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

499 lines 15.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://www.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.0.13
7 * Author: WPBrigade
8 * Author URI: http://www.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.0.13';
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_VERSION', $this->version );
69 $this->define( 'LOGINPRESS_FEEDBACK_SERVER', 'https://wpbrigade.com/' );
70 }
71
72 /**
73 * Include required core files used in admin and on the frontend.
74 */
75
76 public function includes() {
77
78 include_once( LOGINPRESS_DIR_PATH . 'custom.php' );
79 include_once( LOGINPRESS_DIR_PATH . 'classes/loginpress-setup.php' );
80 }
81
82 /**
83 * Hook into actions and filters
84 * @since 1.0.0
85 */
86 private function _hooks() {
87
88 add_action( 'admin_menu', array( $this, 'register_options_page' ) );
89 add_action( 'plugins_loaded', array( $this, 'textdomain' ) );
90 add_filter( 'plugin_row_meta', array( $this, '_row_meta'), 10, 2 );
91 add_action( 'admin_enqueue_scripts', array( $this, '_admin_scripts' ) );
92 add_action( 'admin_footer', array( $this, 'add_deactive_modal' ) );
93 add_action( 'admin_init', array( $this, 'loginpress_review_notice' ) );
94 add_action( 'plugin_action_links', array( $this, 'loginpress_action_links' ), 10, 2 );
95 add_action( 'wp_ajax_loginpress_deactivate', array( $this, '_deactivate' ) );
96 }
97
98 /**
99 * Main Instance
100 *
101 * @since 1.0.0
102 * @static
103 * @see loginPress_loader()
104 * @return Main instance
105 */
106 public static function instance() {
107 if ( is_null( self::$_instance ) ) {
108 self::$_instance = new self();
109 }
110 return self::$_instance;
111 }
112
113
114 /**
115 * Load Languages
116 * @since 1.0.0
117 */
118 public function textdomain() {
119
120 $plugin_dir = dirname( plugin_basename( __FILE__ ) ) ;
121 load_plugin_textdomain( 'loginpress', false, $plugin_dir . '/languages/' );
122 }
123
124 /**
125 * Define constant if not already set
126 * @param string $name
127 * @param string|bool $value
128 */
129 private function define( $name, $value ) {
130 if ( ! defined( $name ) ) {
131 define( $name, $value );
132 }
133 }
134
135 /**
136 * Include required ajax files.
137 */
138 public function ajax_includes() {
139 // Ajax functions for admin and the front-end
140 }
141 /**
142 * Init WPBrigade when WordPress Initialises.
143 */
144 public function init() {
145 // Before init action
146 }
147 /**
148 * Add new page in Apperance to customize Login Page
149 */
150 public function register_options_page() {
151
152 add_theme_page( __( 'LoginPress', 'loginpress' ), __( 'LoginPress', 'loginpress' ), 'manage_options', "abw", '__return_null' );
153 }
154
155
156 public function _loginpress_settings() {
157
158 if ( isset( $_GET['get-premium'] ) && 'loginpress' == $_GET['get-premium'] ) {
159 include_once LOGINPRESS_DIR_PATH . '/include/get-premium.php';
160 } else {
161 include_once LOGINPRESS_DIR_PATH . '/include/settings.php';
162 }
163 }
164
165 function _admin_scripts() {
166 wp_enqueue_style( 'loginpress_stlye', plugins_url( 'css/style.css', __FILE__ ), array(), LOGINPRESS_VERSION );
167 wp_enqueue_script( 'loginpress_js', plugins_url( 'js/admin-custom.js', __FILE__ ), array(), LOGINPRESS_VERSION );
168 }
169
170
171 public function _row_meta( $links, $file ) {
172
173 if ( strpos( $file, 'loginpress.php' ) !== false ) {
174
175 // Set link for Reviews.
176 $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>',
177 );
178
179 $links = array_merge( $links, $new_links );
180 }
181
182 return $links;
183 }
184
185 /**
186 * Add deactivate modal layout.
187 */
188 function add_deactive_modal() {
189 global $pagenow;
190
191 if ( 'plugins.php' !== $pagenow ) {
192 return;
193 }
194
195 include LOGINPRESS_DIR_PATH . 'include/deactivate_modal.php';
196 }
197
198 function _deactivate() {
199
200 $email = get_option( 'admin_email' );
201 $_reason = sanitize_text_field( wp_unslash( $_POST['reason'] ) );
202 $reason_detail = sanitize_text_field( wp_unslash( $_POST['reason_detail'] ) );
203 $reason = '';
204
205 if ( $_reason == '1' ) {
206 $reason = 'I only needed the plugin for a short period';
207 } elseif ( $_reason == '2' ) {
208 $reason = 'I found a better plugin';
209 } elseif ( $_reason == '3' ) {
210 $reason = 'The plugin broke my site';
211 } elseif ( $_reason == '4' ) {
212 $reason = 'The plugin suddenly stopped working';
213 } elseif ( $_reason == '5' ) {
214 $reason = 'I no longer need the plugin';
215 } elseif ( $_reason == '6' ) {
216 $reason = 'It\'s a temporary deactivation. I\'m just debugging an issue.';
217 } elseif ( $_reason == '7' ) {
218 $reason = 'Other';
219 }
220 $fields = array(
221 'email' => $email,
222 'website' => get_site_url(),
223 'action' => 'Deactivate',
224 'reason' => $reason,
225 'reason_detail' => $reason_detail,
226 'blog_language' => get_bloginfo( 'language' ),
227 'wordpress_version' => get_bloginfo( 'version' ),
228 'plugin_version' => LOGINPRESS_VERSION,
229 'plugin_name' => 'LoginPress Free',
230 );
231
232 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
233 'method' => 'POST',
234 'timeout' => 5,
235 'httpversion' => '1.0',
236 'blocking' => false,
237 'headers' => array(),
238 'body' => $fields,
239 )
240 );
241
242 // if ( is_wp_error( $response ) ) {
243 // $error_message = $response->get_error_message();
244 // echo "Something went wrong: $error_message";
245 // } else {
246 // echo 'Response:<pre>';
247 // print_r( $response );
248 // echo '</pre>';
249 // }
250 wp_die();
251 }
252
253 static function plugin_activation() {
254
255 $_loginpress_Setting = get_option( 'loginpress_setting' );
256 if ( ! isset( $_loginpress_Setting['tracking_anonymous'] ) || 'off' == $_loginpress_Setting['tracking_anonymous'] ) {
257 return;
258 }
259
260 $email = get_option( 'admin_email' );
261
262 $fields = array(
263 'email' => $email,
264 'website' => get_site_url(),
265 'action' => 'Activate',
266 'reason' => '',
267 'reason_detail' => '',
268 'blog_language' => get_bloginfo( 'language' ),
269 'wordpress_version' => get_bloginfo( 'version' ),
270 'plugin_version' => LOGINPRESS_VERSION,
271 'plugin_name' => 'LoginPress Free',
272 );
273
274 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
275 'method' => 'POST',
276 'timeout' => 5,
277 'httpversion' => '1.0',
278 'blocking' => false,
279 'headers' => array(),
280 'body' => $fields,
281 ) );
282
283 }
284
285 static function plugin_uninstallation() {
286
287 $_loginpress_Setting = get_option( 'loginpress_setting' );
288 if ( ! isset( $_loginpress_Setting['tracking_anonymous'] ) || 'off' == $_loginpress_Setting['tracking_anonymous'] ) {
289 return;
290 }
291
292 $email = get_option( 'admin_email' );
293
294 $fields = array(
295 'email' => $email,
296 'website' => get_site_url(),
297 'action' => 'Uninstall',
298 'reason' => '',
299 'reason_detail' => '',
300 'blog_language' => get_bloginfo( 'language' ),
301 'wordpress_version' => get_bloginfo( 'version' ),
302 'plugin_version' => LOGINPRESS_VERSION,
303 'plugin_name' => 'LoginPress Free',
304 );
305
306 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
307 'method' => 'POST',
308 'timeout' => 5,
309 'httpversion' => '1.0',
310 'blocking' => false,
311 'headers' => array(),
312 'body' => $fields,
313 ) );
314
315 }
316
317 /**
318 * Ask users to review our plugin on wordpress.org
319 *
320 * @since 1.0.11
321 * @return boolean false
322 */
323 public function loginpress_review_notice() {
324
325 $this->loginpress_review_dismissal();
326 $this->loginpress_review_pending();
327
328 $activation_time = get_site_option( 'loginpress_active_time' );
329 $review_dismissal = get_site_option( 'loginpress_review_dismiss' );
330
331 if ( 'yes' == $review_dismissal ) return;
332
333 if ( ! $activation_time ) :
334
335 $activation_time = time();
336 add_site_option( 'loginpress_active_time', $activation_time );
337 endif;
338
339 // 1296000 = 15 Days in seconds.
340 if ( time() - $activation_time > 1296000 ) :
341 add_action( 'admin_notices' , array( $this, 'loginpress_review_notice_message' ) );
342 endif;
343
344 if ( is_multisite() ) {
345 add_action( 'admin_notices' , array( $this, 'loginpress_multisite_admin_message' ) );
346 add_action('network_admin_notices', array( $this, 'loginpress_multisite_admin_message' ) );
347 }
348 }
349
350 /**
351 * Multisite Admin Notice.
352 *
353 * @since 1.0.12
354 */
355 public function loginpress_multisite_admin_message() {
356
357 echo sprintf( __( '%1$s%2$sHi, LoginPress is not compatible with multisite right now. %3$s Checkout this Ticket in WordPress core %4$s %5$s%6$s', 'loginpress' ),
358 '<div class="notice notice-error is-dismissible">', '<p>', '<a href="https://core.trac.wordpress.org/ticket/40069" target="_blank">', '</a>', '</p>', '</div>' );
359 }
360
361 /**
362 * Check and Dismiss review message.
363 *
364 * @since 1.0.11
365 */
366 private function loginpress_review_dismissal() {
367
368 if ( ! is_admin() ||
369 ! current_user_can( 'manage_options' ) ||
370 ! isset( $_GET['_wpnonce'] ) ||
371 ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'loginpress-review-nonce' ) ||
372 ! isset( $_GET['loginpress_review_dismiss'] ) ) :
373
374 return;
375 endif;
376
377 add_site_option( 'loginpress_review_dismiss', 'yes' );
378 }
379
380 /**
381 * Set time to current so review notice will popup after 14 days
382 *
383 * @since 1.0.11
384 */
385 function loginpress_review_pending() {
386
387 if ( ! is_admin() ||
388 ! current_user_can( 'manage_options' ) ||
389 ! isset( $_GET['_wpnonce'] ) ||
390 ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'loginpress-review-nonce' ) ||
391 ! isset( $_GET['loginpress_review_later'] ) ) :
392
393 return;
394 endif;
395
396 // Reset Time to current time.
397 update_site_option( 'loginpress_active_time', time() );
398 }
399
400 /**
401 * Review notice message
402 *
403 * @since 1.0.11
404 */
405 public function loginpress_review_notice_message() {
406
407 $scheme = ( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY ) ) ? '&' : '?';
408 $url = $_SERVER['REQUEST_URI'] . $scheme . 'loginpress_review_dismiss=yes';
409 $dismiss_url = wp_nonce_url( $url, 'loginpress-review-nonce' );
410
411 $_later_link = $_SERVER['REQUEST_URI'] . $scheme . 'loginpress_review_later=yes';
412 $later_url = wp_nonce_url( $_later_link, 'loginpress-review-nonce' );
413
414 ?>
415 <div class="loginpress-review-notice">
416 <div class="loginpress-review-thumbnail">
417 <img src="<?php echo plugins_url( 'img/thumbnail/gray-loginpress.png', __FILE__ ) ?>" alt="">
418 </div>
419 <div class="loginpress-review-text">
420 <h3><?php _e( 'Leave A Review?', 'loginpress' ) ?></h3>
421 <p><?php _e( 'We hope you\'ve enjoyed using LoginPress! Would you consider leaving us a review on WordPress.org?', 'loginpress' ) ?></p>
422 <ul class="loginpress-review-ul">
423 <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>
424 <li><a href="<?php echo $dismiss_url ?>"><span class="dashicons dashicons-smiley"></span><?php _e( 'I\'ve already left a review', 'loginpress' ) ?></a></li>
425 <li><a href="<?php echo $later_url ?>"><span class="dashicons dashicons-calendar-alt"></span><?php _e( 'Maybe Later', 'loginpress' ) ?></a></li>
426 <li><a href="<?php echo $dismiss_url ?>"><span class="dashicons dashicons-dismiss"></span><?php _e( 'Never show again', 'loginpress' ) ?></a></li></ul>
427 </div>
428 </div>
429 <?php
430 }
431
432 /**
433 * Add a link to the settings page to the plugins list
434 *
435 * @since 1.0.11
436 */
437 public function loginpress_action_links( $links, $file ) {
438
439 static $this_plugin;
440
441 if ( empty( $this_plugin ) ) {
442
443 $this_plugin = 'loginpress/loginpress.php';
444 }
445
446 if ( $file == $this_plugin ) {
447
448 $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>' );
449 array_unshift( $links, $settings_link );
450
451 if ( ! has_action( 'loginpress_pro_add_template' ) ) :
452 $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>' );
453 array_push( $links, $pro_link );
454 endif;
455 }
456
457 return $links;
458 }
459
460 } // End Of Class.
461 endif;
462
463 /**
464 * Returns the main instance of WP to prevent the need to use globals.
465 *
466 * @since 1.0.0
467 * @return LoginPress
468 */
469 function loginPress_loader() {
470 return LoginPress::instance();
471 }
472
473 // Call the function
474 loginPress_loader();
475
476 /**
477 * Create the Object of Custom Login Entites and Settings.
478 *
479 * @since 1.0.0
480 */
481 new LoginPress_Entities();
482 new LoginPress_Settings();
483
484 /**
485 * Create the Object of Remote Notification.
486 *
487 * @since 1.0.9
488 */
489 if (!class_exists('TAV_Remote_Notification_Client')) {
490 require( LOGINPRESS_ROOT_PATH . 'include/class-remote-notification-client.php' );
491 }
492 $notification = new TAV_Remote_Notification_Client( 125, '16765c0902705d62', 'http://wpbrigade.com?post_type=notification' );
493
494 register_activation_hook( __FILE__, array( 'LoginPress', 'plugin_activation' ) );
495 register_uninstall_hook( __FILE__, array( 'LoginPress', 'plugin_uninstallation' ) );
496
497
498 ?>
499