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

349 lines 9.7 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 Login Page Customizer in WordPress which allows you to completely change the layout of login, register and forgot password forms.
6 * Version: 1.0.10
7 * Author: WPBrigade
8 * Author URI: http://www.WPBrigade.com/
9 * Requires at least: 4.0
10 * Tested up to: 4.7.3
11 * Text Domain: loginpress
12 * Domain Path: /languages
13 *
14 * @package loginpress
15 * @category Core
16 * @author WPBrigade
17 */
18
19
20 if ( ! class_exists( 'LoginPress' ) ) :
21
22 final class LoginPress {
23
24 /**
25 * @var string
26 */
27 public $version = '1.0.10';
28
29 /**
30 * @var The single instance of the class
31 * @since 1.0.0
32 */
33 protected static $_instance = null;
34
35 /**
36 * @var WP_Session session
37 */
38 public $session = null;
39
40 /**
41 * @var WP_Query $query
42 */
43 public $query = null;
44
45 /**s
46 * @var WP_Countries $countries
47 */
48 public $countries = null;
49
50 /* * * * * * * * * *
51 * Class constructor
52 * * * * * * * * * */
53 public function __construct() {
54
55 $this->define_constants();
56 $this->includes();
57 $this->_hooks();
58
59 }
60
61 /**
62 * Define LoginPress Constants
63 */
64 private function define_constants() {
65
66 $this->define( 'LOGINPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
67 $this->define( 'LOGINPRESS_DIR_PATH', plugin_dir_path( __FILE__ ) );
68 $this->define( 'LOGINPRESS_DIR_URL', plugin_dir_url( __FILE__ ) );
69 $this->define( 'LOGINPRESS_ROOT_PATH', dirname( __FILE__ ) . '/' );
70 $this->define( 'LOGINPRESS_VERSION', $this->version );
71 $this->define( 'LOGINPRESS_FEEDBACK_SERVER', 'https://wpbrigade.com/' );
72 }
73
74 /**
75 * Include required core files used in admin and on the frontend.
76 */
77
78 public function includes() {
79
80 include_once( LOGINPRESS_DIR_PATH . 'custom.php' );
81 include_once( LOGINPRESS_DIR_PATH . 'classes/loginpress-setup.php' );
82 }
83
84 /**
85 * Hook into actions and filters
86 * @since 1.0.0
87 */
88 private function _hooks() {
89
90 add_action( 'admin_menu', array( $this, 'register_options_page' ) );
91 add_action( 'plugins_loaded', array( $this, 'textdomain' ) );
92 add_filter( 'plugin_row_meta', array( $this, '_row_meta'), 10, 2 );
93 add_action( 'admin_enqueue_scripts', array( $this, '_admin_scripts' ) );
94 add_action( 'admin_footer', array( $this, 'add_deactive_modal' ) );
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 add_menu_page( __( 'LoginPress', 'loginpress' ), __( 'LoginPress', 'loginpress' ), 'manage_options', "loginpress", '__return_null', '', 50 );
155
156 add_submenu_page( 'loginpress', __( 'Customizer', 'loginpress' ), __( 'Customizer', 'loginpress' ), 'manage_options', "loginpress", '__return_null' );
157 }
158
159
160 public function _loginpress_settings() {
161
162 if ( isset( $_GET['get-premium'] ) && 'loginpress' == $_GET['get-premium'] ) {
163 include_once LOGINPRESS_DIR_PATH . '/include/get-premium.php';
164 } else {
165 include_once LOGINPRESS_DIR_PATH . '/include/settings.php';
166 }
167 }
168
169 function _admin_scripts() {
170 wp_enqueue_style( 'loginpress_stlye', plugins_url( 'css/style.css', __FILE__ ), array(), time() );
171 wp_enqueue_script( 'loginpress_js', plugins_url( 'js/admin-custom.js', __FILE__ ), array(), time() );
172 }
173
174
175 public function _row_meta( $links, $file ) {
176
177 if ( strpos( $file, 'loginpress.php' ) !== false ) {
178
179 // Set link for Reviews.
180 $new_links = array('<a href="https://wordpress.org/support/view/plugin-reviews/loginpress" target="_blank"><span class="dashicons dashicons-thumbs-up"></span> ' . __( 'Vote!', 'loginpress' ) . '</a>',
181 );
182
183 $links = array_merge( $links, $new_links );
184 }
185
186 return $links;
187 }
188
189 /**
190 * Add deactivate modal layout.
191 */
192 function add_deactive_modal() {
193 global $pagenow;
194
195 if ( 'plugins.php' !== $pagenow ) {
196 return;
197 }
198 include LOGINPRESS_DIR_PATH . 'include/deactivate_modal.php';
199 }
200
201 function _deactivate() {
202
203 $email = get_option( 'admin_email' );
204 $_reason = sanitize_text_field( wp_unslash( $_POST['reason'] ) );
205 $reason_detail = sanitize_text_field( wp_unslash( $_POST['reason_detail'] ) );
206 $reason = '';
207
208 if ( $_reason == '1' ) {
209 $reason = 'I only needed the plugin for a short period';
210 } elseif ( $_reason == '2' ) {
211 $reason = 'I found a better plugin';
212 } elseif ( $_reason == '3' ) {
213 $reason = 'The plugin broke my site';
214 } elseif ( $_reason == '4' ) {
215 $reason = 'The plugin suddenly stopped working';
216 } elseif ( $_reason == '5' ) {
217 $reason = 'I no longer need the plugin';
218 } elseif ( $_reason == '6' ) {
219 $reason = 'It\'s a temporary deactivation. I\'m just debugging an issue.';
220 } elseif ( $_reason == '7' ) {
221 $reason = 'Other';
222 }
223 $fields = array(
224 'email' => $email,
225 'website' => get_site_url(),
226 'action' => 'Deactivate',
227 'reason' => $reason,
228 'reason_detail' => $reason_detail,
229 'blog_language' => get_bloginfo( 'language' ),
230 'wordpress_version' => get_bloginfo( 'version' ),
231 'plugin_version' => LOGINPRESS_VERSION,
232 'plugin_name' => 'LoginPress Free',
233 );
234
235 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
236 'method' => 'POST',
237 'timeout' => 5,
238 'httpversion' => '1.0',
239 'blocking' => false,
240 'headers' => array(),
241 'body' => $fields,
242 )
243 );
244
245 // if ( is_wp_error( $response ) ) {
246 // $error_message = $response->get_error_message();
247 // echo "Something went wrong: $error_message";
248 // } else {
249 // echo 'Response:<pre>';
250 // print_r( $response );
251 // echo '</pre>';
252 // }
253 wp_die();
254 }
255
256 static function plugin_activation() {
257
258 $email = get_option( 'admin_email' );
259
260 $fields = array(
261 'email' => $email,
262 'website' => get_site_url(),
263 'action' => 'Activate',
264 'reason' => '',
265 'reason_detail' => '',
266 'blog_language' => get_bloginfo( 'language' ),
267 'wordpress_version' => get_bloginfo( 'version' ),
268 'plugin_version' => LOGINPRESS_VERSION,
269 'plugin_name' => 'LoginPress Free',
270 );
271
272 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
273 'method' => 'POST',
274 'timeout' => 5,
275 'httpversion' => '1.0',
276 'blocking' => false,
277 'headers' => array(),
278 'body' => $fields,
279 ) );
280
281 }
282
283 static function plugin_uninstallation() {
284
285 $email = get_option( 'admin_email' );
286
287 $fields = array(
288 'email' => $email,
289 'website' => get_site_url(),
290 'action' => 'Uninstall',
291 'reason' => '',
292 'reason_detail' => '',
293 'blog_language' => get_bloginfo( 'language' ),
294 'wordpress_version' => get_bloginfo( 'version' ),
295 'plugin_version' => LOGINPRESS_VERSION,
296 'plugin_name' => 'LoginPress Free',
297 );
298
299 $response = wp_remote_post( LOGINPRESS_FEEDBACK_SERVER, array(
300 'method' => 'POST',
301 'timeout' => 5,
302 'httpversion' => '1.0',
303 'blocking' => false,
304 'headers' => array(),
305 'body' => $fields,
306 ) );
307
308 }
309
310 } // End Of Class.
311 endif;
312
313 /**
314 * Returns the main instance of WP to prevent the need to use globals.
315 *
316 * @since 1.0.0
317 * @return LoginPress
318 */
319 function loginPress_loader() {
320 return LoginPress::instance();
321 }
322
323 // Call the function
324 loginPress_loader();
325
326 /**
327 * Create the Object of Custom Login Entites and Settings.
328 *
329 * @since 1.0.0
330 */
331 new LoginPress_Entities();
332 new LoginPress_Settings();
333
334 /**
335 * Create the Object of Remote Notification.
336 *
337 * @since 1.0.9
338 */
339 if (!class_exists('TAV_Remote_Notification_Client')) {
340 require( LOGINPRESS_ROOT_PATH . 'include/class-remote-notification-client.php' );
341 }
342 $notification = new TAV_Remote_Notification_Client( 125, '16765c0902705d62', 'http://wpbrigade.com?post_type=notification' );
343
344 register_activation_hook( __FILE__, array( 'LoginPress', 'plugin_activation' ) );
345 register_uninstall_hook( __FILE__, array( 'LoginPress', 'plugin_uninstallation' ) );
346
347
348 ?>
349