phpDocumentor GalleryCore
Classes
[ class tree: GalleryCore ] [ index: GalleryCore ] [ all elements ]

Class: GalleryPlugin

Source Location: /modules/core/classes/GalleryPlugin.class

Class GalleryPlugin

Direct descendents
Child Class Description
GalleryModule This is a container for information about a module.
GalleryTheme This interface provides functionality so user-interfaces have a customizable theme. A theme should implement this class.
PluginTestPlugin

[ Top ]
Property Summary
string   $_description   The description of this plugin
string   $_id   The id of this plugin
string   $_l10Domain   The localization domain for this plugin
string   $_name   The name of this plugin
array   $_requiredCoreApi   The version of the Core API required by this plugin
string   $_version   The version of this plugin

[ Top ]
Method Summary
array   activate()   Activate this plugin
array   deactivate()   Deactivate this plugin.
array   fetchParameters()   Fetch all plugin specific parameters for the given item. The results will contain a mixture of global parameters and item specific parameters, where the item specific ones ones override the global ones.
void   getDescription()  
void   getId()  
void   getL10Domain()  
void   getName()  
array   getParameter()   Convenience method to get a plugin parameter
void   getPluginType()  
void   getRequiredCoreApi()  
void   getVersion()  
GalleryStatus   installOrUpgrade()   Perform the plugin installation or upgrade, whatever is required.
array   isActive()   Is this plugin active?
array   reactivate()   Reactivate this plugin. The plugin is already active, so call deactivate() and then activate(). Perform the deactivation without sending an event because the activation will immediately follow and we don't want other plugins to sense this deactivation and deactivate themselves. If the plugin isn't currently active, don't do anything.
GalleryStatus   removeParameter()   Convenience method to remove a plugin parameter
void   setDescription()  
void   setId()  
void   setName()  
GalleryStatus   setParameter()   Convenience method to set a plugin parameter
void   setRequiredCoreApi()  
void   setVersion()  
string   translate()   Localize the given content.
GalleryStatus   uninstall()   Remove this plugin's parameters
GalleryStatus   upgrade()   Perform any upgrade tasks required at this point. This method is called
void   _flushPluginCache()   Flush plugin-related caches.
GalleryStatus   _postDeactivationEvent()   Post a deactivation event for this plugin. Used by deactivate and reactivate.

[ Top ]
Properties
string   $_description [line 58]

The description of this plugin

API Tags:
Access:  private


[ Top ]
string   $_id [line 44]

The id of this plugin

API Tags:
Access:  private


[ Top ]
string   $_l10Domain [line 79]

The localization domain for this plugin

API Tags:
Access:  private


[ Top ]
string   $_name [line 51]

The name of this plugin

API Tags:
Access:  private


[ Top ]
array   $_requiredCoreApi [line 72]

The version of the Core API required by this plugin

API Tags:
Access:  private


[ Top ]
string   $_version [line 65]

The version of this plugin

API Tags:
Access:  private


[ Top ]
Methods
activate  [line 156]

  array activate( [boolean $postActivationEvent = true]  )

Activate this plugin

Parameters:
boolean   $postActivationEvent:  (optional) should we post an activation event? Normally true, but the upgrader may choose to suppress this event so that it can reactivate a module without causing a ripple effect.

API Tags:
Return:  GalleryStatus a status code array redirect info for error page (empty for success)


Redefined in descendants as:

[ Top ]
deactivate  [line 234]

  array deactivate( [bool $postDeactivationEvent = true]  )

Deactivate this plugin.

Note that modules and themes should not override this method to do anything critical. Modules and themes can be forcibly deactivated during the upgrade process and it's important that this doesn't leave the app in a broken state.

Parameters:
bool   $postDeactivationEvent:  (optional) should we post a deactivation event? Normally true, but the upgrader may choose to suppress this event so that it can reactivate a module without causing a ripple effect.

API Tags:
Return:  GalleryStatus a status code array redirect info for error page (empty for success)


Redefined in descendants as:

[ Top ]
fetchParameters  [line 567]

  array fetchParameters( [int $itemId = null]  )

Fetch all plugin specific parameters for the given item. The results will contain a mixture of global parameters and item specific parameters, where the item specific ones ones override the global ones.

Parameters:
int   $itemId:  (optional)

API Tags:
Return:  GalleryStatus a status code array parameters in key => value form


[ Top ]
getDescription  [line 627]

  void getDescription( )



[ Top ]
getId  [line 611]

  void getId( )



[ Top ]
getL10Domain  [line 639]

  void getL10Domain( )



[ Top ]
getName  [line 619]

  void getName( )



[ Top ]
getParameter  [line 513]

  array getParameter( string $parameterName, [int $itemId = 0]  )

Convenience method to get a plugin parameter

Parameters:
string   $parameterName: 
int   $itemId:  (optional)

API Tags:
Return:  GalleryStatus a status code mixed value


[ Top ]
getPluginType  [line 654]

  void getPluginType( )


API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
getRequiredCoreApi  [line 647]

  void getRequiredCoreApi( )



[ Top ]
getVersion  [line 635]

  void getVersion( )



[ Top ]
installOrUpgrade  [line 394]

  GalleryStatus installOrUpgrade( )

Perform the plugin installation or upgrade, whatever is required.

