PHP Class PhpThumb, thinksns

This is the GD Implementation of the PHP Thumb library.
Show file Open project: medz/thinksns-4 Class Usage Examples

Protected Properties

Property Type Description
$_implementations array This stores what implementations are available based on the loaded extensions in PHP, NOT whether or not the class files are present.
$_instance Instance of self
$_registry array This is where all plugins to be loaded are stored. Data about the plugin is provided, and currently consists of: - loaded: true/false - implementation: gd/imagick/both

Public Methods

Method Description
getInstance ( ) : PhpThumb Returns an instance of self
getPluginRegistry ( string $implementation ) : array Returns the plugin registry for the supplied implementation
isValidImplementation ( string $implementation ) : boolean Returns whether or not $implementation is valid (available)
loadPlugins ( string $pluginPath ) Loads all the plugins in $pluginPath
registerPlugin ( string $pluginName, string $implementation ) : boolean Registers a plugin in the registry

Private Methods

Method Description
__construct ( ) Class constructor
getImplementations ( ) Finds out what implementations are available

Method Details

getInstance() public static method

This is the usual singleton function that returns / instantiates the object
public static getInstance ( ) : PhpThumb
return PhpThumb

getPluginRegistry() public method

Returns the plugin registry for the supplied implementation
public getPluginRegistry ( string $implementation ) : array
$implementation string
return array

isValidImplementation() public method

If 'all' is passed, true is only returned if ALL implementations are available. You can also pass 'n/a', which always returns true
public isValidImplementation ( string $implementation ) : boolean
$implementation string
return boolean

loadPlugins() public method

All this function does is include all files inside the $pluginPath directory. The plugins themselves will not be added to the registry unless you've properly added the code to do so inside your plugin file.
public loadPlugins ( string $pluginPath )
$pluginPath string

registerPlugin() public method

Adds a plugin to the registry if it isn't already loaded, and if the provided implementation is valid. Note that you can pass the following special keywords for implementation: - all - Requires that all implementations be available - n/a - Doesn't require any implementation When a plugin is added to the registry, it's added as a key on $this->_registry with the value being an array containing the following keys: - loaded - whether or not the plugin has been "loaded" into the core class - implementation - what implementation this plugin is valid for
public registerPlugin ( string $pluginName, string $implementation ) : boolean
$pluginName string
$implementation string
return boolean

Property Details

$_implementations protected property

This stores what implementations are available based on the loaded extensions in PHP, NOT whether or not the class files are present.
protected array $_implementations
return array

$_instance protected static property

Instance of self
protected static $_instance

$_registry protected property

This is where all plugins to be loaded are stored. Data about the plugin is provided, and currently consists of: - loaded: true/false - implementation: gd/imagick/both
protected array $_registry
return array