| @@ -8,176 +8,142 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | namespace MainWP\Dashboard; |
| 11 | 11 | |
| 12 | +// Exit if accessed directly. | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | +} | |
| 16 | + | |
| 12 | 17 | /** |
| 13 | 18 | * Class MainWP_Get_Started |
| 14 | 19 | * |
| 15 | 20 | * @package MainWP\Dashboard |
| 16 | 21 | */ |
| 17 | -class MainWP_Get_Started { | |
| 22 | +class MainWP_Get_Started { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.nore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR. | |
| 18 | 23 | |
| 19 | - /** | |
| 20 | - * Method get_class_name() | |
| 21 | - * | |
| 22 | - * Get Class Name | |
| 23 | - * | |
| 24 | - * @return string __CLASS__ Class Name. | |
| 25 | - */ | |
| 26 | - public static function get_class_name() { | |
| 27 | - return __CLASS__; | |
| 28 | - } | |
| 24 | + /** | |
| 25 | + * Method get_class_name() | |
| 26 | + * | |
| 27 | + * Get Class Name | |
| 28 | + * | |
| 29 | + * @return string __CLASS__ Class Name. | |
| 30 | + */ | |
| 31 | + public static function get_class_name() { | |
| 32 | + return __CLASS__; | |
| 33 | + } | |
| 29 | 34 | |
| 30 | - /** | |
| 31 | - * Method get_name() | |
| 32 | - * | |
| 33 | - * Define Widget Title. | |
| 34 | - */ | |
| 35 | - public static function get_name() { | |
| 36 | - return esc_html__( 'Get Started with MainWP', 'mainwp' ); | |
| 37 | - } | |
| 35 | + /** | |
| 36 | + * Method get_name() | |
| 37 | + * | |
| 38 | + * Define Widget Title. | |
| 39 | + */ | |
| 40 | + public static function get_name() { | |
| 41 | + return esc_html__( 'Get Started with MainWP', 'mainwp' ); | |
| 42 | + } | |
| 38 | 43 | |
| 39 | - /** | |
| 40 | - * Method render() | |
| 41 | - */ | |
| 42 | - public static function render() { | |
| 43 | - self::render_content(); | |
| 44 | - } | |
| 44 | + /** | |
| 45 | + * Method render() | |
| 46 | + */ | |
| 47 | + public static function render() { | |
| 48 | + static::render_content(); | |
| 49 | + } | |
| 45 | 50 | |
| 46 | - /** | |
| 47 | - * Method render_sites() | |
| 48 | - * | |
| 49 | - * Grab available Child Sites updates a build Widget. | |
| 50 | - */ | |
| 51 | - public static function render_content() { | |
| 51 | + /** | |
| 52 | + * Method render_sites() | |
| 53 | + * | |
| 54 | + * Grab available Child Sites updates a build Widget. | |
| 55 | + */ | |
| 56 | + public static function render_content() { | |
| 57 | + ?> | |
| 58 | + <div class="mainwp-widget-header"> | |
| 59 | + <h2 class="ui header handle-drag"> | |
| 60 | + <?php | |
| 61 | + /** | |
| 62 | + * Filter: mainwp_get_started_widget_title | |
| 63 | + * | |
| 64 | + * Filters the widget title text. | |
| 65 | + * | |
| 66 | + * @since 5.0 | |
| 67 | + */ | |
| 68 | + echo esc_html( apply_filters( 'mainwp_get_started_widget_title', esc_html__( 'Get Started with MainWP', 'mainwp' ) ) ); | |
| 69 | + ?> | |
| 70 | + <div class="sub header"><?php esc_html_e( 'Kickstart your MainWP experience with our simple checklist.', 'mainwp' ); ?></div> | |
| 71 | + </h2> | |
| 72 | + </div> | |
| 73 | + <div class="mainwp-scrolly-overflow"> | |
| 74 | + <?php | |
| 75 | + $extensions = MainWP_Extensions_Handler::get_extensions(); | |
| 52 | 76 | |
| 53 | - ?> | |
| 77 | + $count_sites = MainWP_Manage_Sites::get_total_sites(); | |
| 78 | + $count_clients = MainWP_DB_Client::instance()->count_total_clients(); | |
| 79 | + $count_costs = apply_filters( 'mainwp_module_cost_tracker_get_total_cost', 0 ); | |
| 80 | + $count_extensions = is_array( $extensions ) ? count( $extensions ) : 0; | |
| 54 | 81 | |
| 55 | - <div class="ui grid mainwp-widget-header"> | |
| 56 | - <div class="sixteen wide column"> | |
| 57 | - <h3 class="ui header handle-drag"> | |
| 58 | - <?php | |
| 59 | - /** | |
| 60 | - * Filter: mainwp_get_started_widget_title | |
| 61 | - * | |
| 62 | - * Filters the widget title text. | |
| 63 | - * | |
| 64 | - * @since 5.0 | |
| 65 | - */ | |
| 66 | - echo esc_html( apply_filters( 'mainwp_get_started_widget_title', esc_html__( 'Get Started with MainWP', 'mainwp' ) ) ); | |
| 67 | - ?> | |
| 68 | - <div class="sub header"><?php esc_html_e( 'Kickstart your MainWP experience with our simple checklist.', 'mainwp' ); ?></div> | |
| 69 | - </h3> | |
| 70 | - </div> | |
| 71 | - </div> | |
| 72 | - <div class="mainwp-scrolly-overflow"> | |
| 73 | - <?php | |
| 74 | - $extensions = MainWP_Extensions_Handler::get_extensions(); | |
| 82 | + $started_done = true; | |
| 75 | 83 | |
| 76 | - $count_sites = MainWP_Manage_Sites::get_total_sites(); | |
| 77 | - $count_clients = MainWP_DB_Client::instance()->count_total_clients(); | |
| 78 | - $count_costs = apply_filters( 'mainwp_module_cost_tracker_get_total_cost', 0 ); | |
| 79 | - $count_extensions = is_array( $extensions ) ? count( $extensions ) : 0; | |
| 84 | + if ( empty( $count_sites ) || empty( $count_clients ) || empty( $count_costs ) || empty( $count_extensions ) ) { | |
| 85 | + $started_done = false; | |
| 86 | + } | |
| 80 | 87 | |
| 81 | - $started_done = true; | |
| 88 | + if ( $started_done && MainWP_Utility::show_mainwp_message( 'notice', 'get-started' ) ) { | |
| 89 | + ?> | |
| 90 | + <div class="ui green message"> | |
| 91 | + <i class="close icon mainwp-notice-dismiss" notice-id="get-started"></i> | |
| 92 | + <div class="header"><?php esc_html_e( 'Congratulations!', 'mainwp' ); ?></div> | |
| 93 | + <?php esc_html_e( 'You can now use this widget as a handy list of shortcuts. If you prefer, you can also hide this widget by accessing the Page Settings.', 'mainwp' ); ?> | |
| 94 | + </div> | |
| 95 | + <?php | |
| 96 | + } | |
| 82 | 97 | |
| 83 | - if ( empty( $count_sites ) || empty( $count_clients ) || empty( $count_costs ) || empty( $count_extensions ) ) { | |
| 84 | - $started_done = false; | |
| 85 | - } | |
| 98 | + /** | |
| 99 | + * Action: mainwp_get_started_widget_top | |
| 100 | + * | |
| 101 | + * Fires top the widget. | |
| 102 | + * | |
| 103 | + * @since 5.0 | |
| 104 | + */ | |
| 105 | + do_action( 'mainwp_get_started_widget_top' ); | |
| 106 | + ?> | |
| 107 | + <div class="ui mini fluid vertical steps"> | |
| 108 | + <a class="<?php echo empty( $count_sites ) ? '' : 'completed'; ?> step" href="admin.php?page=managesites&do=new"> | |
| 109 | + <i class="globe icon"></i> | |
| 110 | + <div class="content"> | |
| 111 | + <div class="title"><?php esc_html_e( 'Add First Site', 'mainwp' ); ?></div> | |
| 112 | + <div class="description"><?php esc_html_e( 'Click here to start connecting your sites.', 'mainwp' ); ?></div> | |
| 113 | + </div> | |
| 114 | + </a> | |
| 115 | + <a class="<?php echo empty( $count_clients ) ? '' : 'completed'; ?> step" href="admin.php?page=ClientAddNew"> | |
| 116 | + <i class="users icon"></i> | |
| 117 | + <div class="content"> | |
| 118 | + <div class="title"><?php esc_html_e( 'Add First Client', 'mainwp' ); ?></div> | |
| 119 | + <div class="description"><?php esc_html_e( 'Click here to start adding your clients.', 'mainwp' ); ?></div> | |
| 120 | + </div> | |
| 121 | + </a> | |
| 122 | + <a class="<?php echo empty( $count_costs ) ? '' : 'completed'; ?> step" href="admin.php?page=CostTrackerAdd"> | |
| 123 | + <i class="dollar sign icon"></i> | |
| 124 | + <div class="content"> | |
| 125 | + <div class="title"><?php esc_html_e( 'Add First Cost', 'mainwp' ); ?></div> | |
| 126 | + <div class="description"><?php esc_html_e( 'Start tracking your expenses.', 'mainwp' ); ?></div> | |
| 127 | + </div> | |
| 128 | + </a> | |
| 129 | + <a class="<?php echo empty( $count_extensions ) ? '' : 'completed'; ?> step" href="admin.php?page=Extensions"> | |
| 130 | + <i class="puzzle icon"></i> | |
| 131 | + <div class="content"> | |
| 132 | + <div class="title"><?php esc_html_e( 'Install Extensions', 'mainwp' ); ?></div> | |
| 133 | + <div class="description"><?php esc_html_e( 'Extend your MainWP Dashboard functionality.', 'mainwp' ); ?></div> | |
| 134 | + </div> | |
| 135 | + </a> | |
| 136 | + </div> | |
| 137 | + </div> | |
| 138 | + <?php | |
| 86 | 139 | |
| 87 | - if ( $started_done ) { | |
| 88 | - if ( MainWP_Utility::show_mainwp_message( 'notice', 'get-started' ) ) { | |
| 89 | - ?> | |
| 90 | - <div class="ui green message"> | |
| 91 | - <i class="close icon mainwp-notice-dismiss" notice-id="get-started"></i> | |
| 92 | - <div class="header"><?php esc_html_e( 'Congratulations!', 'mainwp' ); ?></div> | |
| 93 | - <?php esc_html_e( 'You can now use this widget as a handy list of shortcuts. If you prefer, you can also hide this widget by accessing the Page Settings.', 'mainwp' ); ?> | |
| 94 | - </div> | |
| 95 | - <?php | |
| 96 | - } | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Action: mainwp_get_started_widget_top | |
| 101 | - * | |
| 102 | - * Fires top the widget. | |
| 103 | - * | |
| 104 | - * @since 5.0 | |
| 105 | - */ | |
| 106 | - do_action( 'mainwp_get_started_widget_top' ); | |
| 107 | - ?> | |
| 108 | - <div class="ui hidden divider"></div> | |
| 109 | - <div class="ui middle aligned relaxed list mainwp-get-started-widget-check-lists"> | |
| 110 | - <div class="item"> | |
| 111 | - <?php | |
| 112 | - $text = esc_html__( 'Add first site', 'mainwp' ); | |
| 113 | - if ( empty( $count_sites ) ) { | |
| 114 | - ?> | |
| 115 | - <span style="min-width:45px;"><span class="circular ui large label" style="margin:0px 10px 0 5px">1</span></span> <a href="admin.php?page=managesites&do=new"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 116 | - <?php | |
| 117 | - } else { | |
| 118 | - ?> | |
| 119 | - <i class="check circle green icon big" style="display:inline-block"></i> <a href="admin.php?page=managesites&do=new"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 120 | - <?php | |
| 121 | - } | |
| 122 | - ?> | |
| 123 | - </div> | |
| 124 | - | |
| 125 | - <div class="item"> | |
| 126 | - <?php | |
| 127 | - $text = esc_html__( 'Add first client', 'mainwp' ); | |
| 128 | - if ( empty( $count_clients ) ) { | |
| 129 | - ?> | |
| 130 | - <span style="min-width:45px;"><span class="circular ui large label" style="margin:0px 10px 0 5px">2</span></span><a href="admin.php?page=ClientAddNew"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 131 | - <?php | |
| 132 | - } else { | |
| 133 | - ?> | |
| 134 | - <i class="check circle icon green big" style="display:inline-block"></i> <a href="admin.php?page=ClientAddNew"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 135 | - <?php | |
| 136 | - } | |
| 137 | - ?> | |
| 138 | - </div> | |
| 139 | - | |
| 140 | - <div class="item"> | |
| 141 | - <?php | |
| 142 | - $text = esc_html__( 'Add first thing to Cost Tracker', 'mainwp' ); | |
| 143 | - if ( empty( $count_costs ) ) { | |
| 144 | - ?> | |
| 145 | - <span style="min-width:45px;"><span class="circular ui large label" style="margin:0px 10px 0 5px">3</span></span> <a href="admin.php?page=CostTrackerAdd"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 146 | - <?php | |
| 147 | - | |
| 148 | - } else { | |
| 149 | - ?> | |
| 150 | - <i class="check circle icon green big" style="display:inline-block"></i> <a href="admin.php?page=CostTrackerAdd"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 151 | - <?php | |
| 152 | - } | |
| 153 | - ?> | |
| 154 | - </div> | |
| 155 | - | |
| 156 | - <div class="item"> | |
| 157 | - <?php | |
| 158 | - $text = esc_html__( 'Add first extension', 'mainwp' ); | |
| 159 | - if ( empty( $count_extensions ) ) { | |
| 160 | - ?> | |
| 161 | - <span style="min-width:45px;"><span class="circular ui large label" style="margin:0px 10px 0 5px">4</span></span> <a href="admin.php?page=Extensions"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 162 | - <?php | |
| 163 | - } else { | |
| 164 | - ?> | |
| 165 | - <i class="check circle icon green big" style="display:inline-block"></i> <a href="admin.php?page=Extensions"><?php echo $text; //phpcs:ignore -- ok. ?></a> | |
| 166 | - <?php | |
| 167 | - } | |
| 168 | - ?> | |
| 169 | - </div> | |
| 170 | - </div> | |
| 171 | - </div> | |
| 172 | - <?php | |
| 173 | - | |
| 174 | - /** | |
| 175 | - * Action: mainwp_get_started_widget_bottom | |
| 176 | - * | |
| 177 | - * Fires bottom the widget. | |
| 178 | - * | |
| 179 | - * @since 5.0 | |
| 180 | - */ | |
| 181 | - do_action( 'mainwp_get_started_widget_bottom' ); | |
| 182 | - } | |
| 140 | + /** | |
| 141 | + * Action: mainwp_get_started_widget_bottom | |
| 142 | + * | |
| 143 | + * Fires bottom the widget. | |
| 144 | + * | |
| 145 | + * @since 5.0 | |
| 146 | + */ | |
| 147 | + do_action( 'mainwp_get_started_widget_bottom' ); | |
| 148 | + } | |
| 183 | 149 | } |