← All changes
|
modules/api-backups/classes/class-api-backups-admin.php
+239
-249
5.0.3
→
6.2.1
View file →
| @@ -12,292 +12,282 @@ | ||
| 12 | 12 | |
| 13 | 13 | use MainWP\Dashboard\MainWP_Logger; |
| 14 | 14 | use MainWP\Dashboard\MainWP_UI; |
| 15 | 15 | use MainWP\Dashboard\MainWP_Menu; |
| 16 | -use function MainWP\Dashboard\mainwp_current_user_have_right; | |
| 16 | +use MainWP\Dashboard\MainWP_Utility; | |
| 17 | 17 | |
| 18 | +// Exit if accessed directly. | |
| 19 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 20 | + exit; | |
| 21 | +} | |
| 18 | 22 | |
| 23 | + | |
| 19 | 24 | /** |
| 20 | 25 | * Class Api_Backups_Admin |
| 21 | 26 | */ |
| 22 | 27 | class Api_Backups_Admin { |
| 23 | 28 | |
| 24 | - /** | |
| 25 | - * Version string number. | |
| 26 | - * | |
| 27 | - * @var string $version Version. | |
| 28 | - */ | |
| 29 | - public $version = '4.2'; | |
| 29 | + /** | |
| 30 | + * Version string number. | |
| 31 | + * | |
| 32 | + * @var string $version Version. | |
| 33 | + */ | |
| 34 | + public $version = '4.2'; | |
| 30 | 35 | |
| 31 | - /** | |
| 32 | - * Update version string number. | |
| 33 | - * | |
| 34 | - * @var string $version Update version. | |
| 35 | - */ | |
| 36 | - public $update_version = '4.1'; | |
| 36 | + /** | |
| 37 | + * Update version string number. | |
| 38 | + * | |
| 39 | + * @var string $version Update version. | |
| 40 | + */ | |
| 41 | + public $update_version = '4.1'; | |
| 37 | 42 | |
| 38 | - /** | |
| 39 | - * Current page. | |
| 40 | - * | |
| 41 | - * @static | |
| 42 | - * @var string $page Current page. | |
| 43 | - */ | |
| 44 | - public static $page; | |
| 43 | + /** | |
| 44 | + * Current page. | |
| 45 | + * | |
| 46 | + * @static | |
| 47 | + * @var string $page Current page. | |
| 48 | + */ | |
| 49 | + public static $page; | |
| 45 | 50 | |
| 46 | - /** | |
| 47 | - * Variable to hold the Sub Pages. | |
| 48 | - * | |
| 49 | - * @static | |
| 50 | - * @var mixed Sub Page, default null. | |
| 51 | - */ | |
| 52 | - public static $subPages = null; | |
| 51 | + /** | |
| 52 | + * Variable to hold the Sub Pages. | |
| 53 | + * | |
| 54 | + * @static | |
| 55 | + * @var mixed Sub Page, default null. | |
| 56 | + */ | |
| 57 | + public static $subPages = null; | |
| 53 | 58 | |
| 54 | - /** | |
| 55 | - * Static variable to hold the single instance of the class. | |
| 56 | - * | |
| 57 | - * @static | |
| 58 | - * | |
| 59 | - * @var mixed Default null | |
| 60 | - */ | |
| 61 | - public static $instance = null; | |
| 59 | + /** | |
| 60 | + * Static variable to hold the single instance of the class. | |
| 61 | + * | |
| 62 | + * @static | |
| 63 | + * | |
| 64 | + * @var mixed Default null | |
| 65 | + */ | |
| 66 | + public static $instance = null; | |
| 62 | 67 | |
| 63 | - /** | |
| 64 | - * Get Instance | |
| 65 | - * | |
| 66 | - * Creates public static instance. | |
| 67 | - * | |
| 68 | - * @static | |
| 69 | - * | |
| 70 | - * @return Api_Backups_Admin | |
| 71 | - */ | |
| 72 | - public static function get_instance() { | |
| 73 | - if ( null === self::$instance ) { | |
| 74 | - self::$instance = new self(); | |
| 75 | - } | |
| 76 | - return self::$instance; | |
| 77 | - } | |
| 68 | + /** | |
| 69 | + * Get Instance | |
| 70 | + * | |
| 71 | + * Creates public static instance. | |
| 72 | + * | |
| 73 | + * @static | |
| 74 | + * | |
| 75 | + * @return Api_Backups_Admin | |
| 76 | + */ | |
| 77 | + public static function get_instance() { | |
| 78 | + if ( null === static::$instance ) { | |
| 79 | + static::$instance = new self(); | |
| 80 | + } | |
| 81 | + return static::$instance; | |
| 82 | + } | |
| 78 | 83 | |
| 79 | - /** | |
| 80 | - * Method get_class_name() | |
| 81 | - * | |
| 82 | - * Get Class Name. | |
| 83 | - * | |
| 84 | - * @return string __CLASS__ | |
| 85 | - */ | |
| 86 | - public static function get_class_name() { | |
| 87 | - return __CLASS__; | |
| 88 | - } | |
| 84 | + /** | |
| 85 | + * Method get_class_name() | |
| 86 | + * | |
| 87 | + * Get Class Name. | |
| 88 | + * | |
| 89 | + * @return string __CLASS__ | |
| 90 | + */ | |
| 91 | + public static function get_class_name() { | |
| 92 | + return __CLASS__; | |
| 93 | + } | |
| 89 | 94 | |
| 90 | - /** | |
| 91 | - * Constructor | |
| 92 | - * | |
| 93 | - * Runs each time the class is called. | |
| 94 | - */ | |
| 95 | - public function __construct() { | |
| 96 | - add_action( 'admin_init', array( &$this, 'admin_init' ) ); | |
| 97 | - add_filter( 'mainwp_getprimarybackup_methods', array( &$this, 'hook_getprimarybackup_methods' ) ); | |
| 98 | - add_filter( 'mainwp_managesites_getbackuplink', array( &$this, 'hook_managesites_getbackuplink' ), 10, 4 ); | |
| 95 | + /** | |
| 96 | + * Constructor | |
| 97 | + * | |
| 98 | + * Runs each time the class is called. | |
| 99 | + */ | |
| 100 | + public function __construct() { | |
| 101 | + add_action( 'admin_init', array( &$this, 'admin_init' ) ); | |
| 102 | + add_filter( 'mainwp_getprimarybackup_methods', array( &$this, 'hook_getprimarybackup_methods' ) ); | |
| 103 | + add_filter( 'mainwp_managesites_getbackuplink', array( &$this, 'hook_managesites_getbackuplink' ), 10, 4 ); | |
| 99 | 104 | |
| 100 | - $this->update_check(); | |
| 101 | - Api_Backups_Overview::get_instance(); | |
| 102 | - Api_Backups_Settings::get_instance(); | |
| 103 | - Api_Backups_Handler::get_instance(); | |
| 104 | - Api_Backups_Hooks::get_instance(); | |
| 105 | - } | |
| 105 | + $this->update_check(); | |
| 106 | + Api_Backups_Overview::get_instance(); | |
| 107 | + Api_Backups_Settings::get_instance(); | |
| 108 | + Api_Backups_Handler::get_instance(); | |
| 109 | + Api_Backups_Hooks::get_instance(); | |
| 110 | + } | |
| 106 | 111 | |
| 107 | - /** | |
| 108 | - * Method admin_init() initiated by init() | |
| 109 | - * | |
| 110 | - * Enqueue scripts and styles. | |
| 111 | - */ | |
| 112 | - public function admin_init() { | |
| 113 | - add_filter( 'mainwp_log_specific_actions', array( &$this, 'hook_mainwp_log_specific_actions' ), 10, 2 ); | |
| 114 | - Api_Backups_3rd_Party::instance()->init_ajax_actions(); | |
| 115 | - $module_url = Api_Backups_Manager::get_location_path( 'url' ); | |
| 112 | + /** | |
| 113 | + * Method admin_init() initiated by init() | |
| 114 | + * | |
| 115 | + * Enqueue scripts and styles. | |
| 116 | + */ | |
| 117 | + public function admin_init() { | |
| 118 | + add_filter( 'mainwp_log_specific_actions', array( &$this, 'hook_mainwp_log_specific_actions' ), 10, 2 ); | |
| 119 | + Api_Backups_3rd_Party::instance()->init_ajax_actions(); | |
| 120 | + $module_url = Api_Backups_Manager::get_location_path( 'url' ); | |
| 116 | 121 | |
| 117 | - if ( isset( $_GET['page'] ) && ( 'ManageApiBackups' === $_GET['page'] || 'ManageSitesApiBackups' === $_GET['page'] || 'SettingsApiBackups' === $_GET['page'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 118 | - // Enqueue needed assets. | |
| 119 | - wp_enqueue_script( 'mainwp-module-api-backups', $module_url . 'assets/js/module-api-backups.js', array(), $this->version, true ); | |
| 120 | - wp_enqueue_script( 'mainwp-module-api-backups-manager', $module_url . 'assets/js/module-api-backups-manager.js', array( 'mainwp' ), $this->version, true ); | |
| 121 | - wp_enqueue_style( 'mainwp-module-api-backups', $module_url . 'assets/css/module-api-backups.css', array(), $this->version ); | |
| 122 | - } | |
| 123 | - } | |
| 122 | + if ( isset( $_GET['page'] ) && ( 'ManageApiBackups' === $_GET['page'] || 'ManageSitesApiBackups' === $_GET['page'] || 'SettingsApiBackups' === $_GET['page'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 123 | + // Enqueue needed assets. | |
| 124 | + wp_enqueue_script( 'mainwp-module-api-backups', $module_url . 'assets/js/module-api-backups.js', array(), $this->version, true ); | |
| 125 | + wp_enqueue_script( 'mainwp-module-api-backups-manager', $module_url . 'assets/js/module-api-backups-manager.js', array( 'mainwp' ), $this->version, true ); | |
| 126 | + wp_enqueue_style( 'mainwp-module-api-backups', $module_url . 'assets/css/module-api-backups.css', array(), $this->version ); | |
| 127 | + } | |
| 128 | + } | |
| 124 | 129 | |
| 125 | 130 | |
| 126 | - /** | |
| 127 | - * Method hook_getprimarybackup_methods(). | |
| 128 | - * | |
| 129 | - * @param array $input Input values. | |
| 130 | - * | |
| 131 | - * @return array $input | |
| 132 | - */ | |
| 133 | - public function hook_getprimarybackup_methods( $input ) { | |
| 134 | - $input[] = array( | |
| 135 | - 'value' => 'module-api-backups', | |
| 136 | - 'title' => esc_html__( 'API Backups', 'mainwp' ), | |
| 137 | - ); | |
| 138 | - return $input; | |
| 139 | - } | |
| 131 | + /** | |
| 132 | + * Method hook_getprimarybackup_methods(). | |
| 133 | + * | |
| 134 | + * @param array $input Input values. | |
| 135 | + * | |
| 136 | + * @return array $input | |
| 137 | + */ | |
| 138 | + public function hook_getprimarybackup_methods( $input ) { | |
| 139 | + $input[] = array( | |
| 140 | + 'value' => 'module-api-backups', | |
| 141 | + 'title' => esc_html__( 'API Backups', 'mainwp' ), | |
| 142 | + ); | |
| 143 | + return $input; | |
| 144 | + } | |
| 140 | 145 | |
| 141 | - /** | |
| 142 | - * Handle @filter hook_managesites_getbackuplink(). | |
| 143 | - * | |
| 144 | - * @param array $input Input values. | |
| 145 | - * @param int $site_id Site id. | |
| 146 | - * @param int $last_primary_backup Last time primary backup. | |
| 147 | - * @param string $primary_backup Primary backup method. | |
| 148 | - * | |
| 149 | - * @return array $input | |
| 150 | - */ | |
| 151 | - public function hook_managesites_getbackuplink( $input, $site_id, $last_primary_backup = 0, $primary_backup = '' ) { | |
| 152 | - if ( 'module-api-backups' !== $primary_backup ) { | |
| 153 | - return $input; | |
| 154 | - } | |
| 146 | + /** | |
| 147 | + * Handle @filter hook_managesites_getbackuplink(). | |
| 148 | + * | |
| 149 | + * @param array $input Input values. | |
| 150 | + * @param int $site_id Site id. | |
| 151 | + * @param int $last_primary_backup Last time primary backup. | |
| 152 | + * @param string $primary_backup Primary backup method. | |
| 153 | + * | |
| 154 | + * @return array $input | |
| 155 | + */ | |
| 156 | + public function hook_managesites_getbackuplink( $input, $site_id, $last_primary_backup = 0, $primary_backup = '' ) { | |
| 157 | + if ( 'module-api-backups' !== $primary_backup ) { | |
| 158 | + return $input; | |
| 159 | + } | |
| 155 | 160 | |
| 156 | - if ( $site_id ) { | |
| 157 | - if ( ! empty( $last_primary_backup ) ) { | |
| 158 | - $output = Api_Backups_Utility::format_timestamp( Api_Backups_Utility::get_timestamp( $last_primary_backup ) ) . '<br />'; | |
| 159 | - } else { | |
| 160 | - $output = '<span class="mainwp-red">Never</span><br/>'; | |
| 161 | - } | |
| 161 | + if ( $site_id ) { | |
| 162 | + $output = ''; | |
| 163 | + if ( \mainwp_current_user_can( 'dashboard', 'execute_backups' ) ) { | |
| 164 | + if ( ! empty( $last_primary_backup ) ) { | |
| 165 | + $output = '<span data-tooltip="' . esc_attr__( 'Last backup available: ', 'mainwp' ) . esc_html( MainWP_Utility::time_elapsed_string( $last_primary_backup ) ) . '" data-position="left center" data-inverted=""><a class="ui mini grey icon basic button" href="admin.php?page=ManageSitesApiBackups&id=' . $site_id . '" class="green"><i class="history green icon"></i></a></span>'; | |
| 166 | + } else { | |
| 167 | + $output = '<span data-tooltip="' . esc_attr__( 'No backups taken yet. ', 'mainwp' ) . '" data-position="left center" data-inverted=""><a class="ui mini grey icon basic button" href="admin.php?page=ManageSitesApiBackups&id=' . intval( $site_id ) . '" class="grey"><i class="history grey icon"></i></a></span>'; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + return $output; | |
| 171 | + } else { | |
| 172 | + return $input; | |
| 173 | + } | |
| 174 | + } | |
| 162 | 175 | |
| 163 | - if ( mainwp_current_user_have_right( 'dashboard', 'execute_backups' ) ) { | |
| 164 | - $link = sprintf( '<a href="admin.php?page=ManageSitesApiBackups&id=%d">' . __( 'Backup Now', 'it-l10n-mainwp-backupbuddy' ) . '</a>', $site_id ); | |
| 165 | - $output .= $link; | |
| 166 | - } | |
| 167 | - return $output; | |
| 168 | - } else { | |
| 169 | - return $input; | |
| 170 | - } | |
| 171 | - } | |
| 172 | 176 | |
| 177 | + /** | |
| 178 | + * Method hook_mainwp_log_specific_actions(). | |
| 179 | + * | |
| 180 | + * @param array $input Input values. | |
| 181 | + * | |
| 182 | + * @return array $input | |
| 183 | + */ | |
| 184 | + public function hook_mainwp_log_specific_actions( $input ) { | |
| 185 | + $input[ MainWP_Logger::API_BACKUPS_LOG_PRIORITY ] = 'API Backups'; | |
| 186 | + return $input; | |
| 187 | + } | |
| 173 | 188 | |
| 174 | - /** | |
| 175 | - * Method hook_mainwp_log_specific_actions(). | |
| 176 | - * | |
| 177 | - * @param array $input Input values. | |
| 178 | - * | |
| 179 | - * @return array $input | |
| 180 | - */ | |
| 181 | - public function hook_mainwp_log_specific_actions( $input ) { | |
| 182 | - $input[ MainWP_Logger::API_BACKUPS_LOG_PRIORITY ] = 'API Backups'; | |
| 183 | - return $input; | |
| 184 | - } | |
| 189 | + /** | |
| 190 | + * Method update_check(). | |
| 191 | + * | |
| 192 | + * Handle update db values if needed . | |
| 193 | + */ | |
| 194 | + public function update_check() { | |
| 185 | 195 | |
| 186 | - /** | |
| 187 | - * Method update_check(). | |
| 188 | - * | |
| 189 | - * Handle update db values if needed . | |
| 190 | - */ | |
| 191 | - public function update_check() { | |
| 196 | + $current_update = get_option( 'mainwp_api_backups_update_version' ); | |
| 192 | 197 | |
| 193 | - $current_update = get_option( 'mainwp_api_backups_update_version' ); | |
| 198 | + if ( ( false === $current_update && version_compare( $this->version, '4.2', '<=' ) ) || version_compare( $current_update, '4.1', '<' ) ) { | |
| 199 | + $map_names = array( | |
| 200 | + 'vultr' => 'mainwp_vultr_api_key', | |
| 201 | + 'gridpane' => 'mainwp_gridpane_api_key', | |
| 202 | + 'linode' => 'mainwp_linode_api_key', | |
| 203 | + 'digitalocean' => 'mainwp_digitalocean_api_key', | |
| 204 | + 'cloudways' => 'mainwp_cloudways_api_key', | |
| 205 | + ); | |
| 194 | 206 | |
| 195 | - if ( ( false === $current_update && version_compare( $this->version, '4.2', '<=' ) ) || version_compare( $current_update, '4.1', '<' ) ) { | |
| 196 | - $map_names = array( | |
| 197 | - 'vultr' => 'mainwp_vultr_api_key', | |
| 198 | - 'gridpane' => 'mainwp_gridpane_api_key', | |
| 199 | - 'linode' => 'mainwp_linode_api_key', | |
| 200 | - 'digitalocean' => 'mainwp_digitalocean_api_key', | |
| 201 | - 'cloudways' => 'mainwp_cloudways_api_key', | |
| 202 | - ); | |
| 207 | + foreach ( $map_names as $api_name => $old_name ) { | |
| 208 | + $data = get_option( $old_name ); | |
| 209 | + if ( ! empty( $data ) ) { | |
| 210 | + $encrypted = Api_Backups_Utility::get_instance()->encrypt_api_keys( $data, false, false, $api_name ); | |
| 211 | + if ( is_array( $encrypted ) && ! empty( $encrypted['file_key'] ) ) { | |
| 212 | + update_option( 'mainwp_api_backups_' . $api_name . '_api_key', $encrypted ); | |
| 213 | + delete_option( $old_name ); | |
| 214 | + } | |
| 215 | + } | |
| 216 | + } | |
| 217 | + update_option( 'mainwp_api_backups_update_version', $this->update_version ); | |
| 218 | + } | |
| 219 | + } | |
| 203 | 220 | |
| 204 | - foreach ( $map_names as $api_name => $old_name ) { | |
| 205 | - $data = get_option( $old_name ); | |
| 206 | - if ( ! empty( $data ) ) { | |
| 207 | - $encrypted = Api_Backups_Utility::get_instance()->encrypt_api_keys( $data, false, false, $api_name ); | |
| 208 | - if ( is_array( $encrypted ) && ! empty( $encrypted['file_key'] ) ) { | |
| 209 | - update_option( 'mainwp_api_backups_' . $api_name . '_api_key', $encrypted ); | |
| 210 | - delete_option( $old_name ); | |
| 211 | - } | |
| 212 | - } | |
| 213 | - } | |
| 214 | - update_option( 'mainwp_api_backups_update_version', $this->update_version ); | |
| 215 | - } | |
| 216 | - } | |
| 221 | + /** | |
| 222 | + * Method init_menu() | |
| 223 | + * | |
| 224 | + * Add Insights Overview sub menu "Insights". | |
| 225 | + */ | |
| 226 | + public static function init_menu() { | |
| 227 | + static::$page = add_submenu_page( | |
| 228 | + 'mainwp_tab', | |
| 229 | + esc_html__( 'API Backups', 'mainwp' ), | |
| 230 | + '<div class="mainwp-hidden" id="mainwp-api-backups">' . esc_html__( 'API Backups', 'mainwp' ) . '</div>', | |
| 231 | + 'read', | |
| 232 | + 'ManageApiBackups', | |
| 233 | + array( | |
| 234 | + Api_Backups_Overview::get_instance(), | |
| 235 | + 'render_backups_list', | |
| 236 | + ) | |
| 237 | + ); | |
| 217 | 238 | |
| 218 | - /** | |
| 219 | - * Method init_menu() | |
| 220 | - * | |
| 221 | - * Add Insights Overview sub menu "Insights". | |
| 222 | - */ | |
| 223 | - public static function init_menu() { | |
| 224 | - self::$page = add_submenu_page( | |
| 225 | - 'mainwp_tab', | |
| 226 | - esc_html__( 'API Backups', 'mainwp' ), | |
| 227 | - '<div class="mainwp-hidden" id="mainwp-api-backups">' . esc_html__( 'API Backups', 'mainwp' ) . '</div>', | |
| 228 | - 'read', | |
| 229 | - 'ManageApiBackups', | |
| 230 | - array( | |
| 231 | - Api_Backups_Overview::get_instance(), | |
| 232 | - 'render_backups_list', | |
| 233 | - ) | |
| 234 | - ); | |
| 239 | + /** | |
| 240 | + * This hook allows you to add extra sub pages to the client page via the 'mainwp_getsubpages_cost_tracker' filter. | |
| 241 | + */ | |
| 242 | + static::$subPages = apply_filters( 'mainwp_getsubpages_api_backups', array() ); | |
| 235 | 243 | |
| 236 | - /** | |
| 237 | - * This hook allows you to add extra sub pages to the client page via the 'mainwp_getsubpages_cost_tracker' filter. | |
| 238 | - */ | |
| 239 | - self::$subPages = apply_filters( 'mainwp_getsubpages_api_backups', array() ); | |
| 244 | + if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { | |
| 245 | + foreach ( static::$subPages as $subPage ) { | |
| 246 | + if ( empty( $subPage['slug'] ) || empty( $subPage['callback'] ) ) { | |
| 247 | + continue; | |
| 248 | + } | |
| 249 | + if ( MainWP_Menu::is_disable_menu_item( 3, 'ManageApiBackups' . $subPage['slug'] ) ) { | |
| 250 | + continue; | |
| 251 | + } | |
| 252 | + add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . esc_html( $subPage['title'] ) . '</div>', 'read', 'ManageApiBackups' . $subPage['slug'], $subPage['callback'] ); | |
| 253 | + } | |
| 254 | + } | |
| 240 | 255 | |
| 241 | - if ( isset( self::$subPages ) && is_array( self::$subPages ) ) { | |
| 242 | - foreach ( self::$subPages as $subPage ) { | |
| 243 | - if ( empty( $subPage['slug'] ) || empty( $subPage['callback'] ) ) { | |
| 244 | - continue; | |
| 245 | - } | |
| 246 | - if ( MainWP_Menu::is_disable_menu_item( 3, 'ManageApiBackups' . $subPage['slug'] ) ) { | |
| 247 | - continue; | |
| 248 | - } | |
| 249 | - add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . esc_html( $subPage['title'] ) . '</div>', 'read', 'ManageApiBackups' . $subPage['slug'], $subPage['callback'] ); | |
| 250 | - } | |
| 251 | - } | |
| 256 | + static::init_left_menu( static::$subPages ); | |
| 257 | + } | |
| 252 | 258 | |
| 253 | - self::init_left_menu( self::$subPages ); | |
| 254 | - } | |
| 255 | 259 | |
| 256 | 260 | |
| 261 | + /** | |
| 262 | + * Initiates API Backups menu. | |
| 263 | + * | |
| 264 | + * @param array $subPages API Backups sub pages. | |
| 265 | + */ | |
| 266 | + public static function init_left_menu( $subPages ) { | |
| 257 | 267 | |
| 258 | - /** | |
| 259 | - * Initiates API Backups menu. | |
| 260 | - * | |
| 261 | - * @param array $subPages API Backups sub pages. | |
| 262 | - */ | |
| 263 | - public static function init_left_menu( $subPages ) { | |
| 264 | - MainWP_Menu::add_left_menu( | |
| 265 | - array( | |
| 266 | - 'title' => esc_html__( 'API Backups', 'mainwp' ), | |
| 267 | - 'parent_key' => 'managesites', | |
| 268 | - 'slug' => 'ManageApiBackups', | |
| 269 | - 'href' => 'admin.php?page=ManageApiBackups', | |
| 270 | - 'icon' => '<i class="pie chart icon"></i>', | |
| 271 | - 'desc' => 'API Backups Overview', | |
| 272 | - 'nosubmenu' => true, | |
| 273 | - 'leftsub_order' => 8, | |
| 274 | - ), | |
| 275 | - 1 | |
| 276 | - ); | |
| 268 | + $init_sub_subleftmenu = array(); | |
| 277 | 269 | |
| 278 | - $init_sub_subleftmenu = array(); | |
| 270 | + MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'ManageApiBackups', 'ManageApiBackups' ); | |
| 279 | 271 | |
| 280 | - MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'ManageApiBackups', 'ManageApiBackups' ); | |
| 272 | + foreach ( $init_sub_subleftmenu as $item ) { | |
| 273 | + if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { | |
| 274 | + continue; | |
| 275 | + } | |
| 276 | + MainWP_Menu::add_left_menu( $item, 2 ); | |
| 277 | + } | |
| 278 | + } | |
| 281 | 279 | |
| 282 | - foreach ( $init_sub_subleftmenu as $item ) { | |
| 283 | - if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { | |
| 284 | - continue; | |
| 285 | - } | |
| 286 | - MainWP_Menu::add_left_menu( $item, 2 ); | |
| 287 | - } | |
| 288 | - } | |
| 289 | - | |
| 290 | - /** | |
| 291 | - * Method render_header() | |
| 292 | - * | |
| 293 | - * Render page header. | |
| 294 | - */ | |
| 295 | - public static function render_header() { | |
| 296 | - $params = array( | |
| 297 | - 'title' => esc_html__( 'API Backups - BETA', 'mainwp' ), | |
| 298 | - 'which' => 'page_api_backups_overview', | |
| 299 | - 'wrap_class' => 'mainwp-module-api-backups-content-wrapper', | |
| 300 | - ); | |
| 301 | - MainWP_UI::render_top_header( $params ); | |
| 302 | - } | |
| 280 | + /** | |
| 281 | + * Method render_header() | |
| 282 | + * | |
| 283 | + * Render page header. | |
| 284 | + */ | |
| 285 | + public static function render_header() { | |
| 286 | + $params = array( | |
| 287 | + 'title' => esc_html__( 'API Backups - BETA', 'mainwp' ), | |
| 288 | + 'which' => 'page_api_backups_overview', | |
| 289 | + 'wrap_class' => 'mainwp-module-api-backups-content-wrapper', | |
| 290 | + ); | |
| 291 | + MainWP_UI::render_top_header( $params ); | |
| 292 | + } | |
| 303 | 293 | } |