WP Facebook Auto Publish - Version 1.4.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.4.2
Comparing to
See all releases

Code changes from version 1.4.1 to 1.4.2

admin/about.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  ?>
3
  <style>
4
  </style>
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  ?>
4
  <style>
5
  </style>
admin/admin-notices.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  function wp_fbap_admin_notice()
3
  {
4
  add_thickbox();
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  function wp_fbap_admin_notice()
4
  {
5
  add_thickbox();
admin/ajax-backlink.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  add_action('wp_ajax_xyz_fbap_ajax_backlink', 'xyz_fbap_ajax_backlink_call');
4
 
5
  function xyz_fbap_ajax_backlink_call() {
@@ -8,6 +8,14 @@ function xyz_fbap_ajax_backlink_call() {
8
  global $wpdb;
9
 
10
  if($_POST){
 
 
 
 
 
 
 
 
11
 
12
  update_option('xyz_credit_link','fbap');
13
  }
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  add_action('wp_ajax_xyz_fbap_ajax_backlink', 'xyz_fbap_ajax_backlink_call');
4
 
5
  function xyz_fbap_ajax_backlink_call() {
8
  global $wpdb;
9
 
10
  if($_POST){
11
+ if (! isset( $_POST['_wpnonce'] )
12
+ || ! wp_verify_nonce( $_POST['_wpnonce'],'backlink' )
13
+ ) {
14
+ echo 1;die;
15
+ // wp_nonce_ays( 'backlink' );
16
+ //exit();
17
+
18
+ }
19
 
20
  update_option('xyz_credit_link','fbap');
21
  }
admin/authorization.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  $app_id = get_option('xyz_fbap_application_id');
3
  $app_secret = get_option('xyz_fbap_application_secret');
4
  $redirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=1');
@@ -14,13 +15,22 @@ $code = $_REQUEST["code"];
14
 
15
  if(isset($_POST['fb_auth']))
16
  {
 
 
 
 
 
 
 
 
 
17
 
18
  $xyz_fbap_session_state = md5(uniqid(rand(), TRUE));
19
  setcookie("xyz_fbap_session_state",$xyz_fbap_session_state,"0","/");
20
 
21
  $dialog_url = "https://www.facebook.com/".XYZ_FBAP_FB_API_VERSION."/dialog/oauth?client_id="
22
  . $app_id . "&redirect_uri=" . $my_url . "&state="
23
- . $xyz_fbap_session_state . "&scope=email,public_profile,publish_pages,user_posts,publish_actions,manage_pages";
24
 
25
  header("Location: " . $dialog_url);
26
  }
@@ -105,6 +115,16 @@ if(isset($_COOKIE['xyz_fbap_session_state']) && isset($_REQUEST['state']) && ($_
105
  $newpgs=-1;
106
  }
107
  update_option('xyz_fbap_pages_ids',$newpgs);
 
 
 
 
 
 
 
 
 
 
108
  header("Location:".admin_url('admin.php?page=facebook-auto-publish-settings&auth=1'));
109
  }
110
  else
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  $app_id = get_option('xyz_fbap_application_id');
4
  $app_secret = get_option('xyz_fbap_application_secret');
5
  $redirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=1');
15
 
16
  if(isset($_POST['fb_auth']))
17
  {
18
+ if (! isset( $_REQUEST['_wpnonce'] )
19
+ || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'xyz_smap_fb_auth_nonce' )
20
+ ) {
21
+
22
+ wp_nonce_ays( 'xyz_smap_fb_auth_nonce' );
23
+
24
+ exit();
25
+
26
+ }
27
 
28
  $xyz_fbap_session_state = md5(uniqid(rand(), TRUE));
29
  setcookie("xyz_fbap_session_state",$xyz_fbap_session_state,"0","/");
30
 
31
  $dialog_url = "https://www.facebook.com/".XYZ_FBAP_FB_API_VERSION."/dialog/oauth?client_id="
32
  . $app_id . "&redirect_uri=" . $my_url . "&state="
33
+ . $xyz_fbap_session_state . "&scope=email,public_profile,publish_pages,user_posts,publish_actions,manage_pages,user_photos";
34
 
35
  header("Location: " . $dialog_url);
36
  }
115
  $newpgs=-1;
116
  }
117
  update_option('xyz_fbap_pages_ids',$newpgs);
118
+
119
+ $url = 'https://graph.facebook.com/'.XYZ_FBAP_FB_API_VERSION.'/me?access_token='.$access_token;
120
+ $contentget=wp_remote_get($url);$page_id='';
121
+ if(is_array($contentget))
122
+ {
123
+ $result1=$contentget['body'];
124
+ $pagearray = json_decode($result1);
125
+ $page_id=$pagearray->id;
126
+ }
127
+ update_option('xyz_fbap_fb_numericid',$page_id);
128
  header("Location:".admin_url('admin.php?page=facebook-auto-publish-settings&auth=1'));
129
  }
130
  else
admin/destruction.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  function fbap_free_network_destroy($networkwide) {
3
  global $wpdb;
4
  if (function_exists('is_multisite') && is_multisite()) {
@@ -26,7 +27,7 @@ function fbap_free_destroy()
26
  {
27
  update_option("xyz_credit_link", '0');
28
  }
29
-
30
  delete_option('xyz_fbap_application_id');
31
  delete_option('xyz_fbap_application_secret');
32
  //delete_option('xyz_fbap_fb_id');
@@ -50,7 +51,8 @@ function fbap_free_destroy()
50
  delete_option('xyz_twap_premium_version_ads');
51
  delete_option('xyz_fbap_default_selection_edit');
52
  delete_option('xyz_fbap_utf_decode_enable');
53
-
 
54
  }
55
 
56
  register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  function fbap_free_network_destroy($networkwide) {
4
  global $wpdb;
5
  if (function_exists('is_multisite') && is_multisite()) {
27
  {
28
  update_option("xyz_credit_link", '0');
29
  }
30
+ delete_option('xyz_fbap_application_name');
31
  delete_option('xyz_fbap_application_id');
32
  delete_option('xyz_fbap_application_secret');
33
  //delete_option('xyz_fbap_fb_id');
51
  delete_option('xyz_twap_premium_version_ads');
52
  delete_option('xyz_fbap_default_selection_edit');
53
  delete_option('xyz_fbap_utf_decode_enable');
54
+ delete_option('xyz_fbap_caption_for_fb_attachment');
55
+ delete_option('xyz_fbap_fb_numericid');
56
  }
57
 
58
  register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
admin/footer.php CHANGED
@@ -1,173 +1,175 @@
1
- <?php if(get_option('xyz_fbap_premium_version_ads')==1){?>
2
- <div id="xyz-wp-fbap-premium">
3
-
4
- <div style="float: left; padding: 0 5px">
5
- <h2 style="vertical-align: middle;">
6
- <a target="_blank"
7
- href="http://xyzscripts.com/wordpress-plugins/social-media-auto-publish/features">Fully
8
- Featured XYZ WP SMAP Premium Plugin</a> - Just 29 USD
9
- </h2>
10
- </div>
11
- <div style="float: left; margin-top: 3px">
12
- <a target="_blank"
13
- href="http://xyzscripts.com/members/product/purchase/XYZWPSMPPRE"><img class="hoverImages"
14
- src="<?php echo plugins_url("facebook-auto-publish/admin/images/orange_buynow.png"); ?>">
15
- </a>
16
- </div>
17
- <div style="float: left; padding: 0 5px">
18
- <h2 style="vertical-align: middle;text-shadow: 1px 1px 1px #686868">
19
- ( <a href="<?php echo admin_url('admin.php?page=facebook-auto-publish-about');?>">Compare Features</a> )
20
- </h2>
21
- </div>
22
- </div>
23
- <?php }?>
24
-
25
- <div style="clear: both;"></div>
26
-
27
-
28
- <p></p>
29
-
30
- <div style="width: 100%">
31
-
32
- <div class="xyz_feedback">
33
-
34
-
35
- <a target="_blank" href="http://xyzscripts.com/donate/1" class="xyz_donate">Donate a dollar</a> ★
36
- <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/facebook-auto-publish" class="xyz_star">Rate this plugin</a> ★
37
- <a target="_blank" href="http://xyzscripts.com/support/" class="xyz_suggest">Suggestions</a> ★
38
- <a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_fbook">Like us on facebook</a> ★
39
- <a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_twitt">Follow us on twitter</a> ★
40
- <a target="_blank" href="https://plus.google.com/+Xyzscripts" class="xyz_gplus">+1 us on Google+</a>
41
-
42
-
43
- </div>
44
-
45
- <p></p>
46
-
47
- <div class="xyz_subscribe">
48
-
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;
56
-
57
- if (matchArray == null) {
58
- return false;
59
- }else{
60
- return true;
61
- }
62
- }
63
-
64
-
65
- function verify_lists(form)
66
- {
67
-
68
- var total=0;
69
- var checkBox=form['chk[]'];
70
-
71
- if(checkBox.length){
72
-
73
- for(var i=0;i<checkBox.length;i++){
74
- checkBox[i].checked?total++:null;
75
- }
76
- }else{
77
-
78
- checkBox.checked?total++:null;
79
-
80
- }
81
- if(total>0){
82
- return true;
83
- }else{
84
- return false;
85
- }
86
-
87
- }
88
-
89
- function verify_fields()
90
- {
91
-
92
- if(check_email(document.email_subscription.email.value) == false){
93
- alert("Please check whether the email is correct.");
94
- document.email_subscription.email.select();
95
- return false;
96
- }else if(verify_lists(document.email_subscription)==false){
97
- alert("Select atleast one list.");
98
- }
99
- else{
100
- document.email_subscription.submit();
101
- }
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">
109
- <input type="hidden" name="redirPending" value="http://xyzscripts.com/subscription/active/XYZWPSMPPRE">
110
- <input type="hidden" name="mode" value="1">
111
-
112
- <b>Stay tuned to our updates :</b>
113
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
114
-
115
- Name :
116
- <input style="border: 1px solid #3fafe3; margin-right:10px;padding:5px;" type="text" name="field1" value="<?php
117
- if ($current_user->user_firstname != "" || $current_user->user_lastname != "")
118
- {
119
- echo $current_user->user_firstname . " " . $current_user->user_lastname;
120
- }
121
- else if (strcasecmp($current_user->display_name, 'admin')!=0 && strcasecmp($current_user->display_name , "administrator")!=0 )
122
- {
123
- echo $current_user->display_name;
124
- }
125
- else if (strcasecmp($current_user->user_login ,"admin")!=0 && strcasecmp($current_user->user_login , "administrator")!=0 )
126
- {
127
- echo $current_user->user_login;
128
- }
129
- ?>" >
130
-
131
- Email Address :
132
- <input style="border: 1px solid #3fafe3;padding:5px;" name="email"
133
- type="text" value="<?php echo $current_user->user_email; ?>" /><span style="color:#FF0000">*</span>
134
-
135
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
136
- <input class="submit_fbap" type="submit" value="Subscribe" name="Submit" onclick="javascript: if(!verify_fields()) return false; " />
137
-
138
- <input type="hidden" name="listName" value="7,1,"/>
139
- </form>
140
-
141
-
142
-
143
- </div>
144
-
145
-
146
- <p></p>
147
-
148
- <div style="padding-top: ;" class="xyz_plugins">
149
- Our Plugins :
150
-
151
- <a target="_blank" href="http://wordpress.org/plugins/contact-form-manager/">Contact Form Manager</a> ★
152
- <a target="_blank" href="http://wordpress.org/plugins/facebook-auto-publish/">Facebook Auto Publish</a> ★
153
- <a target="_blank" href="http://wordpress.org/plugins/full-screen-popup/">Full Screen Popup</a> ★
154
- <a target="_blank" href="http://wordpress.org/plugins/insert-html-snippet/">Insert HTML Snippet</a> ★
155
- <a target="_blank" href="http://wordpress.org/plugins/insert-php-code-snippet/">Insert PHP Code Snippet</a> ★
156
- <a target="_blank" href="http://wordpress.org/plugins/lightbox-pop/">Lightbox Pop</a> ★
157
- <a target="_blank" href="http://wordpress.org/plugins/linkedin-auto-publish/">LinkedIn Auto Publish</a> ★
158
- <a target="_blank" href="http://wordpress.org/plugins/newsletter-manager/">Newsletter Manager</a>★
159
- <a target="_blank" href="http://wordpress.org/plugins/popup-dialog-box/">Popup Dialog Box</a> ★
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;">
168
- Powered by <a href="http://xyzscripts.com" target="_blank">XYZScripts</a>
169
- </div>
170
-
171
- <div style="clear: both;"></div>
172
-
 
 
173
  </div>
1
+ <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
+ if(get_option('xyz_fbap_premium_version_ads')==1){?>
4
+ <div id="xyz-wp-fbap-premium">
5
+
6
+ <div style="float: left; padding: 0 5px">
7
+ <h2 style="vertical-align: middle;">
8
+ <a target="_blank"
9
+ href="http://xyzscripts.com/wordpress-plugins/social-media-auto-publish/features">Fully
10
+ Featured XYZ WP SMAP Premium Plugin</a> - Just 29 USD
11
+ </h2>
12
+ </div>
13
+ <div style="float: left; margin-top: 3px">
14
+ <a target="_blank"
15
+ href="http://xyzscripts.com/members/product/purchase/XYZWPSMPPRE"><img class="hoverImages"
16
+ src="<?php echo plugins_url("facebook-auto-publish/admin/images/orange_buynow.png"); ?>">
17
+ </a>
18
+ </div>
19
+ <div style="float: left; padding: 0 5px">
20
+ <h2 style="vertical-align: middle;text-shadow: 1px 1px 1px #686868">
21
+ ( <a href="<?php echo admin_url('admin.php?page=facebook-auto-publish-about');?>">Compare Features</a> )
22
+ </h2>
23
+ </div>
24
+ </div>
25
+ <?php }?>
26
+
27
+ <div style="clear: both;"></div>
28
+
29
+
30
+ <p></p>
31
+
32
+ <div style="width: 100%">
33
+
34
+ <div class="xyz_feedback">
35
+
36
+
37
+ <a target="_blank" href="http://xyzscripts.com/donate/1" class="xyz_donate">Donate a dollar</a> ★
38
+ <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/facebook-auto-publish" class="xyz_star">Rate this plugin</a> ★
39
+ <a target="_blank" href="http://xyzscripts.com/support/" class="xyz_suggest">Suggestions</a> ★
40
+ <a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_fbook">Like us on facebook</a>
41
+ <a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_twitt">Follow us on twitter</a> ★
42
+ <a target="_blank" href="https://plus.google.com/+Xyzscripts" class="xyz_gplus">+1 us on Google+</a>
43
+
44
+
45
+ </div>
46
+
47
+ <p></p>
48
+
49
+ <div class="xyz_subscribe">
50
+
51
+ <script language="javascript">
52
+ function check_email(emailString)
53
+ {
54
+ var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
55
+ var matchArray = emailString.match(mailPattern);
56
+ if (emailString.length == 0)
57
+ return false;
58
+
59
+ if (matchArray == null) {
60
+ return false;
61
+ }else{
62
+ return true;
63
+ }
64
+ }
65
+
66
+
67
+ function verify_lists(form)
68
+ {
69
+
70
+ var total=0;
71
+ var checkBox=form['chk[]'];
72
+
73
+ if(checkBox.length){
74
+
75
+ for(var i=0;i<checkBox.length;i++){
76
+ checkBox[i].checked?total++:null;
77
+ }
78
+ }else{
79
+
80
+ checkBox.checked?total++:null;
81
+
82
+ }
83
+ if(total>0){
84
+ return true;
85
+ }else{
86
+ return false;
87
+ }
88
+
89
+ }
90
+
91
+ function verify_fields()
92
+ {
93
+
94
+ if(check_email(document.email_subscription.email.value) == false){
95
+ alert("Please check whether the email is correct.");
96
+ document.email_subscription.email.select();
97
+ return false;
98
+ }else if(verify_lists(document.email_subscription)==false){
99
+ alert("Select atleast one list.");
100
+ }
101
+ else{
102
+ document.email_subscription.submit();
103
+ }
104
+
105
+ }
106
+ </script>
107
+ <?php global $current_user; wp_get_current_user(); ?>
108
+ <form action=http://xyzscripts.com/newsletter/index.php?page=list/subscribe method="post" name="email_subscription" id="email_subscription" >
109
+ <input type="hidden" name="fieldNameIds" value="1,">
110
+ <input type="hidden" name="redirActive" value="http://xyzscripts.com/subscription/pending/XYZWPSMPPRE">
111
+ <input type="hidden" name="redirPending" value="http://xyzscripts.com/subscription/active/XYZWPSMPPRE">
112
+ <input type="hidden" name="mode" value="1">
113
+
114
+ <b>Stay tuned to our updates :</b>
115
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
116
+
117
+ Name :
118
+ <input style="border: 1px solid #3fafe3; margin-right:10px;padding:5px;" type="text" name="field1" value="<?php
119
+ if ($current_user->user_firstname != "" || $current_user->user_lastname != "")
120
+ {
121
+ echo esc_html($current_user->user_firstname) . " " . esc_html($current_user->user_lastname);
122
+ }
123
+ else if (strcasecmp($current_user->display_name, 'admin')!=0 && strcasecmp($current_user->display_name , "administrator")!=0 )
124
+ {
125
+ echo esc_html($current_user->display_name);
126
+ }
127
+ else if (strcasecmp($current_user->user_login ,"admin")!=0 && strcasecmp($current_user->user_login , "administrator")!=0 )
128
+ {
129
+ echo esc_html($current_user->user_login);
130
+ }
131
+ ?>" >
132
+
133
+ Email Address :
134
+ <input style="border: 1px solid #3fafe3;padding:5px;" name="email"
135
+ type="text" value="<?php echo esc_html($current_user->user_email); ?>" /><span style="color:#FF0000">*</span>
136
+
137
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
138
+ <input class="submit_fbap" type="submit" value="Subscribe" name="Submit" onclick="javascript: if(!verify_fields()) return false; " />
139
+
140
+ <input type="hidden" name="listName" value="7,1,"/>
141
+ </form>
142
+
143
+
144
+
145
+ </div>
146
+
147
+
148
+ <p></p>
149
+
150
+ <div style="padding-top: ;" class="xyz_plugins">
151
+ Our Plugins :
152
+
153
+ <a target="_blank" href="http://wordpress.org/plugins/contact-form-manager/">Contact Form Manager</a> ★
154
+ <a target="_blank" href="http://wordpress.org/plugins/facebook-auto-publish/">Facebook Auto Publish</a> ★
155
+ <a target="_blank" href="http://wordpress.org/plugins/full-screen-popup/">Full Screen Popup</a> ★
156
+ <a target="_blank" href="http://wordpress.org/plugins/insert-html-snippet/">Insert HTML Snippet</a> ★
157
+ <a target="_blank" href="http://wordpress.org/plugins/insert-php-code-snippet/">Insert PHP Code Snippet</a> ★
158
+ <a target="_blank" href="http://wordpress.org/plugins/lightbox-pop/">Lightbox Pop</a> ★
159
+ <a target="_blank" href="http://wordpress.org/plugins/linkedin-auto-publish/">LinkedIn Auto Publish</a> ★
160
+ <a target="_blank" href="http://wordpress.org/plugins/newsletter-manager/">Newsletter Manager</a>★
161
+ <a target="_blank" href="http://wordpress.org/plugins/popup-dialog-box/">Popup Dialog Box</a> ★
162
+ <a target="_blank" href="http://wordpress.org/plugins/quick-bar/">Quick Bar</a> ★
163
+ <a target="_blank" href="http://wordpress.org/plugins/quick-box-popup/">Quick Box Popup</a> ★
164
+ <a target="_blank" href="http://wordpress.org/plugins/social-media-auto-publish/">Social Media Auto Publish</a>
165
+ <a target="_blank" href="http://wordpress.org/plugins/twitter-auto-publish/">Twitter Auto Publish</a>
166
+ <a target="_blank" href="http://wordpress.org/plugins/custom-field-manager/">Custom Field Manager</a>
167
+ </div>
168
+
169
+ <div style="padding-top: 10px;text-align: center;">
170
+ Powered by <a href="http://xyzscripts.com" target="_blank">XYZScripts</a>
171
+ </div>
172
+
173
+ <div style="clear: both;"></div>
174
+
175
  </div>
admin/header.php CHANGED
@@ -1,4 +1,7 @@
1
- <?php if(get_option('xyz_fbap_premium_version_ads')==1){?>
 
 
 
2
  <div id="xyz-wp-fbap-premium">
3
 
4
  <div style="float: left; padding: 0 5px">
@@ -48,16 +51,23 @@ if(get_option('xyz_credit_link')=="0"){
48
  jQuery(document).ready(function() {
49
 
50
  jQuery('.xyz_fbap_backlink').click(function() {
 
51
  var dataString = {
52
  action: 'xyz_fbap_ajax_backlink',
53
- enable: 1
 
54
  };
55
 
56
  jQuery.post(ajaxurl, dataString, function(response) {
57
- jQuery('.xyz_fbap_backlink').hide();
58
- jQuery("#xyz_backlink_div").html('Thank you for enabling backlink !');
59
- jQuery("#xyz_backlink_div").css('background-color', '#D8E8DA');
60
- jQuery("#xyz_backlink_div").css('border', '1px solid #0F801C');
 
 
 
 
 
61
  });
62
 
63
  });
1
+ <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
+
4
+ if(get_option('xyz_fbap_premium_version_ads')==1){?>
5
  <div id="xyz-wp-fbap-premium">
6
 
7
  <div style="float: left; padding: 0 5px">
51
  jQuery(document).ready(function() {
52
 
53
  jQuery('.xyz_fbap_backlink').click(function() {
54
+ var backlink_nonce= '<?php echo wp_create_nonce('backlink');?>';
55
  var dataString = {
56
  action: 'xyz_fbap_ajax_backlink',
57
+ enable: 1,
58
+ _wpnonce: backlink_nonce
59
  };
60
 
61
  jQuery.post(ajaxurl, dataString, function(response) {
62
+
63
+ if(response==1)
64
+ alert("You do not have sufficient permissions");
65
+ else{
66
+ jQuery('.xyz_fbap_backlink').hide();
67
+ jQuery("#xyz_backlink_div").html('Thank you for enabling backlink !');
68
+ jQuery("#xyz_backlink_div").css('background-color', '#D8E8DA');
69
+ jQuery("#xyz_backlink_div").css('border', '1px solid #0F801C');
70
+ }
71
  });
72
 
73
  });
admin/install.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  function fbap_free_network_install($networkwide) {
3
  global $wpdb;
4
 
@@ -43,7 +44,7 @@ function fbap_install_free()
43
  $fbap_installed_date = time();
44
  update_option('fbap_installed_date', $fbap_installed_date);
45
  }
46
-
47
  add_option('xyz_fbap_application_id','');
48
  add_option('xyz_fbap_application_secret', '');
49
  //add_option('xyz_fbap_fb_id', '');
@@ -55,8 +56,8 @@ function fbap_install_free()
55
  add_option('xyz_fbap_pages_ids','-1');
56
  add_option('xyz_fbap_future_to_publish', '1');
57
  add_option('xyz_fbap_apply_filters', '');
58
-
59
-
60
  $version=get_option('xyz_fbap_free_version');
61
  $currentversion=xyz_fbap_plugin_get_version();
62
  update_option('xyz_fbap_free_version', $currentversion);
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  function fbap_free_network_install($networkwide) {
4
  global $wpdb;
5
 
44
  $fbap_installed_date = time();
45
  update_option('fbap_installed_date', $fbap_installed_date);
46
  }
47
+ add_option('xyz_fbap_application_name','');
48
  add_option('xyz_fbap_application_id','');
49
  add_option('xyz_fbap_application_secret', '');
50
  //add_option('xyz_fbap_fb_id', '');
56
  add_option('xyz_fbap_pages_ids','-1');
57
  add_option('xyz_fbap_future_to_publish', '1');
58
  add_option('xyz_fbap_apply_filters', '');
59
+ add_option('xyz_fbap_caption_for_fb_attachment', 1);
60
+ add_option('xyz_fbap_fb_numericid','');
61
  $version=get_option('xyz_fbap_free_version');
62
  $currentversion=xyz_fbap_plugin_get_version();
63
  update_option('xyz_fbap_free_version', $currentversion);
admin/logs.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  ?>
3
  <div >
4
 
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  ?>
4
  <div >
5
 
admin/menu.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  add_action('admin_menu', 'xyz_fbap_menu');
3
 
4
  function xyz_fbap_add_admin_scripts()
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  add_action('admin_menu', 'xyz_fbap_menu');
4
 
5
  function xyz_fbap_add_admin_scripts()
admin/metabox.php CHANGED
@@ -1,4 +1,5 @@
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()
@@ -265,7 +266,7 @@ function inArray(needle, haystack) {
265
  function load_edit_action()
266
  {
267
  document.getElementById("xyz_fbap_post").value=1;
268
- var xyz_fbap_default_selection_edit="<?php echo get_option('xyz_fbap_default_selection_edit');?>";
269
  if(xyz_fbap_default_selection_edit=="")
270
  xyz_fbap_default_selection_edit=0;
271
  if(xyz_fbap_default_selection_edit==1)
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
  add_action( 'add_meta_boxes', 'xyz_fbap_add_custom_box' );
4
  $GLOBALS['edit_flag']=0;
5
  function xyz_fbap_add_custom_box()
266
  function load_edit_action()
267
  {
268
  document.getElementById("xyz_fbap_post").value=1;
269
+ var xyz_fbap_default_selection_edit="<?php echo esc_html(get_option('xyz_fbap_default_selection_edit'));?>";
270
  if(xyz_fbap_default_selection_edit=="")
271
  xyz_fbap_default_selection_edit=0;
272
  if(xyz_fbap_default_selection_edit==1)
admin/publish.php CHANGED
@@ -1,5 +1,5 @@
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');
@@ -23,7 +23,7 @@ function xyz_link_fbap_future_to_publish($new_status, $old_status, $post){
23
 
24
  $post_permissin=get_option('xyz_fbap_post_permission');
25
  if(isset($_POST['xyz_fbap_post_permission']))
26
- $post_permissin=$_POST['xyz_fbap_post_permission'];
27
  else
28
  {
29
  if ($post_permissin == 1) {
@@ -57,7 +57,7 @@ function xyz_fbap_link_publish($post_ID) {
57
 
58
  $post_permissin=get_option('xyz_fbap_post_permission');
59
  if(isset($_POST['xyz_fbap_post_permission']))
60
- $post_permissin=$_POST['xyz_fbap_post_permission'];
61
 
62
  if ($post_permissin != 1) {
63
  $_POST=$_POST_CPY;
@@ -79,7 +79,7 @@ function xyz_fbap_link_publish($post_ID) {
79
  $appid=get_option('xyz_fbap_application_id');
80
  $appsecret=get_option('xyz_fbap_application_secret');
81
  $useracces_token=get_option('xyz_fbap_fb_token');
82
-
83
 
84
  $message=get_option('xyz_fbap_message');
85
  if(isset($_POST['xyz_fbap_message']))
@@ -89,7 +89,7 @@ function xyz_fbap_link_publish($post_ID) {
89
 
90
  $posting_method=get_option('xyz_fbap_po_method');
91
  if(isset($_POST['xyz_fbap_po_method']))
92
- $posting_method=$_POST['xyz_fbap_po_method'];
93
 
94
  $af=get_option('xyz_fbap_af');
95
 
@@ -224,7 +224,15 @@ function xyz_fbap_link_publish($post_ID) {
224
  $image_found=0;
225
 
226
  $name = $postpp->post_title;
227
- $caption = html_entity_decode(get_bloginfo('title'), ENT_QUOTES, get_bloginfo('charset'));
 
 
 
 
 
 
 
 
228
 
229
  if($tit_flag==1)
230
  $name = apply_filters('the_title', $name);
@@ -318,21 +326,91 @@ function xyz_fbap_link_publish($post_ID) {
318
  if($attachmenturl!="")
319
  {
320
 
 
321
  if($posting_method==5)
322
  {
323
  try{
324
- $albums = $fb->get("/$page_id/albums", array('access_token' => $acces_token));
 
 
 
 
 
325
  }
326
- catch(Exception $e)
327
  {
328
  $fb_publish_status[$page_id."/albums"]=$e->getMessage();
329
- }
330
- foreach ($albums["data"] as $album) {
331
- if ($album["type"] == "wall") {
332
- $timeline_album = $album; break;
 
 
 
333
  }
334
  }
335
  if (isset($timeline_album) && isset($timeline_album["id"])) $page_id = $timeline_album["id"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  }
337
 
338
 
@@ -358,7 +436,9 @@ function xyz_fbap_link_publish($post_ID) {
358
  $attachment=xyz_wp_fbap_attachment_metas($attachment,$link);
359
  }
360
  try{
361
- $result = $fb->post('/'.$page_id.'/'.$disp_type.'/', $attachment);}
 
 
362
  catch(Exception $e)
363
  {
364
  $fb_publish_status[$page_id."/".$disp_type]=$e->getMessage();
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
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');
23
 
24
  $post_permissin=get_option('xyz_fbap_post_permission');
25
  if(isset($_POST['xyz_fbap_post_permission']))
26
+ $post_permissin=intval($_POST['xyz_fbap_post_permission']);
27
  else
28
  {
29
  if ($post_permissin == 1) {
57
 
58
  $post_permissin=get_option('xyz_fbap_post_permission');
59
  if(isset($_POST['xyz_fbap_post_permission']))
60
+ $post_permissin=intval($_POST['xyz_fbap_post_permission']);
61
 
62
  if ($post_permissin != 1) {
63
  $_POST=$_POST_CPY;
79
  $appid=get_option('xyz_fbap_application_id');
80
  $appsecret=get_option('xyz_fbap_application_secret');
81
  $useracces_token=get_option('xyz_fbap_fb_token');
82
+ $app_name=get_option('xyz_fbap_application_name');
83
 
84
  $message=get_option('xyz_fbap_message');
85
  if(isset($_POST['xyz_fbap_message']))
89
 
90
  $posting_method=get_option('xyz_fbap_po_method');
91
  if(isset($_POST['xyz_fbap_po_method']))
92
+ $posting_method=intval($_POST['xyz_fbap_po_method']);
93
 
94
  $af=get_option('xyz_fbap_af');
95
 
224
  $image_found=0;
225
 
226
  $name = $postpp->post_title;
227
+
228
+ $xyz_fbap_caption_for_fb_attachment=get_option('xyz_fbap_caption_for_fb_attachment');
229
+
230
+ if($xyz_fbap_caption_for_fb_attachment==1)
231
+ $caption=$_SERVER['HTTP_HOST'];
232
+ else
233
+ $caption=get_bloginfo('title');
234
+
235
+ $caption = html_entity_decode($caption, ENT_QUOTES, get_bloginfo('charset'));
236
 
237
  if($tit_flag==1)
238
  $name = apply_filters('the_title', $name);
326
  if($attachmenturl!="")
327
  {
328
 
329
+
330
  if($posting_method==5)
331
  {
332
  try{
333
+ $album_fount=0;
334
+
335
+ $albums = $fb->get("/$page_id/albums", $acces_token);
336
+ $arrayResults = $albums->getGraphEdge()->asArray();
337
+
338
+
339
  }
340
+ catch (Exception $e)
341
  {
342
  $fb_publish_status[$page_id."/albums"]=$e->getMessage();
343
+ }
344
+ if(isset($arrayResults))
345
+ {
346
+ foreach ($arrayResults as $album) {
347
+ if (isset($album["name"]) && $album["name"] == "Timeline Photos") {
348
+ $album_fount=1;$timeline_album = $album; break;
349
+ }
350
  }
351
  }
352
  if (isset($timeline_album) && isset($timeline_album["id"])) $page_id = $timeline_album["id"];
353
+ if($album_fount==0)
354
+ {
355
+ $attachment = array('name' => "Timeline Photos",
356
+ 'access_token' => $acces_token,
357
+ );
358
+ try{
359
+ $album_create=$fb->post('/'.$page_id.'/albums', $attachment);
360
+ $album_node=$album_create->getGraphNode();
361
+ if (isset($album_node) && isset($album_node["id"]))
362
+ $page_id = $album_node["id"];
363
+ }
364
+ catch (Exception $e)
365
+ {
366
+ $fb_publish_status[$page_id."/albums"]=$e->getMessage();
367
+
368
+ }
369
+
370
+ }
371
+ }
372
+ else
373
+ {
374
+ try{
375
+ $album_fount=0;
376
+
377
+ $albums = $fb->get("/$page_id/albums", $acces_token);
378
+ $arrayResults = $albums->getGraphEdge()->asArray();
379
+
380
+ }
381
+ catch (Exception $e)
382
+ {
383
+ $fb_publish_status[$page_id."/albums"]=$e->getMessage();
384
+ }
385
+ if(isset($arrayResults))
386
+ {
387
+ foreach ($arrayResults as $album)
388
+ {
389
+ if (isset($album["name"]) && $album["name"] == $app_name) {
390
+ $album_fount=1;
391
+ $app_album = $album; break;
392
+ }
393
+ }
394
+
395
+ }
396
+ if (isset($app_album) && isset($app_album["id"])) $page_id = $app_album["id"];
397
+ if($album_fount==0)
398
+ {
399
+ $attachment = array('name' => $app_name,
400
+ 'access_token' => $acces_token,
401
+ );
402
+ try{
403
+ $album_create=$fb->post('/'.$page_id.'/albums', $attachment);
404
+ $album_node=$album_create->getGraphNode();
405
+ if (isset($album_node) && isset($album_node["id"]))
406
+ $page_id = $album_node["id"];
407
+ }
408
+ catch (Exception $e)
409
+ {
410
+ $fb_publish_status[$page_id."/albums"]=$e->getMessage();
411
+ }
412
+
413
+ }
414
  }
415
 
416
 
436
  $attachment=xyz_wp_fbap_attachment_metas($attachment,$link);
437
  }
438
  try{
439
+
440
+ $result = $fb->post('/'.$page_id.'/'.$disp_type.'/', $attachment);
441
+ }
442
  catch(Exception $e)
443
  {
444
  $fb_publish_status[$page_id."/".$disp_type]=$e->getMessage();
admin/settings.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
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="";
9
  $ms2="";
10
  $ms3="";
@@ -37,6 +38,16 @@ Thanks again for using the plugin. We will never show the message again.
37
  $erf=0;
38
  if(isset($_POST['fb']))
39
  {
 
 
 
 
 
 
 
 
 
 
40
 
41
  $ss=array();
42
  if(isset($_POST['fbap_pages_list']))
@@ -61,19 +72,25 @@ if(isset($_POST['fb']))
61
 
62
  update_option('xyz_fbap_pages_ids',$fbap_pages_list_ids);
63
 
64
-
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.";
79
  $erf=1;
@@ -105,27 +122,16 @@ if(isset($_POST['fb']))
105
  {
106
  $messagetopost="New post added at {BLOG_TITLE} - {POST_TITLE}";
107
  }
108
-
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
 
116
- $url = 'https://graph.facebook.com/'.XYZ_FBAP_FB_API_VERSION."/me";
117
- $contentget=wp_remote_get($url);$page_id="";
118
- if(is_array($contentget))
119
- {
120
- $result1=$contentget['body'];
121
- $pagearray = json_decode($result1);
122
- if(isset($pagearray->id))
123
- $page_id=$pagearray->id;
124
- }
125
-
126
-
127
 
128
- update_option('xyz_fbap_fb_numericid',$page_id);
129
 
130
  }
131
  }
@@ -167,7 +173,7 @@ if(isset($_POST['fb']) && $erf==1)
167
  <?php
168
  if(isset($_POST['fb']))
169
  {
170
- echo $ms1;echo $ms2;echo $ms3;echo $ms4;
171
  }
172
  ?>
173
  &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
@@ -192,17 +198,18 @@ function dethide(id)
192
  </h2>
193
  <?php
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>
204
  <form method="post">
205
-
206
  <input type="submit" class="submit_fbap_new" name="fb_auth"
207
  value="Authorize" /><br><br>
208
 
@@ -212,7 +219,7 @@ function dethide(id)
212
  {
213
  ?>
214
  <form method="post">
215
-
216
  <input type="submit" class="submit_fbap_new" name="fb_auth"
217
  value="Reauthorize" title="Reauthorize the account" /><br><br>
218
 
@@ -243,7 +250,7 @@ function dethide(id)
243
  <b><a href="https://developers.facebook.com/apps" target="_blank">Click here</a></b> to create new Facebook application.
244
  <br>In the application page in facebook, navigate to <b>Apps > Settings > Edit settings > Website > Site URL</b>. Set the site url as :
245
  <span style="color: red;"><?php echo (is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; ?></span>
246
- <br>For detailed step by step instructions <b><a href="http://docs.xyzscripts.com/wordpress-plugins/facebook-auto-publish/creating-facebook-application/" target="_blank">Click here</a></b>.
247
  </div>
248
 
249
  </td>
@@ -251,6 +258,8 @@ function dethide(id)
251
  </table>
252
 
253
  <form method="post">
 
 
254
  <input type="hidden" value="config">
255
 
256
 
@@ -259,13 +268,21 @@ function dethide(id)
259
 
260
  <div style="font-weight: bold;padding: 3px;">All fields given below are mandatory</div>
261
  <table class="widefat xyz_fbap_widefat_table" style="width: 99%">
 
 
 
 
 
 
 
 
 
262
  <tr valign="top">
263
  <td width="50%">Application id
264
  </td>
265
  <td><input id="xyz_fbap_application_id"
266
  name="xyz_fbap_application_id" type="text"
267
  value="<?php if($ms1=="") {echo esc_html(get_option('xyz_fbap_application_id'));}?>" />
268
- <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>
269
  </td>
270
  </tr>
271
 
@@ -310,6 +327,16 @@ function dethide(id)
310
  <textarea id="xyz_fbap_message" name="xyz_fbap_message" style="height:80px !important;" ><?php if($ms4==""){
311
  echo esc_textarea(get_option('xyz_fbap_message'));}?></textarea>
312
  </td></tr>
 
 
 
 
 
 
 
 
 
 
313
 
314
 
315
 
@@ -444,12 +471,21 @@ function dethide(id)
444
 
445
  if(isset($_POST['bsettngs']))
446
  {
 
 
 
 
 
 
 
 
 
447
 
448
- $xyz_fbap_include_pages=$_POST['xyz_fbap_include_pages'];
449
- $xyz_fbap_include_posts=$_POST['xyz_fbap_include_posts'];
450
 
451
  if($_POST['xyz_fbap_cat_all']=="All")
452
- $fbap_category_ids=$_POST['xyz_fbap_cat_all'];//redio btn name
453
  else
454
  $fbap_category_ids=$_POST['xyz_fbap_sel_cat'];//dropdown
455
 
@@ -458,10 +494,10 @@ function dethide(id)
458
  if(isset($_POST['post_types']))
459
  $xyz_customtypes=$_POST['post_types'];
460
 
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="";
@@ -511,17 +547,17 @@ function dethide(id)
511
  $xyz_fbap_include_categories=get_option('xyz_fbap_include_categories');
512
  $xyz_fbap_include_customposttypes=get_option('xyz_fbap_include_customposttypes');
513
  $xyz_fbap_apply_filters=get_option('xyz_fbap_apply_filters');
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>
521
 
522
 
523
  <form method="post">
524
-
525
  <table class="widefat xyz_fbap_widefat_table" style="width: 99%">
526
 
527
  <tr valign="top">
@@ -559,7 +595,7 @@ function dethide(id)
559
  <td colspan="1">Select post categories for auto publish
560
  </td>
561
  <td><input type="hidden"
562
- value="<?php echo $xyz_fbap_include_categories;?>"
563
  name="xyz_fbap_sel_cat" id="xyz_fbap_sel_cat"> <input type="radio"
564
  name="xyz_fbap_cat_all" id="xyz_fbap_cat_all" value="All"
565
  onchange="rd_cat_chn(1,-1)"
@@ -768,10 +804,10 @@ function dethide(id)
768
  </div>
769
 
770
  <script type="text/javascript">
771
- //drpdisplay();
772
- var catval='<?php echo $xyz_fbap_include_categories; ?>';
773
- var custtypeval='<?php echo $xyz_fbap_include_customposttypes; ?>';
774
- var get_opt_cats='<?php echo get_option('xyz_fbap_include_posts');?>';
775
  jQuery(document).ready(function() {
776
  if(catval=="All")
777
  jQuery("#cat_dropdown_span").hide();
@@ -805,7 +841,7 @@ document.getElementById('xyz_fbap_sel_cat').value=sel_str;
805
 
806
  }
807
 
808
- var d1='<?php echo $xyz_fbap_include_categories;?>';
809
  splitText = d1.split(",");
810
  jQuery.each(splitText, function(k,v) {
811
  jQuery("#xyz_fbap_catlist").children("option[value="+v+"]").attr("selected","selected");
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
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
+ $ms0="";
9
  $ms1="";
10
  $ms2="";
11
  $ms3="";
38
  $erf=0;
39
  if(isset($_POST['fb']))
40
  {
41
+ if (
42
+ ! isset( $_REQUEST['_wpnonce'] )
43
+ || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'xyz_smap_fb_settings_form_nonce' )
44
+ ) {
45
+
46
+ wp_nonce_ays( 'xyz_smap_fb_settings_form_nonce' );
47
+
48
+ exit();
49
+
50
+ }
51
 
52
  $ss=array();
53
  if(isset($_POST['fbap_pages_list']))
72
 
73
  update_option('xyz_fbap_pages_ids',$fbap_pages_list_ids);
74
 
75
+ $xyz_fbap_caption_for_fb_attachment=intval($_POST['xyz_fbap_caption_for_fb_attachment']);
76
 
77
  $applidold=get_option('xyz_fbap_application_id');
78
  $applsecretold=get_option('xyz_fbap_application_secret');
79
  //$fbidold=get_option('xyz_fbap_fb_id');
80
 
81
+ $posting_method=intval($_POST['xyz_fbap_po_method']);
82
+ $posting_permission=intval($_POST['xyz_fbap_post_permission']);
83
+ $app_name=sanitize_text_field($_POST['xyz_fbap_application_name']);
84
+ $appid=sanitize_text_field($_POST['xyz_fbap_application_id']);
85
+ $appsecret=sanitize_text_field($_POST['xyz_fbap_application_secret']);
86
  $messagetopost=$_POST['xyz_fbap_message'];
87
  //$fbid=$_POST['xyz_fbap_fb_id'];
88
+ if($app_name=="" && $posting_permission==1)
89
+ {
90
+ $ms0="Please fill facebook application name.";
91
+ $erf=1;
92
+ }
93
+ else if($appid=="" && $posting_permission==1)
94
  {
95
  $ms1="Please fill facebook application id.";
96
  $erf=1;
122
  {
123
  $messagetopost="New post added at {BLOG_TITLE} - {POST_TITLE}";
124
  }
125
+ update_option('xyz_fbap_application_name',$app_name);
126
  update_option('xyz_fbap_application_id',$appid);
127
  update_option('xyz_fbap_post_permission',$posting_permission);
128
  update_option('xyz_fbap_application_secret',$appsecret);
129
  //update_option('xyz_fbap_fb_id',$fbid);
130
+ update_option('xyz_fbap_caption_for_fb_attachment',$xyz_fbap_caption_for_fb_attachment);
131
  update_option('xyz_fbap_po_method',$posting_method);
132
  update_option('xyz_fbap_message',$messagetopost);
133
 
 
 
 
 
 
 
 
 
 
 
 
134
 
 
135
 
136
  }
137
  }
173
  <?php
174
  if(isset($_POST['fb']))
175
  {
176
+ echo esc_html($ms0);echo esc_html($ms1);echo esc_html($ms2);echo esc_html($ms3);echo esc_html($ms4);
177
  }
178
  ?>
179
  &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
198
  </h2>
199
  <?php
200
  $af=get_option('xyz_fbap_af');
201
+ $appid=get_option('xyz_fbap_application_id');
202
+ $appsecret=get_option('xyz_fbap_application_secret');
203
  //$fbid=esc_html(get_option('xyz_fbap_fb_id'));
204
  $posting_method=get_option('xyz_fbap_po_method');
205
+ $xyz_fbap_caption_for_fb_attachment=get_option('xyz_fbap_caption_for_fb_attachment');
206
  $posting_message=esc_textarea(get_option('xyz_fbap_message'));
207
  if($af==1 && $appid!="" && $appsecret!="")
208
  {
209
  ?>
210
  <span style="color: red;">Application needs authorisation</span> <br>
211
  <form method="post">
212
+ <?php wp_nonce_field( 'xyz_smap_fb_auth_nonce' );?>
213
  <input type="submit" class="submit_fbap_new" name="fb_auth"
214
  value="Authorize" /><br><br>
215
 
219
  {
220
  ?>
221
  <form method="post">
222
+ <?php wp_nonce_field( 'xyz_smap_fb_auth_nonce' );?>
223
  <input type="submit" class="submit_fbap_new" name="fb_auth"
224
  value="Reauthorize" title="Reauthorize the account" /><br><br>
225
 
250
  <b><a href="https://developers.facebook.com/apps" target="_blank">Click here</a></b> to create new Facebook application.
251
  <br>In the application page in facebook, navigate to <b>Apps > Settings > Edit settings > Website > Site URL</b>. Set the site url as :
252
  <span style="color: red;"><?php echo (is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; ?></span>
253
+ <br>For detailed step by step instructions <b><a href="http://help.xyzscripts.com/docs/social-media-auto-publish/faq/how-can-i-create-facebook-application/" target="_blank">Click here</a></b>.
254
  </div>
255
 
256
  </td>
258
  </table>
259
 
260
  <form method="post">
261
+ <?php wp_nonce_field( 'xyz_smap_fb_settings_form_nonce' );?>
262
+
263
  <input type="hidden" value="config">
264
 
265
 
268
 
269
  <div style="font-weight: bold;padding: 3px;">All fields given below are mandatory</div>
270
  <table class="widefat xyz_fbap_widefat_table" style="width: 99%">
271
+ <tr valign="top">
272
+ <td width="50%">Application name
273
+ </td>
274
+ <td><input id="xyz_fbap_application_name"
275
+ name="xyz_fbap_application_name" type="text"
276
+ value="<?php if($ms0=="") {echo esc_html(get_option('xyz_fbap_application_name'));}?>" />
277
+ <a href="http://help.xyzscripts.com/docs/social-media-auto-publish/faq/how-can-i-create-facebook-application/" target="_blank">How can I create a Facebook Application?</a>
278
+ </td>
279
+ </tr>
280
  <tr valign="top">
281
  <td width="50%">Application id
282
  </td>
283
  <td><input id="xyz_fbap_application_id"
284
  name="xyz_fbap_application_id" type="text"
285
  value="<?php if($ms1=="") {echo esc_html(get_option('xyz_fbap_application_id'));}?>" />
 
286
  </td>
287
  </tr>
288
 
327
  <textarea id="xyz_fbap_message" name="xyz_fbap_message" style="height:80px !important;" ><?php if($ms4==""){
328
  echo esc_textarea(get_option('xyz_fbap_message'));}?></textarea>
329
  </td></tr>
330
+
331
+ <tr valign="top">
332
+ <td>Caption for attachments while posting to facebook</td>
333
+ <td><select name="xyz_fbap_caption_for_fb_attachment" id="xyz_fbap_caption_for_fb_attachment">
334
+ <option value ="1" <?php if($xyz_fbap_caption_for_fb_attachment=='1') echo 'selected'; ?> >Site hostname </option>
335
+ <option value ="2" <?php if($xyz_fbap_caption_for_fb_attachment=='2') echo 'selected'; ?> >Site title </option>
336
+ </select>
337
+
338
+ </td>
339
+ </tr>
340
 
341
 
342
 
471
 
472
  if(isset($_POST['bsettngs']))
473
  {
474
+ if (! isset( $_REQUEST['_wpnonce'] )
475
+ || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'xyz_smap_basic_settings_form_nonce' )
476
+ ) {
477
+
478
+ wp_nonce_ays( 'xyz_smap_basic_settings_form_nonce' );
479
+
480
+ exit();
481
+
482
+ }
483
 
484
+ $xyz_fbap_include_pages=intval($_POST['xyz_fbap_include_pages']);
485
+ $xyz_fbap_include_posts=intval($_POST['xyz_fbap_include_posts']);
486
 
487
  if($_POST['xyz_fbap_cat_all']=="All")
488
+ $fbap_category_ids=$_POST['xyz_fbap_cat_all'];//radio btn name
489
  else
490
  $fbap_category_ids=$_POST['xyz_fbap_sel_cat'];//dropdown
491
 
494
  if(isset($_POST['post_types']))
495
  $xyz_customtypes=$_POST['post_types'];
496
 
497
+ $xyz_fbap_peer_verification=intval($_POST['xyz_fbap_peer_verification']);
498
+ $xyz_fbap_premium_version_ads=intval($_POST['xyz_fbap_premium_version_ads']);
499
+ $xyz_fbap_default_selection_edit=intval($_POST['xyz_fbap_default_selection_edit']);
500
+ $xyz_fbap_utf_decode_enable=intval($_POST['xyz_fbap_utf_decode_enable']);
501
 
502
  //$xyz_fbap_future_to_publish=$_POST['xyz_fbap_future_to_publish'];
503
  $fbap_customtype_ids="";
547
  $xyz_fbap_include_categories=get_option('xyz_fbap_include_categories');
548
  $xyz_fbap_include_customposttypes=get_option('xyz_fbap_include_customposttypes');
549
  $xyz_fbap_apply_filters=get_option('xyz_fbap_apply_filters');
550
+ $xyz_fbap_peer_verification=get_option('xyz_fbap_peer_verification');
551
+ $xyz_fbap_premium_version_ads=get_option('xyz_fbap_premium_version_ads');
552
+ $xyz_fbap_default_selection_edit=get_option('xyz_fbap_default_selection_edit');
553
+ $xyz_fbap_utf_decode_enable=get_option('xyz_fbap_utf_decode_enable');
554
 
555
  ?>
556
  <h2>Basic Settings</h2>
557
 
558
 
559
  <form method="post">
560
+ <?php wp_nonce_field( 'xyz_smap_basic_settings_form_nonce' );?>
561
  <table class="widefat xyz_fbap_widefat_table" style="width: 99%">
562
 
563
  <tr valign="top">
595
  <td colspan="1">Select post categories for auto publish
596
  </td>
597
  <td><input type="hidden"
598
+ value="<?php echo esc_html($xyz_fbap_include_categories);?>"
599
  name="xyz_fbap_sel_cat" id="xyz_fbap_sel_cat"> <input type="radio"
600
  name="xyz_fbap_cat_all" id="xyz_fbap_cat_all" value="All"
601
  onchange="rd_cat_chn(1,-1)"
804
  </div>
805
 
806
  <script type="text/javascript">
807
+ //drpdisplay();
808
+ var catval='<?php echo esc_html($xyz_fbap_include_categories); ?>';
809
+ var custtypeval='<?php echo esc_html($xyz_fbap_include_customposttypes); ?>';
810
+ var get_opt_cats='<?php echo esc_html(get_option('xyz_fbap_include_posts'));?>';
811
  jQuery(document).ready(function() {
812
  if(catval=="All")
813
  jQuery("#cat_dropdown_span").hide();
841
 
842
  }
843
 
844
+ var d1='<?php echo esc_html($xyz_fbap_include_categories);?>';
845
  splitText = d1.split(",");
846
  jQuery.each(splitText, function(k,v) {
847
  jQuery("#xyz_fbap_catlist").children("option[value="+v+"]").attr("selected","selected");
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.4.1
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  License: GPLv2 or later
@@ -24,7 +24,7 @@ You should have received a copy of the GNU General Public License
24
  along with this program; if not, write to the Free Software
25
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
  */
27
-
28
  if ( !function_exists( 'add_action' ) ) {
29
  echo "Hi there! I'm just a plugin, not much I can do when called directly.";
30
  exit;
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.4.2
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  License: GPLv2 or later
24
  along with this program; if not, write to the Free Software
25
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
  */
27
+ if( !defined('ABSPATH') ){ exit();}
28
  if ( !function_exists( 'add_action' ) ) {
29
  echo "Hi there! I'm just a plugin, not much I can do when called directly.";
30
  exit;
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.7.3
7
- Stable tag: 1.4.1
8
  License: GPLv2 or later
9
 
10
  Publish posts automatically to Facebook page or profile.
@@ -62,13 +62,13 @@ The supported post elements which can be published are given below.
62
 
63
  Facebook Auto Publish is developed and maintained by [XYZScripts](http://xyzscripts.com/ "xyzscripts.com"). For any support, you may [contact us](http://xyzscripts.com/support/ "XYZScripts Support").
64
 
65
- ★ [Facebook Auto Publish User Guide](http://docs.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish User Guide")
66
- ★ [Facebook Auto Publish FAQ](http://kb.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish FAQ")
67
 
68
  == Installation ==
69
 
70
- ★ [Facebook Auto Publish User Guide](http://docs.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish User Guide")
71
- ★ [Facebook Auto Publish FAQ](http://kb.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish FAQ")
72
 
73
  1. Extract `facebook-auto-publish.zip` to your `/wp-content/plugins/` directory.
74
  2. In the admin panel under plugins activate Facebook Auto Publish.
@@ -79,8 +79,8 @@ If you need any further help, you may contact our [support desk](http://xyzscrip
79
 
80
  == Frequently Asked Questions ==
81
 
82
- ★ [Facebook Auto Publish User Guide](http://docs.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish User Guide")
83
- ★ [Facebook Auto Publish FAQ](http://kb.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish FAQ")
84
 
85
  = 1. The Facebook Auto Publish is not working properly. =
86
 
@@ -112,7 +112,9 @@ You may use post title, content, excerpt, permalink, site title and user nicenam
112
  SSL peer verification may not be functioning in your server. Please turn off SSL peer verification in settings of plugin and try again.
113
 
114
 
115
- = More questions ? [Drop a mail](http://xyzscripts.com/support/ "XYZScripts Support") and we shall get back to you with the answers.
 
 
116
 
117
 
118
  == Screenshots ==
@@ -122,8 +124,15 @@ SSL peer verification may not be functioning in your server. Please turn off SSL
122
 
123
  == Changelog ==
124
 
125
- = Facebook Auto Publish 1.4.1 =
126
- * utf-8 decoding issue fixed
 
 
 
 
 
 
 
127
  * Visual composer compatiblity issue fixed
128
  * Minor bugs fixed
129
 
@@ -200,8 +209,8 @@ First official launch.
200
 
201
  == More Information ==
202
 
203
- ★ [Facebook Auto Publish User Guide](http://docs.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish User Guide")
204
- ★ [Facebook Auto Publish FAQ](http://kb.xyzscripts.com/wordpress-plugins/facebook-auto-publish/ "Facebook Auto Publish FAQ")
205
 
206
  = Troubleshooting =
207
 
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.7.3
7
+ Stable tag: 1.4.2
8
  License: GPLv2 or later
9
 
10
  Publish posts automatically to Facebook page or profile.
62
 
63
  Facebook Auto Publish is developed and maintained by [XYZScripts](http://xyzscripts.com/ "xyzscripts.com"). For any support, you may [contact us](http://xyzscripts.com/support/ "XYZScripts Support").
64
 
65
+ ★ [Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "Facebook Auto Publish User Guide")
66
+ ★ [Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "Facebook Auto Publish FAQ")
67
 
68
  == Installation ==
69
 
70
+ ★ [Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "Facebook Auto Publish User Guide")
71
+ ★ [Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "Facebook Auto Publish FAQ")
72
 
73
  1. Extract `facebook-auto-publish.zip` to your `/wp-content/plugins/` directory.
74
  2. In the admin panel under plugins activate Facebook Auto Publish.
79
 
80
  == Frequently Asked Questions ==
81
 
82
+ ★ [Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "Facebook Auto Publish User Guide")
83
+ ★ [Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "Facebook Auto Publish FAQ")
84
 
85
  = 1. The Facebook Auto Publish is not working properly. =
86
 
112
  SSL peer verification may not be functioning in your server. Please turn off SSL peer verification in settings of plugin and try again.
113
 
114
 
115
+ = More questions ? =
116
+
117
+ [Drop a mail](http://xyzscripts.com/support/ "XYZScripts Support") and we shall get back to you with the answers.
118
 
119
 
120
  == Screenshots ==
124
 
125
  == Changelog ==
126
 
127
+ = Facebook Auto Publish 1.4.2 =
128
+ * Fixed facebook boost unavailable issue
129
+ * Nonce added
130
+ * Prevented direct access to plugin files
131
+ * Data validation updated
132
+ * App album related issue fixed
133
+
134
+ = Facebook Auto Publish 1.4.1 =
135
+ * utf-8 decoding issue fixed
136
  * Visual composer compatiblity issue fixed
137
  * Minor bugs fixed
138
 
209
 
210
  == More Information ==
211
 
212
+ ★ [Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/ "Facebook Auto Publish User Guide")
213
+ ★ [Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "Facebook Auto Publish FAQ")
214
 
215
  = Troubleshooting =
216
 
xyz-functions.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  if(!function_exists('xyz_trim_deep'))
4
  {
@@ -47,8 +48,8 @@ if(!function_exists('xyz_fbap_links')){
47
  $base = plugin_basename(XYZ_FBAP_PLUGIN_FILE);
48
  if ($file == $base) {
49
 
50
- $links[] = '<a href="http://kb.xyzscripts.com/wordpress-plugins/facebook-auto-publish/" title="FAQ">FAQ</a>';
51
- $links[] = '<a href="http://docs.xyzscripts.com/wordpress-plugins/facebook-auto-publish/" title="Read Me">README</a>';
52
  $links[] = '<a href="http://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
53
  $links[] = '<a href="http://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on twitter"></a>';
54
  $links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Facebook"></a>';
@@ -84,7 +85,7 @@ function xyz_fbap_getimage($post_ID,$description_org)
84
  if($post_thumbnail_id!="")
85
  {
86
  $attachmenturl=wp_get_attachment_url($post_thumbnail_id);
87
- $attachmentimage=wp_get_attachment_image_src( $post_thumbnail_id, full );
88
 
89
  }
90
  else {
1
  <?php
2
+ if( !defined('ABSPATH') ){ exit();}
3
 
4
  if(!function_exists('xyz_trim_deep'))
5
  {
48
  $base = plugin_basename(XYZ_FBAP_PLUGIN_FILE);
49
  if ($file == $base) {
50
 
51
+ $links[] = '<a href="http://help.xyzscripts.com/docs/facebook-auto-publish/faq/" title="FAQ">FAQ</a>';
52
+ $links[] = '<a href="http://help.xyzscripts.com/docs/facebook-auto-publish/" title="Read Me">README</a>';
53
  $links[] = '<a href="http://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
54
  $links[] = '<a href="http://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on twitter"></a>';
55
  $links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Facebook"></a>';
85
  if($post_thumbnail_id!="")
86
  {
87
  $attachmenturl=wp_get_attachment_url($post_thumbnail_id);
88
+ //$attachmentimage=wp_get_attachment_image_src( $post_thumbnail_id, full );
89
 
90
  }
91
  else {