Plugins should not need to override this method. Instead they should override the upgrade method and put all their plugin specific logic there.


API Tags:
Return:  a status code


Redefined in descendants as:
  • GalleryModule::installOrUpgrade() : Perform the module installation or upgrade, whatever is required.
  • GalleryTheme::installOrUpgrade() : Perform the module installation or upgrade, whatever is required. It will do the following:
    1. Get the current version of the theme (if its already installed)
    2. Let the theme perform any necessary upgrade tasks.

[ Top ]
isActive  [line 487]

  array isActive( )

Is this plugin active?


API Tags:
Return:  GalleryStatus a status code boolean true if active


Redefined in descendants as:

[ Top ]
reactivate  [line 268]

  array reactivate( )

Reactivate this plugin. The plugin is already active, so call deactivate() and then activate(). Perform the deactivation without sending an event because the activation will immediately follow and we don't want other plugins to sense this deactivation and deactivate themselves. If the plugin isn't currently active, don't do anything.


API Tags:
Return:  GalleryStatus a status code array redirect info for error page (empty for success)


[ Top ]
removeParameter  [line 548]

  GalleryStatus removeParameter( string $parameterName, [int $itemId = 0]  )

Convenience method to remove a plugin parameter

Parameters:
string   $parameterName: 
int   $itemId:  (optional)

API Tags:
Return:  a status code


[ Top ]
setDescription  [line 623]

  void setDescription( $description  )

Parameters:
   $description: 


[ Top ]
setId  [line 607]

  void setId( $id  )

Parameters:
   $id: 


[ Top ]
setName  [line 615]

  void setName( $name  )

Parameters:
   $name: 


[ Top ]
setParameter  [line 531]

  GalleryStatus setParameter( string $parameterName, string $parameterValue, [int $itemId = 0]  )

Convenience method to set a plugin parameter

Parameters:
string   $parameterName: 
string   $parameterValue: 
int   $itemId:  (optional)

API Tags:
Return:  a status code


Redefined in descendants as:

[ Top ]
setRequiredCoreApi  [line 643]

  void setRequiredCoreApi( $requirement  )

Parameters:
   $requirement: 


[ Top ]
setVersion  [line 631]

  void setVersion( $version  )

Parameters:
   $version: 


[ Top ]
translate  [line 128]

  string translate( mixed $params  )

Localize the given content.

Gallery uses GNU gettext for internationalization (i18n) and localization (l10n) of text presented to the user. Gettext needs to know about all places involving strings that must be translated. Mark any place where localization at runtime shall take place by using this function.

E.g. instead of: print 'TEST to be displayed in different languages'; use (in any subclass of GalleryPlugin): print $this->translate('TEST to be displayed in different languages'); and you are all set for pure literals. The translation teams will receive that literal string as a job to translate and will translate it (when the message is clear enough). At runtime the message is then localized when printed.

But consider this case: $message_to_be_localized = 'TEST to be displayed in different languages'; print $this->translate($message_to_be_localized);

The translate() method is called in the right place for runtime handling, but there is no message at gettext preprocessing time to be given to the translation teams, just a variable name. Translation of the variable name would break the code! So all places potentially feeding this variable have to be marked to be given to translation teams, but not translated at runtime!

The (noop) method Gallery::i18n() is there to resolve all such cases (including storing the original string in, say, the database). Simply mark the candidates: $message_to_be_localized = $gallery->i18n('TEST to be displayed in different languages'); print $this->translate($message_to_be_localized);

The i18n() method does nothing, but feeding translators with that new string. This method does the runtime job, thanks to GNU gettext.

Input parameters may also include $params['hint'] which is text to appear in the po file to assist translators, but is not text to be translated. Example: print $this->translate(array('text' => 'TT', 'hint' => 'Abbreviation for ToolTip')); Input parameters may also include $params['cFormat'] (boolean value) which tells gettext whether or not to use "c-format" for this string (it may guess wrong for "5% faster", for example).

Parameters:
mixed   $params:  a single string, or an array of parameters

API Tags:
Return:  the localized value
See:  Gallery::i18n
See:  GalleryTranslator::translateDomain


[ Top ]
uninstall  [line 347]

  GalleryStatus uninstall( )

Remove this plugin's parameters


API Tags:
Return:  a status code


Redefined in descendants as:

[ Top ]
upgrade  [line 601]

  GalleryStatus upgrade( string $currentVersion  )

Perform any upgrade tasks required at this point. This method is called

if the plugin version in the code does not match the version number in the database. For modules, the framework will upgrade database tables as necessary, but it is the responsibility of the module to:

  1. Register/unregister permissions
  2. Move or massage data as required by the upgrade
This method will be called with a null version on an initial install.

Parameters:
string   $currentVersion:  the current version (null if this is an initial install)

API Tags:
Return:  a status code
Access:  protected


Redefined in descendants as:

[ Top ]
_flushPluginCache  [line 471]

  void _flushPluginCache( )

Flush plugin-related caches.



[ Top ]
_postDeactivationEvent  [line 330]

  GalleryStatus _postDeactivationEvent( )

Post a deactivation event for this plugin. Used by deactivate and reactivate.


API Tags:
Return:  a status code
Access:  private


[ Top ]

Documentation generated on Fri, 08 Oct 2010 05:02:37 -0700 by phpDocumentor 1.3.0RC6