PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.14
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.14
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 / metas / class-hustle-meta-base-design.php
wordpress-popup / inc / metas Last commit date
default-design 5 months ago popup 5 months ago slidein 3 years ago sshare 5 months ago class-hustle-meta-base-content.php 3 years ago class-hustle-meta-base-design.php 3 years ago class-hustle-meta-base-display.php 6 years ago class-hustle-meta-base-emails.php 3 months ago class-hustle-meta-base-integrations.php 3 years ago class-hustle-meta-base-settings.php 3 years ago class-hustle-meta-base-visibility.php 5 months ago
class-hustle-meta-base-design.php
266 lines
1 <?php
2 /**
3 * File for Hustle_Meta_Base_Design class.
4 *
5 * @package Hustle
6 * @since 4.2.0
7 */
8
9 /**
10 * Hustle_Module_Base_Design is the base class for the "design" meta of modules.
11 * This class should handle what's related to the "design" meta.
12 */
13 class Hustle_Meta_Base_Design extends Hustle_Meta {
14
15 /**
16 * Available font families.
17 *
18 * @since 4.3.0
19 * @var array
20 */
21 private static $font_families;
22
23 /**
24 * Path to the folder containing the defaults.
25 *
26 * @since 4.3.0
27 * @var string
28 */
29 private $path_to_defaults = 'inc/metas/default-design/';
30
31 /**
32 * Get the defaults for this meta.
33 *
34 * @since 4.0.2
35 * @return array
36 */
37 public function get_defaults() {
38
39 $defaults = array(
40 'enable_mobile_settings' => '0',
41
42 // ========================================|
43 // 1. Layout.
44
45 'form_layout' => 'one', // Default opt-in layout option.
46 'style' => 'minimal', // Default informational layout option.
47
48 // ========================================|
49 // 2. Customize Elements.
50
51 'feature_image_position' => 'left',
52 'feature_image_width' => '320',
53 'feature_image_width_unit' => 'px',
54 'feature_image_height' => '150',
55 'feature_image_height_unit' => 'px',
56 'feature_image_height_mobile' => '150',
57 'feature_image_height_unit_mobile' => 'px',
58 'feature_image_fit' => 'contain',
59 'feature_image_fit_mobile' => 'contain',
60 'feature_image_horizontal_position' => 'center',
61 'feature_image_horizontal_position_mobile' => 'center',
62 'feature_image_horizontal_value' => '-100',
63 'feature_image_horizontal_value_mobile' => '-100',
64 'feature_image_horizontal_unit' => 'px',
65 'feature_image_horizontal_unit_mobile' => 'px',
66 'feature_image_vertical_position' => 'center',
67 'feature_image_vertical_position_mobile' => 'center',
68 'feature_image_vertical_value_mobile' => '-100',
69 'feature_image_vertical_value' => '-100',
70 'feature_image_vertical_unit' => 'px',
71 'feature_image_vertical_unit_mobile' => 'px',
72
73 'background_image_width' => '',
74 'background_image_width_mobile' => '',
75 'background_image_width_unit' => 'px',
76 'background_image_width_unit_mobile' => 'px',
77 'background_image_height' => '',
78 'background_image_height_mobile' => '',
79 'background_image_height_unit' => 'px',
80 'background_image_height_unit_mobile' => 'px',
81 'background_image_fit' => 'contain',
82 'background_image_fit_mobile' => 'contain',
83 'background_image_horizontal_position' => 'center',
84 'background_image_horizontal_position_mobile' => 'center',
85 'background_image_horizontal_value' => '-100',
86 'background_image_horizontal_value_mobile' => '-100',
87 'background_image_horizontal_unit' => 'px',
88 'background_image_horizontal_unit_mobile' => 'px',
89 'background_image_vertical_position' => 'center',
90 'background_image_vertical_position_mobile' => 'center',
91 'background_image_vertical_value' => '-100',
92 'background_image_vertical_value_mobile' => '-100',
93 'background_image_vertical_unit' => 'px',
94 'background_image_vertical_unit_mobile' => 'px',
95 'background_image_repeat' => 'repeat',
96 'background_image_repeat_mobile' => 'repeat',
97
98 // CTA buttons layout and alignment.
99 'cta_buttons_layout_type' => 'inline',
100 'cta_buttons_layout_type_mobile' => 'stacked',
101 'cta_buttons_layout_gap_value' => '20',
102 'cta_buttons_layout_gap_value_mobile' => '20',
103 'cta_buttons_layout_gap_unit' => 'px',
104 'cta_buttons_layout_gap_unit_mobile' => 'px',
105 'cta_buttons_alignment' => 'left',
106 'cta_buttons_alignment_mobile' => 'full',
107
108 // Opt-in Form.
109 'optin_form_layout' => 'inline',
110 'optin_form_layout_mobile' => 'stacked',
111 'form_fields_icon' => 'static',
112 'customize_form_fields_proximity' => '0',
113 'customize_form_fields_proximity_mobile' => '0',
114 'form_fields_proximity_unit' => 'px',
115 'form_fields_proximity_unit_mobile' => 'px',
116 'form_fields_proximity_value' => '1',
117 'form_fields_proximity_value_mobile' => '1',
118
119 // Close icon.
120 'close_icon_position' => 'outside',
121 'close_icon_position_mobile' => 'outside',
122 'close_icon_alignment_x' => 'right',
123 'close_icon_alignment_x_mobile' => 'right',
124 'close_icon_alignment_y' => 'top',
125 'close_icon_alignment_y_mobile' => 'top',
126 'close_icon_style' => 'flat',
127 'close_icon_style_mobile' => 'flat',
128 'close_button_static_background' => '#f4973c',
129 'close_icon_size' => '12',
130 'close_icon_size_mobile' => '12',
131
132 // ========================================|
133 // 3. Typography.
134 'customize_typography' => '0',
135 'customize_typography_mobile' => '0',
136
137 'global_font_family' => 'custom',
138 'global_custom_font_family' => 'inherit',
139
140 // ========================================|
141 // 4. Advanced.
142
143 // 3.1. Border, Spacing and Shadow.
144 'customize_border_shadow_spacing' => '0',
145 'customize_border_shadow_spacing_mobile' => '0',
146
147 // Use "vanilla" theme.
148 'use_vanilla' => '0',
149
150 // Visibility on mobile.
151 'feature_image_hide_on_mobile' => '0',
152
153 // ========================================|
154 // 5. COLORS PALETTE |
155 // ========================================|
156 // Colors palette.
157 'color_palette' => 'gray_slate',
158
159 // Customize the color palette.
160 'customize_colors' => '0',
161
162 // ========================================|
163 // 8. CUSTOM { MODULE } SIZE |
164 // ========================================|
165 // Enable custom size.
166 'customize_size' => '0',
167 'customize_size_mobile' => '0',
168
169 // Enable custom size » Width (px).
170 'custom_width' => 600,
171 'custom_width_unit' => 'px',
172
173 'custom_width_mobile' => 600,
174 'custom_width_unit_mobile' => 'px',
175
176 // Enable custom size » Height (px).
177 'custom_height' => 300,
178 'custom_height_unit' => 'px',
179
180 'custom_height_mobile' => 300,
181 'custom_height_unit_mobile' => 'px',
182
183 // ========================================|
184 // 9. CUSTOM CSS |
185 // ========================================|
186 // Enable Custom CSS.
187 'customize_css' => '0',
188
189 // Enable Custom CSS » Editor.
190 'custom_css' => '',
191
192 );
193
194 $advanced_desktop_defaults = $this->get_border_spacing_shadow_defaults( 'desktop' );
195 $advanced_mobile_defaults = $this->get_border_spacing_shadow_defaults( 'mobile' );
196
197 $is_optin = Hustle_Module_Model::OPTIN_MODE === $this->module->module_mode;
198 $palette_defaults = Hustle_Palettes_Helper::get_palette_array( 'gray_slate', $is_optin );
199
200 $typography_defaults_desktop = $this->get_typography_defaults( 'desktop' );
201 $typography_defaults_mobile = $this->get_typography_defaults( 'mobile' );
202
203 return $defaults + $palette_defaults + $advanced_desktop_defaults + $advanced_mobile_defaults + $typography_defaults_desktop + $typography_defaults_mobile;
204 }
205
206 /**
207 * Gets the name of the available font families.
208 *
209 * @since 4.3.0
210 * @return array
211 */
212 public static function get_font_families_names() {
213 if ( ! self::$font_families ) {
214 $fonts_handler = new Hustle_Custom_Fonts_Helper();
215
216 self::$font_families = $fonts_handler->get_available_font_families();
217 }
218
219 return self::$font_families;
220 }
221
222 /**
223 * Retrieves the defaults for border, spacing, shadow properties for the given device.
224 *
225 * @since 4.3.0
226 *
227 * @param string $device Device to retrieve the deafults for, mobile|desktop.
228 * @return array
229 */
230 public function get_border_spacing_shadow_defaults( $device ) {
231 $file = 'desktop' === $device ? 'border-spacing-shadow-desktop' : 'border-spacing-shadow-mobile';
232 return $this->get_default_from_file( $file );
233 }
234
235 /**
236 * Gets the typography defaults for the given device.
237 *
238 * @since 4.3.0
239 *
240 * @param string $device desktop|mobile.
241 * @return array
242 */
243 public function get_typography_defaults( $device ) {
244 $file = 'desktop' === $device ? 'typography-desktop' : 'typography-mobile';
245 return $this->get_default_from_file( $file );
246 }
247
248 /**
249 * Retrieves the array from a default file.
250 *
251 * @since 4.3.0
252 *
253 * @param string $file File name within the design defaults directory.
254 * @return array
255 */
256 private function get_default_from_file( $file ) {
257 $file_path = Opt_In::$plugin_path . $this->path_to_defaults . $file . '.php';
258 $is_optin = Hustle_Module_Model::OPTIN_MODE === $this->module->module_mode;
259
260 if ( is_file( $file_path ) ) {
261 return include $file_path;
262 }
263 return array();
264 }
265 }
266