Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook 共享按钮:在FB上发布错误的元数据_Facebook_Button_Share_Meta - Fatal编程技术网

Facebook 共享按钮:在FB上发布错误的元数据

Facebook 共享按钮:在FB上发布错误的元数据,facebook,button,share,meta,Facebook,Button,Share,Meta,问题:当有人使用“我的博客”中的“共享”按钮时,它会以以下方式在其页面上发布: 西雅图的[共享者姓名]通过[错误姓名]共享了一个链接 “via”后面的名字是一个家伙的名字,他六个月前曾是博客的开发者。在我的博客上的任何地方,或者在我能找到的任何代码中,都没有他的名字 什么值决定了显示在那里的名称?推荐人?描述我找不到答案,也找不到编辑它们的地方 通过插件社交共享工具包()在我的Wordpress博客上使用Facebook共享按钮已经一周多了 以下是该插件的代码(注意:它包括“喜欢”和“跟随”按钮

问题:当有人使用“我的博客”中的“共享”按钮时,它会以以下方式在其页面上发布:

西雅图的[共享者姓名]通过[错误姓名]共享了一个链接

“via”后面的名字是一个家伙的名字,他六个月前曾是博客的开发者。在我的博客上的任何地方,或者在我能找到的任何代码中,都没有他的名字

什么值决定了显示在那里的名称?推荐人?描述我找不到答案,也找不到编辑它们的地方

通过插件社交共享工具包()在我的Wordpress博客上使用Facebook共享按钮已经一周多了

以下是该插件的代码(注意:它包括“喜欢”和“跟随”按钮的选项):


在用户部分查找他,看看他的权限是什么。我会删除他的帐户,然后把你的URL放到Facebook调试器中,重新扫描你的网站。看看会发生什么

是的,我昨天删除了他的账户。它是否需要时间才能显示?这是我从调试器得到的:推断属性:应该显式提供'og:url'属性,即使可以从其他标记推断出值。推断属性:应明确提供“og:title”属性,即使可以从其他标记推断值。推断属性:应明确提供“og:description”属性,即使可以从其他标记推断值。推断属性:即使可以从其他标记推断出值,也应显式提供“og:image”属性。如何提供这些。。。?
<?php
class MR_Social_Sharing_Toolkit_Facebook extends MR_Social_Sharing_Toolkit_Button {
function __construct() {
    $this->share_buttons[] = array('name' => 'fb_like', 'title' => 'Facebook Like', 'types' => array('none', 'none_text', 'horizontal', 'vertical'));
    $this->share_buttons[] = array('name' => 'fb_share', 'title' => 'Facebook Share', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
    $this->share_buttons[] = array('name' => 'fb_send', 'title' => 'Facebook Send', 'types' => array('none'));
    $this->follow_buttons[] = array('name' => 'follow_facebook', 'title' => 'Facebook', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
    $this->title = 'Facebook';
    $this->icon = 'facebook';
}

function fb_like($url, $title, $type, $id, $media = '', $description = '', $text = '', $icon = '') {
    //$retval = '<iframe src="https://www.facebook.com/plugins/like.php?locale='.__('en_US','mr_social_sharing_toolkit').'&amp;href='.urlencode($url).'&amp;layout=';
    $retval = '<div class="fb-like" data-href="'.$url.'" data-send="false" ';
    switch ($type) {
        case 'horizontal':
            //$retval .= 'button_count';
            if ($id == 'recommend') {
                $width = __('fb_horizontal_recommend_width','mr_social_sharing_toolkit');
                $width = ($width == 'fb_horizontal_recommend_width') ? '120' : $width;
                $retval .= 'data-layout="button_count" data-width="'.$width.'" data-action="recommend"';                    
            } else {
                $width = __('fb_horizontal_width','mr_social_sharing_toolkit');
                $width = ($width == 'fb_horizontal_width') ? '90' : $width;
                $retval .= 'data-layout="button_count" data-width="'.$width.'"';                    
            }
            $height = '21';             
            break;
        case 'vertical':
            //$retval .= 'box_count';
            if ($id == 'recommend') {
                $width = __('fb_vertical_recommend_width','mr_social_sharing_toolkit');
                $width = ($width == 'fb_vertical_recommend_width') ? '92' : $width;
                $retval .= 'data-layout="box_count" data-width="'.$width.'" data-action="recommend"';                   
            } else {
                $width = __('fb_vertical_width','mr_social_sharing_toolkit');
                $width = ($width == 'fb_vertical_width') ? '55' : $width;
                $retval .= 'data-layout="box_count" data-width="'.$width.'"';                   
            }
            $height = '62';
            break;
        case 'none_text':
            //$retval .= 'standard';
            if ($id == 'recommend') {
                $width = 'auto';
                $retval .= 'data-width="'.$width.'" data-action="recommend"';                   
            } else {
                $width = 'auto';
                $retval .= 'data-width="'.$width.'"';                   
            }
            $height = '25';
            break;
        default:
            //$retval .= 'standard';
            if ($id == 'recommend') {
                $width = __('fb_standard_recommend_width','mr_social_sharing_toolkit');
                $width = ($width == 'fb_standard_standard_recommend_width') ? '91' : $width;
                $retval .= 'data-width="'.$width.'" data-action="recommend"';                   
            } else {
                $width = __('fb_standard_width','mr_social_sharing_toolkit');
                $width = ($width == 'fb_standard_width') ? '51' : $width;
                $retval .= 'data-width="'.$width.'"';                   
            }
            $height = '24';
            break;
    }
    //$retval .= '&amp;show_faces=false&amp;width='.$width.'&amp;height='.$height.'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'.$width.'px; height:'.$height.'px;" allowTransparency="true"></iframe>';*/
    $retval .= ' data-show-faces="false"></div>';
    $lang = __('en_US','mr_social_sharing_toolkit');
    $footer = (get_option('mr_social_sharing_js_footer') == 1) ? true : false;
    $this->enqueue_script('Social_sharing_facebook_root', plugins_url('/button.facebook.js', __FILE__), $footer);
    $this->enqueue_script('Social_sharing_facebook_xfbml', 'http://connect.facebook.net/'.$lang.'/all.js#xfbml=1', $footer);
    return '<span style="display: inline-block; width: '.$width.'px; height: '.$height.'px; overflow: hidden;">'.$retval.'</span>';
}

function fb_share($url, $title, $type, $id, $media = '', $description = '', $text = '', $icon = '') {   
    switch ($type) {
        case 'vertical':
            $retval = '<fb:share-button type="box_count" href="'.$url.'"></fb:share-button>';
            //$retval = '<a name="fb_share" type="box_count" share_url="'.$url.'" href="http://www.facebook.com/sharer.php">Share</a>';
            $this->enqueue_script('Social_sharing_facebook_root', plugins_url('/button.facebook.js', __FILE__));
            $footer = (get_option('mr_social_sharing_js_footer') == 1) ? true : false;
            $this->enqueue_script('Social_sharing_facebook_xfbml', 'http://connect.facebook.net/en_US/all.js#xfbml=1', $footer);
            //$this->enqueue_script('Social_sharing_facebook_share', 'http://static.ak.fbcdn.net/connect.php/js/FB.Share', $footer);
            break;
        case 'horizontal':
            $retval = '<fb:share-button type="button_count" href="'.$url.'"></fb:share-button>';
            //$retval = '<a name="fb_share" type="button_count" share_url="'.$url.'" href="http://www.facebook.com/sharer.php">Share</a>';
            $this->enqueue_script('Social_sharing_facebook_root', plugins_url('/button.facebook.js', __FILE__));
            $footer = (get_option('mr_social_sharing_js_footer') == 1) ? true : false;
            $this->enqueue_script('Social_sharing_facebook_xfbml', 'http://connect.facebook.net/en_US/all.js#xfbml=1', $footer);
            //$this->enqueue_script('Social_sharing_facebook_share', 'http://static.ak.fbcdn.net/connect.php/js/FB.Share', $footer);
            break;
        case 'none':
            $retval = '<fb:share-button type="button" href="'.$url.'"></fb:share-button>';
            //$retval = '<a name="fb_share" type="button" share_url="'.$url.'" href="http://www.facebook.com/sharer.php">Share</a>';
            $this->enqueue_script('Social_sharing_facebook_root', plugins_url('/button.facebook.js', __FILE__));
            $footer = (get_option('mr_social_sharing_js_footer') == 1) ? true : false;
            $this->enqueue_script('Social_sharing_facebook_xfbml', 'http://connect.facebook.net/en_US/all.js#xfbml=1', $footer);
            //$this->enqueue_script('Social_sharing_facebook_share', 'http://static.ak.fbcdn.net/connect.php/js/FB.Share', $footer);
            break;
        default:
            $url = 'https://www.facebook.com/sharer/sharer.php?u='.urlencode($url).'&amp;t='.urlencode($title);
            $text = ($text == '') ? __('Share on','mr_social_sharing_toolkit').' Facebook' : $text;
            $retval = $this->get_icon($type, $url, $text, $icon, true);
            break;
    }
    return $retval;
}

function fb_send($url, $title, $type, $id, $media = '', $description = '', $text = '', $icon = '') {
    //$retval = '<div id="fb-root"></div><fb:send href="'.$url.'" font=""></fb:send>';
    $retval = '<div class="fb-send" data-href="'.$url.'"></div>';
    $lang = __('en_US','mr_social_sharing_toolkit');
    $this->enqueue_script('Social_sharing_facebook_root', plugins_url('/button.facebook.js', __FILE__));
    $footer = (get_option('mr_social_sharing_js_footer') == 1) ? true : false;
    $this->enqueue_script('Social_sharing_facebook_xfbml', 'http://connect.facebook.net/'.$lang.'/all.js#xfbml=1', $footer);
    return $retval;         
}   

function follow_facebook($type, $id, $text = '', $icon = '') {
    $url = 'http://www.facebook.com/'.$id;
    $text = ($text == '') ? __('Friend me on','mr_social_sharing_toolkit').' Facebook' : $text;
    $blank = (get_option('mr_social_sharing_follow_new') == 1) ? true : false;
    return $this->get_icon($type, $url, $text, $icon, false, $blank);
}