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

Class: Gallery

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

Class Gallery

Property Summary
GalleryUser   $_activeUser   The active GalleryUser instance
array   $_config   Storage for all configuration variables, set in config.php. The values contained here can't be modified. Well, they can be modified but they can't be saved so it's not a good idea.
string   $_currentView   The name of the current view
string   $_debug   The current debugging mode. One of 'buffered', 'logged', 'immediate' or false.
string   $_debugBuffer   A place to temporarily store debug output when the debugging mode is set to 'buffered'
string   $_debugLogFile   Where to send debug output (when the debugging mode is set to 'logged')
string   $_debugSnippet   A secondary debug buffer used to record debug output even if regular debug mode is disabled.
boolean   $_debugSnippetActive   Are we currently recording a debug snippet?
GalleryLockSystem   $_lockSystem   The active GalleryLockSystem implementation
GalleryPhpVm   $_phpVm   A facade in front of the PHP virtual machine. We use this as an abstraction layer to let us interpose mock objects between our code and the VM for testing purposes. When we're not in a test environment, this is always an instance of GalleryPhpVm.
GalleryPlatform   $_platform   An instance of the GalleryPlatform class
string   $_profile   The current profiling mode.
GallerySession   $_session   Storage for all session variables.
array   $_shutdownActions   Actions to perform at the end of the request
GalleryStorage   $_storage   The backend persistent store for the Gallery class
GalleryTemplateAdapter   $_templateAdapter   The adapter between the template system and any Gallery callbacks that want to use in the template process.
int   $_timeLimit   The time at which we should cease whatever operation we're doing
GalleryTranslator   $_translator   Instance of the GalleryTranslator class
GalleryUrlGenerator   $_urlGenerator   Instance of the GalleryUrlGenerator class

[ Top ]
Method Summary
Gallery   Gallery()  
void   addShutdownAction()   Add an action to be performed at the end of the request.
void   clearDebugBuffer()   Clear any buffered debug output
void   debug()   Output a debug message
void   debug_r()   Output a print_r style debug message
boolean   fastDownload()   Send a data file out to the browser as quickly as possible.
array   getActiveLanguageCode()   Get the active language code.
GalleryUser   getActiveUser()   Get the active user.
int   getActiveUserId()   Get the Id of the active user.
mixed   getConfig()   Get a value from the Gallery configuration settings
string   getCurrentView()   Get the current view
mixed   getDebug()   Get the debug state
string   getDebugBuffer()   Get any buffered debug output
string   getHttpDate()   Return a date and time string that is conformant to RFC 2616
array   &getLockSystem()   Return the active lock system.
GalleryPhpVm   getPhpVm()   Return our PHP virtual machine abstraction
GalleryPlatform   &getPlatform()   Get the Gallery platform object.
GallerySession   &getSession()   Get the Gallery session object.
GalleryStorage   &getStorage()   Return an instance of the GalleryStorage class
GalleryTemplateAdapter   &getTemplateAdapter()   Return the template adapter. There is only ever one in the system.
GalleryTranslator   &getTranslator()   Return a reference to our GalleryTranslator instance
GalleryUrlGenerator   &getUrlGenerator()   Get the URL generator
void   guaranteeTimeLimit()   Guarantee that we have at least this many more seconds to work
string   i18n()   Mark a string as being internationalized. This is a semaphore method; it does nothing but it allows us to easily identify strings that require translation. Generally this is used to mark strings that will be stored in the database (like module names and descriptions).
void   init()   Register shutdown function to release any hanging locks.
void   initEmptySession()   Initialize an empty session.
GalleryStatus   initSession()   Initialize session.
GalleryStatus   initTranslator()   Initialize our GalleryTranslator
boolean   isEmbedded()   Check if Gallery is in embedded mode
boolean   isProfiling()   Get the profiling state
boolean   isStorageInitialized()   Check if GalleryStorage has been instantiated
void   performShutdownActions()   Process registered shutdown actions.
void   search()  
GalleryStatus   setActiveLanguageCode()   Set the active language code for this session.
void   setActiveUser()   Set the id of the active user. The active user is the user who is logged on in this session.
void   setConfig()   Store a value in the Gallery config table
void   setCurrentView()   Set the current view
void   setDebug()   Change the debugging state
void   setDebugLogFile()   Set the location of debugging output
void   setPlatform()   Set the Gallery platform object.
void   setProfile()   Set the profiling state. Pass in an array containing the different kinds of things that you want to profile. Right now, we only do sql profiling so the only valid values are:
void   setUrlGenerator()   Set the URL generator
void   startRecordingDebugSnippet()   Start recording a debug snippet
string   stopRecordingDebugSnippet()   Stop recording the debug snippet and return whatever got recorded.
void   _shutdown()   Perform any necessary shutdown tasks.

