PluginProbe
WP Ultimate Post Grid / 2.3
WP Ultimate Post Grid v2.3
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / helpers / addon_loader.php

addon_loader.php in WP Ultimate Post Grid 2.3, at helpers/addon_loader.php

39 lines 795 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class WPUPG_Addon_Loader {
4
5 public function __construct()
6 {
7 }
8
9 /**
10 * Loop all addons in the provided directory
11 */
12 public function load_addons( $dir )
13 {
14 if( !is_dir( $dir ) ) {
15 return;
16 }
17
18 $contents = scandir( $dir );
19
20 foreach( $contents as $content ) {
21 if( $content != '.' && $content != '..' ) {
22 $this->load_addon( $dir, $content );
23 }
24 }
25 }
26
27 /**
28 * Include an addon, addon itself should handle initialization
29 */
30 public function load_addon( $dir, $addon )
31 {
32 $dir = rtrim( $dir, '/' );
33 $file = $dir . '/' . $addon . '/' . $addon . '.php';
34
35 if( is_file( $file ) ) {
36 include_once( $file );
37 }
38 }
39 }