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


PHP Router::url方法代码示例

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


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

示例1: doPayment

 public function doPayment()
 {
     $this->autoRender = false;
     $this->layout = 'ajax';
     $token = $this->params->query['token'];
     $payerId = $this->params->query['PayerID'];
     try {
         $details = $this->Paypal->getExpressCheckoutDetails($token);
     } catch (Exception $e) {
         debug($e->getMessage());
     }
     $items = $this->setItemsFromToken($details);
     $order = $this->setPaymentOptions('finish');
     $order['items'] = $items;
     try {
         $doExpress = $this->Paypal->doExpressCheckoutPayment($order, $token, $payerId);
     } catch (PaypalRedirectException $e) {
         $this->redirect($e->getMessage());
     } catch (Exception $e) {
         debug($e->getMessage());
     }
     //enviamos o email
     $this->Emails->paymentSended($payerId, $items);
     $this->redirect(Router::url('/', true) . '#!tienda/emptyCart');
 }
开发者ID:thedrumz,项目名称:music,代码行数:25,代码来源:ShopController.php

示例2: disconnect

 public function disconnect()
 {
     //S'il n'est meme pas connecter et essaye d'ouvrir l'action disconnect
     //le redireger ver la page de connexion
     $this->backupDB();
     if (!isset($this->session->user)) {
         header("Location:" . url("connexion"));
     }
     $id = $this->session->idconnexion;
     $connexion = "Connexion réussie";
     /** il a deborder, sa session est expiree */
     if ($this->session->timeout <= time()) {
         $datefin = date("Y-m-d H:i:s", $this->session->timeout);
         $deconnexion = "Session expriée";
     } else {
         /** Il s'est deconnecter durant sa session normale */
         $deconnexion = "Session fermée correctement";
         $datefin = date("Y-m-d H:i:s", time());
     }
     //updateConnexion($idconnexion, $connexion, $datefin, $deconnexion)
     $this->Connexion->updateConnexion($id, $connexion, $datefin, $deconnexion);
     unset($_SESSION['user']);
     unset($_SESSION['profile']);
     unset($_SESSION['droits']);
     unset($_SESSION['timeout']);
     unset($_SESSION['idconnexion']);
     unset($_SESSION['idprofile']);
     session_destroy();
     header("Location:" . Router::url('connexion'));
 }
开发者ID:jpainam,项目名称:cosba,代码行数:30,代码来源:connexionController.php

示例3: image

 public function image($imagePath, $width = null, $height = null, $class = null, $typeImage = null, $isThumb = false, $crop = 2)
 {
     if (empty($imagePath)) {
         $imagePath = 'no_image.png';
     } else {
         if (!empty($typeImage)) {
             if ($typeImage == 'UserProfile') {
                 $imagePath = Configure::read('ImagePath.UserProfile') . $imagePath;
             } elseif ($typeImage == 'AdvisorProfile') {
                 $imagePath = Configure::read('ImagePath.AdvisorProfile') . $imagePath;
             } elseif ($typeImage == 'temp') {
                 $imagePath = Configure::read('ImagePath.temp') . $imagePath;
             } elseif ($typeImage == 'Job') {
                 $imagePath = Configure::read('ImagePath.Job') . $imagePath;
             } elseif ($typeImage == 'BusinessField') {
                 $imagePath = Configure::read('ImagePath.BusinessField') . $imagePath;
             }
         }
     }
     if ($isThumb) {
         if ($imagePath === 'no_image.png') {
             $imagePath = 'no_image.jpg';
         }
         $imagePath = Router::url('/', true) . IMAGES_URL . $imagePath;
         $imagePath = "/timthumb.php?src={$imagePath}&w={$width}&h={$height}&zc={$crop}";
     }
     return $this->Html->image($imagePath, array('width' => $width, 'height' => $height, 'class' => $class));
 }
开发者ID:sonnt1991,项目名称:Goikenban,代码行数:28,代码来源:UtilityHelper.php

示例4: initialize

 /**
  *
  * @param AppController $controller
  * @param array         $settings
  */
 public function initialize($controller, $settings = array())
 {
     $this->settings = Set::merge($this->settings, $settings);
     $this->controller = $controller;
     $this->getTwitterSource();
     $this->Cookie->path = Router::url('/');
 }
开发者ID:hiromi2424,项目名称:twitter_kit,代码行数:12,代码来源:twitter.php

