本文整理汇总了PHP中JComponentHelper::getComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP JComponentHelper::getComponent方法的具体用法?PHP JComponentHelper::getComponent怎么用?PHP JComponentHelper::getComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JComponentHelper
的用法示例。
在下文中一共展示了JComponentHelper::getComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
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;
}
示例2: install
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();
}
}
示例3: onAfterInitialise
/**
* 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');
}
示例4: _findItem
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;
}
示例5: _findItemId
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;
}
示例6: getItems
/**
*
*/
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];
}
示例7: _setConfWizStatus
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;
}
示例8: load
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);
}
示例9: getTagRoute
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;
}
示例10: storeKey
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());
}
}
示例11: edit
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);
}
}
示例12: display
/**
* 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);
}
示例13: _setMenuitems
/**
* 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];
}
示例14: getMenuItemId
/**
* 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;
}
示例15: display
/**
* 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);
}