phpDocumentor Swift
[ class tree: Swift ] [ index: Swift ] [ all elements ]

Class: Swift

Source Location: /Swift.php

Class Swift

Method Summary
static Swift   getInstance()   Returns an instance of the Swift class.
Swift   __construct()   Creates a new Swift object
Array   allParams()   Retrieve an array containing all the params matched in the mapped url pattern.
Object   config()   Get or set configuration settings for Swift. Provide single parameter, $name, to get the current value of a setting. Optional: Use second paramter, $value, to change the value of the given setting.
SwiftCache   createCache()   Creates and returns a new SwiftCache object.
SwiftDb   createDb()   Creates a new SwiftDb object and automatically connects to it using the database settings found in the config.
SwiftEncrypt   createEncrypt()   Creates and returns a new SwiftEncrypt object.
SwiftForm   createForm()   Creates and returns a new SwiftForm object.
SwiftGoogle   createGoogle()   Creates a new SwiftGoogle object and automatically initializes it using the app_url and google_key settings found in the config.
SwiftGoogleImport   createGoogleImport()   Creates a new SwiftGoogleImport object and initializes it with a new Db and a new Google object.
SwiftHtml   createHtml()   Creates and returns a new SwiftHtml object.
SwiftImage   createImage()   Creates and returns a new SwiftImage object.
SwiftJQuery   createJQuery()   Creates and returns a new SwiftJQuery object.
SwiftLog   createLog()   Creates and returns a new SwiftLog object.
SwiftMinify   createMinify()   Creates and returns a new SwiftMinify object.
SwiftPinger   createPinger()   Creates a new SwiftPinger object and configures it using the app_name, app_url, and app_feed_url settings found in the config.
SwiftRegistry   createRegistry()   Creates and returns a new SwiftRegistry object.
SwiftRouter   createRouter()   Creates and returns a new SwiftRouter object.
SwiftRss   createRss()   Creates and returns a new SwiftRss object.
SwiftSitemap   createSitemap()   Creates and returns a new Sitemap object.
SwiftValidator   createValidator()   Creates and returns a new SwiftValidator object.
Array   getAllViewData()   Retrieve an array of all stored view data.
string   getCache()   Returns the cache stored with the provided $cache_key if the cache is not older then the provided $cache_exp_time. If no cache exists or the cache is expired then the function returns null.
string   getRequestMethod()   Get the method type for the current request.
string   getRequestUri()   Get the request URI from the web server.
string   getRequestVar()   Retrieve the value of request variable that matches the given $key.
string   getViewData()   Get the value of stored view data with the provided $key.
int   log()   Stores a timestamp and $message string to a log file in the
void   map()   Map the provided url pattern to a given callback function.
string   param()   Get the value of a param that was matched in the url pattern.
void   render()   Loads the provided $view file from inside the directory provided by the app_view_dir setting and loads all variables inside the $data array.
void   run()   Configures the App and Router using settings from the config and then dispatches the request.
void   setViewData()   Set data to be stored and made available to the view.
void   startCache()   Begin storing all output into a buffer until stopCache() is called.
string   stopCache()   Stop buffering output from previous call to startCache() and store buffer into cache with the provided $cache_key. Returns the stored cache on success, and returns false on error.

[ Top ]
Methods
static method getInstance  [line 96]

  static Swift getInstance( )

Returns an instance of the Swift class.


API Tags:
Return:  A Swift object
Access:  public


[ Top ]
Constructor __construct  [line 74]

  Swift __construct( )

Creates a new Swift object


API Tags:
Return:  A new Swift object
Access:  public


[ Top ]
allParams  [line 365]

  Array allParams( )

Retrieve an array containing all the params matched in the mapped url pattern.


API Tags:
Return:  An array with all params.
Access:  public


[ Top ]
config  [line 303]

  Object config( string $name, Object $value  )

Get or set configuration settings for Swift. Provide single parameter, $name, to get the current value of a setting. Optional: Use second paramter, $value, to change the value of the given setting.

Parameters:
string   $name:  The name of the setting
Object   $value:  The value to change the current setting to.

API Tags:
Return:  The value of the request setting.
Access:  public


[ Top ]
createCache  [line 291]

  SwiftCache createCache( string $cache_dir  )

Creates and returns a new SwiftCache object.

Parameters:
string   $cache_dir:  The directory to store all chached files.

API Tags:
Return:  A SwiftCache object
Access:  public


[ Top ]
createDb  [line 153]

  SwiftDb createDb( )

