Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/facebook...
File: xyz-functions.php
<?php
[0] Fix | Delete
if( !defined('ABSPATH') ){ exit();}
[1] Fix | Delete
[2] Fix | Delete
if(!function_exists('xyz_trim_deep'))
[3] Fix | Delete
{
[4] Fix | Delete
[5] Fix | Delete
function xyz_trim_deep($value) {
[6] Fix | Delete
if ( is_array($value) ) {
[7] Fix | Delete
$value = array_map('xyz_trim_deep', $value);
[8] Fix | Delete
} elseif ( is_object($value) ) {
[9] Fix | Delete
$vars = get_object_vars( $value );
[10] Fix | Delete
foreach ($vars as $key=>$data) {
[11] Fix | Delete
$value->{$key} = xyz_trim_deep( $data );
[12] Fix | Delete
}
[13] Fix | Delete
} else {
[14] Fix | Delete
$value = trim($value);
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
return $value;
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
if(!function_exists('esc_textarea'))
[23] Fix | Delete
{
[24] Fix | Delete
function esc_textarea($text)
[25] Fix | Delete
{
[26] Fix | Delete
$safe_text = htmlspecialchars( $text, ENT_QUOTES );
[27] Fix | Delete
return $safe_text;
[28] Fix | Delete
}
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
if(!function_exists('xyz_fbap_plugin_get_version'))
[32] Fix | Delete
{
[33] Fix | Delete
function xyz_fbap_plugin_get_version()
[34] Fix | Delete
{
[35] Fix | Delete
if ( ! function_exists( 'get_plugins' ) )
[36] Fix | Delete
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
[37] Fix | Delete
$plugin_folder = get_plugins( '/' . plugin_basename( dirname( XYZ_FBAP_PLUGIN_FILE ) ) );
[38] Fix | Delete
// print_r($plugin_folder);
[39] Fix | Delete
return $plugin_folder['facebook-auto-publish.php']['Version'];
[40] Fix | Delete
}
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
[44] Fix | Delete
if(!function_exists('xyz_fbap_links')){
[45] Fix | Delete
function xyz_fbap_links($links, $file) {
[46] Fix | Delete
$base = plugin_basename(XYZ_FBAP_PLUGIN_FILE);
[47] Fix | Delete
if ($file == $base) {
[48] Fix | Delete
[49] Fix | Delete
$links[] = '<a href="http://help.xyzscripts.com/docs/facebook-auto-publish/faq/" title="FAQ">FAQ</a>';
[50] Fix | Delete
$links[] = '<a href="http://help.xyzscripts.com/docs/facebook-auto-publish/" title="Read Me">README</a>';
[51] Fix | Delete
$links[] = '<a href="https://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
[52] Fix | Delete
$links[] = '<a href="https://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on twitter"></a>';
[53] Fix | Delete
$links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Facebook"></a>';
[54] Fix | Delete
// $links[] = '<a href="https://plus.google.com/+Xyzscripts" class="xyz_gplus" title="+1"></a>';
[55] Fix | Delete
$links[] = '<a href="https://www.linkedin.com/company/xyzscripts" class="xyz_linkdin" title="Follow us on linkedIn"></a>';
[56] Fix | Delete
}
[57] Fix | Delete
return $links;
[58] Fix | Delete
}
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
[62] Fix | Delete
if(!function_exists('xyz_fbap_string_limit')){
[63] Fix | Delete
function xyz_fbap_string_limit($string, $limit)
[64] Fix | Delete
{
[65] Fix | Delete
$space=" ";$appendstr=" ...";
[66] Fix | Delete
if (function_exists('mb_strlen') && function_exists('mb_substr') && function_exists('mb_strripos')) {
[67] Fix | Delete
if(mb_strlen($string) <= $limit) return $string;
[68] Fix | Delete
if(mb_strlen($appendstr) >= $limit) return '';
[69] Fix | Delete
$string = mb_substr($string, 0, $limit-mb_strlen($appendstr));
[70] Fix | Delete
$rpos = mb_strripos($string, $space);
[71] Fix | Delete
if ($rpos===false)
[72] Fix | Delete
return $string.$appendstr;
[73] Fix | Delete
else
[74] Fix | Delete
return mb_substr($string, 0, $rpos).$appendstr;
[75] Fix | Delete
} else {
[76] Fix | Delete
if(strlen($string) <= $limit) return $string;
[77] Fix | Delete
if(strlen($appendstr) >= $limit) return '';
[78] Fix | Delete
$string = substr($string, 0, $limit-strlen($appendstr));
[79] Fix | Delete
$rpos = strripos($string, $space);
[80] Fix | Delete
if ($rpos===false)
[81] Fix | Delete
return $string.$appendstr;
[82] Fix | Delete
else
[83] Fix | Delete
return substr($string, 0, $rpos).$appendstr;
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
if(!function_exists('xyz_fbap_getimage')){
[90] Fix | Delete
function xyz_fbap_getimage($post_ID,$description_org)
[91] Fix | Delete
{
[92] Fix | Delete
$attachmenturl="";
[93] Fix | Delete
$post_thumbnail_id = get_post_thumbnail_id( $post_ID );
[94] Fix | Delete
if(!empty($post_thumbnail_id))
[95] Fix | Delete
$attachmenturl=wp_get_attachment_url($post_thumbnail_id);
[96] Fix | Delete
[97] Fix | Delete
else
[98] Fix | Delete
{
[99] Fix | Delete
$matches=array();
[100] Fix | Delete
$img_content = apply_filters('the_content', $description_org);
[101] Fix | Delete
preg_match_all( '/< *img[^>]*src *= *["\']?([^"\']*)/is', $img_content, $matches );
[102] Fix | Delete
if(isset($matches[1][0]))
[103] Fix | Delete
$attachmenturl = $matches[1][0];
[104] Fix | Delete
else
[105] Fix | Delete
$attachmenturl=xyz_fbap_get_post_gallery_images_with_info($description_org,1);
[106] Fix | Delete
[107] Fix | Delete
}
[108] Fix | Delete
return $attachmenturl;
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
if(!function_exists('xyz_fbap_get_post_gallery_images_with_info'))
[114] Fix | Delete
{
[115] Fix | Delete
function xyz_fbap_get_post_gallery_images_with_info($post_content,$single=1)
[116] Fix | Delete
{
[117] Fix | Delete
$ids=$images_id=array();
[118] Fix | Delete
preg_match('/\[gallery.*ids=.(.*).\]/', $post_content, $ids);
[119] Fix | Delete
if (isset($ids[1]))
[120] Fix | Delete
$images_id = explode(",", $ids[1]);
[121] Fix | Delete
$image_gallery_with_info = array();
[122] Fix | Delete
foreach ($images_id as $image_id) {
[123] Fix | Delete
$attachment = get_post($image_id);
[124] Fix | Delete
$img_src=$attachment->guid;
[125] Fix | Delete
if($single==1)
[126] Fix | Delete
return $img_src;
[127] Fix | Delete
else
[128] Fix | Delete
$image_gallery_with_info[]=$img_src;
[129] Fix | Delete
}
[130] Fix | Delete
return $image_gallery_with_info;
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
/* Local time formating */
[136] Fix | Delete
if(!function_exists('xyz_fbap_local_date_time')){
[137] Fix | Delete
function xyz_fbap_local_date_time($format,$timestamp){
[138] Fix | Delete
return date($format, $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ));
[139] Fix | Delete
}
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
add_filter( 'plugin_row_meta','xyz_fbap_links',10,2);
[143] Fix | Delete
[144] Fix | Delete
[145] Fix | Delete
if (!function_exists("xyz_fbap_is_session_started")) {
[146] Fix | Delete
function xyz_fbap_is_session_started()
[147] Fix | Delete
{
[148] Fix | Delete
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
[149] Fix | Delete
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
[150] Fix | Delete
} else {
[151] Fix | Delete
return session_id() === '' ? FALSE : TRUE;
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
return FALSE;
[155] Fix | Delete
}
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
/*if (!function_exists("xyz_wp_fbap_attachment_metas")) {
[159] Fix | Delete
function xyz_wp_fbap_attachment_metas($attachment,$url)
[160] Fix | Delete
{
[161] Fix | Delete
$name='';$description_li='';$content_img='';$utf="UTF-8";
[162] Fix | Delete
$aprv_me_data=wp_remote_get($url,array('sslverify'=> (get_option('xyz_fbap_peer_verification')=='1') ? true : false));
[163] Fix | Delete
if( is_array($aprv_me_data) ) {
[164] Fix | Delete
$aprv_me_data = $aprv_me_data['body']; // use the content
[165] Fix | Delete
}
[166] Fix | Delete
else {
[167] Fix | Delete
$aprv_me_data='';
[168] Fix | Delete
}
[169] Fix | Delete
[170] Fix | Delete
$og_datas = new DOMDocument();
[171] Fix | Delete
@$og_datas->loadHTML('<?xml encoding="UTF-8">'.$aprv_me_data);
[172] Fix | Delete
$xpath = new DOMXPath($og_datas);
[173] Fix | Delete
/* if(isset($attachment['name']))
[174] Fix | Delete
{
[175] Fix | Delete
$ogmetaContentAttributeNodes_tit = $xpath->query("/html/head/meta[@property='og:title']/@content");
[176] Fix | Delete
[177] Fix | Delete
foreach($ogmetaContentAttributeNodes_tit as $ogmetaContentAttributeNode_tit) {
[178] Fix | Delete
$name=$ogmetaContentAttributeNode_tit->nodeValue;
[179] Fix | Delete
[180] Fix | Delete
}
[181] Fix | Delete
if(get_option('xyz_fbap_utf_decode_enable')==1)
[182] Fix | Delete
$name=utf8_decode($name);
[183] Fix | Delete
// if(strcmp(get_option('blog_charset'),$utf)==0)
[184] Fix | Delete
// $content_title=utf8_decode($content_title);
[185] Fix | Delete
if($name!='')
[186] Fix | Delete
$attachment['name']=$name;
[187] Fix | Delete
} */ /*
[188] Fix | Delete
if(isset($attachment['actions']))
[189] Fix | Delete
{
[190] Fix | Delete
if(isset($attachment['actions']['name']))
[191] Fix | Delete
{
[192] Fix | Delete
$ogmetaContentAttributeNodes_tit = $xpath->query("/html/head/meta[@property='og:title']/@content");
[193] Fix | Delete
[194] Fix | Delete
foreach($ogmetaContentAttributeNodes_tit as $ogmetaContentAttributeNode_tit) {
[195] Fix | Delete
$name=$ogmetaContentAttributeNode_tit->nodeValue;
[196] Fix | Delete
[197] Fix | Delete
}
[198] Fix | Delete
if(get_option('xyz_fbap_utf_decode_enable')==1)
[199] Fix | Delete
$name=utf8_decode($name);
[200] Fix | Delete
// if(strcmp(get_option('blog_charset'),$utf)==0)
[201] Fix | Delete
// $content_title=utf8_decode($content_title);
[202] Fix | Delete
if($name!='')
[203] Fix | Delete
$attachment['actions']['name']=$name;
[204] Fix | Delete
}
[205] Fix | Delete
if(isset($attachment['actions']['link']))
[206] Fix | Delete
{
[207] Fix | Delete
$attachment['actions']['link']=$url;
[208] Fix | Delete
}
[209] Fix | Delete
}
[210] Fix | Delete
/* if(isset($attachment['description']))
[211] Fix | Delete
{
[212] Fix | Delete
$ogmetaContentAttributeNodes_desc = $xpath->query("/html/head/meta[@property='og:description']/@content");
[213] Fix | Delete
foreach($ogmetaContentAttributeNodes_desc as $ogmetaContentAttributeNode_desc) {
[214] Fix | Delete
$description_li=$ogmetaContentAttributeNode_desc->nodeValue;
[215] Fix | Delete
}
[216] Fix | Delete
if(get_option('xyz_fbap_utf_decode_enable')==1)
[217] Fix | Delete
$description_li=utf8_decode($description_li);
[218] Fix | Delete
// if(strcmp(get_option('blog_charset'),$utf)==0)
[219] Fix | Delete
// $content_desc=utf8_decode($content_desc);
[220] Fix | Delete
if($description_li!='')
[221] Fix | Delete
$attachment['description']=$description_li;
[222] Fix | Delete
} */
[223] Fix | Delete
/*if(isset($attachment['picture']))
[224] Fix | Delete
{
[225] Fix | Delete
$ogmetaContentAttributeNodes_img = $xpath->query("/html/head/meta[@property='og:image']/@content");
[226] Fix | Delete
foreach($ogmetaContentAttributeNodes_img as $ogmetaContentAttributeNode_img) {
[227] Fix | Delete
$content_img=$ogmetaContentAttributeNode_img->nodeValue;
[228] Fix | Delete
}
[229] Fix | Delete
if($content_img!='')
[230] Fix | Delete
$attachment['picture']=$content_img;
[231] Fix | Delete
}*/
[232] Fix | Delete
/*
[233] Fix | Delete
if(isset($attachment['link']))
[234] Fix | Delete
$attachment['link']=$url;
[235] Fix | Delete
[236] Fix | Delete
return $attachment;
[237] Fix | Delete
}
[238] Fix | Delete
}*/
[239] Fix | Delete
[240] Fix | Delete
[241] Fix | Delete
[242] Fix | Delete
if(!function_exists('xyz_fbap_post_to_smap_api'))
[243] Fix | Delete
{ function xyz_fbap_post_to_smap_api($post_details,$url,$xyzscripts_hash_val='') {
[244] Fix | Delete
if (function_exists('curl_init'))
[245] Fix | Delete
{
[246] Fix | Delete
$post_parameters['post_params'] = serialize($post_details);
[247] Fix | Delete
$post_parameters['request_hash'] = md5($post_parameters['post_params'].$xyzscripts_hash_val);
[248] Fix | Delete
$ch = curl_init();
[249] Fix | Delete
curl_setopt($ch, CURLOPT_URL, $url);
[250] Fix | Delete
curl_setopt($ch, CURLOPT_POST, true);
[251] Fix | Delete
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_parameters);
[252] Fix | Delete
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
[253] Fix | Delete
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER,(get_option('xyz_fbap_peer_verification')=='1') ? true : false);
[254] Fix | Delete
$content = curl_exec($ch);
[255] Fix | Delete
curl_close($ch);
[256] Fix | Delete
if (empty($content))
[257] Fix | Delete
{
[258] Fix | Delete
if ($url==XYZ_SMAP_SOLUTION_PUBLISH_URL.'api/facebook.php')
[259] Fix | Delete
$response=array('status'=>0,'fb_api_count'=>0,'msg'=>'Error:unable to connect');
[260] Fix | Delete
$content=json_encode($response);
[261] Fix | Delete
}
[262] Fix | Delete
return $content;
[263] Fix | Delete
}
[264] Fix | Delete
}
[265] Fix | Delete
}
[266] Fix | Delete
if (!function_exists("xyz_fbap_clear_open_graph_cache")) {
[267] Fix | Delete
function xyz_fbap_clear_open_graph_cache($url,$access_tocken,$appid,$appsecret) {
[268] Fix | Delete
$fbap_sslverify= (get_option('xyz_fbap_peer_verification')=='1') ? true : false;
[269] Fix | Delete
try {
[270] Fix | Delete
$params = array(
[271] Fix | Delete
'id' => $url,
[272] Fix | Delete
'scrape' => 'true',
[273] Fix | Delete
'access_token' => $access_tocken
[274] Fix | Delete
);
[275] Fix | Delete
$xyz_fb_cache_params_enc=json_encode($params);
[276] Fix | Delete
$response=xyz_fbap_scrape_url($xyz_fb_cache_params_enc,$fbap_sslverify);
[277] Fix | Delete
return $response;
[278] Fix | Delete
} catch (Exception $e){
[279] Fix | Delete
return 'Graph returned an error: ' . $e->getMessage();
[280] Fix | Delete
}
[281] Fix | Delete
}
[282] Fix | Delete
}
[283] Fix | Delete
?>
[284] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function