WP Facebook Auto Publish - Version 1.2.4

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 Icon 128x128 WP Facebook Auto Publish
Version 1.2.4
Comparing to
See all releases

Code changes from version 1.2.3 to 1.2.4

admin/about.php CHANGED
@@ -85,7 +85,7 @@ Facebook Auto Publish automatically publishes posts from your blog to your Face
85
  </tr>
86
 
87
  <tr>
88
- <td>Publish to linkedin profile/company pages/groups</td>
89
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
90
  </td>
91
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
85
  </tr>
86
 
87
  <tr>
88
+ <td>Publish to linkedin profile/company pages</td>
89
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
90
  </td>
91
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
admin/admin-notices.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wp_fbap_admin_notice()
3
+ {
4
+ add_thickbox();
5
+ $sharelink_text_array_fb = array
6
+ (
7
+ "I use Facebook Auto Publish wordpress plugin from @xyzscripts and you should too.",
8
+ "Facebook Auto Publish wordpress plugin from @xyzscripts is awesome",
9
+ "Thanks @xyzscripts for developing such a wonderful Facebook auto publishing wordpress plugin",
10
+ "I was looking for a Facebook publishing plugin and I found this. Thanks @xyzscripts",
11
+ "Its very easy to use Facebook Auto Publish wordpress plugin from @xyzscripts",
12
+ "I installed Facebook Auto Publish from @xyzscripts,it works flawlessly",
13
+ "Facebook Auto Publish wordpress plugin that i use works terrific",
14
+ "I am using Facebook Auto Publish wordpress plugin from @xyzscripts and I like it",
15
+ "The Facebook Auto Publish plugin from @xyzscripts is simple and works fine",
16
+ "I've been using this Facebook plugin for a while now and it is really good",
17
+ "Facebook Auto Publish wordpress plugin is a fantastic plugin",
18
+ "Facebook Auto Publish wordpress plugin is easy to use and works great. Thank you!",
19
+ "Good and flexible Facebook Auto publish plugin especially for beginners",
20
+ "The best Facebook Auto publish wordpress plugin I have used ! THANKS @xyzscripts",
21
+ );
22
+ $sharelink_text_fb = array_rand($sharelink_text_array_fb, 1);
23
+ $sharelink_text_fb = $sharelink_text_array_fb[$sharelink_text_fb];
24
+
25
+
26
+ echo '<div id="fb_notice_td" class="error" style="color: #c1c1c1;margin-left: 2px;background: none repeat scroll 0pt 0pt infobackground; border: 1px solid inactivecaption; padding: 5px;line-height:16px;">
27
+ <p>It looks like you have been enjoying using <a href="https://wordpress.org/plugins/facebook-auto-publish/" target="_blank"> Facebook Auto Publish </a> plugin from Xyzscripts for atleast 30 days.Would you consider supporting us with the continued development of the plugin using any of the below methods?</p>
28
+ <p>
29
+ <a href="https://wordpress.org/support/view/plugin-reviews/facebook-auto-publish" class="button" style="color:black;text-decoration:none;padding:5px;margin-right:4px;" target="_blank">Rate it 5★\'s on wordpress</a>
30
+ <a href="http://xyzscripts.com/wordpress-plugins/social-media-auto-publish/purchase" class="button" style="color:black;text-decoration:none;padding:5px;margin-right:4px;" target="_blank">Purchase premium version</a>';
31
+ if(get_option('xyz_credit_link')=="0")
32
+ echo '<a class="button xyz_fbap_backlink" style="color:black;text-decoration:none;padding:5px;margin-right:4px;" target="_blank">Enable Backlink</a>';
33
+
34
+ echo '<a href="#TB_inline?width=250&height=75&inlineId=show_share_icons_fb" class="button thickbox" style="color:black;text-decoration:none;padding:5px;margin-right:4px;" target="_blank">Share on</a>
35
+
36
+ <a href="admin.php?page=facebook-auto-publish-settings&fbap_notice=hide" class="button" style="color:black;text-decoration:none;padding:5px;margin-right:4px;">Don\'t Show This Again</a>
37
+ </p>
38
+
39
+ <div id="show_share_icons_fb" style="display: none;">
40
+ <a class="button" style="background-color:#3b5998;color:white;margin-right:4px;margin-left:100px;margin-top: 25px;" href="http://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/facebook-auto-publish/&text='.$sharelink_text_fb.'" target="_blank">Facebook</a>
41
+ <a class="button" style="background-color:#00aced;color:white;margin-right:4px;margin-left:20px;margin-top: 25px;" href="http://twitter.com/share?url=https://wordpress.org/plugins/facebook-auto-publish/&text='.$sharelink_text_fb.'" target="_blank">Twitter</a>
42
+ <a class="button" style="background-color:#007bb6;color:white;margin-right:4px;margin-left:20px;margin-top: 25px;" href="http://www.linkedin.com/shareArticle?mini=true&url=https://wordpress.org/plugins/facebook-auto-publish/" target="_blank">LinkedIn</a>
43
+ <a class="button" style="background-color:#dd4b39;color:white;margin-right:4px;margin-left:20px;margin-top: 25px;" href="https://plus.google.com/share?&hl=en&url=https://wordpress.org/plugins/facebook-auto-publish/" target="_blank">google+</a>
44
+ </div>
45
+
46
+
47
+
48
+ </div>';
49
+
50
+
51
+ }
52
+ $fbap_installed_date = get_option('fbap_installed_date');
53
+ if ($fbap_installed_date=="") {
54
+ $fbap_installed_date = time();
55
+ }
56
+ if($fbap_installed_date < ( time() - 2952000 ))
57
+ {
58
+ if (get_option('xyz_fbap_dnt_shw_notice') != "hide")
59
+ {
60
+ add_action('admin_notices', 'wp_fbap_admin_notice');
61
+ }
62
+ }
63
+ ?>
admin/authorization.php CHANGED
@@ -19,7 +19,7 @@ if(isset($_POST['fb_auth']))
19
 
