Version Description
- 2017-02-01 =
- Enhancement: Reset settings option added
- Enhancement: Login Page themes launch
- Enhancement: Added Premium version
Download this release
Release Info
Developer | hiddenpearls |
Plugin | Custom Login Page Customizer | LoginPress |
Version | 1.0.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.7 to 1.0.8
- classes/control-presets.php +48 -29
- classes/loginpress-settings-api.php +621 -0
- classes/loginpress-setup.php +129 -0
- css/style-login.php +51 -8
- css/style-presets.php +3 -6
- css/style.css +119 -0
- css/themes/default-2.php +0 -142
- custom.php +160 -67
- img/dummy.jpg +0 -0
- img/key_icon.svg +22 -0
- img/thumbnail/custom-design.png +0 -0
- img/thumbnail/default-10.png +0 -0
- img/thumbnail/default-11.png +0 -0
- img/thumbnail/default-12.png +0 -0
- img/thumbnail/default-13.png +0 -0
- img/thumbnail/default-14.png +0 -0
- img/thumbnail/default-15.png +0 -0
- img/thumbnail/default-16.png +0 -0
- img/thumbnail/default-17.png +0 -0
- img/thumbnail/default-5.png +0 -0
- img/thumbnail/default-6.png +0 -0
- img/thumbnail/default-7.png +0 -0
- img/thumbnail/default-8.png +0 -0
- img/thumbnail/default-9.png +0 -0
- img/user_icon.svg +13 -0
- include/class-remote-notification-client.php +856 -0
- include/get-premium.php +1 -0
- include/settings.php +41 -0
- js/admin-custom.js +17 -0
- js/customize-controls.js +249 -39
- loginpress.php +38 -19
- readme.txt +14 -9
classes/control-presets.php
CHANGED
@@ -50,7 +50,7 @@ class LoginPress_Presets extends WP_Customize_Control {
|
|
50 |
<?php endif; ?>
|
51 |
</span>
|
52 |
|
53 |
-
<?php $multi_values = !is_array( $this->value() ) ? explode( ',', $this->value() ) : $this->value(); ?>
|
54 |
|
55 |
|
56 |
<div id="input_<?php echo $this->id; ?>" class="image">
|
@@ -58,24 +58,34 @@ class LoginPress_Presets extends WP_Customize_Control {
|
|
58 |
<?php foreach ( $this->choices as $val ) : ?>
|
59 |
|
60 |
<?php $_disbaled = isset( $val['pro'] ) ? 'disabled' : ''; ?>
|
|
|
|
|
61 |
<div class="loginpress_thumbnail">
|
62 |
-
<input <?php echo $
|
63 |
<label for="<?php echo $this->id . $val['id']; ?>">
|
64 |
<div class="loginpress_thumbnail_img">
|
65 |
<img src="<?php echo $val['thumbnail']; ?>" alt="<?php echo esc_attr( $val['id'] ); ?>" title="<?php echo esc_attr( $val['id'] ); ?>">
|
66 |
</div> <!-- .img -->
|
67 |
<h3><?php echo $val['name'] ?></h3>
|
68 |
</label>
|
69 |
-
|
70 |
-
<
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
<!-- </input> -->
|
73 |
</div> <!-- .loginpress_thumbnail -->
|
74 |
|
75 |
<?php endforeach; ?>
|
76 |
</div>
|
77 |
|
78 |
-
<input name='presets_hidden' type="hidden" <?php $this->link(); ?> value="<?php echo
|
79 |
<?php }
|
80 |
|
81 |
|
@@ -142,6 +152,11 @@ function loginpress_presets_control_css() {
|
|
142 |
width: calc(50% - 10px);
|
143 |
margin-bottom: 10px;
|
144 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
#customize-control-customize_presets_settings .loginpress_thumbnail:nth-child(odd){
|
147 |
float: left;
|
@@ -238,38 +253,42 @@ function loginpress_presets_control_css() {
|
|
238 |
opacity: 1;
|
239 |
}
|
240 |
.no-available{
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
263 |
}
|
264 |
#customize-control-customize_presets_settings .loginpress_thumbnail:hover input[type="radio"]:disabled ~ .no-available{
|
265 |
opacity: 1;
|
266 |
visibility: visible;
|
267 |
-
color: #
|
268 |
-webkit-transform: scale(1);
|
269 |
-moz-transform: scale(1);
|
270 |
-ms-transform: scale(1);
|
271 |
transform: scale(1);
|
272 |
}
|
|
|
|
|
|
|
273 |
|
274 |
@-webkit-keyframes checkmark {
|
275 |
0% {
|
50 |
<?php endif; ?>
|
51 |
</span>
|
52 |
|
53 |
+
<?php // $multi_values = !is_array( $this->value() ) ? explode( ',', $this->value() ) : $this->value(); ?>
|
54 |
|
55 |
|
56 |
<div id="input_<?php echo $this->id; ?>" class="image">
|
58 |
<?php foreach ( $this->choices as $val ) : ?>
|
59 |
|
60 |
<?php $_disbaled = isset( $val['pro'] ) ? 'disabled' : ''; ?>
|
61 |
+
<?php $_disbaled_link = isset( $val['link'] ) ? 'disabled' : ''; ?>
|
62 |
+
<?php $disable_for_pro = $_disbaled == 'disabled' ? $_disbaled : $_disbaled_link; ?>
|
63 |
<div class="loginpress_thumbnail">
|
64 |
+
<input <?php echo $disable_for_pro; ?> class="image-select" type="radio" value="<?php echo esc_attr( $val['id'] ); ?>" id="<?php echo $this->id . $val['id']; ?>" name="<?php echo esc_attr( $name ); ?>" <?php checked( $this->value(), $val['id'] ); ?> />
|
65 |
<label for="<?php echo $this->id . $val['id']; ?>">
|
66 |
<div class="loginpress_thumbnail_img">
|
67 |
<img src="<?php echo $val['thumbnail']; ?>" alt="<?php echo esc_attr( $val['id'] ); ?>" title="<?php echo esc_attr( $val['id'] ); ?>">
|
68 |
</div> <!-- .img -->
|
69 |
<h3><?php echo $val['name'] ?></h3>
|
70 |
</label>
|
71 |
+
<?php if ( isset( $val['pro'] ) ) : ?>
|
72 |
+
<a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=lite-version&utm_medium=themes&utm_campaign=pro-upgrade" target="_blank" class="no-available">
|
73 |
+
<span>Unlock Premium Feature</span>
|
74 |
+
</a>
|
75 |
+
<?php elseif ( isset( $val['link'] ) ) : ?>
|
76 |
+
<a href="mailto:support@wpbrigade.com?subject=I want Custom Design for my login page." class="no-available">
|
77 |
+
<span>Contact us for Custom Design</span>
|
78 |
+
</a>
|
79 |
+
<?php endif; ?>
|
80 |
+
|
81 |
+
|
82 |
<!-- </input> -->
|
83 |
</div> <!-- .loginpress_thumbnail -->
|
84 |
|
85 |
<?php endforeach; ?>
|
86 |
</div>
|
87 |
|
88 |
+
<input name='presets_hidden' type="hidden" <?php $this->link(); ?> value="<?php echo $this->value(); ?>" />
|
89 |
<?php }
|
90 |
|
91 |
|
152 |
width: calc(50% - 10px);
|
153 |
margin-bottom: 10px;
|
154 |
position: relative;
|
155 |
+
border: 5px solid transparent;
|
156 |
+
-webkit-transition:all 0.2s ease-in-out;
|
157 |
+
-moz-transition:all 0.2s ease-in-out;
|
158 |
+
-ms-transition:all 0.2s ease-in-out;
|
159 |
+
transition:all 0.2s ease-in-out;
|
160 |
}
|
161 |
#customize-control-customize_presets_settings .loginpress_thumbnail:nth-child(odd){
|
162 |
float: left;
|
253 |
opacity: 1;
|
254 |
}
|
255 |
.no-available{
|
256 |
+
top: 0;
|
257 |
+
left: 0;
|
258 |
+
background: rgba(204, 204, 204, 0.8);
|
259 |
+
content: '';
|
260 |
+
position: absolute;
|
261 |
+
bottom: 0;
|
262 |
+
right: 0;
|
263 |
+
z-index: 100;
|
264 |
+
padding: 20px;
|
265 |
+
text-align: center;
|
266 |
+
font-weight: bold;
|
267 |
+
color: #000;
|
268 |
+
-webkit-transition: all 0.2s ease-in-out;
|
269 |
+
-moz-transition: all 0.2s ease-in-out;
|
270 |
+
-ms-transition: all 0.2s ease-in-out;
|
271 |
+
transition: all 0.2s ease-in-out;
|
272 |
+
opacity: 0;
|
273 |
+
visibility: hidden;
|
274 |
+
-webkit-transform: scale(.5);
|
275 |
+
-moz-transform: scale(.5);
|
276 |
+
-ms-transform: scale(.5);
|
277 |
+
transform: scale(.5);
|
278 |
+
text-decoration: none !important;
|
279 |
}
|
280 |
#customize-control-customize_presets_settings .loginpress_thumbnail:hover input[type="radio"]:disabled ~ .no-available{
|
281 |
opacity: 1;
|
282 |
visibility: visible;
|
283 |
+
color: #000;
|
284 |
-webkit-transform: scale(1);
|
285 |
-moz-transform: scale(1);
|
286 |
-ms-transform: scale(1);
|
287 |
transform: scale(1);
|
288 |
}
|
289 |
+
#customize-control-customize_presets_settings .loginpress_thumbnail:hover{
|
290 |
+
border-color: #ccc;
|
291 |
+
}
|
292 |
|
293 |
@-webkit-keyframes checkmark {
|
294 |
0% {
|
classes/loginpress-settings-api.php
ADDED
@@ -0,0 +1,621 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
if ( !class_exists( 'LoginPress_Settings_API' ) ):
|
7 |
+
class LoginPress_Settings_API {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* settings sections array
|
11 |
+
*
|
12 |
+
* @var array
|
13 |
+
*/
|
14 |
+
protected $settings_sections = array();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Settings fields array
|
18 |
+
*
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
protected $settings_fields = array();
|
22 |
+
|
23 |
+
public function __construct() {
|
24 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Enqueue scripts and styles
|
29 |
+
*/
|
30 |
+
function admin_enqueue_scripts() {
|
31 |
+
wp_enqueue_style( 'wp-color-picker' );
|
32 |
+
|
33 |
+
wp_enqueue_media();
|
34 |
+
wp_enqueue_script( 'wp-color-picker' );
|
35 |
+
wp_enqueue_script( 'jquery' );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Set settings sections
|
40 |
+
*
|
41 |
+
* @param array $sections setting sections array
|
42 |
+
*/
|
43 |
+
function set_sections( $sections ) {
|
44 |
+
$this->settings_sections = $sections;
|
45 |
+
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Add a single section
|
51 |
+
*
|
52 |
+
* @param array $section
|
53 |
+
*/
|
54 |
+
function add_section( $section ) {
|
55 |
+
$this->settings_sections[] = $section;
|
56 |
+
|
57 |
+
return $this;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Set settings fields
|
62 |
+
*
|
63 |
+
* @param array $fields settings fields array
|
64 |
+
*/
|
65 |
+
function set_fields( $fields ) {
|
66 |
+
$this->settings_fields = $fields;
|
67 |
+
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
|
71 |
+
function add_field( $section, $field ) {
|
72 |
+
$defaults = array(
|
73 |
+
'name' => '',
|
74 |
+
'label' => '',
|
75 |
+
'desc' => '',
|
76 |
+
'type' => 'text'
|
77 |
+
);
|
78 |
+
|
79 |
+
$arg = wp_parse_args( $field, $defaults );
|
80 |
+
$this->settings_fields[$section][] = $arg;
|
81 |
+
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Initialize and registers the settings sections and fileds to WordPress
|
87 |
+
*
|
88 |
+
* Usually this should be called at `admin_init` hook.
|
89 |
+
*
|
90 |
+
* This function gets the initiated settings sections and fields. Then
|
91 |
+
* registers them to WordPress and ready for use.
|
92 |
+
*/
|
93 |
+
function admin_init() {
|
94 |
+
//register settings sections
|
95 |
+
foreach ( $this->settings_sections as $section ) {
|
96 |
+
if ( false == get_option( $section['id'] ) ) {
|
97 |
+
add_option( $section['id'] );
|
98 |
+
}
|
99 |
+
|
100 |
+
if ( isset($section['desc']) && !empty($section['desc']) ) {
|
101 |
+
$section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
|
102 |
+
$callback = create_function('', 'echo "' . str_replace( '"', '\"', $section['desc'] ) . '";');
|
103 |
+
} else if ( isset( $section['callback'] ) ) {
|
104 |
+
$callback = $section['callback'];
|
105 |
+
} else {
|
106 |
+
$callback = null;
|
107 |
+
}
|
108 |
+
|
109 |
+
add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
|
110 |
+
}
|
111 |
+
|
112 |
+
//register settings fields
|
113 |
+
foreach ( $this->settings_fields as $section => $field ) {
|
114 |
+
foreach ( $field as $option ) {
|
115 |
+
|
116 |
+
$name = $option['name'];
|
117 |
+
$type = isset( $option['type'] ) ? $option['type'] : 'text';
|
118 |
+
$label = isset( $option['label'] ) ? $option['label'] : '';
|
119 |
+
$callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
|
120 |
+
|
121 |
+
$args = array(
|
122 |
+
'id' => $name,
|
123 |
+
'class' => isset( $option['class'] ) ? $option['class'] : $name,
|
124 |
+
'label_for' => "{$section}[{$name}]",
|
125 |
+
'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
|
126 |
+
'name' => $label,
|
127 |
+
'section' => $section,
|
128 |
+
'size' => isset( $option['size'] ) ? $option['size'] : null,
|
129 |
+
'options' => isset( $option['options'] ) ? $option['options'] : '',
|
130 |
+
'std' => isset( $option['default'] ) ? $option['default'] : '',
|
131 |
+
'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
|
132 |
+
'type' => $type,
|
133 |
+
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
|
134 |
+
'min' => isset( $option['min'] ) ? $option['min'] : '',
|
135 |
+
'max' => isset( $option['max'] ) ? $option['max'] : '',
|
136 |
+
'step' => isset( $option['step'] ) ? $option['step'] : '',
|
137 |
+
);
|
138 |
+
|
139 |
+
add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
// creates our settings in the options table
|
144 |
+
foreach ( $this->settings_sections as $section ) {
|
145 |
+
register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get field description for display
|
151 |
+
*
|
152 |
+
* @param array $args settings field args
|
153 |
+
*/
|
154 |
+
public function get_field_description( $args ) {
|
155 |
+
if ( ! empty( $args['desc'] ) ) {
|
156 |
+
$desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
|
157 |
+
} else {
|
158 |
+
$desc = '';
|
159 |
+
}
|
160 |
+
|
161 |
+
return $desc;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Displays a text field for a settings field
|
166 |
+
*
|
167 |
+
* @param array $args settings field args
|
168 |
+
*/
|
169 |
+
function callback_text( $args ) {
|
170 |
+
|
171 |
+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
172 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
173 |
+
$type = isset( $args['type'] ) ? $args['type'] : 'text';
|
174 |
+
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
|
175 |
+
|
176 |
+
$html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
|
177 |
+
$html .= $this->get_field_description( $args );
|
178 |
+
|
179 |
+
echo $html;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Displays a url field for a settings field
|
184 |
+
*
|
185 |
+
* @param array $args settings field args
|
186 |
+
*/
|
187 |
+
function callback_url( $args ) {
|
188 |
+
$this->callback_text( $args );
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Displays a number field for a settings field
|
193 |
+
*
|
194 |
+
* @param array $args settings field args
|
195 |
+
*/
|
196 |
+
function callback_number( $args ) {
|
197 |
+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
198 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
199 |
+
$type = isset( $args['type'] ) ? $args['type'] : 'number';
|
200 |
+
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
|
201 |
+
$min = empty( $args['min'] ) ? '' : ' min="' . $args['min'] . '"';
|
202 |
+
$max = empty( $args['max'] ) ? '' : ' max="' . $args['max'] . '"';
|
203 |
+
$step = empty( $args['max'] ) ? '' : ' step="' . $args['step'] . '"';
|
204 |
+
|
205 |
+
$html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
|
206 |
+
$html .= $this->get_field_description( $args );
|
207 |
+
|
208 |
+
echo $html;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Displays a checkbox for a settings field
|
213 |
+
*
|
214 |
+
* @param array $args settings field args
|
215 |
+
*/
|
216 |
+
function callback_checkbox( $args ) {
|
217 |
+
|
218 |
+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
219 |
+
|
220 |
+
$html = '<fieldset>';
|
221 |
+
$html .= sprintf( '<label for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] );
|
222 |
+
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
|
223 |
+
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
|
224 |
+
$html .= sprintf( '%1$s</label>', $args['desc'] );
|
225 |
+
$html .= '</fieldset>';
|
226 |
+
|
227 |
+
echo $html;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Displays a multicheckbox a settings field
|
232 |
+
*
|
233 |
+
* @param array $args settings field args
|
234 |
+
*/
|
235 |
+
function callback_multicheck( $args ) {
|
236 |
+
|
237 |
+
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
|
238 |
+
$html = '<fieldset>';
|
239 |
+
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
|
240 |
+
foreach ( $args['options'] as $key => $label ) {
|
241 |
+
$checked = isset( $value[$key] ) ? $value[$key] : '0';
|
242 |
+
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
|
243 |
+
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
|
244 |
+
$html .= sprintf( '%1$s</label><br>', $label );
|
245 |
+
}
|
246 |
+
|
247 |
+
$html .= $this->get_field_description( $args );
|
248 |
+
$html .= '</fieldset>';
|
249 |
+
|
250 |
+
echo $html;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Displays a multicheckbox a settings field
|
255 |
+
*
|
256 |
+
* @param array $args settings field args
|
257 |
+
*/
|
258 |
+
function callback_radio( $args ) {
|
259 |
+
|
260 |
+
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
|
261 |
+
$html = '<fieldset>';
|
262 |
+
|
263 |
+
foreach ( $args['options'] as $key => $label ) {
|
264 |
+
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
|
265 |
+
$html .= sprintf( '<input type="radio" class="radio" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
|
266 |
+
$html .= sprintf( '%1$s</label><br>', $label );
|
267 |
+
}
|
268 |
+
|
269 |
+
$html .= $this->get_field_description( $args );
|
270 |
+
$html .= '</fieldset>';
|
271 |
+
|
272 |
+
echo $html;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Displays a selectbox for a settings field
|
277 |
+
*
|
278 |
+
* @param array $args settings field args
|
279 |
+
*/
|
280 |
+
function callback_select( $args ) {
|
281 |
+
|
282 |
+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
283 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
284 |
+
$html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
|
285 |
+
|
286 |
+
foreach ( $args['options'] as $key => $label ) {
|
287 |
+
$html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
|
288 |
+
}
|
289 |
+
|
290 |
+
$html .= sprintf( '</select>' );
|
291 |
+
$html .= $this->get_field_description( $args );
|
292 |
+
|
293 |
+
echo $html;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Displays a textarea for a settings field
|
298 |
+
*
|
299 |
+
* @param array $args settings field args
|
300 |
+
*/
|
301 |
+
function callback_textarea( $args ) {
|
302 |
+
|
303 |
+
$value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
304 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
305 |
+
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"';
|
306 |
+
|
307 |
+
$html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
|
308 |
+
$html .= $this->get_field_description( $args );
|
309 |
+
|
310 |
+
echo $html;
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Displays a textarea for a settings field
|
315 |
+
*
|
316 |
+
* @param array $args settings field args
|
317 |
+
* @return string
|
318 |
+
*/
|
319 |
+
function callback_html( $args ) {
|
320 |
+
echo $this->get_field_description( $args );
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Displays a rich text textarea for a settings field
|
325 |
+
*
|
326 |
+
* @param array $args settings field args
|
327 |
+
*/
|
328 |
+
function callback_wysiwyg( $args ) {
|
329 |
+
|
330 |
+
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
|
331 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px';
|
332 |
+
|
333 |
+
echo '<div style="max-width: ' . $size . ';">';
|
334 |
+
|
335 |
+
$editor_settings = array(
|
336 |
+
'teeny' => true,
|
337 |
+
'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
|
338 |
+
'textarea_rows' => 10
|
339 |
+
);
|
340 |
+
|
341 |
+
if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
|
342 |
+
$editor_settings = array_merge( $editor_settings, $args['options'] );
|
343 |
+
}
|
344 |
+
|
345 |
+
wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
|
346 |
+
|
347 |
+
echo '</div>';
|
348 |
+
|
349 |
+
echo $this->get_field_description( $args );
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Displays a file upload field for a settings field
|
354 |
+
*
|
355 |
+
* @param array $args settings field args
|
356 |
+
*/
|
357 |
+
function callback_file( $args ) {
|
358 |
+
|
359 |
+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
360 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
361 |
+
$id = $args['section'] . '[' . $args['id'] . ']';
|
362 |
+
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
|
363 |
+
|
364 |
+
$html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
|
365 |
+
$html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
|
366 |
+
$html .= $this->get_field_description( $args );
|
367 |
+
|
368 |
+
echo $html;
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Displays a password field for a settings field
|
373 |
+
*
|
374 |
+
* @param array $args settings field args
|
375 |
+
*/
|
376 |
+
function callback_password( $args ) {
|
377 |
+
|
378 |
+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
379 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
380 |
+
|
381 |
+
$html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
|
382 |
+
$html .= $this->get_field_description( $args );
|
383 |
+
|
384 |
+
echo $html;
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Displays a color picker field for a settings field
|
389 |
+
*
|
390 |
+
* @param array $args settings field args
|
391 |
+
*/
|
392 |
+
function callback_color( $args ) {
|
393 |
+
|
394 |
+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
395 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
396 |
+
|
397 |
+
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
|
398 |
+
$html .= $this->get_field_description( $args );
|
399 |
+
|
400 |
+
echo $html;
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Sanitize callback for Settings API
|
405 |
+
*
|
406 |
+
* @return mixed
|
407 |
+
*/
|
408 |
+
function sanitize_options( $options ) {
|
409 |
+
|
410 |
+
if ( !$options ) {
|
411 |
+
return $options;
|
412 |
+
}
|
413 |
+
|
414 |
+
foreach( $options as $option_slug => $option_value ) {
|
415 |
+
$sanitize_callback = $this->get_sanitize_callback( $option_slug );
|
416 |
+
|
417 |
+
// If callback is set, call it
|
418 |
+
if ( $sanitize_callback ) {
|
419 |
+
$options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value );
|
420 |
+
continue;
|
421 |
+
}
|
422 |
+
}
|
423 |
+
|
424 |
+
return $options;
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Get sanitization callback for given option slug
|
429 |
+
*
|
430 |
+
* @param string $slug option slug
|
431 |
+
*
|
432 |
+
* @return mixed string or bool false
|
433 |
+
*/
|
434 |
+
function get_sanitize_callback( $slug = '' ) {
|
435 |
+
if ( empty( $slug ) ) {
|
436 |
+
return false;
|
437 |
+
}
|
438 |
+
|
439 |
+
// Iterate over registered fields and see if we can find proper callback
|
440 |
+
foreach( $this->settings_fields as $section => $options ) {
|
441 |
+
foreach ( $options as $option ) {
|
442 |
+
if ( $option['name'] != $slug ) {
|
443 |
+
continue;
|
444 |
+
}
|
445 |
+
|
446 |
+
// Return the callback name
|
447 |
+
return isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : false;
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
return false;
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Get the value of a settings field
|
456 |
+
*
|
457 |
+
* @param string $option settings field name
|
458 |
+
* @param string $section the section name this field belongs to
|
459 |
+
* @param string $default default text if it's not found
|
460 |
+
* @return string
|
461 |
+
*/
|
462 |
+
function get_option( $option, $section, $default = '' ) {
|
463 |
+
|
464 |
+
$options = get_option( $section );
|
465 |
+
|
466 |
+
if ( isset( $options[$option] ) ) {
|
467 |
+
return $options[$option];
|
468 |
+
}
|
469 |
+
|
470 |
+
return $default;
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Show navigations as tab
|
475 |
+
*
|
476 |
+
* Shows all the settings section labels as tab
|
477 |
+
*/
|
478 |
+
function show_navigation() {
|
479 |
+
$html = '<h2 class="nav-tab-wrapper">';
|
480 |
+
|
481 |
+
foreach ( $this->settings_sections as $tab ) {
|
482 |
+
if ( 'loginpress_premium' != $tab['id'] ) {
|
483 |
+
$html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
|
484 |
+
}
|
485 |
+
if ( 'loginpress_premium' == $tab['id'] ) {
|
486 |
+
$html .= sprintf( '<a href="%1$s" class="loginpress-premium" target="_blank">%2$s</a>', "https://wpbrigade.com/wordpress/plugins/loginpress-pro/", $tab['title'] );
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
+
$html .= '</h2>';
|
491 |
+
|
492 |
+
echo $html;
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* Show the section settings forms
|
497 |
+
*
|
498 |
+
* This function displays every sections in a different form
|
499 |
+
*/
|
500 |
+
function show_forms() {
|
501 |
+
?>
|
502 |
+
<div class="metabox-holder">
|
503 |
+
<?php foreach ( $this->settings_sections as $form ) { ?>
|
504 |
+
<div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
|
505 |
+
<form method="post" action="options.php">
|
506 |
+
<?php
|
507 |
+
do_action( 'wsa_form_top_' . $form['id'], $form );
|
508 |
+
settings_fields( $form['id'] );
|
509 |
+
do_settings_sections( $form['id'] );
|
510 |
+
do_action( 'wsa_form_bottom_' . $form['id'], $form );
|
511 |
+
if ( isset( $this->settings_fields[ $form['id'] ] ) ):
|
512 |
+
?>
|
513 |
+
<div style="padding-left: 10px">
|
514 |
+
<?php submit_button(); ?>
|
515 |
+
</div>
|
516 |
+
<?php endif; ?>
|
517 |
+
</form>
|
518 |
+
</div>
|
519 |
+
<?php } ?>
|
520 |
+
</div>
|
521 |
+
<?php
|
522 |
+
$this->script();
|
523 |
+
}
|
524 |
+
|
525 |
+
/**
|
526 |
+
* Tabbable JavaScript codes & Initiate Color Picker
|
527 |
+
*
|
528 |
+
* This code uses localstorage for displaying active tabs
|
529 |
+
*/
|
530 |
+
function script() {
|
531 |
+
?>
|
532 |
+
<script>
|
533 |
+
jQuery(document).ready(function($) {
|
534 |
+
//Initiate Color Picker
|
535 |
+
$('.wp-color-picker-field').wpColorPicker();
|
536 |
+
|
537 |
+
// Switches option sections
|
538 |
+
$('.group').hide();
|
539 |
+
var activetab = '';
|
540 |
+
if (typeof(localStorage) != 'undefined' ) {
|
541 |
+
activetab = localStorage.getItem("activetab");
|
542 |
+
}
|
543 |
+
if (activetab != '' && $(activetab).length ) {
|
544 |
+
$(activetab).fadeIn();
|
545 |
+
} else {
|
546 |
+
$('.group:first').fadeIn();
|
547 |
+
}
|
548 |
+
$('.group .collapsed').each(function(){
|
549 |
+
$(this).find('input:checked').parent().parent().parent().nextAll().each(
|
550 |
+
function(){
|
551 |
+
if ($(this).hasClass('last')) {
|
552 |
+
$(this).removeClass('hidden');
|
553 |
+
return false;
|
554 |
+
}
|
555 |
+
$(this).filter('.hidden').removeClass('hidden');
|
556 |
+
});
|
557 |
+
});
|
558 |
+
|
559 |
+
if (activetab != '' && $(activetab + '-tab').length ) {
|
560 |
+
$(activetab + '-tab').addClass('nav-tab-active');
|
561 |
+
}
|
562 |
+
else {
|
563 |
+
$('.nav-tab-wrapper a:first').addClass('nav-tab-active');
|
564 |
+
}
|
565 |
+
$('.nav-tab-wrapper a:not(".loginpress-premium")').click(function(evt) {
|
566 |
+
$('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
567 |
+
$(this).addClass('nav-tab-active').blur();
|
568 |
+
var clicked_group = $(this).attr('href');
|
569 |
+
if (typeof(localStorage) != 'undefined' ) {
|
570 |
+
localStorage.setItem("activetab", $(this).attr('href'));
|
571 |
+
}
|
572 |
+
$('.group').hide();
|
573 |
+
$(clicked_group).fadeIn();
|
574 |
+
evt.preventDefault();
|
575 |
+
});
|
576 |
+
|
577 |
+
$('.wpsa-browse').on('click', function (event) {
|
578 |
+
event.preventDefault();
|
579 |
+
|
580 |
+
var self = $(this);
|
581 |
+
|
582 |
+
// Create the media frame.
|
583 |
+
var file_frame = wp.media.frames.file_frame = wp.media({
|
584 |
+
title: self.data('uploader_title'),
|
585 |
+
button: {
|
586 |
+
text: self.data('uploader_button_text'),
|
587 |
+
},
|
588 |
+
multiple: false
|
589 |
+
});
|
590 |
+
|
591 |
+
file_frame.on('select', function () {
|
592 |
+
attachment = file_frame.state().get('selection').first().toJSON();
|
593 |
+
self.prev('.wpsa-url').val(attachment.url).change();
|
594 |
+
});
|
595 |
+
|
596 |
+
// Finally, open the modal
|
597 |
+
file_frame.open();
|
598 |
+
});
|
599 |
+
});
|
600 |
+
</script>
|
601 |
+
<?php
|
602 |
+
$this->_style_fix();
|
603 |
+
}
|
604 |
+
|
605 |
+
function _style_fix() {
|
606 |
+
global $wp_version;
|
607 |
+
|
608 |
+
if (version_compare($wp_version, '3.8', '<=')):
|
609 |
+
?>
|
610 |
+
<style type="text/css">
|
611 |
+
/** WordPress 3.8 Fix **/
|
612 |
+
.form-table th { padding: 20px 10px; }
|
613 |
+
#wpbody-content .metabox-holder { padding-top: 5px; }
|
614 |
+
</style>
|
615 |
+
<?php
|
616 |
+
endif;
|
617 |
+
}
|
618 |
+
|
619 |
+
}
|
620 |
+
|
621 |
+
endif;
|
classes/loginpress-setup.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WordPress settings API demo class
|
5 |
+
*
|
6 |
+
* @author Tareq Hasan
|
7 |
+
*/
|
8 |
+
if ( !class_exists('LoginPress_Settings' ) ):
|
9 |
+
class LoginPress_Settings {
|
10 |
+
|
11 |
+
private $settings_api;
|
12 |
+
|
13 |
+
function __construct() {
|
14 |
+
include_once( LOGINPRESS_ROOT_PATH . '/classes/loginpress-settings-api.php' );
|
15 |
+
$this->settings_api = new LoginPress_Settings_API;
|
16 |
+
|
17 |
+
add_action( 'admin_init', array($this, 'admin_init') );
|
18 |
+
add_action( 'admin_menu', array($this, 'admin_menu') );
|
19 |
+
}
|
20 |
+
|
21 |
+
function admin_init() {
|
22 |
+
$this->load_default_settings();
|
23 |
+
//set the settings
|
24 |
+
$this->settings_api->set_sections( $this->get_settings_sections() );
|
25 |
+
$this->settings_api->set_fields( $this->get_settings_fields() );
|
26 |
+
|
27 |
+
//initialize settings
|
28 |
+
$this->settings_api->admin_init();
|
29 |
+
}
|
30 |
+
|
31 |
+
function load_default_settings() {
|
32 |
+
|
33 |
+
$_loginpress_Setting = get_option( 'loginpress_setting' );
|
34 |
+
if ( isset( $_loginpress_Setting['reset_settings'] ) && 'on' == $_loginpress_Setting['reset_settings'] ) {
|
35 |
+
|
36 |
+
delete_option( 'loginpress_customization' );
|
37 |
+
update_option( 'customize_presets_settings', 'default1' );
|
38 |
+
$_loginpress_Setting['reset_settings'] = 'off';
|
39 |
+
update_option( 'loginpress_setting', $_loginpress_Setting );
|
40 |
+
add_action( 'admin_notices', array( $this, 'settings_reset_message' ) );
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
function settings_reset_message() {
|
45 |
+
$class = 'notice notice-success';
|
46 |
+
$message = __( 'Default Settings Restored', 'loginpress' );
|
47 |
+
|
48 |
+
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
|
49 |
+
}
|
50 |
+
|
51 |
+
function admin_menu() {
|
52 |
+
|
53 |
+
add_submenu_page( 'loginpress', __( 'Settings', 'loginpress' ), __( 'Settings', 'loginpress' ), 'manage_options', "loginpress-settings", array( $this, 'plugin_page' ) );
|
54 |
+
}
|
55 |
+
|
56 |
+
function get_settings_sections() {
|
57 |
+
|
58 |
+
$loginpress_general_tab = array(
|
59 |
+
array(
|
60 |
+
'id' => 'loginpress_setting',
|
61 |
+
'title' => __( 'Settings', 'loginpress' ),
|
62 |
+
'desc' => "Following are the plugin settings for LoginPress Other than that everything is customizeable through WordPress Customizer.",
|
63 |
+
) );
|
64 |
+
|
65 |
+
if ( ! has_action( 'loginpress_pro_add_template' ) ) {
|
66 |
+
array_push( $loginpress_general_tab , array(
|
67 |
+
'id' => 'loginpress_premium',
|
68 |
+
'title' => __( 'Premium Version', 'loginpress' )
|
69 |
+
) );
|
70 |
+
}
|
71 |
+
|
72 |
+
$sections = $loginpress_general_tab;
|
73 |
+
|
74 |
+
return $sections;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Returns all the settings fields
|
79 |
+
*
|
80 |
+
* @return array settings fields
|
81 |
+
*/
|
82 |
+
function get_settings_fields() {
|
83 |
+
|
84 |
+
$_free_fields = array(
|
85 |
+
array(
|
86 |
+
'name' => 'reset_settings',
|
87 |
+
'label' => __( 'Reset Default Settings', 'loginpress' ),
|
88 |
+
'desc' => __( 'Remove my custom settings.', 'loginpress' ),
|
89 |
+
'type' => 'checkbox'
|
90 |
+
) );
|
91 |
+
|
92 |
+
$_settings_fields = apply_filters( 'loginpress_pro_settings', $_free_fields );
|
93 |
+
|
94 |
+
$settings_fields = array(
|
95 |
+
'loginpress_setting' => $_settings_fields,
|
96 |
+
);
|
97 |
+
|
98 |
+
return $settings_fields;
|
99 |
+
}
|
100 |
+
|
101 |
+
function plugin_page() {
|
102 |
+
echo '<div class="wrap">';
|
103 |
+
|
104 |
+
include_once LOGINPRESS_DIR_PATH . '/include/settings.php';
|
105 |
+
$this->settings_api->show_navigation();
|
106 |
+
$this->settings_api->show_forms();
|
107 |
+
|
108 |
+
echo '</div>';
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Get all the pages
|
113 |
+
*
|
114 |
+
* @return array page names with key value pairs
|
115 |
+
*/
|
116 |
+
function get_pages() {
|
117 |
+
$pages = get_pages();
|
118 |
+
$pages_options = array();
|
119 |
+
if ( $pages ) {
|
120 |
+
foreach ($pages as $page) {
|
121 |
+
$pages_options[$page->ID] = $page->post_title;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
return $pages_options;
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
129 |
+
endif;
|
css/style-login.php
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
<?php
|
2 |
-
// testing error notices OFF
|
3 |
-
// ini_set("display_errors", 0);
|
4 |
/**
|
5 |
* Get option and check the key exists in it.
|
6 |
*
|
@@ -86,23 +84,62 @@ $loginpress_footer_link_bg_clr = loginpress_get_option_key( 'login_footer_backgr
|
|
86 |
$loginpress_custom_css = loginpress_get_option_key( 'loginpress_custom_css', $loginpress_array );
|
87 |
$loginpress_custom_js = loginpress_get_option_key( 'loginpress_custom_js', $loginpress_array );
|
88 |
|
89 |
-
$loginpress_display_bg =
|
90 |
-
|
91 |
-
loginpress_bg_option( 'loginpress_display_bg', $loginpress_array );
|
92 |
-
|
93 |
// ob_start();
|
94 |
?>
|
95 |
<style type="text/css">
|
96 |
*{
|
97 |
box-sizing: border-box;
|
98 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
body.login {
|
100 |
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
background-image: url(<?php echo $loginpress_background_img; ?>);
|
103 |
-
<?php elseif ( isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
104 |
background-image: url();
|
105 |
<?php endif; ?>
|
|
|
106 |
<?php if ( ! empty( $loginpress_background_color ) ) : ?>
|
107 |
background-color: <?php echo $loginpress_background_color; ?>;
|
108 |
<?php endif; ?>
|
@@ -332,6 +369,12 @@ body.login {
|
|
332 |
.wp-core-ui .button-primary{
|
333 |
text-shadow: none;
|
334 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
</style>
|
336 |
|
337 |
<?php // $content = ob_get_clean(); ?>
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
* Get option and check the key exists in it.
|
4 |
*
|
84 |
$loginpress_custom_css = loginpress_get_option_key( 'loginpress_custom_css', $loginpress_array );
|
85 |
$loginpress_custom_js = loginpress_get_option_key( 'loginpress_custom_js', $loginpress_array );
|
86 |
|
87 |
+
$loginpress_display_bg = loginpress_bg_option( 'loginpress_display_bg', $loginpress_array );
|
88 |
+
$loginpress_theme_tem = get_option( 'customize_presets_settings', true );
|
|
|
|
|
89 |
// ob_start();
|
90 |
?>
|
91 |
<style type="text/css">
|
92 |
*{
|
93 |
box-sizing: border-box;
|
94 |
}
|
95 |
+
#login::after{
|
96 |
+
<?php if ( ( $loginpress_theme_tem == 'default6' || $loginpress_theme_tem == 'default8' || $loginpress_theme_tem == 'default10' ) && ! empty( $loginpress_background_img ) && $loginpress_display_bg ) : ?>
|
97 |
+
background-image: url(<?php echo $loginpress_background_img; ?>);
|
98 |
+
<?php elseif ( ( $loginpress_theme_tem == 'default6' || $loginpress_theme_tem == 'default8' || $loginpress_theme_tem == 'default10' ) && isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
99 |
+
background-image: url();
|
100 |
+
<?php endif; ?>
|
101 |
+
}
|
102 |
+
|
103 |
+
#login{
|
104 |
+
<?php if ( $loginpress_theme_tem == 'default17' && ! empty( $loginpress_background_img ) && $loginpress_display_bg ) : ?>
|
105 |
+
background-image: url(<?php echo $loginpress_background_img; ?>);
|
106 |
+
<?php elseif ( $loginpress_theme_tem == 'default17' && isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
107 |
+
background-image: url();
|
108 |
+
<?php endif; ?>
|
109 |
+
}
|
110 |
+
|
111 |
body.login {
|
112 |
|
113 |
+
<?php if ( $loginpress_theme_tem == 'default17' && ! empty( $loginpress_background_img ) && $loginpress_display_bg ) : ?>
|
114 |
+
background-image: url();
|
115 |
+
<?php elseif ( $loginpress_theme_tem == 'default17' && isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
116 |
+
background-image: url();
|
117 |
+
<?php endif; ?>
|
118 |
+
|
119 |
+
<?php if ( $loginpress_theme_tem == 'default10' && ! empty( $loginpress_background_img ) && $loginpress_display_bg ) : ?>
|
120 |
+
background-image: url();
|
121 |
+
<?php elseif ( $loginpress_theme_tem == 'default10' && isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
122 |
+
background-image: url();
|
123 |
+
<?php endif; ?>
|
124 |
+
|
125 |
+
<?php if ( $loginpress_theme_tem == 'default8' && ! empty( $loginpress_background_img ) && $loginpress_display_bg ) : ?>
|
126 |
+
background-image: url();
|
127 |
+
<?php elseif ( $loginpress_theme_tem == 'default8' && isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
128 |
+
background-image: url();
|
129 |
+
<?php endif; ?>
|
130 |
+
|
131 |
+
<?php if ( $loginpress_theme_tem == 'default6' && ! empty( $loginpress_background_img ) && $loginpress_display_bg ) : ?>
|
132 |
+
background-image: url();
|
133 |
+
<?php elseif ( $loginpress_theme_tem == 'default6' && isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
134 |
+
background-image: url();
|
135 |
+
<?php endif; ?>
|
136 |
+
|
137 |
+
<?php if ( $loginpress_theme_tem != 'default6' && $loginpress_theme_tem != 'default8' && $loginpress_theme_tem != 'default10' && $loginpress_theme_tem != 'default17' && ! empty( $loginpress_background_img ) && $loginpress_display_bg ) : ?>
|
138 |
background-image: url(<?php echo $loginpress_background_img; ?>);
|
139 |
+
<?php elseif ( $loginpress_theme_tem != 'default6' && $loginpress_theme_tem != 'default8' && $loginpress_theme_tem != 'default10' && $loginpress_theme_tem != 'default17' && isset( $loginpress_display_bg ) && ! $loginpress_display_bg ) : ?>
|
140 |
background-image: url();
|
141 |
<?php endif; ?>
|
142 |
+
|
143 |
<?php if ( ! empty( $loginpress_background_color ) ) : ?>
|
144 |
background-color: <?php echo $loginpress_background_color; ?>;
|
145 |
<?php endif; ?>
|
369 |
.wp-core-ui .button-primary{
|
370 |
text-shadow: none;
|
371 |
}
|
372 |
+
|
373 |
+
input:-webkit-autofill{
|
374 |
+
transition: all 100000s ease-in-out 0s !important;
|
375 |
+
transition-property: background-color, color !important;
|
376 |
+
}
|
377 |
+
|
378 |
</style>
|
379 |
|
380 |
<?php // $content = ob_get_clean(); ?>
|
css/style-presets.php
CHANGED
@@ -2,18 +2,15 @@
|
|
2 |
|
3 |
// $multi_values = ! is_array( get_option( 'customize_presets_settings' ) ) ? explode( ',', get_option( 'customize_presets_settings' ) ) : get_option( 'customize_presets_settings' );
|
4 |
//
|
5 |
-
|
6 |
|
7 |
-
$selected_preset = 'default1';
|
8 |
?>
|
9 |
|
10 |
<?php
|
11 |
if ( $selected_preset == 'default1' ) {
|
12 |
-
include_once LOGINPRESS_ROOT_PATH . 'css/themes/default-1'
|
13 |
echo first_presets();
|
14 |
-
} else if ( $selected_preset == 'default2' ) {
|
15 |
-
include_once LOGINPRESS_ROOT_PATH . 'css/themes/default-2' . EXE;
|
16 |
-
echo second_presets();
|
17 |
} else {
|
18 |
do_action( 'loginpress_add_pro_theme', $selected_preset );
|
19 |
}
|
2 |
|
3 |
// $multi_values = ! is_array( get_option( 'customize_presets_settings' ) ) ? explode( ',', get_option( 'customize_presets_settings' ) ) : get_option( 'customize_presets_settings' );
|
4 |
//
|
5 |
+
$selected_preset = get_option( 'customize_presets_settings', true );
|
6 |
|
7 |
+
// $selected_preset = 'default1';
|
8 |
?>
|
9 |
|
10 |
<?php
|
11 |
if ( $selected_preset == 'default1' ) {
|
12 |
+
include_once LOGINPRESS_ROOT_PATH . 'css/themes/default-1.php';
|
13 |
echo first_presets();
|
|
|
|
|
|
|
14 |
} else {
|
15 |
do_action( 'loginpress_add_pro_theme', $selected_preset );
|
16 |
}
|
css/style.css
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*{
|
2 |
+
box-sizing: border-box;
|
3 |
+
}
|
4 |
+
#normal-sortables{
|
5 |
+
padding-top: 20px;
|
6 |
+
}
|
7 |
+
#wpbrigade_infs_general_videobox h3{
|
8 |
+
padding: 0px 10px 10px;
|
9 |
+
border-bottom: 1px solid #eee;
|
10 |
+
}
|
11 |
+
.wpbrigade_videobox .column{
|
12 |
+
width: 50%;
|
13 |
+
float: left;
|
14 |
+
padding-right: 2.5%;
|
15 |
+
border-right: 1px solid #ebebeb;
|
16 |
+
padding-bottom: 2em;
|
17 |
+
}
|
18 |
+
.wpbrigade_videobox .column h2{
|
19 |
+
font-size: 16px;
|
20 |
+
margin-bottom: 20px;
|
21 |
+
}
|
22 |
+
.wpbrigade_videobox .column.right{
|
23 |
+
margin-right: 0;
|
24 |
+
padding-right: 0;
|
25 |
+
padding-left: 2.5%;
|
26 |
+
border: 0;
|
27 |
+
max-width: 49%;
|
28 |
+
}
|
29 |
+
.wpbrigade_videobox::after{
|
30 |
+
content: '';
|
31 |
+
display: table;
|
32 |
+
clear: both;
|
33 |
+
}
|
34 |
+
.wpbrigade-video-link{
|
35 |
+
width: 100%;
|
36 |
+
max-width: 200px;
|
37 |
+
float: left;
|
38 |
+
margin: 0 1.5em 1.5em 0;
|
39 |
+
}
|
40 |
+
.wpbrigade-video-link img{
|
41 |
+
max-width: 100%;
|
42 |
+
height: auto;
|
43 |
+
}
|
44 |
+
.wpbrigade-video-popup-overlay{
|
45 |
+
position: fixed;
|
46 |
+
height: 100%;
|
47 |
+
width: 100%;
|
48 |
+
top: 0;
|
49 |
+
left: 0;
|
50 |
+
background: rgba(0,0,0, .9);
|
51 |
+
display: none;
|
52 |
+
}
|
53 |
+
.wpbrigade-video-popup{
|
54 |
+
width: 600px;
|
55 |
+
position: absolute;
|
56 |
+
top: 50%;
|
57 |
+
left: 50%;
|
58 |
+
background: #fff;
|
59 |
+
height: 450px;
|
60 |
+
-webkit-transform: translate(-50%, -50%);
|
61 |
+
-moz-transform: translate(-50%, -50%);
|
62 |
+
-ms-transform: translate(-50%, -50%);
|
63 |
+
transform: translate(-50%, -50%);
|
64 |
+
padding: 50px 20px 20px;
|
65 |
+
}
|
66 |
+
.wpbrigade-video-popup iframe{
|
67 |
+
width: 100%;
|
68 |
+
height: 380px;
|
69 |
+
}
|
70 |
+
.wpbrigade-close-popup{
|
71 |
+
position: absolute;
|
72 |
+
top: 10px;
|
73 |
+
right: 20px;
|
74 |
+
cursor: pointer;
|
75 |
+
}
|
76 |
+
.wpbrigade-video-description-wrapper{
|
77 |
+
overflow: hidden;
|
78 |
+
}
|
79 |
+
.wpbrigade-video-description-wrapper p{
|
80 |
+
margin: 0;
|
81 |
+
}
|
82 |
+
.wpbrigade-video-description-wrapper p ~ p{
|
83 |
+
margin-top: 10px;
|
84 |
+
}
|
85 |
+
.wpbrigade-heading {
|
86 |
+
font-size: 16px;
|
87 |
+
margin-bottom: 20px;
|
88 |
+
font-weight: 400;
|
89 |
+
margin: 0;
|
90 |
+
padding: 9px 0 4px;
|
91 |
+
line-height: 29px;
|
92 |
+
display: block;
|
93 |
+
}
|
94 |
+
.loginpress-premium{
|
95 |
+
float: left;
|
96 |
+
border: 1px solid #ccc;
|
97 |
+
border-bottom: none;
|
98 |
+
margin-left: .5em;
|
99 |
+
padding: 5px 10px;
|
100 |
+
font-size: 14px;
|
101 |
+
line-height: 24px;
|
102 |
+
background: #e5e5e5;
|
103 |
+
color: #0073aa;
|
104 |
+
text-decoration: none;
|
105 |
+
}
|
106 |
+
@media screen and (max-width: 1170px) {
|
107 |
+
|
108 |
+
}
|
109 |
+
@media screen and (max-width: 767px) {
|
110 |
+
.wpbrigade-video-popup{
|
111 |
+
max-width: 455px;
|
112 |
+
width: 100%;
|
113 |
+
height: auto;
|
114 |
+
padding: 37px 20px 9px;
|
115 |
+
}
|
116 |
+
.wpbrigade-video-popup iframe{
|
117 |
+
height: 200px;
|
118 |
+
}
|
119 |
+
}
|
css/themes/default-2.php
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
|
2 |
-
<?php
|
3 |
-
function second_presets() {
|
4 |
-
ob_start();
|
5 |
-
?>
|
6 |
-
<style media="screen">
|
7 |
-
html, body.login {
|
8 |
-
height: auto !important;
|
9 |
-
}
|
10 |
-
body.login {
|
11 |
-
background-image: url(<?php echo plugins_url( 'img/bg2.jpg', LOGINPRESS_PLUGIN_BASENAME ) ?>);
|
12 |
-
background-size: cover;
|
13 |
-
display: table;
|
14 |
-
min-height: 100vh;
|
15 |
-
width: 100%;
|
16 |
-
padding: 0;
|
17 |
-
}
|
18 |
-
.login label{
|
19 |
-
font-size:0;
|
20 |
-
line-height:0;
|
21 |
-
margin-top: 0;
|
22 |
-
display: block;
|
23 |
-
margin-bottom:
|
24 |
-
}
|
25 |
-
#login form p + p:not(.forgetmenot){
|
26 |
-
margin-top: 35px;
|
27 |
-
}
|
28 |
-
.login form .input, .login input[type=text]{
|
29 |
-
background: rgba(255,255,255,.2);
|
30 |
-
display: block;
|
31 |
-
color: #fff;
|
32 |
-
font-size: 16px;
|
33 |
-
width:100%;
|
34 |
-
border:0;
|
35 |
-
height: 50px;
|
36 |
-
padding: 0 15px;
|
37 |
-
}
|
38 |
-
.login form{
|
39 |
-
background: none;
|
40 |
-
padding: 0;
|
41 |
-
box-shadow: none;
|
42 |
-
}
|
43 |
-
.login form br{
|
44 |
-
display: none;
|
45 |
-
}
|
46 |
-
#login{
|
47 |
-
width: calc(100% - 30px) !important;
|
48 |
-
max-width: 360px !important;
|
49 |
-
}
|
50 |
-
#login form p.submit{
|
51 |
-
clear: both;
|
52 |
-
padding-top: 35px;
|
53 |
-
}
|
54 |
-
.wp-core-ui #login .button-primary{
|
55 |
-
width:100% !important;
|
56 |
-
display: block;
|
57 |
-
float: none;
|
58 |
-
background-color : #f78f1e;
|
59 |
-
font-weight: 700;
|
60 |
-
font-size: 18px;
|
61 |
-
font-family: "Roboto", sans-serif;
|
62 |
-
color : #ffffff;
|
63 |
-
height: 56px;
|
64 |
-
border-radius: 0;
|
65 |
-
border:0;
|
66 |
-
box-shadow: none;
|
67 |
-
}
|
68 |
-
.wp-core-ui #login .button-primary:hover{
|
69 |
-
background-color: #fff;
|
70 |
-
color : #f78f1e;
|
71 |
-
}
|
72 |
-
.login form .forgetmenot label{
|
73 |
-
font-size: 13px;
|
74 |
-
color: #d5d5d5;
|
75 |
-
}
|
76 |
-
.login form input[type=checkbox]{
|
77 |
-
background: none;
|
78 |
-
border: 1px solid #d5d5d5;
|
79 |
-
height: 13px;
|
80 |
-
width: 13px;
|
81 |
-
min-width: 13px;
|
82 |
-
}
|
83 |
-
.login #nav, .login #backtoblog {
|
84 |
-
margin: 17px 0 0;
|
85 |
-
padding: 0;
|
86 |
-
font-size: 14px;
|
87 |
-
color: #d5d5d5;
|
88 |
-
}
|
89 |
-
.login #nav a, .login #backtoblog a{
|
90 |
-
font-size: 14px;
|
91 |
-
color: #d5d5d5;
|
92 |
-
}
|
93 |
-
.login #backtoblog{
|
94 |
-
float: left;
|
95 |
-
}
|
96 |
-
.login #nav{
|
97 |
-
float: right;
|
98 |
-
}
|
99 |
-
.login #backtoblog a:hover, .login #nav a:hover, .login h1 a:hover{
|
100 |
-
color: #fff;
|
101 |
-
}
|
102 |
-
.footer-wrapper{
|
103 |
-
display: table-footer-group;
|
104 |
-
}
|
105 |
-
.footer-cont{
|
106 |
-
|
107 |
-
right: 0;
|
108 |
-
bottom: 0;
|
109 |
-
left: 0;
|
110 |
-
text-align: center;
|
111 |
-
display: table-cell;
|
112 |
-
vertical-align: bottom;
|
113 |
-
height: 100px;
|
114 |
-
}
|
115 |
-
.copyRight{
|
116 |
-
text-align: center;
|
117 |
-
padding: 12px;
|
118 |
-
/*background-color: #303030;*/
|
119 |
-
color: #fff;
|
120 |
-
}
|
121 |
-
#login form p + p:not(.forgetmenot){
|
122 |
-
color: #d5d5d5;
|
123 |
-
}
|
124 |
-
input[type=checkbox]:checked:before{
|
125 |
-
font-size: 18px;
|
126 |
-
}
|
127 |
-
@media screen and (max-width: 767px) {
|
128 |
-
.login #nav{
|
129 |
-
text-align: center;
|
130 |
-
width: 100%;
|
131 |
-
}
|
132 |
-
.login #backtoblog{
|
133 |
-
text-align: center;
|
134 |
-
width: 100%;
|
135 |
-
}
|
136 |
-
}
|
137 |
-
</style>
|
138 |
-
|
139 |
-
<?php
|
140 |
-
$content = ob_get_clean();
|
141 |
-
return $content;
|
142 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
custom.php
CHANGED
@@ -48,15 +48,20 @@ class LoginPress_Entities {
|
|
48 |
wp_enqueue_script('jquery');
|
49 |
wp_enqueue_script( 'loginpress-customize-control', plugins_url( 'js/customize-controls.js' , __FILE__ ), array( 'jquery', 'customize-preview' ), LOGINPRESS_VERSION, true );
|
50 |
|
51 |
-
$admin_url = array( 'template_url' => admin_url() );
|
52 |
-
wp_localize_script( 'loginpress-customize-control', 'admin_url', $admin_url );
|
53 |
|
54 |
-
|
55 |
-
|
|
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
wp_localize_script( 'loginpress-customize-control', 'login_theme', $login_theme );
|
60 |
|
61 |
}
|
62 |
|
@@ -70,7 +75,7 @@ class LoginPress_Entities {
|
|
70 |
*/
|
71 |
public function customize_login_panel( $wp_customize ){
|
72 |
|
73 |
-
include LOGINPRESS_ROOT_PATH .'classes/control-presets'
|
74 |
|
75 |
// =============================
|
76 |
// = Panel for the LoginPress =
|
@@ -83,50 +88,138 @@ class LoginPress_Entities {
|
|
83 |
|
84 |
|
85 |
// Start of Presets.
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
//End of Presets.
|
131 |
|
132 |
|
@@ -359,7 +452,7 @@ class LoginPress_Entities {
|
|
359 |
)));
|
360 |
|
361 |
$form_control = array( 'customize_form_width', 'customize_form_height', 'customize_form_padding', 'customize_form_border', 'textfield_width', 'textfield_margin' );
|
362 |
-
$form_default = array( '
|
363 |
$form_label = array(
|
364 |
__( 'Form Width:', 'loginpress' ),
|
365 |
__( 'Form Minimum Height:', 'loginpress' ),
|
@@ -1182,8 +1275,8 @@ class LoginPress_Entities {
|
|
1182 |
|
1183 |
// Include CSS File in heared.
|
1184 |
|
1185 |
-
include( LOGINPRESS_DIR_PATH . 'css/style-presets'
|
1186 |
-
include( LOGINPRESS_DIR_PATH . 'css/style-login'
|
1187 |
|
1188 |
|
1189 |
if ( $this->loginpress_key && array_key_exists( 'header_login_menu', $this->loginpress_key ) ) {
|
@@ -1373,8 +1466,8 @@ class LoginPress_Entities {
|
|
1373 |
* @since 1.0.0
|
1374 |
* * * * * * * * * * * * * * * * * * */
|
1375 |
public function redirect_to_custom_page() {
|
1376 |
-
if (!empty($_GET['page'])) {
|
1377 |
-
if(($_GET['page']== "abw")){
|
1378 |
wp_redirect(get_admin_url()."customize.php?url=".wp_login_url());
|
1379 |
}
|
1380 |
}
|
@@ -1401,21 +1494,21 @@ class LoginPress_Entities {
|
|
1401 |
'return' => admin_url( 'themes.php' ),
|
1402 |
),
|
1403 |
admin_url( 'customize.php' )
|
1404 |
-
|
1405 |
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
|
|
1416 |
}
|
1417 |
}
|
1418 |
}
|
1419 |
-
}
|
1420 |
|
1421 |
?>
|
48 |
wp_enqueue_script('jquery');
|
49 |
wp_enqueue_script( 'loginpress-customize-control', plugins_url( 'js/customize-controls.js' , __FILE__ ), array( 'jquery', 'customize-preview' ), LOGINPRESS_VERSION, true );
|
50 |
|
|
|
|
|
51 |
|
52 |
+
// Get Background URL for use in Customizer JS.
|
53 |
+
$loginpress_bg = get_option( 'loginpress_customization');
|
54 |
+
$loginpress_bg_url = $loginpress_bg['setting_background'] ? $loginpress_bg['setting_background'] : false;
|
55 |
|
56 |
+
// Array for localize.
|
57 |
+
$loginpress_localize = array(
|
58 |
+
'admin_url' => admin_url(),
|
59 |
+
'plugin_url' => plugins_url(),
|
60 |
+
'login_theme' => get_option( 'customize_presets_settings', true ),
|
61 |
+
'loginpress_bg_url' => $loginpress_bg_url
|
62 |
+
);
|
63 |
|
64 |
+
wp_localize_script( 'loginpress-customize-control', 'loginpress_script', $loginpress_localize );
|
|
|
65 |
|
66 |
}
|
67 |
|
75 |
*/
|
76 |
public function customize_login_panel( $wp_customize ){
|
77 |
|
78 |
+
include LOGINPRESS_ROOT_PATH .'classes/control-presets.php';
|
79 |
|
80 |
// =============================
|
81 |
// = Panel for the LoginPress =
|
88 |
|
89 |
|
90 |
// Start of Presets.
|
91 |
+
$wp_customize->add_section( 'customize_presets', array(
|
92 |
+
'title' => __( 'Themes', 'loginpress' ),
|
93 |
+
'description' => __( 'Choose Theme', 'loginpress' ),
|
94 |
+
'priority' => 1,
|
95 |
+
'panel' => 'loginpress_panel',
|
96 |
+
) );
|
97 |
+
|
98 |
+
$wp_customize->add_setting( 'customize_presets_settings', array(
|
99 |
+
'default' => 'default1',
|
100 |
+
'type' => 'option',
|
101 |
+
'capability' => 'manage_options',
|
102 |
+
) );
|
103 |
+
|
104 |
+
$loginpress_free_templates = array(
|
105 |
+
'default1' => array(
|
106 |
+
'img' => plugins_url( 'img/bg.jpg', __FILE__ ),
|
107 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-1.png', __FILE__ ),
|
108 |
+
'id' => 'default1',
|
109 |
+
'name' => 'Default'
|
110 |
+
),
|
111 |
+
'default2' => array(
|
112 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-2.png', __FILE__ ),
|
113 |
+
'id' => 'default2',
|
114 |
+
'name' => __( 'Company', 'loginpress' ),
|
115 |
+
'pro' => 'yes'
|
116 |
+
),
|
117 |
+
'default3' => array(
|
118 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-3.png', __FILE__ ),
|
119 |
+
'id' => 'default3',
|
120 |
+
'name' => __( 'Persona', 'loginpress' ),
|
121 |
+
'pro' => 'yes'
|
122 |
+
),
|
123 |
+
'default4' => array(
|
124 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-4.jpg', __FILE__ ),
|
125 |
+
'id' => 'default4',
|
126 |
+
'name' => __( 'Corporate', 'loginpress' ),
|
127 |
+
'pro' => 'yes'
|
128 |
+
),
|
129 |
+
'default5' => array(
|
130 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-5.png', __FILE__ ),
|
131 |
+
'id' => 'default5',
|
132 |
+
'name' => __( 'Corporate', 'loginpress' ),
|
133 |
+
'pro' => 'yes'
|
134 |
+
),
|
135 |
+
'default6' => array(
|
136 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-6.png', __FILE__ ),
|
137 |
+
'id' => 'default6',
|
138 |
+
'name' => __( 'Startup', 'loginpress' ),
|
139 |
+
'pro' => 'yes'
|
140 |
+
),
|
141 |
+
'default7' => array(
|
142 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-7.png', __FILE__ ),
|
143 |
+
'id' => 'default7',
|
144 |
+
'name' => __( 'Wedding', 'loginpress' ),
|
145 |
+
'pro' => 'yes'
|
146 |
+
),
|
147 |
+
'default8' => array(
|
148 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-8.png', __FILE__ ),
|
149 |
+
'id' => 'default8',
|
150 |
+
'name' => __( 'Wedding #2', 'loginpress' ),
|
151 |
+
'pro' => 'yes'
|
152 |
+
),
|
153 |
+
'default9' => array(
|
154 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-9.png', __FILE__ ),
|
155 |
+
'id' => 'default9',
|
156 |
+
'name' => __( 'Company', 'loginpress' ),
|
157 |
+
'pro' => 'yes'
|
158 |
+
),
|
159 |
+
'default10' => array(
|
160 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-10.png', __FILE__ ),
|
161 |
+
'id' => 'default10',
|
162 |
+
'name' => __( 'Bikers', 'loginpress' ),
|
163 |
+
'pro' => 'yes'
|
164 |
+
),
|
165 |
+
'default11' => array(
|
166 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-11.png', __FILE__ ),
|
167 |
+
'id' => 'default11',
|
168 |
+
'name' => __( 'Fitness', 'loginpress' ),
|
169 |
+
'pro' => 'yes'
|
170 |
+
),
|
171 |
+
'default12' => array(
|
172 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-12.png', __FILE__ ),
|
173 |
+
'id' => 'default12',
|
174 |
+
'name' => __( 'Shopping', 'loginpress' ),
|
175 |
+
'pro' => 'yes'
|
176 |
+
),
|
177 |
+
'default13' => array(
|
178 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-13.png', __FILE__ ),
|
179 |
+
'id' => 'default13',
|
180 |
+
'name' => __( 'Writers', 'loginpress' ),
|
181 |
+
'pro' => 'yes'
|
182 |
+
),
|
183 |
+
'default14' => array(
|
184 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-14.png', __FILE__ ),
|
185 |
+
'id' => 'default14',
|
186 |
+
'name' => __( 'Persona', 'loginpress' ),
|
187 |
+
'pro' => 'yes'
|
188 |
+
),
|
189 |
+
'default15' => array(
|
190 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-15.png', __FILE__ ),
|
191 |
+
'id' => 'default15',
|
192 |
+
'name' => __( 'Geek', 'loginpress' ),
|
193 |
+
'pro' => 'yes'
|
194 |
+
),
|
195 |
+
'default16' => array(
|
196 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-16.png', __FILE__ ),
|
197 |
+
'id' => 'default16',
|
198 |
+
'name' => __( 'Innovation', 'loginpress' ),
|
199 |
+
'pro' => 'yes'
|
200 |
+
),
|
201 |
+
'default17' => array(
|
202 |
+
'thumbnail' => plugins_url( 'img/thumbnail/default-17.png', __FILE__ ),
|
203 |
+
'id' => 'default17',
|
204 |
+
'name' => __( 'Photographers', 'loginpress' ),
|
205 |
+
'pro' => 'yes'
|
206 |
+
),
|
207 |
+
'default18' => array(
|
208 |
+
'thumbnail' => plugins_url( 'img/thumbnail/custom-design.png', __FILE__ ),
|
209 |
+
'id' => 'default18',
|
210 |
+
'name' => 'Custom Design',
|
211 |
+
'pro' => 'yes'
|
212 |
+
)
|
213 |
+
|
214 |
+
);
|
215 |
+
$loginpress_templates = apply_filters( 'loginpress_pro_add_template', $loginpress_free_templates );
|
216 |
+
|
217 |
+
$wp_customize->add_control( new LoginPress_Presets( $wp_customize, 'customize_presets_settings',
|
218 |
+
array(
|
219 |
+
'section' => 'customize_presets',
|
220 |
+
// 'label' => __( 'Themes', 'loginpress' ),
|
221 |
+
'choices' => $loginpress_templates
|
222 |
+
) ) );
|
223 |
//End of Presets.
|
224 |
|
225 |
|
452 |
)));
|
453 |
|
454 |
$form_control = array( 'customize_form_width', 'customize_form_height', 'customize_form_padding', 'customize_form_border', 'textfield_width', 'textfield_margin' );
|
455 |
+
$form_default = array( '', '200px', '26px 24px 46px', '', '100%', '2px 6px 16px 0px' );
|
456 |
$form_label = array(
|
457 |
__( 'Form Width:', 'loginpress' ),
|
458 |
__( 'Form Minimum Height:', 'loginpress' ),
|
1275 |
|
1276 |
// Include CSS File in heared.
|
1277 |
|
1278 |
+
include( LOGINPRESS_DIR_PATH . 'css/style-presets.php' );
|
1279 |
+
include( LOGINPRESS_DIR_PATH . 'css/style-login.php' );
|
1280 |
|
1281 |
|
1282 |
if ( $this->loginpress_key && array_key_exists( 'header_login_menu', $this->loginpress_key ) ) {
|
1466 |
* @since 1.0.0
|
1467 |
* * * * * * * * * * * * * * * * * * */
|
1468 |
public function redirect_to_custom_page() {
|
1469 |
+
if ( ! empty($_GET['page'] ) ) {
|
1470 |
+
if( ( $_GET['page'] == "abw" ) || ( $_GET['page'] == "loginpress" ) ){
|
1471 |
wp_redirect(get_admin_url()."customize.php?url=".wp_login_url());
|
1472 |
}
|
1473 |
}
|
1494 |
'return' => admin_url( 'themes.php' ),
|
1495 |
),
|
1496 |
admin_url( 'customize.php' )
|
1497 |
+
);
|
1498 |
|
1499 |
+
// If is Not Design Menu, return
|
1500 |
+
if ( ! isset( $submenu[ $parent ] ) ) {
|
1501 |
+
return NULL;
|
1502 |
+
}
|
1503 |
|
1504 |
+
foreach ( $submenu[ $parent ] as $key => $value ) {
|
1505 |
+
// Set new URL for menu item
|
1506 |
+
if ( $page === $value[ 2 ] ) {
|
1507 |
+
$submenu[ $parent ][ $key ][ 2 ] = $url;
|
1508 |
+
break;
|
1509 |
+
}
|
1510 |
}
|
1511 |
}
|
1512 |
}
|
|
|
1513 |
|
1514 |
?>
|
img/dummy.jpg
ADDED
Binary file
|
img/key_icon.svg
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
+
<svg version="1.1" id="Layer_1" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
|
4 |
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px"
|
5 |
+
viewBox="-333.2 378.7 20 20" style="enable-background:new -333.2 378.7 20 20;" xml:space="preserve">
|
6 |
+
<style type="text/css">
|
7 |
+
.st0{fill:#909090;}
|
8 |
+
</style>
|
9 |
+
<title></title>
|
10 |
+
<desc></desc>
|
11 |
+
<g>
|
12 |
+
<polygon class="st0" points="-332.7,398.2 -332.7,398.2 -332.8,398.2 "/>
|
13 |
+
<path class="st0" d="M-318.6,378.7c-3,0-5.4,2.4-5.4,5.4c0,0.9,0.2,1.7,0.6,2.5l-9.3,9.3c-0.6,0.6-0.6,1.7,0,2.3
|
14 |
+
c0.6,0.6,1.7,0.6,2.3,0l1.4-1.4l1.9,1.9l2.3-2.3l-1.9-1.9l1.2-1.2l1.5,1.5l2.3-2.3l-1.5-1.5l2.1-2.1c0.7,0.4,1.6,0.6,2.5,0.6
|
15 |
+
c3,0,5.4-2.4,5.4-5.4C-313.2,381.1-315.6,378.7-318.6,378.7z M-318.6,388.7c-1,0-1.9-0.3-2.6-0.8l-3.1,3.1l1.5,1.5l-1.2,1.2
|
16 |
+
l-1.5-1.5l-2.3,2.3l1.9,1.9l-1.2,1.2l-1.9-1.9l-2,2c-0.3,0.3-0.9,0.3-1.2,0l0,0c-0.3-0.3-0.3-0.9,0-1.2l9.8-9.8
|
17 |
+
c-0.5-0.7-0.8-1.6-0.8-2.6c0-2.5,2.1-4.6,4.6-4.6c2.5,0,4.6,2.1,4.6,4.6C-314,386.6-316,388.7-318.6,388.7z"/>
|
18 |
+
<path class="st0" d="M-318.6,381c-1.7,0-3.1,1.4-3.1,3.1c0,1.7,1.4,3.1,3.1,3.1c1.7,0,3.1-1.4,3.1-3.1
|
19 |
+
C-315.5,382.3-316.9,381-318.6,381z M-318.6,386.4c-1.3,0-2.3-1-2.3-2.3s1-2.3,2.3-2.3c1.3,0,2.3,1,2.3,2.3
|
20 |
+
S-317.3,386.4-318.6,386.4z"/>
|
21 |
+
</g>
|
22 |
+
</svg>
|
img/thumbnail/custom-design.png
ADDED
Binary file
|
img/thumbnail/default-10.png
ADDED
Binary file
|
img/thumbnail/default-11.png
ADDED
Binary file
|
img/thumbnail/default-12.png
ADDED
Binary file
|
img/thumbnail/default-13.png
ADDED
Binary file
|
img/thumbnail/default-14.png
ADDED
Binary file
|
img/thumbnail/default-15.png
ADDED
Binary file
|
img/thumbnail/default-16.png
ADDED
Binary file
|
img/thumbnail/default-17.png
ADDED
Binary file
|
img/thumbnail/default-5.png
ADDED
Binary file
|
img/thumbnail/default-6.png
ADDED
Binary file
|
img/thumbnail/default-7.png
ADDED
Binary file
|
img/thumbnail/default-8.png
ADDED
Binary file
|
img/thumbnail/default-9.png
ADDED
Binary file
|
img/user_icon.svg
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
+
width="18px" height="18.6px" viewBox="182.1 387.7 18 18.6" style="enable-background:new 182.1 387.7 18 18.6;"
|
5 |
+
xml:space="preserve">
|
6 |
+
<style type="text/css">
|
7 |
+
.st0{fill:#919090;}
|
8 |
+
</style>
|
9 |
+
<path class="st0" d="M197.5,399.6c-1.2-1.2-2.6-2-4.2-2.4c1.7-0.8,2.8-2.5,2.8-4.5c0-2.7-2.2-5-5-5c-2.7,0-5,2.2-5,5
|
10 |
+
c0,2,1.2,3.7,2.8,4.5c-1.6,0.4-3,1.2-4.2,2.4c-1.7,1.7-2.6,4-2.6,6.4c0,0.2,0.2,0.4,0.4,0.4s0.4-0.2,0.4-0.4c0-4.6,3.7-8.3,8.3-8.3
|
11 |
+
s8.3,3.7,8.3,8.3c0,0.2,0.2,0.4,0.4,0.4c0.2,0,0.4-0.2,0.4-0.4C200.1,403.5,199.2,401.3,197.5,399.6z M186.9,392.7
|
12 |
+
c0-2.3,1.9-4.2,4.2-4.2c2.3,0,4.2,1.9,4.2,4.2c0,2.3-1.9,4.2-4.2,4.2C188.8,396.9,186.9,395,186.9,392.7z"/>
|
13 |
+
</svg>
|
include/class-remote-notification-client.php
ADDED
@@ -0,0 +1,856 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Remote Dashboard Notifications.
|
4 |
+
*
|
5 |
+
* This class is part of the Remote Dashboard Notifications plugin.
|
6 |
+
* This plugin allows you to send notifications to your client's
|
7 |
+
* WordPress dashboard easily.
|
8 |
+
*
|
9 |
+
* Notification you send will be displayed as admin notifications
|
10 |
+
* using the standard WordPress hooks. A "dismiss" option is added
|
11 |
+
* in order to let the user hide the notification.
|
12 |
+
*
|
13 |
+
* @package Remote Dashboard Notifications
|
14 |
+
* @author ThemeAvenue <web@themeavenue.net>
|
15 |
+
* @license GPL-2.0+
|
16 |
+
* @link http://themeavenue.net
|
17 |
+
* @link http://wordpress.org/plugins/remote-dashboard-notifications/
|
18 |
+
* @link https://github.com/ThemeAvenue/Remote-Dashboard-Notifications
|
19 |
+
* @copyright 2016 ThemeAvenue
|
20 |
+
*/
|
21 |
+
|
22 |
+
// If this file is called directly, abort.
|
23 |
+
if ( ! defined( 'WPINC' ) ) {
|
24 |
+
die;
|
25 |
+
}
|
26 |
+
|
27 |
+
if ( ! class_exists( 'Remote_Dashboard_Notifications_Client' ) ) {
|
28 |
+
|
29 |
+
final class Remote_Dashboard_Notifications_Client {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var Remote_Dashboard_Notifications_Client Holds the unique instance
|
33 |
+
* @since 1.3.0
|
34 |
+
*/
|
35 |
+
private static $instance;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Minimum version of WordPress required ot run the plugin
|
39 |
+
*
|
40 |
+
* @since 1.3.0
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
public $wordpress_version_required = '3.8';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Required version of PHP.
|
47 |
+
*
|
48 |
+
* Follow WordPress latest requirements and require
|
49 |
+
* PHP version 5.2 at least.
|
50 |
+
*
|
51 |
+
* @since 1.3.0
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
public $php_version_required = '5.2';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Holds all the registered notifications
|
58 |
+
*
|
59 |
+
* @since 1.3.0
|
60 |
+
* @var array
|
61 |
+
*/
|
62 |
+
public $notifications = array();
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Instantiate and return the unique object
|
66 |
+
*
|
67 |
+
* @since 1.2.0
|
68 |
+
* @return object Remote_Dashboard_Notifications_Client Unique instance
|
69 |
+
*/
|
70 |
+
public static function instance() {
|
71 |
+
|
72 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Awesome_Support ) ) {
|
73 |
+
self::$instance = new Remote_Dashboard_Notifications_Client;
|
74 |
+
self::$instance->init();
|
75 |
+
}
|
76 |
+
|
77 |
+
return self::$instance;
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Instantiate the plugin
|
83 |
+
*
|
84 |
+
* @since 1.3.0
|
85 |
+
* @return void
|
86 |
+
*/
|
87 |
+
private function init() {
|
88 |
+
|
89 |
+
// Make sure the WordPress version is recent enough
|
90 |
+
if ( ! self::$instance->is_version_compatible() ) {
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
// Make sure we have a version of PHP that's not too old
|
95 |
+
if ( ! self::$instance->is_php_version_enough() ) {
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
// Call the dismiss method before testing for Ajax
|
100 |
+
if ( isset( $_GET['rn'] ) && isset( $_GET['notification'] ) ) {
|
101 |
+
add_action( 'plugins_loaded', array( self::$instance, 'dismiss' ) );
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
|
105 |
+
add_action( 'admin_print_styles', array( self::$instance, 'style' ), 100 );
|
106 |
+
add_action( 'admin_notices', array( self::$instance, 'show_notices' ) );
|
107 |
+
add_action( 'admin_footer', array( self::$instance, 'script' ) );
|
108 |
+
}
|
109 |
+
|
110 |
+
add_action( 'wp_ajax_rdn_fetch_notifications', array( $this, 'remote_get_notice_ajax' ) );
|
111 |
+
add_filter( 'heartbeat_received', array( self::$instance, 'heartbeat' ), 10, 2 );
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Throw error on object clone
|
117 |
+
*
|
118 |
+
* The whole idea of the singleton design pattern is that there is a single
|
119 |
+
* object therefore, we don't want the object to be cloned.
|
120 |
+
*
|
121 |
+
* @since 3.2.5
|
122 |
+
* @return void
|
123 |
+
*/
|
124 |
+
public function __clone() {
|
125 |
+
// Cloning instances of the class is forbidden
|
126 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'awesome-support' ), '3.2.5' );
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Disable unserializing of the class
|
131 |
+
*
|
132 |
+
* @since 3.2.5
|
133 |
+
* @return void
|
134 |
+
*/
|
135 |
+
public function __wakeup() {
|
136 |
+
// Unserializing instances of the class is forbidden
|
137 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'awesome-support' ), '3.2.5' );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Check if the core version is compatible with this addon.
|
142 |
+
*
|
143 |
+
* @since 1.3.0
|
144 |
+
* @return boolean
|
145 |
+
*/
|
146 |
+
private function is_version_compatible() {
|
147 |
+
|
148 |
+
if ( empty( self::$instance->wordpress_version_required ) ) {
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( version_compare( get_bloginfo( 'version' ), self::$instance->wordpress_version_required, '<' ) ) {
|
153 |
+
return false;
|
154 |
+
}
|
155 |
+
|
156 |
+
return true;
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Check if the version of PHP is compatible with this addon.
|
162 |
+
*
|
163 |
+
* @since 1.3.0
|
164 |
+
* @return boolean
|
165 |
+
*/
|
166 |
+
private function is_php_version_enough() {
|
167 |
+
|
168 |
+
/**
|
169 |
+
* No version set, we assume everything is fine.
|
170 |
+
*/
|
171 |
+
if ( empty( self::$instance->php_version_required ) ) {
|
172 |
+
return true;
|
173 |
+
}
|
174 |
+
|
175 |
+
if ( version_compare( phpversion(), self::$instance->php_version_required, '<' ) ) {
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
|
179 |
+
return true;
|
180 |
+
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Register a new remote notification
|
185 |
+
*
|
186 |
+
* @since 1.3.0
|
187 |
+
*
|
188 |
+
* @param int $channel_id Channel ID on the remote server
|
189 |
+
* @param string $channel_key Channel key for authentication with the server
|
190 |
+
* @param string $server Notification server URL
|
191 |
+
* @param int $cache Cache lifetime (in hours)
|
192 |
+
*
|
193 |
+
* @return bool|string
|
194 |
+
*/
|
195 |
+
public function add_notification( $channel_id, $channel_key, $server, $cache = 6 ) {
|
196 |
+
|
197 |
+
$notification = array(
|
198 |
+
'channel_id' => (int) $channel_id,
|
199 |
+
'channel_key' => $channel_key,
|
200 |
+
'server_url' => esc_url( $server ),
|
201 |
+
'cache_lifetime' => apply_filters( 'rn_notice_caching_time', $cache ),
|
202 |
+
);
|
203 |
+
|
204 |
+
// Generate the notice unique ID
|
205 |
+
$notification['notice_id'] = $notification['channel_id'] . substr( $channel_key, 0, 5 );
|
206 |
+
|
207 |
+
// Double check that the required info is here
|
208 |
+
if ( '' === ( $notification['channel_id'] || $notification['channel_key'] || $notification['server_url'] ) ) {
|
209 |
+
return false;
|
210 |
+
}
|
211 |
+
|
212 |
+
// Check that there is no notification with the same ID
|
213 |
+
if ( array_key_exists( $notification['notice_id'], $this->notifications ) ) {
|
214 |
+
return false;
|
215 |
+
}
|
216 |
+
|
217 |
+
$this->notifications[ $notification['notice_id'] ] = $notification;
|
218 |
+
|
219 |
+
return $notification['notice_id'];
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Remove a registered notification
|
225 |
+
*
|
226 |
+
* @since 1.3.0
|
227 |
+
*
|
228 |
+
* @param string $notice_id ID of the notice to remove
|
229 |
+
*
|
230 |
+
* @return void
|
231 |
+
*/
|
232 |
+
public function remove_notification( $notice_id ) {
|
233 |
+
if ( array_key_exists( $notice_id, $this->notifications ) ) {
|
234 |
+
unset( $this->notifications[ $notice_id ] );
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Get all registered notifications
|
240 |
+
*
|
241 |
+
* @since 1.3.0
|
242 |
+
* @return array
|
243 |
+
*/
|
244 |
+
public function get_notifications() {
|
245 |
+
return $this->notifications;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Get a specific notification
|
250 |
+
*
|
251 |
+
* @since 1.3.0
|
252 |
+
*
|
253 |
+
* @param string $notice_id ID of the notice to retrieve
|
254 |
+
*
|
255 |
+
* @return bool|array
|
256 |
+
*/
|
257 |
+
public function get_notification( $notice_id ) {
|
258 |
+
|
259 |
+
if ( ! array_key_exists( $notice_id, $this->notifications ) ) {
|
260 |
+
return false;
|
261 |
+
}
|
262 |
+
|
263 |
+
return $this->notifications[ $notice_id ];
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Adds inline style for non standard notices
|
268 |
+
*
|
269 |
+
* This function will only be called if the notice style is not standard.
|
270 |
+
*
|
271 |
+
* @since 0.1.0
|
272 |
+
*/
|
273 |
+
public function style() { ?>
|
274 |
+
<style type="text/css">div.rn-alert{padding:15px 35px 15px 15px;margin-bottom:20px;border:1px solid transparent;-webkit-box-shadow:none;box-shadow:none}div.rn-alert p:empty{display:none}div.rn-alert ol,div.rn-alert ol li,div.rn-alert ul,div.rn-alert ul li{list-style:inherit!important}div.rn-alert ol,div.rn-alert ul{padding-left:30px}div.rn-alert hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}div.rn-alert h1,h2,h3,h4,h5,h6{margin-top:0;color:inherit}div.rn-alert a{font-weight:700}div.rn-alert a:hover{text-decoration:underline}div.rn-alert>p{margin:0;padding:0;line-height:1}div.rn-alert>p,div.rn-alert>ul{margin-bottom:0}div.rn-alert>p+p{margin-top:5px}div.rn-alert .rn-dismiss-btn{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:relative;top:-2px;right:-21px;padding:0;cursor:pointer;background:0;border:0;-webkit-appearance:none;float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20);text-decoration:none}div.rn-alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}div.rn-alert-success hr{border-top-color:#c9e2b3}div.rn-alert-success a{color:#2b542c}div.rn-alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}div.rn-alert-info hr{border-top-color:#a6e1ec}div.rn-alert-info a{color:#245269}div.rn-alert-warning{background-color:#fcf8e3;border-color:#faebcc;color:#8a6d3b}div.rn-alert-warning hr{border-top-color:#f7e1b5}div.rn-alert-warning a{color:#66512c}div.rn-alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#a94442}div.rn-alert-danger hr{border-top-color:#e4b9c0}div.rn-alert-danger a{color:#843534}</style>
|
275 |
+
<?php }
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Display all the registered and available notifications
|
279 |
+
*
|
280 |
+
* @since 1.3.0
|
281 |
+
* @return void
|
282 |
+
*/
|
283 |
+
public function show_notices() {
|
284 |
+
|
285 |
+
foreach ( $this->notifications as $id => $notification ) {
|
286 |
+
|
287 |
+
$rn = $this->get_remote_notification( $notification );
|
288 |
+
|
289 |
+
if ( empty( $rn ) || is_wp_error( $rn ) ) {
|
290 |
+
continue;
|
291 |
+
}
|
292 |
+
|
293 |
+
if ( $this->is_notification_error( $rn ) ) {
|
294 |
+
continue;
|
295 |
+
}
|
296 |
+
|
297 |
+
if ( $this->is_notice_dismissed( $rn->slug ) ) {
|
298 |
+
continue;
|
299 |
+
}
|
300 |
+
|
301 |
+
if ( $this->is_post_type_restricted( $rn ) ) {
|
302 |
+
continue;
|
303 |
+
}
|
304 |
+
|
305 |
+
if ( ! $this->is_notification_started( $rn ) ) {
|
306 |
+
continue;
|
307 |
+
}
|
308 |
+
|
309 |
+
if ( $this->has_notification_ended( $rn ) ) {
|
310 |
+
continue;
|
311 |
+
}
|
312 |
+
|
313 |
+
// Output the admin notice
|
314 |
+
$this->create_admin_notice( $rn->message, $this->get_notice_class( isset( $rn->style ) ? $rn->style : 'updated' ), $this->get_notice_dismissal_url( $rn->slug ) );
|
315 |
+
|
316 |
+
}
|
317 |
+
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Check if the notification has been dismissed
|
322 |
+
*
|
323 |
+
* @since 1.2.0
|
324 |
+
*
|
325 |
+
* @param string $slug Slug of the notice to check
|
326 |
+
*
|
327 |
+
* @return bool
|
328 |
+
*/
|
329 |
+
protected function is_notice_dismissed( $slug ) {
|
330 |
+
|
331 |
+
global $current_user;
|
332 |
+
|
333 |
+
$dismissed = array_filter( (array) get_user_meta( $current_user->ID, '_rn_dismissed', true ) );
|
334 |
+
|
335 |
+
if ( is_array( $dismissed ) && in_array( $slug, $dismissed ) ) {
|
336 |
+
return true;
|
337 |
+
}
|
338 |
+
|
339 |
+
return false;
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Check if the notification can be displayed for the current post type
|
345 |
+
*
|
346 |
+
* @since 1.2.0
|
347 |
+
*
|
348 |
+
* @param stdClass $notification The notification object
|
349 |
+
*
|
350 |
+
* @return bool
|
351 |
+
*/
|
352 |
+
protected function is_post_type_restricted( $notification ) {
|
353 |
+
|
354 |
+
/* If the type array isn't empty we have a limitation */
|
355 |
+
if ( isset( $notification->type ) && is_array( $notification->type ) && ! empty( $notification->type ) ) {
|
356 |
+
|
357 |
+
/* Get current post type */
|
358 |
+
$pt = get_post_type();
|
359 |
+
|
360 |
+
/**
|
361 |
+
* If the current post type can't be retrieved
|
362 |
+
* or if it's not in the allowed post types,
|
363 |
+
* then we don't display the admin notice.
|
364 |
+
*/
|
365 |
+
if ( false === $pt || ! in_array( $pt, $notification->type ) ) {
|
366 |
+
return true;
|
367 |
+
}
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
return false;
|
372 |
+
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Check if the notification has started yet
|
377 |
+
*
|
378 |
+
* @since 1.2.0
|
379 |
+
*
|
380 |
+
* @param stdClass $notification The notification object
|
381 |
+
*
|
382 |
+
* @return bool
|
383 |
+
*/
|
384 |
+
protected function is_notification_started( $notification ) {
|
385 |
+
|
386 |
+
if ( ! isset( $notification->date_start ) ) {
|
387 |
+
return true;
|
388 |
+
}
|
389 |
+
|
390 |
+
if ( empty( $notification->date_start ) || strtotime( $notification->date_start ) < time() ) {
|
391 |
+
return true;
|
392 |
+
}
|
393 |
+
|
394 |
+
return false;
|
395 |
+
|
396 |
+
}
|
397 |
+
|
398 |
+
/**
|
399 |
+
* Check if the notification has expired
|
400 |
+
*
|
401 |
+
* @since 1.2.0
|
402 |
+
*
|
403 |
+
* @param stdClass $notification The notification object
|
404 |
+
*
|
405 |
+
* @return bool
|
406 |
+
*/
|
407 |
+
protected function has_notification_ended( $notification ) {
|
408 |
+
|
409 |
+
if ( ! isset( $notification->date_end ) ) {
|
410 |
+
return false;
|
411 |
+
}
|
412 |
+
|
413 |
+
if ( empty( $notification->date_end ) || strtotime( $notification->date_end ) > time() ) {
|
414 |
+
return false;
|
415 |
+
}
|
416 |
+
|
417 |
+
return true;
|
418 |
+
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Get the remote notification object
|
423 |
+
*
|
424 |
+
* @since 1.3.0
|
425 |
+
*
|
426 |
+
* @param array $notification The notification data array
|
427 |
+
*
|
428 |
+
* @return object|false
|
429 |
+
*/
|
430 |
+
protected function get_remote_notification( $notification ) {
|
431 |
+
|
432 |
+
$content = get_transient( 'rn_last_notification_' . $notification['notice_id'] );
|
433 |
+
|
434 |
+
if ( false === $content ) {
|
435 |
+
add_option( 'rdn_fetch_' . $notification['notice_id'], 'fetch' );
|
436 |
+
}
|
437 |
+
|
438 |
+
return $content;
|
439 |
+
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Get the admin notice class attribute
|
444 |
+
*
|
445 |
+
* @since 1.3.0
|
446 |
+
*
|
447 |
+
* @param string $style Notification style
|
448 |
+
*
|
449 |
+
* @return string
|
450 |
+
*/
|
451 |
+
protected function get_notice_class( $style ) {
|
452 |
+
|
453 |
+
switch ( $style ) {
|
454 |
+
case 'updated':
|
455 |
+
$class = $style;
|
456 |
+
break;
|
457 |
+
|
458 |
+
case 'error':
|
459 |
+
$class = 'updated error';
|
460 |
+
break;
|
461 |
+
|
462 |
+
default:
|
463 |
+
$class = "updated rn-alert rn-alert-$style";
|
464 |
+
}
|
465 |
+
|
466 |
+
return $class;
|
467 |
+
|
468 |
+
}
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Prepare the dismissal URL for the notice
|
472 |
+
*
|
473 |
+
* @since 1.3.0
|
474 |
+
*
|
475 |
+
* @param string $slug Notice slug
|
476 |
+
*
|
477 |
+
* @return string
|
478 |
+
*/
|
479 |
+
protected function get_notice_dismissal_url( $slug ) {
|
480 |
+
|
481 |
+
$args = $_GET;
|
482 |
+
$args['rn'] = wp_create_nonce( 'rn-dismiss' );
|
483 |
+
$args['notification'] = trim( $slug );
|
484 |
+
|
485 |
+
return esc_url( add_query_arg( $args, '' ) );
|
486 |
+
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Create the actual admin notice
|
491 |
+
*
|
492 |
+
* @since 1.3.0
|
493 |
+
*
|
494 |
+
* @param string $contents Notice contents
|
495 |
+
* @param string $class Wrapper class
|
496 |
+
* @param string $dismiss Dismissal link
|
497 |
+
*
|
498 |
+
* @return void
|
499 |
+
*/
|
500 |
+
protected function create_admin_notice( $contents, $class, $dismiss ) { ?>
|
501 |
+
<div class="<?php echo $class; ?>">
|
502 |
+
<a href="<?php echo $dismiss; ?>" id="rn-dismiss" class="rn-dismiss-btn" title="<?php _e( 'Dismiss notification', 'remote-notifications' ); ?>">×</a>
|
503 |
+
<p><?php echo html_entity_decode( $contents ); ?></p>
|
504 |
+
</div>
|
505 |
+
<?php }
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Dismiss notice
|
509 |
+
*
|
510 |
+
* When the user dismisses a notice, its slug
|
511 |
+
* is added to the _rn_dismissed entry in the DB options table.
|
512 |
+
* This entry is then used to check if a notie has been dismissed
|
513 |
+
* before displaying it on the dashboard.
|
514 |
+
*
|
515 |
+
* @since 0.1.0
|
516 |
+
*/
|
517 |
+
public function dismiss() {
|
518 |
+
|
519 |
+
global $current_user;
|
520 |
+
|
521 |
+
/* Check if we have all the vars */
|
522 |
+
if ( ! isset( $_GET['rn'] ) || ! isset( $_GET['notification'] ) ) {
|
523 |
+
return;
|
524 |
+
}
|
525 |
+
|
526 |
+
/* Validate nonce */
|
527 |
+
if ( ! wp_verify_nonce( sanitize_key( $_GET['rn'] ), 'rn-dismiss' ) ) {
|
528 |
+
return;
|
529 |
+
}
|
530 |
+
|
531 |
+
/* Get dismissed list */
|
532 |
+
$dismissed = array_filter( (array) get_user_meta( $current_user->ID, '_rn_dismissed', true ) );
|
533 |
+
|
534 |
+
/* Add the current notice to the list if needed */
|
535 |
+
if ( is_array( $dismissed ) && ! in_array( $_GET['notification'], $dismissed ) ) {
|
536 |
+
array_push( $dismissed, $_GET['notification'] );
|
537 |
+
}
|
538 |
+
|
539 |
+
/* Update option */
|
540 |
+
update_user_meta( $current_user->ID, '_rn_dismissed', $dismissed );
|
541 |
+
|
542 |
+
}
|
543 |
+
|
544 |
+
/**
|
545 |
+
* Adds the script that hooks into the Heartbeat API
|
546 |
+
*
|
547 |
+
* @since 1.3.0
|
548 |
+
* @return void
|
549 |
+
*/
|
550 |
+
public function script() {
|
551 |
+
|
552 |
+
$maybe_fetch = array();
|
553 |
+
|
554 |
+
foreach ( $this->get_notifications() as $id => $n ) {
|
555 |
+
$maybe_fetch[] = (string) $id;
|
556 |
+
} ?>
|
557 |
+
|
558 |
+
<script type="text/javascript">
|
559 |
+
jQuery(document).ready(function ($) {
|
560 |
+
|
561 |
+
// Hook into the heartbeat-send
|
562 |
+
$(document).on('heartbeat-send', function (e, data) {
|
563 |
+
data['rdn_maybe_fetch'] = <?php echo json_encode( $maybe_fetch ); ?>;
|
564 |
+
});
|
565 |
+
|
566 |
+
// Listen for the custom event "heartbeat-tick" on $(document).
|
567 |
+
$(document).on('heartbeat-tick', function (e, data) {
|
568 |
+
|
569 |
+
if (data.rdn_fetch !== '') {
|
570 |
+
|
571 |
+
ajax_data = {
|
572 |
+
'action': 'rdn_fetch_notifications',
|
573 |
+
'notices': data.rdn_fetch
|
574 |
+
};
|
575 |
+
|
576 |
+
$.post(ajaxurl, ajax_data);
|
577 |
+
|
578 |
+
}
|
579 |
+
|
580 |
+
});
|
581 |
+
});
|
582 |
+
</script>
|
583 |
+
|
584 |
+
<?php }
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Hook into the Heartbeat API.
|
588 |
+
*
|
589 |
+
* @since 1.3.0
|
590 |
+
*
|
591 |
+
* @param array $response Heartbeat tick response
|
592 |
+
* @param array $data Heartbeat tick data
|
593 |
+
*
|
594 |
+
* @return array Updated Heartbeat tick response
|
595 |
+
*/
|
596 |
+
function heartbeat( $response, $data ) {
|
597 |
+
|
598 |
+
if ( isset( $data['rdn_maybe_fetch'] ) ) {
|
599 |
+
|
600 |
+
$notices = $data['rdn_maybe_fetch'];
|
601 |
+
|
602 |
+
if ( ! is_array( $notices ) ) {
|
603 |
+
$notices = array( $notices );
|
604 |
+
}
|
605 |
+
|
606 |
+
foreach ( $notices as $notice_id ) {
|
607 |
+
|
608 |
+
$fetch = get_option( "rdn_fetch_$notice_id", false );
|
609 |
+
|
610 |
+
if ( 'fetch' === $fetch ) {
|
611 |
+
|
612 |
+
if ( ! isset( $response['rdn_fetch'] ) ) {
|
613 |
+
$response['rdn_fetch'] = array();
|
614 |
+
}
|
615 |
+
|
616 |
+
$response['rdn_fetch'][] = $notice_id;
|
617 |
+
|
618 |
+
}
|
619 |
+
|
620 |
+
}
|
621 |
+
|
622 |
+
}
|
623 |
+
|
624 |
+
return $response;
|
625 |
+
|
626 |
+
}
|
627 |
+
|
628 |
+
/**
|
629 |
+
* Triggers the remote requests that fetches notices for this particular instance
|
630 |
+
*
|
631 |
+
* @since 1.3.0
|
632 |
+
* @return void
|
633 |
+
*/
|
634 |
+
public function remote_get_notice_ajax() {
|
635 |
+
|
636 |
+
if ( isset( $_POST['notices'] ) ) {
|
637 |
+
$notices = $_POST['notices'];
|
638 |
+
} else {
|
639 |
+
echo 'No notice ID';
|
640 |
+
die();
|
641 |
+
}
|
642 |
+
|
643 |
+
if ( ! is_array( $notices ) ) {
|
644 |
+
$notices = array( $notices );
|
645 |
+
}
|
646 |
+
|
647 |
+
foreach ( $notices as $notice_id ) {
|
648 |
+
|
649 |
+
$notification = $this->get_notification( $notice_id );
|
650 |
+
$rn = $this->remote_get_notification( $notification );
|
651 |
+
|
652 |
+
if ( is_wp_error( $rn ) ) {
|
653 |
+
echo $rn->get_error_message();
|
654 |
+
} else {
|
655 |
+
echo json_encode( $rn );
|
656 |
+
}
|
657 |
+
|
658 |
+
}
|
659 |
+
|
660 |
+
die();
|
661 |
+
|
662 |
+
}
|
663 |
+
|
664 |
+
/**
|
665 |
+
* Get the remote server URL
|
666 |
+
*
|
667 |
+
* @since 1.2.0
|
668 |
+
*
|
669 |
+
* @param string $url THe server URL to sanitize
|
670 |
+
*
|
671 |
+
* @return string
|
672 |
+
*/
|
673 |
+
protected function get_remote_url( $url ) {
|
674 |
+
|
675 |
+
$url = explode( '?', $url );
|
676 |
+
|
677 |
+
return esc_url( $url[0] );
|
678 |
+
|
679 |
+
}
|
680 |
+
|
681 |
+
/**
|
682 |
+
* Maybe get a notification from the remote server
|
683 |
+
*
|
684 |
+
* @since 1.2.0
|
685 |
+
*
|
686 |
+
* @param array $notification The notification data array
|
687 |
+
*
|
688 |
+
* @return string|WP_Error
|
689 |
+
*/
|
690 |
+
protected function remote_get_notification( $notification ) {
|
691 |
+
|
692 |
+
/* Query the server */
|
693 |
+
$response = wp_remote_get( $this->build_query_url( $notification['server_url'], $this->get_payload( $notification ) ), array( 'timeout' => apply_filters( 'rn_http_request_timeout', 5 ) ) );
|
694 |
+
|
695 |
+
/* If we have a WP_Error object we abort */
|
696 |
+
if ( is_wp_error( $response ) ) {
|
697 |
+
return $response;
|
698 |
+
}
|
699 |
+
|
700 |
+
if ( 200 !== (int) wp_remote_retrieve_response_code( $response ) ) {
|
701 |
+
return new WP_Error( 'invalid_response', sprintf( __( 'The server response was invalid (code %s)', 'remote-notifications' ), wp_remote_retrieve_response_code( $response ) ) );
|
702 |
+
}
|
703 |
+
|
704 |
+
$body = wp_remote_retrieve_body( $response );
|
705 |
+
|
706 |
+
if ( empty( $body ) ) {
|
707 |
+
return new WP_Error( 'empty_response', __( 'The server response is empty', 'remote-notifications' ) );
|
708 |
+
}
|
709 |
+
|
710 |
+
$body = json_decode( $body );
|
711 |
+
|
712 |
+
if ( is_null( $body ) ) {
|
713 |
+
return new WP_Error( 'json_decode_error', __( 'Cannot decode the response content', 'remote-notifications' ) );
|
714 |
+
}
|
715 |
+
|
716 |
+
set_transient( 'rn_last_notification_' . $notification['notice_id'], $body, $notification['cache_lifetime'] * 60 * 60 );
|
717 |
+
delete_option( 'rdn_fetch_' . $notification['notice_id'] );
|
718 |
+
|
719 |
+
if ( $this->is_notification_error( $body ) ) {
|
720 |
+
return new WP_Error( 'notification_error', $this->get_notification_error_message( $body ) );
|
721 |
+
}
|
722 |
+
|
723 |
+
return $body;
|
724 |
+
|
725 |
+
}
|
726 |
+
|
727 |
+
/**
|
728 |
+
* Check if the notification returned by the server is an error
|
729 |
+
*
|
730 |
+
* @since 1.2.0
|
731 |
+
*
|
732 |
+
* @param object $notification Notification returned
|
733 |
+
*
|
734 |
+
* @return bool
|
735 |
+
*/
|
736 |
+
protected function is_notification_error( $notification ) {
|
737 |
+
|
738 |
+
if ( false === $this->get_notification_error_message( $notification ) ) {
|
739 |
+
return false;
|
740 |
+
}
|
741 |
+
|
742 |
+
return true;
|
743 |
+
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Get the error message returned by the remote server
|
748 |
+
*
|
749 |
+
* @since 1.2.0
|
750 |
+
*
|
751 |
+
* @param object $notification Notification returned
|
752 |
+
*
|
753 |
+
* @return bool|string
|
754 |
+
*/
|
755 |
+
protected function get_notification_error_message( $notification ) {
|
756 |
+
|
757 |
+
if ( ! is_object( $notification ) ) {
|
758 |
+
return false;
|
759 |
+
}
|
760 |
+
|
761 |
+
if ( ! isset( $notification->error ) ) {
|
762 |
+
return false;
|
763 |
+
}
|
764 |
+
|
765 |
+
return sanitize_text_field( $notification->error );
|
766 |
+
|
767 |
+
}
|
768 |
+
|
769 |
+
/**
|
770 |
+
* Get the payload required for querying the remote server
|
771 |
+
*
|
772 |
+
* @since 1.2.0
|
773 |
+
*
|
774 |
+
* @param array $notification The notification data array
|
775 |
+
*
|
776 |
+
* @return string
|
777 |
+
*/
|
778 |
+
protected function get_payload( $notification ) {
|
779 |
+
return base64_encode( json_encode( array(
|
780 |
+
'channel' => $notification['channel_id'],
|
781 |
+
'key' => $notification['channel_key']
|
782 |
+
) ) );
|
783 |
+
}
|
784 |
+
|
785 |
+
/**
|
786 |
+
* Get the full URL used for the remote get
|
787 |
+
*
|
788 |
+
* @since 1.2.0
|
789 |
+
*
|
790 |
+
* @param string $url The remote server URL
|
791 |
+
* @param string $payload The encoded payload
|
792 |
+
*
|
793 |
+
* @return string
|
794 |
+
*/
|
795 |
+
protected function build_query_url( $url, $payload ) {
|
796 |
+
return add_query_arg( array(
|
797 |
+
'post_type' => 'notification',
|
798 |
+
'payload' => $payload
|
799 |
+
), $this->get_remote_url( $url ) );
|
800 |
+
}
|
801 |
+
|
802 |
+
}
|
803 |
+
|
804 |
+
}
|
805 |
+
|
806 |
+
/**
|
807 |
+
* The main function responsible for returning the unique RDN client
|
808 |
+
*
|
809 |
+
* Use this function like you would a global variable, except without needing
|
810 |
+
* to declare the global.
|
811 |
+
*
|
812 |
+
* @since 1.3.0
|
813 |
+
* @return object Remote_Dashboard_Notifications_Client
|
814 |
+
*/
|
815 |
+
function RDNC() {
|
816 |
+
return Remote_Dashboard_Notifications_Client::instance();
|
817 |
+
}
|
818 |
+
|
819 |
+
// Get Awesome Support Running
|
820 |
+
RDNC();
|
821 |
+
|
822 |
+
/**
|
823 |
+
* Register a new remote notification
|
824 |
+
*
|
825 |
+
* Helper function for registering new notifications through the Remote_Dashboard_Notifications_Client class
|
826 |
+
*
|
827 |
+
* @since 1.3.0
|
828 |
+
*
|
829 |
+
* @param int $channel_id Channel ID on the remote server
|
830 |
+
* @param string $channel_key Channel key for authentication with the server
|
831 |
+
* @param string $server Notification server URL
|
832 |
+
* @param int $cache Cache lifetime (in hours)
|
833 |
+
*
|
834 |
+
* @return bool|string
|
835 |
+
*/
|
836 |
+
function rdnc_add_notification( $channel_id, $channel_key, $server, $cache = 6 ) {
|
837 |
+
return RDNC()->add_notification( $channel_id, $channel_key, $server, $cache );
|
838 |
+
}
|
839 |
+
|
840 |
+
if ( ! class_exists( 'TAV_Remote_Notification_Client' ) ) {
|
841 |
+
|
842 |
+
/**
|
843 |
+
* Class TAV_Remote_Notification_Client
|
844 |
+
*
|
845 |
+
* This class, even though deprecated, is kept here for backwards compatibility. It is now just a wrapper for the new notification registration method.
|
846 |
+
*
|
847 |
+
* @deprecated @1.3.0
|
848 |
+
*/
|
849 |
+
class TAV_Remote_Notification_Client {
|
850 |
+
|
851 |
+
public function __construct( $channel_id = false, $channel_key = false, $server = false ) {
|
852 |
+
rdnc_add_notification( $channel_id, $channel_key, $server );
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
}
|
include/get-premium.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo '<a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/" style="font-size: 26px;"> Buy Now $29 </a>'; ?>
|
include/settings.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- <h2 class="nav-tab-wrapper">
|
2 |
+
<a class="nav-tab nav-tab-active" href="<?php //echo admin_url( 'admin.php?page=loginpress-settings' ) ?>">Settings</a>
|
3 |
+
<a class="nav-tab" href="<?php //echo admin_url( 'admin.php?page=loginpress-settings&get-premium=loginpress' ) ?>">Premium Version</a>
|
4 |
+
</h2> -->
|
5 |
+
|
6 |
+
<h2>LoginPress Settings</h2>
|
7 |
+
<div id="normal-sortables" class="meta-box-sortables wpbrigade-videobox-wrapper">
|
8 |
+
<!-- <div id="wpbrigade_infs_general_videobox" class="postbox">
|
9 |
+
<h3><span>Upgrade to the PREMIUM VERSION</span></h3>
|
10 |
+
<div class="inside">
|
11 |
+
<div class="wpbrigade_videobox">
|
12 |
+
<div class="column"><span class="wpbrigade-heading">Discover the Advanced Features</span>
|
13 |
+
<a class="wpbrigade-video-link" href="#" data-video-id="wpbrigade-video-iframe">
|
14 |
+
<img src="<?php echo LOGINPRESS_DIR_URL . 'img/dummy.jpg' ?>">
|
15 |
+
</a>
|
16 |
+
<div class="wpbrigade-video-description-wrapper">
|
17 |
+
<p class="wpbrigade-video-description">LonginPress Pro</p>
|
18 |
+
<p>Upgrade to the PREMIUM VERSION of LonginPress to benefit from all features!</p>
|
19 |
+
</div>
|
20 |
+
</div>
|
21 |
+
<div class="column right">
|
22 |
+
<span class="wpbrigade-heading">Get Support and Pro Features?</span>
|
23 |
+
|
24 |
+
<p>Our free version works superb as there are awesome reviews coming all the way. If you want to support our development, I will highly recommend to buy our Pro version</p>
|
25 |
+
|
26 |
+
<p>
|
27 |
+
<a class="button-primary" href="" target="_blank">Get Support and Pro Features</a>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
</div> -->
|
33 |
+
</div>
|
34 |
+
<div class="wpbrigade-video-popup-overlay" id="wpbrigade-video-iframe">
|
35 |
+
<div class="wpbrigade-video-popup">
|
36 |
+
<span class="dashicons dashicons-no-alt wpbrigade-close-popup"></span>
|
37 |
+
<div class="wpbrigade-video-wrapper">
|
38 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/GMAwsHomJlE" frameborder="0" allowfullscreen></iframe>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</div>
|
js/admin-custom.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
$(function() {
|
5 |
+
// Code to fire when the DOM is ready.
|
6 |
+
$('.wpbrigade-video-link').on('click', function (e) {
|
7 |
+
e.preventDefault();
|
8 |
+
var target = $(this).data('video-id');
|
9 |
+
$('#'+target).fadeIn();
|
10 |
+
});
|
11 |
+
$('.wpbrigade-close-popup').on('click', function (e) {
|
12 |
+
$(this).parent().parent().fadeOut();
|
13 |
+
$('.wpbrigade-video-wrapper iframe').attr('src', 'https://www.youtube.com/embed/GMAwsHomJlE');
|
14 |
+
});
|
15 |
+
});
|
16 |
+
|
17 |
+
})( jQuery ); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
|
js/customize-controls.js
CHANGED
@@ -104,6 +104,7 @@ var change_theme;
|
|
104 |
|
105 |
change_theme = loginPressVal;
|
106 |
|
|
|
107 |
} );
|
108 |
} );
|
109 |
|
@@ -179,76 +180,281 @@ var change_theme;
|
|
179 |
function loginpress_customizer_bg( customizer_bg ) {
|
180 |
|
181 |
if ( 'default1' == customizer_bg ) {
|
182 |
-
loginpress_bg = 'url(' +
|
183 |
-
|
184 |
} else if ( 'default2' == customizer_bg ) {
|
185 |
-
loginpress_bg = 'url(' +
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
}
|
188 |
|
189 |
-
// LoginPress Background Image Control.
|
190 |
wp.customize( 'loginpress_customization[loginpress_display_bg]', function( value ) {
|
191 |
-
|
192 |
-
customizer_bg = change_theme ? change_theme : login_theme;
|
193 |
-
var bg = $('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image' );
|
194 |
-
|
195 |
-
if( loginPressVal == false ) {
|
196 |
|
197 |
-
|
|
|
198 |
|
199 |
-
|
|
|
|
|
200 |
}
|
201 |
-
$('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', 'none' );
|
202 |
-
$('#customize-control-setting_background').hide();
|
203 |
-
$('#customize-control-background_repeat_radio').hide();
|
204 |
-
$('#customize-control-background_image_size').hide();
|
205 |
-
} else {
|
206 |
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
-
|
210 |
-
console.log('bg1');
|
211 |
|
212 |
-
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
-
loginpress_bg = 'url(' + localStorage.loginpress_bg + ')';
|
219 |
-
console.log('bg3');
|
220 |
} else {
|
221 |
|
222 |
-
|
223 |
-
console.log('bg4');
|
224 |
-
}
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
// LoginPress Background instant change.
|
235 |
wp.customize( 'loginpress_customization[setting_background]', function( value ) {
|
236 |
value.bind( function( loginPressVal ) {
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
if( loginPressVal == '' ) {
|
239 |
if ( localStorage.loginpress_bg ) {
|
240 |
localStorage.removeItem("loginpress_bg");
|
241 |
}
|
242 |
|
243 |
loginpress_customizer_bg( customizer_bg );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
-
|
|
|
|
|
|
|
246 |
} else {
|
247 |
|
248 |
if ( ! localStorage.loginpress_bg ) {
|
249 |
localStorage.setItem( "loginpress_bg", loginPressVal );
|
250 |
}
|
251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
|
254 |
} );
|
@@ -268,7 +474,7 @@ var change_theme;
|
|
268 |
value.bind( function( loginPressVal ) {
|
269 |
|
270 |
if( loginPressVal == '' ) {
|
271 |
-
$('#customize-preview iframe').contents().find('#login h1 a').css( 'background-image', 'url(' + admin_url
|
272 |
} else {
|
273 |
$('#customize-preview iframe').contents().find('#login h1 a').css( 'background-image', 'url(' + loginPressVal + ')' );
|
274 |
}
|
@@ -605,7 +811,8 @@ var change_theme;
|
|
605 |
|
606 |
|
607 |
$(window).on('load', function(){
|
608 |
-
|
|
|
609 |
if ($('#customize-control-loginpress_display_bg input[type="checkbox"]').is(":checked") ) {
|
610 |
$('#customize-control-setting_background').show();
|
611 |
$('#customize-control-background_repeat_radio').show();
|
@@ -615,5 +822,8 @@ var change_theme;
|
|
615 |
$('#customize-control-background_repeat_radio').hide();
|
616 |
$('#customize-control-background_image_size').hide();
|
617 |
}
|
|
|
|
|
618 |
});
|
|
|
619 |
} )( jQuery );
|
104 |
|
105 |
change_theme = loginPressVal;
|
106 |
|
107 |
+
|
108 |
} );
|
109 |
} );
|
110 |
|
180 |
function loginpress_customizer_bg( customizer_bg ) {
|
181 |
|
182 |
if ( 'default1' == customizer_bg ) {
|
183 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress/img/bg.jpg)';
|
|
|
184 |
} else if ( 'default2' == customizer_bg ) {
|
185 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress/img/bg2.jpg)';
|
186 |
+
} else if ( 'default3' == customizer_bg ) {
|
187 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg3.jpg)';
|
188 |
+
} else if ( 'default4' == customizer_bg ) {
|
189 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg4.jpg)';
|
190 |
+
} else if ( 'default5' == customizer_bg ) {
|
191 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg5.jpg)';
|
192 |
+
} else if ( 'default6' == customizer_bg ) {
|
193 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg6.jpg)';
|
194 |
+
} else if ( 'default7' == customizer_bg ) {
|
195 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg7.jpg)';
|
196 |
+
} else if ( 'default8' == customizer_bg ) {
|
197 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg8.jpg)';
|
198 |
+
} else if ( 'default9' == customizer_bg ) {
|
199 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg9.jpg)';
|
200 |
+
} else if ( 'default10' == customizer_bg ) {
|
201 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg10.jpg)';
|
202 |
+
} else if ( 'default11' == customizer_bg ) {
|
203 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg11.png)';
|
204 |
+
} else if ( 'default12' == customizer_bg ) {
|
205 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg12.jpg)';
|
206 |
+
} else if ( 'default13' == customizer_bg ) {
|
207 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg13.jpg)';
|
208 |
+
} else if ( 'default14' == customizer_bg ) {
|
209 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg14.jpg)';
|
210 |
+
} else if ( 'default15' == customizer_bg ) {
|
211 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg15.jpg)';
|
212 |
+
} else if ( 'default16' == customizer_bg ) {
|
213 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg16.jpg)';
|
214 |
+
} else if ( 'default17' == customizer_bg ) {
|
215 |
+
loginpress_bg = 'url(' + loginpress_script.plugin_url + '/loginpress-pro/img/bg17.jpg)';
|
216 |
}
|
217 |
}
|
218 |
|
|
|
219 |
wp.customize( 'loginpress_customization[loginpress_display_bg]', function( value ) {
|
220 |
+
value.bind( function( loginPressVal ) {
|
|
|
|
|
|
|
|
|
221 |
|
222 |
+
// Check the theme id.
|
223 |
+
customizer_bg = change_theme ? change_theme : loginpress_script.login_theme;
|
224 |
|
225 |
+
// Set custom style on customizer.
|
226 |
+
if ( $('#customize-preview iframe').contents().find('#loginpress-customize').length == 0 ) {
|
227 |
+
$("<style type='text/css' id='loginpress-customize'></style>").appendTo($('#customize-preview iframe').contents().find('head'));
|
228 |
}
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
+
// Set conditions on behalf on themes.
|
231 |
+
if( loginPressVal == false ) {
|
232 |
+
|
233 |
+
if ( 'default6' == customizer_bg ) {
|
234 |
+
|
235 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: none}");
|
236 |
+
|
237 |
+
} else if ( 'default8' == customizer_bg ) {
|
238 |
|
239 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("body.login::after{background: none}");
|
|
|
240 |
|
241 |
+
} else if ( 'default10' == customizer_bg ) {
|
242 |
|
243 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: none}");
|
244 |
+
|
245 |
+
} else if ( 'default17' == customizer_bg ) {
|
246 |
+
|
247 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login{background: none}");
|
248 |
+
|
249 |
+
} else {
|
250 |
+
$('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', 'none' );
|
251 |
+
}
|
252 |
+
|
253 |
+
$('#customize-control-setting_background').hide();
|
254 |
+
$('#customize-control-background_image_size').hide();
|
255 |
+
$('#customize-control-background_repeat_radio').hide();
|
256 |
|
|
|
|
|
257 |
} else {
|
258 |
|
259 |
+
if ( localStorage.loginpress_bg ) {
|
|
|
|
|
260 |
|
261 |
+
loginpress_bg_ = 'url(' + localStorage.loginpress_bg + ')';
|
262 |
+
|
263 |
+
if ( 'default6' == customizer_bg ) {
|
264 |
+
|
265 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: "+loginpress_bg_+"}");
|
266 |
+
|
267 |
+
} else if ( 'default8' == customizer_bg ) {
|
268 |
+
|
269 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("body.login::after{background: "+loginpress_bg_+" no-repeat 0 0; background-size: cover}");
|
270 |
+
|
271 |
+
} else if ( 'default10' == customizer_bg ) {
|
272 |
+
|
273 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: "+loginpress_bg_+"}");
|
274 |
+
|
275 |
+
} else if ( 'default17' == customizer_bg ) {
|
276 |
+
|
277 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login{background: "+loginpress_bg_+" no-repeat 0 0;}");
|
278 |
+
|
279 |
+
} else {
|
280 |
+
|
281 |
+
$('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', loginpress_bg_ )
|
282 |
+
}
|
283 |
+
|
284 |
+
} else if ( loginpress_script.loginpress_bg_url == true ){
|
285 |
+
|
286 |
+
if ( 'default6' == customizer_bg ) {
|
287 |
+
|
288 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: " + loginpress_script.loginpress_bg_url + "}");
|
289 |
+
|
290 |
+
} else if ( 'default8' == customizer_bg ) {
|
291 |
+
|
292 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("body.login::after{background: " + loginpress_script.loginpress_bg_url + " no-repeat 0 0; background-size: cover}");
|
293 |
+
|
294 |
+
} else if ( 'default10' == customizer_bg ) {
|
295 |
+
|
296 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: " + loginpress_script.loginpress_bg_url + "}");
|
297 |
+
|
298 |
+
} else if ( 'default17' == customizer_bg ) {
|
299 |
+
|
300 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login{background: " + loginpress_script.loginpress_bg_url + " no-repeat 0 0;}");
|
301 |
+
|
302 |
+
} else {
|
303 |
+
$('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', 'url(' + loginpress_script.loginpress_bg_url + ')' );
|
304 |
+
}
|
305 |
+
} else {
|
306 |
+
|
307 |
+
loginpress_customizer_bg( customizer_bg );
|
308 |
+
if ( 'default6' == customizer_bg ) {
|
309 |
+
|
310 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: " + loginpress_bg + "}");
|
311 |
+
|
312 |
+
} else if ( 'default8' == customizer_bg ) {
|
313 |
+
|
314 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("body.login::after{background: " + loginpress_bg + " no-repeat 0 0; background-size: cover}");
|
315 |
+
|
316 |
+
} else if ( 'default10' == customizer_bg ) {
|
317 |
+
|
318 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: " + loginpress_bg + "}");
|
319 |
+
|
320 |
+
} else if ( 'default17' == customizer_bg ) {
|
321 |
+
|
322 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#logi{background: " + loginpress_bg + " no-repeat 0 0;}");
|
323 |
+
|
324 |
+
} else {
|
325 |
+
$('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', loginpress_bg );
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
$('#customize-control-setting_background').show();
|
330 |
+
$('#customize-control-background_image_size').show();
|
331 |
+
$('#customize-control-background_repeat_radio').show();
|
332 |
+
|
333 |
+
} // endif; conditions on behalf on themes.
|
334 |
+
} );
|
335 |
} );
|
336 |
+
// LoginPress Background Image Control.
|
337 |
+
// wp.customize( 'loginpress_customization[loginpress_display_bg]', function( value ) {
|
338 |
+
// value.bind( function( loginPressVal ) {
|
339 |
+
// customizer_bg = change_theme ? change_theme : loginpress_script.login_theme;
|
340 |
+
//
|
341 |
+
// var bg = $('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image' );
|
342 |
+
// console.log(bg);
|
343 |
+
// if( loginPressVal == false ) {
|
344 |
+
//
|
345 |
+
// if ( ! localStorage.loginpress_bg_check ) {
|
346 |
+
//
|
347 |
+
// localStorage.setItem( "loginpress_bg_check", bg );
|
348 |
+
// }
|
349 |
+
//
|
350 |
+
// if ( 'default6' == customizer_bg ) {
|
351 |
+
// //Q ki hoya ?
|
352 |
+
// console.log('bg of default6 is gone off');
|
353 |
+
// // $('#customize-preview iframe').contents().find( '#login::after' ).appendTo( 'background-image', 'none' );
|
354 |
+
// $("<style type='text/css'>#login::after{background-image: none}</style>").appendTo($('#customize-preview iframe').contents().find('head'));
|
355 |
+
// } else {
|
356 |
+
// console.log('bg gone off');
|
357 |
+
// $('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', 'none' );
|
358 |
+
// }
|
359 |
+
// $('#customize-control-setting_background').hide();
|
360 |
+
// $('#customize-control-background_repeat_radio').hide();
|
361 |
+
// $('#customize-control-background_image_size').hide();
|
362 |
+
// } else {
|
363 |
+
//
|
364 |
+
// if ( localStorage.getItem("loginpress_bg") === null && localStorage.loginpress_bg_check ) {
|
365 |
+
//
|
366 |
+
// loginpress_bg = localStorage.loginpress_bg_check;
|
367 |
+
// console.log('bg1');
|
368 |
+
//
|
369 |
+
// } else if ( localStorage.getItem("loginpress_bg") === null ) {
|
370 |
+
//
|
371 |
+
// loginpress_customizer_bg( customizer_bg );
|
372 |
+
// console.log('bg2');
|
373 |
+
// } else if ( localStorage.loginpress_bg ) {
|
374 |
+
//
|
375 |
+
// loginpress_bg = 'url(' + localStorage.loginpress_bg + ')';
|
376 |
+
// console.log('bg3');
|
377 |
+
// } else {
|
378 |
+
//
|
379 |
+
// loginpress_bg = localStorage.loginpress_bg_check;
|
380 |
+
// console.log('bg4');
|
381 |
+
// }
|
382 |
+
//
|
383 |
+
// if ( 'default6' == customizer_bg ) {
|
384 |
+
// console.log('true default6 bg');
|
385 |
+
// console.log(loginpress_bg);
|
386 |
+
// // $('#customize-preview iframe').contents().find( '#login::after' ).appendTo( 'background-image', loginpress_bg );
|
387 |
+
// $("<style type='text/css'>#login::after{background-image: "+loginpress_bg+"}</style>").appendTo($('#customize-preview iframe').contents().find('head'));
|
388 |
+
// } else {
|
389 |
+
// console.log('true bg');
|
390 |
+
// console.log(loginpress_bg);
|
391 |
+
// $('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', loginpress_bg );
|
392 |
+
// }
|
393 |
+
// // $('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', loginpress_bg );
|
394 |
+
// $('#customize-control-setting_background').show();
|
395 |
+
// $('#customize-control-background_repeat_radio').show();
|
396 |
+
// $('#customize-control-background_image_size').show();
|
397 |
+
// }
|
398 |
+
// } );
|
399 |
+
// } );
|
400 |
|
401 |
// LoginPress Background instant change.
|
402 |
wp.customize( 'loginpress_customization[setting_background]', function( value ) {
|
403 |
value.bind( function( loginPressVal ) {
|
404 |
+
|
405 |
+
customizer_bg = change_theme ? change_theme : loginpress_script.login_theme;
|
406 |
+
|
407 |
+
if ( $('#customize-preview iframe').contents().find('#loginpress-customize').length == 0 ) {
|
408 |
+
$("<style type='text/css' id='loginpress-customize'></style>").appendTo($('#customize-preview iframe').contents().find('head'));
|
409 |
+
}
|
410 |
+
|
411 |
if( loginPressVal == '' ) {
|
412 |
if ( localStorage.loginpress_bg ) {
|
413 |
localStorage.removeItem("loginpress_bg");
|
414 |
}
|
415 |
|
416 |
loginpress_customizer_bg( customizer_bg );
|
417 |
+
if ( 'default6' == customizer_bg ) {
|
418 |
+
|
419 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: " + loginpress_bg + "}");
|
420 |
+
} else if ( 'default8' == customizer_bg ) {
|
421 |
+
|
422 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("body.login::after{background: " + loginpress_bg + " no-repeat 0 0; background-size: cover}");
|
423 |
+
} else if ( 'default10' == customizer_bg ) {
|
424 |
+
|
425 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: " + loginpress_bg + "}");
|
426 |
+
} else if ( 'default17' == customizer_bg ) {
|
427 |
|
428 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login{background: " + loginpress_bg + " no-repeat 0 0;}");
|
429 |
+
} else {
|
430 |
+
$('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', loginpress_bg );
|
431 |
+
}
|
432 |
} else {
|
433 |
|
434 |
if ( ! localStorage.loginpress_bg ) {
|
435 |
localStorage.setItem( "loginpress_bg", loginPressVal );
|
436 |
}
|
437 |
+
|
438 |
+
if ( 'default6' == customizer_bg ) {
|
439 |
+
|
440 |
+
// console.log(loginPressVal);
|
441 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: url(" + loginPressVal + ")}");
|
442 |
+
} else if ( 'default8' == customizer_bg ) {
|
443 |
+
|
444 |
+
// console.log(loginPressVal);
|
445 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("body.login::after{background: url(" + loginPressVal + ") no-repeat 0 0; background-size: cover}");
|
446 |
+
} else if ( 'default10' == customizer_bg ) {
|
447 |
+
|
448 |
+
// console.log(loginPressVal);
|
449 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login::after{background-image: url(" + loginPressVal + ")}");
|
450 |
+
} else if ( 'default17' == customizer_bg ) {
|
451 |
+
|
452 |
+
// console.log(loginPressVal);
|
453 |
+
$('#customize-preview iframe').contents().find('#loginpress-customize').html("#login{background: url(" + loginPressVal + ") no-repeat 0 0;}");
|
454 |
+
} else {
|
455 |
+
$('#customize-preview iframe').contents().find( 'body.login' ).css( 'background-image', 'url(' + loginPressVal + ')' );
|
456 |
+
}
|
457 |
+
|
458 |
}
|
459 |
|
460 |
} );
|
474 |
value.bind( function( loginPressVal ) {
|
475 |
|
476 |
if( loginPressVal == '' ) {
|
477 |
+
$('#customize-preview iframe').contents().find('#login h1 a').css( 'background-image', 'url(' + loginpress_script.admin_url + '/images/wordpress-logo.svg)' );
|
478 |
} else {
|
479 |
$('#customize-preview iframe').contents().find('#login h1 a').css( 'background-image', 'url(' + loginPressVal + ')' );
|
480 |
}
|
811 |
|
812 |
|
813 |
$(window).on('load', function(){
|
814 |
+
|
815 |
+
// console.log($('#customize-control-loginpress_display_bg input[type="checkbox"]').length);
|
816 |
if ($('#customize-control-loginpress_display_bg input[type="checkbox"]').is(":checked") ) {
|
817 |
$('#customize-control-setting_background').show();
|
818 |
$('#customize-control-background_repeat_radio').show();
|
822 |
$('#customize-control-background_repeat_radio').hide();
|
823 |
$('#customize-control-background_image_size').hide();
|
824 |
}
|
825 |
+
|
826 |
+
$("<style type='text/css' id='loginpress-customize'></style>").appendTo($('#customize-preview iframe').contents().find('head'));
|
827 |
});
|
828 |
+
|
829 |
} )( jQuery );
|
loginpress.php
CHANGED
@@ -3,11 +3,11 @@
|
|
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.
|
7 |
* Author: WPBrigade
|
8 |
* Author URI: http://www.WPBrigade.com/
|
9 |
* Requires at least: 4.0
|
10 |
-
* Tested up to: 4.7.
|
11 |
* Text Domain: loginpress
|
12 |
* Domain Path: /languages
|
13 |
*
|
@@ -17,7 +17,6 @@
|
|
17 |
*/
|
18 |
|
19 |
|
20 |
-
|
21 |
if ( ! class_exists( 'LoginPress' ) ) :
|
22 |
|
23 |
final class LoginPress {
|
@@ -25,11 +24,11 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
25 |
/**
|
26 |
* @var string
|
27 |
*/
|
28 |
-
public $version = '1.0.
|
29 |
|
30 |
/**
|
31 |
* @var The single instance of the class
|
32 |
-
* @since
|
33 |
*/
|
34 |
protected static $_instance = null;
|
35 |
|
@@ -65,9 +64,9 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
65 |
|
66 |
$this->define( 'LOGINPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
67 |
$this->define( 'LOGINPRESS_DIR_PATH', plugin_dir_path( __FILE__ ) );
|
68 |
-
$this->define( '
|
|
|
69 |
$this->define( 'LOGINPRESS_VERSION', $this->version );
|
70 |
-
$this->define( 'EXE', '.php' );
|
71 |
}
|
72 |
|
73 |
/**
|
@@ -76,7 +75,8 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
76 |
|
77 |
public function includes() {
|
78 |
|
79 |
-
include_once( LOGINPRESS_DIR_PATH . 'custom'
|
|
|
80 |
}
|
81 |
|
82 |
/**
|
@@ -88,6 +88,7 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
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 |
}
|
92 |
|
93 |
/**
|
@@ -143,17 +144,28 @@ if ( ! class_exists( 'LoginPress' ) ) :
|
|
143 |
* Add new page in Apperance to customize Login Page
|
144 |
*/
|
145 |
public function register_options_page() {
|
146 |
-
add_theme_page( __( 'LoginPress', 'loginpress' ),
|
147 |
-
|
148 |
-
'manage_options',
|
149 |
-
|
150 |
-
'__return_null' );
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
|
159 |
|
@@ -192,4 +204,11 @@ loginPress_loader();
|
|
192 |
* @since 1.0.0
|
193 |
*/
|
194 |
new LoginPress_Entities();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
?>
|
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.8
|
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 |
*
|
17 |
*/
|
18 |
|
19 |
|
|
|
20 |
if ( ! class_exists( 'LoginPress' ) ) :
|
21 |
|
22 |
final class LoginPress {
|
24 |
/**
|
25 |
* @var string
|
26 |
*/
|
27 |
+
public $version = '1.0.8';
|
28 |
|
29 |
/**
|
30 |
* @var The single instance of the class
|
31 |
+
* @since http://prntscr.com/e0wxbu1.0.0
|
32 |
*/
|
33 |
protected static $_instance = null;
|
34 |
|
64 |
|
65 |
$this->define( 'LOGINPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
66 |
$this->define( 'LOGINPRESS_DIR_PATH', plugin_dir_path( __FILE__ ) );
|
67 |
+
$this->define( 'LOGINPRESS_DIR_URL', plugin_dir_url( __FILE__ ) );
|
68 |
+
$this->define( 'LOGINPRESS_ROOT_PATH', dirname( __FILE__ ) . '/' );
|
69 |
$this->define( 'LOGINPRESS_VERSION', $this->version );
|
|
|
70 |
}
|
71 |
|
72 |
/**
|
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 |
/**
|
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 |
}
|
93 |
|
94 |
/**
|
144 |
* Add new page in Apperance to customize Login Page
|
145 |
*/
|
146 |
public function register_options_page() {
|
147 |
+
add_theme_page( __( 'LoginPress', 'loginpress' ), __( 'LoginPress', 'loginpress' ), 'manage_options', "abw", '__return_null' );
|
148 |
+
|
149 |
+
add_menu_page( __( 'LoginPress', 'loginpress' ), __( 'LoginPress', 'loginpress' ), 'manage_options', "loginpress", '__return_null', '', 50 );
|
150 |
+
|
151 |
+
add_submenu_page( 'loginpress', __( 'Customizer', 'loginpress' ), __( 'Customizer', 'loginpress' ), 'manage_options', "loginpress", '__return_null' );
|
152 |
+
|
153 |
+
// add_submenu_page( 'loginpress', __( 'Settings', 'loginpress' ), __( 'Settings', 'loginpress' ), 'manage_options', "loginpress-settings", array( $this, '_loginpress_settings' ) );
|
154 |
+
}
|
155 |
+
|
156 |
+
|
157 |
+
public function _loginpress_settings() {
|
158 |
+
|
159 |
+
if ( isset( $_GET['get-premium'] ) && 'loginpress' == $_GET['get-premium'] ) {
|
160 |
+
include_once LOGINPRESS_DIR_PATH . '/include/get-premium.php';
|
161 |
+
} else {
|
162 |
+
include_once LOGINPRESS_DIR_PATH . '/include/settings.php';
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
function _admin_scripts() {
|
167 |
+
wp_enqueue_style( 'loginpress_stlye', plugins_url( 'css/style.css', __FILE__ ), array(), time() );
|
168 |
+
wp_enqueue_script( 'loginpress_js', plugins_url( 'js/admin-custom.js', __FILE__ ), array(), time() );
|
169 |
}
|
170 |
|
171 |
|
204 |
* @since 1.0.0
|
205 |
*/
|
206 |
new LoginPress_Entities();
|
207 |
+
new LoginPress_Settings();
|
208 |
+
|
209 |
+
|
210 |
+
if (!class_exists('TAV_Remote_Notification_Client')) {
|
211 |
+
require( LOGINPRESS_ROOT_PATH . 'include/class-remote-notification-client.php' );
|
212 |
+
}
|
213 |
+
$notification = new TAV_Remote_Notification_Client( 125, '16765c0902705d62', 'http://wpbrigade.com?post_type=notification' );
|
214 |
?>
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Login ===
|
2 |
-
Version: 1.0.
|
3 |
Requires at least: 4.0
|
4 |
-
Tested up to: 4.7.
|
5 |
-
Contributors: WPBrigade, hiddenpearls,
|
6 |
Author URI: https://wpbrigade.com
|
7 |
Tags: customizer, custom login, login logo, login customizer, custom login page, admin, wp-login, customization, forgot password, login error, login page style, loginpress
|
8 |
-
Stable tag: 1.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -13,7 +13,7 @@ LOGIN allows you to easily customize the layout of login, admin login, client lo
|
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
[Login Plugin](http://www.WPBrigade.com/wordpress/plugins/loginpress/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion) by LoginPress holds a lot of customization fields to change the layout of the login page of WordPress. You can modify the look and feel of login page completely even the login error messages, forgot error messages, registration error messages and many more.
|
17 |
Login Plugin would give you and your users a feeling that it is a custom login page and a part of the site layout. You must checkout the Demo video of how you can customize WordPress login page.
|
18 |
|
19 |
**Getting Started video for customizing login page using LoginPress**
|
@@ -91,7 +91,7 @@ If you like this plugin, then consider checking out our other projects:
|
|
91 |
|
92 |
== Notes ==
|
93 |
|
94 |
-
LoginPress is absolutely, positively the most <a href="http://www.WPBrigade.com/wordpress/plugins/loginpress/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion" rel="friend" title="Best Custom login form plugin">beginner friendly WordPress custom login form plugin</a> on the market. It is both easy and powerful.
|
95 |
|
96 |
Also, I'm the founder of <a href="http://www.wpbrigade.com/" rel="friend">WPBrigade</a>, We do custom WordPress themes for clients and can transform any website in WordPress. It was a huge priority for me to make a WordPress custom login form plugin that beginners can use without any training.
|
97 |
|
@@ -126,7 +126,7 @@ Yes, LoginPress has full translation and localization support via the loginpress
|
|
126 |
|
127 |
= How to donate or contribute? =
|
128 |
|
129 |
-
Please visit <a target="_blank" rel="friend" href="http://www.WPBrigade.com/wordpress/plugins/loginpress/">this link</a> for more info.
|
130 |
|
131 |
== Screenshots ==
|
132 |
|
@@ -143,6 +143,11 @@ Please visit <a target="_blank" rel="friend" href="http://www.WPBrigade.com/word
|
|
143 |
|
144 |
== Changelog ==
|
145 |
|
|
|
|
|
|
|
|
|
|
|
146 |
= 1.0.7 - 2017-01-24 =
|
147 |
* Bug fix: Color and Background management fixed and themes launch.
|
148 |
|
@@ -171,5 +176,5 @@ Please visit <a target="_blank" rel="friend" href="http://www.WPBrigade.com/word
|
|
171 |
|
172 |
== Upgrade Notice ==
|
173 |
|
174 |
-
= 1.0.
|
175 |
-
*
|
1 |
=== Login ===
|
2 |
+
Version: 1.0.8
|
3 |
Requires at least: 4.0
|
4 |
+
Tested up to: 4.7.3
|
5 |
+
Contributors: WPBrigade, hiddenpearls, AbdulWahab610
|
6 |
Author URI: https://wpbrigade.com
|
7 |
Tags: customizer, custom login, login logo, login customizer, custom login page, admin, wp-login, customization, forgot password, login error, login page style, loginpress
|
8 |
+
Stable tag: 1.0.8
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
[Login Plugin](http://www.WPBrigade.com/wordpress/plugins/loginpress-pro/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion) by LoginPress holds a lot of customization fields to change the layout of the login page of WordPress. You can modify the look and feel of login page completely even the login error messages, forgot error messages, registration error messages and many more.
|
17 |
Login Plugin would give you and your users a feeling that it is a custom login page and a part of the site layout. You must checkout the Demo video of how you can customize WordPress login page.
|
18 |
|
19 |
**Getting Started video for customizing login page using LoginPress**
|
91 |
|
92 |
== Notes ==
|
93 |
|
94 |
+
LoginPress is absolutely, positively the most <a href="http://www.WPBrigade.com/wordpress/plugins/loginpress-pro/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion" rel="friend" title="Best Custom login form plugin">beginner friendly WordPress custom login form plugin</a> on the market. It is both easy and powerful.
|
95 |
|
96 |
Also, I'm the founder of <a href="http://www.wpbrigade.com/" rel="friend">WPBrigade</a>, We do custom WordPress themes for clients and can transform any website in WordPress. It was a huge priority for me to make a WordPress custom login form plugin that beginners can use without any training.
|
97 |
|
126 |
|
127 |
= How to donate or contribute? =
|
128 |
|
129 |
+
Please visit <a target="_blank" rel="friend" href="http://www.WPBrigade.com/wordpress/plugins/loginpress-pro/">this link</a> for more info.
|
130 |
|
131 |
== Screenshots ==
|
132 |
|
143 |
|
144 |
== Changelog ==
|
145 |
|
146 |
+
= 1.0.8 - 2017-02-01 =
|
147 |
+
* Enhancement: Reset settings option added
|
148 |
+
* Enhancement: Login Page themes launch
|
149 |
+
* Enhancement: Added Premium version
|
150 |
+
|
151 |
= 1.0.7 - 2017-01-24 =
|
152 |
* Bug fix: Color and Background management fixed and themes launch.
|
153 |
|
176 |
|
177 |
== Upgrade Notice ==
|
178 |
|
179 |
+
= 1.0.8 =
|
180 |
+
* Launched Premium version with more features.
|