本文整理汇总了PHP中JPluginHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JPluginHelper类的具体用法?PHP JPluginHelper怎么用?PHP JPluginHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JPluginHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verify
public static function verify() {
if (! self::enabled ())
return true;
$app = JFactory::getApplication ();
$dispatcher = JDispatcher::getInstance ();
$results = $dispatcher->trigger ( 'onCaptchaRequired', array ('kunena.post' ) );
if (! JPluginHelper::isEnabled ( 'system', 'captcha' ) || ! $results [0]) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CAPTCHA_CANNOT_CHECK_CODE' ), 'error' );
return false;
}
if ($results [0]) {
$captchaparams = array (
JRequest::getVar ( 'captchacode', '', 'post' ),
JRequest::getVar ( 'captchasuffix', '', 'post' ),
JRequest::getVar ( 'captchasessionid', '', 'post' ) );
$results = $dispatcher->trigger ( 'onCaptchaVerify', $captchaparams );
if (! $results [0]) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CAPTCHACODE_DO_NOT_MATCH' ), 'error' );
return false;
}
}
return true;
}
示例2: saveOrder
public function saveOrder($pks = array(), $lft = array())
{
JPluginHelper::importPlugin('cck_storage_location');
if (!count($pks)) {
return false;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.id, a.pk, a.storage_location, b.id AS type_id')->from('#__cck_core AS a')->join('LEFT', '#__cck_core_types AS b ON b.name = a.cck')->where('a.id IN (' . implode(',', $pks) . ')');
$db->setQuery($query);
$results = $db->loadAssocList('id');
if (!empty($results)) {
$ids = array();
$location = null;
$user = JCck::getUser();
$user_id = $user->get('id');
foreach ($pks as $i => $pk) {
$canEdit = $user->authorise('core.edit', 'com_cck.form.' . $results[$pk]['type_id']);
$canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $results[$pk]['type_id']);
// Check Permissions
if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $results[$pk]['author_id'] != $user_id || $canEditOwn && $results[$pk]['author_id'] == $user_id)) {
unset($lft[$i]);
continue;
}
$ids[] = $results[$pk]['pk'];
if (null === $location) {
$location = $results[$pk]['storage_location'];
}
}
if ($location && count($ids)) {
return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft));
}
}
return false;
}
示例3: plgAcymailingContentplugin
function plgAcymailingContentplugin(&$subject, $config)
{
parent::__construct($subject, $config);
if (!isset($this->params)) {
$plugin = JPluginHelper::getPlugin('acymailing', 'contentplugin');
$this->params = new acyParameter($plugin->params);
}
$this->paramsContent = JComponentHelper::getParams('com_content');
JPluginHelper::importPlugin('content');
$this->dispatcherContent = JDispatcher::getInstance();
$excludedHandlers = array('plgContentEmailCloak', 'pluginImageShow');
$excludedNames = array('system' => array('SEOGenerator', 'SEOSimple'), 'content' => array('webeecomment', 'highslide', 'smartresizer', 'phocagallery'));
$excludedType = array_keys($excludedNames);
if (!ACYMAILING_J16) {
foreach ($this->dispatcherContent->_observers as $id => $observer) {
if (is_array($observer) and in_array($observer['handler'], $excludedHandlers)) {
$this->dispatcherContent->_observers[$id]['event'] = '';
} elseif (is_object($observer)) {
if (in_array($observer->_type, $excludedType) and in_array($observer->_name, $excludedNames[$observer->_type])) {
$this->dispatcherContent->_observers[$id] = null;
}
}
}
}
if (!class_exists('JSite')) {
include_once ACYMAILING_ROOT . 'includes' . DS . 'application.php';
}
}
示例4: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
protected function getOptions()
{
$options = array();
$params = JComponentHelper::getParams('com_joomdle');
$app = $params->get('activities');
$option = array('value' => 'no', 'text' => JText::_('COM_JOOMDLE_NONE'));
$options[] = $option;
$option = array('value' => 'jomsocial', 'text' => 'Jomsocial');
$options[] = $option;
// Add sources added via plugins
JPluginHelper::importPlugin('joomdleactivities');
$dispatcher = JDispatcher::getInstance();
$more_sources = $dispatcher->trigger('onGetActivitiesSource', array());
if (is_array($more_sources)) {
foreach ($more_sources as $source) {
$keys = array_keys($source);
$key = $keys[0];
$source_name = array_shift($source);
$option['value'] = $key;
$option['text'] = $source_name;
$options[] = $option;
}
}
return $options;
}
示例5: tag
function tag()
{
$doc = JFactory::getDocument();
$doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css'));
JPluginHelper::importPlugin('acymailing');
$dispatcher = JDispatcher::getInstance();
$tagsfamilies = $dispatcher->trigger('acymailing_getPluginType');
$defaultFamily = reset($tagsfamilies);
$app = JFactory::getApplication();
$fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd');
ob_start();
$defaultContents = $dispatcher->trigger($fctplug);
$defaultContent = ob_get_clean();
$js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}';
$js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}';
$js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}';
$js .= 'function hideTagButton(){}';
$js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }';
$doc->addScriptDeclaration($js);
$this->assignRef('fctplug', $fctplug);
$type = JRequest::getString('type', 'news');
$this->assignRef('type', $type);
$this->assignRef('defaultContent', $defaultContent);
$this->assignRef('tagsfamilies', $tagsfamilies);
$app = JFactory::getApplication();
$this->assignRef('app', $app);
$ctrl = JRequest::getString('ctrl');
$this->assignRef('ctrl', $ctrl);
}
示例6: createObserver
public static function createObserver(JObservableInterface $observableObject, $params = array())
{
$observer = new self($observableObject);
$observer->plugin = JPluginHelper::getPlugin('system', 'jds');
$observer->params = new JRegistry($observer->plugin->params);
return $observer;
}
示例7: listing
function listing()
{
JRequest::setVar('tmpl', 'component');
$statsClass = acymailing_get('class.stats');
$statsClass->saveStats();
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header("Expires: Wed, 17 Sep 1975 21:32:10 GMT");
ob_end_clean();
JPluginHelper::importPlugin('acymailing');
$this->dispatcher = JDispatcher::getInstance();
$results = $this->dispatcher->trigger('acymailing_getstatpicture');
$picture = reset($results);
if (empty($picture)) {
$picture = 'media/com_acymailing/images/statpicture.png';
}
$picture = ltrim(str_replace(array('\\', '/'), DS, $picture), DS);
$imagename = ACYMAILING_ROOT . $picture;
$handle = fopen($imagename, 'r');
if (!$handle) {
exit;
}
header("Content-type: image/png");
$contents = fread($handle, filesize($imagename));
fclose($handle);
echo $contents;
exit;
}
示例8: plgContentCpTags
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for
* plugins because func_get_args ( void ) returns a copy of all passed arguments
* NOT references. This causes problems with cross-referencing necessary for the
* observer design pattern.
*/
function plgContentCpTags(&$subject)
{
parent::__construct($subject);
// load plugin parameters
$this->_plugin =& JPluginHelper::getPlugin('content', 'cptags');
$this->_params = new JParameter($this->_plugin->params);
}
示例9: _getArticleHTML
public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $params)
{
JPluginHelper::importPlugin('content');
$dispatcher = JDispatcher::getInstance();
$html = "";
if (!empty($row)) {
$html .= '<div class="joms-app--myarticle">';
$html .= '<ul class="joms-list">';
foreach ($row as $data) {
$text_limit = $params->get('limit', 50);
$result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0));
if (empty($cat[$data->catid])) {
$cat[$data->catid] = "";
}
$data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid;
$link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid);
$created = new JDate($data->created);
$date = CTimeHelper::timeLapse($created);
$html .= ' <li>';
$html .= ' <a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>';
$html .= '<span class="joms-block joms-text--small joms-text--light">' . $date . '</span>';
$html .= ' </li>';
}
$html .= '</ul>';
$showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles');
$html .= "<div class='joms-gap'></div><div class='list-articles--button'><small><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></small></div>";
$html .= '</div>';
} else {
$html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>";
}
return $html;
}
示例10: display
public function display($tpl = null)
{
global $mainframe;
$pathway =& $mainframe->getPathway();
$params =& $mainframe->getParams();
$model = KFactory::get('site::com.picman.model.album');
$album = $model->getItem();
// set Breadcrumbs
$pathway->addItem($album->name);
// set Document data
$document =& JFactory::getDocument();
$document->setMetaData('keywords', $album->metakey);
$document->setMetaData('description', $album->metadesc);
$document->setTitle($album->name);
// Load GData plugin
$plugin =& JPluginHelper::getPlugin('system', 'gdata');
$gdata = new JParameter($plugin->params);
// get Simple XML feed from GData Plugin
$album = "picman_album_" . $album->id;
$query = "kind=photo&access=all&thumbsize=144c&imgmax=512";
$simpleXml = plgSystemGdata::getSimpleXml($album, $query);
$this->assignRef('album', $album);
$this->assignRef('params', $params);
$this->assignRef('simpleXml', $simpleXml);
$this->assignRef('filter', $model->getFilters());
$this->assignRef('pagination', $model->getPagination());
// Display the layout
parent::display($tpl);
}
示例11: getRequiredScope
public function getRequiredScope()
{
if (self::$requiredScope) {
return self::$requiredScope;
}
JPluginHelper::importPlugin('socialprofiles');
$app = JFactory::getApplication();
$args = array('google');
$perms = $app->triggerEvent('socialProfilesGetRequiredScope', $args);
if ($perms) {
foreach ($perms as $permArray) {
self::$requiredScope = array_merge(self::$requiredScope, $permArray);
}
}
$configModel = JFBCFactory::config();
$customPermsSetting = $configModel->getSetting('google_custom_scope');
if ($customPermsSetting != '') {
$customPermsSetting = str_replace("\r\n", ',', $customPermsSetting);
//Separate into an array to be able to merge and then take out duplicates
$customPerms = explode(',', $customPermsSetting);
foreach ($customPerms as $customPerm) {
self::$requiredScope[] = trim($customPerm);
}
}
self::$requiredScope = array_unique(self::$requiredScope);
self::$requiredScope = implode(",", self::$requiredScope);
return self::$requiredScope;
}
示例12: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
// Base name of the HTML control.
$ctrl = $control_name . '[' . $name . ']';
// Construct the various argument calls that are supported.
$attribs = ' ';
if ($v = $node->attributes('size')) {
$attribs .= 'size="' . $v . '"';
}
if ($v = $node->attributes('class')) {
$attribs .= 'class="' . $v . '"';
} else {
$attribs .= 'class="inputbox"';
}
if ($m = $node->attributes('multiple')) {
$attribs .= ' multiple="multiple"';
$ctrl .= '[]';
}
//get plugin name (plugin entryfile name)
$element = $node->attributes('element');
$db =& JFactory::getDBO();
//get plugin params from #__plugins table
$plugin = JPluginHelper::getPlugin('emailalerts', $element);
if (!empty($plugin)) {
$pluginParams = new JParameter($plugin->params);
$pluginParamsDefault = $pluginParams->_raw;
//example: plugintitle=K2-Latest Items category=1|3|4|5|2 no_of_items=5 catid=1|3|4|5|2
$new1 = explode("\n", $pluginParamsDefault);
$new2 = explode("=", $new1[2]);
$cats = str_replace('|', ',', $new2[1]);
if ($cats) {
$sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman' AND id IN (" . $cats . ")";
} else {
//if no category is yet selected
$sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman'";
}
} else {
//if plugin is not yet enabled load all categories
$sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman'";
}
$db->setQuery($sql);
// Query items for list.
$key = $node->attributes('key_field') ? $node->attributes('key_field') : 'value';
$val = $node->attributes('value_field') ? $node->attributes('value_field') : $name;
$options = array();
foreach ($node->children() as $option) {
$options[] = array($key => $option->attributes('value'), $val => $option->data());
}
$rows = $db->loadAssocList();
if ($rows) {
foreach ($rows as $row) {
$options[] = array($key => $row[$key], $val => $row[$val]);
}
}
if ($options) {
return JHTML::_('select.genericlist', $options, $ctrl, $attribs, $key, $val, $value, $control_name . $name);
} else {
return JText::_('NO_CATS_USER');
}
}
示例13: onStylesSave
public function onStylesSave(Event $event)
{
\JPluginHelper::importPlugin('gantry5');
// Trigger the onGantryThemeUpdateCss event.
$dispatcher = \JEventDispatcher::getInstance();
$dispatcher->trigger('onGantry5UpdateCss', ['theme' => $event->theme]);
}
示例14: NextendSliderWidgets
function NextendSliderWidgets($slider, $id)
{
$this->_slider = $slider;
$this->_id = $id;
$this->_widgets = array();
$this->_enabledWidgets = array();
$params = $this->_slider->_sliderParams;
if ($slider->_backend) {
return;
}
$plugins = array();
NextendPlugin::callPlugin('nextendsliderwidget', 'onNextendSliderWidgetList', array(&$plugins));
foreach ($plugins as $k => $v) {
$widget = $params->get('widget' . $k);
$display = NextendParse::parse($params->get('widget' . $k . 'display', '0|*|always|*|0|*|0'));
if ($widget != '' && (isset($display[0]) && intval($display[0]) || isset($display[2]) && intval($display[2]) || isset($display[3]) && intval($display[3]))) {
$this->_enabledWidgets[$k] = $widget;
}
}
foreach ($this->_enabledWidgets as $k => $v) {
if (nextendIsJoomla()) {
JPluginHelper::importPlugin('nextendsliderwidget' . $k);
}
$class = 'plgNextendSliderWidget' . $k . $v;
if (class_exists($class, false)) {
$this->_widgets[$k] = call_user_func(array($class, 'render'), $slider, $id, $params);
}
}
}
示例15: display
function display($tpl = null)
{
JHTML::_('behavior.modal');
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$model = $this->getModel();
$params = Djcatalog2Helper::getParams();
$menus = $app->getMenu('site');
$menu = $menus->getActive();
$dispatcher = JDispatcher::getInstance();
$categories = Djc2Categories::getInstance(array('state' => '1'));
$item = $model->getData();
/* If Item not published set 404 */
if ($item->id == 0 || !$item->published) {
throw new Exception(JText::_('COM_DJCATALOG2_PRODUCT_NOT_FOUND'), 404);
}
/* plugins */
JPluginHelper::importPlugin('djcatalog2');
$results = $dispatcher->trigger('onPrepareItemDescription', array(&$item, &$params, 0));
$this->assignref('categories', $categories);
$this->assignref('item', $item);
$this->assignref('images', $images);
$this->assignref('params', $params);
$this->_prepareDocument();
parent::display($tpl);
}