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


PHP ExtensionManager::about方法代码示例

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


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

示例1: upgrade_1_3

 private function upgrade_1_3()
 {
     $types = $this->listTypes();
     $formatters = $this->listAll();
     $aboutDriver = ExtensionManager::about('templatedtextformatters');
     foreach (array_keys($types) as $type) {
         $types[$type]['code'] = file_get_contents($types[$type]['path'] . '/formatter.' . $type . '.tpl');
         if (preg_match('/public\\s*function\\s*ttf_tokens\\s*\\([^\\)]*\\)\\s*(\\{(?:[^\\{\\}]+|(?1))*\\})/', $types[$type]['code'], $m)) {
             $types[$type]['ttf_tokens_code'] = $m[0];
         }
     }
     foreach ($formatters as $id => $dummy) {
         $file = TEXTFORMATTERS . "/formatter.{$id}.php";
         $data = file_get_contents($file);
         if (!preg_match('/public\\s*function\\s*ttf_tokens\\s*\\([^\\)]*\\)\\s*(\\{(?:[^\\{\\}]+|(?1))*\\})/', $data, $m)) {
             continue;
         }
         $code = $m[0];
         if (!preg_match('/\'templatedtextformatters-type\'\\s*=>\\s*\'([^\']+)\'/', $data, $m)) {
             continue;
         }
         $type = $m[1];
         if (!$types[$type] || !$types[$type]['ttf_tokens_code']) {
             continue;
         }
         $data = str_replace($code, $types[$type]['ttf_tokens_code'], $data);
         if (!General::writeFile($file, $data, Symphony::Configuration()->get('write_mode', 'file'))) {
             continue;
         }
         include_once $file;
         $classname = "formatter{$id}";
         $old = new $classname();
         $about = $old->about();
         $tokens = array('___' . $type . '/* CLASS NAME */' => $id, '/* NAME */' => preg_replace('/[^\\w\\s\\.-_\\&\\;]/i', '', trim($about['name'])), '/* AUTHOR NAME */' => $about['author']['name'], '/* AUTHOR WEBSITE */' => $about['author']['website'], '/* AUTHOR EMAIL */' => $about['author']['email'], '/* RELEASE DATE */' => DateTimeObj::getGMT('c'), '/* TEMPLATEDTEXTFORMATTERS VERSION */' => $aboutDriver['version'], '/* TEMPLATEDTEXTFORMATTERS TYPE */' => $type);
         if (method_exists($old, 'ttf_tokens')) {
             $tokens = array_merge($tokens, $old->ttf_tokens(false));
         }
         $code = str_replace(array_keys($tokens), $tokens, $types[$type]['code']);
         $code = str_replace('/* CLASS NAME */', $classname, $code);
         General::writeFile($file, $code, Symphony::Configuration()->get('write_mode', 'file'));
     }
 }
开发者ID:ahwayakchih,项目名称:templatedtextformatters,代码行数:42,代码来源:extension.driver.php