示例5: programmation

 public function programmation()
 {
     if (!empty($this->request->programmation)) {
         $chapitres = $this->Chapitre->getChapitresByEnseignement($this->request->idenseignement);
         foreach ($chapitres as $chap) {
             $seq = $this->request->{"seq" . $chap['IDCHAPITRE']};
             $params = ["sequence" => $seq];
             $this->Chapitre->update($params, ["IDCHAPITRE" => $chap['IDCHAPITRE']]);
         }
         # Inserer les lecon dans la table programmation
         # Supprimer les ancienne programmation par enseignement
         $this->Programmation->deleteProgrammationsByEnseignement($this->request->idenseignement);
         $lecons = $this->Lecon->getLeconsByEnseignement($this->request->idenseignement);
         foreach ($lecons as $lec) {
             $params = ["lecon" => $lec['IDLECON'], "etat" => 0];
             $this->Programmation->insert($params);
         }
         header("Location:" . Router::url("pedagogie"));
     }
     $this->view->clientsJS("pedagogie" . DS . "programmation");
     $view = new View();
     $this->comboClasses->first = " ";
     $view->Assign("comboClasses", $this->comboClasses->view());
     $content = $view->Render("pedagogie" . DS . "programmation", false);
     $this->Assign("content", $content);
 }
开发者ID:jpainam,项目名称:cosba,代码行数:26,代码来源:pedagogieController.php

示例6: getListComment

 /**
  * get comment of shop
  * 
  */
 function getListComment($shop_id, $limit = null)
 {
     $comments = $this->find("all", array('joins' => array(array('table' => 'users', 'alias' => 'User', 'type' => 'INNER', 'conditions' => array('User.id = Comment.user_id'))), 'conditions' => array('Comment.shop_id' => $shop_id), "order" => "Comment.id DESC", "fields" => array("Comment.*", "User.name", "User.avatar")));
     $countComment = count($comments);
     $result = array();
     foreach ($comments as $val) {
         if (empty($val["User"]["avatar"])) {
             $val["Comment"]["avatarUser"] = Router::url('/', true) . 'app/systems/background/default.png';
         } else {
             if (!filter_var($val["User"]["avatar"], FILTER_VALIDATE_URL)) {
                 $val["Comment"]["avatarUser"] = Router::url('/', true) . $val["User"]["avatar"];
             } else {
                 $val["Comment"]["avatarUser"] = $val["User"]["avatar"];
             }
         }
         $val["Comment"]["time"] = date("H:i", strtotime($val["Comment"]["created"]));
         $val["Comment"]["nameUser"] = $val["User"]["name"];
         unset($val["User"]);
         $result[] = $val;
         if (empty($limit) && count($result) >= 5) {
             break;
         }
     }
     $ret = array("data" => $result, "count" => $countComment);
     return $ret;
 }
开发者ID:Quang2727,项目名称:Kaopass,代码行数:30,代码来源:Comment.php

示例7: redirect

 function redirect($url, $code = null)
 {
     if ($code == 301) {
         header("HTTP/1.1 301 Moved Permanently");
     }
     header("Location: " . Router::url($url));
 }
开发者ID:EmmanuelMarti,项目名称:Koffee4Free,代码行数:7,代码来源:Controller.php

示例8: downloadInput

 /**
  * download file uploaded
  *
  * @param string $fieldName This should be "Modelname.fieldname"
  */
 public function downloadInput($field, $options = array())
 {
     // get model and field
     $explodeField = explode('.', $field);
     if (!is_array($explodeField)) {
         return;
     }
     $modelName = $explodeField[0];
     $fieldName = $explodeField[1];
     $model = $this->_getModel($modelName);
     if (empty($model->filePath)) {
         return;
     }
     if (!empty($this->request->data[$modelName][$fieldName])) {
         $urlBase = Router::url('/', true);
         $oldFileName = $this->getFilename($this->request->data[$modelName][$fieldName]);
         // file in tmp folder
         $filePath = $model->filePath . 'tmp/' . $this->request->data[$modelName][$fieldName];
         // file in destination folder
         if (!empty($options['model-id'])) {
             $model->id = $options['model-id'];
             if ($this->request->data[$modelName][$fieldName] == $model->field($fieldName)) {
                 $filePath = $model->filePath . $this->request->data[$modelName][$fieldName];
             }
         }
         $options['download'] = $oldFileName;
         return $this->Html->link($oldFileName, $urlBase . $filePath, $options);
     }
     return;
 }
