Show
Ignore:
Timestamp:
09/05/2007 01:17:11 PM (15 months ago)
Author:
OscarB
Message:

UG updates: Tidying and updating helpers content

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  
    11Article status [Draft] requires [Editing] Comments and corrections 
    22# Cookie Helper 
    3 Provides methods for setting, updating and deleting COOKIES. 
     3Provides methods for working with COOKIE data. 
    44 
    55## Configuration 
    6 Default settings for COOKIES are specified in <file>application/config/cookie</file>. You may override 
    7 these settings by passing discrete parameters when calling the helper. 
     6Default settings for Cookies are specified in <file>application/config/cookie</file>. You may override 
     7these settings by passing parameters to the helper. 
    88 
    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> 
     9prefix 
     10: A prefix may be set to avoid name collisions. Default is <code>''</code>. 
    3411 
    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( 
     12domain 
     13: A valid domain, for which the Cookie may be written. Default is <code>''</code> (equivalent to *localhost*.) 
     14For site-wide Cookies, prefix your domain with a period <code>.example.com</code> 
     15 
     16path 
     17: A valid path for which the Cookie may be written. Default is the root directory <code>'/'</code> 
     18 
     19expire 
     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. 
     21Note: Set to *0* (zero) seconds for a Cookie which expires when the browser is closed. 
     22 
     23secure 
     24: The Cookie will **only** be allowed over a secure transfer protocol (HTTPS). Default is <code>FALSE</code> 
     25 
     26httponly 
     27: The Cookie can be accessed via HTTP only, and not via client scripts. Default is <code>FALSE</code> 
     28Note: 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 /> 
     34You may pass parameters to this method as discrete values: 
     35 
     36    cookie::set($name, $value, $expire, $path, $domain, $secure, $httponly, $prefix); 
     37 
     38Or you may pass an associative array of values as a parameter: 
     39 
     40    $cookie_params = array( 
    4541                   'name'   => 'Very_Important_Cookie', 
    4642                   'value'  => 'Choclate Flavoured Mint Delight', 
     
    5046                   'prefix' => 'one_', 
    5147                       ); 
    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); 
    7149 
    7250 
    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 
     58Setting the third parameter to <code>TRUE</code> will filter the Cookie for unsafe data. 
     59 
     60Returns <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 /> 
     66This 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 descriptions 
     1Article status [Draft] requires [Editing]  
    22# File Helper 
    3 Provides methods for splitting and joining FILES. 
     3Provides methods for splitting and joining Files. 
     4 
     5## Methods 
    46 
    57### Split a file into segments. 
    6 The **file::split()** method accepts multiple parameters. Only the input **filename** is required. 
     8<code>file::split()</code> accepts multiple parameters. Only the input **filename** is required. 
    79Returns 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**** 
    1114 
    1215### Join segments of a split file. 
    13 The **file::join()** method accepts multiple parameters. Only the input segment **filename** is required. 
     16<code>file::join()</code> accepts multiple parameters. Only the input segment **filename** is required. 
    1417Returns 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 [First Draft] requires [Editing] Complete and Describe parameters 
    2 # HTML Helper 
    3 Provides methods for html generation. 
     1Article status [Draft] requires [Editing] Complete and Describe parameters 
     2# Html Helper 
     3Provides methods for HTML generation. 
    44 
    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 
    86 
    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. 
     9Converts special characters to html entities, using the UFT-8 character set. 
    1210 
    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); 
    1512 
    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 
     18A standard html anchor link is generated. If you want to generate a link that is internal to your website, 
    1719pass only the url segments to the function, and the anchor is automatically constructed from the site url 
    1820defined in <file>config</file> 
    1921 
    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!')); 
    2323 
    24 Generates <code>&lt;a href="http://example.com/index.php/pub/articles/7" title="Fuel price increase!"&gt;Articles&lt;/a&gt;</code> 
     24Generates  
    2525 
     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 
     37Generates 
     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 
     50Generates 
     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') ?> 
    2656<?php /* $Id$ */ ?> 
  • trunk/modules/user_guide/views/user_guide/en/helpers/text.php

    r496 r502  
    1 Article status [First Draft] requires [Editing] Describe parameters 
     1Article status [Draft] requires [Editing] Complete Alternator method 
    22# Text Helper 
    3 Provides methods for working with TEXT. 
     3Provides methods for working with Text. 
     4 
     5## Methods 
    46 
    57### Word Limiter 
    6 The **text::limit_words()** method accepts multiple parameters. Only the input **string** is required. 
     8<code>text::limit_words()</code> accepts multiple parameters. Only the input **string** is required. 
    79The 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 = '&amp;nbsp;'; 
    1310 
    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 = '&amp;nbsp;'; 
     14 
     15    $short_description = html::limit_words($long_description, $limit, $end_char); 
     16 
    1717Generates: <pre>The rain in Spain </pre> 
    1818 
     19**** 
    1920 
    2021### Character Limiter 
    21 The **text::limit_chars()** method accepts multiple parameters. Only the input **string** is required. 
     22<code>text::limit_chars()</code> accepts multiple parameters. Only the input **string** is required. 
    2223The 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 = '&amp;nbsp;'; 
    28 $preserve_words = FALSE; 
    2924 
    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 = '&amp;nbsp;'; 
     28    $preserve_words = FALSE; 
     29 
     30    $short_description = html::limit_chars($long_description, $limit, $end_char, $preserve_words); 
     31 
    3332Generates: <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. 
     45Returns 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 
     54words is required. 
     55Returns 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 
     62Generates <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 parameters 
    2 # URL Helper 
    3 Provides methods for working with Uniform Resource Locators 
     1Article status [Draft] requires [Editing] Amendments and corrections 
     2# Url Helper 
     3Provides methods for working with URL (s) 
    44 
    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. 
    79Returns the *base_url* defined in <file>config</file> 
    810 
    9 <code>echo url::base();</code> 
     11    // base_url = "http://localhost/kohana/" 
     12    echo url::base(); 
    1013 
    11 ### Site URL 
    12 The **url::site()** method accepts one **mandatory** parameter. 
     14Generates  
     15 
     16    http://localhost/kohana/ 
     17 
     18**** 
     19 
     20### Site 
     21<code>url::site()</code> accepts one **mandatory** parameter. 
    1322Returns a url, based on the *base_url*, *index_page*, *url_suffix* defined in <file>config</file> and the url segments passed to the method. 
    1423 
    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 
     30Generates 
     31 
     32    http://localhost/kohana/index.php/welcome 
     33 
     34**** 
    1635 
    1736### Title 
    18 The **url::title()** method accepts multiple parameters. Only the input **title** string is mandatory. 
     37<code>url::title()</code> accepts multiple parameters. Only the input **title** string is mandatory. 
    1938Returns a properly formatted title, for use in a URI. 
    2039 
    21 <pre> 
    22 <code> 
    23 $input_title = " _Eclectic title's entered by crazed users- ?&gt;  "; 
     40    $input_title = " _Eclectic title's entered by crazed users- ?>  "; 
    2441 
    25 echo url::title($input_title, $seperator = '_'); 
    26 </code> 
    27 </pre> 
     42    echo url::title($input_title, $seperator = '_'); 
    2843 
    29 Generates: <pre>Eclectic_titles_entered_by_crazed_users-</pre> 
     44 
     45Generates:  
     46         
     47    Eclectic_titles_entered_by_crazed_users- 
     48 
     49**** 
    3050 
    3151### Redirect 
    32 The **url::redirect()** method accepts 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. 
     53Generates an HTTP Server Header (302), which will redirect the browser to a specified URL, by default *base_url*. 
    3454 
    35 <code>url::redirect("www.whitehouse.gov");</code> 
     55    url::redirect("www.whitehouse.gov"); 
     56 
     57Will redirect the browser to the Big house website. 
     58 
     59 
     60<?php echo $this->load->view('user_guide/en/abbr') ?> 
     61<?php /* $Id$ */ ?>