From 5036c9caabb12f90b9533d7fb417610e02a652ff Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 Jun 2012 15:34:56 +0300 Subject: Revert/optimize some changes from 773ccc318f2769c9b7579630569b5d8ba47b114b and d261b1e89c3d4d5191036d5a5660ef6764e593a0 --- system/helpers/date_helper.php | 10 +++++----- system/libraries/Calendar.php | 12 ++++++------ system/libraries/Cart.php | 4 ++-- system/libraries/Image_lib.php | 6 +++--- system/libraries/Session.php | 2 +- system/libraries/Trackback.php | 2 +- system/libraries/Upload.php | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 0bda33378..c601dc9e5 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -285,7 +285,7 @@ if ( ! function_exists('days_in_month')) $year = date('Y'); } - if ($month === 2) + if ($month == 2) { if ($year % 400 === 0 OR ($year % 4 === 0 && $year % 100 !== 0)) { @@ -472,9 +472,9 @@ if ( ! function_exists('human_to_unix')) $hour = (strlen($ex[0]) === 1) ? '0'.$ex[0] : $ex[0]; $min = (strlen($ex[1]) === 1) ? '0'.$ex[1] : $ex[1]; - if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex[2])) + if (isset($ex[2]) && preg_match('/[0-9]{1,2}/', $ex[2])) { - $sec = (strlen($ex[2]) === 1) ? '0'.$ex[2] : $ex[2]; + $sec = (strlen($ex[2]) === 1) ? '0'.$ex[2] : $ex[2]; } else { @@ -482,7 +482,7 @@ if ( ! function_exists('human_to_unix')) $sec = '00'; } - if (isset($split['2'])) + if (isset($split[2])) { $ampm = strtolower($split[2]); @@ -491,7 +491,7 @@ if ( ! function_exists('human_to_unix')) $hour += 12; } - if (substr($ampm, 0, 1) === 'a' && $hour === 12) + if (substr($ampm, 0, 1) === 'a' && $hour == 12) { $hour = '00'; } diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 753033a34..969a7610a 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -205,7 +205,7 @@ class CI_Calendar { $cur_month = date('m', $this->local_time); $cur_day = date('j', $this->local_time); - $is_current_month = ($cur_year === $year && $cur_month === $month); + $is_current_month = ($cur_year == $year && $cur_month == $month); // Generate the template data array $this->parse_template(); @@ -258,21 +258,21 @@ class CI_Calendar { for ($i = 0; $i < 7; $i++) { - $out .= ($is_current_month === TRUE && $day === $cur_day) ? $this->temp['cal_cell_start_today'] : $this->temp['cal_cell_start']; + $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_start_today'] : $this->temp['cal_cell_start']; if ($day > 0 && $day <= $total_days) { if (isset($data[$day])) { // Cells with content - $temp = ($is_current_month === TRUE && $day === $cur_day) ? + $temp = ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_content_today'] : $this->temp['cal_cell_content']; $out .= str_replace(array('{content}', '{day}'), array($data[$day], $day), $temp); } else { // Cells with no content - $temp = ($is_current_month === TRUE && $day === $cur_day) ? + $temp = ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_no_content_today'] : $this->temp['cal_cell_no_content']; $out .= str_replace('{day}', $day, $temp); } @@ -283,7 +283,7 @@ class CI_Calendar { $out .= $this->temp['cal_cell_blank']; } - $out .= ($is_current_month === TRUE && $day === $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; + $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; $day++; } @@ -419,7 +419,7 @@ class CI_Calendar { } // Is the year a leap year? - if ($month === 2) + if ($month == 2) { if ($year % 400 === 0 OR ($year % 4 === 0 && $year % 100 !== 0)) { diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 87b1877c3..c442f88da 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -193,7 +193,7 @@ class CI_Cart { $items['qty'] = (float) $items['qty']; // If the quantity is zero or blank there's nothing for us to do - if ( ! is_numeric($items['qty']) OR $items['qty'] === 0) + if ( ! is_numeric($items['qty']) OR $items['qty'] == 0) { return FALSE; } @@ -358,7 +358,7 @@ class CI_Cart { // Is the quantity zero? If so we will remove the item from the cart. // If the quantity is greater than zero we are updating - if ($items['qty'] === 0) + if ($items['qty'] == 0) { unset($this->_cart_contents[$items['rowid']]); } diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index c3973a02f..4735dfd08 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -610,8 +610,8 @@ class CI_Image_lib { } // Set the x/y coordinates - $this->x_axis = ($this->x_axis === '' OR ! preg_match('/^[0-9]+$/', $this->x_axis)) ? 0 : $this->x_axis; - $this->y_axis = ($this->y_axis === '' OR ! preg_match('/^[0-9]+$/', $this->y_axis)) ? 0 : $this->y_axis; + is_numeric($this->x_axis) OR $this->x_axis = 0; + is_numeric($this->y_axis) OR $this->y_axis = 0; // Watermark-related Stuff... if ($this->wm_overlay_path !== '') @@ -750,7 +750,7 @@ class CI_Image_lib { if ($this->gd_version() !== FALSE) { $gd_version = str_replace('0', '', $this->gd_version()); - $v2_override = ($gd_version === 2) ? TRUE : FALSE; + $v2_override = ($gd_version === 2); } } else diff --git a/system/libraries/Session.php b/system/libraries/Session.php index cc992a5b8..7beedd96b 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -359,7 +359,7 @@ class CI_Session { // Is there custom data? If so, add it to the main session array $row = $query->row(); - if (isset($row->user_data) && $row->user_data !== '') + if ( ! empty($row->user_data)) { $custom_data = $this->_unserialize($row->user_data); diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 0da85a022..9a680dc2a 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -132,7 +132,7 @@ class CI_Trackback { { foreach (array('url', 'title', 'blog_name', 'excerpt') as $val) { - if ( ! isset($_POST[$val]) OR $_POST[$val] === '') + if (empty($_POST[$val])) { $this->set_error('The following required POST variable is missing: '.$val); return FALSE; diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index e4cc54b21..bd97a611b 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -809,12 +809,12 @@ class CI_Upload { { $file = $this->file_temp; - if (filesize($file) === 0) + if (filesize($file) == 0) { return FALSE; } - if (function_exists('memory_get_usage') && memory_get_usage() && ini_get('memory_limit') !== '') + if (function_exists('memory_get_usage') && memory_get_usage() && ini_get('memory_limit')) { $current = ini_get('memory_limit') * 1024 * 1024; -- cgit v1.2.3-24-g4f1b