开发者ID:sonnt1991,项目名称:Threestep,代码行数:35,代码来源:UploadFormHelper.php

示例9: displayFlickrImages

 function displayFlickrImages($type, $farm_id, $server_id, $photo_id, $secret, $keyword)
 {
     $_url = sprintf('http://farm%d.static.flickr.com/%d/%s_%s%%s.jpg', $farm_id, $server_id, $photo_id, $secret);
     switch ($type) {
         case '1':
             // thumbnail
             $_type = '_t';
             break;
         case '2':
             // small
             $_type = '_m';
             break;
         case '3':
             // square
             $_type = '_s';
             break;
         case '4':
             // large
             $_type = '_b';
             break;
         default:
             $_type = '';
     }
     $url = sprintf($_url, $_type);
     $image_url = sprintf($_url, '_m');
     //echo '<li id="image_set_flickr"><a href="/flickr/image/'.$photo_id.'&keyword='.$_GET['keyword'].'"><img src='.$url.' alt="" border="0"/></a></li>';
     echo '<li id="image_set_flickr"><a href="' . Router::url('/flickr/image/' . $photo_id . '/tag/' . urlencode($keyword)) . '"><img src=' . $url . ' alt="" border="0"/></a></li>';
 }
开发者ID:simonescu,项目名称:mashupkeyword,代码行数:28,代码来源:mashup.php

示例10: display

 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @return void
  */
 public function display()
 {
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     /*
     if ($this->Session->read('Auth.User'))
     {
     	$this->render("/users/index");
     }
     else
     {
     */
     if ($page == "home") {
         $this->redirect(Router::url("/dashboards"));
     } else {
         $this->render(implode('/', $path));
     }
 }
开发者ID:jgprolluxer,项目名称:prosales,代码行数:38,代码来源:PagesController.php

示例11: __construct

 /**
  *  http://www.paypalobjects.com/de_DE/html/IntegrationCenter/ic_std-variable-reference.html
  *  Setup the config based on Config settings
  */
 public function __construct(View $View, $settings = array())
 {
     $this->settings = $this->_defaults;
     if ($x = Configure::read('Localization.decimalPoint')) {
         $this->settings['dec'] = $x;
     }
     if ($x = Configure::read('Localization.thousandsSeparator')) {
         $this->settings['sep'] = $x;
     }
     $this->settings = array_merge($this->settings, (array) Configure::read('PayPal'));
     if ($this->settings['live']) {
         $this->formOptions['server'] = 'https://www.paypal.com';
     } else {
         $this->formOptions['server'] = 'https://www.sandbox.paypal.com';
     }
     $data = array('HTTP_HOST' => HTTP_HOST, 'HTTP_BASE' => HTTP_BASE);
     $this->formOptions['notify_url'] = String::insert($this->settings['notify_url'], $data, array('before' => '{', 'after' => '}', 'clean' => true));
     $this->formOptions['business'] = $this->settings['email'];
     $this->formOptions['lc'] = $this->settings['locale'];
     $this->formOptions['amount'] = $this->settings['amount'];
     $this->formOptions['no_shipping'] = (int) (!$this->settings['shipping']);
     $this->formOptions['currency_code'] = $this->settings['currency_code'];
     if ($this->settings['cancel_return']) {
         $this->formOptions['cancel_return'] = Router::url(null, true);
     }
     //pr($this->formOptions); die();
     parent::__construct($View, $settings);
 }
开发者ID:09060906,项目名称:CakePHP-Payment-Plugin,代码行数:32,代码来源:PaypalHelper.php

示例12: startup

 /**
  * startup
  * called after Controller::beforeFilter()
  * 
  * @param object $controller instance of controller
  * @return void
  * @access public
  */
 public function startup(Controller $controller)
 {
     // Maintenance mode OFF but on offline page -> redirect to root url
     if (!$this->isOn() && strpos($controller->here, Configure::read('Maintenance.site_offline_url')) !== false) {
         $controller->redirect(Router::url('/', true));
         return;
     }
     // Maintenance mode ON user logoout allowed
     if ($this->isOn() && strpos($controller->here, 'users/logout') !== false) {
         return;
     }
     // Maintenance mode ON but not in offline page requested - > redirect to offline page
     if ($this->isOn() && strpos($controller->here, Configure::read('Maintenance.site_offline_url')) === false) {
         // All users auto logged off if setting is true
         if (Configure::read('Maintenance.offline_destroy_session')) {
             $this->Session->destroy();
         }
         $controller->redirect(Router::url(Configure::read('Maintenance.site_offline_url'), true));
         return;
     }
     // Maintenance mode scheduled show message!!
     if ($this->hasSchedule()) {
         $this->Flash->maintenance(__('This application will be on maintenance mode at  %s ', Configure::read('Maintenance.start')));
     }
 }
