@@ -4,10 +4,10 @@ |
||
| 4 | 4 | * We use this to end our output buffer (started in header.php) and render into the view/page-plugin.twig template. |
| 5 | 5 | */ |
| 6 | 6 | $timberContext = $GLOBALS['timberContext']; |
| 7 | -if ( ! isset( $timberContext ) ) { |
|
| 8 | - throw new \Exception( 'Timber context not set in footer.' ); |
|
| 7 | +if (!isset($timberContext)) { |
|
| 8 | + throw new \Exception('Timber context not set in footer.'); |
|
| 9 | 9 | } |
| 10 | 10 | $timberContext['content'] = ob_get_contents(); |
| 11 | 11 | ob_end_clean(); |
| 12 | -$templates = array( 'page-plugin.twig' ); |
|
| 13 | -Timber::render( $templates, $timberContext ); |
|
| 12 | +$templates = array('page-plugin.twig'); |
|
| 13 | +Timber::render($templates, $timberContext); |
|
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | function get($name) |
| 13 | 13 | { |
| 14 | - return get_template_directory_uri() . '/dist/images/' . $name; |
|
| 14 | + return get_template_directory_uri().'/dist/images/'.$name; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if (strpos($imageUrl, '.svg') !== false) { |
| 29 | 29 | return file_get_contents($imageUrl); |
| 30 | 30 | } else { |
| 31 | - return "<img src='" . $this->get($name) . "' />"; |
|
| 31 | + return "<img src='".$this->get($name)."' />"; |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function registerPostTypes() |
| 14 | 14 | { |
| 15 | - foreach (glob(get_template_directory() . "/inc/post-types/*.php") as $filename) { |
|
| 15 | + foreach (glob(get_template_directory()."/inc/post-types/*.php") as $filename) { |
|
| 16 | 16 | include_once $filename; |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function registerTaxonomies() |
| 24 | 24 | { |
| 25 | - foreach (glob(get_template_directory() . "/inc/taxonomies/*.php") as $filename) { |
|
| 25 | + foreach (glob(get_template_directory()."/inc/taxonomies/*.php") as $filename) { |
|
| 26 | 26 | include_once $filename; |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -add_action('init', function () { |
|
| 31 | +add_action('init', function() { |
|
| 32 | 32 | $custom = new Custom(); |
| 33 | 33 | $custom->registerPostTypes(); |
| 34 | 34 | $custom->registerTaxonomies(); |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | foreach ($list_searcheable_acf as $searcheable_acf) { |
| 61 | 61 | if ($searcheable_acf == $list_searcheable_acf[0]) { |
| 62 | - $where .= " (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
|
| 62 | + $where .= " (meta_key LIKE '%".$searcheable_acf."%' AND meta_value LIKE '%$tag%') "; |
|
| 63 | 63 | } else { |
| 64 | - $where .= " OR (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
|
| 64 | + $where .= " OR (meta_key LIKE '%".$searcheable_acf."%' AND meta_value LIKE '%$tag%') "; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $where .= ") |
@@ -93,6 +93,6 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -add_action('init', function () { |
|
| 96 | +add_action('init', function() { |
|
| 97 | 97 | $acf = new ACF(); |
| 98 | 98 | }); |
| 99 | 99 | \ No newline at end of file |
@@ -24,17 +24,17 @@ |
||
| 24 | 24 | return $classes; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -add_filter('body_class', __NAMESPACE__ . '\\body_class'); |
|
| 27 | +add_filter('body_class', __NAMESPACE__.'\\body_class'); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Clean up the_excerpt() |
| 31 | 31 | */ |
| 32 | 32 | function excerpt_more() |
| 33 | 33 | { |
| 34 | - return ' … <a href="' . get_permalink() . '">' . __('Continued', 'stash') . '</a>'; |
|
| 34 | + return ' … <a href="'.get_permalink().'">'.__('Continued', 'stash').'</a>'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -add_filter('excerpt_more', __NAMESPACE__ . '\\excerpt_more'); |
|
| 37 | +add_filter('excerpt_more', __NAMESPACE__.'\\excerpt_more'); |
|
| 38 | 38 | |
| 39 | 39 | function dd($var) |
| 40 | 40 | { |
@@ -12,35 +12,35 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function load() |
| 14 | 14 | { |
| 15 | - $vendorJsExists = file_exists(get_template_directory() . '/dist/js/vendor.js'); |
|
| 16 | - $mainJsExists = file_exists(get_template_directory() . '/dist/js/main.js'); |
|
| 15 | + $vendorJsExists = file_exists(get_template_directory().'/dist/js/vendor.js'); |
|
| 16 | + $mainJsExists = file_exists(get_template_directory().'/dist/js/main.js'); |
|
| 17 | 17 | $mainJsDependencies = []; |
| 18 | 18 | |
| 19 | - $mainCssExists = file_exists(get_template_directory() . '/dist/css/main.css'); |
|
| 20 | - $vendorCssExists = file_exists(get_template_directory() . '/dist/css/vendor.css'); |
|
| 19 | + $mainCssExists = file_exists(get_template_directory().'/dist/css/main.css'); |
|
| 20 | + $vendorCssExists = file_exists(get_template_directory().'/dist/css/vendor.css'); |
|
| 21 | 21 | $mainCssDependencies = []; |
| 22 | 22 | |
| 23 | 23 | if ($vendorJsExists) { |
| 24 | - wp_enqueue_script('stashVendorJs', get_template_directory_uri() . '/dist/js/vendor.js', [], filemtime(get_stylesheet_directory() . '/dist/js/vendor.js'), true); |
|
| 24 | + wp_enqueue_script('stashVendorJs', get_template_directory_uri().'/dist/js/vendor.js', [], filemtime(get_stylesheet_directory().'/dist/js/vendor.js'), true); |
|
| 25 | 25 | array_push($mainJsDependencies, 'stashVendorJs'); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | if ($mainJsExists) { |
| 29 | - wp_enqueue_script('stashMainJs', get_template_directory_uri() . '/dist/js/main.js', $mainJsDependencies, filemtime(get_stylesheet_directory() . '/dist/js/main.js'), true); |
|
| 29 | + wp_enqueue_script('stashMainJs', get_template_directory_uri().'/dist/js/main.js', $mainJsDependencies, filemtime(get_stylesheet_directory().'/dist/js/main.js'), true); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if ($vendorCssExists) { |
| 33 | - wp_enqueue_style('stashVendorCss', get_template_directory_uri() . '/dist/css/vendor.css', [], filemtime(get_stylesheet_directory() . '/dist/css/vendor.css')); |
|
| 33 | + wp_enqueue_style('stashVendorCss', get_template_directory_uri().'/dist/css/vendor.css', [], filemtime(get_stylesheet_directory().'/dist/css/vendor.css')); |
|
| 34 | 34 | array_push($mainCssDependencies, 'stashVendorCss'); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if ($mainCssExists) { |
| 38 | - wp_enqueue_style('stashMainCss', get_template_directory_uri() . '/dist/css/main.css', $mainCssDependencies, filemtime(get_stylesheet_directory() . '/dist/css/main.css')); |
|
| 38 | + wp_enqueue_style('stashMainCss', get_template_directory_uri().'/dist/css/main.css', $mainCssDependencies, filemtime(get_stylesheet_directory().'/dist/css/main.css')); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | -add_action('wp_enqueue_scripts', function () { |
|
| 43 | +add_action('wp_enqueue_scripts', function() { |
|
| 44 | 44 | $assets = new Assets(); |
| 45 | 45 | $assets->load(); |
| 46 | 46 | }, 100); |
| 47 | 47 | \ No newline at end of file |
@@ -82,12 +82,12 @@ |
||
| 82 | 82 | |
| 83 | 83 | $transientHelper = new TransientHelper(); |
| 84 | 84 | |
| 85 | -add_action('post_updated', function () use ($transientHelper) { |
|
| 85 | +add_action('post_updated', function() use ($transientHelper) { |
|
| 86 | 86 | $transientHelper->deleteAll(); |
| 87 | 87 | }); |
| 88 | -add_action('save_post', function () use ($transientHelper) { |
|
| 88 | +add_action('save_post', function() use ($transientHelper) { |
|
| 89 | 89 | $transientHelper->deleteAll(); |
| 90 | 90 | }); |
| 91 | -add_action('add_attachment', function () use ($transientHelper) { |
|
| 91 | +add_action('add_attachment', function() use ($transientHelper) { |
|
| 92 | 92 | $transientHelper->deleteAll(); |
| 93 | 93 | }); |
| 94 | 94 | \ No newline at end of file |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | $labels = array( |
| 9 | 9 | 'name' => _x($plural, 'taxonomy general name', 'stash'), |
| 10 | 10 | 'singular_name' => _x($single, 'taxonomy singular name', 'stash'), |
| 11 | - 'search_items' => __('Search ' . $plural, 'stash'), |
|
| 11 | + 'search_items' => __('Search '.$plural, 'stash'), |
|
| 12 | 12 | 'all_items' => __('All Genres', 'stash'), |
| 13 | - 'parent_item' => __('Parent ' . $single, 'stash'), |
|
| 14 | - 'parent_item_colon' => __('Parent :' . $single, 'stash'), |
|
| 15 | - 'edit_item' => __('Edit ' . $single, 'stash'), |
|
| 16 | - 'update_item' => __('Update ' . $single, 'stash'), |
|
| 17 | - 'add_new_item' => __('Add New ' . $single, 'stash'), |
|
| 18 | - 'new_item_name' => __('New ' . $single . ' Name', 'stash'), |
|
| 13 | + 'parent_item' => __('Parent '.$single, 'stash'), |
|
| 14 | + 'parent_item_colon' => __('Parent :'.$single, 'stash'), |
|
| 15 | + 'edit_item' => __('Edit '.$single, 'stash'), |
|
| 16 | + 'update_item' => __('Update '.$single, 'stash'), |
|
| 17 | + 'add_new_item' => __('Add New '.$single, 'stash'), |
|
| 18 | + 'new_item_name' => __('New '.$single.' Name', 'stash'), |
|
| 19 | 19 | 'menu_name' => __($single, 'stash'), |
| 20 | 20 | ); |
| 21 | 21 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * Set all pages from within the functions.php->setControllers() |
| 36 | 36 | * |
| 37 | - * @param $pages |
|
| 37 | + * @param string[] $pages |
|
| 38 | 38 | */ |
| 39 | 39 | public function setPages($pages) |
| 40 | 40 | { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | /** |
| 106 | 106 | * Return name of the body class |
| 107 | 107 | * |
| 108 | - * @return bool|string |
|
| 108 | + * @return string|false |
|
| 109 | 109 | */ |
| 110 | 110 | public function getClass() |
| 111 | 111 | { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $context = $this->context; |
| 73 | 73 | |
| 74 | - $file = get_template_directory() . '/controllers/single/' . $this->context['post']->post_type . '.php'; |
|
| 74 | + $file = get_template_directory().'/controllers/single/'.$this->context['post']->post_type.'.php'; |
|
| 75 | 75 | |
| 76 | 76 | if (file_exists($file)) { |
| 77 | 77 | /** |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | include($file); |
| 81 | 81 | } else { |
| 82 | - Timber::render(array('single-' . $context['post']->ID . '.twig', 'single-' . $context['post']->post_type . '.twig', 'single.twig'), $context, Cache::getTimerTime()); |
|
| 82 | + Timber::render(array('single-'.$context['post']->ID.'.twig', 'single-'.$context['post']->post_type.'.twig', 'single.twig'), $context, Cache::getTimerTime()); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function fourOFour() |
| 87 | 87 | { |
| 88 | - include(get_template_directory() . '/controllers/404.php'); |
|
| 88 | + include(get_template_directory().'/controllers/404.php'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function archive() |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $context = $this->context; |
| 96 | 96 | |
| 97 | - $file = get_template_directory() . '/controllers/archive/' . $this->context['post']->post_type . '.php'; |
|
| 97 | + $file = get_template_directory().'/controllers/archive/'.$this->context['post']->post_type.'.php'; |
|
| 98 | 98 | |
| 99 | 99 | if (file_exists($file)) { |
| 100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | include($file); |
| 104 | 104 | } else { |
| 105 | - Timber::render(array('single-' . $context['post']->ID . '.twig', 'single-' . $context['post']->post_type . '.twig', 'single.twig'), $context, Cache::getTimerTime()); |
|
| 105 | + Timber::render(array('single-'.$context['post']->ID.'.twig', 'single-'.$context['post']->post_type.'.twig', 'single.twig'), $context, Cache::getTimerTime()); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | /** |
| 117 | 117 | * See if controller excists else fall back to default |
| 118 | 118 | */ |
| 119 | - $file = get_template_directory() . '/controllers/pages/' . $page . '.php'; |
|
| 119 | + $file = get_template_directory().'/controllers/pages/'.$page.'.php'; |
|
| 120 | 120 | if (file_exists($file)) { |
| 121 | 121 | $this->found = $page; |
| 122 | 122 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $this->setContext(); |
| 146 | 146 | $context = $this->context; |
| 147 | - Timber::render(['page-' . $this->context['post']->post_name . '.twig', 'page.twig'], $this->context, Cache::getTimerTime()); |
|
| 147 | + Timber::render(['page-'.$this->context['post']->post_name.'.twig', 'page.twig'], $this->context, Cache::getTimerTime()); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | public function getClass() |
| 156 | 156 | { |
| 157 | 157 | if ($this->found) { |
| 158 | - return 'page-' . $this->found; |
|
| 158 | + return 'page-'.$this->found; |
|
| 159 | 159 | } else { |
| 160 | 160 | return false; |
| 161 | 161 | } |