PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / 1.4.1
Starter Sites & Templates by Neve v1.4.1
1.4.1 1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / vendor / codeinwp / themeisle-sdk / src / Common / Module_factory.php
templates-patterns-collection / vendor / codeinwp / themeisle-sdk / src / Common Last commit date
Abstract_module.php 1 month ago Module_factory.php 5 years ago
Module_factory.php
109 lines
1 <?php
2 /**
3 * The module factory class.
4 *
5 * @package ThemeIsleSDK
6 * @subpackage Loader
7 * @copyright Copyright (c) 2017, Marius Cristea
8 * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9 * @since 3.0.0
10 */
11
12 namespace ThemeisleSDK\Common;
13
14 use ThemeisleSDK\Product;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 /**
21 * Class Job_Factory
22 *
23 * @package ThemeisleSDK\Common
24 */
25 class Module_Factory {
26 /**
27 * Partners slugs.
28 *
29 * @var array $SLUGS Partners product slugs.
30 */
31 public static $slugs = [
32 'zermatt' => true,
33 'neto' => true,
34 'olsen' => true,
35 'benson' => true,
36 'romero' => true,
37 'carmack' => true,
38 'puzzle' => true,
39 'broadsheet' => true,
40 'girlywp' => true,
41 'veggie' => true,
42 'zeko' => true,
43 'maishawp' => true,
44 'didi' => true,
45 'liber' => true,
46 'medicpress-pt' => true,
47 'adrenaline-pt' => true,
48 'consultpress-pt' => true,
49 'legalpress-pt' => true,
50 'gympress-pt' => true,
51 'readable-pt' => true,
52 'bolts-pt' => true,
53 ];
54 /**
55 * Partners domains.
56 *
57 * @var array $DOMAINS Partners domains.
58 */
59 public static $domains = [
60 'proteusthemes.com',
61 'anarieldesign.com',
62 'prothemedesign.com',
63 'cssigniter.com',
64 ];
65 /**
66 * Map which contains all the modules loaded for each product.
67 *
68 * @var array Mapping array.
69 */
70 private static $modules_attached = [];
71
72 /**
73 * Load availabe modules for the selected product.
74 *
75 * @param Product $product Loaded product.
76 * @param array $modules List of modules.
77 */
78 public static function attach( $product, $modules ) {
79
80 if ( ! isset( self::$modules_attached[ $product->get_slug() ] ) ) {
81 self::$modules_attached[ $product->get_slug() ] = [];
82 }
83
84 foreach ( $modules as $module ) {
85 $class = 'ThemeisleSDK\\Modules\\' . ucwords( $module, '_' );
86 /**
87 * Module object.
88 *
89 * @var Abstract_Module $module_object Module instance.
90 */
91 $module_object = new $class( $product );
92
93 if ( ! $module_object->can_load( $product ) ) {
94 continue;
95 }
96 self::$modules_attached[ $product->get_slug() ][ $module ] = $module_object->load( $product );
97 }
98 }
99
100 /**
101 * Products/Modules loaded map.
102 *
103 * @return array Modules map.
104 */
105 public static function get_modules_map() {
106 return self::$modules_attached;
107 }
108 }
109