Ejemplo n.º 1
0
 public function add(Theme $theme, $parentName = '')
 {
     if ($parentName) {
         $parentTheme = $this->find($parentName);
     } else {
         $parentTheme = $this->root;
     }
     $theme->addParent($parentTheme);
     return $theme;
 }
Ejemplo n.º 2
0
 public function boot()
 {
     /*--------------------------------------------------------------------------
     		| Pulish configuration file
     		|--------------------------------------------------------------------------*/
     $this->publishes([__DIR__ . '/config.php' => config_path('themes.php')]);
     /*--------------------------------------------------------------------------
     		| Extend Blade to support Orcherstra\Asset (Asset Managment)
     		|
     		| Syntax:
     		|
     		|   @css (filename, alias, depends-on-alias)
     		|   @js  (filename, alias, depends-on-alias)
     		|--------------------------------------------------------------------------*/
     Blade::extend(function ($value) {
         return preg_replace_callback('/\\@js\\s*\\(\\s*([\\w\\-\\._:\\/]*)\\s*(?:,\\s*([\\w\\-\\._:\\/]*)\\s*,?\\s*(.*))?\\)/', function ($match) {
             $p1 = \Theme::url($match[1]);
             $p2 = empty($match[2]) ? $match[1] : $match[2];
             $p3 = empty($match[3]) ? '' : $match[3];
             if (empty($p2)) {
                 return "<?php Asset::script('{$p2}', '{$p1}');?>";
             } elseif (empty($p3)) {
                 return "<?php Asset::script('{$p2}', '{$p1}');?>";
             } else {
                 return "<?php Asset::script('{$p2}', '{$p1}', '{$p3}');?>";
             }
         }, $value);
     });
     Blade::extend(function ($value) {
         return preg_replace_callback('/\\@css\\s*\\(\\s*([\\w\\-\\._:\\/]*)\\s*(?:,\\s*([\\w\\-\\._:\\/]*)\\s*,?\\s*(.*))?\\)/', function ($match) {
             $p1 = \Theme::url($match[1]);
             $p2 = empty($match[2]) ? $match[1] : $match[2];
             $p3 = empty($match[3]) ? '' : $match[3];
             if (empty($p2)) {
                 return "<?php Asset::style('{$p2}', '{$p1}');?>";
             } elseif (empty($p3)) {
                 return "<?php Asset::style('{$p2}', '{$p1}');?>";
             } else {
                 return "<?php Asset::style('{$p2}', '{$p1}', '{$p3}');?>";
             }
         }, $value);
     });
 }