Version Description
= Facebook Auto Publish 1.0.1 = If you had issues with default image used for auto publishing, you may apply this upgrade.
= Facebook Auto Publish 1.0 = First official launch.
Download this release
Release Info
Developer | f1logic |
Plugin | WP Facebook Auto Publish |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.4 to 1.3
- admin/authorization.php +19 -4
- admin/destruction.php +3 -1
- admin/footer.php +1 -1
- admin/install.php +3 -3
- admin/logs.php +11 -3
- admin/publish.php +76 -16
- admin/settings.php +38 -23
- facebook-auto-publish.php +1 -1
- readme.txt +12 -4
- xyz-functions.php +98 -0
admin/authorization.php
CHANGED
@@ -6,7 +6,13 @@ $lnredirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=3')
|
|
6 |
|
7 |
$my_url=urlencode($redirecturl);
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
$code="";
|
11 |
if(isset($_REQUEST['code']))
|
12 |
$code = $_REQUEST["code"];
|
@@ -33,17 +39,20 @@ if(isset($_COOKIE['xyz_fbap_session_state']) && isset($_REQUEST['state']) && ($_
|
|
33 |
|
34 |
$params = null;$access_token="";
|
35 |
$response = wp_remote_get($token_url);
|
36 |
-
|
37 |
if(is_array($response))
|
38 |
{
|
39 |
if(isset($response['body']))
|
40 |
{
|
|
|
41 |
parse_str($response['body'], $params);
|
42 |
-
|
43 |
$access_token = $params['access_token'];
|
|
|
44 |
}
|
45 |
}
|
46 |
|
|
|
47 |
if($access_token!="")
|
48 |
{
|
49 |
|
@@ -52,7 +61,7 @@ if(isset($_COOKIE['xyz_fbap_session_state']) && isset($_REQUEST['state']) && ($_
|
|
52 |
update_option('xyz_fbap_af',0);
|
53 |
|
54 |
$offset=0;$limit=100;$data=array();
|
55 |
-
|
56 |
do
|
57 |
{
|
58 |
$result1="";$pagearray1="";
|
@@ -99,8 +108,14 @@ if(isset($_COOKIE['xyz_fbap_session_state']) && isset($_REQUEST['state']) && ($_
|
|
99 |
}
|
100 |
$newpgs=rtrim($newpgs,",");
|
101 |
if($profile_flg==1)
|
|
|
|
|
102 |
$newpgs=$newpgs.",-1";
|
|
|
|
|
|
|
103 |
update_option('xyz_fbap_pages_ids',$newpgs);
|
|
|
104 |
}
|
105 |
else
|
106 |
{
|
6 |
|
7 |
$my_url=urlencode($redirecturl);
|
8 |
|
9 |
+
|
10 |
+
|
11 |
+
if ( xyz_fbap_is_session_started() === FALSE ) session_start();
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
$code="";
|
17 |
if(isset($_REQUEST['code']))
|
18 |
$code = $_REQUEST["code"];
|
39 |
|
40 |
$params = null;$access_token="";
|
41 |
$response = wp_remote_get($token_url);
|
42 |
+
|
43 |
if(is_array($response))
|
44 |
{
|
45 |
if(isset($response['body']))
|
46 |
{
|
47 |
+
|
48 |
parse_str($response['body'], $params);
|
49 |
+
if(isset($params['access_token']))
|
50 |
$access_token = $params['access_token'];
|
51 |
+
|
52 |
}
|
53 |
}
|
54 |
|
55 |
+
|
56 |
if($access_token!="")
|
57 |
{
|
58 |
|
61 |
update_option('xyz_fbap_af',0);
|
62 |
|
63 |
$offset=0;$limit=100;$data=array();
|
64 |
+
//$fbid=get_option('xyz_fbap_fb_id');
|
65 |
do
|
66 |
{
|
67 |
$result1="";$pagearray1="";
|
108 |
}
|
109 |
$newpgs=rtrim($newpgs,",");
|
110 |
if($profile_flg==1)
|
111 |
+
{
|
112 |
+
if($newpgs!="")
|
113 |
$newpgs=$newpgs.",-1";
|
114 |
+
else
|
115 |
+
$newpgs=-1;
|
116 |
+
}
|
117 |
update_option('xyz_fbap_pages_ids',$newpgs);
|
118 |
+
header("Location:".admin_url('admin.php?page=facebook-auto-publish-settings&auth=1'));
|
119 |
}
|
120 |
else
|
121 |
{
|
admin/destruction.php
CHANGED
@@ -31,7 +31,7 @@ function fbap_free_destroy()
|
|
31 |
|
32 |
delete_option('xyz_fbap_application_id');
|
33 |
delete_option('xyz_fbap_application_secret');
|
34 |
-
delete_option('xyz_fbap_fb_id');
|
35 |
delete_option('xyz_fbap_message');
|
36 |
delete_option('xyz_fbap_po_method');
|
37 |
delete_option('xyz_fbap_post_permission');
|
@@ -51,6 +51,8 @@ function fbap_free_destroy()
|
|
51 |
delete_option('xyz_fbap_post_logs');
|
52 |
delete_option('xyz_twap_premium_version_ads');
|
53 |
delete_option('xyz_fbap_default_selection_edit');
|
|
|
|
|
54 |
}
|
55 |
|
56 |
register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
|
31 |
|
32 |
delete_option('xyz_fbap_application_id');
|
33 |
delete_option('xyz_fbap_application_secret');
|
34 |
+
//delete_option('xyz_fbap_fb_id');
|
35 |
delete_option('xyz_fbap_message');
|
36 |
delete_option('xyz_fbap_po_method');
|
37 |
delete_option('xyz_fbap_post_permission');
|
51 |
delete_option('xyz_fbap_post_logs');
|
52 |
delete_option('xyz_twap_premium_version_ads');
|
53 |
delete_option('xyz_fbap_default_selection_edit');
|
54 |
+
delete_option('xyz_fbap_utf_decode_enable');
|
55 |
+
|
56 |
}
|
57 |
|
58 |
register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
|
admin/footer.php
CHANGED
@@ -102,7 +102,7 @@ function verify_fields()
|
|
102 |
|
103 |
}
|
104 |
</script>
|
105 |
-
<?php global $current_user;
|
106 |
<form action=http://xyzscripts.com/newsletter/index.php?page=list/subscribe method="post" name="email_subscription" id="email_subscription" >
|
107 |
<input type="hidden" name="fieldNameIds" value="1,">
|
108 |
<input type="hidden" name="redirActive" value="http://xyzscripts.com/subscription/pending/XYZWPSMPPRE">
|
102 |
|
103 |
}
|
104 |
</script>
|
105 |
+
<?php global $current_user; wp_get_current_user(); ?>
|
106 |
<form action=http://xyzscripts.com/newsletter/index.php?page=list/subscribe method="post" name="email_subscription" id="email_subscription" >
|
107 |
<input type="hidden" name="fieldNameIds" value="1,">
|
108 |
<input type="hidden" name="redirActive" value="http://xyzscripts.com/subscription/pending/XYZWPSMPPRE">
|
admin/install.php
CHANGED
@@ -27,7 +27,7 @@ function fbap_install_free()
|
|
27 |
}*/
|
28 |
|
29 |
global $current_user;
|
30 |
-
|
31 |
if(get_option('xyz_credit_link')=="")
|
32 |
{
|
33 |
add_option("xyz_credit_link", '0');
|
@@ -41,7 +41,7 @@ function fbap_install_free()
|
|
41 |
|
42 |
add_option('xyz_fbap_application_id','');
|
43 |
add_option('xyz_fbap_application_secret', '');
|
44 |
-
add_option('xyz_fbap_fb_id', '');
|
45 |
add_option('xyz_fbap_message', 'New post added at {BLOG_TITLE} - {POST_TITLE}');
|
46 |
add_option('xyz_fbap_po_method', '2');
|
47 |
add_option('xyz_fbap_post_permission', '1');
|
@@ -65,7 +65,7 @@ function fbap_install_free()
|
|
65 |
add_option('xyz_fbap_post_logs', '');
|
66 |
add_option('xyz_fbap_premium_version_ads', '1');
|
67 |
add_option('xyz_fbap_default_selection_edit', '0');
|
68 |
-
|
69 |
}
|
70 |
|
71 |
|
27 |
}*/
|
28 |
|
29 |
global $current_user;
|
30 |
+
wp_get_current_user();
|
31 |
if(get_option('xyz_credit_link')=="")
|
32 |
{
|
33 |
add_option("xyz_credit_link", '0');
|
41 |
|
42 |
add_option('xyz_fbap_application_id','');
|
43 |
add_option('xyz_fbap_application_secret', '');
|
44 |
+
//add_option('xyz_fbap_fb_id', '');
|
45 |
add_option('xyz_fbap_message', 'New post added at {BLOG_TITLE} - {POST_TITLE}');
|
46 |
add_option('xyz_fbap_po_method', '2');
|
47 |
add_option('xyz_fbap_post_permission', '1');
|
65 |
add_option('xyz_fbap_post_logs', '');
|
66 |
add_option('xyz_fbap_premium_version_ads', '1');
|
67 |
add_option('xyz_fbap_default_selection_edit', '0');
|
68 |
+
add_option('xyz_fbap_utf_decode_enable', '0');
|
69 |
}
|
70 |
|
71 |
|
admin/logs.php
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
<tr class="xyz_smap_log_tr">
|
17 |
<th scope="col" width="1%"> </th>
|
18 |
<th scope="col" width="12%">Post Id</th>
|
|
|
19 |
<th scope="col" width="18%">Published On</th>
|
20 |
<th scope="col" width="15%">Status</th>
|
21 |
</tr>
|
@@ -23,14 +24,17 @@
|
|
23 |
<?php
|
24 |
|
25 |
$post_fb_logsmain = get_option('xyz_fbap_post_logs' );
|
26 |
-
|
|
|
|
|
27 |
$post_fb_logsmain_array = array();
|
28 |
-
|
29 |
{
|
30 |
$post_fb_logsmain_array[]=$logval;
|
31 |
|
32 |
}
|
33 |
-
|
|
|
34 |
if($post_fb_logsmain=='')
|
35 |
{
|
36 |
?>
|
@@ -57,6 +61,9 @@
|
|
57 |
<tr>
|
58 |
<td> </td>
|
59 |
<td style="vertical-align: middle !important;padding: 5px;">
|
|
|
|
|
|
|
60 |
<?php echo get_the_title($postid); ?>
|
61 |
</td>
|
62 |
|
@@ -84,6 +91,7 @@
|
|
84 |
}
|
85 |
}
|
86 |
}
|
|
|
87 |
?>
|
88 |
|
89 |
</table>
|
16 |
<tr class="xyz_smap_log_tr">
|
17 |
<th scope="col" width="1%"> </th>
|
18 |
<th scope="col" width="12%">Post Id</th>
|
19 |
+
<th scope="col" width="12%">Post Title</th>
|
20 |
<th scope="col" width="18%">Published On</th>
|
21 |
<th scope="col" width="15%">Status</th>
|
22 |
</tr>
|
24 |
<?php
|
25 |
|
26 |
$post_fb_logsmain = get_option('xyz_fbap_post_logs' );
|
27 |
+
|
28 |
+
if(is_array($post_fb_logsmain))
|
29 |
+
{
|
30 |
$post_fb_logsmain_array = array();
|
31 |
+
foreach ($post_fb_logsmain as $logkey => $logval)
|
32 |
{
|
33 |
$post_fb_logsmain_array[]=$logval;
|
34 |
|
35 |
}
|
36 |
+
|
37 |
+
|
38 |
if($post_fb_logsmain=='')
|
39 |
{
|
40 |
?>
|
61 |
<tr>
|
62 |
<td> </td>
|
63 |
<td style="vertical-align: middle !important;padding: 5px;">
|
64 |
+
<?php echo $postid; ?>
|
65 |
+
</td>
|
66 |
+
<td style="vertical-align: middle !important;padding: 5px;">
|
67 |
<?php echo get_the_title($postid); ?>
|
68 |
</td>
|
69 |
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
+
}
|
95 |
?>
|
96 |
|
97 |
</table>
|
admin/publish.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
add_action('publish_post', 'xyz_fbap_link_publish');
|
4 |
add_action('publish_page', 'xyz_fbap_link_publish');
|
5 |
$xyz_fbap_future_to_publish=get_option('xyz_fbap_future_to_publish');
|
6 |
|
@@ -10,16 +10,47 @@ if($xyz_fbap_future_to_publish==1)
|
|
10 |
function xyz_link_fbap_future_to_publish($post){
|
11 |
$postid =$post->ID;
|
12 |
xyz_fbap_link_publish($postid);
|
13 |
-
}
|
|
|
|
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
|
|
16 |
|
17 |
-
|
18 |
$carr=explode(',', $xyz_fbap_include_customposttypes);
|
19 |
foreach ($carr as $cstyps ) {
|
20 |
add_action('publish_'.$cstyps, 'xyz_fbap_link_publish');
|
21 |
|
22 |
-
}
|
23 |
|
24 |
function xyz_fbap_link_publish($post_ID) {
|
25 |
$_POST_CPY=$_POST;
|
@@ -31,6 +62,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
31 |
if(isset($_POST['xyz_fbap_post_permission']))
|
32 |
$post_permissin=$_POST['xyz_fbap_post_permission'];
|
33 |
|
|
|
34 |
if ($post_permissin != 1) {
|
35 |
$_POST=$_POST_CPY;
|
36 |
return ;
|
@@ -49,7 +81,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
49 |
add_post_meta($post_ID, "xyz_fbap", "1");
|
50 |
|
51 |
global $current_user;
|
52 |
-
|
53 |
|
54 |
////////////fb///////////
|
55 |
$appid=get_option('xyz_fbap_application_id');
|
@@ -61,7 +93,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
61 |
if(isset($_POST['xyz_fbap_message']))
|
62 |
$message=$_POST['xyz_fbap_message'];
|
63 |
|
64 |
-
|
65 |
|
66 |
$posting_method=get_option('xyz_fbap_po_method');
|
67 |
if(isset($_POST['xyz_fbap_po_method']))
|
@@ -91,7 +123,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
91 |
}
|
92 |
}
|
93 |
|
94 |
-
if($posttype=="post")
|
95 |
{
|
96 |
$xyz_fbap_include_posts=get_option('xyz_fbap_include_posts');
|
97 |
if($xyz_fbap_include_posts==0)
|
@@ -121,6 +153,23 @@ function xyz_fbap_link_publish($post_ID) {
|
|
121 |
}
|
122 |
}
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
include_once ABSPATH.'wp-admin/includes/plugin.php';
|
126 |
|
@@ -145,10 +194,11 @@ function xyz_fbap_link_publish($post_ID) {
|
|
145 |
$content = $postpp->post_content;
|
146 |
if($con_flag==1)
|
147 |
$content = apply_filters('the_content', $content);
|
|
|
148 |
$excerpt = $postpp->post_excerpt;
|
149 |
if($exc_flag==1)
|
150 |
$excerpt = apply_filters('the_excerpt', $excerpt);
|
151 |
-
|
152 |
$content = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $content);
|
153 |
$excerpt = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $excerpt);
|
154 |
|
@@ -180,16 +230,16 @@ function xyz_fbap_link_publish($post_ID) {
|
|
180 |
|
181 |
$name = $postpp->post_title;
|
182 |
$caption = html_entity_decode(get_bloginfo('title'), ENT_QUOTES, get_bloginfo('charset'));
|
|
|
|
|
183 |
if($tit_flag==1)
|
184 |
-
|
185 |
-
|
186 |
|
187 |
$name=strip_tags($name);
|
188 |
$name=strip_shortcodes($name);
|
189 |
-
|
190 |
-
$description=strip_tags($description);
|
191 |
$description=strip_shortcodes($description);
|
192 |
-
|
193 |
$description=str_replace(" ","",$description);
|
194 |
|
195 |
$excerpt=str_replace(" ","",$excerpt);
|
@@ -220,7 +270,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
220 |
}
|
221 |
|
222 |
$fb=new FBAPFacebook(array(
|
223 |
-
'appId' => $
|
224 |
'secret' => $appsecret,
|
225 |
'cookie' => true
|
226 |
));
|
@@ -308,10 +358,18 @@ function xyz_fbap_link_publish($post_ID) {
|
|
308 |
}
|
309 |
|
310 |
}
|
|
|
|
|
|
|
|
|
|
|
311 |
try{
|
312 |
-
$result = $fb->api('/'.$page_id.'/'.$disp_type.'/', 'post', $attachment);
|
|
|
|
|
313 |
catch(Exception $e)
|
314 |
{
|
|
|
315 |
$fb_publish_status[$page_id."/".$disp_type]=$e->getMessage();
|
316 |
}
|
317 |
|
@@ -319,7 +377,8 @@ function xyz_fbap_link_publish($post_ID) {
|
|
319 |
|
320 |
|
321 |
if(count($fb_publish_status)>0)
|
322 |
-
|
|
|
323 |
else
|
324 |
$fb_publish_status_insert=1;
|
325 |
|
@@ -343,6 +402,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
343 |
|
344 |
array_shift($update_opt_array);
|
345 |
array_push($update_opt_array,$post_fb_options);
|
|
|
346 |
update_option('xyz_fbap_post_logs', $update_opt_array);
|
347 |
|
348 |
|
1 |
<?php
|
2 |
|
3 |
+
/*add_action('publish_post', 'xyz_fbap_link_publish');
|
4 |
add_action('publish_page', 'xyz_fbap_link_publish');
|
5 |
$xyz_fbap_future_to_publish=get_option('xyz_fbap_future_to_publish');
|
6 |
|
10 |
function xyz_link_fbap_future_to_publish($post){
|
11 |
$postid =$post->ID;
|
12 |
xyz_fbap_link_publish($postid);
|
13 |
+
}*/
|
14 |
+
//////////////
|
15 |
+
add_action( 'transition_post_status', 'xyz_link_fbap_future_to_publish', 10, 3 );
|
16 |
|
17 |
+
function xyz_link_fbap_future_to_publish($new_status, $old_status, $post){
|
18 |
+
|
19 |
+
|
20 |
+
$postid =$post->ID;
|
21 |
+
$get_post_meta=get_post_meta($postid,"xyz_fbap",true);
|
22 |
+
|
23 |
+
$post_permissin=get_option('xyz_fbap_post_permission');
|
24 |
+
if(isset($_POST['xyz_fbap_post_permission']))
|
25 |
+
$post_permissin=$_POST['xyz_fbap_post_permission'];
|
26 |
+
else
|
27 |
+
{
|
28 |
+
if ($post_permissin == 1) {
|
29 |
+
if($new_status == 'publish')
|
30 |
+
{
|
31 |
+
if ($get_post_meta == 1 ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
else return;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
if($post_permissin == 1)
|
39 |
+
{
|
40 |
+
if($new_status == 'publish')
|
41 |
+
xyz_fbap_link_publish($postid);
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
|
46 |
+
//////////
|
47 |
|
48 |
+
/*$xyz_fbap_include_customposttypes=get_option('xyz_fbap_include_customposttypes');
|
49 |
$carr=explode(',', $xyz_fbap_include_customposttypes);
|
50 |
foreach ($carr as $cstyps ) {
|
51 |
add_action('publish_'.$cstyps, 'xyz_fbap_link_publish');
|
52 |
|
53 |
+
}*/
|
54 |
|
55 |
function xyz_fbap_link_publish($post_ID) {
|
56 |
$_POST_CPY=$_POST;
|
62 |
if(isset($_POST['xyz_fbap_post_permission']))
|
63 |
$post_permissin=$_POST['xyz_fbap_post_permission'];
|
64 |
|
65 |
+
|
66 |
if ($post_permissin != 1) {
|
67 |
$_POST=$_POST_CPY;
|
68 |
return ;
|
81 |
add_post_meta($post_ID, "xyz_fbap", "1");
|
82 |
|
83 |
global $current_user;
|
84 |
+
wp_get_current_user();
|
85 |
|
86 |
////////////fb///////////
|
87 |
$appid=get_option('xyz_fbap_application_id');
|
93 |
if(isset($_POST['xyz_fbap_message']))
|
94 |
$message=$_POST['xyz_fbap_message'];
|
95 |
|
96 |
+
//$fbid=get_option('xyz_fbap_fb_id');
|
97 |
|
98 |
$posting_method=get_option('xyz_fbap_po_method');
|
99 |
if(isset($_POST['xyz_fbap_po_method']))
|
123 |
}
|
124 |
}
|
125 |
|
126 |
+
else if($posttype=="post")
|
127 |
{
|
128 |
$xyz_fbap_include_posts=get_option('xyz_fbap_include_posts');
|
129 |
if($xyz_fbap_include_posts==0)
|
153 |
}
|
154 |
}
|
155 |
}
|
156 |
+
else
|
157 |
+
{
|
158 |
+
|
159 |
+
$xyz_fbap_include_customposttypes=get_option('xyz_fbap_include_customposttypes');
|
160 |
+
if($xyz_fbap_include_customposttypes!='')
|
161 |
+
{
|
162 |
+
$carr=explode(',', $xyz_fbap_include_customposttypes);
|
163 |
+
|
164 |
+
if(!in_array($posttype, $carr))
|
165 |
+
$_POST=$_POST_CPY;return;
|
166 |
+
}
|
167 |
+
else
|
168 |
+
{
|
169 |
+
$_POST=$_POST_CPY;return;
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
|
174 |
include_once ABSPATH.'wp-admin/includes/plugin.php';
|
175 |
|
194 |
$content = $postpp->post_content;
|
195 |
if($con_flag==1)
|
196 |
$content = apply_filters('the_content', $content);
|
197 |
+
$content = html_entity_decode($content, ENT_QUOTES, get_bloginfo('charset'));
|
198 |
$excerpt = $postpp->post_excerpt;
|
199 |
if($exc_flag==1)
|
200 |
$excerpt = apply_filters('the_excerpt', $excerpt);
|
201 |
+
$excerpt = html_entity_decode($excerpt, ENT_QUOTES, get_bloginfo('charset'));
|
202 |
$content = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $content);
|
203 |
$excerpt = preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $excerpt);
|
204 |
|
230 |
|
231 |
$name = $postpp->post_title;
|
232 |
$caption = html_entity_decode(get_bloginfo('title'), ENT_QUOTES, get_bloginfo('charset'));
|
233 |
+
if(get_option('xyz_fbap_utf_decode_enable')==1)
|
234 |
+
$caption=utf8_decode($caption);
|
235 |
if($tit_flag==1)
|
236 |
+
$name = apply_filters('the_title', $name);
|
237 |
+
$name = html_entity_decode($name, ENT_QUOTES, get_bloginfo('charset'));
|
238 |
|
239 |
$name=strip_tags($name);
|
240 |
$name=strip_shortcodes($name);
|
241 |
+
$description=strip_tags($description);
|
|
|
242 |
$description=strip_shortcodes($description);
|
|
|
243 |
$description=str_replace(" ","",$description);
|
244 |
|
245 |
$excerpt=str_replace(" ","",$excerpt);
|
270 |
}
|
271 |
|
272 |
$fb=new FBAPFacebook(array(
|
273 |
+
'appId' => $appid,
|
274 |
'secret' => $appsecret,
|
275 |
'cookie' => true
|
276 |
));
|
358 |
}
|
359 |
|
360 |
}
|
361 |
+
if($posting_method==1 || $posting_method==2)
|
362 |
+
{
|
363 |
+
|
364 |
+
$attachment=xyz_wp_fbap_attachment_metas($attachment,$link);
|
365 |
+
}
|
366 |
try{
|
367 |
+
$result = $fb->api('/'.$page_id.'/'.$disp_type.'/', 'post', $attachment);
|
368 |
+
|
369 |
+
}
|
370 |
catch(Exception $e)
|
371 |
{
|
372 |
+
|
373 |
$fb_publish_status[$page_id."/".$disp_type]=$e->getMessage();
|
374 |
}
|
375 |
|
377 |
|
378 |
|
379 |
if(count($fb_publish_status)>0)
|
380 |
+
|
381 |
+
$fb_publish_status_insert=serialize($fb_publish_status);
|
382 |
else
|
383 |
$fb_publish_status_insert=1;
|
384 |
|
402 |
|
403 |
array_shift($update_opt_array);
|
404 |
array_push($update_opt_array,$post_fb_options);
|
405 |
+
|
406 |
update_option('xyz_fbap_post_logs', $update_opt_array);
|
407 |
|
408 |
|
admin/settings.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
global $current_user;
|
4 |
$auth_varble=0;
|
5 |
-
|
6 |
$imgpath= plugins_url()."/facebook-auto-publish/admin/images/";
|
7 |
$heimg=$imgpath."support.png";
|
8 |
$ms1="";
|
@@ -15,7 +15,7 @@ $redirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=1');
|
|
15 |
require( dirname( __FILE__ ) . '/authorization.php' );
|
16 |
|
17 |
|
18 |
-
if($_GET['fbap_notice'] == 'hide')
|
19 |
{
|
20 |
update_option('xyz_fbap_dnt_shw_notice', "hide");
|
21 |
?>
|
@@ -65,14 +65,14 @@ if(isset($_POST['fb']))
|
|
65 |
|
66 |
$applidold=get_option('xyz_fbap_application_id');
|
67 |
$applsecretold=get_option('xyz_fbap_application_secret');
|
68 |
-
|
69 |
|
70 |
$posting_method=$_POST['xyz_fbap_po_method'];
|
71 |
$posting_permission=$_POST['xyz_fbap_post_permission'];
|
72 |
$appid=$_POST['xyz_fbap_application_id'];
|
73 |
$appsecret=$_POST['xyz_fbap_application_secret'];
|
74 |
$messagetopost=$_POST['xyz_fbap_message'];
|
75 |
-
|
76 |
if($appid=="" && $posting_permission==1)
|
77 |
{
|
78 |
$ms1="Please fill facebook application id.";
|
@@ -83,11 +83,11 @@ if(isset($_POST['fb']))
|
|
83 |
$ms2="Please fill facebook application secret.";
|
84 |
$erf=1;
|
85 |
}
|
86 |
-
elseif($fbid=="" && $posting_permission==1)
|
87 |
{
|
88 |
$ms3="Please fill facebook user id.";
|
89 |
$erf=1;
|
90 |
-
}
|
91 |
elseif($messagetopost=="" && $posting_permission==1)
|
92 |
{
|
93 |
$ms4="Please fill message format for posting.";
|
@@ -96,7 +96,7 @@ if(isset($_POST['fb']))
|
|
96 |
else
|
97 |
{
|
98 |
$erf=0;
|
99 |
-
if($appid!=$applidold || $appsecret!=$applsecretold
|
100 |
{
|
101 |
update_option('xyz_fbap_af',1);
|
102 |
update_option('xyz_fbap_fb_token','');
|
@@ -109,7 +109,7 @@ if(isset($_POST['fb']))
|
|
109 |
update_option('xyz_fbap_application_id',$appid);
|
110 |
update_option('xyz_fbap_post_permission',$posting_permission);
|
111 |
update_option('xyz_fbap_application_secret',$appsecret);
|
112 |
-
update_option('xyz_fbap_fb_id',$fbid);
|
113 |
update_option('xyz_fbap_po_method',$posting_method);
|
114 |
update_option('xyz_fbap_message',$messagetopost);
|
115 |
|
@@ -194,10 +194,10 @@ function dethide(id)
|
|
194 |
$af=get_option('xyz_fbap_af');
|
195 |
$appid=esc_html(get_option('xyz_fbap_application_id'));
|
196 |
$appsecret=esc_html(get_option('xyz_fbap_application_secret'));
|
197 |
-
|
198 |
$posting_method=get_option('xyz_fbap_po_method');
|
199 |
$posting_message=esc_textarea(get_option('xyz_fbap_message'));
|
200 |
-
if($af==1 && $appid!="" && $appsecret!=""
|
201 |
{
|
202 |
?>
|
203 |
<span style="color: red;">Application needs authorisation</span> <br>
|
@@ -208,7 +208,7 @@ function dethide(id)
|
|
208 |
|
209 |
</form>
|
210 |
<?php }
|
211 |
-
else if($af==0 && $appid!="" && $appsecret!=""
|
212 |
{
|
213 |
?>
|
214 |
<form method="post">
|
@@ -278,14 +278,14 @@ function dethide(id)
|
|
278 |
value="<?php if($ms2=="") {echo $apsecret; }?>" />
|
279 |
</td>
|
280 |
</tr>
|
281 |
-
<tr valign="top">
|
282 |
<td>Facebook user id
|
283 |
</td>
|
284 |
<td><input id="xyz_fbap_fb_id" name="xyz_fbap_fb_id" type="text"
|
285 |
value="<?php if($ms3=="") {echo esc_html(get_option('xyz_fbap_fb_id'));}?>" />
|
286 |
<a href="http://kb.xyzscripts.com/how-can-i-find-my-facebook-user-id" target="_blank">How can I find my Facebook user id?</a>
|
287 |
</td>
|
288 |
-
</tr
|
289 |
<tr valign="top">
|
290 |
<td>Message format for posting <img src="<?php echo $heimg?>"
|
291 |
onmouseover="detdisplay('xyz_fb')" onmouseout="dethide('xyz_fb')">
|
@@ -354,19 +354,21 @@ function dethide(id)
|
|
354 |
<?php
|
355 |
|
356 |
$xyz_acces_token=get_option('xyz_fbap_fb_token');
|
|
|
357 |
if($xyz_acces_token!=""){
|
358 |
|
359 |
$offset=0;$limit=100;$data=array();
|
360 |
-
|
361 |
do
|
362 |
{
|
363 |
$result1="";$pagearray1="";
|
364 |
$pp=wp_remote_get("https://graph.facebook.com/".XYZ_FBAP_FB_API_VERSION."/me/accounts?access_token=$xyz_acces_token&limit=$limit&offset=$offset");
|
|
|
365 |
if(is_array($pp))
|
366 |
{
|
367 |
$result1=$pp['body'];
|
368 |
$pagearray1 = json_decode($result1);
|
369 |
-
if(is_array($pagearray1->data))
|
370 |
$data = array_merge($data, $pagearray1->data);
|
371 |
}
|
372 |
else
|
@@ -459,8 +461,9 @@ function dethide(id)
|
|
459 |
$xyz_fbap_peer_verification=$_POST['xyz_fbap_peer_verification'];
|
460 |
$xyz_fbap_premium_version_ads=$_POST['xyz_fbap_premium_version_ads'];
|
461 |
$xyz_fbap_default_selection_edit=$_POST['xyz_fbap_default_selection_edit'];
|
|
|
462 |
|
463 |
-
|
464 |
$fbap_customtype_ids="";
|
465 |
|
466 |
$xyz_fbap_applyfilters="";
|
@@ -498,9 +501,10 @@ function dethide(id)
|
|
498 |
update_option('xyz_fbap_peer_verification',$xyz_fbap_peer_verification);
|
499 |
update_option('xyz_fbap_premium_version_ads',$xyz_fbap_premium_version_ads);
|
500 |
update_option('xyz_fbap_default_selection_edit',$xyz_fbap_default_selection_edit);
|
501 |
-
update_option('
|
|
|
502 |
}
|
503 |
-
|
504 |
$xyz_credit_link=get_option('xyz_credit_link');
|
505 |
$xyz_fbap_include_pages=get_option('xyz_fbap_include_pages');
|
506 |
$xyz_fbap_include_posts=get_option('xyz_fbap_include_posts');
|
@@ -510,6 +514,7 @@ function dethide(id)
|
|
510 |
$xyz_fbap_peer_verification=esc_html(get_option('xyz_fbap_peer_verification'));
|
511 |
$xyz_fbap_premium_version_ads=esc_html(get_option('xyz_fbap_premium_version_ads'));
|
512 |
$xyz_fbap_default_selection_edit=esc_html(get_option('xyz_fbap_default_selection_edit'));
|
|
|
513 |
|
514 |
?>
|
515 |
<h2>Basic Settings</h2>
|
@@ -687,18 +692,28 @@ function dethide(id)
|
|
687 |
?>
|
688 |
</td>
|
689 |
</tr>
|
690 |
-
|
691 |
<tr valign="top">
|
692 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
<td scope="row" colspan="1">Enable "future_to_publish" hook </td>
|
694 |
<td><select name="xyz_fbap_future_to_publish" id="xyz_fbap_future_to_publish" >
|
695 |
|
696 |
-
<option value ="1" <?php if($xyz_fbap_future_to_publish=='1') echo 'selected'; ?> >Yes </option>
|
697 |
|
698 |
-
<option value ="2" <?php if($xyz_fbap_future_to_publish=='2') echo 'selected'; ?> >No </option>
|
699 |
</select>
|
700 |
</td>
|
701 |
-
</tr
|
702 |
|
703 |
<tr valign="top">
|
704 |
|
@@ -829,4 +844,4 @@ function xyz_fbap_show_postCategory(val)
|
|
829 |
}
|
830 |
</script>
|
831 |
<?php
|
832 |
-
?>
|
2 |
|
3 |
global $current_user;
|
4 |
$auth_varble=0;
|
5 |
+
wp_get_current_user();
|
6 |
$imgpath= plugins_url()."/facebook-auto-publish/admin/images/";
|
7 |
$heimg=$imgpath."support.png";
|
8 |
$ms1="";
|
15 |
require( dirname( __FILE__ ) . '/authorization.php' );
|
16 |
|
17 |
|
18 |
+
if(isset($_GET['fbap_notice'])&& $_GET['fbap_notice'] == 'hide')
|
19 |
{
|
20 |
update_option('xyz_fbap_dnt_shw_notice', "hide");
|
21 |
?>
|
65 |
|
66 |
$applidold=get_option('xyz_fbap_application_id');
|
67 |
$applsecretold=get_option('xyz_fbap_application_secret');
|
68 |
+
//$fbidold=get_option('xyz_fbap_fb_id');
|
69 |
|
70 |
$posting_method=$_POST['xyz_fbap_po_method'];
|
71 |
$posting_permission=$_POST['xyz_fbap_post_permission'];
|
72 |
$appid=$_POST['xyz_fbap_application_id'];
|
73 |
$appsecret=$_POST['xyz_fbap_application_secret'];
|
74 |
$messagetopost=$_POST['xyz_fbap_message'];
|
75 |
+
//$fbid=$_POST['xyz_fbap_fb_id'];
|
76 |
if($appid=="" && $posting_permission==1)
|
77 |
{
|
78 |
$ms1="Please fill facebook application id.";
|
83 |
$ms2="Please fill facebook application secret.";
|
84 |
$erf=1;
|
85 |
}
|
86 |
+
/*elseif($fbid=="" && $posting_permission==1)
|
87 |
{
|
88 |
$ms3="Please fill facebook user id.";
|
89 |
$erf=1;
|
90 |
+
}*/
|
91 |
elseif($messagetopost=="" && $posting_permission==1)
|
92 |
{
|
93 |
$ms4="Please fill message format for posting.";
|
96 |
else
|
97 |
{
|
98 |
$erf=0;
|
99 |
+
if($appid!=$applidold || $appsecret!=$applsecretold)
|
100 |
{
|
101 |
update_option('xyz_fbap_af',1);
|
102 |
update_option('xyz_fbap_fb_token','');
|
109 |
update_option('xyz_fbap_application_id',$appid);
|
110 |
update_option('xyz_fbap_post_permission',$posting_permission);
|
111 |
update_option('xyz_fbap_application_secret',$appsecret);
|
112 |
+
//update_option('xyz_fbap_fb_id',$fbid);
|
113 |
update_option('xyz_fbap_po_method',$posting_method);
|
114 |
update_option('xyz_fbap_message',$messagetopost);
|
115 |
|
194 |
$af=get_option('xyz_fbap_af');
|
195 |
$appid=esc_html(get_option('xyz_fbap_application_id'));
|
196 |
$appsecret=esc_html(get_option('xyz_fbap_application_secret'));
|
197 |
+
//$fbid=esc_html(get_option('xyz_fbap_fb_id'));
|
198 |
$posting_method=get_option('xyz_fbap_po_method');
|
199 |
$posting_message=esc_textarea(get_option('xyz_fbap_message'));
|
200 |
+
if($af==1 && $appid!="" && $appsecret!="")
|
201 |
{
|
202 |
?>
|
203 |
<span style="color: red;">Application needs authorisation</span> <br>
|
208 |
|
209 |
</form>
|
210 |
<?php }
|
211 |
+
else if($af==0 && $appid!="" && $appsecret!="")
|
212 |
{
|
213 |
?>
|
214 |
<form method="post">
|
278 |
value="<?php if($ms2=="") {echo $apsecret; }?>" />
|
279 |
</td>
|
280 |
</tr>
|
281 |
+
<!-- <tr valign="top">
|
282 |
<td>Facebook user id
|
283 |
</td>
|
284 |
<td><input id="xyz_fbap_fb_id" name="xyz_fbap_fb_id" type="text"
|
285 |
value="<?php if($ms3=="") {echo esc_html(get_option('xyz_fbap_fb_id'));}?>" />
|
286 |
<a href="http://kb.xyzscripts.com/how-can-i-find-my-facebook-user-id" target="_blank">How can I find my Facebook user id?</a>
|
287 |
</td>
|
288 |
+
</tr>-->
|
289 |
<tr valign="top">
|
290 |
<td>Message format for posting <img src="<?php echo $heimg?>"
|
291 |
onmouseover="detdisplay('xyz_fb')" onmouseout="dethide('xyz_fb')">
|
354 |
<?php
|
355 |
|
356 |
$xyz_acces_token=get_option('xyz_fbap_fb_token');
|
357 |
+
|
358 |
if($xyz_acces_token!=""){
|
359 |
|
360 |
$offset=0;$limit=100;$data=array();
|
361 |
+
//$fbid=get_option('xyz_fbap_fb_id');
|
362 |
do
|
363 |
{
|
364 |
$result1="";$pagearray1="";
|
365 |
$pp=wp_remote_get("https://graph.facebook.com/".XYZ_FBAP_FB_API_VERSION."/me/accounts?access_token=$xyz_acces_token&limit=$limit&offset=$offset");
|
366 |
+
|
367 |
if(is_array($pp))
|
368 |
{
|
369 |
$result1=$pp['body'];
|
370 |
$pagearray1 = json_decode($result1);
|
371 |
+
if(is_array($pagearray1->data))
|
372 |
$data = array_merge($data, $pagearray1->data);
|
373 |
}
|
374 |
else
|
461 |
$xyz_fbap_peer_verification=$_POST['xyz_fbap_peer_verification'];
|
462 |
$xyz_fbap_premium_version_ads=$_POST['xyz_fbap_premium_version_ads'];
|
463 |
$xyz_fbap_default_selection_edit=$_POST['xyz_fbap_default_selection_edit'];
|
464 |
+
$xyz_fbap_utf_decode_enable=$_POST['xyz_fbap_utf_decode_enable'];
|
465 |
|
466 |
+
//$xyz_fbap_future_to_publish=$_POST['xyz_fbap_future_to_publish'];
|
467 |
$fbap_customtype_ids="";
|
468 |
|
469 |
$xyz_fbap_applyfilters="";
|
501 |
update_option('xyz_fbap_peer_verification',$xyz_fbap_peer_verification);
|
502 |
update_option('xyz_fbap_premium_version_ads',$xyz_fbap_premium_version_ads);
|
503 |
update_option('xyz_fbap_default_selection_edit',$xyz_fbap_default_selection_edit);
|
504 |
+
update_option('xyz_fbap_utf_decode_enable',$xyz_fbap_utf_decode_enable);
|
505 |
+
// update_option('xyz_fbap_future_to_publish',$xyz_fbap_future_to_publish);
|
506 |
}
|
507 |
+
//$xyz_fbap_future_to_publish=get_option('xyz_fbap_future_to_publish');
|
508 |
$xyz_credit_link=get_option('xyz_credit_link');
|
509 |
$xyz_fbap_include_pages=get_option('xyz_fbap_include_pages');
|
510 |
$xyz_fbap_include_posts=get_option('xyz_fbap_include_posts');
|
514 |
$xyz_fbap_peer_verification=esc_html(get_option('xyz_fbap_peer_verification'));
|
515 |
$xyz_fbap_premium_version_ads=esc_html(get_option('xyz_fbap_premium_version_ads'));
|
516 |
$xyz_fbap_default_selection_edit=esc_html(get_option('xyz_fbap_default_selection_edit'));
|
517 |
+
$xyz_fbap_utf_decode_enable=esc_html(get_option('xyz_fbap_utf_decode_enable'));
|
518 |
|
519 |
?>
|
520 |
<h2>Basic Settings</h2>
|
692 |
?>
|
693 |
</td>
|
694 |
</tr>
|
|
|
695 |
<tr valign="top">
|
696 |
|
697 |
+
<td scope="row" colspan="1" width="50%">Enable utf-8 decoding before publishing
|
698 |
+
</td><td><select name="xyz_fbap_utf_decode_enable" >
|
699 |
+
|
700 |
+
<option value ="1" <?php if($xyz_fbap_utf_decode_enable=='1') echo 'selected'; ?> >Yes </option>
|
701 |
+
|
702 |
+
<option value ="0" <?php if($xyz_fbap_utf_decode_enable=='0') echo 'selected'; ?> >No </option>
|
703 |
+
</select>
|
704 |
+
</td>
|
705 |
+
</tr>
|
706 |
+
<!-- <tr valign="top">
|
707 |
+
|
708 |
<td scope="row" colspan="1">Enable "future_to_publish" hook </td>
|
709 |
<td><select name="xyz_fbap_future_to_publish" id="xyz_fbap_future_to_publish" >
|
710 |
|
711 |
+
<option value ="1" <?php //if($xyz_fbap_future_to_publish=='1') echo 'selected'; ?> >Yes </option>
|
712 |
|
713 |
+
<option value ="2" <?php //if($xyz_fbap_future_to_publish=='2') echo 'selected'; ?> >No </option>
|
714 |
</select>
|
715 |
</td>
|
716 |
+
</tr>-->
|
717 |
|
718 |
<tr valign="top">
|
719 |
|
844 |
}
|
845 |
</script>
|
846 |
<?php
|
847 |
+
?>
|
facebook-auto-publish.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Facebook Auto Publish
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/facebook-auto-publish/
|
5 |
Description: Publish posts automatically from your blog to Facebook social media. You can publish your posts to Facebook as simple text message, text message with image or as attached link to your blog. The plugin supports filtering posts by custom post-types and categories.
|
6 |
-
Version: 1.
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: http://xyzscripts.com/
|
9 |
License: GPLv2 or later
|
3 |
Plugin Name: Facebook Auto Publish
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/facebook-auto-publish/
|
5 |
Description: Publish posts automatically from your blog to Facebook social media. You can publish your posts to Facebook as simple text message, text message with image or as attached link to your blog. The plugin supports filtering posts by custom post-types and categories.
|
6 |
+
Version: 1.3
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: http://xyzscripts.com/
|
9 |
License: GPLv2 or later
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: f1logic
|
3 |
Donate link: http://xyzscripts.com/donate/
|
4 |
Tags: facebook, facebook auto publish, publish post to facebook, add link to facebook, facebook publishing, post to facebook, post to fb, social media auto publish, social media publishing, social network auto publish, social media, social network
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Publish posts automatically to Facebook page or profile.
|
@@ -122,6 +122,14 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
|
|
122 |
|
123 |
== Changelog ==
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
= Facebook Auto Publish 1.2.4 =
|
126 |
* Added option to enable/disable "future_to_publish" hook for handling auto publish of scheduled posts
|
127 |
* Added options to enable/disable "the_content", "the_excerpt", "the_title" filters on content to be auto-published
|
@@ -189,7 +197,7 @@ Please read the FAQ first if you are having problems.
|
|
189 |
|
190 |
= Requirements =
|
191 |
|
192 |
-
WordPress
|
193 |
PHP 5+
|
194 |
|
195 |
= Feedback =
|
2 |
Contributors: f1logic
|
3 |
Donate link: http://xyzscripts.com/donate/
|
4 |
Tags: facebook, facebook auto publish, publish post to facebook, add link to facebook, facebook publishing, post to facebook, post to fb, social media auto publish, social media publishing, social network auto publish, social media, social network
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 4.5.1
|
7 |
+
Stable tag: 1.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Publish posts automatically to Facebook page or profile.
|
122 |
|
123 |
== Changelog ==
|
124 |
|
125 |
+
= Facebook Auto Publish 1.3 =
|
126 |
+
* Added option to enable/disable utf-8 decoding before publishing
|
127 |
+
* Removed unwanted configuration related to 'future_to_publish' hook
|
128 |
+
* Removed unwanted setting "Facebook user id"
|
129 |
+
* Postid added in autopublish logs
|
130 |
+
* Updated auto publish mechanism using transition_post_status hook
|
131 |
+
* Open graph meta tags will be prefered for facebook attachments
|
132 |
+
|
133 |
= Facebook Auto Publish 1.2.4 =
|
134 |
* Added option to enable/disable "future_to_publish" hook for handling auto publish of scheduled posts
|
135 |
* Added options to enable/disable "the_content", "the_excerpt", "the_title" filters on content to be auto-published
|
197 |
|
198 |
= Requirements =
|
199 |
|
200 |
+
WordPress 3.0+
|
201 |
PHP 5+
|
202 |
|
203 |
= Feedback =
|
xyz-functions.php
CHANGED
@@ -115,4 +115,102 @@ if(!function_exists('xyz_fbap_local_date_time')){
|
|
115 |
|
116 |
add_filter( 'plugin_row_meta','xyz_fbap_links',10,2);
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
?>
|
115 |
|
116 |
add_filter( 'plugin_row_meta','xyz_fbap_links',10,2);
|
117 |
|
118 |
+
|
119 |
+
if (!function_exists("xyz_fbap_is_session_started")) {
|
120 |
+
function xyz_fbap_is_session_started()
|
121 |
+
{
|
122 |
+
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
|
123 |
+
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
|
124 |
+
} else {
|
125 |
+
return session_id() === '' ? FALSE : TRUE;
|
126 |
+
}
|
127 |
+
|
128 |
+
return FALSE;
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
if (!function_exists("xyz_wp_fbap_attachment_metas")) {
|
133 |
+
function xyz_wp_fbap_attachment_metas($attachment,$url)
|
134 |
+
{
|
135 |
+
$name='';$description_li='';$content_img='';$utf="UTF-8";
|
136 |
+
$aprv_me_data=wp_remote_get($url);
|
137 |
+
if( is_array($aprv_me_data) ) {
|
138 |
+
$aprv_me_data = $aprv_me_data['body']; // use the content
|
139 |
+
}
|
140 |
+
else {
|
141 |
+
$aprv_me_data='';
|
142 |
+
}
|
143 |
+
|
144 |
+
$og_datas = new DOMDocument();
|
145 |
+
@$og_datas->loadHTML($aprv_me_data);
|
146 |
+
$xpath = new DOMXPath($og_datas);
|
147 |
+
if(isset($attachment['name']))
|
148 |
+
{
|
149 |
+
$ogmetaContentAttributeNodes_tit = $xpath->query("/html/head/meta[@property='og:title']/@content");
|
150 |
+
|
151 |
+
foreach($ogmetaContentAttributeNodes_tit as $ogmetaContentAttributeNode_tit) {
|
152 |
+
$name=$ogmetaContentAttributeNode_tit->nodeValue;
|
153 |
+
|
154 |
+
}
|
155 |
+
if(get_option('xyz_fbap_utf_decode_enable')==1)
|
156 |
+
$name=utf8_decode($name);
|
157 |
+
// if(strcmp(get_option('blog_charset'),$utf)==0)
|
158 |
+
// $content_title=utf8_decode($content_title);
|
159 |
+
if($name!='')
|
160 |
+
$attachment['name']=$name;
|
161 |
+
}
|
162 |
+
if(isset($attachment['actions']))
|
163 |
+
{
|
164 |
+
if(isset($attachment['actions']['name']))
|
165 |
+
{
|
166 |
+
$ogmetaContentAttributeNodes_tit = $xpath->query("/html/head/meta[@property='og:title']/@content");
|
167 |
+
|
168 |
+
foreach($ogmetaContentAttributeNodes_tit as $ogmetaContentAttributeNode_tit) {
|
169 |
+
$name=$ogmetaContentAttributeNode_tit->nodeValue;
|
170 |
+
|
171 |
+
}
|
172 |
+
if(get_option('xyz_fbap_utf_decode_enable')==1)
|
173 |
+
$name=utf8_decode($name);
|
174 |
+
// if(strcmp(get_option('blog_charset'),$utf)==0)
|
175 |
+
// $content_title=utf8_decode($content_title);
|
176 |
+
if($name!='')
|
177 |
+
$attachment['actions']['name']=$name;
|
178 |
+
}
|
179 |
+
if(isset($attachment['actions']['link']))
|
180 |
+
{
|
181 |
+
$attachment['actions']['link']=$url;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
if(isset($attachment['description']))
|
185 |
+
{
|
186 |
+
$ogmetaContentAttributeNodes_desc = $xpath->query("/html/head/meta[@property='og:description']/@content");
|
187 |
+
foreach($ogmetaContentAttributeNodes_desc as $ogmetaContentAttributeNode_desc) {
|
188 |
+
$description_li=$ogmetaContentAttributeNode_desc->nodeValue;
|
189 |
+
}
|
190 |
+
if(get_option('xyz_fbap_utf_decode_enable')==1)
|
191 |
+
$description_li=utf8_decode($description_li);
|
192 |
+
// if(strcmp(get_option('blog_charset'),$utf)==0)
|
193 |
+
// $content_desc=utf8_decode($content_desc);
|
194 |
+
if($description_li!='')
|
195 |
+
$attachment['description']=$description_li;
|
196 |
+
}
|
197 |
+
/*if(isset($attachment['picture']))
|
198 |
+
{
|
199 |
+
$ogmetaContentAttributeNodes_img = $xpath->query("/html/head/meta[@property='og:image']/@content");
|
200 |
+
foreach($ogmetaContentAttributeNodes_img as $ogmetaContentAttributeNode_img) {
|
201 |
+
$content_img=$ogmetaContentAttributeNode_img->nodeValue;
|
202 |
+
}
|
203 |
+
if($content_img!='')
|
204 |
+
$attachment['picture']=$content_img;
|
205 |
+
}*/
|
206 |
+
|
207 |
+
if(isset($attachment['link']))
|
208 |
+
$attachment['link']=$url;
|
209 |
+
|
210 |
+
return $attachment;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
|
215 |
+
|
216 |
?>
|