public function Header($header)
 {
     global $cb_post;
     if (isset($header['back']) && !isset($_REQUEST['back'])) {
         $header['back'] = '<a class="button-secondary" href="' . clearbase_workspace_url(array('id' => $cb_post->ID)) . '">' . __('Back', 'clearbase') . '</a>';
     }
     $header['title'] = '<span class="edit">' . __('Edit', 'clearbase') . '</span>&nbsp' . $cb_post->post_title;
     $header['save'] = '<input name="save-editor" type="submit" class="button-primary" value="' . __('Save Changes', 'clearbase') . '"/>';
     return $header;
 }
 public function RenderEditor()
 {
     global $cb_post_id;
     echo "<ul class=\"{$this->ID()} subviews\">";
     $i = 0;
     foreach ($this->subviews as $subview) {
         echo '<li>
                 ' . ($i == 0 ? '' : '&nbsp|&nbsp') . '
                 <a 
                     class="' . ($this->current_view->ID() == $subview->ID() ? 'current' : '') . '"
                     href="' . ($this->current_view->ID() == $subview->ID() ? '#' : clearbase_workspace_url(array('id' => $cb_post_id, 'cbaction' => $_REQUEST['cbaction'], 'subview' => $subview->ID()))) . '">' . $subview->Title() . '</a>
             </li>';
         $i++;
     }
     echo '</ul>';
     echo "<div class=\"{$this->ID()} subview-content\">";
     $this->current_view->RenderEditor();
     echo '</div>';
 }
 public function manage_row_actions($actions, $post)
 {
     if (isset($actions['edit'])) {
         $actions['edit'] = '<a href="' . clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'edit')) . '">' . __('Edit') . '</a>';
     }
     if (isset($actions['trash'])) {
         $actions['trash'] = "<a class='submitdelete' href='" . clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'trash', 'cbnonce' => wp_create_nonce('trash'))) . "'>" . __('Trash') . "</a>";
     }
     if (isset($actions['untrash'])) {
         $actions['untrash'] = "<a class='submitdelete' href='" . clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'untrash', 'cbnonce' => wp_create_nonce('untrash'))) . "'>" . __('Restore') . "</a>";
     }
     if (isset($actions['delete'])) {
         //this action has js code embedded by WP_Media_List_Table.  So we just replace the url
         $actions['delete'] = preg_replace("/(?<=href=(\"|'))[^\"']+(?=(\"|'))/", clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'delete', 'cbnonce' => wp_create_nonce('delete'))), $actions['delete']);
     }
     unset($actions['view']);
     if (!$this->isTrash) {
         $actions['move'] = '<a class="move-post" href="' . clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'move', 'cbnonce' => wp_create_nonce('move'))) . '">' . __('Move', 'clearbase') . '</a>';
     }
     return $actions;
 }
Ejemplo n.º 4
0
    protected function render_subfolder_actions($post)
    {
        $actions = array();
        if (current_user_can('edit_post', $post->ID) && !$this->is_trash) {
            $actions['edit'] = '<a href="' . clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'edit', 'back' => clearbase_current_url(true))) . '" title="' . __('Edit Folder', 'clearbase') . '">' . __('Edit', 'clearbase') . '</a>';
        }
        if (clearbase_get_value($this->is_parent_settings ? 'allow_nesting' : 'allow_child_nesting', true, $this->settings)) {
            $actions['move'] = "<a class='move-post' title='" . esc_attr__('Move this folder to another folder', 'clearbase') . "' href='" . clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'move', 'cbnonce' => wp_create_nonce('move'))) . "'>" . __('Move', 'clearbase') . "</a>";
        }
        if (current_user_can('delete_post', $post->ID)) {
            $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__('Delete this folder permanently') . "' href='" . clearbase_workspace_url(array('id' => $post->ID, 'cbaction' => 'delete', 'cbnonce' => wp_create_nonce('delete'))) . "'>" . __('Delete', 'clearbase') . "</a>";
            //MEDIA LIST VIEW NOT WORKING
        }
        $actions = apply_filters("clearbase_{$this->ID()}_subfolder_actions", $actions, $post);
        $action_count = count($actions);
        if (!$action_count) {
            return;
        }
        $i = 0;
        ?>
      <div class="folder-actions-container">
        <div class="folder-actions">
        <?php 
        foreach ($actions as $action => $link) {
            ++$i == $action_count ? $sep = '' : ($sep = ' | ');
            echo "<span class='{$action}'>{$link}{$sep}</span>";
        }
        ?>
 
        </div>
      </div>
      <?php 
    }
    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 &#8220;%s&#8221;' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
            $header['title'] = '<a class="clearbase-header-permalink" 
                    title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $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>';
    }