本文整理匯總了PHP中Control::link方法的典型用法代碼示例。如果您正苦於以下問題:PHP Control::link方法的具體用法?PHP Control::link怎麽用?PHP Control::link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Control
的用法示例。
在下文中一共展示了Control::link方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: link
public function link($destination, $array = array())
{
if (strpos($destination, ":") !== FALSE) {
$control = $this->lookup('Nette\\Application\\Presenter', TRUE);
return $control->link($destination, $array);
} else {
return parent::link($destination, $array);
}
}
示例2: 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);
}