本文整理汇总了PHP中FLEXIUtilities::suppressPlugins方法的典型用法代码示例。如果您正苦于以下问题:PHP FLEXIUtilities::suppressPlugins方法的具体用法?PHP FLEXIUtilities::suppressPlugins怎么用?PHP FLEXIUtilities::suppressPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLEXIUtilities
的用法示例。
在下文中一共展示了FLEXIUtilities::suppressPlugins方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
//.........这里部分代码省略.........
// *************************
// MOVED to flexisystem plugin due to ...
/*if (FLEXIUtilities::count_new_hit($item->id) ) {
$model->hit();
}*/
// Load template css/js and set template data variable
$tmplvar = $themes->items->{$ilayout}->tmplvar;
if ($ilayout) {
// Add the templates css files if availables
if (isset($themes->items->{$ilayout}->css)) {
foreach ($themes->items->{$ilayout}->css as $css) {
$document->addStyleSheet($this->baseurl . '/' . $css);
}
}
// Add the templates js files if availables
if (isset($themes->items->{$ilayout}->js)) {
foreach ($themes->items->{$ilayout}->js as $js) {
$document->addScript($this->baseurl . '/' . $js);
}
}
// Set the template var
$tmpl = $themes->items->{$ilayout}->tmplvar;
} else {
$tmpl = '.items.default';
}
// Just put item's text (description field) inside property 'text' in case the events modify the given text,
$item->text = isset($item->fields['text']->display) ? $item->fields['text']->display : '';
// Maybe here not to import all plugins but just those for description field ???
// Anyway these events are usually not very time consuming, so lets trigger all of them ???
JPluginHelper::importPlugin('content');
// Suppress some plugins from triggering for compatibility reasons, e.g.
// (a) jcomments, jom_comment_bot plugins, because we will get comments HTML manually inside the template files
$suppress_arr = array('jcomments', 'jom_comment_bot');
FLEXIUtilities::suppressPlugins($suppress_arr, 'suppress');
// Do some compatibility steps, Set the view and option to 'article' and 'com_content'
JRequest::setVar('view', 'article');
JRequest::setVar('option', 'com_content');
JRequest::setVar("isflexicontent", "yes");
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
// These events return text that could be displayed at appropriate positions by our templates
$item->event = new stdClass();
$results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$params, $limitstart));
$item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$params, $limitstart));
$item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$params, $limitstart));
$item->event->afterDisplayContent = trim(implode("\n", $results));
// Reverse the compatibility steps, set the view and option back to 'items' and 'com_flexicontent'
JRequest::setVar('view', FLEXI_ITEMVIEW);
JRequest::setVar('option', 'com_flexicontent');
// Restore suppressed plugins
FLEXIUtilities::suppressPlugins($suppress_arr, 'restore');
// Put text back into the description field, THESE events SHOULD NOT modify the item text, but some plugins may do it anyway... , so we assign text back for compatibility
if (!empty($item->positions)) {
foreach ($item->positions as $pos_fields) {
foreach ($pos_fields as $pos_field) {
if ($pos_field->name !== 'text') {
continue;
}
$pos_field->display =& $item->text;
}
}
}
$item->fields['text']->display =& $item->text;
// (TOC) TABLE OF Contents has been created inside description field (named 'text') by
// the pagination plugin, this should be assigned to item as a property with same name
示例2: triggerContentPlugins
/**
* Method to selectively trigger content plugins for the text of the specified field
*
* @access public
* @return object
* @since 1.5
*/
static function triggerContentPlugins(&$field, &$item, $method, $view = FLEXI_ITEMVIEW)
{
$debug = false;
static $_plgs_loaded = array();
static $_fields_plgs = array();
static $_initialize = false;
static $_view, $_option, $limitstart;
static $dispatcher, $fcdispatcher;
//$flexiparams = JComponentHelper::getParams('com_flexicontent');
//$print_logging_info = $flexiparams->get('print_logging_info');
// Log content plugin and other performance information
//if ($print_logging_info) global $fc_run_times;
if (!$_initialize) {
// some request and other variables
$_view = JRequest::getVar('view');
$_option = JRequest::getVar('option');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$_initialize = true;
// ***********************************************************************
// We use a custom Dispatcher to allow selective Content Plugin triggering
// ***********************************************************************
require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'dispatcher.php';
$dispatcher = JDispatcher::getInstance();
$fcdispatcher = FCDispatcher::getInstance_FC($debug);
}
if ($debug) {
echo "<br><br>Executing plugins for <b>" . $field->name . "</b>:<br>";
}
if (!@$_fields_plgs[$field->name]) {
// Make sure the necessary plugin are already loaded, but do not try to load them again since this will harm performance
if (!$field->parameters->get('plugins')) {
$_plgs = null;
if (!@$_plgs_loaded['__ALL__']) {
JPluginHelper::importPlugin('content', $plugin = null, $autocreate = true, $dispatcher);
$_plgs_loaded['__ALL__'] = 1;
}
} else {
$_plgs = $field->parameters->get('plugins');
$_plgs = $_plgs ? $_plgs : array();
$_plgs = is_array($_plgs) ? $_plgs : explode('|', $_plgs);
// compatibility because old versions did not JSON encode the parameters
if (!@$_plgs_loaded['__ALL__']) {
foreach ($_plgs as $_plg) {
if (!@$_plgs_loaded[$_plg]) {
JPluginHelper::importPlugin('content', $_plg, $autocreate = true, $dispatcher);
$_plgs_loaded[$_plg] = 1;
}
}
}
}
$_fields_plgs[$field->name] = $_plgs;
}
$plg_arr = $_fields_plgs[$field->name];
// Suppress some plugins from triggering for compatibility reasons, e.g.
// (a) jcomments, jom_comment_bot plugins, because we will get comments HTML manually inside the template files
$suppress_arr = array('jcomments', 'jom_comment_bot');
FLEXIUtilities::suppressPlugins($suppress_arr, 'suppress');
// Initialize field for plugin triggering
$field->text = isset($field->{$method}) ? $field->{$method} : '';
$field->introtext = $field->text;
// needed by some plugins that do not use or clear ->text property
$field->created_by = $item->created_by;
$field->title = $item->title;
$field->slug = isset($item->slug) ? $item->slug : $item->id;
$field->sectionid = !FLEXI_J16GE ? $item->sectionid : false;
$field->catid = $item->catid;
$field->catslug = @$item->categoryslug;
$field->fieldid = $field->id;
$field->id = $item->id;
$field->state = $item->state;
$field->type_id = $item->type_id;
// CASE: FLEXIcontent item view:
// Set triggering 'context' to 'com_content.article', (and also set the 'view' request variable)
if ($view == FLEXI_ITEMVIEW) {
JRequest::setVar('view', 'article');
$context = 'com_content.article';
} else {
JRequest::setVar('view', 'category');
$context = 'com_content.category';
}
// Set the 'option' to 'com_content' but set a flag 'isflexicontent' to indicate triggering from inside FLEXIcontent ... code
JRequest::setVar('option', 'com_content');
JRequest::setVar("isflexicontent", "yes");
// Trigger content plugins on field's HTML display, as if they were a "joomla article"
if (FLEXI_J16GE) {
$results = $fcdispatcher->trigger('onContentPrepare', array($context, &$field, &$item->parameters, $limitstart), $plg_arr);
} else {
$results = $fcdispatcher->trigger('onPrepareContent', array(&$field, &$item->parameters, $limitstart), false, $plg_arr);
}
// Restore 'view' and 'option' request variables
JRequest::setVar('view', $_view);
JRequest::setVar('option', $_option);
$field->id = $field->fieldid;
//.........这里部分代码省略.........
示例3: display
//.........这里部分代码省略.........
// *************************
// MOVED to flexisystem plugin due to ...
/*if (FLEXIUtilities::count_new_hit($item->id) ) {
$model->hit();
}*/
// Load template css/js and set template data variable
$tmplvar = $themes->items->{$ilayout}->tmplvar;
if ($ilayout) {
// Add the templates css files if availables
if (isset($themes->items->{$ilayout}->css)) {
foreach ($themes->items->{$ilayout}->css as $css) {
$document->addStyleSheet($this->baseurl . '/' . $css);
}
}
// Add the templates js files if availables
if (isset($themes->items->{$ilayout}->js)) {
foreach ($themes->items->{$ilayout}->js as $js) {
$document->addScript($this->baseurl . '/' . $js);
}
}
// Set the template var
$tmpl = $themes->items->{$ilayout}->tmplvar;
} else {
$tmpl = '.items.default';
}
// Just put item's text (description field) inside property 'text' in case the events modify the given text,
$item->text = isset($item->fields['text']->display) ? $item->fields['text']->display : '';
// Maybe here not to import all plugins but just those for description field ???
// Anyway these events are usually not very time consuming, so lets trigger all of them ???
JPluginHelper::importPlugin('content');
// Suppress some plugins from triggering for compatibility reasons, e.g.
// (a) jcomments, jom_comment_bot plugins, because we will get comments HTML manually inside the template files
$suppress_arr = array('jcomments', 'jom_comment_bot');
FLEXIUtilities::suppressPlugins($suppress_arr, 'suppress');
// Do some compatibility steps, Set the view and option to 'article' and 'com_content'
JRequest::setVar('view', 'article');
JRequest::setVar('option', 'com_content');
JRequest::setVar("isflexicontent", "yes");
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
// These events return text that could be displayed at appropriate positions by our templates
$item->event = new stdClass();
if (FLEXI_J16GE) {
$results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$params, 0));
} else {
$results = $dispatcher->trigger('onAfterDisplayTitle', array(&$item, &$params, $limitstart));
}
$item->event->afterDisplayTitle = trim(implode("\n", $results));
if (FLEXI_J16GE) {
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$params, 0));
} else {
$results = $dispatcher->trigger('onBeforeDisplayContent', array(&$item, &$params, $limitstart));
}
$item->event->beforeDisplayContent = trim(implode("\n", $results));
if (FLEXI_J16GE) {
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$params, 0));
} else {
$results = $dispatcher->trigger('onAfterDisplayContent', array(&$item, &$params, $limitstart));
}
$item->event->afterDisplayContent = trim(implode("\n", $results));
// Reverse the compatibility steps, set the view and option back to 'items' and 'com_flexicontent'
JRequest::setVar('view', FLEXI_ITEMVIEW);
JRequest::setVar('option', 'com_flexicontent');
// Restore suppressed plugins
FLEXIUtilities::suppressPlugins($suppress_arr, 'restore');
// Put text back into the description field, THESE events SHOULD NOT modify the item text, but some plugins may do it anyway... , so we assign text back for compatibility
if (!empty($item->positions)) {