| 10 |
/** ensure this file is being included by a parent file */ |
/** ensure this file is being included by a parent file */ |
| 11 |
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); |
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); |
| 12 |
|
|
| 13 |
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botMosPaging' ); |
$this->registerFunction( 'onPrepareContent', 'botMosPaging' ); |
| 14 |
|
|
| 15 |
/** |
/** |
| 16 |
* Page break mambot |
* Page break mambot |
| 26 |
* <code>{mospagebreak heading=The first page&title=The page title}</code> |
* <code>{mospagebreak heading=The first page&title=The page title}</code> |
| 27 |
* |
* |
| 28 |
*/ |
*/ |
| 29 |
function botMosPaging( $published, &$row, &$params, $page=0 ) { |
function botMosPaging( $published, &$row, &$cparams, $page=0, $botparams ) { |
| 30 |
global $mainframe, $Itemid, $database; |
global $mainframe, $Itemid, $database; |
| 31 |
|
|
| 32 |
// expression to search for |
// expression to search for |
| 33 |
$regex = '/{(mospagebreak)\s*(.*?)}/i'; |
$regex = '/{(mospagebreak)\s*(.*?)}/i'; |
| 34 |
|
|
| 35 |
if (!$published || $params->get( 'intro_only' )|| $params->get( 'popup' )) { |
if (!$published || $cparams->get( 'intro_only' )|| $cparams->get( 'popup' )) { |
| 36 |
$row->text = preg_replace( $regex, '', $row->text ); |
$row->text = preg_replace( $regex, '', $row->text ); |
| 37 |
return; |
return; |
| 38 |
} |
} |
| 50 |
// we have found at least one mambot, therefore at least 2 pages |
// we have found at least one mambot, therefore at least 2 pages |
| 51 |
if ($n > 1) { |
if ($n > 1) { |
| 52 |
// load mambot params info |
// load mambot params info |
| 53 |
$query = "SELECT id FROM #__mambots WHERE element = 'mospaging' AND folder = 'content'"; |
$params =& new mosParameters( $botparams ); |
|
$database->setQuery( $query ); |
|
|
$id = $database->loadResult(); |
|
|
$mambot = new mosMambot( $database ); |
|
|
$mambot->load( $id ); |
|
|
$params =& new mosParameters( $mambot->params ); |
|
| 54 |
|
|
| 55 |
$title = $params->def( 'title', 1 ); |
$title = $params->def( 'title', 1 ); |
| 56 |
|
|