function save(&$element) { $old = $this->get($element->tax_namekey); JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $do = true; if (!empty($old)) { $element->old =& $old; $dispatcher->trigger('onBeforeTaxUpdate', array(&$element, &$do)); } else { $dispatcher->trigger('onBeforeTaxCreate', array(&$element, &$do)); } if (!$do) { return false; } if (!empty($old)) { $result = parent::save($element); } else { $this->database->setQuery($this->_getInsert($this->getTable(), $element)); $result = $this->database->query(); } if (!empty($old)) { $dispatcher->trigger('onAfterTaxUpdate', array(&$element)); } else { $dispatcher->trigger('onAfterTaxCreate', array(&$element)); } return $result; }
function sendMemberDaytimeToAdmin($member_id, $service_id, $daytime_id) { define("BodyMemberDaytimeToAdmin", "<h1>Nouvelle inscription à une tranche horaire</h1><p>Un bénévole s'est inscrit à un secteur / tranche horaire.</p><p><strong>Nom :</strong> %s <br /><strong>Secteur :</strong> %s<br /><strong>Date :</strong> %s<br /><strong>Tranche horaire :</strong> %s</p><p><a href=\"" . JURI::root() . "/administrator/index.php?option=com_estivole&view=member&layout=edit&member_id=%s\">Cliquez ici</a> pour valider l'inscription et/ou recontacter le bénévole.</p>"); define("SubjectMemberDaytimeToAdmin", "Nouvelle inscription à une tranche horaire"); $db = JFactory::getDBO(); $query = $db->getQuery(TRUE); $this->user = JFactory::getUser(); // Get the dispatcher and load the user's plugins. $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('user'); $data = new JObject(); $data->id = $this->user->id; // Trigger the data preparation event. $dispatcher->trigger('onContentPrepareData', array('com_users.profilestivole', &$data)); $userProfilEstivole = $data; $userName = $userProfilEstivole->profilestivole['firstname'] . ' ' . $userProfilEstivole->profilestivole['lastname']; $query->select('*'); $query->from('#__estivole_members as b, #__estivole_services as s, #__estivole_daytimes as d'); $query->where('b.member_id = ' . (int) $member_id); $query->where('s.service_id = ' . (int) $service_id); $query->where('d.daytime_id = ' . (int) $daytime_id); $db->setQuery($query); $mailModel = $db->loadObject(); $mail = JFactory::getMailer(); $mail->setBody(sprintf(constant("BodyMemberDaytimeToAdmin"), $userName, $mailModel->service_name, date('d-m-Y', strtotime($mailModel->daytime_day)), date('H:i', strtotime($mailModel->daytime_hour_start)) . ' - ' . date('H:i', strtotime($mailModel->daytime_hour_end)), $mailModel->member_id)); $mail->setSubject(constant("SubjectMemberDaytimeToAdmin")); $mail->isHtml(); $recipient = array('*****@*****.**', $mailModel->email_responsable); $mail->addRecipient($recipient); $mail->Send('*****@*****.**'); }
/** * Helper method to return button list. * * This method returns the array by reference so it can be * used to add custom buttons or remove default ones. * * @param JRegistry The module parameters. * * @return array An array of buttons * @since 1.6 */ public static function &getButtons($params) { $key = (string) $params; if (!isset(self::$buttons[$key])) { $context = $params->get('context', 'mod_quickicon'); if ($context == 'mod_quickicon') { // Load mod_quickicon language file in case this method is called before rendering the module JFactory::getLanguage()->load('mod_quickicon'); self::$buttons[$key] = array(array('link' => JRoute::_('index.php?option=com_content&task=article.add'), 'image' => 'header/icon-48-article-add.png', 'text' => JText::_('MOD_QUICKICON_ADD_NEW_ARTICLE'), 'access' => array('core.manage', 'com_content', 'core.create', 'com_content')), array('link' => JRoute::_('index.php?option=com_content'), 'image' => 'header/icon-48-article.png', 'text' => JText::_('MOD_QUICKICON_ARTICLE_MANAGER'), 'access' => array('core.manage', 'com_content')), array('link' => JRoute::_('index.php?option=com_categories&extension=com_content'), 'image' => 'header/icon-48-category.png', 'text' => JText::_('MOD_QUICKICON_CATEGORY_MANAGER'), 'access' => array('core.manage', 'com_content')), array('link' => JRoute::_('index.php?option=com_media'), 'image' => 'header/icon-48-media.png', 'text' => JText::_('MOD_QUICKICON_MEDIA_MANAGER'), 'access' => array('core.manage', 'com_media')), array('link' => JRoute::_('index.php?option=com_menus'), 'image' => 'header/icon-48-menumgr.png', 'text' => JText::_('MOD_QUICKICON_MENU_MANAGER'), 'access' => array('core.manage', 'com_menus')), array('link' => JRoute::_('index.php?option=com_users'), 'image' => 'header/icon-48-user.png', 'text' => JText::_('MOD_QUICKICON_USER_MANAGER'), 'access' => array('core.manage', 'com_users')), array('link' => JRoute::_('index.php?option=com_modules'), 'image' => 'header/icon-48-module.png', 'text' => JText::_('MOD_QUICKICON_MODULE_MANAGER'), 'access' => array('core.manage', 'com_modules')), array('link' => JRoute::_('index.php?option=com_installer'), 'image' => 'header/icon-48-extension.png', 'text' => JText::_('MOD_QUICKICON_EXTENSION_MANAGER'), 'access' => array('core.manage', 'com_installer')), array('link' => JRoute::_('index.php?option=com_languages'), 'image' => 'header/icon-48-language.png', 'text' => JText::_('MOD_QUICKICON_LANGUAGE_MANAGER'), 'access' => array('core.manage', 'com_languages')), array('link' => JRoute::_('index.php?option=com_config'), 'image' => 'header/icon-48-config.png', 'text' => JText::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'), 'access' => array('core.manage', 'com_config', 'core.admin', 'com_config')), array('link' => JRoute::_('index.php?option=com_templates'), 'image' => 'header/icon-48-themes.png', 'text' => JText::_('MOD_QUICKICON_TEMPLATE_MANAGER'), 'access' => array('core.manage', 'com_templates')), array('link' => JRoute::_('index.php?option=com_admin&task=profile.edit&id=' . JFactory::getUser()->id), 'image' => 'header/icon-48-user-profile.png', 'text' => JText::_('MOD_QUICKICON_PROFILE'), 'access' => true)); } else { self::$buttons[$key] = array(); } // Include buttons defined by published quickicon plugins JPluginHelper::importPlugin('quickicon'); $app = JFactory::getApplication(); $arrays = (array) $app->triggerEvent('onGetIcons', array($context)); foreach ($arrays as $response) { foreach ($response as $icon) { $default = array('link' => null, 'image' => 'header/icon-48-config.png', 'text' => null, 'access' => true); $icon = array_merge($default, $icon); if (!is_null($icon['link']) && !is_null($icon['text'])) { self::$buttons[$key][] = $icon; } } } } return self::$buttons[$key]; }
/** * Helper method to return button list. * * This method returns the array by reference so it can be * used to add custom buttons or remove default ones. * * @param JRegistry The module parameters. * * @return array An array of buttons * @since 1.6 */ public static function &getButtons($params) { $key = (string) $params; if (!isset(self::$buttons[$key])) { $context = $params->get('context', 'mod_pj_quickicon'); if ($context == 'mod_pj_quickicon') { // Load mod_quickicon language file in case this method is called before rendering the module JFactory::getLanguage()->load('mod_pj_quickicon'); self::$buttons[$key] = array(array('link' => JRoute::_('index.php?option=com_playjoom&view=audiotracks'), 'params' => null, 'id' => null, 'imagePath' => null, 'image' => ' fa fa-list-alt', 'text' => JText::_('MOD_PJ_QUICKICON_TRACKSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=media'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-music', 'text' => JText::_('MOD_PJ_QUICKICON_ADD_TRACKS'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=artists'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-users', 'text' => JText::_('MOD_PJ_QUICKICON_ARTISTSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=albums'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-picture-o', 'text' => JText::_('MOD_PJ_QUICKICON_ALBUMSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=covers'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-file-image-o', 'text' => JText::_('MOD_PJ_QUICKICON_COVERSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_categories&view=categories&extension=com_playjoom'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-folder-o', 'text' => JText::_('MOD_PJ_QUICKICON_GENRESMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_CATEGORIES'), array('link' => JRoute::_('index.php?option=com_categories&view=categories&extension=com_playjoom.playlist'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-play', 'text' => JText::_('MOD_PJ_QUICKICON_PLAYLISTSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_CATEGORIES'), array('link' => JRoute::_('index.php?option=com_categories&view=categories&extension=com_playjoom.trackfilter'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-filter', 'text' => JText::_('MOD_PJ_QUICKICON_TRACKFILTERMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_CATEGORIES')); //Get user objects $user = JFactory::getUser(); if ($user->authorise('core.admin', 'com_playjoom')) { $PJbuttons = array(array('link' => JRoute::_('index.php?option=com_users'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-user', 'text' => JText::_('MOD_QUICKICON_USER_MANAGER'), 'access' => array('core.manage', 'com_users'), 'group' => 'MOD_PJ_QUICKICON_USERS'), array('link' => JRoute::_('index.php?option=com_config'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-cogs', 'text' => JText::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'), 'access' => array('core.manage', 'com_config', 'core.admin', 'com_config'), 'group' => 'MOD_PJ_QUICKICON_CONFIGURATIONS'), array('link' => JRoute::_('index.php?option=com_config&view=component&component=com_playjoom'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-cog', 'text' => JText::_('MOD_PJ_QUICKICON_PLAYJOOM_OPTIONS'), 'access' => array('core.manage', 'com_config', 'core.admin', 'com_config'), 'group' => 'MOD_PJ_QUICKICON_CONFIGURATIONS')); //Marge standard icons with PlayJoom admin icons self::$buttons[$key] = array_merge(self::$buttons[$key], $PJbuttons); // Include buttons defined by published quickicon plugins JPluginHelper::importPlugin('quickicon'); $app = JFactory::getApplication(); $arrays = (array) $app->triggerEvent('onGetIcons', array($context)); foreach ($arrays as $response) { foreach ($response as $icon) { $default = array('link' => null, 'image' => 'cog', 'text' => null, 'access' => true, 'group' => 'MOD_QUICKICON_EXTENSIONS'); $icon = array_merge($default, $icon); if (!is_null($icon['link']) && !is_null($icon['text'])) { self::$buttons[$key][] = $icon; } } } } } else { self::$buttons[$key] = array(); } } return self::$buttons[$key]; }
/** * 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; }
function plugin_init() { //invoke plugins. JPluginHelper::importPlugin('civicrm'); $app =& JFactory::getApplication(); $app->triggerEvent('onCiviLoad'); }
/** * Method to display a view. * * @param boolean If true, the view output will be cached * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { JPluginHelper::importPlugin('content'); $vName = JRequest::getCmd('view', 'images'); switch ($vName) { case 'imagesList': $mName = 'list'; $vLayout = JRequest::getCmd('layout', 'default'); break; case 'images': default: $vLayout = JRequest::getCmd('layout', 'default'); $mName = 'manager'; $vName = 'images'; break; } $document = JFactory::getDocument(); $vType = $document->getType(); // Get/Create the view $view = $this->getView($vName, $vType); $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . '/views/' . strtolower($vName) . '/tmpl'); // Get/Create the model if ($model = $this->getModel($mName)) { // Push the model into the view (as default) $view->setModel($model, true); } // Set the layout $view->setLayout($vLayout); // Display the view $view->display(); return $this; }
function approve(&$pks, $value = 1) { // Initialise variables. $dispatcher = JDispatcher::getInstance(); $user = JFactory::getUser(); $table = $this->getTable('phocagalleryuser'); $pks = (array) $pks; // Include the content plugins for the change of state event. JPluginHelper::importPlugin('content'); // Access checks. foreach ($pks as $i => $pk) { if ($table->load($pk)) { if (!$this->canEditState($table)) { // Prune items that you can't change. unset($pks[$i]); JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDIT_STATE_NOT_PERMITTED')); } } } // Attempt to change the state of the records. if (!$table->approve($pks, $value, $user->get('id'))) { $this->setError($table->getError()); return false; } $context = $this->option . '.' . $this->name; // Trigger the onContentChangeState event. /*$result = $dispatcher->trigger($this->event_change_state, array($context, $pks, $value)); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; }*/ return true; }
function load($type = '') { $this->allValues = array(); $this->allValues["text"] = JText::_('K2STORE_TEXT'); $this->allValues["email"] = JText::_('K2STORE_EMAIL'); // $this->allValues["link"] = JText::_('K2STORE_LINK'); $this->allValues["textarea"] = JText::_('K2STORE_TEXTAREA'); $this->allValues["wysiwyg"] = JText::_('K2STORE_WYSIWYG'); $this->allValues["radio"] = JText::_('K2STORE_RADIO'); $this->allValues["checkbox"] = JText::_('K2STORE_CHECKBOX'); $this->allValues["singledropdown"] = JText::_('K2STORE_SINGLEDROPDOWN'); // $this->allValues["multipledropdown"] = JText::_('K2STORE_MULTIPLEDROPDOWN'); $this->allValues["zone"] = JText::_('K2STORE_ZONE'); $this->allValues["date"] = JText::_('K2STORE_DATE'); $this->allValues["time"] = JText::_('K2STORE_TIME'); $this->allValues["datetime"] = JText::_('K2STORE_DATETIME'); $this->allValues["customtext"] = JText::_('K2STORE_CUSTOM_TEXT'); if ($this->externalValues == null) { $this->externalValues = array(); JPluginHelper::importPlugin('k2store'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onK2StoreFieldsLoad', array(&$this->externalValues)); if (!empty($this->externalValues)) { foreach ($this->externalValues as $value) { if (substr($value->name, 0, 4) != 'plg.') { $value->name = 'plg.' . $value->name; } $this->allValues[$value->name] = $value->text; } } } }
function loadJoomlaList() { JPluginHelper::importPlugin('nextendmenutheme'); $dispatcher = JDispatcher::getInstance(); $this->_list = array(); $results = $dispatcher->trigger('onNextendMenuThemeList', array(&$this->_list)); }
/** * Ajax action called from element * 11/07/2011 - I've updated things so that any plugin ajax call uses 'view=plugin' rather than controller=plugin * this means that the controller used is now plugin.php and not plugin.raw.php * * @return null */ public function pluginAjax() { $app = JFactory::getApplication(); $input = $app->input; $plugin = $input->get('plugin', ''); $method = $input->get('method', ''); $group = $input->get('g', 'element'); /** * $$$ hugh - playing around trying to fix a viz AJAX issue, figured we might need * to set up the dispatcher first and pass it to importPlugin, which doesn't hurt, but * didn't fix the issue. But leaving these two lines, as I think this might be necessary * at some point, to get the methods into the dispatcher? * * $dispatcher = JDispatcher::getInstance(); * if (!JPluginHelper::importPlugin('fabrik_'.$group, $plugin, true, $dispatcher)) */ if (!JPluginHelper::importPlugin('fabrik_' . $group, $plugin)) { $o = new stdClass(); $o->err = 'unable to import plugin fabrik_' . $group . ' ' . $plugin; echo json_encode($o); return; } if (substr($method, 0, 2) !== 'on') { $method = 'on' . JString::ucfirst($method); } $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger($method); }
function onAfterRoute() { if (defined('T3_PLUGIN')) { T3Bot::preload(); $template = T3::detect(); if ($template) { // load the language $this->loadLanguage(); T3Bot::beforeInit(); T3::init($template); T3Bot::afterInit(); //load T3 plugins JPluginHelper::importPlugin('t3'); if (is_file(T3_TEMPLATE_PATH . '/templateHook.php')) { include_once T3_TEMPLATE_PATH . '/templateHook.php'; } $tplHookCls = preg_replace('/(^[^A-Z_]+|[^A-Z0-9_])/i', '', T3_TEMPLATE . 'Hook'); $dispatcher = JDispatcher::getInstance(); if (class_exists($tplHookCls)) { new $tplHookCls($dispatcher, array()); } $dispatcher->trigger('onT3Init'); //check and execute the t3action T3::checkAction(); //check and change template for ajax T3::checkAjax(); } } }
/** * Prepare message actions display. * * @return void */ protected function before() { parent::before(); $catid = $this->input->getInt('id'); $me = KunenaUserHelper::getMyself(); $this->category = KunenaForumCategory::getInstance($catid); $token = JSession::getFormToken(); $task = "index.php?option=com_kunena&view=category&task=%s&catid={$catid}&{$token}=1"; $layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}"; $this->template = KunenaFactory::getTemplate(); $this->categoryButtons = new JObject(); // Is user allowed to post new topic? if ($this->category->getNewTopicCategory()->exists()) { $this->categoryButtons->set('create', $this->getButton(sprintf($layout, 'create'), 'create', 'topic', 'communication', true)); } // Is user allowed to mark forums as read? if ($me->exists()) { $this->categoryButtons->set('markread', $this->getButton(sprintf($task, 'markread'), 'markread', 'category', 'user', true)); } // Is user allowed to subscribe category? if ($this->category->isAuthorised('subscribe')) { $subscribed = $this->category->getSubscribed($me->userid); if (!$subscribed) { $this->categoryButtons->set('subscribe', $this->getButton(sprintf($task, 'subscribe'), 'subscribe', 'category', 'user', true)); } else { $this->categoryButtons->set('unsubscribe', $this->getButton(sprintf($task, 'unsubscribe'), 'unsubscribe', 'category', 'user', true)); } } JPluginHelper::importPlugin('kunena'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onKunenaGetButtons', array('category.action', $this->categoryButtons, $this)); }
function __construct($config = array()) { parent::__construct($config); JPluginHelper::importPlugin('jshoppingcheckout'); JPluginHelper::importPlugin('jshoppingorder'); JDispatcher::getInstance()->trigger('onConstructJshoppingControllerUser', array(&$this)); }
/** * Funkce pro načtení dat 1 článku z databáze */ private function prepareArticleDB($articleId, $text = 'all', $skipPlugins = false) { $db =& JFactory::getDBO(); $db->setQuery("SELECT * FROM #__content WHERE id='{$articleId}' LIMIT 1;"); $rows = $db->loadObjectList(); if (count($rows) == 1) { $article = $rows[0]->introtext . $rows[0]->fulltext; } else { return false; } //připravíme text if ($text == 'introtext') { $rows[0]->text = $rows[0]->introtext; } elseif ($text == 'fulltext') { $rows[0]->text = $rows[0]->fulltext; } else { $rows[0]->text = $rows[0]->introtext . $rows[0]->fulltext; } if (!$skipPlugins) { $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin("content"); //naimportujeme všechny pluginy pro zpracování obsahu $rows[0]->parameters = new JParameter($rows[0]->attribs); //vytvoříme objekt s parametry článku $results = $dispatcher->trigger('onPrepareContent', array(&$rows[0], &$rows[0]->parameters, 0)); //načtení pluginů } /*nahradíme event. špatný tvar komentářů*/ $rows[0]->text = str_replace('<!--gInclude{', '<!-- gInclude{', $rows[0]->text); $rows[0]->text = str_replace('}-->', '} -->', $rows[0]->text); /**/ return $rows[0]; }
public function render() { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $app->loadDocument($document); $params = array('template' => $app->get('theme'), 'file' => $app->get('themeFile', 'index.php'), 'params' => $app->get('themeParams'), 'directory' => self::getThemesDirectory()); // Parse the document. $document->parse($params); // Trigger the onBeforeRender event. JPluginHelper::importPlugin('system'); $app->triggerEvent('onBeforeRender'); $caching = false; if ($app->isSite() && $app->get('caching') && $app->get('caching', 2) == 2 && !JFactory::getUser()->get('id')) { $caching = true; } // Render the document. $data = $document->render($caching, $params); // Set the application output data. $app->setBody($data); // Trigger the onAfterRender event. $app->triggerEvent('onAfterRender'); // Mark afterRender in the profiler. // Causes issues, so commented out. // JDEBUG ? $app->profiler->mark('afterRender') : null; }
static function render() { $app = JFactory::getApplication(); $options = array(); // Setup the document options. $options['template'] = $app->get('theme'); $options['file'] = $app->get('themeFile', 'index.php'); $options['params'] = $app->get('themeParams'); if ($app->get('themes.base')) { $options['directory'] = $app->get('themes.base'); } else { $options['directory'] = defined('JPATH_THEMES') ? JPATH_THEMES : (defined('JPATH_BASE') ? JPATH_BASE : __DIR__) . '/themes'; } // Parse the document. JFactory::getDocument()->parse($options); // Trigger the onBeforeRender event. JPluginHelper::importPlugin('system'); $app->triggerEvent('onBeforeRender'); $caching = false; if ($app->isSite() && $app->get('caching') && $app->get('caching', 2) == 2 && !JFactory::getUser()->get('id')) { $caching = true; } // Render the document. $data = JFactory::getDocument()->render($caching, $options); // Set the application output data. $app->setBody($data); // Trigger the onAfterRender event. $app->triggerEvent('onAfterRender'); // Mark afterRender in the profiler. // Causes issues, so commented out. // JDEBUG ? $app->profiler->mark('afterRender') : null; }
/** * Prepare reply history display. * * @return void */ protected function before() { parent::before(); $id = $this->input->getInt('id'); $this->topic = KunenaForumTopicHelper::get($id); $this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC'); $this->replycount = $this->topic->getReplies(); $this->historycount = count($this->history); KunenaAttachmentHelper::getByMessage($this->history); $userlist = array(); foreach ($this->history as $message) { $userlist[(int) $message->userid] = (int) $message->userid; } KunenaUserHelper::loadUsers($userlist); // Run events $params = new JRegistry(); $params->set('ksource', 'kunena'); $params->set('kunena_view', 'topic'); $params->set('kunena_layout', 'history'); $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('kunena'); $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0)); // FIXME: need to improve BBCode class on this... $this->attachments = KunenaAttachmentHelper::getByMessage($this->history); $this->inline_attachments = array(); $this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject; }
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); }
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); } } }
/** * Constructor * * @access protected */ function __construct() { $isLoaded = JPluginHelper::importPlugin('authentication'); if (!$isLoaded) { JError::raiseWarning('SOME_ERROR_CODE', JText::_('JAuthentication::__construct: Could not load authentication libraries.')); } }
public function onStylesSave(Event $event) { \JPluginHelper::importPlugin('gantry5'); // Trigger the onGantryThemeUpdateCss event. $dispatcher = \JEventDispatcher::getInstance(); $dispatcher->trigger('onGantry5UpdateCss', ['theme' => $event->theme]); }
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; }
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; }
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); }
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; }
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; }
function _form($tpl = null) { parent::_form($tpl); // load the plugin $row = $this->getModel()->getItem(); $import = JPluginHelper::importPlugin('Citruscart', $row->element); }
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'; } }
/** * Load the editor * * @access private * @param array Associative array of editor config paramaters * @since 1.5 */ function _loadEditor($config = array()) { //check if editor is already loaded if (!is_null($this->_editor)) { return; } jimport('joomla.filesystem.file'); // Build the path to the needed editor plugin $name = JFilterInput::clean($this->_name, 'cmd'); $path = JPATH_SITE . DS . 'plugins' . DS . 'editors' . DS . $name . '.php'; if (!JFile::exists($path)) { $message = JText::_('Cannot load the editor'); JCKHelper::error($message); return false; } // Require plugin file require_once $path; // Build editor plugin classname $name = 'plgEditor' . $this->_name; if ($this->_editor = new $name($this, $config)) { // load plugin parameters $this->initialise(); JPluginHelper::importPlugin('editors-xtd'); } }