[ Top ]
Properties
GalleryUser   $_activeUser [line 46]

The active GalleryUser instance

API Tags:
Access:  private


[ Top ]
array   $_config [line 54]

Storage for all configuration variables, set in config.php. The values contained here can't be modified. Well, they can be modified but they can't be saved so it's not a good idea.

API Tags:
Access:  private


[ Top ]
string   $_currentView = '' [line 153]

The name of the current view

API Tags:
Access:  private


[ Top ]
string   $_debug [line 61]

The current debugging mode. One of 'buffered', 'logged', 'immediate' or false.

API Tags:
Access:  private


[ Top ]
string   $_debugBuffer [line 75]

A place to temporarily store debug output when the debugging mode is set to 'buffered'

API Tags:
Access:  private


[ Top ]
string   $_debugLogFile [line 68]

Where to send debug output (when the debugging mode is set to 'logged')

API Tags:
Access:  private


[ Top ]
string   $_debugSnippet = null [line 82]

A secondary debug buffer used to record debug output even if regular debug mode is disabled.

API Tags:
Access:  private


[ Top ]
boolean   $_debugSnippetActive = false [line 89]

Are we currently recording a debug snippet?

API Tags:
Access:  private


[ Top ]
GalleryLockSystem   $_lockSystem [line 96]

The active GalleryLockSystem implementation

API Tags:
Access:  private


[ Top ]
GalleryPhpVm   $_phpVm = null [line 176]

A facade in front of the PHP virtual machine. We use this as an abstraction layer to let us interpose mock objects between our code and the VM for testing purposes. When we're not in a test environment, this is always an instance of GalleryPhpVm.

API Tags:
Access:  private


[ Top ]
GalleryPlatform   $_platform [line 103]

An instance of the GalleryPlatform class

API Tags:
Access:  private


[ Top ]
string   $_profile [line 110]

The current profiling mode.

API Tags:
Access:  private


[ Top ]
GallerySession   $_session [line 117]

Storage for all session variables.

API Tags:
Access:  private


[ Top ]
array   $_shutdownActions [line 167]

Actions to perform at the end of the request

API Tags:
Access:  private


[ Top ]
GalleryStorage   $_storage [line 124]

The backend persistent store for the Gallery class

API Tags:
Access:  private


[ Top ]
GalleryTemplateAdapter   $_templateAdapter [line 132]

The adapter between the template system and any Gallery callbacks that want to use in the template process.

API Tags:
Access:  private


[ Top ]
int   $_timeLimit [line 160]

The time at which we should cease whatever operation we're doing

API Tags:
Access:  private


[ Top ]
GalleryTranslator   $_translator [line 139]

Instance of the GalleryTranslator class

API Tags:
Access:  private


[ Top ]
GalleryUrlGenerator   $_urlGenerator [line 146]

Instance of the GalleryUrlGenerator class

API Tags:
Access:  private


[ Top ]
Methods
Constructor Gallery  [line 179]

  Gallery Gallery( )



[ Top ]
addShutdownAction  [line 939]

  void addShutdownAction( callback $callback, array $parameters  )

Add an action to be performed at the end of the request.

Parameters:
callback   $callback: 
array   $parameters: 


[ Top ]
clearDebugBuffer  [line 724]

  void clearDebugBuffer( )

Clear any buffered debug output



[ Top ]
debug  [line 757]

  void debug( string $msg  )

Output a debug message

Parameters:
string   $msg:  a message


[ Top ]
debug_r  [line 794]

  void debug_r( mixed $object, [boolean $escapeHtmlEntities = false]  )

Output a print_r style debug message

Parameters:
mixed   $object:  any object or value
boolean   $escapeHtmlEntities:  true if the output should be run through htmlentities()


[ Top ]
fastDownload  [line 855]

  boolean fastDownload( string $relativePath, string $filename, string $lastModified, string $mimeType, int $contentLength  )

