Esempio n. 1
0
 public static function init()
 {
     if (!HeadwayCapabilities::can_user_visually_edit()) {
         return;
     }
     //If no child theme is active or if a child theme IS active and the grid is supported, use the grid mode.
     if (current_theme_supports('headway-grid')) {
         self::$modes['Grid'] = 'Add blocks and arrange your website structure';
     }
     self::$modes['Design'] = 'Choose fonts, colors, and other styles';
     //If the grid is disabled, set Design as the default mode.
     if (!current_theme_supports('headway-grid')) {
         self::$default_mode = 'design';
     }
     //Attempt to raise memory limit to max
     @ini_set('memory_limit', apply_filters('headway_memory_limit', WP_MAX_MEMORY_LIMIT));
     //Load libraries and content
     Headway::load('visual-editor/preview', 'VisualEditorPreview');
     //Put in action so we can run top level functions
     do_action('headway_visual_editor_init');
     //Visual Editor AJAX
     add_action('wp_ajax_headway_visual_editor', array(__CLASS__, 'ajax'));
     if (HeadwayOption::get('debug-mode')) {
         add_action('wp_ajax_nopriv_headway_visual_editor', array(__CLASS__, 'ajax'));
     }
     //Iframe handling
     add_action('headway_body_close', array(__CLASS__, 'iframe_load_flag'));
     add_action('headway_grid_iframe_footer', array(__CLASS__, 'iframe_load_flag'));
 }