protected static function _findItemId($needles) { // Prepare the reverse lookup array. if (self::$lookup === null) { self::$lookup = array(); $component =& JComponentHelper::getComponent('com_xmap'); $menus =& JApplication::getMenu('site', array()); $items = $menus->getItems('component_id', $component->id); foreach ($items as &$item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (!isset(self::$lookup[$view])) { self::$lookup[$view] = array(); } if (isset($item->query['id'])) { self::$lookup[$view][$item->query['id']] = $item->id; } } } } $match = null; foreach ($needles as $view => $id) { if (isset(self::$lookup[$view])) { if (isset(self::$lookup[$view][$id])) { return self::$lookup[$view][$id]; } } } return null; }
/** * This method should handle any authentication and report back to the subject * * @access public * @param array $credentials Array holding the user credentials * @param array $options Array of extra options * @param object $response Authentication response object * @return boolean * @since 1.5 */ function onAuthenticate($credentials, $options, &$response) { $message = ''; $success = false; // Check the gateway component is installed $com_otrsgw =& JComponentHelper::getComponent('com_otrsgateway'); if ($com_otrsgw) { // Check that it's configured $gwParams = new JParameter($com_otrsgw->params); include_once JPATH_SITE . DS . 'components' . DS . "com_otrsgateway" . DS . "helpers" . DS . "userhelper.php"; if (strlen($credentials['username']) && strlen($credentials['password'])) { $gateway = new OTRSGatewayUserHelper(); $authData = $gateway->authenticateOTRSUser(trim($credentials['username']), $credentials['password']); if (is_array($authData)) { $success = true; $response->email = $authData[0]; $response->fullname = $authData[1]; } else { $message = 'Access Denied'; } } else { $message = 'Username or password blank'; } } else { $message = "OTRS Gateway is not installed"; } if ($success) { $response->status = JAUTHENTICATE_STATUS_SUCCESS; $response->error_message = ''; } else { $response->status = JAUTHENTICATE_STATUS_FAILURE; $response->error_message = 'Failed to authenticate: ' . $message; } }
/** * Class Constructor * * @param App $app A reference to an App object * @param string $name The name of the component */ public function __construct($app, $name) { $this->app = $app; $this->name = $name; $this->_component = JComponentHelper::getComponent($name); $this->_params = $app->parameter->create($this->_component->params); }
/** * Display the view */ public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Preprocess the list of items to find ordering divisions. foreach ($this->items as &$item) { $this->ordering[$item->parent_id][] = $item->id; } // Levels filter. $options = array(); $options[] = JHtml::_('select.option', '1', JText::_('J1')); $options[] = JHtml::_('select.option', '2', JText::_('J2')); $options[] = JHtml::_('select.option', '3', JText::_('J3')); $options[] = JHtml::_('select.option', '4', JText::_('J4')); $options[] = JHtml::_('select.option', '5', JText::_('J5')); $options[] = JHtml::_('select.option', '6', JText::_('J6')); $options[] = JHtml::_('select.option', '7', JText::_('J7')); $options[] = JHtml::_('select.option', '8', JText::_('J8')); $options[] = JHtml::_('select.option', '9', JText::_('J9')); $options[] = JHtml::_('select.option', '10', JText::_('J10')); $this->f_levels = $options; // Params for administrators $component = JComponentHelper::getComponent('com_content'); $params = $component->params; $showpreview = $params->get('catpreview'); $this->assignRef('catpreview', $showpreview); $this->addToolbar(); parent::display($tpl); }
function save_code() { $code = JREQUEST::getVar('code', '', '', 'string'); $code = addslashes($code); jimport('joomla.form.form'); $params =& JForm::getInstance('params', JPATH_ADMINISTRATOR . '/components/com_muzeetop/config.xml'); $code_activation = $params->getInput('code_activation'); var_dump($code_activation); var_dump($params); $component =& JComponentHelper::getComponent('com_muzeetop'); if ($code != "" and strlen($code) == 8) { $params->setValue('code_activation', $code); var_dump($params); var_dump($code_activation); $parameters = $params->toString(); $db =& JFactory::getDBO(); $donnees = new stdClass(); $donnees->id = $component->id; $donnees->params = $parameters; $db->updateObject('#__components', $donnees, 'id'); if ($db !== false) { $msg = JTEXT::_('COM_MUZEETOP_MSG_CODE_ENREGISTRE'); } else { $msg = JTEXT::_('COM_MUZEETOP_MSG_ERREUR_BASE_CODE'); } } else { $msg = JText::_('COM_MUZEETOP_ERREUR_SAUVEGARDE_CODE'); } $link = 'index.php?option=com_muzeetop'; $this->setRedirect($link, $msg); }
public static function authorize($task) { $user = JFactory::getUser(); // Joomla! 1.7+ if (method_exists('JUser', 'getAuthorisedViewLevels')) { $action = $task == 'admin' || $task == 'manage' ? 'core.' . $task : 'jce.' . $task; if (!$user->authorise($action, 'com_jce')) { return false; } } else { // get rules from parameters $component = JComponentHelper::getComponent('com_jce'); $params = json_decode($component->params); $rules = isset($params->access) ? $params->access : null; if (is_object($rules)) { $action = $task == 'admin' || $task == 'manage' ? 'core.' . $task : 'jce.' . $task; if (isset($rules->{$action})) { $rule = $rules->{$action}; $gid = $user->gid; if (isset($rule->{$gid}) && $rule->{$gid} == 0) { return false; } } } } return true; }
/** * Display the view */ function display() { $model =& $this->getModel(); $params =& $model->getParams(); $component = JComponentHelper::getComponent(JRequest::getCmd('component')); $document =& JFactory::getDocument(); $document->setTitle(JText::_('Edit Preferences')); JHTML::_('behavior.tooltip'); ?> <form action="index.php" method="post" name="adminForm" autocomplete="off"> <fieldset> <div style="float: right"> <button type="button" onclick="submitbutton('save');window.top.setTimeout('window.parent.document.getElementById(\'sbox-window\').close()', 700);"> <?php echo JText::_('Save'); ?> </button> <button type="button" onclick="window.parent.document.getElementById('sbox-window').close();"> <?php echo JText::_('Cancel'); ?> </button> </div> <div class="configuration" > <?php echo JText::_($this->component->name); ?> </div> </fieldset> <fieldset> <legend> <?php echo JText::_('Configuration'); ?> </legend> <?php echo $params->render(); ?> </fieldset> <input type="hidden" name="id" value="<?php echo $this->component->id; ?> " /> <input type="hidden" name="component" value="<?php echo $this->component->option; ?> " /> <input type="hidden" name="controller" value="component" /> <input type="hidden" name="option" value="com_config" /> <input type="hidden" name="tmpl" value="component" /> <input type="hidden" name="task" value="" /> <?php echo JHTML::_('form.token'); ?> </form> <?php }
function fetchElement($name, $value, &$node, $control_name) { global $mainframe; $com_k2 = JComponentHelper::getComponent('com_k2', true); if (!$com_k2->enabled) { return false; } else { $db =& JFactory::getDBO(); $doc =& JFactory::getDocument(); $template = $mainframe->getTemplate(); $fieldName = $control_name . '[' . $name . ']'; $class = $node['class'] ? ' class="' . $node['class'] . '" ' : ''; JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'tables'); $item =& JTable::getInstance('K2Item', 'Table'); if ($value) { $item->load($value); $descr = JText::_('Caution! By selecting a new article it\'ll replace your previous selection. Click to open a modal window and pick your content item.'); } else { $item->title = JText::_('Select an Item'); $descr = JText::_('Click to open a modal window and pick your content item.'); } $js = "\n\t\t\tfunction jSelectItem(id, title) {\n\t\t\tdocument.getElementById('{$control_name}{$name}' + '_id').value = id;\n\t\t\tdocument.getElementById('{$control_name}{$name}' + '_name').value = title;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t};"; $doc->addScriptDeclaration($js); $link = 'index.php?option=com_k2&view=items&task=element&tmpl=component&object=' . $name; //TODO remove shitty inline css JHTML::_('behavior.modal'); $html = '<span class="ui-helper-clearfix ui-resizable"><input type="text" name="' . $control_name . '[' . $name . '_name]" id="' . $control_name . $name . '_name" value="' . $item->title . '" class="text ui-widget-content ui-corner-all ui-state-disabled ui-width 60" disabled="disabled" size="20">'; $html .= '<a href="' . $link . '" title="' . JText::_('Select an Item') . '::' . $descr . '" class="fg-button ui-state-default ui-width-40 fg-button-icon-right modal shadowbox hasTip ui-corner-right text ui-widget-content" rel="{handler:\'iframe\',size:{x:650, y: 375},iframePreload:true}" ><span class="ui-icon ui-icon-newwin"></span>' . htmlspecialchars(JText::_('Select an item from K2'), ENT_QUOTES, 'UTF-8') . '</a> '; $html .= "\n" . '</span><input type="hidden" id="' . $control_name . $name . '_id" name="' . $fieldName . '" value="' . (int) $value . '" />'; } return $html; }
public function load($config) { if (!array_key_exists('component', $config)) { self::$component = $config['extensionName']; } else { self::$component = $config['component']; } if (!array_key_exists('key', $config)) { self::$key = 'liveupdate'; } else { self::$key = $config['key']; } jimport('joomla.html.parameter'); jimport('joomla.application.component.helper'); $component =& JComponentHelper::getComponent(self::$component); if (!$component->params instanceof JRegistry) { $params = new JParameter($component->params); } else { $params = $component->params; } $data = $params->getValue(self::$key, ''); jimport('joomla.registry.registry'); self::$registry = new JRegistry('update'); self::$registry->loadINI($data); }
function edit() { JEVHelper::stylesheet('eventsadmin.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/'); $document =& JFactory::getDocument(); $document->setTitle(JText::_('COM_JEVENTS_CONFIGURATION')); // Set toolbar items for the page JToolBarHelper::title(JText::_('COM_JEVENTS_CONFIGURATION'), 'jevents'); //APPLY BUTTON BY PRAKASH. JToolBarHelper::apply('params.apply'); //APPLY BUTTON JToolBarHelper::save('params.save'); JToolBarHelper::cancel('cpanel.cpanel'); $model = $this->getModel(); $this->params =& $model->getParams(); $component = JComponentHelper::getComponent(JEV_COM_COMPONENT); JHTML::_('behavior.tooltip'); if (JVersion::isCompatible("1.6.0")) { // Get the actions for the asset. $actions = JAccess::getActions(JEV_COM_COMPONENT, "component"); jimport('joomla.form.form'); // Add the search path for the admin component config.xml file. JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . JEV_COM_COMPONENT); // Get the form. $modelForm = $model->getForm(); $this->assignRef("form", $modelForm); } }
function storeKey() { $data = JComponentHelper::getComponent('com_nonumbermanager'); $data = json_decode(json_encode($data), true); if (is_null($data)) { $data = array(); } $data['params']['key'] = JFactory::getApplication()->input->get('key'); $table = JTable::getInstance('extension'); // Load the previous Data if (!$table->load($data['id'])) { throw new RuntimeException($table->getError()); } unset($data['id']); // Bind the data. if (!$table->bind($data)) { throw new RuntimeException($table->getError()); } // Check the data. if (!$table->check()) { throw new RuntimeException($table->getError()); } // Store the data. if (!$table->store()) { throw new RuntimeException($table->getError()); } }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { $state = $this->get('State'); $items = $this->get('Items'); $parent = $this->get('Parent'); $configs = JComponentHelper::getComponent('com_digicom')->params; // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } if ($items === false) { return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND')); } if ($parent == false) { return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND')); } $params =& $state->params; $items = array($parent->id => $items); // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->maxLevelcat = $params->get('maxLevelcat', 1); $this->params =& $params; $this->parent =& $parent; $this->items =& $items; $this->configs =& $configs; $template = new DigiComSiteHelperTemplate($this); $template->rander('categories'); return parent::display($tpl); }
/** * function to retrieve component menuitems only once; */ static function _setMenuitems($language = '*') { // J1.5 has no language in menu items if ( !FLEXI_J16GE ) $language = '*'; // Return already retrieved data if ( isset(self::$menuitems[$language]) ) return self::$menuitems[$language]; // Get user access, this is needed only for J1.5 $user_access = null; if (!FLEXI_J16GE && $user_access===null) { $user = JFactory::getUser(); $user_access = (int) $user->get('aid'); } // Get component $component = JComponentHelper::getComponent('com_flexicontent'); // Get menu items pointing to the Flexicontent component // NOTE: // -- In J1.5 the static method JSite::getMenu() will give an error (in backend), and also an error in J3.2+ // while JFactory::getApplication('site')->getMenu() will not return the frontend menus $menus = JFactory::getApplication()->getMenu('site', array()); // this will work in J1.5 backend too !!! // NOTE: if (!FLEXI_J16GE) { $_menuitems = $menus->getItems('componentid', $component->id); } else { $attribs = array('component_id'); $values = array($component->id); if ($language != '*') { // Limit to given language and ... to language ALL ('*') $attribs[] = 'language'; $values[] = array($language, '*'); } else { // Getting menu items regardless language // A. If language filtering is enabled, then menu items with currently active language - OR - language '*' // B. If language filtering is disabled, then menu items of any language are returned } $_menuitems = $menus->getItems($attribs, $values); } // Assign menu item objects to per language array, and also index by menu id self::$menuitems[$language] = array(); if ($_menuitems) foreach ($_menuitems as $menuitem) { // In J1.5 filter by access levels of current user // In J2.5+ this is already done by JMenuSite::getItems() if (!FLEXI_J16GE && $menuitem->access > $user_access) continue; // Index by menu id self::$menuitems[$language][$menuitem->id] = $menuitem; } return self::$menuitems[$language]; }
/** * Finds The Menu Item Of the Component * by the needles as params * * needle example: 'view' => 'category' * * * @param array $needle * @since 1.5.0 */ static function getMenuItemId($needles) { $component = JComponentHelper::getComponent('com_bids'); $app = JFactory::getApplication(); $menus = $app->getMenu('site',array()); $items = $menus->getItems('component_id', $component->id); $match = null; foreach ($items as $item) { $ok = true; foreach ($needles as $needle => $id) { if (@$item->query[$needle] != $id) { $ok = false; break; } } if ($ok == true) { $match = $item; break; } } if (isset($match)) { return $match->id; }else return null; }
public function &getItemList($overrideLimits = false, $group = '') { if (empty($this->list)) { // make sure ZOO exist if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) { return; } // load zoo require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; // check if Zoo > 2.4 is loaded if (!class_exists('App')) { return; } // Get the ZOO App instance $zoo = App::getInstance('zoo'); $elements = array(); $apps = $zoo->zoo->getApplicationGroups(); $applications = array(); foreach ($apps as $app) { $author = strtolower($app->getMetaData('author')); if ($author == 'zoolanders' || $author == 'joolanders') { $applications[] = $app; } } $this->list = $applications; } return $this->list; }
/** * Display the view * * @return void */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->authors = $this->get('Authors'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Levels filter. $options = array(); $options[] = JHtml::_('select.option', '1', JText::_('J1')); $options[] = JHtml::_('select.option', '2', JText::_('J2')); $options[] = JHtml::_('select.option', '3', JText::_('J3')); $options[] = JHtml::_('select.option', '4', JText::_('J4')); $options[] = JHtml::_('select.option', '5', JText::_('J5')); $options[] = JHtml::_('select.option', '6', JText::_('J6')); $options[] = JHtml::_('select.option', '7', JText::_('J7')); $options[] = JHtml::_('select.option', '8', JText::_('J8')); $options[] = JHtml::_('select.option', '9', JText::_('J9')); $options[] = JHtml::_('select.option', '10', JText::_('J10')); $this->f_levels = $options; // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } // Params for administrators $component = JComponentHelper::getComponent('com_content'); $params = $component->params; $showpreview = $params->get('showpreview'); $this->assignRef('showpreview', $showpreview); parent::display($tpl); }
public static function getTagRoute($id) { $needles = array('tag' => array((int) $id)); if ($id < 1) { $link = ''; } else { if (!empty($needles) && ($item = self::_findItem($needles))) { $link = 'index.php?Itemid=' . $item; } else { // detect tags page $app = JFactory::getApplication(); $menus = $app->getMenu('site'); $component = JComponentHelper::getComponent('com_tags'); $items = $menus->getItems('component_id', $component->id); $itemid = ''; if ($items) { foreach ($items as $item) { if (isset($item->query) && isset($item->query['view']) && $item->query['view'] == 'tags') { $itemid = '&Itemid=' . $item->id; break; } } } // Create the link $link = 'index.php?option=com_tags&view=tag&id=' . $id . $itemid; } } return $link; }
protected static function _findItem($needles) { $component =& JComponentHelper::getComponent('com_content'); $app = JFactory::getApplication(); $menus =& $app->getMenu(); $items = $menus->getItems('component_id', $component->id); $match = null; foreach ($needles as $needle => $id) { if (is_array($id)) { foreach ($id as $tempid) { foreach ($items as $item) { if (@$item->query['view'] == $needle && @$item->query['id'] == $tempid) { $match = $item; break; } } } } else { foreach ($items as $item) { if (@$item->query['view'] == $needle && @$item->query['id'] == $id) { $match = $item; break; } } } if (isset($match)) { break; } } return $match; }
public function __construct(JInputCli $input = null, JRegistry $config = null, JDispatcher $dispatcher = null) { // CLI Constructor parent::__construct($input, $config, $dispatcher); // Utilities $this->db = JFactory::getDBO(); $this->updater = JUpdater::getInstance(); $this->installer = JComponentHelper::getComponent('com_installer'); // Validate Log Path $logPath = $this->config->get('log_path'); if (!is_dir($logPath) || !is_writeable($logPath)) { $logPath = JPATH_BASE . '/logs'; if (!is_dir($logPath) || !is_writeable($logPath)) { $this->out('Log Path not found - ' . $logPath); } $this->config->set('log_path', JPATH_BASE . '/logs'); } // Validate Tmp Path $tmpPath = $this->config->get('tmp_path'); if (!is_writeable($tmpPath)) { $tmpPath = JPATH_BASE . '/tmp'; if (!is_dir($tmpPath) || !is_writeable($tmpPath)) { $this->out('Tmp Path not found - ' . $tmpPath); } $this->config->set('tmp_path', JPATH_BASE . '/tmp'); } // Push to Global Config $config = JFactory::getConfig(); $config->set('tmp_path', $this->config->get('tmp_path')); $config->set('log_path', $this->config->get('log_path')); }
private function _setConfWizStatus() { static $enableconfwiz; $component = JComponentHelper::getComponent('com_akeeba'); if (is_object($component->params) && $component->params instanceof JRegistry) { $params = $component->params; } else { $params = new JParameter($component->params); } if (empty($enableconfwiz)) { $lv = $params->get('lastversion', ''); $enableconfwiz = empty($lv); } $minStability = $params->get('minstability', 'stable'); $acceptlicense = $params->get('acceptlicense', '0'); $acceptsupport = $params->get('acceptsupport', '0'); $acceptbackuptest = $params->get('acceptbackuptest', '0'); $angieupgrade = $params->get('angieupgrade', '0'); $this->enableconfwiz = $enableconfwiz; $this->minstability = $minStability; $this->acceptlicense = $acceptlicense; $this->acceptsupport = $acceptsupport; $this->acceptbackuptest = $acceptbackuptest; $this->showangieupgrade = $angieupgrade == 0; return $enableconfwiz; }
/** * Edit the component parameters */ public function edit($key = null, $urlVar = null) { // Access check. if (!JFactory::getUser()->authorise('core.admin', 'com_attachments')) { return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 117)'); } // Get the component parameters jimport('joomla.application.component.helper'); $params = JComponentHelper::getParams('com_attachments'); // Get the component model/table $model = new ConfigModelComponent(); $state = $model->getState(); $state->set('component.option', 'com_attachments'); $state->set('component.path', JPATH_ADMINISTRATOR . '/components/com_attachments'); $model->setState($state); $form = $model->getForm(); $component = JComponentHelper::getComponent('com_attachments'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors) . ' (ERR 118)'); return false; } // Bind the form to the data. if ($form && $component->params) { $form->bind($component->params); } // Set up the view require_once JPATH_COMPONENT_ADMINISTRATOR . '/views/params/view.html.php'; $view = new AttachmentsViewParams(); $view->setModel($model); $view->params = $params; $view->form = $form; $view->component = $component; $view->display(); }
protected static function _findItem($needles) { // Prepare the reverse lookup array. if (self::$lookup === null) { self::$lookup = array(); $component = JComponentHelper::getComponent('com_temakorok'); $menus = JApplication::getMenu('site'); $field = 'component_id'; $items = $menus->getItems($field, $component->id); foreach ($items as $item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (!isset(self::$lookup[$view])) { self::$lookup[$view] = array(); } if (isset($item->query['id'])) { self::$lookup[$view][$item->query['id']] = $item->id; } } } } foreach ($needles as $view => $ids) { if (isset(self::$lookup[$view])) { foreach ($ids as $id) { if (isset(self::$lookup[$view][(int) $id])) { return self::$lookup[$view][(int) $id]; } } } } return null; }
function authorize($task) { $user = JFactory::getUser(); // Joomla! 1.5 if (isset($user->gid)) { // get rules from parameters $component = JComponentHelper::getComponent('com_jce'); $params = json_decode($component->params); $rules = isset($params->access) ? $params->access : null; if (is_object($rules)) { $action = $task == 'admin' ? 'core.' . $task : 'jce.' . $task; if (isset($rules->{$action})) { $rule = $rules->{$action}; $gid = $user->gid; if (isset($rule->{$gid}) && $rule->{$gid} == 0) { return false; } } } } else { $action = $task == 'admin' ? 'core.' . $task : 'jce.' . $task; if (!$user->authorise($action, 'com_jce')) { return false; } } return true; }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { if (strtolower($route) == 'install') { $element = $adapter->get('element'); // Restore assets from backup PFInstallerHelper::restoreAssets($element); // Make the admin component menu item a child of com_projectfork PFInstallerHelper::setComponentMenuItem($element); // Create a menu item in the projectfork site menu $com = JComponentHelper::getComponent($element); $eid = is_object($com) && isset($com->id) ? $com->id : 0; if ($eid) { $item = array(); $item['title'] = 'Time Tracking'; $item['alias'] = 'timetracking'; $item['link'] = 'index.php?option=' . $element . '&view=timesheet'; $item['component_id'] = $eid; PFInstallerHelper::addMenuItem($item); } } if (strtolower($route) == 'update') { $element = $adapter->get('element'); // Make the admin component menu item a child of com_projectfork PFInstallerHelper::setComponentMenuItem($element); } return true; }
/** * Method to link to a Community Builder user profile page * * @param integer $id The user id * @param string $name The user name * * @return string The profile url */ protected static function communityBuilder($id, $name = null) { static $itemid = null; // Try to find a suitable menu item if (is_null($itemid)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $com = JComponentHelper::getComponent('com_comprofiler'); $items = $menu->getItems('component_id', $com->id); $profile_id = 0; $cb_id = 0; // If no items found, set to empty array. if (!$items) { $items = array(); } foreach ($items as $item) { if (!isset($item->query['task']) || $item->query['task'] == 'userProfile') { $itemid = $item->id; break; } } if (!$itemid) { $itemid = 0; } } // Create slug $slug = (int) $id . (empty($name) ? '' : ':' . $name); // Return link return 'index.php?option=com_comprofiler&task=userProfile&user='******'&Itemid=' . $itemid : ''); }
/** * onAfterInitialise handler * * * @access public * @return null */ public function onAfterInitialise() { // make sure ZOO exists jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) { return; } // load zoo require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; // check if Zoo > 2.4 is loaded if (!class_exists('App')) { return; } // get zoo instance $this->zoo = App::getInstance('zoo'); // check if Zoo > 2.5 if (version_compare($this->zoo->zoo->version(), '2.5') < 0) { return; } // load zoo language file $this->zoo->system->language->load('com_' . $this->zoo->id); // register plugin paths $path = $this->zoo->path->path('plugins:system/herdboyzoo/'); // register element path $this->zoo->path->register($path . '/elements', 'elements'); }
function getItemid($poll_id) { $component = JComponentHelper::getComponent('com_mijopolls'); $menus = JApplication::getMenu('site', array()); if (MijopollsHelper::is15()) { $items = $menus->getItems('componentid', $component->id); } else { $items = $menus->getItems('component_id', $component->id); } $match = false; $item_id = ''; if (isset($items)) { foreach ($items as $item) { if (@$item->query['view'] == 'poll' && @$item->query['id'] == $poll_id) { $itemid = $item->id; $match = true; break; } } } if ($match) { $item_id = '&Itemid=' . $itemid; } return $item_id; }
public function install($parent) { // enable plugin only if ZOO installed and enabled if (file_exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') && JComponentHelper::getComponent('com_zoo', true)->enabled) { JFactory::getDBO()->setQuery("UPDATE `#__extensions` SET `enabled` = 1 WHERE `type` = 'plugin' AND `element` = 'widgetkit_zoo'")->execute(); } }
function _findItem($needles) { static $items; if (!$items) { $component =& JComponentHelper::getComponent('com_weblinks'); $menu =& JSite::getMenu(); $items = $menu->getItems('componentid', $component->id); } if (!is_array($items)) { return null; } $match = null; foreach ($needles as $needle => $id) { foreach ($items as $item) { if (@$item->query['view'] == $needle && @$item->query['id'] == $id) { $match = $item->id; break; } } if (isset($match)) { break; } } return $match; }
/** * */ public static function getItems($option = '') { static $items; if (empty($option)) { $com = DSC::getApp(); $option = 'com_' . $com->getName(); } $app = JApplication::getInstance('site'); $menus = $app->getMenu(); if (empty($menus)) { return array(); } if (empty($items)) { $items = array(); } if (empty($items[$option])) { $component = JComponentHelper::getComponent($option); foreach ($menus->getItems('component', $option) as $item) { if (!is_object($item)) { continue; } if ($item->component_id == $component->id || $item->componentid == $component->id || !empty($item->query['option']) && $item->query['option'] == $option) { $items[$option][] = $item; } } } if (empty($items[$option])) { return array(); } return $items[$option]; }