PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.0
GenerateBlocks v1.0
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-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
519 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 'overlay' => false,
108 'position' => 'center center',
109 'size' => 'cover',
110 'repeat' => 'no-repeat',
111 'attachment' => '',
112 ),
113 'width' => 50,
114 'widthTablet' => '',
115 'widthMobile' => 100,
116 'verticalAlignment' => '',
117 'verticalAlignmentTablet' => 'inherit',
118 'verticalAlignmentMobile' => 'inherit',
119 'zindex' => '',
120 'removeVerticalGap' => false,
121 'removeVerticalGapTablet' => false,
122 'removeVerticalGapMobile' => false,
123 'orderTablet' => false,
124 'orderMobile' => false,
125 'alignment' => '',
126 'alignmentTablet' => '',
127 'alignmentMobile' => '',
128 'showAdvancedTypography' => false,
129 'fontFamily' => '',
130 'fontFamilyFallback' => '',
131 'googleFont' => false,
132 'googleFontVariants' => '',
133 'fontWeight' => '',
134 'fontSize' => '',
135 'fontSizeTablet' => '',
136 'fontSizeMobile' => '',
137 'fontSizeUnit' => 'px',
138 'textTransform' => '',
139 );
140
141 $defaults['buttonContainer'] = array(
142 'alignment' => '',
143 'alignmentTablet' => '',
144 'alignmentMobile' => '',
145 'marginTop' => '',
146 'marginRight' => '',
147 'marginBottom' => '',
148 'marginLeft' => '',
149 'marginTopTablet' => '',
150 'marginRightTablet' => '',
151 'marginBottomTablet' => '',
152 'marginLeftTablet' => '',
153 'marginTopMobile' => '',
154 'marginRightMobile' => '',
155 'marginBottomMobile' => '',
156 'marginLeftMobile' => '',
157 'marginUnit' => 'px',
158 'stack' => false,
159 'stackTablet' => false,
160 'stackMobile' => false,
161 'fillHorizontalSpace' => false,
162 'fillHorizontalSpaceTablet' => false,
163 'fillHorizontalSpaceMobile' => false,
164 );
165
166 $defaults['button'] = array(
167 'backgroundColor' => false,
168 'backgroundColorOpacity' => 1,
169 'textColor' => false,
170 'backgroundColorHover' => false,
171 'backgroundColorHoverOpacity' => 1,
172 'textColorHover' => false,
173 'showAdvancedTypography' => false,
174 'fontFamily' => '',
175 'fontFamilyFallback' => '',
176 'googleFont' => false,
177 'googleFontVariants' => '',
178 'fontWeight' => '',
179 'fontSize' => false,
180 'fontSizeTablet' => false,
181 'fontSizeMobile' => false,
182 'fontSizeUnit' => 'px',
183 'textTransform' => '',
184 'letterSpacing' => '',
185 'letterSpacingTablet' => '',
186 'letterSpacingMobile' => '',
187 'marginTop' => '',
188 'marginRight' => '',
189 'marginBottom' => '',
190 'marginLeft' => '',
191 'marginTopTablet' => '',
192 'marginRightTablet' => '',
193 'marginBottomTablet' => '',
194 'marginLeftTablet' => '',
195 'marginTopMobile' => '',
196 'marginRightMobile' => '',
197 'marginBottomMobile' => '',
198 'marginLeftMobile' => '',
199 'marginUnit' => 'px',
200 'paddingTop' => '',
201 'paddingRight' => '',
202 'paddingBottom' => '',
203 'paddingLeft' => '',
204 'paddingTopTablet' => '',
205 'paddingRightTablet' => '',
206 'paddingBottomTablet' => '',
207 'paddingLeftTablet' => '',
208 'paddingTopMobile' => '',
209 'paddingRightMobile' => '',
210 'paddingBottomMobile' => '',
211 'paddingLeftMobile' => '',
212 'paddingUnit' => 'px',
213 'borderSizeTop' => '',
214 'borderSizeRight' => '',
215 'borderSizeBottom' => '',
216 'borderSizeLeft' => '',
217 'borderSizeTopTablet' => '',
218 'borderSizeRightTablet' => '',
219 'borderSizeBottomTablet' => '',
220 'borderSizeLeftTablet' => '',
221 'borderSizeTopMobile' => '',
222 'borderSizeRightMobile' => '',
223 'borderSizeBottomMobile' => '',
224 'borderSizeLeftMobile' => '',
225 'borderRadiusTopRight' => '',
226 'borderRadiusBottomRight' => '',
227 'borderRadiusBottomLeft' => '',
228 'borderRadiusTopLeft' => '',
229 'borderRadiusTopRightTablet' => '',
230 'borderRadiusBottomRightTablet' => '',
231 'borderRadiusBottomLeftTablet' => '',
232 'borderRadiusTopLeftTablet' => '',
233 'borderRadiusTopRightMobile' => '',
234 'borderRadiusBottomRightMobile' => '',
235 'borderRadiusBottomLeftMobile' => '',
236 'borderRadiusTopLeftMobile' => '',
237 'borderRadiusUnit' => 'px',
238 'borderColor' => false,
239 'borderColorOpacity' => 1,
240 'borderColorHover' => false,
241 'borderColorHoverOpacity' => 1,
242 'icon' => '',
243 'hasIcon' => false,
244 'iconLocation' => 'left',
245 'removeText' => false,
246 'ariaLabel' => '',
247 'gradient' => false,
248 'gradientDirection' => 90,
249 'gradientColorOne' => '#ffffff',
250 'gradientColorOneOpacity' => 0.1,
251 'gradientColorStopOne' => '',
252 'gradientColorTwo' => '#000000',
253 'gradientColorTwoOpacity' => 0.3,
254 'gradientColorStopTwo' => '',
255 'iconPaddingTop' => '',
256 'iconPaddingRight' => '0.5',
257 'iconPaddingBottom' => '',
258 'iconPaddingLeft' => '',
259 'iconPaddingTopTablet' => '',
260 'iconPaddingRightTablet' => '',
261 'iconPaddingBottomTablet' => '',
262 'iconPaddingLeftTablet' => '',
263 'iconPaddingTopMobile' => '',
264 'iconPaddingRightMobile' => '',
265 'iconPaddingBottomMobile' => '',
266 'iconPaddingLeftMobile' => '',
267 'iconPaddingUnit' => 'em',
268 'iconSize' => 1,
269 'iconSizeTablet' => '',
270 'iconSizeMobile' => '',
271 'iconSizeUnit' => 'em',
272 );
273
274 $defaults['gridContainer'] = array(
275 'horizontalGap' => 30,
276 'verticalGap' => '',
277 'verticalAlignment' => '',
278 'horizontalGapTablet' => '',
279 'verticalGapTablet' => '',
280 'verticalAlignmentTablet' => 'inherit',
281 'horizontalGapMobile' => '',
282 'verticalGapMobile' => '',
283 'verticalAlignmentMobile' => 'inherit',
284 'horizontalAlignment' => '',
285 'horizontalAlignmentTablet' => '',
286 'horizontalAlignmentMobile' => '',
287 );
288
289 $defaults['headline'] = array(
290 'element' => 'h2',
291 'cssClasses' => '',
292 'alignment' => false,
293 'alignmentTablet' => false,
294 'alignmentMobile' => false,
295 'backgroundColor' => false,
296 'backgroundColorOpacity' => 1,
297 'textColor' => false,
298 'linkColor' => false,
299 'linkColorHover' => false,
300 'borderColor' => false,
301 'borderColorOpacity' => 1,
302 'highlightTextColor' => false,
303 'showAdvancedTypography' => false,
304 'fontFamily' => '',
305 'fontFamilyFallback' => '',
306 'googleFont' => false,
307 'googleFontVariants' => '',
308 'fontWeight' => '',
309 'fontSize' => '',
310 'fontSizeTablet' => '',
311 'fontSizeMobile' => '',
312 'fontSizeUnit' => 'px',
313 'textTransform' => '',
314 'lineHeight' => '',
315 'lineHeightTablet' => '',
316 'lineHeightMobile' => '',
317 'lineHeightUnit' => 'em',
318 'letterSpacing' => '',
319 'letterSpacingTablet' => '',
320 'letterSpacingMobile' => '',
321 'marginTop' => '',
322 'marginRight' => '',
323 'marginBottom' => '',
324 'marginLeft' => '',
325 'marginTopTablet' => '',
326 'marginRightTablet' => '',
327 'marginBottomTablet' => '',
328 'marginLeftTablet' => '',
329 'marginTopMobile' => '',
330 'marginRightMobile' => '',
331 'marginBottomMobile' => '',
332 'marginLeftMobile' => '',
333 'marginUnit' => 'px',
334 'paddingTop' => '',
335 'paddingRight' => '',
336 'paddingBottom' => '',
337 'paddingLeft' => '',
338 'paddingTopTablet' => '',
339 'paddingRightTablet' => '',
340 'paddingBottomTablet' => '',
341 'paddingLeftTablet' => '',
342 'paddingTopMobile' => '',
343 'paddingRightMobile' => '',
344 'paddingBottomMobile' => '',
345 'paddingLeftMobile' => '',
346 'paddingUnit' => 'px',
347 'borderSizeTop' => '',
348 'borderSizeRight' => '',
349 'borderSizeBottom' => '',
350 'borderSizeLeft' => '',
351 'borderSizeTopTablet' => '',
352 'borderSizeRightTablet' => '',
353 'borderSizeBottomTablet' => '',
354 'borderSizeLeftTablet' => '',
355 'borderSizeTopMobile' => '',
356 'borderSizeRightMobile' => '',
357 'borderSizeBottomMobile' => '',
358 'borderSizeLeftMobile' => '',
359 'icon' => '',
360 'hasIcon' => false,
361 'iconColor' => false,
362 'iconColorOpacity' => 1,
363 'iconLocation' => 'inline',
364 'iconLocationTablet' => '',
365 'iconLocationMobile' => '',
366 'iconVerticalAlignment' => 'center',
367 'iconVerticalAlignmentTablet' => '',
368 'iconVerticalAlignmentMobile' => '',
369 'iconPaddingTop' => '',
370 'iconPaddingRight' => '0.5',
371 'iconPaddingBottom' => '',
372 'iconPaddingLeft' => '',
373 'iconPaddingTopTablet' => '',
374 'iconPaddingRightTablet' => '',
375 'iconPaddingBottomTablet' => '',
376 'iconPaddingLeftTablet' => '',
377 'iconPaddingTopMobile' => '',
378 'iconPaddingRightMobile' => '',
379 'iconPaddingBottomMobile' => '',
380 'iconPaddingLeftMobile' => '',
381 'iconPaddingUnit' => 'em',
382 'iconSize' => 1,
383 'iconSizeTablet' => '',
384 'iconSizeMobile' => '',
385 'iconSizeUnit' => 'em',
386 'inlineWidth' => false,
387 'inlineWidthTablet' => false,
388 'inlineWidthMobile' => false,
389 'removeText' => false,
390 'ariaLabel' => '',
391 );
392
393 return apply_filters( 'generateblocks_defaults', $defaults );
394 }
395
396 /**
397 * Get defaults for our general options.
398 *
399 * @since 0.1
400 */
401 function generateblocks_get_option_defaults() {
402 return apply_filters(
403 'generateblocks_option_defaults',
404 array(
405 'css_print_method' => 'file',
406 )
407 );
408 }
409
410 /**
411 * Styles to use in the editor/font-end when needed.
412 *
413 * @since 1.0
414 */
415 function generateblocks_get_default_styles() {
416 $defaults = generateblocks_get_block_defaults();
417
418 $defaultBlockStyles = array(
419 'button' => array(
420 'backgroundColor' => $defaults['button']['backgroundColor'] ? $defaults['button']['backgroundColor'] : '#0366d6',
421 'textColor' => $defaults['button']['textColor'] ? $defaults['button']['textColor'] : '#ffffff',
422 'backgroundColorHover' => $defaults['button']['backgroundColorHover'] ? $defaults['button']['backgroundColorHover'] : '#222222',
423 'textColorHover' => $defaults['button']['textColorHover'] ? $defaults['button']['textColorHover'] : '#ffffff',
424 'paddingTop' => $defaults['button']['paddingTop'] ? $defaults['button']['paddingTop'] : '15',
425 'paddingRight' => $defaults['button']['paddingRight'] ? $defaults['button']['paddingRight'] : '20',
426 'paddingBottom' => $defaults['button']['paddingBottom'] ? $defaults['button']['paddingBottom'] : '15',
427 'paddingLeft' => $defaults['button']['paddingLeft'] ? $defaults['button']['paddingLeft'] : '20',
428 ),
429 'container' => array(
430 'gridItemPaddingTop' => '0',
431 'gridItemPaddingRight' => '0',
432 'gridItemPaddingBottom' => '0',
433 'gridItemPaddingLeft' => '0',
434 ),
435 );
436
437 if ( function_exists( 'generate_get_default_fonts' ) ) {
438 $font_settings = wp_parse_args(
439 get_option( 'generate_settings', array() ),
440 generate_get_default_fonts()
441 );
442
443 $defaultBlockStyles['headline'] = array(
444 'p' => array(
445 'marginBottom' => $font_settings['paragraph_margin'],
446 'marginBottomTablet' => '',
447 'marginBottomMobile' => '',
448 'marginUnit' => 'em',
449 'fontSize' => $font_settings['body_font_size'],
450 'fontSizeTablet' => '',
451 'fontSizeMobile' => '',
452 'fontSizeUnit' => 'px',
453 ),
454 'h1' => array(
455 'marginBottom' => $font_settings['heading_1_margin_bottom'],
456 'marginBottomTablet' => '',
457 'marginBottomMobile' => '',
458 'marginUnit' => 'px',
459 'fontSize' => $font_settings['heading_1_font_size'],
460 'fontSizeTablet' => '',
461 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'],
462 'fontSizeUnit' => 'px',
463 ),
464 'h2' => array(
465 'marginBottom' => $font_settings['heading_2_margin_bottom'],
466 'marginBottomTablet' => '',
467 'marginBottomMobile' => '',
468 'marginUnit' => 'px',
469 'fontSize' => $font_settings['heading_2_font_size'],
470 'fontSizeTablet' => '',
471 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'],
472 'fontSizeUnit' => 'px',
473 ),
474 'h3' => array(
475 'marginBottom' => $font_settings['heading_3_margin_bottom'],
476 'marginBottomTablet' => '',
477 'marginBottomMobile' => '',
478 'marginUnit' => 'px',
479 'fontSize' => $font_settings['heading_3_font_size'],
480 'fontSizeTablet' => '',
481 'fontSizeMobile' => '',
482 'fontSizeUnit' => 'px',
483 ),
484 'h4' => array(
485 'marginBottom' => '20',
486 'marginBottomTablet' => '',
487 'marginBottomMobile' => '',
488 'marginUnit' => 'px',
489 'fontSize' => '',
490 'fontSizeTablet' => '',
491 'fontSizeMobile' => '',
492 'fontSizeUnit' => 'px',
493 ),
494 'h5' => array(
495 'marginBottom' => '20',
496 'marginBottomTablet' => '',
497 'marginBottomMobile' => '',
498 'marginUnit' => 'px',
499 'fontSize' => '',
500 'fontSizeTablet' => '',
501 'fontSizeMobile' => '',
502 'fontSizeUnit' => 'px',
503 ),
504 'h6' => array(
505 'marginBottom' => '20',
506 'marginBottomTablet' => '',
507 'marginBottomMobile' => '',
508 'marginUnit' => 'px',
509 'fontSize' => '',
510 'fontSizeTablet' => '',
511 'fontSizeMobile' => '',
512 'fontSizeUnit' => 'px',
513 ),
514 );
515 }
516
517 return apply_filters( 'generateblocks_default_block_styles', $defaultBlockStyles );
518 }
519