PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.14.1
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.14.1
7.8.14 7.8.14.1 7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / inc / class-hustle-dashboard-admin.php
wordpress-popup / inc Last commit date
display-conditions 5 months ago front 2 days ago helpers 1 month ago metas 3 months ago multisite 5 months ago palettes 3 years ago provider 1 month ago providers 2 days ago templates 3 years ago update 5 months ago class-hustle-admin-page-abstract.php 1 month ago class-hustle-auth-token.php 5 months ago class-hustle-condition-factory.php 6 years ago class-hustle-cross-sell.php 10 months ago class-hustle-dashboard-admin.php 1 month ago class-hustle-data.php 1 month ago class-hustle-db.php 2 years ago class-hustle-installer.php 4 years ago class-hustle-meta.php 3 years ago class-hustle-module-admin.php 1 month ago class-hustle-module-collection.php 5 months ago class-hustle-module-fields.php 3 months ago class-hustle-module-page-abstract.php 1 month ago class-hustle-module-validator.php 3 months ago class-hustle-notifications.php 2 days ago class-hustle-settings-admin.php 1 month ago class-hustle-wp-dashboard-page.php 5 months ago class-opt-in.php 2 days ago hustle-background-conversion-log.php 3 months ago hustle-deletion.php 3 months ago hustle-embedded-admin.php 3 years ago hustle-entries-admin.php 5 months ago hustle-entry-model.php 1 month ago hustle-general-data-protection.php 5 months ago hustle-init.php 1 month ago hustle-mail.php 5 months ago hustle-migration.php 5 months ago hustle-model.php 2 days ago hustle-module-model.php 1 month ago hustle-module-widget-legacy.php 5 months ago hustle-module-widget.php 5 months ago hustle-modules-common-admin-ajax.php 1 month ago hustle-popup-admin.php 3 years ago hustle-providers-admin.php 1 month ago hustle-providers.php 5 months ago hustle-settings-admin-ajax.php 1 month ago hustle-settings-page.php 3 years ago hustle-slidein-admin.php 3 years ago hustle-sshare-admin.php 2 days ago hustle-sshare-model.php 2 days ago hustle-tracking-model.php 3 months ago interface-hustle-auth-provider.php 5 months ago opt-in-geo.php 5 months ago opt-in-utils.php 2 days ago opt-in-wpmudev-api.php 5 months ago
class-hustle-dashboard-admin.php
442 lines
1 <?php
2 /**
3 * File for Hustle_Dashboard_Admin class.
4 *
5 * @package Hustle
6 * @since unknwon
7 */
8
9 /**
10 * Hustle_Dashboard_Admin.
11 */
12 class Hustle_Dashboard_Admin extends Hustle_Admin_Page_Abstract {
13
14 const WELCOME_MODAL_NAME = 'welcome_modal';
15 const MIGRATE_MODAL_NAME = 'migrate_modal';
16 const HIGHLIGHT_MODAL_NAME = 'release_highlight_modal_470';
17 const NEW_FEATURES_MODAL_NAME = 'new_features_modal_480';
18 const MIGRATE_NOTICE_NAME = 'migrate_notice';
19
20 /**
21 * Whether we have any module.
22 *
23 * @since 4.3.5
24 *
25 * @var boolean
26 */
27 private $has_modules = false;
28
29 /**
30 * Initiates the page's properties
31 * Should be overridden by each page.
32 *
33 * @since 4.0.1
34 */
35 protected function init() {
36
37 $this->page = 'hustle';
38
39 $this->page_title = esc_html__( 'Dashboard', 'hustle' );
40
41 $this->page_menu_title = $this->page_title;
42
43 $this->page_capability = 'hustle_menu';
44
45 $this->page_template_path = 'admin/dashboard';
46 }
47
48 /**
49 * Actions to be performed on Dashboard page.
50 *
51 * @since 4.0.4
52 */
53 public function current_page_loaded() {
54 parent::current_page_loaded();
55 $this->export_module();
56 }
57
58 /**
59 * Register Hustle's parent menu.
60 * Call the parent method to add the submenu page for Dashboard.
61 *
62 * @since 4.0.1
63 */
64 public function register_admin_menu() {
65
66 $parent_menu_title = esc_html( Opt_In_Utils::get_plugin_name() );
67
68 // Parent menu.
69 add_menu_page(
70 $parent_menu_title,
71 $parent_menu_title,
72 $this->page_capability,
73 'hustle',
74 array( $this, 'render_main_page' ),
75 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzE3XzkpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNy41IDIwQzE2LjgzNyAyMCAxNi4yMDExIDE5LjczNjYgMTUuNzMyMiAxOS4yNjc4QzE1LjI2MzQgMTguNzk4OSAxNSAxOC4xNjMgMTUgMTcuNUMxNSAxNS41NjM4IDEyLjM0NDIgMTUuMTE3IDguOTk5NjkgMTUuMDIzMVYxNi45OTk5QzkuMDEyMTggMTcuMzk3MiA4Ljk0MzE1IDE3Ljc5MjkgOC43OTY4MSAxOC4xNjI1QzguNjUwNDYgMTguNTMyMiA4LjQyOTkgMTguODY3OSA4LjE0ODggMTkuMTQ5QzcuODY3NjkgMTkuN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y4yNDAyIDIuMDUyNjkgMTcuMTQ2NCAyLjE0NjQ1QzE3LjA1MjcgMi4yNDAyMiAxNyAyLjM2NzM5IDE3IDIuNUMxNyA3IDExIDcgNyA3SDRaTTguNTcwMTggMTJWMTAuMjlMMTIuMDAwMiA4VjkuNzFMMTYuMDAwMiA4TDEwLjg2MDIgMTJWMTAuMjlMOC41NzAxOCAxMloiIGZpbGw9IiNBN0FBQUQiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8xN185Ij4KPHJlY3Qgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo='
76 );
77
78 parent::register_admin_menu();
79 }
80
81 /**
82 * Get $active variable for get_all method
83 *
84 * @param array $settings General settings.
85 * @param string $type Module type.
86 * @return boolean|null
87 */
88 private function is_getting_active( $settings, $type ) {
89 $return = null;
90
91 if ( $settings[ 'published_' . $type . '_on_dashboard' ] && ! $settings[ 'draft_' . $type . '_on_dashboard' ] ) {
92 $return = true;
93 } elseif ( ! $settings[ 'published_' . $type . '_on_dashboard' ] && $settings[ 'draft_' . $type . '_on_dashboard' ] ) {
94 $return = false;
95 }
96
97 return $return;
98 }
99
100 /**
101 * Get limit from general settings
102 *
103 * @param array $settings General settings.
104 * @param string $type Module type.
105 * @return string
106 */
107 private static function get_limit( $settings, $type ) {
108 $limit = $settings[ $type . '_on_dashboard' ];
109 if ( $limit < 1 ) {
110 $limit = 1;
111 }
112 return $limit;
113 }
114
115
116 /**
117 * Get the arguments used when rendering the main page.
118 *
119 * @since 4.0.1
120 * @return array
121 */
122 public function get_page_template_args() {
123
124 $collection_instance = Hustle_Module_Collection::instance();
125
126 $general_settings = Hustle_Settings_Admin::get_general_settings();
127 $modules = array(
128 'popup' => array(),
129 'slidein' => array(),
130 'embedded' => array(),
131 'social_sharing' => array(),
132 );
133 foreach ( $modules as $type => $instances ) {
134 $active = self::is_getting_active( $general_settings, $type );
135 $limit = self::get_limit( $general_settings, $type );
136
137 $modules[ $type ] = $collection_instance->get_all( $active, array( 'module_type' => $type ), $limit );
138
139 if ( ! empty( $modules[ $type ] ) ) {
140 $this->has_modules = true;
141 }
142 }
143
144 $active_modules = $collection_instance->get_all(
145 true,
146 array(
147 'count_only' => true,
148 )
149 );
150
151 $args = array(
152 'metrics' => $this->get_3_top_metrics(),
153 'active_modules' => $active_modules,
154 'popups' => $modules['popup'],
155 'slideins' => $modules['slidein'],
156 'embeds' => $modules['embedded'],
157 'social_sharings' => $modules['social_sharing'],
158 'last_conversion' => '',
159 'sui' => $this->get_sui_summary_config(),
160 );
161
162 if ( Hustle_Settings_Admin::global_tracking() ) {
163 $last_conversion = Hustle_Tracking_Model::get_instance()->get_latest_conversion_date( 'all' );
164 $args['last_conversion'] = $last_conversion ? date_i18n( 'j M Y @ H:i A', strtotime( $last_conversion ) ) : esc_html__( 'Never', 'hustle' );
165 }
166
167 return $args;
168 }
169
170 /**
171 * Add data to the current json array.
172 *
173 * @since 4.3.1
174 *
175 * @return array
176 */
177 protected function get_vars_to_localize() {
178 $current_array = parent::get_vars_to_localize();
179
180 // Register translated strings for datepicker preview.
181 $current_array['messages']['days_and_months'] = array(
182 'days_full' => Hustle_Time_Helper::get_week_days(),
183 'days_short' => Hustle_Time_Helper::get_week_days( 'short' ),
184 'days_min' => Hustle_Time_Helper::get_week_days( 'min' ),
185 'months_full' => Hustle_Time_Helper::get_months(),
186 'months_short' => Hustle_Time_Helper::get_months( 'short' ),
187 );
188
189 // Also defined in listing.
190 $current_array['single_module_action_nonce'] = wp_create_nonce( 'hustle_single_action' );
191
192 return $current_array;
193 }
194
195 /**
196 * Get the data for listing the ssharing modules conversions per page.
197 *
198 * @since 4.0.0
199 * @param int $limit Limit for retrieving the sshare data.
200 * @return array
201 */
202 private function get_sshare_per_page_conversions( $limit ) {
203
204 $tracking_model = Hustle_Tracking_Model::get_instance();
205 $tracking_data = $tracking_model->get_ssharing_per_page_conversion_count( $limit );
206
207 $data_array = array();
208 foreach ( $tracking_data as $data ) {
209
210 if ( '0' !== $data->page_id ) {
211 $title = get_the_title( $data->page_id );
212 $url = get_permalink( $data->page_id );
213 } else {
214 $title = get_bloginfo( 'name', 'display' );
215 $url = get_home_url();
216 }
217
218 if ( empty( $url ) ) {
219 continue;
220 }
221 $data_array[] = array(
222 'title' => $title,
223 'url' => $url,
224 'count' => $data->tracked_count,
225 );
226 }
227
228 return $data_array;
229 }
230
231 /**
232 * Get 3 Top Metrics
233 *
234 * @since 4.0.0
235 *
236 * @return array $data Array of 4 top metrics.
237 */
238 private function get_3_top_metrics() {
239 $names = array(
240 'average_conversion_rate' => esc_html__( 'Average Conversion Rate', 'hustle' ),
241 'total_conversions' => esc_html__( 'Total Conversions', 'hustle' ),
242 'most_conversions' => esc_html__( 'Most Conversions', 'hustle' ),
243 'today_conversions' => esc_html__( 'Today\'s Conversion', 'hustle' ),
244 'last_week_conversions' => esc_html__( 'Last 7 Day\'s Conversion', 'hustle' ),
245 'last_month_conversions' => esc_html__( 'Last 1 Month\'s Conversion', 'hustle' ),
246 'inactive_modules_count' => esc_html__( 'Inactive Modules', 'hustle' ),
247 'total_modules_count' => esc_html__( 'Total Modules', 'hustle' ),
248 );
249
250 if ( ! Hustle_Settings_Admin::global_tracking() ) {
251 $metrics = array( 'inactive_modules_count', 'total_modules_count' );
252 } else {
253 $keys = array_keys( $names );
254 $metrics = Hustle_Settings_Admin::get_top_metrics_settings();
255 $metrics = array_values( array_intersect( $keys, $metrics ) );
256
257 $metrics_count = count( $metrics );
258
259 while ( 3 > $metrics_count ) {
260 $key = array_shift( $keys );
261 if ( ! in_array( $key, $metrics, true ) ) {
262 $metrics[] = $key;
263 }
264 $metrics_count = count( $metrics );
265 }
266 }
267 $data = array();
268 $tracking = Hustle_Tracking_Model::get_instance();
269 $module_instance = Hustle_Module_Collection::instance();
270 foreach ( $metrics as $key ) {
271
272 switch ( $key ) {
273 case 'average_conversion_rate':
274 $value = $tracking->get_average_conversion_rate();
275 break;
276 case 'total_conversions':
277 $value = $tracking->get_total_conversions();
278 break;
279 case 'most_conversions':
280 $module_id = $tracking->get_most_conversions_module_id();
281 if ( ! $module_id ) {
282 $value = esc_html__( 'None', 'hustle' );
283 break;
284 }
285 $module = Hustle_Module_Model::new_instance( $module_id );
286 if ( ! is_wp_error( $module ) ) {
287 $value = $module->module_name;
288 $url = add_query_arg( 'page', $module->get_wizard_page() );
289 if ( ! empty( $url ) ) {
290 $url = add_query_arg( 'id', $module->module_id, $url );
291 $value = sprintf(
292 '<a href="%s">%s</a>',
293 esc_url( $url ),
294 esc_html( $value )
295 );
296 }
297 }
298 break;
299 case 'today_conversions':
300 $value = $tracking->get_today_conversions();
301 break;
302 case 'last_week_conversions':
303 $value = $tracking->get_last_week_conversions();
304 break;
305 case 'last_month_conversions':
306 $value = $tracking->get_last_month_conversions();
307 break;
308 case 'inactive_modules_count':
309 $value = $module_instance->get_all( false, array( 'count_only' => true ) );
310 break;
311 case 'total_modules_count':
312 $value = $module_instance->get_all( 'any', array( 'count_only' => true ) );
313 break;
314 default:
315 $value = esc_html__( 'Unknown', 'hustle' );
316 }
317 if ( 0 === $value ) {
318 $value = esc_html__( 'None', 'hustle' );
319 }
320 $data[ $key ] = array(
321 'label' => $names[ $key ],
322 'value' => $value,
323 );
324 }
325 return $data;
326 }
327
328 /**
329 * Renders the modals for the Dashboard page.
330 *
331 * @since 4.3.5
332 *
333 * @todo Move global modals to the base abstract page.
334 *
335 * @return void
336 */
337 protected function render_modals() {
338 parent::render_modals();
339
340 $needs_migration = Hustle_Migration::check_tracking_needs_migration();
341
342 // On Boarding (Welcome).
343 if (
344 filter_input( INPUT_GET, 'show-welcome', FILTER_VALIDATE_BOOLEAN ) ||
345 ( ! $this->has_modules && ! Hustle_Notifications::was_notification_dismissed( self::WELCOME_MODAL_NAME ) )
346 ) {
347 $this->get_renderer()->render( 'admin/dashboard/dialogs/fresh-install' );
348 }
349
350 // Migration.
351 if (
352 filter_input( INPUT_GET, 'show-migrate', FILTER_VALIDATE_BOOLEAN ) ||
353 ( $needs_migration && ! Hustle_Notifications::was_notification_dismissed( self::MIGRATE_MODAL_NAME ) )
354 ) {
355 $this->get_renderer()->render( 'admin/dashboard/dialogs/migrate-data' );
356 }
357
358 // Release highlights.
359 if ( $this->should_show_highlight_modal( $needs_migration ) ) {
360 $this->get_renderer()->render( 'admin/dashboard/dialogs/release-highlight' );
361 }
362
363 // New features (Zoho, Newsletter integrations, Cloudflare Turnstile).
364 if ( $this->should_show_new_features_modal() ) {
365 $this->get_renderer()->render( 'admin/dashboard/dialogs/new-features' );
366 }
367
368 // Dissmiss migrate tracking notice modal confirmation.
369 if ( Hustle_Notifications::is_show_migrate_tracking_notice() ) {
370 $this->get_renderer()->render( 'admin/dialogs/migrate-dismiss-confirmation' );
371 }
372
373 // Visibility behavior updated.
374 if (
375 filter_input( INPUT_GET, 'review-conditions', FILTER_VALIDATE_BOOLEAN ) &&
376 Hustle_Migration::is_migrated( 'hustle_40_migrated' ) &&
377 ! Hustle_Notifications::was_notification_dismissed( '41_visibility_behavior_update' )
378 ) {
379 $this->get_renderer()->render( 'admin/dashboard/dialogs/review-conditions' );
380 }
381
382 // Delete.
383 $this->get_renderer()->render( 'admin/commons/sui-listing/dialogs/delete-module' );
384 }
385
386 /**
387 * Returns whether the highlight modal should show up, enqueues scripts, or dismiss otherwise.
388 *
389 * @todo Separate the check from the enqueueing and the dismissal.
390 * @todo Retrieve $has_modules and $need_migrate from here, instead of recieving them as params.
391 *
392 * @since 4.3.0
393 *
394 * @param boolean $need_migrate Whether the metas migration from 3.x to 4.x is pending.
395 * @return boolean
396 */
397 private function should_show_highlight_modal( $need_migrate ) {
398 $hide = apply_filters( 'wpmudev_branding_hide_doc_link', false );
399 if ( $hide ) {
400 return false;
401 }
402
403 $is_force_highlight = filter_input( INPUT_GET, 'show-release-highlight', FILTER_VALIDATE_BOOLEAN );
404 $was_highlight_dismissed = Hustle_Notifications::was_notification_dismissed( self::HIGHLIGHT_MODAL_NAME );
405
406 if ( ! $was_highlight_dismissed || $is_force_highlight ) {
407
408 // Only display when it's not a fresh install and no 3.x to 4.x migration is needed.
409 // Check for $previous_installed_version in 4.2.1. For now, we assume that if there are modules it's not a fresh install.
410 if ( $is_force_highlight || ( $this->has_modules && ! $need_migrate ) ) {
411 return true;
412 } else {
413 // Fresh install or focus on migration. Dismiss the notification.
414 Hustle_Notifications::add_dismissed_notification( self::HIGHLIGHT_MODAL_NAME );
415 }
416 }
417 return false;
418 }
419
420 /**
421 * Returns whether the new features modal should show up, or dismiss otherwise.
422 *
423 * @since 7.8.13
424 *
425 * @return boolean
426 */
427 private function should_show_new_features_modal() {
428 $hide = apply_filters( 'wpmudev_branding_hide_doc_link', false );
429 if ( $hide ) {
430 return false;
431 }
432
433 $is_force = filter_input( INPUT_GET, 'show-new-features', FILTER_VALIDATE_BOOLEAN );
434 $was_dismissed = Hustle_Notifications::was_notification_dismissed( self::NEW_FEATURES_MODAL_NAME );
435
436 if ( ! $was_dismissed || $is_force ) {
437 return true;
438 }
439 return false;
440 }
441 }
442