PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 3.2.2
LoginPress | wp-login Custom Login Page Customizer v3.2.2
6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.3 1.0.4 All 118 releases
loginpress / loginpress.php

loginpress.php in LoginPress | wp-login Custom Login Page Customizer 3.2.2, at loginpress.php

705 lines 24.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: LoginPress
4 * Plugin URI: https://loginpress.pro?utm_source=loginpress-lite&utm_medium=plugin-header&utm_campaign=pro-upgrade&utm_content=plugin-uri
5 * Description: LoginPress is the best <code>wp-login</code> Login Page Customizer plugin by <a href="https://wpbrigade.com/?utm_source=loginpress-lite&utm_medium=plugins&utm_campaign=wpbrigade-home&utm_content=WPBrigade-text-link">WPBrigade</a> which allows you to completely change the layout of login, register and forgot password forms.
6 * Version: 3.2.2
7 * Author: LoginPress
8 * Author URI: https://loginpress.pro?utm_source=loginpress-lite&utm_medium=plugin-header&utm_campaign=pro-upgrade&utm_content=author-uri
9 * Text Domain: loginpress
10 * Domain Path: /languages
11 *
12 * @package loginpress
13 * @category Core
14 * @author WPBrigade
15 */
16
17
18 if ( ! function_exists( 'loginpress_wpb53407382' ) ) {
19 // Create a helper function for easy SDK access.
20 function loginpress_wpb53407382() {
21 global $loginpress_wpb53407382;
22
23 if ( ! isset( $loginpress_wpb53407382 ) ) {
24 // Include Telemetry SDK.
25 require_once dirname(__FILE__) . '/lib/wpb-sdk/start.php';
26
27 $loginpress_wpb53407382 = wpb_dynamic_init([
28 'id' => '6',
29 'slug' => 'loginpress',
30 'type' => 'plugin',
31 'public_key' => '1|4aOA8EuyIN4pi2miMvC23LLpnHbBZFNki9R9pVmwd673d3c8',
32 'secret_key' => 'sk_b36c525848fee035',
33 'is_premium' => false,
34 'has_addons' => false,
35 'has_paid_plans' => false,
36 'menu' => [
37 'slug' => 'loginpress',
38 'account' => false,
39 'support' => false,
40 ],
41 'settings' => [ 'loginpress_customization' => '' , 'loginpress_setting' => '' , 'loginpress_addon_active_time' => '' , 'loginpress_addon_dismiss_1' => '' , 'loginpress_review_dismiss' => '' , 'loginpress_active_time' => '' , '_loginpress_optin' => '' , 'loginpress_friday_sale_active_time' => '' , 'loginpress_friday_sale_dismiss' => '' , 'loginpress_friday_21_sale_dismiss' => '' ],
42 ]);
43 }
44
45 return $loginpress_wpb53407382;
46 }
47
48 // Init Telemetry.
49 loginpress_wpb53407382();
50 // Signal that SDK was initiated.
51 do_action( 'loginpress_wpb53407382_loaded' );
52 }
53
54 if ( ! class_exists( 'LoginPress' ) ) :
55
56 final class LoginPress {
57
58 /**
59 * @var string
60 */
61 public $version = '3.2.2';
62
63 /**
64 * @var The single instance of the class
65 * @since 1.0.0
66 */
67 protected static $_instance = null;
68
69 /**
70 * @var WP_Session session
71 */
72 public $session = null;
73
74 /**
75 * @var WP_Query $query
76 */
77 public $query = null;
78
79 /**
80 * @var WP_Countries $countries
81 */
82 public $countries = null;
83
84 /**
85 * Class Constructor.
86 */
87 public function __construct() {
88
89 $this->define_constants();
90 $this->includes();
91 $this->_hooks();
92 }
93
94 /**
95 * Define LoginPress Constants
96 */
97 private function define_constants() {
98
99 $this->define( 'LOGINPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
100 $this->define( 'LOGINPRESS_DIR_PATH', plugin_dir_path( __FILE__ ) );
101 $this->define( 'LOGINPRESS_DIR_URL', plugin_dir_url( __FILE__ ) );
102 $this->define( 'LOGINPRESS_ROOT_PATH', dirname( __FILE__ ) . '/' );
103 $this->define( 'LOGINPRESS_ROOT_FILE', __FILE__ );
104 $this->define( 'LOGINPRESS_VERSION', $this->version );
105 $this->define( 'LOGINPRESS_FEEDBACK_SERVER', 'https://wpbrigade.com/' );
106 }
107
108 /**
109 * Include required core files used in admin and on the frontend.
110 *
111 * @since 1.0.0
112 * @version 3.0.0
113 */
114 public function includes() {
115
116 include_once( LOGINPRESS_DIR_PATH . 'include/compatibility.php' );
117 include_once( LOGINPRESS_DIR_PATH . 'custom.php' );
118 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-setup.php' );
119 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-ajax.php' );
120 // include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-filter-plugin.php' );
121 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-developer-hooks.php' );
122 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-notifications.php' );
123 if ( is_multisite() ) {
124 require_once( LOGINPRESS_DIR_PATH . 'include/class-loginpress-theme-template.php' );
125 }
126
127 $loginpress_setting = get_option( 'loginpress_setting' );
128
129 $loginpress_privacy_policy = isset( $loginpress_setting['enable_privacy_policy'] ) ? $loginpress_setting['enable_privacy_policy'] : 'off';
130 if ( 'off' != $loginpress_privacy_policy ) {
131 include_once( LOGINPRESS_DIR_PATH . 'include/privacy-policy.php' );
132 }
133
134 $login_with_email = isset( $loginpress_setting['login_order'] ) ? $loginpress_setting['login_order'] : 'default';
135 if ( 'default' != $login_with_email ) {
136 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-login-order.php' );
137 new LoginPress_Login_Order();
138 }
139
140 $enable_reg_pass_field = isset( $loginpress_setting['enable_reg_pass_field'] ) ? $loginpress_setting['enable_reg_pass_field'] : 'off';
141 if ( 'off' != $enable_reg_pass_field ) {
142 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-custom-password.php' );
143 new LoginPress_Custom_Password();
144 }
145 $loginpress_password_reset_time_limit = isset( $loginpress_setting['loginpress_password_reset_time_limit'] ) ? $loginpress_setting['loginpress_password_reset_time_limit'] : 'off';
146 if ( 'off' != $loginpress_password_reset_time_limit ) {
147 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-force-reset-pass.php' );
148 new LoginPress_Force_Password_Reset();
149 }
150
151 }
152
153 /**
154 * Hook into actions and filters
155 * @since 1.0.0
156 * @version 3.0.0
157 */
158 private function _hooks() {
159
160 add_action( 'admin_menu', array( $this, 'register_options_page' ) );
161 add_action( 'plugins_loaded', array( $this, 'textdomain' ) );
162 add_filter( 'plugin_row_meta', array( $this, '_row_meta'), 10, 2 );
163 add_action( 'admin_enqueue_scripts', array( $this, '_admin_scripts' ) );
164 add_action( 'admin_footer', array( $this, 'add_deactivate_modal' ) );
165 add_action( 'plugin_action_links', array( $this, 'loginpress_action_links' ), 10, 2 );
166 add_action( 'admin_init', array( $this, 'redirect_optin' ) );
167 add_filter( 'auth_cookie_expiration', array( $this, '_change_auth_cookie_expiration' ), 10, 3 );
168 add_action( 'wp_wpb_sdk_after_uninstall', array( $this, 'plugin_uninstallation' ) );
169 //add_filter( 'plugins_api', array( $this, 'get_addon_info_' ) , 100, 3 );
170 if ( is_multisite() ) {
171 add_action( 'admin_init', array( $this, 'redirect_loginpress_edit_page' ) );
172 add_action( 'admin_init', array( $this, 'check_loginpress_page' ) );
173 // Makes sure the plugin is defined before trying to use it
174 if ( ! function_exists( 'is_plugin_active_for_network' ) || ! function_exists( 'is_plugin_active' ) ) {
175 require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
176 if ( is_plugin_active_for_network( 'wordpress-seo/wp-seo.php' ) ) {
177 /**
178 * This filters the ID of the page/post which you want to remove from the sitemap XML.
179 * @since 1.5.14
180 *
181 * @documentation https://developer.yoast.com/features/xml-sitemaps/api/
182 */
183 add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'loginpress_exclude_from_sitemap' ) );
184 }
185 }
186 }
187 }
188
189 /**
190 * Callback function to exclude LoginPress page from sitemap.
191 *
192 * @return bool Exclude page/s or post/s.
193 * @since 1.5.14
194 * @version 1.6.3
195 */
196 public function loginpress_exclude_from_sitemap() {
197
198 $page = get_page_by_path( 'loginpress' );
199 if ( is_object( $page ) ) {
200 return array( $page->ID );
201 }
202 }
203
204 /**
205 * Redirect to Optin page.
206 *
207 * @since 1.0.15
208 */
209 function redirect_optin() {
210
211 /**
212 * Fix the Broken Access Control (BAC) security fix.
213 *
214 * @since 1.6.3
215 */
216 if ( current_user_can( 'manage_options' ) ) {
217 if ( isset( $_POST['loginpress-submit-optout'] ) ) {
218 if ( ! wp_verify_nonce( sanitize_text_field( $_POST['loginpress_submit_optin_nonce'] ), 'loginpress_submit_optin_nonce' ) ) {
219 return;
220 }
221 update_option( '_loginpress_optin', 'no' );
222 // Retrieve WPB SDK existing option and set user_skip
223 $sdk_data = json_decode(get_option('wpb_sdk_loginpress'), true);
224 $sdk_data['user_skip'] = '1';
225 $sdk_data_json = json_encode($sdk_data);
226 update_option('wpb_sdk_loginpress', $sdk_data_json);
227 } elseif ( isset( $_POST['loginpress-submit-optin'] ) ) {
228 if ( ! wp_verify_nonce( sanitize_text_field( $_POST['loginpress_submit_optin_nonce'] ), 'loginpress_submit_optin_nonce' ) ) {
229 return;
230 }
231 update_option( '_loginpress_optin', 'yes' );
232 //WPB SDK OPT IN OPTIONS
233 $sdk_data = array(
234 'communication' => '1',
235 'diagnostic_info' => '1',
236 'extensions' => '1',
237 'user_skip' => '0',
238 );
239 $sdk_data_json = json_encode($sdk_data);
240 update_option('wpb_sdk_loginpress', $sdk_data_json);
241 } elseif ( ! get_option( '_loginpress_optin' ) && isset( $_GET['page'] ) && ( $_GET['page'] === 'loginpress-settings' || $_GET['page'] === 'loginpress' || $_GET['page'] === 'abw' ) ) {
242
243 /**
244 * XSS Attack vector found and fixed.
245 *
246 * @since 1.5.11
247 */
248 $page_redirect = $_GET['page'] === 'loginpress' ? 'loginpress' : 'loginpress-settings';
249 wp_redirect( admin_url('admin.php?page=loginpress-optin&redirect-page=' . $page_redirect) );
250 exit;
251
252 } elseif ( get_option( '_loginpress_optin' ) && ( get_option( '_loginpress_optin' ) == 'yes' ) && isset( $_GET['page'] ) && $_GET['page'] === 'loginpress-optin' ) {
253 wp_redirect( admin_url( 'admin.php?page=loginpress-settings' ) );
254 exit;
255 }
256 }
257 }
258
259 /**
260 * Main Instance
261 *
262 * @since 1.0.0
263 * @static
264 * @see loginPress_loader()
265 * @return Main instance
266 */
267 public static function instance() {
268 if ( is_null( self::$_instance ) ) {
269 self::$_instance = new self();
270 }
271 return self::$_instance;
272 }
273
274 /**
275 * Load Languages
276 * @since 1.0.0
277 */
278 public function textdomain() {
279
280 $plugin_dir = dirname( plugin_basename( __FILE__ ) ) ;
281 load_plugin_textdomain( 'loginpress', false, $plugin_dir . '/languages/' );
282 }
283
284 /**
285 * Define constant if not already set
286 * @param string $name
287 * @param string|bool $value
288 */
289 private function define( $name, $value ) {
290 if ( ! defined( $name ) ) {
291 define( $name, $value );
292 }
293 }
294
295 /**
296 * Init WPBrigade when WordPress Initializes.
297 */
298 public function init() {
299 // Before init action
300 }
301
302 /**
303 * Create LoginPress Page Template.
304 *
305 * @since 1.1.3
306 */
307 public function check_loginpress_page() {
308
309 // Retrieve the LoginPress admin page option, that was created during the activation process.
310 $option = $this->get_loginpress_page();
311
312 include LOGINPRESS_DIR_PATH . 'include/create-loginpress-page.php';
313 // Retrieve the status of the page, if the option is available.
314 if ( $option ) {
315 $page = get_post( $option );
316 $status = $page->post_status;
317 } else {
318 $status = null;
319 }
320
321 // Check the status of the page. Let's fix it, if the page is missing or in the trash.
322 if ( empty( $status ) || 'trash' === $status ) {
323 new LoginPress_Page_Create();
324 }
325 }
326
327 /**
328 * function for redirect the LoginPress page on editing.
329 *
330 * @since 1.1.3
331 */
332 public function redirect_loginpress_edit_page() {
333 global $pagenow;
334
335 $page = $this->get_loginpress_page();
336
337 if ( ! $page ) {
338 return;
339 }
340
341 $page_url = get_permalink( $page );
342 $page_id = get_post( $page );
343 $page_id = $page->ID;
344
345 // Generate the redirect url.
346 $url = add_query_arg(
347 array(
348 'autofocus[section]' => 'loginpress_panel',
349 'url' => rawurlencode( $page_url ),
350 ),
351 admin_url( 'customize.php' )
352 );
353
354 /* Check current admin page. */
355 if ( $pagenow == 'post.php' && isset( $_GET['post'] ) && $_GET['post'] == $page_id ) {
356 wp_safe_redirect( $url );
357 }
358 }
359
360 /**
361 * Add new page in Appearance to customize Login Page.
362 * @version 3.0.0
363 */
364 public function register_options_page() {
365
366 add_submenu_page( 'LoginPress', __( 'Activate', 'loginpress' ), __( 'Activate', 'loginpress' ), 'manage_options', 'loginpress-optin', array( $this, 'render_optin' ) );
367
368 add_theme_page( __( 'LoginPress', 'loginpress' ), __( 'LoginPress', 'loginpress' ), 'manage_options', "abw", '__return_null' );
369 }
370
371
372 /**
373 * Show Opt-in Page.
374 *
375 * @since 1.0.15
376 */
377 function render_optin() {
378 include LOGINPRESS_DIR_PATH . 'include/loginpress-optin-form.php';
379 }
380
381 /**
382 * Session Expiration
383 *
384 * @since 1.0.18
385 * @version 1.3.2
386 */
387 function _change_auth_cookie_expiration( $expiration, $user_id, $remember ) {
388
389 $loginpress_setting = get_option( 'loginpress_setting' );
390 $_expiration = isset( $loginpress_setting['session_expiration'] ) ? intval( $loginpress_setting['session_expiration'] ) : '';
391
392 /**
393 * return the WordPress default $expiration time if LoginPress Session Expiration time set 0 or empty.
394 * @since 1.0.18
395 */
396 if ( empty( $_expiration ) || '0' == $_expiration ) {
397 return $expiration;
398 }
399
400 /**
401 * $filter_role Use filter `loginpress_exclude_role_session` for return the role.
402 * By default it's false and $expiration time will apply on all user.
403 *
404 * @return string/array role name.
405 * @since 1.3.2
406 */
407 $filter_role = apply_filters( 'loginpress_exclude_role_session', false );
408
409 if ( $filter_role ) {
410 $user_roles = get_userdata( $user_id )->roles;
411
412 // if $filter_role is array, return the default $expiration for each defined role.
413 if ( is_array( $filter_role ) ) {
414 foreach ( $filter_role as $role ) {
415 if ( in_array( $role, $user_roles ) ) {
416 return $expiration;
417 }
418 }
419 } else if ( in_array( $filter_role, $user_roles ) ) {
420 return $expiration;
421 }
422 }
423
424 // Convert Duration (minutes) of the expiration period in seconds.
425 $expiration = $_expiration * 60;
426
427 return $expiration;
428 }
429
430 /**
431 * Load JS or CSS files at admin side and enqueue them
432 * @param string tell you the Page ID
433 * @return void
434 * @version 3.0.0
435 */
436 function _admin_scripts( $hook ) {
437
438 if( $hook == 'toplevel_page_loginpress-settings' || $hook == 'loginpress_page_loginpress-addons' || $hook == 'loginpress_page_loginpress-help' || $hook == 'loginpress_page_loginpress-import-export' || $hook == 'loginpress_page_loginpress-license' || $hook == 'admin_page_loginpress-optin' ) {
439
440 wp_enqueue_style( 'loginpress_style', plugins_url( 'css/style.css', __FILE__ ), array(), LOGINPRESS_VERSION );
441 wp_enqueue_script( 'loginpress_js', plugins_url( 'js/admin-custom.js', __FILE__ ), array(), LOGINPRESS_VERSION );
442
443 // Array for localize.
444 $loginpress_localize = array(
445 'plugin_url' => plugins_url(),
446 'localize_translations' => array(
447 _x( 'Name', 'Login Redirect Roles', 'loginpress' ),
448 ),
449 'help_nonce' => wp_create_nonce( 'loginpress-log-nonce' ),
450
451 );
452
453 wp_localize_script( 'loginpress_js', 'loginpress_script', $loginpress_localize );
454 }
455
456 }
457
458 /**
459 * Add rating icon on plugins page.
460 *
461 * @since 1.0.9
462 * @version 1.1.22
463 */
464
465 public function _row_meta( $meta_fields, $file ) {
466
467 if ( $file != 'loginpress/loginpress.php' ) {
468 return $meta_fields;
469 }
470
471 echo "<style>.loginpress-rate-stars { display: inline-block; color: #ffb900; position: relative; top: 3px; }.loginpress-rate-stars svg{ fill:#ffb900; } .loginpress-rate-stars svg:hover{ fill:#ffb900 } .loginpress-rate-stars svg:hover ~ svg{ fill:none; } </style>";
472
473 $plugin_rate = "https://wordpress.org/support/plugin/loginpress/reviews/?rate=5#rate-response";
474 $plugin_filter = "https://wordpress.org/support/plugin/loginpress/reviews/?filter=5";
475 $svg_xmlns = "https://www.w3.org/2000/svg";
476 $svg_icon = '';
477
478 for ( $i = 0; $i < 5; $i++ ) {
479 $svg_icon .= "<svg xmlns='" . esc_url( $svg_xmlns ) . "' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>";
480 }
481
482 // Set icon for thumbs up.
483 $meta_fields[] = '<a href="' . esc_url( $plugin_filter ) . '" target="_blank"><span class="dashicons dashicons-thumbs-up"></span>' . __( 'Vote!', 'loginpress' ) . '</a>';
484
485 // Set icon for 5-star reviews. v1.1.22
486 $meta_fields[] = "<a href='" . esc_url( $plugin_rate ) . "' target='_blank' title='" . esc_html__( 'Rate', 'loginpress' ) . "'><i class='loginpress-rate-stars'>" . $svg_icon . "</i></a>";
487
488 return $meta_fields;
489 }
490
491 /**
492 * Add deactivate modal layout.
493 */
494 function add_deactivate_modal() {
495 global $pagenow;
496
497 if ( 'plugins.php' !== $pagenow ) {
498 return;
499 }
500
501 include LOGINPRESS_DIR_PATH . 'include/loginpress-optout-form.php';
502 }
503
504 /**
505 * Plugin activation
506 *
507 * @since 1.0.15
508 * @version 1.0.22
509 */
510 static function plugin_activation() {
511
512 $loginpress_key = get_option( 'loginpress_customization' );
513 $loginpress_setting = get_option( 'loginpress_setting' );
514
515 // Create a key 'loginpress_customization' with empty array.
516 if ( ! $loginpress_key ) {
517 update_option( 'loginpress_customization', array() );
518 }
519
520 // Create a key 'loginpress_setting' with empty array.
521 if ( ! $loginpress_setting ) {
522 update_option( 'loginpress_setting', array() );
523 }
524 }
525
526 function plugin_uninstallation() {
527 include_once (LOGINPRESS_DIR_PATH . 'include/uninstall.php');
528 }
529
530
531 /**
532 * Pull the LoginPress page from options.
533 *
534 * @access public
535 * @since 1.1.3
536 * @version 1.1.7
537 */
538 public function get_loginpress_page() {
539
540 $loginpress_setting = get_option( 'loginpress_setting', array() );
541 if ( ! is_array( $loginpress_setting ) && empty( $loginpress_setting ) ) {
542 $loginpress_setting = array();
543 }
544 $page = array_key_exists( 'loginpress_page', $loginpress_setting ) ? get_post( $loginpress_setting['loginpress_page'] ) : false;
545
546 return $page;
547 }
548
549
550 /**
551 * Add a link to the settings page to the plugins list
552 *
553 * @since 1.0.11
554 * @version 3.0.8
555 */
556 public function loginpress_action_links( $links, $file ) {
557
558 static $this_plugin;
559
560 if ( empty( $this_plugin ) ) {
561 $this_plugin = 'loginpress/loginpress.php';
562 }
563
564 if ($file == $this_plugin) {
565 // Build the initial settings and customize links
566 $settings_link = sprintf(
567 esc_html__('%1$s Settings %2$s | %3$s Customize %4$s', 'loginpress'),
568 '<a href="' . admin_url('admin.php?page=loginpress-settings') . '">', '</a>',
569 '<a href="' . admin_url('admin.php?page=loginpress') . '">', '</a>'
570 );
571
572 // Retrieve WPB SDK Opt Out options
573 $sdk_data = json_decode(get_option('wpb_sdk_loginpress'), true);
574
575 // Set default values for options
576 $communication = isset($sdk_data['communication']) ? $sdk_data['communication'] : false;
577 $diagnostic_info = isset($sdk_data['diagnostic_info']) ? $sdk_data['diagnostic_info'] : false;
578 $extensions = isset($sdk_data['extensions']) ? $sdk_data['extensions'] : false;
579
580 // Determine the opt-in state and whether all options are false
581 $is_optin = 'yes' == get_option('_loginpress_optin');
582 $all_options_false = $communication === false && $diagnostic_info === false && $extensions === false;
583
584 // Build the settings link based on the option states
585 if ($communication || $diagnostic_info || $extensions) {
586 $settings_link .= sprintf(
587 esc_html__(' | %1$s Opt Out %2$s ', 'loginpress'),
588 '<a class="opt-out" href="' . admin_url('admin.php?page=loginpress-settings') . '">', '</a>'
589 );
590 } else {
591 if ($is_optin) {
592 if ($all_options_false) {
593 // Case 1: Old users without any settings (meaning all options are false)
594 // Ensure old users remain fully opted in by setting all options to true.
595 $sdk_data = json_encode([
596 'communication' => '1',
597 'diagnostic_info' => '1',
598 'extensions' => '1',
599 'user_skip' => '0',
600 ]);
601 update_option('wpb_sdk_loginpress', $sdk_data);
602 $settings_link .= sprintf(
603 esc_html__(' | %1$s Opt Out %2$s ', 'loginpress'),
604 '<a class="opt-out" href="' . admin_url('admin.php?page=loginpress-settings') . '">', '</a>'
605 );
606 } else {
607 // If opted in and not all options are false, update the opt-in state
608 update_option('_loginpress_optin', 'no');
609 // Display opt-in link
610 $settings_link .= sprintf(
611 esc_html__(' | %1$s Opt In %2$s ', 'loginpress'),
612 '<a href="' . admin_url('admin.php?page=loginpress-optin&redirect-page=loginpress-settings') . '">', '</a>'
613 );
614 }
615
616 // Display opt-out link
617 } else {
618 $settings_link .= sprintf(
619 esc_html__(' | %1$s Opt In %2$s ', 'loginpress'),
620 '<a href="' . admin_url('admin.php?page=loginpress-optin&redirect-page=loginpress-settings') . '">', '</a>'
621 );
622
623 }
624 }
625
626 // Add the settings link to the array
627 array_unshift($links, $settings_link);
628
629 // Add Pro upgrade link if not already present
630 if (!has_action('loginpress_pro_add_template')) {
631 $pro_link = sprintf(
632 esc_html__('%1$s %3$s Upgrade Pro %4$s %2$s', 'loginpress'),
633 '<a href="https://loginpress.pro/lite/?utm_source=loginpress-lite&utm_medium=plugins&utm_campaign=pro-upgrade&utm_content=Upgrade+Pro" target="_blank">',
634 '</a>', '<span class="loginpress-dashboard-pro-link">', '</span>'
635 );
636 array_push($links, $pro_link);
637 }
638 }
639
640 return $links;
641 }
642
643 // function get_addon_info_( $api, $action, $args ) {
644
645 // if ( $action == 'plugin_information' && empty( $api ) && ( ! empty( $_GET['lgp'] ) ) ) {
646
647 // $raw_response = wp_remote_post( 'https://wpbrigade.com/loginpress-api/search.php', array(
648 // 'body' => array(
649 // 'slug' => $args->slug
650 // ) )
651 // );
652
653 // if ( is_wp_error( $raw_response ) || $raw_response['response']['code'] != 200 ) {
654 // return false;
655 // }
656
657 // $plugin = unserialize( $raw_response['body'] );
658
659 // $api = new stdClass();
660 // $api->name = $plugin['title'];
661 // $api->version = $plugin['version'];
662 // $api->download_link = $plugin['download_url'];
663 // $api->tested = '10.0';
664
665 // }
666
667 // return $api;
668 // }
669 } // End Of Class.
670 endif;
671
672
673 /**
674 * Returns the main instance of WP to prevent the need to use globals.
675 *
676 * @since 1.0.0
677 * @return LoginPress
678 */
679 function loginPress_loader() {
680 return LoginPress::instance();
681 }
682
683 // Call the function
684 loginPress_loader();
685
686 /**
687 * Create the Object of Custom Login Entities and Settings.
688 *
689 * @since 1.0.0
690 */
691 new LoginPress_Entities();
692 new LoginPress_Settings();
693
694 /**
695 * Create the Object of Remote Notification.
696 *
697 * @since 1.0.9
698 */
699 if ( ! class_exists( 'TAV_Remote_Notification_Client' ) ) {
700 require( LOGINPRESS_ROOT_PATH . 'include/class-remote-notification-client.php' );
701 }
702 $notification = new TAV_Remote_Notification_Client( 125, '16765c0902705d62', 'https://wpbrigade.com?post_type=notification' );
703
704 register_activation_hook( __FILE__, array( 'LoginPress', 'plugin_activation' ) );
705