Skip to content

Commit

Permalink
Replace split function with preg_split and explode functions for OSC-999
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Evans authored and haraldpdl committed Sep 10, 2009
1 parent 88d550f commit 1bfed2f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions catalog/admin/includes/classes/phplot.php
Expand Up @@ -675,7 +675,7 @@ function DrawText($which_font,$which_angle,$which_xpos,$which_ypos,$which_color,
$which_ypos = $which_ypos - ImageFontHeight($which_font);
}
$which_text = preg_replace("/\r/","",$which_text);
$str = split("\n",$which_text); //multiple lines submitted by Remi Ricard
$str = explode("\n",$which_text); //multiple lines submitted by Remi Ricard
$height = ImageFontHeight($which_font);
$width = ImageFontWidth($which_font);
if ($which_angle == 90) { //Vertical Code Submitted by Marlin Viss
Expand Down Expand Up @@ -936,7 +936,7 @@ function SetMargins() {
// It thus depends on the current character size, set by SetCharacterHeight().
/////////////////////////////////////////////////////////////////

$str = split("\n",$this->title_txt);
$str = explode("\n",$this->title_txt);
$nbLines = count($str);

if ($this->use_ttf == 1) {
Expand Down
2 changes: 1 addition & 1 deletion catalog/includes/classes/http_client.php
Expand Up @@ -386,7 +386,7 @@ function processHeader($lastLine = "\r\n") {
$str = fgets($this->socket, 1024);
$finished = ($str == $lastLine);
if (!$finished) {
list($hdr, $value) = split(': ', $str, 2);
list($hdr, $value) = explode(': ', $str, 2);
// nasty workaround broken multiple same headers (eg. Set-Cookie headers) @FIXME
if (isset($headers[$hdr])) {
$headers[$hdr] .= '; ' . trim($value);
Expand Down
6 changes: 3 additions & 3 deletions catalog/includes/functions/general.php
Expand Up @@ -594,7 +594,7 @@ function tep_parse_search_string($search_str = '', &$objects) {
$search_str = trim(strtolower($search_str));

// Break up $search_str on whitespace; quoted string will be reconstructed later
$pieces = split('[[:space:]]+', $search_str);
$pieces = preg_split('/[[:space:]]+/', $search_str);
$objects = array();
$tmpstring = '';
$flag = '';
Expand Down Expand Up @@ -1043,7 +1043,7 @@ function tep_has_product_attributes($products_id) {
////
// Get the number of times a word/character is present in a string
function tep_word_count($string, $needle) {
$temp_array = split($needle, $string);
$temp_array = preg_split('/' . $needle . '/', $string);

return sizeof($temp_array);
}
Expand All @@ -1053,7 +1053,7 @@ function tep_count_modules($modules = '') {

if (empty($modules)) return $count;

$modules_array = split(';', $modules);
$modules_array = explode(';', $modules);

for ($i=0, $n=sizeof($modules_array); $i<$n; $i++) {
$class = substr($modules_array[$i], 0, strrpos($modules_array[$i], '.'));
Expand Down
2 changes: 1 addition & 1 deletion catalog/includes/modules/payment/sage_pay_direct.php
Expand Up @@ -340,7 +340,7 @@ function before_process() {
$transaction_response = $this->sendTransactionToGateway($gateway_url, $post_string);
}

$string_array = split(chr(10), $transaction_response);
$string_array = explode(chr(10), $transaction_response);
$return = array();

foreach ($string_array as $string) {
Expand Down
4 changes: 2 additions & 2 deletions catalog/includes/modules/payment/sage_pay_form.php
Expand Up @@ -205,7 +205,7 @@ function before_process() {
if (isset($HTTP_GET_VARS['crypt']) && tep_not_null($HTTP_GET_VARS['crypt'])) {
$transaction_response = $this->simpleXor($this->base64Decode($HTTP_GET_VARS['crypt']), MODULE_PAYMENT_SAGE_PAY_FORM_ENCRYPTION_PASSWORD);

$string_array = split('&', $transaction_response);
$string_array = explode('&', $transaction_response);
$return = array('Status' => null);

foreach ($string_array as $string) {
Expand Down Expand Up @@ -243,7 +243,7 @@ function get_error() {
} elseif (isset($HTTP_GET_VARS['crypt']) && tep_not_null($HTTP_GET_VARS['crypt'])) {
$transaction_response = $this->simpleXor($this->base64Decode($HTTP_GET_VARS['crypt']), MODULE_PAYMENT_SAGE_PAY_FORM_ENCRYPTION_PASSWORD);

$string_array = split('&', $transaction_response);
$string_array = explode('&', $transaction_response);
$return = array('Status' => null);

foreach ($string_array as $string) {
Expand Down
2 changes: 1 addition & 1 deletion catalog/includes/modules/payment/sage_pay_server.php
Expand Up @@ -263,7 +263,7 @@ function before_process() {

$transaction_response = $this->sendTransactionToGateway($gateway_url, $post_string);

$string_array = split(chr(10), $transaction_response);
$string_array = explode(chr(10), $transaction_response);
$return = array();

foreach ($string_array as $string) {
Expand Down
2 changes: 1 addition & 1 deletion catalog/includes/modules/shipping/table.php
Expand Up @@ -54,7 +54,7 @@ function quote($method = '') {
$order_total = $shipping_weight;
}

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);
$table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
$size = sizeof($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $table_cost[$i]) {
Expand Down
4 changes: 2 additions & 2 deletions catalog/includes/modules/shipping/zones.php
Expand Up @@ -121,7 +121,7 @@ function quote($method = '') {

for ($i=1; $i<=$this->num_zones; $i++) {
$countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
$country_zones = split("[,]", $countries_table);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
Expand All @@ -134,7 +134,7 @@ function quote($method = '') {
$shipping = -1;
$zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);

$zones_table = split("[:,]" , $zones_cost);
$zones_table = preg_split("/[:,]/" , $zones_cost);
$size = sizeof($zones_table);
for ($i=0; $i<$size; $i+=2) {
if ($shipping_weight <= $zones_table[$i]) {
Expand Down

0 comments on commit 1bfed2f

Please sign in to comment.