@@ -23,7 +23,7 @@ |
||
| 23 | 23 | // This prevents unintended scrolling on pages with few content, when logged in. |
| 24 | 24 | add_theme_support('admin-bar', array('callback' => '__return_false')); |
| 25 | 25 | |
| 26 | -add_action('after_setup_theme', function () { |
|
| 26 | +add_action('after_setup_theme', function() { |
|
| 27 | 27 | /** |
| 28 | 28 | * Make theme available for translation. |
| 29 | 29 | * Translations can be filed in the /languages/ directory. |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -add_filter('Flynt/addComponentData?name=FeatureGoogleAnalytics', function ($data) { |
|
| 18 | +add_filter('Flynt/addComponentData?name=FeatureGoogleAnalytics', function($data) { |
|
| 19 | 19 | $googleAnalyticsOptions = Options::getGlobal('GoogleAnalytics'); |
| 20 | 20 | |
| 21 | 21 | if ($googleAnalyticsOptions) { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | return $data; |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | -add_action('Flynt/thirdPartyCookies/initializeOptions', function () { |
|
| 34 | +add_action('Flynt/thirdPartyCookies/initializeOptions', function() { |
|
| 35 | 35 | Options::addTranslatable('GoogleAnalytics', [ |
| 36 | 36 | [ |
| 37 | 37 | 'label' => __('Accept Google Analytics label', 'flynt'), |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | ]); |
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | -add_action('wp_footer', function () { |
|
| 46 | +add_action('wp_footer', function() { |
|
| 47 | 47 | $context = Timber::get_context(); |
| 48 | 48 | Timber::render_string('{{ renderComponent("FeatureGoogleAnalytics") }}', $context); |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | -add_filter('Flynt/thirdPartyCookies', function ($features) { |
|
| 51 | +add_filter('Flynt/thirdPartyCookies', function($features) { |
|
| 52 | 52 | $googleAnalyticsTranslatableOptions = Options::getTranslatable('GoogleAnalytics'); |
| 53 | 53 | |
| 54 | 54 | $features = array_merge($features, [ |
@@ -5,13 +5,13 @@ |
||
| 5 | 5 | use Timber; |
| 6 | 6 | use Flynt\Utils\Asset; |
| 7 | 7 | |
| 8 | -add_action('init', function () { |
|
| 8 | +add_action('init', function() { |
|
| 9 | 9 | register_nav_menus([ |
| 10 | 10 | 'navigation_burger' => __('Navigation Burger', 'flynt') |
| 11 | 11 | ]); |
| 12 | 12 | }); |
| 13 | 13 | |
| 14 | -add_filter('Flynt/addComponentData?name=NavigationBurger', function ($data) { |
|
| 14 | +add_filter('Flynt/addComponentData?name=NavigationBurger', function($data) { |
|
| 15 | 15 | $data['menu'] = new Timber\Menu('navigation_burger'); |
| 16 | 16 | $data['logo'] = [ |
| 17 | 17 | 'src' => get_theme_mod('custom_header_logo') ? get_theme_mod('custom_header_logo') : Asset::requireUrl('Components/NavigationBurger/Assets/logo.svg'), |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'title' => __('Colors', 'flynt'), |
| 126 | 126 | 'description' => 'description', // Include html tags such as <p>. |
| 127 | 127 | 'priority' => 160, // Mixed with top-level-section hierarchy. |
| 128 | - ] |
|
| 128 | + ] |
|
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | $wp_customize->add_section( |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | // Return default if no color provided |
| 279 | 279 | if (empty($color)) { |
| 280 | - return $default; |
|
| 280 | + return $default; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | // Sanitize $color if "#" is provided |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | }; |
| 386 | 386 | echo (get_theme_mod('theme_colors_accent')) ? '--color-accent-alpha: ' . hex2rgba(get_theme_mod('theme_colors_accent'), $alphaColorAmount) . ';' : null; |
| 387 | 387 | echo (get_theme_mod('theme_colors_accent')) ? '--color-accent-hover: ' . colorBrightness(get_theme_mod('theme_colors_accent'), $darkenColorAmount) . ';' : null; |
| 388 | - } ?> |
|
| 388 | + } ?> |
|
| 389 | 389 | <?php if ($hasChangedLight) { |
| 390 | 390 | foreach ($colorsLight as $name => $color) { |
| 391 | 391 | echo (get_theme_mod('theme_colors_' . $name)) ? '--color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
| 392 | 392 | }; |
| 393 | 393 | echo (get_theme_mod('theme_colors_accent-light')) ? '--color-accent-light-alpha: ' . hex2rgba(get_theme_mod('theme_colors_accent-light'), $alphaColorAmount) . ';' : null; |
| 394 | 394 | echo (get_theme_mod('theme_colors_accent-light')) ? '--color-accent-light-hover: ' . colorBrightness(get_theme_mod('theme_colors_accent-light'), $darkenColorAmount) . ';' : null; |
| 395 | - } ?> |
|
| 395 | + } ?> |
|
| 396 | 396 | <?php if ($hasChangedDark) { |
| 397 | 397 | foreach ($colorsDark as $name => $color) { |
| 398 | 398 | echo (get_theme_mod('theme_colors_' . $name)) ? '--color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ], |
| 119 | 119 | ]; |
| 120 | 120 | |
| 121 | -add_action('customize_register', function ($wp_customize) use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 121 | +add_action('customize_register', function($wp_customize) use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 122 | 122 | $wp_customize->add_panel( |
| 123 | 123 | 'theme_colors_panel', |
| 124 | 124 | [ |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | }); |
| 263 | 263 | |
| 264 | -add_action('customize_preview_init', function () { |
|
| 264 | +add_action('customize_preview_init', function() { |
|
| 265 | 265 | wp_enqueue_script( |
| 266 | 266 | 'customizer-colors', |
| 267 | 267 | Asset::requireUrl('assets/customizer-colors.js'), |
| 268 | - array('jquery','customize-preview'), |
|
| 268 | + array('jquery', 'customize-preview'), |
|
| 269 | 269 | '', |
| 270 | 270 | true |
| 271 | 271 | ); |
@@ -287,15 +287,15 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | // Check if color has 6 or 3 characters and get values |
| 289 | 289 | if (strlen($color) == 6) { |
| 290 | - $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); |
|
| 290 | + $hex = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]); |
|
| 291 | 291 | } elseif (strlen($color) == 3) { |
| 292 | - $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); |
|
| 292 | + $hex = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]); |
|
| 293 | 293 | } else { |
| 294 | 294 | return $default; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Convert hexadec to rgb |
| 298 | - $rgb = array_map('hexdec', $hex); |
|
| 298 | + $rgb = array_map('hexdec', $hex); |
|
| 299 | 299 | |
| 300 | 300 | // Check if opacity is set(rgba or rgb) |
| 301 | 301 | if ($opacity) { |
@@ -352,23 +352,23 @@ discard block |
||
| 352 | 352 | return $hash . $hex; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -add_action('wp_head', function () use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 356 | - $hasChangedDefault = array_filter($colorsDefault, function ($color, $name) { |
|
| 355 | +add_action('wp_head', function() use ($colorsDefault, $colorsLight, $colorsDark, $colorsHero) { |
|
| 356 | + $hasChangedDefault = array_filter($colorsDefault, function($color, $name) { |
|
| 357 | 357 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 358 | 358 | return $value !== $color['default']; |
| 359 | 359 | }, ARRAY_FILTER_USE_BOTH); |
| 360 | 360 | |
| 361 | - $hasChangedLight = array_filter($colorsLight, function ($color, $name) { |
|
| 361 | + $hasChangedLight = array_filter($colorsLight, function($color, $name) { |
|
| 362 | 362 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 363 | 363 | return $value !== $color['default']; |
| 364 | 364 | }, ARRAY_FILTER_USE_BOTH); |
| 365 | 365 | |
| 366 | - $hasChangedDark = array_filter($colorsDark, function ($color, $name) { |
|
| 366 | + $hasChangedDark = array_filter($colorsDark, function($color, $name) { |
|
| 367 | 367 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 368 | 368 | return $value !== $color['default']; |
| 369 | 369 | }, ARRAY_FILTER_USE_BOTH); |
| 370 | 370 | |
| 371 | - $hasChangedHero = array_filter($colorsHero, function ($color, $name) { |
|
| 371 | + $hasChangedHero = array_filter($colorsHero, function($color, $name) { |
|
| 372 | 372 | $value = get_theme_mod('theme_colors_' . $name, $color['default']); |
| 373 | 373 | return $value !== $color['default']; |
| 374 | 374 | }, ARRAY_FILTER_USE_BOTH); |