I just switched servers for a bunch of wordpress hosted websites. On the old server we had php version 5.3, on the new one we got 5.4.33. The problem is that we're getting a lot of errors after this change and some of errors are pretty hard (for me) to solve. Have a look at the code below please :)
These are the errors that I get:
Notice: Undefined variable: icon in /wp-content/themes/livescore/library/functions-single-match.php on line 138
Notice: Undefined variable: image in /wp-content/themes/livescore/library/functions-single-match.php on line 145
Notice: Undefined variable: icon in /wp-content/themes/livescore/library/functions-single-match.php on line 179
Notice: Undefined variable: image in /wp-content/themes/livescore/library/functions-single-match.php on line 184
And this is functions-single-match.php below:
<?php
function lastMatches( $teamName, $directTeam = '' )
{
global $wpdb_mysqli;
$matches = array();
if ($directTeam)
{
$args = array(
'post_type' => 'matches',
'post_status' => 'publish',
'posts_per_page' => 10,
'meta_query' => array(
array(
'key' => '_live_echipa_gazda',
'value' => $directTeam,
'compare' => '='
),
array(
'key' => '_live_echipa_oaspete',
'value' => $teamName,
'compare' => '='
)
)
);
}
else
{
$args = array(
'post_type' => 'matches',
'post_status' => 'publish',
'posts_per_page' => 10,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => '_live_echipa_gazda',
'value' => $teamName,
'compare' => '='
),
array(
'key' => '_live_echipa_oaspete',
'value' => $teamName,
'compare' => '='
),
)
);
}
$query = new WP_Query( $args );
$matches = $query->posts;
return $matches;
}
function matchStatusGazde( $matchID )
{
$statusIstoric = get_post_meta( $matchID, '_live_status_meci_gazde', true );
$result = new stdClass();
switch ($statusIstoric)
{
case 'v':
$icon = 'smileyface1.png';
break;
case 'e':
$icon = 'smileyface3.png';
break;
case 'i':
$icon = 'smileyface2.png';
default:
break;
}
if ($icon)
{
$pathImg = get_stylesheet_directory_uri() . "/library/images/$icon";
$image = "<img src='$pathImg' border='0'/>";
}
$result->image = $image;
return $result;
}
function matchStatusOaspeti( $matchID )
{
$statusIstoric = get_post_meta( $matchID, '_live_status_meci_oaspeti', true );
$result = new stdClass();
switch ($statusIstoric)
{
case 'v':
$icon = 'smileyface1.png';
break;
case 'e':
$icon = 'smileyface3.png';
break;
case 'i':
$icon = 'smileyface2.png';
default:
break;
}
if ($icon)
{
$pathImg = get_stylesheet_directory_uri() . "/library/images/$icon";
$image = "<img src='$pathImg' border='0'/>";
}
$result->image = $image;
return $result;
}