freeze() public method

Lock write access to this object's instance. Forever.
public freeze ( ) : Inpsyde_Property_List_Interface
return Inpsyde_Property_List_Interface $this
Beispiel #1
0
 /**
  * Initial setup handler.
  *
  * @global	$wpdb wpdb WordPress Database Wrapper
  * @global	$pagenow string Current Page Wrapper
  * @return void
  */
 public function setup()
 {
     $this->prepare_plugin_data();
     $this->load_assets();
     $this->prepare_helpers();
     $this->plugin_data->freeze();
     // no changes allowed anymore
     require 'functions.php';
     if (!$this->is_active_site()) {
         return;
     }
     // Hooks and filters
     add_action('inpsyde_mlp_loaded', array($this, 'load_plugin_textdomain'), 1);
     // Load modules
     $this->load_features();
     /**
      * First entry for MultilingualPress.
      * Runs before internal actions are registered.
      *
      * @param Inpsyde_Property_List_Interface $plugin_data
      * @param wpdb                            $wpdb
      */
     do_action('inpsyde_mlp_init', $this->plugin_data, $this->wpdb);
     // Enqueue scripts
     add_action('admin_enqueue_scripts', array($this, 'admin_scripts'));
     // Cleanup upon blog delete
     add_filter('delete_blog', array($this, 'delete_blog'), 10, 2);
     // Check for errors
     add_filter('all_admin_notices', array($this, 'check_for_user_errors_admin_notice'));
     add_action('wp_loaded', array($this, 'late_load'), 0);
     /**
      * Second entry for MultilingualPress
      *
      * Runs after internal actions are registered.
      *
      * @param Inpsyde_Property_List_Interface $plugin_data
      * @param wpdb                            $wpdb
      */
     do_action('inpsyde_mlp_loaded', $this->plugin_data, $this->wpdb);
     if (is_admin()) {
         $this->run_admin_actions();
     } else {
         $this->run_frontend_actions();
     }
 }
 /**
  * Initial setup handler.
  *
  * @global	$wpdb wpdb WordPress Database Wrapper
  * @global	$pagenow string Current Page Wrapper
  * @return void
  */
 public function setup()
 {
     global $pagenow;
     $this->link_table = $this->wpdb->base_prefix . 'multilingual_linked';
     $this->plugin_dir_path = $this->plugin_data->plugin_dir_path;
     $this->plugin_file_path = $this->plugin_data->plugin_file_path;
     $this->plugin_data->module_manager = new Mlp_Module_Manager('state_modules');
     $this->plugin_data->site_manager = new Mlp_Module_Manager('inpsyde_multilingual');
     $this->plugin_data->link_table = $this->link_table;
     $this->plugin_data->content_relations = new Mlp_Content_Relations($this->wpdb, $this->plugin_data->site_relations, $this->link_table);
     $this->plugin_data->language_api = new Mlp_Language_Api($this->plugin_data, 'mlp_languages', $this->plugin_data->site_relations, $this->plugin_data->content_relations, $this->wpdb);
     $this->plugin_data->assets = new Mlp_Assets($this->plugin_data->locations);
     $this->load_assets();
     Mlp_Helpers::$link_table = $this->link_table;
     Mlp_Helpers::insert_dependency('site_relations', $this->plugin_data->site_relations);
     Mlp_Helpers::insert_dependency('language_api', $this->plugin_data->language_api);
     Mlp_Helpers::insert_dependency('plugin_data', $this->plugin_data);
     $this->plugin_data->freeze();
     // no changes allowed anymore
     require 'functions.php';
     // This check prevents the use of this plugin in a not-setted blog
     if ('admin-post.php' != $pagenow && 'admin-ajax.php' != $pagenow && !is_network_admin() && !array_key_exists(get_current_blog_id(), get_site_option('inpsyde_multilingual', array()))) {
         return;
     }
     // The Plugins Basename
     // used by features/class-Multilingual_Press_Auto_Update.php only
     self::$plugin_base_name = $this->plugin_data->plugin_base_name;
     // The Plugins URL
     self::$plugin_url = $this->plugin_data->plugin_uri;
     // The Plugins Name
     self::$plugin_name = $this->plugin_data->plugin_name;
     // Textdomain Path
     self::$textdomainpath = $this->plugin_data->text_domain_path;
     // Hooks and filters
     add_action('inpsyde_mlp_loaded', array($this, 'load_plugin_textdomain'), 1);
     // Load modules
     $this->load_features();
     /**
      * Kick-Off Init
      * @return  Void
      */
     do_action('inpsyde_mlp_init', $this->plugin_data);
     // Enqueue scripts
     add_action('admin_enqueue_scripts', array($this, 'admin_scripts'));
     // Cleanup upon blog delete
     add_filter('delete_blog', array($this, 'delete_blog'), 10, 2);
     // Checkup blog cleanup
     add_filter('admin_head', array($this, 'checkup_blog_message'));
     add_filter('wp_ajax_checkup_blogs', array($this, 'checkup_blog'));
     // Check for errors
     add_filter('all_admin_notices', array($this, 'check_for_user_errors_admin_notice'));
     add_action('wp_loaded', array($this, 'late_load'), 0);
     /**
      * Everything loaded
      * @param   Inpsyde_Property_List_Interface
      */
     do_action('inpsyde_mlp_loaded', $this->plugin_data);
     if (is_admin()) {
         if ($this->plugin_data->module_manager->has_modules()) {
             $this->load_module_settings_page();
         }
         if ($this->plugin_data->site_manager->has_modules()) {
             $this->load_site_settings_page();
         }
         new Mlp_Network_Site_Settings_Controller($this->plugin_data);
         new Mlp_Network_New_Site_Controller($this->plugin_data->language_api, $this->plugin_data->site_relations);
     } else {
         // frontend-hooks
         $hreflang = new Mlp_Hreflang_Header_Output($this->plugin_data->language_api);
         add_action('template_redirect', array($hreflang, 'http_header'));
         add_action('wp_head', array($hreflang, 'wp_head'));
     }
 }