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


PHP Extension::status方法代码示例

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


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

示例3: __construct

 public function __construct($flag = NULL, $value = NULL)
 {
     $this->position = 0;
     $key = null;
     if ($flag != null and $value != null) {
         $key = "{$flag}.{$value}";
     }
     if (!isset(self::$extensions_by_flag[$key])) {
         if (!is_array(self::$extensions_by_flag)) {
             self::$extensions_by_flag = array();
         }
         foreach (new DirectoryIterator(EXTENSIONS) as $d) {
             if (!$d->isDir() || $d->isDot() || !file_exists($d->getPathname() . '/extension.driver.php')) {
                 continue;
             }
             $extension = Extension::load($d->getFileName());
             if (!is_null($flag) && !is_null($value)) {
                 switch ($flag) {
                     case self::FLAG_STATUS:
                         if (!in_array(Extension::status($d->getFileName()), (array) $value)) {
                             continue 2;
                         }
                         break;
                     case self::FLAG_TYPE:
                         if (!isset($extension->about()->type) || (bool) array_intersect((array) $value, (array) $extension->about()->type) === false) {
                             continue 2;
                         }
                         break;
                 }
             }
             self::$extensions_by_flag[$key][] = $extension;
         }
     }
     $this->extensions = self::$extensions_by_flag[$key];
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:35,代码来源:class.extension.php


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