@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | use Flynt\Utils\Options; |
5 | 5 | |
6 | -add_filter('pre_http_request', function ($preempt, $args, $url) { |
|
6 | +add_filter('pre_http_request', function($preempt, $args, $url) { |
|
7 | 7 | if (strpos($url, 'https://www.youtube.com/oembed') !== false || strpos($url, 'https://vimeo.com/api/oembed') !== false) { |
8 | 8 | $response = wp_cache_get($url, 'oembedCache'); |
9 | 9 | if (!empty($response)) { |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | return false; |
14 | 14 | }, 10, 3); |
15 | 15 | |
16 | -add_filter('http_response', function ($response, $args, $url) { |
|
16 | +add_filter('http_response', function($response, $args, $url) { |
|
17 | 17 | if (strpos($url, 'https://www.youtube.com/oembed') !== false || strpos($url, 'https://vimeo.com/api/oembed') !== false) { |
18 | 18 | wp_cache_set($url, $response, 'oembedCache'); |
19 | 19 | } |
20 | 20 | return $response; |
21 | 21 | }, 10, 3); |
22 | 22 | |
23 | -add_filter('acf/fields/google_map/api', function ($api) { |
|
23 | +add_filter('acf/fields/google_map/api', function($api) { |
|
24 | 24 | $apiKey = Options::getGlobal('Acf', 'googleMapsApiKey'); |
25 | 25 | if ($apiKey) { |
26 | 26 | $api['key'] = $apiKey; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | function addOptionsToComponent($data, $componentName) |
15 | 15 | { |
16 | 16 | // get fields for this component |
17 | - $options = array_reduce(array_keys(Options::OPTION_TYPES), function ($carry, $optionType) use ($componentName) { |
|
17 | + $options = array_reduce(array_keys(Options::OPTION_TYPES), function($carry, $optionType) use ($componentName) { |
|
18 | 18 | return array_merge($carry, Options::get($optionType, $componentName)); |
19 | 19 | }, []); |
20 | 20 | // don't overwrite existing data |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | static::$initialized = true; |
34 | 34 | } |
35 | 35 | |
36 | - add_action('current_screen', function ($currentScreen) { |
|
36 | + add_action('current_screen', function($currentScreen) { |
|
37 | 37 | $currentScreenId = strtolower($currentScreen->id); |
38 | 38 | foreach (static::OPTION_TYPES as $optionType => $option) { |
39 | 39 | $isTranslatable = $option['translatable']; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 101 |
59 | 59 | ); |
60 | 60 | // hide language selector in admin bar |
61 | - add_action('wp_before_admin_bar_render', function () { |
|
61 | + add_action('wp_before_admin_bar_render', function() { |
|
62 | 62 | $adminBar = $GLOBALS['wp_admin_bar']; |
63 | 63 | $adminBar->remove_menu('WPML_ALS'); |
64 | 64 | }); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $optionNames = ((static::$registeredOptions[$optionType] ?? [])[$scope] ?? []); |
179 | 179 | return array_combine( |
180 | 180 | $optionNames, |
181 | - array_map(function ($optionName) use ($prefix, $isTranslatable) { |
|
181 | + array_map(function($optionName) use ($prefix, $isTranslatable) { |
|
182 | 182 | $fieldKey = $prefix . $optionName; |
183 | 183 | return static::getOptionField($fieldKey, $isTranslatable); |
184 | 184 | }, $optionNames) |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | protected static function prefixFields($fields, $prefix) |
261 | 261 | { |
262 | - return array_map(function ($field) use ($prefix) { |
|
262 | + return array_map(function($field) use ($prefix) { |
|
263 | 263 | $field['name'] = $prefix . '_' . $field['name']; |
264 | 264 | return $field; |
265 | 265 | }, $fields); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // Convert ACF Field of type relationship to a Timber\Post and add all ACF Fields of that Post |
28 | 28 | add_filter('acf/format_value/type=relationship', NS . 'formatPostObject', 100); |
29 | -add_filter('get_twig', function ($twig) { |
|
29 | +add_filter('get_twig', function($twig) { |
|
30 | 30 | $twig->addExtension(new TwigExtensionFlynt()); |
31 | 31 | return $twig; |
32 | 32 | }); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | function formatGallery($value) |
43 | 43 | { |
44 | 44 | if (!empty($value)) { |
45 | - $value = array_map(function ($image) { |
|
45 | + $value = array_map(function($image) { |
|
46 | 46 | return new Image($image); |
47 | 47 | }, $value); |
48 | 48 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | return $value; |
68 | 68 | } |
69 | 69 | |
70 | -add_action('timber/twig/filters', function ($twig) { |
|
71 | - $twig->addFunction(new TwigFunction('placeholderImage', function ($width, $height, $color = null) { |
|
70 | +add_action('timber/twig/filters', function($twig) { |
|
71 | + $twig->addFunction(new TwigFunction('placeholderImage', function($width, $height, $color = null) { |
|
72 | 72 | $width = round($width); |
73 | 73 | $height = round($height); |
74 | 74 | $colorRect = $color ? "<rect width='{$width}' height='{$height}' style='fill:$color' />" : ''; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | add_filter('the_password_form', function ($output) { |
9 | 9 | $context = Timber::get_context(); |
10 | 10 | $context['form'] = [ |
11 | - 'url' => site_url('/wp-login.php?action=postpass', 'login_post') |
|
11 | + 'url' => site_url('/wp-login.php?action=postpass', 'login_post') |
|
12 | 12 | ]; |
13 | 13 | |
14 | 14 | return Timber::fetch('index.twig', $context); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Timber\Timber; |
6 | 6 | use Timber\Post; |
7 | 7 | |
8 | -add_filter('the_password_form', function ($output) { |
|
8 | +add_filter('the_password_form', function($output) { |
|
9 | 9 | $context = Timber::get_context(); |
10 | 10 | $context['form'] = [ |
11 | 11 | 'url' => site_url('/wp-login.php?action=postpass', 'login_post') |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | use Flynt\Utils\Asset; |
9 | 9 | use Parsedown; |
10 | 10 | |
11 | -add_filter('Flynt/addComponentData?name=ListComponents', function ($data) { |
|
11 | +add_filter('Flynt/addComponentData?name=ListComponents', function($data) { |
|
12 | 12 | if (!empty($data['componentBlocks'])) { |
13 | 13 | $templatePaths = [ |
14 | 14 | 'dir' => trailingslashit(get_template_directory()), |
15 | 15 | 'uri' => trailingslashit(get_template_directory_uri()), |
16 | 16 | ]; |
17 | - $data['componentBlocks'] = array_map(function ($block) use ($templatePaths) { |
|
17 | + $data['componentBlocks'] = array_map(function($block) use ($templatePaths) { |
|
18 | 18 | $block['component'] = substr($block['component'], strpos($block['component'], 'Components/')); |
19 | 19 | |
20 | 20 | $imagePath = $templatePaths['dir'] . $block['component'] . 'screenshot.png'; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $data; |
46 | 46 | }); |
47 | 47 | |
48 | -add_filter('acf/load_field/name=component', function ($field) { |
|
48 | +add_filter('acf/load_field/name=component', function($field) { |
|
49 | 49 | $componentManager = ComponentManager::getInstance(); |
50 | 50 | $field['choices'] = array_flip($componentManager->getAll()); |
51 | 51 | return $field; |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | use Flynt\ComponentManager; |
5 | 5 | use Flynt\Utils\Asset; |
6 | 6 | |
7 | -add_action('admin_enqueue_scripts', function () { |
|
7 | +add_action('admin_enqueue_scripts', function() { |
|
8 | 8 | $componentManager = ComponentManager::getInstance(); |
9 | 9 | $templateDirectory = get_template_directory(); |
10 | 10 | $data = [ |
11 | 11 | 'templateDirectoryUri' => get_template_directory_uri(), |
12 | - 'components' => array_map(function ($componentPath) use ($templateDirectory) { |
|
12 | + 'components' => array_map(function($componentPath) use ($templateDirectory) { |
|
13 | 13 | return str_replace($templateDirectory, '', $componentPath); |
14 | 14 | }, $componentManager->getAll()), |
15 | 15 | ]; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | if (class_exists('acf')) { |
20 | 20 | if (is_admin()) { |
21 | 21 | // add image to the flexible content component name |
22 | - add_filter('acf/fields/flexible_content/layout_title', function ($title, $field, $layout, $i) { |
|
22 | + add_filter('acf/fields/flexible_content/layout_title', function($title, $field, $layout, $i) { |
|
23 | 23 | $componentManager = ComponentManager::getInstance(); |
24 | 24 | $componentName = ucfirst($layout['name']); |
25 | 25 | $componentPathFull = $componentManager->getComponentDirPath($componentName); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Flynt\FieldVariables; |
6 | 6 | use Flynt\Utils\Oembed; |
7 | 7 | |
8 | -add_filter('Flynt/addComponentData?name=BlockVideoOembed', function ($data) { |
|
8 | +add_filter('Flynt/addComponentData?name=BlockVideoOembed', function($data) { |
|
9 | 9 | $data['video'] = Oembed::setSrcAsDataAttribute( |
10 | 10 | $data['oembed'], |
11 | 11 | [ |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Flynt\FieldVariables; |
6 | 6 | use Flynt\Utils\Options; |
7 | 7 | |
8 | -add_filter('Flynt/addComponentData?name=SliderImages', function ($data) { |
|
8 | +add_filter('Flynt/addComponentData?name=SliderImages', function($data) { |
|
9 | 9 | $translatableOptions = Options::getTranslatable('SliderOptions'); |
10 | 10 | $data['jsonData'] = [ |
11 | 11 | 'options' => array_merge($translatableOptions, $data['options']), |