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