コード例 #1
0
 public function Init()
 {
     $this->init_fs_hooks();
     if (!$this->fs->is_registered() && !is_admin()) {
         return;
     }
     if ($this->fs->is_registered() && !$this->account->is_registered()) {
         // Connected only with FS, therefore try to connect to RW.
         $this->connect_account($this->fs->get_user(), $this->fs->get_site());
     }
     // Load all extensions.
     require_once WP_RW__PLUGIN_LIB_DIR . 'rw-extension-abstract.php';
     require_once WP_RW__PLUGIN_LIB_DIR_EXT . 'rw-woocommerce.php';
     $this->LoadExtensionsDefaultOptions();
     $this->LogInitialData();
     // Run plugin setup.
     $continue = is_admin() ? $this->setup_on_dashboard() : $this->setup_on_site();
     if (!$continue) {
         return;
     }
     if ($this->fs->is_registered()) {
         $this->fs->add_submenu_link_item(__rw('faq'), rw_get_site_url('support/wordpress/#platform'), false, 'read', 25);
         //					add_action( 'init', array( &$this, 'LoadPlan' ) );
         // Clear cache has to be executed after LoadPlan, because clear
         // cache is has a condition that checks the plan.
         add_action('init', array(&$this, 'ClearCache'));
         add_action('init', array(&$this, 'SetupBuddyPress'));
         add_action('init', array(&$this, 'SetupBBPress'));
     }
     $this->errors = new WP_Error();
     $this->success = new WP_Error();
     /**
      * IMPORTANT:
      *   All scripts/styles must be enqueued from these actions,
      *   otherwise it will mass-up the layout of the admin's dashboard
      *   on RTL WP versions.
      */
     add_action('admin_enqueue_scripts', array(&$this, 'InitScriptsAndStyles'));
     // Enqueue site's styles
     add_action('wp_enqueue_scripts', array(&$this, 'init_site_styles'));
     $rw_languages = array();
     require_once WP_RW__PLUGIN_DIR . '/languages/dir.php';
     $this->languages = $rw_languages;
     $this->languages_short = array_keys($this->languages);
     add_action('plugins_loaded', array(&$this, 'rw_load_textdomain'));
 }