PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.2.1
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.2.1
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
templately / includes / Core / Module.php

Module.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! 3.2.1, at includes/Core/Module.php

42 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Templately\Core;
3
4 use Templately\Utils\Base;
5 use function is_subclass_of;
6
7 class Module extends Base {
8 private $modules = [];
9
10 public function active( $module, $type = 'Platform' ){
11 $_type = \strtolower( $type );
12 if( array_key_exists( $_type, $this->modules ) &&
13 array_key_exists( $module, $this->modules[ $_type ] ) &&
14 is_subclass_of( $this->modules[ $_type ][ $module ]->object, __NAMESPACE__ . '\\' . $type ) ) {
15 return $this->modules[ $_type ][ $module ]->object;
16 }
17
18 return null;
19 }
20
21 public function add( $module, $type = 'Platform' ){
22 $_type = \strtolower( $type );
23 if( ! array_key_exists( $_type, $this->modules) ) {
24 $this->modules[ $_type ] = [];
25 }
26
27 if( isset( $module->id ) ) {
28 $this->modules[ $_type ][ $module->id ] = $module;
29 } else {
30 $this->modules[ $_type ][] = $module;
31 }
32 }
33
34 public function get( $type = 'Platform' ){
35 $_type = \strtolower( $type );
36 if( array_key_exists( $_type, $this->modules ) ) {
37 return $this->modules[ $_type ];
38 }
39
40 return [];
41 }
42 }