当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::load方法代码示例

本文整理汇总了PHP中Component::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::load方法的具体用法?PHP Component::load怎么用?PHP Component::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Component的用法示例。


在下文中一共展示了Component::load方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getComponent

 /**
  * Get the component information.
  *
  * @param   string   $option  The component option.
  * @param   boolean  $strict  If set and the component does not exist, the enabled attribute will be set to false.
  *
  * @return  object   An object with the information for the component.
  *
  * @since   11.1
  */
 public static function getComponent($option, $strict = false)
 {
     if (!self::isLegacy()) {
         return \Component::load($option, $strict);
     }
     if (!isset(self::$components[$option])) {
         if (self::_load($option)) {
             $result = self::$components[$option];
         } else {
             $result = new stdClass();
             $result->enabled = $strict ? false : true;
             $result->params = new JRegistry();
         }
     } else {
         $result = self::$components[$option];
     }
     return $result;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:28,代码来源:helper.php

示例2: build

 /**
  * Build the route for the component.
  *
  * @param   array  &$query  An array of URL arguments
  * @return  array  The URL arguments to use to assemble the subsequent URL.
  */
 public function build(&$query)
 {
     static $items;
     $segments = array();
     $itemid = null;
     // Break up the poll id into numeric and alias values.
     if (isset($query['id']) && strpos($query['id'], ':')) {
         list($query['id'], $query['alias']) = explode(':', $query['id'], 2);
     }
     // Get the menu items for this component.
     if (!$items) {
         $menu = \App::get('menu');
         $component = Component::load('com_poll');
         $items = $menu->getItems('component_id', $component->id);
     }
     // Search for an appropriate menu item.
     if (is_array($items)) {
         // If only the option and itemid are specified in the query, return that item.
         if (!isset($query['view']) && !isset($query['id']) && !isset($query['catid']) && isset($query['Itemid'])) {
             $itemid = (int) $query['Itemid'];
         }
         // Search for a specific link based on the critera given.
         if (!$itemid) {
             foreach ($items as $item) {
                 // Check if this menu item links to this view.
                 if (isset($item->query['view']) && $item->query['view'] == 'poll' && isset($query['view']) && $query['view'] != 'category' && isset($item->query['id']) && $item->query['id'] == $query['id']) {
                     $itemid = $item->id;
                 }
             }
         }
         // If no specific link has been found, search for a general one.
         if (!$itemid) {
             foreach ($items as $item) {
                 if (isset($query['view']) && $query['view'] == 'poll' && isset($item->query['view']) && $item->query['view'] == 'poll') {
                     // Check for an undealt with newsfeed id.
                     if (isset($query['id'])) {
                         // This menu item links to the newsfeed view but we need to append the newsfeed id to it.
                         $itemid = $item->id;
                         $segments[] = isset($query['alias']) ? $query['id'] . ':' . $query['alias'] : $query['id'];
                         break;
                     }
                 }
             }
         }
     }
     // Check if the router found an appropriate itemid.
     if (!$itemid) {
         // Check if a id was specified.
         if (isset($query['id'])) {
             if (isset($query['alias'])) {
                 $query['id'] .= ':' . $query['alias'];
             }
             // Push the id onto the stack.
             $segments[] = $query['id'];
             unset($query['id']);
             unset($query['alias']);
         }
         if (isset($query['view']) && $query['view'] == 'latest') {
             $segments[] = $query['view'];
         }
         unset($query['view']);
     } else {
         $query['Itemid'] = $itemid;
         // Remove the unnecessary URL segments.
         unset($query['view']);
         unset($query['id']);
         unset($query['catid']);
         unset($query['alias']);
     }
     return $segments;
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:77,代码来源:router.php

示例3: foreach

  </div>
</div>
<div class="page-header" style="border-bottom: none !important;">
  <div class="container">
    <ul class="breadcrumb">
      <li><a href="#">Home</a></li>
      <li><a href="#">Library</a></li>
      <li class="active">Data</li>
    </ul>
  </div>
</div>
<div id="panel-component">
<?php 
try {
    include_once $_SERVER["DOCUMENT_ROOT"] . '/lib/init.php';
    foreach (Component::load() as $key => $value) {
        if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/component/{$value['com']}/index.php")) {
            echo '<div id="panel-' . $value['com'] . '" style="display:none">';
            include $_SERVER["DOCUMENT_ROOT"] . "/component/{$value['com']}/index.php";
            echo '</div>';
        }
    }
} catch (Exception $ex) {
    echo 'ERROR::' + $ex->getMessage();
}
?>
<div id="google-adsense" class="container" style="margin-bottom: 60px;">

</div>
</div><div class="panel-footer navbar-fixed-bottom">
  <div class="container">
开发者ID:Kem-Store,项目名称:PHP-Template,代码行数:31,代码来源:default.php

示例4: loadComponent

 protected function loadComponent($component)
 {
     $component = Inflector::camelize($component) . 'Component';
     return $this->{$component} = Component::load($component, true);
 }
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:5,代码来源:Controller.php

示例5: _findItem

 protected static function _findItem($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $language = isset($needles['language']) ? $needles['language'] : '*';
     // Prepare the reverse lookup array.
     if (!isset(self::$lookup[$language])) {
         self::$lookup[$language] = array();
         $component = Component::load('com_content');
         $items = $menus->getItems('component_id', $component->id);
         foreach ($items as $item) {
             if (isset($item->query) && isset($item->query['view']) && $item->language == $language) {
                 $view = $item->query['view'];
                 if (!isset(self::$lookup[$language][$view])) {
                     self::$lookup[$language][$view] = array();
                 }
                 if (isset($item->query['id'])) {
                     self::$lookup[$language][$view][$item->query['id']] = $item->id;
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup[$language][$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup[$language][$view][(int) $id])) {
                         return self::$lookup[$language][$view][(int) $id];
                     }
                 }
             }
         }
     }
     if ($language != '*') {
         $needles['language'] = '*';
         return self::_findItem($needles);
     }
     $active = $menus->getActive();
     if ($active && $active->component == 'com_content') {
         return $active->id;
     }
     return null;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:43,代码来源:route.php

示例6: setType

 /**
  * Sets the type of the menu item currently being edited.
  *
  * @return  void
  *
  * @since   1.6
  */
 function setType()
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     // Get the posted values from the request.
     $data = Request::getVar('jform', array(), 'post', 'array');
     $recordId = Request::getInt('id');
     // Get the type.
     $type = $data['type'];
     $type = json_decode(base64_decode($type));
     $title = isset($type->title) ? $type->title : null;
     $recordId = isset($type->id) ? $type->id : 0;
     if ($title != 'alias' && $title != 'separator' && $title != 'url') {
         $title = 'component';
     }
     $app->setUserState('com_menus.edit.item.type', $title);
     if ($title == 'component') {
         if (isset($type->request)) {
             $component = Component::load($type->request->option);
             $data['component_id'] = $component->id;
             $app->setUserState('com_menus.edit.item.link', 'index.php?' . JURI::buildQuery((array) $type->request));
         }
     } elseif ($title == 'alias') {
         $app->setUserState('com_menus.edit.item.link', 'index.php?Itemid=');
     }
     unset($data['request']);
     $data['type'] = $title;
     if (Request::getCmd('fieldtype') == 'type') {
         $data['link'] = $app->getUserState('com_menus.edit.item.link');
     }
     //Save the data in the session.
     $app->setUserState('com_menus.edit.item.data', $data);
     $this->type = $type;
     $this->setRedirect(Route::url('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:42,代码来源:item.php

示例7: getComponent

 /**
  * Get the component information.
  *
  * @return  object
  * @since   1.6
  */
 public function getComponent()
 {
     // Initialise variables.
     $option = $this->getState('component.option');
     // Load common and local language files.
     Lang::load($option, PATH_APP . "/bootstrap/administrator", null, false, true) || Lang::load($option, \Component::path($option) . "/admin", null, false, true) || Lang::load($option, \Component::path($option) . "/site", null, false, true);
     return \Component::load($option);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:14,代码来源:component.php

示例8: error_reporting

error_reporting(E_ALL & ~E_DEPRECATED);
// Check if an installation folder is exists
//if(file_exists(APPPATH.'install/index.php')) {
//include_once APPPATH.'install/index.php';
//}
// Set error handlers
set_error_handler(array('Exception_Exido', 'handlerError'));
set_exception_handler(array('Exception_Exido', 'handlerException'));
// Initialize framework
Exido::initialize();
// Load basic include paths
Exido::setIncludePaths();
// You can attach a log writer by uncomment next line
//Exido::$log->attach(new Log_File(APPPATH.'data/cache/log'));
// Load additional components
Component::load();
// Initialize loaded components
Component::initialize();
// Include internalization languages
//Exido::$i18n->attach(new I18n_File('en_US'));
Exido::$i18n->attach(new I18n_File('ru_RU'));
// Set application time zone. Depends on language loaded.
// It's UTC default.
// @see  http://php.net/timezones
date_default_timezone_set(__('__time_zone'));
// Set application locale. Depends on language loaded.
// It's en_US.UTF-8 by default.
// @see  http://php.net/setlocale
setlocale(LC_ALL, __('__locale'));
// Set application charset. Depends on language loaded.
// It's UTF-8 default.
开发者ID:esironal,项目名称:exidoengine,代码行数:31,代码来源:bootstrap.php

示例9: getItem

 /**
  * Method to get a menu item.
  *
  * @param	integer	$pk	An optional id of the object to get, otherwise the id from the model state is used.
  *
  * @return	mixed	Menu item data object on success, false on failure.
  * @since	1.6
  */
 public function getItem($pk = null)
 {
     // Initialise variables.
     $pk = !empty($pk) ? $pk : (int) $this->getState('item.id');
     // Get a level row instance.
     $table = $this->getTable();
     // Attempt to load the row.
     $table->load($pk);
     // Check for a table object error.
     if ($error = $table->getError()) {
         $this->setError($error);
         $false = false;
         return $false;
     }
     // Prime required properties.
     if ($type = $this->getState('item.type')) {
         $table->type = $type;
     }
     if (empty($table->id)) {
         $table->parent_id = $this->getState('item.parent_id');
         $table->menutype = $this->getState('item.menutype');
         $table->params = '{}';
     }
     // If the link has been set in the state, possibly changing link type.
     if ($link = $this->getState('item.link')) {
         // Check if we are changing away from the actual link type.
         if (MenusHelper::getLinkKey($table->link) != MenusHelper::getLinkKey($link)) {
             $table->link = $link;
         }
     }
     switch ($table->type) {
         case 'alias':
             $table->component_id = 0;
             $args = array();
             parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
             break;
         case 'separator':
             $table->link = '';
             $table->component_id = 0;
             break;
         case 'url':
             $table->component_id = 0;
             parse_str(parse_url($table->link, PHP_URL_QUERY));
             break;
         case 'component':
         default:
             // Enforce a valid type.
             $table->type = 'component';
             // Ensure the integrity of the component_id field is maintained, particularly when changing the menu item type.
             $args = array();
             parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
             if (isset($args['option'])) {
                 // Load the language file for the component.
                 $lang = Lang::getRoot();
                 $lang->load($args['option'], PATH_APP, null, false, true) || $lang->load($args['option'], PATH_APP . '/components/' . $args['option'] . '/admin', null, false, true) || $lang->load($args['option'], PATH_CORE . '/components/' . $args['option'] . '/admin', null, false, true);
                 // Determine the component id.
                 $component = Component::load($args['option']);
                 if (isset($component->id)) {
                     $table->component_id = $component->id;
                 }
             }
             break;
     }
     // We have a valid type, inject it into the state for forms to use.
     $this->setState('item.type', $table->type);
     // Convert to the Object before adding the params.
     $properties = $table->getProperties(1);
     $result = \Hubzero\Utility\Arr::toObject($properties, '\\Hubzero\\Base\\Object');
     // Convert the params field to an array.
     $registry = new \Hubzero\Config\Registry($table->params);
     $result->params = $registry->toArray();
     // Merge the request arguments in to the params for a component.
     if ($table->type == 'component') {
         // Note that all request arguments become reserved parameter names.
         $result->request = $args;
         $result->params = array_merge($result->params, $args);
     }
     if ($table->type == 'alias') {
         // Note that all request arguments become reserved parameter names.
         $args = array();
         parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
         $result->params = array_merge($result->params, $args);
     }
     if ($table->type == 'url') {
         // Note that all request arguments become reserved parameter names.
         $args = array();
         parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
         $result->params = array_merge($result->params, $args);
     }
     // Load associated menu items
     if (JFactory::getApplication()->get('menu_associations', 0)) {
         if ($pk != null) {
//.........这里部分代码省略.........
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:101,代码来源:item.php

示例10: getComponent

 /**
  * Get the component information.
  *
  * @return  object
  * @since   1.6
  */
 public function getComponent()
 {
     // Initialise variables.
     $option = $this->getState('component.option');
     // Load common and local language files.
     Lang::load($option, PATH_APP . "/bootstrap/administrator", null, false, true) || Lang::load($option, \Component::path($option) . "/admin", null, false, true) || Lang::load($option, \Component::path($option) . "/site", null, false, true);
     if ($path = $this->getState('component.path')) {
         Lang::load($option, PATH_ROOT . dirname($path) . DS . 'Admin', null, false, true);
         Lang::load($option, PATH_ROOT . dirname($path) . DS . 'Site', null, false, true);
     }
     return \Component::load($option);
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:18,代码来源:component.php

示例11: getComponent

 /**
  * Get the component information.
  *
  * @return  object
  * @since   1.6
  */
 public function getComponent()
 {
     // Initialise variables.
     $option = $this->getState('component.option');
     // Load common and local language files.
     Lang::load($option, JPATH_BASE, null, false, true) || Lang::load($option, PATH_CORE . "/components/{$option}/admin", null, false, true) || Lang::load($option, JPATH_BASE . "/components/{$option}", null, false, true);
     return \Component::load($option);
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:14,代码来源:component.php

示例12: find

 /**
  * Find new updates.
  *
  * @since	1.6
  */
 public function find()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     // Get the caching duration
     $component = Component::load('com_installer');
     $params = $component->params;
     $cache_timeout = $params->get('cachetimeout', 6, 'int');
     $cache_timeout = 3600 * $cache_timeout;
     // Find updates
     $model = new Models\Update();
     $result = $model->findUpdates(0, $cache_timeout);
     App::redirect(Route::url('index.php?option=com_installer&view=update', false));
     //$view->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:20,代码来源:update.php


注:本文中的Component::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。