Code Duplication    Length = 31-31 lines in 2 locations

catalog/includes/functions/general.php 1 location

@@ 1181-1211 (lines=31) @@
1178
1179
////
1180
// Output the tax percentage with optional padded decimals
1181
  function tep_display_tax_value($value, $padding = TAX_DECIMAL_PLACES) {
1182
    if (strpos($value, '.')) {
1183
      $loop = true;
1184
      while ($loop) {
1185
        if (substr($value, -1) == '0') {
1186
          $value = substr($value, 0, -1);
1187
        } else {
1188
          $loop = false;
1189
          if (substr($value, -1) == '.') {
1190
            $value = substr($value, 0, -1);
1191
          }
1192
        }
1193
      }
1194
    }
1195
1196
    if ($padding > 0) {
1197
      if ($decimal_pos = strpos($value, '.')) {
1198
        $decimals = strlen(substr($value, ($decimal_pos+1)));
1199
        for ($i=$decimals; $i<$padding; $i++) {
1200
          $value .= '0';
1201
        }
1202
      } else {
1203
        $value .= '.';
1204
        for ($i=0; $i<$padding; $i++) {
1205
          $value .= '0';
1206
        }
1207
      }
1208
    }
1209
1210
    return $value;
1211
  }
1212
1213
////
1214
// Checks to see if the currency code exists as a currency

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

@@ 1142-1172 (lines=31) @@
1139
1140
////
1141
// Output the tax percentage with optional padded decimals
1142
  function tep_display_tax_value($value, $padding = TAX_DECIMAL_PLACES) {
1143
    if (strpos($value, '.')) {
1144
      $loop = true;
1145
      while ($loop) {
1146
        if (substr($value, -1) == '0') {
1147
          $value = substr($value, 0, -1);
1148
        } else {
1149
          $loop = false;
1150
          if (substr($value, -1) == '.') {
1151
            $value = substr($value, 0, -1);
1152
          }
1153
        }
1154
      }
1155
    }
1156
1157
    if ($padding > 0) {
1158
      if ($decimal_pos = strpos($value, '.')) {
1159
        $decimals = strlen(substr($value, ($decimal_pos+1)));
1160
        for ($i=$decimals; $i<$padding; $i++) {
1161
          $value .= '0';
1162
        }
1163
      } else {
1164
        $value .= '.';
1165
        for ($i=0; $i<$padding; $i++) {
1166
          $value .= '0';
1167
        }
1168
      }
1169
    }
1170
1171
    return $value;
1172
  }
1173
1174
  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
1175
    if (SEND_EMAILS != 'true') return false;