From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Cache/drivers/Cache_file.php | 2 +- system/libraries/Cache/drivers/Cache_memcached.php | 2 +- system/libraries/Calendar.php | 30 +++--- system/libraries/Cart.php | 6 +- system/libraries/Email.php | 54 +++++------ system/libraries/Encrypt.php | 8 +- system/libraries/Form_validation.php | 36 ++++---- system/libraries/Ftp.php | 30 +++--- system/libraries/Image_lib.php | 102 ++++++++++----------- system/libraries/Javascript.php | 4 +- system/libraries/Log.php | 4 +- system/libraries/Migration.php | 4 +- system/libraries/Pagination.php | 28 +++--- system/libraries/Parser.php | 4 +- system/libraries/Profiler.php | 8 +- system/libraries/Session.php | 24 ++--- system/libraries/Table.php | 10 +- system/libraries/Trackback.php | 12 +-- system/libraries/Typography.php | 8 +- system/libraries/Unit_test.php | 10 +- system/libraries/Upload.php | 28 +++--- system/libraries/Xmlrpc.php | 68 +++++++------- system/libraries/Xmlrpcs.php | 24 ++--- system/libraries/javascript/Jquery.php | 30 +++--- 24 files changed, 268 insertions(+), 268 deletions(-) (limited to 'system') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index f0eb8bdf7..ce2c2b13a 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -53,7 +53,7 @@ class CI_Cache_file extends CI_Driver { $CI =& get_instance(); $CI->load->helper('file'); $path = $CI->config->item('cache_path'); - $this->_cache_path = ($path == '') ? APPPATH.'cache/' : $path; + $this->_cache_path = ($path === '') ? APPPATH.'cache/' : $path; } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 1df149c2d..bf90f6197 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -212,7 +212,7 @@ class CI_Cache_memcached extends CI_Driver { $cache_server['weight'] = $this->_memcache_conf['default']['default_weight']; } - if (get_class($this->_memcached) == 'Memcache') + if (get_class($this->_memcached) === 'Memcache') { // Third parameter is persistance and defaults to TRUE. $this->_memcached->addServer( diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 92f372b20..753033a34 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -155,7 +155,7 @@ class CI_Calendar { public function generate($year = '', $month = '', $data = array()) { // Set and validate the supplied month/year - if ($year == '') + if ($year === '') { $year = date('Y', $this->local_time); } @@ -168,7 +168,7 @@ class CI_Calendar { $year = '20'.$year; } - if ($month == '') + if ($month === '') { $month = date('m', $this->local_time); } @@ -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(); @@ -214,7 +214,7 @@ class CI_Calendar { $out = $this->temp['table_open']."\n\n".$this->temp['heading_row_start']."\n"; // "previous" month link - if ($this->show_next_prev == TRUE) + if ($this->show_next_prev === TRUE) { // Add a trailing slash to the URL if needed $this->next_prev_url = preg_replace('/(.+?)\/*$/', '\\1/', $this->next_prev_url); @@ -224,7 +224,7 @@ class CI_Calendar { } // Heading containing the month/year - $colspan = ($this->show_next_prev == TRUE) ? 5 : 7; + $colspan = ($this->show_next_prev === TRUE) ? 5 : 7; $this->temp['heading_title_cell'] = str_replace('{colspan}', $colspan, str_replace('{heading}', $this->get_month_name($month).' '.$year, $this->temp['heading_title_cell'])); @@ -232,7 +232,7 @@ class CI_Calendar { $out .= $this->temp['heading_title_cell']."\n"; // "next" month link - if ($this->show_next_prev == TRUE) + if ($this->show_next_prev === TRUE) { $adjusted_date = $this->adjust_date($month + 1, $year); $out .= str_replace('{next_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_next_cell']); @@ -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++; } @@ -306,7 +306,7 @@ class CI_Calendar { */ public function get_month_name($month) { - if ($this->month_type == 'short') + if ($this->month_type === 'short') { $month_names = array('01' => 'cal_jan', '02' => 'cal_feb', '03' => 'cal_mar', '04' => 'cal_apr', '05' => 'cal_may', '06' => 'cal_jun', '07' => 'cal_jul', '08' => 'cal_aug', '09' => 'cal_sep', '10' => 'cal_oct', '11' => 'cal_nov', '12' => 'cal_dec'); } @@ -333,7 +333,7 @@ class CI_Calendar { */ public function get_day_names($day_type = '') { - if ($day_type != '') + if ($day_type !== '') { $this->day_type = $day_type; } @@ -419,9 +419,9 @@ 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)) + if ($year % 400 === 0 OR ($year % 4 === 0 && $year % 100 !== 0)) { return 29; } @@ -480,7 +480,7 @@ class CI_Calendar { { $this->temp = $this->default_template(); - if ($this->template == '') + if ($this->template === '') { return; } diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 827050310..87b1877c3 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']]); } @@ -520,7 +520,7 @@ class CI_Cart { */ public function format_number($n = '') { - return ($n == '') ? '' : number_format( (float) $n, 2, '.', ','); + return ($n === '') ? '' : number_format( (float) $n, 2, '.', ','); } // -------------------------------------------------------------------- diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 56d60c802..45866797b 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -104,7 +104,7 @@ class CI_Email { } else { - $this->_smtp_auth = ! ($this->smtp_user == '' && $this->smtp_pass == ''); + $this->_smtp_auth = ! ($this->smtp_user === '' && $this->smtp_pass === ''); $this->_safe_mode = (bool) @ini_get('safe_mode'); } @@ -139,7 +139,7 @@ class CI_Email { } $this->clear(); - $this->_smtp_auth = ! ($this->smtp_user == '' && $this->smtp_pass == ''); + $this->_smtp_auth = ! ($this->smtp_user === '' && $this->smtp_pass === ''); $this->_safe_mode = (bool) @ini_get('safe_mode'); return $this; @@ -201,7 +201,7 @@ class CI_Email { } // prepare the display name - if ($name != '') + if ($name !== '') { // only use Q encoding if there are characters that would require it if ( ! preg_match('/[\200-\377]/', $name)) @@ -242,7 +242,7 @@ class CI_Email { $this->validate_email($this->_str_to_array($replyto)); } - if ($name == '') + if ($name === '') { $name = $replyto; } @@ -333,7 +333,7 @@ class CI_Email { */ public function bcc($bcc, $limit = '') { - if ($limit != '' && is_numeric($limit)) + if ($limit !== '' && is_numeric($limit)) { $this->bcc_batch_mode = TRUE; $this->bcc_batch_size = $limit; @@ -586,7 +586,7 @@ class CI_Email { $this->protocol = strtolower($this->protocol); in_array($this->protocol, $this->_protocols, TRUE) OR $this->protocol = 'mail'; - if ($return == TRUE) + if ($return === TRUE) { return $this->protocol; } @@ -612,7 +612,7 @@ class CI_Email { } } - if ($return == TRUE) + if ($return === TRUE) { return $this->_encoding; } @@ -629,7 +629,7 @@ class CI_Email { { if ($this->mailtype === 'html') { - return (count($this->_attach_name) == 0) ? 'html' : 'html-attach'; + return (count($this->_attach_name) === 0) ? 'html' : 'html-attach'; } elseif ($this->mailtype === 'text' && count($this->_attach_name) > 0) { @@ -750,7 +750,7 @@ class CI_Email { */ protected function _get_alt_message() { - if ($this->alt_message != '') + if ($this->alt_message !== '') { return $this->word_wrap($this->alt_message, '76'); } @@ -778,9 +778,9 @@ class CI_Email { public function word_wrap($str, $charlim = '') { // Se the character limit - if ($charlim == '') + if ($charlim === '') { - $charlim = ($this->wrapchars == '') ? 76 : $this->wrapchars; + $charlim = ($this->wrapchars === '') ? 76 : $this->wrapchars; } // Reduce multiple spaces @@ -838,7 +838,7 @@ class CI_Email { // If $temp contains data it means we had to split up an over-length // word into smaller chunks so we'll add it back to our current line - if ($temp != '') + if ($temp !== '') { $output .= $temp.$this->newline; } @@ -896,7 +896,7 @@ class CI_Email { { $val = trim($val); - if ($val != '') + if ($val !== '') { $this->_header_str .= $key.': '.$val.$this->newline; } @@ -1043,7 +1043,7 @@ class CI_Email { $ctype = $this->_attach_type[$i]; $file_content = ''; - if ($this->_attach_type[$i] == '') + if ($this->_attach_type[$i] === '') { if ( ! file_exists($filename)) { @@ -1099,7 +1099,7 @@ class CI_Email { // Set the character limit // Don't allow over 76, as that will make servers and MUAs barf // all over quoted-printable data - if ($charlim == '' OR $charlim > 76) + if ($charlim === '' OR $charlim > 76) { $charlim = 76; } @@ -1240,7 +1240,7 @@ class CI_Email { */ public function send() { - if ($this->_replyto_flag == FALSE) + if ($this->_replyto_flag === FALSE) { $this->reply_to($this->_headers['From']); } @@ -1284,7 +1284,7 @@ class CI_Email { $set .= ', '.$this->_bcc_array[$i]; } - if ($i == $float) + if ($i === $float) { $chunk[] = substr($set, 1); $float += $this->bcc_batch_size; @@ -1377,7 +1377,7 @@ class CI_Email { */ protected function _send_with_mail() { - if ($this->_safe_mode == TRUE) + if ($this->_safe_mode === TRUE) { return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str); } @@ -1430,7 +1430,7 @@ class CI_Email { */ protected function _send_with_smtp() { - if ($this->smtp_host == '') + if ($this->smtp_host === '') { $this->_set_error_message('lang:email_no_hostname'); return FALSE; @@ -1452,7 +1452,7 @@ class CI_Email { { foreach ($this->_cc_array as $val) { - if ($val != '') + if ($val !== '') { $this->_send_command('to', $val); } @@ -1463,7 +1463,7 @@ class CI_Email { { foreach ($this->_bcc_array as $val) { - if ($val != '') + if ($val !== '') { $this->_send_command('to', $val); } @@ -1501,7 +1501,7 @@ class CI_Email { */ protected function _smtp_connect() { - $ssl = ($this->smtp_crypto == 'ssl') ? 'ssl://' : NULL; + $ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : NULL; $this->_smtp_connect = fsockopen($ssl.$this->smtp_host, $this->smtp_port, @@ -1517,7 +1517,7 @@ class CI_Email { $this->_set_error_message($this->_get_smtp_data()); - if ($this->smtp_crypto == 'tls') + if ($this->smtp_crypto === 'tls') { $this->_send_command('hello'); $this->_send_command('starttls'); @@ -1599,13 +1599,13 @@ class CI_Email { $this->_debug_msg[] = '
'.$cmd.': '.$reply.'
'; - if (substr($reply, 0, 3) != $resp) + if (substr($reply, 0, 3) !== $resp) { $this->_set_error_message('lang:email_smtp_error', $reply); return FALSE; } - if ($cmd == 'quit') + if ($cmd === 'quit') { fclose($this->_smtp_connect); } @@ -1627,7 +1627,7 @@ class CI_Email { return TRUE; } - if ($this->smtp_user == '' && $this->smtp_pass == '') + if ($this->smtp_user === '' && $this->smtp_pass === '') { $this->_set_error_message('lang:email_no_smtp_unpw'); return FALSE; @@ -1699,7 +1699,7 @@ class CI_Email { { $data .= $str; - if ($str[3] == ' ') + if ($str[3] === ' ') { break; } diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 751557fab..102b1dfdd 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -97,9 +97,9 @@ class CI_Encrypt { */ public function get_key($key = '') { - if ($key == '') + if ($key === '') { - if ($this->encryption_key != '') + if ($this->encryption_key !== '') { return $this->encryption_key; } @@ -449,7 +449,7 @@ class CI_Encrypt { */ protected function _get_cipher() { - if ($this->_mcrypt_cipher == '') + if ($this->_mcrypt_cipher === '') { return $this->_mcrypt_cipher = MCRYPT_RIJNDAEL_256; } @@ -466,7 +466,7 @@ class CI_Encrypt { */ protected function _get_mode() { - if ($this->_mcrypt_mode == '') + if ($this->_mcrypt_mode === '') { return $this->_mcrypt_mode = MCRYPT_MODE_CBC; } diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 67cbfd1a0..225325d6f 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -188,13 +188,13 @@ class CI_Form_validation { } // No fields? Nothing to do... - if ( ! is_string($field) OR ! is_string($rules) OR $field == '') + if ( ! is_string($field) OR ! is_string($rules) OR $field === '') { return $this; } // If the field label wasn't passed we use the field name - $label = ($label == '') ? $field : $label; + $label = ($label === '') ? $field : $label; // Is the field name an array? If it is an array, we break it apart // into its components so that we can fetch the corresponding POST data later @@ -207,7 +207,7 @@ class CI_Form_validation { for ($i = 0, $c = count($matches[0]); $i < $c; $i++) { - if ($matches[1][$i] != '') + if ($matches[1][$i] !== '') { $indexes[] = $matches[1][$i]; } @@ -318,12 +318,12 @@ class CI_Form_validation { return ''; } - if ($prefix == '') + if ($prefix === '') { $prefix = $this->_error_prefix; } - if ($suffix == '') + if ($suffix === '') { $suffix = $this->_error_suffix; } @@ -364,12 +364,12 @@ class CI_Form_validation { return ''; } - if ($prefix == '') + if ($prefix === '') { $prefix = $this->_error_prefix; } - if ($suffix == '') + if ($suffix === '') { $suffix = $this->_error_suffix; } @@ -378,7 +378,7 @@ class CI_Form_validation { $str = ''; foreach ($this->_error_array as $val) { - if ($val != '') + if ($val !== '') { $str .= $prefix.$val.$suffix."\n"; } @@ -417,9 +417,9 @@ class CI_Form_validation { } // Is there a validation rule for the particular URI being accessed? - $uri = ($group == '') ? trim($this->CI->uri->ruri_string(), '/') : $group; + $uri = ($group === '') ? trim($this->CI->uri->ruri_string(), '/') : $group; - if ($uri != '' && isset($this->_config_rules[$uri])) + if ($uri !== '' && isset($this->_config_rules[$uri])) { $this->set_rules($this->_config_rules[$uri]); } @@ -629,7 +629,7 @@ class CI_Form_validation { // We set the $postdata variable with the current data in our master array so that // each cycle of the loop is dealing with the processed data from the last cycle - if ($row['is_array'] == TRUE && is_array($this->_field_data[$row['field']]['postdata'])) + if ($row['is_array'] === TRUE && is_array($this->_field_data[$row['field']]['postdata'])) { // We shouldn't need this safety, but just in case there isn't an array index // associated with this cycle we'll bail out @@ -852,7 +852,7 @@ class CI_Form_validation { return ''; } } - elseif (($field == '' OR $value == '') OR ($field != $value)) + elseif (($field === '' OR $value === '') OR ($field !== $value)) { return ''; } @@ -888,7 +888,7 @@ class CI_Form_validation { return ''; } } - elseif (($field == '' OR $value == '') OR ($field != $value)) + elseif (($field === '' OR $value === '') OR ($field !== $value)) { return ''; } @@ -1040,8 +1040,8 @@ class CI_Form_validation { } return (MB_ENABLED === TRUE) - ? (mb_strlen($str) == $val) - : (strlen($str) == $val); + ? (mb_strlen($str) === $val) + : (strlen($str) === $val); } // -------------------------------------------------------------------- @@ -1254,7 +1254,7 @@ class CI_Form_validation { */ public function is_natural_no_zero($str) { - return ($str != 0 && preg_match('/^[0-9]+$/', $str)); + return ($str !== 0 && preg_match('/^[0-9]+$/', $str)); } // -------------------------------------------------------------------- @@ -1296,7 +1296,7 @@ class CI_Form_validation { return $data; } - if ($this->_safe_form_data == FALSE OR $data === '') + if ($this->_safe_form_data === FALSE OR $data === '') { return $data; } @@ -1314,7 +1314,7 @@ class CI_Form_validation { */ public function prep_url($str = '') { - if ($str === 'http://' OR $str == '') + if ($str === 'http://' OR $str === '') { return ''; } diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index 3cfe1b2b6..461e884fb 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -93,7 +93,7 @@ class CI_FTP { if (FALSE === ($this->conn_id = @ftp_connect($this->hostname, $this->port))) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_connect'); } @@ -102,7 +102,7 @@ class CI_FTP { if ( ! $this->_login()) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_login'); } @@ -110,7 +110,7 @@ class CI_FTP { } // Set passive mode if needed - if ($this->passive == TRUE) + if ($this->passive === TRUE) { ftp_pasv($this->conn_id, TRUE); } @@ -141,7 +141,7 @@ class CI_FTP { { if ( ! is_resource($this->conn_id)) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_no_connection'); } @@ -167,7 +167,7 @@ class CI_FTP { */ public function changedir($path = '', $supress_debug = FALSE) { - if ($path == '' OR ! $this->_is_conn()) + if ($path === '' OR ! $this->_is_conn()) { return FALSE; } @@ -176,7 +176,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE && $supress_debug == FALSE) + if ($this->debug === TRUE && $supress_debug === FALSE) { $this->_error('ftp_unable_to_changedir'); } @@ -197,7 +197,7 @@ class CI_FTP { */ public function mkdir($path = '', $permissions = NULL) { - if ($path == '' OR ! $this->_is_conn()) + if ($path === '' OR ! $this->_is_conn()) { return FALSE; } @@ -206,7 +206,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_makdir'); } @@ -260,7 +260,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_upload'); } @@ -307,7 +307,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_download'); } @@ -338,9 +338,9 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { - $this->_error('ftp_unable_to_' . ($move == FALSE ? 'rename' : 'move')); + $this->_error('ftp_unable_to_' . ($move === FALSE ? 'rename' : 'move')); } return FALSE; } @@ -381,7 +381,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_delete'); } @@ -429,7 +429,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_delete'); } @@ -459,7 +459,7 @@ class CI_FTP { if ($result === FALSE) { - if ($this->debug == TRUE) + if ($this->debug === TRUE) { $this->_error('ftp_unable_to_chmod'); } diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 0cb189445..c3973a02f 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -466,7 +466,7 @@ class CI_Image_lib { } // Is there a source image? If not, there's no reason to continue - if ($this->source_image == '') + if ($this->source_image === '') { $this->set_error('imglib_source_image_required'); return FALSE; @@ -519,7 +519,7 @@ class CI_Image_lib { * it means we are altering the original. We'll * set the destination filename and path accordingly. */ - if ($this->new_image == '') + if ($this->new_image === '') { $this->dest_image = $this->source_image; $this->dest_folder = $this->source_folder; @@ -562,7 +562,7 @@ class CI_Image_lib { * We'll also split the destination image name * so we can insert the thumbnail marker if needed. */ - if ($this->create_thumb === FALSE OR $this->thumb_marker == '') + if ($this->create_thumb === FALSE OR $this->thumb_marker === '') { $this->thumb_marker = ''; } @@ -581,7 +581,7 @@ class CI_Image_lib { * might not be in correct proportion with the source * image's width/height. We'll recalculate it here. */ - if ($this->maintain_ratio === TRUE && ($this->width != 0 OR $this->height != 0)) + if ($this->maintain_ratio === TRUE && ($this->width !== 0 OR $this->height !== 0)) { $this->image_reproportion(); } @@ -591,12 +591,12 @@ class CI_Image_lib { * If the destination width/height was not submitted we * will use the values from the actual file */ - if ($this->width == '') + if ($this->width === '') { $this->width = $this->orig_width; } - if ($this->height == '') + if ($this->height === '') { $this->height = $this->orig_height; } @@ -604,31 +604,31 @@ class CI_Image_lib { // Set the quality $this->quality = trim(str_replace('%', '', $this->quality)); - if ($this->quality == '' OR $this->quality == 0 OR ! preg_match('/^[0-9]+$/', $this->quality)) + if ($this->quality === '' OR $this->quality === 0 OR ! preg_match('/^[0-9]+$/', $this->quality)) { $this->quality = 90; } // 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; + $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; // Watermark-related Stuff... - if ($this->wm_overlay_path != '') + if ($this->wm_overlay_path !== '') { $this->wm_overlay_path = str_replace('\\', '/', realpath($this->wm_overlay_path)); } - if ($this->wm_shadow_color != '') + if ($this->wm_shadow_color !== '') { $this->wm_use_drop_shadow = TRUE; } - elseif ($this->wm_use_drop_shadow == TRUE && $this->wm_shadow_color == '') + elseif ($this->wm_use_drop_shadow === TRUE && $this->wm_shadow_color === '') { $this->wm_use_drop_shadow = FALSE; } - if ($this->wm_font_path != '') + if ($this->wm_font_path !== '') { $this->wm_use_truetype = TRUE; } @@ -683,14 +683,14 @@ class CI_Image_lib { // Allowed rotation values $degs = array(90, 180, 270, 'vrt', 'hor'); - if ($this->rotation_angle == '' OR ! in_array($this->rotation_angle, $degs)) + if ($this->rotation_angle === '' OR ! in_array($this->rotation_angle, $degs)) { $this->set_error('imglib_rotation_angle_required'); return FALSE; } // Reassign the width and height - if ($this->rotation_angle == 90 OR $this->rotation_angle == 270) + if ($this->rotation_angle === 90 OR $this->rotation_angle === 270) { $this->width = $this->orig_height; $this->height = $this->orig_width; @@ -729,9 +729,9 @@ class CI_Image_lib { // If the target width/height match the source, AND if the new file name is not equal to the old file name // we'll simply make a copy of the original with the new name... assuming dynamic rendering is off. - if ($this->dynamic_output === FALSE && $this->orig_width == $this->width && $this->orig_height == $this->height) + if ($this->dynamic_output === FALSE && $this->orig_width === $this->width && $this->orig_height === $this->height) { - if ($this->source_image != $this->new_image && @copy($this->full_src_path, $this->full_dst_path)) + if ($this->source_image !== $this->new_image && @copy($this->full_src_path, $this->full_dst_path)) { @chmod($this->full_dst_path, FILE_WRITE_MODE); } @@ -740,7 +740,7 @@ class CI_Image_lib { } // Let's set up our values based on the action - if ($action == 'crop') + if ($action === 'crop') { // Reassign the source width/height if cropping $this->orig_width = $this->width; @@ -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) ? TRUE : FALSE; } } else @@ -772,7 +772,7 @@ class CI_Image_lib { * it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment * below should that ever prove inaccurate. * - * if ($this->image_library === 'gd2' && function_exists('imagecreatetruecolor') && $v2_override == FALSE) + * if ($this->image_library === 'gd2' && function_exists('imagecreatetruecolor') && $v2_override === FALSE) */ if ($this->image_library === 'gd2' && function_exists('imagecreatetruecolor')) { @@ -787,7 +787,7 @@ class CI_Image_lib { $dst_img = $create($this->width, $this->height); - if ($this->image_type == 3) // png we can actually preserve transparency + if ($this->image_type === 3) // png we can actually preserve transparency { imagealphablending($dst_img, FALSE); imagesavealpha($dst_img, TRUE); @@ -796,7 +796,7 @@ class CI_Image_lib { $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height); // Show the image - if ($this->dynamic_output == TRUE) + if ($this->dynamic_output === TRUE) { $this->image_display_gd($dst_img); } @@ -828,7 +828,7 @@ class CI_Image_lib { public function image_process_imagemagick($action = 'resize') { // Do we have a vaild library path? - if ($this->library_path == '') + if ($this->library_path === '') { $this->set_error('imglib_libpath_invalid'); return FALSE; @@ -842,11 +842,11 @@ class CI_Image_lib { // Execute the command $cmd = $this->library_path.' -quality '.$this->quality; - if ($action == 'crop') + if ($action === 'crop') { $cmd .= ' -crop '.$this->width.'x'.$this->height.'+'.$this->x_axis.'+'.$this->y_axis.' "'.$this->full_src_path.'" "'.$this->full_dst_path .'" 2>&1'; } - elseif ($action == 'rotate') + elseif ($action === 'rotate') { $angle = ($this->rotation_angle === 'hor' OR $this->rotation_angle === 'vrt') ? '-flop' : '-rotate '.$this->rotation_angle; @@ -886,7 +886,7 @@ class CI_Image_lib { */ public function image_process_netpbm($action = 'resize') { - if ($this->library_path == '') + if ($this->library_path === '') { $this->set_error('imglib_libpath_invalid'); return FALSE; @@ -909,11 +909,11 @@ class CI_Image_lib { break; } - if ($action == 'crop') + if ($action === 'crop') { $cmd_inner = 'pnmcut -left '.$this->x_axis.' -top '.$this->y_axis.' -width '.$this->width.' -height '.$this->height; } - elseif ($action == 'rotate') + elseif ($action === 'rotate') { switch ($this->rotation_angle) { @@ -984,7 +984,7 @@ class CI_Image_lib { $dst_img = imagerotate($src_img, $this->rotation_angle, $white); // Show the image - if ($this->dynamic_output == TRUE) + if ($this->dynamic_output === TRUE) { $this->image_display_gd($dst_img); } @@ -1058,7 +1058,7 @@ class CI_Image_lib { } // Show the image - if ($this->dynamic_output == TRUE) + if ($this->dynamic_output === TRUE) { $this->image_display_gd($src_img); } @@ -1129,10 +1129,10 @@ class CI_Image_lib { $this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]); $this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]); - if ($this->wm_vrt_alignment == 'B') + if ($this->wm_vrt_alignment === 'B') $this->wm_vrt_offset = $this->wm_vrt_offset * -1; - if ($this->wm_hor_alignment == 'R') + if ($this->wm_hor_alignment === 'R') $this->wm_hor_offset = $this->wm_hor_offset * -1; // Set the base x and y axis values @@ -1160,7 +1160,7 @@ class CI_Image_lib { } // Build the finalized image - if ($wm_img_type == 3 && function_exists('imagealphablending')) + if ($wm_img_type === 3 && function_exists('imagealphablending')) { @imagealphablending($src_img, TRUE); } @@ -1183,7 +1183,7 @@ class CI_Image_lib { } // Output the image - if ($this->dynamic_output == TRUE) + if ($this->dynamic_output === TRUE) { $this->image_display_gd($src_img); } @@ -1212,7 +1212,7 @@ class CI_Image_lib { return FALSE; } - if ($this->wm_use_truetype == TRUE && ! file_exists($this->wm_font_path)) + if ($this->wm_use_truetype === TRUE && ! file_exists($this->wm_font_path)) { $this->set_error('imglib_missing_font'); return FALSE; @@ -1228,18 +1228,18 @@ class CI_Image_lib { // invert the offset. Note: The horizontal // offset flips itself automatically - if ($this->wm_vrt_alignment == 'B') + if ($this->wm_vrt_alignment === 'B') $this->wm_vrt_offset = $this->wm_vrt_offset * -1; - if ($this->wm_hor_alignment == 'R') + if ($this->wm_hor_alignment === 'R') $this->wm_hor_offset = $this->wm_hor_offset * -1; // Set font width and height // These are calculated differently depending on // whether we are using the true type font or not - if ($this->wm_use_truetype == TRUE) + if ($this->wm_use_truetype === TRUE) { - if ($this->wm_font_size == '') + if ($this->wm_font_size === '') { $this->wm_font_size = 17; } @@ -1258,7 +1258,7 @@ class CI_Image_lib { $x_axis = $this->wm_hor_offset + $this->wm_padding; $y_axis = $this->wm_vrt_offset + $this->wm_padding; - if ($this->wm_use_drop_shadow == FALSE) + if ($this->wm_use_drop_shadow === FALSE) $this->wm_shadow_distance = 0; $this->wm_vrt_alignment = strtoupper(substr($this->wm_vrt_alignment, 0, 1)); @@ -1316,7 +1316,7 @@ class CI_Image_lib { } // Output the final image - if ($this->dynamic_output == TRUE) + if ($this->dynamic_output === TRUE) { $this->image_display_gd($src_img); } @@ -1344,10 +1344,10 @@ class CI_Image_lib { */ public function image_create_gd($path = '', $image_type = '') { - if ($path == '') + if ($path === '') $path = $this->full_src_path; - if ($image_type == '') + if ($image_type === '') $image_type = $this->image_type; @@ -1494,7 +1494,7 @@ class CI_Image_lib { */ public function image_reproportion() { - if (($this->width == 0 && $this->height == 0) OR $this->orig_width == 0 OR $this->orig_height == 0 + if (($this->width === 0 && $this->height === 0) OR $this->orig_width === 0 OR $this->orig_height === 0 OR ( ! preg_match('/^[0-9]+$/', $this->width) && ! preg_match('/^[0-9]+$/', $this->height)) OR ! preg_match('/^[0-9]+$/', $this->orig_width) OR ! preg_match('/^[0-9]+$/', $this->orig_height)) { @@ -1549,7 +1549,7 @@ class CI_Image_lib { // For now we require GD but we should // find a way to determine this using IM or NetPBM - if ($path == '') + if ($path === '') { $path = $this->full_src_path; } @@ -1564,7 +1564,7 @@ class CI_Image_lib { $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); $mime = (isset($types[$vals[2]])) ? 'image/'.$types[$vals[2]] : 'image/jpg'; - if ($return == TRUE) + if ($return === TRUE) { return array( 'width' => $vals[0], @@ -1620,16 +1620,16 @@ class CI_Image_lib { } } - if ($vals['width'] == 0 OR $vals['height'] == 0) + if ($vals['width'] === 0 OR $vals['height'] === 0) { return $vals; } - if ($vals['new_width'] == 0) + if ($vals['new_width'] === 0) { $vals['new_width'] = ceil($vals['width']*$vals['new_height']/$vals['height']); } - elseif ($vals['new_height'] == 0) + elseif ($vals['new_height'] === 0) { $vals['new_height'] = ceil($vals['new_width']*$vals['height']/$vals['width']); } @@ -1715,14 +1715,14 @@ class CI_Image_lib { { foreach ($msg as $val) { - $msg = ($CI->lang->line($val) == FALSE) ? $val : $CI->lang->line($val); + $msg = ($CI->lang->line($val) === FALSE) ? $val : $CI->lang->line($val); $this->error_msg[] = $msg; log_message('error', $msg); } } else { - $msg = ($CI->lang->line($msg) == FALSE) ? $msg : $CI->lang->line($msg); + $msg = ($CI->lang->line($msg) === FALSE) ? $msg : $CI->lang->line($msg); $this->error_msg[] = $msg; log_message('error', $msg); } diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php index dd2df697c..98fec61d3 100644 --- a/system/libraries/Javascript.php +++ b/system/libraries/Javascript.php @@ -615,7 +615,7 @@ class CI_Javascript { { $this->_javascript_location = $external_file; } - elseif ($this->CI->config->item('javascript_location') != '') + elseif ($this->CI->config->item('javascript_location') !== '') { $this->_javascript_location = $this->CI->config->item('javascript_location'); } @@ -667,7 +667,7 @@ class CI_Javascript { protected function _open_script($src = '') { return '