public function Header($header = array()) { global $cb_post_id; if (!clearbase_is_root(false) && current_user_can('edit_post', $cb_post_id)) { $header['edit'] = '<a href="' . clearbase_workspace_url(array('cbaction' => 'edit', 'id' => $cb_post_id)) . '" class="button-secondary edit-folder">' . apply_filters('clearbase_edit_folder_label', __('Edit', 'clearbase'), $cb_post_id) . '</a>'; } if ($this->show_add_folders) { $header['add-folder'] = '<a href="' . clearbase_workspace_url(array('cbaction' => 'add-folder', 'id' => $cb_post_id, 'cbnonce' => wp_create_nonce('add-folder'))) . '" class="addnew add-new-h2 folders">' . apply_filters('clearbase_folder_add_label', __('Add Folder', 'clearbase'), $cb_post_id) . '</a>'; } if ($this->show_add_media) { $header['add-media'] = '<a href="#" class="addnew add-new-h2 media">' . apply_filters('clearbase_media_add_label', __('Add Media', 'clearbase'), $cb_post_id) . '</a>'; } return $header; }
public function PageTitle($page_title) { return clearbase_is_root() ? $page_title : "{$this->Title()} ‹ {$page_title}"; }
public function RenderEditor() { global $cb_post_id, $cb_post, $cb_post_type_obj, $cb_message, $cb_render_sidebar; echo '<div class="wrap">'; $cb_message = apply_filters('clearbase_workspace_message', $cb_message); if (!empty($cb_message)) { switch ($cb_message) { case 'updated': case 'saved': ?> <div id="message" class="<?php echo $cb_message; ?> notice notice-success is-dismissible"> <p><?php printf(__('%s Updated.', 'clearbase'), $cb_post_type_obj->labels->singular_name); ?> </p> <button type="button" class="notice-dismiss"> <span class="screen-reader-text"><?php _e('Dismiss this notice', 'clearbase'); ?> </span> </button> </div> <?php break; default: echo $cb_message; } } $attributes = apply_filters("clearbase_workspace_form_attributes", array('id' => $this->ID(), 'method' => 'post', 'data-post' => $cb_post_id)); echo '<form'; foreach ($attributes as $key => $value) { echo " {$key}=\"{$value}\""; } echo '>'; $hidden = apply_filters('clearbase_client_hidden', array('page' => $_REQUEST['page'], 'id' => $_REQUEST['id'])); foreach ($hidden as $k => $v) { echo '<input type="hidden" id="' . esc_attr($k) . '" name="' . esc_attr($k) . '" value="' . esc_attr($v) . '">'; } // Render Header $header = array('back' => ''); if (!clearbase_is_root()) { $href = isset($_GET['back']) ? esc_attr($_GET['back']) : clearbase_workspace_url(array('id' => $cb_post->post_parent)); $header['back'] = '<a class="clearbase-back-button button-secondary"' . ' href="' . $href . '">' . __('Back', 'clearbase') . '</a>'; } //Workspace Title if (clearbase_is_root(false)) { $header['title'] = 'Clearbase Framework'; } else { //'<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; $header['title'] = '<a class="clearbase-header-permalink" title="' . esc_attr(sprintf(__('View “%s”'), $cb_post->post_title)) . '" rel="permalink" href="' . get_permalink($cb_post) . '">' . esc_html($cb_post->post_title) . '</a>'; } //Allow for custom header handling $header = apply_filters('clearbase_workspace_header', $header); echo '<h2 class="workspace-h2">'; echo "<ul class='header'>\n"; foreach ($header as $id => $item) { echo "<li class='header-item {$id}'>{$item}</li>"; } echo "</ul>"; echo '</h2>'; // End Render Header echo '<div class="content">'; if (isset($this->view)) { $this->view->RenderEditor(); } echo '</div>'; echo '</form></div>'; }