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


PHP jUrl::getEngine方法代码示例

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


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

示例1: _initParams

 protected function _initParams()
 {
     $url = jUrl::getEngine()->parseFromRequest($this, $_GET);
     if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
         $_PUT = $this->readHttpBody();
         if (is_string($_PUT)) {
             $this->params['__httpbody'] = $_PUT;
         } else {
             $this->params = array_merge($url->params, $_PUT);
         }
     } else {
         $this->params = array_merge($url->params, $_POST);
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:14,代码来源:jClassicRequest.class.php

示例2: _initParams

 protected function _initParams()
 {
     $url = jUrl::getEngine()->parseFromRequest($this, $_GET);
     $this->params = array_merge($url->params, $_POST);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:5,代码来源:jRdfRequest.class.php

示例3: parseFromRequest

 /**
  * Parse a url from the request
  * @param jRequest $request
  * @param array  $params            url parameters ($_REQUEST, or $_GET)
  * @return jUrlAction
  * @since 1.1
  */
 static function parseFromRequest($request, $params)
 {
     return jUrl::getEngine()->parseFromRequest($request, $params);
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:11,代码来源:jUrl.class.php

示例4: toUrl

 /**
  * get the jUrl object corresponding to the action
  * @return jUrl
  */
 public function toUrl()
 {
     return jUrl::getEngine()->create($this);
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:8,代码来源:jUrlAction.class.php

示例5: jtpl_function_html_pagelinks

/**
* @package    jelix
* @subpackage jtpl_plugin
* @author     Laurent Jouanneau
* @copyright  2007 Laurent Jouanneau
* @contributor Christian Tritten (christian.tritten@laposte.net)
* @copyright  2007 Christian Tritten
* @link        http://www.jelix.org
* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/
function jtpl_function_html_pagelinks($tpl, $action, $actionParams, $itemsTotal, $offset, $pageSize = 15, $paramName = 'offset', $displayProperties = array())
{
    $offset = intval($offset);
    if ($offset <= 0) {
        $offset = 0;
    }
    $itemsTotal = intval($itemsTotal);
    $pageSize = intval($pageSize);
    if ($pageSize < 1) {
        $pageSize = 1;
    }
    if ($itemsTotal > $pageSize) {
        $jUrlEngine = jUrl::getEngine();
        $urlaction = jUrl::get($action, $actionParams, jUrl::JURLACTION);
        $defaultDisplayProperties = array('start-label' => '|&lt;', 'prev-label' => '&lt;', 'next-label' => '&gt;', 'end-label' => '&gt;|', 'area-size' => 0);
        if (is_array($displayProperties) && count($displayProperties) > 0) {
            $displayProperties = array_merge($defaultDisplayProperties, $displayProperties);
        } else {
            $displayProperties = $defaultDisplayProperties;
        }
        $pages = array();
        $currentPage = 1;
        $numpage = 1;
        $prevBound = 0;
        $nextBound = 0;
        for ($curidx = 0; $curidx < $itemsTotal; $curidx += $pageSize) {
            if ($offset >= $curidx && $offset < $curidx + $pageSize) {
                $pages[$numpage] = '<li class="pagelinks-current">' . $numpage . '</li>';
                $prevBound = $curidx - $pageSize;
                $nextBound = $curidx + $pageSize;
                $currentPage = $numpage;
            } else {
                $urlaction->params[$paramName] = $curidx;
                $url = $jUrlEngine->create($urlaction);
                $pages[$numpage] = '<li><a href="' . $url->toString(true) . '">' . $numpage . '</a></li>';
            }
            $numpage++;
        }
        $urlaction->params[$paramName] = 0;
        $urlStartPage = $jUrlEngine->create($urlaction);
        $urlaction->params[$paramName] = $prevBound;
        $urlPrevPage = $jUrlEngine->create($urlaction);
        $urlaction->params[$paramName] = $nextBound;
        $urlNextPage = $jUrlEngine->create($urlaction);
        $urlaction->params[$paramName] = (count($pages) - 1) * $pageSize;
        $urlEndPage = $jUrlEngine->create($urlaction);
        echo '<ul class="pagelinks">';
        if (!empty($displayProperties['start-label'])) {
            echo '<li class="pagelinks-start';
            if ($prevBound >= 0) {
                echo '"><a href="', $urlStartPage->toString(true), '">', $displayProperties['start-label'], '</a>';
            } else {
                echo ' pagelinks-disabled">', $displayProperties['start-label'];
            }
            echo '</li>', "\n";
        }
        if (!empty($displayProperties['prev-label'])) {
            echo '<li class="pagelinks-prev';
            if ($prevBound >= 0) {
                echo '"><a href="', $urlPrevPage->toString(true), '">', $displayProperties['prev-label'], '</a>';
            } else {
                echo ' pagelinks-disabled">', $displayProperties['prev-label'];
            }
            echo '</li>', "\n";
        }
        foreach ($pages as $key => $page) {
            if ($displayProperties['area-size'] == 0 || $currentPage - $displayProperties['area-size'] <= $key && $currentPage + $displayProperties['area-size'] >= $key) {
                echo $page, "\n";
            }
        }
        if (!empty($displayProperties['next-label'])) {
            echo '<li class="pagelinks-next';
            if ($nextBound < $itemsTotal) {
                echo '"><a href="', $urlNextPage->toString(true), '">', $displayProperties['next-label'], '</a>';
            } else {
                echo ' pagelinks-disabled">', $displayProperties['next-label'];
            }
            echo '</li>', "\n";
        }
        if (!empty($displayProperties['end-label'])) {
            echo '<li class="pagelinks-end';
            if ($nextBound < $itemsTotal) {
                echo '"><a href="', $urlEndPage->toString(true), '">', $displayProperties['end-label'], '</a>';
            } else {
                echo ' pagelinks-disabled">', $displayProperties['end-label'];
            }
            echo '</li>', "\n";
        }
        echo '</ul>';
    } else {
//.........这里部分代码省略.........
开发者ID:havefnubb,项目名称:havefnubb,代码行数:101,代码来源:function.pagelinks.php

示例6: parse

 /**
  * Parse a url
  * @param string $scriptNamePath    /path/index.php
  * @param string $pathinfo          the path info of the url.
  * @param array  $params            url parameter ($_REQUEST)
  * @return jUrlAction
  */
 static function parse($scriptNamePath, $pathinfo, $params)
 {
     return jUrl::getEngine()->parse($scriptNamePath, $pathinfo, $params);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:11,代码来源:jUrl.class.php

示例7: testBasicSignificantEngine

 function testBasicSignificantEngine()
 {
     global $gJConfig, $gJCoord;
     $gJCoord->request->urlScriptPath = '/';
     $gJCoord->request->params = array();
     //$gJCoord->request->type=;
     $gJConfig->urlengine = array('engine' => 'basic_significant', 'enableParser' => true, 'multiview' => false, 'basePath' => '/', 'defaultEntrypoint' => 'index', 'entrypointExtension' => '.php', 'notfoundAct' => 'jelix~notfound', 'significantFile' => 'urls.xml');
     jUrl::getEngine(true);
     // on recharge le nouveau moteur d'url
     $resultList = array();
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url1', 'mois' => '10', 'annee' => '2005', 'id' => '35');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url2', 'mois' => '05', 'annee' => '2004');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url3', 'rubrique' => 'actualite', 'id_art' => '65', 'article' => 'c\'est la fete au village');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url4', 'first' => 'premier', 'second' => 'deuxieme');
     $resultList[] = array();
     $resultList[] = array('module' => 'news', 'action' => 'main:bar', 'aaa' => 'bbb');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url5', 'foo' => 'oof', 'bar' => 'rab');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url8', 'rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'default:index', 'rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:index', 'rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'actu:foo', 'aaa' => 'bbb');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'actu:bar', 'aaa' => 'bbb');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:bar', 'aaa' => 'bbb');
     $request = array(array("index.php", "/jelix_tests/urlsig/url1", array('mois' => '10', 'annee' => '2005', 'id' => '35')), array("testnews.php", "/jelix_tests/urlsig/url2", array('mois' => '05', 'annee' => '2004')), array("testnews.php", "/jelix_tests/urlsig/url3", array('rubrique' => 'actualite', 'id_art' => '65', 'article' => 'c\'est la fete au village')), array("foo/bar.php", "/jelix_tests/urlsig/url4", array('first' => 'premier', 'second' => 'deuxieme')), array("xmlrpc.php", "", array()), array("news.php", "/news/main/bar", array('aaa' => 'bbb')), array("index.php", "/jelix_tests/urlsig/url5", array('foo' => 'oof', 'bar' => 'rab')), array("index.php", "/jelix_tests/urlsig/url8", array('rubrique' => 'vetements', 'id_article' => '98')), array("index.php", "/jelix_tests/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index.php", "/jelix_tests/urlsig/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index.php", "", array('rubrique' => 'vetements', 'id_article' => '98')), array("actu.php", "/jelix_tests/actu/foo", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/actu/bar", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/urlsig/bar", array('aaa' => 'bbb')));
     //$this->sendMessage("significant, multiview = false");
     foreach ($request as $k => $urldata) {
         $url = jUrl::parse($urldata[0], $urldata[1], $urldata[2]);
         $p = $url->params;
         ksort($p);
         ksort($resultList[$k]);
         $this->assertTrue($p == $resultList[$k], 'created:' . var_export($p, true) . ' expected:' . var_export($resultList[$k], true));
     }
     $gJConfig->urlengine['multiview'] = true;
     $request = array(array("index", "/jelix_tests/urlsig/url1", array('mois' => '10', 'annee' => '2005', 'id' => '35')), array("testnews", "/jelix_tests/urlsig/url2", array('mois' => '05', 'annee' => '2004')), array("testnews", "/jelix_tests/urlsig/url3", array('rubrique' => 'actualite', 'id_art' => '65', 'article' => 'c\'est la fete au village')), array("foo/bar", "/jelix_tests/urlsig/url4", array('first' => 'premier', 'second' => 'deuxieme')), array("xmlrpc", "", array()), array("news", "/news/main/bar", array('aaa' => 'bbb')), array("index", "/jelix_tests/urlsig/url5", array('foo' => 'oof', 'bar' => 'rab')), array("index", "/jelix_tests/urlsig/url8", array('rubrique' => 'vetements', 'id_article' => '98')), array("index", "/jelix_tests/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index", "/jelix_tests/urlsig/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index", "", array('rubrique' => 'vetements', 'id_article' => '98')), array("actu.php", "/jelix_tests/actu/foo", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/actu/bar", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/urlsig/bar", array('aaa' => 'bbb')));
     foreach ($request as $k => $urldata) {
         $url = jUrl::parse($urldata[0], $urldata[1], $urldata[2]);
         $p = $url->params;
         ksort($p);
         ksort($resultList[$k]);
         $this->assertTrue($p == $resultList[$k], 'created:' . var_export($p, true) . ' expected:' . var_export($resultList[$k], true));
     }
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:43,代码来源:core.urls_parsing.html_cli.php

示例8: jtpl_function_html_pagelinks_bootstrap

/**
 * displays page links for the twitter bootstrap
 *
 * @param jTpl $tpl template engine
 * @param string $action selector of the action 
 * @param array $actionParams parameters for the action
 * @param integer $itemsTotal number of items
 * @param integer $offset  index of the first item to display
 * @param integer $pageSize  items number in a page
 * @param string $paramName name of the parameter in the actionParams which will content a page offset
 * @param array $displayProperties properties for the links display
 *  */
function jtpl_function_html_pagelinks_bootstrap($tpl, $action, $actionParams, $itemsTotal, $offset, $pageSize = 15, $paramName = 'offset', $displayProperties = array())
{
    $offset = intval($offset);
    if ($offset <= 0) {
        $offset = 0;
    }
    $itemsTotal = intval($itemsTotal);
    $pageSize = intval($pageSize);
    if ($pageSize < 1) {
        $pageSize = 1;
    }
    // If there are at least two pages of results
    if ($itemsTotal > $pageSize) {
        $jUrlEngine = jUrl::getEngine();
        $urlaction = jUrl::get($action, $actionParams, jUrl::JURLACTION);
        $defaultDisplayProperties = array('start-label' => '|&lt;', 'prev-label' => '&lt;', 'next-label' => '&gt;', 'end-label' => '&gt;|', 'area-size' => 0);
        if (is_array($displayProperties) && count($displayProperties) > 0) {
            $displayProperties = array_merge($defaultDisplayProperties, $displayProperties);
        } else {
            $displayProperties = $defaultDisplayProperties;
        }
        $pages = array();
        $currentPage = 1;
        $numpage = 1;
        $prevBound = 0;
        $nextBound = 0;
        // Generates list of page offsets
        for ($curidx = 0; $curidx < $itemsTotal; $curidx += $pageSize) {
            if ($offset >= $curidx && $offset < $curidx + $pageSize) {
                $pages[$numpage] = '<li class="pagelinks-current active"><a href="#">' . $numpage . '</a></li>';
                $prevBound = $curidx - $pageSize;
                $nextBound = $curidx + $pageSize;
                $currentPage = $numpage;
            } else {
                $urlaction->params[$paramName] = $curidx;
                $url = $jUrlEngine->create($urlaction);
                $pages[$numpage] = '<li><a href="' . $url->toString(true) . '">' . $numpage . '</a></li>';
            }
            $numpage++;
        }
        // Calculate start page url
        $urlaction->params[$paramName] = 0;
        $urlStartPage = $jUrlEngine->create($urlaction);
        // Calculate previous page url
        $urlaction->params[$paramName] = $prevBound;
        $urlPrevPage = $jUrlEngine->create($urlaction);
        // Calculate next page url
        $urlaction->params[$paramName] = $nextBound;
        $urlNextPage = $jUrlEngine->create($urlaction);
        // Calculate end page url
        $urlaction->params[$paramName] = (count($pages) - 1) * $pageSize;
        $urlEndPage = $jUrlEngine->create($urlaction);
        // Links display
        echo '<div class="pagination"><ul class="pagelinks">';
        // Start link
        if (!empty($displayProperties['start-label'])) {
            echo '<li class="pagelinks-start prev';
            if ($prevBound >= 0) {
                echo '"><a href="', $urlStartPage->toString(true), '">', $displayProperties['start-label'], '</a>';
            } else {
                echo ' pagelinks-disabled disabled"><a href="#">', $displayProperties['start-label'], '</a>';
            }
            echo '</li>', "\n";
        }
        // Previous link
        if (!empty($displayProperties['prev-label'])) {
            echo '<li class="pagelinks-prev';
            if ($prevBound >= 0) {
                echo '"><a href="', $urlPrevPage->toString(true), '">', $displayProperties['prev-label'], '</a>';
            } else {
                echo ' pagelinks-disabled disabled"><a href="#">', $displayProperties['prev-label'], '</a>';
            }
            echo '</li>', "\n";
        }
        // Pages links
        foreach ($pages as $key => $page) {
            if ($displayProperties['area-size'] == 0 || $currentPage - $displayProperties['area-size'] <= $key && $currentPage + $displayProperties['area-size'] >= $key) {
                echo $page, "\n";
            }
        }
        // Next link
        if (!empty($displayProperties['next-label'])) {
            echo '<li class="pagelinks-next';
            if ($nextBound < $itemsTotal) {
                echo '"><a href="', $urlNextPage->toString(true), '">', $displayProperties['next-label'], '</a>';
            } else {
                echo ' pagelinks-disabled disabled"><a href="#">', $displayProperties['next-label'], '</a>';
            }
//.........这里部分代码省略.........
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:101,代码来源:function.pagelinks_bootstrap.php

示例9: testGetFullUrl

 function testGetFullUrl()
 {
     global $gJConfig, $gJCoord;
     $gJCoord->request->urlScriptPath = '/';
     $gJCoord->request->params = array();
     //$gJCoord->request->type=;
     $gJConfig->urlengine = array('engine' => 'basic_significant', 'enableParser' => true, 'multiview' => false, 'basePath' => '/', 'defaultEntrypoint' => 'index', 'entrypointExtension' => '.php', 'notfoundAct' => 'jelix~error:notfound', 'simple_urlengine_https' => 'jelix_tests~urlsig:url8@classic @xmlrpc', 'significantFile' => 'urls.xml');
     /*
      parameters
         $_SERVER['HTTPS'] ou non
         $_SERVER['SERVER_NAME'] ou $gJConfig->domainName
         given domainName ou pas
         jelix_tests~urlsig:url3 (http) ou jelix_tests~urlsig:url8 (https)
     */
     $_SERVER['SERVER_NAME'] = 'testapp.local';
     $_SERVER['SERVER_PORT'] = '80';
     // ================= HTTP URL
     unset($_SERVER['HTTPS']);
     // without given domain name, without domain name in config, without https
     $gJConfig->domainName = '';
     jUrl::getEngine(true);
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, null);
     $this->assertEqual('http://testapp.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, null);
     $this->assertEqual('https://testapp.local/index.php/jelix_tests/urlsig/url8', $url);
     // with given domain name, without domain name in config, without https
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, 'football.local');
     $this->assertEqual('http://football.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, 'football.local');
     $this->assertEqual('https://football.local/index.php/jelix_tests/urlsig/url8', $url);
     // without given domain name, with domain name in config, without https
     $gJConfig->domainName = 'configdomain.local';
     jUrl::getEngine(true);
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, null);
     $this->assertEqual('http://configdomain.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, null);
     $this->assertEqual('https://configdomain.local/index.php/jelix_tests/urlsig/url8', $url);
     // with given domain name, with domain name in config, without https
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, 'football.local');
     $this->assertEqual('http://football.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, 'football.local');
     $this->assertEqual('https://football.local/index.php/jelix_tests/urlsig/url8', $url);
     $_SERVER['HTTPS'] = 'on';
     $_SERVER['SERVER_PORT'] = '443';
     // without given domain name, without domain name in config, with https
     $gJConfig->domainName = '';
     jUrl::getEngine(true);
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, null);
     $this->assertEqual('https://testapp.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, null);
     $this->assertEqual('https://testapp.local/index.php/jelix_tests/urlsig/url8', $url);
     // with given domain name, without domain name in config, with https
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, 'football.local');
     $this->assertEqual('https://football.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, 'football.local');
     $this->assertEqual('https://football.local/index.php/jelix_tests/urlsig/url8', $url);
     // without given domain name, with domain name in config, with https
     $gJConfig->domainName = 'configdomain.local';
     jUrl::getEngine(true);
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, null);
     $this->assertEqual('https://configdomain.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, null);
     $this->assertEqual('https://configdomain.local/index.php/jelix_tests/urlsig/url8', $url);
     // with given domain name, with domain name in config, with https
     $url = jUrl::getFull('jelix_tests~urlsig:url1', array(), 0, 'football.local');
     $this->assertEqual('https://football.local/index.php/jelix_tests/urlsig/url1', $url);
     $url = jUrl::getFull('jelix_tests~urlsig:url8', array(), 0, 'football.local');
     $this->assertEqual('https://football.local/index.php/jelix_tests/urlsig/url8', $url);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:69,代码来源:core.urls_generation.html.php


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