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


PHP Url::fromRequest方法代码示例

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


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

示例1: testFileUrls

 public function testFileUrls()
 {
     $testResult = 'file://' . getcwd();
     $url = Url::fromRequest();
     $this->assertEquals($testResult, $url->toString());
     $this->assertEquals(getcwd(), (string) $url);
     $url = Url::fromMagic($testResult);
     $this->assertEquals($testResult, $url->toString());
     $this->assertEquals(getcwd(), (string) $url);
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:10,代码来源:URLTest.class.php

示例2: parsePage

 /**
  * Parses a rudimentary system log backend page
  * @param \Cx\Core\Html\Sigma $template Backend template for this page
  * @param array $cmd Supplied CMD
  */
 public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd)
 {
     $em = $this->cx->getDb()->getEntityManager();
     $logRepo = $em->getRepository('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log');
     // @todo: parse message if no entries (template block exists already)
     $parseObject = $this->getNamespace() . '\\Model\\Entity\\Log';
     // set default sorting
     if (!isset($_GET['order'])) {
         $_GET['order'] = 'timestamp/DESC';
     }
     // configure view
     $viewGenerator = new \Cx\Core\Html\Controller\ViewGenerator($parseObject, array('functions' => array('delete' => 'true', 'paging' => true, 'sorting' => true, 'edit' => true), 'fields' => array('id' => array('showOverview' => false), 'timestamp' => array('readonly' => true), 'severity' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
         return '<span class="' . contrexx_raw2xhtml(strtolower($data)) . '_background">' . contrexx_raw2xhtml($data) . '</span>';
     })), 'message' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
         $url = clone \Cx\Core\Routing\Url::fromRequest();
         $url->setMode('backend');
         $url->setParam('editid', $rows['id']);
         return '<a href="' . $url . '">' . contrexx_raw2xhtml($data) . '</a>';
     })), 'data' => array('readonly' => true, 'showOverview' => false, 'type' => 'text'), 'logger' => array('readonly' => true))));
     $template->setVariable('ENTITY_VIEW', $viewGenerator);
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:26,代码来源:BackendController.class.php

示例3: getViewGeneratorOptions

 /**
  * This function returns the ViewGeneration options for a given entityClass
  *
  * @access protected
  * @global $_ARRAYLANG
  * @param $entityClassName contains the FQCN from entity
  * @return array with options
  */
 protected function getViewGeneratorOptions($entityClassName)
 {
     global $_ARRAYLANG;
     $classNameParts = explode('\\', $entityClassName);
     $classIdentifier = end($classNameParts);
     $langVarName = 'TXT_' . strtoupper($this->getType() . '_' . $this->getName() . '_ACT_' . $classIdentifier);
     $header = '';
     if (isset($_ARRAYLANG[$langVarName])) {
         $header = $_ARRAYLANG[$langVarName];
     }
     switch ($entityClassName) {
         case 'Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log':
             return array('functions' => array('delete' => 'true', 'paging' => true, 'sorting' => true, 'edit' => true), 'fields' => array('id' => array('showOverview' => false), 'timestamp' => array('readonly' => true), 'severity' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
                 return '<span class="' . contrexx_raw2xhtml(strtolower($data)) . '_background">' . contrexx_raw2xhtml($data) . '</span>';
             })), 'message' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
                 $url = clone \Cx\Core\Routing\Url::fromRequest();
                 $url->setMode('backend');
                 $url->setParam('editid', $rows['id']);
                 return '<a href="' . $url . '">' . contrexx_raw2xhtml($data) . '</a>';
             })), 'data' => array('readonly' => true, 'showOverview' => false, 'type' => 'text'), 'logger' => array('readonly' => true)));
             break;
         default:
             return array('header' => $header, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false));
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:33,代码来源:BackendController.class.php

示例4: postInit

 /**
  * Initializes request
  */
 protected function postInit()
 {
     global $_CONFIG;
     // if path configuration was wrong in loadConfig(), Url is not yet initialized
     if (!$this->request) {
         // this makes \Env::get('Resolver')->getUrl() return a sensful result
         $request = !empty($_GET['__cap']) ? $_GET['__cap'] : '';
         $offset = $this->websiteOffsetPath;
         switch ($this->mode) {
             case self::MODE_FRONTEND:
             case self::MODE_BACKEND:
                 $this->request = new \Cx\Core\Routing\Model\Entity\Request($_SERVER['REQUEST_METHOD'], \Cx\Core\Routing\Url::fromCapturedRequest($request, $offset, $_GET));
                 break;
             case self::MODE_COMMAND:
             case self::MODE_MINIMAL:
                 try {
                     $this->request = new \Cx\Core\Routing\Model\Entity\Request($_SERVER['REQUEST_METHOD'], \Cx\Core\Routing\Url::fromRequest());
                 } catch (\Cx\Core\Routing\UrlException $e) {
                 }
                 break;
         }
     }
     //call post-init hooks
     $this->ch->callPostInitHooks();
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:28,代码来源:Cx.class.php


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