| 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 { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.nore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR. |
| 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 |
static::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 |
<div class="mainwp-widget-header"> |
| 54 |
<h3 class="ui header handle-drag"> |
| 55 |
<?php |
| 56 |
/** |
| 57 |
* Filter: mainwp_get_started_widget_title |
| 58 |
* |
| 59 |
* Filters the widget title text. |
| 60 |
* |
| 61 |
* @since 5.0 |
| 62 |
*/ |
| 63 |
echo esc_html( apply_filters( 'mainwp_get_started_widget_title', esc_html__( 'Get Started with MainWP', 'mainwp' ) ) ); |
| 64 |
?> |
| 65 |
<div class="sub header"><?php esc_html_e( 'Kickstart your MainWP experience with our simple checklist.', 'mainwp' ); ?></div> |
| 66 |
</h3> |
| 67 |
</div> |
| 68 |
<div class="mainwp-scrolly-overflow"> |
| 69 |
<?php |
| 70 |
$extensions = MainWP_Extensions_Handler::get_extensions(); |
| 71 |
|
| 72 |
$count_sites = MainWP_Manage_Sites::get_total_sites(); |
| 73 |
$count_clients = MainWP_DB_Client::instance()->count_total_clients(); |
| 74 |
$count_costs = apply_filters( 'mainwp_module_cost_tracker_get_total_cost', 0 ); |
| 75 |
$count_extensions = is_array( $extensions ) ? count( $extensions ) : 0; |
| 76 |
|
| 77 |
$started_done = true; |
| 78 |
|
| 79 |
if ( empty( $count_sites ) || empty( $count_clients ) || empty( $count_costs ) || empty( $count_extensions ) ) { |
| 80 |
$started_done = false; |
| 81 |
} |
| 82 |
|
| 83 |
if ( $started_done && MainWP_Utility::show_mainwp_message( 'notice', 'get-started' ) ) { |
| 84 |
?> |
| 85 |
<div class="ui green message"> |
| 86 |
<i class="close icon mainwp-notice-dismiss" notice-id="get-started"></i> |
| 87 |
<div class="header"><?php esc_html_e( 'Congratulations!', 'mainwp' ); ?></div> |
| 88 |
<?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' ); ?> |
| 89 |
</div> |
| 90 |
<?php |
| 91 |
} |
| 92 |
|
| 93 |
/** |
| 94 |
* Action: mainwp_get_started_widget_top |
| 95 |
* |
| 96 |
* Fires top the widget. |
| 97 |
* |
| 98 |
* @since 5.0 |
| 99 |
*/ |
| 100 |
do_action( 'mainwp_get_started_widget_top' ); |
| 101 |
?> |
| 102 |
<div class="ui mini fluid vertical steps"> |
| 103 |
<a class="<?php echo empty( $count_sites ) ? '' : 'completed'; ?> step" href="admin.php?page=managesites&do=new"> |
| 104 |
<i class="globe icon"></i> |
| 105 |
<div class="content"> |
| 106 |
<div class="title"><?php esc_html_e( 'Add First Site', 'mainwp' ); ?></div> |
| 107 |
<div class="description"><?php esc_html_e( 'Click here to start connecting your sites.', 'mainwp' ); ?></div> |
| 108 |
</div> |
| 109 |
</a> |
| 110 |
<a class="<?php echo empty( $count_clients ) ? '' : 'completed'; ?> step" href="admin.php?page=ClientAddNew"> |
| 111 |
<i class="users icon"></i> |
| 112 |
<div class="content"> |
| 113 |
<div class="title"><?php esc_html_e( 'Add First Client', 'mainwp' ); ?></div> |
| 114 |
<div class="description"><?php esc_html_e( 'Click here to start adding your clients.', 'mainwp' ); ?></div> |
| 115 |
</div> |
| 116 |
</a> |
| 117 |
<a class="<?php echo empty( $count_costs ) ? '' : 'completed'; ?> step" href="admin.php?page=CostTrackerAdd"> |
| 118 |
<i class="dollar sign icon"></i> |
| 119 |
<div class="content"> |
| 120 |
<div class="title"><?php esc_html_e( 'Add First Cost', 'mainwp' ); ?></div> |
| 121 |
<div class="description"><?php esc_html_e( 'Start tracking your expenses.', 'mainwp' ); ?></div> |
| 122 |
</div> |
| 123 |
</a> |
| 124 |
<a class="<?php echo empty( $count_extensions ) ? '' : 'completed'; ?> step" href="admin.php?page=Extensions"> |
| 125 |
<i class="puzzle icon"></i> |
| 126 |
<div class="content"> |
| 127 |
<div class="title"><?php esc_html_e( 'Install Extensions', 'mainwp' ); ?></div> |
| 128 |
<div class="description"><?php esc_html_e( 'Extend your MainWP Dashboard functionality.', 'mainwp' ); ?></div> |
| 129 |
</div> |
| 130 |
</a> |
| 131 |
</div> |
| 132 |
</div> |
| 133 |
<?php |
| 134 |
|
| 135 |
/** |
| 136 |
* Action: mainwp_get_started_widget_bottom |
| 137 |
* |
| 138 |
* Fires bottom the widget. |
| 139 |
* |
| 140 |
* @since 5.0 |
| 141 |
*/ |
| 142 |
do_action( 'mainwp_get_started_widget_bottom' ); |
| 143 |
} |
| 144 |
} |
| 145 |
|