WP Facebook Auto Publish - Version 1.2

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
Comparing to
See all releases

Code changes from version 1.1.2 to 1.2

admin/about.php CHANGED
@@ -68,7 +68,7 @@ Facebook Auto Publish automatically publishes posts from your blog to your Face
68
  </tr>
69
  <!-- Posting Options -->
70
  <tr>
71
- <td rowspan="10"><h4>Posting Options</h4></td>
72
  <td>Publish to facebook profile/pages</td>
73
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
74
  </td>
@@ -132,6 +132,14 @@ Facebook Auto Publish automatically publishes posts from your blog to your Face
132
  </td>
133
  </tr>
134
 
 
 
 
 
 
 
 
 
135
  <tr>
136
  <td>Hash Tags support for Facebook, Twitter, Pinterest and Google plus</td>
137
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
@@ -161,7 +169,7 @@ Facebook Auto Publish automatically publishes posts from your blog to your Face
161
 
162
 
163
  <tr>
164
- <td>Seperate image url for publishing to multiple social media accounts</td>
165
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
166
  </td>
167
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
@@ -179,7 +187,7 @@ Facebook Auto Publish automatically publishes posts from your blog to your Face
179
  <!-- Filter Options -->
180
 
181
  <tr>
182
- <td rowspan="4"><h4>Filter Options</h4></td>
183
  <td>Filter posts to publish based on categories</td>
184
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
185
  </td>
@@ -195,6 +203,14 @@ Facebook Auto Publish automatically publishes posts from your blog to your Face
195
  </td>
196
  </tr>
197
 
 
 
 
 
 
 
 
 
198
  <tr>
199
  <td>Category filter for individual accounts</td>
200
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
@@ -211,6 +227,13 @@ Facebook Auto Publish automatically publishes posts from your blog to your Face
211
  </td>
212
  </tr>
213
 
 
 
 
 
 
 
 
214
 
215
  <!-- Scheduling -->
216
 
68
  </tr>
69
  <!-- Posting Options -->
70
  <tr>
71
+ <td rowspan="11"><h4>Posting Options</h4></td>
72
  <td>Publish to facebook profile/pages</td>
73
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
74
  </td>
132
  </td>
133
  </tr>
134
 
135
+ <tr>
136
+ <td>Save auto publish settings of individual posts</td>
137
+ <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
138
+ </td>
139
+ <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
140
+ </td>
141
+ </tr>
142
+
143
  <tr>
144
  <td>Hash Tags support for Facebook, Twitter, Pinterest and Google plus</td>
145
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
169
 
170
 
171
  <tr>
172
+ <td>Separate default image url for publishing to multiple social media accounts</td>
173
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
174
  </td>
175
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
187
  <!-- Filter Options -->
188
 
189
  <tr>
190
+ <td rowspan="6"><h4>Filter Options</h4></td>
191
  <td>Filter posts to publish based on categories</td>
192
  <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
193
  </td>
203
  </td>
204
  </tr>
205
 
206
+ <tr>
207
+ <td>Configuration to enable/disable page publishing</td>
208
+ <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
209
+ </td>
210
+ <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
211
+ </td>
212
+ </tr>
213
+
214
  <tr>
215
  <td>Category filter for individual accounts</td>
216
  <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
227
  </td>
228
  </tr>
229
 
230
+ <tr>
231
+ <td>Enable/Disable page publishing for individual accounts</td>
232
+ <td><img src="<?php echo plugins_url("images/cross.png",__FILE__);?>">
233
+ </td>
234
+ <td><img src="<?php echo plugins_url("images/tick.png",__FILE__);?>">
235
+ </td>
236
+ </tr>
237
 
238
  <!-- Scheduling -->
239
 
admin/authorization.php CHANGED
@@ -43,6 +43,7 @@ if(isset($_COOKIE['xyz_fbap_session_state']) && isset($_REQUEST['state']) && ($_
43
  $access_token = $params['access_token'];
44
  }
45
  }
 
46
  if($access_token!="")
47
  {
48
 
43
  $access_token = $params['access_token'];
44
  }
45
  }
46
+
47
  if($access_token!="")
48
  {
49
 
admin/destruction.php CHANGED
@@ -42,12 +42,13 @@ function fbap_free_destroy()
42
  delete_option('xyz_fbap_free_version');
43
 
44
  delete_option('xyz_fbap_include_pages');
 
45
  delete_option('xyz_fbap_include_categories');
46
  delete_option('xyz_fbap_include_customposttypes');
47
  delete_option('xyz_fbap_peer_verification');
48
  delete_option('xyz_fbap_post_logs');
49
  delete_option('xyz_twap_premium_version_ads');
50
-
51
  }
52
 
53
  register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
42
  delete_option('xyz_fbap_free_version');
43
 
