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 | |
Definition at line 23 of file web.php.
| Web::ajax_exec | ( | $ | js = '' |
) |
Convenience function to pass back JavaScript as an AJAX response.
| 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.
| 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 | ( | ) |
| 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.
| 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 = '' |
) |
| Web::current_url | ( | $ | trim_querystring = false |
) |
Get the current URL, relative to our base web root
| bool | $trim_querystring If set, the query string portion of the URL will not be included. |
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 |
) |
| 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 | ( | ) |
| Web::has_access | ( | $ | key | ) |
Check if the user has the access key required for this operation
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.
| 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 | ) |
| Web::internalerror | ( | ) |
| Web::lastmodified | ( | $ | datetime | ) |
| Web::notfound | ( | ) |
| Web::queue_css_load | ( | $ | key, | |
| $ | url | |||
| ) |
Definition at line 492 of file web.php.
Referenced by enable_debug().
| Web::queue_html_head | ( | $ | key, | |
| $ | val | |||
| ) |
| 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">
| 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.
| 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 |
| Web::redirect | ( | $ | url | ) |
Redirect to the specified URL
| 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 = '' | |||
| ) |
| 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.
| 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.
| 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.
1.6.1