| @@ -53,20 +53,20 @@ | ||
| 53 | 53 | |
| 54 | 54 | class Wordpress_Creation_Kit_PB{ |
| 55 | 55 | |
| 56 | 56 | private $defaults = array( |
| 57 | - 'metabox_id' => '', | |
| 58 | - 'metabox_title' => 'Meta Box', | |
| 59 | - 'post_type' => 'post', | |
| 60 | - 'meta_name' => '', | |
| 61 | - 'meta_array' => array(), | |
| 62 | - 'page_template' => '', | |
| 63 | - 'post_id' => '', | |
| 64 | - 'single' => false, | |
| 57 | + 'metabox_id' => '', | |
| 58 | + 'metabox_title' => 'Meta Box', | |
| 59 | + 'post_type' => 'post', | |
| 60 | + 'meta_name' => '', | |
| 61 | + 'meta_array' => array(), | |
| 62 | + 'page_template' => '', | |
| 63 | + 'post_id' => '', | |
| 64 | + 'single' => false, | |
| 65 | 65 | 'unserialize_fields' => false, |
| 66 | - 'sortable' => true, | |
| 67 | - 'context' => 'post_meta', | |
| 68 | - 'mb_context' => 'normal' | |
| 66 | + 'sortable' => true, | |
| 67 | + 'context' => 'post_meta', | |
| 68 | + 'mb_context' => 'normal' | |
| 69 | 69 | ); |
| 70 | 70 | private $args; |
| 71 | 71 | |
| 72 | 72 | |
| @@ -95,8 +95,9 @@ | ||
| 95 | 95 | add_action("wp_ajax_wck_remove_meta".$this->args['meta_name'], array( &$this, 'wck_remove_meta') ); |
| 96 | 96 | add_action("wp_ajax_wck_reorder_meta".$this->args['meta_name'], array( &$this, 'wck_reorder_meta') ); |
| 97 | 97 | |
| 98 | 98 | add_action('add_meta_boxes', array( &$this, 'wck_add_metabox') ); |
| 99 | + add_action('wck_add_meta_boxes', array( &$this, 'wck_add_metabox') ); | |
| 99 | 100 | |
| 100 | 101 | /* For single forms we save them the old fashion way */ |
| 101 | 102 | if( $this->args['single'] ){ |
| 102 | 103 | add_action('save_post', array($this, 'wck_save_single_metabox'), 10, 2); |
| @@ -117,11 +118,19 @@ | ||
| 117 | 118 | global $pb_wck_pages_hooknames; |
| 118 | 119 | |
| 119 | 120 | if( $this->args['context'] == 'post_meta' ){ |
| 120 | 121 | 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 | + | |
| 123 | + $priority = 'high'; | |
| 124 | + | |
| 125 | + if( !empty( $this->args['meta_name'] ) && in_array( $this->args['meta_name'], array( 'wppb_ul_settings_query', 'wppb_ul_csv_download_settings', 'wppb_rf_progress_bar_settings', 'wppb_epf_progress_bar_settings' ) ) ){ | |
| 126 | + $priority = 'low'; | |
| 127 | + } | |
| 128 | + | |
| 129 | + add_meta_box($this->args['metabox_id'], $this->args['metabox_title'], array( &$this, 'wck_content' ), $this->args['post_type'], $this->args['mb_context'], $priority, array( 'meta_name' => $this->args['meta_name'], 'meta_array' => $this->args['meta_array']) ); | |
| 122 | 130 | /* add class to meta box */ |
| 123 | 131 | add_filter( "postbox_classes_".$this->args['post_type']."_".$this->args['metabox_id'], array( &$this, 'wck_add_metabox_classes' ) ); |
| 132 | + | |
| 124 | 133 | } |
| 125 | 134 | else{ |
| 126 | 135 | if( !empty( $_GET['post'] ) ) |
| 127 | 136 | $post_id = filter_var( $_GET['post'], FILTER_SANITIZE_NUMBER_INT ); |
| @@ -185,9 +194,9 @@ | ||
| 185 | 194 | $post_id = ''; |
| 186 | 195 | |
| 187 | 196 | |
| 188 | 197 | |
| 189 | -// //output the add form or themes metabox content | |
| 198 | + // output the add form or themes metabox content | |
| 190 | 199 | if ($metabox['id'] == 'wppb-ul-themes-settings' ) { |
| 191 | 200 | echo $metabox['args']['meta_array']; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 192 | 201 | } |
| 193 | 202 | else self::create_add_form($metabox['args']['meta_array'], $metabox['args']['meta_name'], $post); |
| @@ -233,14 +242,19 @@ | ||
| 233 | 242 | $single_prefix = $this->args['meta_name'].'_'; |
| 234 | 243 | else |
| 235 | 244 | $single_prefix = ''; |
| 236 | 245 | |
| 237 | - $element .= '<label for="'. $single_prefix . esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" class="field-label">'. apply_filters( "wck_label_{$meta}_". Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ), ucfirst($details['title']) ) .':'; | |
| 246 | + $context_slug = !empty($context) ? $context . '_' : ''; | |
| 247 | + $label_for = esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ); | |
| 248 | + if ( $details['type'] === 'checkbox' && !empty( $details['options'] ) && count( $details['options'] ) == 1 ) { | |
| 249 | + $label_for = $label_for . '_yes'; | |
| 250 | + } | |
| 251 | + | |
| 252 | + $element .= '<label class="cozmoslabs-form-field-label" for="'. $label_for .'">'. apply_filters( "wck_label_{$meta}_". Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ), ucfirst($details['title']) ); | |
| 238 | 253 | if( !empty( $details['required'] ) && $details['required'] ) |
| 239 | 254 | $element .= '<span class="required">*</span>'; |
| 240 | 255 | $element .= '</label>'; |
| 241 | 256 | |
| 242 | - $element .= '<div class="mb-right-column">'; | |
| 243 | 257 | |
| 244 | 258 | // Allow for appeding custom markup before the element. |
| 245 | 259 | $element .= apply_filters( 'wck_output_form_field_before_customtype_' . $details['type'], '', $value, $details, $single_prefix ); |
| 246 | 260 | |
| @@ -271,14 +285,12 @@ | ||
| 271 | 285 | |
| 272 | 286 | // Allow for appeding custom markup after the element. |
| 273 | 287 | $element .= apply_filters( 'wck_output_form_field_after_customtype_' . $details['type'], '', $value, $details, $single_prefix ); |
| 274 | 288 | |
| 275 | - if( !empty( $details['description'] ) ){ | |
| 276 | - $element .= '<p class="description">'. $details['description'].'</p>'; | |
| 277 | - } | |
| 289 | + if( !empty( $details['description'] ) ){ | |
| 290 | + $element .= '<p class="cozmoslabs-description cozmoslabs-description-space-left">'. $details['description'].'</p>'; | |
| 291 | + } | |
| 278 | 292 | |
| 279 | - $element .= '</div><!-- .mb-right-column -->'; | |
| 280 | - | |
| 281 | 293 | $element = apply_filters( "wck_output_form_field_{$meta}_" . Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ), $element ); |
| 282 | 294 | |
| 283 | 295 | return $element; |
| 284 | 296 | |
| @@ -330,10 +342,20 @@ | ||
| 330 | 342 | $value = null; |
| 331 | 343 | if (isset($results[0][Wordpress_Creation_Kit_PB::wck_generate_slug($details['title'], $details )])) |
| 332 | 344 | $value = $results[0][Wordpress_Creation_Kit_PB::wck_generate_slug($details['title'], $details )]; |
| 333 | 345 | } |
| 346 | + | |
| 347 | + $extra_class = ''; | |
| 348 | + if ( $details['type'] === 'checkbox' && !empty( $details['options'] ) ) { | |
| 349 | + $number_of_options = count( $details['options'] ); | |
| 350 | + | |
| 351 | + if ( $number_of_options == 1 ) | |
| 352 | + $extra_class .= ' cozmoslabs-toggle-switch'; | |
| 353 | + elseif ( $number_of_options > 1 ) | |
| 354 | + $extra_class .= ' cozmoslabs-checkbox-list-wrapper'; | |
| 355 | + } | |
| 334 | 356 | ?> |
| 335 | - <li class="row-<?php echo esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) ?>"> | |
| 357 | + <li class="row-<?php echo esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) ?> cozmoslabs-form-field-wrapper <?php echo esc_html( apply_filters( 'wck_form_field_wrapper_extra_classes', $extra_class ) ) ?>"> | |
| 336 | 358 | <?php echo self::wck_output_form_field( $meta, $details, $value, $context, $post_id ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 337 | 359 | </li> |
| 338 | 360 | <?php |
| 339 | 361 | |
| @@ -343,9 +365,9 @@ | ||
| 343 | 365 | } |
| 344 | 366 | } |
| 345 | 367 | ?> |
| 346 | 368 | <?php if( ! $this->args['single'] || $this->args['context'] == 'option' ){ ?> |
| 347 | - <li style="overflow:visible;" class="add-entry-button"> | |
| 369 | + <li class="add-entry-button cozmoslabs-button-group"> | |
| 348 | 370 | <a href="javascript:void(0)" class="button-primary" onclick="addMeta('<?php echo esc_js($meta); ?>', '<?php echo esc_js( $post_id ); ?>', '<?php echo esc_js($nonce); ?>')"><span><?php if( $this->args['single'] ) echo esc_html( apply_filters( 'wck_add_entry_button', __( 'Save', 'profile-builder' ), $meta, $post ) ); else echo esc_html( apply_filters( 'wck_add_entry_button', __( 'Add Entry', 'profile-builder' ), $meta, $post ) ); ?></span></a> |
| 349 | 371 | </li> |
| 350 | 372 | <?php }elseif($this->args['single'] && $this->args['context'] == 'post_meta' ){ ?> |
| 351 | 373 | <input type="hidden" name="_wckmetaname_<?php echo esc_attr( $meta ) ?>#wck" value="true"> |
| @@ -392,13 +414,23 @@ | ||
| 392 | 414 | $value = $results[$element_id][Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details )]; |
| 393 | 415 | else |
| 394 | 416 | $value = ''; |
| 395 | 417 | |
| 418 | + $extra_class = ''; | |
| 419 | + if ( $details['type'] === 'checkbox' && !empty( $details['options'] ) ) { | |
| 420 | + $number_of_options = count( $details['options'] ); | |
| 421 | + | |
| 422 | + if ( $number_of_options == 1 ) | |
| 423 | + $extra_class = 'cozmoslabs-toggle-switch'; | |
| 424 | + elseif ( $number_of_options > 1 ) | |
| 425 | + $extra_class = 'cozmoslabs-checkbox-list-wrapper'; | |
| 426 | + } | |
| 427 | + | |
| 396 | 428 | $form = apply_filters( "wck_before_update_form_{$meta}_element_{$i}", $form, $element_id, $value ); |
| 397 | 429 | |
| 398 | - $form .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'">'; | |
| 430 | + $form .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .' cozmoslabs-form-field-wrapper '. apply_filters( 'wck_form_field_wrapper_extra_classes', $extra_class) .'">'; | |
| 399 | 431 | |
| 400 | - $form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form', $id ); | |
| 432 | + $form .= self::wck_output_form_field( $meta, $details, $value, 'edit_form', $id ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 401 | 433 | |
| 402 | 434 | $form .= '</li>'; |
| 403 | 435 | |
| 404 | 436 | $form = apply_filters( "wck_after_update_form_{$meta}_element_{$i}", $form, $element_id, $value ); |
| @@ -405,11 +437,11 @@ | ||
| 405 | 437 | |
| 406 | 438 | $i++; |
| 407 | 439 | } |
| 408 | 440 | } |
| 409 | - $form .= '<li style="overflow:visible;">'; | |
| 441 | + $form .= '<li class="cozmoslabs-button-group">'; | |
| 410 | 442 | $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>'; |
| 411 | - $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>'; | |
| 443 | + $form .= '<a href="javascript:void(0)" class="button 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>'; | |
| 412 | 444 | $form .= '</li>'; |
| 413 | 445 | |
| 414 | 446 | $form .= '</ul>'; |
| 415 | 447 | } |
| @@ -549,9 +581,9 @@ | ||
| 549 | 581 | $list .= "<script>wck_set_to_widest( 'strong', '". $meta ."' );</script>"; |
| 550 | 582 | } |
| 551 | 583 | |
| 552 | 584 | $list .= '</td>'; |
| 553 | - $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','profile-builder'), $meta ) .'</a></td>'; | |
| 585 | + $list .= '<td style="text-align:center;vertical-align:middle;" class="wck-edit"><a href="javascript:void(0)" class="button 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','profile-builder'), $meta ) .'</a></td>'; | |
| 554 | 586 | $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', 'profile-builder' ), $meta) .'</a></td>'; |
| 555 | 587 | $list .= apply_filters( 'wck_add_content_after_columns', '', $list, $meta ); |
| 556 | 588 | |
| 557 | 589 | $list .= "</tr> \r\n"; |
| @@ -572,9 +604,9 @@ | ||
| 572 | 604 | foreach($optgroup['options'] as $group_option ){ |
| 573 | 605 | |
| 574 | 606 | if( !is_array( $group_option ) ) |
| 575 | 607 | $select_options[] = $group_option; |
| 576 | - | |
| 608 | + | |
| 577 | 609 | } |
| 578 | 610 | } |
| 579 | 611 | |
| 580 | 612 | $field_details['options'] = $select_options; |
| @@ -744,9 +776,9 @@ | ||
| 744 | 776 | |
| 745 | 777 | if( !empty( $values ) ){ |
| 746 | 778 | foreach( $values as $key => $value ){ |
| 747 | 779 | if( array_key_exists( $key, $required_fields ) && apply_filters( "wck_required_test_{$meta}_{$key}", empty( $value ), $value, $id ) ){ |
| 748 | - $required_message .= apply_filters( "wck_required_message_{$meta}_{$key}", __( "Please enter a value for the required field ", "profile-builder" ) . "$required_fields[$key] \n", $value ); | |
| 780 | + $required_message .= apply_filters( "wck_required_message_{$meta}_{$key}", __( "Please enter a value for the required field ", "profile-builder" ) . "<strong>$required_fields[$key]</strong><br>", $value ); | |
| 749 | 781 | $required_fields_with_errors[] = $key; |
| 750 | 782 | } |
| 751 | 783 | } |
| 752 | 784 | } |
| @@ -801,18 +833,21 @@ | ||
| 801 | 833 | |
| 802 | 834 | /* ajax add a reccord to the meta */ |
| 803 | 835 | function wck_add_meta(){ |
| 804 | 836 | check_ajax_referer( "wck-add-meta" ); |
| 837 | + | |
| 805 | 838 | if( !empty( $_POST['meta'] ) ) |
| 806 | 839 | $meta = sanitize_text_field( $_POST['meta'] ); |
| 807 | 840 | else |
| 808 | 841 | $meta = ''; |
| 842 | + | |
| 809 | 843 | if( !empty( $_POST['id'] ) ) |
| 810 | 844 | $id = absint($_POST['id']); |
| 811 | 845 | else |
| 812 | 846 | $id = ''; |
| 847 | + | |
| 813 | 848 | if( !empty( $_POST['values'] ) && is_array( $_POST['values'] ) ) |
| 814 | - $values = array_map( 'wppb_sanitize_value', $_POST['values'] );//phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 849 | + $values = $this->wck_sanitize_associative_array( $_POST['values'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we sanitize with our own function | |
| 815 | 850 | else |
| 816 | 851 | $values = array(); |
| 817 | 852 | |
| 818 | 853 | // Security checks |
| @@ -824,8 +859,13 @@ | ||
| 824 | 859 | $values = apply_filters( "wck_add_meta_filter_values_{$meta}", $values ); |
| 825 | 860 | |
| 826 | 861 | /* check required fields */ |
| 827 | 862 | $errors = self::wck_test_required( $this->args['meta_array'], $meta, $values, $id ); |
| 863 | + | |
| 864 | + if ( empty( $errors ) ) { | |
| 865 | + $errors = self::wck_maybe_add_extra_errors( $this->args['meta_array'], $meta, $values, $id ); | |
| 866 | + } | |
| 867 | + | |
| 828 | 868 | if( $errors != '' ){ |
| 829 | 869 | header( 'Content-type: application/json' ); |
| 830 | 870 | die( json_encode( $errors ) ); |
| 831 | 871 | } |
| @@ -859,17 +899,17 @@ | ||
| 859 | 899 | else if ( $this->args['context'] == 'option' ) |
| 860 | 900 | update_option( apply_filters( 'wck_option_meta' , $meta, $results ), wp_unslash( $results ) ); |
| 861 | 901 | |
| 862 | 902 | /* if unserialize_fields is true add for each entry separate post meta for every element of the form */ |
| 863 | - if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 903 | + // if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 864 | 904 | |
| 865 | - $meta_suffix = count( $results ); | |
| 866 | - if( !empty( $values ) ){ | |
| 867 | - foreach( $values as $name => $value ){ | |
| 868 | - update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 869 | - } | |
| 870 | - } | |
| 871 | - } | |
| 905 | + // $meta_suffix = count( $results ); | |
| 906 | + // if( !empty( $values ) ){ | |
| 907 | + // foreach( $values as $name => $value ){ | |
| 908 | + // update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 909 | + // } | |
| 910 | + // } | |
| 911 | + // } | |
| 872 | 912 | |
| 873 | 913 | $entry_list = $this->wck_refresh_list( $meta, $id ); |
| 874 | 914 | $add_form = $this->wck_add_form( $meta, $id ); |
| 875 | 915 | |
| @@ -880,22 +920,26 @@ | ||
| 880 | 920 | |
| 881 | 921 | /* ajax update a reccord in the meta */ |
| 882 | 922 | function wck_update_meta(){ |
| 883 | 923 | check_ajax_referer( "wck-update-entry" ); |
| 924 | + | |
| 884 | 925 | if( !empty( $_POST['meta'] ) ) |
| 885 | 926 | $meta = sanitize_text_field( $_POST['meta'] ); |
| 886 | 927 | else |
| 887 | 928 | $meta = ''; |
| 929 | + | |
| 888 | 930 | if( !empty( $_POST['id'] ) ) |
| 889 | 931 | $id = absint($_POST['id']); |
| 890 | 932 | else |
| 891 | 933 | $id = ''; |
| 934 | + | |
| 892 | 935 | if( isset( $_POST['element_id'] ) ) |
| 893 | 936 | $element_id = absint( $_POST['element_id'] ); |
| 894 | 937 | else |
| 895 | 938 | $element_id = 0; |
| 896 | - if( !empty( $_POST['values'] ) && is_array( $_POST['values']) ) | |
| 897 | - $values = array_map( 'wppb_sanitize_value', $_POST['values'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 939 | + | |
| 940 | + if( !empty( $_POST['values'] ) && is_array( $_POST['values'] ) ) | |
| 941 | + $values = $this->wck_sanitize_associative_array( $_POST['values'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we sanitize with our own function | |
| 898 | 942 | else |
| 899 | 943 | $values = array(); |
| 900 | 944 | |
| 901 | 945 | // Security checks |
| @@ -933,17 +977,17 @@ | ||
| 933 | 977 | else if ( $this->args['context'] == 'option' ) |
| 934 | 978 | update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) ); |
| 935 | 979 | |
| 936 | 980 | /* if unserialize_fields is true update the coresponding post metas for every element of the form */ |
| 937 | - if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 981 | + // if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 938 | 982 | |
| 939 | - $meta_suffix = $element_id + 1; | |
| 940 | - if( !empty( $values ) ){ | |
| 941 | - foreach( $values as $name => $value ){ | |
| 942 | - update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 943 | - } | |
| 944 | - } | |
| 945 | - } | |
| 983 | + // $meta_suffix = $element_id + 1; | |
| 984 | + // if( !empty( $values ) ){ | |
| 985 | + // foreach( $values as $name => $value ){ | |
| 986 | + // update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 987 | + // } | |
| 988 | + // } | |
| 989 | + // } | |
| 946 | 990 | |
| 947 | 991 | $entry_content = $this->wck_refresh_entry( $meta, $id, $element_id ); |
| 948 | 992 | |
| 949 | 993 | header( 'Content-type: application/json' ); |
| @@ -952,8 +996,12 @@ | ||
| 952 | 996 | |
| 953 | 997 | /* ajax to refresh the meta content | or used in other function to return the */ |
| 954 | 998 | /* this is used in Repeater Fields as an ajax action so we have to keep it dual purpose */ |
| 955 | 999 | function wck_refresh_list( $meta = '', $id = '' ){ |
| 1000 | + | |
| 1001 | + if( !current_user_can( 'manage_options' ) ) | |
| 1002 | + die(); | |
| 1003 | + | |
| 956 | 1004 | if( isset( $_POST['meta'] ) ) |
| 957 | 1005 | $meta = sanitize_text_field( $_POST['meta'] ); |
| 958 | 1006 | |
| 959 | 1007 | if( isset( $_POST['id'] ) ) |
| @@ -1005,10 +1053,14 @@ | ||
| 1005 | 1053 | |
| 1006 | 1054 | /* ajax to show the update form */ |
| 1007 | 1055 | function wck_show_update_form(){ |
| 1008 | 1056 | check_ajax_referer( "wck-edit-entry" ); |
| 1009 | - $meta = isset( $_POST['meta'] ) ? sanitize_text_field( $_POST['meta'] ) : ''; | |
| 1010 | - $id = isset( $_POST['id'] ) ? absint( $_POST['id'] ) : ''; | |
| 1057 | + | |
| 1058 | + if( !current_user_can( 'manage_options' ) ) | |
| 1059 | + die(); | |
| 1060 | + | |
| 1061 | + $meta = isset( $_POST['meta'] ) ? sanitize_text_field( $_POST['meta'] ) : ''; | |
| 1062 | + $id = isset( $_POST['id'] ) ? absint( $_POST['id'] ) : ''; | |
| 1011 | 1063 | $element_id = isset( $_POST['element_id'] ) ? absint( $_POST['element_id'] ) : ''; |
| 1012 | 1064 | |
| 1013 | 1065 | do_action( "wck_before_adding_form_{$meta}", $id, $element_id ); |
| 1014 | 1066 | |
| @@ -1067,33 +1119,33 @@ | ||
| 1067 | 1119 | |
| 1068 | 1120 | |
| 1069 | 1121 | /* TODO: optimize so that it updates from the deleted element forward */ |
| 1070 | 1122 | /* if unserialize_fields is true delete the coresponding post metas */ |
| 1071 | - if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 1123 | + // if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 1072 | 1124 | |
| 1073 | - $meta_suffix = 1; | |
| 1125 | + // $meta_suffix = 1; | |
| 1074 | 1126 | |
| 1075 | - if( !empty( $results ) ){ | |
| 1076 | - foreach( $results as $result ){ | |
| 1077 | - foreach ( $result as $name => $value){ | |
| 1078 | - update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 1079 | - } | |
| 1080 | - $meta_suffix++; | |
| 1081 | - } | |
| 1082 | - } | |
| 1127 | + // if( !empty( $results ) ){ | |
| 1128 | + // foreach( $results as $result ){ | |
| 1129 | + // foreach ( $result as $name => $value){ | |
| 1130 | + // update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 1131 | + // } | |
| 1132 | + // $meta_suffix++; | |
| 1133 | + // } | |
| 1134 | + // } | |
| 1083 | 1135 | |
| 1084 | - if( count( $results ) == 0 ) | |
| 1085 | - $results = $old_results; | |
| 1136 | + // if( count( $results ) == 0 ) | |
| 1137 | + // $results = $old_results; | |
| 1086 | 1138 | |
| 1087 | - if( !empty( $results ) ){ | |
| 1088 | - foreach( $results as $result ){ | |
| 1089 | - foreach ( $result as $name => $value){ | |
| 1090 | - delete_post_meta( $id, $meta.'_'.$name.'_'.$meta_suffix ); | |
| 1091 | - } | |
| 1092 | - break; | |
| 1093 | - } | |
| 1094 | - } | |
| 1095 | - } | |
| 1139 | + // if( !empty( $results ) ){ | |
| 1140 | + // foreach( $results as $result ){ | |
| 1141 | + // foreach ( $result as $name => $value){ | |
| 1142 | + // delete_post_meta( $id, $meta.'_'.$name.'_'.$meta_suffix ); | |
| 1143 | + // } | |
| 1144 | + // break; | |
| 1145 | + // } | |
| 1146 | + // } | |
| 1147 | + // } | |
| 1096 | 1148 | |
| 1097 | 1149 | $entry_list = $this->wck_refresh_list( $meta, $id ); |
| 1098 | 1150 | $add_form = $this->wck_add_form( $meta, $id ); |
| 1099 | 1151 | |
| @@ -1150,21 +1202,21 @@ | ||
| 1150 | 1202 | update_option( apply_filters( 'wck_option_meta' , $meta, $results, $element_id ), wp_unslash( $results ) ); |
| 1151 | 1203 | |
| 1152 | 1204 | |
| 1153 | 1205 | /* if unserialize_fields is true reorder all the coresponding post metas */ |
| 1154 | - if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 1206 | + // if( $this->args['unserialize_fields'] && $this->args['context'] == 'post_meta' ){ | |
| 1155 | 1207 | |
| 1156 | - $meta_suffix = 1; | |
| 1157 | - if( !empty( $new_results ) ){ | |
| 1158 | - foreach( $new_results as $result ){ | |
| 1159 | - foreach ( $result as $name => $value){ | |
| 1160 | - update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 1161 | - } | |
| 1162 | - $meta_suffix++; | |
| 1163 | - } | |
| 1164 | - } | |
| 1208 | + // $meta_suffix = 1; | |
| 1209 | + // if( !empty( $new_results ) ){ | |
| 1210 | + // foreach( $new_results as $result ){ | |
| 1211 | + // foreach ( $result as $name => $value){ | |
| 1212 | + // update_post_meta($id, $meta.'_'.$name.'_'.$meta_suffix, $value); | |
| 1213 | + // } | |
| 1214 | + // $meta_suffix++; | |
| 1215 | + // } | |
| 1216 | + // } | |
| 1165 | 1217 | |
| 1166 | - } | |
| 1218 | + // } | |
| 1167 | 1219 | |
| 1168 | 1220 | $entry_list = $this->wck_refresh_list( $meta, $id ); |
| 1169 | 1221 | header( 'Content-type: application/json' ); |
| 1170 | 1222 | die( json_encode( array( 'entry_list' => $entry_list ) ) ); |
| @@ -1195,12 +1247,14 @@ | ||
| 1195 | 1247 | |
| 1196 | 1248 | if( !empty( $_POST ) ){ |
| 1197 | 1249 | /* for single metaboxes we save a hidden input that contains the meta_name attr as a key so we need to search for it */ |
| 1198 | 1250 | foreach( $_POST as $request_key => $request_value ){ |
| 1251 | + $request_key = sanitize_text_field( $request_key ); | |
| 1252 | + | |
| 1199 | 1253 | if( strpos( $request_key, '_wckmetaname_' ) !== false && strpos( $request_key, '#wck' ) !== false ){ |
| 1200 | 1254 | /* found it so now retrieve the meta_name from the key formatted _wckmetaname_actuaname#wck */ |
| 1201 | 1255 | $request_key = str_replace( '_wckmetaname_', '', $request_key ); |
| 1202 | - $meta_name = sanitize_text_field( str_replace( '#wck', '', $request_key ) ); | |
| 1256 | + $meta_name = str_replace( '#wck', '', $request_key ); | |
| 1203 | 1257 | /* we have it so go through only on the WCK object instance that has this meta_name */ |
| 1204 | 1258 | if( $this->args['meta_name'] == $meta_name ){ |
| 1205 | 1259 | |
| 1206 | 1260 | /* get the meta values from the $_POST and store them in an array */ |
| @@ -1207,18 +1261,23 @@ | ||
| 1207 | 1261 | $meta_values = array(); |
| 1208 | 1262 | if( !empty( $this->args['meta_array'] ) ){ |
| 1209 | 1263 | foreach ($this->args['meta_array'] as $meta_field){ |
| 1210 | 1264 | /* in the $_POST the names for the fields are prefixed with the meta_name for the single metaboxes in case there are multiple metaboxes that contain fields wit hthe same name */ |
| 1211 | - $single_field_name = $this->args['meta_name'] .'_'. Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'],$meta_field ); | |
| 1212 | - if (isset($_POST[$single_field_name])) { | |
| 1265 | + $field_slug = Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'], $meta_field ); | |
| 1266 | + $single_field_name = $this->args['meta_name'] .'_'. $field_slug; | |
| 1267 | + | |
| 1268 | + if ( isset( $_POST[$single_field_name] ) ) { | |
| 1213 | 1269 | /* checkbox needs to be stored as string not array */ |
| 1214 | - if( $meta_field['type'] == 'checkbox' ) | |
| 1215 | - $_POST[$single_field_name] = implode( ', ', $_POST[$single_field_name] );//phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 1270 | + if( $meta_field['type'] == 'checkbox' ){ | |
| 1271 | + if( is_array($_POST[$single_field_name]) ) | |
| 1272 | + $_POST[$single_field_name] = implode(', ', $this->wck_sanitize_value( $_POST[$single_field_name], $field_slug ) ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we sanitize with our own function | |
| 1273 | + else | |
| 1274 | + $_POST[$single_field_name] = $this->wck_sanitize_value( $_POST[$single_field_name], $field_slug ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we sanitize with our own function | |
| 1275 | + } | |
| 1216 | 1276 | |
| 1217 | - $meta_values[Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'], $meta_field )] = wppb_sanitize_value( $_POST[$single_field_name] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 1218 | - } | |
| 1219 | - else | |
| 1220 | - $meta_values[Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'], $meta_field )] = ''; | |
| 1277 | + $meta_values[$field_slug] = $this->wck_sanitize_value( $_POST[$single_field_name], $field_slug ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we sanitize with our own function | |
| 1278 | + } else | |
| 1279 | + $meta_values[$field_slug] = ''; | |
| 1221 | 1280 | } |
| 1222 | 1281 | } |
| 1223 | 1282 | |
| 1224 | 1283 | /* test if we have errors for the required fields */ |
| @@ -1234,17 +1293,18 @@ | ||
| 1234 | 1293 | $wck_single_forms_errors[] = $errors; |
| 1235 | 1294 | } |
| 1236 | 1295 | else { |
| 1237 | 1296 | /* no errors so we can save */ |
| 1238 | - update_post_meta($post_id, $meta_name, array($meta_values)); | |
| 1297 | + update_post_meta( $post_id, $meta_name, array( $meta_values ) ); | |
| 1298 | + | |
| 1239 | 1299 | /* handle unserialized fields */ |
| 1240 | - if ($this->args['unserialize_fields']) { | |
| 1241 | - if (!empty($this->args['meta_array'])) { | |
| 1242 | - foreach ($this->args['meta_array'] as $meta_field) { | |
| 1243 | - update_post_meta($post_id, $meta_name . '_' . Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'], $meta_field ) . '_1', array_map( 'wppb_sanitize_value', $_POST[$this->args['meta_name'] . '_' . Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'], $meta_field )] ) ); //phpcs:ignore | |
| 1244 | - } | |
| 1245 | - } | |
| 1246 | - } | |
| 1300 | + // if ( $this->args['unserialize_fields'] ) { | |
| 1301 | + // if (!empty($this->args['meta_array'])) { | |
| 1302 | + // foreach ($this->args['meta_array'] as $meta_field) { | |
| 1303 | + // update_post_meta($post_id, $meta_name . '_' . Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'], $meta_field ) . '_1', array_map( 'wppb_sanitize_value', $_POST[$this->args['meta_name'] . '_' . Wordpress_Creation_Kit_PB::wck_generate_slug( $meta_field['title'], $meta_field )] ) ); //phpcs:ignore | |
| 1304 | + // } | |
| 1305 | + // } | |
| 1306 | + // } | |
| 1247 | 1307 | } |
| 1248 | 1308 | break; |
| 1249 | 1309 | } |
| 1250 | 1310 | } |
| @@ -1304,9 +1364,26 @@ | ||
| 1304 | 1364 | echo '<script type="text/javascript">alert("'. str_replace( '%0A', '\n', esc_js( urldecode( base64_decode( $_GET['wckerrormessages'] ) ) ) ) .'")</script>';//phpcs:ignore |
| 1305 | 1365 | } |
| 1306 | 1366 | } |
| 1307 | 1367 | |
| 1368 | + static function wck_maybe_add_extra_errors( $meta_array, $meta, $values, $id ){ | |
| 1308 | 1369 | |
| 1370 | + if( strpos( $meta, 'wppb_cr_' ) === false ) | |
| 1371 | + return ''; | |
| 1372 | + | |
| 1373 | + $license_status = wppb_get_serial_number_status(); | |
| 1374 | + | |
| 1375 | + if( $license_status == 'missing' ){ | |
| 1376 | + return array( 'error' => sprintf( __( 'Please %1$senter your license key%2$s first, to add new custom redirects.', 'profile-builder' ), '<a href="' . admin_url( 'admin.php?page=profile-builder-general-settings' ) . '">', '</a>' ) ); | |
| 1377 | + } else if( $license_status !== 'valid' ){ | |
| 1378 | + return array( 'error' => sprintf( __( 'You need an active license to add new custom redirects. <br>%1$sRenew%2$s or %3$spurchase a new one here%4$s.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/account/?utm_source=pb-redirects&utm_medium=client-site&utm_campaign=pb-expired-license">', '</a>', '<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=pb-redirects&utm_medium=client-site&utm_campaign=pb-redirects-addon#pricing" target="_blank">', '</a>' ) ); | |
| 1379 | + } | |
| 1380 | + | |
| 1381 | + return ''; | |
| 1382 | + | |
| 1383 | + } | |
| 1384 | + | |
| 1385 | + | |
| 1309 | 1386 | /** |
| 1310 | 1387 | * The function used to generate slugs in WCK |
| 1311 | 1388 | * |
| 1312 | 1389 | * @since 1.1.1 |
| @@ -1338,9 +1415,9 @@ | ||
| 1338 | 1415 | if( !empty( $values ) ) |
| 1339 | 1416 | $value_attr = $values[$i]; |
| 1340 | 1417 | else |
| 1341 | 1418 | $value_attr = $option; |
| 1342 | - | |
| 1419 | + | |
| 1343 | 1420 | if( !empty( $option['disabled'] ) && $option['disabled'] == true ){ |
| 1344 | 1421 | $disabled = ' disabled'; |
| 1345 | 1422 | } |
| 1346 | 1423 | } |
| @@ -1374,16 +1451,21 @@ | ||
| 1374 | 1451 | // title is set only for disabled options to let users know those fields are available in a paid version |
| 1375 | 1452 | if( !empty( $disabled ) ){ |
| 1376 | 1453 | if( isset( $value_attr['field_name'] ) && $value_attr['field_name'] == 'Subscription Plans' ) |
| 1377 | 1454 | $title = esc_attr( __( 'Install the free Paid Member Subscriptions plugin to get access this field.', 'profile-builder' ) ); |
| 1455 | + elseif ( isset( $value_attr['field_name'] ) && $value_attr['field_name'] == 'Additional Map' ) | |
| 1456 | + $title = esc_attr( __( 'A Map field must be created first.', 'profile-builder' ) ); | |
| 1378 | 1457 | else |
| 1379 | 1458 | $title = esc_attr( __( 'This field is available in our paid plans.', 'profile-builder' ) ); |
| 1380 | 1459 | } |
| 1381 | 1460 | |
| 1382 | - if( isset( $value_attr['field_name'] ) ) | |
| 1461 | + if( isset( $value_attr['field_name'] ) ) { | |
| 1383 | 1462 | $optionOutput = '<option value="" '. esc_attr( $disabled ) . ( !empty( $disabled ) ? ' title="'. $title .'"' : '' ) . ' >'. esc_html( $label ) .'</option>'; |
| 1384 | - else | |
| 1385 | - $optionOutput = '<option value="'. esc_attr( $value_attr ) .'" '. selected( $value_attr, $current_value, false ) . ( !empty( $disabled ) ? ' title="'. $title .'"' : '' ) . ' >'. esc_html( $label ) .'</option>'; | |
| 1463 | + } else if ( is_array( $current_value ) ) { | |
| 1464 | + $is_selected = in_array( $value_attr, $current_value ) ? 'selected="selected" ' : ''; | |
| 1465 | + $optionOutput = '<option value="'. esc_attr( $value_attr ) .'" '. $is_selected . ( !empty( $disabled ) ? ' title="'. $title .'"' : '' ) . ' >'. esc_html( $label ) .'</option>'; | |
| 1466 | + } else | |
| 1467 | + $optionOutput = '<option value="'. esc_attr( $value_attr ) .'" '. selected( strip_tags( $value_attr ), $current_value, false ) . ( !empty( $disabled ) ? ' title="'. $title .'"' : '' ) . ' >'. esc_html( $label ) .'</option>'; | |
| 1386 | 1468 | |
| 1387 | 1469 | return $optionOutput; |
| 1388 | 1470 | } |
| 1389 | 1471 | |
| @@ -1392,8 +1474,71 @@ | ||
| 1392 | 1474 | if (is_array($v)) return true; |
| 1393 | 1475 | } |
| 1394 | 1476 | return false; |
| 1395 | 1477 | } |
| 1478 | + | |
| 1479 | + function wck_sanitize_associative_array( $associative_array ){ | |
| 1480 | + $sanitized_associative_array = array(); | |
| 1481 | + | |
| 1482 | + foreach ( $associative_array as $meta_name => $value) { | |
| 1483 | + $sanitized_associative_array[$meta_name] = $this->wck_sanitize_value($value, $meta_name); | |
| 1484 | + } | |
| 1485 | + | |
| 1486 | + return $sanitized_associative_array; | |
| 1487 | + } | |
| 1488 | + | |
| 1489 | + function wck_sanitize_value( $value, $meta_name = false ){ | |
| 1490 | + | |
| 1491 | + if( apply_filters( 'wck_pre_sanitize_value', false, $meta_name ) ){ | |
| 1492 | + return apply_filters( 'wck_sanitize_value', $value, $meta_name ); | |
| 1493 | + } | |
| 1494 | + | |
| 1495 | + $is_wysiwyg_field = false; | |
| 1496 | + $is_textarea_field = false; | |
| 1497 | + $is_query_compare = false; | |
| 1498 | + | |
| 1499 | + if( !empty( $meta_name ) && !empty( $this->args['meta_array'] ) ){ | |
| 1500 | + | |
| 1501 | + foreach( $this->args['meta_array'] as $field ){ | |
| 1502 | + | |
| 1503 | + if( $field['slug'] === $meta_name && $field['type'] === 'wysiwyg editor' ) | |
| 1504 | + $is_wysiwyg_field = true; | |
| 1505 | + | |
| 1506 | + if( $field['slug'] === $meta_name && $field['type'] === 'textarea' ) | |
| 1507 | + $is_textarea_field = true; | |
| 1508 | + | |
| 1509 | + if( $meta_name === 'query-compare' && $field['slug'] === $meta_name ) | |
| 1510 | + $is_query_compare = true; | |
| 1511 | + | |
| 1512 | + } | |
| 1513 | + | |
| 1514 | + } | |
| 1515 | + | |
| 1516 | + if( is_array( $value ) ) { | |
| 1517 | + $sanitized_array = array(); | |
| 1518 | + | |
| 1519 | + foreach ($value as $element) { | |
| 1520 | + if( $is_wysiwyg_field ) | |
| 1521 | + $sanitized_array[] = wp_kses_post( $element ); | |
| 1522 | + elseif( $is_textarea_field ) | |
| 1523 | + $sanitized_array[] = wp_kses_post( $element ); | |
| 1524 | + else | |
| 1525 | + $sanitized_array[] = sanitize_text_field( $element ); | |
| 1526 | + } | |
| 1527 | + | |
| 1528 | + return $sanitized_array; | |
| 1529 | + } | |
| 1530 | + else{ | |
| 1531 | + if( $is_wysiwyg_field ) | |
| 1532 | + return wp_kses_post( $value ); | |
| 1533 | + elseif( $is_textarea_field ) | |
| 1534 | + return wp_kses_post( $value ); | |
| 1535 | + elseif( $is_query_compare ) | |
| 1536 | + return in_array( $value, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'EXISTS', 'NOT EXISTS' ), true ) ? $value : '='; | |
| 1537 | + else | |
| 1538 | + return sanitize_text_field( $value ); | |
| 1539 | + } | |
| 1540 | + } | |
| 1396 | 1541 | } |
| 1397 | 1542 | |
| 1398 | 1543 | |
| 1399 | 1544 | /* |
| @@ -1516,9 +1661,13 @@ | ||
| 1516 | 1661 | * Do action 'add_meta_boxes'. This hook isn't executed by default on a admin page so we have to add it. |
| 1517 | 1662 | */ |
| 1518 | 1663 | function wck_settings_page_add_meta_boxes() { |
| 1519 | 1664 | global $post; |
| 1520 | - do_action( 'add_meta_boxes', $this->hookname, $post ); | |
| 1665 | + | |
| 1666 | + if( empty( $post ) || empty( $post->ID ) ) | |
| 1667 | + do_action( 'wck_add_meta_boxes', $this->hookname, $post ); | |
| 1668 | + else | |
| 1669 | + do_action( 'add_meta_boxes', $this->hookname, $post ); | |
| 1521 | 1670 | } |
| 1522 | 1671 | |
| 1523 | 1672 | /** |
| 1524 | 1673 | * Loads the JavaScript files required for managing the meta boxes on the theme settings |
| @@ -1561,9 +1710,9 @@ | ||
| 1561 | 1710 | * provides two action hooks 'wck_before_meta_boxes' and 'wck_after_meta_boxes'. |
| 1562 | 1711 | */ |
| 1563 | 1712 | function wck_page_template(){ |
| 1564 | 1713 | ?> |
| 1565 | - <div class="wrap"> | |
| 1714 | + <div class="wrap cozmoslabs-wrap"> | |
| 1566 | 1715 | |
| 1567 | 1716 | <?php if( !empty( $this->args['page_icon'] ) ): ?> |
| 1568 | 1717 | <div id="<?php echo esc_attr( $this->args['menu_slug'] );//phpcs:ignore ?>-icon" style="background: url('<?php echo $this->args['page_icon']; ?>') no-repeat;" class="icon32"> |
| 1569 | 1718 | <br/> |
| @@ -1569,10 +1718,21 @@ | ||
| 1569 | 1718 | <br/> |
| 1570 | 1719 | </div> |
| 1571 | 1720 | <?php endif; ?> |
| 1572 | 1721 | |
| 1573 | - <h2><?php echo esc_html( $this->args['page_title'] ) ?></h2> | |
| 1722 | + <h1></h1> | |
| 1723 | + <!-- WordPress Notices are added after the h1 tag --> | |
| 1574 | 1724 | |
| 1725 | + <div class="cozmoslabs-page-header"> | |
| 1726 | + <div class="cozmoslabs-section-title"> | |
| 1727 | + | |
| 1728 | + <h2 class="cozmoslabs-page-title"> | |
| 1729 | + <?php echo esc_html( $this->args['page_title'] ) ?> | |
| 1730 | + </h2> | |
| 1731 | + | |
| 1732 | + </div> | |
| 1733 | + </div> | |
| 1734 | + | |
| 1575 | 1735 | <div id="poststuff"> |
| 1576 | 1736 | |
| 1577 | 1737 | <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
| 1578 | 1738 | <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
| @@ -1578,10 +1738,12 @@ | ||
| 1578 | 1738 | <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
| 1579 | 1739 | |
| 1580 | 1740 | <?php do_action( 'wck_before_meta_boxes', $this->hookname ); ?> |
| 1581 | 1741 | |
| 1582 | - <div class="metabox-holder"> | |
| 1583 | - <div class="wck-post-body"> | |
| 1742 | + <?php $is_email_customizer_page = $this->hookname === 'profile-builder_page_user-email-customizer' || $this->hookname === 'profile-builder_page_admin-email-customizer'; ?> | |
| 1743 | + | |
| 1744 | + <div class="metabox-holder <?php echo $is_email_customizer_page ? 'cozmoslabs-settings-container' : '' ?>"> | |
| 1745 | + <div class="wck-post-body <?php echo $is_email_customizer_page ? 'cozmoslabs-email-customizer-section cozmoslabs-settings' : '' ?>"> | |
| 1584 | 1746 | <div class="post-box-container column-1 normal"> |
| 1585 | 1747 | <?php do_action( 'wck_before_column1_metabox_content', $this->hookname ); ?> |
| 1586 | 1748 | <?php do_meta_boxes( $this->hookname, 'normal', null ); ?> |
| 1587 | 1749 | <?php do_action( 'wck_after_column1_metabox_content', $this->hookname ); ?> |
| @@ -1591,9 +1753,9 @@ | ||
| 1591 | 1753 | <?php do_meta_boxes( $this->hookname, 'advanced', null ); ?> |
| 1592 | 1754 | <?php do_action( 'wck_after_column3_metabox_content', $this->hookname ); ?> |
| 1593 | 1755 | </div> |
| 1594 | 1756 | </div> |
| 1595 | - <div class="post-box-container column-2 side"><?php do_meta_boxes( $this->hookname, 'side', null ); ?></div> | |
| 1757 | + <div class="post-box-container column-2 side <?php echo $is_email_customizer_page ? 'cozmoslabs-submit' : '' ?>"><?php do_meta_boxes( $this->hookname, 'side', null ); ?></div> | |
| 1596 | 1758 | |
| 1597 | 1759 | </div> |
| 1598 | 1760 | |
| 1599 | 1761 | <?php do_action( 'wck_after_meta_boxes', $this->hookname ); ?> |