PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / application / views / wdk_fields / index.php

index.php in WP Directory Kit 1.5.9, at application/views/wdk_fields/index.php

192 lines 11.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template for Directory Fields Management.
4 *
5 * This is the template that table, search layout
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12 ?>
13
14 <!-- This file should primarily consist of HTML with a little bit of PHP. -->
15
16 <div class="wrap wdk-wrap">
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 <div class="wdk-body ">
20 <div class="row fields_list">
21 <?php if(count($fields) == 0): ?>
22 <?php if(!function_exists('eli_installer') || !function_exists('run_elementinvader') || !is_plugin_active('elementor/elementor.php')):?>
23 <?php
24 $tgma_link = '';
25 if(file_exists(get_template_directory().'/includes/tgm_pa/class-tgm-plugin-activation.php') || file_exists(get_template_directory().'/tgm_pa/class-tgm-plugin-activation.php')) {
26 $tgma_link = get_admin_url() . "themes.php?page=tgmpa-install-plugins";
27 } else {
28 $tgma_link = get_admin_url() . "plugins.php?page=tgmpa-install-plugins";
29 }
30 ?>
31
32 <div class="notice notice-error">
33 <p>
34 <?php echo esc_html__('First please install / activate required plugins, then you can import demo data','wpdirectorykit'); ?>
35 <a href="<?php echo esc_url($tgma_link); ?>" class="button button-primary">
36 <?php echo esc_html__('Begin to install / activate','wpdirectorykit'); ?>
37 </a>
38 </p>
39 </div>
40 <?php else:?>
41 <?php
42 if(file_exists(WPDIRECTORYKIT_PATH.'demo-data/'))
43 {
44 $files = array();
45 $dir = WPDIRECTORYKIT_PATH.'demo-data/';
46 if (is_dir($dir)) {
47 if ($dh = opendir($dir)) {
48 while (($file = readdir($dh)) !== false) {
49 if($file == 'locations.xml') continue;
50 if(strpos($file, '.xml') !== false && strpos($file, '~') === false)
51 $multipurpose_values[$file] = ucfirst(str_replace(array('_', '-', '.xml'), ' ', $file));
52 }
53 closedir($dh);
54 }
55 }
56 }
57 ksort($multipurpose_values);
58
59
60 if(has_filter('wdk/settings/import/multipurpose_values'))
61 $multipurpose_values = apply_filters('wdk/settings/import/multipurpose_values', $multipurpose_values);
62 ?>
63 <div class="notice notice-success">
64 <p>
65 <?php echo esc_html__('You don\'t have any fields, import demo data for','wpdirectorykit'); ?>
66 <select name="multipurpose" class="field_purpose align-top text-capitalize">
67 <?php foreach ($multipurpose_values as $purpose_key => $purpose) :?>
68 <?php
69 $selected = '';
70 if($purpose_key=='real-estate.xml')
71 $selected = "selected ='selected'";
72 ?>
73 <option value="<?php echo esc_attr($purpose_key);?>" <?php echo esc_html($selected);?>><?php echo esc_html(ucwords($purpose));?></option>
74 <?php endforeach;?>
75 </select>
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 </a>
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 </p>
81 </div>
82 <?php endif; ?>
83 <?php endif; ?>
84 <?php
85 if (isset($_GET['message'])) {
86 echo '<p class="alert alert-success">' .esc_html(str_replace("+", ' ', wp_kses_post(urldecode($_GET['message'])))) . '</p><br/>';
87 }
88 ?>
89
90 <div id="wdk-sortable-fields" class="meta-box-sortables ui-sortable wdk-row">
91 <?php foreach($fields as $field): ?>
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 <div class="postbox-header postbox ">
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 </h3>
98 <?php if(false): ?>
99 <div class="handle-actions hide-if-no-js">
100 <button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="postimagediv-handle-order-higher-description">
101 <span class="screen-reader-text">Move up</span>
102 <span class="order-higher-indicator" aria-hidden="true"></span>
103 </button>
104 <span class="hidden" id="postimagediv-handle-order-higher-description">Move Featured image box up</span>
105 <button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="postimagediv-handle-order-lower-description">
106 <span class="screen-reader-text">Move down</span><span class="order-lower-indicator" aria-hidden="true"></span>
107 </button>
108 <span class="hidden" id="postimagediv-handle-order-lower-description">Move Featured image box down</span>
109 <button type="button" class="handlediv" aria-expanded="true"><span class="screen-reader-text">Toggle panel: Featured image</span>
110 <span class="toggle-indicator" aria-hidden="true"></span>
111 </button>
112 </div>
113 <?php endif; ?>
114 </div>
115 <?php if(false): ?>
116 <div class="inside">
117 <p class="hide-if-no-js"></p>
118 </div>
119 <?php endif; ?>
120 </div>
121 <?php endforeach; ?>
122 </div>
123
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>
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>
141 </div>
142 </div>
143 </div>
144
145 <?php
146
147 wp_enqueue_script( 'jquery-ui-core', false, array('jquery') );
148 wp_enqueue_script( 'jquery-ui-sortable', false, array('jquery') );
149
150 ?>
151
152
153 <script>
154 // Generate table
155 jQuery(document).ready(function($) {
156
157 $('.field_purpose').on('change', function(){
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'))
159 });
160
161 $( "#wdk-sortable-fields" ).sortable({
162 update: function(event, ui) {
163
164 var data_fields_list = '';
165
166 $('#wdk-sortable-fields .wdk_field').each(function( index ) {
167 data_fields_list+=$( this ).attr('rel')+';';
168 });
169
170 var data = {
171 'page': 'wdk_fields',
172 'function': 'ajax_save_order',
173 'action': 'wdk_admin_action',
174 'data_fields_list' : data_fields_list,
175 'wdk_fields_nonce' : '<?php echo esc_js(wp_create_nonce('wdk_fields_save_order')); ?>'
176 };
177
178 $.post( "<?php echo esc_url(admin_url( 'admin-ajax.php' )); ?>", data)
179 .done(function( data ) {
180 //alert( "Data Loaded: " + data );
181 });
182 }
183 });
184
185 $('.question_sure').on('click', function(){
186 return confirm("<?php echo esc_js(__('Are you sure? Selected item will be completely removed!','wpdirectorykit')); ?>");
187 });
188 });
189
190 </script>
191
192 <?php $this->view('general/footer', $data); ?>