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


PHP Bundle::parse方法代码示例

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


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

示例1: testParseMethodReturnsElementAndIdentifier

 /**
  * Test the Bundle::parse method.
  *
  * @group laravel
  */
 public function testParseMethodReturnsElementAndIdentifier()
 {
     $this->assertEquals(array('application', 'something'), Bundle::parse('something'));
     $this->assertEquals(array('application', 'something.else'), Bundle::parse('something.else'));
     $this->assertEquals(array('dashboard', 'something'), Bundle::parse('dashboard::something'));
     $this->assertEquals(array('dashboard', 'something.else'), Bundle::parse('dashboard::something.else'));
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:12,代码来源:bundle.test.php

示例2: render_partial

 /**
  * Return partial view rendered
  * 
  * @param string $partial
  * @param array $data
  */
 public function render_partial($partial, $data = array())
 {
     if (\Event::listeners("themes.render.partial: {$partial}")) {
         $result = \Event::until("themes.render.partial: {$partial}", array($view));
         if (!is_null($result)) {
             if ($result instanceof \DOMDocument) {
                 $view = $result->saveHTML();
             } elseif (is_string($result)) {
                 $view = $result;
             } elseif (is_array($result)) {
                 // array to dom
                 $view = '<!DOCTYPE html>';
                 $view .= Dom::arrayToDOMDocument($result, 'html')->saveHTML();
             } else {
                 // trow exception
             }
         }
     }
     $data = $this->_share_data($data);
     $bundle_parts = \Bundle::parse($partial);
     $bundle_name = $bundle_parts['0'] == 'application' ? '' : $bundle_parts['0'] . DS;
     $partial_path = str_replace('.', DS, $bundle_parts['1']);
     $theme_view_folder = $this->_theme_absolute_path . DS . 'views' . DS;
     // Check for a custom path
     $has_partial = $this->_view_exists(str_replace('.', DS, $partial));
     if ($has_partial) {
         return View::make($has_partial, $data);
     }
     // Check on the themes views folder
     $has_partial = $this->_view_exists($theme_view_folder . $bundle_name . 'partials' . DS . $partial_path);
     if ($has_partial) {
         return View::make($has_partial, $data);
     }
     // Check on custom folder (fallback for all themes)
     $has_partial = $this->_view_exists(path('public') . 'custom' . DS . 'views' . DS . $bundle_name . 'partials' . DS . $partial_path);
     if ($has_partial) {
         return View::make($has_partial, $data);
     }
     // bundles folder
     $has_partial = $this->_view_exists($partial);
     if ($has_partial) {
         return View::make($has_partial, $data);
     }
     // try to load from application views folder
     $has_partial = $this->_view_exists('partials' . DS . $partial_path);
     if ($has_partial) {
         return View::make($has_partial, $data);
     }
     Log::error('Failed to render partial from ' . $partial);
     throw new \Exception("Failed to render partial. Partial [{$partial}] doesn't exist. ");
 }
开发者ID:juaniiie,项目名称:mwi,代码行数:57,代码来源:theme.php

示例3: fromStd

 static function fromStd($controller)
 {
     list($bundle, $controller) = \Bundle::parse(strtok($controller, '@'));
     if ($obj = \Controller::resolve($bundle, $controller)) {
         return $obj;
     } else {
         throw new Error("Controller class of block [{$controller}] is undefined.");
     }
 }
开发者ID:SerdarSanri,项目名称:VaneMart,代码行数:9,代码来源:Block.php


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