示例#1
1
 public static function write($type, $message, $pretty_print = false)
 {
     $message = $pretty_print ? print_r($message, true) : $message;
     if (Event::listeners('laravel.log')) {
         Event::fire('laravel.log', array($type, $message));
     }
     $message = static::format($type, $message);
     File::append(path('storage') . 'logs/' . date('Y-m-d') . '.log', $message);
 }
 /**
  * Resolve a bundle and controller name to a controller instance.
  *
  * @param  string      $bundle
  * @param  string      $controller
  * @return Controller
  */
 public static function resolve($bundle, $controller)
 {
     if (!static::load($bundle, $controller)) {
         return;
     }
     $identifier = Bundle::identifier($bundle, $controller);
     // If the controller is registered in the IoC container, we will resolve
     // it out of the container. Using constructor injection on controllers
     // via the container allows more flexible applications.
     $resolver = 'controller: ' . $identifier;
     if (IoC::registered($resolver)) {
         return IoC::resolve($resolver);
     }
     $controller = static::format($bundle, $controller);
     // If we couldn't resolve the controller out of the IoC container we'll
     // format the controller name into its proper class name and load it
     // by convention out of the bundle's controller directory.
     if (Event::listeners(static::factory)) {
         return Event::first(static::factory, $controller);
     } else {
         return new $controller();
     }
 }
示例#3
0
 /**
  * Get the evaluated string content of the view.
  *
  * @return string
  */
 public function render()
 {
     Event::fire("laravel.composing: {$this->view}", array($this));
     // If there are listeners to the view engine event, we'll pass them
     // the view so they can render it according to their needs, which
     // allows easy attachment of other view parsers.
     if (Event::listeners(static::engine)) {
         $result = Event::until(static::engine, array($this));
         if (!is_null($result)) {
             return $result;
         }
     }
     return $this->get();
 }
示例#4
0
文件: view.php 项目: mymizan/phreeze
 /**
  * Get the evaluated contents of the view.
  *
  * @return string
  */
 public function get()
 {
     $__data = $this->data();
     // The contents of each view file is cached in an array for the
     // request since partial views may be rendered inside of for
     // loops which could incur performance penalties.
     $__contents = $this->load();
     ob_start() and extract($__data, EXTR_SKIP);
     // We'll include the view contents for parsing within a catcher
     // so we can avoid any WSOD errors. If an exception occurs we
     // will throw it out to the exception handler.
     try {
         eval('?>' . $__contents);
     } catch (\Exception $e) {
         ob_get_clean();
         throw $e;
     }
     $content = ob_get_clean();
     // The view filter event gives us a last chance to modify the
     // evaluated contents of the view and return them. This lets
     // us do something like run the contents through Jade, etc.
     if (Event::listeners('view.filter')) {
         return Event::first('view.filter', array($content, $this->path));
     }
     return $content;
 }
 /**
  * Get the evaluated string content of the view.
  *
  * @return string
  */
 public function render()
 {
     // To allow bundles or other pieces of the application to modify the
     // view before it is rendered, we'll fire an event, passing in the
     // view instance so it can modified.
     $composer = "laravel.composing: {$this->view}";
     Event::fire($composer, array($this));
     // If there are listeners to the view engine event, we'll pass them
     // the view so they can render it according to their needs, which
     // allows easy attachment of other view parsers.
     if (Event::listeners(static::engine)) {
         $result = Event::first(static::engine, array($this));
         if ($result !== false) {
             return $result;
         }
     }
     return $this->get();
 }
示例#6
0
 public static function resolve($bundle, $controller)
 {
     if (!static::load($bundle, $controller)) {
         return;
     }
     $identifier = Bundle::identifier($bundle, $controller);
     $resolver = 'controller: ' . $identifier;
     if (IoC::registered($resolver)) {
         return IoC::resolve($resolver);
     }
     $controller = static::format($bundle, $controller);
     if (Event::listeners(static::factory)) {
         return Event::first(static::factory, $controller);
     } else {
         return new $controller();
     }
 }