public function __construct() { parent::__construct(); global $cb_post_id; $this->settings = clearbase_get_folder_settings(); $this->is_parent_settings = $cb_post_id != clearbase_get_value('_folder_id', 0, $this->settings); $this->show_folders = clearbase_get_value($this->is_parent_settings ? 'allow_child_nesting' : 'allow_nesting', true, $this->settings); $this->show_add_folders = !$this->show_folders ? false : apply_filters("clearbase_allow_new_folders", true, $cb_post_id); $this->show_media = !clearbase_is_root() || clearbase_is_root() && clearbase_get_value('allow_root_media', true, $this->settings); $this->show_media = apply_filters('clearbase_show_media', $this->show_media, $cb_post_id); $this->show_add_media = !$this->show_media ? false : apply_filters("clearbase_allow_new_media", true, $cb_post_id); $this->is_trash = false; //TODO if (clearbase_is_root(false)) { //enforce Clearbase root rules $this->show_folders = $this->show_add_folders = true; $this->show_media = $this->show_add_media = false; } $modes = array('grid', 'list'); if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) { $this->mode = clearbase_empty_default($_GET, 'mode', ''); update_user_option(get_current_user_id(), 'clearbase_media_mode', $this->mode); } else { $this->mode = get_user_option('clearbase_media_mode', get_current_user_id()); if (!in_array($this->mode, $modes)) { $this->mode = 'list'; } } if ($this->show_media && 'list' == $this->mode) { require_once CLEARBASE_DIR . '/includes/class-cb-media-list-table.php'; $this->media_table = new CB_Media_List_Table(); } }
public function __construct($fields = array()) { parent::__construct(array_merge(array(array('id' => 'settings', 'type' => 'sectionstart'), array('id' => 'option.clearbase.media.exclude', 'title' => __("Hide Attachments", 'clearbase'), 'desc' => __("Hides clearbase attachments from the media library", 'clearbase'), 'type' => 'checkbox', 'css' => 'min-width:300px;', 'default' => 'yes'), array('id' => 'option.clearbase.description', 'title' => __("Description", 'clearbase'), 'desc' => __("Describes the awesomeness of clearbase", 'clearbase'), 'type' => 'textarea', 'css' => 'min-width:300px;'), array('id' => 'settings', 'type' => 'sectionend')), $fields)); if (isset($_POST['save-changes'])) { $this->Save(); } }
public function __construct($subviews = array()) { parent::__construct(); global $cb_post_id, $cb_post; $this->subviews = $subviews; $this->subviews = apply_filters("clearbase_{$this->ID()}_subviews", $this->subviews, $cb_post); // $subview_id = clearbase_empty_default($_REQUEST, 'subview', ''); //handle the scenario where no subview is specified... if (empty($subview_id)) { $this->current_view = reset($this->subviews); } else { foreach ($this->subviews as $subview) { if ($subview->ID() == $subview_id) { $this->current_view = $subview; break; } } } if (isset($this->current_view)) { $this->current_view->InitEditor(); } }
public function __construct($fields = array()) { parent::__construct($fields); }
public function __construct($fields = array()) { parent::__construct($fields); add_filter('clearbase_load_controllers', array($this, '_attach_controller')); }
public function __construct($folder_root = 0) { parent::__construct(); global $cb_folder_root, $cb_post_id, $cb_post, $cb_post_type_obj, $view_id, $cb_action, $cb_workspace_saving; $cb_folder_root = $folder_root; clearbase_folder_set_global(clearbase_empty_default($_GET, 'id', 0)); add_action('post_updated', array(&$this, '_updated'), 10, 1); add_action('edit_attachment', array(&$this, '_updated'), 10, 1); $cb_action = isset($_REQUEST['cbaction']) && -1 != $_REQUEST['cbaction'] ? $_REQUEST['cbaction'] : ''; $cb_workspace_saving = isset($_POST['save-changes']); // do_action('clearbase_workspace_start'); add_filter('clearbase_workspace_view', array($this, 'view'), 10, 3); $this->view = apply_filters('clearbase_workspace_view', null, $cb_post->post_type, $cb_action); if ($this->view instanceof Clearbase_View) { $this->view->InitEditor(); } do_action('clearbase_workspace_loaded'); //allow the loaded views to save any editor changes if (isset($_REQUEST['save-editor'])) { do_action('clearbase_view_save_editor', 'save-editor'); } $args = apply_filters('clearbase_workspace_action', array('action' => $cb_action, 'nonce_action' => $cb_action, 'nonce_field' => isset($_REQUEST['cbnonce']) ? 'cbnonce' : '_wpnonce', 'posts' => clearbase_empty_default($_REQUEST, 'posts', array($cb_post_id)), 'handled' => false)); // Process any Clearbase actions, if the action has not already been handled if (isset($args) && is_array($args) && !$args['handled']) { switch ($args['action']) { case 'add-folder': check_admin_referer($args['nonce_action'], $args['nonce_field']); $result = clearbase_add_folder($cb_post_id); if (is_wp_error($result)) { die($result->get_error_message()); } wp_redirect(clearbase_workspace_url(array('id' => $result, 'cbaction' => 'edit', 'back' => urlencode(clearbase_workspace_url(array('id' => $cb_post_id)))))); exit; break; case 'move': check_admin_referer($args['nonce_action'], $args['nonce_field']); $folder_id = clearbase_empty_default($_REQUEST, 'folderid', ''); if (!is_numeric($folder_id)) { die('Folder ID is invalid.'); } $result = clearbase_move_to_folder($folder_id, $args['posts']); if (is_wp_error($result)) { die($result->get_error_message()); } wp_redirect(clearbase_workspace_url(array('id' => $folder_id))); exit; break; case 'trash': case 'delete': check_admin_referer($args['nonce_action'], $args['nonce_field']); $parent_id; $posts = $args['posts']; for ($i = count($posts) - 1; $i > -1; $i--) { if (!isset($parent_id) && ($p = get_post($posts[$i]))) { $parent_id = $p->post_parent; } wp_delete_post($posts[$i], 'delete' == $args['action']); } wp_redirect(clearbase_workspace_url(array('id' => $parent_id))); exit; break; } } }