Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Load routes by app
givanz8a8e9f4231bd
diff --git a/config/admin-menu.php b/config/admin-menu.phpindex 15d210c..6ba4ca0 100755--- a/config/admin-menu.php+++ b/config/admin-menu.php@@ -937,6 +937,13 @@ return'module' => 'settings/email','action' => 'index',],+ 'rest' => [+ 'name' => __('Rest Api'),+ 'icon' => 'la la-database',+ 'url' => $admin_path . '?module=settings/email',+ 'module' => 'settings/email',+ 'action' => 'index',+ ],],],],diff --git a/config/routes.php b/config/app-routes.phpold mode 100755new mode 100644similarity index 75%rename from config/routes.phprename to config/app-routes.phpindex 68e187c..b93e477--- a/config/routes.php+++ b/config/app-routes.php@@ -57,6 +57,9 @@ return ['/user/wishlist/add/#product_id#' => ['module' => 'user/wishlist/add'],'/user/wishlist/remove/#product_id#' => ['module' => 'user/wishlist/remove'],+ //user digital assets+ '/user/downloads/download/{customer_order_id}-{key}-{public}-#digital_asset_id#' => ['module' => 'user/downloads/download'],+'/user' => ['module' => 'user/index'],//search@@ -65,11 +68,6 @@ return ['/search/{search}/#page#' => ['module' => 'search'],'/search/{search}/{type}/#page#' => ['module' => 'search'],- //rest api- '/rest/' => ['module' => 'rest'],- '/rest/{method}' => ['module' => 'rest'],- '/rest/{method}/{id}' => ['module' => 'rest'],-//ecommerce//catalog@@ -86,7 +84,8 @@ return ['/vendor/{slug}/#page#' => ['module' => 'product/vendor/index'],'/vendor' => ['module' => 'product/vendor/index'],'/vendor/#page#' => ['module' => 'product/vendor/index'],- '/product/{slug}' => ['module' => 'product/product/index', 'edit'=>'?module=product/product&slug={slug}'],+ //'/product/{slug}' => ['module' => 'product/product/index', 'edit'=>'?module=product/product&slug={slug}'],+ '/product/{slug}-#product_id#' => ['module' => 'product/product/index', 'edit'=>'?module=product/product&product_id={product_id}'],//compare'/cart/compare' => ['module' => 'cart/compare/index'],@@ -94,15 +93,15 @@ return ['/cart/compare/remove/#product_id#' => ['module' => 'cart/compare/remove'],//multi language catalog - language code must be at least 2 characters- '/{language{2,5}}/shop' => ['module' => 'product/index'],- '/{language{2,5}}/shop/#page#' => ['module' => 'product/index'],- '/{language{2,5}}/shop/{slug}' => ['module' => 'product/category/index'],- '/{language{2,5}}/shop/{slug}/#page#' => ['module' => 'product/category/index'],- '/{language{2,5}}/shop/{slug}/#page#/filters-{filters}' => ['module' => 'product/category/index'],- '/{language{2,5}}/manufacturer/{slug}' => ['module' => 'product/manufacturer/index'],- '/{language{2,5}}/vendor/{slug}' => ['module' => 'product/vendor/index'],- '/{language{2,5}}/vendor/{slug}/#page#' => ['module' => 'product/vendor/index'],- '/{language{2,5}}/product/{slug}' => ['module' => 'product/product/index', 'edit'=>'?module=product/product&slug={slug}'],+ '/{language{2,5}}/shop' => ['module' => 'product/index'],+ '/{language{2,5}}/shop/#page#' => ['module' => 'product/index'],+ '/{language{2,5}}/shop/{slug}' => ['module' => 'product/category/index'],+ '/{language{2,5}}/shop/{slug}/#page#' => ['module' => 'product/category/index'],+ '/{language{2,5}}/shop/{slug}/#page#/filters-{filters}' => ['module' => 'product/category/index'],+ '/{language{2,5}}/manufacturer/{slug}' => ['module' => 'product/manufacturer/index'],+ '/{language{2,5}}/vendor/{slug}' => ['module' => 'product/vendor/index'],+ '/{language{2,5}}/vendor/{slug}/#page#' => ['module' => 'product/vendor/index'],+ '/{language{2,5}}/product/{slug}-#product_id#' => ['module' => 'product/product/index', 'edit'=>'?module=product/product&product_id={product_id}'],//checkout'/cart' => ['module' => 'cart/cart/index'],@@ -142,21 +141,23 @@ return [//post//'/#year{4,4}#-#month{1,2}#-#day#/{slug}' => ['module' => 'content/post/index', 'edit'=>'?module=content/post&slug={slug}'],- '/{slug}' => ['module' => 'content/post/index', 'edit'=>'?module=content/post&slug={slug}&type=post'],+ //'/{slug}' => ['module' => 'content/post/index', 'edit'=>'?module=content/post&slug={slug}&type=post'],+ '/{slug}-#post_id#' => ['module' => 'content/post/index', 'edit'=>'?module=content/post&post_id={post_id}&type=post'],//page//'/{slug}' => ['module' => 'content/page/index', 'edit'=>'?module=content/post&slug={slug}'],- '/page/{slug}' => ['module' => 'content/page/index', 'edit'=>'?module=content/post&slug={slug}&type=page'],+ //'/page/{slug}' => ['module' => 'content/page/index', 'edit'=>'?module=content/post&slug={slug}&type=page'],+ '/page/{slug}-#post_id#' => ['module' => 'content/page/index', 'edit'=>'?module=content/post&post_id={post_id}&type=page'],//multi language content - language code must be at least 2 characters'/{language{2,5}}/' => ['module' => 'index/index'],//pagination for blog posts'/{language{2,5}}/p/#page#' => ['module' => 'index/index'],//content- '/{language{2,5}}/blog' => ['module' => 'content'],- '/{language{2,5}}/cat/{slug}' => ['module' => 'content/category/language'],- '/{language{2,5}}/tag/{slug}' => ['module' => 'content/tag/index'],- '/{language{2,5}}/{slug}' => ['module' => 'content/post/index', 'edit'=>'?module=content/post&slug={slug}'],- '/{language{2,5}}/page/{slug}' => ['module' => 'content/page/index', 'edit'=>'?module=content/post&slug={slug}'],+ '/{language{2,5}}/blog' => ['module' => 'content'],+ '/{language{2,5}}/cat/{slug}' => ['module' => 'content/category/language'],+ '/{language{2,5}}/tag/{slug}' => ['module' => 'content/tag/index'],+ '/{language{2,5}}/{slug}-#post_id#' => ['module' => 'content/post/index', 'edit'=>'?module=content/post&post_id={post_id}'],+ '/{language{2,5}}/page/{slug}-#post_id#' => ['module' => 'content/page/index', 'edit'=>'?module=content/post&post_id={post_id}'],'/{language{2,5}}/tag/{slug}' => ['module' => 'content/tag/index'],'/{language{2,5}}/tag/{slug}/#page#' => ['module' => 'content/tag/index'],diff --git a/config/rest-routes.php b/config/rest-routes.phpnew file mode 100644index 0000000..4c160b6--- /dev/null+++ b/config/rest-routes.php@@ -0,0 +1,104 @@+<?php++/**+ * Vvveb+ *+ * Copyright (C) 2022 Ziadin Givan+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++return [+ '/rest/' => ['module' => 'index'],++ //posts+ '/rest/posts' => ['module' => 'posts'],+ '/rest/posts/#post_id#' => ['module' => 'posts/post/index'],+ '/rest/posts/{slug}' => ['module' => 'posts/post/index'],+ //revisions+ '/rest/posts/#post_id#/revisions' => ['module' => 'posts/revisions/index'],+ '/rest/posts/#post_id#/revisions/{created_at}' => ['module' => 'posts/revision/index'],+ //pages++ //comments+ '/rest/posts/#post_id#/comments' => ['module' => 'posts/comments/index'],+ '/rest/posts/#post_id#/comments/{created_at}' => ['module' => 'posts/comment/index'],++ //media+ '/rest/media' => ['module' => 'media'],+ '/rest/media/{file}' => ['module' => 'media/media/index'],++ //menus+ '/rest/menus' => ['module' => 'menus'],+ '/rest/menus/{menu_id}' => ['module' => 'menus/v/index'],+ //menu-items+ '/rest/menu-items' => ['module' => 'menu-items'],+ '/rest/menu-items/{menu_id}' => ['module' => 'menu-items/menu-items/index'],++ //taxonomies+ '/rest/taxonomies' => ['module' => 'taxonomies'],+ '/rest/taxonomies/{menu_id}' => ['module' => 'taxonomies/taxonomies/index'],+ //tags+ //categories++ //users+ '/rest/users' => ['module' => 'users'],+ '/rest/users/#user_id#' => ['module' => 'users/user/index'],++ //search+ '/rest/search' => ['module' => 'search'],++ //settings+ '/rest/settings' => ['module' => 'settings'],++ //themes+ '/rest/themes' => ['module' => 'settings'],+ '/rest/themes/{slug}' => ['module' => 'themes/themes/index'],++ //plugins+ '/rest/plugins' => ['module' => 'plugins'],+ '/rest/plugins/{slug}' => ['module' => 'plugins/plugins/index'],++ //languages++ //ecommerce++ //products+ '/rest/products' => ['module' => 'products'],+ '/rest/products/#product_id#' => ['module' => 'products/product/index'],+ '/rest/products/{slug}' => ['module' => 'products/products/index'],++ //product attributes+ //product reviews+ //product questions+ //taxonomies+ //tags+ //categories++ //orders+ //coupons+ //tax rates+ //tax classes+ //tax types+ //returns+ //zones+ //countries+ //currencies++ //payment methods+ //shipping methods++ //stats+];diff --git a/config/sites.php b/config/sites.phpindex ff36c1a..7220cb9 100755--- a/config/sites.php+++ b/config/sites.php@@ -28,5 +28,6 @@'state' => 'live','template' => '','id' => 1,+ 'site_id' => 1,],];diff --git a/system/routes.php b/system/routes.phpindex bcb5b09..1eac0fd 100755--- a/system/routes.php+++ b/system/routes.php@@ -37,7 +37,7 @@ class Routes {private static $routes = [];- private static $urls = null;+ private static $urls = [];private static $modules = null;@@ -102,8 +102,8 @@ class Routes {}}- public static function init() {- self :: $routes += include DIR_ROOT . '/config/routes.php';+ public static function init($app = 'app') {+ self :: $routes += include DIR_ROOT . "/config/$app-routes.php";list(self :: $routes) = Event::trigger(__CLASS__, __FUNCTION__ , self :: $routes);foreach (self :: $routes as $url => $data) {