@@ -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 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | Section Title - Default |
| 182 | - **/ |
|
| 182 | + **/ |
|
| 183 | 183 | $wp_customize->add_setting('section_title_default', array( |
| 184 | 184 | 'default' => '', |
| 185 | 185 | 'sanitize_callback' => 'mytheme_text_sanitization', |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | 220 | Separator 1 |
| 221 | - **/ |
|
| 221 | + **/ |
|
| 222 | 222 | |
| 223 | 223 | $wp_customize->add_setting('separator_1', array( |
| 224 | 224 | 'default' => '', |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | Section Title - Theme Light |
| 239 | - **/ |
|
| 239 | + **/ |
|
| 240 | 240 | $wp_customize->add_setting('section_title_light', array( |
| 241 | 241 | 'default' => '', |
| 242 | 242 | 'sanitize_callback' => 'mytheme_text_sanitization', |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | 276 | Separator 2 |
| 277 | - **/ |
|
| 277 | + **/ |
|
| 278 | 278 | |
| 279 | 279 | $wp_customize->add_setting('separator_2', array( |
| 280 | 280 | 'default' => '', |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | 294 | Section Title - Theme Dark |
| 295 | - **/ |
|
| 295 | + **/ |
|
| 296 | 296 | $wp_customize->add_setting('section_title_dark', array( |
| 297 | 297 | 'default' => '', |
| 298 | 298 | 'sanitize_callback' => 'mytheme_text_sanitization', |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | 332 | Separator 3 |
| 333 | - **/ |
|
| 333 | + **/ |
|
| 334 | 334 | |
| 335 | 335 | $wp_customize->add_setting('separator_3', array( |
| 336 | 336 | 'default' => '', |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | 350 | Section Title - Theme Hero |
| 351 | - **/ |
|
| 351 | + **/ |
|
| 352 | 352 | $wp_customize->add_setting('section_title_hero', array( |
| 353 | 353 | 'default' => '', |
| 354 | 354 | 'sanitize_callback' => 'mytheme_text_sanitization', |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | //Return default if no color provided |
| 403 | 403 | if (empty($color)) { |
| 404 | - return $default; |
|
| 404 | + return $default; |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | //Sanitize $color if "#" is provided |
@@ -509,14 +509,14 @@ discard block |
||
| 509 | 509 | }; |
| 510 | 510 | echo (get_theme_mod('theme_colors_accent')) ? '--color-accent-alpha: ' . hex2rgba(get_theme_mod('theme_colors_accent'), $alphaColorAmount) . ';' : null; |
| 511 | 511 | echo (get_theme_mod('theme_colors_accent')) ? '--color-accent-hover: ' . colorBrightness(get_theme_mod('theme_colors_accent'), $darkenColorAmount) . ';' : null; |
| 512 | - } ?> |
|
| 512 | + } ?> |
|
| 513 | 513 | <?php if ($hasChangedLight) { |
| 514 | 514 | foreach ($colorsLight as $name => $color) { |
| 515 | 515 | echo (get_theme_mod('theme_colors_' . $name)) ? '--color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
| 516 | 516 | }; |
| 517 | 517 | echo (get_theme_mod('theme_colors_accent-light')) ? '--color-accent-light-alpha: ' . hex2rgba(get_theme_mod('theme_colors_accent-light'), $alphaColorAmount) . ';' : null; |
| 518 | 518 | echo (get_theme_mod('theme_colors_accent-light')) ? '--color-accent-light-hover: ' . colorBrightness(get_theme_mod('theme_colors_accent-light'), $darkenColorAmount) . ';' : null; |
| 519 | - } ?> |
|
| 519 | + } ?> |
|
| 520 | 520 | <?php if ($hasChangedDark) { |
| 521 | 521 | foreach ($colorsDark as $name => $color) { |
| 522 | 522 | echo (get_theme_mod('theme_colors_' . $name)) ? '--color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
@@ -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); |