PHP Classes
Icontem

File: classes/Extensions.class.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marius Zadara  >  ExifSort  >  classes/Extensions.class.php  
File: classes/Extensions.class.php
Role: Class source
Content type: text/plain
Description: Extensions
Class: ExifSort
Read EXIF information from picture files
 

Contents

Class file image Download
<?php

/**
 * Class used to work with the PHP modules.
 * This class cannot be extended anymore.
 * 
 * @final 
 */
final class Extensions
{
    
/**
     * private member to hold the PHP loaded extensions
     *
     * @var array
     */
    
private $loadedExtensions;    
    
    
/**
     * Constructor
     * Used to load the PHP extensions into the private member
     *
     * @return Extensions
     */
    
public function Extensions()
    {
        
// load into the private member the PHP loaded extensions
        
$this->loadedExtensions get_loaded_extensions();
    }

    
/**
     * This function is used to find out if an extension has been loaded.
     * If not, try to load it at runtime.
     *
     * @param string $extension 
     * @return boolean TRUE if the extension has been loaded
     * @return boolean FALSE if the extension is not available/could not be loaded
     * @throws ExifNotFound Exception
     */
    
public function isLoaded($extension)
    {
        
// if the extension has not been loaded, 
        // try to load it at runtime
        
if (!extension_loaded($extension) && !@dl($extension))
        {
            
// throw the exception
            
throw new ExifNotFound("The EXIF module could not be loaded !");
            
            
// althought the script will not reach this point in case of exception throwing, 
            // for the sake of the return, put the false value 
            
return false;
        }
        else
        {
            
// either the module is already loaded or has been loading at runtime, 
            // return true
            
return true;
        }        
    }
}


?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products