public static function method_get_layout_blocks_in_json() { $layout = headway_post('layout', false); $layout_status = HeadwayLayout::get_status($layout); if ($layout_status['customized'] != true) { return false; } self::json_encode(array('blocks' => HeadwayBlocksData::get_blocks_by_layout($layout, true), 'wrappers' => HeadwayWrappers::get_layout_wrappers($layout, true))); }
static function clone_pages_select_walker($pages, $depth = 0) { $return = ''; foreach ($pages as $id => $children) { $layout_id_fragments = explode('-', $id); $status = HeadwayLayout::get_status($id); /* 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')) { /* If the page is set as the static homepage or blog page, hide it if they don't have children. */ if (end($layout_id_fragments) == get_option('page_on_front') || end($layout_id_fragments) == get_option('page_for_posts')) { /* Layout has children--add the no edit class and has children class. */ if (is_array($children) && count($children) !== 0) { $disabled = true; } else { continue; } } } /* 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) { /* Check if the children are customized. */ if (HeadwayVisualEditorDisplay::is_any_layout_child_customized($children)) { $disabled = true; } else { continue; } /* If there aren't any children, do not display the node at all */ } else { continue; } } /* If the current layout is selected, then make it disabled. */ if (headway_post('layout') == $id) { $disabled = true; } /* Output Stuff */ $depth_display = str_repeat(' ', $depth); $disabled = isset($disabled) && $disabled === true ? ' disabled="disabled"' : null; $return .= '<option value="' . $id . '"' . $disabled . '>' . $depth_display . HeadwayLayout::get_name($id) . '</option>'; if (is_array($children) && count($children) !== 0) { $return .= self::clone_pages_select_walker($children, $depth + 1); } } return $return; }
public static function is_any_layout_child_customized($children) { if (!is_array($children) || count($children) == 0) { return false; } foreach ($children as $id => $grand_children) { $status = HeadwayLayout::get_status($id); if (headway_get('customized', $status) && !headway_get('template', $status)) { return true; } if (is_array($grand_children) && count($grand_children) > 0 && self::is_any_layout_child_customized($grand_children) === true) { return true; } } return false; }