Minor code style adjustments

This commit is contained in:
FrancescoUK
2017-04-17 21:47:22 +01:00
parent 66a4507525
commit 9d01398a4b
17 changed files with 41 additions and 46 deletions

View File

@@ -81,7 +81,7 @@ class Config extends Secure_Controller
$license[$i]['text'] = '';
$file = file_get_contents('license/composer.LICENSES');
$array = json_decode($file, true);
$array = json_decode($file, TRUE);
foreach($array as $key => $val)
{
@@ -133,7 +133,7 @@ class Config extends Secure_Controller
$license[$i]['text'] = '';
$file = file_get_contents('license/bower.LICENSES');
$array = json_decode($file, true);
$array = json_decode($file, TRUE);
foreach($array as $key => $val)
{
@@ -284,7 +284,7 @@ class Config extends Secure_Controller
$number_locale = $this->input->post('number_locale');
$fmt = new \NumberFormatter($number_locale, \NumberFormatter::CURRENCY);
$currency_symbol = empty($this->input->post('currency_symbol')) ? $fmt->getSymbol(\NumberFormatter::CURRENCY_SYMBOL) : $this->input->post('currency_symbol');
if ($this->input->post('thousands_separator') == "false")
if ($this->input->post('thousands_separator') == 'false')
{
$fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
}

View File

@@ -503,7 +503,7 @@ class Items extends Secure_Controller
}
else
{
$exists = false;
$exists = FALSE;
}
echo !$exists ? 'true' : 'false';
}

View File

