Changeset 502 for trunk/modules/user_guide
- Timestamp:
- 09/05/2007 01:17:11 PM (15 months ago)
- Location:
- trunk/modules/user_guide/views/user_guide/en/helpers
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/user_guide/views/user_guide/en/helpers/cookie.php
r473 r502 1 1 Article status [Draft] requires [Editing] Comments and corrections 2 2 # Cookie Helper 3 Provides methods for setting, updating and deleting COOKIES.3 Provides methods for working with COOKIE data. 4 4 5 5 ## Configuration 6 Default settings for C OOKIESare specified in <file>application/config/cookie</file>. You may override7 these settings by passing discrete parameters when callingthe helper.6 Default settings for Cookies are specified in <file>application/config/cookie</file>. You may override 7 these settings by passing parameters to the helper. 8 8 9 A prefix may be set to avoid name collisions. 10 <code> 11 $config['prefix'] = ''; 12 </code> 13 A valid domain must be provided, a blank setting is equivalent to *localhost* 14 <code> 15 $config['domain'] = ''; 16 </code> 17 A valid path must be provided. 18 <code> 19 $config['path'] = '/'; 20 </code> 21 The COOKIES lifetime. Set it to the number of seconds that COOKIES should persist until expired by the browser, starting from when the COOKIES are set. 22 Note: Set to *0* (zero) seconds to create a cookie which expires when the browser is closed. 23 <code> 24 $config['expire'] = 0; 25 </code> 26 Secure COOKIES only. IF set to TRUE, COOKIES will **only** be created **if** the transfer protocol is secure (using HTTPS) 27 <code> 28 $config['secure'] = FALSE; 29 </code> 30 Restricted COOKIES access. If set to TRUE, then COOKIES can not be read via Client-side scripts. 31 <code> 32 $config['httponly'] = FALSE; 33 </code> 9 prefix 10 : A prefix may be set to avoid name collisions. Default is <code>''</code>. 34 11 35 ### Set a cookie. 36 The **cookie::set()** method takes multiple parameters, Only the cookie name and value are required.<br /> 37 You may pass parameters to the set method as discrete values: 38 <code> 39 cookie::set($name, $value, $expires, $path, $domain, $secure, $httponly, $prefix); 40 </code> 41 Or you may pass an array of values as a parameter: 42 <pre> 43 <code> 44 $cookie_params = array( 12 domain 13 : A valid domain, for which the Cookie may be written. Default is <code>''</code> (equivalent to *localhost*.) 14 For site-wide Cookies, prefix your domain with a period <code>.example.com</code> 15 16 path 17 : A valid path for which the Cookie may be written. Default is the root directory <code>'/'</code> 18 19 expire 20 : The Cookie lifetime. Set the number of seconds the Cookie should persist, until expired by the browser, starting from when the Cookie is set. 21 Note: Set to *0* (zero) seconds for a Cookie which expires when the browser is closed. 22 23 secure 24 : The Cookie will **only** be allowed over a secure transfer protocol (HTTPS). Default is <code>FALSE</code> 25 26 httponly 27 : The Cookie can be accessed via HTTP only, and not via client scripts. Default is <code>FALSE</code> 28 Note: Requires at least PHP version 5.2.0 29 30 ## Methods 31 32 ### Set a Cookie. 33 <code>cookie::set()</code> accepts multiple parameters, Only the cookie name and value are required.<br /> 34 You may pass parameters to this method as discrete values: 35 36 cookie::set($name, $value, $expire, $path, $domain, $secure, $httponly, $prefix); 37 38 Or you may pass an associative array of values as a parameter: 39 40 $cookie_params = array( 45 41 'name' => 'Very_Important_Cookie', 46 42 'value' => 'Choclate Flavoured Mint Delight', … … 50 46 'prefix' => 'one_', 51 47 ); 52 cookie::set($cookie_params); 53 </code> 54 </pre> 55 56 ### Get a cookie 57 The **cookie::get()** method takes multiple parameters, Only the cookie name is required. 58 <pre> 59 <code> 60 $cookie_value = cookie::get($cookie_name, $prefix, TRUE); 61 </code> 62 </pre> 63 Setting the third parameter to TRUE will filter the cookie data for unsafe data. 64 65 ### Delete a cookie 66 The **cookie::delete()** method takes multiple parameters, Only the cookie name is required.<br /> 67 This method is identical to the **cookie::set()** method, but sets the cookie value to ''. 68 <code> 69 cookie::delete('stale_cookie'); 70 </code> 48 cookie::set($cookie_params); 71 49 72 50 73 *[COOKIES]: Data passed between server and browser to provide persistent state 74 *[HTTPS]: HyperText Transfer Protocol Secured 51 ***** 52 53 ### Get a Cookie 54 <code>cookie::get()</code> accepts multiple parameters, Only the cookie name is required. 55 56 $cookie_value = cookie::get($cookie_name, $prefix, $xss_clean = FALSE); 57 58 Setting the third parameter to <code>TRUE</code> will filter the Cookie for unsafe data. 59 60 Returns <code>FALSE</code> if the Cookie item does not exist. 61 62 ***** 63 64 ### Delete a Cookie 65 <code>cookie::delete()</code> accepts multiple parameters, Only the cookie name is required.<br /> 66 This method is identical <code>cookie::set()</code> but sets the cookie value to <code>''</code>. effectively deleting it. 67 68 cookie::delete('stale_cookie'); 69 70 <?php echo $this->load->view('user_guide/en/abbr') ?> 71 <?php /* $Id$ */ ?> -
trunk/modules/user_guide/views/user_guide/en/helpers/file.php
r496 r502 1 Article status [ First Draft] requires [Editing] Add parameter descriptions1 Article status [Draft] requires [Editing] 2 2 # File Helper 3 Provides methods for splitting and joining FILES. 3 Provides methods for splitting and joining Files. 4 5 ## Methods 4 6 5 7 ### Split a file into segments. 6 The **file::split()** methodaccepts multiple parameters. Only the input **filename** is required.8 <code>file::split()</code> accepts multiple parameters. Only the input **filename** is required. 7 9 Returns the number of file segments created. 8 <code> 9 $segments = file::split($filename, $output_directory = FALSE, $piece_size = 10); 10 </code> 10 11 $segments = file::split($filename, $output_directory = FALSE, $piece_size = 10); 12 13 **** 11 14 12 15 ### Join segments of a split file. 13 The **file::join()** methodaccepts multiple parameters. Only the input segment **filename** is required.16 <code>file::join()</code> accepts multiple parameters. Only the input segment **filename** is required. 14 17 Returns the number of file segments joined. 15 <code> 16 $segments = file::split($filename, $output_file = FALSE); 17 </code> 18 19 $segments = file::split($filename, $output_file = FALSE); 20 21 <?php echo $this->load->view('user_guide/en/abbr') ?> 22 <?php /* $Id$ */ ?> -
trunk/modules/user_guide/views/user_guide/en/helpers/html.php
r496 r502 1 Article status [ FirstDraft] requires [Editing] Complete and Describe parameters2 # H TMLHelper3 Provides methods for htmlgeneration.1 Article status [Draft] requires [Editing] Complete and Describe parameters 2 # Html Helper 3 Provides methods for HTML generation. 4 4 5 ### Convert special characters to HTML entities 6 The **html::specialchars()** method accepts multiple parameters. Only the input **string** is required. 7 Converts special characters to HTML entities using a UFT-8 character set. 5 ## Methods 8 6 9 <code> 10 $encoded_string = html::specialchars($string, $double_encode = TRUE); 11 </code> 7 ### Convert special characters to html entities 8 <code>html::specialchars()</code> accepts multiple parameters. Only the input **string** is required. 9 Converts special characters to html entities, using the UFT-8 character set. 12 10 13 ### Generate an HTML anchor link 14 The **html::anchor()** method accepts multiple parameters. Only the url segment(s) are required. 11 $encoded_string = html::specialchars($string, $double_encode = TRUE); 15 12 16 A standard HTML anchor link is generated. If you want to generate a link that is internal to your website, 13 **** 14 15 ### Generate an html anchor link 16 <code>html::anchor()</code> method accepts multiple parameters. Only the URL segment(s) are required. 17 18 A standard html anchor link is generated. If you want to generate a link that is internal to your website, 17 19 pass only the url segments to the function, and the anchor is automatically constructed from the site url 18 20 defined in <file>config</file> 19 21 20 <code> 21 echo html::anchor('pub/articles/7', 'Articles', array('title' => 'Fuel price increase!')); 22 </code> 22 echo html::anchor('pub/articles/7', 'Articles', array('title' => 'Fuel price increase!')); 23 23 24 Generates <code><a href="http://example.com/index.php/pub/articles/7" title="Fuel price increase!">Articles</a></code>24 Generates 25 25 26 <a href="http://example.com/index.php/pub/articles/7" title="Fuel price increase!">Articles</a> 27 28 **** 29 30 ### Generate an html stylesheet link 31 <code>html::stylesheet()</code> accepts multiple parameters. Only the stylesheet is required. 32 33 // base_url = "http://example.com/" 34 $stylesheet = "user_guide/css/layout"; 35 echo html::stylesheet($stylesheet, $index = TRUE, $media = FALSE); 36 37 Generates 38 39 <link rel="stylesheet" href="http://example.com/index.php/user_guide/css/layout.css" /> 40 41 **** 42 43 ### Generate an html script link 44 <code>html::script()</code> accepts multiple parameters. Only the script is required. 45 46 // base_url = "http://example.com/" 47 $script = "user_guide/js/prettify"; 48 echo html::script($script, $index = TRUE, $media = FALSE); 49 50 Generates 51 52 <script type="text/javascript" src="http://example.com/index.php/user_guide/js/prettify.js"></script> 53 54 55 <?php echo $this->load->view('user_guide/en/abbr') ?> 26 56 <?php /* $Id$ */ ?> -
trunk/modules/user_guide/views/user_guide/en/helpers/text.php
r496 r502 1 Article status [ First Draft] requires [Editing] Describe parameters1 Article status [Draft] requires [Editing] Complete Alternator method 2 2 # Text Helper 3 Provides methods for working with TEXT. 3 Provides methods for working with Text. 4 5 ## Methods 4 6 5 7 ### Word Limiter 6 The **text::limit_words()** methodaccepts multiple parameters. Only the input **string** is required.8 <code>text::limit_words()</code> accepts multiple parameters. Only the input **string** is required. 7 9 The default end character is the ellipsis. 8 <pre>9 <code>10 $long_description = 'The rain in Spain falls mainly in the plain';11 $limit = 4;12 $end_char = '&nbsp;';13 10 14 $short_description = html::limit_words($long_description, $limit, $end_char); 15 </code> 16 </pre> 11 $long_description = 'The rain in Spain falls mainly in the plain'; 12 $limit = 4; 13 $end_char = '&nbsp;'; 14 15 $short_description = html::limit_words($long_description, $limit, $end_char); 16 17 17 Generates: <pre>The rain in Spain </pre> 18 18 19 **** 19 20 20 21 ### Character Limiter 21 The **text::limit_chars()** methodaccepts multiple parameters. Only the input **string** is required.22 <code>text::limit_chars()</code> accepts multiple parameters. Only the input **string** is required. 22 23 The default end character is the ellipsis. 23 <pre>24 <code>25 $long_description = 'The rain in Spain falls mainly in the plain';26 $limit = 4;27 $end_char = '&nbsp;';28 $preserve_words = FALSE;29 24 30 $short_description = html::limit_chars($long_description, $limit, $end_char, $preserve_words); 31 </code> 32 </pre> 25 $long_description = 'The rain in Spain falls mainly in the plain'; 26 $limit = 4; 27 $end_char = '&nbsp;'; 28 $preserve_words = FALSE; 29 30 $short_description = html::limit_chars($long_description, $limit, $end_char, $preserve_words); 31 33 32 Generates: <pre>The r </pre> 33 34 **** 35 36 ### Alternator 37 <code>text::alternator()</code> accepts multiple parameters. 38 39 echo text::alternator('what the hell does this do again?'); 40 41 **** 42 43 ### Random 44 <code>text::random()</code> accepts multiple optional parameters. 45 Returns a random text string of specified length. 46 47 echo text::random($type = 'alnum', $length = 10); 48 49 50 **** 51 52 ### Censor 53 <code>text::censor()</code> accepts multiple optional parameters. The input string and an array of marker 54 words is required. 55 Returns a string with the marker words censored by the specified replacement character. 56 57 $str = 'The income tax is a three letter word, but telemarketers are scum.'; 58 $replacement = '*'; 59 $badwords = array('tax', 'scum'); 60 echo text::censor($str, $badwords, $replacement, $replace_partial_words = FALSE); 61 62 Generates <pre>The income *** is a three letter word, but telemarketers are ****.</pre> 63 64 <?php echo $this->load->view('user_guide/en/abbr') ?> 65 <?php /* $Id$ */ ?> -
trunk/modules/user_guide/views/user_guide/en/helpers/url.php
r496 r502 1 Article status [ First Draft] requires [Editing] Complete and Describe parameters2 # U RLHelper3 Provides methods for working with U niform Resource Locators1 Article status [Draft] requires [Editing] Amendments and corrections 2 # Url Helper 3 Provides methods for working with URL (s) 4 4 5 ### Base URL 6 The **url::base()** method accepts one **optional** parameter. 5 ## Methods 6 7 ### Base 8 <code>url::base()</code> accepts one **optional** parameter. 7 9 Returns the *base_url* defined in <file>config</file> 8 10 9 <code>echo url::base();</code> 11 // base_url = "http://localhost/kohana/" 12 echo url::base(); 10 13 11 ### Site URL 12 The **url::site()** method accepts one **mandatory** parameter. 14 Generates 15 16 http://localhost/kohana/ 17 18 **** 19 20 ### Site 21 <code>url::site()</code> accepts one **mandatory** parameter. 13 22 Returns a url, based on the *base_url*, *index_page*, *url_suffix* defined in <file>config</file> and the url segments passed to the method. 14 23 15 <code>echo url::site($uri);</code> 24 // base_url = 'http://localhost/kohana/' 25 // index_page = 'index.php' 26 // url_suffix = '' 27 $uri = 'welcome'; 28 echo url::site($uri); 29 30 Generates 31 32 http://localhost/kohana/index.php/welcome 33 34 **** 16 35 17 36 ### Title 18 The **url::title()** methodaccepts multiple parameters. Only the input **title** string is mandatory.37 <code>url::title()</code> accepts multiple parameters. Only the input **title** string is mandatory. 19 38 Returns a properly formatted title, for use in a URI. 20 39 21 <pre> 22 <code> 23 $input_title = " _Eclectic title's entered by crazed users- ?> "; 40 $input_title = " _Eclectic title's entered by crazed users- ?> "; 24 41 25 echo url::title($input_title, $seperator = '_'); 26 </code> 27 </pre> 42 echo url::title($input_title, $seperator = '_'); 28 43 29 Generates: <pre>Eclectic_titles_entered_by_crazed_users-</pre> 44 45 Generates: 46 47 Eclectic_titles_entered_by_crazed_users- 48 49 **** 30 50 31 51 ### Redirect 32 The **url::redirect()** methodaccepts multiple **optional** parameters.33 Generates an HTTP Server Header (302), which will redirect the browser to a specified URL, *base_url* by default.52 <code>url::redirect()</code> accepts multiple **optional** parameters. 53 Generates an HTTP Server Header (302), which will redirect the browser to a specified URL, by default *base_url*. 34 54 35 <code>url::redirect("www.whitehouse.gov");</code> 55 url::redirect("www.whitehouse.gov"); 56 57 Will redirect the browser to the Big house website. 58 59 60 <?php echo $this->load->view('user_guide/en/abbr') ?> 61 <?php /* $Id$ */ ?>
