Example #1
0
 public static function init()
 {
     /* Load the default meta boxes */
     Headway::load('admin/admin-meta-boxes');
     add_action('delete_post', array(__CLASS__, 'delete_post'));
     add_filter('get_sample_permalink_html', array(__CLASS__, 'open_in_visual_editor_button'), 10, 4);
 }
Example #2
0
 public static function init()
 {
     Headway::load(array('api/api-block'));
     self::load_core_blocks();
     add_action('init', array(__CLASS__, 'register_block_types'), 8);
     add_action('init', array(__CLASS__, 'process_registered_blocks'), 9);
     /* Handle block-specific actions */
     add_action('init', array(__CLASS__, 'setup_block_actions'), 10);
     add_action('init', array(__CLASS__, 'run_block_init_actions'), 11);
     add_action('wp', array(__CLASS__, 'run_block_enqueue_actions'));
     add_action('wp', array(__CLASS__, 'enqueue_block_dynamic_js_file'));
     /* End block-specific actions */
     add_action('headway_register_elements_instances', array(__CLASS__, 'register_block_element_instances'), 11);
     add_action('headway_block_content_unknown', array(__CLASS__, 'unknown_block_content'));
     /* Clear the block actions cache upon Visual Editor save and others */
     add_action('headway_visual_editor_save', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('headway_visual_editor_reset_layout', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('headway_visual_editor_delete_template', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('headway_visual_editor_assign_template', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('headway_visual_editor_unassign_template', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('headway_db_upgrade', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('headway_activation', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('headway_global_reset', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('publish_post', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('delete_post', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('activate_plugin', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('deactivate_plugin', array(__CLASS__, 'clear_block_actions_cache'));
     add_action('switch_theme', array(__CLASS__, 'clear_block_actions_cache'));
 }
Example #3
0
 public static function init()
 {
     if (is_admin()) {
         return;
     }
     Headway::load(array('display/head' => true, 'display/grid-renderer', 'display/layout-renderer'));
     add_filter('body_class', array(__CLASS__, 'body_class'));
     if (HeadwayRoute::is_visual_editor_iframe()) {
         Headway::load('visual-editor', 'VisualEditor');
         HeadwayAdminBar::remove_admin_bar();
     }
     /* If it's a plugin template, then route all of the content to the content block */
     add_action('get_header', array(__CLASS__, 'handle_plugin_template'), 1);
 }
Example #4
0
 public static function init()
 {
     //Load boxes
     Headway::load('api/api-box');
     require_once HEADWAY_LIBRARY_DIR . '/visual-editor/boxes/live-css.php';
     require_once HEADWAY_LIBRARY_DIR . '/visual-editor/boxes/grid-wizard.php';
     //Load panels
     if (current_theme_supports('headway-grid')) {
         require_once HEADWAY_LIBRARY_DIR . '/visual-editor/panels/grid/setup.php';
     }
     if (current_theme_supports('headway-design-editor')) {
         require_once HEADWAY_LIBRARY_DIR . '/visual-editor/panels/design/panel-editor.php';
         require_once HEADWAY_LIBRARY_DIR . '/visual-editor/panels/design/panel-default-elements.php';
         require_once HEADWAY_LIBRARY_DIR . '/visual-editor/panels/design/panel-skins.php';
     }
     //Put in action so we can run top level functions
     do_action('headway_visual_editor_display_init');
     //System for scripts/styles
     add_action('headway_visual_editor_head', array(__CLASS__, 'print_styles'), 12);
     add_action('headway_visual_editor_footer', array(__CLASS__, 'print_scripts'), 12);
     //Enqueue Styles
     remove_all_actions('wp_print_styles');
     /* Removes bad plugin CSS */
     add_action('headway_visual_editor_styles', array(__CLASS__, 'enqueue_styles'));
     add_action('headway_visual_editor_styles', array(__CLASS__, 'output_inline_loading_css'));
     //Enqueue Scripts
     remove_all_actions('wp_print_scripts');
     /* Removes bad plugin JS */
     add_action('headway_visual_editor_scripts', array(__CLASS__, 'enqueue_scripts'));
     //Localize Scripts
     add_action('headway_visual_editor_scripts', array(__CLASS__, 'add_visual_editor_js_vars'));
     //Content
     add_action('headway_visual_editor_modes', array(__CLASS__, 'mode_navigation'));
     add_action('headway_visual_editor_menu_links', array(__CLASS__, 'menu_links'));
     add_action('headway_visual_editor_page_switcher', array(__CLASS__, 'page_switcher_page'));
     add_action('headway_visual_editor_footer', array(__CLASS__, 'layout_selector'));
     add_action('headway_visual_editor_footer', array(__CLASS__, 'block_type_selector'));
     add_action('headway_visual_editor_panel_top', array(__CLASS__, 'panel_top_right'), 12);
     add_action('headway_visual_editor_panel_top', array(__CLASS__, 'panel_top_mode_buttons'), 13);
     //Prevent any type of caching on this page
     define('DONOTCACHEPAGE', true);
     define('DONOTMINIFY', true);
 }
Example #5
0
 public static function form_action_maintenance()
 {
     //Form action for all Headway configuration panels.  Not in function/hook so it can load before everything else.
     if (!headway_post('headway-maintenance-nonce', false)) {
         return false;
     }
     //Check the nonce for security
     if (!wp_verify_nonce(headway_post('headway-maintenance-nonce', false), 'headway-maintenance-nonce')) {
         $GLOBALS['headway_admin_save_message'] = 'Security nonce did not match.';
         return false;
     }
     //Load the maintenance class
     Headway::load('common/maintenance');
     //Handle block repair
     if (headway_post('repair-blocks', false)) {
         HeadwayMaintenance::repair_blocks();
         $GLOBALS['headway_admin_save_message'] = 'Blocks have successfully been repaired.';
     }
     return true;
 }
Example #6
0
 /**
  * Direct index.php to the appropriate function
  * 
  * @return bool
  **/
 public static function direct()
 {
     //If viewing the visual editor, stop the template loading and show the visual editor.
     if (self::is_visual_editor()) {
         //If user is logged in and can't visually edit, loop them back to normal template.
         if (is_user_logged_in() && !HeadwayCapabilities::can_user_visually_edit()) {
             wp_die('You have insufficient permissions to use the Headway Visual Editor.<br /><br /><a href="' . home_url() . '">Return to Home</a>');
             return false;
             //If the user isn't logged in at all, log 'em in and loop back to visual editor as long as debug mode isn't active
         } elseif (!is_user_logged_in() && !HeadwayOption::get('debug-mode')) {
             return auth_redirect();
         }
         HeadwayVisualEditor::display();
         die;
         //Theme Preview
     } elseif (self::is_theme_preview()) {
         return wp_die('Headway and Headway Child Themes cannot be previewed.  Please activate the theme if you wish to see how it looks.');
     } elseif (self::is_grid()) {
         Headway::load('visual-editor/iframe-grid');
         HeadwayVisualEditorIframeGrid::show();
         die;
     }
 }
Example #7
0
 public static function init()
 {
     Headway::load(array('elements/properties', 'data/data-elements', 'api/api-element' => 'ElementAPI'));
     add_action('headway_elements_init', array(__CLASS__, 'load_elements'));
     do_action('headway_elements_init');
 }
Example #8
0
 public static function display()
 {
     self::check_if_ie();
     Headway::load('visual-editor/display', 'VisualEditorDisplay');
     HeadwayVisualEditorDisplay::display();
 }
Example #9
0
<?php

/**
 * Starts Headway
 *
 * @package Headway
 * @author Clay Griffiths
 */
/* Prevent direct access to this file */
if (!defined('WP_CONTENT_DIR')) {
    die('Please do not access this file directly.');
}
/* Make sure PHP 5.2 or newer is installed and WordPress 3.2 or newer is installed. */
require_once get_template_directory() . '/library/common/compatibility-checks.php';
/* Load Headway! */
require_once get_template_directory() . '/library/common/functions.php';
require_once get_template_directory() . '/library/common/application.php';
Headway::init();
Example #10
0
 /**
  * This will process upgrades from one version to another.
  **/
 public static function maybe_db_upgrade()
 {
     $headway_settings = get_option('headway', array('version' => 0));
     $db_version = $headway_settings['version'];
     /* If the version in the database is already up to date, then there are no upgrade functions to be ran. */
     if (version_compare($db_version, HEADWAY_VERSION, '>=') || $db_version === 0) {
         return false;
     }
     Headway::load('common/maintenance');
     return HeadwayMaintenance::db_upgrade($db_version);
 }
 public static function method_export_block_settings()
 {
     Headway::load('data/data-portability');
     return HeadwayDataPortability::export_block_settings(headway_get('block-id'));
 }