PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.9
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.9
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-data.php
wordpress-popup / inc Last commit date
display-conditions 3 years ago front 9 months ago helpers 9 months ago metas 3 years ago multisite 3 years ago palettes 3 years ago provider 3 years ago providers 9 months ago templates 3 years ago update 3 years ago class-hustle-admin-page-abstract.php 9 months ago class-hustle-black-friday-campaign.php 7 months ago class-hustle-condition-factory.php 6 years ago class-hustle-cross-sell.php 9 months ago class-hustle-dashboard-admin.php 3 years ago class-hustle-data.php 3 years 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 9 months ago class-hustle-module-collection.php 3 years ago class-hustle-module-page-abstract.php 2 years ago class-hustle-notifications.php 3 years ago class-hustle-settings-admin.php 3 years ago class-hustle-tutorials-page.php 4 years ago class-hustle-wp-dashboard-page.php 3 years ago hustle-deletion.php 3 years ago hustle-embedded-admin.php 3 years ago hustle-entries-admin.php 3 years ago hustle-entry-model.php 3 years ago hustle-general-data-protection.php 3 years ago hustle-init.php 7 months ago hustle-mail.php 3 years ago hustle-migration.php 3 years ago hustle-model.php 3 years ago hustle-module-model.php 9 months ago hustle-module-widget-legacy.php 3 years ago hustle-module-widget.php 3 years ago hustle-modules-common-admin-ajax.php 9 months ago hustle-popup-admin.php 3 years ago hustle-providers-admin.php 3 years ago hustle-providers.php 3 years ago hustle-settings-admin-ajax.php 3 years ago hustle-settings-page.php 3 years ago hustle-slidein-admin.php 3 years ago hustle-sshare-admin.php 3 years ago hustle-sshare-model.php 3 years ago hustle-tracking-model.php 3 years ago opt-in-geo.php 9 months ago opt-in-utils.php 3 years ago opt-in-wpmudev-api.php 3 years ago
class-hustle-data.php
164 lines
1 <?php
2 /**
3 * File for Hustle_Data class.
4 *
5 * @package Hustle
6 * @since unknown
7 */
8
9 /**
10 * Class for.
11 */
12 class Hustle_Data {
13
14 const ADMIN_PAGE = 'hustle';
15 const DASHBOARD_PAGE = 'hustle_dashboard';
16 const POPUP_LISTING_PAGE = 'hustle_popup_listing';
17 const POPUP_WIZARD_PAGE = 'hustle_popup';
18 const SLIDEIN_LISTING_PAGE = 'hustle_slidein_listing';
19 const SLIDEIN_WIZARD_PAGE = 'hustle_slidein';
20 const EMBEDDED_LISTING_PAGE = 'hustle_embedded_listing';
21 const EMBEDDED_WIZARD_PAGE = 'hustle_embedded';
22 const SOCIAL_SHARING_LISTING_PAGE = 'hustle_sshare_listing';
23 const SOCIAL_SHARING_WIZARD_PAGE = 'hustle_sshare';
24 const INTEGRATIONS_PAGE = 'hustle_integrations';
25 const ENTRIES_PAGE = 'hustle_entries';
26 const UPSELL_PRO = 'hustle_pro';
27 const TUTORIALS = 'hustle_tutorials';
28 const SETTINGS_PAGE = 'hustle_settings';
29
30 /**
31 * Get the possible module types.
32 *
33 * @since 4.3.1
34 *
35 * @return array
36 */
37 public static function get_module_types() {
38 return array(
39 Hustle_Model::POPUP_MODULE,
40 Hustle_Model::SLIDEIN_MODULE,
41 Hustle_Model::EMBEDDED_MODULE,
42 Hustle_Model::SOCIAL_SHARING_MODULE,
43 );
44 }
45
46 /**
47 * Get the listing page for the given module type.
48 *
49 * @since 4.3.1
50 *
51 * @param string $module_type Given module type.
52 * @return string
53 */
54 public static function get_listing_page_by_module_type( $module_type ) {
55
56 switch ( $module_type ) {
57 case Hustle_Module_Model::POPUP_MODULE:
58 return self::POPUP_LISTING_PAGE;
59
60 case Hustle_Module_Model::SLIDEIN_MODULE:
61 return self::SLIDEIN_LISTING_PAGE;
62
63 case Hustle_Module_Model::EMBEDDED_MODULE:
64 return self::EMBEDDED_LISTING_PAGE;
65
66 case Hustle_Module_Model::SOCIAL_SHARING_MODULE:
67 return self::SOCIAL_SHARING_LISTING_PAGE;
68
69 default:
70 return self::POPUP_LISTING_PAGE;
71 }
72 }
73
74 /**
75 * Get the wizard page for the given module type.
76 *
77 * @since 4.3.1
78 *
79 * @param string $module_type Given module type.
80 * @return string
81 */
82 public static function get_wizard_page_by_module_type( $module_type ) {
83
84 switch ( $module_type ) {
85 case Hustle_Module_Model::POPUP_MODULE:
86 return self::POPUP_WIZARD_PAGE;
87
88 case Hustle_Module_Model::SLIDEIN_MODULE:
89 return self::SLIDEIN_WIZARD_PAGE;
90
91 case Hustle_Module_Model::EMBEDDED_MODULE:
92 return self::EMBEDDED_WIZARD_PAGE;
93
94 case Hustle_Module_Model::SOCIAL_SHARING_MODULE:
95 return self::SOCIAL_SHARING_WIZARD_PAGE;
96
97 default:
98 return self::POPUP_WIZARD_PAGE;
99 }
100 }
101
102 /**
103 * Retrieves a list with all hustle pages names.
104 *
105 * @since 4.3.1
106 *
107 * @return array
108 */
109 public static function get_hustle_pages() {
110 return array(
111 self::ADMIN_PAGE,
112 self::DASHBOARD_PAGE,
113 self::POPUP_LISTING_PAGE,
114 self::POPUP_WIZARD_PAGE,
115 self::SLIDEIN_LISTING_PAGE,
116 self::SLIDEIN_WIZARD_PAGE,
117 self::EMBEDDED_LISTING_PAGE,
118 self::EMBEDDED_WIZARD_PAGE,
119 self::SOCIAL_SHARING_LISTING_PAGE,
120 self::SOCIAL_SHARING_WIZARD_PAGE,
121 self::INTEGRATIONS_PAGE,
122 self::ENTRIES_PAGE,
123 self::UPSELL_PRO,
124 self::SETTINGS_PAGE,
125 self::TUTORIALS,
126 );
127 }
128
129 /**
130 * Check whether a new module of this type can be created based on Free limits.
131 * If it's free and there's already 3 modules of this type, then it's a nope.
132 *
133 * @since 4.3.1
134 *
135 * @param string $module_type Module type to check the limits for.
136 * @return boolean
137 */
138 public static function was_free_limit_reached( $module_type ) {
139
140 // If it's Pro, the sky's the limit.
141 if ( ! Opt_In_Utils::is_free() ) {
142 return false;
143 }
144
145 // Check the Module's type is valid.
146 if ( ! in_array( $module_type, self::get_module_types(), true ) ) {
147 return true;
148 }
149
150 $collection_args = array(
151 'module_type' => $module_type,
152 'count_only' => true,
153 );
154 $total_modules = Hustle_Module_Collection::instance()->get_all( null, $collection_args );
155
156 // If we have less than 3 modules of this type, can create another one.
157 if ( $total_modules >= 3 ) {
158 return true;
159 } else {
160 return false;
161 }
162 }
163 }
164