From b73eb19aed66190c10c9cad476da7c36c271d6dc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 19 Sep 2019 15:08:45 +0300 Subject: [ci skip] 3.1.11 release --- user_guide_src/source/helpers/array_helper.rst | 133 ---- user_guide_src/source/helpers/captcha_helper.rst | 168 ----- user_guide_src/source/helpers/cookie_helper.rst | 79 --- user_guide_src/source/helpers/date_helper.rst | 440 ------------ user_guide_src/source/helpers/directory_helper.rst | 83 --- user_guide_src/source/helpers/download_helper.rst | 56 -- user_guide_src/source/helpers/email_helper.rst | 75 --- user_guide_src/source/helpers/file_helper.rst | 202 ------ user_guide_src/source/helpers/form_helper.rst | 743 --------------------- user_guide_src/source/helpers/html_helper.rst | 407 ----------- user_guide_src/source/helpers/index.rst | 9 - user_guide_src/source/helpers/inflector_helper.rst | 99 --- user_guide_src/source/helpers/language_helper.rst | 46 -- user_guide_src/source/helpers/number_helper.rst | 52 -- user_guide_src/source/helpers/path_helper.rst | 53 -- user_guide_src/source/helpers/security_helper.rst | 106 --- user_guide_src/source/helpers/smiley_helper.rst | 169 ----- user_guide_src/source/helpers/string_helper.rst | 223 ------- user_guide_src/source/helpers/text_helper.rst | 230 ------- .../source/helpers/typography_helper.rst | 75 --- user_guide_src/source/helpers/url_helper.rst | 373 ----------- user_guide_src/source/helpers/xml_helper.rst | 55 -- 22 files changed, 3876 deletions(-) delete mode 100644 user_guide_src/source/helpers/array_helper.rst delete mode 100644 user_guide_src/source/helpers/captcha_helper.rst delete mode 100644 user_guide_src/source/helpers/cookie_helper.rst delete mode 100644 user_guide_src/source/helpers/date_helper.rst delete mode 100644 user_guide_src/source/helpers/directory_helper.rst delete mode 100644 user_guide_src/source/helpers/download_helper.rst delete mode 100644 user_guide_src/source/helpers/email_helper.rst delete mode 100644 user_guide_src/source/helpers/file_helper.rst delete mode 100644 user_guide_src/source/helpers/form_helper.rst delete mode 100644 user_guide_src/source/helpers/html_helper.rst delete mode 100644 user_guide_src/source/helpers/index.rst delete mode 100644 user_guide_src/source/helpers/inflector_helper.rst delete mode 100644 user_guide_src/source/helpers/language_helper.rst delete mode 100644 user_guide_src/source/helpers/number_helper.rst delete mode 100644 user_guide_src/source/helpers/path_helper.rst delete mode 100644 user_guide_src/source/helpers/security_helper.rst delete mode 100644 user_guide_src/source/helpers/smiley_helper.rst delete mode 100644 user_guide_src/source/helpers/string_helper.rst delete mode 100644 user_guide_src/source/helpers/text_helper.rst delete mode 100644 user_guide_src/source/helpers/typography_helper.rst delete mode 100644 user_guide_src/source/helpers/url_helper.rst delete mode 100644 user_guide_src/source/helpers/xml_helper.rst (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/array_helper.rst b/user_guide_src/source/helpers/array_helper.rst deleted file mode 100644 index d6b48773f..000000000 --- a/user_guide_src/source/helpers/array_helper.rst +++ /dev/null @@ -1,133 +0,0 @@ -############ -Array Helper -############ - -The Array Helper file contains functions that assist in working with -arrays. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('array'); - - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: element($item, $array[, $default = NULL]) - - :param string $item: Item to fetch from the array - :param array $array: Input array - :param bool $default: What to return if the array isn't valid - :returns: NULL on failure or the array item. - :rtype: mixed - - Lets you fetch an item from an array. The function tests whether the - array index is set and whether it has a value. If a value exists it is - returned. If a value does not exist it returns NULL, or whatever you've - specified as the default value via the third parameter. - - Example:: - - $array = array( - 'color' => 'red', - 'shape' => 'round', - 'size' => '' - ); - - echo element('color', $array); // returns "red" - echo element('size', $array, 'foobar'); // returns "foobar" - - -.. php:function:: elements($items, $array[, $default = NULL]) - - :param string $item: Item to fetch from the array - :param array $array: Input array - :param bool $default: What to return if the array isn't valid - :returns: NULL on failure or the array item. - :rtype: mixed - - Lets you fetch a number of items from an array. The function tests - whether each of the array indices is set. If an index does not exist it - is set to NULL, or whatever you've specified as the default value via - the third parameter. - - Example:: - - $array = array( - 'color' => 'red', - 'shape' => 'round', - 'radius' => '10', - 'diameter' => '20' - ); - - $my_shape = elements(array('color', 'shape', 'height'), $array); - - The above will return the following array:: - - array( - 'color' => 'red', - 'shape' => 'round', - 'height' => NULL - ); - - You can set the third parameter to any default value you like. - :: - - $my_shape = elements(array('color', 'shape', 'height'), $array, 'foobar'); - - The above will return the following array:: - - array(      - 'color' => 'red', - 'shape' => 'round', - 'height' => 'foobar' - ); - - This is useful when sending the ``$_POST`` array to one of your Models. - This prevents users from sending additional POST data to be entered into - your tables. - - :: - - $this->load->model('post_model'); - $this->post_model->update( - elements(array('id', 'title', 'content'), $_POST) - ); - - This ensures that only the id, title and content fields are sent to be - updated. - - -.. php:function:: random_element($array) - - :param array $array: Input array - :returns: A random element from the array - :rtype: mixed - - Takes an array as input and returns a random element from it. - - Usage example:: - - $quotes = array( - "I find that the harder I work, the more luck I seem to have. - Thomas Jefferson", - "Don't stay in bed, unless you can make money in bed. - George Burns", - "We didn't lose the game; we just ran out of time. - Vince Lombardi", - "If everything seems under control, you're not going fast enough. - Mario Andretti", - "Reality is merely an illusion, albeit a very persistent one. - Albert Einstein", - "Chance favors the prepared mind - Louis Pasteur" - ); - - echo random_element($quotes); \ No newline at end of file diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst deleted file mode 100644 index be1b20aaf..000000000 --- a/user_guide_src/source/helpers/captcha_helper.rst +++ /dev/null @@ -1,168 +0,0 @@ -############## -CAPTCHA Helper -############## - -The CAPTCHA Helper file contains functions that assist in creating -CAPTCHA images. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('captcha'); - -Using the CAPTCHA helper -======================== - -Once loaded you can generate a CAPTCHA like this:: - - $vals = array( - 'word' => 'Random word', - 'img_path' => './captcha/', - 'img_url' => 'http://example.com/captcha/', - 'font_path' => './path/to/fonts/texb.ttf', - 'img_width' => '150', - 'img_height' => 30, - 'expiration' => 7200, - 'word_length' => 8, - 'font_size' => 16, - 'img_id' => 'Imageid', - 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', - - // White background and border, black text and red grid - 'colors' => array( - 'background' => array(255, 255, 255), - 'border' => array(255, 255, 255), - 'text' => array(0, 0, 0), - 'grid' => array(255, 40, 40) - ) - ); - - $cap = create_captcha($vals); - echo $cap['image']; - -- The captcha function requires the GD image library. -- Only the **img_path** and **img_url** are required. -- If a **word** is not supplied, the function will generate a random - ASCII string. You might put together your own word library that you - can draw randomly from. -- If you do not specify a path to a TRUE TYPE font, the native ugly GD - font will be used. -- The "captcha" directory must be writable -- The **expiration** (in seconds) signifies how long an image will remain - in the captcha folder before it will be deleted. The default is two - hours. -- **word_length** defaults to 8, **pool** defaults to '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' -- **font_size** defaults to 16, the native GD font has a size limit. Specify a "true type" font for bigger sizes. -- The **img_id** will be set as the "id" of the captcha image. -- If any of the **colors** values is missing, it will be replaced by the default. - -Adding a Database ------------------ - -In order for the captcha function to prevent someone from submitting, -you will need to add the information returned from ``create_captcha()`` -to your database. Then, when the data from the form is submitted by -the user you will need to verify that the data exists in the database -and has not expired. - -Here is a table prototype:: - - CREATE TABLE captcha (   - captcha_id bigint(13) unsigned NOT NULL auto_increment,   - captcha_time int(10) unsigned NOT NULL,   - ip_address varchar(45) NOT NULL,   - word varchar(20) NOT NULL,   - PRIMARY KEY `captcha_id` (`captcha_id`),   - KEY `word` (`word`) - ); - -Here is an example of usage with a database. On the page where the -CAPTCHA will be shown you'll have something like this:: - - $this->load->helper('captcha'); - $vals = array(      - 'img_path' => './captcha/',      - 'img_url' => 'http://example.com/captcha/'      - ); - - $cap = create_captcha($vals); - $data = array(      - 'captcha_time' => $cap['time'],      - 'ip_address' => $this->input->ip_address(),      - 'word' => $cap['word']      - ); - - $query = $this->db->insert_string('captcha', $data); - $this->db->query($query); - - echo 'Submit the word you see below:'; - echo $cap['image']; - echo ''; - -Then, on the page that accepts the submission you'll have something like -this:: - - // First, delete old captchas - $expiration = time() - 7200; // Two hour limit - $this->db->where('captcha_time < ', $expiration) - ->delete('captcha'); - - // Then see if a captcha exists: - $sql = 'SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?'; - $binds = array($_POST['captcha'], $this->input->ip_address(), $expiration); - $query = $this->db->query($sql, $binds); - $row = $query->row(); - - if ($row->count == 0) - {      - echo 'You must submit the word that appears in the image.'; - } - -Available Functions -=================== - -The following functions are available: - -.. php:function:: create_captcha([$data = ''[, $img_path = ''[, $img_url = ''[, $font_path = '']]]]) - - :param array $data: Array of data for the CAPTCHA - :param string $img_path: Path to create the image in (DEPRECATED) - :param string $img_url: URL to the CAPTCHA image folder (DEPRECATED) - :param string $font_path: Server path to font (DEPRECATED) - :returns: array('word' => $word, 'time' => $now, 'image' => $img) - :rtype: array - - Takes an array of information to generate the CAPTCHA as input and - creates the image to your specifications, returning an array of - associative data about the image. - - :: - - array( - 'image' => IMAGE TAG - 'time' => TIMESTAMP (in microtime) - 'word' => CAPTCHA WORD - ) - - The **image** is the actual image tag:: - - - - The **time** is the micro timestamp used as the image name without the - file extension. It will be a number like this: 1139612155.3422 - - The **word** is the word that appears in the captcha image, which if not - supplied to the function, will be a random string. - - .. note:: Usage of the ``$img_path``, ``$img_url`` and ``$font_path`` - parameters is DEPRECATED. Provide them in the ``$data`` array - instead. diff --git a/user_guide_src/source/helpers/cookie_helper.rst b/user_guide_src/source/helpers/cookie_helper.rst deleted file mode 100644 index 2ad51e78c..000000000 --- a/user_guide_src/source/helpers/cookie_helper.rst +++ /dev/null @@ -1,79 +0,0 @@ -############# -Cookie Helper -############# - -The Cookie Helper file contains functions that assist in working with -cookies. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('cookie'); - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = NULL[, $httponly = NULL]]]]]]]) - - :param mixed $name: Cookie name *or* associative array of all of the parameters available to this function - :param string $value: Cookie value - :param int $expire: Number of seconds until expiration - :param string $domain: Cookie domain (usually: .yourdomain.com) - :param string $path: Cookie path - :param string $prefix: Cookie name prefix - :param bool $secure: Whether to only send the cookie through HTTPS - :param bool $httponly: Whether to hide the cookie from JavaScript - :rtype: void - - This helper function gives you friendlier syntax to set browser - cookies. Refer to the :doc:`Input Library <../libraries/input>` for - a description of its use, as this function is an alias for - ``CI_Input::set_cookie()``. - -.. php:function:: get_cookie($index[, $xss_clean = NULL]) - - :param string $index: Cookie name - :param bool $xss_clean: Whether to apply XSS filtering to the returned value - :returns: The cookie value or NULL if not found - :rtype: mixed - - This helper function gives you friendlier syntax to get browser - cookies. Refer to the :doc:`Input Library <../libraries/input>` for - detailed description of its use, as this function acts very - similarly to ``CI_Input::cookie()``, except it will also prepend - the ``$config['cookie_prefix']`` that you might've set in your - *application/config/config.php* file. - -.. php:function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]) - - :param string $name: Cookie name - :param string $domain: Cookie domain (usually: .yourdomain.com) - :param string $path: Cookie path - :param string $prefix: Cookie name prefix - :rtype: void - - Lets you delete a cookie. Unless you've set a custom path or other - values, only the name of the cookie is needed. - :: - - delete_cookie('name'); - - This function is otherwise identical to ``set_cookie()``, except that it - does not have the value and expiration parameters. You can submit an - array of values in the first parameter or you can set discrete - parameters. - :: - - delete_cookie($name, $domain, $path, $prefix); diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst deleted file mode 100644 index 6bc6c2b05..000000000 --- a/user_guide_src/source/helpers/date_helper.rst +++ /dev/null @@ -1,440 +0,0 @@ -########### -Date Helper -########### - -The Date Helper file contains functions that help you work with dates. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('date'); - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: now([$timezone = NULL]) - - :param string $timezone: Timezone - :returns: UNIX timestamp - :rtype: int - - Returns the current time as a UNIX timestamp, referenced either to your server's - local time or any PHP supported timezone, based on the "time reference" setting - in your config file. If you do not intend to set your master time reference to - any other PHP supported timezone (which you'll typically do if you run a site - that lets each user set their own timezone settings) there is no benefit to using - this function over PHP's ``time()`` function. - :: - - echo now('Australia/Victoria'); - - If a timezone is not provided, it will return ``time()`` based on the - **time_reference** setting. - -.. php:function:: mdate([$datestr = ''[, $time = '']]) - - :param string $datestr: Date string - :param int $time: UNIX timestamp - :returns: MySQL-formatted date - :rtype: string - - This function is identical to PHP's `date() `_ - function, except that it lets you use MySQL style date codes, where each - code letter is preceded with a percent sign, e.g. `%Y %m %d` - - The benefit of doing dates this way is that you don't have to worry - about escaping any characters that are not date codes, as you would - normally have to do with the ``date()`` function. - - Example:: - - $datestring = 'Year: %Y Month: %m Day: %d - %h:%i %a'; - $time = time(); - echo mdate($datestring, $time); - - If a timestamp is not included in the second parameter the current time - will be used. - -.. php:function:: standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]]) - - :param string $fmt: Date format - :param int $time: UNIX timestamp - :returns: Formatted date or FALSE on invalid format - :rtype: string - - Lets you generate a date string in one of several standardized formats. - - Example:: - - $format = 'DATE_RFC822'; - $time = time(); - echo standard_date($format, $time); - - .. note:: This function is DEPRECATED. Use the native ``date()`` combined with - `DateTime's format constants - `_ - instead:: - - echo date(DATE_RFC822, time()); - - **Supported formats:** - - =============== ======================= ====================================== - Constant Description Example - =============== ======================= ====================================== - DATE_ATOM Atom 2005-08-15T16:13:03+0000 - DATE_COOKIE HTTP Cookies Sun, 14 Aug 2005 16:13:03 UTC - DATE_ISO8601 ISO-8601 2005-08-14T16:13:03+00:00 - DATE_RFC822 RFC 822 Sun, 14 Aug 05 16:13:03 UTC - DATE_RFC850 RFC 850 Sunday, 14-Aug-05 16:13:03 UTC - DATE_RFC1036 RFC 1036 Sunday, 14-Aug-05 16:13:03 UTC - DATE_RFC1123 RFC 1123 Sun, 14 Aug 2005 16:13:03 UTC - DATE_RFC2822 RFC 2822 Sun, 14 Aug 2005 16:13:03 +0000 - DATE_RSS RSS Sun, 14 Aug 2005 16:13:03 UTC - DATE_W3C W3C 2005-08-14T16:13:03+0000 - =============== ======================= ====================================== - -.. php:function:: local_to_gmt([$time = '']) - - :param int $time: UNIX timestamp - :returns: UNIX timestamp - :rtype: int - - Takes a UNIX timestamp as input and returns it as GMT. - - Example:: - - $gmt = local_to_gmt(time()); - -.. php:function:: gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]]) - - :param int $time: UNIX timestamp - :param string $timezone: Timezone - :param bool $dst: Whether DST is active - :returns: UNIX timestamp - :rtype: int - - Takes a UNIX timestamp (referenced to GMT) as input, and converts it to - a localized timestamp based on the timezone and Daylight Saving Time - submitted. - - Example:: - - $timestamp = 1140153693; - $timezone = 'UM8'; - $daylight_saving = TRUE; - echo gmt_to_local($timestamp, $timezone, $daylight_saving); - - - .. note:: For a list of timezones see the reference at the bottom of this page. - -.. php:function:: mysql_to_unix([$time = '']) - - :param string $time: MySQL timestamp - :returns: UNIX timestamp - :rtype: int - - Takes a MySQL Timestamp as input and returns it as a UNIX timestamp. - - Example:: - - $unix = mysql_to_unix('20061124092345'); - -.. php:function:: unix_to_human([$time = ''[, $seconds = FALSE[, $fmt = 'us']]]) - - :param int $time: UNIX timestamp - :param bool $seconds: Whether to show seconds - :param string $fmt: format (us or euro) - :returns: Formatted date - :rtype: string - - Takes a UNIX timestamp as input and returns it in a human readable - format with this prototype:: - - YYYY-MM-DD HH:MM:SS AM/PM - - This can be useful if you need to display a date in a form field for - submission. - - The time can be formatted with or without seconds, and it can be set to - European or US format. If only the timestamp is submitted it will return - the time without seconds formatted for the U.S. - - Examples:: - - $now = time(); - echo unix_to_human($now); // U.S. time, no seconds - echo unix_to_human($now, TRUE, 'us'); // U.S. time with seconds - echo unix_to_human($now, TRUE, 'eu'); // Euro time with seconds - -.. php:function:: human_to_unix([$datestr = '']) - - :param int $datestr: Date string - :returns: UNIX timestamp or FALSE on failure - :rtype: int - - The opposite of the :php:func:`unix_to_time()` function. Takes a "human" - time as input and returns it as a UNIX timestamp. This is useful if you - accept "human" formatted dates submitted via a form. Returns boolean FALSE - date string passed to it is not formatted as indicated above. - - Example:: - - $now = time(); - $human = unix_to_human($now); - $unix = human_to_unix($human); - -.. php:function:: nice_date([$bad_date = ''[, $format = FALSE]]) - - :param int $bad_date: The terribly formatted date-like string - :param string $format: Date format to return (same as PHP's ``date()`` function) - :returns: Formatted date - :rtype: string - - This function can take a number poorly-formed date formats and convert - them into something useful. It also accepts well-formed dates. - - The function will return a UNIX timestamp by default. You can, optionally, - pass a format string (the same type as the PHP ``date()`` function accepts) - as the second parameter. - - Example:: - - $bad_date = '199605'; - // Should Produce: 1996-05-01 - $better_date = nice_date($bad_date, 'Y-m-d'); - - $bad_date = '9-11-2001'; - // Should Produce: 2001-09-11 - $better_date = nice_date($bad_date, 'Y-m-d'); - - .. note:: This function is DEPRECATED. Use PHP's native `DateTime class - `_ instead. - -.. php:function:: timespan([$seconds = 1[, $time = ''[, $units = '']]]) - - :param int $seconds: Number of seconds - :param string $time: UNIX timestamp - :param int $units: Number of time units to display - :returns: Formatted time difference - :rtype: string - - Formats a UNIX timestamp so that is appears similar to this:: - - 1 Year, 10 Months, 2 Weeks, 5 Days, 10 Hours, 16 Minutes - - The first parameter must contain a UNIX timestamp. - The second parameter must contain a timestamp that is greater that the - first timestamp. - The thirdparameter is optional and limits the number of time units to display. - - If the second parameter empty, the current time will be used. - - The most common purpose for this function is to show how much time has - elapsed from some point in time in the past to now. - - Example:: - - $post_date = '1079621429'; - $now = time(); - $units = 2; - echo timespan($post_date, $now, $units); - - .. note:: The text generated by this function is found in the following language - file: `language//date_lang.php` - -.. php:function:: days_in_month([$month = 0[, $year = '']]) - - :param int $month: a numeric month - :param int $year: a numeric year - :returns: Count of days in the specified month - :rtype: int - - Returns the number of days in a given month/year. Takes leap years into - account. - - Example:: - - echo days_in_month(06, 2005); - - If the second parameter is empty, the current year will be used. - - .. note:: This function will alias the native ``cal_days_in_month()``, if - it is available. - -.. php:function:: date_range([$unix_start = ''[, $mixed = ''[, $is_unix = TRUE[, $format = 'Y-m-d']]]]) - - :param int $unix_start: UNIX timestamp of the range start date - :param int $mixed: UNIX timestamp of the range end date or interval in days - :param bool $is_unix: set to FALSE if $mixed is not a timestamp - :param string $format: Output date format, same as in ``date()`` - :returns: An array of dates - :rtype: array - - Returns a list of dates within a specified period. - - Example:: - - $range = date_range('2012-01-01', '2012-01-15'); - echo "First 15 days of 2012:"; - foreach ($range as $date) - { - echo $date."\n"; - } - -.. php:function:: timezones([$tz = '']) - - :param string $tz: A numeric timezone - :returns: Hour difference from UTC - :rtype: int - - Takes a timezone reference (for a list of valid timezones, see the - "Timezone Reference" below) and returns the number of hours offset from - UTC. - - Example:: - - echo timezones('UM5'); - - - This function is useful when used with :php:func:`timezone_menu()`. - -.. php:function:: timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]]) - - :param string $default: Timezone - :param string $class: Class name - :param string $name: Menu name - :param mixed $attributes: HTML attributes - :returns: HTML drop down menu with time zones - :rtype: string - - Generates a pull-down menu of timezones, like this one: - - .. raw:: html - -
- -
- - - This menu is useful if you run a membership site in which your users are - allowed to set their local timezone value. - - The first parameter lets you set the "selected" state of the menu. For - example, to set Pacific time as the default you will do this:: - - echo timezone_menu('UM8'); - - Please see the timezone reference below to see the values of this menu. - - The second parameter lets you set a CSS class name for the menu. - - The fourth parameter lets you set one or more attributes on the generated select tag. - - .. note:: The text contained in the menu is found in the following - language file: `language//date_lang.php` - -Timezone Reference -================== - -The following table indicates each timezone and its location. - -Note some of the location lists have been abridged for clarity and formatting. - -=========== ===================================================================== -Time Zone Location -=========== ===================================================================== -UM12 (UTC - 12:00) Baker/Howland Island -UM11 (UTC - 11:00) Samoa Time Zone, Niue -UM10 (UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands -UM95 (UTC - 09:30) Marquesas Islands -UM9 (UTC - 09:00) Alaska Standard Time, Gambier Islands -UM8 (UTC - 08:00) Pacific Standard Time, Clipperton Island -UM7 (UTC - 07:00) Mountain Standard Time -UM6 (UTC - 06:00) Central Standard Time -UM5 (UTC - 05:00) Eastern Standard Time, Western Caribbean -UM45 (UTC - 04:30) Venezuelan Standard Time -UM4 (UTC - 04:00) Atlantic Standard Time, Eastern Caribbean -UM35 (UTC - 03:30) Newfoundland Standard Time -UM3 (UTC - 03:00) Argentina, Brazil, French Guiana, Uruguay -UM2 (UTC - 02:00) South Georgia/South Sandwich Islands -UM1 (UTC -1:00) Azores, Cape Verde Islands -UTC (UTC) Greenwich Mean Time, Western European Time -UP1 (UTC +1:00) Central European Time, West Africa Time -UP2 (UTC +2:00) Central Africa Time, Eastern European Time -UP3 (UTC +3:00) Moscow Time, East Africa Time -UP35 (UTC +3:30) Iran Standard Time -UP4 (UTC +4:00) Azerbaijan Standard Time, Samara Time -UP45 (UTC +4:30) Afghanistan -UP5 (UTC +5:00) Pakistan Standard Time, Yekaterinburg Time -UP55 (UTC +5:30) Indian Standard Time, Sri Lanka Time -UP575 (UTC +5:45) Nepal Time -UP6 (UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time -UP65 (UTC +6:30) Cocos Islands, Myanmar -UP7 (UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam -UP8 (UTC +8:00) Australian Western Standard Time, Beijing Time -UP875 (UTC +8:45) Australian Central Western Standard Time -UP9 (UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk -UP95 (UTC +9:30) Australian Central Standard Time -UP10 (UTC +10:00) Australian Eastern Standard Time, Vladivostok Time -UP105 (UTC +10:30) Lord Howe Island -UP11 (UTC +11:00) Srednekolymsk Time, Solomon Islands, Vanuatu -UP115 (UTC +11:30) Norfolk Island -UP12 (UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand -UP1275 (UTC +12:45) Chatham Islands Standard Time -UP13 (UTC +13:00) Phoenix Islands Time, Tonga -UP14 (UTC +14:00) Line Islands -=========== ===================================================================== diff --git a/user_guide_src/source/helpers/directory_helper.rst b/user_guide_src/source/helpers/directory_helper.rst deleted file mode 100644 index b5f1093c1..000000000 --- a/user_guide_src/source/helpers/directory_helper.rst +++ /dev/null @@ -1,83 +0,0 @@ -################ -Directory Helper -################ - -The Directory Helper file contains functions that assist in working with -directories. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code: - -:: - - $this->load->helper('directory'); - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]]) - - :param string $source_dir: Path to the source directory - :param int $directory_depth: Depth of directories to traverse (0 = fully recursive, 1 = current dir, etc) - :param bool $hidden: Whether to include hidden directories - :returns: An array of files - :rtype: array - - Examples:: - - $map = directory_map('./mydirectory/'); - - .. note:: Paths are almost always relative to your main index.php file. - - - Sub-folders contained within the directory will be mapped as well. If - you wish to control the recursion depth, you can do so using the second - parameter (integer). A depth of 1 will only map the top level directory:: - - $map = directory_map('./mydirectory/', 1); - - By default, hidden files will not be included in the returned array. To - override this behavior, you may set a third parameter to true (boolean):: - - $map = directory_map('./mydirectory/', FALSE, TRUE); - - Each folder name will be an array index, while its contained files will - be numerically indexed. Here is an example of a typical array:: - - Array ( - [libraries] => Array - ( - [0] => benchmark.html - [1] => config.html - ["database/"] => Array - ( - [0] => query_builder.html - [1] => binds.html - [2] => configuration.html - [3] => connecting.html - [4] => examples.html - [5] => fields.html - [6] => index.html - [7] => queries.html - ) - [2] => email.html - [3] => file_uploading.html - [4] => image_lib.html - [5] => input.html - [6] => language.html - [7] => loader.html - [8] => pagination.html - [9] => uri.html - ) \ No newline at end of file diff --git a/user_guide_src/source/helpers/download_helper.rst b/user_guide_src/source/helpers/download_helper.rst deleted file mode 100644 index 1a4065073..000000000 --- a/user_guide_src/source/helpers/download_helper.rst +++ /dev/null @@ -1,56 +0,0 @@ -############### -Download Helper -############### - -The Download Helper lets you download data to your desktop. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('download'); - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]]) - - :param string $filename: Filename - :param mixed $data: File contents - :param bool $set_mime: Whether to try to send the actual MIME type - :rtype: void - - Generates server headers which force data to be downloaded to your - desktop. Useful with file downloads. The first parameter is the **name - you want the downloaded file to be named**, the second parameter is the - file data. - - If you set the second parameter to NULL and ``$filename`` is an existing, readable - file path, then its content will be read instead. - - If you set the third parameter to boolean TRUE, then the actual file MIME type - (based on the filename extension) will be sent, so that if your browser has a - handler for that type - it can use it. - - Example:: - - $data = 'Here is some text!'; - $name = 'mytext.txt'; - force_download($name, $data); - - If you want to download an existing file from your server you'll need to - do the following:: - - // Contents of photo.jpg will be automatically read - force_download('/path/to/photo.jpg', NULL); \ No newline at end of file diff --git a/user_guide_src/source/helpers/email_helper.rst b/user_guide_src/source/helpers/email_helper.rst deleted file mode 100644 index 1ee97d902..000000000 --- a/user_guide_src/source/helpers/email_helper.rst +++ /dev/null @@ -1,75 +0,0 @@ -############ -Email Helper -############ - -The Email Helper provides some assistive functions for working with -Email. For a more robust email solution, see CodeIgniter's :doc:`Email -Class <../libraries/email>`. - -.. important:: The Email helper is DEPRECATED and is currently - only kept for backwards compatibility. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('email'); - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: valid_email($email) - - :param string $email: E-mail address - :returns: TRUE if a valid email is supplied, FALSE otherwise - :rtype: bool - - Checks if the input is a correctly formatted e-mail address. Note that is - doesn't actually prove that the address will be able recieve mail, but - simply that it is a validly formed address. - - Example:: - - if (valid_email('email@somesite.com')) - { - echo 'email is valid'; - } - else - { - echo 'email is not valid'; - } - - .. note:: All that this function does is to use PHP's native ``filter_var()``:: - - (bool) filter_var($email, FILTER_VALIDATE_EMAIL); - -.. php:function:: send_email($recipient, $subject, $message) - - :param string $recipient: E-mail address - :param string $subject: Mail subject - :param string $message: Message body - :returns: TRUE if the mail was successfully sent, FALSE in case of an error - :rtype: bool - - Sends an email using PHP's native `mail() `_ - function. - - .. note:: All that this function does is to use PHP's native ``mail`` - - :: - - mail($recipient, $subject, $message); - - For a more robust email solution, see CodeIgniter's :doc:`Email Library - <../libraries/email>`. \ No newline at end of file diff --git a/user_guide_src/source/helpers/file_helper.rst b/user_guide_src/source/helpers/file_helper.rst deleted file mode 100644 index 833cddea4..000000000 --- a/user_guide_src/source/helpers/file_helper.rst +++ /dev/null @@ -1,202 +0,0 @@ -########### -File Helper -########### - -The File Helper file contains functions that assist in working with files. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('file'); - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: read_file($file) - - :param string $file: File path - :returns: File contents or FALSE on failure - :rtype: string - - Returns the data contained in the file specified in the path. - - Example:: - - $string = read_file('./path/to/file.php'); - - The path can be a relative or full server path. Returns FALSE (boolean) on failure. - - .. note:: The path is relative to your main site index.php file, NOT your - controller or view files. CodeIgniter uses a front controller so paths - are always relative to the main site index. - - .. note:: This function is DEPRECATED. Use the native ``file_get_contents()`` - instead. - - .. important:: If your server is running an **open_basedir** restriction this - function might not work if you are trying to access a file above the - calling script. - -.. php:function:: write_file($path, $data[, $mode = 'wb']) - - :param string $path: File path - :param string $data: Data to write to file - :param string $mode: ``fopen()`` mode - :returns: TRUE if the write was successful, FALSE in case of an error - :rtype: bool - - Writes data to the file specified in the path. If the file does not exist then the - function will create it. - - Example:: - - $data = 'Some file data'; - if ( ! write_file('./path/to/file.php', $data)) - {      - echo 'Unable to write the file'; - } - else - {      - echo 'File written!'; - } - - You can optionally set the write mode via the third parameter:: - - write_file('./path/to/file.php', $data, 'r+'); - - The default mode is 'wb'. Please see the `PHP user guide `_ - for mode options. - - .. note: In order for this function to write data to a file, its permissions must - be set such that it is writable. If the file does not already exist, - then the directory containing it must be writable. - - .. note:: The path is relative to your main site index.php file, NOT your - controller or view files. CodeIgniter uses a front controller so paths - are always relative to the main site index. - - .. note:: This function acquires an exclusive lock on the file while writing to it. - -.. php:function:: delete_files($path[, $del_dir = FALSE[, $htdocs = FALSE]]) - - :param string $path: Directory path - :param bool $del_dir: Whether to also delete directories - :param bool $htdocs: Whether to skip deleting .htaccess and index page files - :returns: TRUE on success, FALSE in case of an error - :rtype: bool - - Deletes ALL files contained in the supplied path. - - Example:: - - delete_files('./path/to/directory/'); - - If the second parameter is set to TRUE, any directories contained within the supplied - root path will be deleted as well. - - Example:: - - delete_files('./path/to/directory/', TRUE); - - .. note:: The files must be writable or owned by the system in order to be deleted. - -.. php:function:: get_filenames($source_dir[, $include_path = FALSE]) - - :param string $source_dir: Directory path - :param bool $include_path: Whether to include the path as part of the filenames - :returns: An array of file names - :rtype: array - - Takes a server path as input and returns an array containing the names of all files - contained within it. The file path can optionally be added to the file names by setting - the second parameter to TRUE. - - Example:: - - $controllers = get_filenames(APPPATH.'controllers/'); - -.. php:function:: get_dir_file_info($source_dir, $top_level_only) - - :param string $source_dir: Directory path - :param bool $top_level_only: Whether to look only at the specified directory (excluding sub-directories) - :returns: An array containing info on the supplied directory's contents - :rtype: array - - Reads the specified directory and builds an array containing the filenames, filesize, - dates, and permissions. Sub-folders contained within the specified path are only read - if forced by sending the second parameter to FALSE, as this can be an intensive - operation. - - Example:: - - $models_info = get_dir_file_info(APPPATH.'models/'); - -.. php:function:: get_file_info($file[, $returned_values = array('name', 'server_path', 'size', 'date')]) - - :param string $file: File path - :param array $returned_values: What type of info to return - :returns: An array containing info on the specified file or FALSE on failure - :rtype: array - - Given a file and path, returns (optionally) the *name*, *path*, *size* and *date modified* - information attributes for a file. Second parameter allows you to explicitly declare what - information you want returned. - - Valid ``$returned_values`` options are: `name`, `size`, `date`, `readable`, `writeable`, - `executable` and `fileperms`. - -.. php:function:: get_mime_by_extension($filename) - - :param string $filename: File name - :returns: MIME type string or FALSE on failure - :rtype: string - - Translates a filename extension into a MIME type based on *config/mimes.php*. - Returns FALSE if it can't determine the type, or read the MIME config file. - - :: - - $file = 'somefile.png'; - echo $file.' is has a mime type of '.get_mime_by_extension($file); - - .. note:: This is not an accurate way of determining file MIME types, and - is here strictly for convenience. It should not be used for security - purposes. - -.. php:function:: symbolic_permissions($perms) - - :param int $perms: Permissions - :returns: Symbolic permissions string - :rtype: string - - Takes numeric permissions (such as is returned by ``fileperms()``) and returns - standard symbolic notation of file permissions. - - :: - - echo symbolic_permissions(fileperms('./index.php')); // -rw-r--r-- - -.. php:function:: octal_permissions($perms) - - :param int $perms: Permissions - :returns: Octal permissions string - :rtype: string - - Takes numeric permissions (such as is returned by ``fileperms()``) and returns - a three character octal notation of file permissions. - - :: - - echo octal_permissions(fileperms('./index.php')); // 644 \ No newline at end of file diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst deleted file mode 100644 index 5002a25e4..000000000 --- a/user_guide_src/source/helpers/form_helper.rst +++ /dev/null @@ -1,743 +0,0 @@ -########### -Form Helper -########### - -The Form Helper file contains functions that assist in working with -forms. - -.. contents:: - :local: - -.. raw:: html - -
- -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('form'); - -Escaping field values -===================== - -You may need to use HTML and characters such as quotes within your form -elements. In order to do that safely, you'll need to use -:doc:`common function <../general/common_functions>` -:func:`html_escape()`. - -Consider the following example:: - - $string = 'Here is a string containing "quoted" text.'; - - - -Since the above string contains a set of quotes, it will cause the form -to break. The :php:func:`html_escape()` function converts HTML special -characters so that it can be used safely:: - - - -.. note:: If you use any of the form helper functions listed on this page, - the form values will be automatically escaped, so there is no need - to call this function. Use it only if you are creating your own - form elements. - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: form_open([$action = ''[, $attributes = ''[, $hidden = array()]]]) - - :param string $action: Form action/target URI string - :param array $attributes: HTML attributes - :param array $hidden: An array of hidden fields' definitions - :returns: An HTML form opening tag - :rtype: string - - Creates an opening form tag with a base URL **built from your config preferences**. - It will optionally let you add form attributes and hidden input fields, and - will always add the `accept-charset` attribute based on the charset value in your - config file. - - The main benefit of using this tag rather than hard coding your own HTML is that - it permits your site to be more portable in the event your URLs ever change. - - Here's a simple example:: - - echo form_open('email/send'); - - The above example would create a form that points to your base URL plus the - "email/send" URI segments, like this:: - -
- - **Adding Attributes** - - Attributes can be added by passing an associative array to the second - parameter, like this:: - - $attributes = array('class' => 'email', 'id' => 'myform'); - echo form_open('email/send', $attributes); - - Alternatively, you can specify the second parameter as a string:: - - echo form_open('email/send', 'class="email" id="myform"'); - - The above examples would create a form similar to this:: - - - - **Adding Hidden Input Fields** - - Hidden fields can be added by passing an associative array to the - third parameter, like this:: - - $hidden = array('username' => 'Joe', 'member_id' => '234'); - echo form_open('email/send', '', $hidden); - - You can skip the second parameter by passing any falsy value to it. - - The above example would create a form similar to this:: - - - - - - -.. php:function:: form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]]]) - - :param string $action: Form action/target URI string - :param array $attributes: HTML attributes - :param array $hidden: An array of hidden fields' definitions - :returns: An HTML multipart form opening tag - :rtype: string - - This function is absolutely identical to :php:func:`form_open()` above, - except that it adds a *multipart* attribute, which is necessary if you - would like to use the form to upload files with. - - -.. php:function:: form_hidden($name[, $value = '']) - - :param string $name: Field name - :param string $value: Field value - :returns: An HTML hidden input field tag - :rtype: string - - Lets you generate hidden input fields. You can either submit a - name/value string to create one field:: - - form_hidden('username', 'johndoe'); - // Would produce: - - ... or you can submit an associative array to create multiple fields:: - - $data = array( - 'name' => 'John Doe', - 'email' => 'john@example.com', - 'url' => 'http://example.com' - ); - - echo form_hidden($data); - - /* - Would produce: - - - - */ - - You can also pass an associative array to the value field:: - - $data = array( - 'name' => 'John Doe', - 'email' => 'john@example.com', - 'url' => 'http://example.com' - ); - - echo form_hidden('my_array', $data); - - /* - Would produce: - - - - - */ - - If you want to create hidden input fields with extra attributes:: - - $data = array( - 'type' => 'hidden', - 'name' => 'email', - 'id' => 'hiddenemail', - 'value' => 'john@example.com', - 'class' => 'hiddenemail' - ); - - echo form_input($data); - - /* - Would produce: - - - */ - -.. php:function:: form_input([$data = ''[, $value = ''[, $extra = '']]]) - - :param array $data: Field attributes data - :param string $value: Field value - :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML text input field tag - :rtype: string - - Lets you generate a standard text input field. You can minimally pass - the field name and value in the first and second parameter:: - - echo form_input('username', 'johndoe'); - - Or you can pass an associative array containing any data you wish your - form to contain:: - - $data = array( - 'name' => 'username', - 'id' => 'username', - 'value' => 'johndoe', - 'maxlength' => '100', - 'size' => '50', - 'style' => 'width:50%' - ); - - echo form_input($data); - - /* - Would produce: - - - */ - - If you would like your form to contain some additional data, like - JavaScript, you can pass it as a string in the third parameter:: - - $js = 'onClick="some_function()"'; - echo form_input('username', 'johndoe', $js); - - Or you can pass it as an array:: - - $js = array('onClick' => 'some_function();'); - echo form_input('username', 'johndoe', $js); - -.. php:function:: form_password([$data = ''[, $value = ''[, $extra = '']]]) - - :param array $data: Field attributes data - :param string $value: Field value - :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML password input field tag - :rtype: string - - This function is identical in all respects to the :php:func:`form_input()` - function above except that it uses the "password" input type. - - -.. php:function:: form_upload([$data = ''[, $value = ''[, $extra = '']]]) - - :param array $data: Field attributes data - :param string $value: Field value - :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML file upload input field tag - :rtype: string - - This function is identical in all respects to the :php:func:`form_input()` - function above except that it uses the "file" input type, allowing it to - be used to upload files. - - -.. php:function:: form_textarea([$data = ''[, $value = ''[, $extra = '']]]) - - :param array $data: Field attributes data - :param string $value: Field value - :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML textarea tag - :rtype: string - - This function is identical in all respects to the :php:func:`form_input()` - function above except that it generates a "textarea" type. - - .. note:: Instead of the *maxlength* and *size* attributes in the above example, - you will instead specify *rows* and *cols*. - -.. php:function:: form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) - - :param string $name: Field name - :param array $options: An associative array of options to be listed - :param array $selected: List of fields to mark with the *selected* attribute - :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML dropdown select field tag - :rtype: string - - Lets you create a standard drop-down field. The first parameter will - contain the name of the field, the second parameter will contain an - associative array of options, and the third parameter will contain the - value you wish to be selected. You can also pass an array of multiple - items through the third parameter, and CodeIgniter will create a - multiple select for you. - - Example:: - - $options = array( - 'small' => 'Small Shirt', - 'med' => 'Medium Shirt', - 'large' => 'Large Shirt', - 'xlarge' => 'Extra Large Shirt', - ); - - $shirts_on_sale = array('small', 'large'); - echo form_dropdown('shirts', $options, 'large'); - - /* - Would produce: - - - */ - - echo form_dropdown('shirts', $options, $shirts_on_sale); - - /* - Would produce: - - - */ - - If you would like the opening - - The third parameter contains a boolean TRUE/FALSE to determine whether - the box should be checked or not. - - Similar to the other form functions in this helper, you can also pass an - array of attributes to the function:: - - $data = array( - 'name' => 'newsletter', - 'id' => 'newsletter', - 'value' => 'accept', - 'checked' => TRUE, - 'style' => 'margin:10px' - ); - - echo form_checkbox($data); - // Would produce: - - Also as with other functions, if you would like the tag to contain - additional data like JavaScript, you can pass it as a string in the - fourth parameter:: - - $js = 'onClick="some_function()"'; - echo form_checkbox('newsletter', 'accept', TRUE, $js); - - Or you can pass it as an array:: - - $js = array('onClick' => 'some_function();'); - echo form_checkbox('newsletter', 'accept', TRUE, $js); - - -.. php:function:: form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) - - :param array $data: Field attributes data - :param string $value: Field value - :param bool $checked: Whether to mark the radio button as being *checked* - :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string - :returns: An HTML radio input tag - :rtype: string - - This function is identical in all respects to the :php:func:`form_checkbox()` - function above except that it uses the "radio" input type. - - -.. php:function:: form_label([$label_text = ''[, $id = ''[, $attributes = array()]]]) - - :param string $label_text: Text to put in the