本文整理汇总了PHP中Presenter::link方法的典型用法代码示例。如果您正苦于以下问题:PHP Presenter::link方法的具体用法?PHP Presenter::link怎么用?PHP Presenter::link使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Presenter
的用法示例。
在下文中一共展示了Presenter::link方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: link
/**
* Generates link. If links points to @secure annotated signal handler method, additonal
* parameter preventing changing parameters will be added.
*
* @param string $destination
* @param array|mixed $args
* @return string
*/
public function link($destination, $args = array())
{
if (!is_array($args)) {
$args = func_get_args();
array_shift($args);
}
$link = parent::link($destination, $args);
$lastrequest = $this->presenter->lastCreatedRequest;
/* --- Bad link --- */
if ($lastrequest === NULL) {
return $link;
}
/* --- Not a signal --- */
if (substr($destination, -1) !== '!') {
return $link;
}
/* --- Exclude Form submits --- */
if (substr($destination, -8) === '-submit!') {
return $link;
}
/* --- Only on same presenter --- */
if ($this->getPresenter()->getName() !== $lastrequest->getPresenterName()) {
return $link;
}
$signal = trim($destination, '!');
$rc = $this->getReflection()->getMethod($this->formatSignalMethod($signal));
// if (Annotations::has($rc, 'secured') === FALSE) {
if ($rc->hasAnnotation('secured') === FALSE) {
return $link;
}
$origParams = $lastrequest->getParams();
$protectedParams = array();
foreach ($rc->getParameters() as $param) {
$protectedParams[$param->name] = ArrayTools::get($origParams, $this->getParamId($param->name));
}
$args['__secu'] = $this->createSecureHash($protectedParams);
return parent::link($destination, $args);
}