44
  delete_option('xyz_fbap_include_pages');
45
+ delete_option('xyz_fbap_include_posts');
46
  delete_option('xyz_fbap_include_categories');
47
  delete_option('xyz_fbap_include_customposttypes');
48
  delete_option('xyz_fbap_peer_verification');
49
  delete_option('xyz_fbap_post_logs');
50
  delete_option('xyz_twap_premium_version_ads');
51
+ delete_option('xyz_fbap_default_selection_edit');
52
  }
53
 
54
  register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
admin/footer.php CHANGED
@@ -160,7 +160,8 @@ Our Plugins :
160
  <a target="_blank" href="http://wordpress.org/plugins/quick-bar/">Quick Bar</a> ★
161
  <a target="_blank" href="http://wordpress.org/plugins/quick-box-popup/">Quick Box Popup</a> ★
162
  <a target="_blank" href="http://wordpress.org/plugins/social-media-auto-publish/">Social Media Auto Publish</a> ★
163
- <a target="_blank" href="http://wordpress.org/plugins/twitter-auto-publish/">Twitter Auto Publish</a>
 
164
  </div>
165
 
166
  <div style="padding-top: 10px;text-align: center;">
160
  <a target="_blank" href="http://wordpress.org/plugins/quick-bar/">Quick Bar</a> ★
161
  <a target="_blank" href="http://wordpress.org/plugins/quick-box-popup/">Quick Box Popup</a> ★
162
  <a target="_blank" href="http://wordpress.org/plugins/social-media-auto-publish/">Social Media Auto Publish</a> ★
163
+ <a target="_blank" href="http://wordpress.org/plugins/twitter-auto-publish/">Twitter Auto Publish</a>
164
+ <a target="_blank" href="http://wordpress.org/plugins/custom-field-manager/">Custom Field Manager</a>
165
  </div>
166
 
167
  <div style="padding-top: 10px;text-align: center;">
admin/install.php CHANGED
@@ -50,13 +50,15 @@ function fbap_install_free()
50
  update_option('xyz_fbap_free_version', $currentversion);
51
 
52
  add_option('xyz_fbap_include_pages', '0');
 
53
  add_option('xyz_fbap_include_categories', 'All');
54
  add_option('xyz_fbap_include_customposttypes', '');
55
 
56
  add_option('xyz_fbap_peer_verification', '1');
57
  add_option('xyz_fbap_post_logs', '');
58
  add_option('xyz_fbap_premium_version_ads', '1');
59
-
 
60
  }
61
 
62
 
50
  update_option('xyz_fbap_free_version', $currentversion);
51
 
52
  add_option('xyz_fbap_include_pages', '0');
53
+ add_option('xyz_fbap_include_posts', '1');
54
  add_option('xyz_fbap_include_categories', 'All');
55
  add_option('xyz_fbap_include_customposttypes', '');
56
 
57
  add_option('xyz_fbap_peer_verification', '1');
58
  add_option('xyz_fbap_post_logs', '');
59
  add_option('xyz_fbap_premium_version_ads', '1');
60
+ add_option('xyz_fbap_default_selection_edit', '0');
61
+
62
  }
63
 
64
 
admin/metabox.php CHANGED
@@ -1,31 +1,33 @@
1
  <?php
2
  add_action( 'add_meta_boxes', 'xyz_fbap_add_custom_box' );
 
3
  function xyz_fbap_add_custom_box()
4
  {
5
  $posttype="";
6
  if(isset($_GET['post_type']))
7
- $posttype=$_GET['post_type'];
 
 
 
8
 
9
  if(isset($_GET['action']) && $_GET['action']=="edit")
10
  {
11
  $postid=$_GET['post'];
12
 
13
- $postpp= get_post($postid);
14
- if($postpp->post_status=="publish")
15
- add_meta_box("xyz_fbap1", ' ', 'xyz_fbap_addpostmetatags1') ;
16
 
17
  $get_post_meta=get_post_meta($postid,"xyz_fbap",true);
18
- if($get_post_meta==1)
19
- return ;
 
20
  global $wpdb;
21
  $table='posts';
22
  $accountCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.$table.' WHERE id="'.$postid.'" and post_status!="draft" LIMIT 0,1' ) ;
23
- if($accountCount>0)
24
- return ;
 
 
25
  }
26
 
27
- if($posttype=="")
28
- $posttype="post";
29
 
30
  if ($posttype=="page")
31
  {
@@ -34,6 +36,12 @@ if(isset($_GET['action']) && $_GET['action']=="edit")
34
  if($xyz_fbap_include_pages==0)
35
  return;
36
  }
 
 
 
 
 
 
37
  else if($posttype!="post")
