@@ -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); |
@@ -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-default')) ? '--theme-color-accent-alpha-default: ' . hex2rgba(get_theme_mod('theme_colors_accent-default'), $alphaColorAmount) . ';' : null; |
| 387 | 387 | echo (get_theme_mod('theme_colors_accent-default')) ? '--theme-color-accent-hover-default: ' . colorBrightness(get_theme_mod('theme_colors_accent-default'), $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)) ? '--theme-color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
| 392 | 392 | }; |
| 393 | 393 | echo (get_theme_mod('theme_colors_accent-light')) ? '--theme-color-accent-alpha-light: ' . hex2rgba(get_theme_mod('theme_colors_accent-light'), $alphaColorAmount) . ';' : null; |
| 394 | 394 | echo (get_theme_mod('theme_colors_accent-light')) ? '--theme-color-accent-hover-light: ' . 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)) ? '--theme-color-' . $name . ': ' . get_theme_mod('theme_colors_' . $name) . ';' : null; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | protected function addHooks() |
| 76 | 76 | { |
| 77 | - add_action('timber/twig/filters', function ($twig) { |
|
| 77 | + add_action('timber/twig/filters', function($twig) { |
|
| 78 | 78 | $twig->addFilter( |
| 79 | 79 | new TwigFilter('resizeDynamic', [$this, 'resizeDynamic']) |
| 80 | 80 | ); |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | add_filter('mod_rewrite_rules', [$this, 'addWebpRewriteRule']); |
| 85 | 85 | } |
| 86 | 86 | if ($this->enabled || $this->webpEnabled) { |
| 87 | - add_action('after_switch_theme', function () { |
|
| 87 | + add_action('after_switch_theme', function() { |
|
| 88 | 88 | add_action('shutdown', 'flush_rewrite_rules'); |
| 89 | 89 | }); |
| 90 | - add_action('switch_theme', function () { |
|
| 90 | + add_action('switch_theme', function() { |
|
| 91 | 91 | flush_rewrite_rules(true); |
| 92 | 92 | }); |
| 93 | 93 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | remove_action('generate_rewrite_rules', [$this, 'registerRewriteRule']); |
| 337 | 337 | remove_action('parse_request', [$this, 'parseRequest']); |
| 338 | 338 | } |
| 339 | - add_action('shutdown', function () { |
|
| 339 | + add_action('shutdown', function() { |
|
| 340 | 340 | flush_rewrite_rules(false); |
| 341 | 341 | }); |
| 342 | 342 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } else { |
| 349 | 349 | remove_filter('mod_rewrite_rules', [$this, 'addWebpRewriteRule']); |
| 350 | 350 | } |
| 351 | - add_action('shutdown', function () { |
|
| 351 | + add_action('shutdown', function() { |
|
| 352 | 352 | require_once(ABSPATH . 'wp-admin/includes/file.php'); |
| 353 | 353 | WP_Filesystem(); |
| 354 | 354 | global $wp_filesystem; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | public function changeRelativeUploadPath($relativeUploadPath) |
| 361 | 361 | { |
| 362 | - add_action('shutdown', function () { |
|
| 362 | + add_action('shutdown', function() { |
|
| 363 | 363 | flush_rewrite_rules(false); |
| 364 | 364 | }); |
| 365 | 365 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | namespace Flynt\RemoveEditor; |
| 8 | 8 | |
| 9 | -add_action('init', function () { |
|
| 9 | +add_action('init', function() { |
|
| 10 | 10 | remove_post_type_support('page', 'editor'); |
| 11 | 11 | remove_post_type_support('post', 'editor'); |
| 12 | 12 | }); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Removes Gutenberg default styles on front-end |
| 16 | 16 | */ |
| 17 | -add_action('wp_print_styles', function () { |
|
| 17 | +add_action('wp_print_styles', function() { |
|
| 18 | 18 | wp_dequeue_style('wp-block-library'); |
| 19 | 19 | wp_dequeue_style('wp-block-library-theme'); |
| 20 | 20 | }); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Flynt\Utils\TimberDynamicResize; |
| 7 | 7 | use acf_field_message; |
| 8 | 8 | |
| 9 | -add_action('acf/init', function () { |
|
| 9 | +add_action('acf/init', function() { |
|
| 10 | 10 | global $timberDynamicResize; |
| 11 | 11 | $timberDynamicResize = new TimberDynamicResize(); |
| 12 | 12 | }); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | add_filter( |
| 49 | 49 | 'acf/load_field/key=field_global_TimberDynamicResize_relativeUploadPath', |
| 50 | - function ($field) { |
|
| 50 | + function($field) { |
|
| 51 | 51 | $field['placeholder'] = TimberDynamicResize::getDefaultRelativeUploadDir(); |
| 52 | 52 | return $field; |
| 53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | add_filter( |
| 57 | 57 | 'acf/load_field/key=field_global_TimberDynamicResize_webpSupport', |
| 58 | - function ($field) { |
|
| 58 | + function($field) { |
|
| 59 | 59 | if (!function_exists('imagewebp')) { |
| 60 | 60 | $messageField = new acf_field_message(); |
| 61 | 61 | $field = array_merge($messageField->defaults, $field); |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | add_filter( |
| 70 | 70 | 'acf/load_value/key=field_global_TimberDynamicResize_webpSupport', |
| 71 | - function ($value) { |
|
| 71 | + function($value) { |
|
| 72 | 72 | return function_exists('imagewebp') ? $value : '0'; |
| 73 | 73 | } |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | add_action( |
| 77 | 77 | 'update_option_options_global_TimberDynamicResize_dynamicImageGeneration', |
| 78 | - function ($oldValue, $value) { |
|
| 78 | + function($oldValue, $value) { |
|
| 79 | 79 | global $timberDynamicResize; |
| 80 | 80 | $timberDynamicResize->toggleDynamic($value === '1'); |
| 81 | 81 | }, |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | add_action( |
| 87 | 87 | 'update_option_options_global_TimberDynamicResize_webpSupport', |
| 88 | - function ($oldValue, $value) { |
|
| 88 | + function($oldValue, $value) { |
|
| 89 | 89 | global $timberDynamicResize; |
| 90 | 90 | $timberDynamicResize->toggleWebp($value === '1'); |
| 91 | 91 | }, |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | add_action( |
| 97 | 97 | 'update_option_options_global_TimberDynamicResize_relativeUploadPath', |
| 98 | - function ($oldValue, $value) { |
|
| 98 | + function($oldValue, $value) { |
|
| 99 | 99 | global $timberDynamicResize; |
| 100 | 100 | $timberDynamicResize->changeRelativeUploadPath($value); |
| 101 | 101 | }, |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | 106 | # WPML REWRITE FIX |
| 107 | -add_filter('mod_rewrite_rules', function ($rules) { |
|
| 107 | +add_filter('mod_rewrite_rules', function($rules) { |
|
| 108 | 108 | $homeRoot = parse_url(home_url()); |
| 109 | 109 | if (isset($homeRoot['path'])) { |
| 110 | 110 | $homeRoot = trailingslashit($homeRoot['path']); |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | use Timber\Menu; |
| 7 | 7 | use Flynt\Shortcodes; |
| 8 | 8 | |
| 9 | -add_action('init', function () { |
|
| 9 | +add_action('init', function() { |
|
| 10 | 10 | register_nav_menus([ |
| 11 | 11 | 'navigation_footer' => __('Navigation Footer', 'flynt') |
| 12 | 12 | ]); |
| 13 | 13 | }); |
| 14 | 14 | |
| 15 | -add_filter('Flynt/addComponentData?name=NavigationFooter', function ($data) { |
|
| 15 | +add_filter('Flynt/addComponentData?name=NavigationFooter', function($data) { |
|
| 16 | 16 | $data['maxLevel'] = 0; |
| 17 | 17 | $data['menu'] = new Menu('navigation_footer'); |
| 18 | 18 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * Current year |
| 11 | 11 | */ |
| 12 | -add_shortcode('year', function () { |
|
| 12 | +add_shortcode('year', function() { |
|
| 13 | 13 | $year = date_i18n('Y'); |
| 14 | 14 | return $year; |
| 15 | 15 | }); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Site Title |
| 19 | 19 | */ |
| 20 | -add_shortcode('sitetitle', function () { |
|
| 20 | +add_shortcode('sitetitle', function() { |
|
| 21 | 21 | $blogname = get_bloginfo('name'); |
| 22 | 22 | return $blogname; |
| 23 | 23 | }); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * Tagline |
| 27 | 27 | */ |
| 28 | -add_shortcode('tagline', function () { |
|
| 28 | +add_shortcode('tagline', function() { |
|
| 29 | 29 | $tagline = get_bloginfo('description'); |
| 30 | 30 | return $tagline; |
| 31 | 31 | }); |