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


PHP Url::fromApi方法代码示例

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


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

示例1: getUrlFromApi

 /**
  * Wrapper for \Cx\Core\Routing\Url::fromApi()
  * This ensures correct param order
  * @param string $adapterName (Json)Data adapter name
  * @param string $adapterMethod (Json)Data method name
  * @param array $params (optional) params for (Json)Data method call
  * @return \Cx\Core\Routing\Url URL for (Json)Data call
  */
 protected function getUrlFromApi($adapterName, $adapterMethod, $params)
 {
     if (isset($_GET['preview'])) {
         $params['theme'] = intval($_GET['preview']);
     }
     $url = \Cx\Core\Routing\Url::fromApi('Data', array('Plain', $adapterName, $adapterMethod), $params);
     // make sure params are in correct order:
     $correctIndexOrder = array('page', 'lang', 'user', 'theme', 'country', 'currency');
     $params = $url->getParamArray();
     uksort($params, function ($a, $b) use($correctIndexOrder) {
         return array_search($a, $correctIndexOrder) - array_search($b, $correctIndexOrder);
     });
     $url->setParams($params);
     $url->setParam('EOU', '');
     return $url;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:24,代码来源:CacheLib.class.php

示例2: endContrexxCaching

 /**
  * End caching functions. Check for a sessionId: if not set, write pagecontent to a file.
  */
 public function endContrexxCaching($page, $endcode)
 {
     // TODO: $dynVars needs to be built dynamically
     $this->dynVars = array('GEO' => array('country_code' => \Cx\Core\Routing\Url::fromApi('Data', array('Plain', 'GeoIp', 'getCountryCode'))->toString()));
     // back-replace ESI variables that are url encoded
     foreach ($this->dynVars as $groupName => $vars) {
         foreach ($vars as $varName => $url) {
             $esiPlaceholder = '$(' . $groupName . '{\'' . $varName . '\'})';
             $endcode = str_replace(urlencode($esiPlaceholder), $esiPlaceholder, $endcode);
         }
     }
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     if ($page && $page->getModule() == 'Error' || !$this->boolIsEnabled || session_id() != '' && \FWUser::getFWUserObject()->objUser->login() || $cx->getComponent('Uploader')->isActive()) {
         return $this->internalEsiParsing($endcode);
     }
     // write header cache file
     $resolver = \Env::get('Resolver');
     $headers = $resolver->getHeaders();
     $this->writeCacheFileForRequest($page, $headers, $endcode);
     return $this->internalEsiParsing($endcode);
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:24,代码来源:Cache.class.php


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