PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.3
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.3
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / app / Hooks / filters.php

filters.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.3, at app/Hooks/filters.php

93 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2 <?php
3
4 use FluentCart\Framework\Database\Orm\Builder;
5 use FluentCart\Framework\Foundation\Application;
6
7 use FluentCart\App\Services\Payments\SubscriptionHelper;
8 use FluentCart\Framework\Support\Arr;
9
10 /**
11 * All registered filter's handlers should be in app\Hooks\Handlers,
12 * addFilter is similar to add_filter and addCustomFlter is just a
13 * wrapper over add_filter which will add a prefix to the hook name
14 * using the plugin slug to make it unique in all wordpress plugins,
15 * ex: $app->addCustomFilter('foo', ['FooHandler', 'handleFoo']) is
16 * equivalent to add_filter('slug-foo', ['FooHandler', 'handleFoo']).
17 */
18
19 /**
20 *
21 * @var Application $app
22 */
23
24
25 add_filter('block_categories_all', function ($categories) {
26 $categories[] = array(
27 'slug' => 'fluent-cart',
28 'title' => __('FluentCart', 'fluent-cart'),
29 );
30
31 $categories[] = array(
32 'slug' => 'fluent-cart-buttons',
33 'title' => __('FluentCart Buttons', 'fluent-cart'),
34 );
35
36 return $categories;
37 });
38
39 add_filter('fluent_cart/dummy_product_info', function ($info) {
40 $infos = [
41 'mens-shoes' => [
42 'title' => __("Men’s Shoes", 'fluent-cart'),
43 'count' => "0",
44 'category' => 'mens-shoes',
45 'icon' => 'RunningShoe'
46 ],
47
48 'menswear' => [
49 'title' => __("Menswear", 'fluent-cart'),
50 'count' => "0",
51 'category' => 'menswear',
52 'icon' => 'Cloth'
53 ],
54
55 'AdvancedVariations' => [
56 'title' => __("Advanced Variations", 'fluent-cart'),
57 'count' => "0",
58 'category' => 'AdvancedVariations',
59 'icon' => 'Palette'
60 ],
61 // 'clothing' => [
62 // 'title' => __("Clothing's", 'fluent-cart'),
63 // 'count' => "0",
64 // 'category' => 'clothing'
65 // ],
66 // 'food' => [
67 // 'title' => __("Food", 'fluent-cart'),
68 // 'count' => "0",
69 // 'category' => 'food'
70 // ],
71 // 'electronics' => [
72 // 'title' => __('Electronics', 'fluent-cart'),
73 // 'count' => "0",
74 // 'category' => 'electronics'
75 // ]
76 ];
77
78 foreach ($infos as $key => $info) {
79 $filePath = FLUENTCART_PLUGIN_PATH . 'dummies' . DIRECTORY_SEPARATOR . $key . '.json';
80 if (file_exists($filePath)) {
81 try {
82 $json = file_get_contents($filePath);
83 $products = json_decode($json, true);
84 $infos[$key]['count'] = count($products);
85 } catch (\Exception $exception) {
86
87 }
88 }
89
90 }
91
92 return $infos;
93 });