@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use Flynt\Utils\Options; |
| 6 | 6 | use Flynt\Utils\TimberDynamicResize; |
| 7 | 7 | |
| 8 | -add_action('acf/init', function () { |
|
| 8 | +add_action('acf/init', function() { |
|
| 9 | 9 | global $timberDynamicResize; |
| 10 | 10 | $timberDynamicResize = new TimberDynamicResize(); |
| 11 | 11 | }); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | add_filter( |
| 48 | 48 | 'acf/load_field/key=field_global_TimberDynamicResize_relativeUploadPath', |
| 49 | - function ($field) { |
|
| 49 | + function($field) { |
|
| 50 | 50 | $field['placeholder'] = TimberDynamicResize::getDefaultRelativeUploadDir(); |
| 51 | 51 | return $field; |
| 52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | add_filter( |
| 56 | 56 | 'acf/load_field/key=field_global_TimberDynamicResize_webpSupport', |
| 57 | - function ($field) { |
|
| 57 | + function($field) { |
|
| 58 | 58 | if (!function_exists('imagewebp')) { |
| 59 | 59 | $field['type'] = 'message'; |
| 60 | 60 | $field['instructions'] = 'Your PHP Version does not support WebP generation. The function `imagewebp` does not exist.'; |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | add_filter( |
| 67 | 67 | 'acf/load_value/key=field_global_TimberDynamicResize_webpSupport', |
| 68 | - function ($value) { |
|
| 68 | + function($value) { |
|
| 69 | 69 | return function_exists('imagewebp') ? $value : '0'; |
| 70 | 70 | } |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | add_action( |
| 74 | 74 | 'update_option_options_global_TimberDynamicResize_dynamicImageGeneration', |
| 75 | - function ($oldValue, $value) { |
|
| 75 | + function($oldValue, $value) { |
|
| 76 | 76 | global $timberDynamicResize; |
| 77 | 77 | $timberDynamicResize->toggleDynamic($value === '1'); |
| 78 | 78 | }, |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | add_action( |
| 84 | 84 | 'update_option_options_global_TimberDynamicResize_webpSupport', |
| 85 | - function ($oldValue, $value) { |
|
| 85 | + function($oldValue, $value) { |
|
| 86 | 86 | global $timberDynamicResize; |
| 87 | 87 | $timberDynamicResize->toggleWebp($value === '1'); |
| 88 | 88 | }, |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | add_action( |
| 94 | 94 | 'update_option_options_global_TimberDynamicResize_relativeUploadPath', |
| 95 | - function ($oldValue, $value) { |
|
| 95 | + function($oldValue, $value) { |
|
| 96 | 96 | global $timberDynamicResize; |
| 97 | 97 | $timberDynamicResize->changeRelativeUploadPath($value); |
| 98 | 98 | }, |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | 103 | # WPML REWRITE FIX |
| 104 | -add_filter('mod_rewrite_rules', function ($rules) { |
|
| 104 | +add_filter('mod_rewrite_rules', function($rules) { |
|
| 105 | 105 | $homeRoot = parse_url(home_url()); |
| 106 | 106 | if (isset($homeRoot['path'])) { |
| 107 | 107 | $homeRoot = trailingslashit($homeRoot['path']); |
@@ -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 | } |