PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / trunk
GenerateBlocks vtrunk
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
blocks 1 week ago dynamic-tags 1 week ago pattern-library 1 week ago utils 2 years ago class-do-css.php 2 years ago class-dynamic-content.php 1 week ago class-dynamic-tag-security.php 6 months ago class-enqueue-css.php 1 year ago class-legacy-attributes.php 4 years ago class-map-deprecated-attributes.php 2 years ago class-meta-handler.php 3 months ago class-plugin-update.php 1 year ago class-query-loop.php 2 years ago class-query-utils.php 1 week ago class-render-blocks.php 1 year ago class-rest.php 1 year ago class-settings.php 1 year ago dashboard.php 1 year ago defaults.php 1 year ago deprecated.php 1 year ago functions.php 1 week ago general.php 1 week ago
defaults.php
200 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 $use_cache = apply_filters( 'generateblocks_use_block_defaults_cache', false );
21
22 if ( $use_cache ) {
23 $cached_data = wp_cache_get(
24 'generateblocks_defaults_cache',
25 'generateblocks_cache_group'
26 );
27
28 if ( $cached_data ) {
29 return $cached_data;
30 }
31 }
32
33 $defaults = apply_filters(
34 'generateblocks_defaults',
35 [
36 'container' => generateblocks_with_global_defaults( GenerateBlocks_Block_Container::defaults() ),
37 'buttonContainer' => generateblocks_with_global_defaults( GenerateBlocks_Block_Button_Container::defaults() ),
38 'button' => generateblocks_with_global_defaults( GenerateBlocks_Block_Button::defaults() ),
39 'gridContainer' => generateblocks_with_global_defaults( GenerateBlocks_Block_Grid::defaults() ),
40 'headline' => generateblocks_with_global_defaults( GenerateBlocks_Block_Headline::defaults() ),
41 'image' => generateblocks_with_global_defaults( GenerateBlocks_Block_Image::defaults() ),
42 ]
43 );
44
45 if ( $use_cache ) {
46 wp_cache_set(
47 'generateblocks_defaults_cache',
48 $defaults,
49 'generateblocks_cache_group'
50 );
51 }
52
53 return $defaults;
54 }
55
56 /**
57 * Get defaults for our general options.
58 *
59 * @since 0.1
60 */
61 function generateblocks_get_option_defaults() {
62 return apply_filters(
63 'generateblocks_option_defaults',
64 array(
65 'container_width' => 1100,
66 'css_print_method' => 'file',
67 'sync_responsive_previews' => true,
68 'disable_google_fonts' => true,
69 )
70 );
71 }
72
73 /**
74 * Styles to use in the editor/font-end when needed.
75 *
76 * @since 1.0
77 */
78 function generateblocks_get_default_styles() {
79 $defaults = generateblocks_get_block_defaults();
80
81 $defaultBlockStyles = array(
82 'button' => array(
83 'backgroundColor' => $defaults['button']['backgroundColor'] ? $defaults['button']['backgroundColor'] : '#0366d6',
84 'textColor' => $defaults['button']['textColor'] ? $defaults['button']['textColor'] : '#ffffff',
85 'backgroundColorHover' => $defaults['button']['backgroundColorHover'] ? $defaults['button']['backgroundColorHover'] : '#222222',
86 'textColorHover' => $defaults['button']['textColorHover'] ? $defaults['button']['textColorHover'] : '#ffffff',
87 'spacing' => [
88 'paddingTop' => $defaults['button']['paddingTop'] ? $defaults['button']['paddingTop'] : '15px',
89 'paddingRight' => $defaults['button']['paddingRight'] ? $defaults['button']['paddingRight'] : '20px',
90 'paddingBottom' => $defaults['button']['paddingBottom'] ? $defaults['button']['paddingBottom'] : '15px',
91 'paddingLeft' => $defaults['button']['paddingLeft'] ? $defaults['button']['paddingLeft'] : '20px',
92 ],
93 'display' => 'inline-flex',
94 ),
95 'container' => array(
96 'gridItemPaddingTop' => '',
97 'gridItemPaddingRight' => '',
98 'gridItemPaddingBottom' => '',
99 'gridItemPaddingLeft' => '',
100 'bgImageSize' => 'full',
101 'shapeDividers' => array(
102 'shape' => 'gb-waves-1',
103 'location' => 'bottom',
104 'height' => 200,
105 'heightTablet' => '',
106 'heightMobile' => '',
107 'width' => 100,
108 'widthTablet' => '',
109 'widthMobile' => '',
110 'flipHorizontally' => false,
111 'zindex' => '',
112 'color' => '#000000',
113 'colorOpacity' => 1,
114 ),
115 ),
116 );
117
118 if ( function_exists( 'generate_get_default_fonts' ) ) {
119 $font_settings = wp_parse_args(
120 get_option( 'generate_settings', array() ),
121 generate_get_default_fonts()
122 );
123
124 $defaultBlockStyles['headline'] = array(
125 'p' => array(
126 'marginBottom' => $font_settings['paragraph_margin'],
127 'marginBottomTablet' => '',
128 'marginBottomMobile' => '',
129 'marginUnit' => 'em',
130 'fontSize' => $font_settings['body_font_size'],
131 'fontSizeTablet' => '',
132 'fontSizeMobile' => '',
133 'fontSizeUnit' => 'px',
134 ),
135 'h1' => array(
136 'marginBottom' => $font_settings['heading_1_margin_bottom'],
137 'marginBottomTablet' => '',
138 'marginBottomMobile' => '',
139 'marginUnit' => 'px',
140 'fontSize' => $font_settings['heading_1_font_size'],
141 'fontSizeTablet' => '',
142 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'],
143 'fontSizeUnit' => 'px',
144 ),
145 'h2' => array(
146 'marginBottom' => $font_settings['heading_2_margin_bottom'],
147 'marginBottomTablet' => '',
148 'marginBottomMobile' => '',
149 'marginUnit' => 'px',
150 'fontSize' => $font_settings['heading_2_font_size'],
151 'fontSizeTablet' => '',
152 'fontSizeMobile' => $font_settings['mobile_heading_1_font_size'],
153 'fontSizeUnit' => 'px',
154 ),
155 'h3' => array(
156 'marginBottom' => $font_settings['heading_3_margin_bottom'],
157 'marginBottomTablet' => '',
158 'marginBottomMobile' => '',
159 'marginUnit' => 'px',
160 'fontSize' => $font_settings['heading_3_font_size'],
161 'fontSizeTablet' => '',
162 'fontSizeMobile' => '',
163 'fontSizeUnit' => 'px',
164 ),
165 'h4' => array(
166 'marginBottom' => '20',
167 'marginBottomTablet' => '',
168 'marginBottomMobile' => '',
169 'marginUnit' => 'px',
170 'fontSize' => '',
171 'fontSizeTablet' => '',
172 'fontSizeMobile' => '',
173 'fontSizeUnit' => 'px',
174 ),
175 'h5' => array(
176 'marginBottom' => '20',
177 'marginBottomTablet' => '',
178 'marginBottomMobile' => '',
179 'marginUnit' => 'px',
180 'fontSize' => '',
181 'fontSizeTablet' => '',
182 'fontSizeMobile' => '',
183 'fontSizeUnit' => 'px',
184 ),
185 'h6' => array(
186 'marginBottom' => '20',
187 'marginBottomTablet' => '',
188 'marginBottomMobile' => '',
189 'marginUnit' => 'px',
190 'fontSize' => '',
191 'fontSizeTablet' => '',
192 'fontSizeMobile' => '',
193 'fontSizeUnit' => 'px',
194 ),
195 );
196 }
197
198 return apply_filters( 'generateblocks_default_block_styles', $defaultBlockStyles );
199 }
200