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


PHP jUrl::unescape方法代码示例

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


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

示例1: _parse


//.........这里部分代码省略.........
             
                             5=>array('bla'=>'whatIWant' ), // list of static values
                             6=>false or array('secondaries','actions')
                             */
             list($module, $action, $reg, $dynamicValues, $escapes, $staticValues, $secondariesActions, $needHttps) = $infoparsing;
             if (isset($params['module']) && $params['module'] !== $module) {
                 continue;
             }
             if ($module != '') {
                 $params['module'] = $module;
             }
             // if the action parameter exists in the current url
             // and if it is one of secondaries actions, then we keep it
             // else we take the action indicated in the url mapping
             if ($secondariesActions && isset($params['action'])) {
                 if (strpos($params['action'], ':') === false) {
                     $params['action'] = 'default:' . $params['action'];
                 }
                 if (!in_array($params['action'], $secondariesActions) && $action != '') {
                     $params['action'] = $action;
                 }
             } else {
                 if ($action != '') {
                     $params['action'] = $action;
                 }
             }
             // let's merge static parameters
             if ($staticValues) {
                 foreach ($staticValues as $n => $v) {
                     if (!empty($v) && $v[0] == '$') {
                         // special statique value
                         $typeStatic = $v[1];
                         $v = substr($v, 2);
                         if ($typeStatic == 'l') {
                             jApp::config()->locale = jLocale::langToLocale($v);
                         } else {
                             if ($typeStatic == 'L') {
                                 jApp::config()->locale = $v;
                             }
                         }
                     }
                     $params[$n] = $v;
                 }
             }
             // now let's read dynamic parameters
             if (count($matches)) {
                 array_shift($matches);
                 foreach ($dynamicValues as $k => $name) {
                     if (isset($matches[$k])) {
                         if ($escapes[$k] & 2) {
                             $params[$name] = jUrl::unescape($matches[$k]);
                         } else {
                             $params[$name] = $matches[$k];
                             if ($escapes[$k] & 4) {
                                 $v = $matches[$k];
                                 if (preg_match('/^\\w{2,3}$/', $v, $m)) {
                                     jApp::config()->locale = jLocale::langToLocale($v);
                                 } else {
                                     jApp::config()->locale = $v;
                                     $params[$name] = substr($v, 0, strpos('_'));
                                 }
                             } else {
                                 if ($escapes[$k] & 8) {
                                     $v = $matches[$k];
                                     if (preg_match('/^\\w{2,3}$/', $v, $m)) {
                                         jApp::config()->locale = $params[$name] = jLocale::langToLocale($v);
                                     } else {
                                         jApp::config()->locale = $v;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             $urlact = new jUrlAction($params);
             break;
         }
     }
     if (!$urlact) {
         if ($isDefault && $pathinfo == '') {
             // if we didn't find the url in the mapping, and if this is the default
             // entry point, then we do anything
             $urlact = new jUrlAction($params);
         } else {
             try {
                 $urlact = jUrl::get(jApp::config()->urlengine['notfoundAct'], array(), jUrl::JURLACTION);
             } catch (Exception $e) {
                 $urlact = new jUrlAction(array('module' => 'jelix', 'action' => 'error:notfound'));
             }
         }
     } else {
         if ($needHttps && !$isHttps) {
             // the url is declared for HTTPS, but the request does not come from HTTPS
             // -> 404 not found
             $urlact = new jUrlAction(array('module' => 'jelix', 'action' => 'error:notfound'));
         }
     }
     return $urlact;
 }
开发者ID:medali1990,项目名称:medsite,代码行数:101,代码来源:significant.urls.php

示例2: parseGetParams

 /**
  * extract parameters for the action from the path info.
  *
  * @params array $infoparsing  we have this array
  *                   array(
  *                   0=>'module',
  *                   1=>'action',
  *                   2=>'regexp_pathinfo',
  *                   3=>array('year','month'), // list of dynamic value included in the url,
  *                                         // alphabetical ascendant order
  *                   4=>array(0, 1..), // list of integer which indicates for each
  *                                   // dynamic value: 0: urlencode, 1:urlencode except '/', 2:escape, 4: lang, 8: locale
  *           
  *                   5=>array('bla'=>'whatIWant' ), // list of static values
  *                   6=>false or array('secondaries','actions')
  *                   7=>true/false  true if https is needed
  * @params array $matches  result of the match with the regexp corresponding to the url
  *
  * @return \jUrlAction or null if the handler does not accept the url
  */
 protected function parseGetParams($infoparsing, \jUrl $url, $matches)
 {
     list($module, $action, $reg, $dynamicValues, $escapes, $staticValues, $secondariesActions, $needsHttps) = $infoparsing;
     $params = $url->params;
     $params['module'] = $module;
     if ($secondariesActions && isset($params['action'])) {
         // if the action parameter exists in the current url
         // and if it is one of secondaries actions, then we keep it
         // else we take the action indicated in the url mapping
         if (strpos($params['action'], ':') === false) {
             $params['action'] = 'default:' . $params['action'];
         }
         if (!in_array($params['action'], $secondariesActions) && $action != '') {
             $params['action'] = $action;
         }
     } elseif ($action != '') {
         if (substr($action, -2) == ':*') {
             $action = substr($action, 0, -1);
             // This is an url for a whole controller
             if (isset($matches[1]) && $matches[1]) {
                 $action .= $matches[1];
             } else {
                 $action .= 'index';
             }
             $matches = array();
         }
         // else this is an url for a specific action
         $params['action'] = $action;
     } elseif (count($matches) == 2) {
         // this an url for a whole module
         if ($matches[1] == '/' || $matches[1] == '') {
             $params['action'] = 'default:index';
         } else {
             $pathInfoParts = explode('/', $matches[1]);
             $co = count($pathInfoParts);
             if ($co == 2) {
                 $params['action'] = $pathInfoParts[1] . ':index';
             } else {
                 $params['action'] = $pathInfoParts[1] . ':' . $pathInfoParts[2];
             }
         }
         $matches = array();
     }
     // let's merge static parameters
     if ($staticValues) {
         foreach ($staticValues as $n => $v) {
             if (!empty($v) && $v[0] == '$') {
                 // special statique value
                 $typeStatic = $v[1];
                 $v = substr($v, 2);
                 if ($typeStatic == 'l') {
                     App::config()->locale = Locale::langToLocale($v);
                 } elseif ($typeStatic == 'L') {
                     App::config()->locale = $v;
                 }
             }
             $params[$n] = $v;
         }
     }
     // now let's read dynamic parameters
     if (count($matches)) {
         array_shift($matches);
         foreach ($dynamicValues as $k => $name) {
             if (isset($matches[$k])) {
                 if ($escapes[$k] & self::ESCAPE_NON_ASCII) {
                     $params[$name] = \jUrl::unescape($matches[$k]);
                 } else {
                     $params[$name] = $matches[$k];
                     if ($escapes[$k] & self::ESCAPE_LANG) {
                         $v = $matches[$k];
                         if (preg_match('/^\\w{2,3}$/', $v, $m)) {
                             App::config()->locale = Locale::langToLocale($v);
                         } else {
                             App::config()->locale = $v;
                             $params[$name] = substr($v, 0, strpos('_'));
                         }
                     } elseif ($escapes[$k] & self::ESCAPE_LOCALE) {
                         $v = $matches[$k];
                         if (preg_match('/^\\w{2,3}$/', $v, $m)) {
                             App::config()->locale = $params[$name] = Locale::langToLocale($v);
//.........这里部分代码省略.........
开发者ID:mdouchin,项目名称:jelix,代码行数:101,代码来源:UrlActionMapper.php

示例3: atom

 /**
  * provide a atom feeds for each forum
  */
 function atom()
 {
     $ftitle = jUrl::unescape($this->param('ftitle'), true);
     $id_forum = $this->intParam('id_forum');
     // if the forum is accessible by anonymous then the Atom will be available
     // otherwise NO Atom will be available
     if (!jAcl2::check('hfnu.posts.rss', 'forum' . $id_forum)) {
         jMessage::add(jLocale::get('havefnubb~main.permissions.denied'), 'error');
         $rep = $this->getResponse('html');
         $tpl = new jTpl();
         $rep->body->assign('MAIN', $tpl->fetch('havefnubb~403.html'));
         $rep->setHttpStatus('403', 'Permission denied');
         return $rep;
     }
     if ($id_forum == 0) {
         jLog::log(__METHOD__ . ' line : ' . __LINE__ . ' [this should not be 0] $id_forum', 'DEBUG');
         $rep = $this->getResponse('html');
         $tpl = new jTpl();
         $rep->body->assign('MAIN', $tpl->fetch('havefnubb~404.html'));
         $rep->setHttpStatus('404', 'Not found');
         return $rep;
     }
     $rep = $this->getResponse('atom1.0');
     $gJConfig = jApp::config();
     // entete du flux atom
     $rep->infos->title = $gJConfig->havefnubb['title'];
     $rep->infos->webSiteUrl = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
     $rep->infos->copyright = $gJConfig->havefnubb['title'];
     $rep->infos->description = $gJConfig->havefnubb['description'];
     $rep->infos->updated = date('Y-m-d H:i:s');
     $rep->infos->published = date('Y-m-d H:i:s');
     $rep->infos->selfLink = jUrl::get('havefnubb~posts:atom', array('ftitle' => $ftitle, 'id_forum' => $fid_forum));
     $rep->infos->ttl = 60;
     $dao = jDao::get('havefnubb~forum');
     $forum = $dao->get($id_forum);
     if (jUrl::escape($forum->forum_name, true) != $ftitle) {
         jLog::log(__METHOD__ . ' line : ' . __LINE__ . ' [this should not be different] $forum->forum_name and $ftitle', 'DEBUG');
         $rep = $this->getResponse('html');
         $tpl = new jTpl();
         $rep->body->assign('MAIN', $tpl->fetch('havefnubb~404.html'));
         $rep->setHttpStatus('404', 'Not found');
         return $rep;
     }
     // 1- limit of posts
     $nbPostPerPage = 0;
     $nbPostPerPage = (int) $gJConfig->havefnubb['posts_per_page'];
     // 2- get the posts of the current forum, limited by point 1
     // get all the posts of the current Forum by its Id
     list($page, $nbPosts, $posts) = jClasses::getService('havefnubb~hfnuposts')->getThreads($id_forum, 0, $nbPostPerPage);
     $first = true;
     foreach ($posts as $post) {
         if ($first) {
             // le premier enregistrement permet de connaitre
             // la date du channel
             $rep->infos->updated = date('Y-m-d H:i:s', $post->date_created);
             $rep->infos->published = date('Y-m-d H:i:s', $post->date_created);
             $first = false;
         }
         $url = jUrl::getFull('havefnubb~posts:view', array('id_post' => $post->id_post, 'thread_id' => $post->thread_id, 'ftitle' => $post->forum_name, 'id_forum' => $post->id_forum, 'ptitle' => $post->subject));
         $item = $rep->createItem($post->subject, $url, date('Y-m-d H:i:s', $post->date_created));
         $item->authorName = $post->login;
         $render = new jWiki();
         $item->content = $render->render($post->message);
         $item->contentType = 'html';
         $item->idIsPermalink = true;
         // on ajoute l'item dans le fil atom
         $rep->addItem($item);
     }
     return $rep;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:73,代码来源:posts.classic.php

示例4: _parse

 /**
  *
  * @param string $scriptNamePath    /path/index.php
  * @param string $pathinfo          the path info part of the url (part between script name and query)
  * @param array  $params            url parameters (query part e.g. $_REQUEST)
  * @return jUrlAction
  */
 protected function _parse($scriptNamePath, $pathinfo, $params)
 {
     global $gJConfig;
     /*if(substr($pathinfo,-1) == '/' && $pathinfo != '/'){
               $pathinfo = substr($pathinfo,0,-1);
       }*/
     $urlact = null;
     $isDefault = false;
     $url = new jUrl($scriptNamePath, $params, $pathinfo);
     foreach ($this->dataParseUrl as $k => $infoparsing) {
         // le premier paramètre indique si le point d'entré actuelle est un point d'entré par défaut ou non
         if ($k == 0) {
             $isDefault = $infoparsing;
             continue;
         }
         if (count($infoparsing) < 5) {
             // on a un tableau du style
             // array( 0=> 'module', 1=>'action', 2=>'selecteur handler', 3=>array('actions','secondaires'))
             $s = new jSelectorUrlHandler($infoparsing[2]);
             $c = $s->className . 'UrlsHandler';
             $handler = new $c();
             $url->params['module'] = $infoparsing[0];
             // si une action est présente dans l'url actuelle
             // et qu'elle fait partie des actions secondaires, alors on la laisse
             // sinon on prend celle indiquée dans la conf
             if ($infoparsing[3] && isset($params['action'])) {
                 if (strpos($params['action'], ':') === false) {
                     $params['action'] = 'default:' . $params['action'];
                 }
                 if (in_array($params['action'], $infoparsing[3])) {
                     $url->params['action'] = $params['action'];
                 } else {
                     $url->params['action'] = $infoparsing[1];
                 }
             } else {
                 $url->params['action'] = $infoparsing[1];
             }
             // appel au handler
             if ($urlact = $handler->parse($url)) {
                 break;
             }
         } else {
             /* on a un tableau du style
                array( 0=>'module', 1=>'action', 2=>'regexp_pathinfo',
                3=>array('annee','mois'), // tableau des valeurs dynamiques, classées par ordre croissant
                4=>array(true, false), // tableau des valeurs escapes
                5=>array('bla'=>'cequejeveux' ) // tableau des valeurs statiques
                6=>false ou array('act','act'...) // autres actions secondaires autorisées
                */
             if (preg_match($infoparsing[2], $pathinfo, $matches)) {
                 if ($infoparsing[0] != '') {
                     $params['module'] = $infoparsing[0];
                 }
                 // si une action est présente dans l'url actuelle
                 // et qu'elle fait partie des actions secondaires, alors on la laisse
                 // sinon on prend celle indiquée dans la conf
                 if ($infoparsing[6] && isset($params['action'])) {
                     if (strpos($params['action'], ':') === false) {
                         $params['action'] = 'default:' . $params['action'];
                     }
                     if (!in_array($params['action'], $infoparsing[6]) && $infoparsing[1] != '') {
                         $params['action'] = $infoparsing[1];
                     }
                 } else {
                     if ($infoparsing[1] != '') {
                         $params['action'] = $infoparsing[1];
                     }
                 }
                 // on fusionne les parametres statiques
                 if ($infoparsing[5]) {
                     $params = array_merge($params, $infoparsing[5]);
                 }
                 if (count($matches)) {
                     array_shift($matches);
                     foreach ($infoparsing[3] as $k => $name) {
                         if (isset($matches[$k])) {
                             if ($infoparsing[4][$k]) {
                                 $params[$name] = jUrl::unescape($matches[$k]);
                             } else {
                                 $params[$name] = $matches[$k];
                             }
                         }
                     }
                 }
                 $urlact = new jUrlAction($params);
                 break;
             }
         }
     }
     if (!$urlact) {
         if ($isDefault && $pathinfo == '') {
             // si on n'a pas trouvé de correspondance, mais que c'est l'entry point
             // par defaut pour le type de request courant, alors on laisse passer..
//.........这里部分代码省略.........
开发者ID:alienpham,项目名称:helenekling,代码行数:101,代码来源:significant.urls.php

示例5: _parse

 protected function _parse($scriptNamePath, $pathinfo, $params, $isHttps)
 {
     $urlact = null;
     $isDefault = false;
     $url = new jUrl($scriptNamePath, $params, $pathinfo);
     foreach ($this->dataParseUrl as $k => $infoparsing) {
         if ($k == 0) {
             $isDefault = $infoparsing;
             continue;
         }
         if (count($infoparsing) < 7) {
             list($module, $action, $reg, $selectorHandler, $secondariesActions, $needHttps) = $infoparsing;
             $url2 = clone $url;
             if ($reg != '') {
                 if (preg_match($reg, $pathinfo, $m)) {
                     $url2->pathInfo = isset($m[1]) ? $m[1] : '/';
                 } else {
                     continue;
                 }
             }
             $s = new jSelectorUrlHandler($selectorHandler);
             include_once $s->getPath();
             $c = $s->className . 'UrlsHandler';
             $handler = new $c();
             $url2->params['module'] = $module;
             if ($secondariesActions && isset($params['action'])) {
                 if (strpos($params['action'], ':') === false) {
                     $params['action'] = 'default:' . $params['action'];
                 }
                 if (in_array($params['action'], $secondariesActions)) {
                     $url2->params['action'] = $params['action'];
                 } else {
                     $url2->params['action'] = $action;
                 }
             } else {
                 $url2->params['action'] = $action;
             }
             if ($urlact = $handler->parse($url2)) {
                 break;
             }
         } elseif (preg_match($infoparsing[2], $pathinfo, $matches)) {
             list($module, $action, $reg, $dynamicValues, $escapes, $staticValues, $secondariesActions, $needHttps) = $infoparsing;
             if (isset($params['module']) && $params['module'] !== $module) {
                 continue;
             }
             if ($module != '') {
                 $params['module'] = $module;
             }
             if ($secondariesActions && isset($params['action'])) {
                 if (strpos($params['action'], ':') === false) {
                     $params['action'] = 'default:' . $params['action'];
                 }
                 if (!in_array($params['action'], $secondariesActions) && $action != '') {
                     $params['action'] = $action;
                 }
             } else {
                 if ($action != '') {
                     $params['action'] = $action;
                 }
             }
             if ($staticValues) {
                 foreach ($staticValues as $n => $v) {
                     if ($v[0] == '$') {
                         $typeStatic = $v[1];
                         $v = substr($v, 2);
                         if ($typeStatic == 'l') {
                             jApp::config()->locale = jLocale::langToLocale($v);
                         } else {
                             if ($typeStatic == 'L') {
                                 jApp::config()->locale = $v;
                             }
                         }
                     }
                     $params[$n] = $v;
                 }
             }
             if (count($matches)) {
                 array_shift($matches);
                 foreach ($dynamicValues as $k => $name) {
                     if (isset($matches[$k])) {
                         if ($escapes[$k] & 2) {
                             $params[$name] = jUrl::unescape($matches[$k]);
                         } else {
                             $params[$name] = $matches[$k];
                             if ($escapes[$k] & 4) {
                                 $v = $matches[$k];
                                 if (preg_match('/^\\w{2,3}$/', $v, $m)) {
                                     jApp::config()->locale = jLocale::langToLocale($v);
                                 } else {
                                     jApp::config()->locale = $v;
                                     $params[$name] = substr($v, 0, strpos('_'));
                                 }
                             } else {
                                 if ($escapes[$k] & 8) {
                                     $v = $matches[$k];
                                     if (preg_match('/^\\w{2,3}$/', $v, $m)) {
                                         jApp::config()->locale = $params[$name] = jLocale::langToLocale($v);
                                     } else {
                                         jApp::config()->locale = $v;
                                     }
//.........这里部分代码省略.........
开发者ID:havefnubb,项目名称:havefnubb,代码行数:101,代码来源:significant.urls.php


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