예제 #1
0
 /**
  * Define paths and bootstrap the framework.
  *
  * @return void
  */
 public function bootstrap()
 {
     /**
      * Define all framework paths
      * These are real paths, not URLs to the framework files.
      * These paths are extensible with the help of WordPress
      * filters.
      */
     // Framework paths.
     $paths = apply_filters('themosis_framework_paths', []);
     // Plugin base path.
     $paths['plugin'] = __DIR__ . DS;
     // Framework base path.
     $paths['sys'] = __DIR__ . DS . 'src' . DS . 'Themosis' . DS;
     // Storage path.
     $paths['storage'] = THEMOSIS_STORAGE;
     // Register globally the paths
     themosis_set_paths($paths);
     // Bootstrap the framework
     require_once themosis_path('plugin') . 'bootstrap' . DS . 'start.php';
 }
예제 #2
0
    /*
     * Add a notice in the front-end.
     */
    wp_die($text, $title);
}
/*
 * Retrieve the service container.
 */
$theme = container();
/*
 * Setup the theme paths.
 */
$paths['theme'] = __DIR__ . DS;
$paths['theme.resources'] = __DIR__ . DS . 'resources' . DS;
$paths['theme.admin'] = __DIR__ . DS . 'resources' . DS . 'admin' . DS;
themosis_set_paths($paths);
/*
 * Register all paths into the service container.
 */
$theme->registerAllPaths(themosis_path());
/*
 * Load theme configuration files.
 */
$theme['config.finder']->addPaths([themosis_path('theme.resources') . 'config' . DS]);
/*
 * Autoloading.
 */
$loader = new \Composer\Autoload\ClassLoader();
$classes = \Themosis\Facades\Config::get('loading');
foreach ($classes as $prefix => $path) {
    $loader->addPsr4($prefix, $path);
예제 #3
0
 /**
  * Bootstrap the core plugin.
  */
 protected function bootstrap()
 {
     /*
      * Define core framework paths.
      * These are real paths, not URLs to the framework files.
      */
     $paths['core'] = __DIR__ . DS;
     $paths['sys'] = __DIR__ . DS . 'src' . DS . 'Themosis' . DS;
     $paths['storage'] = THEMOSIS_STORAGE;
     themosis_set_paths($paths);
     /*
      * Instantiate the service container for the project.
      */
     $this->container = new \Themosis\Foundation\Application();
     /*
      * Create a new Request instance and register it.
      * By providing an instance, the instance is shared.
      */
     $request = \Themosis\Foundation\Request::capture();
     $this->container->instance('request', $request);
     /*
      * Setup the facade.
      */
     \Themosis\Facades\Facade::setFacadeApplication($this->container);
     /*
      * Register into the container, the registered paths.
      * Normally at this stage, plugins should have
      * their paths registered into the $GLOBALS array.
      */
     $this->container->registerAllPaths(themosis_path());
     /*
      * Register core service providers.
      */
     $this->registerProviders();
     /*
      * Setup core.
      */
     $this->setup();
     /*
      * Project hooks.
      * Added in their called order.
      */
     add_action('admin_enqueue_scripts', [$this, 'adminEnqueueScripts']);
     add_action('admin_head', [$this, 'adminHead']);
     add_action('template_redirect', 'redirect_canonical');
     add_action('template_redirect', 'wp_redirect_admin_locations');
     add_action('template_redirect', [$this, 'setRouter'], 20);
 }