Version Description
= Facebook Auto Publish 1.0.1 = If you had issues with default image used for auto publishing, you may apply this upgrade.
= Facebook Auto Publish 1.0 = First official launch.
Download this release
Release Info
Developer | f1logic |
Plugin | WP Facebook Auto Publish |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.9 to 2.0
- admin/ajax-backlink.php +41 -0
- admin/authorization.php +1 -1
- admin/destruction.php +7 -0
- admin/fbap-suggest-feature.php +70 -0
- admin/footer.php +1 -1
- admin/install.php +8 -1
- admin/logs.php +8 -6
- admin/menu.php +7 -0
- admin/metabox.php +1 -1
- admin/publish.php +62 -31
- admin/settings.php +284 -19
- facebook-auto-publish.php +5 -11
- images/ajax-loader.gif +0 -0
- readme.txt +261 -256
- xyz-functions.php +24 -1
admin/ajax-backlink.php
CHANGED
@@ -27,4 +27,45 @@ function xyz_fbap_ajax_backlink_call() {
|
|
27 |
die();
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
?>
|
27 |
die();
|
28 |
}
|
29 |
|
30 |
+
add_action('wp_ajax_xyz_fbap_selected_pages_auto_update', 'xyz_fbap_selected_pages_auto_update_fn');
|
31 |
+
function xyz_fbap_selected_pages_auto_update_fn() {
|
32 |
+
global $wpdb;
|
33 |
+
if($_POST){
|
34 |
+
if (! isset( $_POST['_wpnonce'] )|| ! wp_verify_nonce( $_POST['_wpnonce'],'xyz_fbap_selected_pages_nonce' ))
|
35 |
+
{
|
36 |
+
echo 1;die;
|
37 |
+
}
|
38 |
+
global $wpdb;
|
39 |
+
if(isset($_POST)){
|
40 |
+
$pages=stripslashes($_POST['pages']);
|
41 |
+
$smap_sec_key=$_POST['smap_secretkey'];
|
42 |
+
$xyz_fbap_fb_numericid=$_POST['xyz_fb_numericid'];
|
43 |
+
$xyz_fbap_smapsoln_userid=$_POST['smapsoln_userid'];
|
44 |
+
update_option('xyz_fbap_page_names',$pages);
|
45 |
+
update_option('xyz_fbap_af', 0);
|
46 |
+
update_option('xyz_fbap_secret_key', $smap_sec_key);
|
47 |
+
update_option('xyz_fbap_fb_numericid', $xyz_fbap_fb_numericid);
|
48 |
+
update_option('xyz_fbap_smapsoln_userid', $xyz_fbap_smapsoln_userid);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
die();
|
52 |
+
}
|
53 |
+
add_action('wp_ajax_xyz_fbap_xyzscripts_accinfo_auto_update', 'xyz_fbap_xyzscripts_accinfo_auto_update_fn');
|
54 |
+
function xyz_fbap_xyzscripts_accinfo_auto_update_fn() {
|
55 |
+
global $wpdb;
|
56 |
+
if($_POST){
|
57 |
+
if (! isset( $_POST['_wpnonce'] )|| ! wp_verify_nonce( $_POST['_wpnonce'],'xyz_fbap_xyzscripts_accinfo_nonce' ))
|
58 |
+
{
|
59 |
+
echo 1;die;
|
60 |
+
}
|
61 |
+
global $wpdb;
|
62 |
+
if(isset($_POST)){
|
63 |
+
$xyzscripts_hash_val=stripslashes($_POST['xyz_user_hash']);
|
64 |
+
$xyzscripts_user_id=$_POST['xyz_userid'];
|
65 |
+
update_option('xyz_fbap_xyzscripts_user_id', $xyzscripts_user_id);
|
66 |
+
update_option('xyz_fbap_xyzscripts_hash_val', $xyzscripts_hash_val);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
die();
|
70 |
+
}
|
71 |
?>
|
admin/authorization.php
CHANGED
@@ -34,7 +34,7 @@ if(isset($_POST['fb_auth']))
|
|
34 |
|
35 |
$dialog_url = "https://www.facebook.com/".XYZ_FBAP_FB_API_VERSION."/dialog/oauth?client_id="
|
36 |
. $app_id . "&redirect_uri=" . $my_url . "&state="
|
37 |
-
. $xyz_fbap_session_state . "&scope=email,public_profile,publish_pages,
|
38 |
|
39 |
header("Location: " . $dialog_url);
|
40 |
}
|
34 |
|
35 |
$dialog_url = "https://www.facebook.com/".XYZ_FBAP_FB_API_VERSION."/dialog/oauth?client_id="
|
36 |
. $app_id . "&redirect_uri=" . $my_url . "&state="
|
37 |
+
. $xyz_fbap_session_state . "&scope=email,public_profile,publish_pages,manage_pages";
|
38 |
|
39 |
header("Location: " . $dialog_url);
|
40 |
}
|
admin/destruction.php
CHANGED
@@ -55,6 +55,13 @@ function fbap_free_destroy()
|
|
55 |
delete_option('fbap_installed_date');
|
56 |
delete_option('xyz_fbap_dnt_shw_notice');
|
57 |
delete_option('xyz_fbap_credit_dismiss');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
|
55 |
delete_option('fbap_installed_date');
|
56 |
delete_option('xyz_fbap_dnt_shw_notice');
|
57 |
delete_option('xyz_fbap_credit_dismiss');
|
58 |
+
delete_option('xyz_fbap_app_sel_mode');
|
59 |
+
delete_option('xyz_fbap_page_names');
|
60 |
+
delete_option('xyz_fbap_secret_key');
|
61 |
+
delete_option('xyz_fbap_smapsoln_userid');
|
62 |
+
//delete_option('xyz_fbap_api_calls_used');
|
63 |
+
delete_option('xyz_fbap_xyzscripts_hash_val');
|
64 |
+
delete_option('xyz_fbap_xyzscripts_user_id');
|
65 |
}
|
66 |
|
67 |
register_uninstall_hook(XYZ_FBAP_PLUGIN_FILE,'fbap_free_network_destroy');
|
admin/fbap-suggest-feature.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if( !defined('ABSPATH') ){ exit();}
|
3 |
+
global $wpdb;
|
4 |
+
$xyz_fbap_message='';
|
5 |
+
if(isset($_GET['msg']))
|
6 |
+
$xyz_fbap_message = $_GET['msg'];
|
7 |
+
if($xyz_fbap_message == 1){
|
8 |
+
?>
|
9 |
+
<div class="system_notice_area_style1" id="system_notice_area">
|
10 |
+
Thank you for the suggestion. <span
|
11 |
+
id="system_notice_area_dismiss">Dismiss</span>
|
12 |
+
</div>
|
13 |
+
<?php
|
14 |
+
}
|
15 |
+
else if($xyz_fbap_message == 2){
|
16 |
+
?>
|
17 |
+
<div class="system_notice_area_style0" id="system_notice_area">
|
18 |
+
wp_mail not able to process the request. <span
|
19 |
+
id="system_notice_area_dismiss">Dismiss</span>
|
20 |
+
</div>
|
21 |
+
<?php
|
22 |
+
}
|
23 |
+
else if($xyz_fbap_message == 3){
|
24 |
+
?>
|
25 |
+
<div class="system_notice_area_style0" id="system_notice_area">
|
26 |
+
Please suggest a feature. <span
|
27 |
+
id="system_notice_area_dismiss">Dismiss</span>
|
28 |
+
</div>
|
29 |
+
<?php
|
30 |
+
}
|
31 |
+
if (isset($_POST) && isset($_POST['xyz_send_mail']))
|
32 |
+
{
|
33 |
+
if (! isset( $_REQUEST['_wpnonce'] )|| ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'xyz_fbap_suggest_feature_form_nonce' ))
|
34 |
+
{
|
35 |
+
wp_nonce_ays( 'xyz_fbap_suggest_feature_form_nonce' );
|
36 |
+
exit();
|
37 |
+
}
|
38 |
+
if (isset($_POST['xyz_fbap_suggested_feature']) && $_POST['xyz_fbap_suggested_feature']!='')
|
39 |
+
{
|
40 |
+
$xyz_fbap_feature_content=esc_textarea($_POST['xyz_fbap_suggested_feature']);
|
41 |
+
$xyz_fbap_sender_email = get_option('admin_email');
|
42 |
+
$entries0 = $wpdb->get_results( $wpdb->prepare( 'SELECT display_name FROM '.$wpdb->base_prefix.'users WHERE user_email=%s',array($xyz_fbap_sender_email)));
|
43 |
+
foreach( $entries0 as $entry ) {
|
44 |
+
$xyz_fbap_admin_username=$entry->display_name;
|
45 |
+
}
|
46 |
+
$xyz_fbap_recv_email='support@xyzscripts.com';
|
47 |
+
$xyz_fbap_mail_subject="WP FACEBOOK AUTO PUBLISH - FEATURE SUGGESTION";
|
48 |
+
$xyz_fbap_headers = array('From: '.$xyz_fbap_admin_username.' <'. $xyz_fbap_sender_email .'>' ,'Content-Type: text/html; charset=UTF-8');
|
49 |
+
$wp_mail_processed=wp_mail( $xyz_fbap_recv_email, $xyz_fbap_mail_subject, $xyz_fbap_feature_content, $xyz_fbap_headers );
|
50 |
+
if ($wp_mail_processed==true)
|
51 |
+
header("Location:".admin_url('admin.php?page=facebook-auto-publish-suggest-feature&msg=1'));
|
52 |
+
else
|
53 |
+
header("Location:".admin_url('admin.php?page=facebook-auto-publish-suggest-feature&msg=2'));
|
54 |
+
}
|
55 |
+
else
|
56 |
+
header("Location:".admin_url('admin.php?page=facebook-auto-publish-suggest-feature&msg=3'));
|
57 |
+
}?>
|
58 |
+
<form method="post" >
|
59 |
+
<?php wp_nonce_field( 'xyz_fbap_suggest_feature_form_nonce' );?>
|
60 |
+
<h3>Contribute And Get Rewarded</h3>
|
61 |
+
<span style="color: #1A87B9;font-size:13px;padding-left: 10px;" >* Suggest a feature for this plugin and stand a chance to get a free copy of premium version of this plugin.</span>
|
62 |
+
<table class="widefat xyz_fbap_widefat_table" style="width:98%;padding-top: 10px;">
|
63 |
+
<tr><td>
|
64 |
+
<textarea name="xyz_fbap_suggested_feature" id="xyz_fbap_suggested_feature" style="width:620px;height:250px !important;"></textarea>
|
65 |
+
</td></tr>
|
66 |
+
<tr>
|
67 |
+
<td><input name="xyz_send_mail" class="submit_fbap_new" style="color:#FFFFFF;border-radius:4px;border:1px solid #1A87B9; margin-bottom:10px;" type="submit" value="Send Mail To Us">
|
68 |
+
</td></tr>
|
69 |
+
</table>
|
70 |
+
</form>
|
admin/footer.php
CHANGED
@@ -144,7 +144,7 @@ type="text" placeholder="Email" style="" value="<?php echo $current_user->use
|
|
144 |
<a target="_blank" href="https://wordpress.org/plugins/social-media-auto-publish/"><span>1</span>Social Media Auto Publish</a>
|
145 |
<a target="_blank" href="https://wordpress.org/plugins/facebook-auto-publish/"><span>2</span>WP Facebook Auto Publish</a>
|
146 |
<a target="_blank" href="https://wordpress.org/plugins/twitter-auto-publish/"><span>3</span>WP Twitter Auto Publish</a>
|
147 |
-
<a target="_blank" href="https://wordpress.org/plugins/linkedin-auto-publish/"><span>4</span>WP LinkedIn Auto Publish</a>
|
148 |
<a target="_blank" href="https://wordpress.org/plugins/insert-html-snippet/"><span>5</span>Insert HTML Snippet</a>
|
149 |
<a target="_blank" href="https://wordpress.org/plugins/insert-php-code-snippet/"><span>6</span>Insert PHP Code Snippet</a>
|
150 |
<a target="_blank" href="https://wordpress.org/plugins/contact-form-manager/"><span>7</span>Contact Form Manager</a>
|
144 |
<a target="_blank" href="https://wordpress.org/plugins/social-media-auto-publish/"><span>1</span>Social Media Auto Publish</a>
|
145 |
<a target="_blank" href="https://wordpress.org/plugins/facebook-auto-publish/"><span>2</span>WP Facebook Auto Publish</a>
|
146 |
<a target="_blank" href="https://wordpress.org/plugins/twitter-auto-publish/"><span>3</span>WP Twitter Auto Publish</a>
|
147 |
+
<a target="_blank" href="https://wordpress.org/plugins/linkedin-auto-publish/"><span>4</span>WP to LinkedIn Auto Publish</a>
|
148 |
<a target="_blank" href="https://wordpress.org/plugins/insert-html-snippet/"><span>5</span>Insert HTML Snippet</a>
|
149 |
<a target="_blank" href="https://wordpress.org/plugins/insert-php-code-snippet/"><span>6</span>Insert PHP Code Snippet</a>
|
150 |
<a target="_blank" href="https://wordpress.org/plugins/contact-form-manager/"><span>7</span>Contact Form Manager</a>
|
admin/install.php
CHANGED
@@ -71,9 +71,16 @@ function fbap_install_free()
|
|
71 |
add_option('xyz_fbap_premium_version_ads', '1');
|
72 |
add_option('xyz_fbap_default_selection_edit', '0');
|
73 |
// add_option('xyz_fbap_utf_decode_enable', '0');
|
|
|
74 |
add_option('xyz_fbap_dnt_shw_notice','0');
|
75 |
if(get_option('xyz_fbap_credit_dismiss') == "")
|
76 |
-
add_option("xyz_fbap_credit_dismiss",0);
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
|
71 |
add_option('xyz_fbap_premium_version_ads', '1');
|
72 |
add_option('xyz_fbap_default_selection_edit', '0');
|
73 |
// add_option('xyz_fbap_utf_decode_enable', '0');
|
74 |
+
add_option('xyz_fbap_app_sel_mode','0');
|
75 |
add_option('xyz_fbap_dnt_shw_notice','0');
|
76 |
if(get_option('xyz_fbap_credit_dismiss') == "")
|
77 |
+
add_option("xyz_fbap_credit_dismiss",'0');
|
78 |
+
add_option('xyz_fbap_page_names','');
|
79 |
+
add_option('xyz_fbap_secret_key','');
|
80 |
+
add_option('xyz_fbap_smapsoln_userid','0');
|
81 |
+
//add_option('xyz_fbap_api_calls_used','0');
|
82 |
+
add_option('xyz_fbap_xyzscripts_user_id','');
|
83 |
+
add_option('xyz_fbap_xyzscripts_hash_val','');
|
84 |
}
|
85 |
|
86 |
|
admin/logs.php
CHANGED
@@ -11,7 +11,7 @@ if( !defined('ABSPATH') ){ exit();}
|
|
11 |
|
12 |
|
13 |
<div style="text-align: left;padding-left: 7px;"><h3>Auto Publish Logs</h3></div>
|
14 |
-
<span>Last
|
15 |
<table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
|
16 |
<thead>
|
17 |
<tr class="xyz_smap_log_tr">
|
@@ -45,9 +45,10 @@ if( !defined('ABSPATH') ){ exit();}
|
|
45 |
|
46 |
if(is_array($post_fb_logsmain_array))
|
47 |
{
|
48 |
-
for($i=
|
49 |
{
|
50 |
-
if($post_fb_logsmain_array
|
|
|
51 |
{
|
52 |
$post_fb_logs=$post_fb_logsmain_array[$i];
|
53 |
$postid=$post_fb_logs['postid'];
|
@@ -73,21 +74,22 @@ if( !defined('ABSPATH') ){ exit();}
|
|
73 |
<td style="vertical-align: middle !important;padding: 5px;">
|
74 |
<?php
|
75 |
|
76 |
-
if($status=="1")
|
77 |
echo "<span style=\"color:green\">Success</span>";
|
|
|
78 |
else if($status=="0")
|
79 |
echo '';
|
80 |
else
|
81 |
{
|
82 |
$arrval=unserialize($status);
|
83 |
foreach ($arrval as $a=>$b)
|
84 |
-
echo
|
85 |
}
|
86 |
?>
|
87 |
</td>
|
88 |
</tr>
|
89 |
<?php
|
90 |
-
}
|
91 |
}
|
92 |
}
|
93 |
}
|
11 |
|
12 |
|
13 |
<div style="text-align: left;padding-left: 7px;"><h3>Auto Publish Logs</h3></div>
|
14 |
+
<span>Last ten logs</span>
|
15 |
<table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
|
16 |
<thead>
|
17 |
<tr class="xyz_smap_log_tr">
|
45 |
|
46 |
if(is_array($post_fb_logsmain_array))
|
47 |
{
|
48 |
+
for($i=9;$i>=0;$i--)
|
49 |
{
|
50 |
+
if(array_key_exists($i,$post_fb_logsmain_array)){
|
51 |
+
if(($post_fb_logsmain_array[$i])!='')//if(array_key_exists($i,$post_fb_logsmain_array))
|
52 |
{
|
53 |
$post_fb_logs=$post_fb_logsmain_array[$i];
|
54 |
$postid=$post_fb_logs['postid'];
|
74 |
<td style="vertical-align: middle !important;padding: 5px;">
|
75 |
<?php
|
76 |
|
77 |
+
if($status=="1"){
|
78 |
echo "<span style=\"color:green\">Success</span>";
|
79 |
+
}
|
80 |
else if($status=="0")
|
81 |
echo '';
|
82 |
else
|
83 |
{
|
84 |
$arrval=unserialize($status);
|
85 |
foreach ($arrval as $a=>$b)
|
86 |
+
echo $b;
|
87 |
}
|
88 |
?>
|
89 |
</td>
|
90 |
</tr>
|
91 |
<?php
|
92 |
+
}}
|
93 |
}
|
94 |
}
|
95 |
}
|
admin/menu.php
CHANGED
@@ -23,6 +23,7 @@ function xyz_fbap_menu()
|
|
23 |
add_submenu_page('facebook-auto-publish-settings', 'Facebook Auto Publish - Manage settings', ' Settings', 'manage_options', 'facebook-auto-publish-settings' ,'xyz_fbap_settings'); // 8 for admin
|
24 |
add_submenu_page('facebook-auto-publish-settings', 'Facebook Auto Publish - Logs', 'Logs', 'manage_options', 'facebook-auto-publish-log' ,'xyz_fbap_logs');
|
25 |
add_submenu_page('facebook-auto-publish-settings', 'Facebook Auto Publish - About', 'About', 'manage_options', 'facebook-auto-publish-about' ,'xyz_fbap_about'); // 8 for admin
|
|
|
26 |
}
|
27 |
|
28 |
|
@@ -59,6 +60,12 @@ function xyz_fbap_logs()
|
|
59 |
require( dirname( __FILE__ ) . '/logs.php' );
|
60 |
require( dirname( __FILE__ ) . '/footer.php' );
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
add_action('wp_head', 'xyz_fbap_insert_og_image_for_fb');
|
64 |
function xyz_fbap_insert_og_image_for_fb(){
|
23 |
add_submenu_page('facebook-auto-publish-settings', 'Facebook Auto Publish - Manage settings', ' Settings', 'manage_options', 'facebook-auto-publish-settings' ,'xyz_fbap_settings'); // 8 for admin
|
24 |
add_submenu_page('facebook-auto-publish-settings', 'Facebook Auto Publish - Logs', 'Logs', 'manage_options', 'facebook-auto-publish-log' ,'xyz_fbap_logs');
|
25 |
add_submenu_page('facebook-auto-publish-settings', 'Facebook Auto Publish - About', 'About', 'manage_options', 'facebook-auto-publish-about' ,'xyz_fbap_about'); // 8 for admin
|
26 |
+
add_submenu_page('facebook-auto-publish-settings', 'Facebook Auto Publish - Suggest Feature', 'Suggest a Feature', 'manage_options', 'facebook-auto-publish-suggest-feature' ,'xyz_fbap_suggest_feature');
|
27 |
}
|
28 |
|
29 |
|
60 |
require( dirname( __FILE__ ) . '/logs.php' );
|
61 |
require( dirname( __FILE__ ) . '/footer.php' );
|
62 |
}
|
63 |
+
function xyz_fbap_suggest_feature()
|
64 |
+
{
|
65 |
+
require( dirname( __FILE__ ) . '/header.php' );
|
66 |
+
require( dirname( __FILE__ ) . '/fbap-suggest-feature.php' );
|
67 |
+
require( dirname( __FILE__ ) . '/footer.php' );
|
68 |
+
}
|
69 |
|
70 |
add_action('wp_head', 'xyz_fbap_insert_og_image_for_fb');
|
71 |
function xyz_fbap_insert_og_image_for_fb(){
|
admin/metabox.php
CHANGED
@@ -50,7 +50,7 @@ if(isset($_GET['action']) && $_GET['action']=="edit" && !empty($_GET['post']))
|
|
50 |
|
51 |
|
52 |
|
53 |
-
if(get_option('xyz_fbap_af')==0 && get_option('xyz_fbap_fb_token')!=""
|
54 |
add_meta_box( "xyz_fbap", '<strong>WP Facebook Auto Publish </strong>', 'xyz_fbap_addpostmetatags') ;
|
55 |
}
|
56 |
function xyz_fbap_addpostmetatags()
|
50 |
|
51 |
|
52 |
|
53 |
+
if((get_option('xyz_fbap_af')==0 && get_option('xyz_fbap_post_permission')==1 && ((get_option('xyz_fbap_fb_token')!=""&& (get_option('xyz_fbap_app_sel_mode')==0))|| (get_option('xyz_fbap_app_sel_mode')==1 && get_option('xyz_fbap_page_names')!=""))))
|
54 |
add_meta_box( "xyz_fbap", '<strong>WP Facebook Auto Publish </strong>', 'xyz_fbap_addpostmetatags') ;
|
55 |
}
|
56 |
function xyz_fbap_addpostmetatags()
|
admin/publish.php
CHANGED
@@ -94,8 +94,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
94 |
$af=get_option('xyz_fbap_af');
|
95 |
|
96 |
$postpp= get_post($post_ID);global $wpdb;
|
97 |
-
$entries0 = $wpdb->get_results($wpdb->prepare( 'SELECT user_nicename,display_name FROM '.$wpdb->
|
98 |
-
|
99 |
foreach( $entries0 as $entry ) {
|
100 |
$user_nicename=$entry->user_nicename;
|
101 |
$user_displayname=$entry->display_name;
|
@@ -243,37 +242,42 @@ function xyz_fbap_link_publish($post_ID) {
|
|
243 |
$description=str_replace(" ","",$description);
|
244 |
|
245 |
$excerpt=str_replace(" ","",$excerpt);
|
|
|
|
|
246 |
|
247 |
-
if($useracces_token!="" && $appsecret!="" && $appid!="" && $post_permissin==1)
|
248 |
{
|
249 |
$description_li=xyz_fbap_string_limit($description, 10000);
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
253 |
$xyz_fbap_pages_ids=get_option('xyz_fbap_pages_ids');
|
254 |
-
if($xyz_fbap_pages_ids=="")
|
255 |
-
$xyz_fbap_pages_ids=-1;
|
256 |
|
257 |
$xyz_fbap_pages_ids1=explode(",",$xyz_fbap_pages_ids);
|
258 |
-
|
259 |
|
260 |
foreach ($xyz_fbap_pages_ids1 as $key=>$value)
|
261 |
{
|
262 |
-
|
263 |
-
{
|
264 |
$value1=explode("-",$value);
|
265 |
$acces_token=$value1[1];$page_id=$value1[0];
|
266 |
}
|
267 |
else
|
268 |
-
|
269 |
-
$acces_token=$useracces_token;$page_id=$user_page_id;
|
270 |
-
}
|
271 |
|
|
|
272 |
$fb=new Facebook\Facebook(array(
|
273 |
'app_id' => $appid,
|
274 |
'app_secret' => $appsecret,
|
275 |
'cookie' => true
|
276 |
));
|
|
|
277 |
$message1=str_replace('{POST_TITLE}', $name, $message);
|
278 |
$message2=str_replace('{BLOG_TITLE}', $caption,$message1);
|
279 |
$message3=str_replace('{PERMALINK}', $link, $message2);
|
@@ -290,7 +294,6 @@ function xyz_fbap_link_publish($post_ID) {
|
|
290 |
if($posting_method==1) //attach
|
291 |
{
|
292 |
$attachment = array('message' => $message5,
|
293 |
-
'access_token' => $acces_token,
|
294 |
'link' => $link,
|
295 |
'actions' => json_encode(array('name' => $name,
|
296 |
'link' => $link))
|
@@ -300,25 +303,22 @@ function xyz_fbap_link_publish($post_ID) {
|
|
300 |
else if($posting_method==2) //share link
|
301 |
{
|
302 |
$attachment = array('message' => $message5,
|
303 |
-
'access_token' => $acces_token,
|
304 |
'link' => $link
|
305 |
|
306 |
);
|
307 |
}
|
308 |
else if($posting_method==3) //simple text message
|
309 |
{
|
310 |
-
$attachment = array('message' => $message5
|
311 |
-
'access_token' => $acces_token
|
312 |
|
313 |
-
);
|
314 |
|
315 |
}
|
316 |
else if($posting_method==4 || $posting_method==5) //text message with image 4 - app album, 5-timeline
|
317 |
{
|
318 |
if($attachmenturl!="")
|
319 |
{
|
320 |
-
|
321 |
-
|
322 |
if($posting_method==5)
|
323 |
{
|
324 |
try{
|
@@ -344,8 +344,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
344 |
if (isset($timeline_album) && isset($timeline_album["id"])) $page_id = $timeline_album["id"];
|
345 |
if($album_fount==0)
|
346 |
{
|
347 |
-
$attachment = array('name' => "Timeline Photos"
|
348 |
-
'access_token' => $acces_token,
|
349 |
);
|
350 |
try{
|
351 |
$album_create=$fb->post('/'.$page_id.'/albums', $attachment);
|
@@ -389,7 +388,6 @@ function xyz_fbap_link_publish($post_ID) {
|
|
389 |
if($album_fount==0)
|
390 |
{
|
391 |
$attachment = array('name' => $app_name,
|
392 |
-
'access_token' => $acces_token,
|
393 |
);
|
394 |
try{
|
395 |
$album_create=$fb->post('/'.$page_id.'/albums', $attachment);
|
@@ -404,21 +402,18 @@ function xyz_fbap_link_publish($post_ID) {
|
|
404 |
|
405 |
}
|
406 |
}
|
407 |
-
|
408 |
|
409 |
$disp_type="photos";
|
410 |
$attachment = array('message' => $message5,
|
411 |
-
'access_token' => $acces_token,
|
412 |
'url' => $attachmenturl
|
413 |
|
414 |
);
|
415 |
}
|
416 |
else
|
417 |
{
|
418 |
-
$attachment = array('message' => $message5
|
419 |
-
'access_token' => $acces_token
|
420 |
|
421 |
-
);
|
422 |
}
|
423 |
|
424 |
}
|
@@ -430,11 +425,42 @@ function xyz_fbap_link_publish($post_ID) {
|
|
430 |
}
|
431 |
try{
|
432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
$result = $fb->post('/'.$page_id.'/'.$disp_type.'/', $attachment);
|
|
|
434 |
}
|
435 |
catch(Exception $e)
|
436 |
{
|
437 |
-
|
438 |
}
|
439 |
|
440 |
}
|
@@ -451,7 +477,7 @@ function xyz_fbap_link_publish($post_ID) {
|
|
451 |
'postid' => $post_ID,
|
452 |
'acc_type' => "Facebook",
|
453 |
'publishtime' => $time,
|
454 |
-
'status' => $fb_publish_status_insert
|
455 |
);
|
456 |
|
457 |
$update_opt_array=array();
|
@@ -464,6 +490,11 @@ function xyz_fbap_link_publish($post_ID) {
|
|
464 |
$update_opt_array[3]=isset($arr_retrive[3]) ? $arr_retrive[3] : '';
|
465 |
$update_opt_array[4]=isset($arr_retrive[4]) ? $arr_retrive[4] : '';
|
466 |
|
|
|
|
|
|
|
|
|
|
|
467 |
array_shift($update_opt_array);
|
468 |
array_push($update_opt_array,$post_fb_options);
|
469 |
update_option('xyz_fbap_post_logs', $update_opt_array);
|
94 |
$af=get_option('xyz_fbap_af');
|
95 |
|
96 |
$postpp= get_post($post_ID);global $wpdb;
|
97 |
+
$entries0 = $wpdb->get_results($wpdb->prepare( 'SELECT user_nicename,display_name FROM '.$wpdb->base_prefix.'users WHERE ID=%d',$postpp->post_author));
|
|
|
98 |
foreach( $entries0 as $entry ) {
|
99 |
$user_nicename=$entry->user_nicename;
|
100 |
$user_displayname=$entry->display_name;
|
242 |
$description=str_replace(" ","",$description);
|
243 |
|
244 |
$excerpt=str_replace(" ","",$excerpt);
|
245 |
+
$xyz_fbap_app_sel_mode=get_option('xyz_fbap_app_sel_mode');
|
246 |
+
$fbap_secretkey=get_option('xyz_fbap_secret_key');
|
247 |
|
248 |
+
if((($xyz_fbap_app_sel_mode==0 && $useracces_token!="" && $appsecret!="" && $appid!="")|| $xyz_fbap_app_sel_mode==1) && $post_permissin==1)
|
249 |
{
|
250 |
$description_li=xyz_fbap_string_limit($description, 10000);
|
251 |
+
if ($xyz_fbap_app_sel_mode==1){
|
252 |
+
$xyz_fbap_page_names=json_decode(stripslashes(get_option('xyz_fbap_page_names')));
|
253 |
+
foreach ($xyz_fbap_page_names as $xyz_fbap_page_id => $xyz_fbap_page_name)
|
254 |
+
{
|
255 |
+
$xyz_fbap_pages_ids1[]=$xyz_fbap_page_id;
|
256 |
+
}
|
257 |
+
}
|
258 |
+
else{
|
259 |
$xyz_fbap_pages_ids=get_option('xyz_fbap_pages_ids');
|
|
|
|
|
260 |
|
261 |
$xyz_fbap_pages_ids1=explode(",",$xyz_fbap_pages_ids);
|
262 |
+
}
|
263 |
|
264 |
foreach ($xyz_fbap_pages_ids1 as $key=>$value)
|
265 |
{
|
266 |
+
|
267 |
+
if ($xyz_fbap_app_sel_mode==0){
|
268 |
$value1=explode("-",$value);
|
269 |
$acces_token=$value1[1];$page_id=$value1[0];
|
270 |
}
|
271 |
else
|
272 |
+
$page_id=$value;
|
|
|
|
|
273 |
|
274 |
+
if ($xyz_fbap_app_sel_mode==0){
|
275 |
$fb=new Facebook\Facebook(array(
|
276 |
'app_id' => $appid,
|
277 |
'app_secret' => $appsecret,
|
278 |
'cookie' => true
|
279 |
));
|
280 |
+
}
|
281 |
$message1=str_replace('{POST_TITLE}', $name, $message);
|
282 |
$message2=str_replace('{BLOG_TITLE}', $caption,$message1);
|
283 |
$message3=str_replace('{PERMALINK}', $link, $message2);
|
294 |
if($posting_method==1) //attach
|
295 |
{
|
296 |
$attachment = array('message' => $message5,
|
|
|
297 |
'link' => $link,
|
298 |
'actions' => json_encode(array('name' => $name,
|
299 |
'link' => $link))
|
303 |
else if($posting_method==2) //share link
|
304 |
{
|
305 |
$attachment = array('message' => $message5,
|
|
|
306 |
'link' => $link
|
307 |
|
308 |
);
|
309 |
}
|
310 |
else if($posting_method==3) //simple text message
|
311 |
{
|
312 |
+
$attachment = array('message' => $message5);
|
|
|
313 |
|
|
|
314 |
|
315 |
}
|
316 |
else if($posting_method==4 || $posting_method==5) //text message with image 4 - app album, 5-timeline
|
317 |
{
|
318 |
if($attachmenturl!="")
|
319 |
{
|
320 |
+
if($xyz_fbap_app_sel_mode==0)
|
321 |
+
{
|
322 |
if($posting_method==5)
|
323 |
{
|
324 |
try{
|
344 |
if (isset($timeline_album) && isset($timeline_album["id"])) $page_id = $timeline_album["id"];
|
345 |
if($album_fount==0)
|
346 |
{
|
347 |
+
$attachment = array('name' => "Timeline Photos"
|
|
|
348 |
);
|
349 |
try{
|
350 |
$album_create=$fb->post('/'.$page_id.'/albums', $attachment);
|
388 |
if($album_fount==0)
|
389 |
{
|
390 |
$attachment = array('name' => $app_name,
|
|
|
391 |
);
|
392 |
try{
|
393 |
$album_create=$fb->post('/'.$page_id.'/albums', $attachment);
|
402 |
|
403 |
}
|
404 |
}
|
405 |
+
}
|
406 |
|
407 |
$disp_type="photos";
|
408 |
$attachment = array('message' => $message5,
|
|
|
409 |
'url' => $attachmenturl
|
410 |
|
411 |
);
|
412 |
}
|
413 |
else
|
414 |
{
|
415 |
+
$attachment = array('message' => $message5);
|
|
|
416 |
|
|
|
417 |
}
|
418 |
|
419 |
}
|
425 |
}
|
426 |
try{
|
427 |
|
428 |
+
if($xyz_fbap_app_sel_mode==1)
|
429 |
+
{
|
430 |
+
$fbap_smapsoln_userid=get_option('xyz_fbap_smapsoln_userid');
|
431 |
+
$xyz_fbap_secret_key=get_option('xyz_fbap_secret_key');
|
432 |
+
$xyz_fbap_fb_numericid=get_option('xyz_fbap_fb_numericid');
|
433 |
+
$xyz_fbap_xyzscripts_userid=get_option('xyz_fbap_xyzscripts_user_id');
|
434 |
+
$post_details=array('xyz_smap_userid'=>$fbap_smapsoln_userid,//smap_id
|
435 |
+
'xyz_smap_attachment'=>$attachment,
|
436 |
+
'xyz_smap_disp_type'=>$disp_type,
|
437 |
+
'xyz_smap_posting_method'=>$posting_method,
|
438 |
+
'xyz_smap_page_id'=>$page_id,
|
439 |
+
'xyz_smap_app_name'=>$app_name,
|
440 |
+
'xyz_smap_secret_key' =>$xyz_fbap_secret_key,
|
441 |
+
'xyz_fb_numericid' => $xyz_fbap_fb_numericid,
|
442 |
+
'xyz_smap_xyzscripts_userid'=>$xyz_fbap_xyzscripts_userid
|
443 |
+
);
|
444 |
+
$result_smap_solns=xyz_fbap_post_to_facebook($post_details);
|
445 |
+
$result_smap_solns=json_decode($result_smap_solns);
|
446 |
+
if(!empty($result_smap_solns))
|
447 |
+
{
|
448 |
+
$fb_api_count_returned=$result_smap_solns->fb_api_count;
|
449 |
+
if($result_smap_solns->status==0)
|
450 |
+
$fb_publish_status[].="<span style=\"color:red\"> ".$page_id."/".$disp_type."/".$result_smap_solns->msg."</span><br/><span style=\"color:#21759B\">No. of api calls used: ".$fb_api_count_returned."</span><br/>";
|
451 |
+
elseif ($result_smap_solns->status==1)
|
452 |
+
$fb_publish_status[].="<span style=\"color:green\"> ".$page_id."/".$disp_type."/".$result_smap_solns->msg."</span><br/><span style=\"color:#21759B\">No. of api calls used: ".$fb_api_count_returned."</span><br/>";
|
453 |
+
}
|
454 |
+
}
|
455 |
+
else
|
456 |
+
{
|
457 |
+
$attachment['access_token']=$acces_token;
|
458 |
$result = $fb->post('/'.$page_id.'/'.$disp_type.'/', $attachment);
|
459 |
+
}
|
460 |
}
|
461 |
catch(Exception $e)
|
462 |
{
|
463 |
+
$fb_publish_status[]="<span style=\"color:red\"> ".$page_id."/".$disp_type."/".$e->getMessage()."</span><br/>";
|
464 |
}
|
465 |
|
466 |
}
|
477 |
'postid' => $post_ID,
|
478 |
'acc_type' => "Facebook",
|
479 |
'publishtime' => $time,
|
480 |
+
'status' => $fb_publish_status_insert,
|
481 |
);
|
482 |
|
483 |
$update_opt_array=array();
|
490 |
$update_opt_array[3]=isset($arr_retrive[3]) ? $arr_retrive[3] : '';
|
491 |
$update_opt_array[4]=isset($arr_retrive[4]) ? $arr_retrive[4] : '';
|
492 |
|
493 |
+
$update_opt_array[5]=isset($arr_retrive[5]) ? $arr_retrive[5] : '';
|
494 |
+
$update_opt_array[6]=isset($arr_retrive[6]) ? $arr_retrive[6] : '';
|
495 |
+
$update_opt_array[7]=isset($arr_retrive[7]) ? $arr_retrive[7] : '';
|
496 |
+
$update_opt_array[8]=isset($arr_retrive[8]) ? $arr_retrive[8] : '';
|
497 |
+
$update_opt_array[9]=isset($arr_retrive[9]) ? $arr_retrive[9] : '';
|
498 |
array_shift($update_opt_array);
|
499 |
array_push($update_opt_array,$post_fb_options);
|
500 |
update_option('xyz_fbap_post_logs', $update_opt_array);
|
admin/settings.php
CHANGED
@@ -1,7 +1,6 @@
|
|
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/images/";
|
7 |
$heimg=$imgpath."support.png";
|
@@ -9,7 +8,9 @@ $ms0="";
|
|
9 |
$ms1="";
|
10 |
$ms2="";
|
11 |
$ms3="";
|
|
|
12 |
$redirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=1');
|
|
|
13 |
require( dirname( __FILE__ ) . '/authorization.php' );
|
14 |
if(!$_POST && isset($_GET['fbap_notice'])&& $_GET['fbap_notice'] == 'hide')
|
15 |
{
|
@@ -64,25 +65,35 @@ if(isset($_POST['fb']))
|
|
64 |
|
65 |
|
66 |
update_option('xyz_fbap_pages_ids',$fbap_pages_list_ids);
|
|
|
|
|
|
|
|
|
|
|
67 |
$applidold=get_option('xyz_fbap_application_id');
|
68 |
$applsecretold=get_option('xyz_fbap_application_secret');
|
|
|
69 |
$posting_method=intval($_POST['xyz_fbap_po_method']);
|
70 |
$posting_permission=intval($_POST['xyz_fbap_post_permission']);
|
71 |
$app_name=sanitize_text_field($_POST['xyz_fbap_application_name']);
|
|
|
|
|
|
|
72 |
$appid=sanitize_text_field($_POST['xyz_fbap_application_id']);
|
73 |
$appsecret=sanitize_text_field($_POST['xyz_fbap_application_secret']);
|
|
|
74 |
$messagetopost=$_POST['xyz_fbap_message'];
|
75 |
if($app_name=="" && $posting_permission==1)
|
76 |
{
|
77 |
$ms0="Please fill facebook application name.";
|
78 |
$erf=1;
|
79 |
}
|
80 |
-
else if($appid=="" && $posting_permission==1)
|
81 |
{
|
82 |
$ms1="Please fill facebook application id.";
|
83 |
$erf=1;
|
84 |
}
|
85 |
-
elseif($appsecret=="" && $posting_permission==1)
|
86 |
{
|
87 |
$ms2="Please fill facebook application secret.";
|
88 |
$erf=1;
|
@@ -90,16 +101,25 @@ if(isset($_POST['fb']))
|
|
90 |
else
|
91 |
{
|
92 |
$erf=0;
|
93 |
-
if($appid!=$applidold || $appsecret!=$applsecretold)
|
94 |
{
|
95 |
update_option('xyz_fbap_af',1);
|
96 |
update_option('xyz_fbap_fb_token','');
|
97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
update_option('xyz_fbap_application_name',$app_name);
|
|
|
99 |
update_option('xyz_fbap_application_id',$appid);
|
100 |
-
update_option('xyz_fbap_post_permission',$posting_permission);
|
101 |
update_option('xyz_fbap_application_secret',$appsecret);
|
102 |
-
|
|
|
|
|
103 |
update_option('xyz_fbap_po_method',$posting_method);
|
104 |
update_option('xyz_fbap_message',$messagetopost);
|
105 |
}
|
@@ -130,6 +150,24 @@ Unable to authorize the facebook application. Please check your curl/fopen and f
|
|
130 |
</div>
|
131 |
<?php
|
132 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
if(isset($_POST['fb']) && $erf==1)
|
135 |
{
|
@@ -167,10 +205,12 @@ function dethide_fbap(id)
|
|
167 |
//$fbid=esc_html(get_option('xyz_fbap_fb_id'));
|
168 |
$posting_method=get_option('xyz_fbap_po_method');
|
169 |
$posting_message=esc_textarea(get_option('xyz_fbap_message'));
|
|
|
|
|
170 |
if($af==1 && $appid!="" && $appsecret!="")
|
171 |
{
|
172 |
?>
|
173 |
-
|
174 |
<form method="post">
|
175 |
<?php wp_nonce_field( 'xyz_smap_fb_auth_nonce' );?>
|
176 |
<input type="submit" class="submit_fbap_new" name="fb_auth"
|
@@ -188,6 +228,40 @@ function dethide_fbap(id)
|
|
188 |
|
189 |
</form>
|
190 |
<?php }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
if(isset($_GET['auth']) && $_GET['auth']==1 && get_option("xyz_fbap_fb_token")!="")
|
192 |
{
|
193 |
?>
|
@@ -197,7 +271,7 @@ function dethide_fbap(id)
|
|
197 |
<?php
|
198 |
}
|
199 |
?>
|
200 |
-
<table class="widefat" style="width: 99%;background-color: #FFFBCC">
|
201 |
<tr>
|
202 |
<td id="bottomBorderNone" style="border: 1px solid #FCC328;">
|
203 |
|
@@ -207,7 +281,8 @@ function dethide_fbap(id)
|
|
207 |
<br>In the application page in facebook, navigate to <b>Apps >Add Product > Facebook Login >Quickstart >Web > Site URL</b>. Set the site url as :
|
208 |
<span style="color: red;"><?php echo (is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; ?></span>
|
209 |
<br>And then navigate to <b>Apps > Facebook Login > Settings</b>. Set the Valid OAuth redirect URIs as :<br>
|
210 |
-
<span style="color: red;"><?php echo $redirecturl; ?></span
|
|
|
211 |
</div>
|
212 |
|
213 |
</td>
|
@@ -227,10 +302,35 @@ function dethide_fbap(id)
|
|
227 |
<td><input id="xyz_fbap_application_name"
|
228 |
name="xyz_fbap_application_name" type="text"
|
229 |
value="<?php if($ms0=="") {echo esc_html(get_option('xyz_fbap_application_name'));}?>" />
|
230 |
-
<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>
|
231 |
</td>
|
232 |
</tr>
|
233 |
<tr valign="top">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
<td width="50%">Application id
|
235 |
</td>
|
236 |
<td><input id="xyz_fbap_application_id"
|
@@ -239,7 +339,7 @@ function dethide_fbap(id)
|
|
239 |
</td>
|
240 |
</tr>
|
241 |
|
242 |
-
<tr valign="top">
|
243 |
<td>Application secret<?php $apsecret=esc_html(get_option('xyz_fbap_application_secret'));?>
|
244 |
|
245 |
</td>
|
@@ -314,7 +414,7 @@ function dethide_fbap(id)
|
|
314 |
</tr>
|
315 |
<?php
|
316 |
$xyz_acces_token=get_option('xyz_fbap_fb_token');
|
317 |
-
if($xyz_acces_token!=""){
|
318 |
|
319 |
$offset=0;$limit=100;$data=array();
|
320 |
do
|
@@ -355,13 +455,12 @@ function dethide_fbap(id)
|
|
355 |
?>
|
356 |
|
357 |
<tr valign="top"><td>
|
358 |
-
Select facebook pages for auto publish
|
359 |
</td>
|
360 |
<td>
|
361 |
|
362 |
<div class="scroll_checkbox">
|
363 |
<input type="checkbox" id="select_all_pages" >Select All
|
364 |
-
<br><input type="checkbox" class="selpages" name="fbap_pages_list[]" value="-1" <?php if(in_array(-1, $fbap_pages_ids)) echo "checked" ?>>Profile Page
|
365 |
|
366 |
<?php
|
367 |
for($i=0;$i<$count;$i++)
|
@@ -372,11 +471,32 @@ function dethide_fbap(id)
|
|
372 |
<br><input type="checkbox" class="selpages" name="fbap_pages_list[]" value="<?php echo $data[$i]->id."-".$data[$i]->access_token;?>" <?php if(in_array($data[$i]->id, $fbap_pages_ids)) echo "checked" ?>><?php echo $data[$i]->name; ?>
|
373 |
<?php }
|
374 |
// $page_name=base64_encode(serialize($page_name));?>
|
375 |
-
<input type="hidden" value="<?php echo $page_name;?>" name="hidden_page_name" >
|
376 |
</div>
|
377 |
</td></tr>
|
378 |
<?php
|
379 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
<tr><td id="bottomBorderNone"></td>
|
381 |
<td id="bottomBorderNone"><div style="height: 50px;">
|
382 |
<input type="submit" class="submit_fbap_new"
|
@@ -702,6 +822,33 @@ jQuery(document).ready(function() {
|
|
702 |
checkedval= jQuery("input[name='"+value+"']:checked").val();
|
703 |
XyzFbapToggleRadio(checkedval,value);
|
704 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
});
|
706 |
|
707 |
function toggleRadio(value,buttonId)
|
@@ -784,7 +931,125 @@ jQuery.each(fbap_toggle_element_ids, function( index, value ) {
|
|
784 |
xyz_fbap_show_postCategory(1);
|
785 |
});
|
786 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
|
788 |
-
|
789 |
-
|
790 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
if( !defined('ABSPATH') ){ exit();}
|
3 |
global $current_user;
|
|
|
4 |
wp_get_current_user();
|
5 |
$imgpath= plugins_url()."/facebook-auto-publish/images/";
|
6 |
$heimg=$imgpath."support.png";
|
8 |
$ms1="";
|
9 |
$ms2="";
|
10 |
$ms3="";
|
11 |
+
$appid='';$appsecret='';
|
12 |
$redirecturl=admin_url('admin.php?page=facebook-auto-publish-settings&auth=1');
|
13 |
+
$domain_name=$xyzscripts_hash_val=$xyz_fbap_smapsoln_userid=$xyzscripts_user_id=$xyz_smap_licence_key='';
|
14 |
require( dirname( __FILE__ ) . '/authorization.php' );
|
15 |
if(!$_POST && isset($_GET['fbap_notice'])&& $_GET['fbap_notice'] == 'hide')
|
16 |
{
|
65 |
|
66 |
|
67 |
update_option('xyz_fbap_pages_ids',$fbap_pages_list_ids);
|
68 |
+
// if(isset($_POST['xyz_fbap_secret_key'])&& isset($_POST['xyz_fbap_page_names'])){
|
69 |
+
// update_option('xyz_fbap_page_names',$_POST['xyz_fbap_page_names']);
|
70 |
+
// update_option('xyz_fbap_secret_key',$_POST['xyz_fbap_secret_key']);
|
71 |
+
// update_option('xyz_fbap_af',0);
|
72 |
+
// }
|
73 |
$applidold=get_option('xyz_fbap_application_id');
|
74 |
$applsecretold=get_option('xyz_fbap_application_secret');
|
75 |
+
//$app_name_old=get_option('xyz_fbap_application_name');
|
76 |
$posting_method=intval($_POST['xyz_fbap_po_method']);
|
77 |
$posting_permission=intval($_POST['xyz_fbap_post_permission']);
|
78 |
$app_name=sanitize_text_field($_POST['xyz_fbap_application_name']);
|
79 |
+
$xyz_fbap_app_sel_mode=intval($_POST['xyz_fbap_app_sel_mode']);
|
80 |
+
$xyz_fbap_app_sel_mode_old=get_option('xyz_fbap_app_sel_mode');
|
81 |
+
if ($xyz_fbap_app_sel_mode==0){
|
82 |
$appid=sanitize_text_field($_POST['xyz_fbap_application_id']);
|
83 |
$appsecret=sanitize_text_field($_POST['xyz_fbap_application_secret']);
|
84 |
+
}
|
85 |
$messagetopost=$_POST['xyz_fbap_message'];
|
86 |
if($app_name=="" && $posting_permission==1)
|
87 |
{
|
88 |
$ms0="Please fill facebook application name.";
|
89 |
$erf=1;
|
90 |
}
|
91 |
+
else if($appid=="" && $posting_permission==1 && $xyz_fbap_app_sel_mode==0)
|
92 |
{
|
93 |
$ms1="Please fill facebook application id.";
|
94 |
$erf=1;
|
95 |
}
|
96 |
+
elseif($appsecret=="" && $posting_permission==1 && $xyz_fbap_app_sel_mode==0)
|
97 |
{
|
98 |
$ms2="Please fill facebook application secret.";
|
99 |
$erf=1;
|
101 |
else
|
102 |
{
|
103 |
$erf=0;
|
104 |
+
if(($appid!=$applidold || $appsecret!=$applsecretold)&& $xyz_fbap_app_sel_mode==0)
|
105 |
{
|
106 |
update_option('xyz_fbap_af',1);
|
107 |
update_option('xyz_fbap_fb_token','');
|
108 |
}
|
109 |
+
else if ($xyz_fbap_app_sel_mode_old != $xyz_fbap_app_sel_mode)
|
110 |
+
{
|
111 |
+
update_option('xyz_fbap_af',1);
|
112 |
+
update_option('xyz_fbap_fb_token','');
|
113 |
+
update_option('xyz_fbap_secret_key','');
|
114 |
+
update_option('xyz_fbap_page_names','');
|
115 |
+
}
|
116 |
update_option('xyz_fbap_application_name',$app_name);
|
117 |
+
if ($xyz_fbap_app_sel_mode==0){
|
118 |
update_option('xyz_fbap_application_id',$appid);
|
|
|
119 |
update_option('xyz_fbap_application_secret',$appsecret);
|
120 |
+
}
|
121 |
+
update_option('xyz_fbap_post_permission',$posting_permission);
|
122 |
+
update_option('xyz_fbap_app_sel_mode',$xyz_fbap_app_sel_mode);
|
123 |
update_option('xyz_fbap_po_method',$posting_method);
|
124 |
update_option('xyz_fbap_message',$messagetopost);
|
125 |
}
|
150 |
</div>
|
151 |
<?php
|
152 |
}
|
153 |
+
if(isset($_GET['msg']) && $_GET['msg']==4)
|
154 |
+
{
|
155 |
+
?>
|
156 |
+
<div class="system_notice_area_style1" id="system_notice_area">
|
157 |
+
Successfully connected to xyzscripts member area. <span
|
158 |
+
id="system_notice_area_dismiss">Dismiss</span>
|
159 |
+
</div>
|
160 |
+
<?php
|
161 |
+
}
|
162 |
+
if(isset($_GET['msg']) && $_GET['msg']==5)
|
163 |
+
{
|
164 |
+
?>
|
165 |
+
<div class="system_notice_area_style1" id="system_notice_area">
|
166 |
+
Selected pages saved successfully. <span
|
167 |
+
id="system_notice_area_dismiss">Dismiss</span>
|
168 |
+
</div>
|
169 |
+
<?php
|
170 |
+
}
|
171 |
|
172 |
if(isset($_POST['fb']) && $erf==1)
|
173 |
{
|
205 |
//$fbid=esc_html(get_option('xyz_fbap_fb_id'));
|
206 |
$posting_method=get_option('xyz_fbap_po_method');
|
207 |
$posting_message=esc_textarea(get_option('xyz_fbap_message'));
|
208 |
+
if(get_option('xyz_fbap_app_sel_mode')==0)
|
209 |
+
{
|
210 |
if($af==1 && $appid!="" && $appsecret!="")
|
211 |
{
|
212 |
?>
|
213 |
+
<span style="color: red;" id="auth_message" >Application needs authorisation</span> <br>
|
214 |
<form method="post">
|
215 |
<?php wp_nonce_field( 'xyz_smap_fb_auth_nonce' );?>
|
216 |
<input type="submit" class="submit_fbap_new" name="fb_auth"
|
228 |
|
229 |
</form>
|
230 |
<?php }
|
231 |
+
}
|
232 |
+
elseif (get_option('xyz_fbap_app_sel_mode')==1){//add trim
|
233 |
+
$domain_name=trim(get_option('siteurl'));
|
234 |
+
$xyz_fbap_smapsoln_userid=intval(trim(get_option('xyz_fbap_smapsoln_userid')));
|
235 |
+
$xyzscripts_hash_val=trim(get_option('xyz_fbap_xyzscripts_hash_val'));
|
236 |
+
$xyzscripts_user_id=trim(get_option('xyz_fbap_xyzscripts_user_id'));
|
237 |
+
$xyz_smap_accountId=0;
|
238 |
+
$xyz_smap_licence_key='';
|
239 |
+
$auth_secret_key=md5('smapsolutions'.$domain_name.$xyz_smap_accountId.$xyz_fbap_smapsoln_userid.$xyzscripts_user_id.$xyzscripts_hash_val.$xyz_smap_licence_key);
|
240 |
+
if($af==1 )
|
241 |
+
{
|
242 |
+
?>
|
243 |
+
<span id='ajax-save' style="display:none;"><img class="img" title="Saving details" src="<?php echo plugins_url('../images/ajax-loader.gif',__FILE__);?>" style="width:65px;height:70px; "></span>
|
244 |
+
<span id="auth_message">
|
245 |
+
<span style="color: red;" >Application needs authorisation</span> <br>
|
246 |
+
<form method="post">
|
247 |
+
<?php wp_nonce_field( 'xyz_smap_fb_auth_nonce' );?>
|
248 |
+
<input type="hidden" value="<?php echo (is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; ?>" id="parent_domain">
|
249 |
+
<input type="submit" class="submit_fbap_new" name="fb_auth"
|
250 |
+
value="Authorize" onclick="javascript:return fbap_popup_fb_auth('<?php echo urlencode($domain_name);?>','<?php echo $xyz_fbap_smapsoln_userid;?>','<?php echo $xyzscripts_user_id;?>','<?php echo $xyzscripts_hash_val;?>','<?php echo $auth_secret_key;?>');"/><br><br>
|
251 |
+
</form></span>
|
252 |
+
<?php }
|
253 |
+
else if($af==0 )
|
254 |
+
{
|
255 |
+
?>
|
256 |
+
<span id='ajax-save' style="display:none;"><img class="img" title="Saving details" src="<?php echo plugins_url('../images/ajax-loader.gif',__FILE__);?>" style="width:65px;height:70px; "></span>
|
257 |
+
<form method="post" id="re_auth_message">
|
258 |
+
<?php wp_nonce_field( 'xyz_smap_fb_auth_nonce' );?>
|
259 |
+
<input type="hidden" value="<?php echo (is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; ?>" id="parent_domain">
|
260 |
+
<input type="submit" class="submit_fbap_new" name="fb_auth"
|
261 |
+
value="Reauthorize" title="Reauthorize the account" onclick="javascript:return fbap_popup_fb_auth('<?php echo urlencode($domain_name);?>','<?php echo $xyz_fbap_smapsoln_userid;?>','<?php echo $xyzscripts_user_id;?>','<?php echo $xyzscripts_hash_val;?>','<?php echo $auth_secret_key;?>');"/><br><br>
|
262 |
+
</form>
|
263 |
+
<?php }
|
264 |
+
}
|
265 |
if(isset($_GET['auth']) && $_GET['auth']==1 && get_option("xyz_fbap_fb_token")!="")
|
266 |
{
|
267 |
?>
|
271 |
<?php
|
272 |
}
|
273 |
?>
|
274 |
+
<table class="widefat" style="width: 99%;background-color: #FFFBCC" id="xyz_fbap_app_creation_note">
|
275 |
<tr>
|
276 |
<td id="bottomBorderNone" style="border: 1px solid #FCC328;">
|
277 |
|
281 |
<br>In the application page in facebook, navigate to <b>Apps >Add Product > Facebook Login >Quickstart >Web > Site URL</b>. Set the site url as :
|
282 |
<span style="color: red;"><?php echo (is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; ?></span>
|
283 |
<br>And then navigate to <b>Apps > Facebook Login > Settings</b>. Set the Valid OAuth redirect URIs as :<br>
|
284 |
+
<span style="color: red;"><?php echo $redirecturl; ?></span>
|
285 |
+
<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>.
|
286 |
</div>
|
287 |
|
288 |
</td>
|
302 |
<td><input id="xyz_fbap_application_name"
|
303 |
name="xyz_fbap_application_name" type="text"
|
304 |
value="<?php if($ms0=="") {echo esc_html(get_option('xyz_fbap_application_name'));}?>" />
|
|
|
305 |
</td>
|
306 |
</tr>
|
307 |
<tr valign="top">
|
308 |
+
<td width="50%">Application Selection
|
309 |
+
</td>
|
310 |
+
<td>
|
311 |
+
<input type="radio" name="xyz_fbap_app_sel_mode" id="xyz_fbap_app_sel_mode_reviewd" value="0" <?php if(get_option('xyz_fbap_app_sel_mode')==0) echo 'checked';?>>
|
312 |
+
Use your own Facebook reviewed application<br>
|
313 |
+
<a href="http://help.xyzscripts.com/docs/social-media-auto-publish/faq/how-can-i-create-facebook-application/" target="_blank" style="padding-left: 30px;">How can I create a Facebook Application?</a><br/>
|
314 |
+
<input type="radio" name="xyz_fbap_app_sel_mode" id="xyz_fbap_app_sel_mode_xyzapp" value="1" <?php if(get_option('xyz_fbap_app_sel_mode')==1) echo 'checked';?>>
|
315 |
+
Use smapsolution.com's Facebook application(Starts from 10 USD per year)<br>
|
316 |
+
<a target="_blank" href="https://help.xyzscripts.com/docs/social-media-auto-publish/faq/how-can-i-use-the-alternate-solution-for-publishing-posts-to-facebook/" style="padding-left: 30px;">How to use smapsolution.com's application?</a>
|
317 |
+
</td>
|
318 |
+
</tr>
|
319 |
+
<?php
|
320 |
+
if($xyzscripts_user_id =='' || $xyzscripts_hash_val=='' && $xyz_fbap_app_sel_mode==1)
|
321 |
+
{ ?>
|
322 |
+
<tr valign="top" id="xyz_fbap_conn_to_xyzscripts">
|
323 |
+
<td width="50%"> </td>
|
324 |
+
<td width="50%">
|
325 |
+
<span id='ajax-save-xyzscript_acc' style="display:none;"><img class="img" title="Saving details" src="<?php echo plugins_url('../images/ajax-loader.gif',__FILE__);?>" style="width:65px;height:70px; "></span>
|
326 |
+
<span id="connect_to_xyzscripts"style="background-color: #1A87B9;color: white; padding: 4px 5px;
|
327 |
+
text-align: center; text-decoration: none; display: inline-block;border-radius: 4px;">
|
328 |
+
<a href="javascript:fbap_popup_connect_to_xyzscripts();" style="color:white !important;">Connect your xyzscripts account</a>
|
329 |
+
</span>
|
330 |
+
</td>
|
331 |
+
</tr>
|
332 |
+
<?php }?>
|
333 |
+
<tr valign="top" class="xyz_fbap_facebook_settings">
|
334 |
<td width="50%">Application id
|
335 |
</td>
|
336 |
<td><input id="xyz_fbap_application_id"
|
339 |
</td>
|
340 |
</tr>
|
341 |
|
342 |
+
<tr valign="top" class="xyz_fbap_facebook_settings">
|
343 |
<td>Application secret<?php $apsecret=esc_html(get_option('xyz_fbap_application_secret'));?>
|
344 |
|
345 |
</td>
|
414 |
</tr>
|
415 |
<?php
|
416 |
$xyz_acces_token=get_option('xyz_fbap_fb_token');
|
417 |
+
if($xyz_acces_token!="" && get_option('xyz_fbap_app_sel_mode')==0){
|
418 |
|
419 |
$offset=0;$limit=100;$data=array();
|
420 |
do
|
455 |
?>
|
456 |
|
457 |
<tr valign="top"><td>
|
458 |
+
Select facebook pages for auto publish
|
459 |
</td>
|
460 |
<td>
|
461 |
|
462 |
<div class="scroll_checkbox">
|
463 |
<input type="checkbox" id="select_all_pages" >Select All
|
|
|
464 |
|
465 |
<?php
|
466 |
for($i=0;$i<$count;$i++)
|
471 |
<br><input type="checkbox" class="selpages" name="fbap_pages_list[]" value="<?php echo $data[$i]->id."-".$data[$i]->access_token;?>" <?php if(in_array($data[$i]->id, $fbap_pages_ids)) echo "checked" ?>><?php echo $data[$i]->name; ?>
|
472 |
<?php }
|
473 |
// $page_name=base64_encode(serialize($page_name));?>
|
|
|
474 |
</div>
|
475 |
</td></tr>
|
476 |
<?php
|
477 |
+
}elseif (get_option('xyz_fbap_app_sel_mode')==1)// &&pagelist frm smap solutions is not empty )
|
478 |
+
{
|
479 |
+
$xyz_fbap_page_names=stripslashes(get_option('xyz_fbap_page_names'));
|
480 |
+
$xyz_fbap_secret_key=get_option('xyz_fbap_secret_key');
|
481 |
+
?>
|
482 |
+
<tr id="xyz_fbap_selected_pages_tr" style="<?php if($xyz_fbap_page_names=='')echo "display:none;";?>">
|
483 |
+
<td>Selected facebook pages for auto publish</td>
|
484 |
+
<td><div class="scroll_checkbox" id="xyz_fbap_selected_pages" >
|
485 |
+
<?php
|
486 |
+
if($xyz_fbap_page_names!=''){
|
487 |
+
$xyz_fbap_page_names_array=json_decode($xyz_fbap_page_names);
|
488 |
+
foreach ($xyz_fbap_page_names_array as $sel_pageid=>$sel_pagename)
|
489 |
+
{
|
490 |
+
?>
|
491 |
+
<input type="checkbox" class="selpages" name="fbap_pages_list[]" value="<?php echo $sel_pageid;?>" disabled checked="checked"><?php echo $sel_pagename; ?><br>
|
492 |
+
<?php }}
|
493 |
+
?>
|
494 |
+
</div>
|
495 |
+
|
496 |
+
</td>
|
497 |
+
</tr>
|
498 |
+
<?php }
|
499 |
+
?>
|
500 |
<tr><td id="bottomBorderNone"></td>
|
501 |
<td id="bottomBorderNone"><div style="height: 50px;">
|
502 |
<input type="submit" class="submit_fbap_new"
|
822 |
checkedval= jQuery("input[name='"+value+"']:checked").val();
|
823 |
XyzFbapToggleRadio(checkedval,value);
|
824 |
});
|
825 |
+
var xyz_fbap_app_sel_mode=jQuery("input[name='xyz_fbap_app_sel_mode']:checked").val();
|
826 |
+
if(xyz_fbap_app_sel_mode !=0){
|
827 |
+
jQuery('#xyz_fbap_conn_to_xyzscripts').show();
|
828 |
+
jQuery('.xyz_fbap_facebook_settings').hide();
|
829 |
+
jQuery('#xyz_fbap_app_creation_note').hide();
|
830 |
+
}
|
831 |
+
else{
|
832 |
+
jQuery('.xyz_fbap_facebook_settings').show();
|
833 |
+
jQuery('#xyz_fbap_app_creation_note').show();
|
834 |
+
jQuery('#xyz_fbap_conn_to_xyzscripts').hide();
|
835 |
+
}
|
836 |
+
jQuery("input[name='xyz_fbap_app_sel_mode']").click(function(){
|
837 |
+
var xyz_fbap_app_sel_mode=jQuery("input[name='xyz_fbap_app_sel_mode']:checked").val();
|
838 |
+
if(xyz_fbap_app_sel_mode !=0){
|
839 |
+
jQuery('#xyz_fbap_app_creation_note').hide();
|
840 |
+
jQuery('.xyz_fbap_facebook_settings').hide();
|
841 |
+
jQuery('#xyz_fbap_conn_to_xyzscripts').show();
|
842 |
+
}
|
843 |
+
else{
|
844 |
+
jQuery('#xyz_fbap_app_creation_note').show();
|
845 |
+
jQuery('.xyz_fbap_facebook_settings').show();
|
846 |
+
jQuery('#xyz_fbap_conn_to_xyzscripts').hide();
|
847 |
+
}
|
848 |
+
});
|
849 |
+
window.addEventListener('message', function(e) {
|
850 |
+
ProcessChildMessage_2(e.data);
|
851 |
+
} , false);
|
852 |
});
|
853 |
|
854 |
function toggleRadio(value,buttonId)
|
931 |
xyz_fbap_show_postCategory(1);
|
932 |
});
|
933 |
});
|
934 |
+
function fbap_popup_fb_auth(domain_name,xyz_fbap_smapsoln_userid,xyzscripts_user_id,xyzscripts_hash_val,auth_secret_key)
|
935 |
+
{
|
936 |
+
if(xyzscripts_user_id==''|| xyzscripts_hash_val==''){
|
937 |
+
if(jQuery('#system_notice_area').length==0)
|
938 |
+
jQuery('body').append('<div class="system_notice_area_style0" id="system_notice_area"></div>');
|
939 |
+
jQuery("#system_notice_area").html('Please connect your xyzscripts member account <span id="system_notice_area_dismiss">Dismiss</span>');
|
940 |
+
jQuery("#system_notice_area").show();
|
941 |
+
jQuery('#system_notice_area_dismiss').click(function() {
|
942 |
+
jQuery('#system_notice_area').animate({
|
943 |
+
opacity : 'hide',
|
944 |
+
height : 'hide'
|
945 |
+
}, 500);
|
946 |
+
});
|
947 |
+
return false;
|
948 |
+
}
|
949 |
+
else{
|
950 |
+
var childWindow = null;
|
951 |
+
var fbap_licence_key='';
|
952 |
+
var account_id=0;
|
953 |
+
var smap_solution_url='<?php echo XYZ_SMAP_SOLUTION_AUTH_URL;?>';
|
954 |
+
childWindow = window.open(smap_solution_url+"authorize/facebook.php?smap_id="+xyz_fbap_smapsoln_userid+"&account_id="+account_id+
|
955 |
+
"&domain_name="+domain_name+"&xyzscripts_user_id="+xyzscripts_user_id+"&xyzscripts_hash_val="+xyzscripts_hash_val
|
956 |
+
+"&smap_licence_key="+fbap_licence_key+"&auth_secret_key="+auth_secret_key, "SmapSolutions Authorization", "toolbar=yes,scrollbars=yes,resizable=yes,left=500,width=600,height=600");
|
957 |
+
return false; }
|
958 |
+
}
|
959 |
|
960 |
+
function fbap_popup_connect_to_xyzscripts()
|
961 |
+
{
|
962 |
+
var childWindow = null;
|
963 |
+
var smap_xyzscripts_url='<?php echo "https://smap.xyzscripts.com/index.php?page=index/register";?>';
|
964 |
+
childWindow = window.open(smap_xyzscripts_url, "Connect to xyzscripts", "toolbar=yes,scrollbars=yes,resizable=yes,left=500,width=600,height=600");
|
965 |
+
return false;
|
966 |
+
}
|
967 |
+
function ProcessChildMessage_2(message) {
|
968 |
+
var messageType = message.slice(0,5);
|
969 |
+
if(messageType==="error")
|
970 |
+
{
|
971 |
+
message=message.substring(6);
|
972 |
+
if(jQuery('#system_notice_area').length==0)
|
973 |
+
jQuery('body').append('<div class="system_notice_area_style0" id="system_notice_area"></div>');
|
974 |
+
jQuery("#system_notice_area").html(message+' <span id="system_notice_area_dismiss">Dismiss</span>');
|
975 |
+
jQuery("#system_notice_area").show();
|
976 |
+
jQuery('#system_notice_area_dismiss').click(function() {
|
977 |
+
jQuery('#system_notice_area').animate({
|
978 |
+
opacity : 'hide',
|
979 |
+
height : 'hide'
|
980 |
+
}, 500);
|
981 |
+
});
|
982 |
+
}
|
983 |
+
var obj1=jQuery.parseJSON(message);
|
984 |
+
if(obj1.content && obj1.userid)
|
985 |
+
{
|
986 |
+
var xyz_userid=obj1.userid;var xyz_user_hash=obj1.content;
|
987 |
+
var xyz_fbap_xyzscripts_accinfo_nonce= '<?php echo wp_create_nonce('xyz_fbap_xyzscripts_accinfo_nonce');?>';
|
988 |
+
var dataString = {
|
989 |
+
action: 'xyz_fbap_xyzscripts_accinfo_auto_update',
|
990 |
+
xyz_userid: xyz_userid ,
|
991 |
+
xyz_user_hash: xyz_user_hash,
|
992 |
+
dataType: 'json',
|
993 |
+
_wpnonce: xyz_fbap_xyzscripts_accinfo_nonce
|
994 |
+
};
|
995 |
+
jQuery("#connect_to_xyzscripts").hide();
|
996 |
+
jQuery("#ajax-save-xyzscript_acc").show();
|
997 |
+
jQuery.post(ajaxurl, dataString ,function(response) {
|
998 |
+
var base_url = '<?php echo admin_url('admin.php?page=facebook-auto-publish-settings');?>';//msg -
|
999 |
+
window.location.href = base_url+'&msg=4';
|
1000 |
+
});
|
1001 |
+
}
|
1002 |
+
else if(obj1.pages !='')
|
1003 |
+
{
|
1004 |
+
var obj1=jQuery.parseJSON(message);
|
1005 |
+
// console.log(obj1);
|
1006 |
+
var obj=obj1.pages;
|
1007 |
+
var secretkey=obj1.secretkey;
|
1008 |
+
var xyz_fbap_fb_numericid=obj1.xyz_fb_numericid;
|
1009 |
+
var smapsoln_userid=obj1.smapsoln_userid;
|
1010 |
+
jQuery("#xyz_fbap_secret_key").val(secretkey);
|
1011 |
+
var list='';
|
1012 |
+
for (var key in obj) {
|
1013 |
+
if (obj.hasOwnProperty(key)) {
|
1014 |
+
var val = obj[key];
|
1015 |
+
list=list+"<input type='checkbox' value='"+key+"' checked='checked' disabled>"+val+"<br>";
|
1016 |
+
}
|
1017 |
+
}
|
1018 |
+
jQuery("#xyz_fbap_page_names").val(JSON.stringify(obj));
|
1019 |
+
jQuery("#xyz_fbap_selected_pages").html(list);
|
1020 |
+
jQuery("#xyz_fbap_selected_pages_tr").show();
|
1021 |
+
jQuery("#auth_message").hide();
|
1022 |
+
jQuery("#re_auth_message").show();
|
1023 |
+
var xyz_fbap_selected_pages_nonce= '<?php echo wp_create_nonce('xyz_fbap_selected_pages_nonce');?>';
|
1024 |
+
var pages_obj = JSON.stringify(obj);
|
1025 |
+
var dataString = {
|
1026 |
+
action: 'xyz_fbap_selected_pages_auto_update',
|
1027 |
+
pages: pages_obj ,
|
1028 |
+
smap_secretkey: secretkey,
|
1029 |
+
xyz_fb_numericid: xyz_fbap_fb_numericid,
|
1030 |
+
smapsoln_userid:smapsoln_userid,
|
1031 |
+
dataType: 'json',
|
1032 |
+
_wpnonce: xyz_fbap_selected_pages_nonce
|
1033 |
+
};
|
1034 |
+
jQuery("#re_auth_message").hide();
|
1035 |
+
jQuery("#auth_message").hide();
|
1036 |
+
jQuery("#ajax-save-xyzscript_acc").show();
|
1037 |
+
jQuery.post(ajaxurl, dataString ,function(response) {
|
1038 |
+
var base_url = '<?php echo admin_url('admin.php?page=facebook-auto-publish-settings');?>';//msg -
|
1039 |
+
window.location.href = base_url+'&msg=5';
|
1040 |
+
});
|
1041 |
+
}
|
1042 |
+
else
|
1043 |
+
{
|
1044 |
+
if(jQuery('#system_notice_area').length==0)
|
1045 |
+
jQuery('body').append('<div class="system_notice_area_style0" id="system_notice_area"></div>');
|
1046 |
+
jQuery("#system_notice_area").html('An unexpected error occured,please try again <span id="system_notice_area_dismiss">Dismiss</span>');
|
1047 |
+
jQuery("#system_notice_area").show();
|
1048 |
+
jQuery('#system_notice_area_dismiss').click(function() {
|
1049 |
+
jQuery('#system_notice_area').animate({
|
1050 |
+
opacity : 'hide',
|
1051 |
+
height : 'hide'
|
1052 |
+
}, 500);
|
1053 |
+
});
|
1054 |
+
}
|
1055 |
+
}</script>
|
facebook-auto-publish.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Facebook Auto Publish
|
4 |
Plugin URI: https://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:
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: https://xyzscripts.com/
|
9 |
License: GPLv2 or later
|
@@ -32,18 +32,12 @@ if ( !function_exists( 'add_action' ) ) {
|
|
32 |
|
33 |
//error_reporting(E_ALL);
|
34 |
define('XYZ_FBAP_PLUGIN_FILE',__FILE__);
|
35 |
-
define('XYZ_FBAP_FB_API_VERSION','
|
36 |
-
|
37 |
-
|
38 |
-
//define('XYZ_FBAP_FB_api_video','https://api-video.facebook.com/'.XYZ_FBAP_FB_API_VERSION.'/');
|
39 |
-
//define('XYZ_FBAP_FB_api_read','https://api-read.facebook.com/'.XYZ_FBAP_FB_API_VERSION.'/');
|
40 |
-
//define('XYZ_FBAP_FB_graph','https://graph.facebook.com/'.XYZ_FBAP_FB_API_VERSION.'/');
|
41 |
-
//define('XYZ_FBAP_FB_graph_video','https://graph-video.facebook.com/'.XYZ_FBAP_FB_API_VERSION.'/');
|
42 |
-
//define('XYZ_FBAP_FB_www','https://www.facebook.com/'.XYZ_FBAP_FB_API_VERSION.'/');
|
43 |
|
44 |
global $wpdb;
|
45 |
-
|
46 |
-
if(isset($_POST) && isset($_POST['fb_auth'] ) || (isset($_GET['page']) && ($_GET['page']=='facebook-auto-publish-settings')) )
|
47 |
{
|
48 |
ob_start();
|
49 |
}
|
3 |
Plugin Name: WP Facebook Auto Publish
|
4 |
Plugin URI: https://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: 2.0
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: https://xyzscripts.com/
|
9 |
License: GPLv2 or later
|
32 |
|
33 |
//error_reporting(E_ALL);
|
34 |
define('XYZ_FBAP_PLUGIN_FILE',__FILE__);
|
35 |
+
define('XYZ_FBAP_FB_API_VERSION','v3.0');
|
36 |
+
define('XYZ_SMAP_SOLUTION_AUTH_URL','https://authorize.smapsolutions.com/');
|
37 |
+
define('XYZ_SMAP_SOLUTION_PUBLISH_URL','https://free-publish.smapsolutions.com/');
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
global $wpdb;
|
40 |
+
if(isset($_POST) && isset($_POST['fb_auth'] ) ||(isset($_GET['page']) && ($_GET['page']=='facebook-auto-publish-suggest-feature'))|| (isset($_GET['page']) && ($_GET['page']=='facebook-auto-publish-settings')) )
|
|
|
41 |
{
|
42 |
ob_start();
|
43 |
}
|
images/ajax-loader.gif
ADDED
Binary file
|
readme.txt
CHANGED
@@ -1,256 +1,261 @@
|
|
1 |
-
=== WP Facebook Auto Publish ===
|
2 |
-
Contributors: f1logic
|
3 |
-
Donate link: https://xyzscripts.com/donate/
|
4 |
-
Tags: facebook, facebook auto publish,wp 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.9.
|
7 |
-
Stable tag:
|
8 |
-
License: GPLv2 or later
|
9 |
-
|
10 |
-
Publish posts automatically to Facebook page or profile.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
A quick look into WP Facebook Auto Publish :
|
15 |
-
|
16 |
-
★ Publish message to Facebook with image
|
17 |
-
★ Attach post or share link to Facebook
|
18 |
-
★ Filter items to be published based on categories
|
19 |
-
★ Filter items to be published based on custom post types
|
20 |
-
★ Enable or disable wordpress page publishing
|
21 |
-
★ Customizable message formats for Facebook
|
22 |
-
|
23 |
-
|
24 |
-
= WP Facebook Auto Publish Features in Detail =
|
25 |
-
|
26 |
-
The WP Facebook Auto Publish lets you publish posts automatically from your blog to Facebook. 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 based on custom post-types as well as categories.
|
27 |
-
|
28 |
-
The prominent features of the WP Facebook Auto Publish plugin are highlighted below.
|
29 |
-
|
30 |
-
= Supported Mechanisms =
|
31 |
-
|
32 |
-
The various mechanisms of posting to Facebook are listed below.
|
33 |
-
|
34 |
-
Simple text message
|
35 |
-
Text message with image
|
36 |
-
Share a link to your blog post
|
37 |
-
Attach your blog post
|
38 |
-
Post to Facebook profile page
|
39 |
-
Post to specific pages on Facebook
|
40 |
-
|
41 |
-
= Filter Settings =
|
42 |
-
|
43 |
-
The plugin offers multiple kinds of filters for contents to be published automatically.
|
44 |
-
|
45 |
-
Enable or disable publishing of wordpress pages
|
46 |
-
Filter posts to be published based on categories
|
47 |
-
Filtering based on custom post types
|
48 |
-
|
49 |
-
= Message Format Settings =
|
50 |
-
|
51 |
-
The supported post elements which can be published are given below.
|
52 |
-
|
53 |
-
Post title
|
54 |
-
Post description
|
55 |
-
Post excerpt
|
56 |
-
Permalink
|
57 |
-
Blog title
|
58 |
-
User nicename
|
59 |
-
Post ID
|
60 |
-
Post publish date
|
61 |
-
|
62 |
-
|
63 |
-
= About =
|
64 |
-
|
65 |
-
WP Facebook Auto Publish is developed and maintained by [XYZScripts](https://xyzscripts.com/ "xyzscripts.com"). For any support, you may [contact us](https://xyzscripts.com/support/ "XYZScripts Support").
|
66 |
-
|
67 |
-
★ [WP Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "WP Facebook Auto Publish User Guide")
|
68 |
-
★ [WP Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "WP Facebook Auto Publish FAQ")
|
69 |
-
|
70 |
-
== Installation ==
|
71 |
-
|
72 |
-
★ [WP Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "WP Facebook Auto Publish User Guide")
|
73 |
-
★ [WP Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "WP Facebook Auto Publish FAQ")
|
74 |
-
|
75 |
-
1. Extract `facebook-auto-publish.zip` to your `/wp-content/plugins/` directory.
|
76 |
-
2. In the admin panel under plugins activate WP Facebook Auto Publish.
|
77 |
-
3. You can configure the settings from WP Facebook Auto Publish menu. (Make sure to Authorize Facebook application after saving the settings.)
|
78 |
-
4. Once these are done, posts should get automatically published based on your filter settings.
|
79 |
-
|
80 |
-
If you need any further help, you may contact our [support desk](https://xyzscripts.com/support/ "XYZScripts Support").
|
81 |
-
|
82 |
-
== Frequently Asked Questions ==
|
83 |
-
|
84 |
-
★ [WP Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "WP Facebook Auto Publish User Guide")
|
85 |
-
★ [WP Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "WP Facebook Auto Publish FAQ")
|
86 |
-
|
87 |
-
= 1. The WP Facebook Auto Publish is not working properly. =
|
88 |
-
|
89 |
-
Please check the wordpress version you are using. Make sure it meets the minimum version recommended by us. Make sure all files of the `wp facebook auto publish` plugin are uploaded to the folder `wp-content/plugins/`
|
90 |
-
|
91 |
-
|
92 |
-
= 2. Can I post to Facebook pages instead of profile ? =
|
93 |
-
|
94 |
-
Yes, you can select the pages to which you need to publish after authorizing Facebook application.
|
95 |
-
|
96 |
-
|
97 |
-
= 3. How do I restrict auto publish to certain categories ? =
|
98 |
-
|
99 |
-
Yes, you can specify the categories which need to be auto published from settings page.
|
100 |
-
|
101 |
-
|
102 |
-
= 4. Why do I have to create applications in Facebook ? =
|
103 |
-
|
104 |
-
When you create your own applications, it ensures that the posts to Facebook are not shared with any message like "shared via xxx"
|
105 |
-
|
106 |
-
|
107 |
-
= 5. Which all data fields can I send to Facebook ? =
|
108 |
-
|
109 |
-
You may use post title, content, excerpt, permalink, site title and user nicename for auto publishing.
|
110 |
-
|
111 |
-
|
112 |
-
= 6. Why do I see SSL related errors in logs ? =
|
113 |
-
|
114 |
-
SSL peer verification may not be functioning in your server. Please turn off SSL peer verification in settings of plugin and try again.
|
115 |
-
|
116 |
-
|
117 |
-
= More questions ? =
|
118 |
-
|
119 |
-
[Drop a mail](https://xyzscripts.com/support/ "XYZScripts Support") and we shall get back to you with the answers.
|
120 |
-
|
121 |
-
|
122 |
-
== Screenshots ==
|
123 |
-
|
124 |
-
1. This is the Facebook configuration section.
|
125 |
-
2. Publishing options while creating a post.
|
126 |
-
|
127 |
-
== Changelog ==
|
128 |
-
|
129 |
-
= WP Facebook Auto Publish
|
130 |
-
* Removed
|
131 |
-
*
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
*
|
140 |
-
|
141 |
-
= Facebook Auto Publish 1.4.
|
142 |
-
*
|
143 |
-
* Minor
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
*
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
*
|
152 |
-
*
|
153 |
-
|
154 |
-
= Facebook Auto Publish 1.4.
|
155 |
-
*
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
*
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
*
|
166 |
-
*
|
167 |
-
*
|
168 |
-
|
169 |
-
= Facebook Auto Publish 1.4 =
|
170 |
-
*
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
*
|
180 |
-
|
181 |
-
|
182 |
-
*
|
183 |
-
|
184 |
-
|
185 |
-
*
|
186 |
-
*
|
187 |
-
*
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
*
|
193 |
-
*
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
*
|
202 |
-
|
203 |
-
= Facebook Auto Publish 1.2 =
|
204 |
-
*
|
205 |
-
*
|
206 |
-
*
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
*
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
*
|
216 |
-
|
217 |
-
= Facebook Auto Publish 1.1 =
|
218 |
-
*
|
219 |
-
*
|
220 |
-
*
|
221 |
-
|
222 |
-
= Facebook Auto Publish 1.
|
223 |
-
*
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
= Facebook Auto Publish 1.0
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
=
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WP Facebook Auto Publish ===
|
2 |
+
Contributors: f1logic
|
3 |
+
Donate link: https://xyzscripts.com/donate/
|
4 |
+
Tags: facebook, facebook auto publish,wp 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.9.8
|
7 |
+
Stable tag: 2.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
|
10 |
+
Publish posts automatically to Facebook page or profile.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
A quick look into WP Facebook Auto Publish :
|
15 |
+
|
16 |
+
★ Publish message to Facebook with image
|
17 |
+
★ Attach post or share link to Facebook
|
18 |
+
★ Filter items to be published based on categories
|
19 |
+
★ Filter items to be published based on custom post types
|
20 |
+
★ Enable or disable wordpress page publishing
|
21 |
+
★ Customizable message formats for Facebook
|
22 |
+
|
23 |
+
|
24 |
+
= WP Facebook Auto Publish Features in Detail =
|
25 |
+
|
26 |
+
The WP Facebook Auto Publish lets you publish posts automatically from your blog to Facebook. 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 based on custom post-types as well as categories.
|
27 |
+
|
28 |
+
The prominent features of the WP Facebook Auto Publish plugin are highlighted below.
|
29 |
+
|
30 |
+
= Supported Mechanisms =
|
31 |
+
|
32 |
+
The various mechanisms of posting to Facebook are listed below.
|
33 |
+
|
34 |
+
Simple text message
|
35 |
+
Text message with image
|
36 |
+
Share a link to your blog post
|
37 |
+
Attach your blog post
|
38 |
+
Post to Facebook profile page
|
39 |
+
Post to specific pages on Facebook
|
40 |
+
|
41 |
+
= Filter Settings =
|
42 |
+
|
43 |
+
The plugin offers multiple kinds of filters for contents to be published automatically.
|
44 |
+
|
45 |
+
Enable or disable publishing of wordpress pages
|
46 |
+
Filter posts to be published based on categories
|
47 |
+
Filtering based on custom post types
|
48 |
+
|
49 |
+
= Message Format Settings =
|
50 |
+
|
51 |
+
The supported post elements which can be published are given below.
|
52 |
+
|
53 |
+
Post title
|
54 |
+
Post description
|
55 |
+
Post excerpt
|
56 |
+
Permalink
|
57 |
+
Blog title
|
58 |
+
User nicename
|
59 |
+
Post ID
|
60 |
+
Post publish date
|
61 |
+
|
62 |
+
|
63 |
+
= About =
|
64 |
+
|
65 |
+
WP Facebook Auto Publish is developed and maintained by [XYZScripts](https://xyzscripts.com/ "xyzscripts.com"). For any support, you may [contact us](https://xyzscripts.com/support/ "XYZScripts Support").
|
66 |
+
|
67 |
+
★ [WP Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "WP Facebook Auto Publish User Guide")
|
68 |
+
★ [WP Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "WP Facebook Auto Publish FAQ")
|
69 |
+
|
70 |
+
== Installation ==
|
71 |
+
|
72 |
+
★ [WP Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "WP Facebook Auto Publish User Guide")
|
73 |
+
★ [WP Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "WP Facebook Auto Publish FAQ")
|
74 |
+
|
75 |
+
1. Extract `facebook-auto-publish.zip` to your `/wp-content/plugins/` directory.
|
76 |
+
2. In the admin panel under plugins activate WP Facebook Auto Publish.
|
77 |
+
3. You can configure the settings from WP Facebook Auto Publish menu. (Make sure to Authorize Facebook application after saving the settings.)
|
78 |
+
4. Once these are done, posts should get automatically published based on your filter settings.
|
79 |
+
|
80 |
+
If you need any further help, you may contact our [support desk](https://xyzscripts.com/support/ "XYZScripts Support").
|
81 |
+
|
82 |
+
== Frequently Asked Questions ==
|
83 |
+
|
84 |
+
★ [WP Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/user-guide/ "WP Facebook Auto Publish User Guide")
|
85 |
+
★ [WP Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "WP Facebook Auto Publish FAQ")
|
86 |
+
|
87 |
+
= 1. The WP Facebook Auto Publish is not working properly. =
|
88 |
+
|
89 |
+
Please check the wordpress version you are using. Make sure it meets the minimum version recommended by us. Make sure all files of the `wp facebook auto publish` plugin are uploaded to the folder `wp-content/plugins/`
|
90 |
+
|
91 |
+
|
92 |
+
= 2. Can I post to Facebook pages instead of profile ? =
|
93 |
+
|
94 |
+
Yes, you can select the pages to which you need to publish after authorizing Facebook application.
|
95 |
+
|
96 |
+
|
97 |
+
= 3. How do I restrict auto publish to certain categories ? =
|
98 |
+
|
99 |
+
Yes, you can specify the categories which need to be auto published from settings page.
|
100 |
+
|
101 |
+
|
102 |
+
= 4. Why do I have to create applications in Facebook ? =
|
103 |
+
|
104 |
+
When you create your own applications, it ensures that the posts to Facebook are not shared with any message like "shared via xxx"
|
105 |
+
|
106 |
+
|
107 |
+
= 5. Which all data fields can I send to Facebook ? =
|
108 |
+
|
109 |
+
You may use post title, content, excerpt, permalink, site title and user nicename for auto publishing.
|
110 |
+
|
111 |
+
|
112 |
+
= 6. Why do I see SSL related errors in logs ? =
|
113 |
+
|
114 |
+
SSL peer verification may not be functioning in your server. Please turn off SSL peer verification in settings of plugin and try again.
|
115 |
+
|
116 |
+
|
117 |
+
= More questions ? =
|
118 |
+
|
119 |
+
[Drop a mail](https://xyzscripts.com/support/ "XYZScripts Support") and we shall get back to you with the answers.
|
120 |
+
|
121 |
+
|
122 |
+
== Screenshots ==
|
123 |
+
|
124 |
+
1. This is the Facebook configuration section.
|
125 |
+
2. Publishing options while creating a post.
|
126 |
+
|
127 |
+
== Changelog ==
|
128 |
+
|
129 |
+
= WP Facebook Auto Publish 2.0 =
|
130 |
+
* Removed unwanted facebook permissions
|
131 |
+
* Added Facebook authorization and publishing using SMAPSolutions.com
|
132 |
+
* Increased logs count from 5 to 10
|
133 |
+
|
134 |
+
= WP Facebook Auto Publish 1.4.9 =
|
135 |
+
* Removed Facebook deprecated permission 'publish_actions'
|
136 |
+
* Applied wordpress time format in {POST_PUBLISH_DATE}
|
137 |
+
|
138 |
+
= WP Facebook Auto Publish 1.4.8 =
|
139 |
+
* Plugin name changed to WP Facebook Auto Publish, as per wordpress guidelines
|
140 |
+
|
141 |
+
= Facebook Auto Publish 1.4.7 =
|
142 |
+
* Fixed facebook authorisation issue
|
143 |
+
* Minor bug fixes
|
144 |
+
* UI updated
|
145 |
+
|
146 |
+
= Facebook Auto Publish 1.4.6 =
|
147 |
+
* Added USER_DISPLAY_NAME in message formats
|
148 |
+
* Minor security issues fixed
|
149 |
+
|
150 |
+
= Facebook Auto Publish 1.4.5 =
|
151 |
+
* Compatibility with facebook API V 2.11 added
|
152 |
+
* Minor bug fixes
|
153 |
+
|
154 |
+
= Facebook Auto Publish 1.4.4 =
|
155 |
+
* Removed Caption from {POST_CONTENT}
|
156 |
+
* Fixed Facebook image selection issue for 'Share a link to your blog post' and 'Attach your blog post'
|
157 |
+
* Fixed ssl peer verification in wp_remote_get/wp_remote_post calls
|
158 |
+
|
159 |
+
= Facebook Auto Publish 1.4.3 =
|
160 |
+
* Added POST_ID and POST_PUBLISH_DATE in message formats
|
161 |
+
|
162 |
+
= Facebook Auto Publish 1.4.2 =
|
163 |
+
* Fixed facebook boost unavailable issue
|
164 |
+
* Nonce added
|
165 |
+
* Prevented direct access to plugin files
|
166 |
+
* Data validation updated
|
167 |
+
* App album related issue fixed
|
168 |
+
|
169 |
+
= Facebook Auto Publish 1.4.1 =
|
170 |
+
* utf-8 decoding issue fixed
|
171 |
+
* Visual composer compatiblity issue fixed
|
172 |
+
* Minor bugs fixed
|
173 |
+
|
174 |
+
= Facebook Auto Publish 1.4 =
|
175 |
+
* Facebook api updated(requires PHP version 5.4 or higher)
|
176 |
+
|
177 |
+
= Facebook Auto Publish 1.3.1 =
|
178 |
+
* Fixed custom post types autopublish issue
|
179 |
+
* Fixed duplicate autopublish issue
|
180 |
+
|
181 |
+
= Facebook Auto Publish 1.3 =
|
182 |
+
* Added option to enable/disable utf-8 decoding before publishing
|
183 |
+
* Removed unwanted configuration related to 'future_to_publish' hook
|
184 |
+
* Removed unwanted setting "Facebook user id"
|
185 |
+
* Postid added in autopublish logs
|
186 |
+
* Updated auto publish mechanism using transition_post_status hook
|
187 |
+
* Open graph meta tags will be prefered for facebook attachments
|
188 |
+
|
189 |
+
= Facebook Auto Publish 1.2.4 =
|
190 |
+
* Added option to enable/disable "future_to_publish" hook for handling auto publish of scheduled posts
|
191 |
+
* Added options to enable/disable "the_content", "the_excerpt", "the_title" filters on content to be auto-published
|
192 |
+
* Resolved issue in fetching facebook pages in settings page (in case of more than 100 pages)
|
193 |
+
* Inline edit of posts will work according to the value set for "Default selection of auto publish while editing posts/pages"
|
194 |
+
* Latest five auto publish logs are maintained
|
195 |
+
|
196 |
+
= Facebook Auto Publish 1.2.3 =
|
197 |
+
* Fixed category display issue
|
198 |
+
* Removed outdated facebook scopes from authorization
|
199 |
+
|
200 |
+
= Facebook Auto Publish 1.2.2 =
|
201 |
+
* Bug fix for duplicate publishing of scheduled posts
|
202 |
+
|
203 |
+
= Facebook Auto Publish 1.2.1 =
|
204 |
+
* Fixed auto publish related bug in post edit
|
205 |
+
* Fixed message format bug in auto publish
|
206 |
+
* Updated Facebook authorization
|
207 |
+
|
208 |
+
= Facebook Auto Publish 1.2 =
|
209 |
+
* Option to configure auto publish settings while editing posts/pages
|
210 |
+
* General setting to enable/disable post publishing
|
211 |
+
* Added auto publish for scheduled post
|
212 |
+
* Fixed issue related to \" in auto publish
|
213 |
+
|
214 |
+
= Facebook Auto Publish 1.1.2 =
|
215 |
+
* Fixed auto-publish of scheduled post
|
216 |
+
|
217 |
+
= Facebook Auto Publish 1.1.1 =
|
218 |
+
* Added compatibility with wordpress 3.9.1
|
219 |
+
* Facebook API V 2.0 compatibility added
|
220 |
+
* Compatibility with bitly plugin
|
221 |
+
|
222 |
+
= Facebook Auto Publish 1.1 =
|
223 |
+
* View logs for last published post
|
224 |
+
* Option to enable/disable SSL peer verification
|
225 |
+
* Option to reauthorize the application
|
226 |
+
|
227 |
+
= Facebook Auto Publish 1.0.2 =
|
228 |
+
* Bug fixed for &nbsp; in post
|
229 |
+
|
230 |
+
= Facebook Auto Publish 1.0.1 =
|
231 |
+
* Default image fetch logic for auto publish updated.
|
232 |
+
* Thumbnail image logic updated.
|
233 |
+
|
234 |
+
= Facebook Auto Publish 1.0 =
|
235 |
+
* First official launch.
|
236 |
+
|
237 |
+
== Upgrade Notice ==
|
238 |
+
|
239 |
+
= Facebook Auto Publish 1.0.1 =
|
240 |
+
If you had issues with default image used for auto publishing, you may apply this upgrade.
|
241 |
+
|
242 |
+
= Facebook Auto Publish 1.0 =
|
243 |
+
First official launch.
|
244 |
+
|
245 |
+
== More Information ==
|
246 |
+
|
247 |
+
★ [WP Facebook Auto Publish User Guide](http://help.xyzscripts.com/docs/facebook-auto-publish/ "WP Facebook Auto Publish User Guide")
|
248 |
+
★ [WP Facebook Auto Publish FAQ](http://help.xyzscripts.com/docs/facebook-auto-publish/faq/ "WP Facebook Auto Publish FAQ")
|
249 |
+
|
250 |
+
= Troubleshooting =
|
251 |
+
|
252 |
+
Please read the FAQ first if you are having problems.
|
253 |
+
|
254 |
+
= Requirements =
|
255 |
+
|
256 |
+
WordPress 3.0+
|
257 |
+
PHP 5.4+
|
258 |
+
|
259 |
+
= Feedback =
|
260 |
+
|
261 |
+
We would like to receive your feedback and suggestions about WP Facebook Auto Publish plugin. You may submit them at our [support desk](https://xyzscripts.com/support/ "XYZScripts Support").
|
xyz-functions.php
CHANGED
@@ -105,7 +105,7 @@ function xyz_fbap_getimage($post_ID,$description_org)
|
|
105 |
if(isset($matches[1][0]))
|
106 |
$attachmenturl = $matches[1][0];
|
107 |
else {
|
108 |
-
apply_filters('the_content', $description_org);
|
109 |
preg_match_all( '/< *img[^>]*src *= *["\']?([^"\']*)/is', $description_org, $matches );
|
110 |
if(isset($matches[1][0]))
|
111 |
$attachmenturl = $matches[1][0];
|
@@ -225,4 +225,27 @@ function xyz_fbap_is_session_started()
|
|
225 |
|
226 |
|
227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
?>
|
105 |
if(isset($matches[1][0]))
|
106 |
$attachmenturl = $matches[1][0];
|
107 |
else {
|
108 |
+
$description_org=apply_filters('the_content', $description_org);
|
109 |
preg_match_all( '/< *img[^>]*src *= *["\']?([^"\']*)/is', $description_org, $matches );
|
110 |
if(isset($matches[1][0]))
|
111 |
$attachmenturl = $matches[1][0];
|
225 |
|
226 |
|
227 |
|
228 |
+
if(!function_exists('xyz_fbap_post_to_facebook'))
|
229 |
+
{ function xyz_fbap_post_to_facebook($post_details) {
|
230 |
+
if (function_exists('curl_init'))
|
231 |
+
{
|
232 |
+
$url=XYZ_SMAP_SOLUTION_PUBLISH_URL.'api/facebook.php';
|
233 |
+
$header_array = array();
|
234 |
+
$header_array[]='X-SMAP-AUTH-KEY: '.$post_details['xyz_smap_secret_key'];
|
235 |
+
$post_parameters['post_params'] = serialize($post_details);
|
236 |
+
$post_parameters['request_hash'] = md5($post_parameters['post_params'].$post_details['xyz_smap_secret_key']);
|
237 |
+
|
238 |
+
$ch = curl_init();
|
239 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
240 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array);
|
241 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
242 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_parameters);
|
243 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
244 |
+
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER,(get_option('xyz_fbap_peer_verification')=='1') ? true : false);
|
245 |
+
$content = curl_exec($ch);
|
246 |
+
curl_close($ch);
|
247 |
+
return $content;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
}
|
251 |
?>
|