| @@ -1,458 +1,461 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * MainWP Overview Page. |
| 4 | 4 | * |
| 5 | - * @package MainWP/Dashboard | |
| 5 | + * @package MainWP/Dashboard | |
| 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_Overview |
| 12 | 17 | * |
| 13 | 18 | * @package MainWP\Dashboard |
| 14 | 19 | */ |
| 15 | -class MainWP_Overview { | |
| 20 | +class MainWP_Overview { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR. | |
| 16 | 21 | |
| 17 | - /** | |
| 18 | - * Get Class Name | |
| 19 | - * | |
| 20 | - * @return string __CLASS__ | |
| 21 | - */ | |
| 22 | - public static function get_class_name() { | |
| 23 | - return __CLASS__; | |
| 24 | - } | |
| 22 | + /** | |
| 23 | + * Get Class Name | |
| 24 | + * | |
| 25 | + * @return string __CLASS__ | |
| 26 | + */ | |
| 27 | + public static function get_class_name() { | |
| 28 | + return __CLASS__; | |
| 29 | + } | |
| 25 | 30 | |
| 26 | - /** | |
| 27 | - * The single instance of the class | |
| 28 | - * | |
| 29 | - * @var mixed Default null | |
| 30 | - */ | |
| 31 | - protected static $instance = null; | |
| 31 | + /** | |
| 32 | + * The single instance of the class | |
| 33 | + * | |
| 34 | + * @var mixed Default null | |
| 35 | + */ | |
| 36 | + protected static $instance = null; | |
| 32 | 37 | |
| 33 | - /** | |
| 34 | - * Screen dashdoard ID value. | |
| 35 | - * | |
| 36 | - * @var int $dashBoard default 0. | |
| 37 | - */ | |
| 38 | - public $dashBoard = 0; | |
| 38 | + /** | |
| 39 | + * Screen dashdoard ID value. | |
| 40 | + * | |
| 41 | + * @var int $dashBoard default 0. | |
| 42 | + */ | |
| 43 | + public $dashBoard = 0; | |
| 39 | 44 | |
| 40 | - /** | |
| 41 | - * Enabled widgets | |
| 42 | - * | |
| 43 | - * @var array $enable_widgets | |
| 44 | - */ | |
| 45 | - private static $enable_widgets = array( | |
| 46 | - 'overview' => true, | |
| 47 | - 'connection_status' => true, | |
| 48 | - 'recent_posts' => true, | |
| 49 | - 'recent_pages' => true, | |
| 50 | - 'security_issues' => true, | |
| 51 | - 'backup_tasks' => true, | |
| 52 | - 'non_mainwp_changes' => true, | |
| 53 | - 'clients' => true, | |
| 54 | - ); | |
| 45 | + /** | |
| 46 | + * Enabled widgets | |
| 47 | + * | |
| 48 | + * @var array $enable_widgets | |
| 49 | + */ | |
| 50 | + private static $enable_widgets = array( | |
| 51 | + 'overview' => true, | |
| 52 | + 'connection_status' => true, | |
| 53 | + 'uptime_monitoring_status' => true, | |
| 54 | + 'recent_posts' => true, | |
| 55 | + 'recent_pages' => true, | |
| 56 | + 'security_issues' => true, | |
| 57 | + 'backup_tasks' => true, | |
| 58 | + 'non_mainwp_changes' => true, | |
| 59 | + 'clients' => true, | |
| 60 | + 'get-started' => true, | |
| 61 | + ); | |
| 55 | 62 | |
| 56 | - /** | |
| 57 | - * Check if there is a session, | |
| 58 | - * if there isn't one create it. | |
| 59 | - * | |
| 60 | - * @return self::singlton Overview Page Session. | |
| 61 | - * | |
| 62 | - * @uses \MainWP\Dashboard\MainWP_Overview | |
| 63 | - */ | |
| 64 | - public static function get() { | |
| 65 | - if ( null === self::$instance ) { | |
| 66 | - self::$instance = new MainWP_Overview(); | |
| 67 | - } | |
| 63 | + /** | |
| 64 | + * Check if there is a session, | |
| 65 | + * if there isn't one create it. | |
| 66 | + * | |
| 67 | + * @return static::singlton Overview Page Session. | |
| 68 | + * | |
| 69 | + * @uses \MainWP\Dashboard\MainWP_Overview | |
| 70 | + */ | |
| 71 | + public static function get() { | |
| 72 | + if ( null === static::$instance ) { | |
| 73 | + static::$instance = new MainWP_Overview(); | |
| 74 | + } | |
| 68 | 75 | |
| 69 | - return self::$instance; | |
| 70 | - } | |
| 76 | + return static::$instance; | |
| 77 | + } | |
| 71 | 78 | |
| 72 | - /** | |
| 73 | - * MainWP_Overview constructor. | |
| 74 | - * | |
| 75 | - * Run each time the class is called. | |
| 76 | - */ | |
| 77 | - public function __construct() { | |
| 78 | - add_filter( 'screen_layout_columns', array( &$this, 'on_screen_layout_columns' ), 10, 2 ); | |
| 79 | - add_action( 'admin_menu', array( &$this, 'on_admin_menu' ) ); | |
| 80 | - add_action( 'mainwp_help_sidebar_content', array( &$this, 'mainwp_help_content' ) ); | |
| 81 | - } | |
| 79 | + /** | |
| 80 | + * MainWP_Overview constructor. | |
| 81 | + * | |
| 82 | + * Run each time the class is called. | |
| 83 | + */ | |
| 84 | + public function __construct() { | |
| 85 | + add_filter( 'screen_layout_columns', array( &$this, 'on_screen_layout_columns' ), 10, 2 ); | |
| 86 | + add_action( 'admin_menu', array( &$this, 'on_admin_menu' ) ); | |
| 87 | + add_action( 'mainwp_help_sidebar_content', array( &$this, 'mainwp_help_content' ) ); | |
| 88 | + } | |
| 82 | 89 | |
| 83 | - /** | |
| 84 | - * Set the number of page coumns. | |
| 85 | - * | |
| 86 | - * @param mixed $columns Number of Columns. | |
| 87 | - * @param mixed $screen Screen size. | |
| 88 | - * | |
| 89 | - * @return int $columns Number of desired page columns. | |
| 90 | - */ | |
| 91 | - public function on_screen_layout_columns( $columns, $screen ) { | |
| 92 | - if ( $screen === $this->dashBoard ) { | |
| 93 | - $columns[ $this->dashBoard ] = 3; | |
| 94 | - } | |
| 90 | + /** | |
| 91 | + * Set the number of page coumns. | |
| 92 | + * | |
| 93 | + * @param mixed $columns Number of Columns. | |
| 94 | + * @param mixed $screen Screen size. | |
| 95 | + * | |
| 96 | + * @return int $columns Number of desired page columns. | |
| 97 | + */ | |
| 98 | + public function on_screen_layout_columns( $columns, $screen ) { | |
| 99 | + if ( $screen === $this->dashBoard ) { | |
| 100 | + $columns[ $this->dashBoard ] = 3; | |
| 101 | + } | |
| 95 | 102 | |
| 96 | - return $columns; | |
| 97 | - } | |
| 103 | + return $columns; | |
| 104 | + } | |
| 98 | 105 | |
| 99 | - /** | |
| 100 | - * Add MainWP Overview top level menu. | |
| 101 | - * | |
| 102 | - * @uses \MainWP\Dashboard\MainWP_System_Utility::is_admin() | |
| 103 | - * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit() | |
| 104 | - */ | |
| 105 | - public function on_admin_menu() { | |
| 106 | - if ( MainWP_System_Utility::is_admin() ) { | |
| 106 | + /** | |
| 107 | + * Add MainWP Overview top level menu. | |
| 108 | + * | |
| 109 | + * @uses \MainWP\Dashboard\MainWP_System_Utility::is_admin() | |
| 110 | + * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit() | |
| 111 | + */ | |
| 112 | + public function on_admin_menu() { | |
| 113 | + if ( MainWP_System_Utility::is_admin() ) { | |
| 107 | 114 | |
| 108 | - /** | |
| 109 | - * Current user global. | |
| 110 | - * | |
| 111 | - * @global string | |
| 112 | - */ | |
| 113 | - global $current_user; | |
| 115 | + /** | |
| 116 | + * Current user global. | |
| 117 | + * | |
| 118 | + * @global string | |
| 119 | + */ | |
| 120 | + global $current_user; | |
| 114 | 121 | |
| 115 | - // The icon in Base64 format. | |
| 116 | - $icon_base64 = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNi4zLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCA1MCA1MCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTAgNTA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiM5Q0EyQTc7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNSwwLjVDMTEuNDcsMC41LDAuNSwxMS40NywwLjUsMjVjMCwxMy41MywxMC45NywyNC41LDI0LjUsMjQuNVM0OS41LDM4LjUzLDQ5LjUsMjUNCglDNDkuNSwxMS40NywzOC41MywwLjUsMjUsMC41eiBNMjUsNDQuNmwtOC4zMy00LjlsNi4wOS0yNS4wN2MtMS41Ny0wLjgyLTIuNjYtMi40NC0yLjY2LTQuMzNjMC0yLjcxLDIuMTktNC45LDQuOS00LjkNCglzNC45LDIuMTksNC45LDQuOWMwLDEuODktMS4wOSwzLjUyLTIuNjYsNC4zM2w2LjA5LDI1LjA3TDI1LDQ0LjZ6Ii8+DQo8L3N2Zz4NCg=='; | |
| 122 | + // The icon in Base64 format. | |
| 123 | + $icon_base64 = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNi4zLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCA1MCA1MCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTAgNTA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiM5Q0EyQTc7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNSwwLjVDMTEuNDcsMC41LDAuNSwxMS40NywwLjUsMjVjMCwxMy41MywxMC45NywyNC41LDI0LjUsMjQuNVM0OS41LDM4LjUzLDQ5LjUsMjUNCglDNDkuNSwxMS40NywzOC41MywwLjUsMjUsMC41eiBNMjUsNDQuNmwtOC4zMy00LjlsNi4wOS0yNS4wN2MtMS41Ny0wLjgyLTIuNjYtMi40NC0yLjY2LTQuMzNjMC0yLjcxLDIuMTktNC45LDQuOS00LjkNCglzNC45LDIuMTksNC45LDQuOWMwLDEuODktMS4wOSwzLjUyLTIuNjYsNC4zM2w2LjA5LDI1LjA3TDI1LDQ0LjZ6Ii8+DQo8L3N2Zz4NCg=='; | |
| 117 | 124 | |
| 118 | - // The icon in the data URI scheme. | |
| 119 | - $icon_data_uri = 'data:image/svg+xml;base64,' . $icon_base64; | |
| 125 | + // The icon in the data URI scheme. | |
| 126 | + $icon_data_uri = 'data:image/svg+xml;base64,' . $icon_base64; | |
| 120 | 127 | |
| 121 | - delete_user_option( $current_user->ID, 'screen_layout_toplevel_page_mainwp_tab' ); | |
| 122 | - $this->dashBoard = add_menu_page( | |
| 123 | - 'MainWP', | |
| 124 | - 'MainWP', | |
| 125 | - 'read', | |
| 126 | - 'mainwp_tab', | |
| 127 | - array( | |
| 128 | - $this, | |
| 129 | - 'on_show_page', | |
| 130 | - ), | |
| 131 | - $icon_data_uri, | |
| 132 | - '2.00001' | |
| 133 | - ); | |
| 128 | + delete_user_option( $current_user->ID, 'screen_layout_toplevel_page_mainwp_tab' ); | |
| 134 | 129 | |
| 135 | - if ( mainwp_current_user_have_right( 'dashboard', 'access_global_dashboard' ) ) { | |
| 136 | - add_submenu_page( | |
| 137 | - 'mainwp_tab', | |
| 138 | - 'MainWP', | |
| 139 | - __( 'Overview', 'mainwp' ), | |
| 140 | - 'read', | |
| 141 | - 'mainwp_tab', | |
| 142 | - array( | |
| 143 | - $this, | |
| 144 | - 'on_show_page', | |
| 145 | - ) | |
| 146 | - ); | |
| 147 | - } | |
| 130 | + $this->dashBoard = add_menu_page( | |
| 131 | + 'MainWP', | |
| 132 | + 'MainWP', | |
| 133 | + 'read', | |
| 134 | + 'mainwp_tab', | |
| 135 | + array( | |
| 136 | + $this, | |
| 137 | + 'on_show_page', | |
| 138 | + ), | |
| 139 | + $icon_data_uri, | |
| 140 | + '2.00001' | |
| 141 | + ); | |
| 148 | 142 | |
| 149 | - $val = get_user_option( 'screen_layout_' . $this->dashBoard ); | |
| 150 | - if ( ! MainWP_Utility::ctype_digit( $val ) ) { | |
| 151 | - update_user_option( $current_user->ID, 'screen_layout_' . $this->dashBoard, 2, true ); | |
| 152 | - } | |
| 153 | - add_action( 'load-' . $this->dashBoard, array( &$this, 'on_load_page' ) ); | |
| 154 | - self::init_left_menu(); | |
| 143 | + add_submenu_page( | |
| 144 | + 'mainwp_tab', | |
| 145 | + 'MainWP', | |
| 146 | + __( 'Operations', 'mainwp' ), | |
| 147 | + 'read', | |
| 148 | + 'mainwp_tab', | |
| 149 | + array( | |
| 150 | + $this, | |
| 151 | + 'on_show_page', | |
| 152 | + ) | |
| 153 | + ); | |
| 155 | 154 | |
| 156 | - } | |
| 157 | - } | |
| 155 | + $val = get_user_option( 'screen_layout_' . $this->dashBoard ); | |
| 156 | + if ( ! MainWP_Utility::ctype_digit( $val ) ) { | |
| 157 | + update_user_option( $current_user->ID, 'screen_layout_' . $this->dashBoard, 2, true ); | |
| 158 | + } | |
| 159 | + add_action( 'load-' . $this->dashBoard, array( &$this, 'on_load_page' ) ); | |
| 160 | + static::init_left_menu(); | |
| 158 | 161 | |
| 159 | - /** | |
| 160 | - * Instantiate the MainWP Overview Menu item. | |
| 161 | - * | |
| 162 | - * @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu() | |
| 163 | - */ | |
| 164 | - public static function init_left_menu() { | |
| 165 | - MainWP_Menu::add_left_menu( | |
| 166 | - array( | |
| 167 | - 'title' => esc_html__( 'Overview', 'mainwp' ), | |
| 168 | - 'parent_key' => 'mainwp_tab', | |
| 169 | - 'slug' => 'mainwp_tab', | |
| 170 | - 'href' => 'admin.php?page=mainwp_tab', | |
| 171 | - 'icon' => '<i class="th large icon"></i>', | |
| 172 | - ), | |
| 173 | - 0 | |
| 174 | - ); | |
| 175 | - } | |
| 162 | + } | |
| 163 | + } | |
| 176 | 164 | |
| 177 | - /** | |
| 178 | - * Method on_load_page() | |
| 179 | - * | |
| 180 | - * Run on page load. | |
| 181 | - */ | |
| 182 | - public function on_load_page() { | |
| 183 | - wp_enqueue_script( 'common' ); | |
| 184 | - wp_enqueue_script( 'wp-lists' ); | |
| 185 | - wp_enqueue_script( 'postbox' ); | |
| 186 | - wp_enqueue_script( 'dashboard' ); | |
| 187 | - wp_enqueue_script( 'widgets' ); | |
| 165 | + /** | |
| 166 | + * Instantiate the MainWP Overview Menu item. | |
| 167 | + * | |
| 168 | + * @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu() | |
| 169 | + */ | |
| 170 | + public static function init_left_menu() { | |
| 171 | + MainWP_Menu::add_left_menu( | |
| 172 | + array( | |
| 173 | + 'title' => esc_html__( 'Operations', 'mainwp' ), | |
| 174 | + 'parent_key' => 'mainwp_tab', | |
| 175 | + 'slug' => 'mainwp_tab', | |
| 176 | + 'href' => 'admin.php?page=mainwp_tab', | |
| 177 | + 'icon' => '<i class="th large icon"></i>', | |
| 178 | + ), | |
| 179 | + 0 | |
| 180 | + ); | |
| 181 | + } | |
| 188 | 182 | |
| 189 | - self::add_meta_boxes( $this->dashBoard ); | |
| 190 | - } | |
| 183 | + /** | |
| 184 | + * Method on_load_page() | |
| 185 | + * | |
| 186 | + * Run on page load. | |
| 187 | + */ | |
| 188 | + public function on_load_page() { | |
| 189 | + wp_enqueue_script( 'common' ); | |
| 190 | + wp_enqueue_script( 'wp-lists' ); | |
| 191 | + wp_enqueue_script( 'postbox' ); | |
| 192 | + wp_enqueue_script( 'dashboard' ); | |
| 193 | + wp_enqueue_script( 'widgets' ); | |
| 191 | 194 | |
| 192 | - /** | |
| 193 | - * Method add_meta_boxes() | |
| 194 | - * | |
| 195 | - * Add MainWP Overview Page Widgets. | |
| 196 | - * | |
| 197 | - * @param array $page Current page. | |
| 198 | - * | |
| 199 | - * @uses \MainWP\Dashboard\MainWP_System_Handler::apply_filters() | |
| 200 | - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_current_wpid() | |
| 201 | - * @uses \MainWP\Dashboard\MainWP_UI::add_widget_box() | |
| 202 | - * @uses \MainWP\Dashboard\MainWP_Connection_Status::get_class_name() | |
| 203 | - * @uses \MainWP\Dashboard\MainWP_Recent_Pages::get_class_name() | |
| 204 | - * @uses \MainWP\Dashboard\MainWP_Recent_Posts::get_class_name() | |
| 205 | - * @uses \MainWP\Dashboard\MainWP_Security_Issues_Widget::get_class_name() | |
| 206 | - * @uses \MainWP\Dashboard\MainWP_Updates_Overview::get_class_name() | |
| 207 | - */ | |
| 208 | - public static function add_meta_boxes( $page ) { // phpcs:ignore -- complex method. Current complexity is the only way to achieve desired results, pull request solutions appreciated. | |
| 195 | + static::add_meta_boxes( $this->dashBoard ); | |
| 196 | + } | |
| 209 | 197 | |
| 210 | - /** | |
| 211 | - * Get getmetaboxes | |
| 212 | - * | |
| 213 | - * Adds metaboxes (widgets) to the Overview page. | |
| 214 | - * | |
| 215 | - * @since Unknown | |
| 216 | - */ | |
| 217 | - $extMetaBoxs = MainWP_System_Handler::instance()->apply_filters( 'mainwp-getmetaboxes', array() ); | |
| 218 | - $extMetaBoxs = MainWP_System_Handler::instance()->apply_filters( 'mainwp_getmetaboxes', $extMetaBoxs ); // hooks to load widgets for general overview dashboard page. | |
| 198 | + /** | |
| 199 | + * Method add_meta_boxes() | |
| 200 | + * | |
| 201 | + * Add MainWP Overview Page Widgets. | |
| 202 | + * | |
| 203 | + * @param array $page Current page. | |
| 204 | + * | |
| 205 | + * @uses \MainWP\Dashboard\MainWP_System_Handler::apply_filters() | |
| 206 | + * @uses \MainWP\Dashboard\MainWP_System_Utility::get_current_wpid() | |
| 207 | + * @uses \MainWP\Dashboard\MainWP_UI::add_widget_box() | |
| 208 | + * @uses \MainWP\Dashboard\MainWP_Connection_Status::get_class_name() | |
| 209 | + * @uses \MainWP\Dashboard\MainWP_Recent_Pages::get_class_name() | |
| 210 | + * @uses \MainWP\Dashboard\MainWP_Recent_Posts::get_class_name() | |
| 211 | + * @uses \MainWP\Dashboard\MainWP_Security_Issues_Widget::get_class_name() | |
| 212 | + * @uses \MainWP\Dashboard\MainWP_Updates_Overview::get_class_name() | |
| 213 | + */ | |
| 214 | + public static function add_meta_boxes( $page ) { // phpcs:ignore -- NOSONAR - complex method. Current complexity is the only way to achieve desired results, pull request solutions appreciated. | |
| 219 | 215 | |
| 220 | - foreach ( $extMetaBoxs as $box ) { | |
| 221 | - if ( isset( $box['plugin'] ) ) { | |
| 222 | - $name = basename( $box['plugin'], '.php' ); | |
| 223 | - self::$enable_widgets[ $name ] = true; | |
| 224 | - } | |
| 225 | - } | |
| 216 | + /** | |
| 217 | + * Get getmetaboxes | |
| 218 | + * | |
| 219 | + * Adds metaboxes (widgets) to the Operations page. | |
| 220 | + * | |
| 221 | + * @since Unknown | |
| 222 | + */ | |
| 223 | + $extMetaBoxs = MainWP_System_Handler::instance()->apply_filters( 'mainwp-getmetaboxes', array() ); | |
| 224 | + $extMetaBoxs = MainWP_System_Handler::instance()->apply_filters( 'mainwp_getmetaboxes', $extMetaBoxs ); // hooks to load widgets for general overview dashboard page. | |
| 226 | 225 | |
| 227 | - $values = self::$enable_widgets; | |
| 226 | + foreach ( $extMetaBoxs as $box ) { | |
| 227 | + if ( isset( $box['plugin'] ) ) { | |
| 228 | + $name = basename( $box['plugin'], '.php' ); | |
| 229 | + static::$enable_widgets[ $name ] = true; | |
| 230 | + } | |
| 231 | + } | |
| 228 | 232 | |
| 229 | - /** | |
| 230 | - * Unset unwanted Widgets | |
| 231 | - * | |
| 232 | - * Contains the list of enabled widgets and allows user to unset unwanted widgets. | |
| 233 | - * | |
| 234 | - * @param array $values Array containing enabled widgets. | |
| 235 | - * @param int $dashboard_siteid Child site (Overview) ID. | |
| 236 | - * | |
| 237 | - * @since 4.0 | |
| 238 | - */ | |
| 239 | - $values = apply_filters( 'mainwp_overview_enabled_widgets', $values, null ); | |
| 240 | - self::$enable_widgets = array_merge( self::$enable_widgets, $values ); | |
| 233 | + $values = static::$enable_widgets; | |
| 241 | 234 | |
| 242 | - $i = 1; | |
| 243 | - foreach ( $extMetaBoxs as $metaBox ) { | |
| 244 | - $enabled = true; | |
| 245 | - if ( isset( $metaBox['plugin'] ) ) { | |
| 246 | - $name = basename( $metaBox['plugin'], '.php' ); | |
| 247 | - if ( isset( self::$enable_widgets[ $name ] ) && ! self::$enable_widgets[ $name ] ) { | |
| 248 | - $enabled = false; | |
| 249 | - } | |
| 250 | - } | |
| 235 | + /** | |
| 236 | + * Unset unwanted Widgets | |
| 237 | + * | |
| 238 | + * Contains the list of enabled widgets and allows user to unset unwanted widgets. | |
| 239 | + * | |
| 240 | + * @param array $values Array containing enabled widgets. | |
| 241 | + * @param int $dashboard_siteid Child site (Overview) ID. | |
| 242 | + * | |
| 243 | + * @since 4.0 | |
| 244 | + */ | |
| 245 | + $values = apply_filters( 'mainwp_overview_enabled_widgets', $values, null ); | |
| 246 | + static::$enable_widgets = array_merge( static::$enable_widgets, $values ); | |
| 251 | 247 | |
| 252 | - $id = isset( $metaBox['id'] ) ? $metaBox['id'] : $i++; | |
| 253 | - $id = 'advanced-' . $id; | |
| 248 | + // Load the Updates Overview widget. | |
| 249 | + if ( static::$enable_widgets['overview'] ) { | |
| 250 | + MainWP_UI::add_widget_box( 'overview', array( MainWP_Updates_Overview::get_class_name(), 'render' ), $page, array( 0, 0, 12, 20 ) ); | |
| 251 | + } | |
| 254 | 252 | |
| 255 | - if ( $enabled ) { | |
| 256 | - if ( 'google-widget' === $metaBox['id'] || 'matomo' === $metaBox['id'] ) { | |
| 257 | - MainWP_UI::add_widget_box( $id, $metaBox['callback'], $page, array( 1, 1, 4, 18 ) ); | |
| 258 | - } else { | |
| 259 | - MainWP_UI::add_widget_box( $id, $metaBox['callback'], $page, array( 1, 1, 4, 11 ) ); | |
| 260 | - } | |
| 261 | - } | |
| 262 | - } | |
| 253 | + // Load the Clients widget. | |
| 254 | + if ( static::$enable_widgets['clients'] && \mainwp_current_user_can( 'dashboard', 'manage_clients' ) ) { | |
| 255 | + MainWP_UI::add_widget_box( 'clients', array( MainWP_Clients::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) ); | |
| 256 | + } | |
| 263 | 257 | |
| 264 | - // Load the Recent Posts widget. | |
| 265 | - if ( mainwp_current_user_have_right( 'dashboard', 'manage_posts' ) ) { | |
| 266 | - if ( self::$enable_widgets['recent_posts'] ) { | |
| 267 | - MainWP_UI::add_widget_box( 'recent_posts', array( MainWP_Recent_Posts::get_class_name(), 'render' ), $page, array( 1, 1, 6, 11 ) ); | |
| 268 | - } | |
| 269 | - } | |
| 258 | + // Load the Non-MainWP Changes widget. | |
| 259 | + if ( static::$enable_widgets['non_mainwp_changes'] ) { | |
| 260 | + MainWP_UI::add_widget_box( 'non_mainwp_changes', array( MainWP_Site_Actions::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) ); | |
| 261 | + } | |
| 270 | 262 | |
| 271 | - // Load the Recent Pages widget. | |
| 272 | - if ( mainwp_current_user_have_right( 'dashboard', 'manage_pages' ) ) { | |
| 273 | - if ( self::$enable_widgets['recent_pages'] ) { | |
| 274 | - MainWP_UI::add_widget_box( 'recent_pages', array( MainWP_Recent_Pages::get_class_name(), 'render' ), $page, array( 1, 1, 6, 11 ) ); | |
| 275 | - } | |
| 276 | - } | |
| 263 | + // Load the Connection Status widget. | |
| 264 | + if ( ! MainWP_System_Utility::get_current_wpid() && static::$enable_widgets['connection_status'] ) { | |
| 265 | + MainWP_UI::add_widget_box( 'connection_status', array( MainWP_Connection_Status::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) ); | |
| 266 | + } | |
| 277 | 267 | |
| 278 | - // Load the Security Issues widget. | |
| 279 | - if ( mainwp_current_user_have_right( 'dashboard', 'manage_security_issues' ) ) { | |
| 280 | - if ( self::$enable_widgets['security_issues'] ) { | |
| 281 | - MainWP_UI::add_widget_box( 'security_issues', array( MainWP_Security_Issues_Widget::get_class_name(), 'render_widget' ), $page, array( 1, 1, 4, 4 ) ); | |
| 282 | - } | |
| 283 | - } | |
| 268 | + // Load the Connection Status widget. | |
| 269 | + if ( MainWP_Uptime_Monitoring_Edit::is_enable_global_monitoring() && ! MainWP_System_Utility::get_current_wpid() && static::$enable_widgets['uptime_monitoring_status'] ) { | |
| 270 | + MainWP_UI::add_widget_box( 'uptime_monitoring_status', array( MainWP_Uptime_Monitoring_Status::get_class_name(), 'render_status' ), $page, array( -1, -1, 4, 30 ) ); | |
| 271 | + } | |
| 284 | 272 | |
| 285 | - // Load the Connection Status widget. | |
| 286 | - if ( ! MainWP_System_Utility::get_current_wpid() ) { | |
| 287 | - if ( self::$enable_widgets['connection_status'] ) { | |
| 288 | - MainWP_UI::add_widget_box( 'connection_status', array( MainWP_Connection_Status::get_class_name(), 'render' ), $page, array( 1, 1, 4, 5 ) ); | |
| 289 | - } | |
| 290 | - } | |
| 273 | + // Load the Security Issues widget. | |
| 274 | + if ( \mainwp_current_user_can( 'dashboard', 'manage_security_issues' ) && static::$enable_widgets['security_issues'] ) { | |
| 275 | + MainWP_UI::add_widget_box( 'security_issues', array( MainWP_Security_Issues_Widget::get_class_name(), 'render_widget' ), $page, array( -1, -1, 4, 30 ) ); | |
| 276 | + } | |
| 291 | 277 | |
| 292 | - // Load the Non-MainWP Changes widget. | |
| 293 | - if ( self::$enable_widgets['non_mainwp_changes'] ) { | |
| 294 | - MainWP_UI::add_widget_box( 'non_mainwp_changes', array( MainWP_Site_Actions::get_class_name(), 'render' ), $page, array( 1, 1, 4, 18 ) ); | |
| 295 | - } | |
| 278 | + // Load the Recent Pages widget. | |
| 279 | + if ( \mainwp_current_user_can( 'dashboard', 'manage_pages' ) && static::$enable_widgets['recent_pages'] ) { | |
| 280 | + MainWP_UI::add_widget_box( 'recent_pages', array( MainWP_Recent_Pages::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) ); | |
| 281 | + } | |
| 296 | 282 | |
| 297 | - // Load the Clients widget. | |
| 298 | - if ( self::$enable_widgets['clients'] ) { | |
| 299 | - MainWP_UI::add_widget_box( 'clients', array( MainWP_Clients::get_class_name(), 'render' ), $page, array( 1, 1, 4, 9 ) ); | |
| 300 | - } | |
| 283 | + // Load the Recent Posts widget. | |
| 284 | + if ( \mainwp_current_user_can( 'dashboard', 'manage_posts' ) && static::$enable_widgets['recent_posts'] ) { | |
| 285 | + MainWP_UI::add_widget_box( 'recent_posts', array( MainWP_Recent_Posts::get_class_name(), 'render' ), $page, array( -1, -1, 4, 30 ) ); | |
| 286 | + } | |
| 301 | 287 | |
| 302 | - // Load the Updates Overview widget. | |
| 303 | - if ( self::$enable_widgets['overview'] ) { | |
| 304 | - MainWP_UI::add_widget_box( 'overview', array( MainWP_Updates_Overview::get_class_name(), 'render' ), $page, array( 1, 1, 4, 18 ) ); | |
| 305 | - } | |
| 306 | - } | |
| 288 | + $i = 1; | |
| 289 | + foreach ( $extMetaBoxs as $metaBox ) { | |
| 290 | + $enabled = true; | |
| 291 | + if ( isset( $metaBox['plugin'] ) ) { | |
| 292 | + $name = basename( $metaBox['plugin'], '.php' ); | |
| 293 | + if ( isset( static::$enable_widgets[ $name ] ) && ! static::$enable_widgets[ $name ] ) { | |
| 294 | + $enabled = false; | |
| 295 | + } | |
| 296 | + } | |
| 307 | 297 | |
| 308 | - /** | |
| 309 | - * Method on_show_page() | |
| 310 | - * | |
| 311 | - * When the page loads render the body content. | |
| 312 | - * | |
| 313 | - * @uses \MainWP\Dashboard\MainWP_UI::render_top_header() | |
| 314 | - * @uses \MainWP\Dashboard\MainWP_UI::render_second_top_header() | |
| 315 | - */ | |
| 316 | - public function on_show_page() { | |
| 317 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'access_global_dashboard' ) ) { | |
| 318 | - mainwp_do_not_have_permissions( esc_html__( 'global dashboard', 'mainwp' ) ); | |
| 319 | - return; | |
| 320 | - } | |
| 298 | + $id = isset( $metaBox['id'] ) ? $metaBox['id'] : $i++; | |
| 299 | + $id = 'advanced-' . $id; | |
| 321 | 300 | |
| 322 | - /** | |
| 323 | - * Screen layout columns array. | |
| 324 | - * | |
| 325 | - * @global object | |
| 326 | - */ | |
| 327 | - global $screen_layout_columns; | |
| 301 | + $wg_layout = isset( $metaBox['layout'] ) && is_array( $metaBox['layout'] ) ? $metaBox['layout'] : array( -1, -1, 6, 30 ); | |
| 328 | 302 | |
| 329 | - $params = array( | |
| 330 | - 'title' => esc_html__( 'Overview', 'mainwp' ), | |
| 331 | - ); | |
| 303 | + if ( $enabled ) { | |
| 304 | + MainWP_UI::add_widget_box( $id, $metaBox['callback'], $page, $wg_layout ); | |
| 305 | + } | |
| 306 | + } | |
| 307 | + } | |
| 332 | 308 | |
| 333 | - MainWP_UI::render_top_header( $params ); | |
| 309 | + /** | |
| 310 | + * Method on_show_page() | |
| 311 | + * | |
| 312 | + * When the page loads render the body content. | |
| 313 | + * | |
| 314 | + * @uses \MainWP\Dashboard\MainWP_UI::render_top_header() | |
| 315 | + * @uses \MainWP\Dashboard\MainWP_UI::render_second_top_header() | |
| 316 | + */ | |
| 317 | + public function on_show_page() { | |
| 318 | + if ( ! \mainwp_current_user_can( 'dashboard', 'access_global_dashboard' ) ) { | |
| 319 | + \mainwp_do_not_have_permissions( esc_html__( 'global dashboard', 'mainwp' ) ); | |
| 320 | + return; | |
| 321 | + } | |
| 334 | 322 | |
| 335 | - MainWP_UI::render_second_top_header(); | |
| 323 | + /** | |
| 324 | + * Screen layout columns array. | |
| 325 | + * | |
| 326 | + * @global object | |
| 327 | + */ | |
| 328 | + global $screen_layout_columns; | |
| 336 | 329 | |
| 337 | - self::render_dashboard_body(); | |
| 338 | - ?> | |
| 339 | - </div> | |
| 340 | - <?php | |
| 341 | - } | |
| 330 | + $params = array( | |
| 331 | + 'title' => esc_html__( 'Operations', 'mainwp' ), | |
| 332 | + ); | |
| 342 | 333 | |
| 334 | + MainWP_UI::render_top_header( $params ); | |
| 343 | 335 | |
| 344 | - /** | |
| 345 | - * Method render_dashboard_body() | |
| 346 | - * | |
| 347 | - * Render the Dashboard Body content. | |
| 348 | - * | |
| 349 | - * @param object $websites Object containing child sites info. | |
| 350 | - * | |
| 351 | - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_current_wpid() | |
| 352 | - * @uses \MainWP\Dashboard\MainWP_System_Utility::get_page_id() | |
| 353 | - * @uses \MainWP\Dashboard\MainWP_UI::do_widget_boxes() | |
| 354 | - * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message() | |
| 355 | - */ | |
| 356 | - public static function render_dashboard_body( $websites = array() ) { | |
| 357 | - $current_wp_id = MainWP_System_Utility::get_current_wpid(); | |
| 358 | - $website = null; | |
| 359 | - if ( ! empty( $current_wp_id ) ) { | |
| 360 | - $website = $websites[0]; | |
| 361 | - } | |
| 362 | - $screen = get_current_screen(); | |
| 336 | + MainWP_UI::render_second_top_header(); | |
| 363 | 337 | |
| 364 | - MainWP_Demo_Handle::get_instance()->init_data_demo(); | |
| 365 | - ?> | |
| 366 | - <div class="mainwp-primary-content-wrap"> | |
| 367 | - <div class="ui segment" style="padding-top:0px;padding-bottom:0px;margin-bottom:0px;"> | |
| 368 | - <div id="mainwp-dashboard-info-box"></div> | |
| 369 | - <?php | |
| 370 | - if ( ! empty( $current_wp_id ) ) { | |
| 371 | - if ( ! empty( $website->sync_errors ) ) { | |
| 372 | - ?> | |
| 373 | - <div class="ui red message"> | |
| 374 | - <p><?php echo '<strong>' . esc_html( stripslashes( $website->name ) ) . '</strong>' . esc_html__( ' is Disconnected. Click the Reconnect button to establish the connection again.', 'mainwp' ); ?></p> | |
| 375 | - </div> | |
| 376 | - <?php | |
| 377 | - } | |
| 378 | - } | |
| 379 | - ?> | |
| 380 | - <div id="mainwp-message-zone" class="ui message" style="display:none;"></div> | |
| 381 | - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'widgets' ) ) : ?> | |
| 382 | - <div class="ui info message"> | |
| 383 | - <i class="close icon mainwp-notice-dismiss" notice-id="widgets"></i> | |
| 384 | - <?php printf( esc_html__( 'To hide or show a widget, click the Cog (%1$s) icon.', 'mainwp' ), '<i class="cog icon"></i>' ); ?> | |
| 385 | - </div> | |
| 386 | - <?php endif; ?> | |
| 387 | - </div> | |
| 388 | - <?php | |
| 389 | - /** | |
| 390 | - * Action: mainwp_before_overview_widgets | |
| 391 | - * | |
| 392 | - * Fires at the top of the Overview page (before first widget). | |
| 393 | - * | |
| 394 | - * @since 4.1 | |
| 395 | - */ | |
| 396 | - do_action( 'mainwp_before_overview_widgets', 'dashboard' ); | |
| 397 | - ?> | |
| 398 | - <div id="mainwp-grid-wrapper" class="gridster"> | |
| 399 | - <?php MainWP_UI::do_widget_boxes( $screen->id ); ?> | |
| 400 | - </div> | |
| 401 | - <?php | |
| 402 | - /** | |
| 403 | - * Action: 'mainwp_after_overview_widgets' | |
| 404 | - * | |
| 405 | - * Fires at the bottom of the Overview page (after the last widget). | |
| 406 | - * | |
| 407 | - * @since 4.1 | |
| 408 | - */ | |
| 409 | - do_action( 'mainwp_after_overview_widgets', 'dashboard' ); | |
| 410 | - ?> | |
| 411 | - <script type="text/javascript"> | |
| 412 | - jQuery( document ).ready( function( $ ) { | |
| 413 | - jQuery( '.mainwp-widget .mainwp-dropdown-tab .item' ).tab(); | |
| 414 | - mainwp_get_icon_start(); | |
| 415 | - } ); | |
| 416 | - </script> | |
| 417 | - <?php | |
| 418 | - MainWP_UI::render_modal_upload_icon(); | |
| 419 | - MainWP_Updates::render_plugin_details_modal(); | |
| 420 | - } | |
| 338 | + static::render_dashboard_body(); | |
| 339 | + ?> | |
| 340 | + </div> | |
| 341 | + <?php | |
| 342 | + } | |
| 421 | 343 | |
| 422 | - /** | |
| 423 | - * Method mainwp_help_content() | |
| 424 | - * | |
| 425 | - * Hook the section help content to the Help Sidebar element | |
| 426 | - * | |
| 427 | - * @return void | |
| 428 | - */ | |
| 429 | - public static function mainwp_help_content() { | |
| 430 | - if ( isset( $_GET['page'] ) && 'mainwp_tab' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 431 | - ?> | |
| 432 | - <p><?php esc_html_e( 'If you need help with your MainWP Dashboard, please review following help documents', 'mainwp' ); ?></p> | |
| 433 | - <div class="ui relaxed bulleted list"> | |
| 434 | - <div class="item"><a href="https://kb.mainwp.com/docs/understanding-mainwp-dashboard-user-interface/" target="_blank">Understanding MainWP Dashboard UI</a> <i class="external alternate icon"></i></div> | |
| 435 | - <div class="item"><a href="https://kb.mainwp.com/docs/mainwp-navigation/" target="_blank">MainWP Navigation</a> <i class="external alternate icon"></i></div> | |
| 436 | - <div class="item"><a href="https://kb.mainwp.com/docs/screen-options/" target="_blank">Page Settings</a> <i class="external alternate icon"></i></div> | |
| 437 | - <div class="item"><a href="https://kb.mainwp.com/docs/mainwp-dashboard/" target="_blank">MainWP Dashboard</a> <i class="external alternate icon"></i></div> | |
| 438 | - <div class="item"><a href="https://kb.mainwp.com/docs/mainwp-tables/" target="_blank">MainWP Tables</a> <i class="external alternate icon"></i></div> | |
| 439 | - <div class="item"><a href="https://kb.mainwp.com/docs/individual-child-site-mode/" target="_blank">Individual Child Site Mode</a> <i class="external alternate icon"></i></div> | |
| 440 | - <?php | |
| 441 | - /** | |
| 442 | - * Action: mainwp_overview_help_item | |
| 443 | - * | |
| 444 | - * Fires at the bottom of the help articles list in the Help sidebar on the Overview page. | |
| 445 | - * | |
| 446 | - * Suggested HTML markup: | |
| 447 | - * | |
| 448 | - * <div class="item"><a href="Your custom URL">Your custom text</a></div> | |
| 449 | - * | |
| 450 | - * @since 4.1 | |
| 451 | - */ | |
| 452 | - do_action( 'mainwp_overview_help_item' ); | |
| 453 | - ?> | |
| 454 | - </div> | |
| 455 | - <?php | |
| 456 | - } | |
| 457 | - } | |
| 344 | + | |
| 345 | + /** | |
| 346 | + * Method render_dashboard_body() | |
| 347 | + * | |
| 348 | + * Render the Dashboard Body content. | |
| 349 | + * | |
| 350 | + * @param object $websites Object containing child sites info. | |
| 351 | + * | |
| 352 | + * @uses \MainWP\Dashboard\MainWP_System_Utility::get_current_wpid() | |
| 353 | + * @uses \MainWP\Dashboard\MainWP_System_Utility::get_page_id() | |
| 354 | + * @uses \MainWP\Dashboard\MainWP_UI::do_widget_boxes() | |
| 355 | + * @uses \MainWP\Dashboard\MainWP_Utility::show_mainwp_message() | |
| 356 | + */ | |
| 357 | + public static function render_dashboard_body( $websites = array() ) { | |
| 358 | + $current_wp_id = MainWP_System_Utility::get_current_wpid(); | |
| 359 | + $website = null; | |
| 360 | + if ( ! empty( $current_wp_id ) ) { | |
| 361 | + $website = $websites[0]; | |
| 362 | + } | |
| 363 | + $screen = get_current_screen(); | |
| 364 | + ?> | |
| 365 | + <div class="mainwp-primary-content-wrap"> | |
| 366 | + <div class="ui segment"> | |
| 367 | + <?php if ( ! empty( $current_wp_id ) && ! empty( $website->sync_errors ) ) : ?> | |
| 368 | + <div class="ui red message" style="margin: 1em;"> | |
| 369 | + <?php echo '<strong>' . esc_html( stripslashes( $website->name ) ) . '</strong>' . esc_html__( ' is Disconnected. Click the Reconnect button to establish the connection again.', 'mainwp' ); ?> | |
| 370 | + </div> | |
| 371 | + <?php endif; ?> | |
| 372 | + <div id="mainwp-message-zone" class="ui message" style="display:none;"></div> | |
| 373 | + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'widgets' ) ) : ?> | |
| 374 | + <div class="ui message" style="margin: 1em;"> | |
| 375 | + <i class="close icon mainwp-notice-dismiss" notice-id="widgets"></i> | |
| 376 | + <?php /* translators: 1: bulb emoji, 2: cog icon, 3: layout icon */ printf( esc_html__( '%1$s Tip: You can drag and drop widgets to reorder your dashboard, use Page Settings (%2$s) to show or hide widgets, and use Layout (%3$s) in the header to save and load your widget layouts.', 'mainwp' ), '<em data-emoji=":bulb:" class="small"></em>', '<i class="cog fitted icon"></i>', '<i class="all border fitted icon"></i>' ); ?> | |
| 377 | + </div> | |
| 378 | + <?php endif; ?> | |
| 379 | + <?php do_action( 'mainwp_module_log_render_db_update_notice' ); ?> | |
| 380 | + <?php do_action( 'mainwp_module_log_render_db_size_notice', 300, 'overview' ); ?> | |
| 381 | + | |
| 382 | + <?php | |
| 383 | + /** | |
| 384 | + * Action: mainwp_before_overview_widgets | |
| 385 | + * | |
| 386 | + * Fires at the top of the Operations page (before first widget). | |
| 387 | + * | |
| 388 | + * @since 4.1 | |
| 389 | + */ | |
| 390 | + do_action( 'mainwp_before_overview_widgets', 'dashboard', $current_wp_id, $website ); | |
| 391 | + ?> | |
| 392 | + <div id="mainwp-grid-wrapper" class="gridster"> | |
| 393 | + <div id="mainwp-widgets-placeholder" class="ui page dimmer"> | |
| 394 | + <div class="ui double text loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div> | |
| 395 | + </div> | |
| 396 | + <script> | |
| 397 | + jQuery( document ).ready( function () { | |
| 398 | + jQuery('#mainwp-widgets-placeholder').dimmer('show'); | |
| 399 | + }); | |
| 400 | + </script> | |
| 401 | + <?php MainWP_UI::do_widget_boxes( $screen->id ); ?> | |
| 402 | + </div> | |
| 403 | + <?php | |
| 404 | + /** | |
| 405 | + * Action: 'mainwp_after_overview_widgets' | |
| 406 | + * | |
| 407 | + * Fires at the bottom of the Operations page (after the last widget). | |
| 408 | + * | |
| 409 | + * @since 4.1 | |
| 410 | + */ | |
| 411 | + do_action( 'mainwp_after_overview_widgets', 'dashboard' ); | |
| 412 | + ?> | |
| 413 | + </div> | |
| 414 | + <script type="text/javascript"> | |
| 415 | + jQuery( document ).ready( function( $ ) { | |
| 416 | + jQuery( '.mainwp-widget .mainwp-dropdown-tab .item' ).tab(); | |
| 417 | + mainwp_get_icon_start(); | |
| 418 | + } ); | |
| 419 | + </script> | |
| 420 | + <?php | |
| 421 | + MainWP_Ui_Manage_Widgets_Layout::render_modal_save_layout(); | |
| 422 | + MainWP_UI::render_modal_upload_icon(); | |
| 423 | + MainWP_Updates::render_plugin_details_modal(); | |
| 424 | + MainWP_Updates::render_changes_history_modal(); | |
| 425 | + } | |
| 426 | + | |
| 427 | + /** | |
| 428 | + * Method mainwp_help_content() | |
| 429 | + * | |
| 430 | + * Creates the MainWP Help Documentation List for the help component in the sidebar. | |
| 431 | + */ | |
| 432 | + public static function mainwp_help_content() { | |
| 433 | + if ( isset( $_GET['page'] ) && 'mainwp_tab' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 434 | + ?> | |
| 435 | + <p><?php esc_html_e( 'If you need help with your MainWP Dashboard, please review following help documents', 'mainwp' ); ?></p> | |
| 436 | + <div class="ui list"> | |
| 437 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface" target="_blank">Understanding MainWP Dashboard UI</a></div> | |
| 438 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#navigation" target="_blank">MainWP Navigation</a></div> | |
| 439 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#page-settings" target="_blank">Page Settings</a></div> | |
| 440 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#widgetized-pages" target="_blank">Widgetized Page Layout</a></div> | |
| 441 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#tables" target="_blank">MainWP Tables</a></div> | |
| 442 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/getting-started/mainwp-user-interface#individual-site-mode" target="_blank">Individual Child Site Mode</a></div> | |
| 443 | + <?php | |
| 444 | + /** | |
| 445 | + * Action: mainwp_overview_help_item | |
| 446 | + * | |
| 447 | + * Fires at the bottom of the help articles list in the Help sidebar on the Operations page. | |
| 448 | + * | |
| 449 | + * Suggested HTML markup: | |
| 450 | + * | |
| 451 | + * <div class="item"><a href="Your custom URL">Your custom text</a></div> | |
| 452 | + * | |
| 453 | + * @since 4.1 | |
| 454 | + */ | |
| 455 | + do_action( 'mainwp_overview_help_item' ); | |
| 456 | + ?> | |
| 457 | + </div> | |
| 458 | + <?php | |
| 459 | + } | |
| 460 | + } | |
| 458 | 461 | } |