From 0452c358e877fd59fb6afd0085c908063be42939 Mon Sep 17 00:00:00 2001 From: imajim Date: Tue, 18 Jul 2017 20:19:51 +0200 Subject: [PATCH 01/11] for Table Termmeta --- Herbert/Framework/Models/TermMeta.php | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Herbert/Framework/Models/TermMeta.php diff --git a/Herbert/Framework/Models/TermMeta.php b/Herbert/Framework/Models/TermMeta.php new file mode 100644 index 0000000..627aaed --- /dev/null +++ b/Herbert/Framework/Models/TermMeta.php @@ -0,0 +1,48 @@ +belongsTo(__NAMESPACE__ . '\Term', 'term_id'); + } + +} From 3073f091beb5dc9a0ccda953ed651056d72ac01f Mon Sep 17 00:00:00 2001 From: imajim Date: Tue, 18 Jul 2017 20:21:13 +0200 Subject: [PATCH 02/11] add reletion to termmeta --- Herbert/Framework/Models/Term.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Herbert/Framework/Models/Term.php b/Herbert/Framework/Models/Term.php index 8c69039..2c69f79 100644 --- a/Herbert/Framework/Models/Term.php +++ b/Herbert/Framework/Models/Term.php @@ -46,5 +46,15 @@ public function taxonomies() { return $this->hasMany(__NAMESPACE__ . '\Taxonomy', 'term_id'); } + + /** + * TermMeta relationship. + * + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function meta() + { + return $this->hasMany(__NAMESPACE__ . '\TermMeta', 'term_id'); + } } From 937b7353de28ac790738718517bd3b91a26e5c58 Mon Sep 17 00:00:00 2001 From: imajim Date: Wed, 19 Jul 2017 07:06:27 +0200 Subject: [PATCH 03/11] fic abstract method not found --- Herbert/Framework/Application.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Herbert/Framework/Application.php b/Herbert/Framework/Application.php index ee7c3e1..e5b6515 100644 --- a/Herbert/Framework/Application.php +++ b/Herbert/Framework/Application.php @@ -149,7 +149,11 @@ public function __construct() $this->registerCoreContainerAliases(); $this->registerConfiguredProviders(); } - + + public function runningInConsole() { } + + public function getCachedPackagesPath() { } + /** * Added to satisfy interface * From 1b140dd3ec1f086b0968f602ee34de5cd5e7bbb9 Mon Sep 17 00:00:00 2001 From: imajim Date: Mon, 5 Mar 2018 15:11:00 +0100 Subject: [PATCH 04/11] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ce4feb..40c60f5 100644 --- a/composer.json +++ b/composer.json @@ -17,5 +17,5 @@ "config": { "preferred-install": "dist" }, - "minimum-stability": "dev" + "minimum-stability": "stable" } From 710941629ab6f4d3bebf4f4b0bfce885fb9460db Mon Sep 17 00:00:00 2001 From: imajim Date: Mon, 5 Mar 2018 15:11:25 +0100 Subject: [PATCH 05/11] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 40c60f5..8ce4feb 100644 --- a/composer.json +++ b/composer.json @@ -17,5 +17,5 @@ "config": { "preferred-install": "dist" }, - "minimum-stability": "stable" + "minimum-stability": "dev" } From 991b59719160150dfed8ccb48bfc95cb066b3fa0 Mon Sep 17 00:00:00 2001 From: imajim Date: Mon, 5 Mar 2018 15:37:08 +0100 Subject: [PATCH 06/11] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ce4feb..7ec2555 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "getherbert/herbert", + "name": "imajim/herbert", "description": "Herbert", "license": "MIT", "require": { From 345f3aabdd9ddd4538f581e124d512f6040cffdf Mon Sep 17 00:00:00 2001 From: imajim Date: Tue, 6 Mar 2018 06:57:43 +0100 Subject: [PATCH 07/11] Update composer.json --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 7ec2555..0110c40 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,6 @@ "description": "Herbert", "license": "MIT", "require": { - "twig/twig": "~1.16", "illuminate/database": "~5.0", "vierbergenlars/php-semver": "~3.0", "symfony/var-dumper": "~3.0", From ee5277a78f2b45db1e0c80894ab250f289e51585 Mon Sep 17 00:00:00 2001 From: imajim Date: Tue, 6 Mar 2018 06:59:01 +0100 Subject: [PATCH 08/11] Update composer.json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0110c40..ff30ed2 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "illuminate/database": "~5.0", "vierbergenlars/php-semver": "~3.0", "symfony/var-dumper": "~3.0", - "illuminate/http": "~5.0" + "illuminate/http": "~5.0", + "twig/twig": "2.x-dev" }, "autoload": { "psr-4": { From 0547134e2e918b2128032574ffb36a3ed36ccb7f Mon Sep 17 00:00:00 2001 From: imajim Date: Tue, 6 Mar 2018 10:53:15 +0100 Subject: [PATCH 09/11] Update TwigServiceProvider.php set autoespace to 'html' because error in in twig\twig\lib\Twig\Extension\Escaper.php --- Herbert/Framework/Providers/TwigServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Herbert/Framework/Providers/TwigServiceProvider.php b/Herbert/Framework/Providers/TwigServiceProvider.php index cce2573..d15acc0 100644 --- a/Herbert/Framework/Providers/TwigServiceProvider.php +++ b/Herbert/Framework/Providers/TwigServiceProvider.php @@ -38,7 +38,7 @@ public function register() 'cache' => content_directory() . '/twig-cache', 'auto_reload' => true, 'strict_variables' => false, - 'autoescape' => true, + 'autoescape' => 'html', 'optimizations' => -1 ]; }); From adc06cd8bc63eefde8cfeb1eca99ac27a0292ae6 Mon Sep 17 00:00:00 2001 From: imajim Date: Wed, 13 Mar 2019 15:56:34 +0100 Subject: [PATCH 10/11] Update Enqueue.php --- Herbert/Framework/Enqueue.php | 96 +++++++++++++++++------------------ 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/Herbert/Framework/Enqueue.php b/Herbert/Framework/Enqueue.php index c0cf67a..3c35a1f 100644 --- a/Herbert/Framework/Enqueue.php +++ b/Herbert/Framework/Enqueue.php @@ -3,7 +3,8 @@ /** * @see http://getherbert.com */ -class Enqueue { +class Enqueue +{ /** * All the filters. @@ -18,7 +19,8 @@ class Enqueue { 'category', 'archive', 'search', - 'postType' + 'postType', + 'taxonomy' ]; /** @@ -45,18 +47,14 @@ public function __construct(Application $app) */ public function buildInclude($attrs, $footer) { - if (isset($attrs['filter']) && !empty($attrs['filter'])) - { + if (isset($attrs['filter']) && !empty($attrs['filter'])) { $filterBy = key($attrs['filter']); $filterWith = reset($attrs['filter']); - if (!is_array($filterWith)) - { + if (!is_array($filterWith)) { $filterWith = [$filterWith]; } - - if (!$this->filterBy($filterBy, $attrs, $filterWith)) - { + if (!$this->filterBy($filterBy, $attrs, $filterWith)) { return; } } @@ -66,16 +64,13 @@ public function buildInclude($attrs, $footer) // $attrs['src'] = ltrim($attrs['src'], '/'); // } - if (pathinfo($attrs['src'], PATHINFO_EXTENSION) === 'css') - { + if (pathinfo($attrs['src'], PATHINFO_EXTENSION) === 'css') { wp_enqueue_style($attrs['as'], $attrs['src']); - } - else - { + } else { wp_enqueue_script($attrs['as'], $attrs['src'], [], false, $footer); - if(isset($attrs['localize'])) { - wp_localize_script( $attrs['as'], $attrs['as'], $attrs['localize'] ); + if (isset($attrs['localize'])) { + wp_localize_script($attrs['as'], $attrs['as'], $attrs['localize']); } } } @@ -92,8 +87,7 @@ protected function filterBy($by, $attrs, $with) { $method = 'filter' . ucfirst($by); - if (!method_exists($this, $method)) - { + if (!method_exists($this, $method)) { return false; } @@ -108,8 +102,7 @@ protected function filterBy($by, $attrs, $with) */ public function admin($attrs, $footer = 'header') { - add_action('admin_enqueue_scripts', function ($hook) use ($attrs, $footer) - { + add_action('admin_enqueue_scripts', function ($hook) use ($attrs, $footer) { $attrs['hook'] = $hook; $this->buildInclude($attrs, $this->setFooterFlag($footer)); }); @@ -123,8 +116,7 @@ public function admin($attrs, $footer = 'header') */ public function login($attrs, $footer = 'header') { - add_action('login_enqueue_scripts', function () use ($attrs, $footer) - { + add_action('login_enqueue_scripts', function () use ($attrs, $footer) { $this->buildInclude($attrs, $this->setFooterFlag($footer)); }); } @@ -137,8 +129,7 @@ public function login($attrs, $footer = 'header') */ public function front($attrs, $footer = 'header') { - add_action('wp_enqueue_scripts', function () use ($attrs, $footer) - { + add_action('wp_enqueue_scripts', function () use ($attrs, $footer) { $this->buildInclude($attrs, $this->setFooterFlag($footer)); }); } @@ -167,8 +158,7 @@ public function filterHook($attrs, $filterWith) { $hook = $attrs['hook']; - if ($filterWith[0] === '*') - { + if ($filterWith[0] === '*') { return true; } @@ -186,22 +176,20 @@ public function filterHook($attrs, $filterWith) */ public function filterPanel($attrs, $filterWith) { + $panels = $this->app['panel']->getPanels(); $page = $this->app['http']->get('page', false); - if (!$page && function_exists('get_current_screen')) - { + if (!$page && function_exists('get_current_screen')) { $page = object_get(get_current_screen(), 'id', $page); } - foreach ($filterWith as $filter) - { + foreach ($filterWith as $filter) { $filtered = array_filter($panels, function ($panel) use ($page, $filter) { return $page === $panel['slug'] && str_is($filter, $panel['slug']); }); - if (count($filtered) > 0) - { + if (count($filtered) > 0) { return true; } } @@ -220,15 +208,12 @@ public function filterPanel($attrs, $filterWith) */ public function filterPage($attrs, $filterWith) { - if ($filterWith[0] === '*' && is_page()) - { + if ($filterWith[0] === '*' && is_page()) { return true; } - foreach ($filterWith as $filter) - { - if (is_page($filter)) - { + foreach ($filterWith as $filter) { + if (is_page($filter)) { return true; } } @@ -247,15 +232,12 @@ public function filterPage($attrs, $filterWith) */ public function filterPost($attrs, $filterWith) { - if ($filterWith[0] === '*' && is_single()) - { + if ($filterWith[0] === '*' && is_single()) { return true; } - foreach ($filterWith as $filter) - { - if (is_single($filter)) - { + foreach ($filterWith as $filter) { + if (is_single($filter)) { return true; } } @@ -274,15 +256,12 @@ public function filterPost($attrs, $filterWith) */ public function filterCategory($attrs, $filterWith) { - if ($filterWith[0] === '*' && is_category()) - { + if ($filterWith[0] === '*' && is_category()) { return true; } - foreach ($filterWith as $filter) - { - if (is_category($filter)) - { + foreach ($filterWith as $filter) { + if (is_category($filter)) { return true; } } @@ -330,4 +309,21 @@ public function filterPostType($attrs, $filterWith) return array_search(get_post_type(), $filterWith) !== FALSE; } + /** + * Filter by Taxonomy, check all values using + * + * @param $attrs + * @param $filterWith + * @return bool + */ + public function filterTaxonomy($attrs, $filterWith) + { + /* @var \Herbert\Framework\Http $http */ + $http = $this->app->get('http'); + if ($http->has('taxonomy')) { + return array_search( $http->get('taxonomy') , $filterWith) !== FALSE; + } + return false; + } + } From 0b108ee2a75edcaac6cd88d0b5ce337e6ebd6353 Mon Sep 17 00:00:00 2001 From: imajim Date: Wed, 13 Mar 2019 15:57:01 +0100 Subject: [PATCH 11/11] Update Application.php --- Herbert/Framework/Application.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Herbert/Framework/Application.php b/Herbert/Framework/Application.php index e5b6515..c614587 100644 --- a/Herbert/Framework/Application.php +++ b/Herbert/Framework/Application.php @@ -151,7 +151,8 @@ public function __construct() } public function runningInConsole() { } - + public function runningUnitTests() { } + public function getCachedPackagesPath() { } /**