PluginProbe
WP Directory Kit / 1.5.5
WP Directory Kit v1.5.5
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 / fields_edit / SEO_INPUTBOX.php

SEO_INPUTBOX.php in WP Directory Kit 1.5.5, at application/views/fields_edit/SEO_INPUTBOX.php

131 lines 4.7 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 Edit field INPUTBOX.
4 *
5 * This is the template that field layout for edit form
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12 ?>
13 <?php
14
15 //wmvc_dump($field);
16
17 if(isset($field->field))
18 {
19 $field_id = $field->field;
20 }
21 else
22 {
23 $field_id = 'field_'.$field->idfield;
24 }
25
26 if(!isset($field->hint))$field->hint = '';
27 if(!isset($field->columns_number))$field->columns_number = '';
28 if(!isset($field->class))$field->class = '';
29 if(!isset($field->prefix))$field->prefix = '';
30 if(!isset($field->suffix))$field->suffix = '';
31 if(!isset($field->default))$field->default = '';
32 if(!isset($field->empty_default))$field->empty_default = '';
33
34
35 $field_label = $field->field_label;
36
37 $required = '';
38 if(isset($field->is_required) && $field->is_required == 1)
39 $required = '*';
40
41 if(isset($field->rules) && strpos($field->rules, 'required') !== FALSE)
42 $required = '*';
43 ?>
44
45 <div class="wdk-field-<?php echo esc_attr($field_id);?> wdk-field-edit <?php echo esc_attr($field->field_type); ?> wdk-col-<?php echo esc_attr($field->columns_number); ?> <?php echo esc_attr($field->class); ?> <?php if(!empty($form) && method_exists($form, 'hasError') && $form->hasError($field_id)):?> field-error <?php endif;?>">
46 <label for="<?php echo esc_attr($field_id); ?>"><?php echo esc_html($field_label).esc_html($required); ?></label>
47 <div class="wdk-field-container">
48 <input class="regular-text"
49 name="<?php echo esc_attr($field_id); ?>"
50 type="text" id="<?php echo esc_attr($field_id); ?>"
51 value="<?php echo esc_attr(!empty(wmvc_show_data($field_id, $db_data, $field->default)) ? wmvc_show_data($field_id, $db_data, $field->default) : $field->empty_default); ?>"
52 >
53 <span class="suffix"><?php
54 echo esc_html__($field->prefix, 'wpdirectorykit');
55 if(!empty($field->prefix) && !empty($field->suffix)) echo ' / ';
56 echo esc_html__($field->suffix, 'wpdirectorykit');
57 ?></span>
58 <?php if(!empty($field->hint)):?>
59 <p class="wdk-hint">
60 <?php echo wp_kses_post($field->hint); ?>
61 </p>
62 <?php endif;?>
63 <?php if(!empty($form) && method_exists($form, 'hasError') && $form->getError($field_id)):?>
64 <p class="wdk-hint wdk-error">
65 <?php echo wp_kses_post($form->getError($field_id)); ?>
66 </p>
67 <?php endif;?>
68 </div>
69 </div>
70 <?php
71 // Register and enqueue Tribute.js style
72 wp_enqueue_style( 'tribute-css');
73 // Register and enqueue Tribute.js script
74 wp_enqueue_script( 'tribute-js');
75 ?>
76
77 <?php
78
79 $fields_data = wdk_cached_field_get();
80
81 $fields_list = array();
82 $fields_list['field_post_id'] = esc_html__('Post Id', 'wpdirectorykit');
83 $fields_list['field_counter_views'] = esc_html__('Views counter', 'wpdirectorykit');
84 $fields_list['field_lat'] = esc_html__('Gps Lat', 'wpdirectorykit');
85 $fields_list['field_lng'] = esc_html__('Gps Lng', 'wpdirectorykit');
86 $fields_list['field_date'] = esc_html__('Date', 'wpdirectorykit');
87 $fields_list['field_date_modified'] = esc_html__('Date Modified', 'wpdirectorykit');
88 $fields_list['field_post_title'] = esc_html__('Title', 'wpdirectorykit');
89 $fields_list['field_post_content'] = esc_html__('Content', 'wpdirectorykit');
90 $fields_list['field_address'] = esc_html__('Address', 'wpdirectorykit');
91 $fields_list['field_category'] = esc_html__('Category', 'wpdirectorykit');
92 $fields_list['field_location'] = esc_html__('Location', 'wpdirectorykit');
93
94 foreach ($fields_data as $field) {
95 if (wmvc_show_data('field_type', $field) == 'NUMBER' || wmvc_show_data('field_type', $field) == 'INPUTBOX') {
96 $fields_list['field_'.wmvc_show_data('idfield', $field)] = wmvc_show_data('field_label', $field);
97 }
98 }
99 ?>
100
101 <script>
102 document.addEventListener('DOMContentLoaded', function() {
103 var input = document.getElementById('<?php echo esc_js($field_id); ?>');
104 if (input) {
105 var tribute = new Tribute({
106 trigger: '{',
107 values: [
108 <?php
109 $first = true;
110 foreach($fields_list as $value => $key) {
111 if(!$first) echo ",";
112 ?>{ key: <?php echo json_encode($key); ?>, value: <?php echo json_encode($value); ?> }<?php
113 $first = false;
114 }
115 ?>
116 ],
117
118 // Insert with curly braces
119 selectTemplate: function (item) {
120 return '{' + item.original.value + '}';
121 },
122 menuItemTemplate: function (item) {
123 return item.string; // show key
124 }
125 });
126 tribute.attach(input);
127 }
128 });
129 </script>
130
131