第15行的C:\ xampp \ htdocs \ FB_com.php中的解析错误:语法错误,意外','

时间:2018-03-23 14:43:39

标签: php

任何人都知道如何解决这个问题。

<?php

//ADD XFBML

add_filter('language_attributes', 'fbcomments_schema');

function fbcomments_schema($attr) {

$options = get_option('fbcomments');

if (!isset($options)) {$options = "";}

if (!isset($options)) {$options = "";}

if ($options == 'on') {$attr .= "n xmlns:og=","http://ogp.me/ns#";}

if ($options == 'on') {$attr .= "n xmlns:fb="http://ogp.me/ns/fb#"";}

return $attr;

}

//ADD OPEN GRAPH META

function fbgraphinfo() {

$options = get_option('fbcomments'); ?>

<meta property="fb:app_id" content="<?php echo $options; ?>"/>

<meta property="fb:admins" content="<?php echo $options; ?>"/>

<?php

}

add_action('wp_head', 'fbgraphinfo');

function fbmlsetup() {

$options = get_option('fbcomments');

if (!isset($options)) {$options = "";}

if ($options == 'on') {

?>

<!-- Facebook Comments for WordPress: http://3doordigital.com/wordpress/plugins/facebook-comments/ -->

<div id="fb-root"></div>

<script>(function(d, s, id) {

var js, fjs = d.getElementsByTagName(s)[0];

if (d.getElementById(id)) return;

js = d.createElement(s); js.id = id;

js.src = "//connect.facebook.net/<?php echo $options; ?>/all.js#xfbml=1&appId=<?php echo $options; ?>";

fjs.parentNode.insertBefore(js, fjs);

}(document, 'script', 'facebook-jssdk'));</script>

<?php }}

add_action('wp_footer', 'fbmlsetup', 100);

//COMMENT BOX

function fbcommentbox($content) {

$options = get_option('fbcomments');

if (!isset($options)) {$options = "off";}

if (!isset($options)) {$options = "off";}

if (!isset($options)) {$options = "off";}

if (!isset($options)) {$options = "off";}

if (!isset($options)) {$options = "off";}

if (!isset($options)) {$options = "off";}

if (

(is_single() && $options == 'on') ||

(is_page() && $options == 'on') ||

((is_home() || is_front_page()) && $options == 'on')) {

if ($options == 'on') {

if ($options == '') {

$commentcount = "<p>";

} else {

$commentcount = "<p class="".$options."">";

}

$commentcount .= "<fb:comments-count href=".get_permalink()."></fb:comments-count> ".$options."</p>";

}

if ($options != '') {

if ($options == '') {

$commenttitle = "<h3>";

} else {

$commenttitle = "<h3 class="".$options."">";

}

$commenttitle .= $options."</h3>";

}

$content .= "<!-- Facebook Comments for WordPress: http://3doordigital.com/wordpress/plugins/facebook-comments/ -->".$commenttitle.$commentcount;

if ($options == 'on') {

$content .= "<div class="fb-comments" data-href="".get_permalink()."" data-num-posts="".$options."" data-width="".$options."" data-colorscheme="".$options.""></div>";

} else {

$content .= "<fb:comments href="".get_permalink()."" num_posts="".$options."" width="".$options."" colorscheme="".$options.""></fb:comments>";

}

if ($options != 'no') {

if ($options != 'off') {

if (empty($fbcomments[linklove])) {

$content .= '<p>Powered by Facebook Comments</p>';

}}}

}

return $content;

}

add_filter ('the_content', 'fbcommentbox', 100);

function fbcommentshortcode($fbatts) {

extract(shortcode_atts(array(

"fbcomments" => get_option('fbcomments'),

"url" => get_permalink(),

), $fbatts));

if (!empty($fbatts)) {

foreach ($fbatts as $key => $option)

$fbcomments[$key] = $option;

}

if ($fbcomments[count] == 'on') {

if ($fbcomments[countstyle] == '') {

$commentcount = "<p>";

} else {

$commentcount = "<p class="".$fbcomments[countstyle]."">";

}

$commentcount .= "<fb:comments-count href=".$url."></fb:comments-count> ".$fbcomments[countmsg]."</p>";

}

if ($fbcomments[title] != '') {

if ($fbcomments[titleclass] == '') {

$commenttitle = "<h3>";

} else {

$commenttitle = "<h3 class="".$fbcomments[titleclass]."">";

}

$commenttitle .= $fbcomments[title]."</h3>";

}

$fbcommentbox = "<!-- Facebook Comments for WordPress: http://3doordigital.com/wordpress/plugins/facebook-comments/ -->".$commenttitle.$commentcount;

if ($fbcomments[html5] == 'on') {

$fbcommentbox .=    "<div class="fb-comments" data-href="".$url."" data-num-posts="".$fbcomments[num]."" data-width="".$fbcomments[width]."" data-colorscheme="".$fbcomments[scheme].""></div>";

} else {

$fbcommentbox .= "<fb:comments href="".$url."" num_posts="".$fbcomments[num]."" width="".$fbcomments[width]."" colorscheme="".$fbcomments[scheme].""></fb:comments>";

}

if (!empty($fbcomments[linklove])) {

$fbcommentbox .= '<p>Powered by Facebook Comments</p>';

}

return $fbcommentbox;

}

add_filter('widget_text', 'do_shortcode');

add_shortcode('fbcomments', 'fbcommentshortcode');

?>

1 个答案:

答案 0 :(得分:1)

你的字符串使用引号,但在字符串中有引号!如果是这种情况,您需要使用单引号。

更改

const map = { xxx: 'prop1', abc: 'prop2', yyy: 'prop3' };
const myArray = [{id: "1", type: "xxx"}, {id: "2", type: "abc"}, {id: "3", type: "xxx"}, {id: "4", type: "yyy"}];

const out = myArray.map(obj => {
  return { ...obj, newProp: map[obj.type] };
});

console.log(out)

if ($options == 'on') {$attr .= "n xmlns:fb="http://ogp.me/ns/fb#"";}

另一种方法是使用反斜杠转义引号:

if ($options == 'on') {$attr .= 'n xmlns:fb="http://ogp.me/ns/fb#"';}