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

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