function __construct() { $this->key = 'wp-links'; $this->label = __('Links'); $this->singular_label = __('Link'); $this->type = 'link'; $this->page = 'link-manager'; parent::__construct(); }
public function __construct() { $this->key = 'wp-comments'; $this->label = __('Comments'); $this->singular_label = __('Comment'); $this->type = 'comment'; $this->meta_type = 'comment'; $this->page = 'edit-comments'; parent::__construct(); }
/** * @since 2.2 * * @return bool */ public function is_columns_screen() { $is_columns_screen = parent::is_columns_screen(); if (!$is_columns_screen) { if (!empty($_REQUEST['_inline_edit']) && wp_verify_nonce($_REQUEST['_inline_edit'], 'inlineeditnonce')) { $is_columns_screen = true; } } return $is_columns_screen; }
/** * @since 2.3.4 * @see CPAC_Storage_Model::is_columns_screen() */ public function is_columns_screen() { $is_columns_screen = parent::is_columns_screen(); if (!$is_columns_screen) { if (!empty($_REQUEST['_ajax_nonce-replyto-comment']) && wp_verify_nonce($_REQUEST['_ajax_nonce-replyto-comment'], 'replyto-comment')) { $is_columns_screen = true; } } return $is_columns_screen; }
/** * @since 2.0 */ public function __construct() { $this->key = 'wp-users'; $this->label = __('Users'); $this->singular_label = __('User'); $this->type = 'user'; $this->meta_type = 'user'; $this->page = 'users'; $this->menu_type = 'other'; parent::__construct(); }
public function __construct() { $this->key = 'wp-media'; $this->label = __('Media Library'); $this->singular_label = __('Media'); $this->type = 'media'; $this->meta_type = 'post'; $this->page = 'upload'; $this->post_type = 'attachment'; parent::__construct(); }
function __construct() { $this->key = 'wp-links'; $this->label = __('Links'); $this->singular_label = __('Link'); $this->type = 'link'; $this->page = 'link-manager'; $this->menu_type = 'other'; add_filter("manage_{$this->page}_columns", array($this, 'add_headings'), 100); add_action('manage_link_custom_column', array($this, 'manage_value'), 100, 2); parent::__construct(); }
/** * @since 2.0 */ public function __construct() { $this->key = 'wp-users'; $this->label = __('Users'); $this->singular_label = __('User'); $this->type = 'user'; $this->meta_type = 'user'; $this->page = 'users'; $this->menu_type = 'other'; add_filter("manage_{$this->page}_columns", array($this, 'add_headings'), 100); add_filter('manage_users_custom_column', array($this, 'manage_value_callback'), 100, 3); parent::__construct(); }
/** * Constructor * * @since 2.0 */ function __construct() { $this->key = 'wp-ms_users'; $this->label = __('Network Users'); $this->type = 'user'; $this->meta_type = 'user'; $this->page = 'users'; $this->menu_type = 'other'; // headings add_filter("wpmu_users_columns", array($this, 'add_headings'), 100); // values add_filter('manage_users_custom_column', array($this, 'manage_value_callback'), 100, 3); parent::__construct(); }
/** * Constructor * * @since 2.0 */ function __construct() { $this->key = 'wp-comments'; $this->label = __('Comments'); $this->type = 'comment'; $this->meta_type = 'comment'; $this->page = 'edit-comments'; $this->menu_type = 'other'; // headings add_filter("manage_{$this->page}_columns", array($this, 'add_headings'), 100); // values add_action('manage_comments_custom_column', array($this, 'manage_value'), 100, 2); parent::__construct(); }
public function __construct() { $this->key = 'wp-media'; $this->label = __('Media Library'); $this->singular_label = __('Media'); $this->type = 'media'; $this->meta_type = 'post'; $this->page = 'upload'; $this->post_type = 'attachment'; $this->menu_type = 'other'; // Increased the priority to overrule 3th party plugins such as Media Tags add_filter("manage_{$this->page}_columns", array($this, 'add_headings'), 100); add_action('manage_media_custom_column', array($this, 'manage_value'), 100, 2); parent::__construct(); }
/** * Constructor * * @since 1.2.0 */ function __construct($taxonomy) { $this->set_taxonomy_object($taxonomy); $this->key = 'wp-taxonomy_' . $taxonomy; $this->type = 'taxonomy'; $this->page = 'edit-tags'; $this->taxonomy = $taxonomy; $this->label = $this->taxonomy_object->labels->name; $this->singular_label = $this->taxonomy_object->labels->singular_name; $this->menu_type = $this->type; // headings add_filter("manage_edit-{$this->taxonomy}_columns", array($this, 'add_headings')); // values add_action("manage_{$this->taxonomy}_custom_column", array($this, 'manage_value'), 10, 3); parent::__construct(); }
/** * @since 2.4.10 */ public function is_current_screen() { return !is_network_admin() && parent::is_current_screen(); }
/** * @since 2.0 */ public function display() { $classes = implode(' ', array_filter(array("cpac-box-{$this->properties->type}", $this->properties->classes))); // column list $column_list = ''; $groups = $this->storage_model->get_column_type_groups(); foreach ($groups as $group => $label) { $column_list .= $this->get_column_list($this->storage_model->column_types[$group], $label); } // clone attribute $data_clone = $this->properties->is_cloneable ? " data-clone='{$this->properties->clone}'" : ''; ?> <div class="cpac-column <?php echo $classes; ?> " data-type="<?php echo $this->properties->type; ?> "<?php echo $data_clone; ?> > <input type="hidden" class="column-name" name="<?php echo $this->attr_name('column-name'); ?> " value="<?php echo esc_attr($this->properties->name); ?> " /> <input type="hidden" class="type" name="<?php echo $this->attr_name('type'); ?> " value="<?php echo $this->properties->type; ?> " /> <input type="hidden" class="clone" name="<?php echo $this->attr_name('clone'); ?> " value="<?php echo $this->properties->clone; ?> " /> <div class="column-meta"> <table class="widefat"> <tbody> <tr> <td class="column_sort"></td> <td class="column_label"> <div class="inner"> <div class="meta"> <span title="<?php echo esc_attr(__('width', 'cpac')); ?> " class="width" data-indicator-id=""> <?php echo !empty($this->options->width) ? $this->options->width . $this->options->width_unit : ''; ?> </span> <?php /** * Fires in the meta-element for column options, which is displayed right after the column label * * @since 2.0 * * @param CPAC_Column $column_instance Column class instance */ do_action('cac/column/settings_meta', $this); /** * @deprecated 2.2 Use cac/column/settings_meta instead */ do_action('cac/column/label', $this); ?> </div> <a class="toggle" href="javascript:;"><?php echo stripslashes($this->get_label()); ?> </a> <a class="edit-button" href="javascript:;"><?php _e('Edit', 'cpac'); ?> </a> <?php if ($this->properties->is_cloneable) { ?> <a class="clone-button" href="#"><?php _e('Clone', 'cpac'); ?> </a> <?php } ?> <a class="remove-button" href="javascript:;"><?php _e('Remove', 'cpac'); ?> </a> </div> </td> <td class="column_type"> <div class="inner"> <a href="#"><?php echo stripslashes($this->properties->label); ?> </a> </div> </td> <td class="column_edit"></td> </tr> </tbody> </table> </div><!--.column-meta--> <div class="column-form"> <table class="widefat"> <tbody> <tr class="column_type"> <?php $this->label_view(__('Type', 'cpac'), __('Choose a column type.', 'cpac') . '<em>' . __('Type', 'cpac') . ': ' . $this->properties->type . '</em><em>' . __('Name', 'cpac') . ': ' . $this->properties->name . '</em>', 'type'); ?> <td class="input"> <select name="<?php $this->attr_name('type'); ?> " id="<?php $this->attr_id('type'); ?> "> <?php echo $column_list; ?> </select> <div class="msg"></div> </td> </tr><!--.column_label--> <tr class="column_label<?php echo $this->properties->hide_label ? ' hidden' : ''; ?> "> <?php $this->label_view(__('Label', 'cpac'), __('This is the name which will appear as the column header.', 'cpac'), 'label'); ?> <td class="input"> <input class="text" type="text" name="<?php $this->attr_name('label'); ?> " id="<?php $this->attr_id('label'); ?> " value="<?php echo esc_attr($this->options->label); //echo sanitize_text_field( $this->options->label ); ?> " /> </td> </tr><!--.column_label--> <tr class="column_width"> <?php $this->label_view(__('Width', 'cpac'), '', 'width'); ?> <td class="input"> <div class="description" title="<?php _e('default', 'cpac'); ?> "> <input class="width" type="text" placeholder="<?php _e('auto', 'cpac'); ?> " name="<?php $this->attr_name('width'); ?> " id="<?php $this->attr_id('width'); ?> " value="<?php echo $this->options->width; ?> " /> <span class="unit"><?php echo $this->options->width_unit; ?> </span> </div> <div class="width-slider"></div> <div class="unit-select"> <label for="<?php $this->attr_id('width_unit_px'); ?> "> <input type="radio" class="unit" name="<?php $this->attr_name('width_unit'); ?> " id="<?php $this->attr_id('width_unit_px'); ?> " value="px"<?php checked($this->options->width_unit, 'px'); ?> /> px </label> <label for="<?php $this->attr_id('width_unit_perc'); ?> "> <input type="radio" class="unit" name="<?php $this->attr_name('width_unit'); ?> " id="<?php $this->attr_id('width_unit_perc'); ?> " value="%"<?php checked($this->options->width_unit, '%'); ?> /> % </label> </div> </td> </tr><!--.column_width--> <?php /** * Fires directly before the custom options for a column are displayed in the column form * * @since 2.0 * @param CPAC_Column $column_instance Column class instance */ do_action('cac/column/settings_before', $this); ?> <?php /** * Load specific column settings. * */ $this->display_settings(); ?> <?php /** * Fires directly after the custom options for a column are displayed in the column form * * @since 2.0 * @param CPAC_Column $column_instance Column class instance */ do_action('cac/column/settings_after', $this); ?> <tr class="column_action"> <td colspan="2"> <p> <?php if ($this->properties->is_cloneable) { ?> <a class="clone-button" href="#"><?php _e('Clone', 'cpac'); ?> </a> <?php } ?> <a href="javascript:;" class="remove-button"><?php _e('Remove'); ?> </a> </p> </td> </tr> </tbody> </table> </div> </div> <?php }
/** * Test for current screen = the Media/Assistant submenu screen * * @since 2.22 * * @return boolean true if the Media/Assistant submenu is the current screen */ public function is_columns_screen() { $is_columns_screen = parent::is_columns_screen(); if (!$is_columns_screen) { if (!empty($_REQUEST['page']) && MLACore::ADMIN_PAGE_SLUG == $_REQUEST['page']) { $is_columns_screen = true; } } return $is_columns_screen; }
/** * @since 2.2 */ public function is_current_screen() { $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : 'post'; return $this->post_type === $post_type && parent::is_current_screen(); }
/** * Ajax callback for saving a column * * @since 1.0 */ public function ajax_column_save() { if ($this->storage_model->key != $_POST['storage_model']) { return; } // Basic request validation if (empty($_POST['plugin_id']) || empty($_POST['pk']) || empty($_POST['column'])) { wp_send_json_error(__('Required fields missing.', 'cpac')); } // Get ID of entry to edit if (!($id = intval($_POST['pk']))) { wp_send_json_error(__('Invalid item ID.', 'cpac')); } // Get column instance $column = $this->storage_model->get_column_by_name($_POST['column']); if (!$column) { wp_send_json_error(__('Invalid column.', 'cpac')); } $value = isset($_POST['value']) ? $_POST['value'] : ''; /** * Filter for changing the value before storing it to the DB * * @since 3.2.1 * * @param mixed $value Value send from inline edit ajax callback * @param object CPAC_Column instance * @param int $id ID */ $value = apply_filters('cac/inline-edit/ajax-column-save/value', $value, $column, $id); // Store column $save_result = $this->column_save($id, $column, $value); if (is_wp_error($save_result)) { status_header(400); echo $save_result->get_error_message(); exit; } ob_start(); // WP default column if ($column->properties->default) { $this->manage_value($column, $id); } else { if ('taxonomy' == $this->storage_model->type) { echo $this->storage_model->manage_value('', $column->properties->name, $id); } else { echo $this->storage_model->manage_value($column->properties->name, $id); } } $contents = ob_get_clean(); /** * Fires after a inline-edit succesfully saved a value * * @since ???? * * @param CPAC_Column $column Column instance * @param int $id Item ID * @param string $value User submitted input * @param object $this CACIE_Editable_Model $editable_model_instance Editability model instance */ do_action('cac/inline-edit/after_ajax_column_save', $column, $id, $value, $this); $jsondata = array('success' => true, 'data' => array('value' => $contents)); if (!$column->properties->default) { $jsondata['data']['rawvalue'] = $this->get_column_editability_value($column, $id); } if (is_callable(array($column, 'get_item_data'))) { $jsondata['data']['itemdata'] = $column->get_item_data($id); } wp_send_json($jsondata); }