Web Class Reference

List of all members.

Public Member Functions

 Web ($start_point)
 enable_debug ()
 run ($urls, $path=false)
 finish ()
 current_url ($trim_querystring=false)
 redirect ($url)
 check_access ($key, $login_url='', $return_url='', $always_login=false)
 has_access ($key)
 http_auth ($realm)
 require_https ()
 queue_html_head ($key, $val)
 queue_css_load ($key, $url)
 queue_js_run ($key, $code, $overwrite=true)
 queue_js_load ($key, $url)
 ajax_load_queues ()
 ajax_render ($template, $filename, $jsvars=array())
 ajax_exec ($js='')
 render ($template, $filename, $vars=array(), $layout='')
 header ($name, $value)
 expires ($secs=0)
 content_type ($type='')
 lastmodified ($datetime)
 status ($status)
 notfound ()
 forbidden ()
 badrequest ()
 internalerror ()

Public Attributes

 $context
 $controller
 $start_point
 $time_start
 $debug_messages
 $no_debug = false
 $q_html_head
 $q_css_load
 $q_js_load
 $q_js_run

Detailed Description

Definition at line 23 of file web.php.


Member Function Documentation

Web::ajax_exec ( js = ''  ) 

Convenience function to pass back JavaScript as an AJAX response.

Parameters:
string $js JavaScript to pass back via ajax_render()

Definition at line 617 of file web.php.

References ajax_render().

Web::ajax_load_queues (  ) 

Process queued JavaScript code to be passed back as an AJAX response.

Definition at line 552 of file web.php.

Referenced by ajax_render().

Web::ajax_render ( template,
filename,
jsvars = array() 
)

Render and output a template to answer an AJAX request.

Parameters:
object $template Template object
string $filename Template file to render
array $jsvars Additional JavaScript variables to pass back

Definition at line 593 of file web.php.

References ajax_load_queues().

Referenced by ajax_exec().

Web::badrequest (  ) 

Sets "Bad request" status. Executes badrequest function, if exists.

Definition at line 779 of file web.php.

References $p, DS, and status().

Web::check_access ( key,
login_url = '',
return_url = '',
always_login = false 
)

Check access levels to determine if the user is allowed to proceed. If not logged in, send to login form; if logged in with insufficient privileges, send a 403, unless $always_login is true.

Parameters:
string $key The access key required for this action
string $login_url The relative URL to redirect to if user isn't logged in
string $return_url Return URL to pass through the login form
boolean $always_login If true, a logged-in user with insufficient privileges will be sent to the login form, instead of receiving a 403.

Definition at line 414 of file web.php.

References current_url(), forbidden(), Registry::get(), redirect(), and url().

Web::content_type ( type = ''  ) 

Sets "Content-type" header

Parameters:
string $type

Definition at line 712 of file web.php.

References header().

Web::current_url ( trim_querystring = false  ) 

Get the current URL, relative to our base web root

Parameters:
bool $trim_querystring If set, the query string portion of the URL will not be included.
Returns:
string

Definition at line 367 of file web.php.

Referenced by check_access(), require_https(), and run().

Web::enable_debug (  ) 

Enable debugging information in a little dropdown panel. Also buffer any browser output so it can be displayed through the error handler if necessary.

Definition at line 102 of file web.php.

References queue_css_load(), queue_js_load(), and url().

Web::expires ( secs = 0  ) 

Sets "Expires" and "Cache-Control" headers

Parameters:
int $secs Number of seconds until page content expires. If set to zero, then cache will be disabled.

Definition at line 694 of file web.php.

References header().

Referenced by finish().

Web::finish (  ) 

Run cleanup code necessary to finalize a web request. This code is automatically called from Web::run(). However, if your action needs to exit immediately instead of leaving your controller via the normal "return" command, then you can call this.

Rule of thumb: If you're tempted to use die() or exit() to stop script execution, then call this instead.

Definition at line 302 of file web.php.

References $db, expires(), Registry::get(), and start_session().

Referenced by run().

Web::forbidden (  ) 

Sets "Forbidden" status. Executes forbidden function, if exists.

Definition at line 761 of file web.php.

References $p, DS, and status().

Referenced by check_access().

Web::has_access ( key  ) 

Check if the user has the access key required for this operation

Returns:
boolean

Definition at line 442 of file web.php.

References Registry::get().

Web::header ( name,
value 
)

Do the same thing as header native function. The difference is that you don't need to concatenate header name and its value.

