PHP Classes

File: mod.pimg.php

Recommend this page to a friend!
  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: 11 years ago
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!');
    }
}
?>

For more information send a message to info at phpclasses dot org.