/**
  * 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;
 }
 /**
  * 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;
     }
 }
 /**
  * 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);
 }