From f009e9c9009dbade3341fa739ccb2e2b22820d50 Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Mon, 12 Mar 2018 10:56:22 -0700 Subject: [PATCH 001/129] Fix for permissions issue with activate --- fuel/modules/fuel/controllers/Module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/controllers/Module.php b/fuel/modules/fuel/controllers/Module.php index 7d4953566..30e96da24 100644 --- a/fuel/modules/fuel/controllers/Module.php +++ b/fuel/modules/fuel/controllers/Module.php @@ -921,7 +921,7 @@ protected function _process_create() $posted = $this->_process(); // set publish status to no if you do not have the ability to publish - if ( ! $this->fuel->auth->has_permission($this->permission, 'publish')) + if ( ! $this->fuel->auth->has_permission($this->permission, 'publish') AND ! $this->fuel->auth->has_permission($this->permission, 'activate')) { $posted['published'] = 'no'; $posted['active'] = 'no'; From f248043e93884d937f492b66409c74fcdc268e0b Mon Sep 17 00:00:00 2001 From: Martynas Sateika Date: Fri, 16 Mar 2018 00:27:43 +0000 Subject: [PATCH 002/129] Fix typo in word 'compatibility'. Fix unused $module variables in Loader --- fuel/modules/fuel/core/Loader.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fuel/modules/fuel/core/Loader.php b/fuel/modules/fuel/core/Loader.php index 3e4b071a2..65b9a68c8 100644 --- a/fuel/modules/fuel/core/Loader.php +++ b/fuel/modules/fuel/core/Loader.php @@ -16,7 +16,7 @@ /** * Some additions to the Awesome Modular Extension Library mostly for Matchbox compatibility * - * This Library overides the original MX Loader library + * This Library overrides the original MX Loader library * * @package FUEL CMS * @subpackage Third Party @@ -121,7 +121,7 @@ public function _add_module_paths($module = '') public function config($file, $use_sections = FALSE, $fail_gracefully = FALSE, $module = NULL) { if (!isset($module)) $module = $this->_module; // FUEL - return CI::$APP->config->load($file, $use_sections, $fail_gracefully, $this->_module); + return CI::$APP->config->load($file, $use_sections, $fail_gracefully, $module); } @@ -133,7 +133,7 @@ public function helper($helper = array(), $module = NULL) if (isset($this->_ci_helpers[$helper])) return; - list($path, $_helper) = Modules::find($helper.'_helper', $this->_module, 'helpers/'); + list($path, $_helper) = Modules::find($helper.'_helper', $module, 'helpers/'); if ($path === FALSE) return parent::helper($helper); @@ -177,12 +177,12 @@ public function library($library, $params = NULL, $object_name = NULL, $module = ($_alias = strtolower($object_name)) OR $_alias = $class; - list($path, $_library) = Modules::find($library, $this->_module, 'libraries/'); + list($path, $_library) = Modules::find($library, $module, 'libraries/'); /* load library config file as params */ if ($params == NULL) { - list($path2, $file) = Modules::find($_alias, $this->_module, 'config/'); + list($path2, $file) = Modules::find($_alias, $module, 'config/'); ($path2) && $params = Modules::load_file($file, $path2, 'config'); // FUEL check application directory @@ -229,7 +229,7 @@ public function model($model, $object_name = NULL, $connect = FALSE, $module = N return $this; /* check module */ - list($path, $_model) = Modules::find(strtolower($model), $this->_module, 'models/'); + list($path, $_model) = Modules::find(strtolower($model), $module, 'models/'); if ($path == FALSE) { @@ -420,42 +420,42 @@ protected function &_ci_get_component($component) METHODS FOR MATCHBOX COMPATIBILITY ****************************************************************************/ - /** Load config Matchbox style for backwards compatability **/ + /** Load config Matchbox style for backwards compatibility **/ public function module_config($module, $file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { if (!isset($module)) $module = $this->_module; // FUEL return $this->config($file, $use_sections, $fail_gracefully, $module); } - /** Load helper Matchbox style for backwards compatability **/ + /** Load helper Matchbox style for backwards compatibility **/ public function module_helper($module, $helper) { if (!isset($module)) $module = $this->_module; // FUEL return $this->helper($helper, $module); } - /** Load Language Matchbox style for backwards compatability **/ + /** Load Language Matchbox style for backwards compatibility **/ public function module_language($module, $langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '') { if (!isset($module)) $module = $this->_module; // FUEL return $this->language($langfile, $idiom, $return, $add_suffix, $alt_path, $module); } - /** Load Library Matchbox style for backwards compatability **/ + /** Load Library Matchbox style for backwards compatibility **/ public function module_library($module, $library, $params = NULL, $object_name = NULL) { if (!isset($module)) $module = $this->_module; // FUEL - return $this->library($library, $params, $object_name); + return $this->library($library, $params, $object_name, $module); } - /** Load Model Matchbox style for backwards compatability **/ + /** Load Model Matchbox style for backwards compatibility **/ public function module_model($module, $model, $object_name = NULL, $connect = FALSE) { if (!isset($module)) $module = $this->_module; // FUEL - return $this->model($model, $object_name, $connect); + return $this->model($model, $object_name, $connect, $module); } - /** Load view Matchbox style for backwards compatability **/ + /** Load view Matchbox style for backwards compatibility **/ public function module_view($module, $view, $vars = array(), $return = FALSE, $scope = NULL) { if (!isset($module)) $module = $this->_module; // FUEL From 97523fd976b44f12460b4344b6fb96ac96fa3291 Mon Sep 17 00:00:00 2001 From: Martynas Sateika Date: Fri, 16 Mar 2018 00:39:56 +0000 Subject: [PATCH 003/129] Fix incorrect usage of 'parse_str' in Google helper --- fuel/modules/fuel/helpers/google_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/helpers/google_helper.php b/fuel/modules/fuel/helpers/google_helper.php index 76bb56420..642bb0fc2 100644 --- a/fuel/modules/fuel/helpers/google_helper.php +++ b/fuel/modules/fuel/helpers/google_helper.php @@ -236,7 +236,7 @@ function google_map_url($address, $params = array()) // if a query string is passed, then we parse it into an array form if (is_string($params)) { - $params = parse_str($params); + parse_str($params, $params); } // initialize the parameter array From 6408a9589b96312b1f95bbb58fa66c028365f15d Mon Sep 17 00:00:00 2001 From: Martynas Sateika Date: Fri, 16 Mar 2018 02:08:51 +0000 Subject: [PATCH 004/129] Fix 'Undefined variable' error in Google helper --- fuel/modules/fuel/helpers/google_helper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fuel/modules/fuel/helpers/google_helper.php b/fuel/modules/fuel/helpers/google_helper.php index 642bb0fc2..d0202ed34 100644 --- a/fuel/modules/fuel/helpers/google_helper.php +++ b/fuel/modules/fuel/helpers/google_helper.php @@ -254,9 +254,8 @@ function google_map_url($address, $params = array()) } if (!empty($address['state'])) { - $addr .= ','.$address['state']; + $p['q'] .= ','.$address['state']; } - $p['q'] = $addr; } else { From f18b52e3f0faafb3ed40c60eb0b5cbf9ddb77cbc Mon Sep 17 00:00:00 2001 From: Martynas Sateika Date: Fri, 16 Mar 2018 02:10:11 +0000 Subject: [PATCH 005/129] Remove duplicate 'http_build_query' statement --- fuel/modules/fuel/helpers/google_helper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/fuel/modules/fuel/helpers/google_helper.php b/fuel/modules/fuel/helpers/google_helper.php index d0202ed34..ca75495d5 100644 --- a/fuel/modules/fuel/helpers/google_helper.php +++ b/fuel/modules/fuel/helpers/google_helper.php @@ -327,7 +327,6 @@ function google_map_url($address, $params = array()) // set output $p['output'] = 'embed'; $url = 'http://maps.google.com/maps?'.http_build_query($p, '', '&'); - $query_str = http_build_query($p, '', '&'); return $url; } } From 513458eeaf8044abfbc3ee18b4f5dc9727d8391d Mon Sep 17 00:00:00 2001 From: Martynas Sateika Date: Sat, 17 Mar 2018 00:43:42 +0000 Subject: [PATCH 006/129] Variable assigned to itself. Incorrect use of string concatenation. --- fuel/modules/fuel/libraries/Asset.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fuel/modules/fuel/libraries/Asset.php b/fuel/modules/fuel/libraries/Asset.php index 088367e4e..5e0408370 100644 --- a/fuel/modules/fuel/libraries/Asset.php +++ b/fuel/modules/fuel/libraries/Asset.php @@ -746,7 +746,7 @@ public function js($path, $module = '', $options = array()) if ($options['output'] === 'inline') { $open = ""; + $close = "\t"; } else { @@ -756,7 +756,6 @@ public function js($path, $module = '', $options = array()) $str = $this->_output('js', $module, $open, $close, $path, $options); if (!empty($options['echo'])) echo $str; - $str = $str; return $str; } From 89409cf666662bc1aa7d6b04369b050c040b1d7e Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Fri, 16 Mar 2018 22:25:36 -0700 Subject: [PATCH 007/129] Fix for undefined variable in Fuel_pages_model --- fuel/modules/fuel/models/Fuel_pages_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel/modules/fuel/models/Fuel_pages_model.php b/fuel/modules/fuel/models/Fuel_pages_model.php index 4d776f833..f459fe705 100644 --- a/fuel/modules/fuel/models/Fuel_pages_model.php +++ b/fuel/modules/fuel/models/Fuel_pages_model.php @@ -230,7 +230,7 @@ public function find_by_location($location, $just_published = 'yes') $data = $this->find_one_array($where, 'location desc'); // case sensitive check - if (empty($data) OR ($data['location'] != $location AND $data['location'] != $wildcard_location.'/:any')) + if (empty($data) OR ($data['location'] != $location AND (!empty($wildcard_location) AND $data['location'] != $wildcard_location.'/:any')) { return array(); } From 21606e601681ba9c7970b4812cce25d449a26754 Mon Sep 17 00:00:00 2001 From: Martynas Sateika Date: Sun, 18 Mar 2018 00:52:01 +0000 Subject: [PATCH 008/129] Fix several duplicate key issues --- fuel/modules/fuel/config/fuel_modules.php | 3 --- fuel/modules/fuel/core/MY_Model.php | 3 +-- fuel/modules/fuel/libraries/Form_builder.php | 1 - fuel/modules/fuel/libraries/parser/Fuel_twig_parser.php | 1 - fuel/modules/fuel/models/Fuel_navigation_model.php | 1 - fuel/modules/fuel/models/Fuel_pagevariables_model.php | 2 +- 6 files changed, 2 insertions(+), 9 deletions(-) diff --git a/fuel/modules/fuel/config/fuel_modules.php b/fuel/modules/fuel/config/fuel_modules.php index 15b9dde41..eef64a2ed 100644 --- a/fuel/modules/fuel/config/fuel_modules.php +++ b/fuel/modules/fuel/config/fuel_modules.php @@ -43,7 +43,6 @@ 'advanced_search' => TRUE, 'filters' => array( 'layout' => array( - 'default' => 1, 'label' => lang('form_label_layout'), 'type' => 'select', 'model' => 'fuel_pages_model', @@ -53,7 +52,6 @@ 'first_option' => 'Select a layout...', ), 'published' => array( - 'default' => 1, 'label' => lang('form_label_published'), 'type' => 'select', 'options' => array('yes' => 'Published', 'no' =>'Unpublished'), @@ -217,7 +215,6 @@ 'instructions' => lang('assets_instructions'), 'filters' => array( 'group_id' => array( - 'default' => 0, 'label' => lang('form_label_asset_folder'), 'type' => 'select', 'options' => array( diff --git a/fuel/modules/fuel/core/MY_Model.php b/fuel/modules/fuel/core/MY_Model.php index c046784fb..0fa76b46d 100755 --- a/fuel/modules/fuel/core/MY_Model.php +++ b/fuel/modules/fuel/core/MY_Model.php @@ -372,7 +372,7 @@ public function set_tables($tables) * * @access public * @param string the table name (optional) - * @return string + * @return string|array|null */ public function tables($table = NULL) { @@ -391,7 +391,6 @@ public function tables($table = NULL) { return $this->_tables; } - return NULL; } // -------------------------------------------------------------------- diff --git a/fuel/modules/fuel/libraries/Form_builder.php b/fuel/modules/fuel/libraries/Form_builder.php index 635ac4b67..f73e0eb2d 100644 --- a/fuel/modules/fuel/libraries/Form_builder.php +++ b/fuel/modules/fuel/libraries/Form_builder.php @@ -1791,7 +1791,6 @@ public function create_text($params) 'maxlength' => $params['max_length'], 'size' => $size, 'readonly' => $params['readonly'], - 'disabled' => $params['disabled'], 'autocomplete' => (!empty($params['autocomplete']) ? $params['autocomplete'] : NULL), 'placeholder' => (!empty($params['placeholder']) ? $params['placeholder'] : NULL), 'required' => (!empty($params['required']) ? TRUE : NULL), diff --git a/fuel/modules/fuel/libraries/parser/Fuel_twig_parser.php b/fuel/modules/fuel/libraries/parser/Fuel_twig_parser.php index ec2640dea..f129f18ea 100644 --- a/fuel/modules/fuel/libraries/parser/Fuel_twig_parser.php +++ b/fuel/modules/fuel/libraries/parser/Fuel_twig_parser.php @@ -63,7 +63,6 @@ protected function spawn() } $twig = new Twig_Environment($loader, array( - 'autoescape' => FALSE, 'cache' => $this->compile_dir, 'debug' => $this->debug, 'charset' => $this->charset, diff --git a/fuel/modules/fuel/models/Fuel_navigation_model.php b/fuel/modules/fuel/models/Fuel_navigation_model.php index c6934c1c6..7416584da 100644 --- a/fuel/modules/fuel/models/Fuel_navigation_model.php +++ b/fuel/modules/fuel/models/Fuel_navigation_model.php @@ -294,7 +294,6 @@ public function form_fields($values = array(), $related = array()) $fields['group_id'] = array( - 'type' => 'inline_edit', 'module' => 'navigation_group', 'options' => $group_options, 'type' => 'select', diff --git a/fuel/modules/fuel/models/Fuel_pagevariables_model.php b/fuel/modules/fuel/models/Fuel_pagevariables_model.php index 9ac213f0f..0d069002e 100644 --- a/fuel/modules/fuel/models/Fuel_pagevariables_model.php +++ b/fuel/modules/fuel/models/Fuel_pagevariables_model.php @@ -198,7 +198,7 @@ public function find_all_by_page_id($page_id, $lang = NULL) } $data = $this->find_all_array($where); - return $this->_process_casting($data);; + return $this->_process_casting($data); } // -------------------------------------------------------------------- From 71b490f5288e01336ea839fc3a52c037c1fa46e4 Mon Sep 17 00:00:00 2001 From: Martynas Sateika Date: Sun, 18 Mar 2018 02:28:10 +0000 Subject: [PATCH 009/129] Move fuel module's helper function PHPDocs inside 'function_exists' --- fuel/modules/fuel/helpers/MY_array_helper.php | 157 +++--- fuel/modules/fuel/helpers/MY_date_helper.php | 408 +++++++------- .../fuel/helpers/MY_directory_helper.php | 78 +-- fuel/modules/fuel/helpers/MY_file_helper.php | 70 +-- fuel/modules/fuel/helpers/MY_html_helper.php | 54 +- .../fuel/helpers/MY_language_helper.php | 42 +- .../modules/fuel/helpers/MY_string_helper.php | 115 ++-- fuel/modules/fuel/helpers/MY_url_helper.php | 242 ++++---- fuel/modules/fuel/helpers/ajax_helper.php | 28 +- fuel/modules/fuel/helpers/asset_helper.php | 346 ++++++------ fuel/modules/fuel/helpers/browser_helper.php | 16 +- .../fuel/helpers/compatibility_helper.php | 85 +-- fuel/modules/fuel/helpers/convert_helper.php | 94 ++-- fuel/modules/fuel/helpers/format_helper.php | 16 +- fuel/modules/fuel/helpers/google_helper.php | 120 ++-- fuel/modules/fuel/helpers/scraper_helper.php | 48 +- fuel/modules/fuel/helpers/session_helper.php | 57 +- .../modules/fuel/helpers/simplepie_helper.php | 18 +- fuel/modules/fuel/helpers/social_helper.php | 48 +- fuel/modules/fuel/helpers/utility_helper.php | 96 ++-- .../modules/fuel/helpers/validator_helper.php | 528 +++++++++--------- 21 files changed, 1332 insertions(+), 1334 deletions(-) diff --git a/fuel/modules/fuel/helpers/MY_array_helper.php b/fuel/modules/fuel/helpers/MY_array_helper.php index 9a52d6990..3e38ee15e 100644 --- a/fuel/modules/fuel/helpers/MY_array_helper.php +++ b/fuel/modules/fuel/helpers/MY_array_helper.php @@ -28,19 +28,18 @@ // -------------------------------------------------------------------- -/** - * An alternative array sorter that is a bit faster then array_sorter - * - * @access public - * @param array The array of data - * @param string The column to sort by - * @param string The direction (asc/desc) - * @return array - */ - if ( ! function_exists('array_orderby')) { // http://php.net/manual/en/function.array-multisort.php + /** + * An alternative array sorter that is a bit faster then array_sorter + * + * @access public + * @param array The array of data + * @param string The column to sort by + * @param string The direction (asc/desc) + * @return array + */ function array_orderby() { $args = func_get_args(); @@ -61,19 +60,19 @@ function array_orderby() // -------------------------------------------------------------------- -/** - * Array sorter that will sort on an array's key and allows for asc/desc order - * - * @access public - * @param array - * @param string - * @param string - * @param boolean - * @param boolean - * @return array - */ if ( ! function_exists('array_sorter')) { + /** + * Array sorter that will sort on an array's key and allows for asc/desc order + * + * @access public + * @param array + * @param string + * @param string + * @param boolean + * @param boolean + * @return array + */ function array_sorter(&$array, $index, $order = 'asc', $nat_sort = FALSE, $case_sensitive = FALSE) { if(is_array($array) && count($array) > 0) @@ -103,18 +102,18 @@ function array_sorter(&$array, $index, $order = 'asc', $nat_sort = FALSE, $case_ // -------------------------------------------------------------------- -/** - * Array sorter that will sort an array of objects based on an objects - * property and allows for asc/desc order. Changes the original object - * - * @access public - * @param mixed - * @param string - * @param string - * @return NULL - */ if ( ! function_exists('object_sorter')) { + /** + * Array sorter that will sort an array of objects based on an objects + * property and allows for asc/desc order. Changes the original object + * + * @access public + * @param mixed + * @param string + * @param string + * @return NULL + */ function object_sorter(&$data, $key, $order = 'asc') { for ($i = count($data) - 1; $i >= 0; $i--) @@ -152,21 +151,21 @@ function object_sorter(&$data, $key, $order = 'asc') // -------------------------------------------------------------------- -/** - * Creates a key/value array based on an original array. - * - * Can be used in conjunction with the Form library class - * (e.g. $this->form->select('countries, option_list($options))) - * - * @access public - * @param array - * @param string - * @param string - * @param boolean - * @return array - */ if ( ! function_exists('options_list')) { + /** + * Creates a key/value array based on an original array. + * + * Can be used in conjunction with the Form library class + * (e.g. $this->form->select('countries, option_list($options))) + * + * @access public + * @param array + * @param string + * @param string + * @param boolean + * @return array + */ function options_list($values, $value = 'id', $label = 'name', $value_as_key = FALSE) { $return = array(); @@ -192,15 +191,15 @@ function options_list($values, $value = 'id', $label = 'name', $value_as_key = F // -------------------------------------------------------------------- -/** - * Parses a string in the format of key1="val1" key2="val2" into an array - * - * @access public - * @param string - * @return array - */ if ( ! function_exists('parse_string_to_array')) { + /** + * Parses a string in the format of key1="val1" key2="val2" into an array + * + * @access public + * @param string + * @return array + */ function parse_string_to_array($str) { preg_match_all('#(\w+)=([\'"])(.*)\\2#U', $str, $matches); @@ -217,16 +216,16 @@ function parse_string_to_array($str) } } -/** - * Returns an array of arrays. - * - * @access public - * @param array an array to be divided - * @param int number of groups to divide the array into - * @return array - */ if ( ! function_exists('array_group')) { + /** + * Returns an array of arrays. + * + * @access public + * @param array an array to be divided + * @param int number of groups to divide the array into + * @return array + */ function array_group($array, $groups) { if (empty($array)) @@ -238,18 +237,18 @@ function array_group($array, $groups) } } -/** - * Converts a .csv file to an associative array. Must have header row. - * - * @access public - * @param string file name - * @param string the delimiter that separates each column - * @param int the index for where the header row starts - * @param int must be greater then the maximum line length. Setting to 0 is slightly slower, but works for any length - * @return array - */ if ( ! function_exists('csv_to_array')) { + /** + * Converts a .csv file to an associative array. Must have header row. + * + * @access public + * @param string file name + * @param string the delimiter that separates each column + * @param int the index for where the header row starts + * @param int must be greater then the maximum line length. Setting to 0 is slightly slower, but works for any length + * @return array + */ function csv_to_array($filename = '', $delimiter = ',', $header_row = 0, $length = 0) { if(!file_exists($filename) || !is_readable($filename)) @@ -284,18 +283,18 @@ function csv_to_array($filename = '', $delimiter = ',', $header_row = 0, $lengt // -------------------------------------------------------------------- -/** - * Return the value from an associative array or an object. - * credit: borrowed from Vanilla forums GetValueR function - * - * @access public - * @param mixed $array The array or object to search. - * @param string $key The key or property name of the value. - * @param mixed $default The value to return if the key does not exist. - * @return mixed The value from the array or object. - */ if ( ! function_exists('array_get')) { + /** + * Return the value from an associative array or an object. + * credit: borrowed from Vanilla forums GetValueR function + * + * @access public + * @param mixed $array The array or object to search. + * @param string $key The key or property name of the value. + * @param mixed $default The value to return if the key does not exist. + * @return mixed The value from the array or object. + */ function array_get($array, $key, $default = FALSE) { $path = explode('.', $key); diff --git a/fuel/modules/fuel/helpers/MY_date_helper.php b/fuel/modules/fuel/helpers/MY_date_helper.php index 269c1dee3..b1068a395 100644 --- a/fuel/modules/fuel/helpers/MY_date_helper.php +++ b/fuel/modules/fuel/helpers/MY_date_helper.php @@ -29,16 +29,16 @@ // -------------------------------------------------------------------- -/** - * Returns the date into a specified format. Will look at the configuration - * - * @access public' - * @param string - * @param mixed - * @return string - */ if (!function_exists('date_formatter')) { + /** + * Returns the date into a specified format. Will look at the configuration + * + * @access public' + * @param string + * @param mixed + * @return string + */ function date_formatter($date, $format = FALSE) { $date_ts = strtotime($date); @@ -65,15 +65,15 @@ function date_formatter($date, $format = FALSE) // -------------------------------------------------------------------- -/** - * Returns the current datetime value in MySQL format - * - * @access public - * @param boolean - * @return string - */ if (!function_exists('datetime_now')) { + /** + * Returns the current datetime value in MySQL format + * + * @access public + * @param boolean + * @return string + */ function datetime_now($hms = TRUE) { if ($hms) @@ -89,15 +89,15 @@ function datetime_now($hms = TRUE) // -------------------------------------------------------------------- -/** - * Test for common date format - * - * @access public - * @param string - * @return boolean - */ if (!function_exists('is_date_format')) { + /** + * Test for common date format + * + * @access public + * @param string + * @return boolean + */ function is_date_format($date) { return (is_string($date) AND (!empty($date) AND (int)$date != 0) AND @@ -107,15 +107,15 @@ function is_date_format($date) // -------------------------------------------------------------------- -/** - * Test for MySQL date format - * - * @access public - * @param string - * @return boolean - */ if (!function_exists('is_date_db_format')) { + /** + * Test for MySQL date format + * + * @access public + * @param string + * @return boolean + */ function is_date_db_format($date) { return preg_match("#([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})#", $date); @@ -124,15 +124,15 @@ function is_date_db_format($date) // -------------------------------------------------------------------- -/** - * Test for mm/dd/yyyy format - * - * @access public - * @param string - * @return boolean - */ if (!function_exists('is_date_english_format')) { + /** + * Test for mm/dd/yyyy format + * + * @access public + * @param string + * @return boolean + */ function is_date_english_format($date) { return preg_match("#([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})#", $date) OR preg_match("#([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})#", $date); @@ -141,19 +141,19 @@ function is_date_english_format($date) // -------------------------------------------------------------------- -/** - * Returns date in mm/dd/yyy format by default - * Can be configured with a date_format config value - * - * @access public - * @param string - * @param boolean - * @param string - * @param string - * @return string - */ if (!function_exists('english_date')) { + /** + * Returns date in mm/dd/yyy format by default + * Can be configured with a date_format config value + * + * @access public + * @param string + * @param boolean + * @param string + * @param string + * @return string + */ function english_date($date, $long = FALSE, $timezone = NULL, $delimiter = '/') { if (!is_numeric($date) AND !preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $date, $regs)) @@ -183,16 +183,16 @@ function english_date($date, $long = FALSE, $timezone = NULL, $delimiter = '/') // -------------------------------------------------------------------- -/** - * Returns date in 'verbose' (e.g. Jan. 1, 2010) format - * Can be configured with a date_format_verbose config value - * - * @access public - * @param string - * @return boolean - */ if (!function_exists('english_date_verbose')) { + /** + * Returns date in 'verbose' (e.g. Jan. 1, 2010) format + * Can be configured with a date_format_verbose config value + * + * @access public + * @param string + * @return boolean + */ function english_date_verbose($date) { $date_ts = (!is_numeric($date)) ? strtotime($date) : $date; @@ -209,18 +209,18 @@ function english_date_verbose($date) // -------------------------------------------------------------------- -/** - * Returns the time into a verbose format (e.g. 12hrs 10mins 10secs) - * - * must be passed a string in hh:mm format - * - * @access public - * @param string - * @param boolean - * @return boolean - */ if (!function_exists('time_verbose')) { + /** + * Returns the time into a verbose format (e.g. 12hrs 10mins 10secs) + * + * must be passed a string in hh:mm format + * + * @access public + * @param string + * @param boolean + * @return boolean + */ function time_verbose($time, $include_seconds = FALSE) { if (is_date_format($time)) @@ -247,19 +247,19 @@ function time_verbose($time, $include_seconds = FALSE) // -------------------------------------------------------------------- -/** - * Converts a date from english (e.g. mm/dd/yyyy) to db format (e.g yyyy-mm-dd) - * - * @access public - * @param string - * @param int - * @param int - * @param int - * @param string - * @return string - */ if (!function_exists('english_date_to_db_format')) { + /** + * Converts a date from english (e.g. mm/dd/yyyy) to db format (e.g yyyy-mm-dd) + * + * @access public + * @param string + * @param int + * @param int + * @param int + * @param string + * @return string + */ function english_date_to_db_format($date, $hour = 0, $min = 0, $sec = 0, $ampm = 'am') { $hour = (int) $hour; @@ -313,21 +313,21 @@ function english_date_to_db_format($date, $hour = 0, $min = 0, $sec = 0, $ampm = // -------------------------------------------------------------------- -/** - * Formats a date into yyyy-mm-dd hh:mm:ss format - * - * @access public - * @param int - * @param int - * @param int - * @param int - * @param int - * @param int - * @return string - */ // formats a date into a mysql date if (!function_exists('format_db_date')) { + /** + * Formats a date into yyyy-mm-dd hh:mm:ss format + * + * @access public + * @param int + * @param int + * @param int + * @param int + * @param int + * @param int + * @return string + */ function format_db_date($y = NULL, $m = NULL, $d = NULL, $h = NULL, $i = NULL, $s = NULL) { if (empty($m) AND !empty($y)) @@ -364,17 +364,17 @@ function format_db_date($y = NULL, $m = NULL, $d = NULL, $h = NULL, $i = NULL, $ // -------------------------------------------------------------------- -/** - * Creates a date range string (e.g. January 1-10, 2010) - * - * @access public - * @param string start date - * @param string end date - * @param array formatting parameters - * @return string - */ if (!function_exists('date_range_string')) { + /** + * Creates a date range string (e.g. January 1-10, 2010) + * + * @access public + * @param string start date + * @param string end date + * @param array formatting parameters + * @return string + */ function date_range_string($date1, $date2, $params = array()) { @@ -431,18 +431,18 @@ function date_range_string($date1, $date2, $params = array()) // -------------------------------------------------------------------- -/** - * Creates a string based on how long from the current time the date provided. - * - * (e.g. 10 minutes ago) - * - * @access public - * @param string - * @param booelan - * @return string - */ if (!function_exists('pretty_date')) { + /** + * Creates a string based on how long from the current time the date provided. + * + * (e.g. 10 minutes ago) + * + * @access public + * @param string + * @param booelan + * @return string + */ function pretty_date($timestamp, $use_gmt = FALSE) { if (is_string($timestamp)) @@ -496,16 +496,16 @@ function pretty_date($timestamp, $use_gmt = FALSE) // -------------------------------------------------------------------- -/** - * Calculate the age between 2 dates - * - * @access public - * @param int - * @param int - * @return string - */ if (!function_exists('get_age')) { + /** + * Calculate the age between 2 dates + * + * @access public + * @param int + * @param int + * @return string + */ function get_age($bday_ts, $at_time_ts = NULL) { if (empty($at_time_ts)) $at_time_ts = time(); @@ -528,19 +528,19 @@ function get_age($bday_ts, $at_time_ts = NULL) // ------------------------------------------------------------------------ -/** - * Standard Date.. OVERWRITE CI version due to bugs - * - * Returns a date formatted according to the submitted standard. - * http://codeigniter.com/forums/viewthread/171906/ - * - * @access public - * @param string the chosen format - * @param int Unix timestamp - * @return string - */ if (!function_exists('standard_date')) { + /** + * Standard Date.. OVERWRITE CI version due to bugs + * + * Returns a date formatted according to the submitted standard. + * http://codeigniter.com/forums/viewthread/171906/ + * + * @access public + * @param string the chosen format + * @param int Unix timestamp + * @return string + */ function standard_date($fmt = 'DATE_RFC822', $time = '') { $formats = array( @@ -566,15 +566,15 @@ function standard_date($fmt = 'DATE_RFC822', $time = '') // -------------------------------------------------------------------- -/** - * Returns a timestamp from the provided time - * - * @access public - * @param string date (optional) - * @return string - */ if (!function_exists('timestamp')) { + /** + * Returns a timestamp from the provided time + * + * @access public + * @param string date (optional) + * @return string + */ function timestamp($date = NULL) { if (empty($date)) @@ -588,16 +588,16 @@ function timestamp($date = NULL) // -------------------------------------------------------------------- -/** - * Returns a the month value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are 'm/numeric', 'F/long', 'M/short' <- default (optional) - * @return string - */ if (!function_exists('month')) { + /** + * Returns a the month value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are 'm/numeric', 'F/long', 'M/short' <- default (optional) + * @return string + */ function month($date = NULL, $format = 'M') { $ts = timestamp($date); @@ -617,16 +617,16 @@ function month($date = NULL, $format = 'M') // -------------------------------------------------------------------- -/** - * Returns a the day value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are 'd/leading', 'j' <- default (optional) - * @return string - */ if (!function_exists('day')) { + /** + * Returns a the day value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are 'd/leading', 'j' <- default (optional) + * @return string + */ function day($date = NULL, $format = 'j') { switch($format) @@ -641,16 +641,16 @@ function day($date = NULL, $format = 'j') // -------------------------------------------------------------------- -/** - * Returns a the weekday value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are 'l/full', 'N/numeric', 'D' <- default (optional) - * @return string - */ if (!function_exists('weekday')) { + /** + * Returns a the weekday value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are 'l/full', 'N/numeric', 'D' <- default (optional) + * @return string + */ function weekday($date = NULL, $format = 'D') { $ts = timestamp($date); @@ -668,16 +668,16 @@ function weekday($date = NULL, $format = 'D') // -------------------------------------------------------------------- -/** - * Returns a the year value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are 'y/short', 'Y/long' <- default (optional) - * @return string - */ if (!function_exists('year')) { + /** + * Returns a the year value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are 'y/short', 'Y/long' <- default (optional) + * @return string + */ function year($date = NULL, $format = 'Y') { $ts = timestamp($date); @@ -693,16 +693,16 @@ function year($date = NULL, $format = 'Y') // -------------------------------------------------------------------- -/** - * Returns a the weekday value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are '24/military', '12' <- default (optional) - * @return string - */ if (!function_exists('hour')) { + /** + * Returns a the weekday value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are '24/military', '12' <- default (optional) + * @return string + */ function hour($date = NULL, $format = '12') { $ts = timestamp($date); @@ -718,16 +718,16 @@ function hour($date = NULL, $format = '12') // -------------------------------------------------------------------- -/** - * Returns a the weekday value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are 'noleading', 'leading' <- default (optional) - * @return string - */ if (!function_exists('minute')) { + /** + * Returns a the weekday value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are 'noleading', 'leading' <- default (optional) + * @return string + */ function minute($date = NULL, $format = 'leading') { $min = date('i', timestamp($date)); @@ -741,16 +741,16 @@ function minute($date = NULL, $format = 'leading') // -------------------------------------------------------------------- -/** - * Returns a the weekday value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are 'noleading', 'leading' <- default (optional) - * @return string - */ if (!function_exists('second')) { + /** + * Returns a the weekday value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are 'noleading', 'leading' <- default (optional) + * @return string + */ function second($date = NULL, $format = 'leading') { $sec = date('s', timestamp($date)); @@ -764,16 +764,16 @@ function second($date = NULL, $format = 'leading') // -------------------------------------------------------------------- -/** - * Returns a the ampm value of a provided date - * - * @access public - * @param string date (optional) - * @param string options are 'A/upper/uppercase', 'a/lower/lowercase' <- default (optional) - * @return string - */ if (!function_exists('ampm')) { + /** + * Returns a the ampm value of a provided date + * + * @access public + * @param string date (optional) + * @param string options are 'A/upper/uppercase', 'a/lower/lowercase' <- default (optional) + * @return string + */ function ampm($date = NULL, $format = 'a') { $ts = timestamp($date); @@ -789,15 +789,15 @@ function ampm($date = NULL, $format = 'a') // -------------------------------------------------------------------- -/** - * Determines whether the time is midnight or not. Helps with dates that are set without time values - * - * @access public - * @param string date - * @return string - */ if (!function_exists('is_midnight')) { + /** + * Determines whether the time is midnight or not. Helps with dates that are set without time values + * + * @access public + * @param string date + * @return string + */ function is_midnight($date) { $ts = timestamp($date); diff --git a/fuel/modules/fuel/helpers/MY_directory_helper.php b/fuel/modules/fuel/helpers/MY_directory_helper.php index 95e0f9bc4..52b326d61 100644 --- a/fuel/modules/fuel/helpers/MY_directory_helper.php +++ b/fuel/modules/fuel/helpers/MY_directory_helper.php @@ -32,16 +32,16 @@ // -------------------------------------------------------------------- -/** - * Recursively copies from one directory to another - * - * @access public - * @param string - * @param string - * @return array - */ if (!function_exists('copyr')) { + /** + * Recursively copies from one directory to another + * + * @access public + * @param string + * @param string + * @return array + */ function copyr($source, $dest) { // Simple copy for a file @@ -90,17 +90,17 @@ function copyr($source, $dest) // -------------------------------------------------------------------- -/** - * Recursively changes the permissions of a folder structure - * - * from php.net/chmod - * @access public - * @param string - * @param octal - * @return boolean - */ if (!function_exists('chmodr')) { + /** + * Recursively changes the permissions of a folder structure + * + * from php.net/chmod + * @access public + * @param string + * @param octal + * @return boolean + */ function chmodr($path, $filemode) { if (!is_dir($path)) { @@ -143,18 +143,18 @@ function chmodr($path, $filemode) { // -------------------------------------------------------------------- -/** - * Returns an array of file names from a directory - * - * @access public - * @param string - * @param boolean - * @param mixed - * @param boolean - * @return array - */ if (!function_exists('directory_to_array')) { + /** + * Returns an array of file names from a directory + * + * @access public + * @param string + * @param boolean + * @param mixed + * @param boolean + * @return array + */ function directory_to_array($directory, $recursive = TRUE, $exclude = array(), $append_path = TRUE, $no_ext = FALSE, $_first_time = TRUE) { static $orig_directory; @@ -198,20 +198,20 @@ function directory_to_array($directory, $recursive = TRUE, $exclude = array(), $ // -------------------------------------------------------------------- -/** - * Lists the directories only from a give directory - * - * @access public - * @param string - * @param mixed - * @param boolean - * @param boolean - * @param boolean - * @param boolean - * @return array - */ if (!function_exists('list_directories')) { + /** + * Lists the directories only from a give directory + * + * @access public + * @param string + * @param mixed + * @param boolean + * @param boolean + * @param boolean + * @param boolean + * @return array + */ function list_directories($directory, $exclude = array(), $full_path = TRUE, $is_writable = FALSE, $recursive = TRUE, $_first_time = TRUE) { static $orig_directory; diff --git a/fuel/modules/fuel/helpers/MY_file_helper.php b/fuel/modules/fuel/helpers/MY_file_helper.php index dba4af71f..5d28368f4 100644 --- a/fuel/modules/fuel/helpers/MY_file_helper.php +++ b/fuel/modules/fuel/helpers/MY_file_helper.php @@ -32,17 +32,17 @@ // -------------------------------------------------------------------- -/** - * Gets the directory file info. - * - * @access public - * @param string - * @param boolean - * @param boolean - * @return array - */ if (!function_exists('get_dir_file_info')) { + /** + * Gets the directory file info. + * + * @access public + * @param string + * @param boolean + * @param boolean + * @return array + */ function get_dir_file_info($source_dir, $top_level_only = TRUE, $include_path = FALSE, $_recursion = FALSE) { static $_filedata = array(); @@ -95,18 +95,18 @@ function get_dir_file_info($source_dir, $top_level_only = TRUE, $include_path = // -------------------------------------------------------------------- -/** - * Deletes files in a directory with the added option to exclude certain files - * - * @access public - * @param string - * @param boolean - * @param mixed - * @param int - * @return void - */ if (!function_exists('delete_files')) { + /** + * Deletes files in a directory with the added option to exclude certain files + * + * @access public + * @param string + * @param boolean + * @param mixed + * @param int + * @return void + */ function delete_files($path, $del_dir = FALSE, $exclude = NULL, $level = 0) { // Trim the trailing slash @@ -145,17 +145,17 @@ function delete_files($path, $del_dir = FALSE, $exclude = NULL, $level = 0) // -------------------------------------------------------------------- -/** - * Deletes files in a directory older then a certain date with the added option to exclude certain files - * - * @access public - * @param string - * @param string - * @param mixed - * @return void - */ if (!function_exists('delete_old_files')) { + /** + * Deletes files in a directory older then a certain date with the added option to exclude certain files + * + * @access public + * @param string + * @param string + * @param mixed + * @return void + */ function delete_old_files($dir, $older_than, $exclude = array()) { $files = get_dir_file_info($dir); @@ -178,15 +178,15 @@ function delete_old_files($dir, $older_than, $exclude = array()) // -------------------------------------------------------------------- -/** - * Determines if the file is an image - * - * @access public - * @param string - * @return boolean - */ if (!function_exists('is_image_file')) { + /** + * Determines if the file is an image + * + * @access public + * @param string + * @return boolean + */ function is_image_file($path) { if (preg_match("/.+\\.(jpg|jpeg|jpe|gif|png)$/i",$path)) diff --git a/fuel/modules/fuel/helpers/MY_html_helper.php b/fuel/modules/fuel/helpers/MY_html_helper.php index 04eb10f05..21fc725e2 100644 --- a/fuel/modules/fuel/helpers/MY_html_helper.php +++ b/fuel/modules/fuel/helpers/MY_html_helper.php @@ -32,18 +32,18 @@ // -------------------------------------------------------------------- -/** - * Wrap an string or array of values in opening and closing tag - * - * @access public - * @param string opening tag element - * @param string closing tag element - * @param mixed array of values to be enclosed by tags - * @param boolean echo to the screen - * @return string - */ if (!function_exists('tag')) { + /** + * Wrap an string or array of values in opening and closing tag + * + * @access public + * @param string opening tag element + * @param string closing tag element + * @param mixed array of values to be enclosed by tags + * @param boolean echo to the screen + * @return string + */ function tag($tag, $vals, $attrs = array()) { $str = ''; @@ -69,18 +69,18 @@ function tag($tag, $vals, $attrs = array()) // -------------------------------------------------------------------- -/** - * Wrap a string into an HTML blockquote with quotes and cite added - * - * @access public - * @param string string to be enclosed by quote elements - * @param string string source value - * @param string string company/position value - * @param string string css class - * @return string - */ if (!function_exists('quote')) { + /** + * Wrap a string into an HTML blockquote with quotes and cite added + * + * @access public + * @param string string to be enclosed by quote elements + * @param string string source value + * @param string string company/position value + * @param string string css class + * @return string + */ function quote($quote, $cite = NULL, $title = NULL, $class = 'quote') { $str = '