Send a data file out to the browser as quickly as possible.

Parameters:
string   $relativePath:  the relative path to the file from the g2data/ directory
string   $filename:  logical name of the file (used for the Content-Disposition header)
string   $lastModified:  the last modified date string (used for the Last-Modified header)
string   $mimeType:  the mime type (used for the Content-type header)
int   $contentLength:  the size of the file (used for the Content-length header)

API Tags:
Return:  true if we transferred the file successfully


[ Top ]
getActiveLanguageCode  [line 575]

  array getActiveLanguageCode( )

Get the active language code.


API Tags:
Return:  GalleryStatus a status code string language code


[ Top ]
getActiveUser  [line 268]

  GalleryUser getActiveUser( )

Get the active user.

Cache the results of the first call and return that same value each time.


API Tags:
Return:  the active user


[ Top ]
getActiveUserId  [line 253]

  int getActiveUserId( )

Get the Id of the active user.

The active user is the user who is logged on in this session.


API Tags:
Return:  the id of the current user


[ Top ]
getConfig  [line 288]

  mixed getConfig( $key  )

Get a value from the Gallery configuration settings

Parameters:
   $key: 

API Tags:
Return:  an arbitrary value


[ Top ]
getCurrentView  [line 524]

  string getCurrentView( )

Get the current view


API Tags:
Return:  the current view name


[ Top ]
getDebug  [line 703]

  mixed getDebug( )

Get the debug state


API Tags:
Return:  the debug state


[ Top ]
getDebugBuffer  [line 717]

  string getDebugBuffer( )

Get any buffered debug output


API Tags:
Return:  the debug state


[ Top ]
getHttpDate  [line 906]

  string getHttpDate( [int $time = '']  )

Return a date and time string that is conformant to RFC 2616

Parameters:
int   $time:  the unix timestamp of the date we want to return, empty if we want the current time

API Tags:
Return:  a date-string conformant to the RFC 2616
See:  sec3.3


[ Top ]
getLockSystem  [line 357]

  array &getLockSystem( [boolean $canInit = true]  )

Return the active lock system.

Parameters:
boolean   $canInit:  (optional) if false and lockSystem isn't yet initialized, return null

API Tags:
Return:  GalleryStatus a status code GalleryLockSystem the lock implementation (reference)


[ Top ]
getPhpVm  [line 985]

  GalleryPhpVm getPhpVm( )

Return our PHP virtual machine abstraction



[ Top ]
getPlatform  [line 346]

  GalleryPlatform &getPlatform( )

Get the Gallery platform object.

Return a reference to the unique Gallery platform object.


API Tags:
Return:  the Gallery platform object


[ Top ]
getSession  [line 326]

  GallerySession &getSession( )

Get the Gallery session object.

Return a reference to the unique Gallery session object. Any changes made to this object will be saved in the session.


API Tags:
Return:  a session instance


[ Top ]
getStorage  [line 427]

  GalleryStorage &getStorage( )

Return an instance of the GalleryStorage class


API Tags:
Return:  a storage instance


[ Top ]
getTemplateAdapter  [line 809]

  GalleryTemplateAdapter &getTemplateAdapter( )

Return the template adapter. There is only ever one in the system.



[ Top ]
getTranslator  [line 533]

  GalleryTranslator &getTranslator( )

Return a reference to our GalleryTranslator instance



[ Top ]
getUrlGenerator  [line 506]

  GalleryUrlGenerator &getUrlGenerator( )

Get the URL generator



[ Top ]
guaranteeTimeLimit  [line 610]

  void guaranteeTimeLimit( int $limit  )

Guarantee that we have at least this many more seconds to work

After this function completes, we will be guaranteed of at least this much more time to work.

Parameters:
int   $limit:  a time interval in seconds, must be greater than 0


[ Top ]
i18n  [line 841]

  string i18n( mixed $value  )

Mark a string as being internationalized. This is a semaphore method; it does nothing but it allows us to easily identify strings that require translation. Generally this is used to mark strings that will be stored in the database (like module names and descriptions).

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!

This method resolves all such cases. Simply mark the candidates: $message_to_be_localized = $gallery->i18n('TEST to be displayed in different languages'); print $this->translate($message_to_be_localized);

Parameters:
mixed   $value:  string or array (array must have 'text' key; hint/cFormat keys optional)

API Tags:
Return:  the text value
See:  GalleryPlugin::translate


