本文整理汇总了PHP中RequestHandler::Link方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::Link方法的具体用法?PHP RequestHandler::Link怎么用?PHP RequestHandler::Link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::Link方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBackURL
/**
* Get's the previous URL that lead up to the current request.
*
* NOTE: Honestly, this should be built into SS_HTTPRequest, but we can't depend on that right now... so instead,
* this is being copied verbatim from Controller (in the framework).
*
* @param SS_HTTPRequest $request
* @return string
*/
protected function getBackURL(SS_HTTPRequest $request)
{
// Initialize a sane default (basically redirects to root admin URL).
$controller = $this->getToplevelController();
$url = method_exists($this->requestHandler, "Link") ? $this->requestHandler->Link() : $controller->Link();
// Try to parse out a back URL using standard framework technique.
if ($request->requestVar('BackURL')) {
$url = $request->requestVar('BackURL');
} else {
if ($request->isAjax() && $request->getHeader('X-Backurl')) {
$url = $request->getHeader('X-Backurl');
} else {
if ($request->getHeader('Referer')) {
$url = $request->getHeader('Referer');
}
}
}
return $url;
}
示例2: import
/**
* Import the current file
* @param SS_HTTPRequest $request
*/
public function import(SS_HTTPRequest $request)
{
$hasheader = (bool) $request->postVar('HasHeader');
$cleardata = $this->component->getCanClearData() ? (bool) $request->postVar('ClearData') : false;
if ($request->postVar('action_import')) {
$file = File::get()->byID($request->param('FileID'));
if (!$file) {
return "file not found";
}
$colmap = Convert::raw2sql($request->postVar('mappings'));
if ($colmap) {
//save mapping to cache
$this->cacheMapping($colmap);
//do import
$results = $this->importFile($file->getFullPath(), $colmap, $hasheader, $cleardata);
$this->gridField->getForm()->sessionMessage($results->getMessage(), 'good');
}
}
$controller = $this->getToplevelController();
$url = method_exists($this->requestHandler, "Link") ? $this->requestHandler->Link() : $controller->Link();
$controller->redirect($url);
}