Completed
Push — componentlibrary_templateConfi... ( bbe8e2 )
by Dominik
02:00
created
Features/AdminComponentPreview/functions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
         if (is_admin()) {
39 39
             add_action('admin_enqueue_scripts', NS . 'enqueueComponentScripts');
40 40
             // add image to the flexible content component name
41
-            add_filter('acf/fields/flexible_content/layout_title', function ($title, $field, $layout, $i) {
41
+            add_filter('acf/fields/flexible_content/layout_title', function($title, $field, $layout, $i) {
42 42
                 $componentName = ucfirst($layout['name']);
43 43
                 $componentPath = "Components/{$componentName}";
44
-                $componentPreviewDesktopPath = Asset::requirePath("{$componentPath}/preview-desktop.jpg") ;
44
+                $componentPreviewDesktopPath = Asset::requirePath("{$componentPath}/preview-desktop.jpg");
45 45
                 $componentPreviewDesktopUrl = Asset::requireUrl("{$componentPath}/preview-desktop.jpg");
46 46
                 if (is_file($componentPreviewDesktopPath)) {
47 47
                     $newTitle = '<span class="flyntComponentPreview">';
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         } else {
56 56
             add_action('wp_enqueue_scripts', NS . 'enqueueComponentScripts');
57 57
             // adds Component Previews button to admin bar on front-end when logged in
58
-            add_action('admin_bar_menu', function ($wpAdminBar) {
58
+            add_action('admin_bar_menu', function($wpAdminBar) {
59 59
                 $title = __('Component Previews', 'flynt-starter-theme');
60 60
                 $wpAdminBar->add_menu([
61 61
                     'id' => 'toggleComponentPreviews',
Please login to merge, or discard this patch.
Features/Components/functions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 // register all components
13 13
 $componentPath = trailingslashit(Feature::getOption('flynt-components', 0));
14 14
 
15
-add_action('Flynt/afterRegisterFeatures', function () use ($componentPath) {
15
+add_action('Flynt/afterRegisterFeatures', function() use ($componentPath) {
16 16
     if (is_dir($componentPath)) {
17 17
         $components = [];
18
-        FileLoader::iterateDir($componentPath, function ($dir) use (&$components) {
18
+        FileLoader::iterateDir($componentPath, function($dir) use (&$components) {
19 19
             if ($dir->isDir()) {
20 20
                 $components[] = $dir->getFilename();
21 21
             }
@@ -26,6 +26,6 @@  discard block
 block discarded – undo
26 26
 });
27 27
 
28 28
 // set Component Path
29
-add_filter('Flynt/componentPath', function ($defaultPath, $componentName) use ($componentPath) {
29
+add_filter('Flynt/componentPath', function($defaultPath, $componentName) use ($componentPath) {
30 30
     return $componentPath . $componentName;
31 31
 }, 10, 2);
Please login to merge, or discard this patch.
Features/Acf/GoogleMaps.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public static function init()
8 8
     {
9
-        add_filter('acf/fields/google_map/api', function ($api) {
9
+        add_filter('acf/fields/google_map/api', function($api) {
10 10
             $apiKey = OptionPages::get('globalOptions', 'feature', 'Acf', 'googleMapsApiKey');
11 11
             if ($apiKey) {
12 12
                 $api['key'] = $apiKey;
Please login to merge, or discard this patch.
Components/ListPosts/functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 
5 5
 use Flynt\Features\Components\Component;
6 6
 
7
-add_action('wp_enqueue_scripts', function () {
7
+add_action('wp_enqueue_scripts', function() {
8 8
     Component::enqueueAssets('ListPosts');
9 9
 });
10 10
 
11
-add_filter('Flynt/addComponentData?name=ListPosts', function ($data, $parentData) {
11
+add_filter('Flynt/addComponentData?name=ListPosts', function($data, $parentData) {
12 12
     $data['isArchive'] = is_home() || is_archive();
13 13
 
14 14
     $data['pagination'] = (isset($parentData['pagination'])) ? $parentData['pagination'] : null;
Please login to merge, or discard this patch.
Components/BlockMediaText/functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
5 5
 use Flynt\Features\Components\Component;
6 6
 use Flynt\Utils\Oembed;
7 7
 
8
-add_action('wp_enqueue_scripts', function () {
8
+add_action('wp_enqueue_scripts', function() {
9 9
     Component::enqueueAssets('BlockMediaText');
10 10
 });
11 11
 
12
-add_filter('Flynt/addComponentData?name=BlockMediaText', function ($data) {
12
+add_filter('Flynt/addComponentData?name=BlockMediaText', function($data) {
13 13
     if ($data['mediaType'] === 'oembedVideo') {
14 14
         $data['oembedLazyLoad'] = Oembed::setSrcAsDataAttribute(
15 15
             $data['oembed'],
Please login to merge, or discard this patch.
Features/Jquery/functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 use Flynt\Utils\Asset;
6 6
 use Flynt\Utils\Feature;
7 7
 
8
-add_action('wp_enqueue_scripts', function () {
8
+add_action('wp_enqueue_scripts', function() {
9 9
     $jqueryVersion = wp_scripts()->registered['jquery']->ver;
10 10
     wp_deregister_script('jquery');
11 11
 
Please login to merge, or discard this patch.
Features/TinyMce/functions.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Flynt\Features\TinyMce;
4 4
 
5
-use Flynt\Utils\Feature;
6 5
 use Flynt\Utils\Asset;
7 6
 
8 7
 // Load TinyMCE Settings from config file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // Load TinyMCE Settings from config file
9 9
 
10 10
 // First Toolbar
11
-add_filter('mce_buttons', function ($buttons) {
11
+add_filter('mce_buttons', function($buttons) {
12 12
     $config = getConfig();
13 13
     if ($config && isset($config['toolbars'])) {
14 14
         $toolbars = $config['toolbars'];
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 });
21 21
 
22 22
 // Second Toolbar
23
-add_filter('mce_buttons_2', function ($buttons) {
23
+add_filter('mce_buttons_2', function($buttons) {
24 24
     return [];
25 25
 });
26 26
 
27
-add_filter('tiny_mce_before_init', function ($init) {
27
+add_filter('tiny_mce_before_init', function($init) {
28 28
     $config = getConfig();
29 29
     if ($config) {
30 30
         if (isset($config['blockformats'])) {
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
     return $init;
40 40
 });
41 41
 
42
-add_filter('acf/fields/wysiwyg/toolbars', function ($toolbars) {
42
+add_filter('acf/fields/wysiwyg/toolbars', function($toolbars) {
43 43
     // Load Toolbars and parse them into TinyMCE
44 44
     $config = getConfig();
45 45
     if ($config && !empty($config['toolbars'])) {
46
-        $toolbars = array_map(function ($toolbar) {
46
+        $toolbars = array_map(function($toolbar) {
47 47
             array_unshift($toolbar, []);
48 48
             return $toolbar;
49 49
         }, $config['toolbars']);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 function getBlockFormats($blockFormats)
65 65
 {
66 66
     if (!empty($blockFormats)) {
67
-        $blockFormatStrings = array_map(function ($tag, $label) {
67
+        $blockFormatStrings = array_map(function($tag, $label) {
68 68
             return "${label}=${tag}";
69 69
         }, $blockFormats, array_keys($blockFormats));
70 70
         return implode($blockFormatStrings, ';');
Please login to merge, or discard this patch.
Features/Acf/OptionPages.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
 use Flynt\Features\AdminNotices\AdminNoticeManager;
14 14
 use Flynt\Features\CustomPostTypes\CustomPostTypeRegister;
15 15
 use Flynt\Utils\Feature;
16
-use Flynt\Utils\FileLoader;
17 16
 use Flynt\Utils\StringHelpers;
18 17
 
19 18
 class OptionPages
Please login to merge, or discard this patch.
Doc Comments   +23 added lines patch added patch discarded remove patch
@@ -240,6 +240,9 @@  discard block
 block discarded – undo
240 240
         });
241 241
     }
242 242
 
243
+    /**
244
+     * @param string $type
245
+     */
243 246
     protected static function createSubPage($type, $name)
244 247
     {
245 248
         $namespace = self::FILTER_NAMESPACES[$type];
@@ -257,6 +260,9 @@  discard block
 block discarded – undo
257 260
         }
258 261
     }
259 262
 
263
+    /**
264
+     * @param string $subPageName
265
+     */
260 266
     protected static function addOptionSubPage($optionCategoryName, $subPageName, $optionType, $fields)
261 267
     {
262 268
         $prettySubPageName = StringHelpers::splitCamelCase($subPageName);
@@ -285,6 +291,9 @@  discard block
 block discarded – undo
285 291
         );
286 292
     }
287 293
 
294
+    /**
295
+     * @param string $menuSlug
296
+     */
288 297
     protected static function addFieldGroupToSubPage($parentMenuSlug, $menuSlug, $prettySubPageName, $fields)
289 298
     {
290 299
         $fieldGroup = ACFComposer\ResolveConfig::forFieldGroup(
@@ -308,6 +317,10 @@  discard block
 block discarded – undo
308 317
         acf_add_local_field_group($fieldGroup);
309 318
     }
310 319
 
320
+    /**
321
+     * @param string $optionCategory
322
+     * @param string $feature
323
+     */
311 324
     protected static function checkFeature($optionCategory, $feature)
312 325
     {
313 326
         if (array_key_exists($optionCategory, self::$optionCategories) && !Feature::isRegistered($feature)) {
@@ -334,6 +347,12 @@  discard block
 block discarded – undo
334 347
         }, $fields);
335 348
     }
336 349
 
350
+    /**
351
+     * @param string $optionType
352
+     * @param string $optionCategory
353
+     * @param string $subPageName
354
+     * @param string|null $fieldName
355
+     */
337 356
     protected static function checkRequiredHooks($optionType, $optionCategory, $subPageName, $fieldName)
338 357
     {
339 358
         if (did_action('acf/init') < 1) {
@@ -389,6 +408,10 @@  discard block
 block discarded – undo
389 408
     }
390 409
 
391 410
     // find and replace relevant keys, then return an array of all options for this Sub-Page
411
+
412
+    /**
413
+     * @param string $prefix
414
+     */
392 415
     protected static function collectOptionsWithPrefix($options, $prefix)
393 416
     {
394 417
         $optionKeys = is_array($options) ? array_keys($options) : [];
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         self::createOptionPages();
72 72
 
73 73
         // Register Categories
74
-        add_action('acf/init', function () {
74
+        add_action('acf/init', function() {
75 75
             self::addComponentSubPages();
76 76
             self::addFeatureSubPages();
77 77
             self::addCustomPostTypeSubPages();
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public static function addComponentData($data, $parentData, $config)
150 150
     {
151 151
         // get fields for this component
152
-        $options = array_reduce(array_keys(self::$optionTypes), function ($carry, $optionType) use ($config) {
152
+        $options = array_reduce(array_keys(self::$optionTypes), function($carry, $optionType) use ($config) {
153 153
             return array_merge($carry, self::get($optionType, 'Component', $config['name']));
154 154
         }, []);
155 155
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             ];
218 218
         }
219 219
 
220
-        add_action('current_screen', function ($currentScreen) {
220
+        add_action('current_screen', function($currentScreen) {
221 221
             foreach (self::$optionTypes as $optionType => $option) {
222 222
                 $isTranslatable = $option['translatable'];
223 223
                 $toplevelPageId = 'toplevel_page_' . $optionType;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                     add_filter('acf/settings/current_language', 'Flynt\Features\Acf\OptionPages::getDefaultAcfLanguage', 101);
232 232
 
233 233
                     // hide language selector in admin bar
234
-                    add_action('wp_before_admin_bar_render', function () {
234
+                    add_action('wp_before_admin_bar_render', function() {
235 235
                         $adminBar = $GLOBALS['wp_admin_bar'];
236 236
                         $adminBar->remove_menu('WPML_ALS');
237 237
                     });
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
     protected static function prefixFields($fields, $prefix)
330 330
     {
331
-        return array_map(function ($field) use ($prefix) {
331
+        return array_map(function($field) use ($prefix) {
332 332
             $field['name'] = $prefix . '_' . $field['name'];
333 333
             return $field;
334 334
         }, $fields);
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     protected static function collectOptionsWithPrefix($options, $prefix)
393 393
     {
394 394
         $optionKeys = is_array($options) ? array_keys($options) : [];
395
-        return array_reduce($optionKeys, function ($carry, $key) use ($options, $prefix) {
395
+        return array_reduce($optionKeys, function($carry, $key) use ($options, $prefix) {
396 396
             $count = 0;
397 397
             $option = $options[$key];
398 398
             $key = str_replace($prefix, '', $key, $count);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 
406 406
     protected static function combineArrayDefaults(array $array, array $defaults)
407 407
     {
408
-        return array_map(function ($value) use ($defaults) {
408
+        return array_map(function($value) use ($defaults) {
409 409
             return is_array($value) ? array_merge($defaults, $value) : [];
410 410
         }, $array);
411 411
     }
Please login to merge, or discard this patch.
Features/Acf/FieldGroupComposer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
             return;
39 39
         }
40 40
 
41
-        FileLoader::iterateDir($dir, function ($file) {
41
+        FileLoader::iterateDir($dir, function($file) {
42 42
             if ($file->getExtension() === 'json') {
43 43
                 $filePath = $file->getPathname();
44 44
                 $config = json_decode(file_get_contents($filePath), true);
Please login to merge, or discard this patch.