@@ -8,7 +8,7 @@ |
||
| 8 | 8 | use Flynt\Utils\Feature; |
| 9 | 9 | use Flynt\Features\CustomTaxonomies\CustomTaxonomyRegister; |
| 10 | 10 | |
| 11 | -add_action('init', function () { |
|
| 11 | +add_action('init', function() { |
|
| 12 | 12 | $featureOptions = Feature::getOption('flynt-custom-taxonomies', 0); |
| 13 | 13 | $dir = isset($featureOptions['dir']) ? $featureOptions['dir'] : null; |
| 14 | 14 | $fileName = isset($featureOptions['fileName']) ? $featureOptions['fileName'] : null; |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | if (is_array($value)) { |
| 52 | 52 | // Loop through array and apply translations while keeping keys intact |
| 53 | 53 | // NOTE: assuming it's a single dimensional array |
| 54 | - return array_reduce(array_keys($value), function ($carry, $key) use ($value) { |
|
| 54 | + return array_reduce(array_keys($value), function($carry, $key) use ($value) { |
|
| 55 | 55 | return array_merge($carry, [ |
| 56 | 56 | $key => _x($value[$key], $key, 'flynt-starter-theme') |
| 57 | 57 | ]); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected static function cleanConfig($config) |
| 60 | 60 | { |
| 61 | - $cleanConfig = array_map(function ($value) { |
|
| 61 | + $cleanConfig = array_map(function($value) { |
|
| 62 | 62 | if (is_array($value)) { |
| 63 | 63 | return self::cleanConfig($value); |
| 64 | 64 | } |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | }, $config); |
| 68 | 68 | |
| 69 | 69 | // remove null values or empty arrays |
| 70 | - return array_filter($cleanConfig, function ($value) { |
|
| 70 | + return array_filter($cleanConfig, function($value) { |
|
| 71 | 71 | return !(is_null($value) || (is_array($value) && empty($value))); |
| 72 | 72 | }); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | protected static function getConfigs($dir) |
| 76 | 76 | { |
| 77 | - $configs = FileLoader::iterateDir($dir, function ($file) { |
|
| 77 | + $configs = FileLoader::iterateDir($dir, function($file) { |
|
| 78 | 78 | if ($file->isFile() && $file->getExtension() == 'json') { |
| 79 | 79 | $configPath = $file->getPathname(); |
| 80 | 80 | $name = StringHelpers::camelCaseToKebap($file->getBasename('.json')); |
@@ -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-starter-theme'); |
| 61 | 61 | $wpAdminBar->add_menu([ |
| 62 | 62 | 'id' => 'toggleComponentPreviews', |
@@ -36,13 +36,16 @@ |
||
| 36 | 36 | console.log('GoogleAnalytics: ' + [].slice.call(arguments)); |
| 37 | 37 | } |
| 38 | 38 | <?php |
| 39 | - else : ?> |
|
| 39 | + else { |
|
| 40 | + : ?> |
|
| 40 | 41 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| 41 | 42 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| 42 | 43 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| 43 | 44 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| 44 | 45 | <?php |
| 45 | - endif; ?> |
|
| 46 | + endif; |
|
| 47 | + } |
|
| 48 | + ?> |
|
| 46 | 49 | ga('create','<?php echo $this->gaId; ?>','auto');ga('send','pageview'); |
| 47 | 50 | <?php if ($this->anonymizeIp == 1) : ?> |
| 48 | 51 | ga('set', 'anonymizeIp', true); |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | use Timber\Timber; |
| 6 | 6 | use Timber\Post; |
| 7 | 7 | |
| 8 | -add_filter('the_password_form', function ($output) { |
|
| 8 | +add_filter('the_password_form', function($output) { |
|
| 9 | 9 | $context = Timber::get_context(); |
| 10 | 10 | $post = new Post(); |
| 11 | 11 | $context['form'] = [ |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | * TODO add local fallback |
| 11 | 11 | * TODO add cdn again just removed it because internet so slow |
| 12 | 12 | */ |
| 13 | -add_action('wp_enqueue_scripts', function () { |
|
| 13 | +add_action('wp_enqueue_scripts', function() { |
|
| 14 | 14 | $jqueryVersion = wp_scripts()->registered['jquery']->ver; |
| 15 | 15 | wp_deregister_script('jquery'); |
| 16 | 16 | wp_register_script( |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | // Clean Up TinyMCE Buttons |
| 6 | 6 | |
| 7 | 7 | // First Bar |
| 8 | -add_filter('mce_buttons', function ($buttons) { |
|
| 8 | +add_filter('mce_buttons', function($buttons) { |
|
| 9 | 9 | return [ |
| 10 | 10 | 'formatselect', |
| 11 | 11 | // 'styleselect', |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | 48 | // Second Bar |
| 49 | -add_filter('mce_buttons_2', function ($buttons) { |
|
| 49 | +add_filter('mce_buttons_2', function($buttons) { |
|
| 50 | 50 | return []; |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | -add_filter('tiny_mce_before_init', function ($init) { |
|
| 53 | +add_filter('tiny_mce_before_init', function($init) { |
|
| 54 | 54 | // Add block format elements you want to show in dropdown |
| 55 | 55 | $init['block_formats'] = 'Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6'; |
| 56 | 56 | return $init; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | define(__NAMESPACE__ . '\NS', __NAMESPACE__ . '\\'); |
| 12 | 12 | |
| 13 | 13 | // Render Component with Timber (Twig) |
| 14 | -add_filter('Flynt/renderComponent', function ($output, $componentName, $componentData, $areaHtml) { |
|
| 14 | +add_filter('Flynt/renderComponent', function($output, $componentName, $componentData, $areaHtml) { |
|
| 15 | 15 | // get index file |
| 16 | 16 | $componentManager = Flynt\ComponentManager::getInstance(); |
| 17 | 17 | $filePath = $componentManager->getComponentFilePath($componentName, 'index.twig'); |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | return $output; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - $addArea = function ($twig) use ($areaHtml) { |
|
| 24 | + $addArea = function($twig) use ($areaHtml) { |
|
| 25 | 25 | |
| 26 | - $twig->addFunction(new Twig_SimpleFunction('area', function ($areaName) use ($areaHtml) { |
|
| 26 | + $twig->addFunction(new Twig_SimpleFunction('area', function($areaName) use ($areaHtml) { |
|
| 27 | 27 | if (array_key_exists($areaName, $areaHtml)) { |
| 28 | 28 | return $areaHtml[$areaName]; |
| 29 | 29 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | add_filter('get_twig', $addArea); |
| 36 | 36 | |
| 37 | - $returnTimberPaths = function ($paths) use ($filePath) { |
|
| 37 | + $returnTimberPaths = function($paths) use ($filePath) { |
|
| 38 | 38 | array_unshift($paths, dirname($filePath)); |
| 39 | 39 | return $paths; |
| 40 | 40 | }; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | }, 10, 4); |
| 52 | 52 | |
| 53 | 53 | // Convert ACF Images to Timber Images |
| 54 | -add_filter('acf/format_value/type=image', function ($value) { |
|
| 54 | +add_filter('acf/format_value/type=image', function($value) { |
|
| 55 | 55 | if (!empty($value)) { |
| 56 | 56 | $value = new Image($value); |
| 57 | 57 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | }, 100); |
| 60 | 60 | |
| 61 | 61 | // Convert ACF Field of type post_object to a Timber\Post and add all ACF Fields of that Post |
| 62 | -add_filter('acf/format_value/type=post_object', function ($value) { |
|
| 62 | +add_filter('acf/format_value/type=post_object', function($value) { |
|
| 63 | 63 | if (is_array($value)) { |
| 64 | 64 | $value = array_map(NS . 'convertToTimberPost', $value); |
| 65 | 65 | } else { |