@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | add_action('Flynt/afterRegisterFeatures', 'Flynt\Features\Acf\Loader::init'); |
17 | 17 | |
18 | -add_filter('pre_http_request', function ($preempt, $args, $url) { |
|
18 | +add_filter('pre_http_request', function($preempt, $args, $url) { |
|
19 | 19 | if (strpos($url, 'https://www.youtube.com/oembed') !== false || strpos($url, 'https://vimeo.com/api/oembed') !== false) { |
20 | 20 | $response = wp_cache_get($url, 'oembedCache'); |
21 | 21 | if (!empty($response)) { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | return false; |
26 | 26 | }, 10, 3); |
27 | 27 | |
28 | -add_filter('http_response', function ($response, $args, $url) { |
|
28 | +add_filter('http_response', function($response, $args, $url) { |
|
29 | 29 | if (strpos($url, 'https://www.youtube.com/oembed') !== false || strpos($url, 'https://vimeo.com/api/oembed') !== false) { |
30 | 30 | wp_cache_set($url, $response, 'oembedCache'); |
31 | 31 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | if (is_admin()) { |
16 | 16 | // adds buttons to collapse/expand components |
17 | - add_filter('acf/get_field_label', function ($label, $field) { |
|
17 | + add_filter('acf/get_field_label', function($label, $field) { |
|
18 | 18 | if ($field['type'] === 'flexible_content') { |
19 | 19 | $label .= '<span class="flexible-content-controls">'; |
20 | 20 | $label .= '<span class="flexible-content-control"><a class="acf-icon small -collapse collapse-all" title="collapse all"></a></span>'; |
@@ -7,19 +7,19 @@ discard block |
||
7 | 7 | use Timber\Menu; |
8 | 8 | use Flynt\Features\Acf\OptionPages; |
9 | 9 | |
10 | -add_action('wp_enqueue_scripts', function () { |
|
10 | +add_action('wp_enqueue_scripts', function() { |
|
11 | 11 | Component::enqueueAssets('NavigationMain'); |
12 | 12 | }); |
13 | 13 | |
14 | -add_filter('Flynt/addComponentData?name=NavigationMain', function ($data) { |
|
14 | +add_filter('Flynt/addComponentData?name=NavigationMain', function($data) { |
|
15 | 15 | // set max level of the menu |
16 | 16 | $data['maxLevel'] = 0; |
17 | 17 | $data['menuSlug'] = !empty($data['menuSlug']) ? $data['menuSlug'] : ''; |
18 | 18 | $data['menu'] = has_nav_menu($data['menuSlug']) ? new Menu($data['menuSlug']) : false; |
19 | 19 | |
20 | 20 | if (!empty($data['menu'])) { |
21 | - $data['menu']->items = array_map(function ($item) { |
|
22 | - $item->btnClasses = array_filter($item->classes, function ($class) { |
|
21 | + $data['menu']->items = array_map(function($item) { |
|
22 | + $item->btnClasses = array_filter($item->classes, function($class) { |
|
23 | 23 | return stripos(trim($class), 'btn') === 0; |
24 | 24 | }); |
25 | 25 | $item->classes = array_diff($item->classes, $item->btnClasses); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return $data; |
33 | 33 | }); |
34 | 34 | |
35 | -add_action('init', function () { |
|
35 | +add_action('init', function() { |
|
36 | 36 | register_nav_menus([ |
37 | 37 | 'navigation_main' => __('Navigation Main', 'flynt-starter-theme') |
38 | 38 | ]); |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | return $output; |
37 | 37 | } |
38 | 38 | |
39 | - $addArea = function ($twig) use ($areaHtml) { |
|
39 | + $addArea = function($twig) use ($areaHtml) { |
|
40 | 40 | |
41 | - $twig->addFunction(new Twig_SimpleFunction('area', function ($areaName) use ($areaHtml) { |
|
41 | + $twig->addFunction(new Twig_SimpleFunction('area', function($areaName) use ($areaHtml) { |
|
42 | 42 | if (array_key_exists($areaName, $areaHtml)) { |
43 | 43 | return $areaHtml[$areaName]; |
44 | 44 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | add_filter('get_twig', $addArea); |
51 | 51 | |
52 | - $returnTimberPaths = function ($paths) use ($filePath) { |
|
52 | + $returnTimberPaths = function($paths) use ($filePath) { |
|
53 | 53 | array_unshift($paths, dirname($filePath)); |
54 | 54 | return $paths; |
55 | 55 | }; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | function formatGallery($value) |
77 | 77 | { |
78 | 78 | if (!empty($value)) { |
79 | - $value = array_map(function ($image) { |
|
79 | + $value = array_map(function($image) { |
|
80 | 80 | return new Image($image); |
81 | 81 | }, $value); |
82 | 82 | } |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | return $value; |
102 | 102 | } |
103 | 103 | |
104 | -add_action('timber/twig/filters', function ($twig) { |
|
105 | - $twig->addFunction(new \Twig_SimpleFunction('transparentPng', function ($aspect, $r = 0, $g = 0, $b = 0, $a = 127) { |
|
104 | +add_action('timber/twig/filters', function($twig) { |
|
105 | + $twig->addFunction(new \Twig_SimpleFunction('transparentPng', function($aspect, $r = 0, $g = 0, $b = 0, $a = 127) { |
|
106 | 106 | $ratio = aspectToRatio($aspect); |
107 | 107 | //create image with specified sizes |
108 | 108 | $image = imagecreatetruecolor($ratio['width'], $ratio['height']); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $k2 = 1; |
132 | 132 | $b = 1 / $n; |
133 | 133 | do { |
134 | - $b = 1/$b; |
|
134 | + $b = 1 / $b; |
|
135 | 135 | $a = floor($b); |
136 | 136 | $aux = $h1; |
137 | 137 | $h1 = $a * $h1 + $h2; |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | return crypt(serialize($args), NONCE_SALT); |
154 | 154 | } |
155 | 155 | |
156 | -add_action('timber/twig/filters', function ($twig) { |
|
157 | - $twig->addFilter(new \Twig_SimpleFilter('resizeDynamic', function ($src, $w, $h = 0, $crop = 'default', $force = false) { |
|
156 | +add_action('timber/twig/filters', function($twig) { |
|
157 | + $twig->addFilter(new \Twig_SimpleFilter('resizeDynamic', function($src, $w, $h = 0, $crop = 'default', $force = false) { |
|
158 | 158 | $arguments = [ |
159 | 159 | 'src' => $src, |
160 | 160 | 'w' => $w, |
@@ -6,15 +6,15 @@ |
||
6 | 6 | use Flynt\Features\Components\Component; |
7 | 7 | use WP_Query; |
8 | 8 | |
9 | -add_action('wp_enqueue_scripts', function () { |
|
9 | +add_action('wp_enqueue_scripts', function() { |
|
10 | 10 | Component::enqueueAssets('LayoutMultiplePosts'); |
11 | 11 | }); |
12 | 12 | |
13 | -add_filter('Flynt/addComponentData?name=LayoutMultiplePosts', function ($data) { |
|
13 | +add_filter('Flynt/addComponentData?name=LayoutMultiplePosts', function($data) { |
|
14 | 14 | $query = !empty($data['query']) ? $data['query'] : false; |
15 | 15 | $posts = Timber::get_posts($query); |
16 | 16 | if (!empty($posts)) { |
17 | - $posts = array_map(function ($post) { |
|
17 | + $posts = array_map(function($post) { |
|
18 | 18 | $fields = get_fields($post->id); |
19 | 19 | $post->fields = $fields === false ? [] : $fields; |
20 | 20 | return $post; |
@@ -9,24 +9,24 @@ |
||
9 | 9 | add_action('wp_enqueue_scripts', function () { |
10 | 10 | Component::enqueueAssets('DocumentDefault', [ |
11 | 11 | [ |
12 | - 'name' => 'console-polyfill', |
|
13 | - 'type' => 'script', |
|
14 | - 'path' => 'vendor/console.js' |
|
12 | + 'name' => 'console-polyfill', |
|
13 | + 'type' => 'script', |
|
14 | + 'path' => 'vendor/console.js' |
|
15 | 15 | ], |
16 | 16 | [ |
17 | - 'name' => 'babel-polyfill', |
|
18 | - 'type' => 'script', |
|
19 | - 'path' => 'vendor/babel-polyfill.js' |
|
17 | + 'name' => 'babel-polyfill', |
|
18 | + 'type' => 'script', |
|
19 | + 'path' => 'vendor/babel-polyfill.js' |
|
20 | 20 | ], |
21 | 21 | [ |
22 | - 'name' => 'document-register-element', |
|
23 | - 'type' => 'script', |
|
24 | - 'path' => 'vendor/document-register-element.js' |
|
22 | + 'name' => 'document-register-element', |
|
23 | + 'type' => 'script', |
|
24 | + 'path' => 'vendor/document-register-element.js' |
|
25 | 25 | ], |
26 | 26 | [ |
27 | - 'name' => 'normalize', |
|
28 | - 'path' => 'vendor/normalize.css', |
|
29 | - 'type' => 'style' |
|
27 | + 'name' => 'normalize', |
|
28 | + 'path' => 'vendor/normalize.css', |
|
29 | + 'type' => 'style' |
|
30 | 30 | ] |
31 | 31 | ]); |
32 | 32 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Flynt\Features\Components\Component; |
7 | 7 | use Flynt\Utils\Asset; |
8 | 8 | |
9 | -add_action('wp_enqueue_scripts', function () { |
|
9 | +add_action('wp_enqueue_scripts', function() { |
|
10 | 10 | Component::enqueueAssets('DocumentDefault', [ |
11 | 11 | [ |
12 | 12 | 'name' => 'console-polyfill', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ]); |
38 | 38 | }, 0); |
39 | 39 | |
40 | -add_filter('Flynt/addComponentData?name=DocumentDefault', function ($data) { |
|
40 | +add_filter('Flynt/addComponentData?name=DocumentDefault', function($data) { |
|
41 | 41 | $context = Timber::get_context(); |
42 | 42 | |
43 | 43 | $output = [ |
@@ -23,24 +23,24 @@ |
||
23 | 23 | add_action('Flynt\afterRegisterFeatures', function () { |
24 | 24 | Component::enqueueAssets('DocumentDefault', [ |
25 | 25 | [ |
26 | - 'name' => 'console-polyfill', |
|
27 | - 'type' => 'script', |
|
28 | - 'path' => 'vendor/console.js' |
|
26 | + 'name' => 'console-polyfill', |
|
27 | + 'type' => 'script', |
|
28 | + 'path' => 'vendor/console.js' |
|
29 | 29 | ], |
30 | 30 | [ |
31 | - 'name' => 'babel-polyfill', |
|
32 | - 'type' => 'script', |
|
33 | - 'path' => 'vendor/babel-polyfill.js' |
|
31 | + 'name' => 'babel-polyfill', |
|
32 | + 'type' => 'script', |
|
33 | + 'path' => 'vendor/babel-polyfill.js' |
|
34 | 34 | ], |
35 | 35 | [ |
36 | - 'name' => 'document-register-element', |
|
37 | - 'type' => 'script', |
|
38 | - 'path' => 'vendor/document-register-element.js' |
|
36 | + 'name' => 'document-register-element', |
|
37 | + 'type' => 'script', |
|
38 | + 'path' => 'vendor/document-register-element.js' |
|
39 | 39 | ], |
40 | 40 | [ |
41 | - 'name' => 'normalize', |
|
42 | - 'path' => 'vendor/normalize.css', |
|
43 | - 'type' => 'style' |
|
41 | + 'name' => 'normalize', |
|
42 | + 'path' => 'vendor/normalize.css', |
|
43 | + 'type' => 'style' |
|
44 | 44 | ] |
45 | 45 | ]); |
46 | 46 |
@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | use Flynt\Utils\Asset; |
5 | 5 | use function Flynt\Features\TimberLoader\renderTwigIndex; |
6 | 6 | |
7 | -add_filter('get_twig', function ($twig) { |
|
7 | +add_filter('get_twig', function($twig) { |
|
8 | 8 | $twig->addFunction(new Twig_SimpleFunction('renderComponent', 'renderComponent')); |
9 | 9 | |
10 | - $twig->addFunction(new Twig_SimpleFunction('renderFlexibleContent', function ($fcField) { |
|
11 | - return implode('', array_map(function ($field) { |
|
10 | + $twig->addFunction(new Twig_SimpleFunction('renderFlexibleContent', function($fcField) { |
|
11 | + return implode('', array_map(function($field) { |
|
12 | 12 | return renderComponent(ucfirst($field['acf_fc_layout']), $field); |
13 | 13 | }, $fcField)); |
14 | 14 | })); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | return $twig; |
17 | 17 | }); |
18 | 18 | |
19 | -function renderComponent ($name, $data = []) |
|
19 | +function renderComponent($name, $data = []) |
|
20 | 20 | { |
21 | 21 | $data = apply_filters( |
22 | 22 | 'Flynt/addComponentData', |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | return renderTwigIndex(null, $name, $data, null); |
39 | 39 | }; |
40 | 40 | |
41 | -add_action('after_setup_theme', function () { |
|
41 | +add_action('after_setup_theme', function() { |
|
42 | 42 | new Timber\Timber(); |
43 | 43 | }); |
44 | 44 | |
45 | -add_action('Flynt\afterRegisterFeatures', function () { |
|
45 | +add_action('Flynt\afterRegisterFeatures', function() { |
|
46 | 46 | Component::enqueueAssets('DocumentDefault', [ |
47 | 47 | [ |
48 | 48 | 'name' => 'console-polyfill', |
@@ -4,11 +4,11 @@ |
||
4 | 4 | |
5 | 5 | use Flynt\Features\Components\Component; |
6 | 6 | |
7 | -add_filter('Flynt/addComponentData?name=GridDownloadPortrait', function ($data) { |
|
7 | +add_filter('Flynt/addComponentData?name=GridDownloadPortrait', function($data) { |
|
8 | 8 | Component::enqueueAssets('GridDownloadPortrait'); |
9 | 9 | |
10 | 10 | if (!empty($data['items'])) { |
11 | - $data['items'] = array_map(function ($item) { |
|
11 | + $data['items'] = array_map(function($item) { |
|
12 | 12 | if ($item['itemType'] === 'itemFile') { |
13 | 13 | $fileSize = filesize(get_attached_file($item['file']['id'])); |
14 | 14 | $item['file']['fileSize'] = size_format($fileSize); |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Flynt\Features\Components\Component; |
6 | 6 | |
7 | -add_filter('Flynt/addComponentData?name=GridContentLists', function ($data) { |
|
7 | +add_filter('Flynt/addComponentData?name=GridContentLists', function($data) { |
|
8 | 8 | Component::enqueueAssets('GridContentLists'); |
9 | 9 | |
10 | 10 | return $data; |