prepare_plugin_data() public method

public prepare_plugin_data ( ) : void
return void
コード例 #1
0
 /**
  * Bootstraps MultilingualPress.
  *
  * @since 3.0.0
  *
  * @return bool Whether or not MultilingualPress was bootstrapped successfully.
  *
  * @throws BadMethodCallException if called on a MultilingualPress instance that has already been bootstrapped.
  */
 public function bootstrap()
 {
     if ($this->is_bootstrapped) {
         throw new BadMethodCallException('Cannot bootstrap a MultilingualPress instance that has already been bootstrapped.');
     }
     /**
      * Fires right before MultilingualPress gets bootstrapped.
      *
      * Hook here to register custom service providers.
      *
      * @since 3.0.0
      *
      * @param static $multilingualpress MultilingualPress instance.
      */
     do_action('multilingualpress.bootstrap', $this);
     static::$container->lock();
     // TODO: Eventually remove the following block.
     class_exists('Mlp_Load_Controller') or (require __DIR__ . '/inc/autoload/Mlp_Load_Controller.php');
     new \Mlp_Load_Controller(static::$container['multilingualpress.properties']->plugin_dir_path() . '/src/inc');
     if (!$this->check_installation()) {
         return false;
     }
     $this->bootstrap_service_providers();
     $needs_modules = $this->needs_modules();
     if ($needs_modules) {
         /**
          * Fires right before MultilingualPress registers any modules.
          *
          * @since 3.0.0
          */
         do_action('multilingualpress.register_modules');
         $this->register_modules();
     }
     unset($this->modules);
     static::$container->bootstrap();
     $this->is_bootstrapped = true;
     // TODO: Remove as soon as the old front controller has been replaced completely.
     class_exists('Multilingual_Press') or (require __DIR__ . '/inc/Multilingual_Press.php');
     // TODO: Refactor according to new architecure.
     $old_controller = new \Multilingual_Press(static::$container);
     $old_controller->prepare_plugin_data();
     if (!$needs_modules) {
         return true;
     }
     load_plugin_textdomain('multilingual-press');
     if (is_admin()) {
         $this->bootstrap_admin();
     } else {
         $this->bootstrap_front_end();
     }
     // TODO: Refactor according to new architecure.
     $old_controller->setup();
     return true;
 }