Class PhpThumb

Description

PhpThumb Object

This singleton object is essentially a function library that helps with core validation and loading of the core classes and plugins. There isn't really any need to access it directly, unless you're developing a plugin and need to take advantage of any of the functionality contained within.

If you're not familiar with singleton patterns, here's how you get an instance of this class (since you can't create one via the new keyword):

  1. $pt PhpThumb::getInstance();

It's that simple! Outside of that, there's no need to modify anything within this class, unless you're doing some crazy customization... then knock yourself out! :)

Located in /legacy/PhpThumb.inc.php (line 45)


	
			
Variable Summary
Method Summary
static PhpThumb getInstance ()
array getPluginRegistry (string $implementation)
bool isValidImplementation (string $implementation)
void loadPlugins (string $pluginPath)
bool registerPlugin (string $pluginName, string $implementation)
Variables
static object PhpThumb $_instance (line 52)

Instance of self

  • access: protected
array $_implementations (line 72)

What implementations are available

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

  • access: protected
array $_registry (line 63)

The plugin registry

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

  • access: protected
Methods
static method getInstance (line 81)

Returns an instance of self

This is the usual singleton function that returns / instantiates the object

  • access: public
static PhpThumb getInstance ()
getPluginRegistry (line 233)

Returns the plugin registry for the supplied implementation

  • access: public
array getPluginRegistry (string $implementation)
  • string $implementation
isValidImplementation (line 140)

Returns whether or not $implementation is valid (available)

If 'all' is passed, true is only returned if ALL implementations are available.

You can also pass 'n/a', which always returns true

  • access: public
bool isValidImplementation (string $implementation)
  • string $implementation
loadPlugins (line 205)

Loads all the plugins in $pluginPath

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.

  • access: public
void loadPlugins (string $pluginPath)
  • string $pluginPath
registerPlugin (line 186)

Registers a plugin in the registry

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

  • access: public
bool registerPlugin (string $pluginName, string $implementation)
  • string $pluginName
  • string $implementation

Documentation generated on Tue, 09 Aug 2011 09:05:34 +0200 by phpDocumentor 1.4.3