20
  $dialog_url = "https://www.facebook.com/".XYZ_FBAP_FB_API_VERSION."/dialog/oauth?client_id="
21
  . $app_id . "&redirect_uri=" . $my_url . "&state="
22
- . $xyz_fbap_session_state . "&scope=email,user_about_me,publish_pages,user_posts,publish_actions,manage_pages";
23
 
24
  header("Location: " . $dialog_url);
25
  }
@@ -68,10 +68,12 @@ if(isset($_COOKIE['xyz_fbap_session_state']) && isset($_REQUEST['state']) && ($_
68
  else
69
  break;
70
  $offset += $limit;
71
- if(!is_array($pagearray1->paging))
72
- break;
73
- }while(array_key_exists("next", $pagearray1->paging));
74
-
 
 
75
  $count=count($data);
76
 
77
  $fbap_pages_ids1=get_option('xyz_fbap_pages_ids');
19
 
20
  $dialog_url = "https://www.facebook.com/".XYZ_FBAP_FB_API_VERSION."/dialog/oauth?client_id="
21
  . $app_id . "&redirect_uri=" . $my_url . "&state="
22
+ . $xyz_fbap_session_state . "&scope=email,public_profile,publish_pages,user_posts,publish_actions,manage_pages";
23
 
24
  header("Location: " . $dialog_url);
25
  }
68
  else
69
  break;
70
  $offset += $limit;
71
+ // if(!is_array($pagearray1->paging))
72
+ // break;
73
+ // }while(array_key_exists("next", $pagearray1->paging));
74
+ }while(isset($pagearray1->paging->next));
75
+
76
+
77
  $count=count($data);
78
 
79
  $fbap_pages_ids1=get_option('xyz_fbap_pages_ids');
admin/destruction.php CHANGED
@@ -38,6 +38,8 @@ function fbap_free_destroy()
38
  delete_option('xyz_fbap_current_appln_token');
39
  delete_option('xyz_fbap_af');
40
  delete_option('xyz_fbap_pages_ids');
 
 
41
 
42
  delete_option('xyz_fbap_free_version');
43
 
38
  delete_option('xyz_fbap_current_appln_token');
39
  delete_option('xyz_fbap_af');
40
  delete_option('xyz_fbap_pages_ids');
41
+ delete_option('xyz_fbap_future_to_publish');
42
+ delete_option('xyz_fbap_apply_filters');
43
 
