Version Description
- Fixed an issue with the Boss theme by moving the priority of the login_redirect filter
- Fixed issue with edit other user on the Twenty Nineteen theme
- Fixed issues with jQuery code and the Twenty Nineteen theme
- Fixed conflict with Elementor Pro.
Download this release
Release Info
| Developer | madalin.ungureanu |
| Plugin | |
| Version | 2.9.5 |
| Comparing to | |
| See all releases | |
Code changes from version 2.9.4 to 2.9.5
- assets/lib/wck-api/wordpress-creation-kit.php +290 -290
- features/functions.php +5 -1
- front-end/class-formbuilder.php +1 -4
- front-end/login.php +1 -1
- front-end/recover.php +3 -3
- index.php +2 -2
- readme.txt +9 -3
- translation/profile-builder.catalog.php +15 -9
- translation/profile-builder.pot +113 -89
assets/lib/wck-api/wordpress-creation-kit.php
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<?php
|
| 2 |
/* Copyright 2011 Ungureanu Madalin (email : madalin@reflectionmedia.ro)
|
| 3 |
This program is free software; you can redistribute it and/or modify
|
| 4 |
it under the terms of the GNU General Public License as published by
|
|
@@ -18,20 +18,20 @@ if( file_exists( dirname(__FILE__). '/wck-fep/wck-fep.php' ) )
|
|
| 18 |
|
| 19 |
if( file_exists( dirname(__FILE__). '/wck-static-metabox-api.php' ) )
|
| 20 |
require_once( 'wck-static-metabox-api.php' );
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
/*
|
| 24 |
|
| 25 |
Usage Example 1:
|
| 26 |
|
| 27 |
|
| 28 |
-
$fint = array(
|
| 29 |
-
array( 'type' => 'text', 'title' => 'Title', 'description' => 'Description for this input' ),
|
| 30 |
-
array( 'type' => 'textarea', 'title' => 'Description' ),
|
| 31 |
-
array( 'type' => 'upload', 'title' => 'Image', 'description' => 'Upload a image' ),
|
| 32 |
-
array( 'type' => 'select', 'title' => 'Select This', 'options' => array( 'Option 1', 'Option 2', 'Option 3' ) ),
|
| 33 |
-
array( 'type' => 'checkbox', 'title' => 'Check This', 'options' => array( 'Option 1', 'Option 2', 'Option 3' ) ),
|
| 34 |
-
array( 'type' => 'radio', 'title' => 'Radio This', 'options' => array( 'Radio 1', 'Radio 2', 'Radio 3' ) ),
|
| 35 |
);
|
| 36 |
|
| 37 |
$args = array(
|
|
@@ -39,7 +39,7 @@ $args = array(
|
|
| 39 |
'metabox_title' => 'Slideshow Class',
|
| 40 |
'post_type' => 'slideshows',
|
| 41 |
'meta_name' => 'rmscontent',
|
| 42 |
-
'meta_array' => $fint
|
| 43 |
);
|
| 44 |
|
| 45 |
new Wordpress_Creation_Kit_PB( $args );
|
|
@@ -52,7 +52,7 @@ $meta = get_post_meta( $post->ID, 'rmscontent', true );
|
|
| 52 |
*/
|
| 53 |
|
| 54 |
class Wordpress_Creation_Kit_PB{
|
| 55 |
-
|
| 56 |
private $defaults = array(
|
| 57 |
'metabox_id' => '',
|
| 58 |
'metabox_title' => 'Meta Box',
|
|
@@ -67,26 +67,26 @@ class Wordpress_Creation_Kit_PB{
|
|
| 67 |
'context' => 'post_meta',
|
| 68 |
'mb_context' => 'normal'
|
| 69 |
);
|
| 70 |
-
private $args;
|
| 71 |
-
|
| 72 |
-
|
| 73 |
/* Constructor method for the class. */
|
| 74 |
-
function __construct( $args ) {
|
| 75 |
|
| 76 |
/* Global that will hold all the arguments for all the custom boxes */
|
| 77 |
global $wck_objects;
|
| 78 |
-
|
| 79 |
/* Merge the input arguments and the defaults. */
|
| 80 |
$this->args = wp_parse_args( $args, $this->defaults );
|
| 81 |
-
|
| 82 |
/* Add the settings for this box to the global object */
|
| 83 |
$wck_objects[$this->args['metabox_id']] = $this->args;
|
| 84 |
-
|
| 85 |
/*print scripts*/
|
| 86 |
-
add_action('admin_enqueue_scripts', array( &$this, 'wck_print_scripts' ));
|
| 87 |
/* add our own ajaxurl because we are going to use the wck script also in frontend and we want to avoid any conflicts */
|
| 88 |
add_action( 'admin_head', array( &$this, 'wck_print_ajax_url' ) );
|
| 89 |
-
|
| 90 |
// Set up the AJAX hooks
|
| 91 |
add_action("wp_ajax_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
|
| 92 |
add_action("wp_ajax_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
|
|
@@ -105,42 +105,42 @@ class Wordpress_Creation_Kit_PB{
|
|
| 105 |
add_action('wp_insert_post', array($this, 'wck_single_metabox_redirect_if_errors'), 10, 2);
|
| 106 |
/* if we have any $_GET errors alert them with js so we have consistency */
|
| 107 |
add_action('admin_print_footer_scripts', array($this, 'wck_single_metabox_errors_display') );
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
}
|
| 111 |
-
|
| 112 |
-
|
| 113 |
//add metabox using wordpress api
|
| 114 |
|
| 115 |
function wck_add_metabox() {
|
| 116 |
-
|
| 117 |
global $pb_wck_pages_hooknames;
|
| 118 |
-
|
| 119 |
if( $this->args['context'] == 'post_meta' ){
|
| 120 |
if( $this->args['post_id'] == '' && $this->args['page_template'] == '' ){
|
| 121 |
add_meta_box($this->args['metabox_id'], $this->args['metabox_title'], array( &$this, 'wck_content' ), $this->args['post_type'], $this->args['mb_context'], 'high', array( 'meta_name' => $this->args['meta_name'], 'meta_array' => $this->args['meta_array']) );
|
| 122 |
/* add class to meta box */
|
| 123 |
add_filter( "postbox_classes_".$this->args['post_type']."_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 124 |
}
|
| 125 |
-
else{
|
| 126 |
if( !empty( $_GET['post'] ) )
|
| 127 |
$post_id = filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT );
|
| 128 |
else if( !empty( $_POST['post_ID'] ) )
|
| 129 |
$post_id = filter_var( $_POST['post_ID'], FILTER_SANITIZE_NUMBER_INT );
|
| 130 |
-
else
|
| 131 |
$post_id = '';
|
| 132 |
-
|
| 133 |
-
|
| 134 |
if( $this->args['post_id'] != '' && $this->args['page_template'] != '' ){
|
| 135 |
-
$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
|
| 136 |
if( $this->args['post_id'] == $post_id && $template_file == $this->args['page_template'] )
|
| 137 |
add_meta_box($this->args['metabox_id'], $this->args['metabox_title'], array( &$this, 'wck_content' ), 'page', $this->args['mb_context'], 'high', array( 'meta_name' => $this->args['meta_name'], 'meta_array' => $this->args['meta_array'] ) );
|
| 138 |
-
|
| 139 |
/* add class to meta box */
|
| 140 |
add_filter( "postbox_classes_page_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 141 |
}
|
| 142 |
else{
|
| 143 |
-
|
| 144 |
if( $this->args['post_id'] != '' ){
|
| 145 |
if( $this->args['post_id'] == $post_id ){
|
| 146 |
$post_type = get_post_type( $post_id );
|
|
@@ -149,19 +149,19 @@ class Wordpress_Creation_Kit_PB{
|
|
| 149 |
add_filter( "postbox_classes_".$post_type."_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 150 |
}
|
| 151 |
}
|
| 152 |
-
|
| 153 |
if( $this->args['page_template'] != '' ){
|
| 154 |
-
$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
|
| 155 |
if ( $template_file == $this->args['page_template'] ){
|
| 156 |
add_meta_box($this->args['metabox_id'], $this->args['metabox_title'], array( &$this, 'wck_content' ), 'page', $this->args['mb_context'], 'high', array( 'meta_name' => $this->args['meta_name'], 'meta_array' => $this->args['meta_array']) );
|
| 157 |
/* add class to meta box */
|
| 158 |
add_filter( "postbox_classes_page_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 159 |
}
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
}
|
| 163 |
-
|
| 164 |
-
}
|
| 165 |
}
|
| 166 |
else if( $this->args['context'] == 'option' ){
|
| 167 |
if( !empty( $pb_wck_pages_hooknames[$this->args['post_type']] ) ) {
|
|
@@ -170,44 +170,44 @@ class Wordpress_Creation_Kit_PB{
|
|
| 170 |
add_filter("postbox_classes_" . $pb_wck_pages_hooknames[$this->args['post_type']] . "_" . $this->args['metabox_id'], array(&$this, 'wck_add_metabox_classes'));
|
| 171 |
}
|
| 172 |
}
|
| 173 |
-
}
|
| 174 |
-
|
| 175 |
/* Function used to add classes to the wck meta boxes */
|
| 176 |
function wck_add_metabox_classes( $classes ){
|
| 177 |
array_push($classes,'wck-post-box');
|
| 178 |
return $classes;
|
| 179 |
}
|
| 180 |
|
| 181 |
-
function wck_content($post, $metabox){
|
| 182 |
if( !empty( $post->ID ) )
|
| 183 |
$post_id = $post->ID;
|
| 184 |
else
|
| 185 |
$post_id = '';
|
| 186 |
-
|
| 187 |
-
//output the add form
|
| 188 |
self::create_add_form($metabox['args']['meta_array'], $metabox['args']['meta_name'], $post);
|
| 189 |
|
| 190 |
//output the entries only for repeater fields
|
| 191 |
if( !$this->args['single'] )
|
| 192 |
echo self::wck_output_meta_content($metabox['args']['meta_name'], $post_id, $metabox['args']['meta_array']);
|
| 193 |
}
|
| 194 |
-
|
| 195 |
/**
|
| 196 |
* The function used to create a form element
|
| 197 |
*
|
| 198 |
* @since 1.0.0
|
| 199 |
*
|
| 200 |
-
* @param string $meta Meta name.
|
| 201 |
-
* @param array $details Contains the details for the field.
|
| 202 |
* @param string $value Contains input value;
|
| 203 |
* @param string $context Context where the function is used. Depending on it some actions are preformed.;
|
| 204 |
* @param int $post_id The post ID;
|
| 205 |
* @return string $element input element html string.
|
| 206 |
*/
|
| 207 |
-
|
| 208 |
function wck_output_form_field( $meta, $details, $value = '', $context = '', $post_id = '' ){
|
| 209 |
$element = '';
|
| 210 |
-
|
| 211 |
if( $context == 'edit_form' ){
|
| 212 |
$edit_class = '.mb-table-container ';
|
| 213 |
$var_prefix = 'edit';
|
|
@@ -233,14 +233,14 @@ class Wordpress_Creation_Kit_PB{
|
|
| 233 |
if( !empty( $details['required'] ) && $details['required'] )
|
| 234 |
$element .= '<span class="required">*</span>';
|
| 235 |
$element .= '</label>';
|
| 236 |
-
|
| 237 |
-
$element .= '<div class="mb-right-column">';
|
| 238 |
-
|
| 239 |
-
/*
|
| 240 |
include actual field type
|
| 241 |
possible field types: text, textarea, select, checkbox, radio, upload, wysiwyg editor, datepicker, country select, user select, cpt select
|
| 242 |
*/
|
| 243 |
-
|
| 244 |
if( function_exists( 'wck_nr_get_repeater_boxes' ) ){
|
| 245 |
$cfc_titles = wck_nr_get_repeater_boxes();
|
| 246 |
if( in_array( $details['type'], $cfc_titles ) ){
|
|
@@ -255,20 +255,20 @@ class Wordpress_Creation_Kit_PB{
|
|
| 255 |
|
| 256 |
// Add a filter that allows us to add support for custom field types, not just the ones defined in fields (wck api)
|
| 257 |
$element .= apply_filters('wck_output_form_field_customtype_' . $details['type'], '', $value, $details, $single_prefix);
|
| 258 |
-
|
| 259 |
if( !empty( $details['description'] ) ){
|
| 260 |
$element .= '<p class="description">'. $details['description'].'</p>';
|
| 261 |
}
|
| 262 |
-
|
| 263 |
$element .= '</div><!-- .mb-right-column -->';
|
| 264 |
|
| 265 |
$element = apply_filters( "wck_output_form_field_{$meta}_" . Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ), $element );
|
| 266 |
-
|
| 267 |
return $element;
|
| 268 |
-
|
| 269 |
}
|
| 270 |
-
|
| 271 |
-
|
| 272 |
/**
|
| 273 |
* The function used to create the form for adding records
|
| 274 |
*
|
|
@@ -277,7 +277,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 277 |
* @param array $fields Contains the desired inputs in the repeater field. Must be like: array('Key:type').
|
| 278 |
* Key is used for the name attribute of the field, label of the field and as the meta_key.
|
| 279 |
* Supported types: input, textarea, upload
|
| 280 |
-
* @param string $meta It is used in update_post_meta($id, $meta, $results);. Use '_' prefix if you don't want
|
| 281 |
* the meta to apear in custom fields box.
|
| 282 |
* @param object $post Post object
|
| 283 |
*/
|
|
@@ -305,7 +305,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 305 |
$element_id = 0;
|
| 306 |
if( !empty( $fields ) ){
|
| 307 |
foreach( $fields as $details ){
|
| 308 |
-
|
| 309 |
do_action( "wck_before_add_form_{$meta}_element_{$element_id}" );
|
| 310 |
|
| 311 |
/* set values in the case of single forms */
|
|
@@ -320,9 +320,9 @@ class Wordpress_Creation_Kit_PB{
|
|
| 320 |
<?php echo self::wck_output_form_field( $meta, $details, $value, $context, $post_id ); ?>
|
| 321 |
</li>
|
| 322 |
<?php
|
| 323 |
-
|
| 324 |
do_action( "wck_after_add_form_{$meta}_element_{$element_id}" );
|
| 325 |
-
|
| 326 |
$element_id++;
|
| 327 |
}
|
| 328 |
}
|
|
@@ -339,106 +339,106 @@ class Wordpress_Creation_Kit_PB{
|
|
| 339 |
<script>wck_set_to_widest( '.field-label', '<?php echo $meta ?>' );</script>
|
| 340 |
<?php
|
| 341 |
}
|
| 342 |
-
|
| 343 |
/**
|
| 344 |
* The function used to display a form to update a reccord from meta
|
| 345 |
*
|
| 346 |
* @since 1.0.0
|
| 347 |
-
*
|
| 348 |
-
* @param string $meta It is used in get_post_meta($id, $meta, $results);. Use '_' prefix if you don't want
|
| 349 |
* the meta to apear in custom fields box.
|
| 350 |
* @param int $id Post id
|
| 351 |
* @param int $element_id The id of the reccord. The meta is stored as array(array());
|
| 352 |
*/
|
| 353 |
function mb_update_form($fields, $meta, $id, $element_id){
|
| 354 |
-
|
| 355 |
-
$update_nonce = wp_create_nonce( 'wck-update-entry' );
|
| 356 |
-
|
| 357 |
if( $this->args['context'] == 'post_meta' )
|
| 358 |
$results = get_post_meta($id, $meta, true);
|
| 359 |
else if ( $this->args['context'] == 'option' )
|
| 360 |
-
$results = get_option( apply_filters( 'wck_option_meta' , $meta ) );
|
| 361 |
-
|
| 362 |
/* Filter primary used for CFC/OPC fields in order to show/hide fields based on type */
|
| 363 |
$wck_update_container_css_class = " class='wck_update_container update_container_$meta'";
|
| 364 |
$wck_update_container_css_class = apply_filters("wck_update_container_class_{$meta}", $wck_update_container_css_class, $meta, $results, $element_id );
|
| 365 |
-
|
| 366 |
$form = '';
|
| 367 |
$form .= '<tr id="update_container_'.$meta.'_'.$element_id.'" ' . $wck_update_container_css_class . '><td colspan="4">';
|
| 368 |
if($results != null){
|
| 369 |
$i = 0;
|
| 370 |
-
$form .= '<ul class="mb-list-entry-fields">';
|
| 371 |
-
|
| 372 |
if( !empty( $fields ) ){
|
| 373 |
-
foreach( $fields as $field ){
|
| 374 |
$details = $field;
|
| 375 |
if( isset( $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )] ) )
|
| 376 |
$value = $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )];
|
| 377 |
-
else
|
| 378 |
$value = '';
|
| 379 |
|
| 380 |
$form = apply_filters( "wck_before_update_form_{$meta}_element_{$i}", $form, $element_id, $value );
|
| 381 |
-
|
| 382 |
$form .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'">';
|
| 383 |
-
|
| 384 |
-
$form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form', $id );
|
| 385 |
-
|
| 386 |
$form .= '</li>';
|
| 387 |
-
|
| 388 |
$form = apply_filters( "wck_after_update_form_{$meta}_element_{$i}", $form, $element_id, $value );
|
| 389 |
-
|
| 390 |
$i++;
|
| 391 |
}
|
| 392 |
}
|
| 393 |
$form .= '<li style="overflow:visible;">';
|
| 394 |
$form .= '<a href="javascript:void(0)" class="button-primary" onclick=\'updateMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($update_nonce).'")\'><span>'. apply_filters( 'wck_save_changes_button', __( 'Save Changes', 'profile-builder' ), $meta ) .'</span></a>';
|
| 395 |
$form .= '<a href="javascript:void(0)" class="button-secondary" style="margin-left:10px;" onclick=\'removeUpdateForm("'. esc_js( 'update_container_'.$meta.'_'.$element_id ). '" )\'><span>'. apply_filters( 'wck_cancel_button', __( 'Cancel', 'profile-builder' ), $meta ) .'</span></a>';
|
| 396 |
-
$form .= '</li>';
|
| 397 |
-
|
| 398 |
$form .= '</ul>';
|
| 399 |
-
}
|
| 400 |
$form .= '</td></tr>';
|
| 401 |
-
|
| 402 |
return $form;
|
| 403 |
}
|
| 404 |
|
| 405 |
-
|
| 406 |
/**
|
| 407 |
* The function used to output the content of a meta
|
| 408 |
*
|
| 409 |
* @since 1.0.0
|
| 410 |
-
*
|
| 411 |
-
* @param string $meta It is used in get_post_meta($id, $meta, $results);. Use '_' prefix if you don't want
|
| 412 |
* the meta to apear in custom fields box.
|
| 413 |
* @param int $id Post id
|
| 414 |
*/
|
| 415 |
-
function wck_output_meta_content($meta, $id, $fields, $box_args = '' ){
|
| 416 |
/* in fep $this->args is empty so we need it as a parameter */
|
| 417 |
-
if( !empty( $box_args ) )
|
| 418 |
$this->args = wp_parse_args( $box_args, $this->defaults );
|
| 419 |
-
|
| 420 |
-
|
| 421 |
if( $this->args['context'] == 'post_meta' || $this->args['context'] == '' )
|
| 422 |
$results = get_post_meta($id, $meta, true);
|
| 423 |
else if ( $this->args['context'] == 'option' )
|
| 424 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta ) );
|
| 425 |
-
|
| 426 |
$list = '';
|
| 427 |
$list .= '<table id="container_'.esc_attr($meta).'" class="mb-table-container widefat';
|
| 428 |
-
|
| 429 |
if( $this->args['single'] ) $list .= ' single';
|
| 430 |
if( !$this->args['sortable'] ) $list .= ' not-sortable';
|
| 431 |
-
|
| 432 |
-
$list .= '" post="'.esc_attr($id).'">';
|
| 433 |
-
|
| 434 |
-
|
| 435 |
if( !empty( $results ) ){
|
| 436 |
$list .= apply_filters( 'wck_metabox_content_header_'.$meta , '<thead><tr><th class="wck-number">#</th><th class="wck-content">'. __( 'Content', 'profile-builder' ) .'</th><th class="wck-edit">'. __( 'Edit', 'wck' ) .'</th><th class="wck-delete">'. __( 'Delete', 'wck' ) .'</th></tr></thead>' );
|
| 437 |
$i=0;
|
| 438 |
-
foreach ($results as $result){
|
| 439 |
-
|
| 440 |
$list .= self::wck_output_entry_content( $meta, $id, $fields, $results, $i );
|
| 441 |
-
|
| 442 |
$i++;
|
| 443 |
}
|
| 444 |
}
|
|
@@ -448,10 +448,10 @@ class Wordpress_Creation_Kit_PB{
|
|
| 448 |
$list = apply_filters('wck_metabox_content_'.$meta, $list, $id);
|
| 449 |
return $list;
|
| 450 |
}
|
| 451 |
-
|
| 452 |
function wck_output_entry_content( $meta, $id, $fields, $results, $element_id ){
|
| 453 |
$edit_nonce = wp_create_nonce( 'wck-edit-entry' );
|
| 454 |
-
$delete_nonce = wp_create_nonce( 'wck-delete-entry' );
|
| 455 |
$entry_nr = $element_id +1;
|
| 456 |
|
| 457 |
$wck_element_class = '';
|
|
@@ -463,22 +463,22 @@ class Wordpress_Creation_Kit_PB{
|
|
| 463 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-number">'. $entry_nr .'</td>';
|
| 464 |
$list .= '<td class="wck-content"><ul>' . "\r\n";
|
| 465 |
|
| 466 |
-
$j = 0;
|
| 467 |
-
|
| 468 |
if( !empty( $fields ) ){
|
| 469 |
foreach( $fields as $field ){
|
| 470 |
$details = $field;
|
| 471 |
-
|
| 472 |
if( !empty( $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )] ) )
|
| 473 |
$value = $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )];
|
| 474 |
else
|
| 475 |
$value ='';
|
| 476 |
-
|
| 477 |
-
/* filter display value */
|
| 478 |
$value = apply_filters( "wck_displayed_value_{$meta}_element_{$j}", $value );
|
| 479 |
|
| 480 |
/* display it differently based on field type*/
|
| 481 |
-
if( $details['type'] == 'upload' ){
|
| 482 |
$display_value = self::wck_get_entry_field_upload($value);
|
| 483 |
} elseif ( $details['type'] == 'user select' ) {
|
| 484 |
$display_value = self::wck_get_entry_field_user_select( $value ) . '</pre>';
|
|
@@ -498,7 +498,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 498 |
/*check for nested repeater type and set it acordingly */
|
| 499 |
if( strpos( $details['type'], 'CFC-') === 0 )
|
| 500 |
$details['type'] = 'nested-repeater';
|
| 501 |
-
|
| 502 |
$list .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" data-type="'.$details['type'].'"><strong>'.$details['title'].': </strong>'.$display_value.' </li>' . "\r\n";
|
| 503 |
|
| 504 |
$list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
|
|
@@ -509,7 +509,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 509 |
if ($meta == 'wck_cfc_fields') {
|
| 510 |
if( !empty( $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )] ) ){
|
| 511 |
$field_title = $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )];
|
| 512 |
-
if ($field_title == "Field Type")
|
| 513 |
$cfc_field_type = $value;
|
| 514 |
}
|
| 515 |
}
|
|
@@ -524,12 +524,12 @@ class Wordpress_Creation_Kit_PB{
|
|
| 524 |
$list .= wck_nr_handle_repeaters( $meta, $id, $fields, $results, $element_id );
|
| 525 |
}
|
| 526 |
}
|
| 527 |
-
|
| 528 |
if( $element_id === 0 ){
|
| 529 |
$list .= "<script>wck_set_to_widest( 'strong', '". $meta ."' );</script>";
|
| 530 |
}
|
| 531 |
|
| 532 |
-
$list .= '</td>';
|
| 533 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-edit"><a href="javascript:void(0)" class="button-secondary" onclick=\'showUpdateFormMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($edit_nonce).'")\' title="'. __( 'Edit this item', 'profile-builder' ) .'">'. apply_filters( 'wck_edit_button', __('Edit','wck'), $meta ) .'</a></td>';
|
| 534 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-delete"><a href="javascript:void(0)" class="mbdelete" onclick=\'removeMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($delete_nonce).'")\' title="'. __( 'Delete this item', 'profile-builder' ) .'">'. apply_filters( 'wck_delete_button', __( 'Delete', 'wck' ), $meta) .'</a></td>';
|
| 535 |
$list .= apply_filters( 'wck_add_content_after_columns', '', $list, $meta );
|
|
@@ -576,17 +576,17 @@ class Wordpress_Creation_Kit_PB{
|
|
| 576 |
|
| 577 |
/* function to generate output for upload field */
|
| 578 |
function wck_get_entry_field_upload($id){
|
| 579 |
-
if( !empty ( $id ) && is_numeric( $id ) ){
|
| 580 |
$file_src = wp_get_attachment_url($id);
|
| 581 |
$thumbnail = wp_get_attachment_image( $id, array( 80, 60 ), true );
|
| 582 |
$file_name = get_the_title( $id );
|
| 583 |
-
|
| 584 |
if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $id ), $matches ) )
|
| 585 |
$file_type = esc_html( strtoupper( $matches[1] ) );
|
| 586 |
else
|
| 587 |
$file_type = strtoupper( str_replace( 'image/', '', get_post_mime_type( $id ) ) );
|
| 588 |
-
|
| 589 |
-
return $display_value = '<div class="upload-field-details">'. $thumbnail .'<p><span class="file-name">'. $file_name .'</span><span class="file-type">'. $file_type . '</span></p></div>';
|
| 590 |
} else {
|
| 591 |
return '';
|
| 592 |
}
|
|
@@ -594,97 +594,97 @@ class Wordpress_Creation_Kit_PB{
|
|
| 594 |
|
| 595 |
/* function to generate output for user select */
|
| 596 |
function wck_get_entry_field_user_select($id){
|
| 597 |
-
if( !empty ( $id ) && is_numeric( $id ) ){
|
| 598 |
$user = get_user_by( 'id', $id );
|
| 599 |
-
if ( $user )
|
| 600 |
return '<pre>'.htmlspecialchars( $user->display_name );
|
| 601 |
else
|
| 602 |
return 'Error - User ID not found in database';
|
| 603 |
-
|
| 604 |
} else {
|
| 605 |
return '';
|
| 606 |
}
|
| 607 |
}
|
| 608 |
-
|
| 609 |
/* function to generate output for cpt select */
|
| 610 |
function wck_get_entry_field_cpt_select($id){
|
| 611 |
-
if( !empty ( $id ) && is_numeric( $id ) ){
|
| 612 |
-
$post = get_post( $id );
|
| 613 |
-
|
| 614 |
if ( $post != null ){
|
| 615 |
if ( $post->post_title == '' )
|
| 616 |
$post->post_title = 'No title. ID: ' . $id;
|
| 617 |
-
|
| 618 |
-
return '<pre>'.htmlspecialchars( $post->post_title );
|
| 619 |
}
|
| 620 |
else
|
| 621 |
return 'Error - Post ID not found in database';
|
| 622 |
-
|
| 623 |
} else {
|
| 624 |
return '';
|
| 625 |
}
|
| 626 |
-
}
|
| 627 |
-
|
| 628 |
/* enque the js/css */
|
| 629 |
function wck_print_scripts($hook){
|
| 630 |
global $pb_wck_pages_hooknames;
|
| 631 |
-
|
| 632 |
-
if( $this->args['context'] == 'post_meta' ) {
|
| 633 |
if( 'post.php' == $hook || 'post-new.php' == $hook){
|
| 634 |
-
|
| 635 |
/* only add on profile builder custom post types */
|
| 636 |
if( !empty( $_GET['post'] ) )
|
| 637 |
$post_id = filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT );
|
| 638 |
else if( !empty( $_POST['post_ID'] ) )
|
| 639 |
$post_id = filter_var( $_POST['post_ID'], FILTER_SANITIZE_NUMBER_INT );
|
| 640 |
-
else
|
| 641 |
$post_id = '';
|
| 642 |
if( !empty( $post_id ) ){
|
| 643 |
-
$current_post_type = get_post_type( $post_id );
|
| 644 |
-
if( strpos( $current_post_type, 'wppb-' ) === false )
|
| 645 |
return '';
|
| 646 |
-
}
|
| 647 |
-
|
| 648 |
-
self::wck_enqueue();
|
| 649 |
}
|
| 650 |
}
|
| 651 |
elseif( $this->args['context'] == 'option' ){
|
| 652 |
-
if( $pb_wck_pages_hooknames[$this->args['post_type']] == $hook ){
|
| 653 |
-
self::wck_enqueue( 'options' );
|
| 654 |
}
|
| 655 |
}
|
| 656 |
}
|
| 657 |
-
|
| 658 |
/* our own ajaxurl */
|
| 659 |
function wck_print_ajax_url(){
|
| 660 |
echo '<script type="text/javascript">var wppbWckAjaxurl = "'. apply_filters( 'wck_ajax_url', admin_url('admin-ajax.php') ) .'";</script>';
|
| 661 |
}
|
| 662 |
-
|
| 663 |
-
|
| 664 |
/* Helper function for enqueueing scripts and styles */
|
| 665 |
private static function wck_enqueue( $context = '' ){
|
| 666 |
-
|
| 667 |
wp_enqueue_script( 'jquery-ui-draggable' );
|
| 668 |
wp_enqueue_script( 'jquery-ui-droppable' );
|
| 669 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
| 670 |
-
|
| 671 |
if( $context == 'options' ){
|
| 672 |
wp_enqueue_script( 'thickbox' );
|
| 673 |
wp_enqueue_style( 'thickbox' );
|
| 674 |
}
|
| 675 |
-
|
| 676 |
wp_enqueue_script('wordpress-creation-kit', plugins_url('/wordpress-creation-kit.js', __FILE__), array('jquery', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ), PROFILE_BUILDER_VERSION );
|
| 677 |
wp_register_style('wordpress-creation-kit-css', plugins_url('/wordpress-creation-kit.css', __FILE__), array(), PROFILE_BUILDER_VERSION );
|
| 678 |
wp_enqueue_style('wordpress-creation-kit-css');
|
| 679 |
|
| 680 |
-
// wysiwyg
|
| 681 |
// wp_register_script( 'wck-tinymce', plugins_url( '/assets/js/tiny_mce/tiny_mce.js', __FILE__ ), array(), '1.0', true );
|
| 682 |
// wp_enqueue_script( 'wck-tinymce' );
|
| 683 |
// wp_register_script( 'wck-tinymce-init', plugins_url( '/assets/js/tiny_mce/wck_tiny_mce_init.js', __FILE__ ), array(), '1.0', true );
|
| 684 |
// wp_enqueue_script( 'wck-tinymce-init' );
|
| 685 |
-
|
| 686 |
//datepicker
|
| 687 |
-
wp_enqueue_script('jquery-ui-datepicker');
|
| 688 |
wp_enqueue_style( 'jquery-style', plugins_url( '/assets/datepicker/datepicker.css', __FILE__ ) );
|
| 689 |
|
| 690 |
|
|
@@ -692,7 +692,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 692 |
wp_enqueue_media();
|
| 693 |
wp_enqueue_script('wck-upload-field', plugins_url('/fields/upload.js', __FILE__), array('jquery') );
|
| 694 |
|
| 695 |
-
}
|
| 696 |
|
| 697 |
/* Helper function for required fields */
|
| 698 |
function wck_test_required( $meta_array, $meta, $values, $id ){
|
|
@@ -700,16 +700,16 @@ class Wordpress_Creation_Kit_PB{
|
|
| 700 |
$required_fields = array();
|
| 701 |
$required_fields_with_errors = array();
|
| 702 |
$required_message = '';
|
| 703 |
-
|
| 704 |
$errors = '';
|
| 705 |
-
|
| 706 |
if( !empty( $fields ) ){
|
| 707 |
foreach( $fields as $field ){
|
| 708 |
if( !empty( $field['required'] ) && $field['required'] )
|
| 709 |
$required_fields[Wordpress_Creation_Kit_PB::wck_generate_slug( $field['title'], $field )] = $field['title'];
|
| 710 |
}
|
| 711 |
}
|
| 712 |
-
|
| 713 |
if( !empty( $values ) ){
|
| 714 |
foreach( $values as $key => $value ){
|
| 715 |
if( array_key_exists( $key, $required_fields ) && apply_filters( "wck_required_test_{$meta}_{$key}", empty( $value ), $value, $id ) ){
|
|
@@ -718,14 +718,14 @@ class Wordpress_Creation_Kit_PB{
|
|
| 718 |
}
|
| 719 |
}
|
| 720 |
}
|
| 721 |
-
|
| 722 |
$required_message .= apply_filters( "wck_extra_message", "", $fields, $required_fields, $meta, $values, $id );
|
| 723 |
$required_fields_with_errors = apply_filters( "wck_required_fields_with_errors", $required_fields_with_errors, $fields, $required_fields, $meta, $value, $id );
|
| 724 |
|
| 725 |
-
if( $required_message != '' ){
|
| 726 |
-
$errors = array( 'error' => $required_message, 'errorfields' => $required_fields_with_errors );
|
| 727 |
}
|
| 728 |
-
|
| 729 |
return $errors;
|
| 730 |
}
|
| 731 |
|
|
@@ -740,7 +740,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 740 |
|
| 741 |
// Meta is post related
|
| 742 |
if( $context == 'post_meta' && is_user_logged_in() ) {
|
| 743 |
-
|
| 744 |
// Current user must be able to edit posts
|
| 745 |
if( !current_user_can( 'edit_posts' ) )
|
| 746 |
$return = false;
|
|
@@ -765,7 +765,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 765 |
return array( 'error' => __( 'You are not allowed to do this.', 'wck' ), 'errorfields' => '' );
|
| 766 |
|
| 767 |
}
|
| 768 |
-
|
| 769 |
|
| 770 |
/* ajax add a reccord to the meta */
|
| 771 |
function wck_add_meta(){
|
|
@@ -776,7 +776,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 776 |
$meta = '';
|
| 777 |
if( !empty( $_POST['id'] ) )
|
| 778 |
$id = absint($_POST['id']);
|
| 779 |
-
else
|
| 780 |
$id = '';
|
| 781 |
if( !empty( $_POST['values'] ) && is_array( $_POST['values'] ) )
|
| 782 |
$values = array_map( 'wppb_sanitize_value', $_POST['values'] );
|
|
@@ -792,13 +792,13 @@ class Wordpress_Creation_Kit_PB{
|
|
| 792 |
$values = apply_filters( "wck_add_meta_filter_values_{$meta}", $values );
|
| 793 |
|
| 794 |
/* check required fields */
|
| 795 |
-
$errors = self::wck_test_required( $this->args['meta_array'], $meta, $values, $id );
|
| 796 |
if( $errors != '' ){
|
| 797 |
header( 'Content-type: application/json' );
|
| 798 |
die( json_encode( $errors ) );
|
| 799 |
}
|
| 800 |
-
|
| 801 |
-
|
| 802 |
if( $this->args['context'] == 'post_meta' )
|
| 803 |
$results = get_post_meta($id, $meta, true);
|
| 804 |
else if ( $this->args['context'] == 'option' )
|
|
@@ -821,17 +821,17 @@ class Wordpress_Creation_Kit_PB{
|
|
| 821 |
do_action( 'wck_before_add_meta', $meta, $id, $values );
|
| 822 |
$wck_before_add_meta = ob_get_clean(); //don't output it
|
| 823 |
|
| 824 |
-
|
| 825 |
if( $this->args['context'] == 'post_meta' )
|
| 826 |
update_post_meta($id, $meta, $results);
|
| 827 |
else if ( $this->args['context'] == 'option' )
|
| 828 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results ), wp_unslash( $results ) );
|
| 829 |
-
|
| 830 |
/* if unserialize_fields is true add for each entry separate post meta for every element of the form */
|
| 831 |
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 832 |
-
|
| 833 |
$meta_suffix = count( $results );
|
| 834 |
-
if( !empty( $values ) ){
|
| 835 |
foreach( $values as $name => $value ){
|
| 836 |
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 837 |
}
|
|
@@ -842,8 +842,8 @@ class Wordpress_Creation_Kit_PB{
|
|
| 842 |
$add_form = $this->wck_add_form( $meta, $id );
|
| 843 |
|
| 844 |
header( 'Content-type: application/json' );
|
| 845 |
-
die( json_encode( array( 'entry_list' => $entry_list, 'add_form' => $add_form ) ) );
|
| 846 |
-
|
| 847 |
}
|
| 848 |
|
| 849 |
/* ajax update a reccord in the meta */
|
|
@@ -851,41 +851,41 @@ class Wordpress_Creation_Kit_PB{
|
|
| 851 |
check_ajax_referer( "wck-update-entry" );
|
| 852 |
if( !empty( $_POST['meta'] ) )
|
| 853 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 854 |
-
else
|
| 855 |
$meta = '';
|
| 856 |
if( !empty( $_POST['id'] ) )
|
| 857 |
$id = absint($_POST['id']);
|
| 858 |
-
else
|
| 859 |
$id = '';
|
| 860 |
if( isset( $_POST['element_id'] ) )
|
| 861 |
$element_id = absint( $_POST['element_id'] );
|
| 862 |
-
else
|
| 863 |
$element_id = 0;
|
| 864 |
if( !empty( $_POST['values'] ) && is_array( $_POST['values']) )
|
| 865 |
$values = array_map( 'wppb_sanitize_value', $_POST['values'] );
|
| 866 |
else
|
| 867 |
$values = array();
|
| 868 |
-
|
| 869 |
// Security checks
|
| 870 |
if( true !== ( $error = self::wck_verify_user_capabilities( $this->args['context'], $meta, $id ) ) ) {
|
| 871 |
header( 'Content-type: application/json' );
|
| 872 |
die( json_encode( $error ) );
|
| 873 |
}
|
| 874 |
-
|
| 875 |
$values = apply_filters( "wck_update_meta_filter_values_{$meta}", $values, $element_id );
|
| 876 |
-
|
| 877 |
/* check required fields */
|
| 878 |
$errors = self::wck_test_required( $this->args['meta_array'], $meta, $values, $id );
|
| 879 |
if( $errors != '' ){
|
| 880 |
header( 'Content-type: application/json' );
|
| 881 |
die( json_encode( $errors ) );
|
| 882 |
}
|
| 883 |
-
|
| 884 |
if( $this->args['context'] == 'post_meta' )
|
| 885 |
$results = get_post_meta($id, $meta, true);
|
| 886 |
else if ( $this->args['context'] == 'option' )
|
| 887 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta, $values, $element_id ) );
|
| 888 |
-
|
| 889 |
$results[$element_id] = $values;
|
| 890 |
|
| 891 |
/* make sure this does not output anything so it won't break the json response below
|
|
@@ -894,25 +894,25 @@ class Wordpress_Creation_Kit_PB{
|
|
| 894 |
ob_start();
|
| 895 |
do_action( 'wck_before_update_meta', $meta, $id, $values, $element_id );
|
| 896 |
$wck_before_update_meta = ob_get_clean(); //don't output it
|
| 897 |
-
|
| 898 |
|
| 899 |
if( $this->args['context'] == 'post_meta' )
|
| 900 |
update_post_meta($id, $meta, $results);
|
| 901 |
else if ( $this->args['context'] == 'option' )
|
| 902 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) );
|
| 903 |
-
|
| 904 |
/* if unserialize_fields is true update the coresponding post metas for every element of the form */
|
| 905 |
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 906 |
-
|
| 907 |
-
$meta_suffix = $element_id + 1;
|
| 908 |
if( !empty( $values ) ){
|
| 909 |
foreach( $values as $name => $value ){
|
| 910 |
-
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 911 |
}
|
| 912 |
}
|
| 913 |
}
|
| 914 |
|
| 915 |
-
$entry_content = $this->wck_refresh_entry( $meta, $id, $element_id );
|
| 916 |
|
| 917 |
header( 'Content-type: application/json' );
|
| 918 |
die( json_encode( array( 'entry_content' => $entry_content ) ) );
|
|
@@ -923,27 +923,27 @@ class Wordpress_Creation_Kit_PB{
|
|
| 923 |
function wck_refresh_list( $meta = '', $id = '' ){
|
| 924 |
if( isset( $_POST['meta'] ) )
|
| 925 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 926 |
-
|
| 927 |
if( isset( $_POST['id'] ) )
|
| 928 |
-
$id = absint($_POST['id']);
|
| 929 |
|
| 930 |
-
ob_start();
|
| 931 |
echo self::wck_output_meta_content($meta, $id, $this->args['meta_array']);
|
| 932 |
do_action( "wck_refresh_list_{$meta}", $id );
|
| 933 |
$entry_list = ob_get_clean();
|
| 934 |
-
|
| 935 |
if( strpos( current_filter(), 'wp_ajax_wck_refresh_list') === 0 ){
|
| 936 |
-
echo $entry_list;
|
| 937 |
-
exit;
|
| 938 |
}
|
| 939 |
else{
|
| 940 |
return $entry_list;
|
| 941 |
}
|
| 942 |
}
|
| 943 |
-
|
| 944 |
/* function that returns the content of an entry */
|
| 945 |
function wck_refresh_entry( $meta = '', $id = '', $element_id = '' ){
|
| 946 |
-
|
| 947 |
if( $this->args['context'] == 'post_meta' )
|
| 948 |
$results = get_post_meta($id, $meta, true);
|
| 949 |
else if ( $this->args['context'] == 'option' )
|
|
@@ -956,24 +956,24 @@ class Wordpress_Creation_Kit_PB{
|
|
| 956 |
|
| 957 |
return $entry_content;
|
| 958 |
}
|
| 959 |
-
|
| 960 |
/* function that returns the add the form for single */
|
| 961 |
function wck_add_form( $meta = '', $id = '' ){
|
| 962 |
-
|
| 963 |
$post = get_post($id);
|
| 964 |
|
| 965 |
-
ob_start();
|
| 966 |
self::create_add_form($this->args['meta_array'], $meta, $post );
|
| 967 |
do_action( "wck_ajax_add_form_{$meta}", $id );
|
| 968 |
$add_form = ob_get_clean();
|
| 969 |
-
|
| 970 |
return $add_form;
|
| 971 |
}
|
| 972 |
-
|
| 973 |
|
| 974 |
/* ajax to show the update form */
|
| 975 |
function wck_show_update_form(){
|
| 976 |
-
check_ajax_referer( "wck-edit-entry" );
|
| 977 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 978 |
$id = absint($_POST['id']);
|
| 979 |
$element_id = absint( $_POST['element_id'] );
|
|
@@ -981,7 +981,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 981 |
do_action( "wck_before_adding_form_{$meta}", $id, $element_id );
|
| 982 |
|
| 983 |
echo self::mb_update_form($this->args['meta_array'], $meta, $id, $element_id);
|
| 984 |
-
|
| 985 |
do_action( "wck_after_adding_form", $meta, $id, $element_id );
|
| 986 |
do_action( "wck_after_adding_form_{$meta}", $id, $element_id );
|
| 987 |
|
|
@@ -993,15 +993,15 @@ class Wordpress_Creation_Kit_PB{
|
|
| 993 |
check_ajax_referer( "wck-delete-entry" );
|
| 994 |
if( !empty( $_POST['meta'] ) )
|
| 995 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 996 |
-
else
|
| 997 |
$meta = '';
|
| 998 |
if( !empty( $_POST['id'] ) )
|
| 999 |
$id = absint( $_POST['id'] );
|
| 1000 |
-
else
|
| 1001 |
$id = '';
|
| 1002 |
if( isset( $_POST['element_id'] ) )
|
| 1003 |
$element_id = absint( $_POST['element_id'] );
|
| 1004 |
-
else
|
| 1005 |
$element_id = '';
|
| 1006 |
|
| 1007 |
// Security checks
|
|
@@ -1009,12 +1009,12 @@ class Wordpress_Creation_Kit_PB{
|
|
| 1009 |
header( 'Content-type: application/json' );
|
| 1010 |
die( json_encode( $error ) );
|
| 1011 |
}
|
| 1012 |
-
|
| 1013 |
if( $this->args['context'] == 'post_meta' )
|
| 1014 |
$results = get_post_meta($id, $meta, true);
|
| 1015 |
else if ( $this->args['context'] == 'option' )
|
| 1016 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta, $element_id ) );
|
| 1017 |
-
|
| 1018 |
$old_results = $results;
|
| 1019 |
unset($results[$element_id]);
|
| 1020 |
/* reset the keys for the array */
|
|
@@ -1026,36 +1026,36 @@ class Wordpress_Creation_Kit_PB{
|
|
| 1026 |
ob_start();
|
| 1027 |
do_action( 'wck_before_remove_meta', $meta, $id, $element_id );
|
| 1028 |
$wck_before_remove_meta = ob_get_clean(); //don't output it
|
| 1029 |
-
|
| 1030 |
if( $this->args['context'] == 'post_meta' )
|
| 1031 |
update_post_meta($id, $meta, $results);
|
| 1032 |
else if ( $this->args['context'] == 'option' )
|
| 1033 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) );
|
| 1034 |
-
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
/* TODO: optimize so that it updates from the deleted element forward */
|
| 1038 |
/* if unserialize_fields is true delete the coresponding post metas */
|
| 1039 |
-
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 1040 |
-
|
| 1041 |
-
$meta_suffix = 1;
|
| 1042 |
|
| 1043 |
if( !empty( $results ) ){
|
| 1044 |
foreach( $results as $result ){
|
| 1045 |
foreach ( $result as $name => $value){
|
| 1046 |
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 1047 |
}
|
| 1048 |
-
$meta_suffix++;
|
| 1049 |
}
|
| 1050 |
}
|
| 1051 |
-
|
| 1052 |
if( count( $results ) == 0 )
|
| 1053 |
$results = $old_results;
|
| 1054 |
-
|
| 1055 |
if( !empty( $results ) ){
|
| 1056 |
-
foreach( $results as $result ){
|
| 1057 |
foreach ( $result as $name => $value){
|
| 1058 |
-
delete_post_meta( $id, $meta.'_'.$name.'_'.$meta_suffix );
|
| 1059 |
}
|
| 1060 |
break;
|
| 1061 |
}
|
|
@@ -1074,15 +1074,15 @@ class Wordpress_Creation_Kit_PB{
|
|
| 1074 |
function wck_reorder_meta(){
|
| 1075 |
if( !empty( $_POST['meta'] ) )
|
| 1076 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 1077 |
-
else
|
| 1078 |
$meta = '';
|
| 1079 |
if( !empty( $_POST['id'] ) )
|
| 1080 |
$id = absint($_POST['id']);
|
| 1081 |
-
else
|
| 1082 |
$id = '';
|
| 1083 |
if( !empty( $_POST['values'] ) && is_array( $_POST['values'] ) )
|
| 1084 |
$elements_id = array_map( 'absint', $_POST['values'] );
|
| 1085 |
-
else
|
| 1086 |
$elements_id = array();
|
| 1087 |
|
| 1088 |
// Security checks
|
|
@@ -1097,40 +1097,40 @@ class Wordpress_Creation_Kit_PB{
|
|
| 1097 |
ob_start();
|
| 1098 |
do_action( 'wck_before_reorder_meta', $meta, $id, $elements_id );
|
| 1099 |
$wck_before_reorder_meta = ob_get_clean(); //don't output it
|
| 1100 |
-
|
| 1101 |
if( $this->args['context'] == 'post_meta' )
|
| 1102 |
$results = get_post_meta($id, $meta, true);
|
| 1103 |
else if ( $this->args['context'] == 'option' )
|
| 1104 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta ) );
|
| 1105 |
-
|
| 1106 |
$new_results = array();
|
| 1107 |
if( !empty( $elements_id ) ){
|
| 1108 |
foreach($elements_id as $element_id){
|
| 1109 |
$new_results[] = $results[$element_id];
|
| 1110 |
}
|
| 1111 |
}
|
| 1112 |
-
|
| 1113 |
$results = $new_results;
|
| 1114 |
-
|
| 1115 |
if( $this->args['context'] == 'post_meta' )
|
| 1116 |
update_post_meta($id, $meta, $results);
|
| 1117 |
else if ( $this->args['context'] == 'option' )
|
| 1118 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) );
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
/* if unserialize_fields is true reorder all the coresponding post metas */
|
| 1122 |
-
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 1123 |
-
|
| 1124 |
$meta_suffix = 1;
|
| 1125 |
if( !empty( $new_results ) ){
|
| 1126 |
-
foreach( $new_results as $result ){
|
| 1127 |
-
foreach ( $result as $name => $value){
|
| 1128 |
-
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 1129 |
}
|
| 1130 |
$meta_suffix++;
|
| 1131 |
}
|
| 1132 |
}
|
| 1133 |
-
|
| 1134 |
}
|
| 1135 |
|
| 1136 |
$entry_list = $this->wck_refresh_list( $meta, $id );
|
|
@@ -1146,21 +1146,21 @@ class Wordpress_Creation_Kit_PB{
|
|
| 1146 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
| 1147 |
return $post_id;
|
| 1148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1149 |
// Check the user's permissions.
|
| 1150 |
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
|
| 1151 |
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
| 1152 |
return $post_id;
|
| 1153 |
}
|
| 1154 |
} else {
|
| 1155 |
-
if ( ! current_user_can( '
|
| 1156 |
return $post_id;
|
| 1157 |
}
|
| 1158 |
}
|
| 1159 |
|
| 1160 |
-
/* only go through for metaboxes defined for this post type */
|
| 1161 |
-
if( get_post_type( $post_id ) != $this->args['post_type'] )
|
| 1162 |
-
return $post_id;
|
| 1163 |
-
|
| 1164 |
if( !empty( $_POST ) ){
|
| 1165 |
/* for single metaboxes we save a hidden input that contains the meta_name attr as a key so we need to search for it */
|
| 1166 |
foreach( $_POST as $request_key => $request_value ){
|
|
@@ -1271,13 +1271,13 @@ class Wordpress_Creation_Kit_PB{
|
|
| 1271 |
}
|
| 1272 |
}
|
| 1273 |
|
| 1274 |
-
|
| 1275 |
/**
|
| 1276 |
* The function used to generate slugs in WCK
|
| 1277 |
*
|
| 1278 |
* @since 1.1.1
|
| 1279 |
-
*
|
| 1280 |
-
* @param string $string The input string from which we generate the slug
|
| 1281 |
* @return string $slug The henerated slug
|
| 1282 |
*/
|
| 1283 |
static function wck_generate_slug( $string, $details = array() ){
|
|
@@ -1328,7 +1328,7 @@ class Wordpress_Creation_Kit_PB{
|
|
| 1328 |
|
| 1329 |
/*
|
| 1330 |
Helper class that creates admin menu pages ( both top level menu pages and submenu pages )
|
| 1331 |
-
Default Usage:
|
| 1332 |
|
| 1333 |
$args = array(
|
| 1334 |
'page_type' => 'menu_page',
|
|
@@ -1338,35 +1338,35 @@ $args = array(
|
|
| 1338 |
'menu_slug' => '',
|
| 1339 |
'icon_url' => '',
|
| 1340 |
'position' => '',
|
| 1341 |
-
'parent_slug' => ''
|
| 1342 |
);
|
| 1343 |
|
| 1344 |
'page_type' (string) (required) The type of page you want to add. Possible values: 'menu_page', 'submenu_page'
|
| 1345 |
-
'page_title' (string) (required) The text to be displayed in the title tags and header of
|
| 1346 |
the page when the menu is selected
|
| 1347 |
'menu_title' (string) (required) The on-screen name text for the menu
|
| 1348 |
'capability' (string) (required) The capability required for this menu to be displayed to
|
| 1349 |
the user.
|
| 1350 |
-
'menu_slug' (string) (required) The slug name to refer to this menu by (should be unique
|
| 1351 |
for this menu).
|
| 1352 |
-
'icon_url' (string) (optional for 'page_type' => 'menu_page') The url to the icon to be used for this menu.
|
| 1353 |
-
This parameter is optional. Icons should be fairly small, around 16 x 16 pixels
|
| 1354 |
for best results.
|
| 1355 |
-
'position' (integer) (optional for 'page_type' => 'menu_page') The position in the menu order this menu
|
| 1356 |
-
should appear.
|
| 1357 |
-
By default, if this parameter is omitted, the menu will appear at the bottom
|
| 1358 |
-
of the menu structure. The higher the number, the lower its position in the menu.
|
| 1359 |
-
WARNING: if 2 menu items use the same position attribute, one of the items may be
|
| 1360 |
overwritten so that only one item displays!
|
| 1361 |
-
'parent_slug' (string) (required for 'page_type' => 'submenu_page' ) The slug name for the parent menu
|
| 1362 |
(or the file name of a standard WordPress admin page) For examples see http://codex.wordpress.org/Function_Reference/add_submenu_page $parent_slug parameter
|
| 1363 |
-
'priority' (int) (optional) How important your function is. Alter this to make your function
|
| 1364 |
-
be called before or after other functions. The default is 10, so (for example) setting it to 5 would make it run earlier and setting it to 12 would make it run later.
|
| 1365 |
|
| 1366 |
-
public $hookname ( for required for 'page_type' => 'menu_page' ) string used internally to
|
| 1367 |
track menu page callbacks for outputting the page inside the global $menu array
|
| 1368 |
( for required for 'page_type' => 'submenu_page' ) The resulting page's hook_suffix,
|
| 1369 |
-
or false if the user does not have the capability required.
|
| 1370 |
*/
|
| 1371 |
|
| 1372 |
class WCK_Page_Creator_PB{
|
|
@@ -1385,34 +1385,34 @@ class WCK_Page_Creator_PB{
|
|
| 1385 |
);
|
| 1386 |
private $args;
|
| 1387 |
public $hookname;
|
| 1388 |
-
|
| 1389 |
-
|
| 1390 |
/* Constructor method for the class. */
|
| 1391 |
function __construct( $args ) {
|
| 1392 |
|
| 1393 |
/* Global that will hold all the arguments for all the menu pages */
|
| 1394 |
-
global $wck_pages;
|
| 1395 |
-
|
| 1396 |
/* Merge the input arguments and the defaults. */
|
| 1397 |
$this->args = wp_parse_args( $args, $this->defaults );
|
| 1398 |
-
|
| 1399 |
/* Add the settings for this page to the global object */
|
| 1400 |
$wck_pages[$this->args['page_title']] = $this->args;
|
| 1401 |
-
|
| 1402 |
-
if( !$this->args['network_page'] ){
|
| 1403 |
/* Hook the page function to 'admin_menu'. */
|
| 1404 |
add_action( 'admin_menu', array( &$this, 'wck_page_init' ), $this->args['priority'] );
|
| 1405 |
}
|
| 1406 |
else{
|
| 1407 |
/* Hook the page function to 'admin_menu'. */
|
| 1408 |
add_action( 'network_admin_menu', array( &$this, 'wck_page_init' ), $this->args['priority'] );
|
| 1409 |
-
}
|
| 1410 |
}
|
| 1411 |
-
|
| 1412 |
/**
|
| 1413 |
* Function that creates the admin page
|
| 1414 |
*/
|
| 1415 |
-
function wck_page_init(){
|
| 1416 |
global $pb_wck_pages_hooknames;
|
| 1417 |
|
| 1418 |
/* don't add the page at all if the user doesn't meet the capabilities */
|
|
@@ -1420,7 +1420,7 @@ class WCK_Page_Creator_PB{
|
|
| 1420 |
if( !current_user_can( $this->args['capability'] ) )
|
| 1421 |
return;
|
| 1422 |
}
|
| 1423 |
-
|
| 1424 |
/* Create the page using either add_menu_page or add_submenu_page functions depending on the 'page_type' parameter. */
|
| 1425 |
if( $this->args['page_type'] == 'menu_page' ){
|
| 1426 |
$this->hookname = add_menu_page( $this->args['page_title'], $this->args['menu_title'], $this->args['capability'], $this->args['menu_slug'], array( &$this, 'wck_page_template' ), $this->args['icon_url'], $this->args['position'] );
|
|
@@ -1434,14 +1434,14 @@ class WCK_Page_Creator_PB{
|
|
| 1434 |
}
|
| 1435 |
|
| 1436 |
do_action( 'WCK_Page_Creator_PB_after_init', $this->hookname );
|
| 1437 |
-
|
| 1438 |
/* Create a hook for adding meta boxes. */
|
| 1439 |
add_action( "load-{$this->hookname}", array( &$this, 'wck_settings_page_add_meta_boxes' ) );
|
| 1440 |
/* Load the JavaScript needed for the screen. */
|
| 1441 |
add_action( 'admin_enqueue_scripts', array( &$this, 'wck_page_enqueue_scripts' ) );
|
| 1442 |
add_action( "admin_head-{$this->hookname}", array( &$this, 'wck_page_load_scripts' ) );
|
| 1443 |
}
|
| 1444 |
-
|
| 1445 |
/**
|
| 1446 |
* Do action 'add_meta_boxes'. This hook isn't executed by default on a admin page so we have to add it.
|
| 1447 |
*/
|
|
@@ -1449,7 +1449,7 @@ class WCK_Page_Creator_PB{
|
|
| 1449 |
global $post;
|
| 1450 |
do_action( 'add_meta_boxes', $this->hookname, $post );
|
| 1451 |
}
|
| 1452 |
-
|
| 1453 |
/**
|
| 1454 |
* Loads the JavaScript files required for managing the meta boxes on the theme settings
|
| 1455 |
* page, which allows users to arrange the boxes to their liking.
|
|
@@ -1459,14 +1459,14 @@ class WCK_Page_Creator_PB{
|
|
| 1459 |
* @since 1.0.0
|
| 1460 |
* @param string $hook The current page being viewed.
|
| 1461 |
*/
|
| 1462 |
-
function wck_page_enqueue_scripts( $hook ) {
|
| 1463 |
if ( $hook == $this->hookname ) {
|
| 1464 |
wp_enqueue_script( 'common' );
|
| 1465 |
wp_enqueue_script( 'wp-lists' );
|
| 1466 |
wp_enqueue_script( 'postbox' );
|
| 1467 |
}
|
| 1468 |
}
|
| 1469 |
-
|
| 1470 |
/**
|
| 1471 |
* Loads the JavaScript required for toggling the meta boxes on the theme settings page.
|
| 1472 |
*
|
|
@@ -1474,7 +1474,7 @@ class WCK_Page_Creator_PB{
|
|
| 1474 |
* bareskin_settings_page_init ).
|
| 1475 |
* @since 1.0.0
|
| 1476 |
*/
|
| 1477 |
-
function wck_page_load_scripts() {
|
| 1478 |
?>
|
| 1479 |
<script type="text/javascript">
|
| 1480 |
//<![CDATA[
|
|
@@ -1490,25 +1490,25 @@ class WCK_Page_Creator_PB{
|
|
| 1490 |
* Outputs default template for the page. It contains placeholders for metaboxes. It also
|
| 1491 |
* provides two action hooks 'wck_before_meta_boxes' and 'wck_after_meta_boxes'.
|
| 1492 |
*/
|
| 1493 |
-
function wck_page_template(){
|
| 1494 |
-
?>
|
| 1495 |
<div class="wrap">
|
| 1496 |
-
|
| 1497 |
<?php if( !empty( $this->args['page_icon'] ) ): ?>
|
| 1498 |
<div id="<?php echo $this->args['menu_slug'] ?>-icon" style="background: url('<?php echo $this->args['page_icon']; ?>') no-repeat;" class="icon32">
|
| 1499 |
<br/>
|
| 1500 |
</div>
|
| 1501 |
<?php endif; ?>
|
| 1502 |
-
|
| 1503 |
-
<h2><?php echo $this->args['page_title'] ?></h2>
|
| 1504 |
-
|
| 1505 |
<div id="poststuff">
|
| 1506 |
-
|
| 1507 |
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
| 1508 |
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
|
| 1509 |
-
|
| 1510 |
<?php do_action( 'wck_before_meta_boxes', $this->hookname ); ?>
|
| 1511 |
-
|
| 1512 |
<div class="metabox-holder">
|
| 1513 |
<div class="wck-post-body">
|
| 1514 |
<div class="post-box-container column-1 normal">
|
|
@@ -1520,12 +1520,12 @@ class WCK_Page_Creator_PB{
|
|
| 1520 |
<?php do_action( 'wck_before_column3_metabox_content', $this->hookname ); ?>
|
| 1521 |
<?php do_meta_boxes( $this->hookname, 'advanced', null ); ?>
|
| 1522 |
<?php do_action( 'wck_after_column3_metabox_content', $this->hookname ); ?>
|
| 1523 |
-
</div>
|
| 1524 |
</div>
|
| 1525 |
<div class="post-box-container column-2 side"><?php do_meta_boxes( $this->hookname, 'side', null ); ?></div>
|
| 1526 |
-
|
| 1527 |
-
</div>
|
| 1528 |
-
|
| 1529 |
<?php do_action( 'wck_after_meta_boxes', $this->hookname ); ?>
|
| 1530 |
|
| 1531 |
</div><!-- #poststuff -->
|
|
@@ -1537,4 +1537,4 @@ class WCK_Page_Creator_PB{
|
|
| 1537 |
|
| 1538 |
|
| 1539 |
|
| 1540 |
-
?>
|
| 1 |
+
<?php
|
| 2 |
/* Copyright 2011 Ungureanu Madalin (email : madalin@reflectionmedia.ro)
|
| 3 |
This program is free software; you can redistribute it and/or modify
|
| 4 |
it under the terms of the GNU General Public License as published by
|
| 18 |
|
| 19 |
if( file_exists( dirname(__FILE__). '/wck-static-metabox-api.php' ) )
|
| 20 |
require_once( 'wck-static-metabox-api.php' );
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
/*
|
| 24 |
|
| 25 |
Usage Example 1:
|
| 26 |
|
| 27 |
|
| 28 |
+
$fint = array(
|
| 29 |
+
array( 'type' => 'text', 'title' => 'Title', 'description' => 'Description for this input' ),
|
| 30 |
+
array( 'type' => 'textarea', 'title' => 'Description' ),
|
| 31 |
+
array( 'type' => 'upload', 'title' => 'Image', 'description' => 'Upload a image' ),
|
| 32 |
+
array( 'type' => 'select', 'title' => 'Select This', 'options' => array( 'Option 1', 'Option 2', 'Option 3' ) ),
|
| 33 |
+
array( 'type' => 'checkbox', 'title' => 'Check This', 'options' => array( 'Option 1', 'Option 2', 'Option 3' ) ),
|
| 34 |
+
array( 'type' => 'radio', 'title' => 'Radio This', 'options' => array( 'Radio 1', 'Radio 2', 'Radio 3' ) ),
|
| 35 |
);
|
| 36 |
|
| 37 |
$args = array(
|
| 39 |
'metabox_title' => 'Slideshow Class',
|
| 40 |
'post_type' => 'slideshows',
|
| 41 |
'meta_name' => 'rmscontent',
|
| 42 |
+
'meta_array' => $fint
|
| 43 |
);
|
| 44 |
|
| 45 |
new Wordpress_Creation_Kit_PB( $args );
|
| 52 |
*/
|
| 53 |
|
| 54 |
class Wordpress_Creation_Kit_PB{
|
| 55 |
+
|
| 56 |
private $defaults = array(
|
| 57 |
'metabox_id' => '',
|
| 58 |
'metabox_title' => 'Meta Box',
|
| 67 |
'context' => 'post_meta',
|
| 68 |
'mb_context' => 'normal'
|
| 69 |
);
|
| 70 |
+
private $args;
|
| 71 |
+
|
| 72 |
+
|
| 73 |
/* Constructor method for the class. */
|
| 74 |
+
function __construct( $args ) {
|
| 75 |
|
| 76 |
/* Global that will hold all the arguments for all the custom boxes */
|
| 77 |
global $wck_objects;
|
| 78 |
+
|
| 79 |
/* Merge the input arguments and the defaults. */
|
| 80 |
$this->args = wp_parse_args( $args, $this->defaults );
|
| 81 |
+
|
| 82 |
/* Add the settings for this box to the global object */
|
| 83 |
$wck_objects[$this->args['metabox_id']] = $this->args;
|
| 84 |
+
|
| 85 |
/*print scripts*/
|
| 86 |
+
add_action('admin_enqueue_scripts', array( &$this, 'wck_print_scripts' ));
|
| 87 |
/* add our own ajaxurl because we are going to use the wck script also in frontend and we want to avoid any conflicts */
|
| 88 |
add_action( 'admin_head', array( &$this, 'wck_print_ajax_url' ) );
|
| 89 |
+
|
| 90 |
// Set up the AJAX hooks
|
| 91 |
add_action("wp_ajax_wck_add_meta".$this->args['meta_name'], array( &$this, 'wck_add_meta') );
|
| 92 |
add_action("wp_ajax_wck_update_meta".$this->args['meta_name'], array( &$this, 'wck_update_meta') );
|
| 105 |
add_action('wp_insert_post', array($this, 'wck_single_metabox_redirect_if_errors'), 10, 2);
|
| 106 |
/* if we have any $_GET errors alert them with js so we have consistency */
|
| 107 |
add_action('admin_print_footer_scripts', array($this, 'wck_single_metabox_errors_display') );
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
}
|
| 111 |
+
|
| 112 |
+
|
| 113 |
//add metabox using wordpress api
|
| 114 |
|
| 115 |
function wck_add_metabox() {
|
| 116 |
+
|
| 117 |
global $pb_wck_pages_hooknames;
|
| 118 |
+
|
| 119 |
if( $this->args['context'] == 'post_meta' ){
|
| 120 |
if( $this->args['post_id'] == '' && $this->args['page_template'] == '' ){
|
| 121 |
add_meta_box($this->args['metabox_id'], $this->args['metabox_title'], array( &$this, 'wck_content' ), $this->args['post_type'], $this->args['mb_context'], 'high', array( 'meta_name' => $this->args['meta_name'], 'meta_array' => $this->args['meta_array']) );
|
| 122 |
/* add class to meta box */
|
| 123 |
add_filter( "postbox_classes_".$this->args['post_type']."_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 124 |
}
|
| 125 |
+
else{
|
| 126 |
if( !empty( $_GET['post'] ) )
|
| 127 |
$post_id = filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT );
|
| 128 |
else if( !empty( $_POST['post_ID'] ) )
|
| 129 |
$post_id = filter_var( $_POST['post_ID'], FILTER_SANITIZE_NUMBER_INT );
|
| 130 |
+
else
|
| 131 |
$post_id = '';
|
| 132 |
+
|
| 133 |
+
|
| 134 |
if( $this->args['post_id'] != '' && $this->args['page_template'] != '' ){
|
| 135 |
+
$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
|
| 136 |
if( $this->args['post_id'] == $post_id && $template_file == $this->args['page_template'] )
|
| 137 |
add_meta_box($this->args['metabox_id'], $this->args['metabox_title'], array( &$this, 'wck_content' ), 'page', $this->args['mb_context'], 'high', array( 'meta_name' => $this->args['meta_name'], 'meta_array' => $this->args['meta_array'] ) );
|
| 138 |
+
|
| 139 |
/* add class to meta box */
|
| 140 |
add_filter( "postbox_classes_page_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 141 |
}
|
| 142 |
else{
|
| 143 |
+
|
| 144 |
if( $this->args['post_id'] != '' ){
|
| 145 |
if( $this->args['post_id'] == $post_id ){
|
| 146 |
$post_type = get_post_type( $post_id );
|
| 149 |
add_filter( "postbox_classes_".$post_type."_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 150 |
}
|
| 151 |
}
|
| 152 |
+
|
| 153 |
if( $this->args['page_template'] != '' ){
|
| 154 |
+
$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
|
| 155 |
if ( $template_file == $this->args['page_template'] ){
|
| 156 |
add_meta_box($this->args['metabox_id'], $this->args['metabox_title'], array( &$this, 'wck_content' ), 'page', $this->args['mb_context'], 'high', array( 'meta_name' => $this->args['meta_name'], 'meta_array' => $this->args['meta_array']) );
|
| 157 |
/* add class to meta box */
|
| 158 |
add_filter( "postbox_classes_page_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) );
|
| 159 |
}
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
}
|
| 165 |
}
|
| 166 |
else if( $this->args['context'] == 'option' ){
|
| 167 |
if( !empty( $pb_wck_pages_hooknames[$this->args['post_type']] ) ) {
|
| 170 |
add_filter("postbox_classes_" . $pb_wck_pages_hooknames[$this->args['post_type']] . "_" . $this->args['metabox_id'], array(&$this, 'wck_add_metabox_classes'));
|
| 171 |
}
|
| 172 |
}
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
/* Function used to add classes to the wck meta boxes */
|
| 176 |
function wck_add_metabox_classes( $classes ){
|
| 177 |
array_push($classes,'wck-post-box');
|
| 178 |
return $classes;
|
| 179 |
}
|
| 180 |
|
| 181 |
+
function wck_content($post, $metabox){
|
| 182 |
if( !empty( $post->ID ) )
|
| 183 |
$post_id = $post->ID;
|
| 184 |
else
|
| 185 |
$post_id = '';
|
| 186 |
+
|
| 187 |
+
//output the add form
|
| 188 |
self::create_add_form($metabox['args']['meta_array'], $metabox['args']['meta_name'], $post);
|
| 189 |
|
| 190 |
//output the entries only for repeater fields
|
| 191 |
if( !$this->args['single'] )
|
| 192 |
echo self::wck_output_meta_content($metabox['args']['meta_name'], $post_id, $metabox['args']['meta_array']);
|
| 193 |
}
|
| 194 |
+
|
| 195 |
/**
|
| 196 |
* The function used to create a form element
|
| 197 |
*
|
| 198 |
* @since 1.0.0
|
| 199 |
*
|
| 200 |
+
* @param string $meta Meta name.
|
| 201 |
+
* @param array $details Contains the details for the field.
|
| 202 |
* @param string $value Contains input value;
|
| 203 |
* @param string $context Context where the function is used. Depending on it some actions are preformed.;
|
| 204 |
* @param int $post_id The post ID;
|
| 205 |
* @return string $element input element html string.
|
| 206 |
*/
|
| 207 |
+
|
| 208 |
function wck_output_form_field( $meta, $details, $value = '', $context = '', $post_id = '' ){
|
| 209 |
$element = '';
|
| 210 |
+
|
| 211 |
if( $context == 'edit_form' ){
|
| 212 |
$edit_class = '.mb-table-container ';
|
| 213 |
$var_prefix = 'edit';
|
| 233 |
if( !empty( $details['required'] ) && $details['required'] )
|
| 234 |
$element .= '<span class="required">*</span>';
|
| 235 |
$element .= '</label>';
|
| 236 |
+
|
| 237 |
+
$element .= '<div class="mb-right-column">';
|
| 238 |
+
|
| 239 |
+
/*
|
| 240 |
include actual field type
|
| 241 |
possible field types: text, textarea, select, checkbox, radio, upload, wysiwyg editor, datepicker, country select, user select, cpt select
|
| 242 |
*/
|
| 243 |
+
|
| 244 |
if( function_exists( 'wck_nr_get_repeater_boxes' ) ){
|
| 245 |
$cfc_titles = wck_nr_get_repeater_boxes();
|
| 246 |
if( in_array( $details['type'], $cfc_titles ) ){
|
| 255 |
|
| 256 |
// Add a filter that allows us to add support for custom field types, not just the ones defined in fields (wck api)
|
| 257 |
$element .= apply_filters('wck_output_form_field_customtype_' . $details['type'], '', $value, $details, $single_prefix);
|
| 258 |
+
|
| 259 |
if( !empty( $details['description'] ) ){
|
| 260 |
$element .= '<p class="description">'. $details['description'].'</p>';
|
| 261 |
}
|
| 262 |
+
|
| 263 |
$element .= '</div><!-- .mb-right-column -->';
|
| 264 |
|
| 265 |
$element = apply_filters( "wck_output_form_field_{$meta}_" . Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ), $element );
|
| 266 |
+
|
| 267 |
return $element;
|
| 268 |
+
|
| 269 |
}
|
| 270 |
+
|
| 271 |
+
|
| 272 |
/**
|
| 273 |
* The function used to create the form for adding records
|
| 274 |
*
|
| 277 |
* @param array $fields Contains the desired inputs in the repeater field. Must be like: array('Key:type').
|
| 278 |
* Key is used for the name attribute of the field, label of the field and as the meta_key.
|
| 279 |
* Supported types: input, textarea, upload
|
| 280 |
+
* @param string $meta It is used in update_post_meta($id, $meta, $results);. Use '_' prefix if you don't want
|
| 281 |
* the meta to apear in custom fields box.
|
| 282 |
* @param object $post Post object
|
| 283 |
*/
|
| 305 |
$element_id = 0;
|
| 306 |
if( !empty( $fields ) ){
|
| 307 |
foreach( $fields as $details ){
|
| 308 |
+
|
| 309 |
do_action( "wck_before_add_form_{$meta}_element_{$element_id}" );
|
| 310 |
|
| 311 |
/* set values in the case of single forms */
|
| 320 |
<?php echo self::wck_output_form_field( $meta, $details, $value, $context, $post_id ); ?>
|
| 321 |
</li>
|
| 322 |
<?php
|
| 323 |
+
|
| 324 |
do_action( "wck_after_add_form_{$meta}_element_{$element_id}" );
|
| 325 |
+
|
| 326 |
$element_id++;
|
| 327 |
}
|
| 328 |
}
|
| 339 |
<script>wck_set_to_widest( '.field-label', '<?php echo $meta ?>' );</script>
|
| 340 |
<?php
|
| 341 |
}
|
| 342 |
+
|
| 343 |
/**
|
| 344 |
* The function used to display a form to update a reccord from meta
|
| 345 |
*
|
| 346 |
* @since 1.0.0
|
| 347 |
+
*
|
| 348 |
+
* @param string $meta It is used in get_post_meta($id, $meta, $results);. Use '_' prefix if you don't want
|
| 349 |
* the meta to apear in custom fields box.
|
| 350 |
* @param int $id Post id
|
| 351 |
* @param int $element_id The id of the reccord. The meta is stored as array(array());
|
| 352 |
*/
|
| 353 |
function mb_update_form($fields, $meta, $id, $element_id){
|
| 354 |
+
|
| 355 |
+
$update_nonce = wp_create_nonce( 'wck-update-entry' );
|
| 356 |
+
|
| 357 |
if( $this->args['context'] == 'post_meta' )
|
| 358 |
$results = get_post_meta($id, $meta, true);
|
| 359 |
else if ( $this->args['context'] == 'option' )
|
| 360 |
+
$results = get_option( apply_filters( 'wck_option_meta' , $meta ) );
|
| 361 |
+
|
| 362 |
/* Filter primary used for CFC/OPC fields in order to show/hide fields based on type */
|
| 363 |
$wck_update_container_css_class = " class='wck_update_container update_container_$meta'";
|
| 364 |
$wck_update_container_css_class = apply_filters("wck_update_container_class_{$meta}", $wck_update_container_css_class, $meta, $results, $element_id );
|
| 365 |
+
|
| 366 |
$form = '';
|
| 367 |
$form .= '<tr id="update_container_'.$meta.'_'.$element_id.'" ' . $wck_update_container_css_class . '><td colspan="4">';
|
| 368 |
if($results != null){
|
| 369 |
$i = 0;
|
| 370 |
+
$form .= '<ul class="mb-list-entry-fields">';
|
| 371 |
+
|
| 372 |
if( !empty( $fields ) ){
|
| 373 |
+
foreach( $fields as $field ){
|
| 374 |
$details = $field;
|
| 375 |
if( isset( $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )] ) )
|
| 376 |
$value = $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )];
|
| 377 |
+
else
|
| 378 |
$value = '';
|
| 379 |
|
| 380 |
$form = apply_filters( "wck_before_update_form_{$meta}_element_{$i}", $form, $element_id, $value );
|
| 381 |
+
|
| 382 |
$form .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'">';
|
| 383 |
+
|
| 384 |
+
$form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form', $id );
|
| 385 |
+
|
| 386 |
$form .= '</li>';
|
| 387 |
+
|
| 388 |
$form = apply_filters( "wck_after_update_form_{$meta}_element_{$i}", $form, $element_id, $value );
|
| 389 |
+
|
| 390 |
$i++;
|
| 391 |
}
|
| 392 |
}
|
| 393 |
$form .= '<li style="overflow:visible;">';
|
| 394 |
$form .= '<a href="javascript:void(0)" class="button-primary" onclick=\'updateMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($update_nonce).'")\'><span>'. apply_filters( 'wck_save_changes_button', __( 'Save Changes', 'profile-builder' ), $meta ) .'</span></a>';
|
| 395 |
$form .= '<a href="javascript:void(0)" class="button-secondary" style="margin-left:10px;" onclick=\'removeUpdateForm("'. esc_js( 'update_container_'.$meta.'_'.$element_id ). '" )\'><span>'. apply_filters( 'wck_cancel_button', __( 'Cancel', 'profile-builder' ), $meta ) .'</span></a>';
|
| 396 |
+
$form .= '</li>';
|
| 397 |
+
|
| 398 |
$form .= '</ul>';
|
| 399 |
+
}
|
| 400 |
$form .= '</td></tr>';
|
| 401 |
+
|
| 402 |
return $form;
|
| 403 |
}
|
| 404 |
|
| 405 |
+
|
| 406 |
/**
|
| 407 |
* The function used to output the content of a meta
|
| 408 |
*
|
| 409 |
* @since 1.0.0
|
| 410 |
+
*
|
| 411 |
+
* @param string $meta It is used in get_post_meta($id, $meta, $results);. Use '_' prefix if you don't want
|
| 412 |
* the meta to apear in custom fields box.
|
| 413 |
* @param int $id Post id
|
| 414 |
*/
|
| 415 |
+
function wck_output_meta_content($meta, $id, $fields, $box_args = '' ){
|
| 416 |
/* in fep $this->args is empty so we need it as a parameter */
|
| 417 |
+
if( !empty( $box_args ) )
|
| 418 |
$this->args = wp_parse_args( $box_args, $this->defaults );
|
| 419 |
+
|
| 420 |
+
|
| 421 |
if( $this->args['context'] == 'post_meta' || $this->args['context'] == '' )
|
| 422 |
$results = get_post_meta($id, $meta, true);
|
| 423 |
else if ( $this->args['context'] == 'option' )
|
| 424 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta ) );
|
| 425 |
+
|
| 426 |
$list = '';
|
| 427 |
$list .= '<table id="container_'.esc_attr($meta).'" class="mb-table-container widefat';
|
| 428 |
+
|
| 429 |
if( $this->args['single'] ) $list .= ' single';
|
| 430 |
if( !$this->args['sortable'] ) $list .= ' not-sortable';
|
| 431 |
+
|
| 432 |
+
$list .= '" post="'.esc_attr($id).'">';
|
| 433 |
+
|
| 434 |
+
|
| 435 |
if( !empty( $results ) ){
|
| 436 |
$list .= apply_filters( 'wck_metabox_content_header_'.$meta , '<thead><tr><th class="wck-number">#</th><th class="wck-content">'. __( 'Content', 'profile-builder' ) .'</th><th class="wck-edit">'. __( 'Edit', 'wck' ) .'</th><th class="wck-delete">'. __( 'Delete', 'wck' ) .'</th></tr></thead>' );
|
| 437 |
$i=0;
|
| 438 |
+
foreach ($results as $result){
|
| 439 |
+
|
| 440 |
$list .= self::wck_output_entry_content( $meta, $id, $fields, $results, $i );
|
| 441 |
+
|
| 442 |
$i++;
|
| 443 |
}
|
| 444 |
}
|
| 448 |
$list = apply_filters('wck_metabox_content_'.$meta, $list, $id);
|
| 449 |
return $list;
|
| 450 |
}
|
| 451 |
+
|
| 452 |
function wck_output_entry_content( $meta, $id, $fields, $results, $element_id ){
|
| 453 |
$edit_nonce = wp_create_nonce( 'wck-edit-entry' );
|
| 454 |
+
$delete_nonce = wp_create_nonce( 'wck-delete-entry' );
|
| 455 |
$entry_nr = $element_id +1;
|
| 456 |
|
| 457 |
$wck_element_class = '';
|
| 463 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-number">'. $entry_nr .'</td>';
|
| 464 |
$list .= '<td class="wck-content"><ul>' . "\r\n";
|
| 465 |
|
| 466 |
+
$j = 0;
|
| 467 |
+
|
| 468 |
if( !empty( $fields ) ){
|
| 469 |
foreach( $fields as $field ){
|
| 470 |
$details = $field;
|
| 471 |
+
|
| 472 |
if( !empty( $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )] ) )
|
| 473 |
$value = $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )];
|
| 474 |
else
|
| 475 |
$value ='';
|
| 476 |
+
|
| 477 |
+
/* filter display value */
|
| 478 |
$value = apply_filters( "wck_displayed_value_{$meta}_element_{$j}", $value );
|
| 479 |
|
| 480 |
/* display it differently based on field type*/
|
| 481 |
+
if( $details['type'] == 'upload' ){
|
| 482 |
$display_value = self::wck_get_entry_field_upload($value);
|
| 483 |
} elseif ( $details['type'] == 'user select' ) {
|
| 484 |
$display_value = self::wck_get_entry_field_user_select( $value ) . '</pre>';
|
| 498 |
/*check for nested repeater type and set it acordingly */
|
| 499 |
if( strpos( $details['type'], 'CFC-') === 0 )
|
| 500 |
$details['type'] = 'nested-repeater';
|
| 501 |
+
|
| 502 |
$list .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" data-type="'.$details['type'].'"><strong>'.$details['title'].': </strong>'.$display_value.' </li>' . "\r\n";
|
| 503 |
|
| 504 |
$list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
|
| 509 |
if ($meta == 'wck_cfc_fields') {
|
| 510 |
if( !empty( $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )] ) ){
|
| 511 |
$field_title = $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )];
|
| 512 |
+
if ($field_title == "Field Type")
|
| 513 |
$cfc_field_type = $value;
|
| 514 |
}
|
| 515 |
}
|
| 524 |
$list .= wck_nr_handle_repeaters( $meta, $id, $fields, $results, $element_id );
|
| 525 |
}
|
| 526 |
}
|
| 527 |
+
|
| 528 |
if( $element_id === 0 ){
|
| 529 |
$list .= "<script>wck_set_to_widest( 'strong', '". $meta ."' );</script>";
|
| 530 |
}
|
| 531 |
|
| 532 |
+
$list .= '</td>';
|
| 533 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-edit"><a href="javascript:void(0)" class="button-secondary" onclick=\'showUpdateFormMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($edit_nonce).'")\' title="'. __( 'Edit this item', 'profile-builder' ) .'">'. apply_filters( 'wck_edit_button', __('Edit','wck'), $meta ) .'</a></td>';
|
| 534 |
$list .= '<td style="text-align:center;vertical-align:middle;" class="wck-delete"><a href="javascript:void(0)" class="mbdelete" onclick=\'removeMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($delete_nonce).'")\' title="'. __( 'Delete this item', 'profile-builder' ) .'">'. apply_filters( 'wck_delete_button', __( 'Delete', 'wck' ), $meta) .'</a></td>';
|
| 535 |
$list .= apply_filters( 'wck_add_content_after_columns', '', $list, $meta );
|
| 576 |
|
| 577 |
/* function to generate output for upload field */
|
| 578 |
function wck_get_entry_field_upload($id){
|
| 579 |
+
if( !empty ( $id ) && is_numeric( $id ) ){
|
| 580 |
$file_src = wp_get_attachment_url($id);
|
| 581 |
$thumbnail = wp_get_attachment_image( $id, array( 80, 60 ), true );
|
| 582 |
$file_name = get_the_title( $id );
|
| 583 |
+
|
| 584 |
if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $id ), $matches ) )
|
| 585 |
$file_type = esc_html( strtoupper( $matches[1] ) );
|
| 586 |
else
|
| 587 |
$file_type = strtoupper( str_replace( 'image/', '', get_post_mime_type( $id ) ) );
|
| 588 |
+
|
| 589 |
+
return $display_value = '<div class="upload-field-details">'. $thumbnail .'<p><span class="file-name">'. $file_name .'</span><span class="file-type">'. $file_type . '</span></p></div>';
|
| 590 |
} else {
|
| 591 |
return '';
|
| 592 |
}
|
| 594 |
|
| 595 |
/* function to generate output for user select */
|
| 596 |
function wck_get_entry_field_user_select($id){
|
| 597 |
+
if( !empty ( $id ) && is_numeric( $id ) ){
|
| 598 |
$user = get_user_by( 'id', $id );
|
| 599 |
+
if ( $user )
|
| 600 |
return '<pre>'.htmlspecialchars( $user->display_name );
|
| 601 |
else
|
| 602 |
return 'Error - User ID not found in database';
|
| 603 |
+
|
| 604 |
} else {
|
| 605 |
return '';
|
| 606 |
}
|
| 607 |
}
|
| 608 |
+
|
| 609 |
/* function to generate output for cpt select */
|
| 610 |
function wck_get_entry_field_cpt_select($id){
|
| 611 |
+
if( !empty ( $id ) && is_numeric( $id ) ){
|
| 612 |
+
$post = get_post( $id );
|
| 613 |
+
|
| 614 |
if ( $post != null ){
|
| 615 |
if ( $post->post_title == '' )
|
| 616 |
$post->post_title = 'No title. ID: ' . $id;
|
| 617 |
+
|
| 618 |
+
return '<pre>'.htmlspecialchars( $post->post_title );
|
| 619 |
}
|
| 620 |
else
|
| 621 |
return 'Error - Post ID not found in database';
|
| 622 |
+
|
| 623 |
} else {
|
| 624 |
return '';
|
| 625 |
}
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
/* enque the js/css */
|
| 629 |
function wck_print_scripts($hook){
|
| 630 |
global $pb_wck_pages_hooknames;
|
| 631 |
+
|
| 632 |
+
if( $this->args['context'] == 'post_meta' ) {
|
| 633 |
if( 'post.php' == $hook || 'post-new.php' == $hook){
|
| 634 |
+
|
| 635 |
/* only add on profile builder custom post types */
|
| 636 |
if( !empty( $_GET['post'] ) )
|
| 637 |
$post_id = filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT );
|
| 638 |
else if( !empty( $_POST['post_ID'] ) )
|
| 639 |
$post_id = filter_var( $_POST['post_ID'], FILTER_SANITIZE_NUMBER_INT );
|
| 640 |
+
else
|
| 641 |
$post_id = '';
|
| 642 |
if( !empty( $post_id ) ){
|
| 643 |
+
$current_post_type = get_post_type( $post_id );
|
| 644 |
+
if( strpos( $current_post_type, 'wppb-' ) === false )
|
| 645 |
return '';
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
self::wck_enqueue();
|
| 649 |
}
|
| 650 |
}
|
| 651 |
elseif( $this->args['context'] == 'option' ){
|
| 652 |
+
if( $pb_wck_pages_hooknames[$this->args['post_type']] == $hook ){
|
| 653 |
+
self::wck_enqueue( 'options' );
|
| 654 |
}
|
| 655 |
}
|
| 656 |
}
|
| 657 |
+
|
| 658 |
/* our own ajaxurl */
|
| 659 |
function wck_print_ajax_url(){
|
| 660 |
echo '<script type="text/javascript">var wppbWckAjaxurl = "'. apply_filters( 'wck_ajax_url', admin_url('admin-ajax.php') ) .'";</script>';
|
| 661 |
}
|
| 662 |
+
|
| 663 |
+
|
| 664 |
/* Helper function for enqueueing scripts and styles */
|
| 665 |
private static function wck_enqueue( $context = '' ){
|
| 666 |
+
|
| 667 |
wp_enqueue_script( 'jquery-ui-draggable' );
|
| 668 |
wp_enqueue_script( 'jquery-ui-droppable' );
|
| 669 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
| 670 |
+
|
| 671 |
if( $context == 'options' ){
|
| 672 |
wp_enqueue_script( 'thickbox' );
|
| 673 |
wp_enqueue_style( 'thickbox' );
|
| 674 |
}
|
| 675 |
+
|
| 676 |
wp_enqueue_script('wordpress-creation-kit', plugins_url('/wordpress-creation-kit.js', __FILE__), array('jquery', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ), PROFILE_BUILDER_VERSION );
|
| 677 |
wp_register_style('wordpress-creation-kit-css', plugins_url('/wordpress-creation-kit.css', __FILE__), array(), PROFILE_BUILDER_VERSION );
|
| 678 |
wp_enqueue_style('wordpress-creation-kit-css');
|
| 679 |
|
| 680 |
+
// wysiwyg
|
| 681 |
// wp_register_script( 'wck-tinymce', plugins_url( '/assets/js/tiny_mce/tiny_mce.js', __FILE__ ), array(), '1.0', true );
|
| 682 |
// wp_enqueue_script( 'wck-tinymce' );
|
| 683 |
// wp_register_script( 'wck-tinymce-init', plugins_url( '/assets/js/tiny_mce/wck_tiny_mce_init.js', __FILE__ ), array(), '1.0', true );
|
| 684 |
// wp_enqueue_script( 'wck-tinymce-init' );
|
| 685 |
+
|
| 686 |
//datepicker
|
| 687 |
+
wp_enqueue_script('jquery-ui-datepicker');
|
| 688 |
wp_enqueue_style( 'jquery-style', plugins_url( '/assets/datepicker/datepicker.css', __FILE__ ) );
|
| 689 |
|
| 690 |
|
| 692 |
wp_enqueue_media();
|
| 693 |
wp_enqueue_script('wck-upload-field', plugins_url('/fields/upload.js', __FILE__), array('jquery') );
|
| 694 |
|
| 695 |
+
}
|
| 696 |
|
| 697 |
/* Helper function for required fields */
|
| 698 |
function wck_test_required( $meta_array, $meta, $values, $id ){
|
| 700 |
$required_fields = array();
|
| 701 |
$required_fields_with_errors = array();
|
| 702 |
$required_message = '';
|
| 703 |
+
|
| 704 |
$errors = '';
|
| 705 |
+
|
| 706 |
if( !empty( $fields ) ){
|
| 707 |
foreach( $fields as $field ){
|
| 708 |
if( !empty( $field['required'] ) && $field['required'] )
|
| 709 |
$required_fields[Wordpress_Creation_Kit_PB::wck_generate_slug( $field['title'], $field )] = $field['title'];
|
| 710 |
}
|
| 711 |
}
|
| 712 |
+
|
| 713 |
if( !empty( $values ) ){
|
| 714 |
foreach( $values as $key => $value ){
|
| 715 |
if( array_key_exists( $key, $required_fields ) && apply_filters( "wck_required_test_{$meta}_{$key}", empty( $value ), $value, $id ) ){
|
| 718 |
}
|
| 719 |
}
|
| 720 |
}
|
| 721 |
+
|
| 722 |
$required_message .= apply_filters( "wck_extra_message", "", $fields, $required_fields, $meta, $values, $id );
|
| 723 |
$required_fields_with_errors = apply_filters( "wck_required_fields_with_errors", $required_fields_with_errors, $fields, $required_fields, $meta, $value, $id );
|
| 724 |
|
| 725 |
+
if( $required_message != '' ){
|
| 726 |
+
$errors = array( 'error' => $required_message, 'errorfields' => $required_fields_with_errors );
|
| 727 |
}
|
| 728 |
+
|
| 729 |
return $errors;
|
| 730 |
}
|
| 731 |
|
| 740 |
|
| 741 |
// Meta is post related
|
| 742 |
if( $context == 'post_meta' && is_user_logged_in() ) {
|
| 743 |
+
|
| 744 |
// Current user must be able to edit posts
|
| 745 |
if( !current_user_can( 'edit_posts' ) )
|
| 746 |
$return = false;
|
| 765 |
return array( 'error' => __( 'You are not allowed to do this.', 'wck' ), 'errorfields' => '' );
|
| 766 |
|
| 767 |
}
|
| 768 |
+
|
| 769 |
|
| 770 |
/* ajax add a reccord to the meta */
|
| 771 |
function wck_add_meta(){
|
| 776 |
$meta = '';
|
| 777 |
if( !empty( $_POST['id'] ) )
|
| 778 |
$id = absint($_POST['id']);
|
| 779 |
+
else
|
| 780 |
$id = '';
|
| 781 |
if( !empty( $_POST['values'] ) && is_array( $_POST['values'] ) )
|
| 782 |
$values = array_map( 'wppb_sanitize_value', $_POST['values'] );
|
| 792 |
$values = apply_filters( "wck_add_meta_filter_values_{$meta}", $values );
|
| 793 |
|
| 794 |
/* check required fields */
|
| 795 |
+
$errors = self::wck_test_required( $this->args['meta_array'], $meta, $values, $id );
|
| 796 |
if( $errors != '' ){
|
| 797 |
header( 'Content-type: application/json' );
|
| 798 |
die( json_encode( $errors ) );
|
| 799 |
}
|
| 800 |
+
|
| 801 |
+
|
| 802 |
if( $this->args['context'] == 'post_meta' )
|
| 803 |
$results = get_post_meta($id, $meta, true);
|
| 804 |
else if ( $this->args['context'] == 'option' )
|
| 821 |
do_action( 'wck_before_add_meta', $meta, $id, $values );
|
| 822 |
$wck_before_add_meta = ob_get_clean(); //don't output it
|
| 823 |
|
| 824 |
+
|
| 825 |
if( $this->args['context'] == 'post_meta' )
|
| 826 |
update_post_meta($id, $meta, $results);
|
| 827 |
else if ( $this->args['context'] == 'option' )
|
| 828 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results ), wp_unslash( $results ) );
|
| 829 |
+
|
| 830 |
/* if unserialize_fields is true add for each entry separate post meta for every element of the form */
|
| 831 |
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 832 |
+
|
| 833 |
$meta_suffix = count( $results );
|
| 834 |
+
if( !empty( $values ) ){
|
| 835 |
foreach( $values as $name => $value ){
|
| 836 |
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 837 |
}
|
| 842 |
$add_form = $this->wck_add_form( $meta, $id );
|
| 843 |
|
| 844 |
header( 'Content-type: application/json' );
|
| 845 |
+
die( json_encode( array( 'entry_list' => $entry_list, 'add_form' => $add_form ) ) );
|
| 846 |
+
|
| 847 |
}
|
| 848 |
|
| 849 |
/* ajax update a reccord in the meta */
|
| 851 |
check_ajax_referer( "wck-update-entry" );
|
| 852 |
if( !empty( $_POST['meta'] ) )
|
| 853 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 854 |
+
else
|
| 855 |
$meta = '';
|
| 856 |
if( !empty( $_POST['id'] ) )
|
| 857 |
$id = absint($_POST['id']);
|
| 858 |
+
else
|
| 859 |
$id = '';
|
| 860 |
if( isset( $_POST['element_id'] ) )
|
| 861 |
$element_id = absint( $_POST['element_id'] );
|
| 862 |
+
else
|
| 863 |
$element_id = 0;
|
| 864 |
if( !empty( $_POST['values'] ) && is_array( $_POST['values']) )
|
| 865 |
$values = array_map( 'wppb_sanitize_value', $_POST['values'] );
|
| 866 |
else
|
| 867 |
$values = array();
|
| 868 |
+
|
| 869 |
// Security checks
|
| 870 |
if( true !== ( $error = self::wck_verify_user_capabilities( $this->args['context'], $meta, $id ) ) ) {
|
| 871 |
header( 'Content-type: application/json' );
|
| 872 |
die( json_encode( $error ) );
|
| 873 |
}
|
| 874 |
+
|
| 875 |
$values = apply_filters( "wck_update_meta_filter_values_{$meta}", $values, $element_id );
|
| 876 |
+
|
| 877 |
/* check required fields */
|
| 878 |
$errors = self::wck_test_required( $this->args['meta_array'], $meta, $values, $id );
|
| 879 |
if( $errors != '' ){
|
| 880 |
header( 'Content-type: application/json' );
|
| 881 |
die( json_encode( $errors ) );
|
| 882 |
}
|
| 883 |
+
|
| 884 |
if( $this->args['context'] == 'post_meta' )
|
| 885 |
$results = get_post_meta($id, $meta, true);
|
| 886 |
else if ( $this->args['context'] == 'option' )
|
| 887 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta, $values, $element_id ) );
|
| 888 |
+
|
| 889 |
$results[$element_id] = $values;
|
| 890 |
|
| 891 |
/* make sure this does not output anything so it won't break the json response below
|
| 894 |
ob_start();
|
| 895 |
do_action( 'wck_before_update_meta', $meta, $id, $values, $element_id );
|
| 896 |
$wck_before_update_meta = ob_get_clean(); //don't output it
|
| 897 |
+
|
| 898 |
|
| 899 |
if( $this->args['context'] == 'post_meta' )
|
| 900 |
update_post_meta($id, $meta, $results);
|
| 901 |
else if ( $this->args['context'] == 'option' )
|
| 902 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) );
|
| 903 |
+
|
| 904 |
/* if unserialize_fields is true update the coresponding post metas for every element of the form */
|
| 905 |
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 906 |
+
|
| 907 |
+
$meta_suffix = $element_id + 1;
|
| 908 |
if( !empty( $values ) ){
|
| 909 |
foreach( $values as $name => $value ){
|
| 910 |
+
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 911 |
}
|
| 912 |
}
|
| 913 |
}
|
| 914 |
|
| 915 |
+
$entry_content = $this->wck_refresh_entry( $meta, $id, $element_id );
|
| 916 |
|
| 917 |
header( 'Content-type: application/json' );
|
| 918 |
die( json_encode( array( 'entry_content' => $entry_content ) ) );
|
| 923 |
function wck_refresh_list( $meta = '', $id = '' ){
|
| 924 |
if( isset( $_POST['meta'] ) )
|
| 925 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 926 |
+
|
| 927 |
if( isset( $_POST['id'] ) )
|
| 928 |
+
$id = absint($_POST['id']);
|
| 929 |
|
| 930 |
+
ob_start();
|
| 931 |
echo self::wck_output_meta_content($meta, $id, $this->args['meta_array']);
|
| 932 |
do_action( "wck_refresh_list_{$meta}", $id );
|
| 933 |
$entry_list = ob_get_clean();
|
| 934 |
+
|
| 935 |
if( strpos( current_filter(), 'wp_ajax_wck_refresh_list') === 0 ){
|
| 936 |
+
echo $entry_list;
|
| 937 |
+
exit;
|
| 938 |
}
|
| 939 |
else{
|
| 940 |
return $entry_list;
|
| 941 |
}
|
| 942 |
}
|
| 943 |
+
|
| 944 |
/* function that returns the content of an entry */
|
| 945 |
function wck_refresh_entry( $meta = '', $id = '', $element_id = '' ){
|
| 946 |
+
|
| 947 |
if( $this->args['context'] == 'post_meta' )
|
| 948 |
$results = get_post_meta($id, $meta, true);
|
| 949 |
else if ( $this->args['context'] == 'option' )
|
| 956 |
|
| 957 |
return $entry_content;
|
| 958 |
}
|
| 959 |
+
|
| 960 |
/* function that returns the add the form for single */
|
| 961 |
function wck_add_form( $meta = '', $id = '' ){
|
| 962 |
+
|
| 963 |
$post = get_post($id);
|
| 964 |
|
| 965 |
+
ob_start();
|
| 966 |
self::create_add_form($this->args['meta_array'], $meta, $post );
|
| 967 |
do_action( "wck_ajax_add_form_{$meta}", $id );
|
| 968 |
$add_form = ob_get_clean();
|
| 969 |
+
|
| 970 |
return $add_form;
|
| 971 |
}
|
| 972 |
+
|
| 973 |
|
| 974 |
/* ajax to show the update form */
|
| 975 |
function wck_show_update_form(){
|
| 976 |
+
check_ajax_referer( "wck-edit-entry" );
|
| 977 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 978 |
$id = absint($_POST['id']);
|
| 979 |
$element_id = absint( $_POST['element_id'] );
|
| 981 |
do_action( "wck_before_adding_form_{$meta}", $id, $element_id );
|
| 982 |
|
| 983 |
echo self::mb_update_form($this->args['meta_array'], $meta, $id, $element_id);
|
| 984 |
+
|
| 985 |
do_action( "wck_after_adding_form", $meta, $id, $element_id );
|
| 986 |
do_action( "wck_after_adding_form_{$meta}", $id, $element_id );
|
| 987 |
|
| 993 |
check_ajax_referer( "wck-delete-entry" );
|
| 994 |
if( !empty( $_POST['meta'] ) )
|
| 995 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 996 |
+
else
|
| 997 |
$meta = '';
|
| 998 |
if( !empty( $_POST['id'] ) )
|
| 999 |
$id = absint( $_POST['id'] );
|
| 1000 |
+
else
|
| 1001 |
$id = '';
|
| 1002 |
if( isset( $_POST['element_id'] ) )
|
| 1003 |
$element_id = absint( $_POST['element_id'] );
|
| 1004 |
+
else
|
| 1005 |
$element_id = '';
|
| 1006 |
|
| 1007 |
// Security checks
|
| 1009 |
header( 'Content-type: application/json' );
|
| 1010 |
die( json_encode( $error ) );
|
| 1011 |
}
|
| 1012 |
+
|
| 1013 |
if( $this->args['context'] == 'post_meta' )
|
| 1014 |
$results = get_post_meta($id, $meta, true);
|
| 1015 |
else if ( $this->args['context'] == 'option' )
|
| 1016 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta, $element_id ) );
|
| 1017 |
+
|
| 1018 |
$old_results = $results;
|
| 1019 |
unset($results[$element_id]);
|
| 1020 |
/* reset the keys for the array */
|
| 1026 |
ob_start();
|
| 1027 |
do_action( 'wck_before_remove_meta', $meta, $id, $element_id );
|
| 1028 |
$wck_before_remove_meta = ob_get_clean(); //don't output it
|
| 1029 |
+
|
| 1030 |
if( $this->args['context'] == 'post_meta' )
|
| 1031 |
update_post_meta($id, $meta, $results);
|
| 1032 |
else if ( $this->args['context'] == 'option' )
|
| 1033 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) );
|
| 1034 |
+
|
| 1035 |
+
|
| 1036 |
+
|
| 1037 |
/* TODO: optimize so that it updates from the deleted element forward */
|
| 1038 |
/* if unserialize_fields is true delete the coresponding post metas */
|
| 1039 |
+
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 1040 |
+
|
| 1041 |
+
$meta_suffix = 1;
|
| 1042 |
|
| 1043 |
if( !empty( $results ) ){
|
| 1044 |
foreach( $results as $result ){
|
| 1045 |
foreach ( $result as $name => $value){
|
| 1046 |
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 1047 |
}
|
| 1048 |
+
$meta_suffix++;
|
| 1049 |
}
|
| 1050 |
}
|
| 1051 |
+
|
| 1052 |
if( count( $results ) == 0 )
|
| 1053 |
$results = $old_results;
|
| 1054 |
+
|
| 1055 |
if( !empty( $results ) ){
|
| 1056 |
+
foreach( $results as $result ){
|
| 1057 |
foreach ( $result as $name => $value){
|
| 1058 |
+
delete_post_meta( $id, $meta.'_'.$name.'_'.$meta_suffix );
|
| 1059 |
}
|
| 1060 |
break;
|
| 1061 |
}
|
| 1074 |
function wck_reorder_meta(){
|
| 1075 |
if( !empty( $_POST['meta'] ) )
|
| 1076 |
$meta = sanitize_text_field( $_POST['meta'] );
|
| 1077 |
+
else
|
| 1078 |
$meta = '';
|
| 1079 |
if( !empty( $_POST['id'] ) )
|
| 1080 |
$id = absint($_POST['id']);
|
| 1081 |
+
else
|
| 1082 |
$id = '';
|
| 1083 |
if( !empty( $_POST['values'] ) && is_array( $_POST['values'] ) )
|
| 1084 |
$elements_id = array_map( 'absint', $_POST['values'] );
|
| 1085 |
+
else
|
| 1086 |
$elements_id = array();
|
| 1087 |
|
| 1088 |
// Security checks
|
| 1097 |
ob_start();
|
| 1098 |
do_action( 'wck_before_reorder_meta', $meta, $id, $elements_id );
|
| 1099 |
$wck_before_reorder_meta = ob_get_clean(); //don't output it
|
| 1100 |
+
|
| 1101 |
if( $this->args['context'] == 'post_meta' )
|
| 1102 |
$results = get_post_meta($id, $meta, true);
|
| 1103 |
else if ( $this->args['context'] == 'option' )
|
| 1104 |
$results = get_option( apply_filters( 'wck_option_meta' , $meta ) );
|
| 1105 |
+
|
| 1106 |
$new_results = array();
|
| 1107 |
if( !empty( $elements_id ) ){
|
| 1108 |
foreach($elements_id as $element_id){
|
| 1109 |
$new_results[] = $results[$element_id];
|
| 1110 |
}
|
| 1111 |
}
|
| 1112 |
+
|
| 1113 |
$results = $new_results;
|
| 1114 |
+
|
| 1115 |
if( $this->args['context'] == 'post_meta' )
|
| 1116 |
update_post_meta($id, $meta, $results);
|
| 1117 |
else if ( $this->args['context'] == 'option' )
|
| 1118 |
update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) );
|
| 1119 |
+
|
| 1120 |
+
|
| 1121 |
/* if unserialize_fields is true reorder all the coresponding post metas */
|
| 1122 |
+
if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){
|
| 1123 |
+
|
| 1124 |
$meta_suffix = 1;
|
| 1125 |
if( !empty( $new_results ) ){
|
| 1126 |
+
foreach( $new_results as $result ){
|
| 1127 |
+
foreach ( $result as $name => $value){
|
| 1128 |
+
update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value);
|
| 1129 |
}
|
| 1130 |
$meta_suffix++;
|
| 1131 |
}
|
| 1132 |
}
|
| 1133 |
+
|
| 1134 |
}
|
| 1135 |
|
| 1136 |
$entry_list = $this->wck_refresh_list( $meta, $id );
|
| 1146 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
| 1147 |
return $post_id;
|
| 1148 |
|
| 1149 |
+
/* only go through for metaboxes defined for this post type */
|
| 1150 |
+
if( get_post_type( $post_id ) != $this->args['post_type'] )
|
| 1151 |
+
return $post_id;
|
| 1152 |
+
|
| 1153 |
// Check the user's permissions.
|
| 1154 |
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
|
| 1155 |
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
| 1156 |
return $post_id;
|
| 1157 |
}
|
| 1158 |
} else {
|
| 1159 |
+
if ( ! current_user_can( 'edit_posts', $post_id ) ) {
|
| 1160 |
return $post_id;
|
| 1161 |
}
|
| 1162 |
}
|
| 1163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1164 |
if( !empty( $_POST ) ){
|
| 1165 |
/* for single metaboxes we save a hidden input that contains the meta_name attr as a key so we need to search for it */
|
| 1166 |
foreach( $_POST as $request_key => $request_value ){
|
| 1271 |
}
|
| 1272 |
}
|
| 1273 |
|
| 1274 |
+
|
| 1275 |
/**
|
| 1276 |
* The function used to generate slugs in WCK
|
| 1277 |
*
|
| 1278 |
* @since 1.1.1
|
| 1279 |
+
*
|
| 1280 |
+
* @param string $string The input string from which we generate the slug
|
| 1281 |
* @return string $slug The henerated slug
|
| 1282 |
*/
|
| 1283 |
static function wck_generate_slug( $string, $details = array() ){
|
| 1328 |
|
| 1329 |
/*
|
| 1330 |
Helper class that creates admin menu pages ( both top level menu pages and submenu pages )
|
| 1331 |
+
Default Usage:
|
| 1332 |
|
| 1333 |
$args = array(
|
| 1334 |
'page_type' => 'menu_page',
|
| 1338 |
'menu_slug' => '',
|
| 1339 |
'icon_url' => '',
|
| 1340 |
'position' => '',
|
| 1341 |
+
'parent_slug' => ''
|
| 1342 |
);
|
| 1343 |
|
| 1344 |
'page_type' (string) (required) The type of page you want to add. Possible values: 'menu_page', 'submenu_page'
|
| 1345 |
+
'page_title' (string) (required) The text to be displayed in the title tags and header of
|
| 1346 |
the page when the menu is selected
|
| 1347 |
'menu_title' (string) (required) The on-screen name text for the menu
|
| 1348 |
'capability' (string) (required) The capability required for this menu to be displayed to
|
| 1349 |
the user.
|
| 1350 |
+
'menu_slug' (string) (required) The slug name to refer to this menu by (should be unique
|
| 1351 |
for this menu).
|
| 1352 |
+
'icon_url' (string) (optional for 'page_type' => 'menu_page') The url to the icon to be used for this menu.
|
| 1353 |
+
This parameter is optional. Icons should be fairly small, around 16 x 16 pixels
|
| 1354 |
for best results.
|
| 1355 |
+
'position' (integer) (optional for 'page_type' => 'menu_page') The position in the menu order this menu
|
| 1356 |
+
should appear.
|
| 1357 |
+
By default, if this parameter is omitted, the menu will appear at the bottom
|
| 1358 |
+
of the menu structure. The higher the number, the lower its position in the menu.
|
| 1359 |
+
WARNING: if 2 menu items use the same position attribute, one of the items may be
|
| 1360 |
overwritten so that only one item displays!
|
| 1361 |
+
'parent_slug' (string) (required for 'page_type' => 'submenu_page' ) The slug name for the parent menu
|
| 1362 |
(or the file name of a standard WordPress admin page) For examples see http://codex.wordpress.org/Function_Reference/add_submenu_page $parent_slug parameter
|
| 1363 |
+
'priority' (int) (optional) How important your function is. Alter this to make your function
|
| 1364 |
+
be called before or after other functions. The default is 10, so (for example) setting it to 5 would make it run earlier and setting it to 12 would make it run later.
|
| 1365 |
|
| 1366 |
+
public $hookname ( for required for 'page_type' => 'menu_page' ) string used internally to
|
| 1367 |
track menu page callbacks for outputting the page inside the global $menu array
|
| 1368 |
( for required for 'page_type' => 'submenu_page' ) The resulting page's hook_suffix,
|
| 1369 |
+
or false if the user does not have the capability required.
|
| 1370 |
*/
|
| 1371 |
|
| 1372 |
class WCK_Page_Creator_PB{
|
| 1385 |
);
|
| 1386 |
private $args;
|
| 1387 |
public $hookname;
|
| 1388 |
+
|
| 1389 |
+
|
| 1390 |
/* Constructor method for the class. */
|
| 1391 |
function __construct( $args ) {
|
| 1392 |
|
| 1393 |
/* Global that will hold all the arguments for all the menu pages */
|
| 1394 |
+
global $wck_pages;
|
| 1395 |
+
|
| 1396 |
/* Merge the input arguments and the defaults. */
|
| 1397 |
$this->args = wp_parse_args( $args, $this->defaults );
|
| 1398 |
+
|
| 1399 |
/* Add the settings for this page to the global object */
|
| 1400 |
$wck_pages[$this->args['page_title']] = $this->args;
|
| 1401 |
+
|
| 1402 |
+
if( !$this->args['network_page'] ){
|
| 1403 |
/* Hook the page function to 'admin_menu'. */
|
| 1404 |
add_action( 'admin_menu', array( &$this, 'wck_page_init' ), $this->args['priority'] );
|
| 1405 |
}
|
| 1406 |
else{
|
| 1407 |
/* Hook the page function to 'admin_menu'. */
|
| 1408 |
add_action( 'network_admin_menu', array( &$this, 'wck_page_init' ), $this->args['priority'] );
|
| 1409 |
+
}
|
| 1410 |
}
|
| 1411 |
+
|
| 1412 |
/**
|
| 1413 |
* Function that creates the admin page
|
| 1414 |
*/
|
| 1415 |
+
function wck_page_init(){
|
| 1416 |
global $pb_wck_pages_hooknames;
|
| 1417 |
|
| 1418 |
/* don't add the page at all if the user doesn't meet the capabilities */
|
| 1420 |
if( !current_user_can( $this->args['capability'] ) )
|
| 1421 |
return;
|
| 1422 |
}
|
| 1423 |
+
|
| 1424 |
/* Create the page using either add_menu_page or add_submenu_page functions depending on the 'page_type' parameter. */
|
| 1425 |
if( $this->args['page_type'] == 'menu_page' ){
|
| 1426 |
$this->hookname = add_menu_page( $this->args['page_title'], $this->args['menu_title'], $this->args['capability'], $this->args['menu_slug'], array( &$this, 'wck_page_template' ), $this->args['icon_url'], $this->args['position'] );
|
| 1434 |
}
|
| 1435 |
|
| 1436 |
do_action( 'WCK_Page_Creator_PB_after_init', $this->hookname );
|
| 1437 |
+
|
| 1438 |
/* Create a hook for adding meta boxes. */
|
| 1439 |
add_action( "load-{$this->hookname}", array( &$this, 'wck_settings_page_add_meta_boxes' ) );
|
| 1440 |
/* Load the JavaScript needed for the screen. */
|
| 1441 |
add_action( 'admin_enqueue_scripts', array( &$this, 'wck_page_enqueue_scripts' ) );
|
| 1442 |
add_action( "admin_head-{$this->hookname}", array( &$this, 'wck_page_load_scripts' ) );
|
| 1443 |
}
|
| 1444 |
+
|
| 1445 |
/**
|
| 1446 |
* Do action 'add_meta_boxes'. This hook isn't executed by default on a admin page so we have to add it.
|
| 1447 |
*/
|
| 1449 |
global $post;
|
| 1450 |
do_action( 'add_meta_boxes', $this->hookname, $post );
|
| 1451 |
}
|
| 1452 |
+
|
| 1453 |
/**
|
| 1454 |
* Loads the JavaScript files required for managing the meta boxes on the theme settings
|
| 1455 |
* page, which allows users to arrange the boxes to their liking.
|
| 1459 |
* @since 1.0.0
|
| 1460 |
* @param string $hook The current page being viewed.
|
| 1461 |
*/
|
| 1462 |
+
function wck_page_enqueue_scripts( $hook ) {
|
| 1463 |
if ( $hook == $this->hookname ) {
|
| 1464 |
wp_enqueue_script( 'common' );
|
| 1465 |
wp_enqueue_script( 'wp-lists' );
|
| 1466 |
wp_enqueue_script( 'postbox' );
|
| 1467 |
}
|
| 1468 |
}
|
| 1469 |
+
|
| 1470 |
/**
|
| 1471 |
* Loads the JavaScript required for toggling the meta boxes on the theme settings page.
|
| 1472 |
*
|
| 1474 |
* bareskin_settings_page_init ).
|
| 1475 |
* @since 1.0.0
|
| 1476 |
*/
|
| 1477 |
+
function wck_page_load_scripts() {
|
| 1478 |
?>
|
| 1479 |
<script type="text/javascript">
|
| 1480 |
//<![CDATA[
|
| 1490 |
* Outputs default template for the page. It contains placeholders for metaboxes. It also
|
| 1491 |
* provides two action hooks 'wck_before_meta_boxes' and 'wck_after_meta_boxes'.
|
| 1492 |
*/
|
| 1493 |
+
function wck_page_template(){
|
| 1494 |
+
?>
|
| 1495 |
<div class="wrap">
|
| 1496 |
+
|
| 1497 |
<?php if( !empty( $this->args['page_icon'] ) ): ?>
|
| 1498 |
<div id="<?php echo $this->args['menu_slug'] ?>-icon" style="background: url('<?php echo $this->args['page_icon']; ?>') no-repeat;" class="icon32">
|
| 1499 |
<br/>
|
| 1500 |
</div>
|
| 1501 |
<?php endif; ?>
|
| 1502 |
+
|
| 1503 |
+
<h2><?php echo $this->args['page_title'] ?></h2>
|
| 1504 |
+
|
| 1505 |
<div id="poststuff">
|
| 1506 |
+
|
| 1507 |
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
| 1508 |
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
|
| 1509 |
+
|
| 1510 |
<?php do_action( 'wck_before_meta_boxes', $this->hookname ); ?>
|
| 1511 |
+
|
| 1512 |
<div class="metabox-holder">
|
| 1513 |
<div class="wck-post-body">
|
| 1514 |
<div class="post-box-container column-1 normal">
|
| 1520 |
<?php do_action( 'wck_before_column3_metabox_content', $this->hookname ); ?>
|
| 1521 |
<?php do_meta_boxes( $this->hookname, 'advanced', null ); ?>
|
| 1522 |
<?php do_action( 'wck_after_column3_metabox_content', $this->hookname ); ?>
|
| 1523 |
+
</div>
|
| 1524 |
</div>
|
| 1525 |
<div class="post-box-container column-2 side"><?php do_meta_boxes( $this->hookname, 'side', null ); ?></div>
|
| 1526 |
+
|
| 1527 |
+
</div>
|
| 1528 |
+
|
| 1529 |
<?php do_action( 'wck_after_meta_boxes', $this->hookname ); ?>
|
| 1530 |
|
| 1531 |
</div><!-- #poststuff -->
|
| 1537 |
|
| 1538 |
|
| 1539 |
|
| 1540 |
+
?>
|
features/functions.php
CHANGED
|
@@ -341,6 +341,10 @@ function wppb_changeDefaultAvatar( $avatar, $id_or_email, $size, $default, $alt
|
|
| 341 |
if(is_object($id_or_email)){
|
| 342 |
$my_user_id = $id_or_email->user_id;
|
| 343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
}elseif(is_numeric($id_or_email)){
|
| 345 |
$my_user_id = $id_or_email;
|
| 346 |
|
|
@@ -944,7 +948,7 @@ function wppb_manage_required_attribute() {
|
|
| 944 |
<?php
|
| 945 |
}
|
| 946 |
}
|
| 947 |
-
add_action( 'wp_footer', 'wppb_manage_required_attribute' );
|
| 948 |
|
| 949 |
function wpbb_specify_blog_details_on_signup_email( $message, $user_email, $user, $activation_key, $registration_page_url, $meta, $from_name, $context ){
|
| 950 |
$meta = unserialize($meta);
|
| 341 |
if(is_object($id_or_email)){
|
| 342 |
$my_user_id = $id_or_email->user_id;
|
| 343 |
|
| 344 |
+
if ($id_or_email instanceof WP_User){
|
| 345 |
+
$my_user_id = $id_or_email->ID;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
}elseif(is_numeric($id_or_email)){
|
| 349 |
$my_user_id = $id_or_email;
|
| 350 |
|
| 948 |
<?php
|
| 949 |
}
|
| 950 |
}
|
| 951 |
+
add_action( 'wp_footer', 'wppb_manage_required_attribute', 99 );
|
| 952 |
|
| 953 |
function wpbb_specify_blog_details_on_signup_email( $message, $user_email, $user, $activation_key, $registration_page_url, $meta, $from_name, $context ){
|
| 954 |
$meta = unserialize($meta);
|
front-end/class-formbuilder.php
CHANGED
|
@@ -675,6 +675,7 @@ class Profile_Builder_Form_Creator{
|
|
| 675 |
/* turn it in a select2 */
|
| 676 |
wp_enqueue_script( 'wppb_select2_js', WPPB_PLUGIN_URL .'assets/js/select2/select2.min.js', array( 'jquery' ), PROFILE_BUILDER_VERSION );
|
| 677 |
wp_enqueue_style( 'wppb_select2_css', WPPB_PLUGIN_URL .'assets/css/select2/select2.min.css', array(), PROFILE_BUILDER_VERSION );
|
|
|
|
| 678 |
?>
|
| 679 |
<form method="GET" action="" id="select_user_to_edit_form">
|
| 680 |
<p class="wppb-form-field">
|
|
@@ -690,10 +691,6 @@ class Profile_Builder_Form_Creator{
|
|
| 690 |
?>
|
| 691 |
</select>
|
| 692 |
</p>
|
| 693 |
-
<script type="text/javascript">jQuery('#wppb-user-to-edit').change(function () {
|
| 694 |
-
window.location.href = jQuery(this).val();
|
| 695 |
-
});
|
| 696 |
-
jQuery(function(){jQuery('.wppb-user-to-edit').select2(); })</script>
|
| 697 |
</form>
|
| 698 |
<?php
|
| 699 |
}
|
| 675 |
/* turn it in a select2 */
|
| 676 |
wp_enqueue_script( 'wppb_select2_js', WPPB_PLUGIN_URL .'assets/js/select2/select2.min.js', array( 'jquery' ), PROFILE_BUILDER_VERSION );
|
| 677 |
wp_enqueue_style( 'wppb_select2_css', WPPB_PLUGIN_URL .'assets/css/select2/select2.min.css', array(), PROFILE_BUILDER_VERSION );
|
| 678 |
+
wp_add_inline_script( 'wppb_select2_js', 'jQuery("#wppb-user-to-edit").change(function () {window.location.href = jQuery(this).val(); });jQuery(function(){jQuery(".wppb-user-to-edit").select2(); })' );
|
| 679 |
?>
|
| 680 |
<form method="GET" action="" id="select_user_to_edit_form">
|
| 681 |
<p class="wppb-form-field">
|
| 691 |
?>
|
| 692 |
</select>
|
| 693 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
</form>
|
| 695 |
<?php
|
| 696 |
}
|
front-end/login.php
CHANGED
|
@@ -349,7 +349,7 @@ function wppb_login_redirect( $redirect_to, $requested_redirect_to, $user ){
|
|
| 349 |
|
| 350 |
return $redirect_to;
|
| 351 |
}
|
| 352 |
-
add_filter( 'login_redirect', 'wppb_login_redirect',
|
| 353 |
|
| 354 |
|
| 355 |
/* shortcode function */
|
| 349 |
|
| 350 |
return $redirect_to;
|
| 351 |
}
|
| 352 |
+
add_filter( 'login_redirect', 'wppb_login_redirect', 20, 3 );
|
| 353 |
|
| 354 |
|
| 355 |
/* shortcode function */
|
front-end/recover.php
CHANGED
|
@@ -350,9 +350,9 @@ function wppb_front_end_password_recovery(){
|
|
| 350 |
//get the login name and key and verify if they match the ones in the database
|
| 351 |
|
| 352 |
$key = sanitize_text_field( $_GET['key'] );
|
| 353 |
-
$
|
| 354 |
|
| 355 |
-
$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND
|
| 356 |
|
| 357 |
if( !empty( $user ) ){
|
| 358 |
//check if the "finalAction" variable is not in the address bar, if it is, don't display the form anymore
|
|
@@ -414,4 +414,4 @@ function wppb_front_end_password_recovery(){
|
|
| 414 |
ob_end_clean();
|
| 415 |
|
| 416 |
return $output;
|
| 417 |
-
}
|
| 350 |
//get the login name and key and verify if they match the ones in the database
|
| 351 |
|
| 352 |
$key = sanitize_text_field( $_GET['key'] );
|
| 353 |
+
$username = sanitize_user( $_GET['loginName'] );
|
| 354 |
|
| 355 |
+
$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $username ) );
|
| 356 |
|
| 357 |
if( !empty( $user ) ){
|
| 358 |
//check if the "finalAction" variable is not in the address bar, if it is, don't display the form anymore
|
| 414 |
ob_end_clean();
|
| 415 |
|
| 416 |
return $output;
|
| 417 |
+
}
|
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: 2.9.
|
| 7 |
Author: Cozmoslabs
|
| 8 |
Author URI: https://www.cozmoslabs.com/
|
| 9 |
Text Domain: profile-builder
|
|
@@ -75,7 +75,7 @@ function wppb_free_plugin_init() {
|
|
| 75 |
*
|
| 76 |
*
|
| 77 |
*/
|
| 78 |
-
define('PROFILE_BUILDER_VERSION', '2.9.
|
| 79 |
define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
| 80 |
define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
|
| 81 |
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: 2.9.5
|
| 7 |
Author: Cozmoslabs
|
| 8 |
Author URI: https://www.cozmoslabs.com/
|
| 9 |
Text Domain: profile-builder
|
| 75 |
*
|
| 76 |
*
|
| 77 |
*/
|
| 78 |
+
define('PROFILE_BUILDER_VERSION', '2.9.5' );
|
| 79 |
define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
| 80 |
define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
|
| 81 |
define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
readme.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
=== User registration & user profile - Profile Builder ===
|
| 2 |
-
Contributors: cozmoslabs, reflectionmedia, sareiodata, adispiac, madalin.ungureanu, iova.mihai, barinagabriel
|
| 3 |
Donate link: http://www.cozmoslabs.com/wordpress-profile-builder/
|
| 4 |
Tags: user registration, user profile, user registration form, user fields, extra 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.0.
|
| 7 |
-
Stable tag: 2.9.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -167,6 +167,12 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
|
|
| 167 |
12. Role Editor
|
| 168 |
|
| 169 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
= 2.9.4 =
|
| 171 |
* Added (int) cast in manage fields meta name generation to prevent some php notices
|
| 172 |
* Fixed issue with private website when the login page url contained a $_GET parameter
|
| 1 |
=== User registration & user profile - Profile Builder ===
|
| 2 |
+
Contributors: cozmoslabs, reflectionmedia, sareiodata, adispiac, madalin.ungureanu, iova.mihai, barinagabriel
|
| 3 |
Donate link: http://www.cozmoslabs.com/wordpress-profile-builder/
|
| 4 |
Tags: user registration, user profile, user registration form, user fields, extra 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.0.3
|
| 7 |
+
Stable tag: 2.9.5
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 167 |
12. Role Editor
|
| 168 |
|
| 169 |
== Changelog ==
|
| 170 |
+
= 2.9.5 =
|
| 171 |
+
* Fixed an issue with the Boss theme by moving the priority of the login_redirect filter
|
| 172 |
+
* Fixed issue with edit other user on the Twenty Nineteen theme
|
| 173 |
+
* Fixed issues with jQuery code and the Twenty Nineteen theme
|
| 174 |
+
* Fixed conflict with Elementor Pro.
|
| 175 |
+
|
| 176 |
= 2.9.4 =
|
| 177 |
* Added (int) cast in manage fields meta name generation to prevent some php notices
|
| 178 |
* Fixed issue with private website when the login page url contained a $_GET parameter
|
translation/profile-builder.catalog.php
CHANGED
|
@@ -95,7 +95,6 @@
|
|
| 95 |
<?php __("Width (px)", "profile-builder"); ?>
|
| 96 |
<?php __("Forms", "profile-builder"); ?>
|
| 97 |
<?php __("Fields", "profile-builder"); ?>
|
| 98 |
-
<?php __("Emails", "profile-builder"); ?>
|
| 99 |
<?php __("Userlisting", "profile-builder"); ?>
|
| 100 |
<?php __("Shortcodes", "profile-builder"); ?>
|
| 101 |
<?php __("Customization Toolbox", "profile-builder"); ?>
|
|
@@ -1202,23 +1201,28 @@
|
|
| 1202 |
<?php __("Status", "profile-builder"); ?>
|
| 1203 |
<?php __("Active", "profile-builder"); ?>
|
| 1204 |
<?php __("Inactive", "profile-builder"); ?>
|
| 1205 |
-
<?php __("Passwordless Login URL", "profile-builder"); ?>
|
| 1206 |
<?php __("$validation_message", "profile-builder"); ?>
|
|
|
|
|
|
|
| 1207 |
<?php __("Resend activation email", "profile-builder"); ?>
|
| 1208 |
-
<?php __("Enable Passwordless Login tag", "profile-builder"); ?>
|
| 1209 |
-
<?php __("Adds a new tag to the email customizers: <strong>{{{passwordless_login_url}}}</strong>.", "profile-builder"); ?>
|
| 1210 |
-
<?php __("You can include this in certain User emails to give your users the ability to login instantly.", "profile-builder"); ?>
|
| 1211 |
-
<?php __("This feature won't work at all if Admin Approval is enabled.", "profile-builder"); ?>
|
| 1212 |
<?php __("Automatically generate password for users", "profile-builder"); ?>
|
| 1213 |
<?php __("By checking this option, the password will be automatically generated and emailed to the user.", "profile-builder"); ?>
|
| 1214 |
-
<?php __("
|
| 1215 |
-
<?php __("
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1216 |
<?php __("Hide Repeater Fields from the back-end profile page", "profile-builder"); ?>
|
| 1217 |
<?php __("Repeater Fields from Profile Builder do not work on the back-end user profile page, they are just displayed. If you want to remove them completely, you can use this option.", "profile-builder"); ?>
|
| 1218 |
<?php __("You will still be able to use them from a front-end edit profile form.", "profile-builder"); ?>
|
|
|
|
|
|
|
| 1219 |
<?php __("Always capitalize `First Name` and `Last Name` default fields", "profile-builder"); ?>
|
| 1220 |
<?php __("If you have these fields in your forms, they will be always saved with the first letter as uppercase.", "profile-builder"); ?>
|
| 1221 |
<?php __("eg.: <strong>Jhon Doe</strong> instead of <strong>jhon doe</strong>", "profile-builder"); ?>
|
|
|
|
|
|
|
| 1222 |
<?php __("Ban certain words from being used in fields", "profile-builder"); ?>
|
| 1223 |
<?php __("On", "profile-builder"); ?>
|
| 1224 |
<?php __("Affected fields:", "profile-builder"); ?>
|
|
@@ -1238,6 +1242,8 @@
|
|
| 1238 |
<?php __("Check the `Remember Me` checkbox on Login forms, by default.", "profile-builder"); ?>
|
| 1239 |
<?php __("Remove validation from back-end profile page", "profile-builder"); ?>
|
| 1240 |
<?php __("When saving the back-end user profile, Profile Builder fields will not be validated anymore. eg.: bypass required attribute", "profile-builder"); ?>
|
|
|
|
|
|
|
| 1241 |
<?php __("Consider `Anyone can Register` WordPress option", "profile-builder"); ?>
|
| 1242 |
<?php __("setting", "profile-builder"); ?>
|
| 1243 |
<?php __("By default, Profile Builder ignores this %1$s. If you check this option, our registration form will consider it.", "profile-builder"); ?>
|
|
@@ -1248,7 +1254,7 @@
|
|
| 1248 |
<?php __("By default, the Admin Approval status is saved as a custom taxonomy that is attached to the user.", "profile-builder"); ?>
|
| 1249 |
<?php __("If you check this option, the status will also be saved in the `*_usermeta` table under the <strong>wppb_approval_status</strong> meta name.", "profile-builder"); ?>
|
| 1250 |
<?php __("Redirect `/author` page if user is not approved", "profile-builder"); ?>
|
| 1251 |
-
<?php __("By default, users placed in Admin Approval will not be able to login, but the Author pages will be
|
| 1252 |
<?php __("Using this option you can redirect these pages, sending users who try to toolboxess them to your home page.", "profile-builder"); ?>
|
| 1253 |
<?php __("Save `Last Login` date in usermeta", "profile-builder"); ?>
|
| 1254 |
<?php __("By checking this option, each time a user logins, the date and time will be saved in the database.", "profile-builder"); ?>
|
| 95 |
<?php __("Width (px)", "profile-builder"); ?>
|
| 96 |
<?php __("Forms", "profile-builder"); ?>
|
| 97 |
<?php __("Fields", "profile-builder"); ?>
|
|
|
|
| 98 |
<?php __("Userlisting", "profile-builder"); ?>
|
| 99 |
<?php __("Shortcodes", "profile-builder"); ?>
|
| 100 |
<?php __("Customization Toolbox", "profile-builder"); ?>
|
| 1201 |
<?php __("Status", "profile-builder"); ?>
|
| 1202 |
<?php __("Active", "profile-builder"); ?>
|
| 1203 |
<?php __("Inactive", "profile-builder"); ?>
|
|
|
|
| 1204 |
<?php __("$validation_message", "profile-builder"); ?>
|
| 1205 |
+
<?php __("$text", "profile-builder"); ?>
|
| 1206 |
+
<?php __("This display name is already in use. Please choose another one.", "profile-builder"); ?>
|
| 1207 |
<?php __("Resend activation email", "profile-builder"); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1208 |
<?php __("Automatically generate password for users", "profile-builder"); ?>
|
| 1209 |
<?php __("By checking this option, the password will be automatically generated and emailed to the user.", "profile-builder"); ?>
|
| 1210 |
+
<?php __("Modify `Send Credentials` checkbox", "profile-builder"); ?>
|
| 1211 |
+
<?php __("Hidden and checked", "profile-builder"); ?>
|
| 1212 |
+
<?php __("Field text:", "profile-builder"); ?>
|
| 1213 |
+
<?php __("By default, the user needs to choose if he wants to receive a registration email.", "profile-builder"); ?>
|
| 1214 |
+
<?php __("By checking the <strong>Hidden and checked</strong> option, the field won't be shown and the message will always be sent to the user.", "profile-builder"); ?>
|
| 1215 |
+
<?php __("If you choose to show the field, you can modify the default text by entering something in the field from above.", "profile-builder"); ?>
|
| 1216 |
<?php __("Hide Repeater Fields from the back-end profile page", "profile-builder"); ?>
|
| 1217 |
<?php __("Repeater Fields from Profile Builder do not work on the back-end user profile page, they are just displayed. If you want to remove them completely, you can use this option.", "profile-builder"); ?>
|
| 1218 |
<?php __("You will still be able to use them from a front-end edit profile form.", "profile-builder"); ?>
|
| 1219 |
+
<?php __("Unique `Display Name` for users", "profile-builder"); ?>
|
| 1220 |
+
<?php __("By checking this option, users will not be able to choose a <strong>Display Name</strong> that is already used by another account.", "profile-builder"); ?>
|
| 1221 |
<?php __("Always capitalize `First Name` and `Last Name` default fields", "profile-builder"); ?>
|
| 1222 |
<?php __("If you have these fields in your forms, they will be always saved with the first letter as uppercase.", "profile-builder"); ?>
|
| 1223 |
<?php __("eg.: <strong>Jhon Doe</strong> instead of <strong>jhon doe</strong>", "profile-builder"); ?>
|
| 1224 |
+
<?php __("Datepicker starts on Monday", "profile-builder"); ?>
|
| 1225 |
+
<?php __("Will make all Datepickers use Monday as the first day of the week.", "profile-builder"); ?>
|
| 1226 |
<?php __("Ban certain words from being used in fields", "profile-builder"); ?>
|
| 1227 |
<?php __("On", "profile-builder"); ?>
|
| 1228 |
<?php __("Affected fields:", "profile-builder"); ?>
|
| 1242 |
<?php __("Check the `Remember Me` checkbox on Login forms, by default.", "profile-builder"); ?>
|
| 1243 |
<?php __("Remove validation from back-end profile page", "profile-builder"); ?>
|
| 1244 |
<?php __("When saving the back-end user profile, Profile Builder fields will not be validated anymore. eg.: bypass required attribute", "profile-builder"); ?>
|
| 1245 |
+
<?php __("Always show edit other users dropdown", "profile-builder"); ?>
|
| 1246 |
+
<?php __("For perfomance reasons, we disable the select if you have more than 5000 users on your website. This option lets you enable it again.", "profile-builder"); ?>
|
| 1247 |
<?php __("Consider `Anyone can Register` WordPress option", "profile-builder"); ?>
|
| 1248 |
<?php __("setting", "profile-builder"); ?>
|
| 1249 |
<?php __("By default, Profile Builder ignores this %1$s. If you check this option, our registration form will consider it.", "profile-builder"); ?>
|
| 1254 |
<?php __("By default, the Admin Approval status is saved as a custom taxonomy that is attached to the user.", "profile-builder"); ?>
|
| 1255 |
<?php __("If you check this option, the status will also be saved in the `*_usermeta` table under the <strong>wppb_approval_status</strong> meta name.", "profile-builder"); ?>
|
| 1256 |
<?php __("Redirect `/author` page if user is not approved", "profile-builder"); ?>
|
| 1257 |
+
<?php __("By default, users placed in Admin Approval will not be able to login, but the Author pages will be accessible.", "profile-builder"); ?>
|
| 1258 |
<?php __("Using this option you can redirect these pages, sending users who try to toolboxess them to your home page.", "profile-builder"); ?>
|
| 1259 |
<?php __("Save `Last Login` date in usermeta", "profile-builder"); ?>
|
| 1260 |
<?php __("By checking this option, each time a user logins, the date and time will be saved in the database.", "profile-builder"); ?>
|
translation/profile-builder.pot
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Copyright (C)
|
| 2 |
# This file is distributed under the same license as the Profile Builder package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
|
@@ -389,16 +389,12 @@ msgstr ""
|
|
| 389 |
msgid "Width (px)"
|
| 390 |
msgstr ""
|
| 391 |
|
| 392 |
-
#: index.php:39
|
| 393 |
-
msgid "Forms"
|
| 394 |
-
msgstr ""
|
| 395 |
-
|
| 396 |
#: index.php:40
|
| 397 |
-
msgid "
|
| 398 |
msgstr ""
|
| 399 |
|
| 400 |
#: index.php:41
|
| 401 |
-
msgid "
|
| 402 |
msgstr ""
|
| 403 |
|
| 404 |
#: index.php:42
|
|
@@ -417,7 +413,7 @@ msgstr ""
|
|
| 417 |
msgid "Toolbox"
|
| 418 |
msgstr ""
|
| 419 |
|
| 420 |
-
#: index.php:
|
| 421 |
msgid "Settings"
|
| 422 |
msgstr ""
|
| 423 |
|
|
@@ -453,11 +449,11 @@ msgstr ""
|
|
| 453 |
msgid "<pre>Title</pre><pre>Type</pre><pre>Meta Name</pre><pre class=\"wppb-mb-head-required\">Required</pre><pre class=\"wppb-mb-head-visibility\"></pre>"
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
-
#: ../pb-add-on-field-visibility/index.php:223, ../pb-add-on-labels-edit/pble.php:354, ../profile-builder-2.0/admin/manage-fields.php:1239, ../profile-builder-2.0/features/functions.php:
|
| 457 |
msgid "Edit"
|
| 458 |
msgstr ""
|
| 459 |
|
| 460 |
-
#: ../pb-add-on-field-visibility/index.php:223, ../profile-builder-2.0/admin/manage-fields.php:1239, ../profile-builder-2.0/features/functions.php:
|
| 461 |
msgid "Delete"
|
| 462 |
msgstr ""
|
| 463 |
|
|
@@ -685,7 +681,7 @@ msgstr ""
|
|
| 685 |
msgid "Replace labels with placeholders:"
|
| 686 |
msgstr ""
|
| 687 |
|
| 688 |
-
#: ../pb-add-on-placeholder-labels/pbpl.php:171, ../pb-add-on-social-connect/index.php:323, ../profile-builder-2.0/admin/general-settings.php:111, ../profile-builder-2.0/admin/general-settings.php:124, ../profile-builder-2.0/admin/general-settings.php:173, ../profile-builder-2.0/admin/general-settings.php:220, ../profile-builder-2.0/admin/private-website.php:58, ../profile-builder-2.0/admin/private-website.php:115, includes/views/view-
|
| 689 |
msgid "Yes"
|
| 690 |
msgstr ""
|
| 691 |
|
|
@@ -881,7 +877,7 @@ msgstr ""
|
|
| 881 |
msgid "You will be redirected in 5 seconds. If not, click %%."
|
| 882 |
msgstr ""
|
| 883 |
|
| 884 |
-
#: ../pb-add-on-social-connect/index.php:390, ../profile-builder-2.0/features/functions.php:
|
| 885 |
msgid "here"
|
| 886 |
msgstr ""
|
| 887 |
|
|
@@ -941,11 +937,11 @@ msgstr ""
|
|
| 941 |
msgid "Country"
|
| 942 |
msgstr ""
|
| 943 |
|
| 944 |
-
#: ../pb-add-on-woocommerce/billing-fields.php:6, ../pb-add-on-woocommerce/shipping-fields.php:6, ../profile-builder-2.0/admin/manage-fields.php:246, includes/views/view-fields.php:
|
| 945 |
msgid "First Name"
|
| 946 |
msgstr ""
|
| 947 |
|
| 948 |
-
#: ../pb-add-on-woocommerce/billing-fields.php:7, ../pb-add-on-woocommerce/shipping-fields.php:7, ../profile-builder-2.0/admin/manage-fields.php:247, includes/views/view-fields.php:
|
| 949 |
msgid "Last Name"
|
| 950 |
msgstr ""
|
| 951 |
|
|
@@ -1193,7 +1189,7 @@ msgstr ""
|
|
| 1193 |
msgid "Click to edit"
|
| 1194 |
msgstr ""
|
| 1195 |
|
| 1196 |
-
#: ../pb-add-on-campaign-monitor-integration/admin/cmonitor-page.php:451, ../pb-add-on-mailchimp-integration/admin/mailchimp-page.php:171, ../profile-builder-2.0/features/functions.php:
|
| 1197 |
msgid "Cancel"
|
| 1198 |
msgstr ""
|
| 1199 |
|
|
@@ -1767,15 +1763,15 @@ msgstr ""
|
|
| 1767 |
msgid "Very weak"
|
| 1768 |
msgstr ""
|
| 1769 |
|
| 1770 |
-
#: ../profile-builder-2.0/admin/admin-functions.php:137, ../profile-builder-2.0/admin/general-settings.php:280, ../profile-builder-2.0/features/functions.php:
|
| 1771 |
msgid "Weak"
|
| 1772 |
msgstr ""
|
| 1773 |
|
| 1774 |
-
#: ../profile-builder-2.0/admin/admin-functions.php:137, ../profile-builder-2.0/admin/general-settings.php:281, ../profile-builder-2.0/features/functions.php:
|
| 1775 |
msgid "Medium"
|
| 1776 |
msgstr ""
|
| 1777 |
|
| 1778 |
-
#: ../profile-builder-2.0/admin/admin-functions.php:137, ../profile-builder-2.0/admin/general-settings.php:282, ../profile-builder-2.0/features/functions.php:
|
| 1779 |
msgid "Strong"
|
| 1780 |
msgstr ""
|
| 1781 |
|
|
@@ -2251,7 +2247,7 @@ msgstr ""
|
|
| 2251 |
msgid "Username and Email"
|
| 2252 |
msgstr ""
|
| 2253 |
|
| 2254 |
-
#: ../profile-builder-2.0/admin/general-settings.php:249, ../profile-builder-2.0/admin/manage-fields.php:245, ../profile-builder-2.0/front-end/login.php:246, ../profile-builder-2.0/front-end/login.php:260, ../profile-builder-2.0/front-end/login.php:389, includes/views/view-fields.php:
|
| 2255 |
msgid "Username"
|
| 2256 |
msgstr ""
|
| 2257 |
|
|
@@ -4441,7 +4437,7 @@ msgstr ""
|
|
| 4441 |
msgid "We recommend \"<a href=\"%s\" target=\"_blank\">Custom Profile Menus</a>\" addon if you need different menu items for logged in / logged out users."
|
| 4442 |
msgstr ""
|
| 4443 |
|
| 4444 |
-
#: ../profile-builder-2.0/admin/private-website.php:127, ../profile-builder-2.0/features/functions.php:
|
| 4445 |
msgid "Save Changes"
|
| 4446 |
msgstr ""
|
| 4447 |
|
|
@@ -4525,55 +4521,55 @@ msgstr ""
|
|
| 4525 |
msgid "I allow the website to collect and store the data I submit through this form."
|
| 4526 |
msgstr ""
|
| 4527 |
|
| 4528 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4529 |
msgid "Strength indicator"
|
| 4530 |
msgstr ""
|
| 4531 |
|
| 4532 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4533 |
msgid "Very Weak"
|
| 4534 |
msgstr ""
|
| 4535 |
|
| 4536 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4537 |
msgid "Minimum length of %d characters."
|
| 4538 |
msgstr ""
|
| 4539 |
|
| 4540 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4541 |
msgid "The password must have a minimum strength of %s."
|
| 4542 |
msgstr ""
|
| 4543 |
|
| 4544 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4545 |
msgid "This field is required"
|
| 4546 |
msgstr ""
|
| 4547 |
|
| 4548 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4549 |
msgid "Please enter a (valid) reCAPTCHA value"
|
| 4550 |
msgstr ""
|
| 4551 |
|
| 4552 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4553 |
msgid "Incorrect phone number"
|
| 4554 |
msgstr ""
|
| 4555 |
|
| 4556 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4557 |
msgid "Content"
|
| 4558 |
msgstr ""
|
| 4559 |
|
| 4560 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4561 |
msgid "<br><br>Also, you will be able to visit your site at "
|
| 4562 |
msgstr ""
|
| 4563 |
|
| 4564 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4565 |
msgid "<br><br>You can visit your site at "
|
| 4566 |
msgstr ""
|
| 4567 |
|
| 4568 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4569 |
msgid "You will soon be redirected automatically. If you see this page for more than %1$d seconds, please click %2$s.%3$s"
|
| 4570 |
msgstr ""
|
| 4571 |
|
| 4572 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4573 |
msgid "No feed available,please visit our <a href=\"%s\">homepage</a>!"
|
| 4574 |
msgstr ""
|
| 4575 |
|
| 4576 |
-
#: ../profile-builder-2.0/features/functions.php:
|
| 4577 |
msgid "You are not currently logged in."
|
| 4578 |
msgstr ""
|
| 4579 |
|
|
@@ -4641,19 +4637,19 @@ msgstr ""
|
|
| 4641 |
msgid "Send these credentials via email."
|
| 4642 |
msgstr ""
|
| 4643 |
|
| 4644 |
-
#: ../profile-builder-2.0/front-end/class-formbuilder.php:
|
| 4645 |
msgid "User to edit:"
|
| 4646 |
msgstr ""
|
| 4647 |
|
| 4648 |
-
#: ../profile-builder-2.0/front-end/class-formbuilder.php:
|
| 4649 |
msgid "Select User"
|
| 4650 |
msgstr ""
|
| 4651 |
|
| 4652 |
-
#: ../profile-builder-2.0/front-end/class-formbuilder.php:
|
| 4653 |
msgid "There are no other users to edit"
|
| 4654 |
msgstr ""
|
| 4655 |
|
| 4656 |
-
#: ../profile-builder-2.0/front-end/class-formbuilder.php:
|
| 4657 |
msgid "Something went wrong. Please try again!"
|
| 4658 |
msgstr ""
|
| 4659 |
|
|
@@ -4869,95 +4865,115 @@ msgstr ""
|
|
| 4869 |
msgid "Inactive"
|
| 4870 |
msgstr ""
|
| 4871 |
|
| 4872 |
-
#: includes/emails/passwordless-login-tag.php:13
|
| 4873 |
-
msgid "Passwordless Login URL"
|
| 4874 |
-
msgstr ""
|
| 4875 |
-
|
| 4876 |
#: includes/fields/restricted-words.php:24, includes/forms/restricted-email-domains.php:19, includes/forms/restricted-email-domains.php:24
|
| 4877 |
msgid "$validation_message"
|
| 4878 |
msgstr ""
|
| 4879 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4880 |
#: includes/shortcodes/resend-activation.php:5
|
| 4881 |
msgid "Resend activation email"
|
| 4882 |
msgstr ""
|
| 4883 |
|
| 4884 |
-
#: includes/views/view-
|
| 4885 |
-
msgid "
|
| 4886 |
msgstr ""
|
| 4887 |
|
| 4888 |
-
#: includes/views/view-
|
| 4889 |
-
msgid "
|
| 4890 |
msgstr ""
|
| 4891 |
|
| 4892 |
-
#: includes/views/view-
|
| 4893 |
-
msgid "
|
| 4894 |
msgstr ""
|
| 4895 |
|
| 4896 |
-
#: includes/views/view-
|
| 4897 |
-
msgid "
|
| 4898 |
msgstr ""
|
| 4899 |
|
| 4900 |
-
#: includes/views/view-fields.php:
|
| 4901 |
-
msgid "
|
| 4902 |
msgstr ""
|
| 4903 |
|
| 4904 |
-
#: includes/views/view-fields.php:
|
| 4905 |
-
msgid "By
|
| 4906 |
msgstr ""
|
| 4907 |
|
| 4908 |
-
#: includes/views/view-fields.php:
|
| 4909 |
-
msgid "
|
| 4910 |
msgstr ""
|
| 4911 |
|
| 4912 |
-
#: includes/views/view-fields.php:
|
| 4913 |
-
msgid "
|
| 4914 |
msgstr ""
|
| 4915 |
|
| 4916 |
-
#: includes/views/view-fields.php:
|
| 4917 |
msgid "Hide Repeater Fields from the back-end profile page"
|
| 4918 |
msgstr ""
|
| 4919 |
|
| 4920 |
-
#: includes/views/view-fields.php:
|
| 4921 |
msgid "Repeater Fields from Profile Builder do not work on the back-end user profile page, they are just displayed. If you want to remove them completely, you can use this option."
|
| 4922 |
msgstr ""
|
| 4923 |
|
| 4924 |
-
#: includes/views/view-fields.php:
|
| 4925 |
msgid "You will still be able to use them from a front-end edit profile form."
|
| 4926 |
msgstr ""
|
| 4927 |
|
| 4928 |
-
#: includes/views/view-fields.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4929 |
msgid "Always capitalize `First Name` and `Last Name` default fields"
|
| 4930 |
msgstr ""
|
| 4931 |
|
| 4932 |
-
#: includes/views/view-fields.php:
|
| 4933 |
msgid "If you have these fields in your forms, they will be always saved with the first letter as uppercase."
|
| 4934 |
msgstr ""
|
| 4935 |
|
| 4936 |
-
#: includes/views/view-fields.php:
|
| 4937 |
msgid "eg.: <strong>Jhon Doe</strong> instead of <strong>jhon doe</strong>"
|
| 4938 |
msgstr ""
|
| 4939 |
|
| 4940 |
-
#: includes/views/view-fields.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4941 |
msgid "Ban certain words from being used in fields"
|
| 4942 |
msgstr ""
|
| 4943 |
|
| 4944 |
-
#: includes/views/view-fields.php:
|
| 4945 |
msgid "On"
|
| 4946 |
msgstr ""
|
| 4947 |
|
| 4948 |
-
#: includes/views/view-fields.php:
|
| 4949 |
msgid "Affected fields:"
|
| 4950 |
msgstr ""
|
| 4951 |
|
| 4952 |
-
#: includes/views/view-fields.php:
|
| 4953 |
msgid "Banned words:"
|
| 4954 |
msgstr ""
|
| 4955 |
|
| 4956 |
-
#: includes/views/view-fields.php:
|
| 4957 |
msgid "Error message:"
|
| 4958 |
msgstr ""
|
| 4959 |
|
| 4960 |
-
#: includes/views/view-fields.php:
|
| 4961 |
msgid "Allows you to define some words which users cannot use in their Username, First Name or Last Name when registering."
|
| 4962 |
msgstr ""
|
| 4963 |
|
|
@@ -5013,79 +5029,87 @@ msgstr ""
|
|
| 5013 |
msgid "When saving the back-end user profile, Profile Builder fields will not be validated anymore. eg.: bypass required attribute"
|
| 5014 |
msgstr ""
|
| 5015 |
|
| 5016 |
-
#: includes/views/view-forms.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5017 |
msgid "Consider `Anyone can Register` WordPress option"
|
| 5018 |
msgstr ""
|
| 5019 |
|
| 5020 |
-
#: includes/views/view-forms.php:
|
| 5021 |
msgid "setting"
|
| 5022 |
msgstr ""
|
| 5023 |
|
| 5024 |
-
#: includes/views/view-forms.php:
|
| 5025 |
msgid "By default, Profile Builder ignores this %1$s. If you check this option, our registration form will consider it."
|
| 5026 |
msgstr ""
|
| 5027 |
|
| 5028 |
-
#: includes/views/view-forms.php:
|
| 5029 |
msgid "Modify default Redirect Delay timer"
|
| 5030 |
msgstr ""
|
| 5031 |
|
| 5032 |
-
#: includes/views/view-forms.php:
|
| 5033 |
msgid "This allows you to change the amount of seconds it takes for the <strong>`After Registration`</strong> redirect to happen."
|
| 5034 |
msgstr ""
|
| 5035 |
|
| 5036 |
-
#: includes/views/view-forms.php:
|
| 5037 |
msgid "The default is 3 seconds. Leave empty if you do not want to change it."
|
| 5038 |
msgstr ""
|
| 5039 |
|
| 5040 |
-
#: includes/views/view-forms.php:
|
| 5041 |
msgid "Save Admin Approval status in usermeta"
|
| 5042 |
msgstr ""
|
| 5043 |
|
| 5044 |
-
#: includes/views/view-forms.php:
|
| 5045 |
msgid "By default, the Admin Approval status is saved as a custom taxonomy that is attached to the user."
|
| 5046 |
msgstr ""
|
| 5047 |
|
| 5048 |
-
#: includes/views/view-forms.php:
|
| 5049 |
msgid "If you check this option, the status will also be saved in the `*_usermeta` table under the <strong>wppb_approval_status</strong> meta name."
|
| 5050 |
msgstr ""
|
| 5051 |
|
| 5052 |
-
#: includes/views/view-forms.php:
|
| 5053 |
msgid "Redirect `/author` page if user is not approved"
|
| 5054 |
msgstr ""
|
| 5055 |
|
| 5056 |
-
#: includes/views/view-forms.php:
|
| 5057 |
-
msgid "By default, users placed in Admin Approval will not be able to login, but the Author pages will be
|
| 5058 |
msgstr ""
|
| 5059 |
|
| 5060 |
-
#: includes/views/view-forms.php:
|
| 5061 |
msgid "Using this option you can redirect these pages, sending users who try to toolboxess them to your home page."
|
| 5062 |
msgstr ""
|
| 5063 |
|
| 5064 |
-
#: includes/views/view-forms.php:
|
| 5065 |
msgid "Save `Last Login` date in usermeta"
|
| 5066 |
msgstr ""
|
| 5067 |
|
| 5068 |
-
#: includes/views/view-forms.php:
|
| 5069 |
msgid "By checking this option, each time a user logins, the date and time will be saved in the database."
|
| 5070 |
msgstr ""
|
| 5071 |
|
| 5072 |
-
#: includes/views/view-forms.php:
|
| 5073 |
msgid "The meta name for the field will be <strong>last_login_date</strong>."
|
| 5074 |
msgstr ""
|
| 5075 |
|
| 5076 |
-
#: includes/views/view-forms.php:
|
| 5077 |
msgid "You can <a href=\"https://www.cozmoslabs.com/docs/profile-builder-2/manage-user-fields/#Manage_existing_custom_fields_with_Profile_Builder\" target=\"_blank\">create a field with this meta name</a> in Profile Builder to display it in the Userlisting or Edit Profile forms."
|
| 5078 |
msgstr ""
|
| 5079 |
|
| 5080 |
-
#: includes/views/view-forms.php:
|
| 5081 |
msgid "Save `Last Profile Update` date in usermeta"
|
| 5082 |
msgstr ""
|
| 5083 |
|
| 5084 |
-
#: includes/views/view-forms.php:
|
| 5085 |
msgid "By checking this option, each time a modifies his profile the date and time will be saved in the database."
|
| 5086 |
msgstr ""
|
| 5087 |
|
| 5088 |
-
#: includes/views/view-forms.php:
|
| 5089 |
msgid "The meta name for the field will be <strong>last_profile_update_date</strong>."
|
| 5090 |
msgstr ""
|
| 5091 |
|
| 1 |
+
# Copyright (C) 2019 Profile Builder
|
| 2 |
# This file is distributed under the same license as the Profile Builder package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 389 |
msgid "Width (px)"
|
| 390 |
msgstr ""
|
| 391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
#: index.php:40
|
| 393 |
+
msgid "Forms"
|
| 394 |
msgstr ""
|
| 395 |
|
| 396 |
#: index.php:41
|
| 397 |
+
msgid "Fields"
|
| 398 |
msgstr ""
|
| 399 |
|
| 400 |
#: index.php:42
|
| 413 |
msgid "Toolbox"
|
| 414 |
msgstr ""
|
| 415 |
|
| 416 |
+
#: index.php:145, ../pb-add-on-social-connect/index.php:236, ../profile-builder-2.0/admin/admin-functions.php:226, ../profile-builder-2.0/admin/general-settings.php:76, ../profile-builder-2.0/admin/general-settings.php:76
|
| 417 |
msgid "Settings"
|
| 418 |
msgstr ""
|
| 419 |
|
| 449 |
msgid "<pre>Title</pre><pre>Type</pre><pre>Meta Name</pre><pre class=\"wppb-mb-head-required\">Required</pre><pre class=\"wppb-mb-head-visibility\"></pre>"
|
| 450 |
msgstr ""
|
| 451 |
|
| 452 |
+
#: ../pb-add-on-field-visibility/index.php:223, ../pb-add-on-labels-edit/pble.php:354, ../profile-builder-2.0/admin/manage-fields.php:1239, ../profile-builder-2.0/features/functions.php:787, ../profile-builder-2.0/features/functions.php:794, ../profile-builder-2.0/features/admin-approval/class-admin-approval.php:108, ../profile-builder-2.0/features/roles-editor/roles-editor.php:866, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:183, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:197, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:211, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:225, ../profile-builder-2.0/modules/multiple-forms/multiple-forms.php:406
|
| 453 |
msgid "Edit"
|
| 454 |
msgstr ""
|
| 455 |
|
| 456 |
+
#: ../pb-add-on-field-visibility/index.php:223, ../profile-builder-2.0/admin/manage-fields.php:1239, ../profile-builder-2.0/features/functions.php:780, ../profile-builder-2.0/features/functions.php:794, ../profile-builder-2.0/features/admin-approval/class-admin-approval.php:113, ../profile-builder-2.0/features/email-confirmation/class-email-confirmation.php:121, ../profile-builder-2.0/features/email-confirmation/class-email-confirmation.php:218, ../profile-builder-2.0/features/roles-editor/roles-editor.php:179, ../profile-builder-2.0/features/roles-editor/roles-editor.php:884, ../profile-builder-2.0/features/roles-editor/roles-editor.php:893, ../profile-builder-2.0/features/roles-editor/roles-editor.php:904, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:183, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:197, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:211, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:225
|
| 457 |
msgid "Delete"
|
| 458 |
msgstr ""
|
| 459 |
|
| 681 |
msgid "Replace labels with placeholders:"
|
| 682 |
msgstr ""
|
| 683 |
|
| 684 |
+
#: ../pb-add-on-placeholder-labels/pbpl.php:171, ../pb-add-on-social-connect/index.php:323, ../profile-builder-2.0/admin/general-settings.php:111, ../profile-builder-2.0/admin/general-settings.php:124, ../profile-builder-2.0/admin/general-settings.php:173, ../profile-builder-2.0/admin/general-settings.php:220, ../profile-builder-2.0/admin/private-website.php:58, ../profile-builder-2.0/admin/private-website.php:115, includes/views/view-fields.php:18, includes/views/view-fields.php:71, includes/views/view-fields.php:91, includes/views/view-fields.php:107, includes/views/view-fields.php:127, includes/views/view-forms.php:131, includes/views/view-forms.php:146, includes/views/view-forms.php:166, includes/views/view-forms.php:183, includes/views/view-forms.php:221, includes/views/view-forms.php:242, includes/views/view-forms.php:262, includes/views/view-forms.php:284, includes/views/view-shortcodes.php:16, includes/views/view-shortcodes.php:32, includes/views/view-shortcodes.php:48, includes/views/view-shortcodes.php:64, includes/views/view-userlisting.php:53, includes/views/view-userlisting.php:75, ../profile-builder-2.0/features/content-restriction/content-restriction.php:86, ../profile-builder-2.0/modules/multiple-forms/edit-profile-forms.php:206, ../profile-builder-2.0/modules/multiple-forms/register-forms.php:229, ../profile-builder-2.0/modules/multiple-forms/register-forms.php:230, ../profile-builder-2.0/modules/user-listing/userlisting.php:2339
|
| 685 |
msgid "Yes"
|
| 686 |
msgstr ""
|
| 687 |
|
| 877 |
msgid "You will be redirected in 5 seconds. If not, click %%."
|
| 878 |
msgstr ""
|
| 879 |
|
| 880 |
+
#: ../pb-add-on-social-connect/index.php:390, ../profile-builder-2.0/features/functions.php:1059
|
| 881 |
msgid "here"
|
| 882 |
msgstr ""
|
| 883 |
|
| 937 |
msgid "Country"
|
| 938 |
msgstr ""
|
| 939 |
|
| 940 |
+
#: ../pb-add-on-woocommerce/billing-fields.php:6, ../pb-add-on-woocommerce/shipping-fields.php:6, ../profile-builder-2.0/admin/manage-fields.php:246, includes/views/view-fields.php:166
|
| 941 |
msgid "First Name"
|
| 942 |
msgstr ""
|
| 943 |
|
| 944 |
+
#: ../pb-add-on-woocommerce/billing-fields.php:7, ../pb-add-on-woocommerce/shipping-fields.php:7, ../profile-builder-2.0/admin/manage-fields.php:247, includes/views/view-fields.php:172
|
| 945 |
msgid "Last Name"
|
| 946 |
msgstr ""
|
| 947 |
|
| 1189 |
msgid "Click to edit"
|
| 1190 |
msgstr ""
|
| 1191 |
|
| 1192 |
+
#: ../pb-add-on-campaign-monitor-integration/admin/cmonitor-page.php:451, ../pb-add-on-mailchimp-integration/admin/mailchimp-page.php:171, ../profile-builder-2.0/features/functions.php:773, ../pb-add-on-labels-edit/assets/lib/wck-api/wordpress-creation-kit.php:403, ../profile-builder-2.0/assets/lib/wck-api/wordpress-creation-kit.php:395
|
| 1193 |
msgid "Cancel"
|
| 1194 |
msgstr ""
|
| 1195 |
|
| 1763 |
msgid "Very weak"
|
| 1764 |
msgstr ""
|
| 1765 |
|
| 1766 |
+
#: ../profile-builder-2.0/admin/admin-functions.php:137, ../profile-builder-2.0/admin/general-settings.php:280, ../profile-builder-2.0/features/functions.php:607, ../profile-builder-2.0/features/functions.php:631
|
| 1767 |
msgid "Weak"
|
| 1768 |
msgstr ""
|
| 1769 |
|
| 1770 |
+
#: ../profile-builder-2.0/admin/admin-functions.php:137, ../profile-builder-2.0/admin/general-settings.php:281, ../profile-builder-2.0/features/functions.php:607, ../profile-builder-2.0/features/functions.php:631
|
| 1771 |
msgid "Medium"
|
| 1772 |
msgstr ""
|
| 1773 |
|
| 1774 |
+
#: ../profile-builder-2.0/admin/admin-functions.php:137, ../profile-builder-2.0/admin/general-settings.php:282, ../profile-builder-2.0/features/functions.php:607, ../profile-builder-2.0/features/functions.php:631
|
| 1775 |
msgid "Strong"
|
| 1776 |
msgstr ""
|
| 1777 |
|
| 2247 |
msgid "Username and Email"
|
| 2248 |
msgstr ""
|
| 2249 |
|
| 2250 |
+
#: ../profile-builder-2.0/admin/general-settings.php:249, ../profile-builder-2.0/admin/manage-fields.php:245, ../profile-builder-2.0/front-end/login.php:246, ../profile-builder-2.0/front-end/login.php:260, ../profile-builder-2.0/front-end/login.php:389, includes/views/view-fields.php:160, ../profile-builder-2.0/features/admin-approval/class-admin-approval.php:166, ../profile-builder-2.0/features/email-confirmation/class-email-confirmation.php:168, ../profile-builder-2.0/modules/custom-redirects/custom_redirects_admin.php:60, ../profile-builder-2.0/modules/email-customizer/email-customizer.php:28, ../profile-builder-2.0/modules/user-listing/userlisting.php:111, ../profile-builder-2.0/modules/user-listing/userlisting.php:303, ../profile-builder-2.0/modules/user-listing/userlisting.php:778, ../profile-builder-2.0/modules/user-listing/userlisting.php:2290
|
| 2251 |
msgid "Username"
|
| 2252 |
msgstr ""
|
| 2253 |
|
| 4437 |
msgid "We recommend \"<a href=\"%s\" target=\"_blank\">Custom Profile Menus</a>\" addon if you need different menu items for logged in / logged out users."
|
| 4438 |
msgstr ""
|
| 4439 |
|
| 4440 |
+
#: ../profile-builder-2.0/admin/private-website.php:127, ../profile-builder-2.0/features/functions.php:766, includes/views/view-fields.php:217, includes/views/view-forms.php:303, includes/views/view-shortcodes.php:77, includes/views/view-userlisting.php:91, ../profile-builder-2.0/features/content-restriction/content-restriction.php:159, ../profile-builder-2.0/modules/class-mustache-templates/class-mustache-templates.php:390, ../pb-add-on-labels-edit/assets/lib/wck-api/wordpress-creation-kit.php:402, ../profile-builder-2.0/assets/lib/wck-api/wordpress-creation-kit.php:394
|
| 4441 |
msgid "Save Changes"
|
| 4442 |
msgstr ""
|
| 4443 |
|
| 4521 |
msgid "I allow the website to collect and store the data I submit through this form."
|
| 4522 |
msgstr ""
|
| 4523 |
|
| 4524 |
+
#: ../profile-builder-2.0/features/functions.php:581
|
| 4525 |
msgid "Strength indicator"
|
| 4526 |
msgstr ""
|
| 4527 |
|
| 4528 |
+
#: ../profile-builder-2.0/features/functions.php:607, ../profile-builder-2.0/features/functions.php:631
|
| 4529 |
msgid "Very Weak"
|
| 4530 |
msgstr ""
|
| 4531 |
|
| 4532 |
+
#: ../profile-builder-2.0/features/functions.php:621
|
| 4533 |
msgid "Minimum length of %d characters."
|
| 4534 |
msgstr ""
|
| 4535 |
|
| 4536 |
+
#: ../profile-builder-2.0/features/functions.php:632
|
| 4537 |
msgid "The password must have a minimum strength of %s."
|
| 4538 |
msgstr ""
|
| 4539 |
|
| 4540 |
+
#: ../profile-builder-2.0/features/functions.php:709
|
| 4541 |
msgid "This field is required"
|
| 4542 |
msgstr ""
|
| 4543 |
|
| 4544 |
+
#: ../profile-builder-2.0/features/functions.php:747, ../profile-builder-2.0/front-end/default-fields/recaptcha/recaptcha.php:461, ../profile-builder-2.0/front-end/default-fields/recaptcha/recaptcha.php:470, ../profile-builder-2.0/front-end/default-fields/recaptcha/recaptcha.php:523, ../profile-builder-2.0/front-end/default-fields/recaptcha/recaptcha.php:568
|
| 4545 |
msgid "Please enter a (valid) reCAPTCHA value"
|
| 4546 |
msgstr ""
|
| 4547 |
|
| 4548 |
+
#: ../profile-builder-2.0/features/functions.php:754
|
| 4549 |
msgid "Incorrect phone number"
|
| 4550 |
msgstr ""
|
| 4551 |
|
| 4552 |
+
#: ../profile-builder-2.0/features/functions.php:794, ../pb-add-on-labels-edit/assets/lib/wck-api/wordpress-creation-kit.php:444, ../profile-builder-2.0/assets/lib/wck-api/wordpress-creation-kit.php:436
|
| 4553 |
msgid "Content"
|
| 4554 |
msgstr ""
|
| 4555 |
|
| 4556 |
+
#: ../profile-builder-2.0/features/functions.php:961
|
| 4557 |
msgid "<br><br>Also, you will be able to visit your site at "
|
| 4558 |
msgstr ""
|
| 4559 |
|
| 4560 |
+
#: ../profile-builder-2.0/features/functions.php:974
|
| 4561 |
msgid "<br><br>You can visit your site at "
|
| 4562 |
msgstr ""
|
| 4563 |
|
| 4564 |
+
#: ../profile-builder-2.0/features/functions.php:1060
|
| 4565 |
msgid "You will soon be redirected automatically. If you see this page for more than %1$d seconds, please click %2$s.%3$s"
|
| 4566 |
msgstr ""
|
| 4567 |
|
| 4568 |
+
#: ../profile-builder-2.0/features/functions.php:1185
|
| 4569 |
msgid "No feed available,please visit our <a href=\"%s\">homepage</a>!"
|
| 4570 |
msgstr ""
|
| 4571 |
|
| 4572 |
+
#: ../profile-builder-2.0/features/functions.php:1220
|
| 4573 |
msgid "You are not currently logged in."
|
| 4574 |
msgstr ""
|
| 4575 |
|
| 4637 |
msgid "Send these credentials via email."
|
| 4638 |
msgstr ""
|
| 4639 |
|
| 4640 |
+
#: ../profile-builder-2.0/front-end/class-formbuilder.php:682
|
| 4641 |
msgid "User to edit:"
|
| 4642 |
msgstr ""
|
| 4643 |
|
| 4644 |
+
#: ../profile-builder-2.0/front-end/class-formbuilder.php:684
|
| 4645 |
msgid "Select User"
|
| 4646 |
msgstr ""
|
| 4647 |
|
| 4648 |
+
#: ../profile-builder-2.0/front-end/class-formbuilder.php:698
|
| 4649 |
msgid "There are no other users to edit"
|
| 4650 |
msgstr ""
|
| 4651 |
|
| 4652 |
+
#: ../profile-builder-2.0/front-end/class-formbuilder.php:716
|
| 4653 |
msgid "Something went wrong. Please try again!"
|
| 4654 |
msgstr ""
|
| 4655 |
|
| 4865 |
msgid "Inactive"
|
| 4866 |
msgstr ""
|
| 4867 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4868 |
#: includes/fields/restricted-words.php:24, includes/forms/restricted-email-domains.php:19, includes/forms/restricted-email-domains.php:24
|
| 4869 |
msgid "$validation_message"
|
| 4870 |
msgstr ""
|
| 4871 |
|
| 4872 |
+
#: includes/fields/send-credentials-text.php:12
|
| 4873 |
+
msgid "$text"
|
| 4874 |
+
msgstr ""
|
| 4875 |
+
|
| 4876 |
+
#: includes/fields/unique-display-name.php:19
|
| 4877 |
+
msgid "This display name is already in use. Please choose another one."
|
| 4878 |
+
msgstr ""
|
| 4879 |
+
|
| 4880 |
#: includes/shortcodes/resend-activation.php:5
|
| 4881 |
msgid "Resend activation email"
|
| 4882 |
msgstr ""
|
| 4883 |
|
| 4884 |
+
#: includes/views/view-fields.php:14
|
| 4885 |
+
msgid "Automatically generate password for users"
|
| 4886 |
msgstr ""
|
| 4887 |
|
| 4888 |
+
#: includes/views/view-fields.php:23
|
| 4889 |
+
msgid "By checking this option, the password will be automatically generated and emailed to the user."
|
| 4890 |
msgstr ""
|
| 4891 |
|
| 4892 |
+
#: includes/views/view-fields.php:30
|
| 4893 |
+
msgid "Modify `Send Credentials` checkbox"
|
| 4894 |
msgstr ""
|
| 4895 |
|
| 4896 |
+
#: includes/views/view-fields.php:34
|
| 4897 |
+
msgid "Hidden and checked"
|
| 4898 |
msgstr ""
|
| 4899 |
|
| 4900 |
+
#: includes/views/view-fields.php:39
|
| 4901 |
+
msgid "Field text:"
|
| 4902 |
msgstr ""
|
| 4903 |
|
| 4904 |
+
#: includes/views/view-fields.php:49
|
| 4905 |
+
msgid "By default, the user needs to choose if he wants to receive a registration email."
|
| 4906 |
msgstr ""
|
| 4907 |
|
| 4908 |
+
#: includes/views/view-fields.php:52
|
| 4909 |
+
msgid "By checking the <strong>Hidden and checked</strong> option, the field won't be shown and the message will always be sent to the user."
|
| 4910 |
msgstr ""
|
| 4911 |
|
| 4912 |
+
#: includes/views/view-fields.php:55
|
| 4913 |
+
msgid "If you choose to show the field, you can modify the default text by entering something in the field from above."
|
| 4914 |
msgstr ""
|
| 4915 |
|
| 4916 |
+
#: includes/views/view-fields.php:67
|
| 4917 |
msgid "Hide Repeater Fields from the back-end profile page"
|
| 4918 |
msgstr ""
|
| 4919 |
|
| 4920 |
+
#: includes/views/view-fields.php:76
|
| 4921 |
msgid "Repeater Fields from Profile Builder do not work on the back-end user profile page, they are just displayed. If you want to remove them completely, you can use this option."
|
| 4922 |
msgstr ""
|
| 4923 |
|
| 4924 |
+
#: includes/views/view-fields.php:79
|
| 4925 |
msgid "You will still be able to use them from a front-end edit profile form."
|
| 4926 |
msgstr ""
|
| 4927 |
|
| 4928 |
+
#: includes/views/view-fields.php:87
|
| 4929 |
+
msgid "Unique `Display Name` for users"
|
| 4930 |
+
msgstr ""
|
| 4931 |
+
|
| 4932 |
+
#: includes/views/view-fields.php:96
|
| 4933 |
+
msgid "By checking this option, users will not be able to choose a <strong>Display Name</strong> that is already used by another account."
|
| 4934 |
+
msgstr ""
|
| 4935 |
+
|
| 4936 |
+
#: includes/views/view-fields.php:103
|
| 4937 |
msgid "Always capitalize `First Name` and `Last Name` default fields"
|
| 4938 |
msgstr ""
|
| 4939 |
|
| 4940 |
+
#: includes/views/view-fields.php:112
|
| 4941 |
msgid "If you have these fields in your forms, they will be always saved with the first letter as uppercase."
|
| 4942 |
msgstr ""
|
| 4943 |
|
| 4944 |
+
#: includes/views/view-fields.php:115
|
| 4945 |
msgid "eg.: <strong>Jhon Doe</strong> instead of <strong>jhon doe</strong>"
|
| 4946 |
msgstr ""
|
| 4947 |
|
| 4948 |
+
#: includes/views/view-fields.php:123
|
| 4949 |
+
msgid "Datepicker starts on Monday"
|
| 4950 |
+
msgstr ""
|
| 4951 |
+
|
| 4952 |
+
#: includes/views/view-fields.php:132
|
| 4953 |
+
msgid "Will make all Datepickers use Monday as the first day of the week."
|
| 4954 |
+
msgstr ""
|
| 4955 |
+
|
| 4956 |
+
#: includes/views/view-fields.php:140
|
| 4957 |
msgid "Ban certain words from being used in fields"
|
| 4958 |
msgstr ""
|
| 4959 |
|
| 4960 |
+
#: includes/views/view-fields.php:147, includes/views/view-forms.php:21
|
| 4961 |
msgid "On"
|
| 4962 |
msgstr ""
|
| 4963 |
|
| 4964 |
+
#: includes/views/view-fields.php:155
|
| 4965 |
msgid "Affected fields:"
|
| 4966 |
msgstr ""
|
| 4967 |
|
| 4968 |
+
#: includes/views/view-fields.php:179
|
| 4969 |
msgid "Banned words:"
|
| 4970 |
msgstr ""
|
| 4971 |
|
| 4972 |
+
#: includes/views/view-fields.php:198, includes/views/view-forms.php:66
|
| 4973 |
msgid "Error message:"
|
| 4974 |
msgstr ""
|
| 4975 |
|
| 4976 |
+
#: includes/views/view-fields.php:209
|
| 4977 |
msgid "Allows you to define some words which users cannot use in their Username, First Name or Last Name when registering."
|
| 4978 |
msgstr ""
|
| 4979 |
|
| 5029 |
msgid "When saving the back-end user profile, Profile Builder fields will not be validated anymore. eg.: bypass required attribute"
|
| 5030 |
msgstr ""
|
| 5031 |
|
| 5032 |
+
#: includes/views/view-forms.php:162
|
| 5033 |
+
msgid "Always show edit other users dropdown"
|
| 5034 |
+
msgstr ""
|
| 5035 |
+
|
| 5036 |
+
#: includes/views/view-forms.php:171
|
| 5037 |
+
msgid "For perfomance reasons, we disable the select if you have more than 5000 users on your website. This option lets you enable it again."
|
| 5038 |
+
msgstr ""
|
| 5039 |
+
|
| 5040 |
+
#: includes/views/view-forms.php:179
|
| 5041 |
msgid "Consider `Anyone can Register` WordPress option"
|
| 5042 |
msgstr ""
|
| 5043 |
|
| 5044 |
+
#: includes/views/view-forms.php:189
|
| 5045 |
msgid "setting"
|
| 5046 |
msgstr ""
|
| 5047 |
|
| 5048 |
+
#: includes/views/view-forms.php:191
|
| 5049 |
msgid "By default, Profile Builder ignores this %1$s. If you check this option, our registration form will consider it."
|
| 5050 |
msgstr ""
|
| 5051 |
|
| 5052 |
+
#: includes/views/view-forms.php:199
|
| 5053 |
msgid "Modify default Redirect Delay timer"
|
| 5054 |
msgstr ""
|
| 5055 |
|
| 5056 |
+
#: includes/views/view-forms.php:206
|
| 5057 |
msgid "This allows you to change the amount of seconds it takes for the <strong>`After Registration`</strong> redirect to happen."
|
| 5058 |
msgstr ""
|
| 5059 |
|
| 5060 |
+
#: includes/views/view-forms.php:209
|
| 5061 |
msgid "The default is 3 seconds. Leave empty if you do not want to change it."
|
| 5062 |
msgstr ""
|
| 5063 |
|
| 5064 |
+
#: includes/views/view-forms.php:217
|
| 5065 |
msgid "Save Admin Approval status in usermeta"
|
| 5066 |
msgstr ""
|
| 5067 |
|
| 5068 |
+
#: includes/views/view-forms.php:226
|
| 5069 |
msgid "By default, the Admin Approval status is saved as a custom taxonomy that is attached to the user."
|
| 5070 |
msgstr ""
|
| 5071 |
|
| 5072 |
+
#: includes/views/view-forms.php:229
|
| 5073 |
msgid "If you check this option, the status will also be saved in the `*_usermeta` table under the <strong>wppb_approval_status</strong> meta name."
|
| 5074 |
msgstr ""
|
| 5075 |
|
| 5076 |
+
#: includes/views/view-forms.php:238
|
| 5077 |
msgid "Redirect `/author` page if user is not approved"
|
| 5078 |
msgstr ""
|
| 5079 |
|
| 5080 |
+
#: includes/views/view-forms.php:247
|
| 5081 |
+
msgid "By default, users placed in Admin Approval will not be able to login, but the Author pages will be accessible."
|
| 5082 |
msgstr ""
|
| 5083 |
|
| 5084 |
+
#: includes/views/view-forms.php:250
|
| 5085 |
msgid "Using this option you can redirect these pages, sending users who try to toolboxess them to your home page."
|
| 5086 |
msgstr ""
|
| 5087 |
|
| 5088 |
+
#: includes/views/view-forms.php:258
|
| 5089 |
msgid "Save `Last Login` date in usermeta"
|
| 5090 |
msgstr ""
|
| 5091 |
|
| 5092 |
+
#: includes/views/view-forms.php:267
|
| 5093 |
msgid "By checking this option, each time a user logins, the date and time will be saved in the database."
|
| 5094 |
msgstr ""
|
| 5095 |
|
| 5096 |
+
#: includes/views/view-forms.php:270
|
| 5097 |
msgid "The meta name for the field will be <strong>last_login_date</strong>."
|
| 5098 |
msgstr ""
|
| 5099 |
|
| 5100 |
+
#: includes/views/view-forms.php:273, includes/views/view-forms.php:295
|
| 5101 |
msgid "You can <a href=\"https://www.cozmoslabs.com/docs/profile-builder-2/manage-user-fields/#Manage_existing_custom_fields_with_Profile_Builder\" target=\"_blank\">create a field with this meta name</a> in Profile Builder to display it in the Userlisting or Edit Profile forms."
|
| 5102 |
msgstr ""
|
| 5103 |
|
| 5104 |
+
#: includes/views/view-forms.php:280
|
| 5105 |
msgid "Save `Last Profile Update` date in usermeta"
|
| 5106 |
msgstr ""
|
| 5107 |
|
| 5108 |
+
#: includes/views/view-forms.php:289
|
| 5109 |
msgid "By checking this option, each time a modifies his profile the date and time will be saved in the database."
|
| 5110 |
msgstr ""
|
| 5111 |
|
| 5112 |
+
#: includes/views/view-forms.php:292
|
| 5113 |
msgid "The meta name for the field will be <strong>last_profile_update_date</strong>."
|
| 5114 |
msgstr ""
|
| 5115 |
|
