Version Description
- Included Vkontakte in Social Sharing and Social Login
- Added option to disable sharing at particular post/page
- Added option to specify language in Facebook comments
Download this release
Release Info
Developer | the_champ |
Plugin | WordPress Social Share, Social Login and Social Comments Plugin – Super Socializer |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 2.0.0
- admin/facebook.php +19 -1
- admin/help.php +13 -3
- admin/social_login.php +34 -4
- admin/social_sharing.php +13 -0
- css/front.css +10 -1
- images/login/vkontakte.png +0 -0
- images/sharing/vkontakte.png +0 -0
- inc/social_login.php +31 -11
- inc/social_sharing.php +2 -0
- js/front/facebook/commenting.js +26 -12
- js/front/facebook/feed.js +2 -1
- js/front/facebook/sdk.js +22 -10
- js/front/social_login/common.js +49 -1
- js/front/social_login/facebook.js +3 -9
- js/front/social_login/google.js +5 -1
- js/front/social_login/linkedin.js +5 -6
- js/front/social_login/vkontakte.js +34 -0
- readme.txt +12 -2
- super_socializer.php +117 -18
admin/facebook.php
CHANGED
@@ -179,6 +179,24 @@
|
|
179 |
</div>
|
180 |
</td>
|
181 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
</table>
|
183 |
</div>
|
184 |
</div>
|
@@ -231,7 +249,7 @@
|
|
231 |
<tr class="the_champ_help_content" id="the_champ_fb_feed_message_help_cont">
|
232 |
<td colspan="2">
|
233 |
<div>
|
234 |
-
<?php _e('Message for the feed post', 'TheChamp') ?>
|
235 |
</div>
|
236 |
<img src="<?php echo plugins_url('../images/snaps/feed_message.png', __FILE__); ?>" />
|
237 |
</td>
|
179 |
</div>
|
180 |
</td>
|
181 |
</tr>
|
182 |
+
|
183 |
+
<tr>
|
184 |
+
<th>
|
185 |
+
<img id="the_champ_fb_comment_lang_help" class="the_champ_help_bubble" src="<?php echo plugins_url('../images/info.png', __FILE__) ?>" />
|
186 |
+
<label for="the_champ_fbcomment_lang"><?php _e('Language', 'TheChamp'); ?></label>
|
187 |
+
</th>
|
188 |
+
<td>
|
189 |
+
<input id="the_champ_fbcomment_lang" name="the_champ_facebook[comment_lang]" type="text" value="<?php echo isset($theChampFacebookOptions['comment_lang']) ? $theChampFacebookOptions['comment_lang'] : '' ?>" />
|
190 |
+
</td>
|
191 |
+
</tr>
|
192 |
+
|
193 |
+
<tr class="the_champ_help_content" id="the_champ_fb_comment_lang_help_cont">
|
194 |
+
<td colspan="2">
|
195 |
+
<div>
|
196 |
+
<?php echo sprintf(__('Enter the code of the language you want to use to display commenting. You can find the language codes at <a href="%s" target="_blank">this link</a>. Leave it empty for default language(English)', 'TheChamp'), 'http://www.facebook.com/translations/FacebookLocales.xml') ?>
|
197 |
+
</div>
|
198 |
+
</td>
|
199 |
+
</tr>
|
200 |
</table>
|
201 |
</div>
|
202 |
</div>
|
249 |
<tr class="the_champ_help_content" id="the_champ_fb_feed_message_help_cont">
|
250 |
<td colspan="2">
|
251 |
<div>
|
252 |
+
<?php _e('Message for the feed post. %website-name% will be replaced with your website name in actual message.', 'TheChamp') ?>
|
253 |
</div>
|
254 |
<img src="<?php echo plugins_url('../images/snaps/feed_message.png', __FILE__); ?>" />
|
255 |
</td>
|
admin/help.php
CHANGED
@@ -15,6 +15,7 @@
|
|
15 |
<br/><a href="https://www.facebook.com/SocializerChamp" target="_blank">https://www.facebook.com/SocializerChamp</a>
|
16 |
</p>
|
17 |
<p><strong>Twitter</strong>: <br/><a href="https://twitter.com/l0rd_champ" target="_blank">https://twitter.com/l0rd_champ</a></p>
|
|
|
18 |
</div>
|
19 |
</div>
|
20 |
|
@@ -24,7 +25,7 @@
|
|
24 |
<p>If you like my plugin and find it useful, you can drop me an email at <a href="mailto:lordofthechamps@gmail.com">lordofthechamps@gmail.com</a>, like my <strong>Facebook</strong> pages and follow me at <strong>Twitter</strong>.</p>
|
25 |
<!--<p>As this is an open source plugin, I do not get paid for my work. But it requires time, effort, energy and resources to develop, maintain and improve this plugin. To keep the plugin running you can donate via Paypal.</p> -->
|
26 |
|
27 |
-
<div style="height:
|
28 |
<div style="float: left;margin-right: 36px;"><strong>Plugin Fan Page</strong></div>
|
29 |
<div style="float: left; width: 40px;">
|
30 |
<div class="fb-like" data-href="https://www.facebook.com/SocializerChamp" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
|
@@ -33,7 +34,7 @@
|
|
33 |
|
34 |
<div class="the_champ_clear"></div>
|
35 |
|
36 |
-
<div style="height:
|
37 |
<div style="float: left;margin-right: 56px;"><strong>My Fan Page</strong></div>
|
38 |
<div style="float: left; width: 40px;">
|
39 |
<div class="fb-like" data-href="https://www.facebook.com/pages/The-Champ/196278200561984" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
|
@@ -42,7 +43,7 @@
|
|
42 |
|
43 |
<div class="the_champ_clear"></div>
|
44 |
|
45 |
-
<div style="height:
|
46 |
<div style="float: left;margin-right: 89px;"><strong>Twitter</strong></div>
|
47 |
<div style="float: left; width: 40px;">
|
48 |
<iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/follow_button.html?screen_name=l0rd_champ" style="width:250px; height:20px;"></iframe>
|
@@ -51,4 +52,13 @@
|
|
51 |
|
52 |
</div>
|
53 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
</div>
|
15 |
<br/><a href="https://www.facebook.com/SocializerChamp" target="_blank">https://www.facebook.com/SocializerChamp</a>
|
16 |
</p>
|
17 |
<p><strong>Twitter</strong>: <br/><a href="https://twitter.com/l0rd_champ" target="_blank">https://twitter.com/l0rd_champ</a></p>
|
18 |
+
<p><strong>LinkedIn</strong>: <br/><a href="http://www.linkedin.com/pub/champ-lord/8b/aa2/352" target="_blank">http://www.linkedin.com/pub/champ-lord/8b/aa2/352</a></p>
|
19 |
</div>
|
20 |
</div>
|
21 |
|
25 |
<p>If you like my plugin and find it useful, you can drop me an email at <a href="mailto:lordofthechamps@gmail.com">lordofthechamps@gmail.com</a>, like my <strong>Facebook</strong> pages and follow me at <strong>Twitter</strong>.</p>
|
26 |
<!--<p>As this is an open source plugin, I do not get paid for my work. But it requires time, effort, energy and resources to develop, maintain and improve this plugin. To keep the plugin running you can donate via Paypal.</p> -->
|
27 |
|
28 |
+
<div style="height: 24px;">
|
29 |
<div style="float: left;margin-right: 36px;"><strong>Plugin Fan Page</strong></div>
|
30 |
<div style="float: left; width: 40px;">
|
31 |
<div class="fb-like" data-href="https://www.facebook.com/SocializerChamp" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
|
34 |
|
35 |
<div class="the_champ_clear"></div>
|
36 |
|
37 |
+
<div style="height: 24px;">
|
38 |
<div style="float: left;margin-right: 56px;"><strong>My Fan Page</strong></div>
|
39 |
<div style="float: left; width: 40px;">
|
40 |
<div class="fb-like" data-href="https://www.facebook.com/pages/The-Champ/196278200561984" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
|
43 |
|
44 |
<div class="the_champ_clear"></div>
|
45 |
|
46 |
+
<div style="height: 24px;">
|
47 |
<div style="float: left;margin-right: 89px;"><strong>Twitter</strong></div>
|
48 |
<div style="float: left; width: 40px;">
|
49 |
<iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/follow_button.html?screen_name=l0rd_champ" style="width:250px; height:20px;"></iframe>
|
52 |
|
53 |
</div>
|
54 |
</div>
|
55 |
+
|
56 |
+
<div class="stuffbox">
|
57 |
+
<h3><label><?php _e('Want plugin customization?', 'TheChamp');?></label></h3>
|
58 |
+
<div class="inside">
|
59 |
+
<p>
|
60 |
+
<input class="button button-primary" onclick="window.location.href = 'mailto:lordofthechamps@gmail.com?subject=' + escape('Plugin customization') + '&body=' + escape('I require following custom features in the plugin:')" type="button" value="Request custom features" />
|
61 |
+
</p>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
</div>
|
admin/social_login.php
CHANGED
@@ -40,14 +40,26 @@
|
|
40 |
<label><?php _e("Select providers", 'TheChamp'); ?></label>
|
41 |
</th>
|
42 |
<td>
|
43 |
-
<
|
44 |
<input id="the_champ_login_facebook" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('facebook', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="facebook" />
|
45 |
-
<label for="
|
|
|
|
|
46 |
<input id="the_champ_login_twitter" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('twitter', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="twitter" />
|
47 |
-
<label for="
|
|
|
|
|
48 |
<input id="the_champ_login_linkedin" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('linkedin', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="linkedin" />
|
49 |
-
<label for="
|
|
|
|
|
50 |
<input id="the_champ_login_google" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('google', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="google" />
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
</td>
|
52 |
</tr>
|
53 |
|
@@ -149,6 +161,24 @@
|
|
149 |
</td>
|
150 |
</tr>
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
<tr>
|
153 |
<th>
|
154 |
<img id="the_champ_sl_footer_script_help" class="the_champ_help_bubble" src="<?php echo plugins_url('../images/info.png', __FILE__) ?>" />
|
40 |
<label><?php _e("Select providers", 'TheChamp'); ?></label>
|
41 |
</th>
|
42 |
<td>
|
43 |
+
<div class="theChampSharingProviderContainer">
|
44 |
<input id="the_champ_login_facebook" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('facebook', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="facebook" />
|
45 |
+
<label for="the_champ_login_facebook"><?php _e("Facebook", 'TheChamp'); ?></label>
|
46 |
+
</div>
|
47 |
+
<div class="theChampSharingProviderContainer">
|
48 |
<input id="the_champ_login_twitter" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('twitter', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="twitter" />
|
49 |
+
<label for="the_champ_login_twitter"><?php _e("Twitter", 'TheChamp'); ?></label>
|
50 |
+
</div>
|
51 |
+
<div class="theChampSharingProviderContainer">
|
52 |
<input id="the_champ_login_linkedin" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('linkedin', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="linkedin" />
|
53 |
+
<label for="the_champ_login_linkedin"><?php _e("LinkedIn", 'TheChamp'); ?></label>
|
54 |
+
</div>
|
55 |
+
<div class="theChampSharingProviderContainer">
|
56 |
<input id="the_champ_login_google" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('google', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="google" />
|
57 |
+
<label for="the_champ_login_google"><?php _e("Google+", 'TheChamp'); ?></label>
|
58 |
+
</div>
|
59 |
+
<div class="theChampSharingProviderContainer">
|
60 |
+
<input id="the_champ_login_vkontakte" name="the_champ_login[providers][]" type="checkbox" <?php echo isset($theChampLoginOptions['providers']) && in_array('vkontakte', $theChampLoginOptions['providers']) ? 'checked = "checked"' : '';?> value="vkontakte" />
|
61 |
+
<label for="the_champ_login_vkontakte"><?php _e("Vkontakte", 'TheChamp'); ?></label>
|
62 |
+
</div>
|
63 |
</td>
|
64 |
</tr>
|
65 |
|
161 |
</td>
|
162 |
</tr>
|
163 |
|
164 |
+
<tr>
|
165 |
+
<th>
|
166 |
+
<img id="the_champ_slvk_id_help" class="the_champ_help_bubble" src="<?php echo plugins_url('../images/info.png', __FILE__) ?>" />
|
167 |
+
<label for="the_champ_vklogin_key"><?php _e("Vkontakte Application ID", 'TheChamp'); ?></label>
|
168 |
+
</th>
|
169 |
+
<td>
|
170 |
+
<input id="the_champ_vklogin_key" name="the_champ_login[vk_key]" type="text" value="<?php echo isset($theChampLoginOptions['vk_key']) ? $theChampLoginOptions['vk_key'] : '' ?>" />
|
171 |
+
</td>
|
172 |
+
</tr>
|
173 |
+
|
174 |
+
<tr class="the_champ_help_content" id="the_champ_slvk_id_help_cont">
|
175 |
+
<td colspan="2">
|
176 |
+
<div>
|
177 |
+
<?php echo sprintf(__('Required for Vkontakte Social Login to work. Please follow the documentation at <a href="%s" target="_blank">this link</a> to get Vkontakte Application ID', 'TheChamp'), 'http://thechamplord.wordpress.com/2014/03/07/how-to-configure-vkontakte-application-and-get-application-id/') ?>
|
178 |
+
</div>
|
179 |
+
</td>
|
180 |
+
</tr>
|
181 |
+
|
182 |
<tr>
|
183 |
<th>
|
184 |
<img id="the_champ_sl_footer_script_help" class="the_champ_help_bubble" src="<?php echo plugins_url('../images/info.png', __FILE__) ?>" />
|
admin/social_sharing.php
CHANGED
@@ -108,6 +108,11 @@ var theChampSharingIconPath = '<?php echo plugins_url('../images/sharing', __FIL
|
|
108 |
<input id="the_champ_sharing_tumblr" name="the_champ_sharing[providers][]" type="checkbox" <?php echo isset($theChampSharingOptions['providers']) && in_array('tumblr', $theChampSharingOptions['providers']) ? 'checked = "checked"' : '';?> value="tumblr" />
|
109 |
<label for="the_champ_sharing_tumblr"><?php _e("Tumblr", 'TheChamp'); ?></label>
|
110 |
</div>
|
|
|
|
|
|
|
|
|
|
|
111 |
</td>
|
112 |
</tr>
|
113 |
|
@@ -225,6 +230,14 @@ var theChampSharingIconPath = '<?php echo plugins_url('../images/sharing', __FIL
|
|
225 |
</div>
|
226 |
</td>
|
227 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
</table>
|
229 |
</div>
|
230 |
</div>
|
108 |
<input id="the_champ_sharing_tumblr" name="the_champ_sharing[providers][]" type="checkbox" <?php echo isset($theChampSharingOptions['providers']) && in_array('tumblr', $theChampSharingOptions['providers']) ? 'checked = "checked"' : '';?> value="tumblr" />
|
109 |
<label for="the_champ_sharing_tumblr"><?php _e("Tumblr", 'TheChamp'); ?></label>
|
110 |
</div>
|
111 |
+
|
112 |
+
<div class="theChampSharingProviderContainer">
|
113 |
+
<input id="the_champ_sharing_vk" name="the_champ_sharing[providers][]" type="checkbox" <?php echo isset($theChampSharingOptions['providers']) && in_array('vkontakte', $theChampSharingOptions['providers']) ? 'checked = "checked"' : '';?> value="vkontakte" />
|
114 |
+
<label for="the_champ_sharing_vk"><?php _e("Vkontakte", 'TheChamp'); ?></label>
|
115 |
+
</div>
|
116 |
</td>
|
117 |
</tr>
|
118 |
|
230 |
</div>
|
231 |
</td>
|
232 |
</tr>
|
233 |
+
|
234 |
+
<tr>
|
235 |
+
<td colspan="2">
|
236 |
+
<div>
|
237 |
+
<?php _e('<strong>Note:</strong> To disable sharing on particular page/post, edit that page/post and check the <strong>"Disable Social Sharing on this page"</strong> option at the bottom in <strong>"Super Socializer"</strong> section', 'TheChamp') ?>
|
238 |
+
</div>
|
239 |
+
</td>
|
240 |
+
</tr>
|
241 |
</table>
|
242 |
</div>
|
243 |
</div>
|
css/front.css
CHANGED
@@ -6,7 +6,16 @@
|
|
6 |
}
|
7 |
.the_champ_login_container img{
|
8 |
cursor: pointer;
|
9 |
-
margin: 2px
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
.the_champ_sharing_container img{
|
12 |
cursor: pointer;
|
6 |
}
|
7 |
.the_champ_login_container img{
|
8 |
cursor: pointer;
|
9 |
+
margin: 2px;
|
10 |
+
display: none;
|
11 |
+
float: left
|
12 |
+
}
|
13 |
+
.theChampTwitterButton{
|
14 |
+
display: block !important
|
15 |
+
}
|
16 |
+
#the_champ_loading_image{
|
17 |
+
display: block !important;
|
18 |
+
float: none
|
19 |
}
|
20 |
.the_champ_sharing_container img{
|
21 |
cursor: pointer;
|
images/login/vkontakte.png
ADDED
Binary file
|
images/sharing/vkontakte.png
ADDED
Binary file
|
inc/social_login.php
CHANGED
@@ -23,9 +23,12 @@ function the_champ_login_button($widget = false){
|
|
23 |
if(isset($theChampLoginOptions['providers']) && is_array($theChampLoginOptions['providers'])){
|
24 |
foreach($theChampLoginOptions['providers'] as $provider){
|
25 |
$html .= '<img src="' . plugins_url('../images/login/'.$provider.'.png', __FILE__) . '" ';
|
26 |
-
|
27 |
-
|
|
|
28 |
}
|
|
|
|
|
29 |
$html .= 'alt="Login with ';
|
30 |
if($provider == 'google'){
|
31 |
$html .= 'Google Plus';
|
@@ -41,7 +44,7 @@ function the_champ_login_button($widget = false){
|
|
41 |
$html .= '" onclick="theChampInitiateLogin(this)" />';
|
42 |
}
|
43 |
}
|
44 |
-
$html .= '</div>';
|
45 |
if(!$widget){
|
46 |
$html .= '</div>';
|
47 |
}
|
@@ -268,6 +271,16 @@ function the_champ_format_profile_data($profileData, $provider){
|
|
268 |
$temp['bio'] = '';
|
269 |
$temp['link'] = isset($profileData['url']) ? $profileData['url'] : '';
|
270 |
$temp['avatar'] = isset($profileData['image']['url']) ? $profileData['image']['url'] : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
}
|
272 |
$temp['provider'] = $provider;
|
273 |
return $temp;
|
@@ -288,7 +301,7 @@ function the_champ_user_auth($profileData, $provider = 'facebook'){
|
|
288 |
// authenticate user
|
289 |
// check if Social ID exists in database
|
290 |
if($profileData['id'] == ''){
|
291 |
-
return false;
|
292 |
}
|
293 |
$existingUser = get_users('meta_key=thechamp_social_id&meta_value='.$profileData['id']);
|
294 |
if(count($existingUser) > 0){
|
@@ -296,10 +309,13 @@ function the_champ_user_auth($profileData, $provider = 'facebook'){
|
|
296 |
if(isset($existingUser[0] -> ID)){
|
297 |
// check if account needs verification
|
298 |
if(get_user_meta($existingUser[0] -> ID, 'thechamp_key', true) != ''){
|
|
|
|
|
|
|
299 |
the_champ_close_login_popup(site_url().'?theChampUnverified=1');
|
300 |
}
|
301 |
the_champ_login_user($existingUser[0] -> ID);
|
302 |
-
return true;
|
303 |
}
|
304 |
}else{
|
305 |
// if email is blank
|
@@ -309,9 +325,12 @@ function the_champ_user_auth($profileData, $provider = 'facebook'){
|
|
309 |
$profileData['email'] = $profileData['id'].'@'.$provider.'.com';
|
310 |
}else{
|
311 |
// save temporary data
|
312 |
-
$
|
313 |
$uniqueId = mt_rand();
|
314 |
-
update_user_meta($uniqueId, 'the_champ_temp_data', $
|
|
|
|
|
|
|
315 |
the_champ_close_login_popup(site_url().'?theChampEmail=1&par='.$uniqueId);
|
316 |
}
|
317 |
}
|
@@ -319,16 +338,16 @@ function the_champ_user_auth($profileData, $provider = 'facebook'){
|
|
319 |
if(isset($profileData['email']) && $userId = email_exists($profileData['email'])){
|
320 |
// email exists in WP DB
|
321 |
the_champ_login_user($userId);
|
322 |
-
return true;
|
323 |
}
|
324 |
}
|
325 |
// register user
|
326 |
$userId = the_champ_create_user($profileData);
|
327 |
if($userId){
|
328 |
the_champ_login_user($userId);
|
329 |
-
return true;
|
330 |
}
|
331 |
-
return false;
|
332 |
}
|
333 |
|
334 |
/**
|
@@ -342,7 +361,8 @@ function the_champ_user_auth_ajax(){
|
|
342 |
the_champ_ajax_response(0, 'Invalid request');
|
343 |
}
|
344 |
$profileData = $_POST['profileData'];
|
345 |
-
|
|
|
346 |
}
|
347 |
add_action('wp_ajax_the_champ_user_auth', 'the_champ_user_auth_ajax');
|
348 |
add_action('wp_ajax_nopriv_the_champ_user_auth', 'the_champ_user_auth_ajax');
|
23 |
if(isset($theChampLoginOptions['providers']) && is_array($theChampLoginOptions['providers'])){
|
24 |
foreach($theChampLoginOptions['providers'] as $provider){
|
25 |
$html .= '<img src="' . plugins_url('../images/login/'.$provider.'.png', __FILE__) . '" ';
|
26 |
+
// id
|
27 |
+
if( $provider == 'google' ){
|
28 |
+
$html .= 'id="theChamp'. ucfirst($provider) .'Button" ';
|
29 |
}
|
30 |
+
// class
|
31 |
+
$html .= 'class="theChamp'. ucfirst($provider) .'Button" ';
|
32 |
$html .= 'alt="Login with ';
|
33 |
if($provider == 'google'){
|
34 |
$html .= 'Google Plus';
|
44 |
$html .= '" onclick="theChampInitiateLogin(this)" />';
|
45 |
}
|
46 |
}
|
47 |
+
$html .= '<div style="clear:both"></div><a target="_blank" style="text-decoration:none; color: #00A0DA; font-size: 12px" href="http://thechamplord.wordpress.com">Powered by The Champ</a></div>';
|
48 |
if(!$widget){
|
49 |
$html .= '</div>';
|
50 |
}
|
271 |
$temp['bio'] = '';
|
272 |
$temp['link'] = isset($profileData['url']) ? $profileData['url'] : '';
|
273 |
$temp['avatar'] = isset($profileData['image']['url']) ? $profileData['image']['url'] : '';
|
274 |
+
}elseif($provider == 'vkontakte'){
|
275 |
+
$temp['id'] = isset($profileData['uid']) ? $profileData['uid'] : '';
|
276 |
+
$temp['email'] = '';
|
277 |
+
$temp['name'] = isset($profileData['nickname']) ? $profileData['nickname'] : '';
|
278 |
+
$temp['username'] = '';
|
279 |
+
$temp['first_name'] = isset($profileData['first_name']) ? $profileData['first_name'] : '';
|
280 |
+
$temp['last_name'] = isset($profileData['last_name']) ? $profileData['last_name'] : '';
|
281 |
+
$temp['bio'] = '';
|
282 |
+
$temp['link'] = '';
|
283 |
+
$temp['avatar'] = isset($profileData['photo']) ? $profileData['photo'] : '';
|
284 |
}
|
285 |
$temp['provider'] = $provider;
|
286 |
return $temp;
|
301 |
// authenticate user
|
302 |
// check if Social ID exists in database
|
303 |
if($profileData['id'] == ''){
|
304 |
+
return array('status' => false, 'message' => '');
|
305 |
}
|
306 |
$existingUser = get_users('meta_key=thechamp_social_id&meta_value='.$profileData['id']);
|
307 |
if(count($existingUser) > 0){
|
309 |
if(isset($existingUser[0] -> ID)){
|
310 |
// check if account needs verification
|
311 |
if(get_user_meta($existingUser[0] -> ID, 'thechamp_key', true) != ''){
|
312 |
+
if($profileData['provider'] != 'twitter'){
|
313 |
+
return array('status' => false, 'message' => 'unverified');
|
314 |
+
}
|
315 |
the_champ_close_login_popup(site_url().'?theChampUnverified=1');
|
316 |
}
|
317 |
the_champ_login_user($existingUser[0] -> ID);
|
318 |
+
return array('status' => true, 'message' => '');
|
319 |
}
|
320 |
}else{
|
321 |
// if email is blank
|
325 |
$profileData['email'] = $profileData['id'].'@'.$provider.'.com';
|
326 |
}else{
|
327 |
// save temporary data
|
328 |
+
$serializedProfileData = maybe_serialize($profileData);
|
329 |
$uniqueId = mt_rand();
|
330 |
+
update_user_meta($uniqueId, 'the_champ_temp_data', $serializedProfileData);
|
331 |
+
if($profileData['provider'] != 'twitter'){
|
332 |
+
return array('status' => false, 'message' => 'ask email|' . $uniqueId);
|
333 |
+
}
|
334 |
the_champ_close_login_popup(site_url().'?theChampEmail=1&par='.$uniqueId);
|
335 |
}
|
336 |
}
|
338 |
if(isset($profileData['email']) && $userId = email_exists($profileData['email'])){
|
339 |
// email exists in WP DB
|
340 |
the_champ_login_user($userId);
|
341 |
+
return array('status' => true, 'message' => '');
|
342 |
}
|
343 |
}
|
344 |
// register user
|
345 |
$userId = the_champ_create_user($profileData);
|
346 |
if($userId){
|
347 |
the_champ_login_user($userId);
|
348 |
+
return array('status' => true, 'message' => '');
|
349 |
}
|
350 |
+
return array('status' => false, 'message' => '');
|
351 |
}
|
352 |
|
353 |
/**
|
361 |
the_champ_ajax_response(0, 'Invalid request');
|
362 |
}
|
363 |
$profileData = $_POST['profileData'];
|
364 |
+
$response = the_champ_user_auth($profileData, $_POST['provider']);
|
365 |
+
the_champ_ajax_response(intval($response['status']), $response['message']);
|
366 |
}
|
367 |
add_action('wp_ajax_the_champ_user_auth', 'the_champ_user_auth_ajax');
|
368 |
add_action('wp_ajax_nopriv_the_champ_user_auth', 'the_champ_user_auth_ajax');
|
inc/social_sharing.php
CHANGED
@@ -38,6 +38,8 @@ function the_champ_prepare_sharing_html(){
|
|
38 |
$sharingUrl = 'http://www.designfloat.com/submit.php?url='.get_permalink($post->ID).'&title=' . $post->post_title;
|
39 |
}elseif($provider == 'tumblr'){
|
40 |
$sharingUrl = 'http://www.tumblr.com/share?v=3&u='.urlencode(get_permalink($post->ID)).'&t=' . urlencode($post->post_title) . '&s=';
|
|
|
|
|
41 |
}
|
42 |
$html .= '<img alt="'.($provider == 'google' ? 'Google Plus' : ucfirst($provider)).'" Title="'.($provider == 'google' ? 'Google Plus' : ucfirst($provider)).'" src=\''.plugins_url('../images/sharing/'.str_replace(' ', '_', $provider).'.png', __FILE__).'\' onclick=\'theChampPopup("'.$sharingUrl.'")\' />';
|
43 |
}
|
38 |
$sharingUrl = 'http://www.designfloat.com/submit.php?url='.get_permalink($post->ID).'&title=' . $post->post_title;
|
39 |
}elseif($provider == 'tumblr'){
|
40 |
$sharingUrl = 'http://www.tumblr.com/share?v=3&u='.urlencode(get_permalink($post->ID)).'&t=' . urlencode($post->post_title) . '&s=';
|
41 |
+
}elseif($provider == 'vkontakte'){
|
42 |
+
$sharingUrl = 'http://vkontakte.ru/share.php?&url='.urlencode(get_permalink($post->ID));
|
43 |
}
|
44 |
$html .= '<img alt="'.($provider == 'google' ? 'Google Plus' : ucfirst($provider)).'" Title="'.($provider == 'google' ? 'Google Plus' : ucfirst($provider)).'" src=\''.plugins_url('../images/sharing/'.str_replace(' ', '_', $provider).'.png', __FILE__).'\' onclick=\'theChampPopup("'.$sharingUrl.'")\' />';
|
45 |
}
|
js/front/facebook/commenting.js
CHANGED
@@ -1,22 +1,36 @@
|
|
1 |
-
<script>
|
2 |
theChampLoadEvent(function(){
|
3 |
var commentForm = document.getElementById('commentform');
|
4 |
if(commentForm){
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
<?php
|
10 |
}
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
FB.init({
|
15 |
-
appId :
|
16 |
-
channelUrl : '
|
17 |
status : true, // check login status
|
18 |
cookie : true, // enable cookies to allow the server to access the session
|
19 |
xfbml : true // parse XFBML
|
20 |
});
|
21 |
-
});
|
22 |
-
</script>
|
|
|
1 |
theChampLoadEvent(function(){
|
2 |
var commentForm = document.getElementById('commentform');
|
3 |
if(commentForm){
|
4 |
+
if(theChampFBCommentTitleEnable){
|
5 |
+
if(document.getElementById('reply-title')){
|
6 |
+
document.getElementById('reply-title').innerHTML = theChampFBCommentTitle;
|
7 |
+
}
|
|
|
8 |
}
|
9 |
+
var html = '';
|
10 |
+
html = '<div class="fb-comments" data-href="'+theChampFBCommentUrl+'"';
|
11 |
+
if(theChampFBCommentColor != ''){
|
12 |
+
html += ' data-colorscheme="'+theChampFBCommentColor+'"';
|
13 |
+
}
|
14 |
+
if(theChampFBCommentNumPosts != ''){
|
15 |
+
html += ' data-numposts="'+theChampFBCommentNumPosts+'"';
|
16 |
+
}
|
17 |
+
if(theChampFBCommentWidth != ''){
|
18 |
+
html += ' data-width="'+theChampFBCommentWidth+'"';
|
19 |
+
}
|
20 |
+
if(theChampFBCommentOrderby != ''){
|
21 |
+
html += ' data-order-by="'+theChampFBCommentOrderby+'"';
|
22 |
+
}
|
23 |
+
if(theChampFBCommentMobile != ''){
|
24 |
+
html += ' data-mobile="'+theChampFBCommentMobile+'"';
|
25 |
+
}
|
26 |
+
html += ' ></div>';
|
27 |
+
commentForm.innerHTML = html;
|
28 |
}
|
29 |
FB.init({
|
30 |
+
appId : theChampFBAppID, // App ID
|
31 |
+
channelUrl : '//'+theChampSiteUrl+'/channel.html', // Channel File
|
32 |
status : true, // check login status
|
33 |
cookie : true, // enable cookies to allow the server to access the session
|
34 |
xfbml : true // parse XFBML
|
35 |
});
|
36 |
+
});
|
|
js/front/facebook/feed.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<script>
|
2 |
function theChampFBFeedPost(){
|
3 |
var params = {};
|
4 |
-
params['message'] = '<?php echo $theChampFacebookOptions['feedMessage'] ?>';
|
5 |
<?php if(isset($theChampFacebookOptions['feed_name']) && $theChampFacebookOptions['feed_name'] != ''){ ?>
|
6 |
params['name'] = '<?php echo $theChampFacebookOptions['feed_name'] ?>';
|
7 |
<?php }
|
@@ -20,6 +20,7 @@ function theChampFBFeedPost(){
|
|
20 |
if(isset($theChampFacebookOptions['feed_caption']) && $theChampFacebookOptions['feed_caption'] != ''){ ?>
|
21 |
params['caption'] = '<?php echo $theChampFacebookOptions['feed_caption'] ?>';
|
22 |
<?php } ?>
|
|
|
23 |
FB.api('/me/feed', 'post', params, function(response) {});
|
24 |
}
|
25 |
</script>
|
1 |
<script>
|
2 |
function theChampFBFeedPost(){
|
3 |
var params = {};
|
4 |
+
params['message'] = '<?php echo str_replace("%website-name%", get_option("blogname"), $theChampFacebookOptions['feedMessage']) ?>';
|
5 |
<?php if(isset($theChampFacebookOptions['feed_name']) && $theChampFacebookOptions['feed_name'] != ''){ ?>
|
6 |
params['name'] = '<?php echo $theChampFacebookOptions['feed_name'] ?>';
|
7 |
<?php }
|
20 |
if(isset($theChampFacebookOptions['feed_caption']) && $theChampFacebookOptions['feed_caption'] != ''){ ?>
|
21 |
params['caption'] = '<?php echo $theChampFacebookOptions['feed_caption'] ?>';
|
22 |
<?php } ?>
|
23 |
+
params['actions'] = [{name: 'Via Super Socializer', link: 'http://wordpress.org/plugins/super-socializer/'}];
|
24 |
FB.api('/me/feed', 'post', params, function(response) {});
|
25 |
}
|
26 |
</script>
|
js/front/facebook/sdk.js
CHANGED
@@ -1,13 +1,25 @@
|
|
1 |
-
<script type='text/javascript' src='//connect.facebook.net/en_US/all.js'></script>
|
2 |
<div id="fb-root"></div>
|
3 |
<script>
|
4 |
-
|
5 |
-
//
|
6 |
-
FB.init({
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
</script>
|
|
|
1 |
<div id="fb-root"></div>
|
2 |
<script>
|
3 |
+
window.fbAsyncInit = function() {
|
4 |
+
// init the FB JS SDK
|
5 |
+
FB.init({
|
6 |
+
appId : '<?php echo isset($theChampLoginOptions["fb_key"]) && $theChampLoginOptions["fb_key"] != "" ? $theChampLoginOptions["fb_key"] : "" ?>', // App ID
|
7 |
+
channelUrl : '<?php echo site_url() ?>/channel.html', // Channel File
|
8 |
+
status : true, // check login status
|
9 |
+
cookie : true, // enable cookies to allow the server to access the session
|
10 |
+
xfbml : true // parse XFBMLw
|
11 |
+
});
|
12 |
+
// Additional initialization code such as adding Event Listeners goes here
|
13 |
+
if ( typeof theChampDisplayLoginIcon == 'function' ) {
|
14 |
+
theChampDisplayLoginIcon(document, 'theChampFacebookButton');
|
15 |
+
}
|
16 |
+
};
|
17 |
+
// Load the SDK Asynchronously
|
18 |
+
(function(d){
|
19 |
+
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
|
20 |
+
if (d.getElementById(id)) {return;}
|
21 |
+
js = d.createElement('script'); js.id = id; js.async = true;
|
22 |
+
js.src = '//connect.facebook.net/<?php echo isset($theChampFacebookOptions["comment_lang"]) && $theChampFacebookOptions["comment_lang"] != '' ? $theChampFacebookOptions["comment_lang"] : "en_US" ?>/all.js';
|
23 |
+
ref.parentNode.insertBefore(js, ref);
|
24 |
+
}(document));
|
25 |
</script>
|
js/front/social_login/common.js
CHANGED
@@ -113,7 +113,7 @@ function theChampCallAjax(callback){
|
|
113 |
* Display loading image in place of Social Login interface
|
114 |
*/
|
115 |
function theChampLoadingIcon(){
|
116 |
-
jQuery('.the_champ_login_container').html('<img src="<?php echo plugins_url('../../../images/ajax_loader.gif', __FILE__); ?>" />');
|
117 |
}
|
118 |
|
119 |
/**
|
@@ -133,7 +133,16 @@ function theChampAjaxUserAuth(response, provider){
|
|
133 |
success: function(data, textStatus, XMLHttpRequest){
|
134 |
if(data.status == 1){
|
135 |
location.href = '<?php echo the_champ_get_login_redirection_url(); ?>';
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
|
|
|
|
|
|
137 |
}
|
138 |
});
|
139 |
}
|
@@ -173,6 +182,45 @@ function theChampInitiateLogin(icon){
|
|
173 |
return false;
|
174 |
}else if(icon.title == 'Login with Google Plus'){
|
175 |
theChampInitializeGPLogin();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
}
|
178 |
</script>
|
113 |
* Display loading image in place of Social Login interface
|
114 |
*/
|
115 |
function theChampLoadingIcon(){
|
116 |
+
jQuery('.the_champ_login_container').html('<img id="the_champ_loading_image" src="<?php echo plugins_url('../../../images/ajax_loader.gif', __FILE__); ?>" />');
|
117 |
}
|
118 |
|
119 |
/**
|
133 |
success: function(data, textStatus, XMLHttpRequest){
|
134 |
if(data.status == 1){
|
135 |
location.href = '<?php echo the_champ_get_login_redirection_url(); ?>';
|
136 |
+
}else if(data.message.match(/ask/) !== null){
|
137 |
+
//alert(typeof data.message.match(/ask/) +"\r\n"+ data.message.match(/ask/))
|
138 |
+
var keyArr = data.message.split('|');
|
139 |
+
location.href = '<?php echo site_url() ?>?theChampEmail=1&par=' + keyArr[1];
|
140 |
+
}else if(data.message == 'unverified'){
|
141 |
+
location.href = '<?php echo site_url() ?>?theChampUnverified=1';
|
142 |
}
|
143 |
+
},
|
144 |
+
error: function(a, b, c){
|
145 |
+
alert(JSON.stringify(a) + "\r\n" + JSON.stringify(b));
|
146 |
}
|
147 |
});
|
148 |
}
|
182 |
return false;
|
183 |
}else if(icon.title == 'Login with Google Plus'){
|
184 |
theChampInitializeGPLogin();
|
185 |
+
}else if(icon.title == 'Login with Vkontakte'){
|
186 |
+
theChampInitializeVKLogin();
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Get elements by class name without jQuery
|
192 |
+
*/
|
193 |
+
function theChampGetElementsByClass(node, classname) {
|
194 |
+
if (node.getElementsByClassName) { // use native implementation if available
|
195 |
+
return node.getElementsByClassName(classname);
|
196 |
+
} else {
|
197 |
+
return (function getElementsByClass(searchClass,node) {
|
198 |
+
if ( node == null ) {
|
199 |
+
node = document;
|
200 |
+
}
|
201 |
+
var classElements = [],
|
202 |
+
els = node.getElementsByTagName("*"),
|
203 |
+
elsLen = els.length,
|
204 |
+
pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"), i, j;
|
205 |
+
|
206 |
+
for (i = 0, j = 0; i < elsLen; i++) {
|
207 |
+
if ( pattern.test(els[i].className) ) {
|
208 |
+
classElements[j] = els[i];
|
209 |
+
j++;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
return classElements;
|
213 |
+
})(classname, node);
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Display login icons
|
219 |
+
*/
|
220 |
+
function theChampDisplayLoginIcon(node, className){
|
221 |
+
var icons = theChampGetElementsByClass(node, className);
|
222 |
+
for(var i = 0; i < icons.length; i++){
|
223 |
+
icons[i].style.display = 'block';
|
224 |
}
|
225 |
}
|
226 |
</script>
|
js/front/social_login/facebook.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
<script>
|
2 |
// Login in the current user via Facebook and ask for email permission
|
3 |
function theChampAuthUserFB() {
|
4 |
// Check if the current user is logged in and has authorized the app
|
@@ -11,7 +10,7 @@ function checkLoginStatus(response){
|
|
11 |
theChampLoadingIcon();
|
12 |
loginUser();
|
13 |
}else {
|
14 |
-
FB.login(loginUser, {scope:
|
15 |
}
|
16 |
}
|
17 |
|
@@ -21,16 +20,11 @@ function loginUser(){
|
|
21 |
if(!response.id){
|
22 |
return;
|
23 |
}
|
24 |
-
|
25 |
-
if(the_champ_facebook_feed_enabled()){
|
26 |
-
?>
|
27 |
theChampFBFeedPost();
|
28 |
-
<?php
|
29 |
}
|
30 |
-
?>
|
31 |
theChampCallAjax(function(){
|
32 |
theChampAjaxUserAuth(response, 'facebook');
|
33 |
});
|
34 |
});
|
35 |
-
}
|
36 |
-
</script>
|
|
|
1 |
// Login in the current user via Facebook and ask for email permission
|
2 |
function theChampAuthUserFB() {
|
3 |
// Check if the current user is logged in and has authorized the app
|
10 |
theChampLoadingIcon();
|
11 |
loginUser();
|
12 |
}else {
|
13 |
+
FB.login(loginUser, {scope:theChampFacebookScope});
|
14 |
}
|
15 |
}
|
16 |
|
20 |
if(!response.id){
|
21 |
return;
|
22 |
}
|
23 |
+
if(theChampFBFeedEnabled){
|
|
|
|
|
24 |
theChampFBFeedPost();
|
|
|
25 |
}
|
|
|
26 |
theChampCallAjax(function(){
|
27 |
theChampAjaxUserAuth(response, 'facebook');
|
28 |
});
|
29 |
});
|
30 |
+
}
|
|
js/front/social_login/google.js
CHANGED
@@ -1,10 +1,14 @@
|
|
1 |
<script>
|
2 |
(function() {
|
3 |
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
4 |
-
po.src = 'https://apis.google.com/js/client:plusone.js';
|
5 |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
6 |
})();
|
7 |
|
|
|
|
|
|
|
|
|
8 |
function theChampInitializeGPLogin(){
|
9 |
gapi.auth.signIn({
|
10 |
'callback': theChampGPSignInCallback,
|
1 |
<script>
|
2 |
(function() {
|
3 |
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
4 |
+
po.src = 'https://apis.google.com/js/client:plusone.js?onload=theChampGoogleOnLoad';
|
5 |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
6 |
})();
|
7 |
|
8 |
+
function theChampGoogleOnLoad(){
|
9 |
+
theChampDisplayLoginIcon(document, 'theChampGoogleButton');
|
10 |
+
}
|
11 |
+
|
12 |
function theChampInitializeGPLogin(){
|
13 |
gapi.auth.signIn({
|
14 |
'callback': theChampGPSignInCallback,
|
js/front/social_login/linkedin.js
CHANGED
@@ -1,8 +1,4 @@
|
|
1 |
-
|
2 |
-
api_key: <?php echo isset($theChampLoginOptions['li_key']) ? $theChampLoginOptions['li_key'] : '' ?>
|
3 |
-
</script>
|
4 |
-
<script>
|
5 |
-
<!-- LinkedIn login -->
|
6 |
IN.Event.on(IN, 'auth', function(){
|
7 |
theChampLoadingIcon();
|
8 |
IN.API.Profile("me").
|
@@ -13,4 +9,7 @@ IN.Event.on(IN, 'auth', function(){
|
|
13 |
}
|
14 |
});
|
15 |
});
|
16 |
-
|
|
|
|
|
|
1 |
+
// LinkedIn login
|
|
|
|
|
|
|
|
|
2 |
IN.Event.on(IN, 'auth', function(){
|
3 |
theChampLoadingIcon();
|
4 |
IN.API.Profile("me").
|
9 |
}
|
10 |
});
|
11 |
});
|
12 |
+
|
13 |
+
function theChampLinkedInOnLoad(){
|
14 |
+
theChampDisplayLoginIcon(document, 'theChampLinkedinButton');
|
15 |
+
}
|
js/front/social_login/vkontakte.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="vk_api_transport"></div>
|
2 |
+
<script>
|
3 |
+
window.vkAsyncInit = function() {
|
4 |
+
VK.init({
|
5 |
+
apiId: <?php echo isset($theChampLoginOptions["vk_key"]) && $theChampLoginOptions["vk_key"] != "" ? $theChampLoginOptions["vk_key"] : 0 ?>
|
6 |
+
});
|
7 |
+
// callback
|
8 |
+
theChampDisplayLoginIcon(document, 'theChampVkontakteButton');
|
9 |
+
};
|
10 |
+
|
11 |
+
setTimeout(function() {
|
12 |
+
var el = document.createElement("script");
|
13 |
+
el.type = "text/javascript";
|
14 |
+
el.src = "http://vk.com/js/api/openapi.js";
|
15 |
+
el.async = true;
|
16 |
+
document.getElementById("vk_api_transport").appendChild(el);
|
17 |
+
}, 0);
|
18 |
+
|
19 |
+
function theChampInitializeVKLogin(){
|
20 |
+
VK.Auth.login(function(response){
|
21 |
+
if (response.session.mid) {
|
22 |
+
VK.Api.call('getProfiles', {uids: response.session.mid, fields: 'uid, first_name, last_name, nickname, photo'}, function(profile) {
|
23 |
+
if(profile.response[0].uid){
|
24 |
+
theChampCallAjax(function(){
|
25 |
+
theChampAjaxUserAuth(profile.response[0], 'vkontakte');
|
26 |
+
});
|
27 |
+
}
|
28 |
+
});
|
29 |
+
}else {
|
30 |
+
alert('Error in authentication');
|
31 |
+
}
|
32 |
+
});
|
33 |
+
}
|
34 |
+
</script>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://thechamplord.wordpress.com/
|
|
4 |
Tags: super socializer, thechamp, champ, social login, social sharing, social commenting, wordpress plugin, buddypress, bbpress, social share, feed, multisite, comments, share post, openid integration, user profile data, social analytics, online identity, social profile storage, id provider, single sign-on, plug-in, social media tools, free social login, post to social networks, social authentication, social app, connect, capture social data, wordpress, social sign-in, signin, sign up, signup, social plugins, social connect, facebook, twitter, google, google+, googleplus, google plus, linkedin, yahoo, reddit, digg, stumbleupon, delicious, float it, tumblr, widget, social network
|
5 |
Requires at least: 2.5.0
|
6 |
Tested up to: 3.8.1
|
7 |
-
Stable tag:
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Feed and more
|
@@ -164,6 +164,11 @@ Yes, I can help you with it. Just drop me an email at lordofthechamps@gmail.com
|
|
164 |
3. **Facebook Commenting**: Facebook commenting replaces the traditional comment form
|
165 |
|
166 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
167 |
= 1.0.2 =
|
168 |
* Fixed the bug due to redeclaration of Twitter OAuth class
|
169 |
|
@@ -182,4 +187,9 @@ Yes, I can help you with it. Just drop me an email at lordofthechamps@gmail.com
|
|
182 |
* Minor bug fixing in Facebook feed functionality
|
183 |
|
184 |
= 1.0.2 =
|
185 |
-
* Fixed the bug due to redeclaration of Twitter OAuth class
|
|
|
|
|
|
|
|
|
|
4 |
Tags: super socializer, thechamp, champ, social login, social sharing, social commenting, wordpress plugin, buddypress, bbpress, social share, feed, multisite, comments, share post, openid integration, user profile data, social analytics, online identity, social profile storage, id provider, single sign-on, plug-in, social media tools, free social login, post to social networks, social authentication, social app, connect, capture social data, wordpress, social sign-in, signin, sign up, signup, social plugins, social connect, facebook, twitter, google, google+, googleplus, google plus, linkedin, yahoo, reddit, digg, stumbleupon, delicious, float it, tumblr, widget, social network
|
5 |
Requires at least: 2.5.0
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 2.0.0
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Feed and more
|
164 |
3. **Facebook Commenting**: Facebook commenting replaces the traditional comment form
|
165 |
|
166 |
== Changelog ==
|
167 |
+
= 2.0.0 =
|
168 |
+
* Included Vkontakte in Social Sharing and Social Login
|
169 |
+
* Added option to disable sharing at particular post/page
|
170 |
+
* Added option to specify language in Facebook comments
|
171 |
+
|
172 |
= 1.0.2 =
|
173 |
* Fixed the bug due to redeclaration of Twitter OAuth class
|
174 |
|
187 |
* Minor bug fixing in Facebook feed functionality
|
188 |
|
189 |
= 1.0.2 =
|
190 |
+
* Fixed the bug due to redeclaration of Twitter OAuth class
|
191 |
+
|
192 |
+
= 2.0.0 =
|
193 |
+
* Included Vkontakte in Social Sharing and Social Login
|
194 |
+
* Added option to disable sharing at particular post/page
|
195 |
+
* Added option to specify language in Facebook comments
|
super_socializer.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
Plugin Name: Super Socializer
|
4 |
Plugin URI: https://www.facebook.com/SocializerChamp
|
5 |
Description: A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Feed and more.
|
6 |
-
Version:
|
7 |
Author: The Champ
|
8 |
Author URI: http://thechamplord.wordpress.com
|
9 |
License: GPL2+
|
10 |
*/
|
11 |
-
define('THE_CHAMP_SS_VERSION', '
|
12 |
if(get_option('the_champ_ss_version') != THE_CHAMP_SS_VERSION){
|
13 |
update_option('the_champ_ss_version', THE_CHAMP_SS_VERSION);
|
14 |
}
|
@@ -76,8 +76,10 @@ function the_champ_connect(){
|
|
76 |
// generate unique ID
|
77 |
$uniqueId = mt_rand();
|
78 |
// save oauth token and secret in db temporarily
|
|
|
79 |
update_user_meta($uniqueId, 'thechamp_twitter_oauthtoken', $requestToken['oauth_token']);
|
80 |
update_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret', $requestToken['oauth_token_secret']);
|
|
|
81 |
wp_redirect($connection->getAuthorizeURL($requestToken['oauth_token']));
|
82 |
die;
|
83 |
}
|
@@ -88,11 +90,6 @@ function the_champ_connect(){
|
|
88 |
global $wpdb;
|
89 |
$uniqueId = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'thechamp_twitter_oauthtoken' and meta_value = %s", $_REQUEST['oauth_token']));
|
90 |
$oauthTokenSecret = get_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret', true);
|
91 |
-
// delete temporary data
|
92 |
-
if(!empty($uniqueId)){
|
93 |
-
delete_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret');
|
94 |
-
delete_user_meta($uniqueId, 'thechamp_twitter_oauthtoken');
|
95 |
-
}
|
96 |
if(empty($uniqueId) || $oauthTokenSecret == ''){
|
97 |
// invalid request
|
98 |
wp_redirect(site_url());
|
@@ -104,6 +101,10 @@ function the_champ_connect(){
|
|
104 |
/* Create a TwitterOauth object with consumer/user tokens. */
|
105 |
$connection = new TwitterOAuth($theChampLoginOptions['twitter_key'], $theChampLoginOptions['twitter_secret'], $accessToken['oauth_token'], $accessToken['oauth_token_secret']);
|
106 |
$content = $connection->get('account/verify_credentials');
|
|
|
|
|
|
|
|
|
107 |
if(is_object($content) && isset($content -> id)){
|
108 |
the_champ_user_auth($content, 'twitter');
|
109 |
the_champ_close_login_popup(the_champ_get_login_redirection_url());
|
@@ -198,6 +199,10 @@ function the_champ_frontend_scripts(){
|
|
198 |
}
|
199 |
</script>
|
200 |
<?php
|
|
|
|
|
|
|
|
|
201 |
if(isset($theChampLoginOptions['email_required']) && $theChampLoginOptions['email_required'] == 1){
|
202 |
wp_enqueue_script('thickbox');
|
203 |
wp_enqueue_style('thickbox');
|
@@ -208,22 +213,49 @@ function the_champ_frontend_scripts(){
|
|
208 |
}
|
209 |
// Linkedin scripts
|
210 |
if(the_champ_social_login_provider_enabled('linkedin') && !is_user_logged_in()){
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
}
|
213 |
-
// scripts
|
214 |
-
if(
|
215 |
-
require 'js/front/social_login/
|
216 |
}
|
217 |
// Facebook scripts
|
218 |
if(the_champ_facebook_plugin_enabled()){
|
219 |
require 'js/front/facebook/sdk.js';
|
220 |
}
|
221 |
if(the_champ_social_login_provider_enabled('facebook') && !is_user_logged_in()){
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
}
|
224 |
// Facebook commenting
|
225 |
if(the_champ_facebook_commenting_enabled()){
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
}
|
228 |
// Facebook feed posts
|
229 |
if(the_champ_facebook_feed_enabled()){
|
@@ -291,8 +323,8 @@ function the_champ_facebook_notifications($fbOptions){
|
|
291 |
* Display Social Login notifications
|
292 |
*/
|
293 |
function the_champ_login_notifications($loginOptions){
|
|
|
294 |
if(isset($loginOptions['providers'])){
|
295 |
-
$errorHtml = '';
|
296 |
if(in_array('facebook', $loginOptions['providers']) && (!isset($loginOptions['fb_key']) || $loginOptions['fb_key'] == '')){
|
297 |
$errorHtml .= the_champ_error_message('Facebook App ID is required for Facebook Login to work');
|
298 |
}
|
@@ -305,6 +337,9 @@ function the_champ_login_notifications($loginOptions){
|
|
305 |
if(in_array('google', $loginOptions['providers']) && (!isset($loginOptions['google_key']) || $loginOptions['google_key'] == '')){
|
306 |
$errorHtml .= the_champ_error_message('Google Plus Client ID is required for Google Plus Login to work');
|
307 |
}
|
|
|
|
|
|
|
308 |
}
|
309 |
return $errorHtml;
|
310 |
}
|
@@ -375,10 +410,14 @@ function the_champ_options_init(){
|
|
375 |
register_setting('the_champ_facebook_options', 'the_champ_facebook', 'the_champ_validate_options');
|
376 |
register_setting('the_champ_login_options', 'the_champ_login', 'the_champ_validate_options');
|
377 |
register_setting('the_champ_sharing_options', 'the_champ_sharing', 'the_champ_validate_options');
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
}
|
379 |
-
|
380 |
-
add_action('admin_init', 'the_champ_options_init');
|
381 |
-
}
|
382 |
|
383 |
/**
|
384 |
* Include javascript files in admin.
|
@@ -408,6 +447,19 @@ function the_champ_admin_style(){
|
|
408 |
wp_enqueue_style('the_champ_admin_style', plugins_url('css/admin.css', __FILE__));
|
409 |
}
|
410 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
/**
|
412 |
* Return ajax response
|
413 |
*/
|
@@ -533,7 +585,9 @@ function the_champ_default_options(){
|
|
533 |
|
534 |
// login options
|
535 |
add_option('the_champ_facebook', array(
|
536 |
-
'enable_fbcomments' => '1'
|
|
|
|
|
537 |
));
|
538 |
|
539 |
// sharing options
|
@@ -594,4 +648,49 @@ if(is_multisite() && is_main_site()){
|
|
594 |
add_action('update_option_the_champ_login', 'the_champ_update_old_blogs');
|
595 |
add_action('update_option_the_champ_facebook', 'the_champ_update_old_blogs');
|
596 |
add_action('update_option_the_champ_sharing', 'the_champ_update_old_blogs');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
}
|
3 |
Plugin Name: Super Socializer
|
4 |
Plugin URI: https://www.facebook.com/SocializerChamp
|
5 |
Description: A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Feed and more.
|
6 |
+
Version: 2.0.0
|
7 |
Author: The Champ
|
8 |
Author URI: http://thechamplord.wordpress.com
|
9 |
License: GPL2+
|
10 |
*/
|
11 |
+
define('THE_CHAMP_SS_VERSION', '2.0.0');
|
12 |
if(get_option('the_champ_ss_version') != THE_CHAMP_SS_VERSION){
|
13 |
update_option('the_champ_ss_version', THE_CHAMP_SS_VERSION);
|
14 |
}
|
76 |
// generate unique ID
|
77 |
$uniqueId = mt_rand();
|
78 |
// save oauth token and secret in db temporarily
|
79 |
+
//echo $requestToken['oauth_token'];
|
80 |
update_user_meta($uniqueId, 'thechamp_twitter_oauthtoken', $requestToken['oauth_token']);
|
81 |
update_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret', $requestToken['oauth_token_secret']);
|
82 |
+
//die();
|
83 |
wp_redirect($connection->getAuthorizeURL($requestToken['oauth_token']));
|
84 |
die;
|
85 |
}
|
90 |
global $wpdb;
|
91 |
$uniqueId = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'thechamp_twitter_oauthtoken' and meta_value = %s", $_REQUEST['oauth_token']));
|
92 |
$oauthTokenSecret = get_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret', true);
|
|
|
|
|
|
|
|
|
|
|
93 |
if(empty($uniqueId) || $oauthTokenSecret == ''){
|
94 |
// invalid request
|
95 |
wp_redirect(site_url());
|
101 |
/* Create a TwitterOauth object with consumer/user tokens. */
|
102 |
$connection = new TwitterOAuth($theChampLoginOptions['twitter_key'], $theChampLoginOptions['twitter_secret'], $accessToken['oauth_token'], $accessToken['oauth_token_secret']);
|
103 |
$content = $connection->get('account/verify_credentials');
|
104 |
+
// delete temporary data
|
105 |
+
delete_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret');
|
106 |
+
delete_user_meta($uniqueId, 'thechamp_twitter_oauthtoken');
|
107 |
+
|
108 |
if(is_object($content) && isset($content -> id)){
|
109 |
the_champ_user_auth($content, 'twitter');
|
110 |
the_champ_close_login_popup(the_champ_get_login_redirection_url());
|
199 |
}
|
200 |
</script>
|
201 |
<?php
|
202 |
+
// scripts used for common Social Login functionality
|
203 |
+
if(the_champ_social_login_enabled() && !is_user_logged_in()){
|
204 |
+
require 'js/front/social_login/common.js';
|
205 |
+
}
|
206 |
if(isset($theChampLoginOptions['email_required']) && $theChampLoginOptions['email_required'] == 1){
|
207 |
wp_enqueue_script('thickbox');
|
208 |
wp_enqueue_style('thickbox');
|
213 |
}
|
214 |
// Linkedin scripts
|
215 |
if(the_champ_social_login_provider_enabled('linkedin') && !is_user_logged_in()){
|
216 |
+
?>
|
217 |
+
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
|
218 |
+
api_key: <?php echo isset($theChampLoginOptions['li_key']) ? $theChampLoginOptions['li_key'] : '' ?>
|
219 |
+
|
220 |
+
onLoad: theChampLinkedInOnLoad
|
221 |
+
</script>
|
222 |
+
<?php
|
223 |
+
wp_enqueue_script('the_champ_sl_linkedin', plugins_url('js/front/social_login/linkedin.js', __FILE__));
|
224 |
}
|
225 |
+
// Vkontakte scripts
|
226 |
+
if(the_champ_social_login_provider_enabled('vkontakte') && !is_user_logged_in()){
|
227 |
+
require 'js/front/social_login/vkontakte.js';
|
228 |
}
|
229 |
// Facebook scripts
|
230 |
if(the_champ_facebook_plugin_enabled()){
|
231 |
require 'js/front/facebook/sdk.js';
|
232 |
}
|
233 |
if(the_champ_social_login_provider_enabled('facebook') && !is_user_logged_in()){
|
234 |
+
?>
|
235 |
+
<script>
|
236 |
+
var theChampFacebookScope = 'email<?php echo isset( $theChampFacebookOptions["enable_fbfeed"] ) && $theChampFacebookOptions["enable_fbfeed"] == 1 ? ", publish_stream" : "" ?>';
|
237 |
+
var theChampFBFeedEnabled = <?php echo the_champ_facebook_feed_enabled() ? 'true' : 'false' ?>;
|
238 |
+
</script>
|
239 |
+
<?php
|
240 |
+
wp_enqueue_script('the_champ_sl_facebook', plugins_url('js/front/social_login/facebook.js', __FILE__));
|
241 |
}
|
242 |
// Facebook commenting
|
243 |
if(the_champ_facebook_commenting_enabled()){
|
244 |
+
?>
|
245 |
+
<script>
|
246 |
+
var theChampFBCommentTitleEnable = <?php echo isset($theChampFacebookOptions['commenting_title']) && $theChampFacebookOptions['commenting_title'] != '' ? 'true' : 'false' ?>;
|
247 |
+
var theChampFBCommentTitle = '<?php echo $theChampFacebookOptions['commenting_title'] ?>';
|
248 |
+
var theChampFBCommentUrl = '<?php echo isset($theChampFacebookOptions['urlToComment']) && $theChampFacebookOptions['urlToComment'] != '' ? $theChampFacebookOptions["urlToComment"] : get_permalink(); ?>';
|
249 |
+
var theChampFBCommentColor = '<?php echo isset($theChampFacebookOptions['comment_color']) && $theChampFacebookOptions['comment_color'] != '' ? $theChampFacebookOptions["comment_color"] : ''; ?>';
|
250 |
+
var theChampFBCommentNumPosts = '<?php echo isset($theChampFacebookOptions['comment_numposts']) && $theChampFacebookOptions['comment_numposts'] != '' ? $theChampFacebookOptions["comment_numposts"] : ''; ?>';
|
251 |
+
var theChampFBCommentWidth = '<?php echo isset($theChampFacebookOptions['comment_width']) && $theChampFacebookOptions['comment_width'] != '' ? $theChampFacebookOptions["comment_width"] : ''; ?>';
|
252 |
+
var theChampFBCommentOrderby = '<?php echo isset($theChampFacebookOptions['comment_orderby']) && $theChampFacebookOptions['comment_orderby'] != '' ? $theChampFacebookOptions["comment_orderby"] : ''; ?>'
|
253 |
+
var theChampFBCommentMobile = '<?php echo isset($theChampFacebookOptions['comment_mobile']) && $theChampFacebookOptions['comment_mobile'] != '' ? $theChampFacebookOptions["comment_mobile"] : ''; ?>';
|
254 |
+
var theChampFBAppID = '<?php echo isset($theChampLoginOptions['fb_key']) && $theChampLoginOptions['fb_key'] != '' ? $theChampLoginOptions['fb_key'] : '' ?>';
|
255 |
+
var theChampSiteUrl = '<?php echo site_url() ?>';
|
256 |
+
</script>
|
257 |
+
<?php
|
258 |
+
wp_enqueue_script('the_champ_fb_commenting', plugins_url('js/front/facebook/commenting.js', __FILE__));
|
259 |
}
|
260 |
// Facebook feed posts
|
261 |
if(the_champ_facebook_feed_enabled()){
|
323 |
* Display Social Login notifications
|
324 |
*/
|
325 |
function the_champ_login_notifications($loginOptions){
|
326 |
+
$errorHtml = '';
|
327 |
if(isset($loginOptions['providers'])){
|
|
|
328 |
if(in_array('facebook', $loginOptions['providers']) && (!isset($loginOptions['fb_key']) || $loginOptions['fb_key'] == '')){
|
329 |
$errorHtml .= the_champ_error_message('Facebook App ID is required for Facebook Login to work');
|
330 |
}
|
337 |
if(in_array('google', $loginOptions['providers']) && (!isset($loginOptions['google_key']) || $loginOptions['google_key'] == '')){
|
338 |
$errorHtml .= the_champ_error_message('Google Plus Client ID is required for Google Plus Login to work');
|
339 |
}
|
340 |
+
if(in_array('vkontakte', $loginOptions['providers']) && (!isset($loginOptions['vk_key']) || $loginOptions['vk_key'] == '')){
|
341 |
+
$errorHtml .= the_champ_error_message('Vkontakte Application ID is required for Vkontakte Login to work');
|
342 |
+
}
|
343 |
}
|
344 |
return $errorHtml;
|
345 |
}
|
410 |
register_setting('the_champ_facebook_options', 'the_champ_facebook', 'the_champ_validate_options');
|
411 |
register_setting('the_champ_login_options', 'the_champ_login', 'the_champ_validate_options');
|
412 |
register_setting('the_champ_sharing_options', 'the_champ_sharing', 'the_champ_validate_options');
|
413 |
+
// show option to disable sharing on particular page/post
|
414 |
+
foreach(array('post', 'page') as $type){
|
415 |
+
add_meta_box('the_champ_meta', 'Super Socializer', 'the_champ_sharing_meta_setup', $type);
|
416 |
+
}
|
417 |
+
// save sharing meta on post/page save
|
418 |
+
add_action('save_post', 'the_champ_save_sharing_meta');
|
419 |
}
|
420 |
+
add_action('admin_init', 'the_champ_options_init');
|
|
|
|
|
421 |
|
422 |
/**
|
423 |
* Include javascript files in admin.
|
447 |
wp_enqueue_style('the_champ_admin_style', plugins_url('css/admin.css', __FILE__));
|
448 |
}
|
449 |
|
450 |
+
function the_champ_add_settings_link($links, $file){
|
451 |
+
static $plugin;
|
452 |
+
if(!$plugin){
|
453 |
+
$plugin = plugin_basename(__FILE__);
|
454 |
+
}
|
455 |
+
if ($file == $plugin){
|
456 |
+
$settingsLink = '<a href="options-general.php?page=the-champ">' . __('Settings') . '</a>';
|
457 |
+
array_unshift($links, $settingsLink); // before other links
|
458 |
+
}
|
459 |
+
return $links;
|
460 |
+
}
|
461 |
+
add_filter('plugin_action_links', 'the_champ_add_settings_link', 10, 2);
|
462 |
+
|
463 |
/**
|
464 |
* Return ajax response
|
465 |
*/
|
585 |
|
586 |
// login options
|
587 |
add_option('the_champ_facebook', array(
|
588 |
+
'enable_fbcomments' => '1',
|
589 |
+
'feedMessage' => 'Has just logged into %website-name%',
|
590 |
+
'comment_lang' => get_locale(),
|
591 |
));
|
592 |
|
593 |
// sharing options
|
648 |
add_action('update_option_the_champ_login', 'the_champ_update_old_blogs');
|
649 |
add_action('update_option_the_champ_facebook', 'the_champ_update_old_blogs');
|
650 |
add_action('update_option_the_champ_sharing', 'the_champ_update_old_blogs');
|
651 |
+
}
|
652 |
+
|
653 |
+
/**
|
654 |
+
* Register LoginRadius_settings and its sanitization callback.
|
655 |
+
*/
|
656 |
+
function the_champ_sharing_meta_setup(){
|
657 |
+
global $post;
|
658 |
+
$postType = $post->post_type;
|
659 |
+
$sharingMeta = get_post_meta($post->ID, '_the_champ_meta', true);
|
660 |
+
?>
|
661 |
+
<p>
|
662 |
+
<label for="the_champ_sharing">
|
663 |
+
<input type="checkbox" name="_the_champ_meta[sharing]" id="the_champ_sharing" value="1" <?php checked('1', @$sharingMeta['sharing']); ?> />
|
664 |
+
<?php _e('Disable Social Sharing on this '.$postType, 'TheChamp') ?>
|
665 |
+
</label>
|
666 |
+
</p>
|
667 |
+
<?php
|
668 |
+
echo '<input type="hidden" name="the_champ_meta_nonce" value="' . wp_create_nonce(__FILE__) . '" />';
|
669 |
+
}
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Save sharing meta fields.
|
673 |
+
*/
|
674 |
+
function the_champ_save_sharing_meta($postId){
|
675 |
+
// make sure data came from our meta box
|
676 |
+
if(!isset($_POST['the_champ_meta_nonce']) || !wp_verify_nonce( $_POST['the_champ_meta_nonce'], __FILE__ )){
|
677 |
+
return $postId;
|
678 |
+
}
|
679 |
+
// check user permissions
|
680 |
+
if($_POST['post_type'] == 'page'){
|
681 |
+
if(!current_user_can('edit_page', $postId)){
|
682 |
+
return $postId;
|
683 |
+
}
|
684 |
+
}else{
|
685 |
+
if(!current_user_can('edit_post', $postId)){
|
686 |
+
return $postId;
|
687 |
+
}
|
688 |
+
}
|
689 |
+
if ( isset( $_POST['_the_champ_meta'] ) ) {
|
690 |
+
$newData = $_POST['_the_champ_meta'];
|
691 |
+
}else{
|
692 |
+
$newData = array( 'sharing' => 0 );
|
693 |
+
}
|
694 |
+
update_post_meta($postId, '_the_champ_meta', $newData);
|
695 |
+
return $postId;
|
696 |
}
|