本文整理汇总了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');
}
示例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);
}
示例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;
}
示例4: loadSfExtension
/**
* Загрузка старнадтного helper'a symfony
*/
public function loadSfExtension()
{
$this->sfContext->getConfiguration()->loadHelpers(func_get_args(), $this->sfContext->getModuleName());
}