| 1 |
<?php |
| 2 |
/** |
| 3 |
* MainWP Get Started Widget |
| 4 |
* |
| 5 |
* Grab Child Sites update status & build widget. |
| 6 |
* |
| 7 |
* @package MainWP |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace MainWP\Dashboard; |
| 11 |
|
| 12 |
/** |
| 13 |
* Class MainWP_Get_Started |
| 14 |
* |
| 15 |
* @package MainWP\Dashboard |
| 16 |
*/ |
| 17 |
class MainWP_Get_Started { |
| 18 |
|
| 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 |
} |
| 29 |
|
| 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 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Method render() |
| 41 |
*/ |
| 42 |
public static function render() { |
| 43 |
self::render_content(); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Method render_sites() |
| 48 |
* |
| 49 |
* Grab available Child Sites updates a build Widget. |
| 50 |
*/ |
| 51 |
public static function render_content() { |
| 52 |
|
| 53 |
?> |
| 54 |
|
| 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(); |
| 75 |
|
| 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; |
| 80 |
|
| 81 |
$started_done = true; |
| 82 |
|
| 83 |
if ( empty( $count_sites ) || empty( $count_clients ) || empty( $count_costs ) || empty( $count_extensions ) ) { |
| 84 |
$started_done = false; |
| 85 |
} |
| 86 |
|
| 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 |
} |
| 183 |
} |
| 184 |
|