示例2: formatElementItem

    public function formatElementItem($activity, $fallback = FALSE)
    {
        switch ($activity['item_type']) {
            // Pages and Page Templates
            case 'pages':
                // Is is a Page Template?
                $is_template = !is_numeric($activity['item_id']);
                // Fetch the page from the DB
                $page = Symphony::Database()->fetch('
						SELECT `title`
						FROM `tbl_pages`
						WHERE `' . ($is_template ? 'handle' : 'id') . '` = "' . $activity['item_id'] . '"');
                // If the page no longer exists, use the fallback description
                if (empty($page)) {
                    $item = $activity['fallback_description'];
                } elseif ($is_template) {
                    $item = __(' the %1s page %2s', array($page[0]['title'], $fallback ? __('template') : Widget::Anchor(__('template'), URL . '/symphony/blueprints/pages/template/' . $activity['item_id'])->generate()));
                    // Or if it was the page config, build that description
                } else {
                    $item = __(' the %1s page', array($fallback ? $page[0]['title'] : Widget::Anchor($page[0]['title'], URL . '/symphony/blueprints/pages/edit/' . $activity['item_id'])->generate()));
                }
                break;
            case "events":
                // Grab the event info
                $handle = EventManager::__getHandleFromFilename($activity['item_id']);
                $about = EventManager::about($handle);
                // If the event no longer exists, use the fallback description
                if (empty($about)) {
                    $item = $activity['fallback_description'];
                } else {
                    $item = __(' the %1s event', array($fallback ? $about['name'] : Widget::Anchor($about['name'], URL . '/symphony/blueprints/events/edit/' . $handle)->generate()));
                }
                break;
            case "datasources":
                // Grab the DS info
                $handle = DatasourceManager::__getHandleFromFilename($activity['item_id']);
                $about = DatasourceManager::about($handle);
                // If the DS no longer exists, use the fallback description
                if (empty($about)) {
                    $item = $activity['fallback_description'];
                } else {
                    $item = __(' the %1s data source', array($fallback ? $about['name'] : Widget::Anchor($about['name'], URL . '/symphony/blueprints/datasources/edit/' . $handle)->generate()));
                }
                break;
            case "utilities":
                // If the utility no longer exists, use the fallback description
                if (!file_exists(UTILITIES . '/' . $activity['item_id'])) {
                    $item = $activity['fallback_description'];
                } else {
                    $item = __(' the %1s utility', array($fallback ? $activity['item_id'] : Widget::Anchor($activity['item_id'], URL . '/symphony/blueprints/utilities/edit/' . str_replace('.xsl', '', $activity['item_id']))->generate()));
                }
                break;
            case "sections":
                // Grab the section info
                $section = SectionManager::fetch($activity['item_id']);
                // If the section no longer exists, use the fallback description
                if (!$section instanceof Section) {
                    $item = $activity['fallback_description'];
                } else {
                    $item = __(' the %1s section', array($fallback ? $section->get('name') : Widget::Anchor($section->get('name'), URL . '/symphony/blueprints/sections/edit/' . $activity['item_id'])->generate()));
                }
                break;
            case "authors":
                // Grab the author info
                $author = AuthorManager::fetchByID($activity['item_id']);
                // If the author no longer exists, use the fallback description
                if (!$author instanceof Author) {
                    $item = $activity['fallback_description'];
                } else {
                    // If the author edited their own record
                    if ($activity['user_id'] == $activity['item_id']) {
                        $item = __(' his/her %1s', array($fallback ? __('author record') : Widget::Anchor(__('author record'), URL . '/symphony/system/authors/edit/' . $activity['item_id'])->generate()));
                    } else {
                        $item = __(' the author record for %1s', array($fallback ? $author->getFullName() : Widget::Anchor($author->getFullName(), URL . '/symphony/system/authors/edit/' . $activity['item_id'])->generate()));
                    }
                }
                break;
            case "preferences":
                $item = __(' the %s', array(Widget::Anchor(__('system preferences'), URL . '/symphony/system/preferences')->generate()));
                break;
            case "maintenance-mode":
                $item = __(' maintenance mode');
                break;
            case "extensions":
                try {
                    $about = ExtensionManager::about($activity['item_id']);
                } catch (Exception $e) {
                    $about = NULL;
                }
                if (empty($about)) {
                    $item = $activity['fallback_description'];
                } else {
                    $item = __('the %1s extension', array($about['name']));
                }
                break;
            case "login":
                $item = __(' to the back end');
                break;
            case "password-reset":
                $item = __(' his/her password');
//.........这里部分代码省略.........
开发者ID:rc1,项目名称:tracker,代码行数:101,代码来源:class.tracker.php

示例3: update

 /**
  *
  * Delegate fired when the extension is updated (when version changes)
  * @param string $previousVersion
  */
 public function update($previousVersion = false)
 {
     $about = ExtensionManager::about('anti_brute_force');
     return ABF::instance()->update($previousVersion, $about['version']);
 }
开发者ID:korelogic,项目名称:anti_brute_force,代码行数:10,代码来源:extension.driver.php

示例4: __construct

 private function __construct()
 {
     $s = Symphony::Configuration()->get();
     $this->_settings = $s[ABF::SETTING_GROUP];
     unset($s);
     // now an array
     $validStatuses = EXTENSION_ENABLED;
     $about = ExtensionManager::about('anti_brute_force');
     $status = ExtensionManager::fetchStatus($about);
     $this->_isInstalled = in_array($validStatuses, $status);
     // only if already installed
     if ($this->_isInstalled) {
         // assure access to settings
         // fail is not settings, since this is a security software
         if (count($this->_settings) < 1) {
             throw new Exception('Can not load settings. Can not continue.');
         }
     }
 }
开发者ID:korelogic,项目名称:anti_brute_force,代码行数:19,代码来源:class.ABF.php

示例5: save

 public function save()
 {
     $about = array();
     if ($this->_context[0] && !is_object($this->formatter)) {
         $this->formatter = TextformatterManager::create($this->_context[0]);
     }
     if (is_object($this->formatter)) {
         $about = TextformatterManager::about($this->_context[0]);
     }
     $fields = $_POST['fields'];
     $driverAbout = ExtensionManager::about('templatedtextformatters');
     $types = $this->_driver->listTypes();
     if (strlen(trim($fields['name'])) < 1) {
         $this->_errors['name'] = __('You have to specify name for text formatter');
         return;
     }
     if ($about['templatedtextformatters-type'] && $about['templatedtextformatters-type'] != $fields['type']) {
         $this->_errors['type'] = __('Changing type of already existing formatter is not allowed');
         return;
     }
     if (!$fields['type'] || !is_array($types[$fields['type']]) || !isset($types[$fields['type']]['path'])) {
         $this->_errors['type'] = __('There is no <code>%s</code> type available', array($fields['type']));
         return;
     }
     $tplfile = $types[$fields['type']]['path'] . '/formatter.' . $fields['type'] . '.tpl';
     if (!@is_file($tplfile)) {
         $this->_errors['type'] = __('Wrong type of text formatter');
         return;
     }
     $classname = 'ttf_' . Lang::createHandle(trim($fields['name']), NULL, '_', false, true, array('@^[^a-z]+@i' => '', '/[^\\w-\\.]/i' => ''));
     $file = TEXTFORMATTERS . '/formatter.' . $classname . '.php';
     $isDuplicate = false;
     $queueForDeletion = NULL;
     if (!$about['handle'] && @is_file($file)) {
         $isDuplicate = true;
     } else {
         if ($about['handle']) {
             if ($classname != $about['handle'] && @is_file($file)) {
                 $isDuplicate = true;
             } elseif ($classname != $about['handle']) {
                 $queueForDeletion = TEXTFORMATTERS . '/formatter.' . $about['handle'] . '.php';
             }
         }
     }
     // Duplicate
     if ($isDuplicate) {
         $this->_errors['name'] = __('Text formatter with the name <code>%s</code> already exists', array($classname));
     }
     if (!empty($this->_errors)) {
         return;
     }
     $description = trim($fields['description']);
     if (empty($description)) {
         $description = __('N/A');
     }
     // https://github.com/symphonycms/symphony-2/wiki/Migration-Guide-to-2.5-for-Developers#properties
     if (is_callable(array('Symphony', 'Author'))) {
         $author = Symphony::Author();
     } else {
         $author = Administration::instance()->Author;
     }
     $tokens = array('___' . $fields['type'] . '/* CLASS NAME */' => $classname, '/* NAME */' => preg_replace('/[^\\w\\s\\.-_\\&\\;]/i', '', trim($fields['name'])), '/* AUTHOR NAME */' => self::cleanupString($author->getFullName()), '/* AUTHOR WEBSITE */' => self::cleanupString(URL), '/* AUTHOR EMAIL */' => self::cleanupString($author->get('email')), '/* RELEASE DATE */' => DateTimeObj::getGMT('c'), '/* DESCRIPTION */' => self::cleanupString($description), '/* TEMPLATEDTEXTFORMATTERS VERSION */' => $driverAbout['version'], '/* TEMPLATEDTEXTFORMATTERS TYPE */' => $fields['type']);
     if (!is_object($this->formatter)) {
         include_once $tplfile;
         $temp = 'formatter___' . $fields['type'];
         $temp = new $temp();
         if (method_exists($temp, 'ttf_tokens')) {
             $tokens = array_merge($tokens, $temp->ttf_tokens());
         }
     } else {
         if (method_exists($this->formatter, 'ttf_tokens')) {
             $tokens = array_merge($tokens, $this->formatter->ttf_tokens());
         }
     }
     $ttfShell = file_get_contents($tplfile);
     $ttfShell = str_replace(array_keys($tokens), $tokens, $ttfShell);
     $ttfShell = str_replace('/* CLASS NAME */', $classname, $ttfShell);
     // Write the file
     if (!is_writable(dirname($file)) || !($write = General::writeFile($file, $ttfShell, Symphony::Configuration()->get('write_mode', 'file')))) {
         $this->pageAlert(__('Failed to write Text Formatter source to <code>%s</code>. Please check permissions.', array($file)), Alert::ERROR);
     } else {
         if ($queueForDeletion || !$about['name']) {
             if ($queueForDeletion) {
                 General::deleteFile($queueForDeletion);
             }
             // TODO: Find a way to make formatted fields update their content
             $_SESSION['templatedtextformatters-alert'] = 'created';
             redirect(URL . '/symphony/extension/templatedtextformatters/edit/' . $classname);
         } else {
             // Update current data
             $_SESSION['templatedtextformatters-alert'] = 'saved';
             $_POST['fields']['name'] = $tokens['/* NAME */'];
             $_POST['fields']['description'] = $tokens['/* DESCRIPTION */'];
         }
     }
 }
开发者ID:ahwayakchih,项目名称:templatedtextformatters,代码行数:96,代码来源:content.edit.php


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