本文整理汇总了PHP中Dispatcher::getAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::getAction方法的具体用法?PHP Dispatcher::getAction怎么用?PHP Dispatcher::getAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::getAction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run()
{
$router = new Router();
$dispatcher = new Dispatcher($router, array("requireViewFile" => !in_array($router->getAction(), array_keys(static::$actionsWithDataOnly))));
static::$dispatcher =& $dispatcher;
$action = $dispatcher->getAction();
$controller = $dispatcher->getController();
$lang = $dispatcher->getLang();
$module = $dispatcher->getModule();
$permission = $dispatcher->getPermission();
$view = $dispatcher->getView();
$info = array("action" => $action, "controller" => $controller, "data" => $dispatcher->getData(), "extra" => $dispatcher->getExtra(), "lang" => $lang, "module" => $module, "view" => $view);
if ($permission::getPermission($action, Session::getPerm(), $info) === false) {
$dispatcher->setError(403);
$info["action"] = $action = $dispatcher->getAction();
$info["controller"] = $controller = $dispatcher->getController();
$info["module"] = $module = $dispatcher->getModule();
$info["view"] = $view = $dispatcher->getView();
}
//TASK: przeniesc do __constructStatic, znalezc inne wywolania __init i to samo!
$view::__init($action);
$view::obStart();
if (array_key_exists($action, static::$actionsWithDataOnly)) {
header("Content-Type: " . static::$actionsWithDataOnly[$action]);
//TODO: czy metody withDataOnly powinny otrzymywac argument $viewParams["info"] ?
if (is_callable(array($controller, $action))) {
echo $controller::$action();
} elseif (is_callable(array($controller, "{$action}_"))) {
$action2 = "{$action}_";
echo $controller::$action2();
}
} else {
if (Config::getOne("requireWww")) {
Utils\Header::redirectIfNotWww();
}
$viewParams = array("info" => $info);
// Troche magii:
// Jesli mamy modul, w ktorym akcja nazywa sie tak samo jak modul - to PHP uzna akcje za konstruktor, lecz ten nie moze byc statyczny wiec bedzie blad PHP.
// Wtedy definiujemy akcje jako z sufixem "_" (np. "AKCJA_"), a tu umozliwiamy jej wywolanie.
// Przyklad: \App\Controller\Index::index
if (is_callable(array($controller, $action))) {
$viewParams["data"] = $controller::$action($viewParams["info"]);
} elseif (is_callable(array($controller, "{$action}_"))) {
$action2 = "{$action}_";
$viewParams["data"] = $controller::$action2($viewParams["info"]);
}
$bodyContent = static::loadViewFile($view::getViewFile($lang, $module, $action), $viewParams);
$headerContent = static::loadViewFile($view::getViewFile($lang, "common", "header"), $viewParams);
$view::printSite(["bodyHeader" => $headerContent, "body" => $bodyContent, "info" => $info]);
}
$view::obFinish();
}
示例2:
* See exception.txt for details and the full text.
*/
/**
* The FileManager allows users to upload and manipulate files.
*
* @package frog
* @subpackage plugin.file_manager
*
* @author Philippe Archambault <philippe.archambault@gmail.com>
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @version 1.0.0
* @since Frog version 0.9.0
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @copyright Philippe Archambault & Martijn van der Kleijn, 2008
*/
if (Dispatcher::getAction() == 'index') {
?>
<p class="button">
<a href="<?php
echo get_url('dine/create');
?>
"><img src="<?php
echo URL_PUBLIC;
?>
wolf/app/views/dine/images/plus.png" align="middle" alt="upload icon" /><?php
echo __('Add Dine');
?>
</a>
</p>
示例3:
$this.data('oldValue', newFilter);
var elemId = $this.attr('id').slice(0, -10);
var elem = $('#'+elemId+'_content');
$(this).trigger('wolfSwitchFilterOut', [oldFilter, elem]);
$(this).trigger('wolfSwitchFilterIn', [newFilter, elem]);
});
});
// ]]>
</script>
<?php
$action = Dispatcher::getAction();
?>
</head>
<body id="body_<?php
echo $ctrl . '_' . Dispatcher::getAction();
?>
">
<!-- Div to allow for modal dialogs -->
<div id="mask"></div>
<div id="header">
<div id="site-title"><a href="<?php
echo URL_PUBLIC;
?>
"><?php
echo Setting::get('admin_title');
?>
</a></div>
<div id="mainTabs">
<ul>
示例4: get_url
?>
<!--<p class="button"><a href="<?php
echo get_url('fnb/add');
?>
"><img src="<?php
echo URI_PUBLIC;
?>
wolf/admin/images/user.png" align="middle" alt="user icon" /> <?php
echo __('New Menu');
?>
</a></p>-->
<?php
}
if (Dispatcher::getAction() == 'edit') {
foreach (Dispatcher::getParams() as $id) {
$fnbid = $id;
break;
}
?>
<!--<p class="button"><a href="#upload-file-popup" class="popupLink"><img src="<?php
echo URL_PUBLIC;
?>
wolf/admin/images/icon-img-upload.png" align="middle" alt="upload icon" /><?php
echo __('Upload Menu Image');
?>
</a></p>
<p class="button"><a href="#upload-location-popup" class="popupLink"><img src="<?php
示例5:
<?php
if (Dispatcher::getAction() != 'view') {
?>
<p class="button"><a href="<?php
echo get_url('plugin/themr/documentation');
?>
"><img src="../frog/plugins/tagger/images/documentation.png" align="middle" alt="snippet icon" /> <?php
echo __('Documentation');
?>
</a></p>
<div class="box">
<h2><?php
echo __('What is a Themr?');
?>
</h2>
<p><?php
echo __('Themr is a plugin that helps to organise and manage themes.');
?>
</p>
</div>
<div class="box">
<h2><?php
echo __('Tips');
?>
</h2>
<p><?php
echo __('Use simple names for theme folder structure and make sure underscore without space.');
示例6: __
* @since Frog version 0.9.0
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @copyright Philippe Archambault & Martijn van der Kleijn, 2008
*/
if (Dispatcher::getAction() == 'index') {
?>
<p class="button"><a href="#create-category-popup" class="popupLink"><img src="<?php
echo URL_PUBLIC;
?>
wolf/app/views/news/images/plus.png" align="middle" alt="" /><?php
echo __('Create Category');
?>
</a></p>
<?php
}
if (Dispatcher::getAction() == 'browse_cat') {
foreach (Dispatcher::getParams() as $id) {
$cat_id = $id;
break;
}
?>
<p class="button">
<a href="<?php
echo get_url('news/create/' . $cat_id);
?>
"><img src="<?php
echo URL_PUBLIC;
?>
wolf/app/views/news/images/plus.png" align="middle" alt="upload icon" /><?php
echo __('Add News');
?>
示例7:
*/
/**
* The FileManager allows users to upload and manipulate files.
*
* @package frog
* @subpackage plugin.file_manager
*
* @author Philippe Archambault <philippe.archambault@gmail.com>
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @version 1.0.0
* @since Frog version 0.9.0
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @copyright Philippe Archambault & Martijn van der Kleijn, 2008
*/
if (Dispatcher::getAction() != 'view') {
if (Dispatcher::getAction() != 'view_album') {
?>
<!--<p class="button"><a href="#create-album-popup" class="popupLink"><img src="<?php
echo URL_PUBLIC;
?>
wolf/app/views/fnbgallery/images/fnbgallery-add.png" align="middle" alt="upload icon" /><?php
echo __('Create Album');
?>
</a></p>-->
<?php
}
?>
<p class="button"><a href="#upload-file-popup" class="popupLink"><img src="<?php
echo URL_PUBLIC;
?>
wolf/app/views/fnbgallery/images/add_image.png" align="middle" alt="upload icon" /><?php
示例8: __
</p>
<p class="button">
<a href="../shopping_cart/customers_tab"><?php
echo __('Manage customers');
?>
</a>
</p>
<?php
}
if (Dispatcher::getAction() != 'view' && $_SERVER['REQUEST_URI'] == '/admin/plugin/shopping_cart/customers_tab') {
?>
<p class="button">
<a href="../shopping_cart"><?php
echo __('Manage Products');
?>
</a>
</p>
<p class="button">
<a href="../shopping_cart/orders_tab"><?php
echo __('Manage Orders');
?>
</a>
示例9: array
if ($pawUsers->permissions->hasPermission("user_view")) {
$menu[] = array("url" => get_url("user"), "active" => Dispatcher::getAction() === "index" ? "pawusers-menu-active" : "", "label" => __("Manage Users"));
}
if ($pawUsers->permissions->hasPermission("user_fields_config")) {
$menu[] = array("url" => get_url("user/fields"), "active" => Dispatcher::getAction() === "fields" ? "pawusers-menu-active" : "", "label" => __("Manage Fields"));
}
if ($pawUsers->config["security_blacklist"] && $pawUsers->permissions->hasPermission("pawu_list_view")) {
$menu[] = array("url" => get_url("user/blacklist"), "active" => Dispatcher::getAction() === "blacklist" ? "pawusers-menu-active" : "", "label" => __("Manage Blacklist"));
}
if ($pawUsers->permissions->hasPermission("pawu_perm_view")) {
$menu[] = array("url" => get_url("user/permissions"), "active" => Dispatcher::getAction() === "permissions" ? "pawusers-menu-active" : "", "label" => __("Manage Permissions"));
}
if ($pawUsers->permissions->hasPermission("user_config")) {
$menu[] = "hr";
$menu[] = array("url" => get_url("user/documentation"), "active" => Dispatcher::getAction() === "documentation" ? "pawusers-menu-active" : "", "label" => "pawUsers " . __("Documentation"));
$menu[] = array("url" => get_url("user/settings"), "active" => Dispatcher::getAction() === "settings" ? "pawusers-menu-active" : "", "label" => "pawUsers " . __("Settings"));
}
if (!empty($menu)) {
?>
<div class="box pawusers-menu">
<h2>pawUsers <?php
echo __("Administration");
?>
</h2>
<ul class="pawusers-sidebarlist">
<?php
foreach ($menu as $m) {
?>
<?php
if ($m === "hr") {