Creates a new SwiftDb object and automatically connects to it using the database settings found in the config.


API Tags:
Return:  Db object
Access:  public


[ Top ]
createEncrypt  [line 250]

  SwiftEncrypt createEncrypt( )

Creates and returns a new SwiftEncrypt object.


API Tags:
Return:  A SwiftEncrypt object
Access:  public


[ Top ]
createForm  [line 265]

  SwiftForm createForm( [string $form_name = null], [string $form_id = null], [string $form_action = '/'], [string $form_method = 'get'], [string $form_enctype = null], [string $form_container_id = null], [boolean $form_ajax = false]  )

Creates and returns a new SwiftForm object.

Parameters:
string   $form_name:  The HTML name attribute for the form. (Optional)
string   $form_id:  The HTML id attribute for the form. (Optional)
string   $form_action:  The HTML action attribute for the form. Default: / (Optional)
string   $form_method:  The HTML method attribute for the form. Default: get (Optional)
string   $form_enctype:  The HTML enctype attribute for the form. (Optional)
string   $form_container_id:  The ID of the HTML container for the form. (Optional)
boolean   $form_ajax:  True for AJAX form submit or False for regular submit. Default: false (Optional)

API Tags:
Return:  A SwiftForm object
Access:  public


[ Top ]
createGoogle  [line 166]

  SwiftGoogle createGoogle( )

Creates a new SwiftGoogle object and automatically initializes it using the app_url and google_key settings found in the config.


API Tags:
Return:  A SwiftGoogle object
Access:  public


[ Top ]
createGoogleImport  [line 214]

  SwiftGoogleImport createGoogleImport( )

Creates a new SwiftGoogleImport object and initializes it with a new Db and a new Google object.


API Tags:
Return:  A SwiftGoogleImport object
Access:  public


[ Top ]
createHtml  [line 222]

  SwiftHtml createHtml( )

Creates and returns a new SwiftHtml object.


API Tags:
Return:  A SwiftHtml object
Access:  public


[ Top ]
createImage  [line 233]

  SwiftImage createImage( [String $filename = null], Integer $width, Integer $height  )

Creates and returns a new SwiftImage object.

Parameters:
String   $filename:  The filename of a PNG, GIF, or JPEG image to load. (Optional)
Integer   $width:  The width of the image to render. (Specifiy if $filename is not provided)
Integer   $height:  The height of the image to render. (Specifiy if $filename is not provided)

API Tags:
Return:  A SwiftImage object
Access:  public


[ Top ]
createJQuery  [line 242]

  SwiftJQuery createJQuery( [boolean $debug_comments = false]  )

Creates and returns a new SwiftJQuery object.

Parameters:
boolean   $debug_comments:  True to create debug comments. Otherwise false. Default: false

API Tags:
Return:  A SwiftJQuery object
Access:  public


[ Top ]
createLog  [line 274]

  SwiftLog createLog( [string $log_dir = null]  )

Creates and returns a new SwiftLog object.

Parameters:
string   $log_dir:  The base log directory to store logs in. Default: null

API Tags:
Return:  A SwiftLog object
Access:  public


[ Top ]
createMinify  [line 282]

  SwiftMinify createMinify( )

Creates and returns a new SwiftMinify object.


API Tags:
Return:  A SwiftMinify object
Access:  public


[ Top ]
createPinger  [line 178]

  SwiftPinger createPinger( )

Creates a new SwiftPinger object and configures it using the app_name, app_url, and app_feed_url settings found in the config.


API Tags:
Return:  A SwiftPinger object
Access:  public


[ Top ]
createRegistry  [line 136]

  SwiftRegistry createRegistry( )

Creates and returns a new SwiftRegistry object.


API Tags:
Return:  A SwiftRegistry object
Access:  public


[ Top ]
createRouter  [line 144]

  SwiftRouter createRouter( )

Creates and returns a new SwiftRouter object.


API Tags:
Return:  A SwiftRouter object
Access:  public


[ Top ]
createRss  [line 197]

  SwiftRss createRss( )

Creates and returns a new SwiftRss object.


API Tags:
Return:  A SwiftRss object
Access:  public


[ Top ]
createSitemap  [line 205]

  SwiftSitemap createSitemap( )

Creates and returns a new Sitemap object.


API Tags:
Return:  A SwiftSitemap object
Access:  public


[ Top ]
createValidator  [line 189]

  SwiftValidator createValidator( )

Creates and returns a new SwiftValidator object.


