Revert/optimize some changes from 773ccc318f2769c9b7579630569b5d8ba47b114b and d261b1e89c3d4d5191036d5a5660ef6764e593a0
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 0bda333..c601dc9 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -285,7 +285,7 @@
 			$year = date('Y');
 		}
 
-		if ($month === 2)
+		if ($month == 2)
 		{
 			if ($year % 400 === 0 OR ($year % 4 === 0 && $year % 100 !== 0))
 			{
@@ -472,9 +472,9 @@
 		$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 @@
 			$sec = '00';
 		}
 
-		if (isset($split['2']))
+		if (isset($split[2]))
 		{
 			$ampm = strtolower($split[2]);
 
@@ -491,7 +491,7 @@
 				$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 753033a..969a761 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -205,7 +205,7 @@
 		$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 @@
 
 			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 @@
 					$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 @@
 		}
 
 		// 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 87b1877..c442f88 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -193,7 +193,7 @@
 		$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 @@
 
 		// 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 c3973a0..4735dfd 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -610,8 +610,8 @@
 		}
 
 		// 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 @@
 			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 cc992a5..7beedd9 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -359,7 +359,7 @@
 
 			// 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 0da85a0..9a680dc 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -132,7 +132,7 @@
 	{
 		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 e4cc54b..bd97a61 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -809,12 +809,12 @@
 	{
 		$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;