Parameters:
string $name
string $value

Definition at line 683 of file web.php.

Referenced by content_type(), expires(), http_auth(), lastmodified(), redirect(), and status().

Web::http_auth ( realm  ) 

Collect username/password via HTTP Basic Authentication. Username can be found in $_SERVER['PHP_AUTH_USER'] Password can be found in $_SERVER['PHP_AUTH_PW']

Parameters:
string $realm

Definition at line 455 of file web.php.

References header().

Web::internalerror (  ) 

Sets "Internal Server Error" status. Executes internalerror function, if exists.

Definition at line 797 of file web.php.

References $p, DS, and status().

Web::lastmodified ( datetime  ) 

Sets "Last-modified" header.

Parameters:
 

Definition at line 723 of file web.php.

References header().

Web::notfound (  ) 

Sets "Not found" status. Executes notfound function, if exists.

Definition at line 743 of file web.php.

References $p, DS, and status().

Referenced by run().

Web::queue_css_load ( key,
url 
)

Definition at line 492 of file web.php.

Referenced by enable_debug().

Web::queue_html_head ( key,
val 
)

Add text to the <head> area of the template

Parameters:
string $key A unique key for this chunk of HTML
string $val The HTML itself

Definition at line 487 of file web.php.

Web::queue_js_load ( key,
url 
)

Same as queue_js_run, except this one will mimic a a remote load, eg, <script type="text/javascript" src="/path/to/js">

Parameters:
string $key A unique key for this JavaScript
string $url The URL to the JS file

Definition at line 533 of file web.php.

Referenced by enable_debug().

Web::queue_js_run ( key,
code,
overwrite = true 
)

Schedule some JavaScript code to be run. If the page is being delivered normally, then it will be executed in the <head> section of the template. If the page is loaded via AJAX, then it will be executed immediately.

Parameters:
string $key A unique key for this JavaScript. If the key begins with a '+', then it will be run as-is. Otherwise it will be run through a jQuery .ready() call. If the key is blank, then we generate a hash string to use as the key.
string $code The JS code
boolean $overwrite If true, overwrite code using this key, otherwise append to it

Definition at line 514 of file web.php.

Web::redirect ( url  ) 

Redirect to the specified URL

Parameters:
string $url

Definition at line 385 of file web.php.

References header(), and url().

Referenced by check_access(), require_https(), and run().

Web::render ( template,
filename,
vars = array(),
layout = '' 
)

Render and output a template.

Parameters:
object $template Template object
string $filename Template file to render
array $vars Additional variables to include in template
string $layout Layout template to use. Leave empty/false for no layout.

Definition at line 630 of file web.php.

References DS.

Web::require_https (  ) 

Ensure that the current page is being accessed over HTTPS. If not, redirect to https://CURRENT_URL.

Definition at line 467 of file web.php.

References absolute_url(), current_url(), and redirect().

Web::run ( urls,
path = false 
)

Start dispatcher. This begins the dispatch process of the framework. The requested URL is parsed and the respective page controller is called.

Parameters:
array $urls Array of URL patterns to map Pages to URLs
mixed $path If not FALSE, use this as the relative base path instead of autodetecting it

Definition at line 122 of file web.php.

References $args, $params, $urls, current_url(), error(), finish(), notfound(), Factory::page(), redirect(), and Registry::set().

Web::status ( status  ) 

Sets "Status" header.

Parameters:
string $status

Definition at line 733 of file web.php.

References header().

Referenced by badrequest(), forbidden(), internalerror(), and notfound().

Web::Web ( start_point  ) 

Definition at line 47 of file web.php.

References $basepath, and $start_point.


Member Data Documentation

Web::$context

Definition at line 24 of file web.php.

Web::$controller

Definition at line 25 of file web.php.

Web::$debug_messages

Definition at line 32 of file web.php.

Web::$no_debug = false

Definition at line 33 of file web.php.

Web::$q_css_load

Definition at line 38 of file web.php.

Web::$q_html_head

Definition at line 37 of file web.php.

Web::$q_js_load

Definition at line 39 of file web.php.

Web::$q_js_run

Definition at line 40 of file web.php.

Web::$start_point

Definition at line 28 of file web.php.

Referenced by Web().

Web::$time_start

Definition at line 29 of file web.php.


The documentation for this class was generated from the following file:

Generated on Wed Jan 13 09:21:05 2010 for Pronto Framework by  doxygen 1.6.1