From 53b8ef524529e6ca9f32ad49d36c5140df84feb0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 8 Nov 2012 21:38:53 +0200 Subject: Polish docs for HTML, Inflector, Language, Number, Path, Security and Smiley helpers Also fixed a DB_cache bug introduced in previous commit and removed an unused parameter in a smiley helper --- user_guide_src/source/helpers/html_helper.rst | 296 ++++++++++++--------- user_guide_src/source/helpers/inflector_helper.rst | 82 +++--- user_guide_src/source/helpers/language_helper.rst | 25 +- user_guide_src/source/helpers/number_helper.rst | 32 +-- user_guide_src/source/helpers/path_helper.rst | 31 ++- user_guide_src/source/helpers/security_helper.rst | 70 +++-- user_guide_src/source/helpers/smiley_helper.rst | 70 ++--- 7 files changed, 352 insertions(+), 254 deletions(-) (limited to 'user_guide_src') diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst index 17c28cd2a..df53ebd2f 100644 --- a/user_guide_src/source/helpers/html_helper.rst +++ b/user_guide_src/source/helpers/html_helper.rst @@ -19,6 +19,11 @@ The following functions are available: br() ==== +.. php:function:: br($count = 1) + + :param int $count: Number of times to repeat the tag + :returns: string + Generates line break tags (
) based on the number you submit. Example:: @@ -29,7 +34,14 @@ The above would produce:


heading() ========= -Lets you create HTML

tags. The first parameter will contain the +.. php:function:: heading($data = '', $h = '1', $attributes = '') + + :param string $data: Content + :param string $h: Heading level + :param array $attributes: HTML attributes + :returns: string + +Lets you create HTML heading tags. The first parameter will contain the data, the second the size of the heading. Example:: echo heading('Welcome!', 3); @@ -37,9 +49,7 @@ data, the second the size of the heading. Example:: The above would produce:

Welcome!

Additionally, in order to add attributes to the heading tag such as HTML -classes, ids or inline styles, a third parameter is available. - -:: +classes, ids or inline styles, a third parameter is available:: echo heading('Welcome!', 3, 'class="pink"') @@ -48,28 +58,31 @@ The above code produces:

Welcome!<

img() ===== -Lets you create HTML tags. The first parameter contains the -image source. Example +.. php:function:: img($src = '', $index_page = FALSE, $attributes = '') -:: + :param string $src: Image source data + :param bool $index_page: Whether to treat $src as a routed URI string + :param array $attributes: HTML attributes + :returns: string + +Lets you create HTML tags. The first parameter contains the +image source. Example:: echo img('images/picture.jpg'); // gives There is an optional second parameter that is a TRUE/FALSE value that -specifics if the src should have the page specified by -$config['index_page'] added to the address it creates. Presumably, this -would be if you were using a media controller. - -:: +specifics if the *src* should have the page specified by +``$config['index_page']`` added to the address it creates. +Presumably, this would be if you were using a media controller:: echo img('images/picture.jpg', TRUE); // gives -Additionally, an associative array can be passed to the img() function -for complete control over all attributes and values. If an alt attribute +Additionally, an associative array can be passed to the ``img()`` function +for complete control over all attributes and values. If an *alt* attribute is not provided, CodeIgniter will generate an empty string. -:: +Example:: $image_properties = array(            'src' => 'images/picture.jpg',            @@ -81,128 +94,136 @@ is not provided, CodeIgniter will generate an empty string. 'rel' => 'lightbox' ); - img($image_properties); // Me, demonstrating how to eat 4 slices of pizza at one time + img($image_properties); + // Me, demonstrating how to eat 4 slices of pizza at one time link_tag() -=========== +========== -Lets you create HTML tags. This is useful for stylesheet links, -as well as other links. The parameters are href, with optional rel, -type, title, media and index_page. index_page is a TRUE/FALSE value -that specifics if the href should have the page specified by -$config['index_page'] added to the address it creates. +.. php:function:: ling_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE) -:: + :param string $href: What are we linking to + :param string $rel: Relation type + :param string $type: Type of the related document + :param string $title: Link title + :param string $media: Media type + :param bool $index_page: Whether to treat $src as a routed URI string + :returns: string - echo link_tag('css/mystyles.css'); // gives +Lets you create HTML tags. This is useful for stylesheet links, +as well as other links. The parameters are *href*, with optional *rel*, +*type*, *title*, *media* and *index_page*. + +*index_page* is a boolean value that specifies if the *href* should have +the page specified by ``$config['index_page']`` added to the address it creates. +Example:: -Further examples + echo link_tag('css/mystyles.css'); + // gives -:: - echo link_tag('favicon.ico', 'shortcut icon', 'image/ico'); // +Further examples:: - echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed'); // + echo link_tag('favicon.ico', 'shortcut icon', 'image/ico'); + // -Additionally, an associative array can be passed to the link() function -for complete control over all attributes and values. + echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed'); + // -:: +Additionally, an associative array can be passed to the ``link()`` function +for complete control over all attributes and values:: $link = array(            - 'href' => 'css/printer.css',            - 'rel' => 'stylesheet',            - 'type' => 'text/css',            - 'media' => 'print' + 'href' => 'css/printer.css', + 'rel' => 'stylesheet', + 'type' => 'text/css', + 'media' => 'print' ); - echo link_tag($link); // - + echo link_tag($link); + // nbs() ===== -Generates non-breaking spaces ( ) based on the number you submit. -Example +.. php:function:: nbs($num = 1) -:: + :param int $num: Number of space entities to produce + :returns: string - echo nbs(3); +Generates non-breaking spaces ( ) based on the number you submit. +Example:: -The above would produce + echo nbs(3); -:: +The above would produce::     -ol() and ul() +ul() and ol() ============= -Permits you to generate ordered or unordered HTML lists from simple or -multi-dimensional arrays. Example +.. php:function:: ul($list, $attributes = '') -:: + :param array $list: List entries + :param array $attributes: HTML attributes + :returns: string - $this->load->helper('html'); +Permits you to generate ordered or unordered HTML lists from simple or +multi-dimensional arrays. Example:: - $list = array(              - 'red',              - 'blue',              - 'green',              - 'yellow'              + $list = array( + 'red', + 'blue', + 'green', + 'yellow' ); - $attributes = array(                      - 'class' => 'boldlist',                      - 'id'    => 'mylist'                     + $attributes = array( + 'class' => 'boldlist', + 'id' => 'mylist' ); echo ul($list, $attributes); -The above code will produce this - -:: +The above code will produce this:: -    -
  • red
  •    -
  • blue
  •    -
  • green
  •    + +
  • red
  • +
  • blue
  • +
  • green
  • yellow
  • -Here is a more complex example, using a multi-dimensional array - -:: - - $this->load->helper('html'); +Here is a more complex example, using a multi-dimensional array:: - $attributes = array(                      - 'class' => 'boldlist',                      - 'id'    => 'mylist'                      + $attributes = array( + 'class' => 'boldlist', + 'id' => 'mylist' ); - $list = array(              - 'colors' => array(                                  - 'red',                                  - 'blue',                                  - 'green'                              + $list = array( + 'colors' => array( + 'red', + 'blue', + 'green' ), - 'shapes' => array(                                  - 'round',                                  - 'square',                                  - 'circles' => array(                                              + 'shapes' => array( + 'round', + 'square', + 'circles' => array( 'ellipse', 'oval', 'sphere' - )                              - ),              - 'moods' => array(                                  - 'happy',                                  - 'upset' => array(                                          + ) + ), + 'moods' => array( + 'happy', + 'upset' => array( 'defeated' => array( - 'dejected',                 + 'dejected', 'disheartened', 'depressed' ), @@ -215,59 +236,74 @@ Here is a more complex example, using a multi-dimensional array echo ul($list, $attributes); -The above code will produce this - -:: - -    -
  • colors      -
             -
    • red
    •        -
    • blue
    •        -
    • green
    •      -
       -
  •    -
  • shapes      -
             -
    • round
    •        -
    • suare
    •        -
    • circles          -
                   -
      • elipse
      •            -
      • oval
      •            -
      • sphere
      •          -
             -
    •      -
       -
  •    -
  • moods      -
             -
    • happy
    •        -
    • upset          -
                   -
      • defeated              -
                         +The above code will produce this:: + + +
        • colors +
            +
          • red
          • +
          • blue
          • +
          • green
          • +
          +
        • +
        • shapes +
            +
          • round
          • +
          • suare
          • +
          • circles +
              +
            • elipse
            • +
            • oval
            • +
            • sphere
            • +
            +
          • +
          +
        • +
        • moods +
            +
          • happy
          • +
          • upset +
              +
            • defeated +
              • dejected
              • disheartened
              • depressed
            • annoyed
            • -
            • cross
            •            -
            • angry
            •          -
                   -
          •      -
             +
        • cross
        • +
        • angry
        • +
        +
      • +
    +.. php:function:: ol($list, $attributes = '') + + :param array $list: List entries + :param array $attributes: HTML attributes + :returns: string + +Identical to :php:func:`ul()`, only it produces the
      tag for +ordered lists instead of
        . + meta() ====== +.. php:function:: meta($name = '', $content = '', $type = 'name', $newline = "\n") + + :param string $name: Meta name + :param string $content: Meta content + :param string $type: Meta type + :param string $newline: Newline character + :returns: string + Helps you generate meta tags. You can pass strings to the function, or -simple arrays, or multidimensional ones. Examples +simple arrays, or multidimensional ones. -:: +Examples:: echo meta('description', 'My Great site'); // Generates: @@ -279,7 +315,7 @@ simple arrays, or multidimensional ones. Examples echo meta(array('name' => 'robots', 'content' => 'no-cache')); // Generates: - $meta = array(          + $meta = array( array( 'name' => 'robots', 'content' => 'no-cache' @@ -291,7 +327,7 @@ simple arrays, or multidimensional ones. Examples array( 'name' => 'keywords', 'content' => 'love, passion, intrigue, deception' - ),          + ), array( 'name' => 'robots', 'content' => 'no-cache' @@ -313,10 +349,14 @@ simple arrays, or multidimensional ones. Examples doctype() ========= +.. php:function:: doctype($type = 'xhtml1-strict') + + :param string $type: Doctype name + Helps you generate document type declarations, or DTD's. XHTML 1.0 Strict is used by default, but many doctypes are available. -:: +Example:: echo doctype(); // diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst index cc46a1851..1f54b76c0 100644 --- a/user_guide_src/source/helpers/inflector_helper.rst +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -10,9 +10,7 @@ words to plural, singular, camel case, etc. Loading this Helper =================== -This helper is loaded using the following code - -:: +This helper is loaded using the following code:: $this->load->helper('inflector'); @@ -21,65 +19,81 @@ The following functions are available: singular() ========== -Changes a plural word to singular. Example +.. php:function:: singular($str) + + :param string $str: Input string + :returns: string -:: +Changes a plural word to singular. Example:: - $word = "dogs"; - echo singular($word); // Returns "dog" + echo singular('dogs'); // Prints 'dog' plural() ======== -Changes a singular word to plural. Example - -:: - - $word = "dog"; - echo plural($word); // Returns "dogs" +.. php:function:: plural($str) -To force a word to end with "es" use a second "true" argument. + :param string $str: Input string + :returns: string -:: +Changes a singular word to plural. Example:: - $word = "pass"; - echo plural($word, TRUE); // Returns "passes" + echo plural('dog'); // Prints 'dogs' camelize() ========== -Changes a string of words separated by spaces or underscores to camel -case. Example +.. php:function:: camelize($str) + + :param string $str: Input string + :returns: string -:: +Changes a string of words separated by spaces or underscores to camel +case. Example:: - $word = "my_dog_spot"; - echo camelize($word); // Returns "myDogSpot" + echo camelize('my_dog_spot'); // Prints 'myDogSpot' underscore() ============ -Takes multiple words separated by spaces and underscores them. Example +.. php:function:: camelize($str) -:: + :param string $str: Input string + :returns: string - $word = "my dog spot"; - echo underscore($word); // Returns "my_dog_spot" +Takes multiple words separated by spaces and underscores them. +Example:: + + echo underscore('my dog spot'); // Prints 'my_dog_spot' humanize() ========== +.. php:function:: camelize($str) + + :param string $str: Input string + :param string $separator: Input separator + :returns: string + Takes multiple words separated by underscores and adds spaces between -them. Each word is capitalized. Example +them. Each word is capitalized. + +Example:: + + echo humanize('my_dog_spot'); // Prints 'My Dog Spot' + +To use dashes instead of underscores:: + + echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot' -:: +is_countable() +============== - $word = "my_dog_spot"; - echo humanize($word); // Returns "My Dog Spot" +.. php:function:: is_countable($word) -To use dashes instead of underscores + :param string $word: Input string + :returns: bool -:: +Checks if the given word has a plural version. Example:: - $word = "my-dog-spot"; - echo humanize($word, '-'); // Returns "My Dog Spot" \ No newline at end of file + is_countable('equipment'); // Returns FALSE \ No newline at end of file diff --git a/user_guide_src/source/helpers/language_helper.rst b/user_guide_src/source/helpers/language_helper.rst index b7b23d149..8b039374d 100644 --- a/user_guide_src/source/helpers/language_helper.rst +++ b/user_guide_src/source/helpers/language_helper.rst @@ -10,24 +10,27 @@ language files. Loading this Helper =================== -This helper is loaded using the following code - -:: +This helper is loaded using the following code:: $this->load->helper('language'); The following functions are available: -lang('language line', 'element id') -=================================== +lang() +====== + +.. php:function:: lang($line, $id = '') + + :param string $line: Language line key + :param string $id: ID of the element we're creating a label for + :returns: string This function returns a line of text from a loaded language file with -simplified syntax that may be more desirable for view files than calling -`$this->lang->line()`. The optional second parameter will also output a -form label for you. Example +simplified syntax that may be more desirable for view files than +``CI_Lang::line()``. +The optional second parameter will also output a form label for you. -:: +Example:: echo lang('language_key', 'form_item_id'); - // becomes - + // becomes \ No newline at end of file diff --git a/user_guide_src/source/helpers/number_helper.rst b/user_guide_src/source/helpers/number_helper.rst index af6cdad57..8e0ebda5e 100644 --- a/user_guide_src/source/helpers/number_helper.rst +++ b/user_guide_src/source/helpers/number_helper.rst @@ -10,9 +10,7 @@ numeric data. Loading this Helper =================== -This helper is loaded using the following code - -:: +This helper is loaded using the following code:: $this->load->helper('number'); @@ -21,25 +19,27 @@ The following functions are available: byte_format() ============= -Formats a numbers as bytes, based on size, and adds the appropriate -suffix. Examples +.. php:function:: byte_format($num, $precision = 1) + + :param mixed $num: Number of bytes + :param int $precision: Floating point precision + :returns: string -:: +Formats numbers as bytes, based on size, and adds the appropriate +suffix. Examples:: - echo byte_format(456); // Returns 456 Bytes - echo byte_format(4567); // Returns 4.5 KB - echo byte_format(45678); // Returns 44.6 KB - echo byte_format(456789); // Returns 447.8 KB - echo byte_format(3456789); // Returns 3.3 MB - echo byte_format(12345678912345); // Returns 1.8 GB + echo byte_format(456); // Returns 456 Bytes + echo byte_format(4567); // Returns 4.5 KB + echo byte_format(45678); // Returns 44.6 KB + echo byte_format(456789); // Returns 447.8 KB + echo byte_format(3456789); // Returns 3.3 MB + echo byte_format(12345678912345); // Returns 1.8 GB echo byte_format(123456789123456789); // Returns 11,228.3 TB An optional second parameter allows you to set the precision of the -result. - -:: +result:: echo byte_format(45678, 2); // Returns 44.61 KB .. note:: The text generated by this function is found in the following - language file: language//number_lang.php + language file: `language//number_lang.php` \ No newline at end of file diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst index 847f5a08b..3a271b28f 100644 --- a/user_guide_src/source/helpers/path_helper.rst +++ b/user_guide_src/source/helpers/path_helper.rst @@ -10,9 +10,7 @@ file paths on the server. Loading this Helper =================== -This helper is loaded using the following code - -:: +This helper is loaded using the following code:: $this->load->helper('path'); @@ -21,23 +19,28 @@ The following functions are available: set_realpath() ============== -Checks to see if the path exists. This function will return a server -path without symbolic links or relative directory structures. An -optional second argument will cause an error to be triggered if the path -cannot be resolved. +.. php:function:: set_realpath($path, $check_existance = FALSE) + + :param string $path: Path + :param bool $check_existance: Whether to check if the path actually exists + :returns: string + +This function will return a server path without symbolic links or +relative directory structures. An optional second argument will +cause an error to be triggered if the path cannot be resolved. -:: +Examples:: $file = '/etc/php5/apache2/php.ini'; - echo set_realpath($file); // returns "/etc/php5/apache2/php.ini" + echo set_realpath($file); // Prints '/etc/php5/apache2/php.ini' $non_existent_file = '/path/to/non-exist-file.txt'; - echo set_realpath($non_existent_file, TRUE); // shows an error, as the path cannot be resolved - echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt" + echo set_realpath($non_existent_file, TRUE); // Shows an error, as the path cannot be resolved + echo set_realpath($non_existent_file, FALSE); // Prints '/path/to/non-exist-file.txt' $directory = '/etc/php5'; - echo set_realpath($directory); // returns "/etc/php5/" + echo set_realpath($directory); // Prints '/etc/php5/' $non_existent_directory = '/path/to/nowhere'; - echo set_realpath($non_existent_directory, TRUE); // shows an error, as the path cannot be resolved - echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" + echo set_realpath($non_existent_directory, TRUE); // Shows an error, as the path cannot be resolved + echo set_realpath($non_existent_directory, FALSE); // Prints '/path/to/nowhere' \ No newline at end of file diff --git a/user_guide_src/source/helpers/security_helper.rst b/user_guide_src/source/helpers/security_helper.rst index ec0be28b3..21bf53490 100644 --- a/user_guide_src/source/helpers/security_helper.rst +++ b/user_guide_src/source/helpers/security_helper.rst @@ -9,9 +9,7 @@ The Security Helper file contains security related functions. Loading this Helper =================== -This helper is loaded using the following code - -:: +This helper is loaded using the following code:: $this->load->helper('security'); @@ -20,25 +18,47 @@ The following functions are available: xss_clean() =========== -Provides Cross Site Script Hack filtering. This function is an alias to -the one in the :doc:`Input class <../libraries/input>`. More info can -be found there. +.. php:function:: xss_clean($str, $is_image = FALSE) + + :param string $str: Input data + :param bool $is_image: Whether we're dealing with an image + :returns: string + +Provides Cross Site Script Hack filtering. + +This function is an alias for ``CI_Input::xss_clean()``. For more info, +please see the :doc:`Input Library <../libraries/input>` documentation. sanitize_filename() =================== -Provides protection against directory traversal. This function is an -alias to the one in the :doc:`Security class <../libraries/security>`. -More info can be found there. +.. php:function:: sanitize_filename($filename) + + :param string $filename: Filename + :returns: string + +Provides protection against directory traversal. + +This function is an alias for ``CI_Security::sanitize_filename()``. +For more info, please see the :doc:`Security Library <../libraries/security>` +documentation. do_hash() ========= +.. php:function:: do_hash($str, $type = 'sha1') + + :param string $str: Input + :param string $type: Algorithm + :returns: string + Permits you to create one way hashes suitable for encrypting -passwords. Will create SHA1 by default. See `hash_algos() `_ +passwords. Will use SHA1 by default. + +See `hash_algos() `_ for a full list of supported algorithms. -:: +Examples:: $str = do_hash($str); // SHA1 $str = do_hash($str, 'md5'); // MD5 @@ -51,20 +71,34 @@ for a full list of supported algorithms. strip_image_tags() ================== -This is a security function that will strip image tags from a string. It -leaves the image URL as plain text. +.. php:function:: strip_image_tags($str) + + :param string $str: Input + :returns: string + +This is a security function that will strip image tags from a string. +It leaves the image URL as plain text. -:: +Example:: $string = strip_image_tags($string); +This function is an alias for ``CI_Security::strip_image_tags()``. For +more info, please see the :doc:`Security Library <../libraries/security>` +documentation. + encode_php_tags() ================= -This is a security function that converts PHP tags to entities. Note: If -you use the XSS filtering function it does this automatically. +.. php:function:: encode_php_tags($str) + + :param string $str: Input + :returns: string + +This is a security function that converts PHP tags to entities. -:: +.. note: :php:func:`xss_clean()` does this automatically, if you use it. - $string = encode_php_tags($string); +Example:: + $string = encode_php_tags($string); \ No newline at end of file diff --git a/user_guide_src/source/helpers/smiley_helper.rst b/user_guide_src/source/helpers/smiley_helper.rst index 941ba11e3..13841e8bd 100644 --- a/user_guide_src/source/helpers/smiley_helper.rst +++ b/user_guide_src/source/helpers/smiley_helper.rst @@ -10,9 +10,7 @@ The Smiley Helper file contains functions that let you manage smileys Loading this Helper =================== -This helper is loaded using the following code - -:: +This helper is loaded using the following code:: $this->load->helper('smiley'); @@ -36,10 +34,11 @@ smileys next to a form field. This example requires that you first download and install the smiley images, then create a controller and the View as described. -.. important:: Before you begin, please `download the smiley images `_ - and put them in a publicly accessible place on your server. This helper - also assumes you have the smiley replacement array located at - `application/config/smileys.php` +.. important:: Before you begin, please `download the smiley images + `_ + and put them in a publicly accessible place on your server. + This helper also assumes you have the smiley replacement array + located at `application/config/smileys.php` The Controller -------------- @@ -47,18 +46,17 @@ The Controller In your `application/controllers/` folder, create a file called smileys.php and place the code below in it. -.. important:: Change the URL in the `get_clickable_smileys()` +.. important:: Change the URL in the :php:func:`get_clickable_smileys()` function below so that it points to your smiley folder. -You'll notice that in addition to the smiley helper we are using the :doc:`Table Class <../libraries/table>`. - -:: +You'll notice that in addition to the smiley helper, we are also using +the :doc:`Table Class <../libraries/table>`:: load->helper('smiley'); $this->load->library('table'); @@ -69,12 +67,11 @@ You'll notice that in addition to the smiley helper we are using the :doc:`Table $data['smiley_table'] = $this->table->generate($col_array); $this->load->view('smiley_view', $data); } + } In your `application/views/` folder, create a file called `smiley_view.php` -and place this code in it: - -:: +and place this code in it:: @@ -102,59 +99,66 @@ links a generic name that will be tied to a specific id in your view. $image_array = get_smiley_links("http://example.com/images/smileys/", "comment_textarea_alias"); -To map the alias to the field id, pass them both into the `smiley_js` -function - -:: +To map the alias to the field id, pass them both into the +:php:func:`smiley_js()` function:: $image_array = smiley_js("comment_textarea_alias", "comments"); -****************** -Function Reference -****************** - get_clickable_smileys() ======================= +.. php:function:: get_clickable_smileys($image_url, $alias = '', $smileys = NULL) + + :param string $image_url: URL path to the smileys directory + :param string $alias: Field alias + :returns: array + Returns an array containing your smiley images wrapped in a clickable link. You must supply the URL to your smiley folder and a field id or field alias. -:: +Example:: $image_array = get_smiley_links("http://example.com/images/smileys/", "comment"); -Note: Usage of this function without the second parameter, in -combination with `js_insert_smiley` has been deprecated. - smiley_js() =========== +.. php:function:: smiley_js($alias = '', $field_id = '', $inline = TRUE) + + :param string $alias: Field alias + :param string $field_id: Field ID + :param bool $inline: Whether we're inserting an inline smiley + Generates the JavaScript that allows the images to be clicked and inserted into a form field. If you supplied an alias instead of an id when generating your smiley links, you need to pass the alias and corresponding form id into the function. This function is designed to be placed into the area of your web page. -:: +Example:: -Note: This function replaces `js_insert_smiley`, which has been -deprecated. - parse_smileys() =============== +.. php:function:: parse_smileys($str = '', $image_url = '', $smileys = NULL) + + :param string $str: Text containing smiley codes + :param string $image_url: URL path to the smileys directory + :param array $smileys: An array of smileys + :returns: string + Takes a string of text as input and replaces any contained plain text smileys into the image equivalent. The first parameter must contain your string, the second must contain the URL to your smiley folder -:: +Example:: $str = 'Here are some simileys: :-) ;-)'; $str = parse_smileys($str, "http://example.com/images/smileys/"); echo $str; -.. |smile!| image:: ../images/smile.gif +.. |smile!| image:: ../images/smile.gif \ No newline at end of file -- cgit v1.2.3-24-g4f1b