| @@ -13,10 +13,10 @@ | ||
| 13 | 13 | |
| 14 | 14 | <!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 15 | 15 | |
| 16 | 16 | <div class="wrap wdk-wrap"> |
| 17 | - <h1 class="wp-heading-inline"><?php echo __('Directory Fields Management','wpdirectorykit'); ?> <a href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=field_edit"; ?>" class="button button-primary" id="add_field_button"><?php echo __('Add Field','wpdirectorykit'); ?></a></h1> | |
| 18 | - <br /><br /> | |
| 17 | + <h1 class="wp-heading-inline"><?php echo esc_html__('Directory Fields Management','wpdirectorykit'); ?> <a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_fields&function=field_edit"); ?>" class="button button-primary" id="add_field_button"><?php echo esc_html__('Add Field','wpdirectorykit'); ?></a></h1> | |
| 18 | + <br /> | |
| 19 | 19 | <div class="wdk-body "> |
| 20 | 20 | <div class="row fields_list"> |
| 21 | 21 | <?php if(count($fields) == 0): ?> |
| 22 | 22 | <?php if(!function_exists('eli_installer') || !function_exists('run_elementinvader') || !is_plugin_active('elementor/elementor.php')):?> |
| @@ -30,11 +30,11 @@ | ||
| 30 | 30 | ?> |
| 31 | 31 | |
| 32 | 32 | <div class="notice notice-error"> |
| 33 | 33 | <p> |
| 34 | - <?php echo __('First please install / activate required plugins, then you can import demo data','wpdirectorykit'); ?> | |
| 34 | + <?php echo esc_html__('First please install / activate required plugins, then you can import demo data','wpdirectorykit'); ?> | |
| 35 | 35 | <a href="<?php echo esc_url($tgma_link); ?>" class="button button-primary"> |
| 36 | - <?php echo __('Begin to install / activate','wpdirectorykit'); ?> | |
| 36 | + <?php echo esc_html__('Begin to install / activate','wpdirectorykit'); ?> | |
| 37 | 37 | </a> |
| 38 | 38 | </p> |
| 39 | 39 | </div> |
| 40 | 40 | <?php else:?> |
| @@ -61,9 +61,9 @@ | ||
| 61 | 61 | $multipurpose_values = apply_filters('wdk/settings/import/multipurpose_values', $multipurpose_values); |
| 62 | 62 | ?> |
| 63 | 63 | <div class="notice notice-success"> |
| 64 | 64 | <p> |
| 65 | - <?php echo __('You don\'t have any fields, import demo data for','wpdirectorykit'); ?> | |
| 65 | + <?php echo esc_html__('You don\'t have any fields, import demo data for','wpdirectorykit'); ?> | |
| 66 | 66 | <select name="multipurpose" class="field_purpose align-top text-capitalize"> |
| 67 | 67 | <?php foreach ($multipurpose_values as $purpose_key => $purpose) :?> |
| 68 | 68 | <?php |
| 69 | 69 | $selected = ''; |
| @@ -72,10 +72,10 @@ | ||
| 72 | 72 | ?> |
| 73 | 73 | <option value="<?php echo esc_attr($purpose_key);?>" <?php echo esc_html($selected);?>><?php echo esc_html(ucwords($purpose));?></option> |
| 74 | 74 | <?php endforeach;?> |
| 75 | 75 | </select> |
| 76 | - <a href="<?php echo get_admin_url() . "admin.php?page=wdk_settings&function=run&multipurpose=real-estate.xml&redirect_url=admin.php?page=wdk_fields&_wpnonce=".wp_create_nonce( 'wdk-import-data-run'); ?>" class="button button-primary event-ajax-indicator" id="import_demo_field_button"> | |
| 77 | - <?php echo __('Click here to import now','wpdirectorykit'); ?> | |
| 76 | + <a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_settings&function=run&multipurpose=real-estate.xml&redirect_url=admin.php?page=wdk_fields&_wpnonce=".wp_create_nonce( 'wdk-import-data-run')); ?>" class="button button-primary event-ajax-indicator" id="import_demo_field_button"> | |
| 77 | + <?php echo esc_html__('Click here to import now','wpdirectorykit'); ?> | |
| 78 | 78 | </a> |
| 79 | 79 | <span class="wdk-ajax-indicator wdk-infinity-load color-primary dashicons dashicons-update-alt hidden" style="margin-top: 6px;margin-left: 4px;"></span> |
| 80 | 80 | </p> |
| 81 | 81 | </div> |
| @@ -82,9 +82,9 @@ | ||
| 82 | 82 | <?php endif; ?> |
| 83 | 83 | <?php endif; ?> |
| 84 | 84 | <?php |
| 85 | 85 | if (isset($_GET['message'])) { |
| 86 | - echo '<p class="alert alert-success">' .str_replace("+", ' ', wp_kses_post(urldecode($_GET['message']))) . '</p><br/>'; | |
| 86 | + echo '<p class="alert alert-success">' .esc_html(str_replace("+", ' ', wp_kses_post(urldecode($_GET['message'])))) . '</p><br/>'; | |
| 87 | 87 | } |
| 88 | 88 | ?> |
| 89 | 89 | |
| 90 | 90 | <div id="wdk-sortable-fields" class="meta-box-sortables ui-sortable wdk-row"> |
| @@ -90,11 +90,11 @@ | ||
| 90 | 90 | <div id="wdk-sortable-fields" class="meta-box-sortables ui-sortable wdk-row"> |
| 91 | 91 | <?php foreach($fields as $field): ?> |
| 92 | 92 | <div id="fid_<?php echo esc_attr($field->idfield); ?>" class=" wdk_field wdk-col-md-<?php echo esc_attr($field->columns_number); ?> <?php echo esc_attr($field->field_type); ?>" rel="<?php echo esc_attr($field->idfield); ?>"> |
| 93 | 93 | <div class="postbox-header postbox "> |
| 94 | - <h3 class="hndle ui-sortable-handle"> <a href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=field_edit&id=".esc_attr($field->idfield); ?>">#<?php echo esc_html($field->idfield); ?> <?php echo esc_html($field->field_label); ?> <?php echo !empty(wmvc_show_data('is_required', $field, ''))?'*':''; ?> [<?php echo esc_html($field->field_type); ?>]</a> | |
| 95 | - <a class="question_sure pull_right" href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=delete&id=".esc_attr($field->idfield); ?>&_wpnonce=<?php echo wp_create_nonce( 'wdk-fields-delete_'.esc_attr($field->idfield));?>" title="<?php echo esc_attr__('Remove','wpdirectorykit');?>"><span class="dashicons dashicons-no"></span></a> | |
| 96 | - <a class="pull_right" href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=field_edit&id=".esc_attr($field->idfield); ?>" title="<?php echo esc_attr__('Edit','wpdirectorykit');?>"><span class="dashicons dashicons-edit"></span></a> | |
| 94 | + <h3 class="hndle ui-sortable-handle"> <a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_fields&function=field_edit&id=".esc_attr($field->idfield)); ?>">#<?php echo esc_html($field->idfield); ?> <?php echo esc_html($field->field_label); ?> <?php echo !empty(wmvc_show_data('is_required', $field, ''))?'*':''; ?> [<?php echo esc_html($field->field_type); ?>]</a> | |
| 95 | + <a class="question_sure pull_right" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_fields&function=delete&id=".esc_attr($field->idfield)); ?>&_wpnonce=<?php echo esc_attr(wp_create_nonce( 'wdk-fields-delete_'.esc_attr($field->idfield)));?>" title="<?php echo esc_attr__('Remove','wpdirectorykit');?>"><span class="dashicons dashicons-no"></span></a> | |
| 96 | + <a class="pull_right" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_fields&function=field_edit&id=".esc_attr($field->idfield)); ?>" title="<?php echo esc_attr__('Edit','wpdirectorykit');?>"><span class="dashicons dashicons-edit"></span></a> | |
| 97 | 97 | </h3> |
| 98 | 98 | <?php if(false): ?> |
| 99 | 99 | <div class="handle-actions hide-if-no-js"> |
| 100 | 100 | <button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="postimagediv-handle-order-higher-description"> |
| @@ -120,9 +120,24 @@ | ||
| 120 | 120 | </div> |
| 121 | 121 | <?php endforeach; ?> |
| 122 | 122 | </div> |
| 123 | 123 | |
| 124 | - <div class="alert alert-info" style="margin-bottom:20px" role="alert"><?php echo sprintf(__('%1$s This fields and section can be restructured, replaced/moved with drag & drop, resized etc. How to add new fields?%2$s', 'wpdirectorykit'),'<a href="//wpdirectorykit.com/documentation/#!/custom_fields" target="_blank">','</a>'); ?></div> | |
| 124 | + <div class="alert alert-info" style="margin-bottom:20px" role="alert"><?php | |
| 125 | + echo wp_kses( | |
| 126 | + sprintf( | |
| 127 | + /* translators: 1: Tag with link open, 2: close link tag. */ | |
| 128 | + __('%1$s This fields and section can be restructured, replaced/moved with drag & drop, resized etc. How to add new fields?%2$s', 'wpdirectorykit'), | |
| 129 | + '<a href="' . esc_url('https://wpdirectorykit.com/documentation/#!/custom_fields') . '" target="_blank">', | |
| 130 | + '</a>' | |
| 131 | + ), | |
| 132 | + array( | |
| 133 | + 'a' => array( | |
| 134 | + 'href' => true, | |
| 135 | + 'target' => true, | |
| 136 | + ), | |
| 137 | + ) | |
| 138 | + ); | |
| 139 | + ?></div> | |
| 125 | 140 | <iframe width="560" height="315" src="//www.youtube.com/embed/cewZBOGzbPg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> |
| 126 | 141 | </div> |
| 127 | 142 | </div> |
| 128 | 143 | </div> |
| @@ -139,9 +154,9 @@ | ||
| 139 | 154 | // Generate table |
| 140 | 155 | jQuery(document).ready(function($) { |
| 141 | 156 | |
| 142 | 157 | $('.field_purpose').on('change', function(){ |
| 143 | - $('#import_demo_field_button').attr('href', '<?php echo get_admin_url() . "admin.php?page=wdk_settings&function=run&redirect_url=admin.php?page=wdk_fields&_wpnonce=".wp_create_nonce( 'wdk-import-data-run'); ?>&multipurpose='+$(this).find(":selected").attr('value')) | |
| 158 | + $('#import_demo_field_button').attr('href', '<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_settings&function=run&redirect_url=admin.php?page=wdk_fields&_wpnonce=".wp_create_nonce( 'wdk-import-data-run')); ?>&multipurpose='+$(this).find(":selected").attr('value')) | |
| 144 | 159 | }); |
| 145 | 160 | |
| 146 | 161 | $( "#wdk-sortable-fields" ).sortable({ |
| 147 | 162 | update: function(event, ui) { |
| @@ -151,15 +166,14 @@ | ||
| 151 | 166 | $('#wdk-sortable-fields .wdk_field').each(function( index ) { |
| 152 | 167 | data_fields_list+=$( this ).attr('rel')+';'; |
| 153 | 168 | }); |
| 154 | 169 | |
| 155 | - //console.log(data_fields_list); | |
| 156 | - | |
| 157 | 170 | var data = { |
| 158 | 171 | 'page': 'wdk_fields', |
| 159 | 172 | 'function': 'ajax_save_order', |
| 160 | 173 | 'action': 'wdk_admin_action', |
| 161 | - 'data_fields_list' : data_fields_list | |
| 174 | + 'data_fields_list' : data_fields_list, | |
| 175 | + 'wdk_fields_nonce' : '<?php echo esc_js(wp_create_nonce('wdk_fields_save_order')); ?>' | |
| 162 | 176 | }; |
| 163 | 177 | |
| 164 | 178 | $.post( "<?php echo esc_url(admin_url( 'admin-ajax.php' )); ?>", data) |
| 165 | 179 | .done(function( data ) { |