當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfContext::getModuleName方法代碼示例

本文整理匯總了PHP中sfContext::getModuleName方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfContext::getModuleName方法的具體用法?PHP sfContext::getModuleName怎麽用?PHP sfContext::getModuleName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sfContext的用法示例。


在下文中一共展示了sfContext::getModuleName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getThemeForRequest

 /**
  * Attempts to return the theme for the current request
  * 
  * This first throws a sympal.theme.set_theme_from_request event, giving
  * anyone the opportunity to determine the theme. If this event is not
  * handled, we continue with some default rules for setting themes.
  * 
  * @param sfContext $context
  * @param array An array of valid themes, to be used for user-entered themes
  * 
  * @return string The theme (defaults to the default theme)
  */
 public function getThemeForRequest(sfContext $context, $validThemes)
 {
     $event = $context->getEventDispatcher()->notifyUntil(new sfEvent($this, 'theme.set_theme_from_request', array('context' => $context)));
     if ($event->isProcessed()) {
         return $event->getReturnValue();
     }
     if ($this->getOption('allow_changing_theme_by_url', true)) {
         $user = $context->getUser();
         $request = $context->getRequest();
         if ($theme = $request->getParameter($this->getOption('theme_request_parameter_name', 'sf_theme'))) {
             // make sure the theme is valid
             if (in_array($theme, $validThemes)) {
                 $user->setCurrentTheme($theme);
                 return $theme;
             } else {
                 // unset the user attribute
                 $user->setCurrentTheme(false);
             }
         }
         if ($theme = $user->getCurrentTheme()) {
             return $theme;
         }
     }
     // Get the theme from module/route. False is a valid response (don't set theme)
     $module = $context->getModuleName();
     $route = $context->getRouting()->getCurrentRouteName();
     $theme = $this->getThemeFromConfig($module, $route);
     if ($theme || $theme === false) {
         return $theme;
     }
     return $this->getOption('default_theme');
 }
開發者ID:rafaelgou,項目名稱:sfThemePlugin,代碼行數:44,代碼來源:sfThemeController.class.php

示例2: decomposeURL

 public static function decomposeURL(sfContext $context, sfRequest $request)
 {
     $module = $context->getModuleName();
     $action = $context->getActionName();
     $parameters = $request->getParameterHolder()->getAll();
     return array("module" => $module, "action" => $action, "parameters" => $parameters);
 }
開發者ID:rafd,項目名稱:SkuleCourses,代碼行數:7,代碼來源:skuleadminConst.class.php

示例3: getActionName

 /**
  * Get the current action name, with translatio, if possible
  *
  * @param sfContext $context
  *
  * @return string
  */
 public static function getActionName(sfContext $context)
 {
     $modulename = $context->getModuleName();
     $actionname = $context->getActionName();
     $translation = self::getProperty("translator", array());
     return isset($translation[$modulename]["actions"][$actionname]) ? $translation[$modulename]["actions"][$actionname] : $actionname;
 }
開發者ID:Richtermeister,項目名稱:sfAdminDashPlugin,代碼行數:14,代碼來源:sfAdminDash.class.php

示例4: loadSfExtension

 /**
  * Загрузка старнадтного helper'a symfony
  */
 public function loadSfExtension()
 {
     $this->sfContext->getConfiguration()->loadHelpers(func_get_args(), $this->sfContext->getModuleName());
 }
開發者ID:krissym,項目名稱:sfTwigPlugin,代碼行數:7,代碼來源:sfHelperTwigExtension.class.php


注:本文中的sfContext::getModuleName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。