当前位置: 首页>>代码示例>>PHP>>正文


PHP CHttpRequest::getUrlReferrer方法代码示例

本文整理汇总了PHP中CHttpRequest::getUrlReferrer方法的典型用法代码示例。如果您正苦于以下问题:PHP CHttpRequest::getUrlReferrer方法的具体用法?PHP CHttpRequest::getUrlReferrer怎么用?PHP CHttpRequest::getUrlReferrer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CHttpRequest的用法示例。


在下文中一共展示了CHttpRequest::getUrlReferrer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUrlReferrer

 public function getUrlReferrer()
 {
     $referrer = parent::getUrlReferrer();
     $host = UrlHelper::getHost($referrer);
     if ($host === $this->getServerName()) {
         return $referrer;
     } else {
         return UrlHelper::createAbsoluteUrl('/shop');
     }
 }
开发者ID:rahmanjis,项目名称:dipstart-development,代码行数:10,代码来源:BaseHttpRequest.php

示例2: getUrlReferrer

 /**
  * Return the referal url,
  * it's used for the "close" buttons, and the "save and close" buttons
  * So it checks if the referrer url is the same than the current url to avoid looping.
  * If it the case, a paramater can be set to tell what referrer to return.
  * If the referrer is an external url, Yii return by default the current url.
  *
  * To avoid looping between two urls (like simpleStatistics <=> Expert Statistics),
  * it can be necessary to check if the referrer contains a specific word (an action in general)
  * So if you want to forbid a return to a certain page, just provide an alternative url, and the forbidden key world
  *
  * Not all "close" and "save and close" buttons should use it.
  * Only close button for pages that can be accessed since different places.
  * eg: edit question, that can be accessed from question list or question
  *
  *
  * TODO: implement it for all those pages
  * List of pages where it should be implemented :
  * - All pages accessible via the top nav-bar (eg: create a new survey, edit template, etc.)
  * - All pages accessible via quick actions (home page, survey quick actions, question group quick actions, etc.)
  * - All pages accessible via question explorer (only "add question to group" for now)
  * - Edition of question and question group, which are accessible via summary or list
  * - Import question, question group
  *
  * TODO: remove misused of it
  * It should not be used for pages accessible from only one place
  * - Token activation
  * etc.
  *
  * In doubt, just use getUrlReferrer with a default link to home page for full page layout pages,
  * or a link to the survey summary for sidemenu layout pages,
  * with the controller action as forbidden world.
  * So the close button will never loop.
  *
  * TODO : Each time a new quick action or button is added to access an existing page, the "close" & "save and close" button should be updated to use getUrlReferrer()
  *
  * @param $sAlternativeUrl string, the url to return if referrer url is the same than current url.
  * @param $aForbiddenWordsInUrl array, an array containing forbidden words in url
  * @return string if success, else null
  */
 public function getUrlReferrer($sAlternativeUrl = null, $aForbiddenWordsInUrl = array())
 {
     $referrer = parent::getUrlReferrer();
     $baseReferrer = str_replace(Yii::app()->getBaseUrl(true), "", $referrer);
     $baseRequestUri = str_replace(Yii::app()->getBaseUrl(), "", Yii::app()->request->requestUri);
     $referrer = $baseReferrer != $baseRequestUri ? $referrer : null;
     // Checks if the alternative url should be used
     if (isset($sAlternativeUrl)) {
         // Use alternative url if the referrer is equal to current url.
         if (is_null($referrer)) {
             $referrer = $sAlternativeUrl;
         }
         // Use alternative url if a forbidden word appears in the referrer
         foreach ($aForbiddenWordsInUrl as $sForbiddenWord) {
             if (strpos($referrer, $sForbiddenWord) !== false) {
                 $referrer = $sAlternativeUrl;
             }
         }
     }
     return $referrer;
 }
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:61,代码来源:LSHttpRequest.php

示例3: array

$this->widget('bootstrap.widgets.TbBreadcrumb', array('links' => array('App' => array(), 'Manage Apps' => array(), 'Runs')));
?>




<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<br/><div class="well-button">

              <?php 
echo TbHtml::Button('<i class="fa fa-arrow-left"></i> Back', array('submit' => CHttpRequest::getUrlReferrer(), 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'style' => 'color: green;'));
?>
            
            
            
                
        </div>

<div class="group-div">
   <div class="well-cinza">
                      <b><?php 
echo $nomeApp;
?>
</b>
                  </div>
<?php 
开发者ID:raphaelrocha,项目名称:mtcontrool_mtcontext,代码行数:31,代码来源:adminRuns.php

示例4: array

<div class="form">
    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'runs-form', 'enableAjaxValidation' => false));
?>
    <div class="well-button">

              <?php 
echo TbHtml::Button('<i class="fa fa-arrow-left"></i> Back', array('onclick' => 'js:document.location.href="/mtcontrool"', 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'style' => 'color: green;'));
?>
            
             <?php 
echo TbHtml::submitButton('<i class="fa fa-check fa-lg"></i> Create', array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'class' => 'btn pull-right', 'style' => 'color: white; margin-left: 4px;', 'title' => 'Create'));
?>
          
                        <?php 
echo TbHtml::button('<i class="fa fa-times fa-lg"></i> Cancel', array('submit' => CHttpRequest::getUrlReferrer(), 'color' => TbHtml::BUTTON_COLOR_DANGER, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'title' => 'Cancel', 'class' => 'btn pull-right', 'style' => 'color: white;'));
?>
            
                
        </div>
    <div class="well">
    <p class="help-block">
		Fields with <span class="required">*</span> are required.
	</p>

        <?php 
$user_Id = Yii::app()->user->id;
?>
    <?php 
echo $form->errorSummary($model);
?>
开发者ID:raphaelrocha,项目名称:mtcontrool_mtcontext,代码行数:31,代码来源:_update.php

示例5: updateNavigationStack

 /**
  * Method to update the LimeSurvey Navigation Stack to prevent looping
  */
 public function updateNavigationStack()
 {
     $referrer = parent::getUrlReferrer();
     $navStack = App()->session['LSNAVSTACK'];
     if (!is_array($navStack)) {
         $navStack = array();
     }
     array_unshift($navStack, $referrer);
     if (count($navStack) > 5) {
         array_pop($navStack);
     }
     App()->session['LSNAVSTACK'] = $navStack;
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:16,代码来源:LSHttpRequest.php

示例6: array

            
            
            


        </div>                            
        
</div>

		
	
                       <br/>
                        <div class="well-button">

              <?php 
echo TbHtml::Button($model->isNewRecord ? '<i class="fa fa-arrow-left"></i>' : Share, array('submit' => CHttpRequest::getUrlReferrer(), 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'style' => 'color: green;'));
?>
            
             <?php 
echo TbHtml::submitButton('<i class="fa fa-check fa-lg"></i>', array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'class' => 'btn pull-right', 'style' => 'color: white; margin-left: 4px;', 'title' => 'Create'));
?>
          
                        <?php 
echo TbHtml::button('<i class="fa fa-times fa-lg"></i>', array('onclick' => 'js:document.location.href="/mtcontrool"', 'color' => TbHtml::BUTTON_COLOR_DANGER, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'title' => 'Cancel', 'class' => 'btn pull-right', 'style' => 'color: white;'));
?>
            
                
        </div>
<?php 
$this->endWidget();
?>
开发者ID:raphaelrocha,项目名称:mtcontrool_mtcontext,代码行数:26,代码来源:_form.php


注:本文中的CHttpRequest::getUrlReferrer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。