/** * Parse the action uri value. * * @param string $uri * @param bool $ssl * * @return string */ protected function parseAction($uri, $ssl) { if (strpos(esc_url($uri), 'http')) { $uri = esc_url($uri, ['http', 'https']); $uri = starts_with($uri, '/') ? substr($uri, 1) : $uri; return is_ssl() || $ssl ? str_replace('http://', 'https://', $uri) : $uri; } return is_ssl() || $ssl ? 'https://' . $this->request->getHttpHost() . $uri : 'http://' . $this->request->getHttpHost() . $uri; }
/** * 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); }