• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfRouting类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addRoute

 /**
  * addRoute - prepend a route to given routing object with abstraction of
  * symfony version
  *
  * @param  sfRouting $r
  * @param  string $routeName
  * @param  string $routeUrl
  * @param  array $routeParameters
  * @return void
  */
 protected static function addRoute(sfRouting $r, $routeName, $routePattern, $routeDefaults, $routeRequirements = array(), $routeOptions = array())
 {
     if (self::$newStyleRoutes) {
         $r->prependRoute(self::ROUTE . '_' . $routeName, new sfRoute($routePattern, $routeDefaults, $routeRequirements, $routeOptions));
     } else {
         $r->prependRoute(self::ROUTE . '_' . $routeName, $routePattern, $routeDefaults, $routeRequirements);
     }
 }
开发者ID:ericroge,项目名称:sfdynamicsplugin,代码行数:18,代码来源:sfDynamicsRouting.class.php


示例2: getInstance

 /**
  * Retrieve the singleton instance of this class.
  *
  * @return  sfRouting The sfRouting implementation instance
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new sfRouting();
     }
     return self::$instance;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:12,代码来源:sfRouting.class.php


示例3: loadConfiguration

 /**
  * @see sfRouting
  */
 public function loadConfiguration()
 {
     if (!is_null($this->cache) && ($routes = $this->cache->get('symfony.routing.configuration'))) {
         $this->routes = unserialize($routes);
         $this->routesFullyLoaded = false;
     } else {
         if ($this->options['load_configuration'] && ($config = sfContext::getInstance()->getConfigCache()->checkConfig('config/routing.yml', true))) {
             $this->setRoutes(include $config);
         }
         parent::loadConfiguration();
         if (!is_null($this->cache)) {
             if (!$this->options['lazy_routes_deserialize']) {
                 $this->cache->set('symfony.routing.configuration', serialize($this->routes));
             } else {
                 $lazyMap = array();
                 foreach ($this->routes as $name => $route) {
                     if (is_string($route)) {
                         $route = $this->loadRoute($name);
                     }
                     $lazyMap[$name] = serialize($route);
                 }
                 $this->cache->set('symfony.routing.configuration', serialize($lazyMap));
             }
         }
     }
 }
开发者ID:yasirgit,项目名称:afids,代码行数:29,代码来源:sfPatternRouting.class.php


