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


PHP EventManager::__getHandleFromFilename方法代码示例

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


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

示例1: 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


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