PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.1.2
GenerateBlocks v1.1.2
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / includes / defaults.php
generateblocks / includes Last commit date
class-do-css.php 6 years ago class-enqueue-css.php 6 years ago class-plugin-update.php 6 years ago class-settings.php 6 years ago dashboard.php 6 years ago defaults.php 6 years ago functions.php 6 years ago general.php 6 years ago generate-css.php 6 years ago
defaults.php
523 lines
1 <?php
2 /**
3 * Set our block attribute defaults.
4 *
5 * @package GenerateBlocks
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 /**
13 * Set our block defaults.
14 *
15 * @since 0.1
16 *
17 * @return array
18 */
19 function generateblocks_get_block_defaults() {
20 $defaults = array();
21
22 $container_width = 1100;
23
24 if ( function_exists( 'generate_get_option' ) ) {
25 $container_width = generate_get_option( 'container_width' );
26 }
27
28 $defaults['container'] = array(
29 'isGrid' => false,
30 'containerWidth' => $container_width,
31 'outerContainer' => 'full',
32 'innerContainer' => 'contained',
33 'minHeight' => false,
34 'minHeightUnit' => 'px',
35 'minHeightTablet' => false,
36 'minHeightUnitTablet' => 'px',
37 'minHeightMobile' => false,
38 'minHeightUnitMobile' => 'px',
39 'paddingTop' => 40,
40 'paddingRight' => 40,
41 'paddingBottom' => 40,
42 'paddingLeft' => 40,
43 'paddingUnit' => 'px',
44 'paddingTopTablet' => '',
45 'paddingRightTablet' => '',
46 'paddingBottomTablet' => '',
47 'paddingLeftTablet' => '',
48 'paddingTopMobile' => '',
49 'paddingRightMobile' => '',
50 'paddingBottomMobile' => '',
51 'paddingLeftMobile' => '',
52 'marginTop' => '',
53 'marginRight' => '',
54 'marginBottom' => '',
55 'marginLeft' => '',
56 'marginUnit' => 'px',
57 'marginTopTablet' => '',
58 'marginRightTablet' => '',
59 'marginBottomTablet' => '',
60 'marginLeftTablet' => '',
61 'marginTopMobile' => '',
62 'marginRightMobile' => '',
63 'marginBottomMobile' => '',
64 'marginLeftMobile' => '',
65 'borderSizeTop' => '',
66 'borderSizeRight' => '',
67 'borderSizeBottom' => '',
68 'borderSizeLeft' => '',
69 'borderSizeTopTablet' => '',
70 'borderSizeRightTablet' => '',
71 'borderSizeBottomTablet' => '',
72 'borderSizeLeftTablet' => '',
73 'borderSizeTopMobile' => '',
74 'borderSizeRightMobile' => '',
75 'borderSizeBottomMobile' => '',
76 'borderSizeLeftMobile' => '',
77 'borderRadiusTopRight' => '',
78 'borderRadiusBottomRight' => '',
79 'borderRadiusBottomLeft' => '',
80 'borderRadiusTopLeft' => '',
81 'borderRadiusUnit' => 'px',
82 'borderRadiusTopRightTablet' => '',
83 'borderRadiusBottomRightTablet' => '',
84 'borderRadiusBottomLeftTablet' => '',
85 'borderRadiusTopLeftTablet' => '',
86 'borderRadiusTopRightMobile' => '',
87 'borderRadiusBottomRightMobile' => '',
88 'borderRadiusBottomLeftMobile' => '',
89 'borderRadiusTopLeftMobile' => '',
90 'borderColor' => '',
91 'borderColorOpacity' => 1,
92 'backgroundColor' => '',
93 'backgroundColorOpacity' => 1,
94 'gradient' => false,
95 'gradientDirection' => 90,
96 'gradientColorOne' => '#ffffff',
97 'gradientColorOneOpacity' => 0.1,
98 'gradientColorStopOne' => '',
99 'gradientColorTwo' => '#000000',
100 'gradientColorTwoOpacity' => 0.3,
101 'gradientColorStopTwo' => '',
102 'textColor' => '',
103 'linkColor' => '',
104 'linkColorHover' => '',
105 'bgImage' => '',
106 'bgOptions' => array(
107 'selector' => 'element',
108 'opacity' => 1,
109 'overlay' => false,
110 'position' => 'center center',
111 'size' => 'cover',
112 'repeat' => 'no-repeat',
113 'attachment' => '',
114 ),
115 'width' => 50,
116 'widthTablet' => '',
117 'widthMobile' => 100,
118 'verticalAlignment' => '',
119 'verticalAlignmentTablet' => 'inherit',
120 'verticalAlignmentMobile' => 'inherit',
121 'zindex' => '',
122 'removeVerticalGap' => false,
123 'removeVerticalGapTablet' => false,
124 'removeVerticalGapMobile' => false,
125 'orderTablet' => false,
126 'orderMobile' => false,
127 'alignment' => '',
128 'alignmentTablet' => '',
129 'alignmentMobile' => '',
130 'showAdvancedTypography' => false,
131 'fontFamily' => '',
132 'fontFamilyFallback' => '',
133 'googleFont' => false,
134 'googleFontVariants' => '',
135 'fontWeight' => '',
136 'fontSize' => '',
137 'fontSizeTablet' => '',
138 'fontSizeMobile' => '',
139 'fontSizeUnit' => 'px',
140 'textTransform' => '',
141 );
142
143 $defaults['buttonContainer'] = array(
144 'alignment' => '',
145 'alignmentTablet' => '',
146 'alignmentMobile' => '',
147 'marginTop' => '',
148 'marginRight' => '',
149 'marginBottom' => '',
150 'marginLeft' => '',
151 'marginTopTablet' => '',
152 'marginRightTablet' => '',
153 'marginBottomTablet' => '',
154 'marginLeftTablet' => '',
155 'marginTopMobile' => '',
156 'marginRightMobile' => '',
157 'marginBottomMobile' => '',
158 'marginLeftMobile' => '',
159 'marginUnit' => 'px',
160 'stack' => false,
161 'stackTablet' => false,
162 'stackMobile' => false,
163 'fillHorizontalSpace' => false,
164 'fillHorizontalSpaceTablet' => false,
165 'fillHorizontalSpaceMobile' => false,
166 );
167
168 $defaults['button'] = array(
169 'backgroundColor' => false,
170 'backgroundColorOpacity' => 1,
171 'textColor' => false,
172 'backgroundColorHover' => false,
173 'backgroundColorHoverOpacity' => 1,
174 'textColorHover' => false,
175 'showAdvancedTypography' => false,
176 'fontFamily' => '',
177 'fontFamilyFallback' => '',
178 'googleFont' => false,
179 'googleFontVariants' => '',
180 'fontWeight' => '',
181 'fontSize' => false,
182 'fontSizeTablet' => false,
183 'fontSizeMobile' => false,
184 'fontSizeUnit' => 'px',
185 'textTransform' => '',
186 'letterSpacing' => '',
187 'letterSpacingTablet' => '',
188 'letterSpacingMobile' => '',
189 'marginTop' => '',
190 'marginRight' => '',
191 'marginBottom' => '',
192 'marginLeft' => '',
193 'marginTopTablet' => '',
194 'marginRightTablet' => '',
195 'marginBottomTablet' => '',
196 'marginLeftTablet' => '',
197 'marginTopMobile' => '',
198 'marginRightMobile' => '',
199 'marginBottomMobile' => '',
200 'marginLeftMobile' => '',
201 'marginUnit' => 'px',
202 'paddingTop' => '',
203 'paddingRight' => '',
204 'paddingBottom' => '',
205 'paddingLeft' => '',
206 'paddingTopTablet' => '',
207 'paddingRightTablet' => '',
208 'paddingBottomTablet' => '',
209 'paddingLeftTablet' => '',
210 'paddingTopMobile' => '',
211 'paddingRightMobile' => '',
212 'paddingBottomMobile' => '',
213 'paddingLeftMobile' => '',
214 'paddingUnit' => 'px',
215 'borderSizeTop' => '',
216 'borderSizeRight' => '',
217 'borderSizeBottom' => '',
218 'borderSizeLeft' => '',
219 'borderSizeTopTablet' => '',
220 'borderSizeRightTablet' => '',
221 'borderSizeBottomTablet' => '',
222 'borderSizeLeftTablet' => '',
223 'borderSizeTopMobile' => '',
224 'borderSizeRightMobile' => '',
225 'borderSizeBottomMobile' => '',
226 'borderSizeLeftMobile' => '',
227 'borderRadiusTopRight' => '',
228 'borderRadiusBottomRight' => '',
229 'borderRadiusBottomLeft' => '',
230 'borderRadiusTopLeft' => '',
231 'borderRadiusTopRightTablet' => '',
232 'borderRadiusBottomRightTablet' => '',
233 'borderRadiusBottomLeftTablet' => '',
234 'borderRadiusTopLeftTablet' => '',
235 'borderRadiusTopRightMobile' => '',
236 'borderRadiusBottomRightMobile' => '',
237 'borderRadiusBottomLeftMobile' => '',
238 'borderRadiusTopLeftMobile' => '',
239 'borderRadiusUnit' => 'px',
240 'borderColor' => false,
241 'borderColorOpacity' => 1,
242 'borderColorHover' => false,
243 'borderColorHoverOpacity' => 1,
244 'icon' => '',
245 'hasIcon' => false,
246 'iconLocation' => 'left',
247 'removeText' => false,
248 'ariaLabel' => '',
249 'gradient' => false,
250 'gradientDirection' => 90,
251 'gradientColorOne' => '#ffffff',
252 'gradientColorOneOpacity' => 0.1,
253 'gradientColorStopOne' => '',
254 'gradientColorTwo' => '#000000',
255 'gradientColorTwoOpacity' => 0.3,
256 'gradientColorStopTwo' => '',
257 'iconPaddingTop' => '',
258 'iconPaddingRight' => '0.5',
259 'iconPaddingBottom' => '',
260 'iconPaddingLeft' => '',
261 'iconPaddingTopTablet' => '',
262 'iconPaddingRightTablet' => '',
263 'iconPaddingBottomTablet' => '',
264 'iconPaddingLeftTablet' => '',
265 'iconPaddingTopMobile' => '',
266 'iconPaddingRightMobile' => '',
267 'iconPaddingBottomMobile' => '',
268 'iconPaddingLeftMobile' => '',
269 'iconPaddingUnit' => 'em',
270 'iconSize' => 1,
271 'iconSizeTablet' => '',
272 'iconSizeMobile' => '',
273 'iconSizeUnit' => 'em',
274 );
275
276 $defaults['gridContainer'] = array(
277 'horizontalGap' => 30,
278 'verticalGap' => '',
279 'verticalAlignment' => '',
280 'horizontalGapTablet' => '',
281 'verticalGapTablet' => '',
282 'verticalAlignmentTablet' => 'inherit',
283 'horizontalGapMobile' => '',
284 'verticalGapMobile' => '',
285 'verticalAlignmentMobile' => 'inherit',
286 'horizontalAlignment' => '',
287 'horizontalAlignmentTablet' => '',
288 'horizontalAlignmentMobile' => '',
289 );
290
291 $defaults['headline'] = array(
292 'element' => 'h2',
293 'cssClasses' => '',
294 'alignment' => false,
295 'alignmentTablet' => false,
296 'alignmentMobile' => false,
297 'backgroundColor' => false,
298 'backgroundColorOpacity' => 1,
299 'textColor' => false,
300 'linkColor' => false,
301 'linkColorHover' => false,
302 'borderColor' => false,
303 'borderColorOpacity' => 1,
304 'highlightTextColor' => false,
305 'showAdvancedTypography' => false,
306 'fontFamily' => '',
307 'fontFamilyFallback' => '',
308 'googleFont' => false,
309 'googleFontVariants' => '',
310 'fontWeight' => '',
311 'fontSize' => '',
312 'fontSizeTablet' => '',
313 'fontSizeMobile' => '',
314 'fontSizeUnit' => 'px',
315 'textTransform' => '',
316 'lineHeight' => '',
317 'lineHeightTablet' => '',
318 'lineHeightMobile' => '',
319 'lineHeightUnit' => 'em',
320 'letterSpacing' => '',
321 'letterSpacingTablet' => '',
322 'letterSpacingMobile' => '',
323 'marginTop' => '',
324 'marginRight' => '',
325 'marginBottom' => '',
326 'marginLeft' => '',
327 'marginTopTablet' => '',
328 'marginRightTablet' => '',
329 'marginBottomTablet' => '',
330 'marginLeftTablet' => '',
331 'marginTopMobile' => '',
332 'marginRightMobile' => '',
333 'marginBottomMobile' => '',
334 'marginLeftMobile' => '',
335 'marginUnit' => 'px',
336 'paddingTop' => '',
337 'paddingRight' => '',
338 'paddingBottom' => '',
339 'paddingLeft' => '',
340 'paddingTopTablet' => '',
341 'paddingRightTablet' => '',
342 'paddingBottomTablet' => '',
343 'paddingLeftTablet' => '',
344 'paddingTopMobile' => '',
345 'paddingRightMobile' => '',
346 'paddingBottomMobile' => '',
347 'paddingLeftMobile' => '',
348 'paddingUnit' => 'px',
349 'borderSizeTop' => '',
350 'borderSizeRight' => '',
351 'borderSizeBottom' => '',
352 'borderSizeLeft' => '',
353 'borderSizeTopTablet' => '',
354 'borderSizeRightTablet' => '',
355 'borderSizeBottomTablet' => '',
356 'borderSizeLeftTablet' => '',
357 'borderSizeTopMobile' => '',
358 'borderSizeRightMobile' => '',
359 'borderSizeBottomMobile' => '',
360 'borderSizeLeftMobile' => '',
361 'icon' => '',
362 'hasIcon' => false,
363 'iconColor' => false,
364 'iconColorOpacity' => 1,
365 'iconLocation' => 'inline',
366 'iconLocationTablet' => '',
367 'iconLocationMobile' => '',
368 'iconVerticalAlignment' => 'center',
369 'iconVerticalAlignmentTablet' => '',
370 'iconVerticalAlignmentMobile' => '',
371 'iconPaddingTop' => '',
372 'iconPaddingRight' => '0.5',
373 'iconPaddingBottom' => '',
374 'iconPaddingLeft' => '',
375 'iconPaddingTopTablet' => '',
376 'iconPaddingRightTablet' => '',
377 'iconPaddingBottomTablet' => '',
378 'iconPaddingLeftTablet' => '',
379 'iconPaddingTopMobile' => '',
380 'iconPaddingRightMobile' => '',
381 'iconPaddingBottomMobile' => '',
382 'iconPaddingLeftMobile' => '',
383 'iconPaddingUnit' => 'em',
384 'iconSize' => 1,
385 'iconSizeTablet' => '',
386 'iconSizeMobile' => '',
387 'iconSizeUnit' => 'em',
388 'inlineWidth' => false,
389 'inlineWidthTablet' => false,
390 'inlineWidthMobile' => false,
391 'removeText' => false,
392 'ariaLabel' => '',
393 );
394
395 return apply_filters( 'generateblocks_defaults', $defaults );
396 }
397
398 /**
399 * Get defaults for our general options.
400 *
401 * @since 0.1
402 */
403 function generateblocks_get_option_defaults() {
404 return apply_filters(
405 'generateblocks_option_defaults',
406 array(
407 'css_print_method' => 'file',
408 'color_component_display' => 'palette',
409 )
410 );
411 }
412
413 /**
414 * Styles to use in the editor/font-end when needed.
415 *
416 * @since 1.0
417 */
418 function generateblocks_get_default_styles() {
419 $defaults = generateblocks_get_block_defaults();
420
421 $defaultBlockStyles = array(
422 'button' => array(
423 'backgroundColor' => $defaults['button']['backgroundColor'] ? $defaults['button']['backgroundColor'] : '#0366d6',
424 'textColor' => $defaults['button']['textColor'] ? $defaults['button']['textColor'] : '#ffffff',
425 'backgroundColorHover' => $defaults['button']['backgroundColorHover'] ? $defaults['button']['backgroundColorHover'] : '#222222',
426 'textColorHover' => $defaults['button']['textColorHover'] ? $defaults['button']['textColorHover'] : '#ffffff',
427 'paddingTop' => $defaults['button']['paddingTop'] ? $defaults['button']['paddingTop'] : '15',
428 'paddingRight' => $defaults['button']['paddingRight'] ? $defaults['button']['paddingRight'] : '20',
429 'paddingBottom' => $defaults['button']['paddingBottom'] ? $defaults['button']['paddingBottom'] : '15',
430 'paddingLeft' => $defaults['button']['paddingLeft'] ? $defaults['button']['paddingLeft'] : '20',
431 ),
432 'container' => array(
433 'gridItemPaddingTop' => '0',
434 'gridItemPaddingRight' => '0',
435 'gridItemPaddingBottom' => '0',
436 'gridItemPaddingLeft' => '0',
437 'bgImageSize' => 'full',
438 ),
439 );
440
441 if ( function_exists( 'generate_get_default_fonts' ) ) {
442 $font_settings = wp_parse_args(
443 get_option( 'generate_settings', array() ),
444 generate_get_default_fonts()
445 );
446
447 $defaultBlockStyles['headline'] = array(
448 'p' => array(
449 'marginBottom' => $font_settings['paragraph_margin'],
450 'marginBottomTablet' => '',
451 'marginBottomMobile' => '',
452 'marginUnit' => 'em',
453 'fontSize' => $font_settings['body_font_size'],
454 'fontSizeTablet' => '',
455 'fontSizeMobile' => '',
456 'fontSizeUnit' => 'px',
457 ),
458 'h1' => array(
459 'marginBottom' => $font_settings['heading_1_margin_bottom'],
460 'marginBottomTablet' => '',
461 'marginBottomMobile' => '',
462 'marginUnit' => 'px',
463 'fontSize' => $font_settings['heading_1_font_size'],
464 'fontSizeTablet' => '',
465 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'],
466 'fontSizeUnit' => 'px',
467 ),
468 'h2' => array(
469 'marginBottom' => $font_settings['heading_2_margin_bottom'],
470 'marginBottomTablet' => '',
471 'marginBottomMobile' => '',
472 'marginUnit' => 'px',
473 'fontSize' => $font_settings['heading_2_font_size'],
474 'fontSizeTablet' => '',
475 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'],
476 'fontSizeUnit' => 'px',
477 ),
478 'h3' => array(
479 'marginBottom' => $font_settings['heading_3_margin_bottom'],
480 'marginBottomTablet' => '',
481 'marginBottomMobile' => '',
482 'marginUnit' => 'px',
483 'fontSize' => $font_settings['heading_3_font_size'],
484 'fontSizeTablet' => '',
485 'fontSizeMobile' => '',
486 'fontSizeUnit' => 'px',
487 ),
488 'h4' => array(
489 'marginBottom' => '20',
490 'marginBottomTablet' => '',
491 'marginBottomMobile' => '',
492 'marginUnit' => 'px',
493 'fontSize' => '',
494 'fontSizeTablet' => '',
495 'fontSizeMobile' => '',
496 'fontSizeUnit' => 'px',
497 ),
498 'h5' => array(
499 'marginBottom' => '20',
500 'marginBottomTablet' => '',
501 'marginBottomMobile' => '',
502 'marginUnit' => 'px',
503 'fontSize' => '',
504 'fontSizeTablet' => '',
505 'fontSizeMobile' => '',
506 'fontSizeUnit' => 'px',
507 ),
508 'h6' => array(
509 'marginBottom' => '20',
510 'marginBottomTablet' => '',
511 'marginBottomMobile' => '',
512 'marginUnit' => 'px',
513 'fontSize' => '',
514 'fontSizeTablet' => '',
515 'fontSizeMobile' => '',
516 'fontSizeUnit' => 'px',
517 ),
518 );
519 }
520
521 return apply_filters( 'generateblocks_default_block_styles', $defaultBlockStyles );
522 }
523