@@ -6,7 +6,7 @@ |
||
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; |
@@ -5,7 +5,7 @@ |
||
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 |
@@ -2,7 +2,6 @@ |
||
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 |
@@ -8,7 +8,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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, ';'); |
@@ -66,6 +66,9 @@ |
||
66 | 66 | self::addFilters('feature', $name, $filePath); |
67 | 67 | } |
68 | 68 | |
69 | + /** |
|
70 | + * @param string $category |
|
71 | + */ |
|
69 | 72 | public static function addFilters($category, $name, $filePath) |
70 | 73 | { |
71 | 74 | if (false === $filePath || !file_exists($filePath)) { |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | $filterNamespace = self::FILTER_NAMESPACES[$category]; |
80 | 80 | $filterName = "{$filterNamespace}/{$name}/Fields/{$groupKey}"; |
81 | 81 | |
82 | - add_filter($filterName, function ($config) use ($groupValue) { |
|
82 | + add_filter($filterName, function($config) use ($groupValue) { |
|
83 | 83 | return $groupValue; |
84 | 84 | }); |
85 | 85 | if (ArrayHelpers::isAssoc($groupValue) && array_key_exists('sub_fields', $groupValue)) { |
86 | 86 | $filterName .= '/SubFields'; |
87 | 87 | $subFields = $groupValue['sub_fields']; |
88 | 88 | |
89 | - add_filter($filterName, function ($subFieldsconfig) use ($subFields) { |
|
89 | + add_filter($filterName, function($subFieldsconfig) use ($subFields) { |
|
90 | 90 | return $subFields; |
91 | 91 | }); |
92 | 92 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | $subFieldName = ucfirst($subField['name']); |
111 | - $subFilterName = "{$parentFilterName}/{$subFieldName}"; |
|
111 | + $subFilterName = "{$parentFilterName}/{$subFieldName}"; |
|
112 | 112 | |
113 | - add_filter($subFilterName, function ($subFieldConfig) use ($subField) { |
|
113 | + add_filter($subFilterName, function($subFieldConfig) use ($subField) { |
|
114 | 114 | return $subField; |
115 | 115 | }); |
116 | 116 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Flynt\Features\HideProtectedPosts; |
4 | 4 | |
5 | -add_action('pre_get_posts', function ($query) { |
|
5 | +add_action('pre_get_posts', function($query) { |
|
6 | 6 | if (!$query->is_singular() && !is_admin()) { |
7 | 7 | $query->set('has_password', false); |
8 | 8 | } |
@@ -240,6 +240,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) : []; |
@@ -13,7 +13,6 @@ |
||
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 |
@@ -71,7 +71,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | }); |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | protected static function prefixFields($fields, $prefix) |
331 | 331 | { |
332 | - return array_map(function ($field) use ($prefix) { |
|
332 | + return array_map(function($field) use ($prefix) { |
|
333 | 333 | $field['name'] = $prefix . '_' . $field['name']; |
334 | 334 | return $field; |
335 | 335 | }, $fields); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | protected static function collectOptionsWithPrefix($options, $prefix) |
394 | 394 | { |
395 | 395 | $optionKeys = is_array($options) ? array_keys($options) : []; |
396 | - return array_reduce($optionKeys, function ($carry, $key) use ($options, $prefix) { |
|
396 | + return array_reduce($optionKeys, function($carry, $key) use ($options, $prefix) { |
|
397 | 397 | $count = 0; |
398 | 398 | $option = $options[$key]; |
399 | 399 | $key = str_replace($prefix, '', $key, $count); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | protected static function combineArrayDefaults(array $array, array $defaults) |
408 | 408 | { |
409 | - return array_map(function ($value) use ($defaults) { |
|
409 | + return array_map(function($value) use ($defaults) { |
|
410 | 410 | return is_array($value) ? array_merge($defaults, $value) : []; |
411 | 411 | }, $array); |
412 | 412 | } |
@@ -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 |