开发者ID:felix-koehler,项目名称:phkapa,代码行数:33,代码来源:MaintenanceComponent.php

示例13: parse

 /**
  * Parses a string url into an array. Parsed urls will result in an automatic
  * redirection
  *
  * @param string $url The url to parse
  * @return boolean False on failure
  */
 public function parse($url)
 {
     $params = parent::parse($url);
     if (!$params) {
         return false;
     }
     if (!$this->response) {
         $this->response = new CakeResponse();
     }
     $redirect = $this->defaults;
     if (count($this->defaults) == 1 && !isset($this->defaults['controller'])) {
         $redirect = $this->defaults[0];
     }
     if (isset($this->options['persist']) && is_array($redirect)) {
         $argOptions['context'] = array('action' => $redirect['action'], 'controller' => $redirect['controller']);
         $args = Router::getArgs($params['_args_'], $argOptions);
         $redirect += $args['pass'];
         $redirect += $args['named'];
     }
     $status = 301;
     if (isset($this->options['status']) && ($this->options['status'] >= 300 && $this->options['status'] < 400)) {
         $status = $this->options['status'];
     }
     $this->response->header(array('Location' => Router::url($redirect, true)));
     $this->response->statusCode($status);
     $this->response->send();
 }
开发者ID:no2key,项目名称:Web-Framework-Benchmark,代码行数:34,代码来源:redirect_route.php

示例14: margeSimpleInfo

 /**
  * 店舗情報とイメージ情報をマージします。
  */
 public function margeSimpleInfo($topInfo, $mediaInfoList)
 {
     // jsonの情報が何も無ければ、カラの画像だけ設定して戻る
     if (empty($topInfo['DtbBasicInfo']['info'])) {
         // noimageへ置換する
         $returnInfo = array();
         for ($i = 0; $i < 5; $i++) {
             $imageInfo = array('url' => Router::url('/img/common/noimage/noimage_top_shop.png', true), 'date' => '---- / -- / --');
             $returnInfo['image_info_list'][] = $imageInfo;
         }
         return json_encode($returnInfo);
     }
     $topInfoObj = json_decode($topInfo['DtbBasicInfo']['info'], true);
     // 画像情報をマージする。
     // 画像情報が存在しなければ、noimageを返却する。
     if (empty($mediaInfoList) || empty($topInfoObj['image_id_list'])) {
         // noimageへ置換する
         $topInfoObj['image_url_list'] = array('common/noimage/noimage_icon.png');
     } else {
         // 置換する
         $urlList = array();
         foreach ($topInfoObj['image_id_list'] as $imageId) {
             $urlList[] = $mediaInfoList[$imageId];
         }
         $topInfoObj['image_url_list'] = $urlList;
     }
     // jsonの形式にエンコードして返却する。
     return json_encode($topInfoObj);
 }
开发者ID:buiquangquyet,项目名称:ipost,代码行数:32,代码来源:BlockLogic.php

示例15: initialize

 public function initialize(&$controller, $settings = array())
 {
     if (empty($settings['maintenanceUrl'])) {
         return true;
     }
     if (empty($settings['statusFilePath'])) {
         $settings['statusFilePath'] = TMP . 'maintenance';
     }
     $this->controller = $controller;
     $this->_set($settings);
     $maintenanceUrl = Router::url($this->maintenanceUrl, true);
     $clientIp = $this->RequestHandler->getClientIP();
     $maintenanceEnable = $this->isMaintenance();
     if ($maintenanceEnable === true) {
         // maintenance status
         if (!$this->isAllowedAction($this->controller->params) && strstr(Router::url('', true), $controller->webroot) && Router::url('', true) != Router::url($maintenanceUrl, true) && !in_array($clientIp, (array) $this->allowedIp)) {
             $controller->redirect($maintenanceUrl);
         }
     } else {
         // on service
         if (Router::url('', true) == $maintenanceUrl) {
             $controller->redirect('/');
         }
     }
 }
开发者ID:hiromi2424,项目名称:maintenance,代码行数:25,代码来源:maintenance.php


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