public function init()
    {
        if ($this->isInitialized())
            return $this;

        if (!$this->getThemesPath() || !$this->getName())
            throw new \Exception('Theme Cant initialize because theme name or theme paths not present.');

        $themePathname = $this->getThemesPath().DS.$this->getName();
        if (!is_dir($themePathname))
            throw new \Exception(sprintf('Theme "%s" not found in "%s".', $this->getName(), $themePathname));

        $bootstrap    = $themePathname.DS.'theme.bootstrap.php';
        if (file_exists($bootstrap)) {
            ob_start();
            set_error_handler(
                function($errno, $errstr) {
                    throw new \ErrorException($errstr, $errno);
                },
                E_ALL
            );

            include $bootstrap; // Bootstrap Theme

            restore_error_handler();
            ob_get_clean();
        }

        $this->initialized = true;

        return $this;
    }
public function init()
    {
        if ($this->isInitialized())
            return $this;

        if (!$this->getThemesPath() || !$this->getName())
            throw new \Exception('Theme Cant initialize because theme name or theme paths not present.');

        $themePathname = $this->getThemesPath().DS.$this->getName();
        if (!is_dir($themePathname))
            throw new \Exception(sprintf('Theme "%s" not found in "%s".', $this->getName(), $themePathname));

        $bootstrap    = $themePathname.DS.'theme.bootstrap.php';
        if (file_exists($bootstrap)) {
            ob_start();
            set_error_handler(
                function($errno, $errstr) {
                    throw new \ErrorException($errstr, $errno);
                },
                E_ALL
            );

            include $bootstrap; // Bootstrap Theme

            restore_error_handler();
            ob_get_clean();
        }

        $this->initialized = true;

        return $this;
    }
public function init ( ) { if ( $ this -> isInitialized ( ) ) return $ this ; if ( ! $ this -> getThemesPath ( ) || ! $ this -> getName ( ) ) throw new \ Exception ( 'Theme Cant initialize because theme name or theme paths not present.' ) ; $ themePathname = $ this -> getThemesPath ( ) . DS . $ this -> getName ( ) ; if ( ! is_dir ( $ themePathname ) ) throw new \ Exception ( sprintf ( 'Theme "%s" not found in "%s".' , $ this -> getName ( ) , $ themePathname ) ) ; $ bootstrap = $ themePathname . DS . 'theme.bootstrap.php' ; if ( file_exists ( $ bootstrap ) ) { ob_start ( ) ; set_error_handler ( function ( $ errno , $ errstr ) { throw new \ ErrorException ( $ errstr , $ errno ) ; } , E_ALL ) ; include $ bootstrap ; // Bootstrap Theme restore_error_handler ( ) ; ob_get_clean ( ) ; } $ this -> initialized = true ; return $ this ; }
Initialize theme object if attained

@throws \Exception
@return mixed
Initialize theme object if attained