API Tags:
Return:  A SwiftValidator object
Access:  public


[ Top ]
getAllViewData  [line 391]

  Array getAllViewData( )

Retrieve an array of all stored view data.


API Tags:
Return:  An array of all view data.
Access:  public


[ Top ]
getCache  [line 426]

  string getCache( string $cache_key, [int $cache_exp_time = 600]  )

Returns the cache stored with the provided $cache_key if the cache is not older then the provided $cache_exp_time. If no cache exists or the cache is expired then the function returns null.

Parameters:
string   $cache_key:  An alphanumeric key to reference the stored cache.
int   $cache_exp_time:  The expiration time (in seconds) of the cache. Default = 600

API Tags:
Return:  The stored cache as a string. Returns null if cache does not exist or is expired.
Access:  public


[ Top ]
getRequestMethod  [line 338]

  string getRequestMethod( )

Get the method type for the current request.


API Tags:
Return:  The type of method. (GET|POST|DELETE|PUT)
Access:  public


[ Top ]
getRequestUri  [line 330]

  string getRequestUri( )

Get the request URI from the web server.


API Tags:
Return:  The current request URI.
Access:  public


[ Top ]
getRequestVar  [line 347]

  string getRequestVar( string $key  )

Retrieve the value of request variable that matches the given $key.

Parameters:
string   $key:  The name/key of the request variable.

API Tags:
Return:  The value of the specified request variable.
Access:  public


[ Top ]
getViewData  [line 383]

  string getViewData( string $key  )

Get the value of stored view data with the provided $key.

Parameters:
string   $key:  The key/name of the data.

API Tags:
Return:  The value of the stored view data.
Access:  public


[ Top ]
log  [line 403]

  int log( string $message, [string $type = 'info']  )

Stores a timestamp and $message string to a log file in the

directory specified by the 'app_log_dir' setting. The log file written to will be formated: "<type>-<date>.log" e.g. "error-20130913.log"

Parameters:
string   $message:  The message string to log.
string   $type:  The type of log message. Options: debug, info, warning, error, and fatal. Default: info.

API Tags:
Return:  Returns the number of bytes that were written to the log file, or false on failure.
Access:  public


[ Top ]
map  [line 322]

  void map( string $pattern, string $callback  )

Map the provided url pattern to a given callback function.

The $pattern may contain one or many regular expressions which will be matched using preg_match(). Each match in the $pattern is stored and may be retrieved by calling param() function. The $callback function is automatically called when a url match is made with the provided $pattern.

Parameters:
string   $pattern:  A url pattern to match. May contain multiple reg exps.
string   $callback:  A callback function that is called upon a match.

API Tags:
Access:  public


[ Top ]
param  [line 356]

  string param( string $key  )

Get the value of a param that was matched in the url pattern.

Parameters:
string   $key:  The name/key of the url param.

API Tags:
Return:  The value of the param.
Access:  public


[ Top ]
render  [line 455]

  void render( string $view, [Array $data = null], [boolean $minify = false]  )

Loads the provided $view file from inside the directory provided by the app_view_dir setting and loads all variables inside the $data array.

Parameters:
string   $view:  The filename of a view to render/load.
Array   $data:  Array of variables to load in the public scope for the $view. (Default: null)
boolean   $minify:  Minimize and compress all HTML and JavaScript output from the $view. (Default: false)

API Tags:
Access:  public


[ Top ]
run  [line 108]

  void run( [boolean $start_session = false]  )

Configures the App and Router using settings from the config and then dispatches the request.

Parameters:
boolean   $start_session:  If true, a PHP Session will be started. Default = false

API Tags:
Access:  public


[ Top ]
setViewData  [line 374]

  void setViewData( string $key, string $value  )

Set data to be stored and made available to the view.

Parameters:
string   $key:  The key/name of the data.
string   $value:  The value of the data.

API Tags:
Access:  public


[ Top ]
startCache  [line 433]

  void startCache( )

Begin storing all output into a buffer until stopCache() is called.


API Tags:
Access:  public


[ Top ]
stopCache  [line 444]

  string stopCache( string $cache_key  )

Stop buffering output from previous call to startCache() and store buffer into cache with the provided $cache_key. Returns the stored cache on success, and returns false on error.

Parameters:
string   $cache_key:  An alphanumeric key to reference the stored cache.

API Tags:
Return:  The stored cache as a string.
Access:  public


[ Top ]

Documentation generated on Tue, 08 Oct 2013 05:37:15 +0200 by phpDocumentor 1.4.4