@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | // Convert ACF Field of type relationship to a Timber\Post and add all ACF Fields of that Post |
31 | 31 | add_filter('acf/format_value/type=relationship', NS . 'formatPostObject', 100); |
32 | -add_filter('get_twig', function ($twig) { |
|
32 | +add_filter('get_twig', function($twig) { |
|
33 | 33 | $twig->addExtension(new TwigExtensionFlynt()); |
34 | 34 | return $twig; |
35 | 35 | }); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | function formatGallery($value) |
46 | 46 | { |
47 | 47 | if (!empty($value)) { |
48 | - $value = array_map(function ($image) { |
|
48 | + $value = array_map(function($image) { |
|
49 | 49 | return new Image($image); |
50 | 50 | }, $value); |
51 | 51 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | return $value; |
71 | 71 | } |
72 | 72 | |
73 | -add_action('timber/twig/filters', function ($twig) { |
|
74 | - $twig->addFunction(new TwigFunction('placeholderImage', function ($width, $height, $color = null) { |
|
73 | +add_action('timber/twig/filters', function($twig) { |
|
74 | + $twig->addFunction(new TwigFunction('placeholderImage', function($width, $height, $color = null) { |
|
75 | 75 | $width = round($width); |
76 | 76 | $height = round($height); |
77 | 77 | $colorRect = $color ? "<rect width='{$width}' height='{$height}' style='fill:$color' />" : ''; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return "data:image/svg+xml;base64," . base64_encode($svg); |
80 | 80 | })); |
81 | 81 | |
82 | - $twig->addFunction(new TwigFunction('requireUrl', function ($asset) { |
|
82 | + $twig->addFunction(new TwigFunction('requireUrl', function($asset) { |
|
83 | 83 | return Asset::requireUrl($asset); |
84 | 84 | })); |
85 | 85 |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'title' => __('Colors', 'flynt'), |
154 | 154 | 'description' => 'description', // Include html tags such as <p>. |
155 | 155 | 'priority' => 160, // Mixed with top-level-section hierarchy. |
156 | - ] |
|
156 | + ] |
|
157 | 157 | ); |
158 | 158 | |
159 | 159 | $wp_customize->add_section( |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | if ($name == 'background-light') { |
243 | 243 | /** |
244 | 244 | Separator 1 |
245 | - **/ |
|
245 | + **/ |
|
246 | 246 | |
247 | 247 | $wp_customize->add_setting('separator_1', array( |
248 | 248 | 'default' => '', |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | /** |
262 | 262 | Section Title - Theme Light |
263 | - **/ |
|
263 | + **/ |
|
264 | 264 | $wp_customize->add_setting('section_title_light', array( |
265 | 265 | 'default' => '', |
266 | 266 | 'sanitize_callback' => 'flynt_text_sanitization', |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | //Return default if no color provided |
341 | 341 | if (empty($color)) { |
342 | - return $default; |
|
342 | + return $default; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | //Sanitize $color if "#" is provided |
@@ -447,14 +447,14 @@ discard block |
||
447 | 447 | }; |
448 | 448 | echo (get_theme_mod('theme_colors_accent')) ? '--color-accent-alpha: ' . hex2rgba(get_theme_mod('theme_colors_accent'), $alphaColorAmount) . ';' : null; |
449 | 449 | echo (get_theme_mod('theme_colors_accent')) ? '--color-accent-hover: ' . colorBrightness(get_theme_mod('theme_colors_accent'), $darkenColorAmount) . ';' : null; |
450 | - } ?> |
|
450 | + } ?> |
|
451 | 451 | <?php if ($hasChangedLight) { |
452 | 452 | foreach ($colorsLight as $name => $color) { |
453 | 453 | echo (get_theme_mod('theme_colors_' . $name)) ? '--color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
454 | 454 | }; |
455 | 455 | echo (get_theme_mod('theme_colors_accent-light')) ? '--color-accent-light-alpha: ' . hex2rgba(get_theme_mod('theme_colors_accent-light'), $alphaColorAmount) . ';' : null; |
456 | 456 | echo (get_theme_mod('theme_colors_accent-light')) ? '--color-accent-light-hover: ' . colorBrightness(get_theme_mod('theme_colors_accent-light'), $darkenColorAmount) . ';' : null; |
457 | - } ?> |
|
457 | + } ?> |
|
458 | 458 | <?php if ($hasChangedDark) { |
459 | 459 | foreach ($colorsDark as $name => $color) { |
460 | 460 | echo (get_theme_mod('theme_colors_' . $name)) ? '--color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ], |
147 | 147 | ]; |
148 | 148 | |
149 | -add_action('customize_register', function ($wp_customize) use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
149 | +add_action('customize_register', function($wp_customize) use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
150 | 150 | $wp_customize->add_panel( |
151 | 151 | 'theme_colors_panel', |
152 | 152 | [ |
@@ -323,11 +323,11 @@ discard block |
||
323 | 323 | } |
324 | 324 | }); |
325 | 325 | |
326 | -add_action('customize_preview_init', function () { |
|
326 | +add_action('customize_preview_init', function() { |
|
327 | 327 | wp_enqueue_script( |
328 | 328 | 'customizer-colors', |
329 | 329 | Asset::requireUrl('assets/customizer-colors.js'), |
330 | - array('jquery','customize-preview'), |
|
330 | + array('jquery', 'customize-preview'), |
|
331 | 331 | '', |
332 | 332 | true |
333 | 333 | ); |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | |
350 | 350 | //Check if color has 6 or 3 characters and get values |
351 | 351 | if (strlen($color) == 6) { |
352 | - $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); |
|
352 | + $hex = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]); |
|
353 | 353 | } elseif (strlen($color) == 3) { |
354 | - $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); |
|
354 | + $hex = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]); |
|
355 | 355 | } else { |
356 | 356 | return $default; |
357 | 357 | } |
358 | 358 | |
359 | 359 | //Convert hexadec to rgb |
360 | - $rgb = array_map('hexdec', $hex); |
|
360 | + $rgb = array_map('hexdec', $hex); |
|
361 | 361 | |
362 | 362 | //Check if opacity is set(rgba or rgb) |
363 | 363 | if ($opacity) { |
@@ -414,23 +414,23 @@ discard block |
||
414 | 414 | return $hash . $hex; |
415 | 415 | } |
416 | 416 | |
417 | -add_action('wp_head', function () use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
418 | - $hasChangedDefault = array_filter($colorsDefault, function ($color, $name) { |
|
417 | +add_action('wp_head', function() use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
418 | + $hasChangedDefault = array_filter($colorsDefault, function($color, $name) { |
|
419 | 419 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
420 | 420 | return $value !== $color['default']; |
421 | 421 | }, ARRAY_FILTER_USE_BOTH); |
422 | 422 | |
423 | - $hasChangedLight = array_filter($colorsLight, function ($color, $name) { |
|
423 | + $hasChangedLight = array_filter($colorsLight, function($color, $name) { |
|
424 | 424 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
425 | 425 | return $value !== $color['default']; |
426 | 426 | }, ARRAY_FILTER_USE_BOTH); |
427 | 427 | |
428 | - $hasChangedDark = array_filter($colorsDark, function ($color, $name) { |
|
428 | + $hasChangedDark = array_filter($colorsDark, function($color, $name) { |
|
429 | 429 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
430 | 430 | return $value !== $color['default']; |
431 | 431 | }, ARRAY_FILTER_USE_BOTH); |
432 | 432 | |
433 | - $hasChangedHero = array_filter($colorsHero, function ($color, $name) { |
|
433 | + $hasChangedHero = array_filter($colorsHero, function($color, $name) { |
|
434 | 434 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
435 | 435 | return $value !== $color['default']; |
436 | 436 | }, ARRAY_FILTER_USE_BOTH); |