38
  {
39
 
@@ -48,23 +56,14 @@ if(isset($_GET['action']) && $_GET['action']=="edit")
48
 
49
 
50
 
51
-
52
- if(get_option('xyz_fbap_af')==0 && get_option('xyz_fbap_fb_token')!="")
53
- add_meta_box( "xyz_fbap", '<strong>Facebook Auto Publish - Post Options</strong>', 'xyz_fbap_addpostmetatags') ;
54
- }
55
- function xyz_fbap_addpostmetatags1()
56
- {
57
- ?>
58
- <input type="hidden" name="xyz_fbap_hidden_meta" value="1" >
59
- <script type="text/javascript">
60
- jQuery('#xyz_fbap1').hide();
61
- </script>
62
- <?php
63
  }
64
  function xyz_fbap_addpostmetatags()
65
  {
66
  $imgpath= plugins_url()."/facebook-auto-publish/admin/images/";
67
  $heimg=$imgpath."support.png";
 
68
  ?>
69
  <script>
70
 
@@ -103,11 +102,86 @@ function dethide_fbap(id)
103
  }
104
 
105
 
106
- </script>
107
- <table class="xyz_fbap_metalist_table">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
- <tr><td colspan="2" >
 
 
 
 
 
 
 
 
 
 
 
 
110
 
 
 
 
 
 
 
 
111
  <table class="xyz_fbap_meta_acclist_table"><!-- FB META -->
112
 
113
 
@@ -123,11 +197,10 @@ function dethide_fbap(id)
123
  <td class="xyz_fbap_pleft15" width="60%">Enable auto publish post to my facebook account
124
  </td>
125
  <td width="40%"><select id="xyz_fbap_post_permission" name="xyz_fbap_post_permission"
126
- onchange="displaycheck_fbap()"><option value="0"
127
- <?php if(get_option('xyz_fbap_post_prmission')==0) echo 'selected';?>>
128
  No</option>
129
  <option value="1"
130
- <?php if(get_option('xyz_fbap_post_permission')==1) echo 'selected';?>>Yes</option>
131
  </select>
132
  </td>
133
  </tr>
@@ -184,7 +257,7 @@ function dethide_fbap(id)
184
  </td></tr>
185
 
186
  </table>
187
-
188
  </td></tr>
189
 
190
 
@@ -192,6 +265,29 @@ function dethide_fbap(id)
192
  <script type="text/javascript">
