@@ -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 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | ], |
| 145 | 145 | ]; |
| 146 | 146 | |
| 147 | -add_action('customize_register', function ($wp_customize) use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 147 | +add_action('customize_register', function($wp_customize) use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 148 | 148 | $wp_customize->add_section( |
| 149 | 149 | 'theme_colors', |
| 150 | 150 | [ |
@@ -385,11 +385,11 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | }); |
| 387 | 387 | |
| 388 | -add_action('customize_preview_init', function () { |
|
| 388 | +add_action('customize_preview_init', function() { |
|
| 389 | 389 | wp_enqueue_script( |
| 390 | 390 | 'customizer-colors', |
| 391 | 391 | Asset::requireUrl('assets/customizer-colors.js'), |
| 392 | - array('jquery','customize-preview'), |
|
| 392 | + array('jquery', 'customize-preview'), |
|
| 393 | 393 | '', |
| 394 | 394 | true |
| 395 | 395 | ); |
@@ -411,15 +411,15 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | //Check if color has 6 or 3 characters and get values |
| 413 | 413 | if (strlen($color) == 6) { |
| 414 | - $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); |
|
| 414 | + $hex = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]); |
|
| 415 | 415 | } elseif (strlen($color) == 3) { |
| 416 | - $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); |
|
| 416 | + $hex = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]); |
|
| 417 | 417 | } else { |
| 418 | 418 | return $default; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | //Convert hexadec to rgb |
| 422 | - $rgb = array_map('hexdec', $hex); |
|
| 422 | + $rgb = array_map('hexdec', $hex); |
|
| 423 | 423 | |
| 424 | 424 | //Check if opacity is set(rgba or rgb) |
| 425 | 425 | if ($opacity) { |
@@ -476,23 +476,23 @@ discard block |
||
| 476 | 476 | return $hash . $hex; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | -add_action('wp_head', function () use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 480 | - $hasChangedDefault = array_filter($colorsDefault, function ($color, $name) { |
|
| 479 | +add_action('wp_head', function() use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 480 | + $hasChangedDefault = array_filter($colorsDefault, function($color, $name) { |
|
| 481 | 481 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 482 | 482 | return $value !== $color['default']; |
| 483 | 483 | }, ARRAY_FILTER_USE_BOTH); |
| 484 | 484 | |
| 485 | - $hasChangedLight = array_filter($colorsLight, function ($color, $name) { |
|
| 485 | + $hasChangedLight = array_filter($colorsLight, function($color, $name) { |
|
| 486 | 486 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 487 | 487 | return $value !== $color['default']; |
| 488 | 488 | }, ARRAY_FILTER_USE_BOTH); |
| 489 | 489 | |
| 490 | - $hasChangedDark = array_filter($colorsDark, function ($color, $name) { |
|
| 490 | + $hasChangedDark = array_filter($colorsDark, function($color, $name) { |
|
| 491 | 491 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 492 | 492 | return $value !== $color['default']; |
| 493 | 493 | }, ARRAY_FILTER_USE_BOTH); |
| 494 | 494 | |
| 495 | - $hasChangedHero = array_filter($colorsHero, function ($color, $name) { |
|
| 495 | + $hasChangedHero = array_filter($colorsHero, function($color, $name) { |
|
| 496 | 496 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 497 | 497 | return $value !== $color['default']; |
| 498 | 498 | }, ARRAY_FILTER_USE_BOTH); |