| @@ -6,1138 +6,1044 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace MainWP\Dashboard; |
| 9 | 9 | |
| 10 | +// Exit if accessed directly. | |
| 11 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | + exit; | |
| 13 | +} | |
| 14 | + | |
| 10 | 15 | /** |
| 11 | 16 | * Class MainWP_Extensions_Groups |
| 12 | 17 | */ |
| 13 | -class MainWP_Extensions_Groups { | |
| 18 | +class MainWP_Extensions_Groups { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR. | |
| 14 | 19 | |
| 15 | - /** | |
| 16 | - * Method get_class_name() | |
| 17 | - * | |
| 18 | - * Get Class Name. | |
| 19 | - * | |
| 20 | - * @return object Class name. | |
| 21 | - */ | |
| 22 | - public static function get_class_name() { | |
| 23 | - return __CLASS__; | |
| 24 | - } | |
| 20 | + /** | |
| 21 | + * Method get_class_name() | |
| 22 | + * | |
| 23 | + * Get Class Name. | |
| 24 | + * | |
| 25 | + * @return object Class name. | |
| 26 | + */ | |
| 27 | + public static function get_class_name() { | |
| 28 | + return __CLASS__; | |
| 29 | + } | |
| 25 | 30 | |
| 26 | - /** | |
| 27 | - * Instantiate action hooks. | |
| 28 | - */ | |
| 29 | - public static function init() { | |
| 30 | - add_action( 'mainwp_admin_menu', array( self::get_class_name(), 'init_extensions_menu' ), 10, 2 ); | |
| 31 | - } | |
| 31 | + /** | |
| 32 | + * Instantiate action hooks. | |
| 33 | + */ | |
| 34 | + public static function init() { | |
| 35 | + add_action( 'mainwp_admin_menu', array( static::get_class_name(), 'init_extensions_menu' ), 10, 2 ); | |
| 36 | + } | |
| 32 | 37 | |
| 33 | - /** | |
| 34 | - * Method init_extensions_menu() | |
| 35 | - * | |
| 36 | - * Initiate left Extensions menus. | |
| 37 | - */ | |
| 38 | - public static function init_extensions_menu() { | |
| 38 | + /** | |
| 39 | + * Method init_extensions_menu() | |
| 40 | + * | |
| 41 | + * Initiate left Extensions menus. | |
| 42 | + */ | |
| 43 | + public static function init_extensions_menu() { //phpcs:ignore -- NOSONAR - complex. | |
| 39 | 44 | |
| 40 | - add_submenu_page( | |
| 41 | - 'mainwp_tab', | |
| 42 | - esc_html__( 'Backups', 'mainwp' ), | |
| 43 | - '<div class="mainwp-hidden" id="mainwp-extensions-backups">' . esc_html__( 'Backups', 'mainwp' ) . '</div>', | |
| 44 | - 'read', | |
| 45 | - 'Extensions-Mainwp-Backups', | |
| 46 | - array( | |
| 47 | - self::class, | |
| 48 | - 'render_extensions_groups', | |
| 49 | - ) | |
| 50 | - ); | |
| 45 | + // @NO_SONAR_START@ - duplicated issue. | |
| 46 | + $end_div = '</div>'; | |
| 51 | 47 | |
| 52 | - add_submenu_page( | |
| 53 | - 'mainwp_tab', | |
| 54 | - esc_html__( 'Security', 'mainwp' ), | |
| 55 | - '<div class="mainwp-hidden" id="mainwp-extensions-security">' . esc_html__( 'Security', 'mainwp' ) . '</div>', | |
| 56 | - 'read', | |
| 57 | - 'Extensions-Mainwp-Security', | |
| 58 | - array( | |
| 59 | - self::class, | |
| 60 | - 'render_extensions_groups', | |
| 61 | - ) | |
| 62 | - ); | |
| 48 | + $submenu_pages = array( | |
| 49 | + array( | |
| 50 | + 'parent_slug' => 'mainwp_tab', | |
| 51 | + 'page_title' => esc_html__( 'Content Operations', 'mainwp' ), | |
| 52 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-content-operations">' . esc_html__( 'Content Operations', 'mainwp' ) . $end_div, | |
| 53 | + 'capability' => 'read', | |
| 54 | + 'menu_slug' => 'Extensions-Mainwp-Content-Operations', | |
| 55 | + 'callback' => array( | |
| 56 | + static::class, | |
| 57 | + 'render_extensions_groups', | |
| 58 | + ), | |
| 59 | + ), | |
| 60 | + array( | |
| 61 | + 'parent_slug' => 'mainwp_tab', | |
| 62 | + 'page_title' => esc_html__( 'Backups', 'mainwp' ), | |
| 63 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-backups">' . esc_html__( 'Backups', 'mainwp' ) . $end_div, | |
| 64 | + 'capability' => 'read', | |
| 65 | + 'menu_slug' => 'Extensions-Mainwp-Backups', | |
| 66 | + 'callback' => array( | |
| 67 | + static::class, | |
| 68 | + 'render_extensions_groups', | |
| 69 | + ), | |
| 70 | + ), | |
| 71 | + array( | |
| 72 | + 'parent_slug' => 'mainwp_tab', | |
| 73 | + 'page_title' => esc_html__( 'Security', 'mainwp' ), | |
| 74 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-security">' . esc_html__( 'Security', 'mainwp' ) . $end_div, | |
| 75 | + 'capability' => 'read', | |
| 76 | + 'menu_slug' => 'Extensions-Mainwp-Security', | |
| 77 | + 'callback' => array( | |
| 78 | + static::class, | |
| 79 | + 'render_extensions_groups', | |
| 80 | + ), | |
| 81 | + ), | |
| 82 | + array( | |
| 83 | + 'parent_slug' => 'mainwp_tab', | |
| 84 | + 'page_title' => esc_html__( 'Monitoring', 'mainwp' ), | |
| 85 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-monitoring">' . esc_html__( 'Monitoring', 'mainwp' ) . $end_div, | |
| 86 | + 'capability' => 'read', | |
| 87 | + 'menu_slug' => 'Extensions-Mainwp-Monitoring', | |
| 88 | + 'callback' => array( | |
| 89 | + static::class, | |
| 90 | + 'render_extensions_groups', | |
| 91 | + ), | |
| 92 | + ), | |
| 93 | + array( | |
| 94 | + 'parent_slug' => 'mainwp_tab', | |
| 95 | + 'page_title' => esc_html__( 'Analytics', 'mainwp' ), | |
| 96 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-analytics">' . esc_html__( 'Analytics', 'mainwp' ) . $end_div, | |
| 97 | + 'capability' => 'read', | |
| 98 | + 'menu_slug' => 'Extensions-Mainwp-Analytics', | |
| 99 | + 'callback' => array( | |
| 100 | + static::class, | |
| 101 | + 'render_extensions_groups', | |
| 102 | + ), | |
| 103 | + ), | |
| 104 | + array( | |
| 105 | + 'parent_slug' => 'mainwp_tab', | |
| 106 | + 'page_title' => esc_html__( 'Performance', 'mainwp' ), | |
| 107 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-performance">' . esc_html__( 'Performance', 'mainwp' ) . $end_div, | |
| 108 | + 'capability' => 'read', | |
| 109 | + 'menu_slug' => 'Extensions-Mainwp-Performance', | |
| 110 | + 'callback' => array( | |
| 111 | + static::class, | |
| 112 | + 'render_extensions_groups', | |
| 113 | + ), | |
| 114 | + ), | |
| 115 | + array( | |
| 116 | + 'parent_slug' => 'mainwp_tab', | |
| 117 | + 'page_title' => esc_html__( 'Agency', 'mainwp' ), | |
| 118 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-agency">' . esc_html__( 'Agency', 'mainwp' ) . $end_div, | |
| 119 | + 'capability' => 'read', | |
| 120 | + 'menu_slug' => 'Extensions-Mainwp-Agency', | |
| 121 | + 'callback' => array( | |
| 122 | + static::class, | |
| 123 | + 'render_extensions_groups', | |
| 124 | + ), | |
| 125 | + ), | |
| 126 | + array( | |
| 127 | + 'parent_slug' => 'mainwp_tab', | |
| 128 | + 'page_title' => esc_html__( 'Administrative', 'mainwp' ), | |
| 129 | + 'menu_title' => '<div class="mainwp-hidden" id="mainwp-extensions-administrative">' . esc_html__( 'Administrative', 'mainwp' ) . $end_div, | |
| 130 | + 'capability' => 'read', | |
| 131 | + 'menu_slug' => 'Extensions-Mainwp-Administrative', | |
| 132 | + 'callback' => array( | |
| 133 | + static::class, | |
| 134 | + 'render_extensions_groups', | |
| 135 | + ), | |
| 136 | + ), | |
| 137 | + ); | |
| 63 | 138 | |
| 64 | - add_submenu_page( | |
| 65 | - 'mainwp_tab', | |
| 66 | - esc_html__( 'Monitoring', 'mainwp' ), | |
| 67 | - '<div class="mainwp-hidden" id="mainwp-extensions-monitoring">' . esc_html__( 'Monitoring', 'mainwp' ) . '</div>', | |
| 68 | - 'read', | |
| 69 | - 'Extensions-Mainwp-Monitoring', | |
| 70 | - array( | |
| 71 | - self::class, | |
| 72 | - 'render_extensions_groups', | |
| 73 | - ) | |
| 74 | - ); | |
| 139 | + foreach ( $submenu_pages as $item ) { | |
| 140 | + add_submenu_page( | |
| 141 | + $item['parent_slug'], | |
| 142 | + $item['page_title'], | |
| 143 | + $item['menu_title'], | |
| 144 | + $item['capability'], | |
| 145 | + $item['menu_slug'], | |
| 146 | + $item['callback'], | |
| 147 | + ); | |
| 148 | + } | |
| 75 | 149 | |
| 76 | - add_submenu_page( | |
| 77 | - 'mainwp_tab', | |
| 78 | - esc_html__( 'Analytics', 'mainwp' ), | |
| 79 | - '<div class="mainwp-hidden" id="mainwp-extensions-analytics">' . esc_html__( 'Analytics', 'mainwp' ) . '</div>', | |
| 80 | - 'read', | |
| 81 | - 'Extensions-Mainwp-Analytics', | |
| 82 | - array( | |
| 83 | - self::class, | |
| 84 | - 'render_extensions_groups', | |
| 85 | - ) | |
| 86 | - ); | |
| 150 | + $extensions_and_leftmenus = array( | |
| 151 | + array( | |
| 152 | + 'title' => esc_html__( 'Content Operations', 'mainwp' ), | |
| 153 | + 'parent_key' => 'managesites', | |
| 154 | + 'slug' => 'Extensions-Mainwp-Content-Operations', | |
| 155 | + 'href' => 'admin.php?page=Extensions-Mainwp-Content-Operations', | |
| 156 | + 'leftsub_order' => 8, | |
| 157 | + 'id' => 'mainwp-content-operations-extensions-category', | |
| 158 | + 'level' => 1, | |
| 159 | + ), | |
| 160 | + ); | |
| 87 | 161 | |
| 88 | - add_submenu_page( | |
| 89 | - 'mainwp_tab', | |
| 90 | - esc_html__( 'Performance', 'mainwp' ), | |
| 91 | - '<div class="mainwp-hidden" id="mainwp-extensions-performance">' . esc_html__( 'Performance', 'mainwp' ) . '</div>', | |
| 92 | - 'read', | |
| 93 | - 'Extensions-Mainwp-Performance', | |
| 94 | - array( | |
| 95 | - self::class, | |
| 96 | - 'render_extensions_groups', | |
| 97 | - ) | |
| 98 | - ); | |
| 162 | + $extensions_and_leftmenus[] = array( | |
| 163 | + 'title' => esc_html__( 'Backups', 'mainwp' ), | |
| 164 | + 'parent_key' => 'managesites', | |
| 165 | + 'slug' => 'Extensions-Mainwp-Backups', | |
| 166 | + 'href' => 'admin.php?page=Extensions-Mainwp-Backups', | |
| 167 | + 'leftsub_order' => 8.1, | |
| 168 | + 'id' => 'mainwp-backups-extensions-category', | |
| 169 | + 'level' => 1, | |
| 170 | + ); | |
| 99 | 171 | |
| 100 | - add_submenu_page( | |
| 101 | - 'mainwp_tab', | |
| 102 | - esc_html__( 'Development', 'mainwp' ), | |
| 103 | - '<div class="mainwp-hidden" id="mainwp-extensions-development">' . esc_html__( 'Development', 'mainwp' ) . '</div>', | |
| 104 | - 'read', | |
| 105 | - 'Extensions-Mainwp-Development', | |
| 106 | - array( | |
| 107 | - self::class, | |
| 108 | - 'render_extensions_groups', | |
| 109 | - ) | |
| 110 | - ); | |
| 172 | + if ( defined( 'MAINWP_MODULE_API_BACKUPS_ENABLED' ) && MAINWP_MODULE_API_BACKUPS_ENABLED ) { | |
| 173 | + $extensions_and_leftmenus[] = array( | |
| 174 | + 'type' => 'extension', | |
| 175 | + 'title' => esc_html__( 'API Backups', 'mainwp' ), | |
| 176 | + 'slug' => 'mainwp-api-backpus', | |
| 177 | + 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 178 | + 'ext_page' => 'admin.php?page=ManageApiBackups', | |
| 179 | + 'leftsub_order_level2' => 1, | |
| 180 | + 'level' => 2, | |
| 181 | + 'active_path' => array( 'ManageApiBackups' => 'managesites' ), | |
| 182 | + ); | |
| 183 | + } | |
| 111 | 184 | |
| 112 | - add_submenu_page( | |
| 113 | - 'mainwp_tab', | |
| 114 | - esc_html__( 'Agency', 'mainwp' ), | |
| 115 | - '<div class="mainwp-hidden" id="mainwp-extensions-agency">' . esc_html__( 'Agency', 'mainwp' ) . '</div>', | |
| 116 | - 'read', | |
| 117 | - 'Extensions-Mainwp-Agency', | |
| 118 | - array( | |
| 119 | - self::class, | |
| 120 | - 'render_extensions_groups', | |
| 121 | - ) | |
| 122 | - ); | |
| 185 | + $extensions_and_leftmenus[] = array( | |
| 186 | + 'type' => 'extension', | |
| 187 | + 'title' => esc_html__( 'BackWPup', 'mainwp' ), | |
| 188 | + 'slug' => 'mainwp-backwpup-extension/mainwp-backwpup-extension.php', | |
| 189 | + 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 190 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Backwpup-Extension', | |
| 191 | + 'leftsub_order_level2' => 2, | |
| 192 | + 'level' => 2, | |
| 193 | + 'active_path' => array( 'Extensions-Mainwp-Backwpup-Extension' => 'managesites' ), | |
| 194 | + ); | |
| 123 | 195 | |
| 124 | - add_submenu_page( | |
| 125 | - 'mainwp_tab', | |
| 126 | - esc_html__( 'Administrative', 'mainwp' ), | |
| 127 | - '<div class="mainwp-hidden" id="mainwp-extensions-administrative">' . esc_html__( 'Administrative', 'mainwp' ) . '</div>', | |
| 128 | - 'read', | |
| 129 | - 'Extensions-Mainwp-Administrative', | |
| 130 | - array( | |
| 131 | - self::class, | |
| 132 | - 'render_extensions_groups', | |
| 133 | - ) | |
| 134 | - ); | |
| 196 | + $extensions_and_leftmenus[] = array( | |
| 197 | + 'type' => 'extension', | |
| 198 | + 'title' => esc_html__( 'UpdraftPlus', 'mainwp' ), | |
| 199 | + 'slug' => 'mainwp-updraftplus-extension/mainwp-updraftplus-extension.php', | |
| 200 | + 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 201 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Updraftplus-Extension', | |
| 202 | + 'leftsub_order_level2' => 3, | |
| 203 | + 'level' => 2, | |
| 204 | + 'active_path' => array( 'Extensions-Mainwp-Updraftplus-Extension' => 'managesites' ), | |
| 205 | + ); | |
| 135 | 206 | |
| 136 | - MainWP_Menu::add_left_menu( | |
| 137 | - array( | |
| 138 | - 'title' => esc_html__( 'Backups', 'mainwp' ), | |
| 139 | - 'parent_key' => 'managesites', | |
| 140 | - 'slug' => 'Extensions-Mainwp-Backups', | |
| 141 | - 'href' => 'admin.php?page=Extensions-Mainwp-Backups', | |
| 142 | - 'leftsub_order' => 8.1, | |
| 143 | - 'id' => 'mainwp-backups-extensions-category', | |
| 144 | - ), | |
| 145 | - 1 | |
| 146 | - ); | |
| 207 | + $extensions_and_leftmenus[] = array( | |
| 208 | + 'type' => 'extension', | |
| 209 | + 'title' => esc_html__( 'MainWP Buddy', 'mainwp' ), | |
| 210 | + 'slug' => 'mainwp-buddy-extension/mainwp-buddy-extension.php', | |
| 211 | + 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 212 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Buddy-Extension', | |
| 213 | + 'leftsub_order_level2' => 4, | |
| 214 | + 'level' => 2, | |
| 215 | + 'active_path' => array( 'Extensions-Mainwp-Buddy-Extension' => 'managesites' ), | |
| 216 | + ); | |
| 147 | 217 | |
| 148 | - self::add_extension_menu( | |
| 149 | - array( | |
| 150 | - 'title' => esc_html__( 'API Backups', 'mainwp' ), | |
| 151 | - 'slug' => 'mainwp-api-backpus', | |
| 152 | - 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 153 | - 'ext_page' => 'admin.php?page=ManageApiBackups', | |
| 154 | - 'leftsub_order_level2' => 1, | |
| 155 | - 'level' => 2, | |
| 156 | - 'active_path' => array( 'ManageApiBackups' => 'managesites' ), | |
| 157 | - ), | |
| 158 | - ); | |
| 218 | + $extensions_and_leftmenus[] = array( | |
| 219 | + 'type' => 'extension', | |
| 220 | + 'title' => esc_html__( 'Time Capsule', 'mainwp' ), | |
| 221 | + 'slug' => 'mainwp-timecapsule-extension/mainwp-timecapsule-extension.php', | |
| 222 | + 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 223 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Timecapsule-Extension', | |
| 224 | + 'leftsub_order_level2' => 5, | |
| 225 | + 'level' => 2, | |
| 226 | + 'active_path' => array( 'Extensions-Mainwp-Timecapsule-Extension' => 'managesites' ), | |
| 227 | + ); | |
| 159 | 228 | |
| 160 | - self::add_extension_menu( | |
| 161 | - array( | |
| 162 | - 'title' => esc_html__( 'BackWPup', 'mainwp' ), | |
| 163 | - 'slug' => 'mainwp-backwpup-extension/mainwp-backwpup-extension.php', | |
| 164 | - 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 165 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Backwpup-Extension', | |
| 166 | - 'leftsub_order_level2' => 2, | |
| 167 | - 'level' => 2, | |
| 168 | - 'active_path' => array( 'Extensions-Mainwp-Backwpup-Extension' => 'managesites' ), | |
| 169 | - ), | |
| 170 | - ); | |
| 229 | + $extensions_and_leftmenus[] = array( | |
| 230 | + 'type' => 'extension', | |
| 231 | + 'title' => esc_html__( 'WPvivid Backup', 'mainwp' ), | |
| 232 | + 'slug' => 'wpvivid-backup-mainwp/wpvivid-backup-mainwp.php', | |
| 233 | + 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 234 | + 'ext_page' => 'admin.php?page=Extensions-Wpvivid-Backup-Mainwp', | |
| 235 | + 'leftsub_order_level2' => 6, | |
| 236 | + 'level' => 2, | |
| 237 | + 'active_path' => array( 'Extensions-Wpvivid-Backup-Mainwp' => 'managesites' ), | |
| 238 | + ); | |
| 171 | 239 | |
| 172 | - self::add_extension_menu( | |
| 173 | - array( | |
| 174 | - 'title' => esc_html__( 'UpdraftPlus', 'mainwp' ), | |
| 175 | - 'slug' => 'mainwp-updraftplus-extension/mainwp-updraftplus-extension.php', | |
| 176 | - 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 177 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Updraftplus-Extension', | |
| 178 | - 'leftsub_order_level2' => 3, | |
| 179 | - 'level' => 2, | |
| 180 | - 'active_path' => array( 'Extensions-Mainwp-Updraftplus-Extension' => 'managesites' ), | |
| 181 | - ), | |
| 182 | - ); | |
| 240 | + $extensions_and_leftmenus[] = array( | |
| 241 | + 'title' => esc_html__( 'Security', 'mainwp' ), | |
| 242 | + 'parent_key' => 'managesites', | |
| 243 | + 'slug' => 'Extensions-Mainwp-Security', | |
| 244 | + 'href' => 'admin.php?page=Extensions-Mainwp-Security', | |
| 245 | + 'leftsub_order' => 8.2, | |
| 246 | + 'id' => 'mainwp-security-extensions-category', | |
| 247 | + 'level' => 1, | |
| 248 | + ); | |
| 183 | 249 | |
| 184 | - self::add_extension_menu( | |
| 185 | - array( | |
| 186 | - 'title' => esc_html__( 'MainWP Buddy', 'mainwp' ), | |
| 187 | - 'slug' => 'mainwp-buddy-extension/mainwp-buddy-extension.php', | |
| 188 | - 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 189 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Buddy-Extension', | |
| 190 | - 'leftsub_order_level2' => 4, | |
| 191 | - 'level' => 2, | |
| 192 | - 'active_path' => array( 'Extensions-Mainwp-Buddy-Extension' => 'managesites' ), | |
| 193 | - ), | |
| 194 | - ); | |
| 250 | + $extensions_and_leftmenus[] = array( | |
| 251 | + 'type' => 'extension', | |
| 252 | + 'title' => esc_html__( 'Activity Log for MainWP', 'mainwp' ), | |
| 253 | + 'slug' => 'activity-log-mainwp/activity-log-mainwp.php', | |
| 254 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 255 | + 'ext_page' => 'admin.php?page=Extensions-Activity-Log-Mainwp', | |
| 256 | + 'leftsub_order_level2' => 1, | |
| 257 | + 'level' => 2, | |
| 258 | + 'active_path' => array( 'Extensions-Activity-Log-Mainwp' => 'managesites' ), | |
| 259 | + ); | |
| 195 | 260 | |
| 196 | - self::add_extension_menu( | |
| 197 | - array( | |
| 198 | - 'title' => esc_html__( 'Time Capsule', 'mainwp' ), | |
| 199 | - 'slug' => 'mainwp-timecapsule-extension/mainwp-timecapsule-extension.php', | |
| 200 | - 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 201 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Timecapsule-Extension', | |
| 202 | - 'leftsub_order_level2' => 5, | |
| 203 | - 'level' => 2, | |
| 204 | - 'active_path' => array( 'Extensions-Mainwp-Timecapsule-Extension' => 'managesites' ), | |
| 205 | - ), | |
| 206 | - ); | |
| 261 | + $extensions_and_leftmenus[] = array( | |
| 262 | + 'type' => 'extension', | |
| 263 | + 'title' => esc_html__( 'Dashboard Lock', 'mainwp' ), | |
| 264 | + 'slug' => 'mainwp-clean-and-lock-extension/mainwp-clean-and-lock-extension.php', | |
| 265 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 266 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Clean-And-Lock-Extension', | |
| 267 | + 'leftsub_order_level2' => 2, | |
| 268 | + 'level' => 2, | |
| 269 | + 'active_path' => array( 'Extensions-Mainwp-Clean-And-Lock-Extension' => 'managesites' ), | |
| 270 | + ); | |
| 207 | 271 | |
| 208 | - self::add_extension_menu( | |
| 209 | - array( | |
| 210 | - 'title' => esc_html__( 'WPvivid Backup', 'mainwp' ), | |
| 211 | - 'slug' => 'wpvivid-backup-mainwp/wpvivid-backup-mainwp.php', | |
| 212 | - 'parent_key' => 'Extensions-Mainwp-Backups', | |
| 213 | - 'ext_page' => 'admin.php?page=Extensions-Wpvivid-Backup-Mainwp', | |
| 214 | - 'leftsub_order_level2' => 6, | |
| 215 | - 'level' => 2, | |
| 216 | - 'active_path' => array( 'Extensions-Wpvivid-Backup-Mainwp' => 'managesites' ), | |
| 217 | - ), | |
| 218 | - ); | |
| 272 | + $extensions_and_leftmenus[] = array( | |
| 273 | + 'type' => 'extension', | |
| 274 | + 'title' => esc_html__( 'Jetpack Scan', 'mainwp' ), | |
| 275 | + 'slug' => 'mainwp-jetpack-scan-extension/mainwp-jetpack-scan-extension.php', | |
| 276 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 277 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Jetpack-Scan-Extension', | |
| 278 | + 'leftsub_order_level2' => 3, | |
| 279 | + 'level' => 2, | |
| 280 | + 'active_path' => array( 'Extensions-Mainwp-Jetpack-Scan-Extension' => 'managesites' ), | |
| 281 | + ); | |
| 219 | 282 | |
| 220 | - MainWP_Menu::add_left_menu( | |
| 221 | - array( | |
| 222 | - 'title' => esc_html__( 'Security', 'mainwp' ), | |
| 223 | - 'parent_key' => 'managesites', | |
| 224 | - 'slug' => 'Extensions-Mainwp-Security', | |
| 225 | - 'href' => 'admin.php?page=Extensions-Mainwp-Security', | |
| 226 | - 'leftsub_order' => 8.2, | |
| 227 | - 'id' => 'mainwp-security-extensions-category', | |
| 228 | - ), | |
| 229 | - 1 | |
| 230 | - ); | |
| 283 | + $extensions_and_leftmenus[] = array( | |
| 284 | + 'type' => 'extension', | |
| 285 | + 'title' => esc_html__( 'Jetpack Protect', 'mainwp' ), | |
| 286 | + 'slug' => 'mainwp-jetpack-protect-extension/mainwp-jetpack-protect-extension.php', | |
| 287 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 288 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Jetpack-Protect-Extension', | |
| 289 | + 'leftsub_order_level2' => 4, | |
| 290 | + 'level' => 2, | |
| 291 | + 'active_path' => array( 'Extensions-Mainwp-Jetpack-Protect-Extension' => 'managesites' ), | |
| 292 | + ); | |
| 231 | 293 | |
| 232 | - self::add_extension_menu( | |
| 233 | - array( | |
| 234 | - 'title' => esc_html__( 'Activity Log for MainWP', 'mainwp' ), | |
| 235 | - 'slug' => 'activity-log-mainwp/activity-log-mainwp.php', | |
| 236 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 237 | - 'ext_page' => 'admin.php?page=Extensions-Activity-Log-Mainwp', | |
| 238 | - 'leftsub_order_level2' => 1, | |
| 239 | - 'level' => 2, | |
| 240 | - 'active_path' => array( 'Extensions-Activity-Log-Mainwp' => 'managesites' ), | |
| 241 | - ), | |
| 242 | - ); | |
| 294 | + $extensions_and_leftmenus[] = array( | |
| 295 | + 'type' => 'extension', | |
| 296 | + 'title' => esc_html__( 'Security Ninja', 'mainwp' ), | |
| 297 | + 'slug' => 'security-ninja-for-mainwp/security-ninja-mainwp.php', | |
| 298 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 299 | + 'ext_page' => 'admin.php?page=Extensions-Security-Ninja-For-Mainwp', | |
| 300 | + 'leftsub_order_level2' => 5, | |
| 301 | + 'level' => 2, | |
| 302 | + 'active_path' => array( 'Extensions-Security-Ninja-For-Mainwp' => 'managesites' ), | |
| 303 | + ); | |
| 243 | 304 | |
| 244 | - self::add_extension_menu( | |
| 245 | - array( | |
| 246 | - 'title' => esc_html__( 'Dashboard Lock', 'mainwp' ), | |
| 247 | - 'slug' => 'mainwp-clean-and-lock-extension/mainwp-clean-and-lock-extension.php', | |
| 248 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 249 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Clean-And-Lock-Extension', | |
| 250 | - 'leftsub_order_level2' => 2, | |
| 251 | - 'level' => 2, | |
| 252 | - 'active_path' => array( 'Extensions-Mainwp-Clean-And-Lock-Extension' => 'managesites' ), | |
| 253 | - ), | |
| 254 | - ); | |
| 305 | + $extensions_and_leftmenus[] = array( | |
| 306 | + 'type' => 'extension', | |
| 307 | + 'title' => esc_html__( 'Sucuri', 'mainwp' ), | |
| 308 | + 'slug' => 'mainwp-sucuri-extension/mainwp-sucuri-extension.php', | |
| 309 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 310 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Sucuri-Extension', | |
| 311 | + 'leftsub_order_level2' => 6, | |
| 312 | + 'level' => 2, | |
| 313 | + 'active_path' => array( 'Extensions-Mainwp-Sucuri-Extension' => 'managesites' ), | |
| 314 | + ); | |
| 255 | 315 | |
| 256 | - self::add_extension_menu( | |
| 257 | - array( | |
| 258 | - 'title' => esc_html__( 'Jetpack Scan', 'mainwp' ), | |
| 259 | - 'slug' => 'mainwp-jetpack-scan-extension/mainwp-jetpack-scan-extension.php', | |
| 260 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 261 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Jetpack-Scan-Extension', | |
| 262 | - 'leftsub_order_level2' => 3, | |
| 263 | - 'level' => 2, | |
| 264 | - 'active_path' => array( 'Extensions-Mainwp-Jetpack-Scan-Extension' => 'managesites' ), | |
| 265 | - ), | |
| 266 | - ); | |
| 316 | + $extensions_and_leftmenus[] = array( | |
| 317 | + 'type' => 'extension', | |
| 318 | + 'title' => esc_html__( 'Solid Security Integration', 'mainwp' ), | |
| 319 | + 'slug' => 'mainwp-ithemes-security-extension/mainwp-ithemes-security-extension.php', | |
| 320 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 321 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Ithemes-Security-Extension', | |
| 322 | + 'leftsub_order_level2' => 7, | |
| 323 | + 'level' => 2, | |
| 324 | + 'active_path' => array( 'Extensions-Mainwp-Ithemes-Security-Extension' => 'managesites' ), | |
| 325 | + ); | |
| 267 | 326 | |
| 268 | - self::add_extension_menu( | |
| 269 | - array( | |
| 270 | - 'title' => esc_html__( 'Jetpack Protect', 'mainwp' ), | |
| 271 | - 'slug' => 'mainwp-jetpack-protect-extension/mainwp-jetpack-protect-extension.php', | |
| 272 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 273 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Jetpack-Protect-Extension', | |
| 274 | - 'leftsub_order_level2' => 4, | |
| 275 | - 'level' => 2, | |
| 276 | - 'active_path' => array( 'Extensions-Mainwp-Jetpack-Protect-Extension' => 'managesites' ), | |
| 277 | - ), | |
| 278 | - ); | |
| 327 | + $extensions_and_leftmenus[] = array( | |
| 328 | + 'type' => 'extension', | |
| 329 | + 'title' => esc_html__( 'Virusdie', 'mainwp' ), | |
| 330 | + 'slug' => 'mainwp-virusdie-extension/mainwp-virusdie-extension.php', | |
| 331 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 332 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Virusdie-Extension', | |
| 333 | + 'leftsub_order_level2' => 8, | |
| 334 | + 'level' => 2, | |
| 335 | + 'active_path' => array( 'Extensions-Mainwp-Virusdie-Extension' => 'managesites' ), | |
| 336 | + ); | |
| 279 | 337 | |
| 280 | - self::add_extension_menu( | |
| 281 | - array( | |
| 282 | - 'title' => esc_html__( 'Security Ninja', 'mainwp' ), | |
| 283 | - 'slug' => 'security-ninja-for-mainwp/security-ninja-mainwp.php', | |
| 284 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 285 | - 'ext_page' => 'admin.php?page=Extensions-Security-Ninja-For-Mainwp', | |
| 286 | - 'leftsub_order_level2' => 5, | |
| 287 | - 'level' => 2, | |
| 288 | - 'active_path' => array( 'Extensions-Security-Ninja-For-Mainwp' => 'managesites' ), | |
| 289 | - ), | |
| 290 | - ); | |
| 338 | + $extensions_and_leftmenus[] = array( | |
| 339 | + 'type' => 'extension', | |
| 340 | + 'title' => esc_html__( 'Vulnerability Checker', 'mainwp' ), | |
| 341 | + 'slug' => 'mainwp-vulnerability-checker-extension/mainwp-vulnerability-checker-extension.php', | |
| 342 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 343 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Vulnerability-Checker-Extension', | |
| 344 | + 'leftsub_order_level2' => 9, | |
| 345 | + 'level' => 2, | |
| 346 | + 'active_path' => array( 'Extensions-Mainwp-Vulnerability-Checker-Extension' => 'managesites' ), | |
| 347 | + ); | |
| 291 | 348 | |
| 292 | - self::add_extension_menu( | |
| 293 | - array( | |
| 294 | - 'title' => esc_html__( 'Sucuri', 'mainwp' ), | |
| 295 | - 'slug' => 'mainwp-sucuri-extension/mainwp-sucuri-extension.php', | |
| 296 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 297 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Sucuri-Extension', | |
| 298 | - 'leftsub_order_level2' => 6, | |
| 299 | - 'level' => 2, | |
| 300 | - 'active_path' => array( 'Extensions-Mainwp-Sucuri-Extension' => 'managesites' ), | |
| 301 | - ), | |
| 302 | - ); | |
| 349 | + $extensions_and_leftmenus[] = array( | |
| 350 | + 'type' => 'extension', | |
| 351 | + 'title' => esc_html__( 'Wordfence', 'mainwp' ), | |
| 352 | + 'slug' => 'mainwp-wordfence-extension/mainwp-wordfence-extension.php', | |
| 353 | + 'parent_key' => 'Extensions-Mainwp-Security', | |
| 354 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Wordfence-Extension', | |
| 355 | + 'leftsub_order_level2' => 10, | |
| 356 | + 'level' => 2, | |
| 357 | + 'active_path' => array( 'Extensions-Mainwp-Wordfence-Extension' => 'managesites' ), | |
| 358 | + ); | |
| 303 | 359 | |
| 304 | - self::add_extension_menu( | |
| 305 | - array( | |
| 306 | - 'title' => esc_html__( 'iThemes Security', 'mainwp' ), | |
| 307 | - 'slug' => 'mainwp-ithemes-security-extension/mainwp-ithemes-security-extension.php', | |
| 308 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 309 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Ithemes-Security-Extension', | |
| 310 | - 'leftsub_order_level2' => 7, | |
| 311 | - 'level' => 2, | |
| 312 | - 'active_path' => array( 'Extensions-Mainwp-Ithemes-Security-Extension' => 'managesites' ), | |
| 313 | - ), | |
| 314 | - ); | |
| 360 | + $extensions_and_leftmenus[] = array( | |
| 361 | + 'title' => esc_html__( 'Analytics', 'mainwp' ), | |
| 362 | + 'parent_key' => 'managesites', | |
| 363 | + 'slug' => 'Extensions-Mainwp-Analytics', | |
| 364 | + 'href' => 'admin.php?page=Extensions-Mainwp-Analytics', | |
| 365 | + 'leftsub_order' => 8.3, | |
| 366 | + 'id' => 'mainwp-analytics-extensions-category', | |
| 367 | + 'level' => 1, | |
| 368 | + ); | |
| 315 | 369 | |
| 316 | - self::add_extension_menu( | |
| 317 | - array( | |
| 318 | - 'title' => esc_html__( 'Virusdie', 'mainwp' ), | |
| 319 | - 'slug' => 'mainwp-virusdie-extension/mainwp-virusdie-extension.php', | |
| 320 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 321 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Virusdie-Extension', | |
| 322 | - 'leftsub_order_level2' => 8, | |
| 323 | - 'level' => 2, | |
| 324 | - 'active_path' => array( 'Extensions-Mainwp-Virusdie-Extension' => 'managesites' ), | |
| 325 | - ), | |
| 326 | - ); | |
| 370 | + $extensions_and_leftmenus[] = array( | |
| 371 | + 'type' => 'extension', | |
| 372 | + 'title' => esc_html__( 'Google Analytics', 'mainwp' ), | |
| 373 | + 'slug' => 'mainwp-google-analytics-extension/mainwp-google-analytics-extension.php', | |
| 374 | + 'parent_key' => 'Extensions-Mainwp-Analytics', | |
| 375 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Google-Analytics-Extension', | |
| 376 | + 'leftsub_order_level2' => 1, | |
| 377 | + 'level' => 2, | |
| 378 | + 'active_path' => array( 'Extensions-Mainwp-Google-Analytics-Extension' => 'managesites' ), | |
| 379 | + ); | |
| 327 | 380 | |
| 328 | - self::add_extension_menu( | |
| 329 | - array( | |
| 330 | - 'title' => esc_html__( 'Vulnerability Checker', 'mainwp' ), | |
| 331 | - 'slug' => 'mainwp-vulnerability-checker-extension/mainwp-vulnerability-checker-extension.php', | |
| 332 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 333 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Vulnerability-Checker-Extension', | |
| 334 | - 'leftsub_order_level2' => 9, | |
| 335 | - 'level' => 2, | |
| 336 | - 'active_path' => array( 'Extensions-Mainwp-Vulnerability-Checker-Extension' => 'managesites' ), | |
| 337 | - ), | |
| 338 | - ); | |
| 381 | + $extensions_and_leftmenus[] = array( | |
| 382 | + 'type' => 'extension', | |
| 383 | + 'title' => esc_html__( 'Fathom', 'mainwp' ), | |
| 384 | + 'slug' => 'mainwp-fathom-extension/mainwp-fathom-extension.php', | |
| 385 | + 'parent_key' => 'Extensions-Mainwp-Analytics', | |
| 386 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Fathom-Extension', | |
| 387 | + 'leftsub_order_level2' => 2, | |
| 388 | + 'level' => 2, | |
| 389 | + 'active_path' => array( 'Extensions-Mainwp-Fathom-Extension' => 'managesites' ), | |
| 390 | + ); | |
| 339 | 391 | |
| 340 | - self::add_extension_menu( | |
| 341 | - array( | |
| 342 | - 'title' => esc_html__( 'Wordfence', 'mainwp' ), | |
| 343 | - 'slug' => 'mainwp-wordfence-extension/mainwp-wordfence-extension.php', | |
| 344 | - 'parent_key' => 'Extensions-Mainwp-Security', | |
| 345 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Wordfence-Extension', | |
| 346 | - 'leftsub_order_level2' => 10, | |
| 347 | - 'level' => 2, | |
| 348 | - 'active_path' => array( 'Extensions-Mainwp-Wordfence-Extension' => 'managesites' ), | |
| 349 | - ), | |
| 350 | - ); | |
| 392 | + $extensions_and_leftmenus[] = array( | |
| 393 | + 'type' => 'extension', | |
| 394 | + 'title' => esc_html__( 'Matomo', 'mainwp' ), | |
| 395 | + 'slug' => 'mainwp-piwik-extension/mainwp-piwik-extension.php', | |
| 396 | + 'parent_key' => 'Extensions-Mainwp-Analytics', | |
| 397 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Piwik-Extension', | |
| 398 | + 'leftsub_order_level2' => 3, | |
| 399 | + 'level' => 2, | |
| 400 | + 'active_path' => array( 'Extensions-Mainwp-Piwik-Extension' => 'managesites' ), | |
| 401 | + ); | |
| 351 | 402 | |
| 352 | - MainWP_Menu::add_left_menu( | |
| 353 | - array( | |
| 354 | - 'title' => esc_html__( 'Analytics', 'mainwp' ), | |
| 355 | - 'parent_key' => 'managesites', | |
| 356 | - 'slug' => 'Extensions-Mainwp-Analytics', | |
| 357 | - 'href' => 'admin.php?page=Extensions-Mainwp-Analytics', | |
| 358 | - 'leftsub_order' => 8.3, | |
| 359 | - 'id' => 'mainwp-analytics-extensions-category', | |
| 360 | - ), | |
| 361 | - 1 | |
| 362 | - ); | |
| 403 | + $extensions_and_leftmenus[] = array( | |
| 404 | + 'title' => esc_html__( 'Monitoring', 'mainwp' ), | |
| 405 | + 'parent_key' => 'managesites', | |
| 406 | + 'slug' => 'Extensions-Mainwp-Monitoring', | |
| 407 | + 'href' => 'admin.php?page=Extensions-Mainwp-Monitoring', | |
| 408 | + 'leftsub_order' => 8.4, | |
| 409 | + 'id' => 'mainwp-monitoring-extensions-category', | |
| 410 | + 'level' => 1, | |
| 411 | + ); | |
| 363 | 412 | |
| 364 | - self::add_extension_menu( | |
| 365 | - array( | |
| 366 | - 'title' => esc_html__( 'Google Analytics', 'mainwp' ), | |
| 367 | - 'slug' => 'mainwp-google-analytics-extension/mainwp-google-analytics-extension.php', | |
| 368 | - 'parent_key' => 'Extensions-Mainwp-Analytics', | |
| 369 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Google-Analytics-Extension', | |
| 370 | - 'leftsub_order_level2' => 1, | |
| 371 | - 'level' => 2, | |
| 372 | - 'active_path' => array( 'Extensions-Mainwp-Google-Analytics-Extension' => 'managesites' ), | |
| 373 | - ), | |
| 374 | - ); | |
| 413 | + $extensions_and_leftmenus[] = array( | |
| 414 | + 'title' => esc_html__( 'Monitoring', 'mainwp' ), | |
| 415 | + 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 416 | + 'slug' => 'MonitoringSites', | |
| 417 | + 'href' => 'admin.php?page=MonitoringSites', | |
| 418 | + 'leftsub_order_level2' => 0.5, | |
| 419 | + 'level' => 2, | |
| 420 | + ); | |
| 375 | 421 | |
| 376 | - self::add_extension_menu( | |
| 377 | - array( | |
| 378 | - 'title' => esc_html__( 'Fathom', 'mainwp' ), | |
| 379 | - 'slug' => 'mainwp-fathom-extension/mainwp-fathom-extension.php', | |
| 380 | - 'parent_key' => 'Extensions-Mainwp-Analytics', | |
| 381 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Fathom-Extension', | |
| 382 | - 'leftsub_order_level2' => 2, | |
| 383 | - 'level' => 2, | |
| 384 | - 'active_path' => array( 'Extensions-Mainwp-Fathom-Extension' => 'managesites' ), | |
| 385 | - ), | |
| 386 | - ); | |
| 422 | + $extensions_and_leftmenus[] = array( | |
| 423 | + 'type' => 'extension', | |
| 424 | + 'title' => esc_html__( 'Advanced Uptime Monitor', 'mainwp' ), | |
| 425 | + 'slug' => 'advanced-uptime-monitor-extension/advanced-uptime-monitor-extension.php', | |
| 426 | + 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 427 | + 'ext_page' => 'admin.php?page=Extensions-Advanced-Uptime-Monitor-Extension', | |
| 428 | + 'leftsub_order_level2' => 1, | |
| 429 | + 'level' => 2, | |
| 430 | + 'active_path' => array( 'Extensions-Advanced-Uptime-Monitor-Extension' => 'managesites' ), | |
| 431 | + ); | |
| 387 | 432 | |
| 388 | - self::add_extension_menu( | |
| 389 | - array( | |
| 390 | - 'title' => esc_html__( 'Matomo', 'mainwp' ), | |
| 391 | - 'slug' => 'mainwp-piwik-extension/mainwp-piwik-extension.php', | |
| 392 | - 'parent_key' => 'Extensions-Mainwp-Analytics', | |
| 393 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Piwik-Extension', | |
| 394 | - 'leftsub_order_level2' => 3, | |
| 395 | - 'level' => 2, | |
| 396 | - 'active_path' => array( 'Extensions-Mainwp-Piwik-Extension' => 'managesites' ), | |
| 397 | - ), | |
| 398 | - ); | |
| 433 | + $extensions_and_leftmenus[] = array( | |
| 434 | + 'type' => 'extension', | |
| 435 | + 'title' => esc_html__( 'SSL Monitor', 'mainwp' ), | |
| 436 | + 'slug' => 'mainwp-ssl-monitor-extension/mainwp-ssl-monitor-extension.php', | |
| 437 | + 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 438 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Ssl-Monitor-Extension', | |
| 439 | + 'leftsub_order_level2' => 2, | |
| 440 | + 'level' => 2, | |
| 441 | + 'active_path' => array( 'Extensions-Mainwp-Ssl-Monitor-Extension' => 'managesites' ), | |
| 442 | + ); | |
| 399 | 443 | |
| 400 | - MainWP_Menu::add_left_menu( | |
| 401 | - array( | |
| 402 | - 'title' => esc_html__( 'Monitoring', 'mainwp' ), | |
| 403 | - 'parent_key' => 'managesites', | |
| 404 | - 'slug' => 'Extensions-Mainwp-Monitoring', | |
| 405 | - 'href' => 'admin.php?page=Extensions-Mainwp-Monitoring', | |
| 406 | - 'leftsub_order' => 8.4, | |
| 407 | - 'id' => 'mainwp-monitoring-extensions-category', | |
| 408 | - ), | |
| 409 | - 1 | |
| 410 | - ); | |
| 444 | + $extensions_and_leftmenus[] = array( | |
| 445 | + 'type' => 'extension', | |
| 446 | + 'title' => esc_html__( 'Domain Monitor', 'mainwp' ), | |
| 447 | + 'slug' => 'mainwp-domain-monitor-extension/mainwp-domain-monitor-extension.php', | |
| 448 | + 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 449 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Domain-Monitor-Extension', | |
| 450 | + 'leftsub_order_level2' => 3, | |
| 451 | + 'level' => 2, | |
| 452 | + 'active_path' => array( 'Extensions-Mainwp-Domain-Monitor-Extension' => 'managesites' ), | |
| 453 | + ); | |
| 411 | 454 | |
| 412 | - MainWP_Menu::add_left_menu( | |
| 413 | - array( | |
| 414 | - 'title' => esc_html__( 'Basic Monitoring', 'mainwp' ), | |
| 415 | - 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 416 | - 'slug' => 'MonitoringSites', | |
| 417 | - 'href' => 'admin.php?page=MonitoringSites', | |
| 418 | - 'leftsub_order_level2' => 0.5, | |
| 419 | - ), | |
| 420 | - 2 | |
| 421 | - ); | |
| 455 | + $extensions_and_leftmenus[] = array( | |
| 456 | + 'type' => 'extension', | |
| 457 | + 'title' => esc_html__( 'Lighthouse', 'mainwp' ), | |
| 458 | + 'slug' => 'mainwp-lighthouse-extension/mainwp-lighthouse-extension.php', | |
| 459 | + 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 460 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Lighthouse-Extension', | |
| 461 | + 'leftsub_order_level2' => 4, | |
| 462 | + 'level' => 2, | |
| 463 | + 'active_path' => array( 'Extensions-Mainwp-Lighthouse-Extension' => 'managesites' ), | |
| 464 | + ); | |
| 422 | 465 | |
| 423 | - self::add_extension_menu( | |
| 424 | - array( | |
| 425 | - 'title' => esc_html__( 'Advanced Uptime Monitor', 'mainwp' ), | |
| 426 | - 'slug' => 'advanced-uptime-monitor-extension/advanced-uptime-monitor-extension.php', | |
| 427 | - 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 428 | - 'ext_page' => 'admin.php?page=Extensions-Advanced-Uptime-Monitor-Extension', | |
| 429 | - 'leftsub_order_level2' => 1, | |
| 430 | - 'level' => 2, | |
| 431 | - 'active_path' => array( 'Extensions-Advanced-Uptime-Monitor-Extension' => 'managesites' ), | |
| 432 | - ), | |
| 433 | - ); | |
| 466 | + $extensions_and_leftmenus[] = array( | |
| 467 | + 'type' => 'extension', | |
| 468 | + 'title' => esc_html__( 'WooCommerce Status', 'mainwp' ), | |
| 469 | + 'slug' => 'mainwp-woocommerce-status-extension/mainwp-woocommerce-status-extension.php', | |
| 470 | + 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 471 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Woocommerce-Status-Extension', | |
| 472 | + 'leftsub_order_level2' => 2, | |
| 473 | + 'level' => 2, | |
| 474 | + 'active_path' => array( 'Extensions-Mainwp-Woocommerce-Status-Extension' => 'managesites' ), | |
| 475 | + ); | |
| 434 | 476 | |
| 435 | - self::add_extension_menu( | |
| 436 | - array( | |
| 437 | - 'title' => esc_html__( 'SSL Monitor', 'mainwp' ), | |
| 438 | - 'slug' => 'mainwp-ssl-monitor-extension/mainwp-ssl-monitor-extension.php', | |
| 439 | - 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 440 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Ssl-Monitor-Extension', | |
| 441 | - 'leftsub_order_level2' => 2, | |
| 442 | - 'level' => 2, | |
| 443 | - 'active_path' => array( 'Extensions-Mainwp-Ssl-Monitor-Extension' => 'managesites' ), | |
| 444 | - ), | |
| 445 | - ); | |
| 477 | + $extensions_and_leftmenus[] = array( | |
| 478 | + 'title' => esc_html__( 'Agency', 'mainwp' ), | |
| 479 | + 'parent_key' => 'managesites', | |
| 480 | + 'slug' => 'Extensions-Mainwp-Agency', | |
| 481 | + 'href' => 'admin.php?page=Extensions-Mainwp-Agency', | |
| 482 | + 'leftsub_order' => 8.4, | |
| 483 | + 'id' => 'mainwp-agency-extensions-category', | |
| 484 | + 'level' => 1, | |
| 485 | + ); | |
| 446 | 486 | |
| 447 | - self::add_extension_menu( | |
| 448 | - array( | |
| 449 | - 'title' => esc_html__( 'Domain Monitor', 'mainwp' ), | |
| 450 | - 'slug' => 'mainwp-domain-monitor-extension/mainwp-domain-monitor-extension.php', | |
| 451 | - 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 452 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Domain-Monitor-Extension', | |
| 453 | - 'leftsub_order_level2' => 3, | |
| 454 | - 'level' => 2, | |
| 455 | - 'active_path' => array( 'Extensions-Mainwp-Domain-Monitor-Extension' => 'managesites' ), | |
| 456 | - ), | |
| 457 | - ); | |
| 487 | + $extensions_and_leftmenus[] = array( | |
| 488 | + 'type' => 'extension', | |
| 489 | + 'title' => esc_html__( 'White Label', 'mainwp' ), | |
| 490 | + 'slug' => 'mainwp-branding-extension/mainwp-branding-extension.php', | |
| 491 | + 'parent_key' => 'Extensions-Mainwp-Agency', | |
| 492 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Branding-Extension', | |
| 493 | + 'leftsub_order_level2' => 1, | |
| 494 | + 'level' => 2, | |
| 495 | + 'active_path' => array( 'Extensions-Mainwp-Branding-Extension' => 'managesites' ), | |
| 496 | + ); | |
| 458 | 497 | |
| 459 | - self::add_extension_menu( | |
| 460 | - array( | |
| 461 | - 'title' => esc_html__( 'Lighthouse', 'mainwp' ), | |
| 462 | - 'slug' => 'mainwp-lighthouse-extension/mainwp-lighthouse-extension.php', | |
| 463 | - 'parent_key' => 'Extensions-Mainwp-Monitoring', | |
| 464 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Lighthouse-Extension', | |
| 465 | - 'leftsub_order_level2' => 4, | |
| 466 | - 'level' => 2, | |
| 467 | - 'active_path' => array( 'Extensions-Mainwp-Lighthouse-Extension' => 'managesites' ), | |
| 468 | - ), | |
| 469 | - ); | |
| 498 | + $extensions_and_leftmenus[] = array( | |
| 499 | + 'type' => 'extension', | |
| 500 | + 'title' => esc_html__( 'Team Control', 'mainwp' ), | |
| 501 | + 'slug' => 'mainwp-team-control/mainwp-team-control.php', | |
| 502 | + 'parent_key' => 'Extensions-Mainwp-Agency', | |
| 503 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Team-Control', | |
| 504 | + 'leftsub_order_level2' => 2, | |
| 505 | + 'level' => 2, | |
| 506 | + 'active_path' => array( 'Extensions-Mainwp-Team-Control' => 'managesites' ), | |
| 507 | + ); | |
| 470 | 508 | |
| 471 | - MainWP_Menu::add_left_menu( | |
| 472 | - array( | |
| 473 | - 'title' => esc_html__( 'Agency', 'mainwp' ), | |
| 474 | - 'parent_key' => 'managesites', | |
| 475 | - 'slug' => 'Extensions-Mainwp-Agency', | |
| 476 | - 'href' => 'admin.php?page=Extensions-Mainwp-Agency', | |
| 477 | - 'leftsub_order' => 8.4, | |
| 478 | - 'id' => 'mainwp-agency-extensions-category', | |
| 479 | - ), | |
| 480 | - 1 | |
| 481 | - ); | |
| 509 | + $extensions_and_leftmenus[] = array( | |
| 510 | + 'title' => esc_html__( 'Administrative', 'mainwp' ), | |
| 511 | + 'parent_key' => 'managesites', | |
| 512 | + 'slug' => 'Extensions-Mainwp-Administrative', | |
| 513 | + 'href' => 'admin.php?page=Extensions-Mainwp-Administrative', | |
| 514 | + 'leftsub_order' => 8.5, | |
| 515 | + 'id' => 'mainwp-administrative-extensions-category', | |
| 516 | + 'level' => 1, | |
| 517 | + ); | |
| 482 | 518 | |
| 483 | - self::add_extension_menu( | |
| 484 | - array( | |
| 485 | - 'title' => esc_html__( 'White Label', 'mainwp' ), | |
| 486 | - 'slug' => 'mainwp-branding-extension/mainwp-branding-extension.php', | |
| 487 | - 'parent_key' => 'Extensions-Mainwp-Agency', | |
| 488 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Branding-Extension', | |
| 489 | - 'leftsub_order_level2' => 1, | |
| 490 | - 'level' => 2, | |
| 491 | - 'active_path' => array( 'Extensions-Mainwp-Branding-Extension' => 'managesites' ), | |
| 492 | - ), | |
| 493 | - ); | |
| 519 | + $extensions_and_leftmenus[] = array( | |
| 520 | + 'type' => 'extension', | |
| 521 | + 'title' => esc_html__( 'Atarim', 'mainwp' ), | |
| 522 | + 'slug' => 'mainwp-atarim-extension/mainwp-atarim-extension.php', | |
| 523 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 524 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Atarim-Extension', | |
| 525 | + 'leftsub_order_level2' => 1, | |
| 526 | + 'level' => 2, | |
| 527 | + 'active_path' => array( 'Extensions-Mainwp-Atarim-Extension' => 'managesites' ), | |
| 528 | + ); | |
| 494 | 529 | |
| 495 | - self::add_extension_menu( | |
| 496 | - array( | |
| 497 | - 'title' => esc_html__( 'Team Control', 'mainwp' ), | |
| 498 | - 'slug' => 'mainwp-team-control/mainwp-team-control.php', | |
| 499 | - 'parent_key' => 'Extensions-Mainwp-Agency', | |
| 500 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Team-Control', | |
| 501 | - 'leftsub_order_level2' => 2, | |
| 502 | - 'level' => 2, | |
| 503 | - 'active_path' => array( 'Extensions-Mainwp-Team-Control' => 'managesites' ), | |
| 504 | - ), | |
| 505 | - ); | |
| 530 | + $extensions_and_leftmenus[] = array( | |
| 531 | + 'type' => 'extension', | |
| 532 | + 'title' => esc_html__( 'Bulk Settings Manager', 'mainwp' ), | |
| 533 | + 'slug' => 'mainwp-bulk-settings-manager/mainwp-bulk-settings-manager.php', | |
| 534 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 535 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Bulk-Settings-Manager', | |
| 536 | + 'leftsub_order_level2' => 2, | |
| 537 | + 'level' => 2, | |
| 538 | + 'active_path' => array( 'Extensions-Mainwp-Bulk-Settings-Manager' => 'managesites' ), | |
| 539 | + ); | |
| 506 | 540 | |
| 507 | - MainWP_Menu::add_left_menu( | |
| 508 | - array( | |
| 509 | - 'title' => esc_html__( 'Administrative', 'mainwp' ), | |
| 510 | - 'parent_key' => 'managesites', | |
| 511 | - 'slug' => 'Extensions-Mainwp-Administrative', | |
| 512 | - 'href' => 'admin.php?page=Extensions-Mainwp-Administrative', | |
| 513 | - 'leftsub_order' => 8.5, | |
| 514 | - 'id' => 'mainwp-administrative-extensions-category', | |
| 515 | - ), | |
| 516 | - 1 | |
| 517 | - ); | |
| 541 | + $extensions_and_leftmenus[] = array( | |
| 542 | + 'type' => 'extension', | |
| 543 | + 'title' => esc_html__( 'Code Snippets', 'mainwp' ), | |
| 544 | + 'slug' => 'mainwp-code-snippets-extension/mainwp-code-snippets-extension.php', | |
| 545 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 546 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Code-Snippets-Extension', | |
| 547 | + 'leftsub_order_level2' => 3, | |
| 548 | + 'level' => 2, | |
| 549 | + 'active_path' => array( 'Extensions-Mainwp-Code-Snippets-Extension' => 'managesites' ), | |
| 550 | + ); | |
| 551 | + $extensions_and_leftmenus[] = array( | |
| 552 | + 'type' => 'extension', | |
| 553 | + 'title' => esc_html__( 'Custom Dashboard', 'mainwp' ), | |
| 554 | + 'slug' => 'mainwp-custom-dashboard-extension/mainwp-custom-dashboard-extension.php', | |
| 555 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 556 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Custom-Dashboard-Extension', | |
| 557 | + 'leftsub_order_level2' => 4, | |
| 558 | + 'level' => 2, | |
| 559 | + 'active_path' => array( 'Extensions-Mainwp-Custom-Dashboard-Extension' => 'managesites' ), | |
| 560 | + ); | |
| 518 | 561 | |
| 519 | - self::add_extension_menu( | |
| 520 | - array( | |
| 521 | - 'title' => esc_html__( 'WooCommerce Shortcuts', 'mainwp' ), | |
| 522 | - 'slug' => 'mainwp-woocommerce-shortcuts-extension/mainwp-woocommerce-shortcuts-extension.php', | |
| 523 | - 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 524 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Woocommerce-Shortcuts-Extension', | |
| 525 | - 'leftsub_order_level2' => 1, | |
| 526 | - 'level' => 2, | |
| 527 | - 'active_path' => array( 'Extensions-Mainwp-Woocommerce-Shortcuts-Extension' => 'managesites' ), | |
| 528 | - ), | |
| 529 | - ); | |
| 562 | + $extensions_and_leftmenus[] = array( | |
| 563 | + 'type' => 'extension', | |
| 564 | + 'title' => esc_html__( 'Custom Post Type', 'mainwp' ), | |
| 565 | + 'slug' => 'mainwp-custom-post-types/mainwp-custom-post-types.php', | |
| 566 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 567 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Custom-Post-Types', | |
| 568 | + 'leftsub_order_level2' => 5, | |
| 569 | + 'level' => 2, | |
| 570 | + 'active_path' => array( 'Extensions-Mainwp-Custom-Post-Types' => 'managesites' ), | |
| 571 | + ); | |
| 530 | 572 | |
| 531 | - self::add_extension_menu( | |
| 532 | - array( | |
| 533 | - 'title' => esc_html__( 'WooCommerce Status', 'mainwp' ), | |
| 534 | - 'slug' => 'mainwp-woocommerce-status-extension/mainwp-woocommerce-status-extension.php', | |
| 535 | - 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 536 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Woocommerce-Status-Extension', | |
| 537 | - 'leftsub_order_level2' => 2, | |
| 538 | - 'level' => 2, | |
| 539 | - 'active_path' => array( 'Extensions-Mainwp-Woocommerce-Status-Extension' => 'managesites' ), | |
| 540 | - ), | |
| 541 | - ); | |
| 573 | + $extensions_and_leftmenus[] = array( | |
| 574 | + 'type' => 'extension', | |
| 575 | + 'title' => esc_html__( 'File Uploader', 'mainwp' ), | |
| 576 | + 'slug' => 'mainwp-file-uploader-extension/mainwp-file-uploader-extension.php', | |
| 577 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 578 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-File-Uploader-Extension', | |
| 579 | + 'leftsub_order_level2' => 6, | |
| 580 | + 'level' => 2, | |
| 581 | + 'active_path' => array( 'Extensions-Mainwp-File-Uploader-Extension' => 'managesites' ), | |
| 582 | + ); | |
| 542 | 583 | |
| 543 | - MainWP_Menu::add_left_menu( | |
| 544 | - array( | |
| 545 | - 'title' => esc_html__( 'Development', 'mainwp' ), | |
| 546 | - 'parent_key' => 'managesites', | |
| 547 | - 'slug' => 'Extensions-Mainwp-Development', | |
| 548 | - 'href' => 'admin.php?page=Extensions-Mainwp-Development', | |
| 549 | - 'leftsub_order' => 8.6, | |
| 550 | - 'id' => 'mainwp-development-extensions-category', | |
| 551 | - ), | |
| 552 | - 1 | |
| 553 | - ); | |
| 584 | + $extensions_and_leftmenus[] = array( | |
| 585 | + 'type' => 'extension', | |
| 586 | + 'title' => esc_html__( 'Pressable', 'mainwp' ), | |
| 587 | + 'slug' => 'mainwp-pressable-extension/mainwp-pressable-extension.php', | |
| 588 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 589 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Pressable-Extension', | |
| 590 | + 'leftsub_order_level2' => 7, | |
| 591 | + 'level' => 2, | |
| 592 | + 'active_path' => array( 'Extensions-Mainwp-Pressable-Extension' => 'managesites' ), | |
| 593 | + ); | |
| 554 | 594 | |
| 555 | - self::add_extension_menu( | |
| 556 | - array( | |
| 557 | - 'title' => esc_html__( 'Atarim', 'mainwp' ), | |
| 558 | - 'slug' => 'mainwp-atarim-extension/mainwp-atarim-extension.php', | |
| 559 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 560 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Atarim-Extension', | |
| 561 | - 'leftsub_order_level2' => 1, | |
| 562 | - 'level' => 2, | |
| 563 | - 'active_path' => array( 'Extensions-Mainwp-Atarim-Extension' => 'managesites' ), | |
| 564 | - ), | |
| 565 | - ); | |
| 595 | + $extensions_and_leftmenus[] = array( | |
| 596 | + 'type' => 'extension', | |
| 597 | + 'title' => esc_html__( 'Staging', 'mainwp' ), | |
| 598 | + 'slug' => 'mainwp-staging-extension/mainwp-staging-extension.php', | |
| 599 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 600 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Staging-Extension', | |
| 601 | + 'leftsub_order_level2' => 8, | |
| 602 | + 'level' => 2, | |
| 603 | + 'active_path' => array( 'Extensions-Mainwp-Staging-Extension' => 'managesites' ), | |
| 604 | + ); | |
| 566 | 605 | |
| 567 | - self::add_extension_menu( | |
| 568 | - array( | |
| 569 | - 'title' => esc_html__( 'Bulk Settings Manager', 'mainwp' ), | |
| 570 | - 'slug' => 'mainwp-bulk-settings-manager/mainwp-bulk-settings-manager.php', | |
| 571 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 572 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Bulk-Settings-Manager', | |
| 573 | - 'leftsub_order_level2' => 2, | |
| 574 | - 'level' => 2, | |
| 575 | - 'active_path' => array( 'Extensions-Mainwp-Bulk-Settings-Manager' => 'managesites' ), | |
| 576 | - ), | |
| 577 | - ); | |
| 606 | + $extensions_and_leftmenus[] = array( | |
| 607 | + 'type' => 'extension', | |
| 608 | + 'title' => esc_html__( 'URL Extractor', 'mainwp' ), | |
| 609 | + 'slug' => 'mainwp-url-extractor-extension/mainwp-url-extractor-extension.php', | |
| 610 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 611 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Url-Extractor-Extension', | |
| 612 | + 'leftsub_order_level2' => 9, | |
| 613 | + 'level' => 2, | |
| 614 | + 'active_path' => array( 'Extensions-Mainwp-Url-Extractor-Extension' => 'managesites' ), | |
| 615 | + ); | |
| 578 | 616 | |
| 579 | - self::add_extension_menu( | |
| 580 | - array( | |
| 581 | - 'title' => esc_html__( 'Code Snippets', 'mainwp' ), | |
| 582 | - 'slug' => 'mainwp-code-snippets-extension/mainwp-code-snippets-extension.php', | |
| 583 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 584 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Code-Snippets-Extension', | |
| 585 | - 'leftsub_order_level2' => 3, | |
| 586 | - 'level' => 2, | |
| 587 | - 'active_path' => array( 'Extensions-Mainwp-Code-Snippets-Extension' => 'managesites' ), | |
| 588 | - ), | |
| 589 | - ); | |
| 617 | + $extensions_and_leftmenus[] = array( | |
| 618 | + 'type' => 'extension', | |
| 619 | + 'title' => esc_html__( 'WooCommerce Shortcuts', 'mainwp' ), | |
| 620 | + 'slug' => 'mainwp-woocommerce-shortcuts-extension/mainwp-woocommerce-shortcuts-extension.php', | |
| 621 | + 'parent_key' => 'Extensions-Mainwp-Administrative', | |
| 622 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Woocommerce-Shortcuts-Extension', | |
| 623 | + 'leftsub_order_level2' => 1, | |
| 624 | + 'level' => 2, | |
| 625 | + 'active_path' => array( 'Extensions-Mainwp-Woocommerce-Shortcuts-Extension' => 'managesites' ), | |
| 626 | + ); | |
| 590 | 627 | |
| 591 | - self::add_extension_menu( | |
| 592 | - array( | |
| 593 | - 'title' => esc_html__( 'Custom Dashboard', 'mainwp' ), | |
| 594 | - 'slug' => 'mainwp-custom-dashboard-extension/mainwp-custom-dashboard-extension.php', | |
| 595 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 596 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Custom-Dashboard-Extension', | |
| 597 | - 'leftsub_order_level2' => 4, | |
| 598 | - 'level' => 2, | |
| 599 | - 'active_path' => array( 'Extensions-Mainwp-Custom-Dashboard-Extension' => 'managesites' ), | |
| 600 | - ), | |
| 601 | - ); | |
| 628 | + $extensions_and_leftmenus[] = array( | |
| 629 | + 'title' => esc_html__( 'Performance', 'mainwp' ), | |
| 630 | + 'parent_key' => 'managesites', | |
| 631 | + 'slug' => 'Extensions-Mainwp-Performance', | |
| 632 | + 'href' => 'admin.php?page=Extensions-Mainwp-Performance', | |
| 633 | + 'leftsub_order' => 8.6, | |
| 634 | + 'id' => 'mainwp-performance-extensions-category', | |
| 635 | + 'level' => 1, | |
| 636 | + ); | |
| 602 | 637 | |
| 603 | - self::add_extension_menu( | |
| 604 | - array( | |
| 605 | - 'title' => esc_html__( 'Custom Post Type', 'mainwp' ), | |
| 606 | - 'slug' => 'mainwp-custom-post-types/mainwp-custom-post-types.php', | |
| 607 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 608 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Custom-Post-Types', | |
| 609 | - 'leftsub_order_level2' => 5, | |
| 610 | - 'level' => 2, | |
| 611 | - 'active_path' => array( 'Extensions-Mainwp-Custom-Post-Types' => 'managesites' ), | |
| 612 | - ), | |
| 613 | - ); | |
| 638 | + $extensions_and_leftmenus[] = array( | |
| 639 | + 'type' => 'extension', | |
| 640 | + 'title' => esc_html__( 'Cache Control', 'mainwp' ), | |
| 641 | + 'slug' => 'mainwp-cache-control-extension/mainwp-cache-control-extension.php', | |
| 642 | + 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 643 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Cache-Control-Extension', | |
| 644 | + 'leftsub_order_level2' => 1, | |
| 645 | + 'level' => 2, | |
| 646 | + 'active_path' => array( 'Extensions-Mainwp-Cache-Control-Extension' => 'managesites' ), | |
| 647 | + ); | |
| 614 | 648 | |
| 615 | - self::add_extension_menu( | |
| 616 | - array( | |
| 617 | - 'title' => esc_html__( 'File Uploader', 'mainwp' ), | |
| 618 | - 'slug' => 'mainwp-file-uploader-extension/mainwp-file-uploader-extension.php', | |
| 619 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 620 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-File-Uploader-Extension', | |
| 621 | - 'leftsub_order_level2' => 6, | |
| 622 | - 'level' => 2, | |
| 623 | - 'active_path' => array( 'Extensions-Mainwp-File-Uploader-Extension' => 'managesites' ), | |
| 624 | - ), | |
| 625 | - ); | |
| 649 | + $extensions_and_leftmenus[] = array( | |
| 650 | + 'type' => 'extension', | |
| 651 | + 'title' => esc_html__( 'Maintenance', 'mainwp' ), | |
| 652 | + 'slug' => 'mainwp-maintenance-extension/mainwp-maintenance-extension.php', | |
| 653 | + 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 654 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Maintenance-Extension', | |
| 655 | + 'leftsub_order_level2' => 2, | |
| 656 | + 'level' => 2, | |
| 657 | + 'active_path' => array( 'Extensions-Mainwp-Maintenance-Extension' => 'managesites' ), | |
| 658 | + ); | |
| 626 | 659 | |
| 627 | - self::add_extension_menu( | |
| 628 | - array( | |
| 629 | - 'title' => esc_html__( 'Pressable', 'mainwp' ), | |
| 630 | - 'slug' => 'mainwp-pressable-extension/mainwp-pressable-extension.php', | |
| 631 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 632 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Pressable-Extension', | |
| 633 | - 'leftsub_order_level2' => 7, | |
| 634 | - 'level' => 2, | |
| 635 | - 'active_path' => array( 'Extensions-Mainwp-Pressable-Extension' => 'managesites' ), | |
| 636 | - ), | |
| 637 | - ); | |
| 660 | + $extensions_and_leftmenus[] = array( | |
| 661 | + 'type' => 'extension', | |
| 662 | + 'title' => esc_html__( 'Rocket', 'mainwp' ), | |
| 663 | + 'slug' => 'mainwp-rocket-extension/mainwp-rocket-extension.php', | |
| 664 | + 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 665 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Rocket-Extension', | |
| 666 | + 'leftsub_order_level2' => 3, | |
| 667 | + 'level' => 2, | |
| 668 | + 'active_path' => array( 'Extensions-Mainwp-Rocket-Extension' => 'managesites' ), | |
| 669 | + ); | |
| 638 | 670 | |
| 639 | - self::add_extension_menu( | |
| 640 | - array( | |
| 641 | - 'title' => esc_html__( 'Staging', 'mainwp' ), | |
| 642 | - 'slug' => 'mainwp-staging-extension/mainwp-staging-extension.php', | |
| 643 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 644 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Staging-Extension', | |
| 645 | - 'leftsub_order_level2' => 8, | |
| 646 | - 'level' => 2, | |
| 647 | - 'active_path' => array( 'Extensions-Mainwp-Staging-Extension' => 'managesites' ), | |
| 648 | - ), | |
| 649 | - ); | |
| 671 | + $extensions_and_leftmenus[] = array( | |
| 672 | + 'type' => 'extension', | |
| 673 | + 'title' => esc_html__( 'WP Compress', 'mainwp' ), | |
| 674 | + 'slug' => 'wp-compress-mainwp/wp-compress-main-wp.php', | |
| 675 | + 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 676 | + 'ext_page' => 'admin.php?page=Extensions-Wp-Compress-Mainwp', | |
| 677 | + 'leftsub_order_level2' => 4, | |
| 678 | + 'level' => 2, | |
| 679 | + 'active_path' => array( 'Extensions-Wp-Compress-Mainwp' => 'managesites' ), | |
| 680 | + ); | |
| 650 | 681 | |
| 651 | - self::add_extension_menu( | |
| 652 | - array( | |
| 653 | - 'title' => esc_html__( 'URL Extractor', 'mainwp' ), | |
| 654 | - 'slug' => 'mainwp-url-extractor-extension/mainwp-url-extractor-extension.php', | |
| 655 | - 'parent_key' => 'Extensions-Mainwp-Development', | |
| 656 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Url-Extractor-Extension', | |
| 657 | - 'leftsub_order_level2' => 9, | |
| 658 | - 'level' => 2, | |
| 659 | - 'active_path' => array( 'Extensions-Mainwp-Url-Extractor-Extension' => 'managesites' ), | |
| 660 | - ), | |
| 661 | - ); | |
| 682 | + $extensions_and_leftmenus[] = array( | |
| 683 | + 'type' => 'extension', | |
| 684 | + 'title' => esc_html__( 'Comments', 'mainwp' ), | |
| 685 | + 'slug' => 'mainwp-comments-extension/mainwp-comments-extension.php', | |
| 686 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 687 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Comments-Extension', | |
| 688 | + 'leftsub_order_level2' => 2.1, | |
| 689 | + 'level' => 2, | |
| 690 | + 'active_path' => array( 'Extensions-Mainwp-Comments-Extension' => 'managesites' ), | |
| 691 | + ); | |
| 662 | 692 | |
| 663 | - MainWP_Menu::add_left_menu( | |
| 664 | - array( | |
| 665 | - 'title' => esc_html__( 'Performance', 'mainwp' ), | |
| 666 | - 'parent_key' => 'managesites', | |
| 667 | - 'slug' => 'Extensions-Mainwp-Performance', | |
| 668 | - 'href' => 'admin.php?page=Extensions-Mainwp-Performance', | |
| 669 | - 'leftsub_order' => 8.6, | |
| 670 | - 'id' => 'mainwp-performance-extensions-category', | |
| 671 | - ), | |
| 672 | - 1 | |
| 673 | - ); | |
| 693 | + $extensions_and_leftmenus[] = array( | |
| 694 | + 'type' => 'extension', | |
| 695 | + 'title' => esc_html__( 'Clone', 'mainwp' ), | |
| 696 | + 'slug' => 'mainwp-clone-extension/mainwp-clone-extension.php', | |
| 697 | + 'parent_key' => 'managesites', | |
| 698 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Clone-Extension', | |
| 699 | + 'leftsub_order_level2' => 5, | |
| 700 | + 'level' => 2, | |
| 701 | + 'active_path' => array( 'Extensions-Mainwp-Clone-Extension' => 'managesites' ), | |
| 702 | + ); | |
| 674 | 703 | |
| 675 | - self::add_extension_menu( | |
| 676 | - array( | |
| 677 | - 'title' => esc_html__( 'Cache Control', 'mainwp' ), | |
| 678 | - 'slug' => 'mainwp-cache-control-extension/mainwp-cache-control-extension.php', | |
| 679 | - 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 680 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Cache-Control-Extension', | |
| 681 | - 'leftsub_order_level2' => 1, | |
| 682 | - 'level' => 2, | |
| 683 | - 'active_path' => array( 'Extensions-Mainwp-Cache-Control-Extension' => 'managesites' ), | |
| 684 | - ), | |
| 685 | - ); | |
| 704 | + $extensions_and_leftmenus[] = array( | |
| 705 | + 'type' => 'extension', | |
| 706 | + 'title' => esc_html__( 'Article Uploader', 'mainwp' ), | |
| 707 | + 'slug' => 'mainwp-article-uploader-extension/mainwp-article-uploader-extension.php', | |
| 708 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 709 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Article-Uploader-Extension', | |
| 710 | + 'leftsub_order_level2' => 3, | |
| 711 | + 'level' => 2, | |
| 712 | + 'active_path' => array( 'Extensions-Mainwp-Article-Uploader-Extension' => 'managesites' ), | |
| 713 | + ); | |
| 686 | 714 | |
| 687 | - self::add_extension_menu( | |
| 688 | - array( | |
| 689 | - 'title' => esc_html__( 'Maintenance', 'mainwp' ), | |
| 690 | - 'slug' => 'mainwp-maintenance-extension/mainwp-maintenance-extension.php', | |
| 691 | - 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 692 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Maintenance-Extension', | |
| 693 | - 'leftsub_order_level2' => 2, | |
| 694 | - 'level' => 2, | |
| 695 | - 'active_path' => array( 'Extensions-Mainwp-Maintenance-Extension' => 'managesites' ), | |
| 696 | - ), | |
| 697 | - ); | |
| 715 | + $extensions_and_leftmenus[] = array( | |
| 716 | + 'type' => 'extension', | |
| 717 | + 'title' => esc_html__( 'Manage Boilerplates', 'mainwp' ), | |
| 718 | + 'slug' => 'boilerplate-extension/boilerplate-extension.php', | |
| 719 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 720 | + 'ext_page' => 'admin.php?page=Extensions-Boilerplate-Extension', | |
| 721 | + 'leftsub_order_level2' => 2, | |
| 722 | + 'level' => 2, | |
| 723 | + 'active_path' => array( 'Extensions-Boilerplate-Extension' => 'managesites' ), | |
| 724 | + ); | |
| 698 | 725 | |
| 699 | - self::add_extension_menu( | |
| 700 | - array( | |
| 701 | - 'title' => esc_html__( 'Rocket', 'mainwp' ), | |
| 702 | - 'slug' => 'mainwp-rocket-extension/mainwp-rocket-extension.php', | |
| 703 | - 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 704 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Rocket-Extension', | |
| 705 | - 'leftsub_order_level2' => 3, | |
| 706 | - 'level' => 2, | |
| 707 | - 'active_path' => array( 'Extensions-Mainwp-Rocket-Extension' => 'managesites' ), | |
| 708 | - ), | |
| 709 | - ); | |
| 726 | + $extensions_and_leftmenus[] = array( | |
| 727 | + 'type' => 'extension', | |
| 728 | + 'title' => esc_html__( 'Post Dripper', 'mainwp' ), | |
| 729 | + 'slug' => 'mainwp-post-dripper-extension/mainwp-post-dripper-extension.php', | |
| 730 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 731 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Post-Dripper-Extension', | |
| 732 | + 'leftsub_order_level2' => 4, | |
| 733 | + 'level' => 2, | |
| 734 | + ); | |
| 710 | 735 | |
| 711 | - self::add_extension_menu( | |
| 712 | - array( | |
| 713 | - 'title' => esc_html__( 'WP Compress', 'mainwp' ), | |
| 714 | - 'slug' => 'wp-compress-mainwp/wp-compress-main-wp.php', | |
| 715 | - 'parent_key' => 'Extensions-Mainwp-Performance', | |
| 716 | - 'ext_page' => 'admin.php?page=Extensions-Wp-Compress-Mainwp', | |
| 717 | - 'leftsub_order_level2' => 4, | |
| 718 | - 'level' => 2, | |
| 719 | - 'active_path' => array( 'Extensions-Wp-Compress-Mainwp' => 'managesites' ), | |
| 720 | - ), | |
| 721 | - ); | |
| 736 | + $extensions_and_leftmenus[] = array( | |
| 737 | + 'type' => 'extension', | |
| 738 | + 'title' => esc_html__( 'Post Plus', 'mainwp' ), | |
| 739 | + 'slug' => 'mainwp-post-plus-extension/mainwp-post-plus-extension.php', | |
| 740 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 741 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Post-Plus-Extension', | |
| 742 | + 'leftsub_order_level2' => 5, | |
| 743 | + 'level' => 2, | |
| 744 | + ); | |
| 722 | 745 | |
| 723 | - self::add_extension_menu( | |
| 724 | - array( | |
| 725 | - 'title' => esc_html__( 'Comments', 'mainwp' ), | |
| 726 | - 'slug' => 'mainwp-comments-extension/mainwp-comments-extension.php', | |
| 727 | - 'parent_key' => 'PostBulkManage', | |
| 728 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Comments-Extension', | |
| 729 | - 'leftsub_order_level2' => 2.1, | |
| 730 | - 'level' => 2, | |
| 731 | - 'active_path' => array( 'Extensions-Mainwp-Comments-Extension' => 'managesites' ), | |
| 732 | - ), | |
| 733 | - ); | |
| 746 | + $extensions_and_leftmenus[] = array( | |
| 747 | + 'type' => 'extension', | |
| 748 | + 'title' => esc_html__( 'Pro Reports', 'mainwp' ), | |
| 749 | + 'slug' => 'mainwp-pro-reports-extension/mainwp-pro-reports-extension.php', | |
| 750 | + 'parent_key' => 'ManageClients', | |
| 751 | + 'ext_page' => 'admin.php?page=Extensions-Mainwp-Pro-Reports-Extension', | |
| 752 | + 'leftsub_order_level2' => 4, | |
| 753 | + 'level' => 2, | |
| 754 | + 'active_path' => array( 'Extensions-Mainwp-Pro-Reports-Extension' => 'ManageClients' ), | |
| 755 | + ); | |
| 734 | 756 | |
| 735 | - self::add_extension_menu( | |
| 736 | - array( | |
| 737 | - 'title' => esc_html__( 'Comments', 'mainwp' ), | |
| 738 | - 'slug' => 'mainwp-comments-extension/mainwp-comments-extension.php', | |
| 739 | - 'parent_key' => 'PageBulkManage', | |
| 740 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Comments-Extension', | |
| 741 | - 'leftsub_order_level2' => 2.1, | |
| 742 | - 'level' => 2, | |
| 743 | - 'active_path' => array( 'Extensions-Mainwp-Comments-Extension' => 'managesites' ), | |
| 744 | - ), | |
| 745 | - ); | |
| 757 | + if ( defined( 'MAINWP_MODULE_COST_TRACKER_ENABLED' ) && MAINWP_MODULE_COST_TRACKER_ENABLED ) { | |
| 758 | + $extensions_and_leftmenus[] = array( | |
| 759 | + 'type' => 'extension', | |
| 760 | + 'title' => esc_html__( 'Cost Tracker Assistant', 'mainwp' ), | |
| 761 | + 'slug' => 'mainwp-cost-tracker-assistant-extension/mainwp-cost-tracker-assistant-extension.php', | |
| 762 | + 'parent_key' => 'ManageCostTracker', | |
| 763 | + 'ext_page' => 'admin.php?page=ManageCostTracker', | |
| 764 | + 'leftsub_order_level2' => 4, | |
| 765 | + 'level' => 2, | |
| 766 | + ); | |
| 767 | + } | |
| 746 | 768 | |
| 747 | - self::add_extension_menu( | |
| 748 | - array( | |
| 749 | - 'title' => esc_html__( 'Clone', 'mainwp' ), | |
| 750 | - 'slug' => 'mainwp-clone-extension/mainwp-clone-extension.php', | |
| 751 | - 'parent_key' => 'managesites', | |
| 752 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Clone-Extension', | |
| 753 | - 'leftsub_order_level2' => 5, | |
| 754 | - 'level' => 2, | |
| 755 | - 'active_path' => array( 'Extensions-Mainwp-Clone-Extension' => 'managesites' ), | |
| 756 | - ), | |
| 757 | - ); | |
| 769 | + $extensions_and_leftmenus[] = array( | |
| 770 | + 'type' => 'extension', | |
| 771 | + 'title' => esc_html__( 'WordPress SEO', 'mainwp' ), | |
| 772 | + 'slug' => 'wordpress-seo-extension/wordpress-seo-extension.php', | |
| 773 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 774 | + 'ext_page' => 'admin.php?page=Extensions-Wordpress-Seo-Extension', | |
| 775 | + 'leftsub_order_level2' => 6, | |
| 776 | + 'level' => 2, | |
| 777 | + ); | |
| 758 | 778 | |
| 759 | - self::add_extension_menu( | |
| 760 | - array( | |
| 761 | - 'title' => esc_html__( 'Article Uploader', 'mainwp' ), | |
| 762 | - 'slug' => 'mainwp-article-uploader-extension/mainwp-article-uploader-extension.php', | |
| 763 | - 'parent_key' => 'PostBulkManage', | |
| 764 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Article-Uploader-Extension', | |
| 765 | - 'leftsub_order_level2' => 3, | |
| 766 | - 'level' => 2, | |
| 767 | - 'active_path' => array( 'Extensions-Mainwp-Article-Uploader-Extension' => 'managesites' ), | |
| 768 | - ), | |
| 769 | - ); | |
| 779 | + $extensions_and_leftmenus[] = array( | |
| 780 | + 'type' => 'extension', | |
| 781 | + 'title' => esc_html__( 'SEOPress', 'mainwp' ), | |
| 782 | + 'slug' => 'seopress-for-mainwp/seopress-for-mainwp.php', | |
| 783 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 784 | + 'ext_page' => 'admin.php?page=Extensions-Seopress-For-Mainwp', | |
| 785 | + 'leftsub_order_level2' => 6, | |
| 786 | + 'level' => 2, | |
| 787 | + ); | |
| 770 | 788 | |
| 771 | - self::add_extension_menu( | |
| 772 | - array( | |
| 773 | - 'title' => esc_html__( 'Post Dripper', 'mainwp' ), | |
| 774 | - 'slug' => 'mainwp-post-dripper-extension/mainwp-post-dripper-extension.php', | |
| 775 | - 'parent_key' => 'PostBulkManage', | |
| 776 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Post-Dripper-Extension', | |
| 777 | - 'leftsub_order_level2' => 4, | |
| 778 | - 'level' => 2, | |
| 779 | - 'active_path' => array( 'Extensions-Mainwp-Post-Dripper-Extension' => 'managesites' ), | |
| 780 | - ), | |
| 781 | - ); | |
| 789 | + $extensions_and_leftmenus = apply_filters( 'mainwp_menu_extensions_left_menu', $extensions_and_leftmenus ); | |
| 782 | 790 | |
| 783 | - self::add_extension_menu( | |
| 784 | - array( | |
| 785 | - 'title' => esc_html__( 'Post Plus', 'mainwp' ), | |
| 786 | - 'slug' => 'mainwp-post-plus-extension/mainwp-post-plus-extension.php', | |
| 787 | - 'parent_key' => 'PostBulkManage', | |
| 788 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Post-Plus-Extension', | |
| 789 | - 'leftsub_order_level2' => 5, | |
| 790 | - 'level' => 2, | |
| 791 | - 'active_path' => array( 'Extensions-Mainwp-Post-Plus-Extension' => 'managesites' ), | |
| 792 | - ), | |
| 793 | - ); | |
| 791 | + foreach ( $extensions_and_leftmenus as $item ) { | |
| 792 | + if ( isset( $item['type'] ) && 'extension' === $item['type'] ) { | |
| 793 | + static::add_extension_menu( $item ); | |
| 794 | + } else { | |
| 795 | + $level = isset( $item['level'] ) ? intval( $item['level'] ) : 1; | |
| 796 | + MainWP_Menu::add_left_menu( $item, $level ); | |
| 797 | + } | |
| 798 | + } | |
| 799 | + // @NO_SONAR_END@ . | |
| 800 | + global $_mainwp_menu_active_slugs; | |
| 794 | 801 | |
| 795 | - self::add_extension_menu( | |
| 796 | - array( | |
| 797 | - 'title' => esc_html__( 'Post Dripper', 'mainwp' ), | |
| 798 | - 'slug' => 'mainwp-post-dripper-extension/mainwp-post-dripper-extension.php', | |
| 799 | - 'parent_key' => 'PageBulkManage', | |
| 800 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Post-Dripper-Extension', | |
| 801 | - 'leftsub_order_level2' => 4, | |
| 802 | - 'level' => 2, | |
| 803 | - 'active_path' => array( 'Extensions-Mainwp-Post-Dripper-Extension' => 'managesites' ), | |
| 804 | - ), | |
| 805 | - ); | |
| 802 | + $active_slugs = array( | |
| 803 | + 'Extensions-Mainwp-Content-Operations' => 'Extensions-Mainwp-Content-Operations', | |
| 804 | + 'Extensions-Mainwp-Backups' => 'Extensions-Mainwp-Backups', | |
| 805 | + 'Extensions-Mainwp-Security' => 'Extensions-Mainwp-Security', | |
| 806 | + 'Extensions-Mainwp-Analytics' => 'Extensions-Mainwp-Analytics', | |
| 807 | + 'Extensions-Mainwp-Monitoring' => 'Extensions-Mainwp-Monitoring', | |
| 808 | + 'Extensions-Mainwp-Agency' => 'Extensions-Mainwp-Agency', | |
| 809 | + 'Extensions-Mainwp-Administrative' => 'Extensions-Mainwp-Administrative', | |
| 810 | + 'Extensions-Mainwp-Performance' => 'Extensions-Mainwp-Performance', | |
| 811 | + ); | |
| 812 | + // to fix activate menus state. | |
| 813 | + foreach ( $active_slugs as $item => $act_slug ) { | |
| 814 | + MainWP_Menu::set_menu_active_slugs( $item, $act_slug ); | |
| 815 | + } | |
| 816 | + } | |
| 806 | 817 | |
| 807 | - self::add_extension_menu( | |
| 808 | - array( | |
| 809 | - 'title' => esc_html__( 'Post Plus', 'mainwp' ), | |
| 810 | - 'slug' => 'mainwp-post-plus-extension/mainwp-post-plus-extension.php', | |
| 811 | - 'parent_key' => 'PageBulkManage', | |
| 812 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Post-Plus-Extension', | |
| 813 | - 'leftsub_order_level2' => 5, | |
| 814 | - 'level' => 2, | |
| 815 | - 'active_path' => array( 'Extensions-Mainwp-Post-Plus-Extension' => 'managesites' ), | |
| 816 | - ), | |
| 817 | - ); | |
| 818 | + /** | |
| 819 | + * Method render_extensions_groups() | |
| 820 | + * | |
| 821 | + * @param string $plugin_slug The extension's slug. | |
| 822 | + * | |
| 823 | + * @return bool file existed. | |
| 824 | + */ | |
| 825 | + public static function extension_is_installed( $plugin_slug ) { | |
| 826 | + return file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_slug ) ? true : false; | |
| 827 | + } | |
| 818 | 828 | |
| 819 | - self::add_extension_menu( | |
| 820 | - array( | |
| 821 | - 'title' => esc_html__( 'Pro Reports', 'mainwp' ), | |
| 822 | - 'slug' => 'mainwp-pro-reports-extension/mainwp-pro-reports-extension.php', | |
| 823 | - 'parent_key' => 'ManageClients', | |
| 824 | - 'ext_page' => 'admin.php?page=Extensions-Mainwp-Pro-Reports-Extension', | |
| 825 | - 'leftsub_order_level2' => 4, | |
| 826 | - 'level' => 2, | |
| 827 | - 'active_path' => array( 'Extensions-Mainwp-Pro-Reports-Extension' => 'ManageClients' ), | |
| 828 | - ), | |
| 829 | - ); | |
| 829 | + /** | |
| 830 | + * Method add_extension_menu() | |
| 831 | + * | |
| 832 | + * @param array $params The extension's params. | |
| 833 | + */ | |
| 834 | + public static function add_extension_menu( $params = array() ) { | |
| 830 | 835 | |
| 831 | - self::add_extension_menu( | |
| 832 | - array( | |
| 833 | - 'title' => esc_html__( 'Cost Tracker Assistant', 'mainwp' ), | |
| 834 | - 'slug' => 'mainwp-cost-tracker-assistant-extension/mainwp-cost-tracker-assistant-extension.php', | |
| 835 | - 'parent_key' => 'ManageCostTracker', | |
| 836 | - 'ext_page' => 'admin.php?page=ManageCostTracker', | |
| 837 | - 'leftsub_order_level2' => 4, | |
| 838 | - 'level' => 2, | |
| 839 | - ), | |
| 840 | - ); | |
| 836 | + $title = $params['title']; | |
| 837 | + $ext_page = $params['ext_page']; | |
| 838 | + $plugin_slug = $params['slug']; | |
| 839 | + $parent_key = $params['parent_key']; | |
| 840 | + $level = $params['level']; | |
| 841 | + $nosubmenu = isset( $params['nosubmenu'] ) && $params['nosubmenu'] ? true : false; | |
| 842 | + $leftsub_order = isset( $params['leftsub_order'] ) ? $params['leftsub_order'] : false; | |
| 843 | + $leftsub_order_level2 = isset( $params['leftsub_order_level2'] ) ? $params['leftsub_order_level2'] : false; | |
| 841 | 844 | |
| 842 | - self::add_extension_menu( | |
| 843 | - array( | |
| 844 | - 'title' => esc_html__( 'WordPress SEO', 'mainwp' ), | |
| 845 | - 'slug' => 'wordpress-seo-extension/wordpress-seo-extension.php', | |
| 846 | - 'parent_key' => 'PostBulkManage', | |
| 847 | - 'ext_page' => 'admin.php?page=Extensions-Wordpress-Seo-Extension', | |
| 848 | - 'leftsub_order_level2' => 6, | |
| 849 | - 'level' => 2, | |
| 850 | - 'active_path' => array( 'Extensions-Wordpress-Seo-Extension' => 'ManageClients' ), | |
| 851 | - ), | |
| 852 | - ); | |
| 845 | + if ( 'mainwp-api-backpus' === $plugin_slug ) { | |
| 846 | + $activated_ext = true; | |
| 847 | + $href = $ext_page; | |
| 848 | + } else { | |
| 849 | + $activated_ext = is_plugin_active( $plugin_slug ) ? true : false; | |
| 853 | 850 | |
| 854 | - self::add_extension_menu( | |
| 855 | - array( | |
| 856 | - 'title' => esc_html__( 'WordPress SEO', 'mainwp' ), | |
| 857 | - 'slug' => 'wordpress-seo-extension/wordpress-seo-extension.php', | |
| 858 | - 'parent_key' => 'PageBulkManage', | |
| 859 | - 'ext_page' => 'admin.php?page=Extensions-Wordpress-Seo-Extension', | |
| 860 | - 'leftsub_order_level2' => 6, | |
| 861 | - 'level' => 2, | |
| 862 | - 'active_path' => array( 'Extensions-Wordpress-Seo-Extension' => 'ManageClients' ), | |
| 863 | - ), | |
| 864 | - ); | |
| 851 | + if ( $activated_ext ) { | |
| 852 | + $href = $ext_page; | |
| 853 | + } else { | |
| 854 | + $href = '#'; | |
| 855 | + //phpcs:disable Squiz.PHP.CommentedOutCode.Found | |
| 856 | + // $href = 'admin.php?page=Extensions'; | |
| 857 | + // if ( ! static::extension_is_installed( $plugin_slug ) ) { | |
| 858 | + // $href .= '&message=install-ext-' . dirname( $plugin_slug ); | |
| 859 | + // } | |
| 860 | + //phpcs:enable | |
| 861 | + } | |
| 862 | + } | |
| 865 | 863 | |
| 866 | - self::add_extension_menu( | |
| 867 | - array( | |
| 868 | - 'title' => esc_html__( 'SEOPress', 'mainwp' ), | |
| 869 | - 'slug' => 'seopress-for-mainwp/wp-seopress-mainwp.php', | |
| 870 | - 'parent_key' => 'PostBulkManage', | |
| 871 | - 'ext_page' => 'admin.php?page=Extensions-Seopress-For-Mainwp', | |
| 872 | - 'leftsub_order_level2' => 6, | |
| 873 | - 'level' => 2, | |
| 874 | - 'active_path' => array( 'Extensions-Seopress-For-Mainwp' => 'ManageClients' ), | |
| 875 | - ), | |
| 876 | - ); | |
| 864 | + $menu_params = array( | |
| 865 | + 'title' => $title, | |
| 866 | + 'parent_key' => $parent_key, | |
| 867 | + 'href' => $href, | |
| 868 | + 'nosubmenu' => $nosubmenu, | |
| 869 | + 'ext_status' => $activated_ext ? 'activated' : 'inactive', | |
| 870 | + ); | |
| 877 | 871 | |
| 878 | - self::add_extension_menu( | |
| 879 | - array( | |
| 880 | - 'title' => esc_html__( 'SEOPress', 'mainwp' ), | |
| 881 | - 'slug' => 'seopress-for-mainwp/seopress-for-mainwp.php', | |
| 882 | - 'parent_key' => 'PageBulkManage', | |
| 883 | - 'ext_page' => 'admin.php?page=Extensions-Seopress-For-Mainwp', | |
| 884 | - 'leftsub_order_level2' => 6, | |
| 885 | - 'level' => 2, | |
| 886 | - 'active_path' => array( 'Extensions-Seopress-For-Mainwp' => 'ManageClients' ), | |
| 887 | - ), | |
| 888 | - ); | |
| 872 | + if ( false !== $leftsub_order ) { | |
| 873 | + $menu_params['leftsub_order'] = $leftsub_order; | |
| 874 | + } | |
| 889 | 875 | |
| 890 | - global $_mainwp_menu_active_slugs; | |
| 876 | + if ( false !== $leftsub_order_level2 ) { | |
| 877 | + $menu_params['leftsub_order_level2'] = $leftsub_order_level2; | |
| 878 | + } | |
| 891 | 879 | |
| 892 | - $active_slugs = array( | |
| 893 | - 'Extensions-Mainwp-Backups' => 'Extensions-Mainwp-Backups', | |
| 894 | - 'Extensions-Mainwp-Security' => 'Extensions-Mainwp-Security', | |
| 895 | - 'Extensions-Mainwp-Analytics' => 'Extensions-Mainwp-Analytics', | |
| 896 | - 'Extensions-Mainwp-Monitoring' => 'Extensions-Mainwp-Monitoring', | |
| 897 | - 'Extensions-Mainwp-Agency' => 'Extensions-Mainwp-Agency', | |
| 898 | - 'Extensions-Mainwp-Administrative' => 'Extensions-Mainwp-Administrative', | |
| 899 | - 'Extensions-Mainwp-Development' => 'Extensions-Mainwp-Development', | |
| 900 | - 'Extensions-Mainwp-Performance' => 'Extensions-Mainwp-Performance', | |
| 901 | - ); | |
| 902 | - // to fix activate menus state. | |
| 903 | - foreach ( $active_slugs as $item => $act_slug ) { | |
| 904 | - MainWP_Menu::set_menu_active_slugs( $item, $act_slug ); | |
| 905 | - } | |
| 906 | - } | |
| 880 | + if ( isset( $params['active_path'] ) ) { | |
| 881 | + $menu_params['active_path'] = $params['active_path']; | |
| 882 | + } | |
| 883 | + MainWP_Menu::add_left_menu( $menu_params, $level ); | |
| 884 | + } | |
| 907 | 885 | |
| 908 | - /** | |
| 909 | - * Method render_extensions_groups() | |
| 910 | - * | |
| 911 | - * @param string $plugin_slug The extension's slug. | |
| 912 | - * | |
| 913 | - * @return bool file existed. | |
| 914 | - */ | |
| 915 | - public static function extension_is_installed( $plugin_slug ) { | |
| 916 | - return file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_slug ) ? true : false; | |
| 917 | - } | |
| 886 | + /** | |
| 887 | + * Method render_extensions_groups() | |
| 888 | + * | |
| 889 | + * @return void | |
| 890 | + */ | |
| 891 | + public static function render_extensions_groups() { //phpcs:ignore -- NOSONAR - complex method. | |
| 918 | 892 | |
| 919 | - /** | |
| 920 | - * Method add_extension_menu() | |
| 921 | - * | |
| 922 | - * @param array $params The extension's params. | |
| 923 | - */ | |
| 924 | - public static function add_extension_menu( $params = array() ) { | |
| 893 | + $get_ext_group = array(); | |
| 925 | 894 | |
| 926 | - $title = $params['title']; | |
| 927 | - $ext_page = $params['ext_page']; | |
| 928 | - $plugin_slug = $params['slug']; | |
| 929 | - $parent_key = $params['parent_key']; | |
| 930 | - $level = $params['level']; | |
| 931 | - $nosubmenu = isset( $params['nosubmenu'] ) && $params['nosubmenu'] ? true : false; | |
| 932 | - $leftsub_order = isset( $params['leftsub_order'] ) ? $params['leftsub_order'] : false; | |
| 933 | - $leftsub_order_level2 = isset( $params['leftsub_order_level2'] ) ? $params['leftsub_order_level2'] : false; | |
| 895 | + //phpcs:disable WordPress.Security.NonceVerification.Recommended | |
| 896 | + if ( isset( $_GET['page'] ) ) { | |
| 897 | + if ( 'Extensions-Mainwp-Backups' === $_GET['page'] ) { | |
| 898 | + $get_ext_group[] = 'backup'; | |
| 899 | + } elseif ( 'Extensions-Mainwp-Security' === $_GET['page'] ) { | |
| 900 | + $get_ext_group[] = 'security'; | |
| 901 | + } elseif ( 'Extensions-Mainwp-Analytics' === $_GET['page'] ) { | |
| 902 | + $get_ext_group[] = 'visitor'; | |
| 903 | + } elseif ( 'Extensions-Mainwp-Monitoring' === $_GET['page'] ) { | |
| 904 | + $get_ext_group[] = 'monitoring'; | |
| 905 | + } elseif ( 'Extensions-Mainwp-Agency' === $_GET['page'] ) { | |
| 906 | + $get_ext_group[] = 'agency'; | |
| 907 | + } elseif ( 'Extensions-Mainwp-Administrative' === $_GET['page'] ) { | |
| 908 | + $get_ext_group[] = 'admin'; | |
| 909 | + } elseif ( 'Extensions-Mainwp-Performance' === $_GET['page'] ) { | |
| 910 | + $get_ext_group[] = 'performance'; | |
| 911 | + } elseif ( 'Extensions-Mainwp-Content-Operations' === $_GET['page'] ) { | |
| 912 | + $get_ext_group[] = 'content'; | |
| 913 | + } | |
| 914 | + } | |
| 915 | + //phpcs:enable | |
| 934 | 916 | |
| 935 | - if ( 'mainwp-api-backpus' === $plugin_slug ) { | |
| 936 | - $activated_ext = true; | |
| 937 | - $href = $ext_page; | |
| 938 | - } else { | |
| 939 | - $activated_ext = is_plugin_active( $plugin_slug ) ? true : false; | |
| 917 | + if ( empty( $get_ext_group ) ) { | |
| 918 | + return; | |
| 919 | + } | |
| 940 | 920 | |
| 941 | - if ( $activated_ext ) { | |
| 942 | - $href = $ext_page; | |
| 943 | - } else { | |
| 944 | - $href = '#'; | |
| 945 | - //phpcs:disable Squiz.PHP.CommentedOutCode.Found | |
| 946 | - // $href = 'admin.php?page=Extensions'; | |
| 947 | - // if ( ! self::extension_is_installed( $plugin_slug ) ) { | |
| 948 | - // $href .= '&message=install-ext-' . dirname( $plugin_slug ); | |
| 949 | - // } | |
| 950 | - //phpcs:enable | |
| 951 | - } | |
| 952 | - } | |
| 921 | + $extension_update = get_site_transient( 'update_plugins' ); | |
| 953 | 922 | |
| 954 | - $menu_params = array( | |
| 955 | - 'title' => $title, | |
| 956 | - 'parent_key' => $parent_key, | |
| 957 | - 'href' => $href, | |
| 958 | - 'nosubmenu' => $nosubmenu, | |
| 959 | - 'ext_status' => $activated_ext ? 'activated' : 'inactive', | |
| 960 | - ); | |
| 923 | + $extensions = MainWP_Extensions_Handler::get_extensions(); | |
| 961 | 924 | |
| 962 | - if ( false !== $leftsub_order ) { | |
| 963 | - $menu_params['leftsub_order'] = $leftsub_order; | |
| 964 | - } | |
| 925 | + $group_available_extensions = MainWP_Extensions_View::get_available_extensions( false, $get_ext_group ); | |
| 965 | 926 | |
| 966 | - if ( false !== $leftsub_order_level2 ) { | |
| 967 | - $menu_params['leftsub_order_level2'] = $leftsub_order_level2; | |
| 968 | - } | |
| 927 | + $extensions_disabled = MainWP_Extensions_Handler::get_extensions_disabled(); | |
| 969 | 928 | |
| 970 | - if ( isset( $params['active_path'] ) ) { | |
| 971 | - $menu_params['active_path'] = $params['active_path']; | |
| 972 | - } | |
| 973 | - MainWP_Menu::add_left_menu( $menu_params, $level ); | |
| 974 | - } | |
| 929 | + $extensions_not_installed = MainWP_Extensions_Handler::get_extensions_not_installed(); | |
| 975 | 930 | |
| 976 | - /** | |
| 977 | - * Method render_extensions_groups() | |
| 978 | - * | |
| 979 | - * @return void | |
| 980 | - */ | |
| 981 | - public static function render_extensions_groups() { //phpcs:ignore -- complex method. | |
| 931 | + $excluded_extensions = array(); | |
| 982 | 932 | |
| 983 | - $get_ext_group = array(); | |
| 933 | + do_action( 'mainwp_pageheader_extensions' ); | |
| 934 | + ?> | |
| 935 | + <div class="ui segment"> | |
| 936 | + <div class="ui three mainwp-cards cards" id="mainwp-extensions-list"> | |
| 937 | + <?php if ( isset( $_GET['page'] ) && 'Extensions-Mainwp-Backups' === $_GET['page'] ) : //phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> | |
| 938 | + <div class="ui extension card"> | |
| 939 | + <div class="content"> | |
| 940 | + <img class="right floated mini ui image" alt="<?php esc_attr_e( 'Add-on icon placeholder', 'mainwp' ); ?>" src="<?php echo esc_url( MAINWP_PLUGIN_URL ) . 'assets/images/extensions/placeholder.png'; ?>"> | |
| 941 | + <div class="header"><a href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'API Backpus', 'mainwp' ); ?></a></div> | |
| 942 | + <a href="admin.php?page=ManageApiBackups" class="ui green ribbon label"><?php echo esc_html__( ' MainWP core feature', 'mainwp' ); ?></a> | |
| 943 | + <div class="description"><?php esc_html_e( 'Manage host-side backups via REST API. Currently, the supported providers are Cloudways, GridPane, Digital Ocean, Linode, Vultr and cPanel.', 'mainwp' ); ?></div> | |
| 944 | + </div> | |
| 945 | + </div> | |
| 946 | + <?php endif; ?> | |
| 947 | + <?php if ( isset( $_GET['page'] ) && 'Extensions-Mainwp-Monitoring' === $_GET['page'] ) : //phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> | |
| 948 | + <div class="ui extension card"> | |
| 949 | + <div class="content"> | |
| 950 | + <img class="right floated mini ui image" alt="<?php esc_attr_e( 'Add-on icon placeholder', 'mainwp' ); ?>" src="<?php echo esc_url( MAINWP_PLUGIN_URL ) . 'assets/images/extensions/placeholder.png'; ?>"> | |
| 951 | + <div class="header"><a href="admin.php?page=MonitoringSites"><?php esc_html_e( 'Uptime Monitoring', 'mainwp' ); ?></a></div> | |
| 952 | + <a href="admin.php?page=MonitoringSites" class="ui green ribbon label"><?php echo esc_html__( 'MainWP core feature', 'mainwp' ); ?></a> | |
| 953 | + <div class="description"><?php esc_html_e( 'The MainWP Uptime Monitoring function operates independently of third-party services, providing a straightforward and no-cost option for uptime monitoring across all your managed sites.', 'mainwp' ); ?></div> | |
| 954 | + </div> | |
| 955 | + </div> | |
| 956 | + <?php endif; ?> | |
| 984 | 957 | |
| 985 | - //phpcs:disable WordPress.Security.NonceVerification.Recommended | |
| 986 | - if ( isset( $_GET['page'] ) ) { | |
| 987 | - if ( 'Extensions-Mainwp-Backups' === $_GET['page'] ) { | |
| 988 | - $get_ext_group[] = 'backup'; | |
| 989 | - } elseif ( 'Extensions-Mainwp-Security' === $_GET['page'] ) { | |
| 990 | - $get_ext_group[] = 'security'; | |
| 991 | - } elseif ( 'Extensions-Mainwp-Analytics' === $_GET['page'] ) { | |
| 992 | - $get_ext_group[] = 'visitor'; | |
| 993 | - } elseif ( 'Extensions-Mainwp-Monitoring' === $_GET['page'] ) { | |
| 994 | - $get_ext_group[] = 'monitoring'; | |
| 995 | - } elseif ( 'Extensions-Mainwp-Agency' === $_GET['page'] ) { | |
| 996 | - $get_ext_group[] = 'agency'; | |
| 997 | - } elseif ( 'Extensions-Mainwp-Administrative' === $_GET['page'] ) { | |
| 998 | - $get_ext_group[] = 'admin'; | |
| 999 | - } elseif ( 'Extensions-Mainwp-Development' === $_GET['page'] ) { | |
| 1000 | - $get_ext_group[] = 'development'; | |
| 1001 | - } elseif ( 'Extensions-Mainwp-Performance' === $_GET['page'] ) { | |
| 1002 | - $get_ext_group[] = 'performance'; | |
| 1003 | - } | |
| 1004 | - } | |
| 1005 | - //phpcs:enable | |
| 958 | + <?php if ( isset( $extensions ) && is_array( $extensions ) ) { ?> | |
| 959 | + <?php foreach ( $extensions as $extension ) { ?> | |
| 960 | + <?php | |
| 961 | + if ( ! \mainwp_current_user_can( 'extension', dirname( $extension['slug'] ) ) ) { | |
| 962 | + continue; | |
| 963 | + } | |
| 1006 | 964 | |
| 1007 | - if ( empty( $get_ext_group ) ) { | |
| 1008 | - return; | |
| 1009 | - } | |
| 965 | + if ( ! isset( $group_available_extensions[ dirname( $extension['slug'] ) ] ) ) { | |
| 966 | + continue; | |
| 967 | + } | |
| 1010 | 968 | |
| 1011 | - $extension_update = get_site_transient( 'update_plugins' ); | |
| 969 | + if ( in_array( dirname( $extension['slug'] ), $excluded_extensions ) ) { | |
| 970 | + continue; | |
| 971 | + } | |
| 1012 | 972 | |
| 1013 | - $extensions = MainWP_Extensions_Handler::get_extensions(); | |
| 973 | + $extensions_data = isset( $group_available_extensions[ dirname( $extension['slug'] ) ] ) ? $group_available_extensions[ dirname( $extension['slug'] ) ] : array(); | |
| 1014 | 974 | |
| 1015 | - $group_available_extensions = MainWP_Extensions_View::get_available_extensions( false, $get_ext_group ); | |
| 975 | + if ( isset( $extensions_data['img'] ) && ! empty( $extensions_data['img'] ) ) { | |
| 976 | + $img_url = $extensions_data['img']; | |
| 977 | + } elseif ( isset( $extension['icon'] ) && ! empty( $extension['icon'] ) ) { | |
| 978 | + $img_url = $extension['icon']; | |
| 979 | + } elseif ( isset( $extension['iconURI'] ) && '' !== $extension['iconURI'] ) { | |
| 980 | + $img_url = MainWP_Utility::remove_http_prefix( $extension['iconURI'] ); | |
| 981 | + } else { | |
| 982 | + $img_url = MAINWP_PLUGIN_URL . 'assets/images/extensions/placeholder.png'; | |
| 983 | + } | |
| 1016 | 984 | |
| 1017 | - $extensions_disabled = MainWP_Extensions_Handler::get_extensions_disabled(); | |
| 985 | + MainWP_Extensions_View::render_extension_card( $extension, $extension_update, $img_url, false, true ); | |
| 986 | + ?> | |
| 1018 | 987 | |
| 1019 | - $extensions_not_installed = MainWP_Extensions_Handler::get_extensions_not_installed(); | |
| 988 | + <?php } ?> | |
| 989 | + <?php } ?> | |
| 1020 | 990 | |
| 1021 | - $excluded_extensions = array(); | |
| 991 | + <?php if ( is_array( $extensions_disabled ) ) { ?> | |
| 992 | + <?php foreach ( $extensions_disabled as $extension ) { ?> | |
| 993 | + <?php | |
| 994 | + $slug = dirname( $extension['slug'] ); | |
| 1022 | 995 | |
| 1023 | - do_action( 'mainwp_pageheader_extensions' ); | |
| 1024 | - ?> | |
| 1025 | - <div class="ui segment"> | |
| 1026 | - <div class="ui four stackable cards" id="mainwp-extensions-list"> | |
| 1027 | - <?php if ( isset( $_GET['page'] ) && 'Extensions-Mainwp-Backups' === $_GET['page'] ) : //phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> | |
| 1028 | - <div class="ui extension card"> | |
| 1029 | - <div class="content"> | |
| 1030 | - <img class="right floated mini ui image" src="<?php echo esc_url( MAINWP_PLUGIN_URL ) . 'assets/images/extensions/placeholder.png'; ?>"> | |
| 1031 | - <div class="header"><a href="admin.php?page=ManageApiBackups"><?php esc_html_e( 'API Backpus', 'mainwp' ); ?></a></div> | |
| 1032 | - <a href="admin.php?page=ManageApiBackups" class="ui green ribbon label"><?php echo esc_html__( ' MainWP core feature', 'mainwp' ); ?></a> | |
| 1033 | - <div class="description"><?php esc_html_e( 'Manage host-side backups via REST API. Currently, the supported providers are Cloudways, GridPane, Digital Ocean, Linode, Vultr and cPanel.', 'mainwp' ); ?></div> | |
| 1034 | - </div> | |
| 1035 | - </div> | |
| 1036 | - <?php endif; ?> | |
| 1037 | - <?php if ( isset( $_GET['page'] ) && 'Extensions-Mainwp-Monitoring' === $_GET['page'] ) : //phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> | |
| 1038 | - <div class="ui extension card"> | |
| 1039 | - <div class="content"> | |
| 1040 | - <img class="right floated mini ui image" src="<?php echo esc_url( MAINWP_PLUGIN_URL ) . 'assets/images/extensions/placeholder.png'; ?>"> | |
| 1041 | - <div class="header"><a href="admin.php?page=MonitoringSites"><?php esc_html_e( 'Basic Monitoring', 'mainwp' ); ?></a></div> | |
| 1042 | - <a href="admin.php?page=MonitoringSites" class="ui green ribbon label"><?php echo esc_html__( 'MainWP core feature', 'mainwp' ); ?></a> | |
| 1043 | - <div class="description"><?php esc_html_e( 'The MainWP Basic Uptime Monitoring function operates independently of third-party services, providing a straightforward and no-cost option for uptime monitoring across all your managed sites.', 'mainwp' ); ?></div> | |
| 1044 | - </div> | |
| 1045 | - </div> | |
| 1046 | - <?php endif; ?> | |
| 1047 | - <?php if ( isset( $extensions ) && is_array( $extensions ) ) { ?> | |
| 1048 | - | |
| 1049 | - <?php foreach ( $extensions as $extension ) { ?> | |
| 1050 | - <?php | |
| 1051 | - if ( ! mainwp_current_user_have_right( 'extension', dirname( $extension['slug'] ) ) ) { | |
| 1052 | - continue; | |
| 1053 | - } | |
| 996 | + if ( ! isset( $group_available_extensions[ $slug ] ) ) { | |
| 997 | + continue; | |
| 998 | + } | |
| 1054 | 999 | |
| 1055 | - if ( ! isset( $group_available_extensions[ dirname( $extension['slug'] ) ] ) ) { | |
| 1056 | - continue; | |
| 1057 | - } | |
| 1000 | + if ( in_array( $slug, $excluded_extensions ) ) { | |
| 1001 | + continue; | |
| 1002 | + } | |
| 1058 | 1003 | |
| 1059 | - if ( in_array( dirname( $extension['slug'] ), $excluded_extensions ) ) { | |
| 1060 | - continue; | |
| 1061 | - } | |
| 1004 | + $extensions_data = $group_available_extensions[ $slug ]; | |
| 1062 | 1005 | |
| 1063 | - $extensions_data = isset( $group_available_extensions[ dirname( $extension['slug'] ) ] ) ? $group_available_extensions[ dirname( $extension['slug'] ) ] : array(); | |
| 1006 | + if ( isset( $extensions_data['img'] ) && ! empty( $extensions_data['img'] ) ) { | |
| 1007 | + $img_url = $extensions_data['img']; // icon from the available extensions in dashboard. | |
| 1008 | + } elseif ( isset( $extension['icon'] ) && ! empty( $extension['icon'] ) ) { | |
| 1009 | + $img_url = $extension['icon']; // icon from the get_this_extension(). | |
| 1010 | + } elseif ( isset( $extension['iconURI'] ) && '' !== $extension['iconURI'] ) { | |
| 1011 | + $img_url = MainWP_Utility::remove_http_prefix( $extension['iconURI'] ); // icon from the extension header. | |
| 1012 | + } else { | |
| 1013 | + $img_url = MAINWP_PLUGIN_URL . 'assets/images/extensions/placeholder.png'; | |
| 1014 | + } | |
| 1064 | 1015 | |
| 1065 | - if ( isset( $extensions_data['img'] ) && ! empty( $extensions_data['img'] ) ) { | |
| 1066 | - $img_url = $extensions_data['img']; | |
| 1067 | - } elseif ( isset( $extension['icon'] ) && ! empty( $extension['icon'] ) ) { | |
| 1068 | - $img_url = $extension['icon']; | |
| 1069 | - } elseif ( isset( $extension['iconURI'] ) && '' !== $extension['iconURI'] ) { | |
| 1070 | - $img_url = MainWP_Utility::remove_http_prefix( $extension['iconURI'] ); | |
| 1071 | - } else { | |
| 1072 | - $img_url = MAINWP_PLUGIN_URL . 'assets/images/extensions/placeholder.png'; | |
| 1073 | - } | |
| 1016 | + MainWP_Extensions_View::render_inactive_extension_card( $extension, $img_url, true ); | |
| 1017 | + ?> | |
| 1074 | 1018 | |
| 1075 | - MainWP_Extensions_View::render_extension_card( $extension, $extension_update, $img_url, false, true ); | |
| 1076 | - ?> | |
| 1019 | + <?php } ?> | |
| 1020 | + <?php } ?> | |
| 1077 | 1021 | |
| 1078 | - <?php } ?> | |
| 1079 | - <?php } ?> | |
| 1022 | + <?php if ( is_array( $extensions_not_installed ) ) { ?> | |
| 1023 | + <?php foreach ( $extensions_not_installed as $slug => $extension ) { ?> | |
| 1024 | + <?php | |
| 1080 | 1025 | |
| 1081 | - <?php if ( is_array( $extensions_disabled ) ) { ?> | |
| 1082 | - <?php foreach ( $extensions_disabled as $extension ) { ?> | |
| 1083 | - <?php | |
| 1084 | - $slug = dirname( $extension['slug'] ); | |
| 1026 | + if ( ! isset( $group_available_extensions[ $slug ] ) ) { | |
| 1027 | + continue; | |
| 1028 | + } | |
| 1085 | 1029 | |
| 1086 | - if ( ! isset( $group_available_extensions[ $slug ] ) ) { | |
| 1087 | - continue; | |
| 1088 | - } | |
| 1030 | + if ( in_array( $slug, $excluded_extensions ) ) { | |
| 1031 | + continue; | |
| 1032 | + } | |
| 1089 | 1033 | |
| 1090 | - if ( in_array( $slug, $excluded_extensions ) ) { | |
| 1091 | - continue; | |
| 1092 | - } | |
| 1034 | + if ( isset( $extension['img'] ) && ! empty( $extension['img'] ) ) { | |
| 1035 | + $img_url = $extension['img']; // icon from the available extensions in dashboard. | |
| 1036 | + } else { | |
| 1037 | + $img_url = MAINWP_PLUGIN_URL . 'assets/images/extensions/placeholder.png'; | |
| 1038 | + } | |
| 1093 | 1039 | |
| 1094 | - $extensions_data = $group_available_extensions[ $slug ]; | |
| 1095 | - | |
| 1096 | - if ( isset( $extensions_data['img'] ) && ! empty( $extensions_data['img'] ) ) { | |
| 1097 | - $img_url = $extensions_data['img']; // icon from the available extensions in dashboard. | |
| 1098 | - } elseif ( isset( $extension['icon'] ) && ! empty( $extension['icon'] ) ) { | |
| 1099 | - $img_url = $extension['icon']; // icon from the get_this_extension(). | |
| 1100 | - } elseif ( isset( $extension['iconURI'] ) && '' !== $extension['iconURI'] ) { | |
| 1101 | - $img_url = MainWP_Utility::remove_http_prefix( $extension['iconURI'] ); // icon from the extension header. | |
| 1102 | - } else { | |
| 1103 | - $img_url = MAINWP_PLUGIN_URL . 'assets/images/extensions/placeholder.png'; | |
| 1104 | - } | |
| 1105 | - | |
| 1106 | - MainWP_Extensions_View::render_inactive_extension_card( $extension, $img_url, true ); | |
| 1107 | - ?> | |
| 1108 | - | |
| 1109 | - <?php } ?> | |
| 1110 | - | |
| 1111 | - <?php } ?> | |
| 1112 | - | |
| 1113 | - <?php if ( is_array( $extensions_not_installed ) ) { ?> | |
| 1114 | - <?php foreach ( $extensions_not_installed as $slug => $extension ) { ?> | |
| 1115 | - <?php | |
| 1116 | - | |
| 1117 | - if ( ! isset( $group_available_extensions[ $slug ] ) ) { | |
| 1118 | - continue; | |
| 1119 | - } | |
| 1120 | - | |
| 1121 | - if ( in_array( $slug, $excluded_extensions ) ) { | |
| 1122 | - continue; | |
| 1123 | - } | |
| 1124 | - | |
| 1125 | - if ( isset( $extension['img'] ) && ! empty( $extension['img'] ) ) { | |
| 1126 | - $img_url = $extension['img']; // icon from the available extensions in dashboard. | |
| 1127 | - } else { | |
| 1128 | - $img_url = MAINWP_PLUGIN_URL . 'assets/images/extensions/placeholder.png'; | |
| 1129 | - } | |
| 1130 | - | |
| 1131 | - MainWP_Extensions_View::render_inactive_extension_card( $extension, $img_url ); | |
| 1132 | - ?> | |
| 1133 | - | |
| 1134 | - <?php } ?> | |
| 1135 | - | |
| 1136 | - <?php } ?> | |
| 1137 | - | |
| 1138 | - </div> | |
| 1139 | - </div> | |
| 1140 | - <?php | |
| 1141 | - do_action( 'mainwp_pagefooter_extensions' ); | |
| 1142 | - } | |
| 1040 | + MainWP_Extensions_View::render_inactive_extension_card( $extension, $img_url ); | |
| 1041 | + ?> | |
| 1042 | + <?php } ?> | |
| 1043 | + <?php } ?> | |
| 1044 | + </div> | |
| 1045 | + </div> | |
| 1046 | + <?php | |
| 1047 | + do_action( 'mainwp_pagefooter_extensions' ); | |
| 1048 | + } | |
| 1143 | 1049 | } |