PluginProbe
LoginPress | wp-login Custom Login Page Customizer / 1.1.11
LoginPress | wp-login Custom Login Page Customizer v1.1.11
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 1.1.11, at loginpress.php

750 lines 23.3 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 - Customizing the WordPress Login
4 * Plugin URI: https://WPBrigade.com/wordpress/plugins/loginpress/
5 * Description: LoginPress is the best <code>wp-login</code> Login Page Customizer plugin by <a href="https://wpbrigade.com/">WPBrigade</a> which allows you to completely change the layout of login, register and forgot password forms.
6 * Version: 1.1.11
7 * Author: WPBrigade
8 * Author URI: https://WPBrigade.com/
9 * Text Domain: loginpress
10 * Domain Path: /languages
11 *
12 * @package loginpress
13 * @category Core
14 * @author WPBrigade
15 */
16
17
18 if ( ! class_exists( 'LoginPress' ) ) :
19
20 final class LoginPress {
21
22 /**
23 * @var string
24 */
25 public $version = '1.1.11';
26
27 /**
28 * @var The single instance of the class
29 * @since 1.0.0
30 */
31 protected static $_instance = null;
32
33 /**
34 * @var WP_Session session
35 */
36 public $session = null;
37
38 /**
39 * @var WP_Query $query
40 */
41 public $query = null;
42
43 /**s
44 * @var WP_Countries $countries
45 */
46 public $countries = null;
47
48 /* * * * * * * * * *
49 * Class constructor
50 * * * * * * * * * */
51 public function __construct() {
52
53 $this->define_constants();
54 $this->includes();
55 $this->_hooks();
56
57 }
58
59 /**
60 * Define LoginPress Constants
61 */
62 private function define_constants() {
63
64 $this->define( 'LOGINPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
65 $this->define( 'LOGINPRESS_DIR_PATH', plugin_dir_path( __FILE__ ) );
66 $this->define( 'LOGINPRESS_DIR_URL', plugin_dir_url( __FILE__ ) );
67 $this->define( 'LOGINPRESS_ROOT_PATH', dirname( __FILE__ ) . '/' );
68 $this->define( 'LOGINPRESS_ROOT_FILE', __FILE__ );
69 $this->define( 'LOGINPRESS_VERSION', $this->version );
70 $this->define( 'LOGINPRESS_FEEDBACK_SERVER', 'https://wpbrigade.com/' );
71 }
72
73 /**
74 * Include required core files used in admin and on the frontend.
75 * @version 1.1.7
76 */
77
78 public function includes() {
79
80 include_once( LOGINPRESS_DIR_PATH . 'include/compatibility.php' );
81 include_once( LOGINPRESS_DIR_PATH . 'custom.php' );
82 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-setup.php' );
83 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-ajax.php' );
84 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-filter-plugin.php' );
85 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-developer-hooks.php' );
86 if ( is_multisite() ) {
87 require_once( LOGINPRESS_DIR_PATH . 'include/class-loginpress-theme-template.php' );
88 }
89
90 $loginpress_setting = get_option( 'loginpress_setting' );
91
92 $loginpress_privacy_policy = isset( $loginpress_setting['enable_privacy_policy'] ) ? $loginpress_setting['enable_privacy_policy'] : 'off';
93 if ( 'off' != $loginpress_privacy_policy ) {
94 include_once( LOGINPRESS_DIR_PATH . 'include/privacy-policy.php' );
95 }
96
97 $login_with_email = isset( $loginpress_setting['login_order'] ) ? $loginpress_setting['login_order'] : 'default';
98 if ( 'default' != $login_with_email ) {
99 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-login-order.php' );
100 new LoginPress_Login_Order();
101 }
102
103 $enable_reg_pass_field = isset( $loginpress_setting['enable_reg_pass_field'] ) ? $loginpress_setting['enable_reg_pass_field'] : 'off';
104 if ( 'off' != $enable_reg_pass_field ) {
105 include_once( LOGINPRESS_DIR_PATH . 'classes/class-loginpress-custom-password.php' );
106 new LoginPresss_Custom_Password();
107 }
108 }
109
110 /**
111 * Hook into actions and filters
112 * @since 1.0.0
113 */
114 private function _hooks() {
115
116 add_action( 'admin_menu', array( $this, 'register_options_page' ) );
117 add_action( 'plugins_loaded', array( $this, 'textdomain' ) );
118 add_filter( 'plugin_row_meta', array( $this, '_row_meta'), 10, 2 );
119 add_action( 'admin_enqueue_scripts', array( $this, '_admin_scripts' ) );
120 add_action( 'admin_footer', array( $this, 'add_deactive_modal' ) );
121 add_action( 'admin_init', array( $this, 'loginpress_review_notice' ) );
122 add_action( 'admin_init' , array( $this, 'loginpress_addon_notice' ) );
123 add_action( 'plugin_action_links', array( $this, 'loginpress_action_links' ), 10, 2 );
124 add_action( 'admin_init', array( $this, 'redirect_optin' ) );
125 add_filter( 'auth_cookie_expiration', array( $this, '_change_auth_cookie_expiration' ), 10, 3 );
126 //add_filter( 'plugins_api', array( $this, 'get_addon_info_' ) , 100, 3 );
127 if ( is_multisite() ) {
128 add_action( 'admin_init', array( $this, 'redirect_loginpress_edit_page' ) );
129 add_action( 'admin_init', array( $this, 'check_loginpress_page' ) );
130 }
131
132 }
133
134 /**
135 * Redirect to Optin page.
136 *
137 * @since 1.0.15
138 */
139 function redirect_optin() {
140
141 // delete_option( '_loginpress_optin' );
142
143 if ( isset( $_POST['loginpress-submit-optout'] ) ) {
144
145 update_option( '_loginpress_optin', 'no' );
146 $this->_send_data( array(
147 'action' => 'Skip',
148 ) );
149
150 } elseif ( isset( $_POST['loginpress-submit-optin'] ) ) {
151
152 update_option( '_loginpress_optin', 'yes' );
153 $fields = array(
154 'action' => 'Activate',
155 'track_mailchimp' => 'yes'
156 );
157 $this->_send_data( $fields );
158
159 } elseif ( ! get_option( '_loginpress_optin' ) && isset( $_GET['page'] ) && ( $_GET['page'] === 'loginpress-settings' || $_GET['page'] === 'loginpress' || $_GET['page'] === 'abw' ) ) {
160
161 wp_redirect( admin_url('admin.php?page=loginpress-optin&redirect-page=' . $_GET['page'] ) );
162 exit;
163 } elseif ( get_option( '_loginpress_optin' ) && ( get_option( '_loginpress_optin' ) == 'yes' || get_option( '_loginpress_optin' ) == 'no' ) && isset( $_GET['page'] ) && $_GET['page'] === 'loginpress-optin' ) {
164
165 wp_redirect( admin_url( 'admin.php?page=loginpress-settings' ) );
166 exit;
167 }
168 }
169
170
171 /**
172 * Main Instance
173 *
174 * @since 1.0.0
175 * @static
176 * @see loginPress_loader()
177 * @return Main instance
178 */
179 public static function instance() {
180 if ( is_null( self::$_instance ) ) {
181 self::$_instance = new self();
182 }
183 return self::$_instance;
184 }
185
186
187 /**
188 * Load Languages
189 * @since 1.0.0
190 */
191 public function textdomain() {
192
193 $plugin_dir = dirname( plugin_basename( __FILE__ ) ) ;
194 load_plugin_textdomain( 'loginpress', false, $plugin_dir . '/languages/' );
195 }
196
197 /**
198 * Define constant if not already set
199 * @param string $name
200 * @param string|bool $value
201 */
202 private function define( $name, $value ) {
203 if ( ! defined( $name ) ) {
204 define( $name, $value );
205 }
206 }
207
208 /**
209 * Init WPBrigade when WordPress Initialises.
210 */
211 public function init() {
212 // Before init action
213 }
214
215 /**
216 * Create LoginPress Page Template.
217 *
218 * @since 1.1.3
219 */
220 public function check_loginpress_page() {
221
222 // Retrieve the LoginPress admin page option, that was created during the activation process.
223 $option = $this->get_loginpress_page();
224
225 include LOGINPRESS_DIR_PATH . 'include/create-loginpress-page.php';
226 // Retrieve the status of the page, if the option is available.
227 if ( $option ) {
228 $page = get_post( $option );
229 $status = $page->post_status;
230 } else {
231 $status = null;
232 }
233
234 // Check the status of the page. Let's fix it, if the page is missing or in the trash.
235 if ( empty( $status ) || 'trash' === $status ) {
236 new LoginPress_Page_Create();
237 }
238 }
239
240 /**
241 * function for redirect the LoginPress page on editing.
242 *
243 * @since 1.1.3
244 */
245 public function redirect_loginpress_edit_page() {
246 global $pagenow;
247
248 $page = $this->get_loginpress_page();
249
250 if ( ! $page ) {
251 return;
252 }
253
254 $page_url = get_permalink( $page );
255 $page_id = get_post( $page );
256 $page_id = $page->ID;
257
258 // Generate the redirect url.
259 $url = add_query_arg(
260 array(
261 'autofocus[section]' => 'loginpress_panel',
262 'url' => rawurlencode( $page_url ),
263 ),
264 admin_url( 'customize.php' )
265 );
266
267 /* Check current admin page. */
268 if ( $pagenow == 'post.php' && isset( $_GET['post'] ) && $_GET['post'] == $page_id ) {
269 wp_safe_redirect( $url );
270 }
271 }
272
273 /**
274 * Add new page in Apperance to customize Login Page
275 */
276 public function register_options_page() {
277
278 add_submenu_page( null, __( 'Activate', 'loginpress' ), __( 'Activate', 'loginpress' ), 'manage_options', 'loginpress-optin', array( $this, 'render_optin' ) );
279
280 add_theme_page( __( 'LoginPress', 'loginpress' ), __( 'LoginPress', 'loginpress' ), 'manage_options', "abw", '__return_null' );
281 }
282
283
284 /**
285 * Show Opt-in Page.
286 *
287 * @since 1.0.15
288 */
289 function render_optin() {
290 include LOGINPRESS_DIR_PATH . 'include/loginpress-optin-form.php';
291 }
292
293 /**
294 * Wrapper function to send data.
295 * @param [arrays] $args.
296 *
297 * @since 1.0.15
298 * @version 1.0.23
299 */
300 function _send_data( $args ) {
301
302 $cuurent_user = wp_get_current_user();
303 $fields = array(
304 'email' => get_option( 'admin_email' ),
305 'website' => get_site_url(),
306 'action' => '',
307 'reason' => '',
308 'reason_detail' => '',
309 'display_name' => $cuurent_user->display_name,
310 'blog_language' => get_bloginfo( 'language' ),
311 'wordpress_version' => get_bloginfo( 'version' ),
312 'php_version' => PHP_VERSION,
313 'plugin_version' => LOGINPRESS_VERSION,
314 'plugin_name' => 'LoginPress Free',
315 );
316
317 $args = array_merge( $fields, $args );
318 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
319 'method' => 'POST',
320 'timeout' => 5,
321 'httpversion' => '1.0',
322 'blocking' => true,
323 'headers' => array(),
324 'body' => $args,
325 ) );
326
327 // echo '<pre>'; print_r( $args ); echo '</pre>';
328
329 }
330
331 /**
332 * Session Expiration
333 *
334 * @since 1.0.18
335 */
336 function _change_auth_cookie_expiration( $expiration, $user_id, $remember ) {
337
338 $loginpress_setting = get_option( 'loginpress_setting' );
339 $_expiration = isset( $loginpress_setting['session_expiration'] ) ? intval( $loginpress_setting['session_expiration'] ) : '';
340
341 if ( empty( $_expiration ) || '0' == $_expiration ) {
342 return $expiration;
343 }
344
345 $expiration = $_expiration * 60; // Duration of the expiration period in seconds.
346
347 return $expiration;
348 }
349
350 /**
351 * Load JS or CSS files at admin side and enqueue them
352 * @param string tell you the Page ID
353 * @return void
354 */
355 function _admin_scripts( $hook ) {
356
357 if( $hook == 'toplevel_page_loginpress-settings' || $hook == 'loginpress_page_loginpress-help' || $hook == 'loginpress_page_loginpress-import-export' || $hook == 'loginpress_page_loginpress-license' ) {
358
359 wp_enqueue_style( 'loginpress_stlye', plugins_url( 'css/style.css', __FILE__ ), array(), LOGINPRESS_VERSION );
360 wp_enqueue_script( 'loginpress_js', plugins_url( 'js/admin-custom.js', __FILE__ ), array(), LOGINPRESS_VERSION );
361
362 // Array for localize.
363 $loginpress_localize = array(
364 'plugin_url' => plugins_url(),
365 );
366
367 wp_localize_script( 'loginpress_js', 'loginpress_script', $loginpress_localize );
368 }
369
370 }
371
372
373 public function _row_meta( $links, $file ) {
374
375 if ( strpos( $file, 'loginpress.php' ) !== false ) {
376
377 // Set link for Reviews.
378 $new_links = array('<a href="https://wordpress.org/support/plugin/loginpress/reviews/?filter=5" target="_blank"><span class="dashicons dashicons-thumbs-up"></span> ' . __( 'Vote!', 'loginpress' ) . '</a>',
379 );
380
381 $links = array_merge( $links, $new_links );
382 }
383
384 return $links;
385 }
386
387 /**
388 * Add deactivate modal layout.
389 */
390 function add_deactive_modal() {
391 global $pagenow;
392
393 if ( 'plugins.php' !== $pagenow ) {
394 return;
395 }
396
397 include LOGINPRESS_DIR_PATH . 'include/deactivate_modal.php';
398 include LOGINPRESS_DIR_PATH . 'include/loginpress-optout-form.php';
399 }
400
401 /**
402 * Plugin activation
403 *
404 * @since 1.0.15
405 * @version 1.0.22
406 */
407 static function plugin_activation() {
408
409 $loginpress_key = get_option( 'loginpress_customization' );
410 $loginpress_setting = get_option( 'loginpress_setting' );
411
412 // Create a key 'loginpress_customization' with empty array.
413 if ( ! $loginpress_key ) {
414 update_option( 'loginpress_customization', array() );
415 }
416
417 // Create a key 'loginpress_setting' with empty array.
418 if ( ! $loginpress_setting ) {
419 update_option( 'loginpress_setting', array() );
420 }
421 }
422
423 static function plugin_uninstallation() {
424
425 $email = get_option( 'admin_email' );
426
427 $fields = array(
428 'email' => $email,
429 'website' => get_site_url(),
430 'action' => 'Uninstall',
431 'reason' => '',
432 'reason_detail' => '',
433 'blog_language' => get_bloginfo( 'language' ),
434 'wordpress_version' => get_bloginfo( 'version' ),
435 'php_version' => PHP_VERSION,
436 'plugin_version' => LOGINPRESS_VERSION,
437 'plugin_name' => 'LoginPress Free',
438 );
439
440 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
441 'method' => 'POST',
442 'timeout' => 5,
443 'httpversion' => '1.0',
444 'blocking' => false,
445 'headers' => array(),
446 'body' => $fields,
447 ) );
448
449 }
450
451 /**
452 * Ask users to review our plugin on wordpress.org
453 *
454 * @since 1.1.3
455 * @return boolean false
456 */
457 public function loginpress_addon_notice() {
458
459 $this->loginpress_addon_dismissal();
460
461 $activation_time = get_site_option( 'loginpress_addon_active_time' );
462 $addon_dismissal = get_site_option( 'loginpress_addon_dismiss_1' );
463
464 if ( 'yes' == $addon_dismissal ) return;
465
466 if ( ! $activation_time ) :
467
468 $activation_time = time();
469 add_site_option( 'loginpress_addon_active_time', $activation_time );
470 endif;
471
472 // 432000 = 5 Days in seconds.
473 // if ( time() - $activation_time > 432000 ) :
474
475 add_action( 'admin_notices' , array( $this, 'loginpress_addon_notice_text' ) );
476 // endif;
477
478 }
479
480 /**
481 * Ask users to review our plugin on wordpress.org
482 *
483 * @since 1.0.11
484 * @return boolean false
485 * @version 1.1.3
486 */
487 public function loginpress_review_notice() {
488
489 $this->loginpress_review_dismissal();
490 $this->loginpress_review_pending();
491
492 $activation_time = get_site_option( 'loginpress_active_time' );
493 $review_dismissal = get_site_option( 'loginpress_review_dismiss' );
494
495 if ( 'yes' == $review_dismissal ) return;
496
497 if ( ! $activation_time ) :
498
499 $activation_time = time();
500 add_site_option( 'loginpress_active_time', $activation_time );
501 endif;
502
503 // 1296000 = 15 Days in seconds.
504 if ( time() - $activation_time > 1296000 ) :
505
506 wp_enqueue_style( 'loginpress_review_stlye', plugins_url( 'css/style-review.css', __FILE__ ), array(), LOGINPRESS_VERSION );
507 add_action( 'admin_notices' , array( $this, 'loginpress_review_notice_message' ) );
508 endif;
509
510 }
511
512 /**
513 * Check and Dismiss review message.
514 *
515 * @since 1.0.11
516 */
517 private function loginpress_review_dismissal() {
518
519 if ( ! is_admin() ||
520 ! current_user_can( 'manage_options' ) ||
521 ! isset( $_GET['_wpnonce'] ) ||
522 ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'loginpress-review-nonce' ) ||
523 ! isset( $_GET['loginpress_review_dismiss'] ) ) :
524
525 return;
526 endif;
527
528 add_site_option( 'loginpress_review_dismiss', 'yes' );
529 }
530
531 /**
532 * Set time to current so review notice will popup after 14 days
533 *
534 * @since 1.0.11
535 */
536 function loginpress_review_pending() {
537
538 if ( ! is_admin() ||
539 ! current_user_can( 'manage_options' ) ||
540 ! isset( $_GET['_wpnonce'] ) ||
541 ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'loginpress-review-nonce' ) ||
542 ! isset( $_GET['loginpress_review_later'] ) ) :
543
544 return;
545 endif;
546
547 // Reset Time to current time.
548 update_site_option( 'loginpress_active_time', time() );
549 }
550
551 /**
552 * Review notice message
553 *
554 * @since 1.0.11
555 */
556 public function loginpress_review_notice_message() {
557
558 $scheme = ( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY ) ) ? '&' : '?';
559 $url = $_SERVER['REQUEST_URI'] . $scheme . 'loginpress_review_dismiss=yes';
560 $dismiss_url = wp_nonce_url( $url, 'loginpress-review-nonce' );
561
562 $_later_link = $_SERVER['REQUEST_URI'] . $scheme . 'loginpress_review_later=yes';
563 $later_url = wp_nonce_url( $_later_link, 'loginpress-review-nonce' );
564 ?>
565
566 <div class="loginpress-review-notice">
567 <div class="loginpress-review-thumbnail">
568 <img src="<?php echo plugins_url( 'img/thumbnail/gray-loginpress.png', __FILE__ ) ?>" alt="">
569 </div>
570 <div class="loginpress-review-text">
571 <h3><?php _e( 'Leave A Review?', 'loginpress' ) ?></h3>
572 <p><?php _e( 'We hope you\'ve enjoyed using LoginPress! Would you consider leaving us a review on WordPress.org?', 'loginpress' ) ?></p>
573 <ul class="loginpress-review-ul">
574 <li><a href="https://wordpress.org/support/view/plugin-reviews/loginpress?rate=5#postform" target="_blank"><span class="dashicons dashicons-external"></span><?php _e( 'Sure! I\'d love to!', 'loginpress' ) ?></a></li>
575 <li><a href="<?php echo $dismiss_url ?>"><span class="dashicons dashicons-smiley"></span><?php _e( 'I\'ve already left a review', 'loginpress' ) ?></a></li>
576 <li><a href="<?php echo $later_url ?>"><span class="dashicons dashicons-calendar-alt"></span><?php _e( 'Maybe Later', 'loginpress' ) ?></a></li>
577 <li><a href="<?php echo $dismiss_url ?>"><span class="dashicons dashicons-dismiss"></span><?php _e( 'Never show again', 'loginpress' ) ?></a></li></ul>
578 </div>
579 </div>
580 <?php
581 }
582
583 /**
584 * Review notice message
585 *
586 * @since 1.1.3
587 */
588 public function loginpress_addon_notice_text() {
589
590 $scheme = ( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY ) ) ? '&' : '?';
591 $url = $_SERVER['REQUEST_URI'] . $scheme . 'loginpress_addon_dismiss_1=yes';
592 $dismiss_url = wp_nonce_url( $url, 'loginpress-addon-nonce' );
593 wp_enqueue_style( 'loginpress_review_stlye', plugins_url( 'css/style-review.css', __FILE__ ), array(), LOGINPRESS_VERSION );
594 ?>
595 <div class="loginpress-alert-notice">
596 <a href="<?php echo $dismiss_url ?>" class="notice-dismiss" ><span class="screen-reader-text"></span></a>
597 <a href="https://wpbrigade.com/wordpress/plugins/loginpress/addons/?utm_source=loginpress-lite&utm_medium=addons-notice-banner&utm_campaign=pro-upgrade" class="loginpress-addon-notice-link" target="_blank">
598 <div class="loginpress-alert-thumbnail">
599 <img src="<?php echo plugins_url( 'img/notification_logo.svg', __FILE__ ) ?>" alt="">
600 </div>
601 <div class="loginpress-alert-text">
602 <h3><?php _e( 'Introducing LoginPress Addons!', 'loginpress' ) ?></h3>
603 <p><?php _e( 'Extend LoginPress with these add-ons and supercharge your login pages.', 'loginpress' ) ?></p>
604 </div>
605 </a>
606 <div class="loginpress-alert-button-section">
607 <a href="https://wpbrigade.com/wordpress/plugins/loginpress/addons/?utm_source=loginpress-lite&utm_medium=addons-notice-more&utm_campaign=pro-upgrade" class="loginpress-alert-button" target="_blank"><?php _e( 'Learn More', 'loginpress' ) ?></a>
608 </div>
609 </div>
610 <?php
611 }
612
613 /**
614 * Check and Dismiss addon message.
615 *
616 * @since 1.1.3
617 */
618 private function loginpress_addon_dismissal() {
619
620 if ( ! is_admin() ||
621 ! current_user_can( 'manage_options' ) ||
622 ! isset( $_GET['_wpnonce'] ) ||
623 ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'loginpress-addon-nonce' ) ||
624 ! isset( $_GET['loginpress_addon_dismiss_1'] ) ) :
625
626 return;
627 endif;
628
629 add_site_option( 'loginpress_addon_dismiss_1', 'yes' );
630 }
631
632 /**
633 * Pull the LoginPress page from options.
634 *
635 * @access public
636 * @since 1.1.3
637 * @version 1.1.7
638 */
639 public function get_loginpress_page() {
640
641 $loginpress_setting = get_option( 'loginpress_setting', array() );
642 if ( ! is_array( $loginpress_setting ) && empty( $loginpress_setting ) ) {
643 $loginpress_setting = array();
644 }
645 $page = array_key_exists( 'loginpress_page', $loginpress_setting ) ? get_post( $loginpress_setting['loginpress_page'] ) : false;
646
647 return $page;
648 }
649
650 /**
651 * Add a link to the settings page to the plugins list
652 *
653 * @since 1.0.11
654 */
655 public function loginpress_action_links( $links, $file ) {
656
657 static $this_plugin;
658
659 if ( empty( $this_plugin ) ) {
660
661 $this_plugin = 'loginpress/loginpress.php';
662 }
663
664 if ( $file == $this_plugin ) {
665
666 $settings_link = sprintf( esc_html__( '%1$s Settings %2$s | %3$s Customize %4$s', 'loginpress' ), '<a href="' . admin_url( 'admin.php?page=loginpress-settings' ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=loginpress' ) . '">', '</a>' );
667
668
669 if( 'yes' == get_option( '_loginpress_optin' ) ){
670 $settings_link .= sprintf( esc_html__( ' | %1$s Opt Out %2$s ', 'loginpress'), '<a class="opt-out" href="' . admin_url( 'admin.php?page=loginpress-settings' ) . '">', '</a>' );
671 } else {
672 $settings_link .= sprintf( esc_html__( ' | %1$s Opt In %2$s ', 'loginpress'), '<a href="' . admin_url( 'admin.php?page=loginpress-optin&redirect-page=' .'loginpress-settings' ) . '">', '</a>' );
673 }
674
675 array_unshift( $links, $settings_link );
676
677 if ( ! has_action( 'loginpress_pro_add_template' ) ) :
678 $pro_link = sprintf( esc_html__( '%1$s %3$s Upgrade Pro %4$s %2$s', 'loginpress' ), '<a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=loginpress-lite&utm_medium=plugin-action-link&utm_campaign=pro-upgrade" target="_blank">', '</a>', '<span class="loginpress-dasboard-pro-link">', '</span>' );
679 array_push( $links, $pro_link );
680 endif;
681 }
682
683 return $links;
684 }
685
686 // function get_addon_info_( $api, $action, $args ) {
687
688 // if ( $action == 'plugin_information' && empty( $api ) && ( ! empty( $_GET['lgp'] ) ) ) {
689
690 // $raw_response = wp_remote_post( 'https://wpbrigade.com/loginpress-api/search.php', array(
691 // 'body' => array(
692 // 'slug' => $args->slug
693 // ) )
694 // );
695
696 // if ( is_wp_error( $raw_response ) || $raw_response['response']['code'] != 200 ) {
697 // return false;
698 // }
699
700 // $plugin = unserialize( $raw_response['body'] );
701
702 // $api = new stdClass();
703 // $api->name = $plugin['title'];
704 // $api->version = $plugin['version'];
705 // $api->download_link = $plugin['download_url'];
706 // $api->tested = '10.0';
707
708 // }
709
710 // return $api;
711 // }
712 } // End Of Class.
713 endif;
714
715
716 /**
717 * Returns the main instance of WP to prevent the need to use globals.
718 *
719 * @since 1.0.0
720 * @return LoginPress
721 */
722 function loginPress_loader() {
723 return LoginPress::instance();
724 }
725
726 // Call the function
727 loginPress_loader();
728
729 /**
730 * Create the Object of Custom Login Entites and Settings.
731 *
732 * @since 1.0.0
733 */
734 new LoginPress_Entities();
735 new LoginPress_Settings();
736
737 /**
738 * Create the Object of Remote Notification.
739 *
740 * @since 1.0.9
741 */
742 if (!class_exists('TAV_Remote_Notification_Client')) {
743 require( LOGINPRESS_ROOT_PATH . 'include/class-remote-notification-client.php' );
744 }
745 $notification = new TAV_Remote_Notification_Client( 125, '16765c0902705d62', 'https://wpbrigade.com?post_type=notification' );
746
747 register_activation_hook( __FILE__, array( 'LoginPress', 'plugin_activation' ) );
748 register_uninstall_hook( __FILE__, array( 'LoginPress', 'plugin_uninstallation' ) );
749 ?>
750