From 8b6cb3043109dc864681d3f9dc52a7baa7dce529 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Wed, 3 Jun 2020 17:30:51 +0300 Subject: [PATCH 01/32] remove unused files && add sage10 support --- composer.json | 29 +-- src/AbstractBladeModule.php | 4 +- src/AbstractHelper.php | 7 - src/God.php | 114 --------- src/Modules/Accordion/Accordion.php | 2 +- src/Modules/Alert/Alert.php | 2 +- src/Modules/Breadcrumbs/Breadcrumbs.php | 2 +- src/Modules/Breadcrumbs/includes/frontend.php | 2 +- src/Modules/Button/Button.php | 2 +- src/Modules/Button/includes/frontend.php | 2 +- src/Modules/ContentImage/ContentImage.php | 2 +- src/Modules/FilterBar/FilterBar.php | 2 +- src/Modules/Gallery/Gallery.php | 2 +- src/Modules/GravityForm/GravityForm.php | 2 +- src/Modules/PageHeading/PageHeading.php | 2 +- src/Modules/PageSlider/PageSlider.php | 2 +- src/Modules/SecondaryNav/SecondaryNav.php | 2 +- .../SecondaryNav/includes/frontend.php | 2 +- src/Modules/Table/Table.php | 2 +- src/Modules/Testimonial/Testimonial.php | 2 +- src/SageFLBuilder.php | 8 +- src/Settings/Archives/Archive.php | 37 --- src/Settings/Archives/EventsArchive.php | 17 -- src/Settings/PostGrid.php | 230 ------------------ src/Settings/ProductsArchive.php | 69 ------ src/Settings/RichText.php | 24 -- src/Settings/ThemeLayouts/ThemeLayout.php | 2 +- src/post-grid/filter-bar-event.php | 46 ---- src/post-grid/filter-bar.php | 108 -------- src/post-grid/post-theme-event.php | 35 --- src/post-grid/post-theme-product.php | 27 -- src/post-grid/post-theme.php | 46 ---- 32 files changed, 21 insertions(+), 814 deletions(-) delete mode 100644 src/God.php delete mode 100644 src/Settings/Archives/Archive.php delete mode 100644 src/Settings/Archives/EventsArchive.php delete mode 100644 src/Settings/PostGrid.php delete mode 100644 src/Settings/ProductsArchive.php delete mode 100644 src/Settings/RichText.php delete mode 100644 src/post-grid/filter-bar-event.php delete mode 100644 src/post-grid/filter-bar.php delete mode 100644 src/post-grid/post-theme-event.php delete mode 100644 src/post-grid/post-theme-product.php delete mode 100644 src/post-grid/post-theme.php diff --git a/composer.json b/composer.json index 69af6b2..33e9891 100644 --- a/composer.json +++ b/composer.json @@ -5,14 +5,13 @@ "require": { "php": "^7.1", "illuminate/support": "^5.4", - "roots/sage-lib": "^9.0" + "roots/acorn": "^1.0.1" }, "require-dev": { "automattic/vipwpcs": "dev-master", "beaver-builder/bb-plugin": "*", "beaver-builder/bb-theme-builder": "*", "roave/security-advisories": "dev-master", - "roots/sage": "*", "wp-coding-standards/wpcs": "^1.0" }, "config": { @@ -28,32 +27,6 @@ "Itineris\\SageFLBuilder\\": "src/" } }, - "repositories": [ - { - "type": "package", - "package": { - "name": "beaver-builder/bb-plugin", - "type": "wordpress-plugin", - "version": "999.999.999", - "dist": { - "type": "zip", - "url": "https://updates.wpbeaverbuilder.com/?fl-api-method=composer_download&download=bb-plugin-pro.zip&license=78682e62702e6676657261766776407a7667" - } - } - }, - { - "type": "package", - "package": { - "name": "beaver-builder/bb-theme-builder", - "type": "wordpress-plugin", - "version": "999.999.999", - "dist": { - "type": "zip", - "url": "https://updates.wpbeaverbuilder.com/?fl-api-method=composer_download&download=bb-theme-builder.zip&license=78682e62702e6676657261766776407a7667" - } - } - } - ], "prefer-stable": true, "scripts": { "check-style": "phpcs --standard=ruleset.xml --colors -p -s", diff --git a/src/AbstractBladeModule.php b/src/AbstractBladeModule.php index 2c27dcc..5bee11a 100644 --- a/src/AbstractBladeModule.php +++ b/src/AbstractBladeModule.php @@ -5,7 +5,7 @@ namespace Itineris\SageFLBuilder; use FLBuilderModule; -use function App\sage; +use Itineris\SageFLBuilder\SageFLBuilder; /** * Add Laravel Blade support. @@ -32,7 +32,7 @@ public static function renderFrontendTemplate(string $file, FLBuilderModule $mod } /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = SageFLBuilder::container(AbstractHelper::class); $path = $helper->templatePath($module->dir . 'includes/frontend.blade.php'); echo $helper->template($path, [ diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index 8e6b853..8edf12d 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -124,11 +124,4 @@ abstract public function videoEmbed($video_url, $width = null, $height = null); abstract public function getSecondaryNav(); abstract public function getGravityForms(): array; - - /** - * Full path to PostGrid template directory. - * - * @return string - */ - abstract public function getPostGridTemplateDir(): string; } diff --git a/src/God.php b/src/God.php deleted file mode 100644 index b46b646..0000000 --- a/src/God.php +++ /dev/null @@ -1,114 +0,0 @@ - $postType, - 'meta_key' => 'location', - 'meta_query' => [ - [ - 'key' => 'location', - 'value' => '', - 'compare' => '!=', - ], - ], - ]); // WPCS: slow query ok. - - if ($locQuery->have_posts()) { - while ($locQuery->have_posts()) { - $locQuery->the_post(); - $location = get_field('location', get_the_ID()); - if (! array_key_exists($location, $locations)) { - $locations[esc_attr($location)] = $location; - } - } - } - - wp_reset_postdata(); - - return $locations; - } - - /** - * TODO: Do I deserve a class? - */ - public static function flGetFilterCount($settings): int - { - $count = 0; - if (! $settings->show_filter) { - return $count; - } - if ($settings->show_search_filter) { - $count++; - } - if (isset($settings->tax_exists) && $settings->tax_exists) { - $count++; - } - if ($settings->show_meta_filters) { - $count++; - } - if (isset($settings->show_role) && $settings->show_role) { - $count++; - } - - return $count; - } - - /** - * TODO: Am I belong to class `PostGrid` or `FilterBar`? - */ - public function filterBarFrontend($settings): string - { - $settings['show_filter'] = true; - $settings['layout'] = 'theme'; - - return sage(PostGrid::class)->filterBar((object) $settings); - } - - /** - * TODO: Am I belong to class `PostGrid` or `FilterBar`? - */ - public function noPostsFilterBar($settings, $query): void - { - if ($query->have_posts()) { - return; - } - - $settings->show_filter = true; - $settings->layout = 'theme'; - - echo sage(PostGrid::class)->filterBar($settings); - } -} diff --git a/src/Modules/Accordion/Accordion.php b/src/Modules/Accordion/Accordion.php index c93f6e4..0f25c13 100644 --- a/src/Modules/Accordion/Accordion.php +++ b/src/Modules/Accordion/Accordion.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function App\sage; +use function Roots\app as sage; /** * Generic Bootstrap accordion widget diff --git a/src/Modules/Alert/Alert.php b/src/Modules/Alert/Alert.php index 0ea2811..b2b7596 100644 --- a/src/Modules/Alert/Alert.php +++ b/src/Modules/Alert/Alert.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; /** * Class Alert diff --git a/src/Modules/Breadcrumbs/Breadcrumbs.php b/src/Modules/Breadcrumbs/Breadcrumbs.php index b7f52d3..d2e4230 100644 --- a/src/Modules/Breadcrumbs/Breadcrumbs.php +++ b/src/Modules/Breadcrumbs/Breadcrumbs.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function App\sage; +use function Roots\app as sage; /** * Class Breadcrumbs diff --git a/src/Modules/Breadcrumbs/includes/frontend.php b/src/Modules/Breadcrumbs/includes/frontend.php index 6ba362a..909eea6 100644 --- a/src/Modules/Breadcrumbs/includes/frontend.php +++ b/src/Modules/Breadcrumbs/includes/frontend.php @@ -3,7 +3,7 @@ declare(strict_types=1); use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; /** @var AbstractHelper $helper */ $helper = sage(AbstractHelper::class); diff --git a/src/Modules/Button/Button.php b/src/Modules/Button/Button.php index 72486d5..0af5e1b 100644 --- a/src/Modules/Button/Button.php +++ b/src/Modules/Button/Button.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function App\sage; +use function Roots\app as sage; /** * Generic Bootstrap button widget diff --git a/src/Modules/Button/includes/frontend.php b/src/Modules/Button/includes/frontend.php index 9ec8bed..1089031 100644 --- a/src/Modules/Button/includes/frontend.php +++ b/src/Modules/Button/includes/frontend.php @@ -6,7 +6,7 @@ */ use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; /** @var AbstractHelper $helper */ $helper = sage(AbstractHelper::class); diff --git a/src/Modules/ContentImage/ContentImage.php b/src/Modules/ContentImage/ContentImage.php index 9c3d70f..f99508c 100644 --- a/src/Modules/ContentImage/ContentImage.php +++ b/src/Modules/ContentImage/ContentImage.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; /** * Generic Bootstrap button widget diff --git a/src/Modules/FilterBar/FilterBar.php b/src/Modules/FilterBar/FilterBar.php index 8866d50..6374ae6 100644 --- a/src/Modules/FilterBar/FilterBar.php +++ b/src/Modules/FilterBar/FilterBar.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function App\sage; +use function Roots\app as sage; /** * @class FilterBar diff --git a/src/Modules/Gallery/Gallery.php b/src/Modules/Gallery/Gallery.php index 4542f2f..ea3f757 100644 --- a/src/Modules/Gallery/Gallery.php +++ b/src/Modules/Gallery/Gallery.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; /** * Class Gallery diff --git a/src/Modules/GravityForm/GravityForm.php b/src/Modules/GravityForm/GravityForm.php index 6bbf037..c21cbec 100644 --- a/src/Modules/GravityForm/GravityForm.php +++ b/src/Modules/GravityForm/GravityForm.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; class GravityForm extends AbstractBladeModule { diff --git a/src/Modules/PageHeading/PageHeading.php b/src/Modules/PageHeading/PageHeading.php index eb731ca..0176fe0 100644 --- a/src/Modules/PageHeading/PageHeading.php +++ b/src/Modules/PageHeading/PageHeading.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage;; /** * @class PageHeading diff --git a/src/Modules/PageSlider/PageSlider.php b/src/Modules/PageSlider/PageSlider.php index 69c2a02..85b51ad 100644 --- a/src/Modules/PageSlider/PageSlider.php +++ b/src/Modules/PageSlider/PageSlider.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function App\sage; +use function Roots\app as sage; /** * @class PageSlider diff --git a/src/Modules/SecondaryNav/SecondaryNav.php b/src/Modules/SecondaryNav/SecondaryNav.php index ffe77f8..a41ef9f 100644 --- a/src/Modules/SecondaryNav/SecondaryNav.php +++ b/src/Modules/SecondaryNav/SecondaryNav.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function App\sage; +use function Roots\app as sage; /** * Class SecondaryNav diff --git a/src/Modules/SecondaryNav/includes/frontend.php b/src/Modules/SecondaryNav/includes/frontend.php index 9b6fb14..42e6ecc 100644 --- a/src/Modules/SecondaryNav/includes/frontend.php +++ b/src/Modules/SecondaryNav/includes/frontend.php @@ -3,7 +3,7 @@ declare(strict_types=1); use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; /** @var AbstractHelper $helper */ $helper = sage(AbstractHelper::class); diff --git a/src/Modules/Table/Table.php b/src/Modules/Table/Table.php index 74f46f6..c36346c 100644 --- a/src/Modules/Table/Table.php +++ b/src/Modules/Table/Table.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function App\sage; +use function Roots\app as sage; /** * Generic Bootstrap table widget diff --git a/src/Modules/Testimonial/Testimonial.php b/src/Modules/Testimonial/Testimonial.php index 9d8b320..353a8bc 100644 --- a/src/Modules/Testimonial/Testimonial.php +++ b/src/Modules/Testimonial/Testimonial.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; /** * Generic Testimonial widget diff --git a/src/SageFLBuilder.php b/src/SageFLBuilder.php index 44510ea..86a1987 100644 --- a/src/SageFLBuilder.php +++ b/src/SageFLBuilder.php @@ -17,14 +17,12 @@ use Itineris\SageFLBuilder\Modules\SecondaryNav\SecondaryNav; use Itineris\SageFLBuilder\Modules\Table\Table; use Itineris\SageFLBuilder\Modules\Testimonial\Testimonial; -use Itineris\SageFLBuilder\Settings\Archives\EventsArchive; -use Itineris\SageFLBuilder\Settings\PostGrid; use Itineris\SageFLBuilder\Settings\RichText; use Itineris\SageFLBuilder\Settings\ThemeLayouts\ArchiveThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\DefaultThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\HomeThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\SingleThemeLayout; -use function App\sage; +use function Roots\app as sage; /** * Beaver Builder extensions @@ -38,15 +36,12 @@ final class SageFLBuilder Breadcrumbs::class, Button::class, ContentImage::class, - EventsArchive::class, FilterBar::class, Gallery::class, - God::class, GravityForm::class, HomeThemeLayout::class, PageHeading::class, PageSlider::class, - PostGrid::class, RichText::class, SecondaryNav::class, SingleThemeLayout::class, @@ -148,7 +143,6 @@ public function addFilters(): void public function init(): void { sage()->instance(AbstractHelper::class, $this->helper); - sage()->bind(PostGrid::class); foreach ($this->initializables as $initializable) { $initializable::init(); diff --git a/src/Settings/Archives/Archive.php b/src/Settings/Archives/Archive.php deleted file mode 100644 index c266f70..0000000 --- a/src/Settings/Archives/Archive.php +++ /dev/null @@ -1,37 +0,0 @@ -postType = $postType; - } - - public function modifyQuery(WP_Query $query): WP_Query - { - if ($this->shouldModify($query)) { - $query->set('post_parent', 0); - } - - return $query; - } - - private function shouldModify(WP_Query $query): bool - { - return ! is_admin() && - $query->is_post_type_archive($this->postType) && - ($query->is_main_query() || $query->get('fl_builder_loop', false)) && - (! isset($query->query['settings']->type) || 'post-grid' === $query->query['settings']->type); // WPCS: precision alignment ok. - } -} diff --git a/src/Settings/Archives/EventsArchive.php b/src/Settings/Archives/EventsArchive.php deleted file mode 100644 index 644f2dd..0000000 --- a/src/Settings/Archives/EventsArchive.php +++ /dev/null @@ -1,17 +0,0 @@ - [ - 'posts', - ], - 'fields' => [ - 'match_height', - 'show_filter', - 'show_cat_desc', - ], - ]; - $form['layout']['sections']['general']['fields']['show_filter'] = [ - 'type' => 'select', - 'label' => __('Show filter bar?', 'fabric'), - 'default' => '1', - 'options' => [ - '1' => __('Yes', 'fl-builder'), - '0' => __('No', 'fl-builder'), - ], - 'toggle' => [ - '0' => [], - '1' => [ - 'sections' => ['filter_bar'], - ], - ], - ]; - $form['layout']['sections']['info']['fields']['date_format']['options']['l jS F'] = date('l jS F'); - $form['layout']['sections']['filter_bar'] = [ - 'title' => __('Filter bar', 'fabric'), - 'fields' => [ - 'auto_filter' => [ - 'type' => 'select', - 'label' => __('Auto filter?', 'fabric'), - 'default' => '1', - 'options' => [ - '1' => __('Yes', 'fl-builder'), - '0' => __('No', 'fl-builder'), - ], - ], - 'show_button' => [ - 'type' => 'select', - 'label' => __('Show submit button?', 'fabric'), - 'default' => '1', - 'options' => [ - '0' => __('No', 'fabric'), - '1' => __('Yes', 'fabric'), - ], - ], - 'show_search_filter' => [ - 'type' => 'select', - 'label' => __('Show search box?', 'fabric'), - 'default' => '1', - 'options' => [ - '1' => __('Yes', 'fl-builder'), - '0' => __('No', 'fl-builder'), - ], - ], - 'show_meta_filters' => [ - 'type' => 'select', - 'label' => __('Show field filters?', 'fabric'), - 'default' => '1', - 'options' => [ - '1' => __('Yes', 'fl-builder'), - '0' => __('No', 'fl-builder'), - ], - ], - 'show_cat_desc' => [ - 'type' => 'select', - 'label' => __('Show category description?', 'fabric'), - 'default' => '1', - 'options' => [ - '1' => __('Yes', 'fl-builder'), - '0' => __('No', 'fl-builder'), - ], - ], - 'show_cat_filter' => [ - 'type' => 'select', - 'label' => __('Show category dropdown?', 'fabric'), - 'default' => '1', - 'options' => [ - '1' => __('Yes', 'fl-builder'), - '0' => __('No', 'fl-builder'), - ], - ], - ], - ]; - - return $form; - } - - public static function loadLayoutPath($path, $layout, $settings) - { - if ('theme' !== $layout) { - return $path; - } - - /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); - - return self::templatePath( - $helper->getPostGridTemplateDir(), - 'post-theme', - get_post_type() ?: $settings->post_type - ); - } - - private static function templatePath(string $dir, string $prefix, string $postType): string - { - $dir = untrailingslashit($dir); - $prefix = untrailingslashit($prefix); - - $paths = [ - "$dir/$prefix-$postType.blade.php", - "$dir/$prefix-$postType.php", - "$dir/$prefix.blade.php", - "$dir/$prefix.php", - __DIR__ . "/../post-grid/$prefix-$postType.blade.php", - __DIR__ . "/../post-grid/$prefix-$postType.php", - __DIR__ . "/../post-grid/$prefix.blade.php", - __DIR__ . "/../post-grid/$prefix.php", - ]; - - $path = array_first($paths, function (string $path): bool { - return file_exists($path); - }, self::NOT_FOUND); - - if (self::NOT_FOUND === $path) { - throw new RuntimeException('Template not found in ' . implode(', ', $paths)); - } - - if (ends_with($path, '.blade.php')) { - /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); - $path = $helper->templatePath($path); - } - - return $path; - } - - public static function filterBar($settings): string - { - /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); - - ob_start(); - - // phpcs:ignore WordPressVIPMinimum.Variables.VariableAnalysis.UnusedVariable - $show_filter = false; - $tax_exists = false; - - $postType = $settings->post_type ?? null; - if ('main_query' === $settings->data_source) { - $postType = get_post_type(); - } - if (empty($postType)) { - $postType = 'post'; - } - - if ($settings->show_filter) { - // Get the taxonomy name. - if ('post' === $postType) { - $category = 'category'; - } elseif ('product' === $postType) { - $category = 'product_cat'; - } else { - $category = $postType . '_category'; - } - // Check if the taxonomy exists. - $tax_exists = taxonomy_exists($category); - // Whether or not to show the filter. - $show_filter = $tax_exists ? true : false; - // Get the Term ID to filter by from $_GET['pc']. - $term_id = $helper->getCat(true, $category, true); - // Change the category if it is valid. - if (! empty($term_id)) { - $settings->{'tax_' . $postType . '_' . $category} = $term_id; - } - } - - $path = self::templatePath( - $helper->getPostGridTemplateDir(), - 'filter-bar', - $postType - ); - - // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.IncludingFile - include $path; - - return ob_get_clean(); - } -} diff --git a/src/Settings/ProductsArchive.php b/src/Settings/ProductsArchive.php deleted file mode 100644 index 6357450..0000000 --- a/src/Settings/ProductsArchive.php +++ /dev/null @@ -1,69 +0,0 @@ -layout) { - return; - } - - $postType = get_post_type() ?: $settings->post_type; - - if ('product' === $postType) { - echo ''; - } - } - - public static function loadFilterBar($settings, $query) - { - if ('theme' !== $settings->layout) { - return; - } - - $tax_query = $query->get('tax_query'); - $term = isset($tax_query[0]['terms'][0]) && is_numeric($tax_query[0]['terms'][0]) ? - get_term($tax_query[0]['terms'][0], 'product_cat') : ''; - $cat_title = ! empty($term) && ! is_wp_error($term) ? $term->name : ''; - $post_type = $query->query_vars['post_type']; - if ('product' === $post_type) { - echo '
'; - echo '
'; - echo '
'; - echo '

