public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new WPDDL_ModuleManagerSupport();
     }
     return self::$instance;
 }
 function __construct()
 {
     $this->plugin_localization();
     WPDDL_Layouts_WPML::getInstance();
     WPDDL_ModuleManagerSupport::getInstance();
     WDDL_ExtraModulesLoader::getInstance();
     $this->ddl_caps = WPDD_Layouts_Users_Profiles::getInstance();
     $this->registed_cells = new WPDD_registed_cell_types();
     $this->layout_post_loop_cell_manager = new WPDD_layout_post_loop_cell_manager();
     $this->registered_theme_sections = new WPDD_register_layout_theme_section();
     $this->scripts_manager = WPDDL_scripts_manager::getInstance();
     if (is_admin()) {
         $this->parents_options = new WPDDL_Options_Manager(self::PARENTS_OPTIONS);
     }
     $this->post_types_manager = new WPDD_Layouts_PostTypesManager();
     $this->individual_assignment_manager = new WPDD_Layouts_IndividualAssignmentManager();
     global $wpdd_gui_editor;
     $this->wpddl_init();
     $this->css_manager = WPDD_Layouts_CSSManager::getInstance();
     $this->frameworks_options_manager = WPDD_Layouts_CSSFrameworkOptions::getInstance();
     $this->set_css_framework($this->frameworks_options_manager->get_current_framework());
     add_action('wp_ajax_nopriv_' . WPDDL_LAYOUTS_CSS, array(&$this, 'handle_layout_css_from_db_print'), 10);
     add_action('init', array(&$this, 'init_listing_page'), 20);
     add_action('before_delete_post', array(&$this, 'before_delete_post_action'));
     add_action('add_attachment', array(&$this, 'add_attachment_action'));
     if (is_admin()) {
         // a little trick to have global $this available in post edit page upon construction
         add_action('init', array(&$this, 'init_create_layout_for_pages'), 20);
         $this->fix_up_views_slugs();
         if ($this->layouts_editor_page) {
             new WPDD_GUI_DIALOGS();
         }
         global $pagenow;
         $wpdd_gui_editor = new WPDD_GUI_EDITOR();
         /**/
         if (class_exists('WPDDL_Admin_Pages')) {
             WPDDL_Admin_Pages::getInstance();
         } else {
             if (class_exists('WPDDL_Admin_Pages_Embedded')) {
                 WPDDL_Admin_Pages_Embedded::getInstance();
             }
         }
         if ($pagenow == 'plugins.php') {
             add_action('admin_enqueue_scripts', array($this, 'plugin_page_styles'));
         }
         if (isset($_GET['page']) && ($_GET['page'] == WPDDL_LAYOUTS_POST_TYPE || $_GET['page'] == 'dd_layout_theme_export' || $_GET['page'] == 'dd_layouts_edit')) {
             add_action('admin_enqueue_scripts', array($this, 'preload_styles'));
             add_action('admin_enqueue_scripts', array($this, 'preload_scripts'));
         }
         if (isset($_GET['page']) && $_GET['page'] == 'dd_tutorial_videos') {
             add_action('admin_enqueue_scripts', array($this, 'help_page_scripts'));
         }
         if (isset($_GET['in-iframe-for-layout']) && $_GET['in-iframe-for-layout'] == 1 && defined('CRED_FORMS_CUSTOM_POST_NAME') && $pagenow == 'post.php' && isset($_GET['post'])) {
             $post_id = $_GET['post'];
             $post = get_post($post_id);
             if ($post->post_type == CRED_FORMS_CUSTOM_POST_NAME) {
                 add_action('admin_enqueue_scripts', array($this, 'cred_in_iframe_scripts'));
             }
         }
         if (isset($_GET['in-iframe-for-layout']) && $_GET['in-iframe-for-layout'] == 1 && defined('CRED_USER_FORMS_CUSTOM_POST_NAME') && $pagenow == 'post.php' && isset($_GET['post'])) {
             $post_id = $_GET['post'];
             $post = get_post($post_id);
             if ($post->post_type == CRED_USER_FORMS_CUSTOM_POST_NAME) {
                 add_action('admin_enqueue_scripts', array($this, 'cred_user_in_iframe_scripts'));
             }
         }
         if (isset($_GET['in-iframe-for-layout']) && $_GET['in-iframe-for-layout'] == 1 && isset($_GET['page']) && ('views-editor' == $_GET['page'] || 'views-embedded' == $_GET['page'] || 'view-archives-embedded' == $_GET['page'] || 'view-archives-editor' == $_GET['page'])) {
             add_action('admin_enqueue_scripts', array($this, 'views_in_iframe_scripts'));
         }
         if (isset($_GET['in-iframe-for-layout']) && '1' == $_GET['in-iframe-for-layout']) {
             wp_deregister_script('heartbeat');
             remove_action('wp_head', 'print_emoji_detection_script', 7);
             remove_action('wp_print_styles', 'print_emoji_styles');
         }
         add_action('wp_ajax_ddl_create_layout', array($this, 'create_layout_callback'));
         add_action('wp_ajax_ddl_dismiss_template_message', array($this, 'ddl_dismiss_template_message'));
         /**
          * add extra debug information
          */
         add_filter('icl_get_extra_debug_info', array($this, 'add_extra_debug_information'));
         add_action('wpml_register_string_packages', array($this, 'register_all_strings_for_translation'), 10, 0);
         add_action('admin_enqueue_scripts', array($this, 'enqueue_toolset_common_styles'));
     } else {
         // add_action('wp_head', array(&$this,'handle_layout_css_fe'));
         if (isset($_GET['ddl_style'])) {
             header('Content-Type:text/css');
             $this->wpddl_frontent_styles($_GET['ddl_style']);
             die;
         }
         // Assign post layout for post create from front-end
         add_action('wp_enqueue_scripts', array($this, 'load_frontend_js'));
         add_action('wp_enqueue_scripts', array($this, 'load_frontend_css'));
         //place layout edit link in last position
         add_action('get_layout_id_for_render', array(&$this, 'get_layout_id_for_render_callback'), 888, 2);
         // @see class-toolset-admin-bar-menu.php
         //add_action( 'admin_bar_menu', array($this, 'print_layout_edit_link'), 999 );
         add_action('wp_enqueue_scripts', array($this, 'enqueue_toolset_common_styles'));
         /**
          * get cache singleton
          */
         WPDD_Layouts_Cache_Singleton::getInstance();
     }
 }