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


PHP Extension::getHandleFromPath方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     $this->errors = new MessageStack();
     $this->fields = array();
     $this->editing = $this->failed = false;
     $this->datasource = $this->handle = $this->status = $this->type = NULL;
     $this->types = array();
     foreach (new ExtensionIterator(ExtensionIterator::FLAG_TYPE, array('Data Source')) as $extension) {
         $path = Extension::getPathFromClass(get_class($extension));
         $handle = Extension::getHandleFromPath($path);
         if (Extension::status($handle) != Extension::STATUS_ENABLED) {
             continue;
         }
         if (!method_exists($extension, 'getDataSourceTypes')) {
             continue;
         }
         foreach ($extension->getDataSourceTypes() as $type) {
             $this->types[$type->class] = $type;
         }
     }
     if (empty($this->types)) {
         $this->alerts()->append(__('There are no Data Source types currently available. You will not be able to create or edit Data Sources.'), AlertStack::ERROR);
     }
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:25,代码来源:content.blueprintsdatasources.php

示例2: __find

 protected static function __find($name)
 {
     if (is_file(DATASOURCES . "/{$name}.php")) {
         return DATASOURCES;
     } else {
         foreach (new ExtensionIterator(ExtensionIterator::FLAG_STATUS, Extension::STATUS_ENABLED) as $extension) {
             $path = Extension::getPathFromClass(get_class($extension));
             $handle = Extension::getHandleFromPath($path);
             if (is_file(EXTENSIONS . "/{$handle}/data-sources/{$name}.php")) {
                 return EXTENSIONS . "/{$handle}/data-sources";
             }
         }
         /*
         $extensions = ExtensionManager::instance()->listInstalledHandles();
         
         if(is_array($extensions) && !empty($extensions)){
         	foreach($extensions as $e){
         		if(is_file(EXTENSIONS . "/{$e}/data-sources/{$name}.php")) return EXTENSIONS . "/{$e}/data-sources";
         	}
         }
         */
     }
     return false;
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:24,代码来源:class.datasource.php

示例3: view

 public function view()
 {
     $this->lists = (object) array('status' => array(Extension::STATUS_ENABLED => array(), Extension::STATUS_DISABLED => array(), Extension::STATUS_NOT_INSTALLED => array(), Extension::STATUS_REQUIRES_UPDATE => array()), 'type' => array(), 'extensions' => array());
     ## Setup page
     $filter = $this->_context[0] == 'type' || $this->_context[0] == 'status' ? $this->_context[0] : NULL;
     $value = isset($this->_context[1]) ? $this->_context[1] : NULL;
     $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Extensions'))));
     $this->appendSubheading(__('Extensions'));
     $path = ADMIN_URL . '/system/extensions/';
     $this->Form->setAttribute('action', Administration::instance()->getCurrentPageURL());
     ## Define layout
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $left->setAttribute('class', 'column small filters');
     $right = $layout->createColumn(Layout::LARGE);
     ## Process extensions and build lists
     foreach (new ExtensionIterator() as $extension) {
         $pathname = Extension::getPathFromClass(get_class($extension));
         $handle = Extension::getHandleFromPath($pathname);
         $status = Extension::status($handle);
         // List of extensions
         $this->lists->extensions[$handle] = array('object' => $extension, 'path' => $path, 'handle' => $handle, 'status' => $status);
         // List of extension handles grouped by status
         if (!is_array($this->lists->status[$status])) {
             $this->lists->status[$status] = array();
         }
         $this->lists->status[$status][] = $handle;
         // List of extension handles grouped by type
         if (isset($extension->about()->type) && is_array($extension->about()->type) && !empty($extension->about()->type)) {
             foreach ($extension->about()->type as $t) {
                 if (!isset($this->lists->type[$t])) {
                     $this->lists->type[$t] = array();
                 }
                 $this->lists->type[$t][] = $handle;
             }
         }
     }
     ## Build status filter menu
     $h4 = $this->createElement('h4', __('Filter by Status'));
     $left->appendChild($h4);
     $ul = $this->createElement('ul');
     ## Main status overview
     $li = $this->createElement('li', Widget::Anchor(__('Overview'), $path));
     if (is_null($filter)) {
         $li->setAttribute('class', 'active');
     }
     $ul->appendChild($li);
     foreach ($this->lists->status as $status => $extensions) {
         if (!empty($extensions)) {
             $li = $this->createElement('li', Widget::Anchor(self::$status_translation[$status], "{$path}status/{$status}"));
             if ($value == $status) {
                 $li->setAttribute('class', 'active');
             }
             $count = $this->createElement('span', (string) count($extensions));
             $li->appendChild($count);
             $ul->appendChild($li);
         }
     }
     $left->appendChild($ul);
     ## Build type filter menu
     $h4 = $this->createElement('h4', __('Filter by Type'));
     $left->appendChild($h4);
     $ul = $this->createElement('ul');
     foreach ($this->lists->type as $type => $extensions) {
         if (!empty($extensions)) {
             $li = $this->createElement('li', Widget::Anchor(ucwords($type), "{$path}type/{$type}"));
             if ($value == $type) {
                 $li->setAttribute('class', 'active');
             }
             $count = $this->createElement('span', (string) count($extensions));
             $li->appendChild($count);
             $ul->appendChild($li);
         }
     }
     $left->appendChild($ul);
     ## If a filter and value are specified...
     if (!is_null($filter) && !is_null($value)) {
         ## If there are extensions in the list, build the table
         if (isset($this->lists->{$filter}[$value])) {
             $right->appendChild($this->buildTable($this->lists->{$filter}[$value]));
         } else {
             ## Otherwise pass an empty array so we get the
             ## 'No Records Found' message
             $right->appendChild($this->buildTable());
         }
         ## and append table actions
         $tableActions = $this->createElement('div');
         $tableActions->setAttribute('class', 'actions');
         $options = array(array(NULL, false, __('With Selected...')), array('enable', false, __('Enable')), array('disable', false, __('Disable')), array('uninstall', false, __('Uninstall'), 'confirm'));
         $tableActions->appendChild(Widget::Select('with-selected', $options));
         $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
         $right->appendChild($tableActions);
         ## Otherwise, build the overview
     } else {
         ## Requires Update
         if (!empty($this->lists->status[Extension::STATUS_REQUIRES_UPDATE])) {
             $count = count($this->lists->status[Extension::STATUS_REQUIRES_UPDATE]);
             $div = $this->createElement('div');
             $div->setAttribute('class', 'tools');
             $h4 = $this->createElement('h4', __('Updates'));
//.........这里部分代码省略.........
开发者ID:brendo,项目名称:symphony-3,代码行数:101,代码来源:content.systemextensions.php

示例4: findLanguagePath

 /**
  * Find the correct path to the core translations based on the language code
  *
  * The default English language strings are stored in /symphony/lang whereas
  * the localisation files for other languages are stored in the extension folder.
  */
 public static function findLanguagePath($lang)
 {
     $file = sprintf('/lang.%s.php', $lang);
     if (!is_file(LANG . $file)) {
         foreach (new ExtensionIterator(ExtensionIterator::FLAG_STATUS, Extension::STATUS_ENABLED) as $extension) {
             $path = Extension::getPathFromClass(get_class($extension));
             $handle = Extension::getHandleFromPath($path);
             //foreach(ExtensionManager::instance()->listAll() as $extension => $about) {
             // Explicitly match localisation extensions
             if (strpos($handle, 'lang_') === false) {
                 continue;
             }
             $path = EXTENSIONS . "/{$handle}/lang";
             if (is_file($path . $file)) {
                 return $path;
             }
         }
     } else {
         return LANG;
     }
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:27,代码来源:class.lang.php

示例5: __buildNavigation

 protected function __buildNavigation()
 {
     $nav = array();
     $xml = simplexml_load_file(ASSETS . '/navigation.xml');
     foreach ($xml->xpath('/navigation/group') as $n) {
         $index = (string) $n->attributes()->index;
         $children = $n->xpath('children/item');
         $content = $n->attributes();
         if (isset($nav[$index])) {
             do {
                 $index++;
             } while (isset($nav[$index]));
         }
         $nav[$index] = array('name' => __(strval($content->name)), 'index' => $index, 'children' => array());
         if (strlen(trim((string) $content->limit)) > 0) {
             $nav[$index]['limit'] = (string) $content->limit;
         }
         if (count($children) > 0) {
             foreach ($children as $child) {
                 $limit = (string) $child->attributes()->limit;
                 $item = array('link' => (string) $child->attributes()->link, 'name' => __(strval($child->attributes()->name)), 'visible' => (string) $child->attributes()->visible == 'no' ? 'no' : 'yes');
                 if (strlen(trim($limit)) > 0) {
                     $item['limit'] = $limit;
                 }
                 $nav[$index]['children'][] = $item;
             }
         }
     }
     foreach (new SectionIterator() as $s) {
         $group_index = self::__navigationFindGroupIndex($nav, $s->{'navigation-group'});
         if ($group_index === false) {
             $group_index = General::array_find_available_index($nav, 0);
             $nav[$group_index] = array('name' => $s->{'navigation-group'}, 'index' => $group_index, 'children' => array(), 'limit' => NULL);
         }
         $nav[$group_index]['children'][] = array('link' => '/publish/' . $s->handle . '/', 'name' => $s->name, 'type' => 'section', 'section' => array('id' => $s->guid, 'handle' => $s->handle), 'visible' => $s->{'hidden-from-publish-menu'} == 'no' ? 'yes' : 'no');
     }
     //			$extensions = ExtensionManager::instance()->listInstalledHandles();
     foreach (new ExtensionIterator(ExtensionIterator::FLAG_STATUS, Extension::STATUS_ENABLED) as $e) {
         if (!method_exists($e, 'fetchNavigation')) {
             continue;
         }
         $e_navigation = $e->fetchNavigation();
         if (isset($e_navigation) && is_array($e_navigation) && !empty($e_navigation)) {
             foreach ($e_navigation as $item) {
                 $type = isset($item['children']) ? Extension::NAVIGATION_GROUP : Extension::NAVIGATION_CHILD;
                 switch ($type) {
                     case Extension::NAVIGATION_GROUP:
                         $index = General::array_find_available_index($nav, $item['location']);
                         $nav[$index] = array('name' => $item['name'], 'index' => $index, 'children' => array(), 'limit' => !is_null($item['limit']) ? $item['limit'] : NULL);
                         foreach ($item['children'] as $child) {
                             if (!isset($child['relative']) || $child['relative'] == true) {
                                 $link = '/extension/' . Extension::getHandleFromPath(Extension::getPathFromClass(get_class($e))) . '/' . ltrim($child['link'], '/');
                             } else {
                                 $link = '/' . ltrim($child['link'], '/');
                             }
                             $nav[$index]['children'][] = array('link' => $link, 'name' => $child['name'], 'visible' => $child['visible'] == 'no' ? 'no' : 'yes', 'limit' => !is_null($child['limit']) ? $child['limit'] : NULL);
                         }
                         break;
                     case Extension::NAVIGATION_CHILD:
                         if (!isset($item['relative']) || $item['relative'] == true) {
                             $link = '/extension/' . Extension::getHandleFromPath(Extension::getPathFromClass(get_class($e))) . '/' . ltrim($item['link'], '/');
                         } else {
                             $link = '/' . ltrim($item['link'], '/');
                         }
                         if (!is_numeric($item['location'])) {
                             // is a navigation group
                             $group_name = $item['location'];
                             $group_index = $this->__findLocationIndexFromName($nav, $item['location']);
                         } else {
                             // is a legacy numeric index
                             $group_index = $item['location'];
                         }
                         $child = array('link' => $link, 'name' => $item['name'], 'visible' => $item['visible'] == 'no' ? 'no' : 'yes', 'limit' => !is_null($item['limit']) ? $item['limit'] : NULL);
                         if ($group_index === false) {
                             // add new navigation group
                             $nav[] = array('name' => $group_name, 'index' => $group_index, 'children' => array($child), 'limit' => !is_null($item['limit']) ? $item['limit'] : NULL);
                         } else {
                             // add new location by index
                             $nav[$group_index]['children'][] = $child;
                         }
                         break;
                 }
             }
         }
     }
     ####
     # Delegate: ExtensionsAddToNavigation
     # Description: After building the Navigation properties array. This is specifically
     # 			for extentions to add their groups to the navigation or items to groups,
     # 			already in the navigation. Note: THIS IS FOR ADDING ONLY! If you need
     #			to edit existing navigation elements, use the 'NavigationPreRender' delegate.
     # Global: Yes
     Extension::notify('ExtensionsAddToNavigation', '/administration/', array('navigation' => &$nav));
     $pageCallback = Administration::instance()->getPageCallback();
     $pageRoot = $pageCallback['pageroot'] . (isset($pageCallback['context'][0]) ? $pageCallback['context'][0] . '/' : '');
     $found = $this->__findActiveNavigationGroup($nav, $pageRoot);
     ## Normal searches failed. Use a regular expression using the page root. This is less
     ## efficent and should never really get invoked unless something weird is going on
     if (!$found) {
         $this->__findActiveNavigationGroup($nav, '/^' . str_replace('/', '\\/', $pageCallback['pageroot']) . '/i', true);
//.........这里部分代码省略.........
开发者ID:brendo,项目名称:symphony-3,代码行数:101,代码来源:class.administrationpage.php

示例6: __find

 protected static function __find($name)
 {
     if (is_file(SECTIONS . "/{$name}.xml")) {
         return SECTIONS;
     } else {
         foreach (new ExtensionIterator(ExtensionIterator::FLAG_STATUS, Extension::STATUS_ENABLED) as $extension) {
             $path = Extension::getPathFromClass(get_class($extension));
             $handle = Extension::getHandleFromPath($path);
             if (!is_file(EXTENSIONS . "/{$handle}/sections/{$name}.xml")) {
                 continue;
             }
             return EXTENSIONS . "/{$handle}/sections";
         }
     }
     return false;
 }
开发者ID:pointybeard,项目名称:symphony-3,代码行数:16,代码来源:class.section.php


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