MPSUM_Admin.php
7 years ago
MPSUM_Admin_Advanced.php
7 years ago
MPSUM_Admin_Advanced_Preview.php
7 years ago
MPSUM_Admin_Ajax.php
7 years ago
MPSUM_Admin_Bar.php
7 years ago
MPSUM_Admin_Core.php
7 years ago
MPSUM_Admin_Dashboard.php
7 years ago
MPSUM_Admin_Help.php
7 years ago
MPSUM_Admin_Logs.php
7 years ago
MPSUM_Admin_Plugins.php
7 years ago
MPSUM_Admin_Screen_Options.php
7 years ago
MPSUM_Admin_Themes.php
7 years ago
MPSUM_Advanced_Premium.php
7 years ago
MPSUM_Check_Plugin_Install_Status.php
7 years ago
MPSUM_Check_Theme_Install_Status.php
7 years ago
MPSUM_Commands.php
7 years ago
MPSUM_Disable_Updates.php
7 years ago
MPSUM_Disable_Updates_All.php
7 years ago
MPSUM_Disable_Updates_Plugins.php
7 years ago
MPSUM_Disable_Updates_Themes.php
7 years ago
MPSUM_Disable_Updates_Translations.php
7 years ago
MPSUM_Disable_Updates_WordPress.php
7 years ago
MPSUM_Exclude_Users.php
7 years ago
MPSUM_Force_Updates.php
7 years ago
MPSUM_List_Table.php
7 years ago
MPSUM_Logs.php
7 years ago
MPSUM_Logs_List_Table.php
7 years ago
MPSUM_Plugins_List_Table.php
7 years ago
MPSUM_Reset_Options.php
7 years ago
MPSUM_Themes_List_Table.php
7 years ago
MPSUM_UpdraftCentral.php
7 years ago
MPSUM_UpdraftCentral_EUM_Commands.php
7 years ago
MPSUM_Utils.php
7 years ago
easy-updates-manager-notices.php
7 years ago
updraft-notices.php
7 years ago
MPSUM_Admin_Screen_Options.php
103 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Screen options screen for Easy Updates Manager |
| 4 | * Initializes and outputs the screen options screen for the plugin. |
| 5 | * |
| 6 | * @package WordPress |
| 7 | * @since 6.2.0 |
| 8 | */ |
| 9 | class MPSUM_Admin_Screen_Options { |
| 10 | |
| 11 | /** |
| 12 | * Holds the class instance. |
| 13 | * |
| 14 | * @since 6.2.0 |
| 15 | * @access static |
| 16 | * @var MPSUM_Admin $instance |
| 17 | */ |
| 18 | private static $instance = null; |
| 19 | |
| 20 | /** |
| 21 | * Class constructor. |
| 22 | * |
| 23 | * Initialize the class |
| 24 | * |
| 25 | * @since 6.2.0 |
| 26 | * @access private |
| 27 | */ |
| 28 | private function __construct() { |
| 29 | $this->set_screen_options(); |
| 30 | } //end constructor |
| 31 | |
| 32 | /** |
| 33 | * Save screen option. |
| 34 | * |
| 35 | * @since 6.2.0 |
| 36 | * @access static |
| 37 | * @param string $status Save option status |
| 38 | * @param string $option Option name |
| 39 | * @param string $value Option value |
| 40 | * @return string Returns value if succeeds, otherwise status |
| 41 | */ |
| 42 | public static function save_options( $status, $option, $value ) { |
| 43 | if ('mpsum_items_per_page' == $option) { |
| 44 | return $value; |
| 45 | } |
| 46 | return $status; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Set a class instance. |
| 51 | * |
| 52 | * Set a class instance. |
| 53 | * |
| 54 | * @since 6.2.0 |
| 55 | * @access static |
| 56 | */ |
| 57 | public static function run() { |
| 58 | if (null == self::$instance) { |
| 59 | self::$instance = new self; |
| 60 | } |
| 61 | } //end get_instance |
| 62 | |
| 63 | /** |
| 64 | * Set screen options for items per page. |
| 65 | * |
| 66 | * Set screen options for items per page. |
| 67 | * |
| 68 | * @since 6.2.0 |
| 69 | * @access private |
| 70 | */ |
| 71 | private function set_screen_options() { |
| 72 | $args = array( |
| 73 | 'label' => __('Items Per Page', 'stops-core-theme-and-plugin-updates'), |
| 74 | 'default' => 100, |
| 75 | 'option' => 'mpsum_items_per_page' |
| 76 | ); |
| 77 | |
| 78 | add_screen_option('per_page', $args); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Save dashboard screen options. |
| 83 | * |
| 84 | * Save dashboard screen options. |
| 85 | * |
| 86 | * @since 6.2.0 |
| 87 | * @access static |
| 88 | */ |
| 89 | public static function maybe_save_dashboard_screen_option() { |
| 90 | if (isset($_REQUEST['mpsum_dashboard']) && isset($_REQUEST['screenoptionnonce'])) { |
| 91 | if (! wp_verify_nonce($_REQUEST['screenoptionnonce'], 'screen-options-nonce')) { |
| 92 | return; |
| 93 | } |
| 94 | $user_id = get_current_user_id(); |
| 95 | $dashboard = sanitize_text_field($_REQUEST['mpsum_dashboard']); |
| 96 | if ('on' !== $dashboard) { |
| 97 | $dashboard = 'off'; |
| 98 | } |
| 99 | update_user_meta($user_id, 'mpsum_dashboard', $dashboard); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 |