本文整理汇总了PHP中Url::route方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::route方法的具体用法?PHP Url::route怎么用?PHP Url::route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::route方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processView
public static function processView($params, &$view)
{
if (!isset($params['get'])) {
return '';
}
$params['get'] = Route::route($params['get'], $params);
if (!Request::isAvailable($params['get'], 'get')) {
return;
}
$vars_backup = $view->_tpl_vars;
if (is_array($params)) {
foreach ($params as $name => $value) {
$view->assign($name, $value);
}
}
list($controller, $action, $data) = Url::route($params['get'], 'get');
$handler = Url::handler($controller, $action);
if (empty($handler)) {
return '';
}
if (!empty($params['display'])) {
$handler .= '.' . $params['display'];
}
$result = $view->fetch('Modules/' . $handler . '.tpl');
$view->_tpl_vars = $vars_backup;
if (!empty($params['wrapper']) && !empty($result)) {
return '<div class="' . $params['wrapper'] . '">' . $result . '</div>';
}
return $result;
}
示例2: processView
public static function processView($params, &$view)
{
if (!isset($params['get'])) {
return '';
}
$params['get'] = Route::resource($params['get'], $params);
if (!Request::isAvailable($params['get'], 'get')) {
return;
}
$vars_backup = $view->_tpl_vars;
if (is_array($params)) {
foreach ($params as $name => $value) {
$view->assign($name, $value);
}
}
list($controller, $action, $data) = Url::route($params['get'], 'get');
$params = array_merge($params, $data);
$handler = Url::handler($controller, $action);
if (empty($handler)) {
return '';
}
if (!empty($params['display'])) {
$handler .= '.' . $params['display'];
}
$view->assign('params', $params);
$result = $view->fetch('file:' . $handler . '.tpl');
$view->_tpl_vars = $vars_backup;
if (!empty($params['wrapper']) && !empty($result)) {
list($start, $end) = static::wrapper($params['wrapper']);
return $start . $result . $end;
}
return $result;
}
示例3: create
/**
* Builds a menu for displaying associated items to a model entry (i.e. /club/21/team).
*
* The menu will include:
* - An Add LinkMenuItem;
* - A SpacerMenuItem with the name of the associated model;
* - A ResourceMenuItem to hold entries of the associated model.
*
* @param String $modelName The name of the model (i.e. Club).
* @param int $modelId The id of the model entry.
* @param String $associationName The name of the associated model (i.e. Team).
* @param ModelConfig $config (optional) The `ModelConfig` to use.
*
* @return Menu the Menu, which can be configured further.
*/
public function create($modelName, $modelId, $associationName, ModelConfig $config = null)
{
$menu = new Menu();
$addMenuItem = new LinkMenuItem();
$addMenuItem->setText(Lang::trans('Add') . ' ' . Lang::trans($associationName));
$addMenuItem->setIcon(Icons::ion_plus);
$addMenuItem->setTarget(Url::route($this->aujaRouter->getCreateAssociationName($modelName, $associationName), $modelId));
$menu->addMenuItem($addMenuItem);
$headerMenuItem = new SpacerMenuItem();
$headerMenuItem->setText(Lang::trans(str_plural($associationName)));
$menu->addMenuItem($headerMenuItem);
$resourceMenuItem = new ResourceMenuItem();
$resourceMenuItem->setTarget(Url::route($this->aujaRouter->getAssociationName($modelName, $associationName), $modelId));
$menu->addMenuItem($resourceMenuItem);
return $menu;
}
示例4: run
public static function run($resource, $method)
{
$top = count(self::$stack) - 1;
if ($top < 0) {
return;
}
$isExternal = $top == 0;
$resource = Route::route($resource, self::$stack[$top]);
if (!self::isAvailable($resource, $method)) {
if ($isExternal) {
$resource = 'errors/access-denied';
} else {
return '';
}
}
list($controller, $action, $data) = Url::route($resource, $method);
self::$stack[$top] = array_merge(self::$stack[$top], $data);
$handler = Url::handler($controller, $action);
if ($isExternal) {
Middleware::processBefore($resource, $action, self::$stack[$top], $method);
self::runHandler($handler);
Middleware::processAfter($resource, $action, self::$stack[$top], $method);
} else {
if (!self::runInternalHandler($handler)) {
return '';
}
}
if (!empty(self::$stack[$top]['display'])) {
$handler .= '.' . self::$stack[$top]['display'];
}
if ($isExternal && self::$response->code == '404 Not Found') {
list($controller, $action, $data) = Url::route('errors/not-found', 'get');
$handler = Url::handler($controller, $action);
self::$response->result("error", self::$response->code);
}
if ($isExternal && self::$response->code == '403 Forbidden') {
list($controller, $action, $data) = Url::route('errors/not-found', 'get');
$handler = Url::handler($controller, $action);
self::$response->result("error", self::$response->code);
}
$r = self::$response->fetch($handler, $isExternal);
if ($isExternal) {
Language::rewrite($r);
}
return $r;
}
示例5: getListingUrl
function getListingUrl($params = [])
{
$params = $params + ['from' => \Input::get('from'), 'to' => \Input::get('to')];
return \Url::route('posts.listing', $params);
}
示例6: smartIncludeMenuItems
private function smartIncludeMenuItems($main, $config)
{
foreach ($this->aujaConfigurator->getModels() as $model) {
if ($this->aujaConfigurator->shouldSmartIncludeInMain($model, $config)) {
$item = new Item();
$item->setTitle($model->getName());
$item->setIcon($this->aujaConfigurator->getIcon($model, $config));
$item->setTarget(Url::route($this->aujaRouter->getMenuName($model->getName())));
$main->addItem($item);
}
}
}
示例7: doDetectAuth
/**
* Init url payment authorization
*/
private function doDetectAuth()
{
if ($this->payment->cvc == '333') {
$this->auth = Url::route('ff-bank-em-pay-auth', array('payment' => Crypt::encrypt($this->payment->id), 'back' => urlencode(Url::route('ff-bank-em-endpoint-auth-result'))));
$this->payment->status = Status::AUTHORIZATION;
}
}