/** * Constructor. * * @param string field name * @param string realpath for destination */ public function __construct($field = 'files', $destination = null) { $this->field = $field; if (is_null($destination)) { $destination = Application::basepath() . '/uploads'; } $this->setDestination($destination); }
/** * render. * * @param callable Callback * * @return string rendered output */ public function render($__local281291callbackFilter = null) { $this->directory = Application::realpath() . '/Views'; $__local281291vars = array_merge(self::$data, $this->vars); $__local281291fileparts = array_filter(explode('/', $this->filename), 'trim'); $__local281291filename = $this->directory . '/' . implode('/', $__local281291fileparts) . '.php'; if (!is_file($__local281291filename)) { throw new Exception('Unable to locate view : ' . $__local281291filename); } $__local281291contentFile = $this->loadContentFile($__local281291filename); extract($__local281291vars); ob_start(); eval('?>' . $__local281291contentFile); $__local281291outputRendering = ob_get_clean(); $__local281291trimOutputRendering = trim($__local281291outputRendering); return is_callable($__local281291callbackFilter) ? call_user_func($__local281291callbackFilter, $__local281291trimOutputRendering, $this) : $__local281291trimOutputRendering; }
/** * Getter. * * @param string name * * @return application collections */ public function __get($name) { $app =& Application::currentInstance(); return $app[$name]; }