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


PHP Symphony::getPageNamespace方法代码示例

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


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

示例1: translate

 /**
  * This function is an internal alias for `__()`.
  *
  * @since Symphony 2.3
  * @see toolkit.__()
  * @param string $string
  *  The string that should be translated
  * @param array $inserts (optional)
  *  Optional array used to replace translation placeholders, defaults to NULL
  * @param string $namespace (optional)
  *  Optional string used to define the namespace, defaults to NULL.
  * @return string
  *  Returns the translated string
  */
 public static function translate($string, array $inserts = null, $namespace = null)
 {
     if (is_null($namespace) && class_exists('Symphony')) {
         $namespace = Symphony::getPageNamespace();
     }
     if (isset($namespace) && isset(self::$_dictionary[$namespace][$string])) {
         $translated = self::$_dictionary[$namespace][$string];
     } else {
         if (isset(self::$_dictionary[$string])) {
             $translated = self::$_dictionary[$string];
         } else {
             $translated = $string;
         }
     }
     $translated = empty($translated) ? $string : $translated;
     // Replace translation placeholders
     if (is_array($inserts) && !empty($inserts)) {
         $translated = vsprintf($translated, $inserts);
     }
     return $translated;
 }
开发者ID:nickdunn,项目名称:elasticsearch-surfin-shakespeare,代码行数:35,代码来源:class.lang.php

示例2: canAccessPage

 /**
  * Checks the current Symphony Author can access the current page.
  * This check uses the `ASSETS . /navigation.xml` file to determine
  * if the current page (or the current page namespace) can be viewed
  * by the currently logged in Author.
  *
  * @link http://github.com/symphonycms/symphony-2/blob/master/symphony/assets/navigation.xml
  * @return boolean
  *  True if the Author can access the current page, false otherwise
  */
 public function canAccessPage()
 {
     $nav = $this->getNavigationArray();
     $page = '/' . trim(getCurrentPage(), '/') . '/';
     $page_limit = 'author';
     foreach ($nav as $item) {
         if (General::in_array_multi($page, $item['children']) or General::in_array_multi(Symphony::getPageNamespace() . '/', $item['children'])) {
             if (is_array($item['children'])) {
                 foreach ($item['children'] as $c) {
                     if ($c['link'] == $page && isset($c['limit'])) {
                         $page_limit = $c['limit'];
                     }
                 }
             }
             if (isset($item['limit']) && $page_limit != 'primary') {
                 if ($page_limit == 'author' && $item['limit'] == 'developer') {
                     $page_limit = 'developer';
                 }
             }
         } else {
             if (isset($item['link']) && $page == $item['link'] && isset($item['limit'])) {
                 $page_limit = $item['limit'];
             }
         }
     }
     if ($page_limit == 'author' or $page_limit == 'developer' && Administration::instance()->Author->isDeveloper() or $page_limit == 'primary' && Administration::instance()->Author->isPrimaryAccount()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:nickdunn,项目名称:elasticsearch-surfin-shakespeare,代码行数:41,代码来源:class.administrationpage.php

示例3: canAccessPage

 /**
  * Checks the current Symphony Author can access the current page.
  * This check uses the `ASSETS . /xml/navigation.xml` file to determine
  * if the current page (or the current page namespace) can be viewed
  * by the currently logged in Author.
  *
  * @link http://github.com/symphonycms/symphony-2/blob/master/symphony/assets/xml/navigation.xml
  * @return boolean
  *  True if the Author can access the current page, false otherwise
  */
 public function canAccessPage()
 {
     $nav = $this->getNavigationArray();
     $page = '/' . trim(getCurrentPage(), '/') . '/';
     $page_limit = 'author';
     foreach ($nav as $item) {
         if (General::in_array_multi($page, $item['children']) or General::in_array_multi(Symphony::getPageNamespace() . '/', $item['children'])) {
             if (is_array($item['children'])) {
                 foreach ($item['children'] as $c) {
                     if ($c['link'] === $page && isset($c['limit'])) {
                         $page_limit = $c['limit'];
                     }
                 }
             }
             if (isset($item['limit']) && $page_limit !== 'primary') {
                 if ($page_limit === 'author' && $item['limit'] === 'developer') {
                     $page_limit = 'developer';
                 }
             }
         } elseif (isset($item['link']) && $page === $item['link'] && isset($item['limit'])) {
             $page_limit = $item['limit'];
         }
     }
     return $this->doesAuthorHaveAccess($page_limit);
 }
开发者ID:roshinebagha,项目名称:Symphony-Test,代码行数:35,代码来源:class.administrationpage.php


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