-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle-plus-auto-poster.php
156 lines (135 loc) · 4.95 KB
/
google-plus-auto-poster.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
/*
Plugin Name: Google Plus Auto Poster
Plugin URI: http://www.wpsuperplugin.com
Description: This plugin automatically publishes posts from on your google profile page
Version: 1.1
Author: Mr.Subhash Patel
Author URI: http://www.wpsuperplugin.com
*/
function wpsp_googleplus_deactiveplugin()
{
global $wpdb;
}
register_deactivation_hook( __FILE__, 'wpsp_googleplus_deactiveplugin' );
//Drop Database Table
function wpsp_googleplus_dropplugin()
{
global $wpdb;
delete_option('wpsp_gpapoption');
delete_option('wpsp_gpapoptionstatus');
}
register_uninstall_hook( __FILE__, 'wpsp_googleplus_dropplugin' );
function wpsp_gmail_menu()
{
//icon display on side title plugin in leftside
$icon_url=WP_PLUGIN_URL."/google-plus-auto-poster/images/googleplusicone.png";
add_menu_page('WPSP_Googlepost_Autopost', 'Google+Autopost', 'activate_plugins', 'wpspgpap_authontication', 'wpspgpap_authon',$icon_url);
}
add_action('admin_menu', 'wpsp_gmail_menu');
function wpspgpap_authon()
{
$wpapgetoption =get_option('wpsp_gpapoption');
if(($_POST['username']!="" && $_POST['password']!=""))
{
if($_POST['username']!="" && $_POST['password']!="")
{
require_once('googleplus.php');
//Option Value
if ( get_option( 'wpsp_gpapoption' ) !== false ) update_option( 'wpsp_gpapoption' , $_POST ); else add_option('wpsp_gpapoption' , $_POST );
require_once('authontication.php');
}
}
?>
<link href="<?php echo WP_PLUGIN_URL."/google-plus-auto-poster/css/wpspgoogleplus.css"; ?>" rel="stylesheet" type="text/css" />
<div style="margin-top:20px;">
<?php
$statusgpap =get_option( 'wpsp_gpapoptionstatus');
if($statusgpap=="success" && $msg=="")
{
?><div id="msg"><div class="success">Login Success</div></div><?php
}
if($statusgpap!="success" && $msg=="")
{
?><div id="msg"><div class="error">Incorrect Username/Password </div></div><?php
}
?>
<div id="msg"><?php echo $msg; ?></div>
<div id="googleboxes">
<div class="googleplusbody">
<?php
wp_enqueue_script("authvalidationjs", plugins_url( '/js/jquery.validate.js' , __FILE__ ), array("jquery"));
wp_enqueue_script("authjs", plugins_url( '/js/authontication_check.js' , __FILE__ ), array("jquery"));
?>
<h2>Google Plus Auto Poster</h2>
<div>
<form action="admin.php?page=wpspgpap_authontication" method="post" name="authform" id="authform">
<table class="form-table" width="100%">
<tr valign="top">
<th scope="row">Email Address:</th>
<td><input type="text" name="username" class="googleforminput" id="username" value="<?php echo $wpapgetoption['username']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Password:</th>
<td><input type="password" name="password" class="googleforminput" id="password" value="<?php echo $wpapgetoption['password']; ?>" /></td>
</tr>
</table>
<p class="submit">
<input type="submit" name="submitauth" class="button-primary extbutton" value="Submit" />
</p>
</form>
</div>
<div style="font-size: 10px;">For business and communities page available on pro version at <a href="http://www.wpsuperplugin.com/download/google-auto-poster/" target="_blank">http://www.wpsuperplugin.com/</a></div>
</div>
<div class="notes">Enter Google Account Email Address and Password In Form</div>
</div>
</div>
<?php
}
global $post;
function wpspgpap()
{
global $wpdb;
global $post;
$my_postid = $post->ID;//This is page id or post id
$gettype =get_post_type($my_postid);
if($gettype=='post')
{
require_once('googleplus.php');
$content_post = get_post($my_postid);
$gpap_guid =$content_post->guid;
$gpap_title =$content_post->post_title;
$message = $content_post->post_content;
$message = apply_filters('the_content', $message);
$message = str_replace(']]>', ']]>', $message);
$statusgpap =get_option( 'wpsp_gpapoptionstatus');
if($statusgpap=="success")
{
require_once('authontication.php');
//Login success then call if condition
if (!$loginconnection)
{
// link with page title display
$thumbnilcheck = wp_get_attachment_url( get_post_thumbnail_id($post->ID));
if($thumbnilcheck!="")
{
$contentsss = get_post_field('post_content', $my_postid);
$images = $thumbnilcheck;
$link = $gpap_guid;
$domain = $domain;
$title = $gpap_title;
$txt = $txt;
googlepluspostfromwpsp($contentsss,$images,$link,$domain,$title,$txt);
}
else
{
$link = $content_post->guid;
$contentsss = get_post_field('post_content', $my_postid);
wpspgetlinkandtitle($contentsss,$link);
}
}
}
}
}
add_action('publish_post', 'wpspgpap');
?>