/** * Register the panel. * * @param string Name of panel to be displayed * @param string ID of panel for HTML and options **/ public function register() { global $headway_registered_ve_boxes; if (!isset($headway_registered_ve_boxes)) { $headway_registered_ve_boxes = array(); } if (in_array($this->id, $headway_registered_ve_boxes)) { return false; } $mode = HeadwayVisualEditor::get_current_mode(); if ($this->mode === 'all' || strtolower($this->mode) === strtolower($mode)) { add_action('headway_visual_editor_boxes', array($this, 'build_box')); } if ($this->load_with_ajax) { add_action('headway_visual_editor_ajax_box_content_' . $this->id, array($this, 'content')); } $headway_registered_ve_boxes[] = $this->id; }
/** * Register the panel. * * @param string Name of panel to be displayed * @param string ID of panel for HTML and options **/ public function register() { $mode = HeadwayVisualEditor::get_current_mode(); /* Forward old Manage panels to Design */ if ($this->mode == 'manage') { $this->mode = 'design'; } if (strtolower($this->mode) !== strtolower($mode)) { return false; } /* Since there is a message that's displayed if there is no panel content, we have to tell it not to display the message now that * we're registering a panel */ remove_action('headway_visual_editor_panel_top', array('HeadwayVisualEditorDisplay', 'add_default_panel_link')); remove_action('headway_visual_editor_content', array('HeadwayVisualEditorDisplay', 'add_default_panel')); add_action('headway_visual_editor_panel_top', array($this, 'panel_link')); add_action('headway_visual_editor_content', array($this, 'build_panel')); if (method_exists($this, 'init')) { $this->init(); } }
<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 list_pages($pages = null) { //Since this function is recursive, we must designate the default like this if ($pages === null) { $pages = HeadwayLayout::get_pages(); $root_pages = true; } $return = ''; $return .= '<ul>' . "\n"; /** * Only show the message the function is being called for the first time (not showing children) and that the * mode is NOT the grid and the grid is supported still. **/ if (isset($root_pages) && HeadwayVisualEditor::get_current_mode() !== 'grid' && current_theme_supports('headway-grid')) { $return .= '<li class="layout-item info-layout-item"><span class="layout"><strong>To add blocks to a new layout, please switch to the Grid mode.</strong></span></li>'; } foreach ($pages as $id => $children) { $layout_id_fragments = explode('-', $id); $status = HeadwayLayout::get_status($id, true); $class = array('layout-item'); if (is_array($children) && count($children) !== 0 && headway_post('mode') === 'grid') { $class[] = 'has-children'; } if ($status['customized'] === true && !$status['template'] && count(HeadwayBlocksData::get_blocks_by_layout($id)) > 0) { $class[] = 'layout-item-customized'; } if ($status['template']) { $class[] = 'layout-item-template-used'; } if ($id === headway_post('currentLayout')) { $class[] = 'layout-selected'; } $template_id = $status['template'] ? 'template-' . $status['template'] : 'none'; $template_name = $status['template'] ? HeadwayLayout::get_name('template-' . $status['template']) : null; /* Take care of layouts that are the front page or blog index */ if (get_option('show_on_front') === 'page' && (isset($layout_id_fragments[1]) && $layout_id_fragments[1] == 'page') || apply_filters('headway_layout_selector_no_edit_item_' . $id, false)) { /* If the page is set as the static homepage or blog page, hide it if they don't have children. The Blog Index and Front Page layouts will override them. */ if (end($layout_id_fragments) == get_option('page_on_front') || end($layout_id_fragments) == get_option('page_for_posts') || apply_filters('headway_layout_selector_no_edit_item_' . $id, false)) { /* Layout has children--add the no edit class and has children class. */ if (is_array($children) && count($children) !== 0) { $class[] = 'layout-item-no-edit'; /* If the layout doesn't have children, then just hide it. */ } else { continue; } } } /* Set layouts that aren't customized in the DE to no edit */ if (headway_post('mode') === 'design') { /* Handle layouts that aren't customized or have a template */ if (headway_get('customized', $status, false) === false || headway_get('template', $status, false) !== false) { /* If there ARE customized children, add the no-edit class */ if (is_array($children) && count($children) !== 0) { $show_node = false; //Get the variable ready /* Check if the children are customized. */ if (self::is_any_layout_child_customized($children)) { $class[] = 'layout-item-no-edit'; $class[] = 'has-children'; $class[] = 'has-customized-children'; $show_node = true; } /* If the children aren't customized, then don't display it at all */ if (!isset($show_node) || !$show_node) { continue; } /* If there aren't any children, do not display the node at all */ } else { continue; } /* Handle layouts that are customized */ } } /* Add other classes */ if (is_array($children) && count($children) && self::is_any_layout_child_customized($children)) { $class[] = 'has-children'; $class[] = 'has-customized-children'; } /* Get post status */ $post_status = headway_get('post_status', $status); $formatted_post_status = $post_status && $post_status != 'Published' ? '<span class="status status-post-status">(' . $post_status . ')</span>' : null; /* Output Stuff */ $return .= '<li class="' . implode(' ', array_filter($class)) . '">'; $return .= '<span class="layout-has-customized-children tooltip" title="This layout has customized children.">°</span>'; $return .= '<span data-layout-id="' . $id . '" data-layout-url="' . HeadwayLayout::get_url($id) . '" class="layout layout-page">'; $return .= '<strong>' . htmlspecialchars(HeadwayLayout::get_name($id)) . '</strong>'; $return .= $formatted_post_status; $return .= '<span class="status status-template" data-template-id="' . $template_id . '">' . $template_name . '</span>'; $return .= '<span class="status status-customized">Customized</span>'; $return .= '<span class="status status-currently-editing">Currently Editing</span>'; $return .= '<span class="remove-template layout-selector-button">Remove Template</span>'; if (HeadwayVisualEditor::get_current_mode() !== 'design') { $return .= '<span class="edit layout-selector-button">Edit</span>'; } else { $return .= '<span class="edit layout-selector-button">View</span>'; } $return .= '<span class="revert layout-selector-button tooltip" title="Resetting a layout will remove all of its blocks<br />so it inherits the blocks of a parent layout.">Reset</span>'; $return .= '</span>' . "\n"; if (is_array($children) && count($children) !== 0) { $return .= self::list_pages($children); } $return .= '</li>' . "\n"; } $return .= '</ul>' . "\n"; return $return; }