diff options
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/date_helper.php | 2 | ||||
-rw-r--r-- | system/helpers/download_helper.php | 3 | ||||
-rw-r--r-- | system/helpers/email_helper.php | 10 | ||||
-rw-r--r-- | system/helpers/file_helper.php | 19 | ||||
-rw-r--r-- | system/helpers/form_helper.php | 162 | ||||
-rw-r--r-- | system/helpers/html_helper.php | 66 | ||||
-rw-r--r-- | system/helpers/language_helper.php | 7 | ||||
-rw-r--r-- | system/helpers/number_helper.php | 5 | ||||
-rw-r--r-- | system/helpers/path_helper.php | 3 | ||||
-rw-r--r-- | system/helpers/smiley_helper.php | 13 | ||||
-rw-r--r-- | system/helpers/string_helper.php | 51 | ||||
-rw-r--r-- | system/helpers/text_helper.php | 8 | ||||
-rw-r--r-- | system/helpers/typography_helper.php | 8 | ||||
-rw-r--r-- | system/helpers/url_helper.php | 59 | ||||
-rw-r--r-- | system/helpers/xml_helper.php | 14 |
15 files changed, 156 insertions, 274 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index d54553292..66f21c1f5 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 96ff29dec..19192a147 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -42,7 +42,6 @@ * * Generates headers that force a download to happen * - * @access public * @param string filename * @param mixed the data to be downloaded * @param bool wether to try and send the actual file MIME type @@ -125,4 +124,4 @@ if ( ! function_exists('force_download')) } /* End of file download_helper.php */ -/* Location: ./system/helpers/download_helper.php */ +/* Location: ./system/helpers/download_helper.php */
\ No newline at end of file diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index b87bce674..497625c10 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Email Helpers * @@ -42,7 +40,7 @@ /** * Validate email address * - * @access public + * @param string * @return bool */ if ( ! function_exists('valid_email')) @@ -58,7 +56,9 @@ if ( ! function_exists('valid_email')) /** * Send an email * - * @access public + * @param string + * @param string + * @param string * @return bool */ if ( ! function_exists('send_email')) @@ -70,4 +70,4 @@ if ( ! function_exists('send_email')) } /* End of file email_helper.php */ -/* Location: ./system/helpers/email_helper.php */ +/* Location: ./system/helpers/email_helper.php */
\ No newline at end of file diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 3fd6b82e1..6e8a4ded1 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter File Helpers * @@ -44,7 +42,6 @@ * * Opens the file specfied in the path and returns it as a string. * - * @access public * @param string path to file * @return string */ @@ -90,7 +87,6 @@ if ( ! function_exists('read_file')) * Writes data to the file specified in the path. * Creates a new file if non-existent. * - * @access public * @param string path to file * @param string file data * @return bool @@ -123,7 +119,6 @@ if ( ! function_exists('write_file')) * If the second parameter is set to TRUE, any directories contained * within the supplied base directory will be nuked as well. * - * @access public * @param string path to file * @param bool whether to delete any directories found in the path * @return bool @@ -142,7 +137,7 @@ if ( ! function_exists('delete_files')) while (FALSE !== ($filename = @readdir($current_dir))) { - if ($filename !== '.' and $filename !== '..') + if ($filename !== '.' && $filename !== '..') { if (is_dir($path.DIRECTORY_SEPARATOR.$filename) && $filename[0] !== '.') { @@ -150,13 +145,13 @@ if ( ! function_exists('delete_files')) } else { - unlink($path.DIRECTORY_SEPARATOR.$filename); + @unlink($path.DIRECTORY_SEPARATOR.$filename); } } } @closedir($current_dir); - if ($del_dir == TRUE AND $level > 0) + if ($del_dir == TRUE && $level > 0) { return @rmdir($path); } @@ -173,7 +168,6 @@ if ( ! function_exists('delete_files')) * Reads the specified directory and builds an array containing the filenames. * Any sub-folders contained within the specified path are read as well. * - * @access public * @param string path to source * @param bool whether to include the path as part of the filename * @param bool internal variable to determine recursion status - do not use in calls @@ -224,7 +218,6 @@ if ( ! function_exists('get_filenames')) * * Any sub-folders contained within the specified path are read as well. * - * @access public * @param string path to source * @param bool Look only at the top level directory specified? * @param bool internal variable to determine recursion status - do not use in calls @@ -278,7 +271,6 @@ if ( ! function_exists('get_dir_file_info')) * Options are: name, server_path, size, date, readable, writable, executable, fileperms * Returns FALSE if the file cannot be found. * -* @access public * @param string path to file * @param mixed array or comma separated string of information returned * @return array @@ -345,7 +337,6 @@ if ( ! function_exists('get_file_info')) * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience * It should NOT be trusted, and should certainly NOT be used for security * - * @access public * @param string path to file * @return mixed */ @@ -399,7 +390,6 @@ if ( ! function_exists('get_mime_by_extension')) * Takes a numeric value representing a file's permissions and returns * standard symbolic notation representing that value * - * @access public * @param int * @return string */ @@ -467,7 +457,6 @@ if ( ! function_exists('symbolic_permissions')) * Takes a numeric value representing a file's permissions and returns * a three character string representing the file's octal permissions * - * @access public * @param int * @return string */ @@ -480,4 +469,4 @@ if ( ! function_exists('octal_permissions')) } /* End of file file_helper.php */ -/* Location: ./system/helpers/file_helper.php */ +/* Location: ./system/helpers/file_helper.php */
\ No newline at end of file diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 37337d975..e5b487608 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -24,8 +24,6 @@ * @since Version 1.0 */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Form Helpers * @@ -43,7 +41,6 @@ * * Creates the opening portion of the form. * - * @access public * @param string the URI segments of the form destination * @param array a key/value pair of attributes * @param array a key/value pair hidden data @@ -71,15 +68,15 @@ if ( ! function_exists('form_open')) $form = '<form action="'.$action.'"'._attributes_to_string($attributes, TRUE).">\n"; - // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites - if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->base_url()) === FALSE OR strpos($form, 'method="get"'))) + // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites + if ($CI->config->item('csrf_protection') === TRUE && ! (strpos($action, $CI->config->base_url()) === FALSE OR strpos($form, 'method="get"'))) { $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash(); } - if (is_array($hidden) AND count($hidden) > 0) + if (is_array($hidden) && count($hidden) > 0) { - $form .= sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden)); + $form .= sprintf('<div style="display:none;">%s</div>', form_hidden($hidden)); } return $form; @@ -93,7 +90,6 @@ if ( ! function_exists('form_open')) * * Creates the opening portion of the form, but with "multipart/form-data". * - * @access public * @param string the URI segments of the form destination * @param array a key/value pair of attributes * @param array a key/value pair hidden data @@ -121,10 +117,9 @@ if ( ! function_exists('form_open_multipart')) /** * Hidden Input Field * - * Generates hidden fields. You can pass a simple key/value string or an associative - * array with multiple values. + * Generates hidden fields. You can pass a simple key/value string or + * an associative array with multiple values. * - * @access public * @param mixed * @param string * @return string @@ -157,7 +152,7 @@ if ( ! function_exists('form_hidden')) { foreach ($value as $k => $v) { - $k = (is_int($k)) ? '' : $k; + $k = is_int($k) ? '' : $k; form_hidden($name.'['.$k.']', $v, TRUE); } } @@ -171,7 +166,6 @@ if ( ! function_exists('form_hidden')) /** * Text Input Field * - * @access public * @param mixed * @param string * @param string @@ -181,7 +175,7 @@ if ( ! function_exists('form_input')) { function form_input($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'text', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); return '<input '._parse_form_attributes($data, $defaults).$extra." />\n"; } @@ -194,7 +188,6 @@ if ( ! function_exists('form_input')) * * Identical to the input function but adds the "password" type * - * @access public * @param mixed * @param string * @param string @@ -221,7 +214,6 @@ if ( ! function_exists('form_password')) * * Identical to the input function but adds the "file" type * - * @access public * @param mixed * @param string * @param string @@ -246,7 +238,6 @@ if ( ! function_exists('form_upload')) /** * Textarea field * - * @access public * @param mixed * @param string * @param string @@ -256,7 +247,7 @@ if ( ! function_exists('form_textarea')) { function form_textarea($data = '', $value = '', $extra = '') { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '40', 'rows' => '10'); + $defaults = array('name' => ( ! is_array($data) ? $data : ''), 'cols' => '40', 'rows' => '10'); if ( ! is_array($data) OR ! isset($data['value'])) { @@ -268,7 +259,7 @@ if ( ! function_exists('form_textarea')) unset($data['value']); // textareas don't use the value attribute } - $name = (is_array($data)) ? $data['name'] : $data; + $name = is_array($data) ? $data['name'] : $data; return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.form_prep($val, $name)."</textarea>\n"; } } @@ -278,12 +269,11 @@ if ( ! function_exists('form_textarea')) /** * Multi-select menu * - * @access public * @param string * @param array * @param mixed * @param string - * @return type + * @return string */ if ( ! function_exists('form_multiselect')) { @@ -303,7 +293,6 @@ if ( ! function_exists('form_multiselect')) /** * Drop-down Menu * - * @access public * @param string * @param array * @param string @@ -314,28 +303,16 @@ if ( ! function_exists('form_dropdown')) { function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '') { - // If name is really an array then we'll call the function again using the array - if (is_array($name) && isset($name['name'])) - { - - if ( ! isset($name['options'])) - { - $name['options'] = array(); - } - - if ( ! isset($name['selected'])) - { - $name['selected'] = array(); - } - - if ( ! isset($name['extra'])) - { - $name['extra'] = ''; - } - - return form_dropdown($name['name'], $name['options'], $name['selected'], $name['extra']); - } - + // If name is really an array then we'll call the function again using the array + if (is_array($name) && isset($name['name'])) + { + isset($name['options']) OR $name['options'] = array(); + isset($name['selected']) OR $name['selected'] = array(); + isset($name['extra']) OR $name['extra'] = array(); + + return form_dropdown($name['name'], $name['options'], $name['selected'], $name['extra']); + } + if ( ! is_array($selected)) { $selected = array($selected); @@ -363,11 +340,11 @@ if ( ! function_exists('form_dropdown')) foreach ($val as $optgroup_key => $optgroup_val) { - $sel = (in_array($optgroup_key, $selected)) ? ' selected="selected"' : ''; + $sel = in_array($optgroup_key, $selected) ? ' selected="selected"' : ''; $form .= '<option value="'.$optgroup_key.'"'.$sel.'>'.(string) $optgroup_val."</option>\n"; } - $form .= '</optgroup>'."\n"; + $form .= "</optgroup>\n"; } else { @@ -375,9 +352,7 @@ if ( ! function_exists('form_dropdown')) } } - $form .= "</select>\n"; - - return $form; + return $form."</select>\n"; } } @@ -386,7 +361,6 @@ if ( ! function_exists('form_dropdown')) /** * Checkbox Field * - * @access public * @param mixed * @param string * @param bool @@ -397,9 +371,9 @@ if ( ! function_exists('form_checkbox')) { function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '') { - $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'checkbox', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); - if (is_array($data) AND array_key_exists('checked', $data)) + if (is_array($data) && array_key_exists('checked', $data)) { $checked = $data['checked']; @@ -431,7 +405,6 @@ if ( ! function_exists('form_checkbox')) /** * Radio Button * - * @access public * @param mixed * @param string * @param bool @@ -457,7 +430,6 @@ if ( ! function_exists('form_radio')) /** * Submit Button * - * @access public * @param mixed * @param string * @param string @@ -467,7 +439,7 @@ if ( ! function_exists('form_submit')) { function form_submit($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'submit', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); return '<input '._parse_form_attributes($data, $defaults).$extra." />\n"; } } @@ -477,7 +449,6 @@ if ( ! function_exists('form_submit')) /** * Reset Button * - * @access public * @param mixed * @param string * @param string @@ -487,7 +458,7 @@ if ( ! function_exists('form_reset')) { function form_reset($data = '', $value = '', $extra = '') { - $defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); + $defaults = array('type' => 'reset', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); return '<input '._parse_form_attributes($data, $defaults).$extra." />\n"; } } @@ -497,7 +468,6 @@ if ( ! function_exists('form_reset')) /** * Form Button * - * @access public * @param mixed * @param string * @param string @@ -507,8 +477,8 @@ if ( ! function_exists('form_button')) { function form_button($data = '', $content = '', $extra = '') { - $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'button'); - if ( is_array($data) AND isset($data['content'])) + $defaults = array('name' => ( ! is_array($data) ? $data : ''), 'type' => 'button'); + if (is_array($data) && isset($data['content'])) { $content = $data['content']; unset($data['content']); // content is not an attribute @@ -523,7 +493,6 @@ if ( ! function_exists('form_button')) /** * Form Label Tag * - * @access public * @param string The text to appear onscreen * @param string The id the label applies to * @param string Additional attributes @@ -538,10 +507,10 @@ if ( ! function_exists('form_label')) if ($id != '') { - $label .= " for=\"$id\""; + $label .= ' for="'.$id.'"'; } - if (is_array($attributes) AND count($attributes) > 0) + if (is_array($attributes) && count($attributes) > 0) { foreach ($attributes as $key => $val) { @@ -549,7 +518,7 @@ if ( ! function_exists('form_label')) } } - return $label .= ">$label_text</label>"; + return $label.'>'.$label_text.'</label>'; } } @@ -560,7 +529,6 @@ if ( ! function_exists('form_label')) * Used to produce <fieldset><legend>text</legend>. To close fieldset * use form_fieldset_close() * - * @access public * @param string The legend text * @param string Additional attributes * @return string @@ -572,7 +540,7 @@ if ( ! function_exists('form_fieldset')) $fieldset = '<fieldset'._attributes_to_string($attributes, FALSE).">\n"; if ($legend_text != '') { - $fieldset .= "<legend>$legend_text</legend>\n"; + return $fieldset.'<legend>'.$legend_text."</legend>\n"; } return $fieldset; @@ -584,7 +552,6 @@ if ( ! function_exists('form_fieldset')) /** * Fieldset Close Tag * - * @access public * @param string * @return string */ @@ -592,7 +559,7 @@ if ( ! function_exists('form_fieldset_close')) { function form_fieldset_close($extra = '') { - return "</fieldset>".$extra; + return '</fieldset>'.$extra; } } @@ -601,7 +568,6 @@ if ( ! function_exists('form_fieldset_close')) /** * Form Close Tag * - * @access public * @param string * @return string */ @@ -609,7 +575,7 @@ if ( ! function_exists('form_close')) { function form_close($extra = '') { - return "</form>".$extra; + return '</form>'.$extra; } } @@ -620,7 +586,6 @@ if ( ! function_exists('form_close')) * * Formats text so that it can be safely placed in a form field in the event it has HTML tags. * - * @access public * @param string * @return string */ @@ -670,10 +635,9 @@ if ( ! function_exists('form_prep')) * Form Value * * Grabs a value from the POST array for the specified field so you can - * re-populate an input field or textarea. If Form Validation + * re-populate an input field or textarea. If Form Validation * is active it retrieves the info from the validation class * - * @access public * @param string * @return mixed */ @@ -703,7 +667,6 @@ if ( ! function_exists('set_value')) * Let's you set the selected value of a <select> menu via data in the POST array. * If Form Validation is active it retrieves the info from the validation class * - * @access public * @param string * @param string * @param bool @@ -719,7 +682,7 @@ if ( ! function_exists('set_select')) { if ( ! isset($_POST[$field])) { - if (count($_POST) === 0 AND $default == TRUE) + if (count($_POST) === 0 && $default == TRUE) { return ' selected="selected"'; } @@ -735,12 +698,9 @@ if ( ! function_exists('set_select')) return ''; } } - else + elseif (($field == '' OR $value == '') OR ($field != $value)) { - if (($field == '' OR $value == '') OR ($field != $value)) - { - return ''; - } + return ''; } return ' selected="selected"'; @@ -758,7 +718,6 @@ if ( ! function_exists('set_select')) * Let's you set the selected value of a checkbox via the value in the POST array. * If Form Validation is active it retrieves the info from the validation class * - * @access public * @param string * @param string * @param bool @@ -774,7 +733,7 @@ if ( ! function_exists('set_checkbox')) { if ( ! isset($_POST[$field])) { - if (count($_POST) === 0 AND $default == TRUE) + if (count($_POST) === 0 && $default == TRUE) { return ' checked="checked"'; } @@ -790,12 +749,9 @@ if ( ! function_exists('set_checkbox')) return ''; } } - else + elseif (($field == '' OR $value == '') OR ($field != $value)) { - if (($field == '' OR $value == '') OR ($field != $value)) - { - return ''; - } + return ''; } return ' checked="checked"'; @@ -813,7 +769,6 @@ if ( ! function_exists('set_checkbox')) * Let's you set the selected value of a radio field via info in the POST array. * If Form Validation is active it retrieves the info from the validation class * - * @access public * @param string * @param string * @param bool @@ -829,7 +784,7 @@ if ( ! function_exists('set_radio')) { if ( ! isset($_POST[$field])) { - if (count($_POST) === 0 AND $default == TRUE) + if (count($_POST) === 0 && $default == TRUE) { return ' checked="checked"'; } @@ -865,10 +820,9 @@ if ( ! function_exists('set_radio')) /** * Form Error * - * Returns the error for a specific form field. This is a helper for the + * Returns the error for a specific form field. This is a helper for the * form validation class. * - * @access public * @param string * @param string * @param string @@ -892,10 +846,9 @@ if ( ! function_exists('form_error')) /** * Validation Error String * - * Returns all the errors associated with a form submission. This is a helper + * Returns all the errors associated with a form submission. This is a helper * function for the form validation class. * - * @access public * @param string * @param string * @return string @@ -920,7 +873,6 @@ if ( ! function_exists('validation_errors')) * * Helper function used by some of the form helpers * - * @access private * @param array * @param array * @return string @@ -955,7 +907,7 @@ if ( ! function_exists('_parse_form_attributes')) $val = form_prep($val, $default['name']); } - $att .= $key . '="' . $val . '" '; + $att .= $key.'="'.$val.'" '; } return $att; @@ -969,7 +921,6 @@ if ( ! function_exists('_parse_form_attributes')) * * Helper function used by some of the form helpers * - * @access private * @param mixed * @param bool * @return string @@ -978,14 +929,14 @@ if ( ! function_exists('_attributes_to_string')) { function _attributes_to_string($attributes, $formtag = FALSE) { - if (is_string($attributes) AND strlen($attributes) > 0) + if (is_string($attributes) && strlen($attributes) > 0) { - if ($formtag == TRUE AND strpos($attributes, 'method=') === FALSE) + if ($formtag == TRUE && strpos($attributes, 'method=') === FALSE) { $attributes .= ' method="post"'; } - if ($formtag == TRUE AND strpos($attributes, 'accept-charset=') === FALSE) + if ($formtag == TRUE && strpos($attributes, 'accept-charset=') === FALSE) { $attributes .= ' accept-charset="'.strtolower(config_item('charset')).'"'; } @@ -993,21 +944,21 @@ if ( ! function_exists('_attributes_to_string')) return ' '.$attributes; } - if (is_object($attributes) AND count($attributes) > 0) + if (is_object($attributes) && count($attributes) > 0) { - $attributes = (array)$attributes; + $attributes = (array) $attributes; } - if (is_array($attributes) AND ($formtag === TRUE OR count($attributes) > 0)) + if (is_array($attributes) && ($formtag === TRUE OR count($attributes) > 0)) { $atts = ''; - if ( ! isset($attributes['method']) AND $formtag === TRUE) + if ( ! isset($attributes['method']) && $formtag === TRUE) { $atts .= ' method="post"'; } - if ( ! isset($attributes['accept-charset']) AND $formtag === TRUE) + if ( ! isset($attributes['accept-charset']) && $formtag === TRUE) { $atts .= ' accept-charset="'.strtolower(config_item('charset')).'"'; } @@ -1030,7 +981,6 @@ if ( ! function_exists('_attributes_to_string')) * Determines what the form validation class was instantiated as, fetches * the object and returns it. * - * @access private * @return mixed */ if ( ! function_exists('_get_validation_object')) @@ -1057,4 +1007,4 @@ if ( ! function_exists('_get_validation_object')) } /* End of file form_helper.php */ -/* Location: ./system/helpers/form_helper.php */ +/* Location: ./system/helpers/form_helper.php */
\ No newline at end of file diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index b8c4f36f6..0417bd253 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter HTML Helpers * @@ -42,12 +40,10 @@ /** * Heading * - * Generates an HTML heading tag. First param is the data. - * Second param is the size of the heading tag. + * Generates an HTML heading tag. * - * @access public - * @param string - * @param integer + * @param string content + * @param int heading level * @return string */ if ( ! function_exists('heading')) @@ -65,7 +61,6 @@ if ( ! function_exists('heading')) * * Generates an HTML unordered list from an single or multi-dimensional array. * - * @access public * @param array * @param mixed * @return string @@ -85,7 +80,6 @@ if ( ! function_exists('ul')) * * Generates an HTML ordered list from an single or multi-dimensional array. * - * @access public * @param array * @param mixed * @return string @@ -105,11 +99,10 @@ if ( ! function_exists('ol')) * * Generates an HTML ordered list from an single or multi-dimensional array. * - * @access private * @param string * @param mixed * @param mixed - * @param integer + * @param int * @return string */ if ( ! function_exists('_list')) @@ -131,13 +124,13 @@ if ( ! function_exists('_list')) $atts = ''; foreach ($attributes as $key => $val) { - $atts .= ' ' . $key . '="' . $val . '"'; + $atts .= ' '.$key.'="'.$val.'"'; } $attributes = $atts; } - elseif (is_string($attributes) AND strlen($attributes) > 0) + elseif (is_string($attributes) && strlen($attributes) > 0) { - $attributes = ' '. $attributes; + $attributes = ' '.$attributes; } // Write the opening list tag @@ -175,8 +168,7 @@ if ( ! function_exists('_list')) /** * Generates HTML BR tags based on number supplied * - * @access public - * @param integer + * @param int * @return string */ if ( ! function_exists('br')) @@ -194,8 +186,8 @@ if ( ! function_exists('br')) * * Generates an <img /> element * - * @access public * @param mixed + * @param bool * @return string */ if ( ! function_exists('img')) @@ -217,7 +209,7 @@ if ( ! function_exists('img')) foreach ($src as $k => $v) { - if ($k === 'src' AND strpos($v, '://') === FALSE) + if ($k === 'src' && strpos($v, '://') === FALSE) { $CI =& get_instance(); @@ -232,7 +224,7 @@ if ( ! function_exists('img')) } else { - $img .= " $k=\"$v\""; + $img .= ' '.$k.'="'.$v.'"'; } } @@ -248,10 +240,9 @@ if ( ! function_exists('img')) * Generates a page document type declaration * * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame, - * html4-strict, html4-trans, and html4-frame. Values are saved in the + * html4-strict, html4-trans, and html4-frame. Values are saved in the * doctypes config file. * - * @access public * @param string type The doctype to be generated * @return string */ @@ -263,7 +254,7 @@ if ( ! function_exists('doctype')) if ( ! is_array($_doctypes)) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php')) + if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'); } @@ -278,7 +269,7 @@ if ( ! function_exists('doctype')) } } - return (isset($_doctypes[$type])) ? $_doctypes[$type] : FALSE; + return isset($_doctypes[$type]) ? $_doctypes[$type] : FALSE; } } @@ -289,13 +280,12 @@ if ( ! function_exists('doctype')) * * Generates link to a CSS file * - * @access public * @param mixed stylesheet hrefs or an array * @param string rel * @param string type * @param string title * @param string media - * @param boolean should index_page be added to the css path + * @param bool should index_page be added to the css path * @return string */ if ( ! function_exists('link_tag')) @@ -309,7 +299,7 @@ if ( ! function_exists('link_tag')) { foreach ($href as $k => $v) { - if ($k === 'href' AND strpos($v, '://') === FALSE) + if ($k === 'href' && strpos($v, '://') === FALSE) { if ($index_page === TRUE) { @@ -322,11 +312,9 @@ if ( ! function_exists('link_tag')) } else { - $link .= "$k=\"$v\" "; + $link .= $k.'="'.$v.'" '; } } - - $link .= '/>'; } else { @@ -354,11 +342,9 @@ if ( ! function_exists('link_tag')) { $link .= 'title="'.$title.'" '; } - - $link .= '/>'; } - return $link."\n"; + return $link."/>\n"; } } @@ -367,8 +353,10 @@ if ( ! function_exists('link_tag')) /** * Generates meta tags from an array of key/values * - * @access public * @param array + * @param string + * @param string + * @param string * @return string */ if ( ! function_exists('meta')) @@ -381,13 +369,10 @@ if ( ! function_exists('meta')) { $name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline)); } - else + elseif (isset($name['name'])) { // Turn single array into multidimensional - if (isset($name['name'])) - { - $name = array($name); - } + $name = array($name); } $str = ''; @@ -410,8 +395,7 @@ if ( ! function_exists('meta')) /** * Generates non-breaking space entities based on number supplied * - * @access public - * @param integer + * @param int * @return string */ if ( ! function_exists('nbs')) @@ -423,4 +407,4 @@ if ( ! function_exists('nbs')) } /* End of file html_helper.php */ -/* Location: ./system/helpers/html_helper.php */ +/* Location: ./system/helpers/html_helper.php */
\ No newline at end of file diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index 1d66df59f..b31c97107 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Language Helpers * @@ -44,7 +42,6 @@ * * Fetches a language variable and optionally outputs a form label * - * @access public * @param string the language line * @param string the id of the form element * @return string @@ -58,7 +55,7 @@ if ( ! function_exists('lang')) if ($id != '') { - $line = '<label for="'.$id.'">'.$line."</label>"; + $line = '<label for="'.$id.'">'.$line.'</label>'; } return $line; @@ -66,4 +63,4 @@ if ( ! function_exists('lang')) } /* End of file language_helper.php */ -/* Location: ./system/helpers/language_helper.php */ +/* Location: ./system/helpers/language_helper.php */
\ No newline at end of file diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index b6c823d8b..40da6e7bf 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Number Helpers * @@ -42,7 +40,6 @@ /** * Formats a numbers as bytes, based on size, and adds the appropriate suffix * - * @access public * @param mixed // will be cast as int * @return string */ @@ -84,4 +81,4 @@ if ( ! function_exists('byte_format')) } /* End of file number_helper.php */ -/* Location: ./system/helpers/number_helper.php */ +/* Location: ./system/helpers/number_helper.php */
\ No newline at end of file diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index c31f0bdc5..6ee99072c 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -40,7 +40,6 @@ /** * Set Realpath * - * @access public * @param string * @param bool checks to see if the path exists * @return string @@ -71,4 +70,4 @@ if ( ! function_exists('set_realpath')) } /* End of file path_helper.php */ -/* Location: ./system/helpers/path_helper.php */ +/* Location: ./system/helpers/path_helper.php */
\ No newline at end of file diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index cc903bc1c..790a15264 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -1,13 +1,13 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -241,7 +241,7 @@ if ( ! function_exists('_get_smiley_array')) { function _get_smiley_array() { - if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) + if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); } @@ -249,8 +249,8 @@ if ( ! function_exists('_get_smiley_array')) { include(APPPATH.'config/smileys.php'); } - - if (isset($smileys) AND is_array($smileys)) + + if (isset($smileys) && is_array($smileys)) { return $smileys; } @@ -288,6 +288,5 @@ EOF; } } - /* End of file smiley_helper.php */ /* Location: ./system/helpers/smiley_helper.php */
\ No newline at end of file diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 607a12bcb..aed35c157 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -1,13 +1,13 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter String Helpers * @@ -50,7 +48,6 @@ * * this/that/theother * - * @access public * @param string * @return string */ @@ -69,7 +66,6 @@ if ( ! function_exists('trim_slashes')) * * Removes slashes contained in a string or in an array * - * @access public * @param mixed string or array * @return mixed string or array */ @@ -100,7 +96,6 @@ if ( ! function_exists('strip_slashes')) * * Removes single and double quotes from a string * - * @access public * @param string * @return string */ @@ -119,7 +114,6 @@ if ( ! function_exists('strip_quotes')) * * Converts single and double quotes to entities * - * @access public * @param string * @return string */ @@ -145,7 +139,6 @@ if ( ! function_exists('quotes_to_entities')) * * http://www.some-site.com/index.php * - * @access public * @param string * @return string */ @@ -153,7 +146,7 @@ if ( ! function_exists('reduce_double_slashes')) { function reduce_double_slashes($str) { - return preg_replace("#(^|[^:])//+#", "\\1/", $str); + return preg_replace('#(^|[^:])//+#', '\\1/', $str); } } @@ -170,7 +163,6 @@ if ( ! function_exists('reduce_double_slashes')) * * Fred, Bill, Joe, Jimmy * - * @access public * @param string * @param string the character you wish to reduce * @param bool TRUE/FALSE - whether to trim the character from the beginning/end @@ -184,7 +176,7 @@ if ( ! function_exists('reduce_multiples')) if ($trim === TRUE) { - $str = trim($str, $character); + return trim($str, $character); } return $str; @@ -198,9 +190,8 @@ if ( ! function_exists('reduce_multiples')) * * Useful for generating passwords or hashes. * - * @access public * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1 - * @param integer number of characters + * @param int number of characters * @return string */ if ( ! function_exists('random_string')) @@ -227,9 +218,9 @@ if ( ! function_exists('random_string')) case 'nozero' : $pool = '123456789'; break; } - + $str = substr(str_shuffle(str_repeat($pool, ceil($len/strlen($pool)))),0,$len); - + return $str; break; case 'unique' : @@ -254,16 +245,19 @@ if ( ! function_exists('random_string')) /** * Add's _1 to a string or increment the ending number to allow _2, _3, etc * - * @param string $str required - * @param string $separator What should the duplicate number be appended with - * @param string $first Which number should be used for the first dupe increment - * @return string + * @param string required + * @param string What should the duplicate number be appended with + * @param string Which number should be used for the first dupe increment + * @return string */ -function increment_string($str, $separator = '_', $first = 1) +if ( ! function_exists('increment_string')) { - preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match); + function increment_string($str, $separator = '_', $first = 1) + { + preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match); - return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first; + return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first; + } } // ------------------------------------------------------------------------ @@ -271,9 +265,8 @@ function increment_string($str, $separator = '_', $first = 1) /** * Alternator * - * Allows strings to be alternated. See docs... + * Allows strings to be alternated. See docs... * - * @access public * @param string (as many parameters as needed) * @return string */ @@ -298,19 +291,17 @@ if ( ! function_exists('alternator')) /** * Repeater function * - * @access public * @param string - * @param integer number of repeats + * @param int number of repeats * @return string */ if ( ! function_exists('repeater')) { function repeater($data, $num = 1) { - return (($num > 0) ? str_repeat($data, $num) : ''); + return ($num > 0) ? str_repeat($data, $num) : ''; } } - /* End of file string_helper.php */ /* Location: ./system/helpers/string_helper.php */
\ No newline at end of file diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 7591bac5f..2d0f78d2c 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -1,13 +1,13 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -534,4 +534,4 @@ if ( ! function_exists('ellipsize')) } /* End of file text_helper.php */ -/* Location: ./system/helpers/text_helper.php */ +/* Location: ./system/helpers/text_helper.php */
\ No newline at end of file diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 9b19c7c2d..7a3db5d6b 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Typography Helpers * @@ -42,7 +40,6 @@ /** * Convert newlines to HTML line breaks except within PRE tags * - * @access public * @param string * @return string */ @@ -61,8 +58,6 @@ if ( ! function_exists('nl2br_except_pre')) /** * Auto Typography Wrapper Function * - * - * @access public * @param string * @param bool whether to allow javascript event handlers * @param bool whether to reduce multiple instances of double newlines to two @@ -86,7 +81,6 @@ if ( ! function_exists('auto_typography')) * * This function is a replacement for html_entity_decode() * - * @access public * @param string * @param string * @return string @@ -101,4 +95,4 @@ if ( ! function_exists('entity_decode')) } /* End of file typography_helper.php */ -/* Location: ./system/helpers/typography_helper.php */ +/* Location: ./system/helpers/typography_helper.php */
\ No newline at end of file diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2ae1fd37b..5576c2748 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter URL Helpers * @@ -45,7 +43,6 @@ * Create a local URL based on your basepath. Segments can be passed via the * first parameter either as a string or an array. * - * @access public * @param string * @return string */ @@ -67,8 +64,7 @@ if ( ! function_exists('site_url')) * Segments can be passed in as a string or an array, same as site_url * or a URL to a file can be passed in, e.g. to an image file. * - * @access public - * @param string + * @param string * @return string */ if ( ! function_exists('base_url')) @@ -88,7 +84,6 @@ if ( ! function_exists('base_url')) * Returns the full URL (including segments) of the page where this * function is placed * - * @access public * @return string */ if ( ! function_exists('current_url')) @@ -106,7 +101,6 @@ if ( ! function_exists('current_url')) * * Returns the URI segments. * - * @access public * @return string */ if ( ! function_exists('uri_string')) @@ -125,7 +119,6 @@ if ( ! function_exists('uri_string')) * * Returns the "index_page" from your config file * - * @access public * @return string */ if ( ! function_exists('index_page')) @@ -144,7 +137,6 @@ if ( ! function_exists('index_page')) * * Creates an anchor based on the local URL. * - * @access public * @param string the URL * @param string the link title * @param mixed any attributes @@ -158,7 +150,7 @@ if ( ! function_exists('anchor')) if ( ! is_array($uri)) { - $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri; + $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri); } else { @@ -187,7 +179,6 @@ if ( ! function_exists('anchor')) * Creates an anchor based on the local URL. The link * opens a new window based on the attributes specified. * - * @access public * @param string the URL * @param string the link title * @param mixed any attributes @@ -198,7 +189,7 @@ if ( ! function_exists('anchor_popup')) function anchor_popup($uri = '', $title = '', $attributes = FALSE) { $title = (string) $title; - $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri; + $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri); if ($title == '') { @@ -207,7 +198,7 @@ if ( ! function_exists('anchor_popup')) if ($attributes === FALSE) { - return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank');\">".$title."</a>"; + return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank');\">".$title.'</a>'; } if ( ! is_array($attributes)) @@ -217,7 +208,7 @@ if ( ! function_exists('anchor_popup')) foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val) { - $atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key]; + $atts[$key] = isset($attributes[$key]) ? $attributes[$key] : $val; unset($attributes[$key]); } @@ -226,7 +217,7 @@ if ( ! function_exists('anchor_popup')) $attributes = _parse_attributes($attributes); } - return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank', '"._parse_attributes($atts, TRUE)."');\"$attributes>".$title."</a>"; + return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank', '"._parse_attributes($atts, TRUE)."');\"".$attributes.'>'.$title.'</a>'; } } @@ -235,7 +226,6 @@ if ( ! function_exists('anchor_popup')) /** * Mailto Link * - * @access public * @param string the email address * @param string the link title * @param mixed any attributes @@ -263,7 +253,6 @@ if ( ! function_exists('mailto')) * * Create a spam-protected mailto link written in Javascript * - * @access public * @param string the email address * @param string the link title * @param mixed any attributes @@ -373,10 +362,9 @@ if ( ! function_exists('safe_mailto')) * * Automatically links URL and Email addresses. * Note: There's a bit of extra code here to deal with - * URLs or emails that end in a period. We'll strip these + * URLs or emails that end in a period. We'll strip these * off and add them after the link. * - * @access public * @param string the string * @param string the type: email, url, or both * @param bool whether to create pop-up links @@ -440,7 +428,6 @@ if ( ! function_exists('auto_link')) * * Simply adds the http:// part if no scheme is included * - * @access public * @param string the URL * @return string */ @@ -470,12 +457,12 @@ if ( ! function_exists('prep_url')) * Create URL Title * * Takes a "title" string as input and creates a - * human-friendly URL string with a "separator" string + * human-friendly URL string with a "separator" string * as the word separator. * - * @access public * @param string the string * @param string the separator + * @param bool * @return string */ if ( ! function_exists('url_title')) @@ -484,21 +471,21 @@ if ( ! function_exists('url_title')) { if ($separator === 'dash') { - $separator = '-'; + $separator = '-'; } - else if ($separator == 'underscore') + elseif ($separator === 'underscore') { - $separator = '_'; + $separator = '_'; } - + $q_separator = preg_quote($separator); $trans = array( - '&.+?;' => '', - '[^a-z0-9 _-]' => '', - '\s+' => $separator, - '('.$q_separator.')+' => $separator - ); + '&.+?;' => '', + '[^a-z0-9 _-]' => '', + '\s+' => $separator, + '('.$q_separator.')+' => $separator + ); $str = strip_tags($str); foreach ($trans as $key => $val) @@ -524,7 +511,6 @@ if ( ! function_exists('url_title')) * For very fine grained control over headers, you could use the Output * Library's set_header() function. * - * @access public * @param string the URL * @param string the method: location or refresh * @return string @@ -564,7 +550,6 @@ if ( ! function_exists('redirect')) * * Some of the functions use this * - * @access private * @param array * @param bool * @return string @@ -583,15 +568,15 @@ if ( ! function_exists('_parse_attributes')) { if ($javascript == TRUE) { - $att .= $key . '=' . $val . ','; + $att .= $key.'='.$val.','; } else { - $att .= ' ' . $key . '="' . $val . '"'; + $att .= ' '.$key.'="'.$val.'"'; } } - if ($javascript == TRUE AND $att != '') + if ($javascript == TRUE && $att != '') { return substr($att, 0, -1); } @@ -601,4 +586,4 @@ if ( ! function_exists('_parse_attributes')) } /* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ +/* Location: ./system/helpers/url_helper.php */
\ No newline at end of file diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index f3ff5764c..67fd34b97 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter XML Helpers * @@ -42,8 +40,8 @@ /** * Convert Reserved XML characters to Entities * - * @access public * @param string + * @param bool * @return string */ if ( ! function_exists('xml_convert')) @@ -54,11 +52,11 @@ if ( ! function_exists('xml_convert')) // Replace entities to temporary markers so that // ampersands won't get messed up - $str = preg_replace("/&#(\d+);/", "$temp\\1;", $str); + $str = preg_replace('/&#(\d+);/', $temp.'\\1;', $str); if ($protect_all == TRUE) { - $str = preg_replace('/&(\w+);/', "$temp\\1;", $str); + $str = preg_replace('/&(\w+);/', $temp.'\\1;', $str); } $str = str_replace(array('&', '<', '>', '"', "'", '-'), @@ -66,11 +64,11 @@ if ( ! function_exists('xml_convert')) $str); // Decode the temp markers back to entities - $str = preg_replace('/$temp(\d+);/', '&#\\1;', $str); + $str = preg_replace('/'.$temp.'(\d+);/', '&#\\1;', $str); if ($protect_all == TRUE) { - return preg_replace("/$temp(\w+);/", '&\\1;', $str); + return preg_replace('/'.$temp.'(\w+);/', '&\\1;', $str); } return $str; @@ -78,4 +76,4 @@ if ( ! function_exists('xml_convert')) } /* End of file xml_helper.php */ -/* Location: ./system/helpers/xml_helper.php */ +/* Location: ./system/helpers/xml_helper.php */
\ No newline at end of file |