Login   Register  
PHP Classes
elePHPant
Icontem

File: mod.pimg.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tony Bogdanov  >  PIMG  >  mod.pimg.php  >  Download  
File: mod.pimg.php
Role: Class source
Content type: text/plain
Description: Helper class for loading user modules
Class: PIMG
Process images using multiple operations
Author: By
Last change:
Date: 2010-09-12 13:52
Size: 1,018 bytes
 

Contents

Class file image Download
<?php
/* Core module for loading user created extensions / modules */
class pimg_mod
{
    
/* Resources */
    
private $pimg;
    
    
// PIMG constructor
    
function __construct($pimg)
    {
        
$this -> pimg $pimg;
    }
    
    
    
    
/*
        User module loader helper
        @return: pimg_mod instance
    */
    
public function init()
    {
        return 
$this;
    }
    
    
    
    
/* LOADING MODULES */
    
public function __call($mod$args)
    {
        
// Check if the module exists
        
$mod basename($mod);
        
$modFile dirname(__FILE__) . '/mods/' $mod '.pimg.php';
        
$mod 'pimg_mod_' $mod;
        if (
file_exists($modFile))
        {
            
// Load the module and return an instance
            
require_once($modFile);
            if (!
class_exists($mod))
                exit(
'PIMG user module <b>' $mod '</b> does not exist or cannot be loaded!');
            else {
                
$mod = new $mod($this -> pimg);
                return 
call_user_func_array(array($mod'init'), $args);
            }
        } else
            exit(
'PIMG user module <b>' $mod '</b> does not exist or cannot be loaded!');
    }
}
?>