HEX
Server: nginx/1.22.1
System: Linux VM-4-16-centos 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User: www (1001)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: /www/wwwroot/wen.haoynn.cn/wp-content/plugins/easy-image-collage/helpers/addon_loader.php
<?php

class EIC_Addon_Loader {

	public function __construct()
	{
	}

	/**
	 * Loop all addons in the provided directory
	 */
	public function load_addons( $dir )
	{
		if( !is_dir( $dir ) ) {
			return;
		}

		$contents = scandir( $dir );

		foreach( $contents as $content ) {
			if( $content != '.' && $content != '..' ) {
				$this->load_addon( $dir, $content );
			}
		}
	}

	/**
	 * Include an addon, addon itself should handle initialization
	 */
	public function load_addon( $dir, $addon )
	{
		$dir = rtrim( $dir, '/' );
		$file = $dir . '/' . $addon . '/' . $addon . '.php';

		if( is_file( $file ) ) {
			include_once( $file );
		}
	}
}