/** * Class Init */ function init() { // Include required files $this->includes(); $this->setup_default_directories(); /* git #1862 */ $this->builder_cpt_check(); do_action('themify_builder_setup_modules', $this); // Init Themify_Builder_Model::load_general_metabox(); // setup metabox fields $this->load_modules(); // load builder modules // Builder write panel add_filter('themify_do_metaboxes', array($this, 'builder_write_panels'), 11); // Filtered post types add_filter('themify_post_types', array($this, 'extend_post_types')); add_filter('themify_builder_module_content', 'wptexturize'); add_filter('themify_builder_module_content', 'convert_smilies'); add_filter('themify_builder_module_content', 'convert_chars'); add_filter('themify_builder_module_content', array($this, 'the_module_content')); // Actions add_action('init', array($this, 'setup'), 10); add_action('themify_builder_metabox', array($this, 'add_builder_metabox'), 10); //add_action( 'media_buttons_context', array( $this, 'add_custom_switch_btn' ), 10 ); add_action('admin_enqueue_scripts', array($this, 'load_admin_interface'), 10); // Asynchronous Loader add_action('wp_enqueue_scripts', array($this, 'register_frontend_js_css'), 9); if (Themify_Builder_Model::is_frontend_editor_page()) { add_action('wp_enqueue_scripts', array($this, 'async_load_builder_js'), 9); add_action('wp_footer', array($this, 'async_load_assets_loaded'), 99); add_action('wp_ajax_themify_builder_loader', array($this, 'async_load_builder')); add_action('wp_ajax_nopriv_themify_builder_loader', array($this, 'async_load_builder')); // load module panel frontend add_action('wp_footer', array($this, 'builder_module_panel_frontedit'), 10); add_action('wp_footer', array($this, 'load_javascript_template'), 10); add_action('wp_footer', 'themify_font_icons_dialog', 10); // Row Styling add_action('themify_builder_row_start', array($this, 'render_row_styling'), 10, 2); } else { // If user not logged in and is not a Builder editor view, enqueue static stylesheet if (isset($_GET['themify_builder_infinite_scroll']) && 'yes' == $_GET['themify_builder_infinite_scroll']) { add_action('themify_builder_row_start', array($this, 'render_row_styling'), 10, 2); } else { add_action('wp_enqueue_scripts', array($this, 'enqueue_stylesheet'), 14); add_action('themify_builder_before_template_content_render', array($this, 'enqueue_stylesheet'), 10, 2); } } // Google Fonts add_action('wp_footer', array($this, 'load_builder_google_fonts'), 10); // Ajax Actions add_action('wp_ajax_tfb_add_element', array($this, 'add_element_ajaxify'), 10); add_action('wp_ajax_tfb_lightbox_options', array($this, 'module_lightbox_options_ajaxify'), 10); add_action('wp_ajax_tfb_add_wp_editor', array($this, 'add_wp_editor_ajaxify'), 10); add_action('wp_ajax_builder_import', array($this, 'builder_import_ajaxify'), 10); add_action('wp_ajax_builder_import_submit', array($this, 'builder_import_submit_ajaxify'), 10); add_action('wp_ajax_row_lightbox_options', array($this, 'row_lightbox_options_ajaxify'), 10); add_action('wp_ajax_builder_render_duplicate_row', array($this, 'render_duplicate_row_ajaxify'), 10); // Builder Save Data add_action('wp_ajax_tfb_save_data', array($this, 'save_data_builder'), 10); // Duplicate page / post action add_action('wp_ajax_tfb_duplicate_page', array($this, 'duplicate_page_ajaxify'), 10); // Hook to frontend add_action('wp_head', array($this, 'load_inline_js_script'), 10); add_filter('the_content', array($this, 'builder_show_on_front'), 11); add_action('wp_ajax_tfb_toggle_frontend', array($this, 'load_toggle_frontend_ajaxify'), 10); add_action('wp_ajax_tfb_load_module_partial', array($this, 'load_module_partial_ajaxify'), 10); add_action('wp_ajax_tfb_load_row_partial', array($this, 'load_row_partial_ajaxify'), 10); add_filter('body_class', array($this, 'body_class'), 10); // Shortcode add_shortcode('themify_builder_render_content', array($this, 'do_shortcode_builder_render_content')); // Plupload Action add_action('admin_enqueue_scripts', array($this, 'plupload_admin_head'), 10); // elioader //add_action( 'wp_head', array( $this, 'plupload_front_head' ), 10 ); add_action('wp_ajax_themify_builder_plupload_action', array($this, 'builder_plupload'), 10); add_action('admin_bar_menu', array($this, 'builder_admin_bar_menu'), 100); // Frontend editor add_action('themify_builder_edit_module_panel', array($this, 'module_edit_panel_front'), 10, 2); // Checks if a stylesheet with the proper slug exists, otherwise generates it. add_action('save_post', array($this, 'build_stylesheet_if_needed'), 77, 1); // Switch to frontend add_action('save_post', array($this, 'switch_frontend'), 999, 1); // Reset Builder Filter // Non active at the moment //add_action( 'themify_builder_before_template_content_render', array( $this, 'do_reset_before_template_content_render' ) ); //add_action( 'themify_builder_after_template_content_render', array( $this, 'do_reset_after_template_content_render' ) ); // WordPress Search add_filter('posts_where', array($this, 'do_search')); add_filter('post_class', array($this, 'filter_post_class')); if (Themify_Builder_Model::is_animation_active()) { add_filter('themify_builder_animation_inview_selectors', array($this, 'add_inview_selectors')); } // Render any js classname add_action('wp_head', array($this, 'render_javascript_classes')); add_action('wp_head', array($this, 'add_builder_inline_css'), 0); }
/** * Class Init */ function init() { // Include required files $this->includes(); $this->setup_default_directories(); do_action('themify_builder_setup_modules', $this); // Init Themify_Builder_Model::load_general_metabox(); // setup metabox fields $this->load_modules(); // load builder modules // Builder write panel add_filter('themify_do_metaboxes', array(&$this, 'builder_write_panels'), 11); // Filtered post types add_filter('themify_post_types', array(&$this, 'extend_post_types')); add_filter('themify_builder_module_content', 'wptexturize'); add_filter('themify_builder_module_content', 'convert_smilies'); add_filter('themify_builder_module_content', 'convert_chars'); add_filter('themify_builder_module_content', array(&$this, 'the_module_content')); // Actions add_action('init', array(&$this, 'setup'), 10); add_action('themify_builder_metabox', array(&$this, 'add_builder_metabox'), 10); //add_action( 'media_buttons_context', array( &$this, 'add_custom_switch_btn' ), 10 ); add_action('admin_enqueue_scripts', array(&$this, 'load_admin_js_css'), 10); add_action('wp_enqueue_scripts', array(&$this, 'load_front_js_css'), 10); add_action('wp_footer', array(&$this, 'load_builder_google_fonts'), 10); // Ajax Actions add_action('wp_ajax_tfb_add_element', array(&$this, 'add_element_ajaxify'), 10); add_action('wp_ajax_tfb_lightbox_options', array(&$this, 'module_lightbox_options_ajaxify'), 10); add_action('wp_ajax_tfb_add_wp_editor', array(&$this, 'add_wp_editor_ajaxify'), 10); add_action('wp_ajax_builder_import', array(&$this, 'builder_import_ajaxify'), 10); add_action('wp_ajax_builder_import_submit', array(&$this, 'builder_import_submit_ajaxify'), 10); add_action('wp_ajax_row_lightbox_options', array(&$this, 'row_lightbox_options_ajaxify'), 10); // Builder Save Data add_action('wp_ajax_tfb_save_data', array(&$this, 'save_data_builder'), 10); // Duplicate page / post action add_action('wp_ajax_tfb_duplicate_page', array(&$this, 'duplicate_page_ajaxify'), 10); // Hook to frontend add_action('wp_head', array(&$this, 'load_inline_js_script'), 10); add_filter('the_content', array(&$this, 'builder_show_on_front'), 11); add_action('wp_ajax_tfb_toggle_frontend', array(&$this, 'load_toggle_frontend_ajaxify'), 10); add_action('wp_ajax_tfb_load_module_partial', array(&$this, 'load_module_partial_ajaxify'), 10); add_action('wp_ajax_tfb_load_row_partial', array(&$this, 'load_row_partial_ajaxify'), 10); add_filter('body_class', array(&$this, 'body_class'), 10); // Shortcode add_shortcode('themify_builder_render_content', array(&$this, 'do_shortcode_builder_render_content')); // Plupload Action add_action('admin_enqueue_scripts', array(&$this, 'plupload_admin_head'), 10); add_action('wp_head', array(&$this, 'plupload_front_head'), 10); add_action('wp_ajax_themify_builder_plupload_action', array(&$this, 'builder_plupload'), 10); add_action('admin_bar_menu', array(&$this, 'builder_admin_bar_menu'), 100); // Frontend editor add_action('themify_builder_edit_module_panel', array(&$this, 'module_edit_panel_front'), 10, 2); // Switch to frontend add_action('save_post', array(&$this, 'switch_frontend'), 999, 1); // Reset Builder Filter add_action('themify_builder_before_template_content_render', array(&$this, 'do_reset_before_template_content_render')); add_action('themify_builder_after_template_content_render', array(&$this, 'do_reset_after_template_content_render')); // WordPress Search add_filter('posts_where', array(&$this, 'do_search')); // Row Styling add_action('themify_builder_row_start', array(&$this, 'render_row_styling'), 10, 2); }