我在服务器上传更新的主题文件夹后面临跟随错误,主题文件夹在本地计算机上正常工作。错误如下:
解析错误:第1行/home1/mudinta/public_html/wp-content/themes/BookYourTravel/includes/theme_filters.php中的语法错误,意外“功能”(T_FUNCTION)
theme_filter.php文件代码如下:
<?php
/**
* Remove password email text if option for users to set their own password is enabled in Theme settings.
*/
function remove_password_email_text ( $text ) {
$let_users_set_pass = of_get_option('let_users_set_pass', 0);
if ($text == 'A password will be e-mailed to you.' && $let_users_set_pass)
$text = '';
return $text;
}
add_filter( 'gettext', 'remove_password_email_text' );
/**
* Function that renders labeled field in the form of
* <div class="container_css_class"><span>$label_text</span> $field_value</div>
*/
function byt_render_labeled_field_value($container_css_class, $label_css_class, $label_text, $field_value, $header_text = '', $paragraph = false) {
if (!empty($field_value) || !empty($label_text)) {
$ret_val = '';
if (!empty($header_text))
$ret_val = sprintf("<h1>%s</h1>", $header_text);
if (!empty($container_css_class))
$ret_val .= sprintf("<div class='%s'>", $container_css_class);
if ($paragraph)
$ret_val .= '<p>';
if (!empty($label_text) || !empty($label_css_class))
$ret_val .= sprintf("<span class='%s'>%s</span>", $label_css_class, $label_text);
if (!empty($field_value))
$ret_val .= $field_value;
if ($paragraph)
$ret_val .= '</p>';
if (!empty($container_css_class))
$ret_val .= '</div>';
$ret_val = apply_filters('byt_render_labeled_field_value', $ret_val, $container_css_class, $label_css_class, $label_text, $field_value, $header_text, $paragraph);
echo $ret_val;
}
}
/**
* Function that renders image tag in the form of
* <img class="image_css_class" id="$image_id" src="$image_src" title="$image_title" alt="$image_alt" />
*/
function byt_render_image($image_css_class, $image_id, $image_src, $image_title, $image_alt, $echo = true) {
if ( !empty( $image_src) ) {
$ret_val = sprintf("<img class='%s' id='%s' src='%s' title='%s' alt='%s' />", $image_css_class, $image_id, $image_src, $image_title, $image_alt);
$ret_val = apply_filters('byt_render_image', $ret_val, $image_css_class, $image_id, $image_src, $image_title, $image_alt);
if ($echo)
echo $ret_val;
else
return $ret_val;
}
return "";
}
/**
* Function that renders list item in the form of
* <li class="item_css_class" id="$item_id">$item_content</li>
*/
function byt_render_list_item($page_post_type, $item_css_class, $item_id, $item_content) {
$ret_val = sprintf("<li class='%s' id='%s'>%s</li>", $item_css_class, $item_id, $item_content);
$ret_val = apply_filters('byt_render_list_item', $ret_val, $page_post_type, $item_css_class, $item_id, $item_content);
echo $ret_val;
}
/**
* Function that renders link button in the form of
* <a href="$href" class="$link_css_class" id="$link_id" title="$text">$text</a>
*/
function byt_render_link_button($href, $link_css_class, $link_id, $text) {
$ret_val = sprintf("<a href='%s' class='%s' ", $href, $link_css_class);
if (!empty($link_id))
$ret_val .= sprintf(" id='%s' ", $link_id);
$ret_val .= sprintf(" title='%s'>%s</a>", $text, $text);
$ret_val = apply_filters('byt_render_link_button', $ret_val, $href, $link_css_class, $link_id, $text);
echo $ret_val;
}
/**
* Function that renders submit button in the form of
* <input type="submit" value="$text" id="$submit_id" name="$submit_id" class="$submit_css_class" />
*/
function byt_render_submit_button($submit_css_class, $submit_id, $text) {
$ret_val = sprintf("<input type='submit' class='%s' id='%s' name='%s' value='%s' />", $submit_css_class, $submit_id, $submit_id, $text);
$ret_val = apply_filters('byt_render_link_button', $ret_val, $submit_css_class, $submit_id, $submit_id, $text);
echo $ret_val;
}
?>
答案 0 :(得分:0)
当我将文件上传到服务器时,它将文件代码转换为单行,如下所示:
<?php/*some comment here*/function xyz...?>
我格式化了这样的代码:
<?php
/*some comment here*/
function xyz...
.
.
.
?>
它对我来说很好。