@@ -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 | } |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | $pluginActive = class_exists('\\Flynt\\Render'); |
| 25 | 25 | |
| 26 | 26 | if (!$pluginActive) { |
| 27 | - add_action('admin_notices', function () { |
|
| 27 | + add_action('admin_notices', function() { |
|
| 28 | 28 | echo '<div class="error"><p>Flynt Core Plugin not activated. Make sure you activate the plugin in <a href="' |
| 29 | 29 | . esc_url(admin_url('plugins.php#flynt')) . '">' |
| 30 | 30 | . esc_url(admin_url('plugins.php')) . '</a></p></div>'; |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | - add_filter('template_include', function () { |
|
| 33 | + add_filter('template_include', function() { |
|
| 34 | 34 | $newTemplate = locate_template(['plugin-inactive.php']); |
| 35 | 35 | if ('' != $newTemplate) { |
| 36 | 36 | return $newTemplate; |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Filter out other (non-flynt) theme features |
| 87 | - $flyntThemeFeatures = array_filter($GLOBALS['_wp_theme_features'], function ($feature) { |
|
| 87 | + $flyntThemeFeatures = array_filter($GLOBALS['_wp_theme_features'], function($feature) { |
|
| 88 | 88 | return StringHelpers::startsWith('flynt-', $feature); |
| 89 | 89 | }, ARRAY_FILTER_USE_KEY); |
| 90 | 90 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | public static function consoleDebug($data, $title = 'PHP', $logType = 'log') |
| 18 | 18 | { |
| 19 | - $title .= '(' . self::getCallerFile(2) .'):'; |
|
| 19 | + $title .= '(' . self::getCallerFile(2) . '):'; |
|
| 20 | 20 | $type = gettype($data); |
| 21 | 21 | if (is_array($data) || is_object($data)) { |
| 22 | 22 | $output = json_encode($data); |
@@ -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)) { |
@@ -17,18 +17,18 @@ |
||
| 17 | 17 | // only converts first dimension of object |
| 18 | 18 | public static function objectToArray($obj) |
| 19 | 19 | { |
| 20 | - return array_map(function ($val) { |
|
| 20 | + return array_map(function($val) { |
|
| 21 | 21 | return (array) $val; |
| 22 | 22 | }, $obj); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function indexedValuesToAssocKeys(array $array) |
| 26 | 26 | { |
| 27 | - $values = array_map(function ($value) { |
|
| 27 | + $values = array_map(function($value) { |
|
| 28 | 28 | return is_array($value) ? $value : []; |
| 29 | 29 | }, $array); |
| 30 | 30 | |
| 31 | - $keys = array_map(function ($key) use ($array) { |
|
| 31 | + $keys = array_map(function($key) use ($array) { |
|
| 32 | 32 | return is_int($key) ? $array[$key] : $key; |
| 33 | 33 | }, array_keys($array)); |
| 34 | 34 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | use Timber\Post; |
| 9 | 9 | use Flynt\Utils\Log; |
| 10 | 10 | |
| 11 | -add_filter('Flynt/addComponentData?name=ListProducts', function ($data) { |
|
| 11 | +add_filter('Flynt/addComponentData?name=ListProducts', function($data) { |
|
| 12 | 12 | $defaultCount = OptionPages::getOption('globalOptions', 'customPostType', 'product', 'defaultProductsNumber'); |
| 13 | 13 | $data['productTypesLabel'] = OptionPages::getOption('translatableOptions', 'customPostType', 'product', 'productTypesLabel'); |
| 14 | 14 | $data['overviewPage'] = OptionPages::getOption('translatableOptions', 'customPostType', 'product', 'overviewPage'); |
@@ -30,6 +30,6 @@ discard block |
||
| 30 | 30 | return $data; |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | -add_action('wp_enqueue_scripts', function () { |
|
| 33 | +add_action('wp_enqueue_scripts', function() { |
|
| 34 | 34 | Component::enqueueAssets('ListProducts'); |
| 35 | 35 | }); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | // Clean Up TinyMCE Buttons |
| 8 | 8 | |
| 9 | 9 | // First Bar |
| 10 | -add_filter('mce_buttons', function ($buttons) { |
|
| 10 | +add_filter('mce_buttons', function($buttons) { |
|
| 11 | 11 | return [ |
| 12 | 12 | 'formatselect', |
| 13 | 13 | 'styleselect', |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | 50 | // Second Bar |
| 51 | -add_filter('mce_buttons_2', function ($buttons) { |
|
| 51 | +add_filter('mce_buttons_2', function($buttons) { |
|
| 52 | 52 | return []; |
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | -add_filter('tiny_mce_before_init', function ($init) { |
|
| 55 | +add_filter('tiny_mce_before_init', function($init) { |
|
| 56 | 56 | // Add block format elements you want to show in dropdown |
| 57 | 57 | $init['block_formats'] = 'Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6'; |
| 58 | 58 | return $init; |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | -add_filter('tiny_mce_before_init', function ($init_array) { |
|
| 61 | +add_filter('tiny_mce_before_init', function($init_array) { |
|
| 62 | 62 | $style_formats = array( |
| 63 | 63 | [ |
| 64 | 64 | 'title' => 'Turquoise Colour ', |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | if (is_array($value)) { |
| 53 | 53 | // Loop through array and apply translations while keeping keys intact |
| 54 | 54 | // NOTE: assuming it's a single dimensional array |
| 55 | - return array_reduce(array_keys($value), function ($carry, $key) use ($value) { |
|
| 55 | + return array_reduce(array_keys($value), function($carry, $key) use ($value) { |
|
| 56 | 56 | return array_merge($carry, [ |
| 57 | 57 | $key => _x($value[$key], $key, 'flynt-theme') |
| 58 | 58 | ]); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | add_action('admin_enqueue_scripts', NS . 'enqueueComponentScripts'); |
| 40 | 40 | |
| 41 | 41 | // add image to the flexible content component name |
| 42 | - add_filter('acf/fields/flexible_content/layout_title', function ($title, $field, $layout, $i) { |
|
| 42 | + add_filter('acf/fields/flexible_content/layout_title', function($title, $field, $layout, $i) { |
|
| 43 | 43 | $componentPath = "/Components/$layout[name]/"; |
| 44 | 44 | $componentPreviewDesktopPath = get_template_directory() . $componentPath . 'preview-desktop.jpg'; |
| 45 | 45 | $componentPreviewDesktopUrl = get_template_directory_uri() . $componentPath . 'preview-desktop.jpg'; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } else { |
| 57 | 57 | add_action('wp_enqueue_scripts', NS . 'enqueueComponentScripts'); |
| 58 | 58 | // adds Component Previews button to admin bar on front-end when logged in |
| 59 | - add_action('admin_bar_menu', function ($wpAdminBar) { |
|
| 59 | + add_action('admin_bar_menu', function($wpAdminBar) { |
|
| 60 | 60 | $title = __('Component Previews', 'flynt-theme'); |
| 61 | 61 | $wpAdminBar->add_menu([ |
| 62 | 62 | 'id' => 'toggleComponentPreviews', |