Code Duplication    Length = 31-31 lines in 2 locations

catalog/admin/includes/functions/general.php 1 location

@@ 1187-1217 (lines=31) @@
1184
1185
////
1186
// Output the tax percentage with optional padded decimals
1187
  function tep_display_tax_value($value, $padding = TAX_DECIMAL_PLACES) {
1188
    if (strpos($value, '.')) {
1189
      $loop = true;
1190
      while ($loop) {
1191
        if (substr($value, -1) == '0') {
1192
          $value = substr($value, 0, -1);
1193
        } else {
1194
          $loop = false;
1195
          if (substr($value, -1) == '.') {
1196
            $value = substr($value, 0, -1);
1197
          }
1198
        }
1199
      }
1200
    }
1201
1202
    if ($padding > 0) {
1203
      if ($decimal_pos = strpos($value, '.')) {
1204
        $decimals = strlen(substr($value, ($decimal_pos+1)));
1205
        for ($i=$decimals; $i<$padding; $i++) {
1206
          $value .= '0';
1207
        }
1208
      } else {
1209
        $value .= '.';
1210
        for ($i=0; $i<$padding; $i++) {
1211
          $value .= '0';
1212
        }
1213
      }
1214
    }
1215
1216
    return $value;
1217
  }
1218
1219
  function tep_get_tax_class_title($tax_class_id) {
1220
    if ($tax_class_id == '0') {

catalog/includes/functions/general.php 1 location

@@ 1129-1159 (lines=31) @@
1126
1127
////
1128
// Output the tax percentage with optional padded decimals
1129
  function tep_display_tax_value($value, $padding = TAX_DECIMAL_PLACES) {
1130
    if (strpos($value, '.')) {
1131
      $loop = true;
1132
      while ($loop) {
1133
        if (substr($value, -1) == '0') {
1134
          $value = substr($value, 0, -1);
1135
        } else {
1136
          $loop = false;
1137
          if (substr($value, -1) == '.') {
1138
            $value = substr($value, 0, -1);
1139
          }
1140
        }
1141
      }
1142
    }
1143
1144
    if ($padding > 0) {
1145
      if ($decimal_pos = strpos($value, '.')) {
1146
        $decimals = strlen(substr($value, ($decimal_pos+1)));
1147
        for ($i=$decimals; $i<$padding; $i++) {
1148
          $value .= '0';
1149
        }
1150
      } else {
1151
        $value .= '.';
1152
        for ($i=0; $i<$padding; $i++) {
1153
          $value .= '0';
1154
        }
1155
      }
1156
    }
1157
1158
    return $value;
1159
  }
1160
1161
////
1162
// Checks to see if the currency code exists as a currency