Example #1
0
 public static function add_admin_bar_nodes()
 {
     if (!HeadwayCapabilities::can_user_visually_edit()) {
         return;
     }
     global $wp_admin_bar;
     $default_visual_editor_mode = current_theme_supports('headway-grid') ? 'grid' : 'design';
     //Headway Root
     $wp_admin_bar->add_menu(array('id' => 'headway', 'title' => 'Headway', 'href' => add_query_arg(array('visual-editor' => 'true', 'visual-editor-mode' => $default_visual_editor_mode, 've-layout' => HeadwayLayout::get_current()), home_url())));
     //Visual Editor
     $wp_admin_bar->add_menu(array('parent' => 'headway', 'id' => 'headway-ve', 'title' => 'Visual Editor', 'href' => add_query_arg(array('visual-editor' => 'true', 'visual-editor-mode' => $default_visual_editor_mode, 've-layout' => HeadwayLayout::get_current()), home_url())));
     //Grid
     if (current_theme_supports('headway-grid')) {
         $wp_admin_bar->add_menu(array('parent' => 'headway-ve', 'id' => 'headway-ve-grid', 'title' => 'Grid', 'href' => add_query_arg(array('visual-editor' => 'true', 'visual-editor-mode' => 'grid', 've-layout' => HeadwayLayout::get_current()), home_url())));
     }
     //Design Editor
     $wp_admin_bar->add_menu(array('parent' => 'headway-ve', 'id' => 'headway-ve-design', 'title' => 'Design', 'href' => add_query_arg(array('visual-editor' => 'true', 'visual-editor-mode' => 'design', 've-layout' => HeadwayLayout::get_current()), home_url())));
     //Extend
     $wp_admin_bar->add_menu(array('parent' => 'headway', 'id' => 'headway-admin-extend', 'title' => 'Extend', 'href' => admin_url('admin.php?page=headway-extend')));
     //Admin Options
     $wp_admin_bar->add_menu(array('parent' => 'headway', 'id' => 'headway-admin-options', 'title' => 'Options', 'href' => admin_url('admin.php?page=headway-options')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-options', 'id' => 'headway-admin-options-general', 'title' => 'General', 'href' => admin_url('admin.php?page=headway-options#tab-general')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-options', 'id' => 'headway-admin-options-seo', 'title' => 'Search Engine Optimization', 'href' => admin_url('admin.php?page=headway-options#tab-seo')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-options', 'id' => 'headway-admin-options-scripts', 'title' => 'Scripts/Analytics', 'href' => admin_url('admin.php?page=headway-options#tab-scripts')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-options', 'id' => 'headway-admin-options-visual-editor', 'title' => 'Visual Editor', 'href' => admin_url('admin.php?page=headway-options#tab-visual-editor')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-options', 'id' => 'headway-admin-options-advanced', 'title' => 'Advanced', 'href' => admin_url('admin.php?page=headway-options#tab-advanced')));
     //Admin Tools
     $wp_admin_bar->add_menu(array('parent' => 'headway', 'id' => 'headway-admin-tools', 'title' => 'Tools', 'href' => admin_url('admin.php?page=headway-tools')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-tools', 'id' => 'headway-admin-tools-system-info', 'title' => 'System Info', 'href' => admin_url('admin.php?page=headway-tools#tab-system-info')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-tools', 'id' => 'headway-admin-tools-maintenance', 'title' => 'Maintenance', 'href' => admin_url('admin.php?page=headway-tools#tab-maintenance')));
     $wp_admin_bar->add_menu(array('parent' => 'headway-admin-tools', 'id' => 'headway-admin-tools-reset', 'title' => 'Reset', 'href' => admin_url('admin.php?page=headway-tools#tab-reset')));
 }
 private function display_no_blocks_message()
 {
     echo '<div class="wrapper wrapper-no-blocks wrapper-fixed" id="wrapper-default">' . "\n\n";
     echo '<div class="block-type-content">';
     echo '<div class="entry-content">';
     echo '<h1 class="entry-title">' . __('No Content to Display', 'headway') . '</h1>';
     $visual_editor_url = add_query_arg(array('visual-editor' => 'true', 'visual-editor-mode' => 'grid', 've-layout' => HeadwayLayout::get_current()), home_url());
     if (HeadwayCapabilities::can_user_visually_edit()) {
         echo sprintf(__('<p>There are no blocks to display.  Add some by going to the <a href="%s">Headway Grid</a>!</p>', 'headway'), $visual_editor_url);
     } else {
         echo sprintf(__('<p>There is no content to display.  Please notify the site administrator or <a href="%s">login</a>.</p>', 'headway'), $visual_editor_url);
     }
     echo '</div><!-- .entry-content -->';
     echo '</div><!-- .block-type-content -->';
     echo '</div><!-- .wrapper -->';
     return false;
 }
Example #3
0
			<div id="preview-button-container" class="save-button-container">
				<span class="save-button preview-button tooltip-top-right" id="preview-button" title="Click to hide the grid and show how the website looks before saving.">Preview</span>
				<span class="save-button preview-button" id="inactive-preview-button">Preview</span>
			</div>
			';
}
?>
		
	</div><!-- #menu-right -->
</div><!-- #menu -->

<!-- Big Boy iframe -->
<div id="iframe-container">
	<?php 
$layout_url = HeadwayVisualEditor::get_current_mode() == 'grid' ? home_url() : HeadwayLayout::get_url(HeadwayLayout::get_current());
$iframe_url = add_query_arg(array('ve-iframe' => 'true', 've-layout' => HeadwayLayout::get_current(), 've-iframe-mode' => HeadwayVisualEditor::get_current_mode(), 'rand' => rand(1, 999999)), $layout_url);
echo '<iframe id="content" class="content" src="' . $iframe_url . '" scrolling="no"></iframe>';
if (HeadwayVisualEditor::is_mode('grid')) {
    echo '<iframe id="preview" class="content" src="" style="display: none;" scrolling="no"></iframe>';
}
echo '<div id="iframe-overlay"></div>';
echo '<div id="iframe-loading-overlay"><div class="cog-container"><div class="cog-bottom-left"></div><div class="cog-top-right"></div></div></div>';
?>
</div>
<!-- #iframe#content -->

<div id="panel">
				
	<ul id="panel-top">
				
		<?php 
 public static function delete($layout, $option = null, $group_name = false)
 {
     //No deleting to be done if we don't have an option to delete
     if ($option === null) {
         return false;
     }
     //If there's no group defined, define it using the default
     if (!$group_name) {
         $group_name = self::$default_group;
     }
     //Make sure there is a layout to use
     if (!$layout) {
         $layout = HeadwayLayout::get_current();
     }
     //Format layout ID
     $layout = self::format_layout_id($layout);
     //Retrieve options array from DB
     $options = get_option('headway_layout_options_' . str_replace('-', '_', $layout));
     //If DB option doesn't exist, make a default array
     if (!is_array($options)) {
         $options = array();
     }
     //Option or group doesn't exist
     if (!isset($options[$group_name]) || !isset($options[$group_name][$option])) {
         return false;
     }
     //If option exists, delete the sucker
     unset($options[$group_name][$option]);
     //If group is empty, delete it too
     if (count($options[$group_name]) === 0) {
         unset($options[$group_name]);
     }
     //If the options array is empty, delete the entire option and remove it from catalog
     if (count($options) === 0 && !HeadwayOption::$group_suffix) {
         $removal = array($layout);
         $catalog = array_diff(get_option('headway_layout_options_catalog'), $removal);
         delete_option('headway_layout_options_' . $layout);
         update_option('headway_layout_options_catalog', $catalog);
         return true;
     }
     update_option('headway_layout_options_' . $layout . HeadwayOption::$group_suffix, $options);
     return true;
 }
Example #5
0
 /**
  * Assembles the classes for the body element.
  **/
 public static function body_class($c)
 {
     global $wp_query, $authordata;
     $c[] = 'custom';
     /* User Agents */
     if (!HeadwayCompiler::is_plugin_caching()) {
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
         /* IE */
         if ($ie_version = headway_is_ie()) {
             $c[] = 'ie';
             $c[] = 'ie' . $ie_version;
         }
         /* Modern Browsers */
         if (stripos($user_agent, 'Safari') !== false) {
             $c[] = 'safari';
         } elseif (stripos($user_agent, 'Firefox') !== false) {
             $c[] = 'firefox';
         } elseif (stripos($user_agent, 'Chrome') !== false) {
             $c[] = 'chrome';
         } elseif (stripos($user_agent, 'Opera') !== false) {
             $c[] = 'opera';
         }
         /* Rendering Engines */
         if (stripos($user_agent, 'WebKit') !== false) {
             $c[] = 'webkit';
         } elseif (stripos($user_agent, 'Gecko') !== false) {
             $c[] = 'gecko';
         }
         /* Mobile */
         if (stripos($user_agent, 'iPhone') !== false) {
             $c[] = 'iphone';
         } elseif (stripos($user_agent, 'iPod') !== false) {
             $c[] = 'ipod';
         } elseif (stripos($user_agent, 'iPad') !== false) {
             $c[] = 'ipad';
         } elseif (stripos($user_agent, 'Android') !== false) {
             $c[] = 'android';
         }
     }
     /* End User Agents */
     /* Responsive Grid */
     if (HeadwayResponsiveGrid::is_enabled()) {
         $c[] = 'responsive-grid-enabled';
     }
     if (HeadwayResponsiveGrid::is_active()) {
         $c[] = 'responsive-grid-active';
     }
     /* Pages */
     if (is_page() && isset($wp_query->post) && isset($wp_query->post->ID)) {
         $c[] = 'pageid-' . $wp_query->post->ID;
         $c[] = 'page-slug-' . $wp_query->post->post_name;
     }
     /* Posts & Pages */
     if (is_singular() && isset($wp_query->post) && isset($wp_query->post->ID)) {
         //Add the custom classes from the meta box
         if ($custom_css_class = HeadwayLayoutOption::get($wp_query->post->ID, 'css-class', null)) {
             $custom_css_classes = str_replace('  ', ' ', str_replace(',', ' ', htmlspecialchars(strip_tags($custom_css_class))));
             $c = array_merge($c, array_filter(explode(' ', $custom_css_classes)));
         }
     }
     /* Layout IDs, etc */
     $c[] = 'layout-' . HeadwayLayout::get_current();
     $c[] = 'layout-using-' . HeadwayLayout::get_current_in_use();
     if (HeadwayRoute::is_visual_editor_iframe()) {
         $c[] = 've-iframe';
     }
     if (headway_get('ve-iframe-mode') && HeadwayRoute::is_visual_editor_iframe()) {
         $c[] = 'visual-editor-mode-' . headway_get('ve-iframe-mode');
     }
     if (!current_theme_supports('headway-design-editor')) {
         $c[] = 'design-editor-disabled';
     }
     $c = array_unique(array_filter($c));
     return $c;
 }
Example #6
0
 public static function add_visual_editor_js_vars()
 {
     //Gather the URLs for the block types
     $block_types = HeadwayBlocks::get_block_types();
     $block_type_urls = array();
     foreach ($block_types as $block_type => $block_type_options) {
         $block_type_urls[$block_type] = $block_type_options['url'];
     }
     $block_styles = class_exists('HeadwayChildThemeAPI') ? HeadwayChildThemeAPI::get_block_style_classes() : array();
     $current_layout_status = HeadwayLayout::get_status(HeadwayLayout::get_current());
     $script_name = is_ssl() ? 'headway-ve-js-https' : 'headway-ve-js';
     wp_localize_script($script_name, 'Headway', array('ajaxURL' => admin_url('admin-ajax.php'), 'currentLayout' => HeadwayLayout::get_current(), 'currentLayoutName' => HeadwayLayout::get_name(HeadwayLayout::get_current()), 'currentLayoutCustomized' => $current_layout_status['customized'], 'currentLayoutTemplate' => $current_layout_status['template'], 'availableBlockID' => HeadwayBlocksData::get_available_block_id(), 'availableWrapperID' => HeadwayWrappers::get_available_wrapper_id(), 'headwayURL' => get_template_directory_uri(), 'siteURL' => site_url(), 'homeURL' => home_url(), 'adminURL' => admin_url(), 'mode' => HeadwayVisualEditor::get_current_mode(), 'designEditorSupport' => current_theme_supports('headway-design-editor'), 'siteName' => get_bloginfo('name'), 'siteDescription' => get_bloginfo('description'), 'security' => wp_create_nonce('headway-visual-editor-ajax'), 'ranTour' => json_encode(array('legacy' => HeadwayOption::get('ran-tour', false, false), 'grid' => HeadwayOption::get('ran-tour-grid', false, false), 'design' => HeadwayOption::get('ran-tour-design', false, false))), 'blockTypeURLs' => json_encode($block_type_urls), 'allBlockTypes' => json_encode($block_types), 'disableCodeMirror' => HeadwayOption::get('disable-codemirror', false, false), 'frontPage' => get_option('show_on_front', 'posts'), 'gridSupported' => current_theme_supports('headway-grid'), 'disableTooltips' => HeadwayOption::get('disable-visual-editor-tooltips', false, false), 'blockStyles' => $block_styles, 'responsiveGrid' => HeadwayResponsiveGrid::is_enabled(), 'designEditorProperties' => HeadwayVisualEditor::is_mode('design') ? json_encode(HeadwayElementProperties::get_properties()) : json_encode(array()), 'colorpickerSwatches' => HeadwayOption::get('colorpicker-swatches', false, array()), 'gridSafeMode' => HeadwayOption::get('grid-safe-mode', false, false), 'defaultGridColumnCount' => HeadwayWrappers::$default_columns, 'globalGridColumnWidth' => HeadwayWrappers::$global_grid_column_width, 'globalGridGutterWidth' => HeadwayWrappers::$global_grid_gutter_width, 'touch' => stripos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== false ? true : false));
 }
Example #7
0
 public static function save_preview_options()
 {
     //Set up options
     parse_str(headway_get('unsaved'), $options);
     return HeadwayVisualEditor::save($options, HeadwayLayout::get_current(), 'grid');
 }