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