44
  delete_option('xyz_fbap_free_version');
45
 
admin/footer.php CHANGED
@@ -49,7 +49,7 @@
49
  <script language="javascript">
50
  function check_email(emailString)
51
  {
52
- var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
53
  var matchArray = emailString.match(mailPattern);
54
  if (emailString.length == 0)
55
  return false;
49
  <script language="javascript">
50
  function check_email(emailString)
51
  {
52
+ var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
53
  var matchArray = emailString.match(mailPattern);
54
  if (emailString.length == 0)
55
  return false;
admin/header.php CHANGED
@@ -43,11 +43,11 @@ if(get_option('xyz_credit_link')=="0"){
43
  ?>
44
  <div style="float:left;background-color: #FFECB3;border-radius:5px;padding: 0px 5px;margin-top: 10px;border: 1px solid #E0AB1B" id="xyz_backlink_div">
45
 
46
- Please do a favour by enabling backlink to our site. <a id="xyz_fbap_backlink" style="cursor: pointer;" >Okay, Enable</a>.
47
  <script type="text/javascript">
48
  jQuery(document).ready(function() {
49
 
50
- jQuery('#xyz_fbap_backlink').click(function() {
51
 
52
 
53
  var dataString = {
@@ -56,6 +56,7 @@ jQuery(document).ready(function() {
56
  };
57
 
58
  jQuery.post(ajaxurl, dataString, function(response) {
 
59
  jQuery("#xyz_backlink_div").html('Thank you for enabling backlink !');
60
  jQuery("#xyz_backlink_div").css('background-color', '#D8E8DA');
61
  jQuery("#xyz_backlink_div").css('border', '1px solid #0F801C');
43
  ?>
44
  <div style="float:left;background-color: #FFECB3;border-radius:5px;padding: 0px 5px;margin-top: 10px;border: 1px solid #E0AB1B" id="xyz_backlink_div">
45
 
46
+ Please do a favour by enabling backlink to our site. <a class="xyz_fbap_backlink" style="cursor: pointer;" >Okay, Enable</a>.
47
  <script type="text/javascript">
48
  jQuery(document).ready(function() {
49
 
50
+ jQuery('.xyz_fbap_backlink').click(function() {
51
 
52
 
53
  var dataString = {
56
  };
57
 
58
  jQuery.post(ajaxurl, dataString, function(response) {
59
+ jQuery('.xyz_fbap_backlink').hide();
60
  jQuery("#xyz_backlink_div").html('Thank you for enabling backlink !');
61
  jQuery("#xyz_backlink_div").css('background-color', '#D8E8DA');
62
  jQuery("#xyz_backlink_div").css('border', '1px solid #0F801C');
admin/install.php CHANGED
@@ -32,7 +32,13 @@ function fbap_install_free()
32
  {
33
  add_option("xyz_credit_link", '0');
34
  }
35
-
 
 
 
 
 
 
36
  add_option('xyz_fbap_application_id','');
37
  add_option('xyz_fbap_application_secret', '');
38
  add_option('xyz_fbap_fb_id', '');
@@ -42,7 +48,8 @@ function fbap_install_free()
42
  add_option('xyz_fbap_current_appln_token', '');
43
  add_option('xyz_fbap_af', '1'); //authorization flag
44
  add_option('xyz_fbap_pages_ids','-1');
45
-
 
46
 
47
 
48
  $version=get_option('xyz_fbap_free_version');
32
  {
33
  add_option("xyz_credit_link", '0');
34
  }
35
+
36
+ $fbap_installed_date = get_option('fbap_installed_date');
37
+ if ($fbap_installed_date=="") {
38
+ $fbap_installed_date = time();
39
+ update_option('fbap_installed_date', $fbap_installed_date);
40
+ }
41
+
42
  add_option('xyz_fbap_application_id','');
43
  add_option('xyz_fbap_application_secret', '');
44
  add_option('xyz_fbap_fb_id', '');
48
  add_option('xyz_fbap_current_appln_token', '');
49
  add_option('xyz_fbap_af', '1'); //authorization flag
50
  add_option('xyz_fbap_pages_ids','-1');
51
+ add_option('xyz_fbap_future_to_publish', '1');
52
+ add_option('xyz_fbap_apply_filters', '');
53
 
54
 
55
  $version=get_option('xyz_fbap_free_version');
admin/logs.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
 
12
  <div style="text-align: left;padding-left: 7px;"><h3>Auto Publish Logs</h3></div>
13
-
14
  <table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
15
  <thead>
16
  <tr class="xyz_smap_log_tr">
@@ -22,52 +22,69 @@
22
  </thead>
23
  <?php
24
 
25
- $post_fb_logs = get_option('xyz_fbap_post_logs' );
26
 
27
- if($post_fb_logs!=""){
 
 
 
28
 
29
- $postid=$post_fb_logs['postid'];
30
- $publishtime=$post_fb_logs['publishtime'];
31
- if($publishtime!="")
32
- $publishtime=xyz_fbap_local_date_time('Y/m/d g:i:s A',$publishtime);
33
- $status=$post_fb_logs['status'];
34
 
35
-
 
 
 
 
 
36
 
37
 
38
- ?>
39
- <tr>
40
- <td>&nbsp;</td>
41
- <td style="vertical-align: middle !important;padding: 5px;">
42
- <?php echo $postid; ?>
43
- </td>
44
-
45
- <td style="vertical-align: middle !important;padding: 5px;">
46
- <?php echo $publishtime;?>
47
- </td>
48
-
49
- <td style="vertical-align: middle !important;padding: 5px;">
50
- <?php
51
-
52
-
53
- if($status=="1")
54
- echo "<span style=\"color:green\">Success</span>";
55
- else if($status=="0")
56
- echo '';
57
- else
58
  {
59
- $arrval=unserialize($status);
60
- foreach ($arrval as $a=>$b)
61
- echo "<span style=\"color:red\">".$a." : ".$b."</span><br>";
62
-
63
- }
64
-
65
- ?>
66
- </td>
67
- </tr>
68
- <?php }else{?>
69
- <tr><td colspan="4" style="padding: 5px;">No logs Found</td></tr>
70
- <?php }?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  </table>
73
 
10
 
11
 
12
  <div style="text-align: left;padding-left: 7px;"><h3>Auto Publish Logs</h3></div>
13
+ <span>Last five logs</span>
14
  <table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
15
  <thead>
16
  <tr class="xyz_smap_log_tr">
22
  </thead>
23
  <?php
24
 
25
+ $post_fb_logsmain = get_option('xyz_fbap_post_logs' );
26
 
27
+ $post_fb_logsmain_array = array();
28
+ foreach ($post_fb_logsmain as $logkey => $logval)
29
+ {
30
+ $post_fb_logsmain_array[]=$logval;
31
 
32
+ }
 
 
 
 
33
 
34
+ if($post_fb_logsmain=='')
35
+ {
36
+ ?>
37
+ <tr><td colspan="4" style="padding: 5px;">No logs Found</td></tr>
38
+ <?php
39
+ }
40
 
41
 
42
+
43
+ if(is_array($post_fb_logsmain_array))
44
+ {
45
+ for($i=4;$i>=0;$i--)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  {
47
+ if($post_fb_logsmain_array[$i]!='')
48
+ {
49
+ $post_fb_logs=$post_fb_logsmain_array[$i];
50
+ $postid=$post_fb_logs['postid'];
51
+ $publishtime=$post_fb_logs['publishtime'];
52
+ if($publishtime!="")
53
+ $publishtime=xyz_fbap_local_date_time('Y/m/d g:i:s A',$publishtime);
54
+ $status=$post_fb_logs['status'];
55
+
56
+ ?>
57
+ <tr>
58
+ <td>&nbsp;</td>
59
+ <td style="vertical-align: middle !important;padding: 5px;">
60
+ <?php echo get_the_title($postid); ?>
61
+ </td>
62
+
63
+ <td style="vertical-align: middle !important;padding: 5px;">
64
+ <?php echo $publishtime;?>
65
+ </td>
66
+
67
+ <td style="vertical-align: middle !important;padding: 5px;">
68
+ <?php
69
+
70
+ if($status=="1")
71
+ echo "<span style=\"color:green\">Success</span>";
72
+ else if($status=="0")
73
+ echo '';
74
+ else
75
+ {
76
+ $arrval=unserialize($status);
77
+ foreach ($arrval as $a=>$b)
78
+ echo "<span style=\"color:red\">".$a." : ".$b."</span><br>";
79
+ }
80
+ ?>
81
+ </td>
82
+ </tr>
83
+ <?php
84
+ }
85
+ }
86
+ }
87
+ ?>
88
 
89
  </table>
90
 
admin/publish.php CHANGED
@@ -2,7 +2,10 @@
2
 
3
  add_action('publish_post', 'xyz_fbap_link_publish');
4
  add_action('publish_page', 'xyz_fbap_link_publish');
5
- //add_action('future_to_publish', 'xyz_link_fbap_future_to_publish');
 
 
 
6
 
7
  function xyz_link_fbap_future_to_publish($post){
8
  $postid =$post->ID;
@@ -21,20 +24,30 @@ foreach ($carr as $cstyps ) {
21
  function xyz_fbap_link_publish($post_ID) {
22
  $_POST_CPY=$_POST;
23
  $_POST=stripslashes_deep($_POST);
24
- // if(isset($_POST['xyz_fbap_hidden_meta']) && $_POST['xyz_fbap_hidden_meta']==1)
25
- // {
26
- // $_POST=$_POST_CPY;
27
- // return ;
28
- // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  $get_post_meta=get_post_meta($post_ID,"xyz_fbap",true);
31
  if($get_post_meta!=1)
32
  add_post_meta($post_ID, "xyz_fbap", "1");
33
- // else
34
- // {
35
- // $_POST=$_POST_CPY;
36
- // return;
37
- // }
38
  global $current_user;
39
  get_currentuserinfo();
40
 
@@ -54,9 +67,6 @@ function xyz_fbap_link_publish($post_ID) {
54
  if(isset($_POST['xyz_fbap_po_method']))
55
  $posting_method=$_POST['xyz_fbap_po_method'];
56
 
57
- $post_permissin=get_option('xyz_fbap_post_permission');
58
- if(isset($_POST['xyz_fbap_post_permission']))
59
- $post_permissin=$_POST['xyz_fbap_post_permission'];
60
 
61
  $af=get_option('xyz_fbap_af');
62
 
@@ -121,10 +131,27 @@ function xyz_fbap_link_publish($post_ID) {
121
  }
122
  $link = get_permalink($postpp->ID);
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
125
-
126
- $content = $postpp->post_content;$content = apply_filters('the_content', $content);
127
- $excerpt = $postpp->post_excerpt;$excerpt = apply_filters('the_excerpt', $excerpt);
128
  if($excerpt=="")
129
  {
130
  if($content!="")
@@ -151,10 +178,11 @@ function xyz_fbap_link_publish($post_ID) {
151
  else
152
  $image_found=0;
153
 
154
-
155
- $name = html_entity_decode(get_the_title($postpp->ID), ENT_QUOTES, get_bloginfo('charset'));
156
  $caption = html_entity_decode(get_bloginfo('title'), ENT_QUOTES, get_bloginfo('charset'));
157
- $name = apply_filters('the_title', $name);
 
 
158
 
159
  $name=strip_tags($name);
160
  $name=strip_shortcodes($name);
@@ -196,7 +224,6 @@ function xyz_fbap_link_publish($post_ID) {
196
  'secret' => $appsecret,
197
  'cookie' => true
198
  ));
199
- //$fb=new FBAPFacebook();
200
  $message1=str_replace('{POST_TITLE}', $name, $message);
201
  $message2=str_replace('{BLOG_TITLE}', $caption,$message1);
202
  $message3=str_replace('{PERMALINK}', $link, $message2);
@@ -303,8 +330,22 @@ function xyz_fbap_link_publish($post_ID) {
303
  'publishtime' => $time,
304
  'status' => $fb_publish_status_insert
305
  );
306
- update_option('xyz_fbap_post_logs', $post_fb_options);
307
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  }
309
 
310
  }
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
+
7
+ if($xyz_fbap_future_to_publish==1)
8
+ add_action('future_to_publish', 'xyz_link_fbap_future_to_publish');
9
 
10
  function xyz_link_fbap_future_to_publish($post){
11
  $postid =$post->ID;
24
  function xyz_fbap_link_publish($post_ID) {
25
  $_POST_CPY=$_POST;
26
  $_POST=stripslashes_deep($_POST);
27
+
28
+
29
+
30
+ $post_permissin=get_option('xyz_fbap_post_permission');
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 ;
37
+
38
+ } else if (isset($_POST['_inline_edit']) AND (get_option('xyz_fbap_default_selection_edit') == 0) ) {
39
+ $_POST=$_POST_CPY;
40
+ return;
41
+ }
42
+
43
+
44
+
45
+
46
 
47
  $get_post_meta=get_post_meta($post_ID,"xyz_fbap",true);
48
  if($get_post_meta!=1)
49
  add_post_meta($post_ID, "xyz_fbap", "1");
50
+
 
 
 
 
51
  global $current_user;
52
  get_currentuserinfo();
53
 
67
  if(isset($_POST['xyz_fbap_po_method']))
68
  $posting_method=$_POST['xyz_fbap_po_method'];
69
 
 
 
 
70
 
71
  $af=get_option('xyz_fbap_af');
72
 
131
  }
132
  $link = get_permalink($postpp->ID);
133
 
134
+
135
+ $xyz_fbap_apply_filters=get_option('xyz_fbap_apply_filters');
136
+ $ar2=explode(",",$xyz_fbap_apply_filters);
137
+ $con_flag=$exc_flag=$tit_flag=0;
138
+ if(isset($ar2[0]))
139
+ if($ar2[0]==1) $con_flag=1;
140
+ if(isset($ar2[1]))
141
+ if($ar2[1]==2) $exc_flag=1;
142
+ if(isset($ar2[2]))
143
+ if($ar2[2]==3) $tit_flag=1;
144
+
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
 
 
 
 
155
  if($excerpt=="")
156
  {
157
  if($content!="")
178
  else
179
  $image_found=0;
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
+ $name = apply_filters('the_title', $name);
185
+
186
 
187
  $name=strip_tags($name);
188
  $name=strip_shortcodes($name);
224
  'secret' => $appsecret,
225
  'cookie' => true
226
  ));
 
227
  $message1=str_replace('{POST_TITLE}', $name, $message);
228
  $message2=str_replace('{BLOG_TITLE}', $caption,$message1);
229
  $message3=str_replace('{PERMALINK}', $link, $message2);
330
  'publishtime' => $time,
331
  'status' => $fb_publish_status_insert
332
  );
333
+
334
+ $update_opt_array=array();
335
+
336
+ $arr_retrive=(get_option('xyz_fbap_post_logs'));
337
+
338
+ $update_opt_array[0]=isset($arr_retrive[0]) ? $arr_retrive[0] : '';
339
+ $update_opt_array[1]=isset($arr_retrive[1]) ? $arr_retrive[1] : '';
340
+ $update_opt_array[2]=isset($arr_retrive[2]) ? $arr_retrive[2] : '';
341
+ $update_opt_array[3]=isset($arr_retrive[3]) ? $arr_retrive[3] : '';
342
+ $update_opt_array[4]=isset($arr_retrive[4]) ? $arr_retrive[4] : '';
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
+
349
  }
350
 
351
  }
admin/settings.php CHANGED
@@ -14,6 +14,26 @@ $redirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=1');
14
 
15
  require( dirname( __FILE__ ) . '/authorization.php' );
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  $erf=0;
18
  if(isset($_POST['fb']))
19
  {
@@ -352,10 +372,10 @@ function dethide(id)
352
  else
353
  break;
354
  $offset += $limit;
355
- if(!is_array($pagearray1->paging))
356
- break;
357
- }while(array_key_exists("next", $pagearray1->paging));
358
-
359
 
360
 
361
 
@@ -440,19 +460,34 @@ function dethide(id)
440
  $xyz_fbap_premium_version_ads=$_POST['xyz_fbap_premium_version_ads'];
441
  $xyz_fbap_default_selection_edit=$_POST['xyz_fbap_default_selection_edit'];
442
 
 
443
  $fbap_customtype_ids="";
444
 
 
 
 
 
 
445
  if($xyz_customtypes!="")
446
  {
447
  for($i=0;$i<count($xyz_customtypes);$i++)
448
  {
449
  $fbap_customtype_ids.=$xyz_customtypes[$i].",";
450
  }
451
-
452
  }
453
  $fbap_customtype_ids=rtrim($fbap_customtype_ids,',');
454
 
455
-
 
 
 
 
 
 
 
 
 
 
456
  update_option('xyz_fbap_include_pages',$xyz_fbap_include_pages);
457
  update_option('xyz_fbap_include_posts',$xyz_fbap_include_posts);
458
  if($xyz_fbap_include_posts==0)
@@ -463,13 +498,15 @@ function dethide(id)
463
  update_option('xyz_fbap_peer_verification',$xyz_fbap_peer_verification);
464
  update_option('xyz_fbap_premium_version_ads',$xyz_fbap_premium_version_ads);
465
  update_option('xyz_fbap_default_selection_edit',$xyz_fbap_default_selection_edit);
 
466
  }
467
-
468
  $xyz_credit_link=get_option('xyz_credit_link');
469
  $xyz_fbap_include_pages=get_option('xyz_fbap_include_pages');
470
  $xyz_fbap_include_posts=get_option('xyz_fbap_include_posts');
471
  $xyz_fbap_include_categories=get_option('xyz_fbap_include_categories');
472
  $xyz_fbap_include_customposttypes=get_option('xyz_fbap_include_customposttypes');
 
473
  $xyz_fbap_peer_verification=esc_html(get_option('xyz_fbap_peer_verification'));
474
  $xyz_fbap_premium_version_ads=esc_html(get_option('xyz_fbap_premium_version_ads'));
475
  $xyz_fbap_default_selection_edit=esc_html(get_option('xyz_fbap_default_selection_edit'));
@@ -618,9 +655,51 @@ function dethide(id)
618
  <option value ="0" <?php if($xyz_fbap_peer_verification=='0') echo 'selected'; ?> >Disable </option>
619
  </select>
620
  </td></tr>
621
-
622
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
 
 
 
 
 
 
 
 
 
 
 
624
  <tr valign="top">
625
 
626
  <td colspan="1">Enable credit link to author
14
 
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
+ ?>
22
+ <style type='text/css'>
23
+ #fb_notice_td
24
+ {
25
+ display:none;
26
+ }
27
+ </style>
28
+ <div class="system_notice_area_style1" id="system_notice_area">
29
+ Thanks again for using the plugin. We will never show the message again.
30
+ &nbsp;&nbsp;&nbsp;<span
31
+ id="system_notice_area_dismiss">Dismiss</span>
32
+ </div>
33
+ <?php
34
+ }
35
+
36
+
37
  $erf=0;
38
  if(isset($_POST['fb']))
39
  {
372
  else
373
  break;
374
  $offset += $limit;
375
+ // if(!is_array($pagearray1->paging))
376
+ // break;
377
+ // }while(array_key_exists("next", $pagearray1->paging));
378
+ }while(isset($pagearray1->paging->next));
379
 
380
 
381
 
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
+ $xyz_fbap_future_to_publish=$_POST['xyz_fbap_future_to_publish'];
464
  $fbap_customtype_ids="";
465
 
466
+ $xyz_fbap_applyfilters="";
467
+ if(isset($_POST['xyz_fbap_applyfilters']))
468
+ $xyz_fbap_applyfilters=$_POST['xyz_fbap_applyfilters'];
469
+
470
+
471
  if($xyz_customtypes!="")
472
  {
473
  for($i=0;$i<count($xyz_customtypes);$i++)
474
  {
475
  $fbap_customtype_ids.=$xyz_customtypes[$i].",";
476
  }
 
477
  }
478
  $fbap_customtype_ids=rtrim($fbap_customtype_ids,',');
479
 
480
+ $xyz_fbap_applyfilters_val="";
481
+ if($xyz_fbap_applyfilters!="")
482
+ {
483
+ for($i=0;$i<count($xyz_fbap_applyfilters);$i++)
484
+ {
485
+ $xyz_fbap_applyfilters_val.=$xyz_fbap_applyfilters[$i].",";
486
+ }
487
+ }
488
+ $xyz_fbap_applyfilters_val=rtrim($xyz_fbap_applyfilters_val,',');
489
+
490
+ update_option('xyz_fbap_apply_filters',$xyz_fbap_applyfilters_val);
491
  update_option('xyz_fbap_include_pages',$xyz_fbap_include_pages);
492
  update_option('xyz_fbap_include_posts',$xyz_fbap_include_posts);
493
  if($xyz_fbap_include_posts==0)
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('xyz_fbap_future_to_publish',$xyz_fbap_future_to_publish);
502
  }
503
+ $xyz_fbap_future_to_publish=get_option('xyz_fbap_future_to_publish');
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');
507
  $xyz_fbap_include_categories=get_option('xyz_fbap_include_categories');
508
  $xyz_fbap_include_customposttypes=get_option('xyz_fbap_include_customposttypes');
509
+ $xyz_fbap_apply_filters=get_option('xyz_fbap_apply_filters');
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'));
655
  <option value ="0" <?php if($xyz_fbap_peer_verification=='0') echo 'selected'; ?> >Disable </option>
656
  </select>
657
  </td></tr>
658
+
659
+ <tr valign="top">
660
+ <td scope="row" colspan="1">Apply filters during publishing </td>
661
+ <td>
662
+ <?php
663
+ $ar2=explode(",",$xyz_fbap_apply_filters);
664
+ for ($i=0;$i<3;$i++ ) {
665
+ $filVal=$i+1;
666
+
667
+ if($filVal==1)
668
+ $filName='the_content';
669
+ else if($filVal==2)
670
+ $filName='the_excerpt';
671
+ else if($filVal==3)
672
+ $filName='the_title';
673
+ else $filName='';
674
+
675
+ echo '<input type="checkbox" name="xyz_fbap_applyfilters[]" value="'.$filVal.'" ';
676
+ if(in_array($filVal, $ar2))
677
+ {
678
+ echo 'checked="checked"/>';
679
+ }
680
+ else
681
+ echo '/>';
682
+
683
+ echo '<label>'.$filName.'</label><br/>';
684
+
685
+ }
686
+
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
 
705
  <td colspan="1">Enable credit link to author
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.2.3
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  License: GPLv2 or later
@@ -54,6 +54,7 @@ require_once( dirname( __FILE__ ) . '/api/facebook.php' );
54
  require_once( dirname( __FILE__ ) . '/admin/ajax-backlink.php' );
55
  require_once( dirname( __FILE__ ) . '/admin/metabox.php' );
56
  require_once( dirname( __FILE__ ) . '/admin/publish.php' );
 
57
  if(get_option('xyz_credit_link')=="fbap"){
58
 
59
  add_action('wp_footer', 'xyz_fbap_credit');
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.2.4
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  License: GPLv2 or later
54
  require_once( dirname( __FILE__ ) . '/admin/ajax-backlink.php' );
55
  require_once( dirname( __FILE__ ) . '/admin/metabox.php' );
56
  require_once( dirname( __FILE__ ) . '/admin/publish.php' );
57
+ require_once( dirname( __FILE__ ) . '/admin/admin-notices.php' );
58
  if(get_option('xyz_credit_link')=="fbap"){
59
 
60
  add_action('wp_footer', 'xyz_fbap_credit');
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: 2.8
6
- Tested up to: 4.2.1
7
- Stable tag: 1.2.3
8
  License: GPLv2 or later
9
 
10
  Publish posts automatically to Facebook page or profile.
@@ -122,6 +122,13 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
 
 
125
  = Facebook Auto Publish 1.2.3 =
126
  * Fixed category display issue
127
  * Removed outdated facebook scopes from authorization
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: 2.8
6
+ Tested up to: 4.3
7
+ Stable tag: 1.2.4
8
  License: GPLv2 or later
9
 
10
  Publish posts automatically to Facebook page or profile.
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
128
+ * Resolved issue in fetching facebook pages in settings page (in case of more than 100 pages)
129
+ * Inline edit of posts will work according to the value set for "Default selection of auto publish while editing posts/pages"
130
+ * Latest five auto publish logs are maintained
131
+
132
  = Facebook Auto Publish 1.2.3 =
133
  * Fixed category display issue
134
  * Removed outdated facebook scopes from authorization