public function __construct($args = array()) { $this->detached = isset($_REQUEST['attachment-filter']) && 'detached' === $_REQUEST['attachment-filter']; $this->uncategorized = isset($_REQUEST['attachment-filter']) && 'uncategorized' === $_REQUEST['attachment-filter']; $this->is_trash = isset($_REQUEST['attachment-filter']) && 'trash' == $_REQUEST['attachment-filter']; parent::__construct(); }
/** * Constructor. * * @since 3.1.0 * @access public * * @see WP_List_Table::__construct() for more information on default arguments. * * @param array $args An associative array of arguments. */ public function __construct($args = array()) { if (!$this->current_action() && clearbase_empty_default($_GET, '_wp_http_referer', false)) { wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']))); die; } parent::__construct($args); global $cb_post_id; add_filter('clearbase_workspace_action', array(&$this, 'filter_action')); add_filter('clearbase_workspace_form_attributes', array(&$this, 'filter_workspace_form')); add_filter('clearbase_workspace_url_args', array(&$this, 'filter_workspace_url_args')); //Implement the necessary things for attachments in a Clearbase folder $screen = get_current_screen(); $_REQUEST['post_mime_type'] = clearbase_get_value('media_filter', null, clearbase_get_folder_settings()); $_REQUEST['post_parent'] = $cb_post_id; $_REQUEST['orderby'] = 'menu_order'; $_REQUEST['order'] = clearbase_get_value('postmeta.attachment_order', 'DESC'); $this->isTrash = isset($_REQUEST['attachment-filter']) && 'trash' == $_REQUEST['attachment-filter']; add_filter('manage_media_columns', array(&$this, 'manage_media_columns')); add_filter("manage_{$screen->id}_sortable_columns", array(&$this, 'manage_sortable_columns')); add_filter('months_dropdown_results', array(&$this, 'manage_months_dropdown'), 10, 2); add_filter('media_row_actions', array(&$this, 'manage_row_actions'), 10, 2); add_filter('get_edit_post_link', array(&$this, 'edit_post_link'), 10, 3); add_action('manage_media_custom_column', array(&$this, 'render_column'), 10, 2); }
/** * Get column value of media actions * * This part is copied from the Media List Table class * * @since 1.4.2 * * @param int $id * @return string Actions */ private function get_column_value_actions($id) { if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php')) { require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; } if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php')) { require_once ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php'; } // we need class to get the object actions $m = new WP_Media_List_Table(); // prevent php notice $m->is_trash = isset($_REQUEST['status']) && 'trash' == $_REQUEST['status']; // get media actions $media = get_post($id); $actions = $m->_get_row_actions($media, _draft_or_post_title($id)); return implode(' | ', $actions); }
function current_action() { if (isset($_REQUEST['find_detached'])) { return 'find_detached'; } if (isset($_REQUEST['found_post_id']) && isset($_REQUEST['media'])) { return 'attach'; } if (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) { return 'delete_all'; } return parent::current_action(); }
function search($results, $search_term) { $search_url = esc_url(add_query_arg('s', $search_term, admin_url('upload.php'))); $search_link = sprintf(' <a href="%s" class="add-new-h2">%s</a>', $search_url, esc_html__('Search Media', 'jetpack')); $html = '<h2>' . esc_html__('Media', 'jetpack') . $search_link . '</h2>'; parent::__construct(); ob_start(); $this->prepare_items(); $columns = $this->get_columns(); unset($columns['cb']); $this->_column_headers = array($columns, array(), array()); $this->display(); $html .= ob_get_clean(); $label = __('Media', 'jetpack'); $results[$label] = $html; return $results; }
public function __construct($args = array()) { $this->modes = array('list' => __('List View', 'gallery-plugin'), 'grid' => __('Grid View', 'gallery-plugin')); parent::__construct(array('plural' => 'media', 'screen' => isset($args['screen']) ? $args['screen'] : '')); }
function __construct() { parent::__construct(); }
/** * Get WP default media columns. * * @since 1.2.1 */ private function get_wp_default_media_columns() { // You can use this filter to add third_party columns by hooking into this. do_action('cpac-get-default-columns-media'); // @todo could use _get_list_table('WP_Media_List_Table') ? if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php')) { require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; } if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php')) { require_once ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php'; } // As of WP Release 3.5 we can use the following. if (version_compare(get_bloginfo('version'), '3.4.10', '>=')) { $table = new WP_Media_List_Table(array('screen' => 'upload')); $columns = $table->get_columns(); } else { global $current_screen; // save original $org_current_screen = $current_screen; // prevent php warning if (!isset($current_screen)) { $current_screen = new stdClass(); } // overwrite current_screen global with our media id... $current_screen->id = 'upload'; // init media class $wp_media = new WP_Media_List_Table(); // get media columns $columns = $wp_media->get_columns(); // reset current screen $current_screen = $org_current_screen; } // change to uniform format $columns = $this->get_uniform_format($columns); return apply_filters('cpac-default-media-columns', $columns); }