HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/ideasforum.kaunokolegija.lt/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 );
		}
	}
}