@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Flynt\Utils\Asset; |
6 | 6 | |
7 | -add_action('wp_enqueue_scripts', function () { |
|
7 | +add_action('wp_enqueue_scripts', function() { |
|
8 | 8 | Asset::register([ |
9 | 9 | 'type' => 'script', |
10 | 10 | 'name' => 'Flynt/Features/Lodash', |
@@ -2,9 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Flynt\Features\BaseStyle; |
4 | 4 | |
5 | -use Timber\Timber; |
|
6 | -use Flynt\ComponentManager; |
|
7 | - |
|
8 | 5 | if (current_user_can('editor') || (WP_ENV !== 'production')) { |
9 | 6 | add_filter('init', 'Flynt\Features\BaseStyle\registerRewriteRule'); |
10 | 7 | add_filter('template_include', 'Flynt\Features\BaseStyle\templateInclude'); |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | function disallowRobots() |
17 | 17 | { |
18 | 18 | if (defined('WPSEO_VERSION')) { |
19 | - add_filter('wpseo_robots', function () { |
|
19 | + add_filter('wpseo_robots', function() { |
|
20 | 20 | return "noindex,nofollow"; |
21 | 21 | }); |
22 | 22 | } else { |
23 | 23 | remove_action('wp_head', 'noindex', 1); |
24 | - add_action('wp_head', function () { |
|
24 | + add_action('wp_head', function() { |
|
25 | 25 | echo "<meta name='robots' content='noindex,nofollow' />\n"; |
26 | 26 | }); |
27 | 27 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $rules = get_option('rewrite_rules'); |
38 | 38 | |
39 | - if (! isset($rules["{$routeName}/(.*?)/?$"])) { |
|
39 | + if (!isset($rules["{$routeName}/(.*?)/?$"])) { |
|
40 | 40 | flush_rewrite_rules(); |
41 | 41 | } |
42 | 42 | } |
@@ -2,8 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Flynt\Features\YoutubeNoCookieEmbed; |
4 | 4 | |
5 | -use Flynt\Utils\Oembed; |
|
6 | - |
|
7 | 5 | add_action('oembed_result', 'Flynt\Features\YoutubeNoCookieEmbed\setNoCookieDomain', 10, 2); |
8 | 6 | add_filter('embed_oembed_html', 'Flynt\Features\YoutubeNoCookieEmbed\setNoCookieDomain', 10, 2); |
9 | 7 |
@@ -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>'; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if (count($files) === 0) { |
45 | 45 | $dir = get_template_directory() . '/' . $dir; |
46 | 46 | |
47 | - self::iterateDir($dir, function ($file) { |
|
47 | + self::iterateDir($dir, function($file) { |
|
48 | 48 | if ($file->isDir()) { |
49 | 49 | $dirPath = trim(str_replace(get_template_directory(), '', $file->getPathname()), '/'); |
50 | 50 | self::loadPhpFiles($dirPath); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | }); |
56 | 56 | } else { |
57 | - array_walk($files, function ($file) use ($dir) { |
|
57 | + array_walk($files, function($file) use ($dir) { |
|
58 | 58 | $filePath = $dir . '/' . ltrim($file, '/'); |
59 | 59 | |
60 | 60 | if (!locate_template($filePath, true, true)) { |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | public static function consoleDebug($data, $postpone = true, $title = 'PHP', $logType = 'log') |
23 | 23 | { |
24 | 24 | if (in_array($logType, ['log', 'error', 'trace'])) { |
25 | - $title .= '(' . self::getCallerFile(2) .'):'; |
|
25 | + $title .= '(' . self::getCallerFile(2) . '):'; |
|
26 | 26 | $type = gettype($data); |
27 | 27 | $output = json_encode($data); |
28 | - $result = "<script>console.{$logType}('{$title}', '({$type})', {$output});</script>\n"; |
|
28 | + $result = "<script>console.{$logType}('{$title}', '({$type})', {$output});</script>\n"; |
|
29 | 29 | self::echoDebug($result, $postpone); |
30 | 30 | } |
31 | 31 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | protected static function echoDebug($data, $postpone) |
47 | 47 | { |
48 | 48 | if ($postpone) { |
49 | - add_action('wp_footer', function () use ($data) { |
|
49 | + add_action('wp_footer', function() use ($data) { |
|
50 | 50 | echo $data; |
51 | 51 | }, 30); |
52 | 52 | } else { |
@@ -34,11 +34,11 @@ |
||
34 | 34 | */ |
35 | 35 | public static function indexedValuesToAssocKeys(array $array) |
36 | 36 | { |
37 | - $values = array_map(function ($value) { |
|
37 | + $values = array_map(function($value) { |
|
38 | 38 | return is_array($value) ? $value : []; |
39 | 39 | }, $array); |
40 | 40 | |
41 | - $keys = array_map(function ($key) use ($array) { |
|
41 | + $keys = array_map(function($key) use ($array) { |
|
42 | 42 | return is_int($key) ? $array[$key] : $key; |
43 | 43 | }, array_keys($array)); |
44 | 44 |
@@ -29,6 +29,9 @@ |
||
29 | 29 | return $output; |
30 | 30 | } |
31 | 31 | |
32 | + /** |
|
33 | + * @param string $componentName |
|
34 | + */ |
|
32 | 35 | public function renderComponent(Twig_Environment $env, $context, $componentName, $data = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) |
33 | 36 | { |
34 | 37 | $data = $this->getComponentData($data, $componentName); |