forked from wp-plugins/login-sidebar-widget
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.php
More file actions
322 lines (298 loc) · 11.5 KB
/
settings.php
File metadata and controls
322 lines (298 loc) · 11.5 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?php
class login_settings {
private $default_style = '
.login_wid{
list-style-type:none;
border: 1px dashed #999999;
width:98%;
float:left;
padding:2%;
}
.login_wid li{
width:45%;
float:left;
margin:2px;
}
.afo_social_login{
padding:5px 0px 0px 0px;
clear:both;
width:100% !important;
}';
function __construct() {
$this->load_settings();
}
function login_widget_afo_save_settings(){
if(isset($_POST['option']) and $_POST['option'] == "login_widget_afo_save_settings"){
if ( ! isset( $_POST['login_widget_afo_field'] ) || ! wp_verify_nonce( $_POST['login_widget_afo_field'], 'login_widget_afo_action' ) ) {
wp_die( 'Sorry, your nonce did not verify.' );
exit;
}
update_option( 'redirect_page', sanitize_text_field($_POST['redirect_page']) );
update_option( 'logout_redirect_page', sanitize_text_field($_POST['logout_redirect_page']) );
update_option( 'link_in_username', sanitize_text_field($_POST['link_in_username']) );
update_option( 'login_afo_rem', sanitize_text_field($_POST['login_afo_rem']) );
update_option( 'login_afo_forgot_pass_link', sanitize_text_field($_POST['login_afo_forgot_pass_link']) );
update_option( 'login_afo_register_link', sanitize_text_field($_POST['login_afo_register_link']) );
if(isset($_POST['load_default_style']) and $_POST['load_default_style'] == "Yes"){
update_option( 'custom_style_afo', sanitize_text_field($this->default_style) );
} else {
update_option( 'custom_style_afo', sanitize_text_field($_POST['custom_style_afo']) );
}
}
}
function login_widget_afo_options () {
global $wpdb;
$redirect_page = get_option('redirect_page');
$logout_redirect_page = get_option('logout_redirect_page');
$link_in_username = get_option('link_in_username');
$login_afo_rem = get_option('login_afo_rem');
$login_afo_forgot_pass_link = get_option('login_afo_forgot_pass_link');
$login_afo_register_link = get_option('login_afo_register_link');
$custom_style_afo = stripslashes(get_option('custom_style_afo'));
$this->donate_form_login();
$this->fb_comment_addon_add();
$this->fb_login_pro_add();
$this->help_support();
?>
<form name="f" method="post" action="">
<?php wp_nonce_field('login_widget_afo_action','login_widget_afo_field'); ?>
<input type="hidden" name="option" value="login_widget_afo_save_settings" />
<table width="98%" style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:0px 0px 0px 10px; margin:2px;">
<tr>
<td width="45%"><h1>Login Widget AFO Settings</h1></td>
<td width="55%"> </td>
</tr>
<tr>
<td><strong>Login Redirect Page:</strong></td>
<td><?php
$args = array(
'depth' => 0,
'selected' => $redirect_page,
'echo' => 1,
'show_option_none' => '-',
'id' => 'redirect_page',
'name' => 'redirect_page'
);
wp_dropdown_pages( $args );
?></td>
</tr>
<tr>
<td><strong>Logout Redirect Page:</strong></td>
<td><?php
$args1 = array(
'depth' => 0,
'selected' => $logout_redirect_page,
'echo' => 1,
'show_option_none' => '-',
'id' => 'logout_redirect_page',
'name' => 'logout_redirect_page'
);
wp_dropdown_pages( $args1 );
?></td>
</tr>
<tr>
<td><strong>Link in Username</strong></td>
<td><?php
$args2 = array(
'depth' => 0,
'selected' => $link_in_username,
'echo' => 1,
'show_option_none' => '-',
'id' => 'link_in_username',
'name' => 'link_in_username'
);
wp_dropdown_pages( $args2 );
?></td>
</tr>
<tr>
<td><strong>Add Remember Me</strong></td>
<td><input type="checkbox" name="login_afo_rem" value="Yes" <?php echo $login_afo_rem == 'Yes'?'checked="checked"':'';?> /></td>
</tr>
<tr>
<td><strong>Forgot Password Link</strong></td>
<td>
<?php
$args3 = array(
'depth' => 0,
'selected' => $login_afo_forgot_pass_link,
'echo' => 1,
'show_option_none' => '-',
'id' => 'login_afo_forgot_pass_link',
'name' => 'login_afo_forgot_pass_link'
);
wp_dropdown_pages( $args3 );
?>
<i>Leave blank to not include the link</i>
</td>
</tr>
<tr>
<td><strong>Register Link</strong></td>
<td>
<?php
$args4 = array(
'depth' => 0,
'selected' => $login_afo_register_link,
'echo' => 1,
'show_option_none' => '-',
'id' => 'login_afo_register_link',
'name' => 'login_afo_register_link'
);
wp_dropdown_pages( $args4 );
?>
<i>Leave blank to not include the link</i>
</td>
</tr>
<tr>
<td width="45%"><h1>Styling</h1></td>
<td width="55%"> </td>
</tr>
<tr>
<td valign="top"><input type="checkbox" name="load_default_style" value="Yes" /><strong> Load Default Styles</strong><br />
Check this and hit the save button to go back to default styling.
</td>
<td><textarea name="custom_style_afo" style="width:80%; height:200px;"><?php echo $custom_style_afo;?></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Save" class="button button-primary button-large" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">Use <span style="color:#000066;">[login_widget]</span> shortcode to display login form in post or page.<br />
Example: <span style="color:#000066;">[login_widget title="Login Here"]</span></td>
</tr>
<tr>
<td colspan="2">Use <span style="color:#000066;">[forgot_password]</span> shortcode to display forgot password form in post or page.<br />
Example: <span style="color:#000066;">[forgot_password title="Forgot Password?"]</span></td>
</tr>
</table>
</form>
<?php }
function fb_comment_plugin_addon_options(){
global $wpdb;
$fb_comment_addon = new afo_fb_comment_settings;
$fb_comments_color_scheme = get_option('fb_comments_color_scheme');
$fb_comments_width = get_option('fb_comments_width');
$fb_comments_no = get_option('fb_comments_no');
$fb_comments_language = get_option('fb_comments_language');
?>
<form name="f" method="post" action="">
<input type="hidden" name="option" value="save_afo_fb_comment_settings" />
<table width="100%" border="0" style="background-color:#FFFFFF; margin-top:20px; width:98%; padding:5px; border:1px solid #999999; ">
<tr>
<td colspan="2"><h1>Social Comments Settings</h1></td>
</tr>
<?php do_action('fb_comments_settings_top');?>
<tr>
<td><h3>Facebook Comments</h3></td>
<td></td>
</tr>
<tr>
<td><strong>Language</strong></td>
<td><select name="fb_comments_language">
<option value=""> -- </option>
<?php echo $fb_comment_addon->language_selected($fb_comments_language);?>
</select>
</td>
</tr>
<tr>
<td><strong>Color Scheme</strong></td>
<td><select name="fb_comments_color_scheme">
<?php echo $fb_comment_addon->get_color_scheme_selected($fb_comments_color_scheme);?>
</select>
</td>
</tr>
<tr>
<td><strong>Width</strong></td>
<td><input type="text" name="fb_comments_width" value="<?php echo $fb_comments_width;?>"/> In Percent (%)</td>
</tr>
<tr>
<td><strong>No of Comments</strong></td>
<td><input type="text" name="fb_comments_no" value="<?php echo $fb_comments_no;?>"/> Default is 10</td>
</tr>
<?php do_action('fb_comments_settings_bottom');?>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Save" class="button button-primary button-large" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">Use <span style="color:#000066;">[social_comments]</span> shortcode to display Facebook / Disqus Comments in post or page.<br />
Example: <span style="color:#000066;">[social_comments title="Comments"]</span>
<br /> <br />
Or else<br /> <br />
You can use this function <span style="color:#000066;">social_comments()</span> in your template to display the Facebook Comments. <br />
Example: <span style="color:#000066;"><?php social_comments("Comments");?></span>
</td>
</tr>
</table>
</form>
<?php
}
function login_widget_afo_text_domain(){
load_plugin_textdomain('lwa', FALSE, basename( dirname( __FILE__ ) ) .'/languages');
}
function plug_install_afo_fb_login(){
update_option( 'custom_style_afo', $this->default_style );
}
function login_widget_afo_menu () {
add_options_page( 'Login Widget', 'Login Widget Settings', 'activate_plugins', 'login_widget_afo', array( $this,'login_widget_afo_options' ));
}
function load_settings(){
add_action( 'admin_menu' , array( $this, 'login_widget_afo_menu' ) );
add_action( 'admin_init', array( $this, 'login_widget_afo_save_settings' ) );
add_action( 'plugins_loaded', array( $this, 'login_widget_afo_text_domain' ) );
register_activation_hook(__FILE__, array( $this, 'plug_install_afo_fb_login' ) );
}
function help_support(){ ?>
<table width="98%" border="0" style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:0px 0px 0px 10px; margin:2px;">
<tr>
<td align="right"><a href="http://aviplugins.com/support.php" target="_blank">Help and Support</a></td>
</tr>
</table>
<?php
}
function fb_comment_addon_add(){
if ( !is_plugin_active( 'fb-comments-afo-addon/fb_comment.php' ) ) {
?>
<table width="98%" border="0" style="background-color:#FFFFD2; border:1px solid #E6DB55; padding:0px 0px 0px 10px; margin:2px;">
<tr>
<td><p>There is a <strong>Facebook Comments Addon</strong> for this plugin. The plugin replace the default <strong>Wordpress</strong> Comments module and enable <strong>Facebook</strong> Comments Module. You can get it <a href="http://www.aviplugins.com/fb-comments-afo-addon/" target="_blank">here</a> in <strong>USD 1.00</strong> </p></td>
</tr>
</table>
<?php
}
}
function fb_login_pro_add(){ ?>
<table width="98%" border="0" style="background-color:#FFFFD2; border:1px solid #E6DB55; padding:0px 0px 0px 10px; margin:2px;">
<tr>
<td><p>There is a PRO version of this plugin that supports login with <strong>Facebook</strong>, <strong>Google</strong>, <strong>Twitter</strong> and <strong>LinkedIn</strong>. You can get it <a href="http://aviplugins.com/fb-login-widget-pro/" target="_blank">here</a> in <strong>USD 3.00</strong> </p></td>
</tr>
</table>
<?php }
function donate_form_login(){
if ( !is_plugin_active( 'fb-comments-afo-addon/fb_comment.php' ) ) {
?>
<table width="98%" border="0" style="background-color:#FFFFD2; border:1px solid #E6DB55; margin:2px;">
<tr>
<td align="right"><h3>Even $0.60 Can Make A Difference</h3></td>
<td><form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="avifoujdar@gmail.com">
<input type="hidden" name="item_name" value="Donation for plugins (Login)">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="0.60">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="Make a donation with PayPal">
</form></td>
</tr>
</table>
<?php }
}
}
new login_settings;