@@ -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); |
@@ -9,16 +9,16 @@ |
||
9 | 9 | |
10 | 10 | class TwigExtensionFlynt extends Twig_Extension { |
11 | 11 | |
12 | - public function getName() { |
|
13 | - return 'twig_extension_flynt'; |
|
14 | - } |
|
12 | + public function getName() { |
|
13 | + return 'twig_extension_flynt'; |
|
14 | + } |
|
15 | 15 | |
16 | - public function getFunctions() { |
|
17 | - return array( |
|
16 | + public function getFunctions() { |
|
17 | + return array( |
|
18 | 18 | new Twig_SimpleFunction('renderComponent', [$this, 'renderComponent'], array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))), |
19 | 19 | new Twig_SimpleFunction('renderFlexibleContent', [$this, 'renderFlexibleContent'], array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))), |
20 | - ); |
|
21 | - } |
|
20 | + ); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | public function renderFlexibleContent(Twig_Environment $env, $context, $fields, $withContext = true, $ignoreMissing = false, $sandboxed = false) |
24 | 24 | { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | // Convert ACF Field of type post_object to a Timber\Post and add all ACF Fields of that Post |
21 | 21 | add_filter('acf/format_value/type=post_object', NS . 'formatPostObject', 100); |
22 | 22 | |
23 | -add_filter('get_twig', function ($twig) { |
|
23 | +add_filter('get_twig', function($twig) { |
|
24 | 24 | $twig->addExtension(new TwigExtensionFlynt()); |
25 | 25 | return $twig; |
26 | 26 | }); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | function formatGallery($value) |
37 | 37 | { |
38 | 38 | if (!empty($value)) { |
39 | - $value = array_map(function ($image) { |
|
39 | + $value = array_map(function($image) { |
|
40 | 40 | return new Image($image); |
41 | 41 | }, $value); |
42 | 42 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | return $value; |
62 | 62 | } |
63 | 63 | |
64 | -add_action('timber/twig/filters', function ($twig) { |
|
65 | - $twig->addFunction(new \Twig_SimpleFunction('transparentPng', function ($aspect, $r = 0, $g = 0, $b = 0, $a = 127) { |
|
64 | +add_action('timber/twig/filters', function($twig) { |
|
65 | + $twig->addFunction(new \Twig_SimpleFunction('transparentPng', function($aspect, $r = 0, $g = 0, $b = 0, $a = 127) { |
|
66 | 66 | $ratio = aspectToRatio($aspect); |
67 | 67 | //create image with specified sizes |
68 | 68 | $image = imagecreatetruecolor($ratio['width'], $ratio['height']); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $k2 = 1; |
92 | 92 | $b = 1 / $n; |
93 | 93 | do { |
94 | - $b = 1/$b; |
|
94 | + $b = 1 / $b; |
|
95 | 95 | $a = floor($b); |
96 | 96 | $aux = $h1; |
97 | 97 | $h1 = $a * $h1 + $h2; |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | return crypt(serialize($args), NONCE_SALT); |
114 | 114 | } |
115 | 115 | |
116 | -add_action('timber/twig/filters', function ($twig) { |
|
117 | - $twig->addFilter(new \Twig_SimpleFilter('resizeDynamic', function ($src, $w, $h = 0, $crop = 'default', $force = false) { |
|
116 | +add_action('timber/twig/filters', function($twig) { |
|
117 | + $twig->addFilter(new \Twig_SimpleFilter('resizeDynamic', function($src, $w, $h = 0, $crop = 'default', $force = false) { |
|
118 | 118 | $arguments = [ |
119 | 119 | 'src' => $src, |
120 | 120 | 'w' => $w, |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | public static function setTemplateDirectory() |
8 | 8 | { |
9 | - add_action('after_switch_theme', function () { |
|
9 | + add_action('after_switch_theme', function() { |
|
10 | 10 | $stylesheet = get_option('stylesheet'); |
11 | 11 | |
12 | 12 | if (basename($stylesheet) !== 'templates') { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | } |
15 | 15 | }); |
16 | 16 | |
17 | - add_filter('stylesheet', function ($stylesheet) { |
|
17 | + add_filter('stylesheet', function($stylesheet) { |
|
18 | 18 | return dirname($stylesheet); |
19 | 19 | }); |
20 | 20 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | if (!$acfActive || !$flyntCoreActive) { |
36 | - add_filter('template_include', function () { |
|
36 | + add_filter('template_include', function() { |
|
37 | 37 | die( |
38 | 38 | 'One or more required plugins are not activated! Please <a href="' |
39 | 39 | . esc_url(admin_url('plugins.php')) |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | protected static function notifyRequiredPluginIsMissing($pluginName) |
49 | 49 | { |
50 | - add_action('admin_notices', function () use ($pluginName) { |
|
50 | + add_action('admin_notices', function() use ($pluginName) { |
|
51 | 51 | echo "<div class=\"error\"><p>${pluginName} Plugin not activated. Make sure you activate the plugin on the <a href=\"" |
52 | 52 | . esc_url(admin_url('plugins.php')) . "\">plugin page</a>.</p></div>"; |
53 | 53 | }); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use Flynt\Utils\Asset; |
4 | 4 | |
5 | -add_action('wp_enqueue_scripts', function () { |
|
5 | +add_action('wp_enqueue_scripts', function() { |
|
6 | 6 | Asset::register([ |
7 | 7 | 'name' => 'console-polyfill', |
8 | 8 | 'type' => 'script', |