diff --git a/composer.json b/composer.json index 71bfd0d..df663ad 100644 --- a/composer.json +++ b/composer.json @@ -26,13 +26,13 @@ }, "require": { "newfold-labs/wp-module-installer": "^1.1", - "newfold-labs/wp-module-patterns": "^2.0", + "newfold-labs/wp-module-patterns": "^2.4", "newfold-labs/wp-module-ai": "^1.1", "wp-forge/wp-upgrade-handler": "^1.0", "mustache/mustache": "^2.14", - "newfold-labs/wp-module-data": "^2.0", + "newfold-labs/wp-module-data": "^2.6", "newfold-labs/wp-module-coming-soon": "^1.2", - "newfold-labs/wp-module-performance": "^1.4", + "newfold-labs/wp-module-performance": "^2.0", "newfold-labs/wp-module-install-checker": "^1.0", "newfold-labs/wp-module-survey": "^1.0" }, diff --git a/composer.lock b/composer.lock index 2631af1..c64785d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2d41d466ff3bc1d1e41ba66ccf71bf00", + "content-hash": "0a9f8fb749a3f28acf8597c3525fa01b", "packages": [ { "name": "doctrine/inflector", @@ -192,16 +192,16 @@ }, { "name": "newfold-labs/wp-module-ai", - "version": "1.1.11", + "version": "1.1.12", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-ai.git", - "reference": "523fe373a723b2336e3043cbcaeac058734ed761" + "reference": "3836a576e83e068b53de1d850bcb60aac471656d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-ai/zipball/523fe373a723b2336e3043cbcaeac058734ed761", - "reference": "523fe373a723b2336e3043cbcaeac058734ed761", + "url": "https://api.github.com/repos/newfold-labs/wp-module-ai/zipball/3836a576e83e068b53de1d850bcb60aac471656d", + "reference": "3836a576e83e068b53de1d850bcb60aac471656d", "shasum": "" }, "require": { @@ -231,10 +231,10 @@ ], "description": "A module for providing artificial intelligence capabilities.", "support": { - "source": "https://github.com/newfold-labs/wp-module-ai/tree/1.1.11", + "source": "https://github.com/newfold-labs/wp-module-ai/tree/1.1.12", "issues": "https://github.com/newfold-labs/wp-module-ai/issues" }, - "time": "2024-08-28T15:18:10+00:00" + "time": "2024-09-19T07:47:50+00:00" }, { "name": "newfold-labs/wp-module-coming-soon", @@ -682,23 +682,27 @@ }, { "name": "newfold-labs/wp-module-performance", - "version": "1.4.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-performance.git", - "reference": "5e4c87d404788c61ea55e3c62e29e5df48c36340" + "reference": "ed7db2ce699d1ab6c61db28080b4f13f8511cc0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-performance/zipball/5e4c87d404788c61ea55e3c62e29e5df48c36340", - "reference": "5e4c87d404788c61ea55e3c62e29e5df48c36340", + "url": "https://api.github.com/repos/newfold-labs/wp-module-performance/zipball/ed7db2ce699d1ab6c61db28080b4f13f8511cc0d", + "reference": "ed7db2ce699d1ab6c61db28080b4f13f8511cc0d", "shasum": "" }, "require": { "newfold-labs/wp-module-context": "^1.0", - "wp-forge/collection": "^1.0", + "newfold-labs/wp-module-features": "^1.3", + "wp-forge/collection": "^1.0.2", "wp-forge/wp-htaccess-manager": "^1.0", - "wpscholar/url": "^1.2" + "wpscholar/url": "^1.2.2" + }, + "require-dev": { + "newfold-labs/wp-php-standards": "^1.2.3" }, "type": "library", "autoload": { @@ -706,6 +710,7 @@ "NewfoldLabs\\WP\\Module\\Performance\\": "includes" }, "files": [ + "includes/PerformanceFeature.php", "includes/functions.php", "bootstrap.php" ] @@ -721,10 +726,10 @@ ], "description": "A module for managing caching functionality.", "support": { - "source": "https://github.com/newfold-labs/wp-module-performance/tree/1.4.1", + "source": "https://github.com/newfold-labs/wp-module-performance/tree/2.0.1", "issues": "https://github.com/newfold-labs/wp-module-performance/issues" }, - "time": "2024-04-22T22:30:42+00:00" + "time": "2024-08-15T22:17:47+00:00" }, { "name": "newfold-labs/wp-module-survey", @@ -1835,16 +1840,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { @@ -1911,27 +1916,93 @@ "type": "open_collective" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-09-18T10:38:58+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-24T14:02:46+00:00" }, { "name": "symfony/finder", - "version": "v7.1.4", + "version": "v5.4.43", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823" + "reference": "ae25a9145a900764158d439653d5630191155ca0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d95bbf319f7d052082fb7af147e0f835a695e823", - "reference": "d95bbf319f7d052082fb7af147e0f835a695e823", + "url": "https://api.github.com/repos/symfony/finder/zipball/ae25a9145a900764158d439653d5630191155ca0", + "reference": "ae25a9145a900764158d439653d5630191155ca0", "shasum": "" }, "require": { - "php": ">=8.2" - }, - "require-dev": { - "symfony/filesystem": "^6.4|^7.0" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -1959,7 +2030,87 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.4" + "source": "https://github.com/symfony/finder/tree/v5.4.43" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-08-13T14:03:51+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -1975,7 +2126,7 @@ "type": "tidelift" } ], - "time": "2024-08-13T14:28:19+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "wp-cli/i18n-command", @@ -2304,5 +2455,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/includes/Options.php b/includes/Options.php index b554f07..0d631a0 100644 --- a/includes/Options.php +++ b/includes/Options.php @@ -57,6 +57,8 @@ final class Options { 'filter_active_plugins' => 'filter_active_plugins', 'sitegen_regenerated_homepages' => 'sitegen_regenerated_homepages', 'status' => 'status', + 'wc_shop_page_id' => 'woocommerce_shop_page_id', + 'wc_queue_flush_rewrite_rules' => 'woocommerce_queue_flush_rewrite_rules', ); /** diff --git a/includes/Services/SiteGenService.php b/includes/Services/SiteGenService.php index abeeba6..a28234b 100644 --- a/includes/Services/SiteGenService.php +++ b/includes/Services/SiteGenService.php @@ -948,10 +948,12 @@ public static function publish_sitemap_pages( $site_description, $content_style, ), $slug ); - if ( $update_nav_menu && ! is_wp_error( $post_id ) ) { $navigation_links_grammar .= self::get_nav_link_grammar_from_post_data( $post_id, $page['title'], get_permalink( $post_id ) ); } + if ( ! is_wp_error( $post_id ) && self::is_products_or_shop_page( $page['slug'] ) ) { + self::set_woo_shop_page( $post_id ); + } } if ( $update_nav_menu ) { @@ -977,6 +979,32 @@ public static function publish_sitemap_pages( $site_description, $content_style, return true; } + /** + * Checks if it is a products or shop slug + * + * @param string $slug Slug of the page being generated. + * @return boolean + */ + public static function is_products_or_shop_page( $slug ) { + $product_page_slug = array( + 'products' => true, + 'shop' => true, + ); + return array_key_exists( $slug, $product_page_slug ); + } + + /** + * Sets the products page generated by AI to woocommerce shop page + * + * @param integer $page_id Id of the page + */ + public static function set_woo_shop_page( $page_id ) { + $option_shop_page_id = Options::get_option_name( 'wc_shop_page_id', false ); + $option_wc_queue_flush_rewrite_rules = Options::get_option_name( 'wc_queue_flush_rewrite_rules', false ); + update_option( $option_shop_page_id, $page_id ); + update_option( $option_wc_queue_flush_rewrite_rules, 'yes' ); + } + /** * Trash the "Sample Page" generated for all new sites. *