ID);
return $urlthis;
}
function header_callback($buffer)
{
$htmltag='';
return (preg_replace('@]*?>@si', $htmltag, $buffer));
}
//action to take
function facebook_modify_html(){
//if(is_single()||is_page())
ob_start("header_callback");
}
function facebook_add_like($content){
global $facebook_like_like_width;
global $facebook_like_like_use_recommend;
global $facebook_like_dark_color;
$cnt=$content;
if(is_single()||is_page()){
if($facebook_like_like_use_recommend)$reco=' data-action="recommend"';else $reco='';
if($facebook_like_dark_color)$use_dark=' data-colorscheme="dark"';else $use_dark='';
$cnt.='
';
}
return $cnt;
}
function facebook_comments_number($output, $number){
global $facebook_like_use_fb_comment;
if($facebook_like_use_fb_comment)return '';
else return $output;
//return ' comments';
}
/**
* Generates an excerpt from the content, if needed.
*
* @param int|object $post_or_id can be the post ID, or the actual $post object itself
* @param string $excerpt_more the text that is applied to the end of the excerpt if we algorithically snip it
* @return string the snipped excerpt or the manual excerpt if it exists
*/
function zg_trim_excerpt__($post_or_id, $excerpt_more = ' [...]') {
if ( is_object( $post_or_id ) ) $postObj = $post_or_id;
else $postObj = get_post($post_or_id);
$raw_excerpt = $text = $postObj->post_excerpt;
if ( '' == $text ) {
$text = $postObj->post_content;
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = apply_filters('excerpt_length', 55);
// don't automatically assume we will be using the global "read more" link provided by the theme
// $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
if ( count($words) > $excerpt_length ) {
array_pop($words);
$text = implode(' ', $words);
$text = $text . $excerpt_more;
} else {
$text = implode(' ', $words);
}
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
function facebook_like_add_meta(){
ob_end_flush();
if(is_single()||is_page()):
global $facebook_like_og_image;
global $facebook_like_fb_admins;
global $facebook_like_fb_app_id;
?>
" />
\n";
}elseif(isset($facebook_like_og_image)){
echo "\n";
}
?>
".__('You do not have sufficient permissions to access this page.')."";
die;
}
global $facebook_like_og_image;
global $facebook_like_fb_admins;
global $facebook_like_fb_app_id;
global $facebook_like_like_width;
global $facebook_like_like_use_recommend;
global $facebook_like_dark_color;
global $facebook_like_comment_width;
global $facebook_like_comment_num;
global $facebook_comment_dark_color;
global $facebook_like_use_fb_comment;
if(isset($_POST['fb_og_image'])){
$facebook_like_og_image=$_POST['fb_og_image'];
update_option("facebook_like_og_image", $facebook_like_og_image);
$facebook_like_fb_admins=$_POST['fb_admins'];
update_option("facebook_like_fb_admins", $facebook_like_fb_admins);
$facebook_like_fb_app_id=$_POST['fb_app_id'];
update_option("facebook_like_fb_app_id", $facebook_like_fb_app_id);
$facebook_like_like_width=$_POST['fb_like_width'];
update_option("facebook_like_like_width", $facebook_like_like_width);
if(isset($_POST['use_fb_recommend']))$facebook_like_like_use_recommend=true;
else $facebook_like_like_use_recommend=false;
update_option("facebook_like_like_use_recommend", $facebook_like_like_use_recommend);
$facebook_like_comment_width=$_POST['fb_comment_width'];
update_option("facebook_like_comment_width", $facebook_like_comment_width);
$facebook_like_comment_num=$_POST['fb_comment_num'];
update_option("facebook_like_comment_num", $facebook_like_comment_num);
if(isset($_POST['fb_dark_color']))$facebook_like_dark_color=true;
else $facebook_like_dark_color=false;
update_option("facebook_like_dark_color", $facebook_like_dark_color);
if(isset($_POST['fb_comment_dark_color']))$facebook_comment_dark_color=true;
else $facebook_comment_dark_color=false;
update_option("facebook_comment_dark_color", $facebook_comment_dark_color);
if(isset($_POST['use_fb_comment']))$facebook_like_use_fb_comment=true;
else $facebook_like_use_fb_comment=false;
update_option("facebook_like_use_fb_comment", $facebook_like_use_fb_comment);
}
//facebook_write_opt();
echo "
".__('Options Updated')."
";
die;
}
function facebook_write_opt(){
global $facebook_like_og_image;
global $facebook_like_fb_admins;
global $facebook_like_fb_app_id;
global $facebook_like_like_width;
global $facebook_like_like_use_recommend;
global $facebook_like_dark_color;
global $facebook_like_comment_width;
global $facebook_like_comment_num;
global $facebook_comment_dark_color;
global $facebook_like_use_fb_comment;
$facebook_like_og_image=get_option("facebook_like_og_image");
$facebook_like_fb_admins=get_option("facebook_like_fb_admins");
$facebook_like_fb_app_id=get_option("facebook_like_fb_app_id");
$facebook_like_like_width=get_option("facebook_like_like_width");
$facebook_like_like_use_recommend=get_option("facebook_like_like_use_recommend");
$facebook_like_dark_color=get_option("facebook_like_dark_color");
$facebook_like_comment_width=get_option("facebook_like_comment_width");
$facebook_like_comment_num=get_option("facebook_like_comment_num");
$facebook_comment_dark_color=get_option("facebook_comment_dark_color");
$facebook_like_use_fb_comment=get_option("facebook_like_use_fb_comment");
$action_url = $_SERVER['REQUEST_URI'];
?>