'; - if (function_exists('is_product_category') && is_product_category()) { - single_term_title(); - } else { - echo $cat_title; - } - echo '

'; - echo '
'; - echo '
'; - \FLThemeBuilderWooCommerceArchive::posts_module_before_posts($settings); - echo '
'; - echo '
    '; - } elseif ($settings->show_filter) { - echo sage(PostGrid::class)->filterBar($settings); - } - } -} diff --git a/src/Settings/RichText.php b/src/Settings/RichText.php deleted file mode 100644 index 68e4889..0000000 --- a/src/Settings/RichText.php +++ /dev/null @@ -1,24 +0,0 @@ -slug) { - return $out; - } - - return '
    ' . $out . '
    '; - } -} diff --git a/src/Settings/ThemeLayouts/ThemeLayout.php b/src/Settings/ThemeLayouts/ThemeLayout.php index a084ab6..e1a54c6 100644 --- a/src/Settings/ThemeLayouts/ThemeLayout.php +++ b/src/Settings/ThemeLayouts/ThemeLayout.php @@ -6,7 +6,7 @@ use Closure; use Itineris\SageFLBuilder\AbstractHelper; -use function App\sage; +use function Roots\app as sage; final class ThemeLayout { diff --git a/src/post-grid/filter-bar-event.php b/src/post-grid/filter-bar-event.php deleted file mode 100644 index 337e2b0..0000000 --- a/src/post-grid/filter-bar-event.php +++ /dev/null @@ -1,46 +0,0 @@ - -layout && $show_filter) : ?> -
    -
    -
    -
    - taxonomyDropdown('event_category', 'event', 'ec', 'Category'); ?> -
    -
    - taxonomyDropdown('event_type', 'event', 'et', 'Type'); ?> -
    -
    - -
    -
    - -
    -
    - diff --git a/src/post-grid/filter-bar.php b/src/post-grid/filter-bar.php deleted file mode 100644 index 2473c0e..0000000 --- a/src/post-grid/filter-bar.php +++ /dev/null @@ -1,108 +0,0 @@ -data_source ? (get_post_type() ?: 'post') : $settings->post_type; -if ($settings->show_filter) { - // Get the taxonomy name. - $category = ('post' === $post_type) ? 'category' : ('product' === $post_type ? 'product_cat' : $post_type . '_category'); - // Check if the taxonomy exists. - $tax_exists = taxonomy_exists($category); - - // Whether or not to show the filter. - $show_filter = $tax_exists ? true : false; - - // Get the Term ID to filter by from $_GET['cat']. - $term_id = $helper->getCat(true, $category, true); - // Change the category if it is valid. - if (! empty($term_id)) { - $settings->{'tax_' . $post_type . '_' . $category} = $term_id; - } -} -$list_class = 'news'; -if (('job_vacancy' === $post_type || 'volunteer_vacancy' === $post_type) && 'theme' === $settings->layout) { - $list_class = 'jobs'; -} elseif ('team' === $post_type && 'theme' === $settings->layout) { - $list_class = 'team'; -} elseif ('product' === $post_type && 'theme' === $settings->layout) { - $list_class = 'product'; -} -$filter_count = Itineris\SageFLBuilder\God::flGetFilterCount($settings); -if ('post' === $post_type) { - // TODO: `\App\get_posts` only accepts 2 parameters. - $authors = $helper->getPosts('team', '', true); - $filter_count++; -} -if (1 === $filter_count) { - $filter_col = 12; -} elseif (2 === $filter_count) { - $filter_col = 6; -} elseif (3 === $filter_count) { - $filter_col = 6; -} elseif (4 === $filter_count) { - $filter_col = 3; -} -$kw = get_query_var('kw'); -?> -layout && $show_filter) : ?> -
    auto_filter && print ' data-filter-auto="true"'; ?>> -
    -
    - show_search_filter) : ?> -
    -
    -
    - -
    -
    -
    - - -
    - taxonomyDropdown($category, 'Category', $post_type); ?> -
    - - show_meta_filters) : ?> - - - -
    -
    - -
    -
    - - -
    - show_button) : ?> - - -
    -
    - show_cat_desc) : ?> -
    - - diff --git a/src/post-grid/post-theme-event.php b/src/post-grid/post-theme-event.php deleted file mode 100644 index c00ef05..0000000 --- a/src/post-grid/post-theme-event.php +++ /dev/null @@ -1,35 +0,0 @@ -date_format ? get_option('date_format') : $settings->date_format; -$img = has_post_thumbnail() ? get_the_post_thumbnail(null, - 'post-thumb') : wp_get_attachment_image(get_theme_mod('fabric_placeholder_image'), 'post-thumb'); -?> -
    itemscope - itemtype="" role="contentinfo" aria-label="article"> - - -
    - -
    - -
    - -
    - ', ''); ?> - show_date) : ?> -

    date_format); ?>

    - - - - -
    -
    -
    -
    diff --git a/src/post-grid/post-theme-product.php b/src/post-grid/post-theme-product.php deleted file mode 100644 index 2844af7..0000000 --- a/src/post-grid/post-theme-product.php +++ /dev/null @@ -1,27 +0,0 @@ - - -
  • - - -

    - - £3.95 - -
    - %s', - esc_url($product->add_to_cart_url()), - esc_attr(isset($quantity) ? $quantity : 1), - esc_attr($product->get_id()), - esc_attr($product->get_sku()), - esc_attr(isset($class) ? $class : 'button product_type_simple add_to_cart_button ajax_add_to_cart'), - esc_html($product->add_to_cart_text()) - ), - $product); ?> -
  • diff --git a/src/post-grid/post-theme.php b/src/post-grid/post-theme.php deleted file mode 100644 index 8bc0d2a..0000000 --- a/src/post-grid/post-theme.php +++ /dev/null @@ -1,46 +0,0 @@ -post_type); -$the_id = get_the_id(); -$the_excerpt = (! empty($summary)) ? $summary : get_the_excerpt(); -$the_date_format = 'default' === $settings->date_format ? get_option('date_format') : $settings->date_format; -?> -
    itemscope - itemtype="" role="contentinfo" aria-label="article"> - - - - - -
    - -
    - -
    - -
    - - show_date) : ?> - date_format); ?> - - - ', ''); ?> - -
    - -
    - -
    - -
    From 4da191dd19ec7dd24a74c17ca8131d15f57b7387 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Wed, 3 Jun 2020 17:32:41 +0300 Subject: [PATCH 02/32] sageflbuilder container to roots/app --- src/AbstractBladeModule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AbstractBladeModule.php b/src/AbstractBladeModule.php index 5bee11a..95832ee 100644 --- a/src/AbstractBladeModule.php +++ b/src/AbstractBladeModule.php @@ -5,7 +5,7 @@ namespace Itineris\SageFLBuilder; use FLBuilderModule; -use Itineris\SageFLBuilder\SageFLBuilder; +use function Roots\app as sage; /** * Add Laravel Blade support. @@ -32,7 +32,7 @@ public static function renderFrontendTemplate(string $file, FLBuilderModule $mod } /** @var AbstractHelper $helper */ - $helper = SageFLBuilder::container(AbstractHelper::class); + $helper = sage(AbstractHelper::class); $path = $helper->templatePath($module->dir . 'includes/frontend.blade.php'); echo $helper->template($path, [ From 06ba097b663f9a6896b700b82e2f451e7d6f76c8 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Thu, 4 Jun 2020 13:32:48 +0300 Subject: [PATCH 03/32] remove richtext --- src/SageFLBuilder.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/SageFLBuilder.php b/src/SageFLBuilder.php index 86a1987..7074473 100644 --- a/src/SageFLBuilder.php +++ b/src/SageFLBuilder.php @@ -17,7 +17,6 @@ use Itineris\SageFLBuilder\Modules\SecondaryNav\SecondaryNav; use Itineris\SageFLBuilder\Modules\Table\Table; use Itineris\SageFLBuilder\Modules\Testimonial\Testimonial; -use Itineris\SageFLBuilder\Settings\RichText; use Itineris\SageFLBuilder\Settings\ThemeLayouts\ArchiveThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\DefaultThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\HomeThemeLayout; @@ -42,7 +41,6 @@ final class SageFLBuilder HomeThemeLayout::class, PageHeading::class, PageSlider::class, - RichText::class, SecondaryNav::class, SingleThemeLayout::class, Table::class, From b7959f60d23c91b9c1c420c51978c9d758ee8d79 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Mon, 8 Jun 2020 12:26:57 +0300 Subject: [PATCH 04/32] remove aliases --- src/AbstractBladeModule.php | 4 ++-- src/AbstractHelper.php | 7 +++++-- src/Modules/Accordion/Accordion.php | 4 ++-- src/Modules/Alert/Alert.php | 4 ++-- src/Modules/Breadcrumbs/Breadcrumbs.php | 4 ++-- src/Modules/Breadcrumbs/includes/frontend.php | 4 ++-- src/Modules/Button/Button.php | 6 +++--- src/Modules/Button/includes/frontend.php | 4 ++-- src/Modules/ContentImage/ContentImage.php | 4 ++-- src/Modules/FilterBar/FilterBar.php | 4 ++-- src/Modules/Gallery/Gallery.php | 4 ++-- src/Modules/GravityForm/GravityForm.php | 6 +++--- src/Modules/PageHeading/PageHeading.php | 4 ++-- src/Modules/PageSlider/PageSlider.php | 6 +++--- src/Modules/SecondaryNav/SecondaryNav.php | 4 ++-- src/Modules/SecondaryNav/includes/frontend.php | 4 ++-- src/Modules/Table/Table.php | 4 ++-- src/Modules/Testimonial/Testimonial.php | 4 ++-- src/SageFLBuilder.php | 6 +++--- src/Settings/ThemeLayouts/ThemeLayout.php | 4 ++-- src/empty.php | 1 + 21 files changed, 48 insertions(+), 44 deletions(-) diff --git a/src/AbstractBladeModule.php b/src/AbstractBladeModule.php index 95832ee..7f022ce 100644 --- a/src/AbstractBladeModule.php +++ b/src/AbstractBladeModule.php @@ -5,7 +5,7 @@ namespace Itineris\SageFLBuilder; use FLBuilderModule; -use function Roots\app as sage; +use function Roots\app; /** * Add Laravel Blade support. @@ -32,7 +32,7 @@ public static function renderFrontendTemplate(string $file, FLBuilderModule $mod } /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); $path = $helper->templatePath($module->dir . 'includes/frontend.blade.php'); echo $helper->template($path, [ diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index 8edf12d..90e2c3a 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -4,6 +4,9 @@ namespace Itineris\SageFLBuilder; +use function Roots\view; +use function Roots\asset; + abstract class AbstractHelper { /** @@ -14,7 +17,7 @@ abstract class AbstractHelper */ public function template($file, $data = []): string { - return \App\template($file, $data); + return view($file, $data); } /** @@ -37,7 +40,7 @@ public function templatePath($file, $data = []): string */ public function assetPath($asset): string { - return \App\asset_path($asset); + return asset($asset)->uri(); } public function getModuleGroup(): string diff --git a/src/Modules/Accordion/Accordion.php b/src/Modules/Accordion/Accordion.php index 0f25c13..ccbee21 100644 --- a/src/Modules/Accordion/Accordion.php +++ b/src/Modules/Accordion/Accordion.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function Roots\app as sage; +use function Roots\app; /** * Generic Bootstrap accordion widget @@ -87,7 +87,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Accordion', 'fabric'), diff --git a/src/Modules/Alert/Alert.php b/src/Modules/Alert/Alert.php index b2b7596..93f0d8e 100644 --- a/src/Modules/Alert/Alert.php +++ b/src/Modules/Alert/Alert.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; /** * Class Alert @@ -55,7 +55,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Alert', 'fabric'), diff --git a/src/Modules/Breadcrumbs/Breadcrumbs.php b/src/Modules/Breadcrumbs/Breadcrumbs.php index d2e4230..f4b20ac 100644 --- a/src/Modules/Breadcrumbs/Breadcrumbs.php +++ b/src/Modules/Breadcrumbs/Breadcrumbs.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function Roots\app as sage; +use function Roots\app; /** * Class Breadcrumbs @@ -28,7 +28,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Breadcrumbs', 'fabric'), diff --git a/src/Modules/Breadcrumbs/includes/frontend.php b/src/Modules/Breadcrumbs/includes/frontend.php index 909eea6..a6506b3 100644 --- a/src/Modules/Breadcrumbs/includes/frontend.php +++ b/src/Modules/Breadcrumbs/includes/frontend.php @@ -3,9 +3,9 @@ declare(strict_types=1); use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; /** @var AbstractHelper $helper */ -$helper = sage(AbstractHelper::class); +$helper = app(AbstractHelper::class); echo $helper->breadcrumbs(); diff --git a/src/Modules/Button/Button.php b/src/Modules/Button/Button.php index 0af5e1b..4c976c7 100644 --- a/src/Modules/Button/Button.php +++ b/src/Modules/Button/Button.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function Roots\app as sage; +use function Roots\app; /** * Generic Bootstrap button widget @@ -19,7 +19,7 @@ class Button extends AbstractModule public static function register(): void { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); FLBuilder::register_module(__CLASS__, [ 'general' => [ @@ -66,7 +66,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Button', 'fabric'), diff --git a/src/Modules/Button/includes/frontend.php b/src/Modules/Button/includes/frontend.php index 1089031..5067180 100644 --- a/src/Modules/Button/includes/frontend.php +++ b/src/Modules/Button/includes/frontend.php @@ -6,10 +6,10 @@ */ use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; /** @var AbstractHelper $helper */ -$helper = sage(AbstractHelper::class); +$helper = app(AbstractHelper::class); ?> link) && ! empty($settings->text)) : ?> diff --git a/src/Modules/ContentImage/ContentImage.php b/src/Modules/ContentImage/ContentImage.php index f99508c..aa25dec 100644 --- a/src/Modules/ContentImage/ContentImage.php +++ b/src/Modules/ContentImage/ContentImage.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; /** * Generic Bootstrap button widget @@ -39,7 +39,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Content image', 'fabric'), diff --git a/src/Modules/FilterBar/FilterBar.php b/src/Modules/FilterBar/FilterBar.php index 6374ae6..d3cd543 100644 --- a/src/Modules/FilterBar/FilterBar.php +++ b/src/Modules/FilterBar/FilterBar.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function Roots\app as sage; +use function Roots\app; /** * @class FilterBar @@ -103,7 +103,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Filter bar', 'fabric'), diff --git a/src/Modules/Gallery/Gallery.php b/src/Modules/Gallery/Gallery.php index ea3f757..1b09a6d 100644 --- a/src/Modules/Gallery/Gallery.php +++ b/src/Modules/Gallery/Gallery.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; /** * Class Gallery @@ -61,7 +61,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Gallery', 'fabric'), diff --git a/src/Modules/GravityForm/GravityForm.php b/src/Modules/GravityForm/GravityForm.php index c21cbec..ceafbf9 100644 --- a/src/Modules/GravityForm/GravityForm.php +++ b/src/Modules/GravityForm/GravityForm.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; class GravityForm extends AbstractBladeModule { @@ -18,7 +18,7 @@ class GravityForm extends AbstractBladeModule public static function register(): void { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); FLBuilder::register_module(__CLASS__, [ 'items' => [ @@ -104,7 +104,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Gravity Form', 'fabric'), diff --git a/src/Modules/PageHeading/PageHeading.php b/src/Modules/PageHeading/PageHeading.php index 0176fe0..7836e87 100644 --- a/src/Modules/PageHeading/PageHeading.php +++ b/src/Modules/PageHeading/PageHeading.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage;; +use function Roots\app; /** * @class PageHeading @@ -61,7 +61,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Page heading', 'fabric'), diff --git a/src/Modules/PageSlider/PageSlider.php b/src/Modules/PageSlider/PageSlider.php index 85b51ad..debd35b 100644 --- a/src/Modules/PageSlider/PageSlider.php +++ b/src/Modules/PageSlider/PageSlider.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function Roots\app as sage; +use function Roots\app; /** * @class PageSlider @@ -19,7 +19,7 @@ class PageSlider extends AbstractModule public static function register(): void { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); FLBuilder::register_module(__CLASS__, [ 'general' => [ @@ -207,7 +207,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Page Slider', 'fabric'), diff --git a/src/Modules/SecondaryNav/SecondaryNav.php b/src/Modules/SecondaryNav/SecondaryNav.php index a41ef9f..68c629e 100644 --- a/src/Modules/SecondaryNav/SecondaryNav.php +++ b/src/Modules/SecondaryNav/SecondaryNav.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function Roots\app as sage; +use function Roots\app; /** * Class SecondaryNav @@ -28,7 +28,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Secondary nav', 'fabric'), diff --git a/src/Modules/SecondaryNav/includes/frontend.php b/src/Modules/SecondaryNav/includes/frontend.php index 42e6ecc..f23235a 100644 --- a/src/Modules/SecondaryNav/includes/frontend.php +++ b/src/Modules/SecondaryNav/includes/frontend.php @@ -3,10 +3,10 @@ declare(strict_types=1); use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; /** @var AbstractHelper $helper */ -$helper = sage(AbstractHelper::class); +$helper = app(AbstractHelper::class); ?> diff --git a/src/Modules/Table/Table.php b/src/Modules/Table/Table.php index c36346c..cebb003 100644 --- a/src/Modules/Table/Table.php +++ b/src/Modules/Table/Table.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractHelper; use Itineris\SageFLBuilder\AbstractModule; -use function Roots\app as sage; +use function Roots\app; /** * Generic Bootstrap table widget @@ -89,7 +89,7 @@ public static function register(): void public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Table', 'fabric'), diff --git a/src/Modules/Testimonial/Testimonial.php b/src/Modules/Testimonial/Testimonial.php index 353a8bc..7d53bf9 100644 --- a/src/Modules/Testimonial/Testimonial.php +++ b/src/Modules/Testimonial/Testimonial.php @@ -7,7 +7,7 @@ use FLBuilder; use Itineris\SageFLBuilder\AbstractBladeModule; use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; /** * Generic Testimonial widget @@ -66,7 +66,7 @@ public function getCite(): string public function __construct() { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); parent::__construct([ 'name' => __('Testimonial', 'fabric'), diff --git a/src/SageFLBuilder.php b/src/SageFLBuilder.php index 7074473..b7292c2 100644 --- a/src/SageFLBuilder.php +++ b/src/SageFLBuilder.php @@ -21,7 +21,7 @@ use Itineris\SageFLBuilder\Settings\ThemeLayouts\DefaultThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\HomeThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\SingleThemeLayout; -use function Roots\app as sage; +use function Roots\app; /** * Beaver Builder extensions @@ -95,7 +95,7 @@ public function setInitializables($initializables): self public static function setDefaultModuleGroup(array $data): array { /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); // Get the name of the projects module group. $group_name = $helper->getSiteModuleGroup(); @@ -140,7 +140,7 @@ public function addFilters(): void public function init(): void { - sage()->instance(AbstractHelper::class, $this->helper); + app()->instance(AbstractHelper::class, $this->helper); foreach ($this->initializables as $initializable) { $initializable::init(); diff --git a/src/Settings/ThemeLayouts/ThemeLayout.php b/src/Settings/ThemeLayouts/ThemeLayout.php index e1a54c6..42196fc 100644 --- a/src/Settings/ThemeLayouts/ThemeLayout.php +++ b/src/Settings/ThemeLayouts/ThemeLayout.php @@ -6,7 +6,7 @@ use Closure; use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app as sage; +use function Roots\app; final class ThemeLayout { @@ -33,7 +33,7 @@ public function locateTemplatePath(string $template): string } /** @var AbstractHelper $helper */ - $helper = sage(AbstractHelper::class); + $helper = app(AbstractHelper::class); $newTemplate = $helper->locateTemplate($this->template); diff --git a/src/empty.php b/src/empty.php index 32ff58b..956650b 100644 --- a/src/empty.php +++ b/src/empty.php @@ -1,4 +1,5 @@ Date: Tue, 9 Jun 2020 14:02:07 +0300 Subject: [PATCH 05/32] get compiled --- src/AbstractHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index 90e2c3a..fca8a62 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -30,7 +30,7 @@ public function template($file, $data = []): string */ public function templatePath($file, $data = []): string { - return \App\template_path($file, $data); + return view($file, $data)->getCompiled(); } /** From 81383f6379fb1a8647789bae7be6382af6c1cfcc Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Tue, 9 Jun 2020 14:16:33 +0300 Subject: [PATCH 06/32] remove abstract functions --- src/AbstractHelper.php | 47 ------------------------ src/Modules/Button/includes/frontend.php | 2 +- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index fca8a62..1788bb8 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -79,52 +79,5 @@ abstract public function buttonStyles(): array; */ abstract public function breadcrumbs(); - /** - * Some times le wild appears, which is when you need this function, to validate both - * blue and hedgehog because sanitize_html_class doesn't allow spaces. - * - * @param mixed $classes "blue hedgehog goes shopping" or array("blue", "hedgehog", "goes", "shopping"). - * @param mixed $fallback Anything you want returned in case of a failure. - * - * @return string - */ - abstract public function sanitizeHtmlClasses($classes, $fallback = null): string; - - /** - * @param string $videoUrl - * @param bool $isElement - * @param int $size - * @param string $altText - * - * @return string|null - */ - abstract public function videoThumb($videoUrl, $isElement = false, $size = '0', string $altText = ''); - - /** - * @param string $videoUrl - * @param string $urlType - * - * @return string - */ - abstract public function formatVideoUrl($videoUrl, $urlType = 'embed'): string; - - /** - * Creates a responsive iframe and embeds a video player - * or an embed URL for the video - * - * @param string $videoUrl URL of the video. - * @param boolean $isUrl If true, returns the iframe URL, not the iframe. - * @param int $width The width of the iframe. - * @param int $height The height of the iframe. - * - * @return string|false Video embed URL or HTML for iframe embed - */ - abstract public function videoEmbed($video_url, $width = null, $height = null); - - /** - * Builds a navigation menu based on parent post, children and siblings - */ - abstract public function getSecondaryNav(); - abstract public function getGravityForms(): array; } diff --git a/src/Modules/Button/includes/frontend.php b/src/Modules/Button/includes/frontend.php index 5067180..92ce84c 100644 --- a/src/Modules/Button/includes/frontend.php +++ b/src/Modules/Button/includes/frontend.php @@ -14,6 +14,6 @@ ?> link) && ! empty($settings->text)) : ?> text); ?> From 6e405f81bf5ee9246c90f138af0c2eb15bd5376b Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 10 Jun 2020 15:20:29 +0100 Subject: [PATCH 07/32] Remove redundant packages. Min stab dev --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 33e9891..6a1424b 100644 --- a/composer.json +++ b/composer.json @@ -4,13 +4,9 @@ "license": "proprietary", "require": { "php": "^7.1", - "illuminate/support": "^5.4", "roots/acorn": "^1.0.1" }, "require-dev": { - "automattic/vipwpcs": "dev-master", - "beaver-builder/bb-plugin": "*", - "beaver-builder/bb-theme-builder": "*", "roave/security-advisories": "dev-master", "wp-coding-standards/wpcs": "^1.0" }, @@ -27,6 +23,7 @@ "Itineris\\SageFLBuilder\\": "src/" } }, + "minimum-stability": "dev", "prefer-stable": true, "scripts": { "check-style": "phpcs --standard=ruleset.xml --colors -p -s", From 42835eff089b288dff8c1240010e64da00b5feb3 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Thu, 11 Jun 2020 11:14:49 +0300 Subject: [PATCH 08/32] add ServiceProvider --- composer.json | 3 +++ src/SageFLBuilderServiceProvider.php | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/SageFLBuilderServiceProvider.php diff --git a/composer.json b/composer.json index 6a1424b..13e29b2 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,9 @@ "extra": { "branch-alias": { "dev-master": "0.11.x-dev" + }, + "acorn": { + "providers": "Itineris\\SageFLBuilder\\SageFLBuilderServiceProvider" } }, "autoload": { diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php new file mode 100644 index 0000000..9bd9c03 --- /dev/null +++ b/src/SageFLBuilderServiceProvider.php @@ -0,0 +1,19 @@ +loadViewsFrom(base_path('Plugins/FLBuilder/Modules'), 'ItinerisSageFLBuilder'); + } +} From f37c20fb0122b3ce23872ccb3c1974771e67078d Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Fri, 12 Jun 2020 17:49:25 +0300 Subject: [PATCH 09/32] sage flbuilder themer support --- src/AbstractBladeModule.php | 2 +- src/AbstractHelper.php | 57 +++++++++++++++++++++-- src/SageFLBuilder.php | 1 + src/SageFLBuilderServiceProvider.php | 8 +++- src/Settings/ThemeLayouts/ThemeLayout.php | 3 +- 5 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/AbstractBladeModule.php b/src/AbstractBladeModule.php index 7f022ce..c07818f 100644 --- a/src/AbstractBladeModule.php +++ b/src/AbstractBladeModule.php @@ -33,7 +33,7 @@ public static function renderFrontendTemplate(string $file, FLBuilderModule $mod /** @var AbstractHelper $helper */ $helper = app(AbstractHelper::class); - $path = $helper->templatePath($module->dir . 'includes/frontend.blade.php'); + $path = $module->slug . '/includes/frontend'; echo $helper->template($path, [ 'module' => $module, diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index 1788bb8..369fdfb 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -15,9 +15,11 @@ abstract class AbstractHelper * * @return string */ - public function template($file, $data = []): string + public function template(string $file, array $data = []): string { - return view($file, $data); + return view()->exists("ItinerisSageFLBuilder::{$file}") + ? view("ItinerisSageFLBuilder::{$file}", $data)->render() + : ''; } /** @@ -28,9 +30,9 @@ public function template($file, $data = []): string * * @return string */ - public function templatePath($file, $data = []): string + public function templatePath(string $file, array $data = []): string { - return view($file, $data)->getCompiled(); + return view($file, $data)->makeLoader(); } /** @@ -60,12 +62,57 @@ public function getModuleCategory(): string return __('Custom Widgets', 'fabric'); } + /** + * @param string|string[] $templates Possible template files. + * @return array + */ + public function filter_templates($templates) + { + $paths = apply_filters('sage/filter_templates/paths', [ + 'views', + 'resources/views' + ]); + $paths_pattern = '#^(' . implode('|', $paths) . ')/#'; + + return collect($templates) + ->map(function ($template) use ($paths_pattern) { + /** Remove .blade.php/.blade/.php from template names */ + $template = preg_replace('#\.(blade\.?)?(php)?$#', '', ltrim($template)); + + /** Remove partial $paths from the beginning of template names */ + if (strpos($template, '/')) { + $template = preg_replace($paths_pattern, '', $template); + } + + return $template; + }) + ->flatMap(function ($template) use ($paths) { + return collect($paths) + ->flatMap(function ($path) use ($template) { + return [ + "{$path}/{$template}.blade.php", + "{$path}/{$template}.php", + ]; + }) + ->concat([ + "{$template}.blade.php", + "{$template}.php", + ]); + }) + ->filter() + ->unique() + ->all(); + } + /** * @param string|string[] $templates Relative path to possible template files. * * @return string Location of the template */ - abstract public function locateTemplate($templates): string; + public function locateTemplate($templates): string + { + return \locate_template($this->filter_templates($templates)); + } /** * Button Styles usable in the cutup diff --git a/src/SageFLBuilder.php b/src/SageFLBuilder.php index b7292c2..409fe71 100644 --- a/src/SageFLBuilder.php +++ b/src/SageFLBuilder.php @@ -21,6 +21,7 @@ use Itineris\SageFLBuilder\Settings\ThemeLayouts\DefaultThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\HomeThemeLayout; use Itineris\SageFLBuilder\Settings\ThemeLayouts\SingleThemeLayout; + use function Roots\app; /** diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php index 9bd9c03..b7006f3 100644 --- a/src/SageFLBuilderServiceProvider.php +++ b/src/SageFLBuilderServiceProvider.php @@ -3,6 +3,7 @@ namespace Itineris\SageFLBuilder; use Roots\Acorn\ServiceProvider; + use function Roots\base_path; class SageFLBuilderServiceProvider extends ServiceProvider @@ -12,8 +13,11 @@ class SageFLBuilderServiceProvider extends ServiceProvider * * @return void */ - public function boot() + public function boot(): void { - $this->loadViewsFrom(base_path('Plugins/FLBuilder/Modules'), 'ItinerisSageFLBuilder'); + $this->loadViewsFrom( + base_path('app/Plugins/FLBuilder/Modules'), + 'ItinerisSageFLBuilder' + ); } } diff --git a/src/Settings/ThemeLayouts/ThemeLayout.php b/src/Settings/ThemeLayouts/ThemeLayout.php index 42196fc..8dcdf1a 100644 --- a/src/Settings/ThemeLayouts/ThemeLayout.php +++ b/src/Settings/ThemeLayouts/ThemeLayout.php @@ -6,6 +6,7 @@ use Closure; use Itineris\SageFLBuilder\AbstractHelper; + use function Roots\app; final class ThemeLayout @@ -41,6 +42,6 @@ public function locateTemplatePath(string $template): string return $template; } - return $helper->templatePath($newTemplate); + return $helper->templatePath($this->template); } } From 543ac812375110636071d4b7ba907f4f4d8ec267 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Fri, 12 Jun 2020 18:19:36 +0300 Subject: [PATCH 10/32] remove redundant functions --- src/AbstractHelper.php | 65 ----------------------- src/Settings/ThemeLayouts/ThemeLayout.php | 18 ++----- 2 files changed, 5 insertions(+), 78 deletions(-) diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index 369fdfb..76ac458 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -22,19 +22,6 @@ public function template(string $file, array $data = []): string : ''; } - /** - * Retrieve path to a compiled blade view - * - * @param $file - * @param array $data - * - * @return string - */ - public function templatePath(string $file, array $data = []): string - { - return view($file, $data)->makeLoader(); - } - /** * @param $asset * @@ -62,58 +49,6 @@ public function getModuleCategory(): string return __('Custom Widgets', 'fabric'); } - /** - * @param string|string[] $templates Possible template files. - * @return array - */ - public function filter_templates($templates) - { - $paths = apply_filters('sage/filter_templates/paths', [ - 'views', - 'resources/views' - ]); - $paths_pattern = '#^(' . implode('|', $paths) . ')/#'; - - return collect($templates) - ->map(function ($template) use ($paths_pattern) { - /** Remove .blade.php/.blade/.php from template names */ - $template = preg_replace('#\.(blade\.?)?(php)?$#', '', ltrim($template)); - - /** Remove partial $paths from the beginning of template names */ - if (strpos($template, '/')) { - $template = preg_replace($paths_pattern, '', $template); - } - - return $template; - }) - ->flatMap(function ($template) use ($paths) { - return collect($paths) - ->flatMap(function ($path) use ($template) { - return [ - "{$path}/{$template}.blade.php", - "{$path}/{$template}.php", - ]; - }) - ->concat([ - "{$template}.blade.php", - "{$template}.php", - ]); - }) - ->filter() - ->unique() - ->all(); - } - - /** - * @param string|string[] $templates Relative path to possible template files. - * - * @return string Location of the template - */ - public function locateTemplate($templates): string - { - return \locate_template($this->filter_templates($templates)); - } - /** * Button Styles usable in the cutup * diff --git a/src/Settings/ThemeLayouts/ThemeLayout.php b/src/Settings/ThemeLayouts/ThemeLayout.php index 8dcdf1a..356e75c 100644 --- a/src/Settings/ThemeLayouts/ThemeLayout.php +++ b/src/Settings/ThemeLayouts/ThemeLayout.php @@ -5,9 +5,8 @@ namespace Itineris\SageFLBuilder\Settings\ThemeLayouts; use Closure; -use Itineris\SageFLBuilder\AbstractHelper; -use function Roots\app; +use function Roots\view; final class ThemeLayout { @@ -29,19 +28,12 @@ public function __construct(Closure $shouldInclude, string $template) public function locateTemplatePath(string $template): string { - if (! ($this->shouldInclude)()) { + if (!($this->shouldInclude)()) { return $template; } - /** @var AbstractHelper $helper */ - $helper = app(AbstractHelper::class); - - $newTemplate = $helper->locateTemplate($this->template); - - if (empty($newTemplate)) { - return $template; - } - - return $helper->templatePath($this->template); + return view()->exists($this->template) + ? view($this->template)->makeLoader() + : $template; } } From 6b52721f9cbbd541a270ecfeed92053f369041b2 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Mon, 15 Jun 2020 10:17:39 +0300 Subject: [PATCH 11/32] add layout --- src/AbstractBladeModule.php | 2 +- src/SageFLBuilderServiceProvider.php | 7 ++++++- src/Settings/ThemeLayouts/ThemeLayout.php | 8 ++++++-- src/Views/fl-builder-archive.blade.php | 13 ++++++++++++ src/Views/fl-builder-single.blade.php | 13 ++++++++++++ src/Views/layouts/archive.blade.php | 25 +++++++++++++++++++++++ 6 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/Views/fl-builder-archive.blade.php create mode 100644 src/Views/fl-builder-single.blade.php create mode 100644 src/Views/layouts/archive.blade.php diff --git a/src/AbstractBladeModule.php b/src/AbstractBladeModule.php index c07818f..34e499e 100644 --- a/src/AbstractBladeModule.php +++ b/src/AbstractBladeModule.php @@ -33,7 +33,7 @@ public static function renderFrontendTemplate(string $file, FLBuilderModule $mod /** @var AbstractHelper $helper */ $helper = app(AbstractHelper::class); - $path = $module->slug . '/includes/frontend'; + $path = $module->slug . 'includes/frontend'; echo $helper->template($path, [ 'module' => $module, diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php index b7006f3..08a9d3a 100644 --- a/src/SageFLBuilderServiceProvider.php +++ b/src/SageFLBuilderServiceProvider.php @@ -16,8 +16,13 @@ class SageFLBuilderServiceProvider extends ServiceProvider public function boot(): void { $this->loadViewsFrom( - base_path('app/Plugins/FLBuilder/Modules'), + base_path('app/Plugins/FLBuilder/Modules/'), 'ItinerisSageFLBuilder' ); + + $this->loadViewsFrom( + __DIR__ . '/Views/', + 'ItinerisSageFLBuilderViews' + ); } } diff --git a/src/Settings/ThemeLayouts/ThemeLayout.php b/src/Settings/ThemeLayouts/ThemeLayout.php index 356e75c..d1ffbcb 100644 --- a/src/Settings/ThemeLayouts/ThemeLayout.php +++ b/src/Settings/ThemeLayouts/ThemeLayout.php @@ -28,12 +28,16 @@ public function __construct(Closure $shouldInclude, string $template) public function locateTemplatePath(string $template): string { - if (!($this->shouldInclude)()) { + if (! ($this->shouldInclude)()) { return $template; } return view()->exists($this->template) ? view($this->template)->makeLoader() - : $template; + : ( + view()->exists("ItinerisSageFLBuilderViews::{$this->template}") + ? view("ItinerisSageFLBuilderViews::{$this->template}")->makeLoader() + : $template + ); } } diff --git a/src/Views/fl-builder-archive.blade.php b/src/Views/fl-builder-archive.blade.php new file mode 100644 index 0000000..31dba83 --- /dev/null +++ b/src/Views/fl-builder-archive.blade.php @@ -0,0 +1,13 @@ +@extends("ItinerisSageFLBuilderViews::layouts.archive") + +@section('content') + @php + $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); + if ( 'fl-theme-layout' == get_post_type() && count( $ids ) > 1 ) { + $post_id = FLBuilderModel::get_post_id(); + } else { + $post_id = $ids[0]; + } + FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); + @endphp +@endsection diff --git a/src/Views/fl-builder-single.blade.php b/src/Views/fl-builder-single.blade.php new file mode 100644 index 0000000..31dba83 --- /dev/null +++ b/src/Views/fl-builder-single.blade.php @@ -0,0 +1,13 @@ +@extends("ItinerisSageFLBuilderViews::layouts.archive") + +@section('content') + @php + $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); + if ( 'fl-theme-layout' == get_post_type() && count( $ids ) > 1 ) { + $post_id = FLBuilderModel::get_post_id(); + } else { + $post_id = $ids[0]; + } + FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); + @endphp +@endsection diff --git a/src/Views/layouts/archive.blade.php b/src/Views/layouts/archive.blade.php new file mode 100644 index 0000000..4b00d35 --- /dev/null +++ b/src/Views/layouts/archive.blade.php @@ -0,0 +1,25 @@ + + + + + + + @php wp_head(); @endphp + + + + @php + wp_body_open(); + do_action('get_header'); + @endphp + +
    + @include('layouts.app') +
    + + @php + do_action('get_footer'); + wp_footer(); + @endphp + + From 73177639d465a11c0f1dcef99cba3bc820ddc11c Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Mon, 15 Jun 2020 10:52:40 +0300 Subject: [PATCH 12/32] change views dir --- {src/Views => resources/views}/fl-builder-archive.blade.php | 0 {src/Views => resources/views}/fl-builder-single.blade.php | 0 {src/Views => resources/views}/layouts/archive.blade.php | 0 src/AbstractBladeModule.php | 2 +- src/SageFLBuilderServiceProvider.php | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename {src/Views => resources/views}/fl-builder-archive.blade.php (100%) rename {src/Views => resources/views}/fl-builder-single.blade.php (100%) rename {src/Views => resources/views}/layouts/archive.blade.php (100%) diff --git a/src/Views/fl-builder-archive.blade.php b/resources/views/fl-builder-archive.blade.php similarity index 100% rename from src/Views/fl-builder-archive.blade.php rename to resources/views/fl-builder-archive.blade.php diff --git a/src/Views/fl-builder-single.blade.php b/resources/views/fl-builder-single.blade.php similarity index 100% rename from src/Views/fl-builder-single.blade.php rename to resources/views/fl-builder-single.blade.php diff --git a/src/Views/layouts/archive.blade.php b/resources/views/layouts/archive.blade.php similarity index 100% rename from src/Views/layouts/archive.blade.php rename to resources/views/layouts/archive.blade.php diff --git a/src/AbstractBladeModule.php b/src/AbstractBladeModule.php index 34e499e..c07818f 100644 --- a/src/AbstractBladeModule.php +++ b/src/AbstractBladeModule.php @@ -33,7 +33,7 @@ public static function renderFrontendTemplate(string $file, FLBuilderModule $mod /** @var AbstractHelper $helper */ $helper = app(AbstractHelper::class); - $path = $module->slug . 'includes/frontend'; + $path = $module->slug . '/includes/frontend'; echo $helper->template($path, [ 'module' => $module, diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php index 08a9d3a..079179b 100644 --- a/src/SageFLBuilderServiceProvider.php +++ b/src/SageFLBuilderServiceProvider.php @@ -21,7 +21,7 @@ public function boot(): void ); $this->loadViewsFrom( - __DIR__ . '/Views/', + __DIR__ . '/../resources/views/', 'ItinerisSageFLBuilderViews' ); } From fe18cd9c09aee2331c7f94415349cec10ad5764b Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Mon, 15 Jun 2020 13:03:49 +0300 Subject: [PATCH 13/32] changes --- resources/views/fl-builder-archive.blade.php | 18 ++++++++++-------- resources/views/fl-builder-single.blade.php | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/resources/views/fl-builder-archive.blade.php b/resources/views/fl-builder-archive.blade.php index 31dba83..976c520 100644 --- a/resources/views/fl-builder-archive.blade.php +++ b/resources/views/fl-builder-archive.blade.php @@ -2,12 +2,14 @@ @section('content') @php - $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); - if ( 'fl-theme-layout' == get_post_type() && count( $ids ) > 1 ) { - $post_id = FLBuilderModel::get_post_id(); - } else { - $post_id = $ids[0]; - } - FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); + $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); + + if ('fl-theme-layout' === get_post_type() && count($ids) > 1) { + $post_id = FLBuilderModel::get_post_id(); + } else { + $post_id = $ids[0] ?? get_the_ID(); + } + + FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp -@endsection +@endsection \ No newline at end of file diff --git a/resources/views/fl-builder-single.blade.php b/resources/views/fl-builder-single.blade.php index 31dba83..976c520 100644 --- a/resources/views/fl-builder-single.blade.php +++ b/resources/views/fl-builder-single.blade.php @@ -2,12 +2,14 @@ @section('content') @php - $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); - if ( 'fl-theme-layout' == get_post_type() && count( $ids ) > 1 ) { - $post_id = FLBuilderModel::get_post_id(); - } else { - $post_id = $ids[0]; - } - FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); + $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); + + if ('fl-theme-layout' === get_post_type() && count($ids) > 1) { + $post_id = FLBuilderModel::get_post_id(); + } else { + $post_id = $ids[0] ?? get_the_ID(); + } + + FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp -@endsection +@endsection \ No newline at end of file From 1a194d5cd230b3fb769dcf14cb21878a8fa69eb3 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Tue, 16 Jun 2020 10:22:37 +0300 Subject: [PATCH 14/32] double quotes to single quotes --- resources/views/fl-builder-archive.blade.php | 4 ++-- resources/views/fl-builder-single.blade.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/fl-builder-archive.blade.php b/resources/views/fl-builder-archive.blade.php index 976c520..4f82164 100644 --- a/resources/views/fl-builder-archive.blade.php +++ b/resources/views/fl-builder-archive.blade.php @@ -1,4 +1,4 @@ -@extends("ItinerisSageFLBuilderViews::layouts.archive") +@extends('ItinerisSageFLBuilderViews::layouts.archive') @section('content') @php @@ -12,4 +12,4 @@ FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/fl-builder-single.blade.php b/resources/views/fl-builder-single.blade.php index 976c520..4f82164 100644 --- a/resources/views/fl-builder-single.blade.php +++ b/resources/views/fl-builder-single.blade.php @@ -1,4 +1,4 @@ -@extends("ItinerisSageFLBuilderViews::layouts.archive") +@extends('ItinerisSageFLBuilderViews::layouts.archive') @section('content') @php @@ -12,4 +12,4 @@ FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp -@endsection \ No newline at end of file +@endsection From af30e1b445302d5d11e188d930d9a87408d57d83 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 15:02:40 +0100 Subject: [PATCH 15/32] cr php:^7.4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 13e29b2..d9822db 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "x", "license": "proprietary", "require": { - "php": "^7.1", + "php": "^7.4", "roots/acorn": "^1.0.1" }, "require-dev": { From 4657bd72e5598efaa80adc7c35e8d79e1c2a236d Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 15:03:46 +0100 Subject: [PATCH 16/32] Pass data to templates and type properties --- src/Settings/ThemeLayouts/ThemeLayout.php | 36 ++++++++++++++++------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/Settings/ThemeLayouts/ThemeLayout.php b/src/Settings/ThemeLayouts/ThemeLayout.php index d1ffbcb..3186b75 100644 --- a/src/Settings/ThemeLayouts/ThemeLayout.php +++ b/src/Settings/ThemeLayouts/ThemeLayout.php @@ -5,6 +5,8 @@ namespace Itineris\SageFLBuilder\Settings\ThemeLayouts; use Closure; +use FLBuilderModel; +use FLThemeBuilderLayoutData; use function Roots\view; @@ -13,17 +15,17 @@ final class ThemeLayout /** * @var Closure */ - private $shouldInclude; + private Closure $shouldInclude; /** * @var string */ - private $template; + private string $template; public function __construct(Closure $shouldInclude, string $template) { $this->shouldInclude = $shouldInclude; - $this->template = $template; + $this->template = $template; } public function locateTemplatePath(string $template): string @@ -32,12 +34,26 @@ public function locateTemplatePath(string $template): string return $template; } - return view()->exists($this->template) - ? view($this->template)->makeLoader() - : ( - view()->exists("ItinerisSageFLBuilderViews::{$this->template}") - ? view("ItinerisSageFLBuilderViews::{$this->template}")->makeLoader() - : $template - ); + $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); + + if ('fl-theme-layout' === get_post_type() && count($ids) > 1) { + $post_id = FLBuilderModel::get_post_id(); + } else { + $post_id = $ids[0] ?? get_the_ID(); + } + + $data = [ + 'post_id' => $post_id, + ]; + + if (view()->exists($this->template)) { + return view($this->template, $data)->makeLoader(); + } + + if (view()->exists("ItinerisSageFLBuilderViews::{$this->template}")) { + return view("ItinerisSageFLBuilderViews::{$this->template}", $data)->makeLoader(); + } + + return $template; } } From ad04af1f0320bbf2187e2ab8b6b98e6d329341fd Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 15:03:58 +0100 Subject: [PATCH 17/32] Cleanup templates --- resources/views/fl-builder-archive.blade.php | 12 +----------- resources/views/fl-builder-single.blade.php | 12 +----------- resources/views/layouts/archive.blade.php | 14 +++++--------- 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/resources/views/fl-builder-archive.blade.php b/resources/views/fl-builder-archive.blade.php index 4f82164..c1297e0 100644 --- a/resources/views/fl-builder-archive.blade.php +++ b/resources/views/fl-builder-archive.blade.php @@ -1,15 +1,5 @@ @extends('ItinerisSageFLBuilderViews::layouts.archive') @section('content') - @php - $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); - - if ('fl-theme-layout' === get_post_type() && count($ids) > 1) { - $post_id = FLBuilderModel::get_post_id(); - } else { - $post_id = $ids[0] ?? get_the_ID(); - } - - FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); - @endphp + @php FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp @endsection diff --git a/resources/views/fl-builder-single.blade.php b/resources/views/fl-builder-single.blade.php index 4f82164..c1297e0 100644 --- a/resources/views/fl-builder-single.blade.php +++ b/resources/views/fl-builder-single.blade.php @@ -1,15 +1,5 @@ @extends('ItinerisSageFLBuilderViews::layouts.archive') @section('content') - @php - $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); - - if ('fl-theme-layout' === get_post_type() && count($ids) > 1) { - $post_id = FLBuilderModel::get_post_id(); - } else { - $post_id = $ids[0] ?? get_the_ID(); - } - - FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); - @endphp + @php FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp @endsection diff --git a/resources/views/layouts/archive.blade.php b/resources/views/layouts/archive.blade.php index 4b00d35..58bb8d6 100644 --- a/resources/views/layouts/archive.blade.php +++ b/resources/views/layouts/archive.blade.php @@ -8,18 +8,14 @@ - @php - wp_body_open(); - do_action('get_header'); - @endphp + @php wp_body_open(); @endphp + @php do_action('get_header'); @endphp -
    +
    @include('layouts.app')
    - @php - do_action('get_footer'); - wp_footer(); - @endphp + @php do_action('get_footer'); @endphp + @php wp_footer(); @endphp From 4990ec9eb2eb0859583e004a4346390620f6bd7a Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 15:06:24 +0100 Subject: [PATCH 18/32] Don't ignore resources directory --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 425d5cd..086e5d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,5 +6,6 @@ # Export white-listed production code only. /src -export-ignore +/resources /composer.json -export-ignore /README.md -export-ignore From a702eb1998bf8519842248209c7fd57a094d37a8 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 16:00:12 +0100 Subject: [PATCH 19/32] Use a View Composer to pass data to views --- src/SageFLBuilderServiceProvider.php | 8 +++- src/Settings/ThemeLayouts/ThemeLayout.php | 20 ++-------- src/View/Composers/FLBuilder.php | 47 +++++++++++++++++++++++ 3 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 src/View/Composers/FLBuilder.php diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php index 079179b..7e30c34 100644 --- a/src/SageFLBuilderServiceProvider.php +++ b/src/SageFLBuilderServiceProvider.php @@ -2,6 +2,8 @@ namespace Itineris\SageFLBuilder; +use Illuminate\Support\Facades\View; +use Itineris\SageFLBuilder\View\Composers\FLBuilder; use Roots\Acorn\ServiceProvider; use function Roots\base_path; @@ -17,12 +19,14 @@ public function boot(): void { $this->loadViewsFrom( base_path('app/Plugins/FLBuilder/Modules/'), - 'ItinerisSageFLBuilder' + 'Sage' ); $this->loadViewsFrom( __DIR__ . '/../resources/views/', - 'ItinerisSageFLBuilderViews' + 'ItinerisSageFLBuilder' ); + + View::composer(FLBuilder::views(), FLBuilder::class); } } diff --git a/src/Settings/ThemeLayouts/ThemeLayout.php b/src/Settings/ThemeLayouts/ThemeLayout.php index 3186b75..ca8a838 100644 --- a/src/Settings/ThemeLayouts/ThemeLayout.php +++ b/src/Settings/ThemeLayouts/ThemeLayout.php @@ -5,8 +5,6 @@ namespace Itineris\SageFLBuilder\Settings\ThemeLayouts; use Closure; -use FLBuilderModel; -use FLThemeBuilderLayoutData; use function Roots\view; @@ -34,24 +32,12 @@ public function locateTemplatePath(string $template): string return $template; } - $ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); - - if ('fl-theme-layout' === get_post_type() && count($ids) > 1) { - $post_id = FLBuilderModel::get_post_id(); - } else { - $post_id = $ids[0] ?? get_the_ID(); - } - - $data = [ - 'post_id' => $post_id, - ]; - if (view()->exists($this->template)) { - return view($this->template, $data)->makeLoader(); + return view($this->template)->makeLoader(); } - if (view()->exists("ItinerisSageFLBuilderViews::{$this->template}")) { - return view("ItinerisSageFLBuilderViews::{$this->template}", $data)->makeLoader(); + if (view()->exists("ItinerisSageFLBuilder::{$this->template}")) { + return view("ItinerisSageFLBuilder::{$this->template}")->makeLoader(); } return $template; diff --git a/src/View/Composers/FLBuilder.php b/src/View/Composers/FLBuilder.php new file mode 100644 index 0000000..55e0ba9 --- /dev/null +++ b/src/View/Composers/FLBuilder.php @@ -0,0 +1,47 @@ + 1) { + return $post_id = FLBuilderModel::get_post_id(); + } + + return $ids[0] ?? get_the_ID(); + } + + /** + * Data to be passed to view before rendering. + * + * @return array + */ + public function with(): array + { + return [ + 'post_id' => $this->getPostId(), + ]; + } +} From 0e4def94ff5f58ef1033330cdc1b82d858452535 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 16:00:26 +0100 Subject: [PATCH 20/32] Rename view namespaces --- resources/views/fl-builder-archive.blade.php | 2 +- resources/views/fl-builder-single.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/fl-builder-archive.blade.php b/resources/views/fl-builder-archive.blade.php index c1297e0..9aa1614 100644 --- a/resources/views/fl-builder-archive.blade.php +++ b/resources/views/fl-builder-archive.blade.php @@ -1,4 +1,4 @@ -@extends('ItinerisSageFLBuilderViews::layouts.archive') +@extends('ItinerisSageFLBuilder::layouts.archive') @section('content') @php FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp diff --git a/resources/views/fl-builder-single.blade.php b/resources/views/fl-builder-single.blade.php index c1297e0..9aa1614 100644 --- a/resources/views/fl-builder-single.blade.php +++ b/resources/views/fl-builder-single.blade.php @@ -1,4 +1,4 @@ -@extends('ItinerisSageFLBuilderViews::layouts.archive') +@extends('ItinerisSageFLBuilder::layouts.archive') @section('content') @php FLBuilder::render_content_by_id($post_id, 'div', apply_filters('fl_theme_builder_content_attrs', [])); @endphp From a76421b74e43b79e461b7fe70951b3740e4a9d80 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 16:19:17 +0100 Subject: [PATCH 21/32] Cast string IDs to int --- src/SageFLBuilderServiceProvider.php | 2 ++ src/View/Composers/FLBuilder.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php index 7e30c34..eeb311b 100644 --- a/src/SageFLBuilderServiceProvider.php +++ b/src/SageFLBuilderServiceProvider.php @@ -1,5 +1,7 @@ 1) { - return $post_id = FLBuilderModel::get_post_id(); + return FLBuilderModel::get_post_id(); } return $ids[0] ?? get_the_ID(); From 362fb41543c80630f48bcdfaa5c25e668288a52e Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 28 Jul 2020 17:52:33 +0100 Subject: [PATCH 22/32] Fix not loading theme namespace --- src/AbstractHelper.php | 4 ++-- src/SageFLBuilderServiceProvider.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index 76ac458..6b6bd4c 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -17,8 +17,8 @@ abstract class AbstractHelper */ public function template(string $file, array $data = []): string { - return view()->exists("ItinerisSageFLBuilder::{$file}") - ? view("ItinerisSageFLBuilder::{$file}", $data)->render() + return view()->exists("Theme::{$file}") + ? view("Theme::{$file}", $data)->render() : ''; } diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php index eeb311b..cd8fa6c 100644 --- a/src/SageFLBuilderServiceProvider.php +++ b/src/SageFLBuilderServiceProvider.php @@ -21,7 +21,7 @@ public function boot(): void { $this->loadViewsFrom( base_path('app/Plugins/FLBuilder/Modules/'), - 'Sage' + 'Theme' ); $this->loadViewsFrom( From f484236ddde79a07346b14dd95950befd5b67b12 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Fri, 31 Jul 2020 13:08:00 +0100 Subject: [PATCH 23/32] export-ignore --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 086e5d5..3cfd4ad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,6 +6,6 @@ # Export white-listed production code only. /src -export-ignore -/resources +/resources -export-ignore /composer.json -export-ignore /README.md -export-ignore From 9cee7599e7fcce97e6dc2343a3110dae8a952e81 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Sun, 2 Aug 2020 09:49:54 +0100 Subject: [PATCH 24/32] Allow filtering Post ID passed to template --- src/View/Composers/FLBuilder.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/View/Composers/FLBuilder.php b/src/View/Composers/FLBuilder.php index 3f2c2a0..bdba9b9 100644 --- a/src/View/Composers/FLBuilder.php +++ b/src/View/Composers/FLBuilder.php @@ -27,10 +27,12 @@ protected function getPostId(): int $ids = array_map('absint', FLThemeBuilderLayoutData::get_current_page_content_ids()); if ('fl-theme-layout' === get_post_type() && count($ids) > 1) { - return FLBuilderModel::get_post_id(); + $id = FLBuilderModel::get_post_id(); + } else { + $id = $ids[0] ?? get_the_ID(); } - return $ids[0] ?? get_the_ID(); + return apply_filters('itineris/sage-flbuilder/themer-layout-id', absint($id)); } /** From 295a86fd88722f55e88051b2a80b0590f26037cd Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Wed, 18 Nov 2020 12:22:08 +0200 Subject: [PATCH 25/32] array --- src/View/Composers/FLBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/View/Composers/FLBuilder.php b/src/View/Composers/FLBuilder.php index bdba9b9..438470e 100644 --- a/src/View/Composers/FLBuilder.php +++ b/src/View/Composers/FLBuilder.php @@ -15,7 +15,7 @@ class FLBuilder extends Composer * * @var array */ - protected static $views = [ + protected static array $views = [ 'fl-builder-archive', 'fl-builder-single', 'ItinerisSageFLBuilder::fl-builder-archive', From 7d061fe61432e61db443776a3ba9b96dd8be2957 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Wed, 18 Nov 2020 13:55:26 +0200 Subject: [PATCH 26/32] remove array #view --- src/View/Composers/FLBuilder.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/View/Composers/FLBuilder.php b/src/View/Composers/FLBuilder.php index 438470e..b917a59 100644 --- a/src/View/Composers/FLBuilder.php +++ b/src/View/Composers/FLBuilder.php @@ -12,10 +12,8 @@ class FLBuilder extends Composer { /** * List of views served by this composer. - * - * @var array */ - protected static array $views = [ + protected static $views = [ 'fl-builder-archive', 'fl-builder-single', 'ItinerisSageFLBuilder::fl-builder-archive', From d8bf8f3b1e0925666b2028f8ea9b8552f3d36736 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Thu, 17 Dec 2020 10:20:57 +0200 Subject: [PATCH 27/32] loading view from the sage-flbuilder Modules directory --- src/AbstractHelper.php | 10 ++++++++-- src/SageFLBuilderServiceProvider.php | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/AbstractHelper.php b/src/AbstractHelper.php index 6b6bd4c..bd35f3c 100644 --- a/src/AbstractHelper.php +++ b/src/AbstractHelper.php @@ -17,8 +17,14 @@ abstract class AbstractHelper */ public function template(string $file, array $data = []): string { - return view()->exists("Theme::{$file}") - ? view("Theme::{$file}", $data)->render() + $file_path = "Theme::{$file}"; + + if ($this->getModuleGroup() === $data['module']->group) { + $file_path = "ItinerisSageFLBuilderModules::{$file}"; + } + + return view()->exists($file_path) + ? view($file_path, $data)->render() : ''; } diff --git a/src/SageFLBuilderServiceProvider.php b/src/SageFLBuilderServiceProvider.php index cd8fa6c..1bdcca8 100644 --- a/src/SageFLBuilderServiceProvider.php +++ b/src/SageFLBuilderServiceProvider.php @@ -29,6 +29,11 @@ public function boot(): void 'ItinerisSageFLBuilder' ); + $this->loadViewsFrom( + __DIR__ . '/Modules/', + 'ItinerisSageFLBuilderModules' + ); + View::composer(FLBuilder::views(), FLBuilder::class); } } From afdb9ca3987a526001584593259e75a687d03b92 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Sun, 4 Jul 2021 12:51:29 +0100 Subject: [PATCH 28/32] cr roots/acorn:2.0.0-alpha.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d9822db..26ee81c 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "proprietary", "require": { "php": "^7.4", - "roots/acorn": "^1.0.1" + "roots/acorn": "2.0.0-alpha.0" }, "require-dev": { "roave/security-advisories": "dev-master", From 125c40e808c2074457abc7db8226d03d25f6c892 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 7 Dec 2022 10:01:25 +0000 Subject: [PATCH 29/32] cr 'php:^7.4 || ^8.0' --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 26ee81c..f76573a 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "x", "license": "proprietary", "require": { - "php": "^7.4", + "php": "^7.4 || ^8.0", "roots/acorn": "2.0.0-alpha.0" }, "require-dev": { From a916360aa2207b9ea4a219b81fbb5eb577ff0b08 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 7 Dec 2022 10:02:52 +0000 Subject: [PATCH 30/32] cr roots/acorn --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f76573a..87a1087 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "proprietary", "require": { "php": "^7.4 || ^8.0", - "roots/acorn": "2.0.0-alpha.0" + "roots/acorn": "^2.1" }, "require-dev": { "roave/security-advisories": "dev-master", From 2d63750ac1f8bc98b715cb0de438a85756be9594 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 7 Dec 2022 10:17:18 +0000 Subject: [PATCH 31/32] roots/acorn is a bedrock dependency --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 87a1087..3bc3f23 100644 --- a/composer.json +++ b/composer.json @@ -3,8 +3,7 @@ "description": "x", "license": "proprietary", "require": { - "php": "^7.4 || ^8.0", - "roots/acorn": "^2.1" + "php": "^7.4 || ^8.0" }, "require-dev": { "roave/security-advisories": "dev-master", From bea2d6f62b2736358bb5424bdfd1c2f5167211ef Mon Sep 17 00:00:00 2001 From: codepuncher Date: Tue, 20 Dec 2022 19:20:47 +0000 Subject: [PATCH 32/32] cr php:^8.1 -W --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3bc3f23..f0165cc 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "x", "license": "proprietary", "require": { - "php": "^7.4 || ^8.0" + "php": "^8.1" }, "require-dev": { "roave/security-advisories": "dev-master",