/** * Used for when a user clicks View Site in the Visual Editor **/ public static function redirect_to_layout() { remove_filter('wp_redirect', '__return_false', 12); if (headway_get('debug') && HeadwayCapabilities::can_user_visually_edit()) { wp_die(HeadwayLayout::get_url(headway_get('layout'))); } return wp_safe_redirect(HeadwayLayout::get_url(headway_get('layout'))); }
echo ' <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">
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; }