193
  displaycheck_fbap();
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  function xyz_fbap_info_insert(inf){
196
 
197
  var e = document.getElementById("xyz_fbap_info");
1
  <?php
2
  add_action( 'add_meta_boxes', 'xyz_fbap_add_custom_box' );
3
+ $GLOBALS['edit_flag']=0;
4
  function xyz_fbap_add_custom_box()
5
  {
6
  $posttype="";
7
  if(isset($_GET['post_type']))
8
+ $posttype=$_GET['post_type'];
9
+
10
+ if($posttype=="")
11
+ $posttype="post";
12
 
13
  if(isset($_GET['action']) && $_GET['action']=="edit")
14
  {
15
  $postid=$_GET['post'];
16
 
 
 
 
17
 
18
  $get_post_meta=get_post_meta($postid,"xyz_fbap",true);
19
+ if($get_post_meta==1){
20
+ $GLOBALS['edit_flag']=1;
21
+ }
22
  global $wpdb;
23
  $table='posts';
24
  $accountCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.$table.' WHERE id="'.$postid.'" and post_status!="draft" LIMIT 0,1' ) ;
25
+ if($accountCount>0){
26
+ $GLOBALS['edit_flag']=1;
27
+ }
28
+ $posttype=get_post_type($postid);
29
  }
30
 
 
 
31
 
32
  if ($posttype=="page")
33
  {
36
  if($xyz_fbap_include_pages==0)
37
  return;
38
  }
39
+ else if($posttype=="post")
40
+ {
41
+ $xyz_fbap_include_posts=get_option('xyz_fbap_include_posts');
42
+ if($xyz_fbap_include_posts==0)
43
+ return;
44
+ }
45
  else if($posttype!="post")
46
  {
47
 
56
 
57
 
58
 
59
+ if(get_option('xyz_fbap_af')==0 && get_option('xyz_fbap_fb_token')!="" && get_option('xyz_fbap_post_permission')==1)
60
+ add_meta_box( "xyz_fbap", '<strong>Facebook Auto Publish </strong>', 'xyz_fbap_addpostmetatags') ;
 
 
 
 
 
 
 
 
 
 
61
  }
62
  function xyz_fbap_addpostmetatags()
63
  {
64
  $imgpath= plugins_url()."/facebook-auto-publish/admin/images/";
65
  $heimg=$imgpath."support.png";
66
+ $xyz_fbap_catlist=get_option('xyz_fbap_include_categories');
67
  ?>
68
  <script>
69
 
102
  }
103
 
104
 
105
+ jQuery(document).ready(function() {
106
+
107
+ jQuery('#category-all').bind("DOMSubtreeModified",function(){
108
+ get_categorylist(1);
109
+ });
110
+
111
+ get_categorylist(1);
112
+ jQuery('#category-all').on("click",'input[name="post_category[]"]',function() {
113
+ get_categorylist(1);
114
+ });
115
+
116
+ jQuery('#category-pop').on("click",'input[type="checkbox"]',function() {
117
+ get_categorylist(2);
118
+ });
119
+ });
120
+
121
+ function get_categorylist(val)
122
+ {
123
+ var cat_list="";var chkdArray=new Array();var cat_list_array=new Array();
124
+ var posttype="<?php echo get_post_type() ;?>";
125
+ if(val==1){
126
+ jQuery('input[name="post_category[]"]:checked').each(function() {
127
+ cat_list+=this.value+",";
128
+ });
129
+ }else if(val==2)
130
+ {
131
+ jQuery('#category-pop input[type="checkbox"]:checked').each(function() {
132
+
133
+ cat_list+=this.value+",";
134
+ });
135
+ }
136
+ if (cat_list.charAt(cat_list.length - 1) == ',') {
137
+ cat_list = cat_list.substr(0, cat_list.length - 1);
138
+ }
139
+ jQuery('#cat_list').val(cat_list);
140
+
141
+ var xyz_fbap_catlist="<?php echo $xyz_fbap_catlist;?>";
142
+ if(xyz_fbap_catlist!="All")
143
+ {
144
+ cat_list_array=xyz_fbap_catlist.split(',');
145
+ var show_flag=1;
146
+ var chkdcatvals=jQuery('#cat_list').val();
147
+ chkdArray=chkdcatvals.split(',');
148
+
149
+ for(var x=0;x<chkdArray.length;x++) {
150
+
151
+ if(inArray(chkdArray[x], cat_list_array))
152
+ {
153
+ show_flag=1;
154
+ break;
155
+ }
156
+ else
157
+ {
158
+ show_flag=0;
159
+ continue;
160
+ }
161
+
162
+ }
163
 
164
+ if(show_flag==0 && posttype=="post")
165
+ jQuery('#xyz_fbMetabox').hide();
166
+ else
167
+ jQuery('#xyz_fbMetabox').show();
168
+ }
169
+ }
170
+ function inArray(needle, haystack) {
171
+ var length = haystack.length;
172
+ for(var i = 0; i < length; i++) {
173
+ if(haystack[i] == needle) return true;
174
+ }
175
+ return false;
176
+ }
177
 
178
+
179
+ </script>
180
+ <table class="xyz_fbap_metalist_table">
181
+ <input type="hidden" name="cat_list" id="cat_list" value="">
182
+ <input type="hidden" name="xyz_fbap_post" id="xyz_fbap_post" value="0" >
183
+ <tr id="xyz_fbMetabox"><td colspan="2" >
184
+ <?php if(get_option('xyz_fbap_post_permission')==1) {?>
185
  <table class="xyz_fbap_meta_acclist_table"><!-- FB META -->
186
 
187
 
197
  <td class="xyz_fbap_pleft15" width="60%">Enable auto publish post to my facebook account
198
  </td>
199
  <td width="40%"><select id="xyz_fbap_post_permission" name="xyz_fbap_post_permission"
200
+ onchange="displaycheck_fbap()"><option value="0" >
 
201
  No</option>
202
  <option value="1"
203
+ <?php echo 'selected';?>>Yes</option>
204
  </select>
205
  </td>
206
  </tr>
257
  </td></tr>
258
 
259
  </table>
260
+ <?php }?>
261
  </td></tr>
262
 
263
 
265
  <script type="text/javascript">
266
  displaycheck_fbap();
267
 
268
+ var edit_flag="<?php echo $GLOBALS['edit_flag'];?>";
269
+ if(edit_flag==1)
270
+ load_edit_action();
271
+
272
+ function load_edit_action()
273
+ {
274
+ document.getElementById("xyz_fbap_post").value=1;
275
+ var xyz_fbap_default_selection_edit="<?php echo get_option('xyz_fbap_default_selection_edit');?>";
276
+ if(xyz_fbap_default_selection_edit=="")
277
+ xyz_fbap_default_selection_edit=0;
278
+ if(xyz_fbap_default_selection_edit==1)
279
+ return;
280
+
281
+ if(document.getElementById("xyz_fbap_post_permission"))
282
+ {
283
+ document.getElementById("xyz_fbap_post_permission").value=0;
284
+ document.getElementById("fpabpmd").style.display='none';
285
+ document.getElementById("fpabpmf").style.display='none';
286
+ document.getElementById("fpabpmftarea").style.display='none';
287
+ }
288
+ }
289
+
290
+
291
  function xyz_fbap_info_insert(inf){
292
 
293
  var e = document.getElementById("xyz_fbap_info");
admin/publish.php CHANGED
@@ -2,6 +2,12 @@
2
 
3
  add_action('publish_post', 'xyz_fbap_link_publish');
4
  add_action('publish_page', 'xyz_fbap_link_publish');
 
 
 
 
 
 
5
 
6
 
7
 
@@ -14,14 +20,22 @@ foreach ($carr as $cstyps ) {
14
 
15
  function xyz_fbap_link_publish($post_ID) {
16
 
 
 
17
  if(isset($_POST['xyz_fbap_hidden_meta']) && $_POST['xyz_fbap_hidden_meta']==1)
 
 
18
  return ;
 
19
 
20
  $get_post_meta=get_post_meta($post_ID,"xyz_fbap",true);
21
  if($get_post_meta!=1)
22
  add_post_meta($post_ID, "xyz_fbap", "1");
23
- else
 
 
24
  return;
 
25
  global $current_user;
26
  get_currentuserinfo();
27
 
@@ -52,7 +66,7 @@ function xyz_fbap_link_publish($post_ID) {
52
 
53
  foreach( $entries0 as $entry ) {
54
  $user_nicename=$entry->user_nicename;}
55
- if ($postpp->post_status == 'publish' || $postpp->post_status == 'future')
56
  {
57
  $posttype=$postpp->post_type;
58
  $fb_publish_status=array();
@@ -62,11 +76,20 @@ function xyz_fbap_link_publish($post_ID) {
62
 
63
  $xyz_fbap_include_pages=get_option('xyz_fbap_include_pages');
64
  if($xyz_fbap_include_pages==0)
 
 
65
  return;
 
66
  }
67
 
68
  if($posttype=="post")
69
  {
 
 
 
 
 
 
70
  $xyz_fbap_include_categories=get_option('xyz_fbap_include_categories');
71
  if($xyz_fbap_include_categories!="All")
72
  {
@@ -83,7 +106,10 @@ function xyz_fbap_link_publish($post_ID) {
83
 
84
 
85
  if($retflag==1)
 
 
86
  return;
 
87
  }
88
  }
89
 
@@ -144,6 +170,7 @@ function xyz_fbap_link_publish($post_ID) {
144
 
145
  if($useracces_token!="" && $appsecret!="" && $appid!="" && $post_permissin==1)
146
  {
 
147
 
148
  $user_page_id=get_option('xyz_fbap_fb_numericid');
149
 
@@ -189,7 +216,7 @@ function xyz_fbap_link_publish($post_ID) {
189
  'link' => $link,
190
  'name' => $name,
191
  'caption' => $caption,
192
- 'description' => $description,
193
  'actions' => array(array('name' => $name,
194
  'link' => $link)),
195
  'picture' => $attachmenturl
@@ -203,7 +230,7 @@ function xyz_fbap_link_publish($post_ID) {
203
  'link' => $link,
204
  'name' => $name,
205
  'caption' => $caption,
206
- 'description' => $description,
207
  'picture' => $attachmenturl
208
 
209
 
@@ -284,7 +311,7 @@ function xyz_fbap_link_publish($post_ID) {
284
 
285
  }
286
 
287
-
288
  }
289
 
290
  ?>
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;
9
+ xyz_fbap_link_publish($postid);
10
+ }
11
 
12
 
13
 
20
 
21
  function xyz_fbap_link_publish($post_ID) {
22
 
23
+ $_POST_CPY=$_POST;
24
+ $_POST=stripslashes_deep($_POST);
25
  if(isset($_POST['xyz_fbap_hidden_meta']) && $_POST['xyz_fbap_hidden_meta']==1)
26
+ {
27
+ $_POST=$_POST_CPY;
28
  return ;
29
+ }
30
 
31
  $get_post_meta=get_post_meta($post_ID,"xyz_fbap",true);
32
  if($get_post_meta!=1)
33
  add_post_meta($post_ID, "xyz_fbap", "1");
34
+ else
35
+ {
36
+ $_POST=$_POST_CPY;
37
  return;
38
+ }
39
  global $current_user;
40
  get_currentuserinfo();
41
 
66
 
67
  foreach( $entries0 as $entry ) {
68
  $user_nicename=$entry->user_nicename;}
69
+ if ($postpp->post_status == 'publish')
70
  {
71
  $posttype=$postpp->post_type;
72
  $fb_publish_status=array();
76
 
77
  $xyz_fbap_include_pages=get_option('xyz_fbap_include_pages');
78
  if($xyz_fbap_include_pages==0)
79
+ {
80
+ $_POST=$_POST_CPY;
81
  return;
82
+ }
83
  }
84
 
85
  if($posttype=="post")
86
  {
87
+ $xyz_fbap_include_posts=get_option('xyz_fbap_include_posts');
88
+ if($xyz_fbap_include_posts==0)
89
+ {
90
+ $_POST=$_POST_CPY;return;
91
+ }
92
+
93
  $xyz_fbap_include_categories=get_option('xyz_fbap_include_categories');
94
  if($xyz_fbap_include_categories!="All")
95
  {
106
 
107
 
108
  if($retflag==1)
109
+ {
110
+ $_POST=$_POST_CPY;
111
  return;
112
+ }
113
  }
114
  }
115
 
170
 
171
  if($useracces_token!="" && $appsecret!="" && $appid!="" && $post_permissin==1)
172
  {
173
+ $description_li=xyz_fbap_string_limit($description, 10000);
174
 
175
  $user_page_id=get_option('xyz_fbap_fb_numericid');
176
 
216
  'link' => $link,
217
  'name' => $name,
218
  'caption' => $caption,
219
+ 'description' => $description_li,
220
  'actions' => array(array('name' => $name,
221
  'link' => $link)),
222
  'picture' => $attachmenturl
230
  'link' => $link,
231
  'name' => $name,
232
  'caption' => $caption,
233
+ 'description' => $description_li,
234
  'picture' => $attachmenturl
235
 
236
 
311
 
312
  }
313
 
314
+ $_POST=$_POST_CPY;
315
  }
316
 
317
  ?>
admin/settings.php CHANGED
@@ -245,6 +245,7 @@ function dethide(id)
245
  <td><input id="xyz_fbap_application_id"
246
  name="xyz_fbap_application_id" type="text"
247
  value="<?php if($ms1=="") {echo esc_html(get_option('xyz_fbap_application_id'));}?>" />
 
248
  </td>
249
  </tr>
250
 
@@ -262,6 +263,7 @@ function dethide(id)
262
  </td>
263
  <td><input id="xyz_fbap_fb_id" name="xyz_fbap_fb_id" type="text"
264
  value="<?php if($ms3=="") {echo esc_html(get_option('xyz_fbap_fb_id'));}?>" />
 
265
  </td>
266
  </tr>
267
  <tr valign="top">
@@ -322,7 +324,7 @@ function dethide(id)
322
  </td>
323
  <td><select id="xyz_fbap_post_permission"
324
  name="xyz_fbap_post_permission"><option value="0"
325
- <?php if(get_option('xyz_fbap_post_prmission')==0) echo 'selected';?>>
326
  No</option>
327
  <option value="1"
328
  <?php if(get_option('xyz_fbap_post_permission')==1) echo 'selected';?>>Yes</option>
@@ -421,9 +423,9 @@ function dethide(id)
421
  if(isset($_POST['bsettngs']))
422
  {
423
 
424
-
425
  $xyz_fbap_include_pages=$_POST['xyz_fbap_include_pages'];
426
-
 
427
  if($_POST['xyz_fbap_cat_all']=="All")
428
  $fbap_category_ids=$_POST['xyz_fbap_cat_all'];//redio btn name
429
  else
@@ -436,7 +438,8 @@ function dethide(id)
436
 
437
  $xyz_fbap_peer_verification=$_POST['xyz_fbap_peer_verification'];
438
  $xyz_fbap_premium_version_ads=$_POST['xyz_fbap_premium_version_ads'];
439
-
 
440
  $fbap_customtype_ids="";
441
 
442
  if($xyz_customtypes!="")
@@ -451,20 +454,25 @@ function dethide(id)
451
 
452
 
453
  update_option('xyz_fbap_include_pages',$xyz_fbap_include_pages);
454
- update_option('xyz_fbap_include_categories',$fbap_category_ids);
 
 
 
 
455
  update_option('xyz_fbap_include_customposttypes',$fbap_customtype_ids);
456
  update_option('xyz_fbap_peer_verification',$xyz_fbap_peer_verification);
457
  update_option('xyz_fbap_premium_version_ads',$xyz_fbap_premium_version_ads);
458
-
459
  }
460
 
461
  $xyz_credit_link=get_option('xyz_credit_link');
462
  $xyz_fbap_include_pages=get_option('xyz_fbap_include_pages');
 
463
  $xyz_fbap_include_categories=get_option('xyz_fbap_include_categories');
464
  $xyz_fbap_include_customposttypes=get_option('xyz_fbap_include_customposttypes');
465
  $xyz_fbap_peer_verification=esc_html(get_option('xyz_fbap_peer_verification'));
466
  $xyz_fbap_premium_version_ads=esc_html(get_option('xyz_fbap_premium_version_ads'));
467
-
468
 
469
  ?>
470
  <h2>Basic Settings</h2>
@@ -476,7 +484,7 @@ function dethide(id)
476
 
477
  <tr valign="top">
478
 
479
- <td colspan="1" width="50%">Publish wordpress `pages` to social media
480
  </td>
481
  <td><select name="xyz_fbap_include_pages">
482
 
@@ -491,7 +499,22 @@ function dethide(id)
491
 
492
  <tr valign="top">
493
 
494
- <td colspan="1">Select wordpress categories for auto publish
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  </td>
496
  <td><input type="hidden"
497
  value="<?php echo $xyz_fbap_include_categories;?>"
@@ -572,6 +595,18 @@ function dethide(id)
572
  </td>
573
  </tr>
574
 
 
 
 
 
 
 
 
 
 
 
 
 
575
  <tr valign="top">
576
 
577
  <td scope="row" colspan="1" width="50%">SSL peer verification </td><td><select name="xyz_fbap_peer_verification" >
@@ -640,12 +675,18 @@ function dethide(id)
640
  //drpdisplay();
641
  var catval='<?php echo $xyz_fbap_include_categories; ?>';
642
  var custtypeval='<?php echo $xyz_fbap_include_customposttypes; ?>';
 
643
  jQuery(document).ready(function() {
644
  if(catval=="All")
645
  jQuery("#cat_dropdown_span").hide();
646
  else
647
  jQuery("#cat_dropdown_span").show();
648
 
 
 
 
 
 
649
  });
650
 
651
  function setcat(obj)
@@ -698,6 +739,13 @@ function xyz_fbap_info_insert(inf){
698
  jQuery("textarea#xyz_fbap_message").focus();
699
 
700
  }
 
 
 
 
 
 
 
701
  </script>
702
  <?php
703
  ?>
245
  <td><input id="xyz_fbap_application_id"
246
  name="xyz_fbap_application_id" type="text"
247
  value="<?php if($ms1=="") {echo esc_html(get_option('xyz_fbap_application_id'));}?>" />
248
+ <a href="http://docs.xyzscripts.com/wordpress-plugins/social-media-auto-publish/creating-facebook-application" target="_blank">How can I create a Facebook Application?</a>
249
  </td>
250
  </tr>
251
 
263
  </td>
264
  <td><input id="xyz_fbap_fb_id" name="xyz_fbap_fb_id" type="text"
265
  value="<?php if($ms3=="") {echo esc_html(get_option('xyz_fbap_fb_id'));}?>" />
266
+ <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>
267
  </td>
268
  </tr>
269
  <tr valign="top">
324
  </td>
325
  <td><select id="xyz_fbap_post_permission"
326
  name="xyz_fbap_post_permission"><option value="0"
327
+ <?php if(get_option('xyz_fbap_post_permission')==0) echo 'selected';?>>
328
  No</option>
329
  <option value="1"
330
  <?php if(get_option('xyz_fbap_post_permission')==1) echo 'selected';?>>Yes</option>
423
  if(isset($_POST['bsettngs']))
424
  {
425
 
 
426
  $xyz_fbap_include_pages=$_POST['xyz_fbap_include_pages'];
427
+ $xyz_fbap_include_posts=$_POST['xyz_fbap_include_posts'];
428
+
429
  if($_POST['xyz_fbap_cat_all']=="All")
430
  $fbap_category_ids=$_POST['xyz_fbap_cat_all'];//redio btn name
431
  else
438
 
439
  $xyz_fbap_peer_verification=$_POST['xyz_fbap_peer_verification'];
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!="")
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)
459
+ update_option('xyz_fbap_include_categories',"All");
460
+ else
461
+ update_option('xyz_fbap_include_categories',$fbap_category_ids);
462
  update_option('xyz_fbap_include_customposttypes',$fbap_customtype_ids);
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'));
476
 
477
  ?>
478
  <h2>Basic Settings</h2>
484
 
485
  <tr valign="top">
486
 
487
+ <td colspan="1" width="50%">Publish wordpress `pages` to facebook
488
  </td>
489
  <td><select name="xyz_fbap_include_pages">
490
 
499
 
500
  <tr valign="top">
501
 
502
+ <td colspan="1">Publish wordpress `posts` to facebook
503
+ </td>
504
+ <td><select name="xyz_fbap_include_posts" onchange="xyz_fbap_show_postCategory(this.value);">
505
+
506
+ <option value="1"
507
+ <?php if($xyz_fbap_include_posts=='1') echo 'selected'; ?>>Yes</option>
508
+
509
+ <option value="0"
510
+ <?php if($xyz_fbap_include_posts!='1') echo 'selected'; ?>>No</option>
511
+ </select>
512
+ </td>
513
+ </tr>
514
+
515
+ <tr valign="top" id="selPostCat">
516
+
517
+ <td colspan="1">Select post categories for auto publish
518
  </td>
519
  <td><input type="hidden"
520
  value="<?php echo $xyz_fbap_include_categories;?>"
595
  </td>
596
  </tr>
597
 
598
+ <tr valign="top">
599
+
600
+ <td scope="row" colspan="1" width="50%">Default selection of auto publish while editing posts/pages
601
+ </td><td><select name="xyz_fbap_default_selection_edit" >
602
+
603
+ <option value ="1" <?php if($xyz_fbap_default_selection_edit=='1') echo 'selected'; ?> >Yes </option>
604
+
605
+ <option value ="0" <?php if($xyz_fbap_default_selection_edit=='0') echo 'selected'; ?> >No </option>
606
+ </select>
607
+ </td>
608
+ </tr>
609
+
610
  <tr valign="top">
611
 
612
  <td scope="row" colspan="1" width="50%">SSL peer verification </td><td><select name="xyz_fbap_peer_verification" >
675
  //drpdisplay();
676
  var catval='<?php echo $xyz_fbap_include_categories; ?>';
677
  var custtypeval='<?php echo $xyz_fbap_include_customposttypes; ?>';
678
+ var get_opt_cats='<?php echo get_option('xyz_fbap_include_posts');?>';
679
  jQuery(document).ready(function() {
680
  if(catval=="All")
681
  jQuery("#cat_dropdown_span").hide();
682
  else
683
  jQuery("#cat_dropdown_span").show();
684
 
685
+ if(get_opt_cats==0)
686
+ jQuery('#selPostCat').hide();
687
+ else
688
+ jQuery('#selPostCat').show();
689
+
690
  });
691
 
692
  function setcat(obj)
739
  jQuery("textarea#xyz_fbap_message").focus();
740
 
741
  }
742
+ function xyz_fbap_show_postCategory(val)
743
+ {
744
+ if(val==0)
745
+ jQuery('#selPostCat').hide();
746
+ else
747
+ jQuery('#selPostCat').show();
748
+ }
749
  </script>
750
  <?php
751
  ?>
admin/style.css CHANGED
@@ -308,6 +308,11 @@ width: 100%;
308
  background: linear-gradient(to top, #ECECEC, #F9F9F9) repeat scroll 0 0 #F1F1F1;border-bottom: 1px solid #DFDFDF;height: 25px;
309
  }
310
 
 
 
 
 
 
311
  a {
312
  text-decoration: none;
313
  }
308
  background: linear-gradient(to top, #ECECEC, #F9F9F9) repeat scroll 0 0 #F1F1F1;border-bottom: 1px solid #DFDFDF;height: 25px;
309
  }
310
 
311
+ .xyz_fbap_meta_acclist_table select ,.xyz_fbap_meta_acclist_table textarea{
312
+ width: 200px;padding: 5px !important;height: 2.35em !important;
313
+ }
314
+
315
+
316
  a {
317
  text-decoration: none;
318
  }
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.1.2
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.2
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  License: GPLv2 or later
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.0
7
- Stable tag: 1.1.2
8
  License: GPLv2 or later
9
 
10
  Publish posts automatically to Facebook page or profile.
@@ -122,6 +122,12 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
 
125
  = Facebook Auto Publish 1.1.2 =
126
  * Fixed auto-publish of scheduled post
127
 
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.1
7
+ Stable tag: 1.2
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 =
126
+ * Option to configure auto publish settings while editing posts/pages
127
+ * General setting to enable/disable post publishing
128
+ * Added auto publish for scheduled post
129
+ * Fixed issue related to \" in auto publish
130
+
131
  = Facebook Auto Publish 1.1.2 =
132
  * Fixed auto-publish of scheduled post
133
 
xyz-functions.php CHANGED
@@ -89,12 +89,12 @@ function xyz_fbap_getimage($post_ID,$description_org)
89
 
90
  }
91
  else {
92
- preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/is', $description_org, $matches);
93
  if(isset($matches[1][0]))
94
  $attachmenturl = $matches[1][0];
95
  else {
96
  apply_filters('the_content', $description_org);
97
- preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/is', $description_org, $matches);
98
  if(isset($matches[1][0]))
99
  $attachmenturl = $matches[1][0];
100
  }
89
 
90
  }
91
  else {
92
+ preg_match_all( '/< *img[^>]*src *= *["\']?([^"\']*)/is', $description_org, $matches );
93
  if(isset($matches[1][0]))
94
  $attachmenturl = $matches[1][0];
95
  else {
96
  apply_filters('the_content', $description_org);
97
+ preg_match_all( '/< *img[^>]*src *= *["\']?([^"\']*)/is', $description_org, $matches );
98
  if(isset($matches[1][0]))
99
  $attachmenturl = $matches[1][0];
100
  }