Exemplo n.º 1
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     $path = $view->getPath();
     if (!is_object($path)) {
         if ($path) {
             $path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
         }
         if (substr($path, -10) == '.blade.php') {
             $type = 'blade';
         } else {
             $type = pathinfo($path, PATHINFO_EXTENSION);
         }
     } else {
         $type = get_class($view);
         $path = '';
     }
     if (!$this->collect_data) {
         $params = array_keys($view->getData());
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             $data[$key] = $this->exporter->exportValue($value);
         }
         $params = $data;
     }
     $this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
 }
Exemplo n.º 2
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     $path = $view->getPath();
     if ($path) {
         $path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
     }
     if (substr($path, -10) == '.blade.php') {
         $type = 'blade';
     } else {
         $type = pathinfo($path, PATHINFO_EXTENSION);
     }
     if (!$this->collect_data) {
         $params = array_keys($view->getData());
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (in_array($key, ['__env', 'app', 'errors', 'obLevel', 'currentUser'])) {
                 continue;
             }
             $data[$key] = $this->exportValue($value);
         }
         $params = $data;
     }
     $this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
 }
Exemplo n.º 3
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     if (!$this->collect_data) {
         $this->views[] = $name;
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (is_object($value) and method_exists($value, 'toArray')) {
                 $data[$key] = $value->toArray();
             } else {
                 $data[$key] = $value;
             }
         }
         $this->views[] = $name . ' => ' . $this->formatVar($data);
     }
 }
Exemplo n.º 4
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     $type = pathinfo($view->getPath(), PATHINFO_EXTENSION);
     if (!$this->collect_data) {
         $params = array_keys($view->getData());
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (is_object($value) && method_exists($value, 'toArray')) {
                 $value = $value->toArray();
             }
             $data[$key] = $this->exporter->exportValue($value);
         }
         $params = $data;
     }
     $this->templates[] = array('name' => $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
 }
Exemplo n.º 5
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     if (!$this->collect_data) {
         $this->data[$name] = $name;
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (is_object($value)) {
                 if (method_exists($value, 'toArray')) {
                     $data[$key] = $value->toArray();
                 } else {
                     $data[$key] = "Object (" . get_class($value) . ")";
                 }
             } else {
                 $data[$key] = $value;
             }
         }
         $this->data[$name] = $data;
     }
 }
Exemplo n.º 6
0
 /**
  * Call the creator for a given view.
  *
  * @param  \Illuminate\View\View  $view
  * @return void
  */
 public function callCreator(View $view)
 {
     $this->events->fire('creating: ' . $view->getName(), [$view]);
 }
Exemplo n.º 7
0
 /**
  * Get the override view path.
  *
  * @param  $view
  * @return null|string
  */
 public function getOverloadPath(View $view)
 {
     /**
      * We can only overload namespaced
      * views right now.
      */
     if (!str_contains($view->getName(), '::')) {
         return null;
     }
     /**
      * Split the view into it's
      * namespace and path.
      */
     list($namespace, $path) = explode('::', $view->getName());
     $path = str_replace('.', '/', $path);
     /**
      * If the module is shorthand
      * then check to see if we have
      * an active module to use for it.
      */
     if ($namespace === 'module' && $this->module) {
         $namespace = $this->module->getNamespace();
     }
     /**
      * If the view is already in
      * the theme then skip it.
      */
     if ($namespace == 'theme' || str_is('*.theme.*', $namespace)) {
         return null;
     }
     /**
      * If the view is a streams view then
      * it's real easy to guess what the
      * override path should be.
      */
     if ($namespace == 'streams') {
         $path = $this->theme->getNamespace('streams/' . $path);
     }
     /**
      * If the view uses a dot syntax namespace then
      * transform it all into the override view path.
      */
     if ($addon = $this->addons->get($namespace)) {
         $path = $this->theme->getNamespace("addons/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
     }
     if ($this->view->exists($path)) {
         return $path;
     }
     /**
      * If the view uses a dot syntax namespace then
      * transform it all into the override view path.
      *
      * @deprecated since v3.0.0
      */
     if ($addon) {
         $path = $this->theme->getNamespace("addon/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
     }
     if ($this->view->exists($path)) {
         return $path;
     }
     return null;
 }
Exemplo n.º 8
0
 /**
  * Call the composer for a given view.
  *
  * @param  Illuminate\View\View  $view
  * @return void
  */
 public function callComposer(View $view)
 {
     $this->events->fire('composing: ' . $view->getName(), array($view));
 }