[ Top ]
init  [line 207]

  void init( )

Register shutdown function to release any hanging locks.

This used to be done in the constructor, but moved here to avoid php4 vs php5 issue ($gallery =& new Gallery() needed for php4, but this is deprecated in php5.3).



[ Top ]
initEmptySession  [line 314]

  void initEmptySession( )

Initialize an empty session.



[ Top ]
initSession  [line 298]

  GalleryStatus initSession( )

Initialize session.


API Tags:
Return:  a status code


[ Top ]
initTranslator  [line 543]

  GalleryStatus initTranslator( [boolean $dontUseDatabase = false]  )

Initialize our GalleryTranslator

Parameters:
boolean   $dontUseDatabase:  (optional) true if we should not use the database

API Tags:
Return:  a status code


[ Top ]
isEmbedded  [line 929]

  boolean isEmbedded( )

Check if Gallery is in embedded mode


API Tags:
Return:  true if Gallery is in embedded mode, false otherwise


[ Top ]
isProfiling  [line 658]

  boolean isProfiling( string $type  )

Get the profiling state

Parameters:
string   $type:  profiling type


[ Top ]
isStorageInitialized  [line 487]

  boolean isStorageInitialized( )

Check if GalleryStorage has been instantiated



[ Top ]
performShutdownActions  [line 959]

  void performShutdownActions( )

Process registered shutdown actions.



[ Top ]
search  [line 215]

  void search( $query, [ $data = array()], [ $options = array()]  )

Parameters:
   $query: 
   $data: 
   $options: 

API Tags:
See:  GalleryStorage::search


[ Top ]
setActiveLanguageCode  [line 593]

  GalleryStatus setActiveLanguageCode( string $language  )

Set the active language code for this session.

Parameters:
string   $language:  language code

API Tags:
Return:  a status code


[ Top ]
setActiveUser  [line 230]

  void setActiveUser( GalleryUser $user  )

Set the id of the active user. The active user is the user who is logged on in this session.

Parameters:
GalleryUser   $user:  the current user


[ Top ]
setConfig  [line 278]

  void setConfig( string $key, mixed $value  )

Store a value in the Gallery config table

Parameters:
string   $key: 
mixed   $value: 


[ Top ]
setCurrentView  [line 515]

  void setCurrentView( string $view  )

Set the current view

Parameters:
string   $view:  the view name


[ Top ]
setDebug  [line 667]

  void setDebug( [mixed $debug = false]  )

Change the debugging state

Parameters:
mixed   $debug:  one of 'buffered', 'logged', 'immediate' or false


[ Top ]
setDebugLogFile  [line 695]

  void setDebugLogFile( string $debugLogFile  )

Set the location of debugging output

Parameters:
string   $debugLogFile:  a filename


[ Top ]
setPlatform  [line 335]

  void setPlatform( &$platform, GalleryPlatform $platform  )

Set the Gallery platform object.

Parameters:
GalleryPlatform   $platform:  the Gallery platform object
   &$platform: 


[ Top ]
setProfile  [line 644]

  void setProfile( [mixed $profile = array()]  )

Set the profiling state. Pass in an array containing the different kinds of things that you want to profile. Right now, we only do sql profiling so the only valid values are:

false <-- no profiling array() <-- no profiling array('sql') <-- SQL profiling

Parameters:
mixed   $profile:  array of profiling modes or boolean false


[ Top ]
setUrlGenerator  [line 496]

  void setUrlGenerator( &$urlGenerator, GalleryUrlGenerator $urlGenerator  )

Set the URL generator

Parameters:
GalleryUrlGenerator   $urlGenerator: 
   &$urlGenerator: 


[ Top ]
startRecordingDebugSnippet  [line 731]

  void startRecordingDebugSnippet( )

Start recording a debug snippet



[ Top ]
stopRecordingDebugSnippet  [line 743]

  string stopRecordingDebugSnippet( )

Stop recording the debug snippet and return whatever got recorded.


API Tags:
Return:  the snippet


[ Top ]
_shutdown  [line 401]

  void _shutdown( )

Perform any necessary shutdown tasks.

This should only be invoked as a register_shutdown callback.


API Tags:
Access:  private


[ Top ]

Documentation generated on Fri, 08 Oct 2010 04:53:27 -0700 by phpDocumentor 1.3.0RC6