| 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.2 |
| 7 |
* Author: WPBrigade |
| 8 |
* Author URI: http://www.WPBrigade.com/ |
| 9 |
* Requires at least: 4.0 |
| 10 |
* Tested up to: 4.7.0 |
| 11 |
* Text Domain: loginpress |
| 12 |
* Domain Path: /languages |
| 13 |
* |
| 14 |
* @package loginpress |
| 15 |
* @category Core |
| 16 |
* @author WPBrigade |
| 17 |
*/ |
| 18 |
if ( ! class_exists( 'LoginPress' ) ) : |
| 19 |
|
| 20 |
final class LoginPress { |
| 21 |
|
| 22 |
/** |
| 23 |
* @var string |
| 24 |
*/ |
| 25 |
public $version = '1.0.2'; |
| 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 |
* Define LoginPress Constants |
| 60 |
*/ |
| 61 |
private function define_constants() { |
| 62 |
|
| 63 |
$this->define( 'LOGINPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 64 |
$this->define( 'LOGINPRESS_VERSION', $this->version ); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Include required core files used in admin and on the frontend. |
| 69 |
*/ |
| 70 |
public function includes() { |
| 71 |
include_once( 'custom.php' ); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Hook into actions and filters |
| 76 |
* @since 1.0.0 |
| 77 |
*/ |
| 78 |
private function _hooks() { |
| 79 |
|
| 80 |
add_action( 'admin_menu', array( $this, 'register_options_page' ) ); |
| 81 |
add_action( 'plugins_loaded', array( $this, 'textdomain' ) ); |
| 82 |
add_filter( 'plugin_row_meta', array( $this, '_row_meta'), 10, 2 ); |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Main Instance |
| 87 |
* |
| 88 |
* @since 1.0.0 |
| 89 |
* @static |
| 90 |
* @see loginPress_loader() |
| 91 |
* @return Main instance |
| 92 |
*/ |
| 93 |
public static function instance() { |
| 94 |
if ( is_null( self::$_instance ) ) { |
| 95 |
self::$_instance = new self(); |
| 96 |
} |
| 97 |
return self::$_instance; |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
/** |
| 102 |
* Load Languages |
| 103 |
* @since 1.0.0 |
| 104 |
*/ |
| 105 |
public function textdomain() { |
| 106 |
|
| 107 |
$plugin_dir = dirname( plugin_basename( __FILE__ ) ) ; |
| 108 |
load_plugin_textdomain( 'loginpress', false, $plugin_dir . '/languages/'); |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 112 |
* Define constant if not already set |
| 113 |
* @param string $name |
| 114 |
* @param string|bool $value |
| 115 |
*/ |
| 116 |
private function define( $name, $value ) { |
| 117 |
if ( ! defined( $name ) ) { |
| 118 |
define( $name, $value ); |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
/** |
| 123 |
* Include required ajax files. |
| 124 |
*/ |
| 125 |
public function ajax_includes() { |
| 126 |
// Ajax functions for admin and the front-end |
| 127 |
} |
| 128 |
/** |
| 129 |
* Init WPBrigade when WordPress Initialises. |
| 130 |
*/ |
| 131 |
public function init() { |
| 132 |
// Before init action |
| 133 |
} |
| 134 |
/** |
| 135 |
* Add new page in Apperance to customize Login Page |
| 136 |
*/ |
| 137 |
public function register_options_page() { |
| 138 |
add_theme_page( __( 'LoginPress', 'loginpress' ), |
| 139 |
__( 'LoginPress', 'loginpress' ), |
| 140 |
'manage_options', |
| 141 |
"abw", |
| 142 |
array( $this , '__return_null' ) ); |
| 143 |
} |
| 144 |
public function _row_meta( $links, $file ) { |
| 145 |
|
| 146 |
if ( strpos( $file, 'loginpress.php' ) !== false ) { |
| 147 |
|
| 148 |
// Set link for Reviews. |
| 149 |
$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>', |
| 150 |
); |
| 151 |
|
| 152 |
$links = array_merge( $links, $new_links ); |
| 153 |
} |
| 154 |
|
| 155 |
return $links; |
| 156 |
} |
| 157 |
} |
| 158 |
endif; |
| 159 |
|
| 160 |
/** |
| 161 |
* Returns the main instance of WP to prevent the need to use globals. |
| 162 |
* |
| 163 |
* @since 1.0.0 |
| 164 |
* @return LoginPress |
| 165 |
*/ |
| 166 |
function loginPress_loader() { |
| 167 |
return LoginPress::instance(); |
| 168 |
} |
| 169 |
|
| 170 |
// Call the function |
| 171 |
loginPress_loader(); |
| 172 |
|
| 173 |
/** |
| 174 |
* Create the Object of Custom Login Entites. |
| 175 |
* |
| 176 |
* @since 1.0.0 |
| 177 |
*/ |
| 178 |
new LoginPress_Entities(); |
| 179 |
?> |
| 180 |
|