本文整理汇总了PHP中sfWebRequest::getPathInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::getPathInfo方法的具体用法?PHP sfWebRequest::getPathInfo怎么用?PHP sfWebRequest::getPathInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::getPathInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPathInfo
/**
* Override inorder to ignore trailing slashes in requests.
* @see \sfWebRequest::getPathInfo()
*/
public function getPathInfo()
{
$pathInfo = parent::getPathInfo();
// remove trailing slash.
$pathInfo = preg_replace('/\\/$/', '', $pathInfo);
return $pathInfo;
}
示例2: executeError404
public function executeError404(sfWebRequest $request)
{
$this->search = preg_split("/\\/|-/", $request->getPathInfo());
$query = Doctrine::getTable('SeoPage')->getSearchQuery(array_filter($this->search))->limit(10);
$this->results = $query->execute();
$this->getResponse()->setStatusCode(404, 'This page does not exist');
}
示例3: executeChiaraRedirector
public function executeChiaraRedirector(sfWebRequest $request)
{
$pathInfo = str_replace('Chiara_PEAR_Server_REST', 'pluginRest', $request->getPathInfo());
$routing = sfContext::getInstance()->getRouting();
$parameter = $routing->parse($pathInfo);
$request->setAttribute('sf_route', $parameter['_sf_route']);
unset($parameter['_sf_route']);
$parameterHolder = $request->getParameterHolder();
$parameterHolder->add($parameter);
$this->forward($parameter['module'], $parameter['action']);
}
示例4: executePage_index
/**
* pageActions::executePage_index()
*
* @param sfWebRequest $request
* @return
*/
public function executePage_index(sfWebRequest $request)
{
// リクエストされたパスを取得する。
$path = strtolower($request->getPathInfo());
// 並べ替えパラメータを取得する。
$sort_key = $request->getParameter('sk', 'title');
$sort_order = $request->getParameter('so', 'asc');
// パスにマッチするページ一覧を取得する。
$pages = PageTable::getListFromPath($path, $sort_key, $sort_order);
$this->path = $path;
$this->pages = $pages;
}
示例5: executeShow
public function executeShow(sfWebRequest $request)
{
$this->rt_site = Doctrine::getTable('rtSite')->findOneBy('reference_key', $request->getParameter('reference_key'));
$this->forward404Unless($this->rt_site);
$site = rtSiteToolkit::getCurrentSite();
if (rtSiteToolkit::getCurrentSite()->getReferenceKey() !== sfConfig::get('app_rt_booking_site_ref_key')) {
$site = Doctrine::getTable('rtSite')->findOneBy('reference_key', sfConfig::get('app_rt_booking_site_ref_key'));
if (!$site) {
$this->forward404();
}
$this->redirect('http://' . $site->getDomain() . $request->getPathInfo());
}
}
示例6: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
// リクエストされたパスを取得する。
$path = strtolower($request->getPathInfo());
$year = $request->getParameter('year', '');
$month = $request->getParameter('month', '');
$page_type = $request->getParameter('page_type', '');
$path = str_replace(sprintf('%s/%s/', $year, $month), '', $path);
// 並べ替えパラメータを設定する。
$sort_key = 'first_committed';
$sort_order = 'desc';
// パスと条件にマッチするページ一覧を取得する。
$pages = PageTable::getListFromPath($path, $sort_key, $sort_order, -1, true, $year, $month);
// パスにマッチするページ一覧(全部)を取得する。
$pages_temp = PageTable::getListFromPath($path, $sort_key, $sort_order);
// ページの一覧から年月インデックス配列を作成する。
$ym_index = array();
foreach ($pages_temp as $page) {
$ym = $page->getDateTimeObject('first_committed')->format('Ym');
if (isset($ym_index[$ym])) {
++$ym_index[$ym]['count'];
} else {
$ym_index[$ym]['count'] = 1;
$ym_index[$ym]['year'] = substr($ym, 0, 4);
$ym_index[$ym]['month'] = substr($ym, -2, 2);
}
}
$this->path = $path;
$this->pages = $pages;
$this->ym_index = $ym_index;
switch ($page_type) {
case 'events':
$title = 'イベント';
break;
case 'news':
$title = 'ニュース';
break;
case 'blog':
default:
$title = 'ブログ';
break;
}
$this->page_type = $page_type;
$this->page_title = $title;
}
示例7: executeLoad
/**
* Action for the JS Routing. Action checks if a cached file is used or
* not. Cached = prod, not cached = dev.
* prod means that a single file is loaded with all logic
* dev means that all files (about 120) will be loaded
*
* @param sfWebRequest $request
* @return <type>
*/
public function executeLoad(sfWebRequest $request) {
$path = $request->getPathInfo();
$path = str_replace('/djs', '', $path);
$path = str_replace($request->getParameter('filename') . '.js', '', $path);
if($path == '/cache/') {
$template = sfConfig::get('sf_cache_dir') . '/javaScriptCache/' . $request->getParameter('filename');
}
else {
$template = sfConfig::get('sf_app_template_dir') . $path . $request->getParameter('filename');
}
$this->getResponse()->setContentType('text/javascript');
$this->setLayout(false);
$this->setTemplate($template); // the real path to JS File -.-
return sfView::SUCCESS;
//return '.js' . chr(0);
}
示例8: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$path = preg_replace('/\\/download\\/uploads/', '', preg_replace('/:/', '.', $request->getPathInfo()));
$file = sfConfig::get('sf_upload_dir') . $path;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
return sfView::NONE;
}