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


PHP sfRoute::getDefaults方法代码示例

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


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

示例1: getContextEngineSlug

 /**
  * If an engine page has already been pushed or we are on an engine page now,
  * returns that engine page slug. Otherwise returns null. Useful to determine
  * whether you should get clever or not in a getEngineSlug() method for an
  * aDoctrineRoute.
  *
  * @param  sfRoute $route
  *
  * @return string The engine slug, or null
  */
 public static function getContextEngineSlug(sfRoute $route)
 {
     $defaults = $route->getDefaults();
     $currentPage = aTools::getCurrentPage();
     $engine = $defaults['module'];
     if (isset(self::$targetEnginePageSlugs[$engine]) && count(self::$targetEnginePageSlugs[$engine])) {
         return end(self::$targetEnginePageSlugs[$engine]);
     } elseif ($currentPage && $currentPage->engine === $defaults['module']) {
         return $currentPage->slug;
     } else {
         return null;
     }
 }
开发者ID:hashir,项目名称:UoA,代码行数:23,代码来源:aRouteTools.php

示例2: addPageToUrl

 /**
  * Prepends the current CMS page to the URL.
  *
  * @param  string $url The URL so far obtained from parent::generate
  * @param  Boolean $absolute  Whether to generate an absolute URL
  *
  * @return string The generated URL
  */
 public static function addPageToUrl(sfRoute $route, $url, $absolute)
 {
     $defaults = $route->getDefaults();
     $currentPage = aTools::getCurrentPage();
     $engine = $defaults['module'];
     if (isset(self::$targetEnginePages[$engine]) && count(self::$targetEnginePages[$engine])) {
         $page = end(self::$targetEnginePages[$engine]);
     } elseif (!$currentPage || $currentPage->engine !== $defaults['module']) {
         $page = aPageTable::getFirstEnginePage($defaults['module']);
     } else {
         $page = $currentPage;
     }
     if (!$page) {
         throw new sfException('Attempt to generate aRoute URL for module ' . $defaults['module'] . ' with no matching engine page on the site');
     }
     // A route URL of / for an engine route maps to the page itself, without a trailing /
     if ($url === '/') {
         $url = '';
     }
     // Ditto for / followed by a query string (missed this before)
     if (substr($url, 0, 2) === '/?') {
         $url = substr($url, 1);
     }
     $pageUrl = $page->getUrl($absolute);
     // Strip controller off so it doesn't duplicate the controller in the
     // URL we just generated. We could use the slug directly, but that would
     // break if the CMS were not mounted at the root on a particular site.
     // Take care to function properly in the presence of an absolute URL
     if (preg_match("/^(https?:\\/\\/[^\\/]+)?\\/[^\\/]+\\.php(.*)\$/", $pageUrl, $matches)) {
         $pageUrl = $matches[2];
     }
     return $pageUrl . $url;
 }
开发者ID:verenate,项目名称:gri,代码行数:41,代码来源:aRouteTools.php

示例3: getSecurityConfigForRoute

 /**
  * get the security settings for a route
  *
  * @param sfRoute $route
  * @return array
  */
 protected function getSecurityConfigForRoute(sfRoute $route)
 {
     $route_defaults = $route->getDefaults() ? $route->getDefaults() : $route->getDefaultParameters();
     $config = $this->context->getConfiguration();
     if ($file = $config->getConfigCache()->checkConfig('modules/' . $route_defaults['module'] . '/config/security.yml', true)) {
         require $file;
     } else {
         $this->security = array();
     }
     $secure = $this->getSecurityValue($route_defaults['action'], 'is_secure');
     $credentials = $this->getSecurityValue($route_defaults['action'], 'credentials');
     if (!is_null($credentials) && !is_array($credentials)) {
         $credentials = array($credentials);
     }
     return array('is_secure' => $secure, 'credentials' => $credentials);
 }
开发者ID:vicb,项目名称:ioMenuPlugin,代码行数:22,代码来源:ioMenuConfigHandler.class.php


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