/** * Get the list of help tabs for a given screen * * @since 5.1 * @static * @access private * * @param string $screen Screen name * @return array $help_tabs List of tabs */ private static function get_help_tabs($screen) { $bd = BULK_DELETE(); $help_tabs = array(); switch ($screen) { case $bd->posts_page: $overview_tab = array('title' => __('Overview', 'bulk-delete'), 'id' => 'overview_tab', 'content' => '<p>' . __('This screen contains different modules that allows you to delete posts or schedule them for deletion.', 'bulk-delete') . '</p>', 'callback' => false); $help_tabs['overview_tab'] = $overview_tab; break; case $bd->pages_page: // Overview tab $overview_tab = array('title' => __('Overview', 'bulk-delete'), 'id' => 'overview_tab', 'content' => '<p>' . __('This screen contains different modules that allows you to delete pages or schedule them for deletion.', 'bulk-delete') . '</p>', 'callback' => false); $help_tabs['overview_tab'] = $overview_tab; break; } // about plugin tab $about_plugin_tab = array('title' => __('About Plugin', 'bulk-delete'), 'id' => 'about_plugin_tab', 'content' => '', 'callback' => array('Bulk_Delete_Help_Screen', 'print_about_plugin_tab_content')); $help_tabs['about_plugin_tab'] = $about_plugin_tab; /** * Filters help tab content for admin screens * * @since 5.1 */ return apply_filters('bd_admin_help_tabs', $help_tabs, $screen); }
/** * Register post related addons. * * @since 5.5 */ function bd_register_post_addons() { $bd = BULK_DELETE(); add_meta_box(Bulk_Delete::BOX_CUSTOM_FIELD, __('By Custom Field', 'bulk-delete'), 'bd_render_delete_posts_by_custom_field_box', $bd->posts_page, 'advanced'); add_meta_box(Bulk_Delete::BOX_TITLE, __('By Title', 'bulk-delete'), 'bd_render_delete_posts_by_title_box', $bd->posts_page, 'advanced'); add_meta_box(Bulk_Delete::BOX_DUPLICATE_TITLE, __('By Duplicate Title', 'bulk-delete'), 'bd_render_delete_posts_by_duplicate_title_box', $bd->posts_page, 'advanced'); add_meta_box(Bulk_Delete::BOX_POST_BY_ROLE, __('By User Role', 'bulk-delete'), 'bd_render_delete_posts_by_user_role_box', $bd->posts_page, 'advanced'); add_meta_box(Bulk_Delete::BOX_POST_FROM_TRASH, __('Posts in Trash', 'bulk-delete'), 'bd_render_delete_posts_from_trash', $bd->posts_page, 'advanced'); }
/** * Display License form * * @since 5.0 * @static */ public static function display_activate_license_form() { $bd = BULK_DELETE(); if (isset($bd->display_activate_license_form) && true === $bd->display_activate_license_form) { // This prints out all hidden setting fields settings_fields(Bulk_Delete::SETTING_OPTION_GROUP); do_settings_sections(Bulk_Delete::ADDON_PAGE_SLUG); submit_button(__('Activate License', 'bulk-delete')); } }
/** * Add settings menu if needed * * @static * @since 5.3 */ public static function add_menu() { $settings_page_needed = apply_filters('bd_settings_page_needed', false); if (!$settings_page_needed) { return; } $bd = BULK_DELETE(); // add page $bd->settings_page = add_submenu_page(Bulk_Delete::POSTS_PAGE_SLUG, __('Bulk Delete Settings', 'bulk-delete'), __('Settings', 'bulk-delete'), 'delete_posts', self::SETTINGS_PAGE_SLUG, array(__CLASS__, 'display_settings_page')); // register settings register_setting(self::ADDON_SETTING_OPTION_GROUP, self::ADDON_SETTING_OPTION_NAME, array(__CLASS__, 'sanitize_settings')); }
/** * Add settings Panel for delete meta page. * * @static * @since 5.4 */ public static function add_delete_meta_settings_panel() { $bd = BULK_DELETE(); /** * Add contextual help for admin screens. * * @since 5.4 */ do_action('bd_add_contextual_help', $bd->meta_page); /* Trigger the add_meta_boxes hooks to allow meta boxes to be added */ do_action('add_meta_boxes_' . $bd->meta_page, null); /* Enqueue WordPress' script for handling the meta boxes */ wp_enqueue_script('postbox'); }
/** * Register comment-meta meta box for delete meta page. * * @static * @since 5.4 */ public static function add_delete_comment_meta_box() { $bd = BULK_DELETE(); add_meta_box(self::BOX_COMMENT_META, __('Bulk Delete Comment Meta', 'bulk-delete'), array(__CLASS__, 'render_delete_comment_meta_box'), $bd->meta_page, 'advanced'); }
* * This is to prevent bulk operations from timing out * * @since 5.4 */ public function increase_timeout() { if (!ini_get('safe_mode')) { @set_time_limit(0); } } } /** * The main function responsible for returning the one true Bulk_Delete * Instance to functions everywhere. * * Use this function like you would a global variable, except without needing * to declare the global. * * Example: `<?php $bulk_delete = BULK_DELETE(); ?>` * * @since 5.0 * @return Bulk_Delete The one true Bulk_Delete Instance */ function BULK_DELETE() { return Bulk_Delete::instance(); } // Get BULK_DELETE Running BULK_DELETE();
/** * Register Jetpack Feedback meta box for delete misc page * * @static * @since 5.3 */ public static function add_delete_jetpack_messages_meta_box() { $bd = BULK_DELETE(); add_meta_box(self::BOX_JETPACK_MESSAGES, __('Bulk Delete Jetpack Contact Form Messages', 'bulk-delete'), array(__CLASS__, 'render_delete_jetpack_messages_box'), $bd->misc_page, 'advanced'); }
/** * Register user-meta meta box for delete meta page. * * @static * @since 5.4 */ public static function add_delete_user_meta_box() { $bd = BULK_DELETE(); add_meta_box(self::BOX_USER_META, __('Bulk Delete User Meta', 'bulk-delete'), array(__CLASS__, 'render_delete_user_meta_box'), $bd->meta_page, 'advanced'); }
/** * Decide whether to display the license form or not * * @since 5.0 */ public function display_license_form() { if (!BD_License::has_valid_license($this->addon_name, $this->addon_code)) { $bd = BULK_DELETE(); $bd->display_activate_license_form = true; } }
/** * Add menu. * * @since 5.5 */ public function add_menu() { $bd = BULK_DELETE(); $this->screen = add_submenu_page(Bulk_Delete::POSTS_PAGE_SLUG, $this->label['page_title'], $this->label['menu_title'], $this->capability, $this->page_slug, array($this, 'render_page')); add_action("admin_print_scripts-{$this->screen}", array($bd, 'add_script')); add_action("load-{$this->screen}", array($this, 'add_settings_panel')); add_action("add_meta_boxes_{$this->screen}", array($this, 'add_meta_boxes')); }
/** * Register post related addons. * * @since 5.5 */ function bd_register_page_addons() { $bd = BULK_DELETE(); add_meta_box(Bulk_Delete::BOX_PAGE_FROM_TRASH, __('Pages in Trash', 'bulk-delete'), 'bd_render_delete_pages_from_trash', $bd->pages_page, 'advanced'); }
/** * Setup translation. * * @access protected * @since 5.5 */ protected function setup_translation() { $bd = BULK_DELETE(); // Load translation files from Bulk Delete language folder load_plugin_textdomain('bulk-delete', false, $bd->translations); }