@@ -5,11 +5,11 @@ |
||
| 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('BlockVideoOembed'); |
| 10 | 10 | }); |
| 11 | 11 | |
| 12 | -add_filter('Flynt/addComponentData?name=BlockVideoOembed', function ($data) { |
|
| 12 | +add_filter('Flynt/addComponentData?name=BlockVideoOembed', function($data) { |
|
| 13 | 13 | $data['oembedLazyLoad'] = Oembed::setSrcAsDataAttribute( |
| 14 | 14 | $data['oembed'], |
| 15 | 15 | [ |
@@ -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, ';'); |
@@ -246,6 +246,9 @@ discard block |
||
| 246 | 246 | }); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | + /** |
|
| 250 | + * @param string $type |
|
| 251 | + */ |
|
| 249 | 252 | protected static function createSubPage($type, $name) |
| 250 | 253 | { |
| 251 | 254 | $namespace = self::FILTER_NAMESPACES[$type]; |
@@ -263,6 +266,9 @@ discard block |
||
| 263 | 266 | } |
| 264 | 267 | } |
| 265 | 268 | |
| 269 | + /** |
|
| 270 | + * @param string $subPageName |
|
| 271 | + */ |
|
| 266 | 272 | protected static function addOptionSubPage($optionCategoryName, $subPageName, $optionType, $fields) |
| 267 | 273 | { |
| 268 | 274 | $prettySubPageName = StringHelpers::splitCamelCase($subPageName); |
@@ -291,6 +297,9 @@ discard block |
||
| 291 | 297 | ); |
| 292 | 298 | } |
| 293 | 299 | |
| 300 | + /** |
|
| 301 | + * @param string $menuSlug |
|
| 302 | + */ |
|
| 294 | 303 | protected static function addFieldGroupToSubPage($parentMenuSlug, $menuSlug, $prettySubPageName, $fields) |
| 295 | 304 | { |
| 296 | 305 | $fieldGroup = ACFComposer\ResolveConfig::forFieldGroup( |
@@ -314,6 +323,10 @@ discard block |
||
| 314 | 323 | acf_add_local_field_group($fieldGroup); |
| 315 | 324 | } |
| 316 | 325 | |
| 326 | + /** |
|
| 327 | + * @param string $optionCategory |
|
| 328 | + * @param string $feature |
|
| 329 | + */ |
|
| 317 | 330 | protected static function checkFeature($optionCategory, $feature) |
| 318 | 331 | { |
| 319 | 332 | if (array_key_exists($optionCategory, self::$optionCategories) && !Feature::isRegistered($feature)) { |
@@ -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(); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | // find and replace relevant keys, then return an array of all options for this Sub-Page |
| 131 | 131 | $optionKeys = is_array($options) ? array_keys($options) : []; |
| 132 | - $options = array_reduce($optionKeys, function ($carry, $key) use ($options, $prefix) { |
|
| 132 | + $options = array_reduce($optionKeys, function($carry, $key) use ($options, $prefix) { |
|
| 133 | 133 | $count = 0; |
| 134 | 134 | $option = $options[$key]; |
| 135 | 135 | $key = str_replace($prefix, '', $key, $count); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public static function addComponentData($data, $parentData, $config) |
| 154 | 154 | { |
| 155 | 155 | // get fields for this component |
| 156 | - $options = array_reduce(array_keys(self::$optionTypes), function ($carry, $optionType) use ($config) { |
|
| 156 | + $options = array_reduce(array_keys(self::$optionTypes), function($carry, $optionType) use ($config) { |
|
| 157 | 157 | return array_merge($carry, self::get($optionType, 'Component', $config['name'])); |
| 158 | 158 | }, []); |
| 159 | 159 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ]; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - add_action('current_screen', function ($currentScreen) { |
|
| 224 | + add_action('current_screen', function($currentScreen) { |
|
| 225 | 225 | foreach (self::$optionTypes as $optionType => $option) { |
| 226 | 226 | $isTranslatable = $option['translatable']; |
| 227 | 227 | $toplevelPageId = 'toplevel_page_' . $optionType; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | add_filter('acf/settings/current_language', 'Flynt\Features\Acf\OptionPages::getDefaultAcfLanguage', 101); |
| 236 | 236 | |
| 237 | 237 | // hide language selector in admin bar |
| 238 | - add_action('wp_before_admin_bar_render', function () { |
|
| 238 | + add_action('wp_before_admin_bar_render', function() { |
|
| 239 | 239 | $adminBar = $GLOBALS['wp_admin_bar']; |
| 240 | 240 | $adminBar->remove_menu('WPML_ALS'); |
| 241 | 241 | }); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | protected static function prefixFields($fields, $prefix) |
| 334 | 334 | { |
| 335 | - return array_map(function ($field) use ($prefix) { |
|
| 335 | + return array_map(function($field) use ($prefix) { |
|
| 336 | 336 | $field['name'] = $prefix . '_' . $field['name']; |
| 337 | 337 | return $field; |
| 338 | 338 | }, $fields); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | protected static function combineArrayDefaults(array $array, array $defaults) |
| 385 | 385 | { |
| 386 | - return array_map(function ($value) use ($defaults) { |
|
| 386 | + return array_map(function($value) use ($defaults) { |
|
| 387 | 387 | return is_array($value) ? array_merge($defaults, $value) : []; |
| 388 | 388 | }, $array); |
| 389 | 389 | } |
@@ -38,7 +38,7 @@ |
||
| 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); |
@@ -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 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * in order to make sure custom post types are registered before acf fields |
| 14 | 14 | * (e.g. for option pages) are added the priority needs to be lower than 5 |
| 15 | 15 | */ |
| 16 | -add_action('init', function () { |
|
| 16 | +add_action('init', function() { |
|
| 17 | 17 | $featureOptions = Feature::getOption('flynt-custom-post-types', 0); |
| 18 | 18 | $dir = isset($featureOptions['dir']) ? $featureOptions['dir'] : null; |
| 19 | 19 | $fileName = isset($featureOptions['fileName']) ? $featureOptions['fileName'] : null; |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | use Flynt\Features\Components\Component; |
| 6 | 6 | use Flynt\Utils\Oembed; |
| 7 | 7 | |
| 8 | -add_filter('Flynt/addComponentData?name=SliderMedia', function ($data) { |
|
| 9 | - $data['mediaSlides'] = array_map(function ($item) { |
|
| 8 | +add_filter('Flynt/addComponentData?name=SliderMedia', function($data) { |
|
| 9 | + $data['mediaSlides'] = array_map(function($item) { |
|
| 10 | 10 | if ($item['mediaType'] == 'oembed') { |
| 11 | 11 | $item['image'] = $item['posterImage']; |
| 12 | 12 | $item['oembedLazyLoad'] = Oembed::setSrcAsDataAttribute( |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | return $data; |
| 23 | 23 | }); |
| 24 | 24 | |
| 25 | -add_action('wp_enqueue_scripts', function () { |
|
| 25 | +add_action('wp_enqueue_scripts', function() { |
|
| 26 | 26 | Component::enqueueAssets('SliderMedia', [ |
| 27 | 27 | [ |
| 28 | 28 | 'name' => 'slick-carousel', |
@@ -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 | } |