本文整理汇总了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;
}
示例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;
}
}
示例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);
}