Source for file pagebreak.php
Documentation is available at pagebreak.php
* @subpackage Content.pagebreak
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
jimport('joomla.utilities.utility');
* <code><hr class="system-pagebreak" /></code>
* <code><hr class="system-pagebreak" title="The page title" /></code>
* <code><hr class="system-pagebreak" alt="The first page" /></code>
* <code><hr class="system-pagebreak" title="The page title" alt="The first page" /></code>
* <code><hr class="system-pagebreak" alt="The first page" title="The page title" /></code>
* @subpackage Content.pagebreak
* Load the language file on instantiation.
* Plugin that adds a pagebreak into the text and truncates text at that point
* @param string $context The context of the content being passed to the plugin.
* @param object &$row The article object. Note $article->text is also available
* @param mixed &$params The article params
* @param integer $page The 'page' number
* @return mixed Always returns void or true
$canProceed =
$context ==
'com_content.article';
$style =
$this->params->get('style', 'pages');
// Expression to search for.
$regex =
'#<hr(.*)class="system-pagebreak"(.*)\/>#iU';
$print =
$input->getBool('print');
$showall =
$input->getBool('showall');
if (!$this->params->get('enabled', 1))
// Simple performance check to determine whether bot should process further.
if (JString::strpos($row->text, 'class="system-pagebreak') ===
false)
$view =
$input->getString('view');
$full =
$input->getBool('fullview');
if ($params->get('intro_only') ||
$params->get('popup') ||
$full ||
$view !=
'article')
// Find all instances of plugin and put in $matches.
if (($showall &&
$this->params->get('showall', 1)))
$hasToc =
$this->params->get('multipage_toc', 1);
$this->_createToc($row, $matches, $page);
// Split the text around the plugin.
// Count the number of pages.
// We have found at least one plugin, therefore at least 2 pages.
$title =
$this->params->get('title', 1);
$hasToc =
$this->params->get('multipage_toc', 1);
// Adds heading or title to <site> Title.
if ($page &&
@$matches[$page -
1][2])
$row->page_title =
$attrs['title'];
// Reset the text, we already hold it in the $text array.
$this->_createToc($row, $matches, $page);
// Traditional mos page navigation
$row->text .=
'<div class="pagenavcounter">';
$row->text .=
$pageNav->getPagesCounter();
$text[$page] =
str_replace('<hr id="system-readmore" />', '', $text[$page]);
$row->text .=
$text[$page];
// $row->text .= '<br />';
$row->text .=
'<div class="pager">';
// Adds navigation between pages to bottom of text.
// Page links shown at bottom of page if TOC disabled.
$row->text .=
$pageNav->getPagesLinks();
$t[] = (string)
JHtml::_($style .
'.start', 'article' .
$row->id .
'-' .
$style);
foreach ($text as $key =>
$subtext)
$match =
$matches[$key -
1];
if (isset
($match['alt']))
elseif (isset
($match['title']))
$title =
JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $key +
1);
$t[] = (string)
JHtml::_($style .
'.panel', $title, 'article' .
$row->id .
'-' .
$style .
$key);
$t[] = (string)
$subtext;
$t[] = (string)
JHtml::_($style .
'.end');
* Creates a Table of Contents for the pagebreak
* @param object &$row The article object. Note $article->text is also available
* @param array &$matches Array of matches of a regex in onContentPrepare
* @param integer &$page The 'page' number
protected function _createTOC(&$row, &$matches, &$page)
$heading = isset
($row->title) ?
$row->title :
JText::_('PLG_CONTENT_PAGEBREAK_NO_TITLE');
$limitstart =
$input->getUInt('limitstart', 0);
$showall =
$input->getInt('showall', 0);
$row->toc .=
'<div class="pull-right article-index">';
if ($this->params->get('article_index') ==
1)
$headingtext =
JText::_('PLG_CONTENT_PAGEBREAK_ARTICLE_INDEX');
if ($this->params->get('article_index_text'))
$row->toc .=
'<h3>' .
$headingtext .
'</h3>';
$class =
($limitstart ===
0 &&
$showall ===
0) ?
'toclink active' :
'toclink';
$row->toc .=
'<ul class="nav nav-tabs nav-stacked">
<li class="' .
$class .
'">
foreach ($matches as $bot)
elseif (@$attrs2['title'])
$title =
JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
$title =
JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
$class =
($limitstart ==
$i -
1) ?
'toclink active' :
'toclink';
<a href="' .
$link .
'" class="' .
$class .
'">'
if ($this->params->get('showall'))
$class =
($showall ==
1) ?
'toclink active' :
'toclink';
<a href="' .
$link .
'" class="' .
$class .
'">'
.
JText::_('PLG_CONTENT_PAGEBREAK_ALL_PAGES') .
$row->toc .=
'</ul></div>';
* Creates the navigation for the item
* @param object &$row The article object. Note $article->text is also available
* @param int $page The total number of pages
* @param int $n The page number
$next =
'<a href="' .
$link_next .
'">' .
JText::_('JNEXT') .
$pnSpace .
JText::_('JGLOBAL_GT') .
JText::_('JGLOBAL_GT') .
'</a>';
$page_prev =
$page -
1 ==
0 ?
'' :
$page -
1;
$prev =
'<a href="' .
$link_prev .
'">' .
JText::_('JGLOBAL_LT') .
JText::_('JGLOBAL_LT') .
$pnSpace .
JText::_('JPREV') .
'</a>';
$row->text .=
'<ul><li>' .
$prev .
' </li><li>' .
$next .
'</li></ul>';
Documentation generated on Tue, 19 Nov 2013 15:10:04 +0100 by phpDocumentor 1.4.3