示例4: setDefaultParameters

 /**
  * @see sfRouting
  */
 public function setDefaultParameters($parameters)
 {
     parent::setDefaultParameters($parameters);
     foreach ($this->routes as $route) {
         if (is_object($route)) {
             $route->setDefaultParameters($this->defaultParameters);
         }
     }
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:12,代码来源:sfPatternRouting.class.php


示例5: loadConfiguration

 /**
  * @see sfRouting
  */
 public function loadConfiguration()
 {
     if ($this->options['load_configuration'] && ($config = sfContext::getInstance()->getConfigCache()->checkConfig('config/routing.yml', true))) {
         foreach (include $config as $name => $route) {
             $this->routes[$name] = $route;
         }
     }
     parent::loadConfiguration();
 }
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:12,代码来源:sfPatternRouting.class.php


示例6: initializeSwitch

 /**
  * Initialize the vars for language switch
  *
  * @access protected
  * @param  void
  * @return void
  */
 protected function initializeSwitch()
 {
     if (method_exists($this->getContext(), 'getRouting')) {
         $this->routing = $this->getContext()->getRouting();
     } else {
         $this->routing = sfRouting::getInstance();
     }
     $this->request = $this->getContext()->getRequest();
     $this->languages_available = array('en' => array('title' => 'English', 'image' => '/sfLanguageSwitch/images/flag/gb.png'));
 }
开发者ID:net7,项目名称:Talia-CMS,代码行数:17,代码来源:BasesfLanguageSwitchComponents.class.php


示例7: execute

 /**
  * Executes this configuration handler.
  *
  * @param array An array of absolute filesystem path to a configuration file
  *
  * @return string Data to be written to a cache file
  *
  * @throws sfConfigurationException If a requested configuration file does not exist or is not readable
  * @throws sfParseException If a requested configuration file is improperly formatted
  */
 public function execute($configFiles)
 {
     // parse the yaml
     $config = $this->parseYamls($configFiles);
     // connect routes
     $routes = sfRouting::getInstance();
     foreach ($config as $name => $params) {
         $routes->connect($name, $params['url'] ? $params['url'] : '/', isset($params['param']) ? $params['param'] : array(), isset($params['requirements']) ? $params['requirements'] : array());
     }
     // compile data
     $retval = sprintf("<?php\n" . "// auto-generated by sfRoutingConfigHandler\n" . "// date: %s\n\$routes = sfRouting::getInstance();\n\$routes->setRoutes(\n%s\n);\n", date('Y/m/d H:i:s'), var_export($routes->getRoutes(), 1));
     return $retval;
 }
开发者ID:taryono,项目名称:school,代码行数:23,代码来源:sfRoutingConfigHandler.class.php


示例8: executeLogin

 public function executeLogin()
 {
     if ($this->getRequest()->getMethod() != sfRequest::POST) {
         $r = sfRouting::getInstance();
         if ($r->getCurrentRouteName() == 'login') {
             $this->getRequest()->setAttribute('referer', $this->getRequest()->getReferer());
         } else {
             $this->getRequest()->setAttribute('referer', $r->getCurrentInternalUri());
         }
     } else {
         $this->redirect($this->getRequestParameter('referer', '@homepage'));
     }
 }
开发者ID:noose,项目名称:Planeta,代码行数:13,代码来源:actions.class.php


示例9: loadConfiguration

 /**
  * @see sfRouting
  */
 public function loadConfiguration()
 {
     if (!is_null($this->cache) && ($routes = $this->cache->get('symfony.routing.configuration'))) {
         $this->routes = unserialize($routes);
     } else {
         if ($this->options['load_configuration'] && ($config = sfContext::getInstance()->getConfigCache()->checkConfig('config/routing.yml', true))) {
             include $config;
         }
         parent::loadConfiguration();
         if (!is_null($this->cache)) {
             $this->cache->set('symfony.routing.configuration', serialize($this->routes));
         }
     }
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:17,代码来源:sfPatternRouting.class.php


示例10: executeList

 public function executeList()
 {
     $type = $this->getRequestParameter('type', 'all');
     $c = $this->{'list' . $type}();
     $c->addDescendingOrderByColumn(PostPeer::CREATED_AT);
     $c->add(PostPeer::DELETED, false);
     $pager = new sfPropelPager('Post', sfConfig::get('app_post_per_page', 7));
     $pager->setCriteria($c);
     $pager->setPage($this->getRequestParameter('page', 1));
     $pager->setPeerMethod('doSelectJoinAll');
     $pager->init();
     $this->pager = $pager;
     $r = sfRouting::getInstance();
     $this->iuri = $r->getCurrentRouteName() == 'homepage' ? '@posts?page=1' : $r->getCurrentInternalUri(true);
 }
开发者ID:noose,项目名称:Planeta,代码行数:15,代码来源:actions.class.php


示例11: execute

  public function execute ($filterChain)
  {
    // execute next filter
    $filterChain->execute();

    $response = $this->getContext()->getResponse();

    // execute this filter only if cache is set and no GET or POST parameters
    // execute this filter not in debug mode, only if no_script_name and for 200 response code
    if (
      (!sfConfig::get('sf_cache') || count($_GET) || count($_POST))
      ||
      (sfConfig::get('sf_debug') || !sfConfig::get('sf_no_script_name') || $response->getStatusCode() != 200)
    )
    {
      return;
    }

    // only if cache is set for the entire page
    $cacheManager = $this->getContext()->getViewCacheManager();
    $uri = sfRouting::getInstance()->getCurrentInternalUri();
    if ($cacheManager->isCacheable($uri) && $cacheManager->withLayout($uri))
    {
      // save super cache
      $request = $this->getContext()->getRequest();
      $pathInfo = $request->getPathInfo();
      $file = sfConfig::get('sf_web_dir').'/'.$this->getParameter('cache_dir', 'cache').'/'.$request->getHost().('/' == $pathInfo[strlen($pathInfo) - 1] ? $pathInfo.'index.html' : $pathInfo);
      $current_umask = umask();
      umask(0000);
      $dir = dirname($file);
      if (!is_dir($dir))
      {
        mkdir($dir, 0777, true);
      }
      file_put_contents($file, $this->getContext()->getResponse()->getContent());
      chmod($file, 0666);
      umask($current_umask);
    }
  }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:39,代码来源:sfSuperCacheFilter.class.php


示例12: stop

 /**
  * Stops the fragment cache.
  *
  * @param string Unique fragment name
  *
  * @return boolean true, if success otherwise false
  */
 public function stop($name)
 {
     $data = ob_get_clean();
     // save content to cache
     $internalUri = sfRouting::getInstance()->getCurrentInternalUri();
     try {
         $this->set($data, $internalUri . (strpos($internalUri, '?') ? '&' : '?') . '_sf_cache_key=' . $name);
     } catch (Exception $e) {
     }
     return $data;
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:18,代码来源:sfViewCacheManager.class.php


示例13: array

<?php

// Adding polls routes if option has not been disabled in app.yml
// @see http://www.symfony-project.com/book/trunk/09-Links-and-the-Routing-System#Creating%20Rules%20Without%20routing.yml
if (sfConfig::get('app_sfPropelPollsPlugin_routes_register', true) && in_array('sfPolls', sfConfig::get('sf_enabled_modules'))) {
    $r = sfRouting::getInstance();
    # Polls list route
    $r->prependRoute('sf_propel_polls_list', '/polls', array('module' => 'sfPolls', 'action' => 'list'), array('id' => '\\d+'));
    # Poll detail (form) route
    $r->prependRoute('sf_propel_polls_detail', '/poll_detail/:id', array('module' => 'sfPolls', 'action' => 'detail'), array('id' => '\\d+'));
    # Poll results route
    $r->prependRoute('sf_propel_polls_results', '/poll_results/:id', array('module' => 'sfPolls', 'action' => 'results'), array('id' => '\\d+'));
    # Poll vote route
    $r->prependRoute('sf_propel_polls_vote', '/poll_vote', array('module' => 'sfPolls', 'action' => 'vote'), array('id' => '\\d+'));
}
开发者ID:sgrove,项目名称:cothinker,代码行数:15,代码来源:config.php


示例14: sfGeoFeedItem

<?php

$feedItem = new sfGeoFeedItem();
$i18n = $item['ArticleI18n'][0];
$feedItem->setTitle($i18n['name']);
$id = $item['id'];
$lang = $i18n['culture'];
$feedItem->setLink("@document_by_id_lang_slug?module=articles&id={$id}&lang={$lang}&slug=" . make_slug($i18n['name']));
$feedItem->setUniqueId(sfRouting::getInstance()->getCurrentInternalUri() . '_' . $id);
$feedItem->setAuthorName($item['creator']);
$feedItem->setPubdate(strtotime($item['creation_date']));
$data = array();
$data[] = get_paginated_value_from_list($item['categories'], 'mod_articles_categories_list');
if (isset($item['activities']) && is_string($item['activities'])) {
    $data[] = get_paginated_activities($item['activities'], true);
}
$data[] = get_paginated_value($item['article_type'], 'mod_articles_article_types_list');
$feedItem->setDescription(implode(' - ', $data));
$feed->addItem($feedItem);
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:19,代码来源:_rss_item.php


示例15: getItemFeedLink

 private static function getItemFeedLink($item, $routeName = '', $fallback_url = '')
 {
     if ($routeName) {
         if (method_exists('sfRouting', 'getInstance')) {
             $route = sfRouting::getInstance()->getRouteByName($routeName);
             $url = $route[0];
             $paramNames = $route[2];
             $defaults = $route[4];
         } else {
             $routes = sfContext::getInstance()->getRouting()->getRoutes();
             $route = $routes[substr($routeName, 1)];
             if ($route instanceof sfRoute) {
                 $url = $route->getPattern();
                 $paramNames = array_keys($route->getVariables());
                 $defaults = $route->getDefaults();
             } else {
                 $url = $route[0];
                 $paramNames = array_keys($route[2]);
                 $defaults = $route[3];
             }
         }
         // we get all parameters
         $params = array();
         foreach ($paramNames as $paramName) {
             $value = null;
             $name = ucfirst(sfInflector::camelize($paramName));
             $found = false;
             foreach (array('getFeed' . $name, 'get' . $name) as $methodName) {
                 if (method_exists($item, $methodName)) {
                     $value = $item->{$methodName}();
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 if (array_key_exists($paramName, $defaults)) {
                     $value = $defaults[$paramName];
                 } else {
                     $error = 'Cannot find a "getFeed%s()" or "get%s()" method for object "%s" to generate URL with the "%s" route';
                     $error = sprintf($error, $name, $name, get_class($item), $routeName);
                     throw new sfException($error);
                 }
             }
             $params[] = $paramName . '=' . $value;
         }
         return sfContext::getInstance()->getController()->genUrl($routeName . ($params ? '?' . implode('&', $params) : ''), true);
     }
     foreach (array('getFeedLink', 'getLink', 'getUrl') as $methodName) {
         if (method_exists($item, $methodName)) {
             return sfContext::getInstance()->getController()->genUrl($item->{$methodName}(), true);
         }
     }
     if ($fallback_url) {
         return sfContext::getInstance()->getController()->genUrl($fallback_url, true);
     } else {
         return sfContext::getInstance()->getController()->genUrl('/', true);
     }
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:58,代码来源:sfFeedPeer.class.php


示例16: array

<?php

// auto-generated by sfRoutingConfigHandler
// date: 2015/09/01 13:56:04
$routes = sfRouting::getInstance();
$routes->setRoutes(array('homepage' => array(0 => '/', 1 => '/^[\\/]*$/', 2 => array(), 3 => array(), 4 => array('module' => 'admin', 'action' => 'index'), 5 => array(), 6 => ''), 'listmodules' => array(0 => '/listmodules', 1 => '#^/listmodules$#', 2 => array(), 3 => array(), 4 => array('module' => 'admin', 'action' => 'listmodules'), 5 => array(), 6 => ''), 'default_symfony' => array(0 => '/symfony/:action/*', 1 => '#^/symfony(?:\\/([^\\/]+))?(?:\\/(.*))?$#', 2 => array(0 => 'action'), 3 => array('action' => 1), 4 => array('module' => 'default'), 5 => array(), 6 => ''), 'default_index' => array(0 => '/:module', 1 => '#^(?:\\/([^\\/]+))?$#', 2 => array(0 => 'module'), 3 => array('module' => 1), 4 => array('action' => 'index'), 5 => array(), 6 => ''), 'default' => array(0 => '/:module/:action/*', 1 => '#^(?:\\/([^\\/]+))?(?:\\/([^\\/]+))?(?:\\/(.*))?$#', 2 => array(0 => 'module', 1 => 'action'), 3 => array('module' => 1, 'action' => 1), 4 => array(), 5 => array(), 6 => ''), 'login' => array(0 => '/login', 1 => '#^/login$#', 2 => array(), 3 => array(), 4 => array('module' => 'user', 'action' => 'login'), 5 => array(), 6 => '')));
开发者ID:kotow,项目名称:work,代码行数:6,代码来源:config_routing.yml.php


示例17: execute

 /**
  * Executes this filter.
  *
  * @param sfFilterChain The filter chain
  *
  * @throws <b>sfInitializeException</b> If an error occurs during view initialization.
  * @throws <b>sfViewException</b>       If an error occurs while executing the view.
  */
 public function execute($filterChain)
 {
     // get the context and controller
     $context = $this->getContext();
     $controller = $context->getController();
     // get the current action instance
     $actionEntry = $controller->getActionStack()->getLastEntry();
     $actionInstance = $actionEntry->getActionInstance();
     // get the current action information
     $moduleName = $context->getModuleName();
     $actionName = $context->getActionName();
     // get the request method
     $method = $context->getRequest()->getMethod();
     $viewName = null;
     if (sfConfig::get('sf_cache')) {
         $uri = sfRouting::getInstance()->getCurrentInternalUri();
         if (null !== $context->getResponse()->getParameter($uri . '_action', null, 'symfony/cache')) {
             // action in cache, so go to the view
             $viewName = sfView::SUCCESS;
         }
     }
     if (!$viewName) {
         if (($actionInstance->getRequestMethods() & $method) != $method) {
             // this action will skip validation/execution for this method
             // get the default view
             $viewName = $actionInstance->getDefaultView();
         } else {
             // set default validated status
             $validated = true;
             // the case of the first letter of the action is insignificant
             // get the current action validation configuration
             $validationConfigWithFirstLetterLower = $moduleName . '/' . sfConfig::get('sf_app_module_validate_dir_name') . '/' . strtolower(substr($actionName, 0, 1)) . substr($actionName, 1) . '.yml';
             $validationConfigWithFirstLetterUpper = $moduleName . '/' . sfConfig::get('sf_app_module_validate_dir_name') . '/' . ucfirst($actionName) . '.yml';
             // determine $validateFile by testing both the uppercase and lowercase
             // types of validation configurations.
             $validateFile = null;
             if (!is_null($testValidateFile = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name') . '/' . $validationConfigWithFirstLetterLower, true))) {
                 $validateFile = $testValidateFile;
             } else {
                 if (!is_null($testValidateFile = sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name') . '/' . $validationConfigWithFirstLetterUpper, true))) {
                     $validateFile = $testValidateFile;
                 }
             }
             // load validation configuration
             // do NOT use require_once
             if (!is_null($validateFile)) {
                 // create validator manager
                 $validatorManager = new sfValidatorManager();
                 $validatorManager->initialize($context);
                 require $validateFile;
                 // process validators
                 $validated = $validatorManager->execute();
             }
             // process manual validation
             $validateToRun = 'validate' . ucfirst($actionName);
             $manualValidated = method_exists($actionInstance, $validateToRun) ? $actionInstance->{$validateToRun}() : $actionInstance->validate();
             // action is validated if:
             // - all validation methods (manual and automatic) return true
             // - or automatic validation returns false but errors have been 'removed' by manual validation
             $validated = $manualValidated && $validated || $manualValidated && !$validated && !$context->getRequest()->hasErrors();
             // register fill-in filter
             if (null !== ($parameters = $context->getRequest()->getAttribute('fillin', null, 'symfony/filter'))) {
                 $this->registerFillInFilter($filterChain, $parameters);
             }
             if ($validated) {
                 if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
                     $timer = sfTimerManager::getTimer(sprintf('Action "%s/%s"', $moduleName, $actionName));
                 }
                 // execute the action
                 $actionInstance->preExecute();
                 $viewName = $actionInstance->execute();
                 if ($viewName == '') {
                     $viewName = sfView::SUCCESS;
                 }
                 $actionInstance->postExecute();
                 if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
                     $timer->addTime();
                 }
             } else {
                 if (sfConfig::get('sf_logging_enabled')) {
                     $this->context->getLogger()->info('{sfFilter} action validation failed');
                 }
                 // validation failed
                 $handleErrorToRun = 'handleError' . ucfirst($actionName);
                 $viewName = method_exists($actionInstance, $handleErrorToRun) ? $actionInstance->{$handleErrorToRun}() : $actionInstance->handleError();
                 if ($viewName == '') {
                     $viewName = sfView::ERROR;
                 }
             }
         }
     }
     if ($viewName == sfView::HEADER_ONLY) {
//.........这里部分代码省略.........
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:101,代码来源:sfExecutionFilter.class.php


示例18: addNotice

 protected function addNotice($terms, $from = null)
 {
     $content = $this->getContext()->getResponse()->getContent();
     $term_string = implode($terms, ', ');
     $route = $route = sfRouting::getInstance()->getCurrentInternalUri();
     $route = preg_replace('/(\\?|&)' . $this->getHighlightQs() . '=.*?(&|$)/', '$1', $route);
     $route = $this->getContext()->getController()->genUrl($route);
     $remove_string = $this->translate($this->getRemoveString(), array('%url%' => $route));
     if ($from) {
         $message = $this->translate($this->getNoticeRefererString(), array('%from%' => $from, '%keywords%' => $term_string, '%remove%' => $remove_string));
     } else {
         $message = $this->translate($this->getNoticeString(), array('%keywords%' => $term_string, '%remove%' => $remove_string));
     }
     $content = str_replace($this->getNoticeTag(), $message, $content);
     $this->getContext()->getResponse()->setContent($content);
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:16,代码来源:sfSolrHighlightFilter.class.php


示例19: executeBeforeRendering

 /**
  * Executes this filter.
  *
  * @param sfFilterChain A sfFilterChain instance.
  */
 public function executeBeforeRendering()
 {
     // cache only 200 HTTP status
     if (200 != $this->response->getStatusCode()) {
         return;
     }
     $uri = sfRouting::getInstance()->getCurrentInternalUri();
     // save page in cache
     if (isset($this->cache[$uri]) && $this->cache[$uri]['page']) {
         // set some headers that deals with cache
         if ($lifetime = $this->cacheManager->getClientLifeTime($uri, 'page')) {
             $this->response->setHttpHeader('Last-Modified', $this->response->getDate(time()), false);
             $this->response->setHttpHeader('Expires', $this->response->getDate(time() + $lifetime), false);
             $this->response->addCacheControlHttpHeader('max-age', $lifetime);
         }
         // set Vary headers
         foreach ($this->cacheManager->getVary($uri, 'page') as $vary) {
             $this->response->addVaryHttpHeader($vary);
         }
         $this->setPageCache($uri);
     } else {
         if (isset($this->cache[$uri]) && $this->cache[$uri]['action']) {
             // save action in cache
             $this->setActionCache($uri);
         }
     }
     // remove PHP automatic Cache-Control and Expires headers if not overwritten by application or cache
     if ($this->response->hasHttpHeader('Last-Modified') || sfConfig::get('sf_etag')) {
         // FIXME: these headers are set by PHP sessions (see session_cache_limiter())
         $this->response->setHttpHeader('Cache-Control', null, false);
         $this->response->setHttpHeader('Expires', null, false);
         $this->response->setHttpHeader('Pragma', null, false);
     }
     // Etag support
     if (sfConfig::get('sf_etag')) {
         $etag = '"' . md5($this->response->getContent()) . '"';
         $this->response->setHttpHeader('ETag', $etag);
         if ($this->request->getHttpHeader('IF_NONE_MATCH') == $etag) {
             $this->response->setStatusCode(304);
             $this->response->setHeaderOnly(true);
             if (sfConfig::get('sf_logging_enabled')) {
                 $this->getContext()->getLogger()->info('{sfFilter} ETag matches If-None-Match (send 304)');
             }
         }
     }
     // conditional GET support
     // never in debug mode
     if ($this->response->hasHttpHeader('Last-Modified') && !sfConfig::get('sf_debug')) {
         $last_modified = $this->response->getHttpHeader('Last-Modified');
         if ($this->request->getHttpHeader('IF_MODIFIED_SINCE') == $last_modified) {
             $this->response->setStatusCode(304);
             $this->response->setHeaderOnly(true);
             if (sfConfig::get('sf_logging_enabled')) {
                 $this->getContext()->getLogger()->info('{sfFilter} Last-Modified matches If-Modified-Since (send 304)');
             }
         }
     }
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:63,代码来源:sfCacheFilter.class.php


示例20: dirname

 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
require_once $_test_dir . '/unit/sfContextMock.class.php';
class myRequest extends sfRequest
{
    function shutdown()
    {
    }
}
class fakeRequest
{
}
$t = new lime_test(54, new lime_output_color());
$context = new sfContext();
sfRouting::getInstance()->clearRoutes();
// ::newInstance()
$t->diag('::newInstance()');
$t->isa_ok(sfRequest::newInstance('myRequest'), 'myRequest', '::newInstance() takes a request class as its first parameter');
$t->isa_ok(sfRequest::newInstance('myRequest'), 'myRequest', '::newInstance() returns an instance of myRequest');
try {
    sfRequest::newInstance('fakeRequest');
    $t->fail('::newInstance() throws a sfFactoryException if the class does not extends sfRequest');
} catch (sfFactoryException $e) {
    $t->pass('::newInstance() throws a sfFactoryException if the class does not extends sfRequest');
}
// ->initialize()
$t->diag('->initialize()');
$request = sfRequest::newInstance('myRequest');
$t->is($request->getContext(), null, '->initialize() takes a sfContext object as its first argument');
$request->initialize($context, array('foo' => 'bar'));
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:31,代码来源:sfRequestTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfSessionStorage类代码示例发布时间:2022-05-23
下一篇:
PHP sfRoute类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap