From d8e1ac7c7fed6310669480fc5be58dff3a479cf5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 22:22:37 +0300 Subject: Fix some examples in the user guide --- user_guide_src/source/general/styleguide.rst | 2 +- user_guide_src/source/general/views.rst | 22 ++++++++--------- user_guide_src/source/libraries/file_uploading.rst | 16 ++++++------- .../source/libraries/form_validation.rst | 4 ++-- user_guide_src/source/libraries/xmlrpc.rst | 28 ++++++++++++---------- 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/user_guide_src/source/general/styleguide.rst b/user_guide_src/source/general/styleguide.rst index c97f23817..2b91d1cc0 100644 --- a/user_guide_src/source/general/styleguide.rst +++ b/user_guide_src/source/general/styleguide.rst @@ -94,7 +94,7 @@ overly long and verbose names. class Super_class { - function __construct() + public function __construct() { } diff --git a/user_guide_src/source/general/views.rst b/user_guide_src/source/general/views.rst index dc65f6c4f..9b7c9daaa 100644 --- a/user_guide_src/source/general/views.rst +++ b/user_guide_src/source/general/views.rst @@ -49,7 +49,7 @@ replace the echo statement with the view loading function:: load->view('blogview'); } @@ -74,14 +74,14 @@ might look something like this:: class Page extends CI_Controller { - function index() - { - $data['page_title'] = 'Your title'; - $this->load->view('header'); - $this->load->view('menu'); - $this->load->view('content', $data); - $this->load->view('footer'); - } + public function index() + { + $data['page_title'] = 'Your title'; + $this->load->view('header'); + $this->load->view('menu'); + $this->load->view('content', $data); + $this->load->view('footer'); + } } ?> @@ -126,7 +126,7 @@ Let's try it with your controller file. Open it add this code:: load->helper(array('form', 'url')); } - function index() + public function index() { $this->load->view('upload_form', array('error' => ' ' )); } - function do_upload() + public function do_upload() { - $config['upload_path'] = './uploads/'; - $config['allowed_types'] = 'gif|jpg|png'; - $config['max_size'] = '100'; - $config['max_width'] = '1024'; - $config['max_height'] = '768'; + $config['upload_path'] = './uploads/'; + $config['allowed_types'] = 'gif|jpg|png'; + $config['max_size'] = 100; + $config['max_width'] = 1024; + $config['max_height'] = 768; $this->load->library('upload', $config); diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index 5d7368ccb..3e8855f60 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -123,7 +123,7 @@ this code and save it to your applications/controllers/ folder:: class Form extends CI_Controller { - function index() + public function index() { $this->load->helper(array('form', 'url')); @@ -219,7 +219,7 @@ Your controller should now look like this:: class Form extends CI_Controller { - function index() + public function index() { $this->load->helper(array('form', 'url')); diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index 3b945769f..dfb88114e 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -184,10 +184,10 @@ server will expect a class to exist with this prototype:: class My_blog extends CI_Controller { - function new_post($request) - { + public function new_post($request) + { - } + } } The $request variable is an object compiled by the Server, which @@ -304,7 +304,7 @@ folder:: class Xmlrpc_client extends CI_Controller { - function index() + public function index() { $this->load->helper('url'); $server_url = site_url('xmlrpc_server'); @@ -345,7 +345,7 @@ folder:: class Xmlrpc_server extends CI_Controller { - function index() + public function index() { $this->load->library('xmlrpc'); $this->load->library('xmlrpcs'); @@ -357,15 +357,17 @@ folder:: } - function process($request) + public function process($request) { $parameters = $request->output_parameters(); $response = array( - array( - 'you_said' => $parameters['0'], - 'i_respond' => 'Not bad at all.'), - 'struct'); + array( + 'you_said' => $parameters[0], + 'i_respond' => 'Not bad at all.' + ), + 'struct' + ); return $this->xmlrpc->send_response($response); } @@ -419,9 +421,9 @@ the Server. :: $parameters = $request->output_parameters(); - $name = $parameters['0']['name']; - $size = $parameters['1']['size']; - $size = $parameters['1']['shape']; + $name = $parameters[0]['name']; + $size = $parameters[1]['size']; + $size = $parameters[1]['shape']; ************************** XML-RPC Function Reference -- cgit v1.2.3-24-g4f1b From e92df33e7dda139ee46bddca31aebb4cd5d452fd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 22:44:20 +0300 Subject: Remove remaining access description lines from helpers + some style fixes --- system/helpers/date_helper.php | 67 ++++++++++++++----------------------- system/helpers/directory_helper.php | 2 +- system/helpers/inflector_helper.php | 20 ++++++----- system/helpers/security_helper.php | 2 +- system/helpers/smiley_helper.php | 7 ---- system/helpers/text_helper.php | 29 +++++----------- 6 files changed, 48 insertions(+), 79 deletions(-) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 66f21c1f5..f1ba364f5 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Date Helpers * @@ -44,8 +42,7 @@ * * Returns time() or its GMT equivalent based on the config file preference * - * @access public - * @return integer + * @return int */ if ( ! function_exists('now')) { @@ -85,10 +82,9 @@ if ( ! function_exists('now')) * have to worry about escaping your text letters that * match the date codes. * - * @access public * @param string - * @param integer - * @return integer + * @param int + * @return int */ if ( ! function_exists('mdate')) { @@ -118,9 +114,8 @@ if ( ! function_exists('mdate')) * * Returns a date formatted according to the submitted standard. * - * @access public * @param string the chosen format - * @param integer Unix timestamp + * @param int Unix timestamp * @return string */ if ( ! function_exists('standard_date')) @@ -157,10 +152,9 @@ if ( ! function_exists('standard_date')) * Returns a span of seconds in this format: * 10 days 14 hours 36 minutes 47 seconds * - * @access public - * @param integer a number of seconds - * @param integer Unix timestamp - * @param integer a number of display units + * @param int a number of seconds + * @param int Unix timestamp + * @param int a number of display units * @return string */ if ( ! function_exists('timespan')) @@ -273,10 +267,9 @@ if ( ! function_exists('timespan')) * Takes a month/year as input and returns the number of days * for the given month/year. Takes leap years into consideration. * - * @access public - * @param integer a numeric month - * @param integer a numeric year - * @return integer + * @param int a numeric month + * @param int a numeric year + * @return int */ if ( ! function_exists('days_in_month')) { @@ -294,7 +287,7 @@ if ( ! function_exists('days_in_month')) if ($month == 2) { - if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0)) + if ($year % 400 == 0 OR ($year % 4 == 0 && $year % 100 != 0)) { return 29; } @@ -310,9 +303,8 @@ if ( ! function_exists('days_in_month')) /** * Converts a local Unix timestamp to GMT * - * @access public - * @param integer Unix timestamp - * @return integer + * @param int Unix timestamp + * @return int */ if ( ! function_exists('local_to_gmt')) { @@ -343,11 +335,10 @@ if ( ! function_exists('local_to_gmt')) * at the local value based on the timezone and DST setting * submitted * - * @access public - * @param integer Unix timestamp + * @param int Unix timestamp * @param string timezone * @param bool whether DST is active - * @return integer + * @return int */ if ( ! function_exists('gmt_to_local')) { @@ -374,9 +365,8 @@ if ( ! function_exists('gmt_to_local')) /** * Converts a MySQL Timestamp to Unix * - * @access public - * @param integer Unix timestamp - * @return integer + * @param int Unix timestamp + * @return int */ if ( ! function_exists('mysql_to_unix')) { @@ -409,8 +399,7 @@ if ( ! function_exists('mysql_to_unix')) * * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM * - * @access public - * @param integer Unix timestamp + * @param int Unix timestamp * @param bool whether to show seconds * @param string format: us or euro * @return string @@ -451,9 +440,8 @@ if ( ! function_exists('unix_to_human')) * * Reverses the above process * - * @access public * @param string format: us or euro - * @return integer + * @return int */ if ( ! function_exists('human_to_unix')) { @@ -499,12 +487,12 @@ if ( ! function_exists('human_to_unix')) { $ampm = strtolower($split['2']); - if (substr($ampm, 0, 1) == 'p' AND $hour < 12) + if (substr($ampm, 0, 1) === 'p' && $hour < 12) { $hour = $hour + 12; } - if (substr($ampm, 0, 1) == 'a' AND $hour == 12) + if (substr($ampm, 0, 1) === 'a' && $hour == 12) { $hour = '00'; } @@ -525,10 +513,9 @@ if ( ! function_exists('human_to_unix')) * Turns many "reasonably-date-like" strings into something * that is actually useful. This only works for dates after unix epoch. * - * @access public - * @param string The terribly formatted date-like string - * @param string Date format to return (same as php date function) - * @return string + * @param string The terribly formatted date-like string + * @param string Date format to return (same as php date function) + * @return string */ if ( ! function_exists('nice_date')) { @@ -593,7 +580,6 @@ if ( ! function_exists('nice_date')) * * Generates a drop-down menu of timezones. * - * @access public * @param string timezone * @param string classname * @param string menu name @@ -634,10 +620,9 @@ if ( ! function_exists('timezone_menu')) /** * Timezones * - * Returns an array of timezones. This is a helper function + * Returns an array of timezones. This is a helper function * for various other ones in this library * - * @access public * @param string timezone * @return string */ @@ -698,7 +683,7 @@ if ( ! function_exists('timezones')) $tz = ($tz == 'GMT') ? 'UTC' : $tz; - return ( ! isset($zones[$tz])) ? 0 : $zones[$tz]; + return isset($zones[$tz]) ? $zones[$tz] : 0; } } diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index d7ca13e85..4044ace11 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -85,4 +85,4 @@ if ( ! function_exists('directory_map')) } /* End of file directory_helper.php */ -/* Location: ./system/helpers/directory_helper.php */ +/* Location: ./system/helpers/directory_helper.php */ \ No newline at end of file diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 485806b20..feeaf57d7 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -199,8 +199,8 @@ if ( ! function_exists('underscore')) * * Takes multiple words separated by the separator and changes them to spaces * - * @param string $str - * @param string $separator + * @param string $str + * @param string $separator * @return str */ if ( ! function_exists('humanize')) @@ -214,19 +214,21 @@ if ( ! function_exists('humanize')) /** * Checks if the given word has a plural version. * - * @param string the word to check - * @return bool if the word is countable + * @param string the word to check + * @return bool if the word is countable */ if ( ! function_exists('is_countable')) { function is_countable($word) { - return ! (in_array(strtolower(strval($word)), array( - 'equipment', 'information', 'rice', 'money', - 'species', 'series', 'fish', 'meta' - ))); + return ! in_array(strtolower(strval($word)), + array( + 'equipment', 'information', 'rice', 'money', + 'species', 'series', 'fish', 'meta' + ) + ); } } /* End of file inflector_helper.php */ -/* Location: ./system/helpers/inflector_helper.php */ +/* Location: ./system/helpers/inflector_helper.php */ \ No newline at end of file diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 8c7adea46..d6f134c9f 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -124,4 +124,4 @@ if ( ! function_exists('encode_php_tags')) } /* End of file security_helper.php */ -/* Location: ./system/helpers/security_helper.php */ +/* Location: ./system/helpers/security_helper.php */ \ No newline at end of file diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 790a15264..8dba74e73 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Smiley Helpers * @@ -45,7 +43,6 @@ * Returns the javascript required for the smiley insertion. Optionally takes * an array of aliases to loosely couple the smiley array to the view. * - * @access public * @param mixed alias name or array of alias->field_id pairs * @param string field_id if alias name was passed in * @return array @@ -139,7 +136,6 @@ EOF; * Returns an array of image tag links that can be clicked to be inserted * into a form field. * - * @access public * @param string the URL to the folder containing the smiley images * @return array */ @@ -193,7 +189,6 @@ if ( ! function_exists('get_clickable_smileys')) * * Takes a string as input and swaps any contained smileys for the actual image * - * @access public * @param string the text to be parsed * @param string the URL to the folder containing the smiley images * @return string @@ -234,7 +229,6 @@ if ( ! function_exists('parse_smileys')) * * Fetches the config/smiley.php file * - * @access private * @return mixed */ if ( ! function_exists('_get_smiley_array')) @@ -268,7 +262,6 @@ if ( ! function_exists('_get_smiley_array')) * * DEPRECATED as of version 1.7.2, use smiley_js instead * - * @access public * @param string form name * @param string field name * @return string diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 2d0f78d2c..cc501c334 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Text Helpers * @@ -44,9 +42,8 @@ * * Limits a string to X number of words. * - * @access public * @param string - * @param integer + * @param int * @param string the end character. Usually an ellipsis * @return string */ @@ -78,9 +75,8 @@ if ( ! function_exists('word_limiter')) * Limits the string based on the character count. Preserves complete words * so the character count may not be exactly as specified. * - * @access public * @param string - * @param integer + * @param int * @param string the end character. Usually an ellipsis * @return string */ @@ -121,7 +117,6 @@ if ( ! function_exists('character_limiter')) * * Converts High ascii text and MS Word special characters to character entities * - * @access public * @param string * @return string */ @@ -182,7 +177,6 @@ if ( ! function_exists('ascii_to_entities')) * * Converts character entities back to ASCII * - * @access public * @param string * @param bool * @return string @@ -240,7 +234,6 @@ if ( ! function_exists('entities_to_ascii')) * matched words will be converted to #### or to the replacement * word you've submitted. * - * @access public * @param string the text string * @param string the array of censoered words * @param string the optional replacement value @@ -286,7 +279,6 @@ if ( ! function_exists('word_censor')) * * Colorizes code strings * - * @access public * @param string the text string * @return string */ @@ -330,7 +322,6 @@ if ( ! function_exists('highlight_code')) * * Highlights a phrase within a text string * - * @access public * @param string the text string * @param string the phrase you'd like to highlight * @param string the openging tag to precede the phrase with @@ -360,7 +351,6 @@ if ( ! function_exists('highlight_phrase')) /** * Convert Accented Foreign Characters to ASCII * - * @access public * @param string the text string * @return string */ @@ -368,7 +358,7 @@ if ( ! function_exists('convert_accented_characters')) { function convert_accented_characters($str) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php')) + if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'); } @@ -395,9 +385,8 @@ if ( ! function_exists('convert_accented_characters')) * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor * will URLs. * - * @access public * @param string the text string - * @param integer the number of characters to wrap at + * @param int the number of characters to wrap at * @return string */ if ( ! function_exists('word_wrap')) @@ -497,11 +486,11 @@ if ( ! function_exists('word_wrap')) * * This function will strip tags from a string, split it at its max_length and ellipsize * - * @param string string to ellipsize - * @param integer max length of string - * @param mixed int (1|0) or float, .5, .2, etc for position to split - * @param string ellipsis ; Default '...' - * @return string ellipsized string + * @param string string to ellipsize + * @param int max length of string + * @param mixed int (1|0) or float, .5, .2, etc for position to split + * @param string ellipsis ; Default '...' + * @return string ellipsized string */ if ( ! function_exists('ellipsize')) { -- cgit v1.2.3-24-g4f1b