Version Description
- Fix: issue with back-end Users with unconfirmed emails page
- Misc: remove unnecessary code
- Misc: sanitize outputted register sucesss message
Download this release
Release Info
Developer | raster02 |
Plugin | User registration & user profile – Profile Builder |
Version | 3.6.7 |
Comparing to | |
See all releases |
Code changes from version 3.6.6 to 3.6.7
- assets/lib/class-mustache-templates/class-mustache-templates.css +0 -193
- assets/lib/class-mustache-templates/class-mustache-templates.js +0 -80
- assets/lib/class-mustache-templates/class-mustache-templates.php +0 -575
- features/email-confirmation/email-confirmation.php +1 -1
- front-end/class-formbuilder.php +1 -1
- front-end/login.php +3 -1
- index.php +2 -2
- readme.txt +6 -1
- translation/profile-builder.pot +23 -23
assets/lib/class-mustache-templates/class-mustache-templates.css
DELETED
@@ -1,193 +0,0 @@
|
|
1 |
-
/* Mustache Library for Creating */
|
2 |
-
|
3 |
-
/*--------------------------------------------------------------
|
4 |
-
>>> TABLE OF CONTENTS:
|
5 |
-
----------------------------------------------------------------
|
6 |
-
1.0 - Basic Structure
|
7 |
-
2.0 - Textarea Codemirror Styling
|
8 |
-
3.0 - Other Form Elements
|
9 |
-
4.0 - Save Button
|
10 |
-
5.0 - Media Queries
|
11 |
-
6.0 - Other
|
12 |
-
--------------------------------------------------------------*/
|
13 |
-
|
14 |
-
/*--------------------------------------------------------------
|
15 |
-
1.0 Basic Structure
|
16 |
-
--------------------------------------------------------------*/
|
17 |
-
|
18 |
-
.side .form-table th {
|
19 |
-
width: 20%;
|
20 |
-
font-weight: bold;
|
21 |
-
text-align: left;
|
22 |
-
padding-left: 0;
|
23 |
-
}
|
24 |
-
|
25 |
-
.wck-post-body{
|
26 |
-
clear: left;
|
27 |
-
float: left;
|
28 |
-
margin-right: -2000px;
|
29 |
-
width: 100%;
|
30 |
-
}
|
31 |
-
|
32 |
-
.metabox-holder .column-1 {
|
33 |
-
margin-right:300px;
|
34 |
-
}
|
35 |
-
.metabox-holder .column-2 {
|
36 |
-
float: right;
|
37 |
-
width: 280px;
|
38 |
-
clear:right;
|
39 |
-
position:relative;
|
40 |
-
}
|
41 |
-
.metabox-holder .column-3 {
|
42 |
-
clear: both;
|
43 |
-
margin-right:300px;
|
44 |
-
}
|
45 |
-
/*--------------------------------------------------------------
|
46 |
-
2.0 Textarea Codemirror styling
|
47 |
-
--------------------------------------------------------------*/
|
48 |
-
.textarea .stp-extra{
|
49 |
-
border:1px solid #ccc;
|
50 |
-
border-left:0;
|
51 |
-
float: left;
|
52 |
-
overflow: auto;
|
53 |
-
width: 39%;
|
54 |
-
height:400px;
|
55 |
-
}
|
56 |
-
.textarea .stp-extra h4 {
|
57 |
-
height: 20px;
|
58 |
-
margin: 1px 0;
|
59 |
-
padding:10px 20px;
|
60 |
-
overflow: hidden;
|
61 |
-
cursor:pointer;
|
62 |
-
background:#F1F1F1;
|
63 |
-
}
|
64 |
-
.textarea .stp-extra h4:hover{
|
65 |
-
background:#FCFCFC;
|
66 |
-
}
|
67 |
-
.textarea .stp-extra pre {
|
68 |
-
display: block;
|
69 |
-
height: 253px;
|
70 |
-
margin: 12px 0;
|
71 |
-
max-height: 253px;
|
72 |
-
overflow: auto;
|
73 |
-
padding-left: 20px;
|
74 |
-
vertical-align: top;
|
75 |
-
width: auto;
|
76 |
-
}
|
77 |
-
.textarea label.wppb_mustache_label {
|
78 |
-
display: none;
|
79 |
-
}
|
80 |
-
.cm-s-default.CodeMirror {
|
81 |
-
border: 1px solid #CCCCCC;
|
82 |
-
float: left;
|
83 |
-
font-family: Monaco,Menlo,"Andale Mono","lucida console","Courier New",monospace !important;
|
84 |
-
line-height: 1.4em !important;
|
85 |
-
width: 60%;
|
86 |
-
}
|
87 |
-
.cm-s-default {
|
88 |
-
min-height: 400px;
|
89 |
-
}
|
90 |
-
.mustache-box{
|
91 |
-
table-layout:fixed;
|
92 |
-
}
|
93 |
-
/*--------------------------------------------------------------
|
94 |
-
3.0 Other Form Elements
|
95 |
-
--------------------------------------------------------------*/
|
96 |
-
.text label.wppb_mustache_label {
|
97 |
-
display: inline-block;
|
98 |
-
min-width: 150px;
|
99 |
-
font-weight: bold;
|
100 |
-
}
|
101 |
-
|
102 |
-
.checkbox label.wppb_mustache_label {
|
103 |
-
font-weight: bold;
|
104 |
-
margin-right: 8px;
|
105 |
-
}
|
106 |
-
|
107 |
-
.mustache-box input[type="text"]{
|
108 |
-
width:400px;
|
109 |
-
min-width: auto;
|
110 |
-
}
|
111 |
-
|
112 |
-
.mustache-box .description{
|
113 |
-
display: block;
|
114 |
-
}
|
115 |
-
|
116 |
-
.mustache-box.form-table td.header{
|
117 |
-
padding-top: 0;
|
118 |
-
padding-bottom: 0;
|
119 |
-
}
|
120 |
-
|
121 |
-
/*--------------------------------------------------------------
|
122 |
-
4.0 Save Button
|
123 |
-
--------------------------------------------------------------*/
|
124 |
-
.mustache-save{
|
125 |
-
width: 100%;
|
126 |
-
text-align: center;
|
127 |
-
}
|
128 |
-
|
129 |
-
#page-save-metabox .hndle{
|
130 |
-
background: #333333;
|
131 |
-
color: #fff;
|
132 |
-
}
|
133 |
-
#page-save-metabox .inside{
|
134 |
-
padding: 30px;
|
135 |
-
}
|
136 |
-
|
137 |
-
/*--------------------------------------------------------------
|
138 |
-
5.0 Media Queries
|
139 |
-
--------------------------------------------------------------*/
|
140 |
-
@media screen and ( max-width: 878px ) {
|
141 |
-
.wck-post-body{
|
142 |
-
float:none;
|
143 |
-
margin-right: 0;
|
144 |
-
}
|
145 |
-
|
146 |
-
.metabox-holder .column-2{
|
147 |
-
float:none;
|
148 |
-
width:100%;
|
149 |
-
}
|
150 |
-
|
151 |
-
.metabox-holder .column-1{
|
152 |
-
margin-right:0;
|
153 |
-
}
|
154 |
-
|
155 |
-
.textarea .stp-extra{
|
156 |
-
float:none;
|
157 |
-
width:auto;
|
158 |
-
border:1px solid #ccc;
|
159 |
-
border-top:0;
|
160 |
-
}
|
161 |
-
.cm-s-default.CodeMirror{
|
162 |
-
float:none;
|
163 |
-
width: auto;
|
164 |
-
}
|
165 |
-
#page-save-metabox .inside{
|
166 |
-
text-align: right;
|
167 |
-
}
|
168 |
-
.mustache-save{
|
169 |
-
width: auto;
|
170 |
-
text-align: center;
|
171 |
-
}
|
172 |
-
|
173 |
-
}
|
174 |
-
|
175 |
-
/*--------------------------------------------------------------
|
176 |
-
6.0 Other
|
177 |
-
--------------------------------------------------------------*/
|
178 |
-
/* show email toggle checkbox inline for User/Admin Email Customizers */
|
179 |
-
.profile-builder_page_user-email-customizer .wck-post-body .postbox:not(:first-child) tr:nth-child(1), .profile-builder_page_admin-email-customizer .wck-post-body .postbox:not(:first-child) tr:nth-child(1) {
|
180 |
-
width: 50%;
|
181 |
-
display: inline-block;
|
182 |
-
}
|
183 |
-
|
184 |
-
.profile-builder_page_user-email-customizer .wck-post-body .postbox:not(:first-child) tr:nth-child(2), .profile-builder_page_admin-email-customizer .wck-post-body .postbox:not(:first-child) tr:nth-child(2) {
|
185 |
-
text-align: left;
|
186 |
-
width: 50%;
|
187 |
-
display: inline-block;
|
188 |
-
}
|
189 |
-
|
190 |
-
.profile-builder_page_user-email-customizer .wck-post-body .postbox:not(:first-child) tr:nth-child(2) td, .profile-builder_page_admin-email-customizer .wck-post-body .postbox:not(:first-child) tr:nth-child(2) td {
|
191 |
-
float: right;
|
192 |
-
padding-right: 20px;
|
193 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/lib/class-mustache-templates/class-mustache-templates.js
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
CodeMirror.defineMode("mustache", function(config, parserConfig) {
|
2 |
-
var mustacheOverlay = {
|
3 |
-
token: function(stream, state) {
|
4 |
-
var ch;
|
5 |
-
if (stream.match("{{")) {
|
6 |
-
while ((ch = stream.next()) != null)
|
7 |
-
if (ch == "}" && stream.next() == "}") break;
|
8 |
-
stream.eat("}");
|
9 |
-
return "mustache";
|
10 |
-
}
|
11 |
-
while (stream.next() != null && !stream.match("{{", false)) {}
|
12 |
-
return null;
|
13 |
-
}
|
14 |
-
};
|
15 |
-
return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
|
16 |
-
});
|
17 |
-
|
18 |
-
|
19 |
-
jQuery(function(){
|
20 |
-
var wck_stp_textareas = ["wppb_mustache_template"];
|
21 |
-
var length = wck_stp_textareas.length;
|
22 |
-
element = null;
|
23 |
-
|
24 |
-
for ( var i=0; i < length; i++ ){
|
25 |
-
element = wck_stp_textareas[i];
|
26 |
-
|
27 |
-
if ( jQuery( 'textarea[class="' + element + '"]' ).length > 0 ){
|
28 |
-
jQuery( 'textarea[class|="' + element + '"]' ).each( function(){
|
29 |
-
var editor = CodeMirror.fromTextArea( this, {
|
30 |
-
mode: "mustache",
|
31 |
-
lineNumbers: true,
|
32 |
-
//lineWrapping:true,
|
33 |
-
extraKeys: {
|
34 |
-
"F11": function(cm) {
|
35 |
-
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
36 |
-
},
|
37 |
-
"Esc": function(cm) {
|
38 |
-
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
});
|
42 |
-
});
|
43 |
-
}
|
44 |
-
}
|
45 |
-
})
|
46 |
-
|
47 |
-
jQuery(function() {
|
48 |
-
jQuery( ".stp-extra" ).accordion();
|
49 |
-
});
|
50 |
-
|
51 |
-
//add hidden input with off value for checkboxes
|
52 |
-
jQuery(function() {
|
53 |
-
|
54 |
-
jQuery('form .wck-post-body input[type="checkbox"]').each( function() {
|
55 |
-
|
56 |
-
if ( !jQuery(this).is(':checked') ) {
|
57 |
-
var wppb_mustache_checkbox_off = document.createElement('input');
|
58 |
-
wppb_mustache_checkbox_off.type = 'hidden';
|
59 |
-
wppb_mustache_checkbox_off.value = 'off';
|
60 |
-
wppb_mustache_checkbox_off.name = jQuery(this).attr('name');
|
61 |
-
|
62 |
-
jQuery(this).after(wppb_mustache_checkbox_off);
|
63 |
-
}
|
64 |
-
|
65 |
-
});
|
66 |
-
|
67 |
-
jQuery('form .wck-post-body input[type="checkbox"]').on( 'change', function() {
|
68 |
-
var wppb_mustache_checkbox_off = document.createElement('input');
|
69 |
-
wppb_mustache_checkbox_off.type = 'hidden';
|
70 |
-
wppb_mustache_checkbox_off.value = 'off';
|
71 |
-
wppb_mustache_checkbox_off.name = jQuery(this).attr('name');
|
72 |
-
|
73 |
-
if ( jQuery(this).is(':checked') )
|
74 |
-
jQuery( '.' + jQuery(this).attr('name') + ' input[type="hidden"]' ).remove();
|
75 |
-
else
|
76 |
-
jQuery(this).after(wppb_mustache_checkbox_off);
|
77 |
-
|
78 |
-
});
|
79 |
-
|
80 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/lib/class-mustache-templates/class-mustache-templates.php
DELETED
@@ -1,575 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @param array() $mustache_vars is the array containing the names of the variable that must be proccessed by mustache in the template. The array must be in this form:
|
4 |
-
* array( array( 'name' => '', 'type' => '' ) ... ), and for loop tags it also contains a 'children' element which contains other mustache_vars array( array( 'name' => 'users', 'type' => 'loop_tag', 'children' => $merge_tags )
|
5 |
-
* @param string $template the template that needs to be procesed
|
6 |
-
* @param array $extra_values in this array we can pass any variables that are required for that specific implementation of the mustache processing system
|
7 |
-
*
|
8 |
-
*/
|
9 |
-
class PB_Mustache_Generate_Template{
|
10 |
-
var $mustache_vars = array( );
|
11 |
-
var $template = '';
|
12 |
-
var $extra_values = array( );
|
13 |
-
|
14 |
-
/**
|
15 |
-
* constructor for the class
|
16 |
-
*
|
17 |
-
* @param array $mustache_vars the array of variables
|
18 |
-
* @param string $template the html template
|
19 |
-
* @param $extra_values in this array we can pass any variables that are required for that specific implementation of the mustache processing system
|
20 |
-
*
|
21 |
-
* @since 2.0.0
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
function __construct( $mustache_vars, $template, $extra_values ){
|
25 |
-
|
26 |
-
// Include Mustache Templates
|
27 |
-
if( !class_exists( 'Mustache_Autoloader' ) )
|
28 |
-
require_once( WPPB_PLUGIN_DIR.'/assets/lib/Mustache/Autoloader.php' );
|
29 |
-
|
30 |
-
Mustache_Autoloader::register();
|
31 |
-
|
32 |
-
$this->mustache_vars = $mustache_vars;
|
33 |
-
$this->template = $template;
|
34 |
-
$this->extra_values = $extra_values;
|
35 |
-
|
36 |
-
$this->process_mustache_vars();
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* construct the mustache_vars_array from $mustache_vars through filters
|
41 |
-
*
|
42 |
-
* @since 2.0.0
|
43 |
-
*
|
44 |
-
*/
|
45 |
-
function process_mustache_vars(){
|
46 |
-
if( !empty( $this->mustache_vars ) ){
|
47 |
-
foreach( $this->mustache_vars as $var ){
|
48 |
-
foreach( $var['variables'] as $variables ){
|
49 |
-
if( empty( $variables['children'] ) )
|
50 |
-
$variables['children'] = array();
|
51 |
-
$this->mustache_vars_array[ $variables['name'] ] = apply_filters( 'mustache_variable_'. $variables['type'], '', $variables['name'], $variables['children'], $this->extra_values );
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Process the mustache template from the html template and the processed mustache variable array.
|
60 |
-
*
|
61 |
-
* @since 2.0.0
|
62 |
-
*
|
63 |
-
* @return $content the proccessed template ready for output.
|
64 |
-
*/
|
65 |
-
function process_template(){
|
66 |
-
$m = new Mustache_Engine;
|
67 |
-
try {
|
68 |
-
if( !empty( $this->mustache_vars_array ) ){
|
69 |
-
foreach( $this->mustache_vars_array as $key => $value ){
|
70 |
-
if( is_string( $value ) ) {
|
71 |
-
$this->mustache_vars_array[$key] = str_replace('[', '[', $value);
|
72 |
-
$this->mustache_vars_array[$key] = str_replace(']', ']', $value);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
}
|
76 |
-
$content = do_shortcode( $m->render( $this->template, $this->mustache_vars_array ) );
|
77 |
-
} catch (Exception $e) {
|
78 |
-
$content = $e->getMessage();
|
79 |
-
}
|
80 |
-
|
81 |
-
return apply_filters( 'wppb_mustache_template', $content );
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Handle toString method
|
86 |
-
*
|
87 |
-
* @since 2.0.0
|
88 |
-
*
|
89 |
-
* @return string $html html for the template.
|
90 |
-
*/
|
91 |
-
public function __toString() {
|
92 |
-
$html = $this->process_template();
|
93 |
-
return "{$html}";
|
94 |
-
}
|
95 |
-
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
class PB_Mustache_Generate_Admin_Box{
|
101 |
-
|
102 |
-
var $id; // string meta box id
|
103 |
-
var $title; // string title
|
104 |
-
var $page; // string|array post type to add meta box to
|
105 |
-
var $priority;
|
106 |
-
var $mustache_vars;
|
107 |
-
var $default_value;
|
108 |
-
|
109 |
-
|
110 |
-
/**
|
111 |
-
* constructor for the class
|
112 |
-
*
|
113 |
-
* @param string $id the meta box id
|
114 |
-
* @param string $title the title of the metabox
|
115 |
-
* @param string|array $page post type to add meta box to
|
116 |
-
* @param string $priority the priority within the context where the boxes should show ('high', 'core', 'default' or 'low')
|
117 |
-
* @param array $mustache_vars is the array containing the names of the variable that must be proccessed by mustache in the template. The array must be in this form:
|
118 |
-
* array( array( 'name' => '', 'type' => '' ) ... ), and for loop tags it also contains a 'children' element which contains other mustache_vars array( array( 'name' => 'users', 'type' => 'loop_tag', 'children' => $merge_tags )
|
119 |
-
* @param string $default_value the default template that populates the codemirror box.
|
120 |
-
*
|
121 |
-
* @since 2.0.0
|
122 |
-
*
|
123 |
-
*/
|
124 |
-
function __construct( $id, $title, $page, $priority, $mustache_vars, $default_value = '', $fields = array() ){
|
125 |
-
|
126 |
-
$this->mustache_vars = $mustache_vars;
|
127 |
-
|
128 |
-
$this->id = $id;
|
129 |
-
$this->title = $title;
|
130 |
-
$this->page = $page;
|
131 |
-
$this->priority = $priority;
|
132 |
-
$this->default_value = $default_value;
|
133 |
-
|
134 |
-
if(!is_array($this->page)) {
|
135 |
-
$this->page = array($this->page);
|
136 |
-
}
|
137 |
-
|
138 |
-
if( empty( $fields ) ){
|
139 |
-
$this->fields = array(
|
140 |
-
array( // Textarea
|
141 |
-
'label' => '', // <label>
|
142 |
-
'desc' => '', // description
|
143 |
-
'id' => $id, // field id and name
|
144 |
-
'type' => 'textarea', // type of field
|
145 |
-
'default' => $default_value, // type of field
|
146 |
-
)
|
147 |
-
);
|
148 |
-
}
|
149 |
-
else{
|
150 |
-
$this->fields = $fields;
|
151 |
-
}
|
152 |
-
|
153 |
-
$this->save_default_values();
|
154 |
-
|
155 |
-
if( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
156 |
-
return;
|
157 |
-
|
158 |
-
add_action( 'add_meta_boxes', array( $this, 'add_box' ) );
|
159 |
-
add_action( 'save_post', array( $this, 'save_box' ), 11, 2);
|
160 |
-
add_action( 'wp_insert_post', array( $this, 'save_box' ), 11, 2);
|
161 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'wppb_print_mustache_script' ) );
|
162 |
-
add_action( 'admin_head', array( $this, 'wppb_print_codemirror_script' ) );
|
163 |
-
|
164 |
-
add_action( 'wck_before_meta_boxes', array( $this, 'wppb_mustache_page_before' ) );
|
165 |
-
add_action( 'wck_after_meta_boxes', array( $this, 'wppb_mustache_page_after' ) );
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Function that print the required scripts for the mustache templates
|
170 |
-
*
|
171 |
-
* @param string $hook the page hook
|
172 |
-
*
|
173 |
-
* @since 2.0.0
|
174 |
-
*
|
175 |
-
*/
|
176 |
-
function wppb_print_mustache_script( $hook ){
|
177 |
-
if ( isset( $_GET['post_type'] ) || isset( $_GET['post'] ) || isset( $_GET['page'] ) ){
|
178 |
-
if ( isset( $_GET['post_type'] ) )
|
179 |
-
$post_type = sanitize_text_field( $_GET['post_type'] );
|
180 |
-
|
181 |
-
elseif ( isset( $_GET['post'] ) )
|
182 |
-
$post_type = get_post_type( absint( $_GET['post'] ) );
|
183 |
-
else if( isset( $_GET['page'] ) ){
|
184 |
-
$screen = get_current_screen();
|
185 |
-
$post_type = $screen->id;
|
186 |
-
}
|
187 |
-
|
188 |
-
if ( ( $this->page[0] == $post_type ) ){
|
189 |
-
wp_enqueue_style( 'codemirror-style', WPPB_PLUGIN_URL . 'assets/lib/codemirror/lib/codemirror.css', false, PROFILE_BUILDER_VERSION );
|
190 |
-
if( !wp_script_is( 'codemirror', 'registered' ) && !wp_script_is( 'codemirror', 'enqueued' ) ) {
|
191 |
-
wp_enqueue_script('codemirror', WPPB_PLUGIN_URL . 'assets/lib/codemirror/lib/codemirror.js', array(), PROFILE_BUILDER_VERSION);
|
192 |
-
wp_enqueue_script('codemirror-mode-overlay-js', WPPB_PLUGIN_URL . 'assets/lib/codemirror/addon/mode/overlay.js', array(), '1.0');
|
193 |
-
wp_enqueue_script('codemirror-mode-xml-js', WPPB_PLUGIN_URL . 'assets/lib/codemirror/mode/xml/xml.js', array(), '1.0');
|
194 |
-
wp_enqueue_script('codemirror-fullscreen-js', WPPB_PLUGIN_URL . 'assets/lib/codemirror/addon/display/fullscreen.js', array(), '1.0');
|
195 |
-
}
|
196 |
-
|
197 |
-
wp_enqueue_script('jquery-ui-accordion');
|
198 |
-
}
|
199 |
-
}
|
200 |
-
}
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Function that prints the codemirror initialization and the css
|
204 |
-
*
|
205 |
-
* @param string $hook the page hook
|
206 |
-
*
|
207 |
-
* @since 2.0.0
|
208 |
-
*
|
209 |
-
*/
|
210 |
-
function wppb_print_codemirror_script(){
|
211 |
-
global $printed_codemirror_scripts;
|
212 |
-
|
213 |
-
if( $printed_codemirror_scripts )
|
214 |
-
return;
|
215 |
-
|
216 |
-
$post_type = NULL;
|
217 |
-
|
218 |
-
if ( isset( $_GET['post_type'] ) || isset( $_GET['post'] ) || isset( $_GET['page'] ) ){
|
219 |
-
if ( isset( $_GET['post_type'] ) )
|
220 |
-
$post_type = sanitize_text_field( $_GET['post_type'] );
|
221 |
-
elseif ( isset( $_GET['post'] ) )
|
222 |
-
$post_type = get_post_type( absint( $_GET['post'] ) );
|
223 |
-
else if( isset( $_GET['page'] ) ){
|
224 |
-
$screen = get_current_screen();
|
225 |
-
if( $screen !== null && is_object( $screen ) ) {
|
226 |
-
$post_type = $screen->id;
|
227 |
-
}
|
228 |
-
}
|
229 |
-
|
230 |
-
if ( ( $this->page[0] == $post_type ) ){
|
231 |
-
wp_enqueue_style( 'class-mustache-css', WPPB_PLUGIN_URL . 'assets/lib/class-mustache-templates/class-mustache-templates.css', false, PROFILE_BUILDER_VERSION );
|
232 |
-
if( wp_script_is( 'codemirror-mode-overlay-js', 'enqueued' ) ) {
|
233 |
-
wp_enqueue_script('class-mustache-js', WPPB_PLUGIN_URL . 'assets/lib/class-mustache-templates/class-mustache-templates.js', array("jquery"), PROFILE_BUILDER_VERSION);
|
234 |
-
}
|
235 |
-
|
236 |
-
$printed_codemirror_scripts = true;
|
237 |
-
}
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
-
/**
|
242 |
-
* Function that adds the mustache metabox
|
243 |
-
*
|
244 |
-
* @since 2.0.0
|
245 |
-
*
|
246 |
-
*/
|
247 |
-
function add_box() {
|
248 |
-
global $post_type;
|
249 |
-
|
250 |
-
foreach ( $this->page as $page ) {
|
251 |
-
add_meta_box( $this->id, $this->title, array( $this, 'meta_box_callback' ), $page, 'normal', $this->priority, array( 'post_type' => $post_type ) );
|
252 |
-
|
253 |
-
/* if it's not a post type add a side metabox with a save button */
|
254 |
-
if( isset( $_GET['page'] ) )
|
255 |
-
add_meta_box( 'page-save-metabox', __( 'Save', 'profile-builder' ), array( $this, 'page_save_meta_box' ), $page, 'side' );
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Function output the content for the metabox
|
261 |
-
*
|
262 |
-
*
|
263 |
-
* @since 2.0.0
|
264 |
-
*
|
265 |
-
*/
|
266 |
-
function meta_box_callback( $post, $metabox ) {
|
267 |
-
global $post;
|
268 |
-
if( isset( $_GET['page'] ) )
|
269 |
-
$post_type = NULL;
|
270 |
-
else
|
271 |
-
$post_type = $metabox['args']['post_type'];
|
272 |
-
|
273 |
-
/* save default values in the database as post meta for post types */
|
274 |
-
if( !empty( $this->fields ) && !empty( $post->ID ) ){
|
275 |
-
foreach( $this->fields as $field ){
|
276 |
-
if( !empty( $field['default'] ) ){
|
277 |
-
/* see if we have an option with this name, if we have don't do anything */
|
278 |
-
$field_saved_value = get_post_meta( $post->ID, $field['id'], true );
|
279 |
-
if( empty( $field_saved_value ) ){
|
280 |
-
add_post_meta( $post->ID, $field['id'], $field['default'], true );
|
281 |
-
}
|
282 |
-
}
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
// Use nonce for verification
|
287 |
-
echo '<input type="hidden" name="' . esc_attr( $post_type ) . '_meta_box_nonce" value="' . esc_attr( wp_create_nonce( basename( __FILE__) ) ) . '" />';
|
288 |
-
|
289 |
-
// Begin the field table and loop
|
290 |
-
echo '<table class="form-table meta_box mustache-box">';
|
291 |
-
foreach ( $this->fields as $field ) {
|
292 |
-
|
293 |
-
// get data for this field
|
294 |
-
extract( $field );
|
295 |
-
if ( !empty( $desc ) )
|
296 |
-
$desc = '<span class="description">' . $desc . '</span>';
|
297 |
-
|
298 |
-
// get value of this field if it exists for this post
|
299 |
-
if( isset( $_GET['page'] ) ){
|
300 |
-
$meta = get_option( $id );
|
301 |
-
}
|
302 |
-
else{
|
303 |
-
$meta = get_post_meta( $post->ID, $id, true );
|
304 |
-
}
|
305 |
-
|
306 |
-
//try to set a default value
|
307 |
-
if( empty( $meta ) && !empty( $default ) ){
|
308 |
-
$meta = $default;
|
309 |
-
}
|
310 |
-
|
311 |
-
|
312 |
-
// begin a table row with
|
313 |
-
echo '<tr>
|
314 |
-
<td class="' . esc_attr( $id ) . ' ' . esc_attr( $type ) . '">';
|
315 |
-
if( $type != 'header' && !empty( $label ) ){
|
316 |
-
echo '<label for="' . esc_attr( $id ) . '" class="wppb_mustache_label">' . esc_html( $label ) . '</label>';
|
317 |
-
}
|
318 |
-
switch( $type ) {
|
319 |
-
// text
|
320 |
-
case 'text':
|
321 |
-
echo '<input type="text" name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '" value="' . esc_attr( $meta ) . '" size="30" />
|
322 |
-
<br />' . wp_kses_post( $desc ) ;
|
323 |
-
break;
|
324 |
-
// textarea
|
325 |
-
case 'textarea':
|
326 |
-
|
327 |
-
echo '<textarea name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '" cols="220" rows="4" class="wppb_mustache_template">' . esc_textarea( $meta ) . '</textarea>';
|
328 |
-
echo wp_kses_post( $desc ) ;
|
329 |
-
break;
|
330 |
-
// checkbox
|
331 |
-
case 'checkbox':
|
332 |
-
echo '<input type="checkbox" name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '"' . checked( esc_attr( $meta ), 'on', false ) . ' value="on" />
|
333 |
-
<label for="' . esc_attr( $id ) . '">' . esc_html( $desc ) . '</label>';
|
334 |
-
break;
|
335 |
-
// select
|
336 |
-
case 'select':
|
337 |
-
echo '<select name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
|
338 |
-
foreach ( $options as $option )
|
339 |
-
echo '<option' . selected( esc_attr( $meta ), $option['value'], false ) . ' value="' . esc_attr( $option['value'] ) . '">' . esc_html( $option['label'] ) . '</option>';
|
340 |
-
echo '</select><br />' . wp_kses_post( $desc );
|
341 |
-
break;
|
342 |
-
// radio
|
343 |
-
case 'radio':
|
344 |
-
foreach ( $options as $option )
|
345 |
-
echo '<input type="radio" name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '-' . esc_attr( $option['value'] ) . '" value="' . esc_attr( $option['value'] ) . '"' . checked( esc_attr( $meta ), $option['value'], false ) . ' />
|
346 |
-
<label for="' . esc_attr( $id ) . '-' . esc_attr( $option['value'] ) . '">' . esc_html( $option['label'] ) . '</label><br />';
|
347 |
-
echo '' . wp_kses_post( $desc );
|
348 |
-
break;
|
349 |
-
// checkbox_group
|
350 |
-
case 'checkbox_group':
|
351 |
-
foreach ( $options as $option )
|
352 |
-
echo '<input type="checkbox" value="' . esc_attr( $option['value'] ) . '" name="' . $id . '[]" id="' . $id . '-' . $option['value'] . '"' , is_array( $meta ) && in_array( $option['value'], $meta ) ? ' checked="checked"' : '' , ' />
|
353 |
-
<label for="' . esc_attr( $id ) . '-' . esc_attr( $option['value'] ) . '">' . esc_html( $option['label'] ) . '</label><br />';
|
354 |
-
echo '' . wp_kses_post( $desc );
|
355 |
-
break;
|
356 |
-
// text
|
357 |
-
case 'header':
|
358 |
-
echo '<h4>'. esc_html( $default ) .'</h4>';
|
359 |
-
break;
|
360 |
-
} //end switch
|
361 |
-
|
362 |
-
if( $type == 'textarea' ){
|
363 |
-
?>
|
364 |
-
<div class="stp-extra">
|
365 |
-
<?php
|
366 |
-
if( !empty( $this->mustache_vars ) ){
|
367 |
-
foreach( $this->mustache_vars as $mustache_var_group ){
|
368 |
-
?>
|
369 |
-
<h4><?php echo esc_html( $mustache_var_group['group-title'] ); ?></h4>
|
370 |
-
<pre><?php do_action( 'wppb_before_mustache_vars_display', $mustache_var_group, $id, $post_type ); $this->display_mustache_available_vars( $mustache_var_group['variables'], 0 ); ?></pre>
|
371 |
-
<?php
|
372 |
-
}
|
373 |
-
}
|
374 |
-
?>
|
375 |
-
</div>
|
376 |
-
<?php
|
377 |
-
}
|
378 |
-
echo '</td></tr>';
|
379 |
-
} // end foreach
|
380 |
-
echo '</table>'; // end table
|
381 |
-
}
|
382 |
-
|
383 |
-
/**
|
384 |
-
* Function that ads a side metabox on pages ( not post types ) with a save button
|
385 |
-
*
|
386 |
-
*
|
387 |
-
* @since 2.0.0
|
388 |
-
*
|
389 |
-
*/
|
390 |
-
function page_save_meta_box() {
|
391 |
-
?>
|
392 |
-
<input type="submit" value="<?php esc_html_e( 'Save Changes', 'profile-builder' ); ?>" class="button button-primary button-large mustache-save">
|
393 |
-
<?php
|
394 |
-
}
|
395 |
-
|
396 |
-
/**
|
397 |
-
* Function that ads a form start on pages ( not post types ) and also the 'save_post' action
|
398 |
-
*
|
399 |
-
*
|
400 |
-
* @since 2.0.0
|
401 |
-
*
|
402 |
-
*/
|
403 |
-
function wppb_mustache_page_before( $hook ){
|
404 |
-
global $started_mustache_form;
|
405 |
-
|
406 |
-
if( $started_mustache_form )
|
407 |
-
return;
|
408 |
-
|
409 |
-
if( isset( $_GET['page'] ) && $hook == $this->page[0] ){
|
410 |
-
/* if we are saving do the action 'save_post' */
|
411 |
-
if( isset( $_GET['mustache_action'] ) && $_GET['mustache_action'] == 'save' ) {
|
412 |
-
/* to avoid conflicts with other plugins we send an empty post object as the second parameter with a fake post type */
|
413 |
-
$post = new WP_Post( new stdClass() );
|
414 |
-
$post->post_type = 'wppb-mustache-settings-page';
|
415 |
-
remove_all_actions('save_post', 10 );//remove all actions that could run on the save_post hook on priority 10 than could expect a numeric post id instead of a string like $this->id. Ex: add_action( 'save_post', array( $this, 'refresh_post_word_count' ) ); in WPML translation management
|
416 |
-
remove_all_actions('save_post', PHP_INT_MAX );//same for PHP_INT_MAX priority: add_action( 'save_post', array( $this, 'queue_save_post_actions' ), PHP_INT_MAX, 2 );
|
417 |
-
do_action( 'save_post', $this->id, $post, false );
|
418 |
-
}
|
419 |
-
|
420 |
-
echo '<form action="'. esc_url( add_query_arg( array('mustache_action' => 'save') ) ) .'" method="post">';
|
421 |
-
$started_mustache_form = true;
|
422 |
-
}
|
423 |
-
}
|
424 |
-
|
425 |
-
/**
|
426 |
-
* Function that ads a form end on pages ( not post types )
|
427 |
-
*
|
428 |
-
*
|
429 |
-
* @since 2.0.0
|
430 |
-
*
|
431 |
-
*/
|
432 |
-
function wppb_mustache_page_after( $hook ){
|
433 |
-
global $ended_mustache_form;
|
434 |
-
if( $ended_mustache_form )
|
435 |
-
return;
|
436 |
-
|
437 |
-
if( isset( $_GET['page'] ) && $hook == $this->page[0] ){
|
438 |
-
echo '</form>';
|
439 |
-
$ended_mustache_form = true;
|
440 |
-
}
|
441 |
-
}
|
442 |
-
|
443 |
-
|
444 |
-
/**
|
445 |
-
* Function that transforms and echoes the $mustache_vars into despayable forms. It takes care of nested levels and adds {{}} as well
|
446 |
-
*
|
447 |
-
* @param array $mustache_vars is the array containing the names of the variable that must be proccessed by mustache in the template. The array must be in this form:
|
448 |
-
* array( array( 'name' => '', 'type' => '' ) ... ), and for loop tags it also contains a 'children' element which contains other mustache_vars array( array( 'name' => 'users', 'type' => 'loop_tag', 'children' => $merge_tags )
|
449 |
-
* @param int $level the current level of the nested variables.
|
450 |
-
*
|
451 |
-
* @since 2.0.0
|
452 |
-
*
|
453 |
-
*/
|
454 |
-
function display_mustache_available_vars( $mustache_vars, $level ){
|
455 |
-
if( !empty( $mustache_vars ) ){
|
456 |
-
foreach( $mustache_vars as $var ){
|
457 |
-
if ( $var[ 'name' ] != 'password' ) {
|
458 |
-
if ( empty( $var[ 'children' ] ) ) {
|
459 |
-
echo str_repeat( " ", $level );//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
460 |
-
if ( !empty( $var[ 'label' ] ) )
|
461 |
-
echo esc_html( apply_filters( 'wppb_variable_label', $var[ 'label' ] . ':' ) );
|
462 |
-
if ( !empty( $var[ 'unescaped' ] ) && $var[ 'unescaped' ] === true )
|
463 |
-
echo '{{{';
|
464 |
-
else
|
465 |
-
echo '{{';
|
466 |
-
echo esc_html( $var[ 'name' ] );
|
467 |
-
if ( !empty( $var[ 'unescaped' ] ) && $var[ 'unescaped' ] === true )
|
468 |
-
echo '}}}';
|
469 |
-
else
|
470 |
-
echo '}}';
|
471 |
-
echo PHP_EOL;
|
472 |
-
} else {
|
473 |
-
echo str_repeat( " ", $level ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
474 |
-
echo '{{#' . esc_html( $var[ 'name' ] ) . '}}' . PHP_EOL;
|
475 |
-
$level++;
|
476 |
-
$this->display_mustache_available_vars( $var[ 'children' ], $level );
|
477 |
-
$level--;
|
478 |
-
echo str_repeat( " ", $level ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
479 |
-
echo '{{/' . esc_html( $var[ 'name' ] ) . '}}' . PHP_EOL;
|
480 |
-
}
|
481 |
-
}
|
482 |
-
}
|
483 |
-
}
|
484 |
-
}
|
485 |
-
|
486 |
-
/**
|
487 |
-
* Function that saves the values from the metabox
|
488 |
-
*
|
489 |
-
* @param int $post_id the post id
|
490 |
-
* @param post object $post
|
491 |
-
*
|
492 |
-
* @since 2.0.0
|
493 |
-
*
|
494 |
-
*/
|
495 |
-
function save_box( $post_id, $post ){
|
496 |
-
global $post_type;
|
497 |
-
/* addition to save as option if we are not on a post type */
|
498 |
-
if( !is_numeric( $post_id ) && isset( $_POST['_meta_box_nonce'] ) && @wp_verify_nonce( sanitize_text_field( $_POST['_meta_box_nonce'] ), basename( __FILE__ ) ) ){
|
499 |
-
foreach ( $this->fields as $field ) {
|
500 |
-
|
501 |
-
if ( isset( $_POST[$field['id']] ) ) {
|
502 |
-
update_option( $field['id'], wp_unslash( $_POST[$field['id']] ) );//phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
503 |
-
}
|
504 |
-
|
505 |
-
}
|
506 |
-
}
|
507 |
-
|
508 |
-
// verify nonce
|
509 |
-
if ( ! ( in_array( $post_type, $this->page ) && isset( $_POST[$post_type . '_meta_box_nonce'] ) && @wp_verify_nonce( sanitize_text_field( $_POST[$post_type . '_meta_box_nonce'] ), basename( __FILE__ ) ) ) )
|
510 |
-
return $post_id;
|
511 |
-
// check autosave
|
512 |
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
513 |
-
return $post_id;
|
514 |
-
// check permissions
|
515 |
-
if ( !current_user_can( 'edit_page', $post_id ) )
|
516 |
-
return $post_id;
|
517 |
-
|
518 |
-
// loop through fields and save the data
|
519 |
-
foreach ( $this->fields as $field ) {
|
520 |
-
if( $field['type'] == 'tax_select' ) {
|
521 |
-
// save taxonomies
|
522 |
-
if ( isset( $_POST[$field['id']] ) )
|
523 |
-
$term = $_POST[$field['id']]; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
524 |
-
wp_set_object_terms( $post_id, $term, $field['id'] );
|
525 |
-
}
|
526 |
-
else {
|
527 |
-
// save the rest
|
528 |
-
$old = get_post_meta( $post_id, $field['id'], true );
|
529 |
-
if ( isset( $_POST[$field['id']] ) ) {
|
530 |
-
$new = $_POST[$field['id']]; /* phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized */
|
531 |
-
} else {
|
532 |
-
$new = '';
|
533 |
-
}
|
534 |
-
|
535 |
-
if ( $new && $new != $old ) {
|
536 |
-
if ( is_array( $new ) ) {
|
537 |
-
foreach ( $new as &$item ) {
|
538 |
-
//$item = esc_attr( $item );
|
539 |
-
}
|
540 |
-
unset( $item );
|
541 |
-
} else {
|
542 |
-
//$new = esc_attr( $new );
|
543 |
-
}
|
544 |
-
update_post_meta( $post_id, $field['id'], $new );
|
545 |
-
} elseif ( '' == $new && $old ) {
|
546 |
-
delete_post_meta( $post_id, $field['id'], $old );
|
547 |
-
}
|
548 |
-
}
|
549 |
-
} // end foreach
|
550 |
-
}
|
551 |
-
|
552 |
-
|
553 |
-
/**
|
554 |
-
* Function that saves the default values for each field in the database for options
|
555 |
-
*
|
556 |
-
*
|
557 |
-
* @since 2.0.0
|
558 |
-
*
|
559 |
-
*/
|
560 |
-
|
561 |
-
function save_default_values(){
|
562 |
-
/* only do it on pages where we save as options and we have fields */
|
563 |
-
if( !empty( $this->fields ) && !post_type_exists($this->page[0]) ){
|
564 |
-
foreach( $this->fields as $field ){
|
565 |
-
if( !empty( $field['default'] ) ){
|
566 |
-
/* see if we have an option with this name, if we have don't do anything */
|
567 |
-
$field_saved_value = get_option( $field['id'] );
|
568 |
-
if( empty( $field_saved_value ) ) {
|
569 |
-
update_option( $field['id'], $field['default'] );
|
570 |
-
}
|
571 |
-
}
|
572 |
-
}
|
573 |
-
}
|
574 |
-
}
|
575 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
features/email-confirmation/email-confirmation.php
CHANGED
@@ -60,7 +60,7 @@ function wppb_add_pending_users_header_script(){
|
|
60 |
actionText = '<?php esc_html_e( 'Do you want to', 'profile-builder' ); ?>' + ' ' + actionText;
|
61 |
|
62 |
if (confirm(actionText)) {
|
63 |
-
jQuery.post( ajaxurl , { action:"wppb_handle_email_confirmation_cases", URL:URL, todo:todo, user_email:user_email, nonce
|
64 |
if (response.trim() == 'ok')
|
65 |
window.location=URL;
|
66 |
|
60 |
actionText = '<?php esc_html_e( 'Do you want to', 'profile-builder' ); ?>' + ' ' + actionText;
|
61 |
|
62 |
if (confirm(actionText)) {
|
63 |
+
jQuery.post( ajaxurl , { action:"wppb_handle_email_confirmation_cases", URL:URL, todo:todo, user_email:user_email, nonce:"<?php echo esc_js( wp_create_nonce( 'wppb_handle_email_confirmation' ) ) ?>" }, function(response) {
|
64 |
if (response.trim() == 'ok')
|
65 |
window.location=URL;
|
66 |
|
front-end/class-formbuilder.php
CHANGED
@@ -384,7 +384,7 @@ class Profile_Builder_Form_Creator{
|
|
384 |
$redirect = $this->wppb_log_in_user( $this->args['redirect_url'], $redirect );
|
385 |
}
|
386 |
|
387 |
-
echo $form_message_tpl_start . $wppb_register_success_message . $form_message_tpl_end . $redirect; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ /* properly escaped above */
|
388 |
//action hook after registration success
|
389 |
do_action( 'wppb_register_success', $_REQUEST, $this->args['form_name'], $user_id );
|
390 |
return;
|
384 |
$redirect = $this->wppb_log_in_user( $this->args['redirect_url'], $redirect );
|
385 |
}
|
386 |
|
387 |
+
echo $form_message_tpl_start . wp_kses_post( $wppb_register_success_message ) . $form_message_tpl_end . $redirect; /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ /* properly escaped above */
|
388 |
//action hook after registration success
|
389 |
do_action( 'wppb_register_success', $_REQUEST, $this->args['form_name'], $user_id );
|
390 |
return;
|
front-end/login.php
CHANGED
@@ -267,8 +267,10 @@ function wppb_resend_confirmation_email() {
|
|
267 |
return;
|
268 |
|
269 |
include_once(plugin_dir_path(__FILE__) . '../features/email-confirmation/email-confirmation.php');
|
270 |
-
|
|
|
271 |
include_once(plugin_dir_path(__FILE__) . '../assets/lib/class-mustache-templates/class-mustache-templates.php');
|
|
|
272 |
global $wpdb;
|
273 |
$sql_result = $wpdb->get_row( $wpdb->prepare("SELECT * FROM " . $wpdb->base_prefix . "signups WHERE user_email = %s", sanitize_email( $_GET['email'] )), ARRAY_A );
|
274 |
|
267 |
return;
|
268 |
|
269 |
include_once(plugin_dir_path(__FILE__) . '../features/email-confirmation/email-confirmation.php');
|
270 |
+
|
271 |
+
if ( !class_exists('PB_Mustache_Generate_Template') && file_exists( plugin_dir_path(__FILE__) . '../assets/lib/class-mustache-templates/class-mustache-templates.php' ) )
|
272 |
include_once(plugin_dir_path(__FILE__) . '../assets/lib/class-mustache-templates/class-mustache-templates.php');
|
273 |
+
|
274 |
global $wpdb;
|
275 |
$sql_result = $wpdb->get_row( $wpdb->prepare("SELECT * FROM " . $wpdb->base_prefix . "signups WHERE user_email = %s", sanitize_email( $_GET['email'] )), ARRAY_A );
|
276 |
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Profile Builder
|
4 |
Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
|
5 |
Description: Login, registration and edit profile shortcodes for the front-end. Also you can choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
|
6 |
-
Version: 3.6.
|
7 |
Author: Cozmoslabs
|
8 |
Author URI: https://www.cozmoslabs.com/
|
9 |
Text Domain: profile-builder
|
@@ -70,7 +70,7 @@ function wppb_free_plugin_init() {
|
|
70 |
*
|
71 |
*
|
72 |
*/
|
73 |
-
define('PROFILE_BUILDER_VERSION', '3.6.
|
74 |
define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
75 |
define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
|
76 |
define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
3 |
Plugin Name: Profile Builder
|
4 |
Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
|
5 |
Description: Login, registration and edit profile shortcodes for the front-end. Also you can choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
|
6 |
+
Version: 3.6.7
|
7 |
Author: Cozmoslabs
|
8 |
Author URI: https://www.cozmoslabs.com/
|
9 |
Text Domain: profile-builder
|
70 |
*
|
71 |
*
|
72 |
*/
|
73 |
+
define('PROFILE_BUILDER_VERSION', '3.6.7' );
|
74 |
define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
75 |
define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
|
76 |
define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.cozmoslabs.com/wordpress-profile-builder/
|
|
4 |
Tags: user registration, user profile, registration, profile, user registration form, user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form, content restriction, restrict content
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 5.9
|
7 |
-
Stable tag: 3.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -177,6 +177,11 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
|
|
177 |
15. Edit or Add New User Role
|
178 |
|
179 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
180 |
= 3.6.6 =
|
181 |
* Feature: login users automatically after a password reset. Can be activated from the Advanced Settings -> Forms tab
|
182 |
* Fix: notice when deleting a labels edit add-on entry
|
4 |
Tags: user registration, user profile, registration, profile, user registration form, user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form, content restriction, restrict content
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 5.9
|
7 |
+
Stable tag: 3.6.7
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
177 |
15. Edit or Add New User Role
|
178 |
|
179 |
== Changelog ==
|
180 |
+
= 3.6.7 =
|
181 |
+
* Fix: issue with back-end Users with unconfirmed emails page
|
182 |
+
* Misc: remove unnecessary code
|
183 |
+
* Misc: sanitize outputted register sucesss message
|
184 |
+
|
185 |
= 3.6.6 =
|
186 |
* Feature: login users automatically after a password reset. Can be activated from the Advanced Settings -> Forms tab
|
187 |
* Fix: notice when deleting a labels edit add-on entry
|
translation/profile-builder.pot
CHANGED
@@ -377,7 +377,7 @@ msgstr ""
|
|
377 |
msgid "Edit Profile"
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: ../pb-add-on-custom-profile-menus/index.php:311, ../pb-add-on-custom-profile-menus/wppb-custom-profile-menus.php:74, front-end/class-formbuilder.php:464, front-end/login.php:
|
381 |
msgid "Register"
|
382 |
msgstr ""
|
383 |
|
@@ -2077,11 +2077,11 @@ msgstr ""
|
|
2077 |
msgid "Username and Email"
|
2078 |
msgstr ""
|
2079 |
|
2080 |
-
#: admin/general-settings.php:302, admin/manage-fields.php:333, front-end/login.php:
|
2081 |
msgid "Username"
|
2082 |
msgstr ""
|
2083 |
|
2084 |
-
#: admin/general-settings.php:303, front-end/login.php:
|
2085 |
msgid "Email"
|
2086 |
msgstr ""
|
2087 |
|
@@ -4649,7 +4649,7 @@ msgstr ""
|
|
4649 |
msgid "Only an administrator can add new users."
|
4650 |
msgstr ""
|
4651 |
|
4652 |
-
#: front-end/class-formbuilder.php:302, front-end/login.php:
|
4653 |
msgid "You are not allowed to do this."
|
4654 |
msgstr ""
|
4655 |
|
@@ -4718,79 +4718,79 @@ msgstr ""
|
|
4718 |
msgid "Log In"
|
4719 |
msgstr ""
|
4720 |
|
4721 |
-
#: front-end/login.php:
|
4722 |
msgid "SUCCESS"
|
4723 |
msgstr ""
|
4724 |
|
4725 |
-
#: front-end/login.php:
|
4726 |
msgid "Activation email sent to %s"
|
4727 |
msgstr ""
|
4728 |
|
4729 |
-
#: front-end/login.php:
|
4730 |
msgid "ERROR"
|
4731 |
msgstr ""
|
4732 |
|
4733 |
-
#: front-end/login.php:
|
4734 |
msgid "You need to confirm your Email Address before logging in! To resend the Confirmation Email %1$sclick here%2$s"
|
4735 |
msgstr ""
|
4736 |
|
4737 |
-
#: front-end/login.php:
|
4738 |
msgid "The password field is empty."
|
4739 |
msgstr ""
|
4740 |
|
4741 |
-
#: front-end/login.php:
|
4742 |
msgid "The password you entered is incorrect."
|
4743 |
msgstr ""
|
4744 |
|
4745 |
-
#: front-end/login.php:
|
4746 |
msgid "The username field is empty"
|
4747 |
msgstr ""
|
4748 |
|
4749 |
-
#: front-end/login.php:
|
4750 |
msgid "The username/email field is empty"
|
4751 |
msgstr ""
|
4752 |
|
4753 |
-
#: front-end/login.php:
|
4754 |
msgid "The email field is empty."
|
4755 |
msgstr ""
|
4756 |
|
4757 |
-
#: front-end/login.php:
|
4758 |
msgid "Invalid username."
|
4759 |
msgstr ""
|
4760 |
|
4761 |
-
#: front-end/login.php:
|
4762 |
msgid "Invalid username or email."
|
4763 |
msgstr ""
|
4764 |
|
4765 |
-
#: front-end/login.php:
|
4766 |
msgid "Invalid email."
|
4767 |
msgstr ""
|
4768 |
|
4769 |
-
#: front-end/login.php:
|
4770 |
msgid "Password Lost and Found."
|
4771 |
msgstr ""
|
4772 |
|
4773 |
-
#: front-end/login.php:
|
4774 |
msgid "Lost your password?"
|
4775 |
msgstr ""
|
4776 |
|
4777 |
-
#: front-end/login.php:
|
4778 |
msgid "Both fields are empty."
|
4779 |
msgstr ""
|
4780 |
|
4781 |
-
#: front-end/login.php:
|
4782 |
msgid "Log out of this account"
|
4783 |
msgstr ""
|
4784 |
|
4785 |
-
#: front-end/login.php:
|
4786 |
msgid "Log out »"
|
4787 |
msgstr ""
|
4788 |
|
4789 |
-
#: front-end/login.php:
|
4790 |
msgid "You are currently logged in as %1$s. %2$s"
|
4791 |
msgstr ""
|
4792 |
|
4793 |
-
#: front-end/login.php:
|
4794 |
msgid "Username or Email"
|
4795 |
msgstr ""
|
4796 |
|
377 |
msgid "Edit Profile"
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: ../pb-add-on-custom-profile-menus/index.php:311, ../pb-add-on-custom-profile-menus/wppb-custom-profile-menus.php:74, front-end/class-formbuilder.php:464, front-end/login.php:583, assets/misc/elementor/widgets/class-pb-widget-rf.php:32
|
381 |
msgid "Register"
|
382 |
msgstr ""
|
383 |
|
2077 |
msgid "Username and Email"
|
2078 |
msgstr ""
|
2079 |
|
2080 |
+
#: admin/general-settings.php:302, admin/manage-fields.php:333, front-end/login.php:339, front-end/login.php:353, front-end/login.php:537, add-ons/custom-redirects/custom_redirects_admin.php:60, add-ons/email-customizer/email-customizer.php:28, add-ons/user-listing/userlisting.php:113, add-ons/user-listing/userlisting.php:336, add-ons/user-listing/userlisting.php:878, add-ons/user-listing/userlisting.php:2526, features/admin-approval/class-admin-approval.php:174, features/email-confirmation/class-email-confirmation.php:168, admin/advanced-settings/includes/views/view-fields.php:121
|
2081 |
msgid "Username"
|
2082 |
msgstr ""
|
2083 |
|
2084 |
+
#: admin/general-settings.php:303, front-end/login.php:534, front-end/recover.php:118, add-ons/email-customizer/email-customizer.php:29, add-ons/user-listing/userlisting.php:119, add-ons/user-listing/userlisting.php:884, add-ons/user-listing/userlisting.php:2527, features/admin-approval/class-admin-approval.php:177, features/email-confirmation/class-email-confirmation.php:169, admin/advanced-settings/includes/shortcodes/resend-activation.php:9
|
2085 |
msgid "Email"
|
2086 |
msgstr ""
|
2087 |
|
4649 |
msgid "Only an administrator can add new users."
|
4650 |
msgstr ""
|
4651 |
|
4652 |
+
#: front-end/class-formbuilder.php:302, front-end/login.php:641, assets/lib/wck-api/wordpress-creation-kit.php:787
|
4653 |
msgid "You are not allowed to do this."
|
4654 |
msgstr ""
|
4655 |
|
4718 |
msgid "Log In"
|
4719 |
msgstr ""
|
4720 |
|
4721 |
+
#: front-end/login.php:282
|
4722 |
msgid "SUCCESS"
|
4723 |
msgstr ""
|
4724 |
|
4725 |
+
#: front-end/login.php:282
|
4726 |
msgid "Activation email sent to %s"
|
4727 |
msgstr ""
|
4728 |
|
4729 |
+
#: front-end/login.php:318, front-end/login.php:410, front-end/login.php:448, front-end/recover.php:18, front-end/recover.php:324, features/two-factor-authentication/class-two-factor-authentication.php:574, front-end/extra-fields/extra-fields.php:95
|
4730 |
msgid "ERROR"
|
4731 |
msgstr ""
|
4732 |
|
4733 |
+
#: front-end/login.php:318
|
4734 |
msgid "You need to confirm your Email Address before logging in! To resend the Confirmation Email %1$sclick here%2$s"
|
4735 |
msgstr ""
|
4736 |
|
4737 |
+
#: front-end/login.php:414
|
4738 |
msgid "The password field is empty."
|
4739 |
msgstr ""
|
4740 |
|
4741 |
+
#: front-end/login.php:418
|
4742 |
msgid "The password you entered is incorrect."
|
4743 |
msgstr ""
|
4744 |
|
4745 |
+
#: front-end/login.php:427
|
4746 |
msgid "The username field is empty"
|
4747 |
msgstr ""
|
4748 |
|
4749 |
+
#: front-end/login.php:425
|
4750 |
msgid "The username/email field is empty"
|
4751 |
msgstr ""
|
4752 |
|
4753 |
+
#: front-end/login.php:423
|
4754 |
msgid "The email field is empty."
|
4755 |
msgstr ""
|
4756 |
|
4757 |
+
#: front-end/login.php:436
|
4758 |
msgid "Invalid username."
|
4759 |
msgstr ""
|
4760 |
|
4761 |
+
#: front-end/login.php:434
|
4762 |
msgid "Invalid username or email."
|
4763 |
msgstr ""
|
4764 |
|
4765 |
+
#: front-end/login.php:432
|
4766 |
msgid "Invalid email."
|
4767 |
msgstr ""
|
4768 |
|
4769 |
+
#: front-end/login.php:442
|
4770 |
msgid "Password Lost and Found."
|
4771 |
msgstr ""
|
4772 |
|
4773 |
+
#: front-end/login.php:442, front-end/login.php:589
|
4774 |
msgid "Lost your password?"
|
4775 |
msgstr ""
|
4776 |
|
4777 |
+
#: front-end/login.php:448
|
4778 |
msgid "Both fields are empty."
|
4779 |
msgstr ""
|
4780 |
|
4781 |
+
#: front-end/login.php:628, front-end/logout.php:38
|
4782 |
msgid "Log out of this account"
|
4783 |
msgstr ""
|
4784 |
|
4785 |
+
#: front-end/login.php:628, front-end/logout.php:25
|
4786 |
msgid "Log out »"
|
4787 |
msgstr ""
|
4788 |
|
4789 |
+
#: front-end/login.php:629
|
4790 |
msgid "You are currently logged in as %1$s. %2$s"
|
4791 |
msgstr ""
|
4792 |
|
4793 |
+
#: front-end/login.php:541, front-end/recover.php:122
|
4794 |
msgid "Username or Email"
|
4795 |
msgstr ""
|
4796 |
|