@@ -489,7 +489,7 @@ class Sales extends Secure_Controller
}
$data['amount_change'] = $data['amount_due'] * -1;
if($this->sale_lib->is_invoice_mode() || $data['invoice_number_enabled'] == true)
if($this->sale_lib->is_invoice_mode() || $data['invoice_number_enabled'] == TRUE)
{
// generate final invoice number (if using the invoice in sales by receipt mode then the invoice number can be manually entered or altered in some way
if($this->sale_lib->is_sale_by_receipt_mode())

View File

@@ -2,18 +2,17 @@
class MY_Lang extends CI_Lang
{
function __construct()
public function __construct()
{
parent::__construct();
}
function switch_to( $idiom )
public function switch_to($idiom)
{
$CI =& get_instance();
if( is_string( $idiom ) )
if(is_string($idiom))
{
$CI->config->set_item( 'language', $idiom );
$CI->config->set_item('language', $idiom);
$loaded = $this->is_loaded;
$this->is_loaded = array();
@@ -32,7 +31,7 @@ class MY_Lang extends CI_Lang
* @access public
* @return mixed false if not found or the language string
*/
function line($line = '', $log_errors = true)
public function line($line = '', $log_errors = TRUE)
{
//get the arguments passed to the function
$args = func_get_args();
@@ -41,28 +40,28 @@ class MY_Lang extends CI_Lang
$c = count($args);
//if one or more arguments, perform the necessary processing
if ($c)
if($c)
{
//first argument should be the actual language line key
//so remove it from the array (pop from front)
$line = array_shift($args);
//check to make sure the key is valid and load the line
if ($line == '')
if($line == '')
{
$line = FALSE;
}
else
{
if (isset($this->language[$line]))
if(isset($this->language[$line]))
{
$line = $this->language[$line];
//if the line exists and more function arguments remain
//perform wildcard replacements
if ($args)
if($args)
{
$i = 1;
foreach ($args as $arg)
foreach($args as $arg)
{
$line = preg_replace('/\%'.$i.'/', $arg, $line);
++$i;
@@ -80,17 +79,16 @@ class MY_Lang extends CI_Lang
else
{
//if no arguments given, no language line available
$line = false;
$line = FALSE;
}
return $line;
}
function line_tbd($line='')
public function line_tbd($line = '')
{
return $line . ' (TBD)';
}
}
?>

View File

@@ -206,9 +206,9 @@ class Barcode_lib
{
$array = array();
if (($handle = opendir($folder)) !== false)
if (($handle = opendir($folder)) !== FALSE)
{
while (($file = readdir($handle)) !== false)
while (($file = readdir($handle)) !== FALSE)
{
if(substr($file, -4, 4) === '.ttf')
{
@@ -230,4 +230,4 @@ class Barcode_lib
}
}
?>
?>

View File

@@ -334,11 +334,11 @@ class Sale_lib
$tax_exclusive_subtotal = 0;
foreach($this->get_cart() as $item)
{
$subtotal = bcadd($subtotal, $this->get_item_total($item['quantity'], $item['price'], $item['discount'], false));
$discounted_subtotal = bcadd($discounted_subtotal, $this->get_item_total($item['quantity'], $item['price'], $item['discount'], true));
$subtotal = bcadd($subtotal, $this->get_item_total($item['quantity'], $item['price'], $item['discount'], FALSE));
$discounted_subtotal = bcadd($discounted_subtotal, $this->get_item_total($item['quantity'], $item['price'], $item['discount'], TRUE));
if($this->CI->config->config['tax_included'])
{
$tax_exclusive_subtotal = bcadd($tax_exclusive_subtotal, $this->get_item_total_tax_exclusive($item['item_id'], $item['quantity'], $item['price'], $item['discount'], true));
$tax_exclusive_subtotal = bcadd($tax_exclusive_subtotal, $this->get_item_total_tax_exclusive($item['item_id'], $item['quantity'], $item['price'], $item['discount'], TRUE));
}
}

View File

@@ -18,7 +18,7 @@ class Token_lib
{
// Transform legacy "$" tokens to their brace token equivalent
if(strpos($tokened_text, '$') !== false)
if(strpos($tokened_text, '$') !== FALSE)
{
$tokened_text = str_replace('$YCO', '{YCO}', $tokened_text);
$tokened_text = str_replace('$CO', '{CO}', $tokened_text);
@@ -27,7 +27,7 @@ class Token_lib
}
// Apply the transformation for the "%" tokens if any are used
if(strpos($tokened_text, '%') !== false)
if(strpos($tokened_text, '%') !== FALSE)
{
$tokened_text = strftime($tokened_text);
}
@@ -37,7 +37,7 @@ class Token_lib
if(empty($token_tree))
{
if(strpos($tokened_text, '%') !== false)
if(strpos($tokened_text, '%') !== FALSE)
{
return strftime($tokened_text);
}
@@ -105,4 +105,4 @@ class Token_lib
}
}
?>
?>

View File

@@ -9,7 +9,6 @@ class Customer_rewards extends CI_Model
return ($this->db->get()->num_rows() >= 1);
}
public function save(&$table_data, $package_id)
{
$name = $$table_data['package_name'];
@@ -67,7 +66,7 @@ class Customer_rewards extends CI_Model
}
/*
Deletes one table
Deletes one reward
*/
public function delete($package_id)
{
@@ -81,4 +80,4 @@ class Customer_rewards extends CI_Model
return $this->db->trans_status();
}
}
?>
?>

View File

@@ -9,7 +9,6 @@ class Dinner_table extends CI_Model
return ($this->db->get()->num_rows() >= 1);
}
public function save(&$table_data, $dinner_table_id)
{
$name = $$table_data['name'];

View File

@@ -2,7 +2,7 @@
class Giftcard extends CI_Model
{
/*
Determines if a given giftcard_id is an giftcard
Determines if a given giftcard_id is a giftcard
*/
public function exists($giftcard_id)
{

View File

@@ -22,6 +22,5 @@ class Rewards extends CI_Model
return $this->db->update('sales_reward_points', $rewards_data);
}
}
?>

View File

@@ -7,7 +7,7 @@
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<link rel="stylesheet" type="text/css" href="<?php echo 'dist/bootswatch/' . (empty($this->config->item('theme')) ? 'flatly' : $this->config->item('theme')) . '/bootstrap.min.css' ?>"/>
<?php if ($this->input->cookie('debug') == "true" || $this->input->get("debug") == "true") : ?>
<?php if ($this->input->cookie('debug') == 'true' || $this->input->get('debug') == 'true') : ?>
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/jquery-ui/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="bower_components/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css" />
@@ -97,8 +97,8 @@
</div>
<div class="navbar-right" style="margin:0">
<?php echo $user_info->first_name . ' ' . $user_info->last_name . ' | ' . ($this->input->get("debug") == "true" ? $this->session->userdata('session_sha1') : ''); ?>
<?php echo anchor("home/logout", $this->lang->line("common_logout")); ?>
<?php echo $user_info->first_name . ' ' . $user_info->last_name . ' | ' . ($this->input->get('debug') == 'true' ? $this->session->userdata('session_sha1') : ''); ?>
<?php echo anchor('home/logout', $this->lang->line('common_logout')); ?>
</div>
<div class="navbar-center" style="text-align:center">

View File

@@ -67,7 +67,7 @@ if (isset($error_message))
</tr>
<?php
foreach(array_reverse($cart, true) as $line=>$item)
foreach(array_reverse($cart, TRUE) as $line=>$item)
{
?>
<tr>

View File

@@ -127,7 +127,7 @@ if (isset($success))
}
else
{
foreach(array_reverse($cart, true) as $line=>$item)
foreach(array_reverse($cart, TRUE) as $line=>$item)
{
?>
<?php echo form_open($controller_name."/edit_item/$line", array('class'=>'form-horizontal', 'id'=>'cart_'.$line)); ?>

View File

@@ -43,7 +43,7 @@
<th style="width:20%;text-align:right;"><?php echo $this->lang->line('sales_total'); ?></th>
</tr>
<?php
foreach(array_reverse($cart, true) as $line=>$item)
foreach(array_reverse($cart, TRUE) as $line=>$item)
{
?>
<tr>
@@ -189,4 +189,4 @@
<img src='data:image/png;base64,<?php echo $barcode; ?>' /><br>
<?php echo $sale_id; ?>
</div>
</div>
</div>

View File

@@ -47,7 +47,7 @@
<th colspan="4" style="width:25%;" class="total-value"><?php echo $this->lang->line('sales_total'); ?></th>
</tr>
<?php
foreach(array_reverse($cart, true) as $line=>$item)
foreach(array_reverse($cart, TRUE) as $line=>$item)
{
?>
<tr>
@@ -182,4 +182,4 @@
<img src='data:image/png;base64,<?php echo $barcode; ?>' /><br>
<?php echo $sale_id; ?>
</div>
</div>
</div>

View File

@@ -130,7 +130,7 @@ if (isset($success))
}
else
{
foreach(array_reverse($cart, true) as $line=>$item)
foreach(array_reverse($cart, TRUE) as $line=>$item)
{
?>
<?php echo form_open($controller_name."/edit_item/$line", array('class'=>'form-horizontal', 'id'=>'cart_'.$line)); ?>
@@ -781,4 +781,4 @@ function check_payment_type()
</script>
<?php $this->load->view("partial/footer"); ?>
<?php $this->load->view("partial/footer"); ?>