Blog Crashed with Parse error: syntax error
-
Apparently my blog crashed down!
I receive this message when I try to enter:
Parse error: syntax error, unexpected T_FUNCTION in /home/content/18/5019418/html/blog/wp-content/themes/photolab/inc/tools.php on line 28
It happened when I updated photolab theme.
What can I do??
This is the link to my blog: blog.bernardoramirez.net
-
can you access your webhosting file manager or FTP?
do you have a backup of your website database and files?Yes I can, using ftp I can see my files
I can’t enter using ftp or anything, I don’t know what’s happening… please help…
I don’t have any backup
Finally I could enter using ftp, what can I do??
Hi,
can you please paste the code of your following file.
/home/content/18/5019418/html/blog/wp-content/themes/photolab/inc/tools.php
Thanks
<?php
class Tools{
/**
* Join array to string
* @param array $arr — array like ‘key’ => ‘value’
* @return string — joined string
*/
public static function join($arr = array())
{
$arr = self::removeEmpty($arr);
$result = array();
foreach ($arr as $key => $value)
{
$result[] = sprintf(‘%s=”%s”‘, $key, $value);
}
return implode(‘ ‘, $result);
}/**
* Remove empty elements
* @param array $arr — array with empty elements
* @return array — array without empty elements
*/
public static function removeEmpty($arr)
{
return array_filter($arr, function($var) { return $var != ”; });
}/**
* Lave just right keys in array
* @param array $right_keys — right keys array
* @param array $arr — array to sanitize
* @return array — sanitized array
*/
public static function leaveRightKeys($right_keys, $arr)
{
if(count($arr))
{
foreach ($arr as $key => $value)
{
if(!in_array($key, $right_keys)) unset($arr[$key]);
}
}
return $arr;
}/**
* Leave keys from array
* @param array $remove_keys — kyes to remove
* @param array $arr — array from we need remove these keys
* @return array — sanitized array
*/
public static function removeKeys($remove_keys, $arr)
{
if(count($remove_keys))
{
foreach ($remove_keys as $key => $value)
{
if(array_key_exists($value, $arr)) unset($arr[$value]);
}
}
return $arr;
}/**
* Get key or return empty string
* @param string $key — key name
* @param array $arr — array to check key
* @param mixed $default — default value
* @return mixed — key
*/
public static function tryGet($key, $arr, $default = ”)
{
if(array_key_exists($key, $arr)) return $arr[$key];
return $default;
}/**
* Render your view
* @param string $view_name — view name
* @param array $variables — variables to extract in rendering View
* @return string — HTML code
*/
public static function renderView($view_name, $variables = array())
{
extract($variables);
ob_start();
include sprintf(‘views/%s.php’, $view_name);
return ob_get_clean();
}/**
* Render select control
* @param array $values — options for select ctrl
* @param string $attributes — attributes to
* @return string — HTML code
*/
public static function renderSelectControl($values, $attributes = array())
{
$attributes = array_merge(array(‘value’ => ”), $attributes);
return self::renderView(
‘select_control’,
array(
‘attributes’ => $attributes,
‘values’ => $values
)
);
}
}This is the line that says it’s wrong:
return array_filter($arr, function($var) { return $var != ”; });
Hi,
It seems to be a theme file and function. We cannot rectify or modify it on our own as we do not where it is used and what will be its effect after changing it.
As the theme is Photolab I recommend you to open a support ticket on the theme forum so that the theme developer will be able to assist you properly than anybody here can.
https://ww.wp.xz.cn/support/theme/photolab
Thanks
Thank you for your help! I opened the support ticket right now.
Welcome. π
The topic ‘Blog Crashed with Parse error: syntax error’ is closed to new replies.