This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | global $pods_i; |
||
0 ignored issues
–
show
|
|||
3 | |||
4 | $api = pods_api(); |
||
5 | |||
6 | $pod = $api->load_pod( array( 'id' => $obj->id ) ); |
||
7 | |||
8 | $pod_type = pods_v( 'type', $pod ); |
||
9 | |||
10 | if ( 'taxonomy' == $pod[ 'type' ] && 'none' == $pod[ 'storage' ] && 1 == pods_v( 'enable_extra_fields' ) ) { |
||
11 | $api->save_pod( array( 'id' => $obj->id, 'storage' => 'table' ) ); |
||
12 | |||
13 | $pod = $api->load_pod( array( 'id' => $obj->id ) ); |
||
14 | |||
15 | unset( $_GET[ 'enable_extra_fields' ] ); |
||
16 | |||
17 | pods_message( __( 'Extra fields were successfully enabled for this Custom Taxonomy.', 'pods' ) ); |
||
18 | } |
||
19 | |||
20 | $field_types = PodsForm::field_types(); |
||
21 | |||
22 | $field_types_select = array(); |
||
23 | |||
24 | foreach ( $field_types as $type => $field_type_data ) { |
||
25 | /** |
||
26 | * @var $field_type PodsField |
||
27 | */ |
||
28 | $field_type = PodsForm::field_loader( $type, $field_type_data[ 'file' ] ); |
||
29 | |||
30 | $field_type_vars = get_class_vars( get_class( $field_type ) ); |
||
31 | |||
32 | if ( !isset( $field_type_vars[ 'pod_types' ] ) ) |
||
33 | $field_type_vars[ 'pod_types' ] = true; |
||
34 | |||
35 | // Only show supported field types |
||
36 | if ( true !== $field_type_vars[ 'pod_types' ] ) { |
||
37 | if ( empty( $field_type_vars[ 'pod_types' ] ) ) |
||
38 | continue; |
||
39 | elseif ( is_array( $field_type_vars[ 'pod_types' ] ) && !in_array( $pod_type, $field_type_vars[ 'pod_types' ], true ) ) |
||
40 | continue; |
||
41 | elseif ( !is_array( $field_type_vars[ 'pod_types' ] ) && $pod_type != $field_type_vars[ 'pod_types' ] ) |
||
42 | continue; |
||
43 | } |
||
44 | |||
45 | if ( !empty( PodsForm::$field_group ) ) { |
||
46 | if ( !isset( $field_types_select[ PodsForm::$field_group ] ) ) |
||
47 | $field_types_select[ PodsForm::$field_group ] = array(); |
||
48 | |||
49 | $field_types_select[ PodsForm::$field_group ][ $type ] = $field_type_data[ 'label' ]; |
||
50 | } |
||
51 | else { |
||
52 | if ( !isset( $field_types_select[ __( 'Other', 'pods' ) ] ) ) |
||
53 | $field_types_select[ __( 'Other', 'pods' ) ] = array(); |
||
54 | |||
55 | $field_types_select[ __( 'Other', 'pods' ) ][ $type ] = $field_type_data[ 'label' ]; |
||
56 | } |
||
57 | } |
||
58 | |||
59 | $field_defaults = array( |
||
60 | 'name' => 'new_field', |
||
61 | 'label' => 'New Field', |
||
62 | 'description' => '', |
||
63 | 'type' => 'text', |
||
64 | 'pick_object' => '', |
||
65 | 'sister_id' => '', |
||
66 | 'required' => 0, |
||
67 | 'unique' => 0, |
||
68 | ); |
||
69 | |||
70 | $pick_object = PodsForm::field_method( 'pick', 'related_objects', true ); |
||
71 | |||
72 | $tableless_field_types = PodsForm::tableless_field_types(); |
||
73 | $simple_tableless_objects = PodsForm::field_method( 'pick', 'simple_objects' ); |
||
74 | $bidirectional_objects = PodsForm::field_method( 'pick', 'bidirectional_objects' ); |
||
75 | |||
76 | foreach ( $pod[ 'options' ] as $_option => $_value ) { |
||
77 | $pod[ $_option ] = $_value; |
||
78 | } |
||
79 | |||
80 | foreach ( $pod[ 'fields' ] as $_field => $_data ) { |
||
81 | $_data[ 'options' ] = (array) $_data[ 'options' ]; |
||
82 | |||
83 | foreach ( $_data[ 'options' ] as $_option => $_value ) { |
||
84 | $pod[ 'fields' ][ $_field ][ $_option ] = $_value; |
||
85 | } |
||
86 | } |
||
87 | |||
88 | $field_defaults = apply_filters( 'pods_field_defaults', apply_filters( 'pods_field_defaults_' . $pod[ 'name' ], $field_defaults, $pod ) ); |
||
89 | |||
90 | $pick_table = pods_transient_get( 'pods_tables' ); |
||
91 | |||
92 | if ( empty( $pick_table ) ) { |
||
93 | $pick_table = array( |
||
94 | '' => __( '-- Select Table --', 'pods' ) |
||
95 | ); |
||
96 | |||
97 | global $wpdb; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
98 | |||
99 | $tables = $wpdb->get_results( "SHOW TABLES", ARRAY_N ); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
SHOW TABLES does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
100 | |||
101 | if ( !empty( $tables ) ) { |
||
102 | foreach ( $tables as $table ) { |
||
103 | $pick_table[ $table[ 0 ] ] = $table[ 0 ]; |
||
104 | } |
||
105 | } |
||
106 | |||
107 | pods_transient_set( 'pods_tables', $pick_table ); |
||
108 | } |
||
109 | |||
110 | $field_settings = array( |
||
111 | 'field_types_select' => $field_types_select, |
||
112 | 'field_defaults' => $field_defaults, |
||
113 | 'pick_object' => $pick_object, |
||
114 | 'pick_table' => $pick_table, |
||
115 | 'sister_id' => array( '' => __( 'No Related Fields Found', 'pods' ) ) |
||
116 | ); |
||
117 | |||
118 | $field_settings = apply_filters( 'pods_field_settings', apply_filters( 'pods_field_settings_' . $pod[ 'name' ], $field_settings, $pod ) ); |
||
119 | |||
120 | $pod[ 'fields' ] = apply_filters( 'pods_fields_edit', apply_filters( 'pods_fields_edit_' . $pod[ 'name' ], $pod[ 'fields' ], $pod ) ); |
||
121 | |||
122 | global $wpdb; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
123 | $max_length_name = 64; |
||
124 | $max_length_name -= 10; // Allow for WP Multisite or prefix changes in the future |
||
125 | $max_length_name -= strlen( $wpdb->prefix . 'pods_' ); |
||
126 | |||
127 | $tabs = PodsInit::$admin->admin_setup_edit_tabs( $pod ); |
||
128 | $tab_options = PodsInit::$admin->admin_setup_edit_options( $pod ); |
||
129 | |||
130 | $field_tabs = PodsInit::$admin->admin_setup_edit_field_tabs( $pod ); |
||
131 | $field_tab_options = PodsInit::$admin->admin_setup_edit_field_options( $pod ); |
||
132 | |||
133 | $no_additional = array(); |
||
134 | |||
135 | foreach ( $field_tab_options[ 'additional-field' ] as $field_type => $field_type_fields ) { |
||
136 | if ( empty( $field_type_fields ) ) |
||
137 | $no_additional[] = $field_type; |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * Make use of the WP core meta box functionality |
||
142 | * |
||
143 | * Currently only context 'side' is available |
||
144 | * |
||
145 | * @since 2.7 |
||
146 | * @see https://codex.wordpress.org/Plugin_API/Action_Reference/add_meta_boxes |
||
147 | * @param array $pod The Pod object as an array |
||
148 | */ |
||
149 | do_action( 'pods_add_meta_boxes', '_pods_pod', $pod ); |
||
150 | |||
151 | $pod_post = get_post( $pod['id'] ); |
||
152 | |||
153 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
||
154 | do_action( 'add_meta_boxes', $pod_post->post_type, $pod_post ); |
||
155 | ?> |
||
156 | <div class="wrap pods-admin"> |
||
157 | <div id="icon-pods" class="icon32"><br /></div> |
||
158 | <form action="" method="post" class="pods-submittable pods-nav-tabbed"> |
||
159 | <div class="pods-submittable-fields"> |
||
160 | <input type="hidden" name="action" value="pods_admin" /> |
||
161 | <input type="hidden" name="method" value="save_pod" /> |
||
162 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'pods-save_pod' ) ); ?>" /> |
||
163 | <input type="hidden" name="id" value="<?php echo esc_attr( (int) $pod[ 'id' ] ); ?>" /> |
||
164 | <input type="hidden" name="old_name" value="<?php echo esc_attr( $pod[ 'name' ] ); ?>" /> |
||
165 | |||
166 | <h2> |
||
167 | <?php esc_html_e( 'Edit Pod', 'pods' ); ?>: |
||
168 | <?php |
||
169 | if ( ( in_array( $pod[ 'type' ], array( 'post_type', 'taxonomy' ), true ) && !empty( $pod[ 'object' ] ) ) || in_array( $pod[ 'type' ], array( 'media', 'user', 'comment' ), true ) ) { |
||
170 | ?> |
||
171 | <em><?php echo esc_html( $pod[ 'name' ] ); ?></em> |
||
172 | <?php |
||
173 | } |
||
174 | else { |
||
175 | ?> |
||
176 | <span class="pods-sluggable"> |
||
177 | <span class="pods-slug"> |
||
178 | <em><?php echo esc_html( $pod[ 'name' ] ); ?></em> |
||
179 | <input type="button" class="edit-slug-button button" value="<?php esc_attr_e( 'Edit', 'pods' ); ?>" /> |
||
180 | </span> |
||
181 | <span class="pods-slug-edit"> |
||
182 | <?php echo PodsForm::field( 'name', pods_v( 'name', $pod ), 'db', array( |
||
183 | 'attributes' => array( |
||
0 ignored issues
–
show
|
|||
184 | 'maxlength' => $max_length_name, |
||
185 | 'size' => 25 |
||
186 | ), |
||
0 ignored issues
–
show
|
|||
187 | 'class' => 'pods-validate pods-validate-required' |
||
0 ignored issues
–
show
|
|||
188 | ) ); ?> |
||
0 ignored issues
–
show
|
|||
189 | <input type="button" class="save-button button" value="<?php esc_attr_e( 'OK', 'pods' ); ?>" /> <a class="cancel" href="#cancel-edit"><?php esc_html_e( 'Cancel', 'pods' ); ?></a> |
||
190 | </span> |
||
191 | </span> |
||
192 | <?php |
||
193 | } |
||
194 | ?> |
||
195 | </h2> |
||
196 | |||
197 | <?php |
||
198 | if ( !empty( $tabs ) ) { |
||
199 | ?> |
||
200 | |||
201 | <h2 class="nav-tab-wrapper pods-nav-tabs"> |
||
202 | <?php |
||
203 | $default = sanitize_title( pods_v( 'tab', 'get', 'manage-fields', null, true ) ); |
||
204 | |||
205 | if ( !isset( $tabs[ $default ] ) ) { |
||
206 | $tab_keys = array_keys( $tabs ); |
||
207 | |||
208 | $default = current( $tab_keys ); |
||
209 | } |
||
210 | |||
211 | foreach ( $tabs as $tab => $label ) { |
||
212 | if ( !in_array( $tab, array( 'manage-fields', 'labels', 'extra-fields' ), true ) && ( !isset( $tab_options[ $tab ] ) || empty( $tab_options[ $tab ] ) ) ) |
||
213 | continue; |
||
214 | |||
215 | $class = ''; |
||
216 | |||
217 | $tab = sanitize_title( $tab ); |
||
218 | |||
219 | if ( $tab == $default ) |
||
220 | $class = ' nav-tab-active'; |
||
221 | ?> |
||
222 | <a href="#pods-<?php echo esc_attr( $tab ); ?>" class="nav-tab<?php echo esc_attr( $class ); ?> pods-nav-tab-link"> |
||
223 | <?php echo $label; ?> |
||
224 | </a> |
||
225 | <?php |
||
226 | } |
||
227 | ?> |
||
228 | </h2> |
||
229 | <?php |
||
230 | } |
||
231 | ?> |
||
232 | </div> |
||
233 | |||
234 | <?php |
||
235 | if ( isset( $_GET[ 'do' ] ) ) { |
||
236 | $action = __( 'saved', 'pods' ); |
||
237 | |||
238 | $do = pods_v( 'do', 'get', 'save' ); |
||
239 | |||
240 | if ( 'create' == $do ) |
||
241 | $action = __( 'created', 'pods' ); |
||
242 | elseif ( 'duplicate' ==$do ) |
||
243 | $action = __( 'duplicated', 'pods' ); |
||
244 | |||
245 | $message = sprintf( __( '<strong>Success!</strong> %s %s successfully.', 'pods' ), $obj->item, $action ); |
||
246 | |||
247 | echo $obj->message( $message ); |
||
248 | } |
||
249 | ?> |
||
250 | |||
251 | <div id="poststuff"> |
||
252 | <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" /> |
||
253 | <!-- /inner-sidebar --> |
||
254 | <div id="post-body" class="meta-box-holder columns-2"> |
||
255 | <div id="post-body-content" class="pods-nav-tab-group"> |
||
256 | |||
257 | <?php |
||
258 | if ( isset( $tabs[ 'manage-fields' ] ) ) { |
||
259 | ?> |
||
260 | <div id="pods-manage-fields" class="pods-nav-tab"> |
||
261 | <p class="pods-manage-row-add pods-float-right"> |
||
262 | <a href="#add-field" class="button-primary"><?php _e( 'Add Field', 'pods' ); ?></a> |
||
263 | </p> |
||
264 | |||
265 | <?php |
||
266 | if ( !empty( $tabs ) ) |
||
267 | echo '<h2>' . __( 'Manage Fields', 'pods' ) . '</h2>'; |
||
268 | |||
269 | do_action( 'pods_admin_ui_setup_edit_fields', $pod, $obj ); |
||
270 | ?> |
||
271 | |||
272 | <!-- pods table --> |
||
273 | <table class="widefat fixed pages" cellspacing="0"> |
||
274 | <thead> |
||
275 | <tr> |
||
276 | <th scope="col" id="cb" class="manage-column field-cb check-column"> |
||
277 | <span> </span> |
||
278 | </th> |
||
279 | <th scope="col" id="label" class="manage-column field-label"> |
||
280 | <span><?php esc_html_e( 'Label', 'pods' ); pods_help( "<h6>" . __( 'Label', 'pods' ) . "</h6>" . __( 'The label is the descriptive name to identify the Pod field.', 'pods' ) ); ?></span> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
<h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
</h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
281 | </th> |
||
282 | <th scope="col" id="machine-name" class="manage-column field-machine-name"> |
||
283 | <span><?php esc_html_e( 'Name', 'pods' ); pods_help( "<h6>" . __( 'Name', 'pods' ) . "</h6>" . __( 'The name attribute is what is used to identify and access the Pod field programatically.', 'pods' ) ); ?></span> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
<h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
</h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
284 | </th> |
||
285 | <th scope="col" id="field-type" class="manage-column field-field-type"> |
||
286 | <span><?php esc_html_e( 'Field Type', 'pods' ); pods_help( "<h6>" . __( 'Field Type', 'pods' ) . "</h6>" . __( 'Field types are used to determine what kind of data will be stored in the Pod. They can range from, dates, text, files, etc.', 'pods' ) ); ?></span> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
<h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
</h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
287 | </th> |
||
288 | </tr> |
||
289 | </thead> |
||
290 | <tfoot> |
||
291 | <tr> |
||
292 | <th scope="col" class="manage-column field-cb check-column"> |
||
293 | <span> </span> |
||
294 | </th> |
||
295 | <th scope="col" class="manage-column field-label"> |
||
296 | <span><?php esc_html_e( 'Label', 'pods' ); pods_help( "<h6>" . __( 'Label', 'pods' ) . "</h6>" . __( 'The label is the descriptive name to identify the Pod field.', 'pods' ) ); ?></span> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
<h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
</h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
297 | </th> |
||
298 | <th scope="col" class="manage-column field-machine-name"> |
||
299 | <span><?php esc_html_e( 'Name', 'pods' ); pods_help( "<h6>" . __( 'Name', 'pods' ) . "</h6>" . __( 'The name attribute is what is used to identify and access the Pod field programatically.', 'pods' ) ); ?></span> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
<h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
</h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
300 | </th> |
||
301 | <th scope="col" class="manage-column field-field-type"> |
||
302 | <span><?php esc_html_e( 'Field Type', 'pods' ); pods_help( "<h6>" . __( 'Field Type', 'pods' ) . "</h6>" . __( 'Field types are used to determine what kind of data will be stored in the Pod. They can range from, dates, text, files, etc.', 'pods' ) ); ?></span> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
<h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
</h6> does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
303 | </th> |
||
304 | </tr> |
||
305 | </tfoot> |
||
306 | <tbody class="pods-manage-list"> |
||
307 | <?php |
||
308 | // Empty Row for Flexible functionality |
||
309 | $pods_i = '--1'; |
||
310 | |||
311 | $field = array( |
||
312 | 'id' => '__1', |
||
313 | 'name' => '', |
||
314 | 'label' => '', |
||
315 | 'type' => 'text' |
||
316 | ); |
||
317 | |||
318 | include PODS_DIR . 'ui/admin/setup-edit-field-fluid.php'; |
||
319 | |||
320 | $pods_i = 1; |
||
321 | |||
322 | foreach ( $pod[ 'fields' ] as $field ) { |
||
323 | include PODS_DIR . 'ui/admin/setup-edit-field.php'; |
||
324 | |||
325 | $pods_i++; |
||
326 | } |
||
327 | ?> |
||
328 | <tr class="no-items<?php echo esc_attr( 1 < $pods_i ? ' hidden' : '' ); ?>"> |
||
329 | <td class="colspanchange" colspan="4"><?php esc_html_e( 'No fields have been added yet', 'pods' ); ?></td> |
||
330 | </tr> |
||
331 | </tbody> |
||
332 | </table> |
||
333 | <!-- /pods table --> |
||
334 | <p class="pods-manage-row-add"> |
||
335 | <a href="#add-field" class="button-primary"><?php _e( 'Add Field', 'pods' ); ?></a> |
||
336 | </p> |
||
337 | </div> |
||
338 | <?php |
||
339 | } |
||
340 | |||
341 | $pods_tab_form = true; |
||
342 | |||
343 | if ( isset( $tabs[ 'labels' ] ) ) { |
||
344 | ?> |
||
345 | <div id="pods-labels" class="pods-nav-tab pods-manage-field pods-dependency pods-submittable-fields"> |
||
346 | <?php |
||
347 | |||
348 | $fields = $tab_options[ 'labels' ]; |
||
349 | $field_options = PodsForm::fields_setup( $fields ); |
||
350 | $field = $pod; |
||
351 | |||
352 | include PODS_DIR . 'ui/admin/field-option.php'; |
||
353 | |||
354 | ?> |
||
355 | </div> |
||
356 | <?php |
||
357 | } |
||
358 | |||
359 | if ( isset( $tabs[ 'advanced' ] ) ) { |
||
360 | ?> |
||
361 | <div id="pods-advanced" class="pods-nav-tab pods-manage-field pods-dependency pods-submittable-fields"> |
||
362 | <?php |
||
363 | if ( 'post_type' == $pod_type && strlen( pods_v( 'object', $pod ) ) < 1 ) { |
||
364 | $fields = $tab_options[ 'advanced' ]; |
||
365 | $field_options = PodsForm::fields_setup( $fields ); |
||
366 | $field = $pod; |
||
367 | |||
368 | include PODS_DIR . 'ui/admin/field-option.php'; |
||
369 | ?> |
||
370 | <div class="pods-field-option-group"> |
||
371 | <p class="pods-field-option-group-label"> |
||
372 | <?php _e( 'Supports', 'pods' ); ?> |
||
373 | </p> |
||
374 | |||
375 | <div class="pods-pick-values pods-pick-checkbox"> |
||
376 | <ul> |
||
377 | <li> |
||
378 | <div class="pods-field pods-boolean"> |
||
379 | <?php echo PodsForm::field( 'supports_title', pods_v( 'supports_title', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Title', 'pods' ) ) ); ?> |
||
380 | </div> |
||
381 | </li> |
||
382 | <li> |
||
383 | <div class="pods-field pods-boolean"> |
||
384 | <?php echo PodsForm::field( 'supports_editor', pods_v( 'supports_editor', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Editor', 'pods' ) ) ); ?> |
||
385 | </div> |
||
386 | </li> |
||
387 | <li> |
||
388 | <div class="pods-field pods-boolean"> |
||
389 | <?php echo PodsForm::field( 'supports_author', pods_v( 'supports_author', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Author', 'pods' ) ) ); ?> |
||
390 | </div> |
||
391 | </li> |
||
392 | <li> |
||
393 | <div class="pods-field pods-boolean"> |
||
394 | <?php echo PodsForm::field( 'supports_thumbnail', pods_v( 'supports_thumbnail', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Featured Image', 'pods' ), 'dependency' => true ) ); ?> |
||
395 | </div> |
||
396 | </li> |
||
397 | <li> |
||
398 | <div class="pods-field pods-boolean"> |
||
399 | <?php echo PodsForm::field( 'supports_excerpt', pods_v( 'supports_excerpt', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Excerpt', 'pods' ) ) ); ?> |
||
400 | </div> |
||
401 | </li> |
||
402 | <li> |
||
403 | <div class="pods-field pods-boolean"> |
||
404 | <?php echo PodsForm::field( 'supports_trackbacks', pods_v( 'supports_trackbacks', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Trackbacks', 'pods' ) ) ); ?> |
||
405 | </div> |
||
406 | </li> |
||
407 | <li> |
||
408 | <div class="pods-field pods-boolean"> |
||
409 | <?php echo PodsForm::field( 'supports_custom_fields', pods_v( 'supports_custom_fields', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Custom Fields', 'pods' ) ) ); ?> |
||
410 | </div> |
||
411 | </li> |
||
412 | <li> |
||
413 | <div class="pods-field pods-boolean"> |
||
414 | <?php echo PodsForm::field( 'supports_comments', pods_v( 'supports_comments', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Comments', 'pods' ) ) ); ?> |
||
415 | </div> |
||
416 | </li> |
||
417 | <li> |
||
418 | <div class="pods-field pods-boolean"> |
||
419 | <?php echo PodsForm::field( 'supports_revisions', pods_v( 'supports_revisions', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Revisions', 'pods' ) ) ); ?> |
||
420 | </div> |
||
421 | </li> |
||
422 | <li> |
||
423 | <div class="pods-field pods-boolean"> |
||
424 | <?php echo PodsForm::field( 'supports_page_attributes', pods_v( 'supports_page_attributes', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Page Attributes', 'pods' ) ) ); ?> |
||
425 | </div> |
||
426 | </li> |
||
427 | <li> |
||
428 | <div class="pods-field pods-boolean"> |
||
429 | <?php echo PodsForm::field( 'supports_post_formats', pods_v( 'supports_post_formats', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Post Formats', 'pods' ) ) ); ?> |
||
430 | </div> |
||
431 | </li> |
||
432 | |||
433 | <?php if ( function_exists( 'genesis' ) ) { ?> |
||
434 | <li> |
||
435 | <div class="pods-field pods-boolean"> |
||
436 | <?php echo PodsForm::field( 'supports_genesis_seo', pods_v( 'supports_genesis_seo', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Genesis: SEO', 'pods' ) ) ); ?> |
||
437 | </div> |
||
438 | </li> |
||
439 | <li> |
||
440 | <div class="pods-field pods-boolean"> |
||
441 | <?php echo PodsForm::field( 'supports_genesis_layouts', pods_v( 'supports_genesis_layouts', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Genesis: Layouts', 'pods' ) ) ); ?> |
||
442 | </div> |
||
443 | </li> |
||
444 | <li> |
||
445 | <div class="pods-field pods-boolean"> |
||
446 | <?php echo PodsForm::field( 'supports_genesis_simple_sidebars', pods_v( 'supports_genesis_simple_sidebars', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Genesis: Simple Sidebars', 'pods' ) ) ); ?> |
||
447 | </div> |
||
448 | </li> |
||
449 | <?php } ?> |
||
450 | |||
451 | <?php if ( defined( 'YARPP_VERSION' ) ) { ?> |
||
452 | <li> |
||
453 | <div class="pods-field pods-boolean"> |
||
454 | <?php echo PodsForm::field( 'supports_yarpp_support', pods_v( 'supports_yarpp_support', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'YARPP Support', 'pods' ) ) ); ?> |
||
455 | </div> |
||
456 | </li> |
||
457 | <?php } ?> |
||
458 | |||
459 | <?php if ( class_exists( 'Jetpack' ) ) { ?> |
||
460 | <li> |
||
461 | <div class="pods-field pods-boolean"> |
||
462 | <?php echo PodsForm::field( 'supports_jetpack_publicize', pods_v( 'supports_jetpack_publicize', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Jetpack Publicize Support', 'pods' ) ) ); ?> |
||
463 | </div> |
||
464 | </li> |
||
465 | <li> |
||
466 | <div class="pods-field pods-boolean"> |
||
467 | <?php echo PodsForm::field( 'supports_jetpack_markdown', pods_v( 'supports_jetpack_markdown', $pod, false ), 'boolean', array( 'boolean_yes_label' => __( 'Jetpack Markdown Support', 'pods' ) ) ); ?> |
||
468 | </div> |
||
469 | </li> |
||
470 | <?php } ?> |
||
471 | </ul> |
||
472 | </div> |
||
473 | </div> |
||
474 | <div class="pods-field-option"> |
||
475 | <?php echo PodsForm::label( 'supports_custom', __( 'Advanced Supports', 'pods' ), __( 'Comma-separated list of custom "supports" values to pass to register_post_type.', 'pods' ) ); ?> |
||
476 | <?php echo PodsForm::field( 'supports_custom', pods_v( 'supports_custom', $pod, '' ), 'text' ); ?> |
||
477 | </div> |
||
478 | <div class="pods-field-option-group"> |
||
479 | <p class="pods-field-option-group-label"> |
||
480 | <?php _e( 'Built-in Taxonomies', 'pods' ); ?> |
||
481 | </p> |
||
482 | |||
483 | <div class="pods-pick-values pods-pick-checkbox"> |
||
484 | <ul> |
||
485 | <?php |
||
486 | foreach ( (array) $field_settings[ 'pick_object' ][ __( 'Taxonomies', 'pods' ) ] as $taxonomy => $label ) { |
||
487 | $taxonomy = pods_str_replace( 'taxonomy-', '', $taxonomy, 1 ); |
||
488 | ?> |
||
489 | <li> |
||
490 | <div class="pods-field pods-boolean"> |
||
491 | <?php echo PodsForm::field( 'built_in_taxonomies_' . $taxonomy, pods_v( 'built_in_taxonomies_' . $taxonomy, $pod, false ), 'boolean', array( 'boolean_yes_label' => $label . ' <small>(' . $taxonomy . ')</small>' ) ); ?> |
||
492 | </div> |
||
493 | </li> |
||
494 | <?php |
||
495 | } |
||
496 | ?> |
||
497 | </ul> |
||
498 | </div> |
||
499 | </div> |
||
500 | <?php |
||
501 | } |
||
502 | elseif ( 'taxonomy' == $pod_type && strlen( pods_v( 'object', $pod ) ) < 1 ) { |
||
503 | $fields = $tab_options[ 'advanced' ]; |
||
504 | $field_options = PodsForm::fields_setup( $fields ); |
||
505 | $field = $pod; |
||
506 | |||
507 | include PODS_DIR . 'ui/admin/field-option.php'; |
||
508 | ?> |
||
509 | <div class="pods-field-option-group"> |
||
510 | <p class="pods-field-option-group-label"> |
||
511 | <?php _e( 'Associated Post Types', 'pods' ); ?> |
||
512 | </p> |
||
513 | |||
514 | <div class="pods-pick-values pods-pick-checkbox"> |
||
515 | <ul> |
||
516 | <?php |
||
517 | foreach ( (array) $field_settings[ 'pick_object' ][ __( 'Post Types', 'pods' ) ] as $post_type => $label ) { |
||
518 | $post_type = pods_str_replace( 'post_type-', '', $post_type, 1 ); |
||
519 | $label = str_replace( array( '(', ')' ), array( '<small>(', ')</small>' ), $label ); |
||
520 | ?> |
||
521 | <li> |
||
522 | <div class="pods-field pods-boolean"> |
||
523 | <?php echo PodsForm::field( 'built_in_post_types_' . $post_type, pods_v( 'built_in_post_types_' . $post_type, $pod, false ), 'boolean', array( 'boolean_yes_label' => $label ) ); ?> |
||
524 | </div> |
||
525 | </li> |
||
526 | <?php |
||
527 | } |
||
528 | ?> |
||
529 | <li> |
||
530 | <div class="pods-field pods-boolean"> |
||
531 | <?php echo PodsForm::field( 'built_in_post_types_attachment', pods_v( 'built_in_post_types_attachment', $pod, false ), 'boolean', array( 'boolean_yes_label' => 'Media <small>(attachment)</small>' ) ); ?> |
||
532 | </div> |
||
533 | </li> |
||
534 | </ul> |
||
535 | </div> |
||
536 | </div> |
||
537 | <?php |
||
538 | } |
||
539 | elseif ( 'pod' == $pod_type ) { |
||
540 | ?> |
||
541 | <div class="pods-field-option"> |
||
542 | <?php echo PodsForm::label( 'detail_url', __( 'Detail Page URL', 'pods' ), __( 'help', 'pods' ) ); ?> |
||
543 | <?php echo PodsForm::field( 'detail_url', pods_v( 'detail_url', $pod ), 'text' ); ?> |
||
544 | </div> |
||
545 | |||
546 | <?php |
||
547 | $index_fields = array( 'id' => 'ID' ); |
||
548 | |||
549 | foreach ( $pod[ 'fields' ] as $field ) { |
||
550 | if ( !in_array( $field[ 'type' ], $tableless_field_types, true ) ) |
||
551 | $index_fields[ $field[ 'name' ] ] = $field[ 'label' ]; |
||
552 | } |
||
553 | ?> |
||
554 | |||
555 | <div class="pods-field-option"> |
||
556 | <?php echo PodsForm::label( 'pod_index', __( 'Title Field', 'pods' ), __( 'If you delete the "name" field, we need to specify the field to use as your primary title field. This field will serve as an index of your content. Most commonly this field represents the name of a person, place, thing, or a summary field.', 'pods' ) ); ?> |
||
557 | <?php echo PodsForm::field( 'pod_index', pods_v( 'pod_index', $pod, 'name' ), 'pick', array( 'data' => $index_fields ) ); ?> |
||
558 | </div> |
||
559 | |||
560 | <div class="pods-field-option"> |
||
561 | <?php echo PodsForm::label( 'hierarchical', __( 'Hierarchical', 'pods' ), __( 'help', 'pods' ) ); ?> |
||
562 | <?php echo PodsForm::field( 'hierarchical', (int) pods_v( 'hierarchical', $pod, 0 ), 'boolean', array( 'dependency' => true, 'boolean_yes_label' => '' ) ); ?> |
||
563 | </div> |
||
564 | |||
565 | <?php |
||
566 | $hierarchical_fields = array(); |
||
567 | |||
568 | foreach ( $pod[ 'fields' ] as $field ) { |
||
569 | if ( 'pick' == $field[ 'type' ] && 'pod' == pods_v( 'pick_object', $field ) && $pod[ 'name' ] == pods_v( 'pick_val', $field ) && 'single' == pods_v( 'pick_format_type', $field[ 'options' ] ) ) |
||
570 | $hierarchical_fields[ $field[ 'name' ] ] = $field[ 'label' ]; |
||
571 | } |
||
572 | |||
573 | if ( empty( $hierarchical_fields ) ) |
||
574 | $hierarchical_fields = array( '' => __( 'No Hierarchical Fields found', 'pods' ) ); |
||
575 | ?> |
||
576 | |||
577 | <div class="pods-field-option pods-depends-on pods-depends-on-hierarchical"> |
||
578 | <?php echo PodsForm::label( 'pod_parent', __( 'Hierarchical Field', 'pods' ), __( 'help', 'pods' ) ); ?> |
||
579 | <?php echo PodsForm::field( 'pod_parent', pods_v( 'pod_parent', $pod, 'name' ), 'pick', array( 'data' => $hierarchical_fields ) ); ?> |
||
580 | </div> |
||
581 | |||
582 | <?php |
||
583 | if ( class_exists( 'Pods_Helpers' ) ) { |
||
584 | ?> |
||
585 | |||
586 | <div class="pods-field-option"> |
||
587 | <?php |
||
588 | $pre_save_helpers = array( '' => '-- Select --' ); |
||
589 | |||
590 | $helpers = $api->load_helpers( array( 'options' => array( 'helper_type' => 'pre_save' ) ) ); |
||
591 | |||
592 | foreach ( $helpers as $helper ) { |
||
593 | $pre_save_helpers[ $helper[ 'name' ] ] = $helper[ 'name' ]; |
||
594 | } |
||
595 | |||
596 | echo PodsForm::label( 'pre_save_helpers', __( 'Pre-Save Helper(s)', 'pods' ), __( 'help', 'pods' ) ); |
||
597 | echo PodsForm::field( 'pre_save_helpers', pods_v( 'pre_save_helpers', $pod ), 'pick', array( 'data' => $pre_save_helpers ) ); |
||
598 | ?> |
||
599 | </div> |
||
600 | <div class="pods-field-option"> |
||
601 | <?php |
||
602 | $post_save_helpers = array( '' => '-- Select --' ); |
||
603 | |||
604 | $helpers = $api->load_helpers( array( 'options' => array( 'helper_type' => 'post_save' ) ) ); |
||
605 | |||
606 | foreach ( $helpers as $helper ) { |
||
607 | $post_save_helpers[ $helper[ 'name' ] ] = $helper[ 'name' ]; |
||
608 | } |
||
609 | |||
610 | echo PodsForm::label( 'post_save_helpers', __( 'Post-Save Helper(s)', 'pods' ), __( 'help', 'pods' ) ); |
||
611 | echo PodsForm::field( 'post_save_helpers', pods_v( 'post_save_helpers', $pod ), 'pick', array( 'data' => $post_save_helpers ) ); |
||
612 | ?> |
||
613 | </div> |
||
614 | <div class="pods-field-option"> |
||
615 | <?php |
||
616 | $pre_delete_helpers = array( '' => '-- Select --' ); |
||
617 | |||
618 | $helpers = $api->load_helpers( array( 'options' => array( 'helper_type' => 'pre_delete' ) ) ); |
||
619 | |||
620 | foreach ( $helpers as $helper ) { |
||
621 | $pre_delete_helpers[ $helper[ 'name' ] ] = $helper[ 'name' ]; |
||
622 | } |
||
623 | |||
624 | echo PodsForm::label( 'pre_delete_helpers', __( 'Pre-Delete Helper(s)', 'pods' ), __( 'help', 'pods' ) ); |
||
625 | echo PodsForm::field( 'pre_delete_helpers', pods_v( 'pre_delete_helpers', $pod ), 'pick', array( 'data' => $pre_delete_helpers ) ); |
||
626 | ?> |
||
627 | </div> |
||
628 | <div class="pods-field-option"> |
||
629 | <?php |
||
630 | $post_delete_helpers = array( '' => '-- Select --' ); |
||
631 | |||
632 | $helpers = $api->load_helpers( array( 'options' => array( 'helper_type' => 'post_delete' ) ) ); |
||
633 | |||
634 | foreach ( $helpers as $helper ) { |
||
635 | $post_delete_helpers[ $helper[ 'name' ] ] = $helper[ 'name' ]; |
||
636 | } |
||
637 | |||
638 | echo PodsForm::label( 'post_delete_helpers', __( 'Post-Delete Helper(s)', 'pods' ), __( 'help', 'pods' ) ); |
||
639 | echo PodsForm::field( 'post_delete_helpers', pods_v( 'post_delete_helpers', $pod ), 'pick', array( 'data' => $post_delete_helpers ) ); |
||
640 | ?> |
||
641 | </div> |
||
642 | <?php |
||
643 | } |
||
644 | } |
||
645 | ?> |
||
646 | </div> |
||
647 | <?php |
||
648 | } |
||
649 | |||
650 | foreach ( $tabs as $tab => $tab_label ) { |
||
651 | $tab = sanitize_title( $tab ); |
||
652 | |||
653 | if ( in_array( $tab, array( 'manage-fields', 'labels', 'advanced', 'extra-fields' ), true ) || !isset( $tab_options[ $tab ] ) || empty( $tab_options[ $tab ] ) ) |
||
654 | continue; |
||
655 | ?> |
||
656 | <div id="pods-<?php echo esc_attr( $tab ); ?>" class="pods-nav-tab pods-manage-field pods-dependency pods-submittable-fields"> |
||
657 | <?php |
||
658 | $fields = $tab_options[ $tab ]; |
||
659 | $field_options = PodsForm::fields_setup( $fields ); |
||
660 | $field = $pod; |
||
661 | |||
662 | include PODS_DIR . 'ui/admin/field-option.php'; |
||
663 | ?> |
||
664 | </div> |
||
665 | <?php |
||
666 | } |
||
667 | |||
668 | if ( isset( $tabs[ 'extra-fields' ] ) ) { |
||
669 | ?> |
||
670 | <div id="pods-extra-fields" class="pods-nav-tab"> |
||
671 | <p><?php _e( 'Taxonomies do not support extra fields natively, but Pods can add this feature for you easily. Table based storage will operate in a way where each field you create for your content type becomes a field in a table.', 'pods' ); ?></p> |
||
672 | |||
673 | <p><?php echo sprintf( __( 'Enabling extra fields for this taxonomy will add a custom table into your database as <em>%s</em>.', 'pods' ), $wpdb->prefix . 'pods_' . pods_v( 'name', $pod ) ); ?></p> |
||
674 | |||
675 | <p><a href="https://pods.io/docs/comparisons/compare-storage-types/" target="_blank"><?php _e( 'Find out more', 'pods' ); ?> »</a></p> |
||
676 | |||
677 | <p class="submit"> |
||
678 | <a href="<?php echo esc_url( pods_query_arg( array( 'enable_extra_fields' => 1 ) ) ); ?>" class="button-primary"><?php _e( 'Enable Extra Fields', 'pods' ); ?></a> |
||
679 | </p> |
||
680 | </div> |
||
681 | <?php |
||
682 | } |
||
683 | ?> |
||
684 | </div> |
||
685 | <!-- /#post-body-content --> |
||
686 | |||
687 | <div id="postbox-container-1" class="postbox-container pods_floatmenu"> |
||
688 | <div id="side-info-field" class="inner-sidebar"> |
||
689 | <div id="side-sortables"> |
||
690 | <div id="submitdiv" class="postbox pods-no-toggle"> |
||
691 | <h3><span><?php esc_html_e( 'Manage', 'pods' ); ?> <small>(<a href="<?php echo esc_url( pods_query_arg( array( 'action' . $obj->num => 'manage', 'id' . $obj->num => '' ) ) ); ?>">« <?php _e( 'Back to Manage', 'pods' ); ?></a>) |
||
692 | </small></span></h3> |
||
693 | <div class="inside"> |
||
694 | <div class="submitbox" id="submitpost"> |
||
695 | <div id="major-publishing-actions"> |
||
696 | <div id="delete-action"> |
||
697 | <a href="<?php echo esc_url( pods_query_arg( array( 'action' . $obj->num => 'delete', '_wpnonce' => wp_create_nonce( 'pods-ui-action-delete' ) ) ) ); ?>" class="submitdelete deletion pods-confirm" data-confirm="<?php _e( 'Are you sure you want to delete this Pod? All fields and data will be removed.', 'pods' ); ?>"> <?php _e( 'Delete', 'pods' ); ?> Pod </a> |
||
698 | </div> |
||
699 | <div id="publishing-action"> |
||
700 | <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> |
||
701 | <button class="button-primary" type="submit"><?php esc_html_e( 'Save Pod', 'pods' ); ?></button> |
||
702 | </div> |
||
703 | <div class="clear"></div> |
||
704 | </div> |
||
705 | </div> |
||
706 | </div> |
||
707 | </div> |
||
708 | <!-- /#submitdiv --> |
||
709 | <div class="pods-submittable-fields"> |
||
710 | <?php do_meta_boxes( '_pods_pod', 'side', $pod_post ); ?> |
||
711 | </div> |
||
712 | </div> |
||
713 | </div> |
||
714 | </div> |
||
715 | </div> |
||
716 | <!-- /#post-body --> |
||
717 | </div> |
||
718 | <!-- /poststuff --> |
||
719 | </form> |
||
720 | </div> |
||
721 | <script type="text/javascript"> |
||
722 | <?php |
||
723 | $pods_field_types = array(); |
||
724 | |||
725 | foreach ( $field_types as $field_type => $field_type_data ) { |
||
726 | $pods_field_types[] = "'" . esc_js( $field_type ) . "' : '" . esc_js( $field_type_data[ 'label' ] ) . "'"; |
||
727 | } |
||
728 | |||
729 | $pods_pick_objects = array(); |
||
730 | |||
731 | $pick_object_singular = array( |
||
732 | __( 'Pods', 'pods' ) => __( 'Pod', 'pods' ), |
||
733 | __( 'Post Types', 'pods' ) => __( 'Post Type', 'pods' ), |
||
734 | __( 'Taxonomies', 'pods' ) => __( 'Taxonomy', 'pods' ) |
||
735 | ); |
||
736 | |||
737 | foreach ( $field_settings[ 'pick_object' ] as $object => $object_label ) { |
||
738 | if ( is_array( $object_label ) ) { |
||
739 | if ( isset( $pick_object_singular[ $object ] ) ) |
||
740 | $object = ' <small>(' . esc_js( $pick_object_singular[ $object ] ) . ')</small>'; |
||
741 | else |
||
742 | $object = ''; |
||
743 | |||
744 | foreach ( $object_label as $sub_object => $sub_object_label ) { |
||
745 | $pods_pick_objects[] = "'" . esc_js( $sub_object ) . "' : '" . esc_js( $sub_object_label ) . $object . "'"; |
||
746 | } |
||
747 | } |
||
748 | elseif ( '-- Select --' != $object_label ) |
||
749 | $pods_pick_objects[] = "'" . esc_js( $object ) . "' : '" . esc_js( $object_label ) . "'"; |
||
750 | } |
||
751 | ?> |
||
752 | var pods_field_types = { |
||
753 | <?php echo implode( ",\n ", $pods_field_types ); ?> |
||
754 | }; |
||
755 | var pods_pick_objects = { |
||
756 | <?php echo implode( ",\n ", $pods_pick_objects ); ?> |
||
757 | }; |
||
758 | |||
759 | jQuery( function ( $ ) { |
||
760 | $( document ).Pods( 'validate' ); |
||
761 | $( document ).Pods( 'submit' ); |
||
762 | $( document ).Pods( 'sluggable' ); |
||
763 | $( document ).Pods( 'sortable' ); |
||
764 | $( document ).Pods( 'collapsible', $( 'tbody.pods-manage-list tr.flexible-row div.pods-manage-field' ) ); |
||
765 | $( document ).Pods( 'toggled' ); |
||
766 | $( document ).Pods( 'tabbed' ); |
||
767 | $( document ).Pods( 'nav_tabbed' ); |
||
768 | $( document ).Pods( 'dependency' ); |
||
769 | $( document ).Pods( 'flexible', $( 'tbody.pods-manage-list tr.flexible-row' ) ); |
||
770 | $( document ).Pods( 'confirm' ); |
||
771 | $( document ).Pods( 'exit_confirm' ); |
||
772 | } ); |
||
773 | |||
774 | var pods_admin_submit_callback = function ( id ) { |
||
775 | id = parseInt( id ); |
||
776 | var thank_you = '<?php echo pods_slash( pods_query_arg( array( 'do' => 'save' ) ) ); ?>'; |
||
777 | |||
778 | document.location = thank_you.replace( 'X_ID_X', id ); |
||
779 | }; |
||
780 | |||
781 | var sisterFieldsProcessing = {}; |
||
782 | |||
783 | /*global PodsDFV */ |
||
784 | var pods_sister_field = function ( $el ) { |
||
785 | var postData, relatedPodName, selectedValue, $container; |
||
786 | var fieldModel, collection, selectField; |
||
787 | |||
788 | var id = $el.closest( 'tr.pods-manage-row' ).data( 'row' ); |
||
789 | var fieldKey = id + '_' + $el.prop( 'id' ); |
||
790 | |||
791 | if ( 'undefined' != typeof sisterFieldsProcessing[ fieldKey ] && true == sisterFieldsProcessing[ fieldKey ] ) { |
||
792 | return; |
||
793 | } |
||
794 | |||
795 | relatedPodName = jQuery( '#pods-form-ui-field-data-' + id + '-pick-object' ).val() + ''; |
||
796 | selectedValue = jQuery( '#pods-form-ui-field-data-' + id + '-sister-id' ).val() + ''; |
||
797 | $container = $el.find( '.pods-sister-field' ); |
||
798 | |||
799 | if ( 0 != relatedPodName.indexOf( 'pod-' ) |
||
800 | && 0 != relatedPodName.indexOf( 'post_type-' ) |
||
801 | && 0 != relatedPodName.indexOf( 'taxonomy-' ) |
||
802 | && 0 != relatedPodName.indexOf( 'user' ) |
||
803 | && 0 != relatedPodName.indexOf( 'media' ) |
||
804 | && 0 != relatedPodName.indexOf( 'comment' ) ) { |
||
805 | |||
806 | sisterFieldsProcessing[ fieldKey ] = false; |
||
807 | return; |
||
808 | } |
||
809 | |||
810 | sisterFieldsProcessing[ fieldKey ] = true; |
||
811 | |||
812 | fieldModel = new PodsDFV.models.PodsDFVFieldModel( { |
||
813 | htmlAttr: { |
||
814 | id : "pods-form-ui-field-data-" + id + "-sister-id", |
||
815 | "class" : "pods-form-ui-field pods-form-ui-field-type-pick pods-form-ui-field-name-field-data-sister-id", |
||
816 | name : "field_data[" + id + "][sister_id]", |
||
817 | name_clean: "field-data-sister-id" |
||
818 | } |
||
819 | } ); |
||
820 | |||
821 | collection = new PodsDFV.models.RelationshipCollection( { |
||
822 | id : "", |
||
823 | name: <?php echo json_encode( __( 'Loading available fields..', 'pods' ) ); ?> |
||
824 | } ); |
||
825 | |||
826 | selectField = new PodsDFV.fields.Pick( { |
||
827 | el : $container, |
||
828 | model : fieldModel, |
||
829 | collection: collection |
||
830 | } ); |
||
831 | |||
832 | selectField.render(); |
||
833 | |||
834 | postData = { |
||
835 | action : 'pods_admin', |
||
836 | method : 'load_sister_fields', |
||
837 | _wpnonce : '<?php echo esc_js( wp_create_nonce( 'pods-load_sister_fields' ) ); ?>', |
||
838 | pod : '<?php echo esc_js( pods_v( 'name', $pod ) ); ?>', |
||
839 | related_pod: relatedPodName |
||
840 | }; |
||
841 | |||
842 | jQuery.ajax( { |
||
843 | type : 'POST', |
||
844 | dataType: 'html', |
||
845 | url : ajaxurl + '?pods_ajax=1', |
||
846 | cache : false, |
||
847 | data : postData, |
||
848 | success : function ( d ) { |
||
849 | var json, newItems, fieldID, fieldName; |
||
850 | |||
851 | newItems = []; |
||
852 | |||
853 | if ( -1 == d.indexOf( '<e>' ) && -1 == d.indexOf('</e>') && -1 != d && '[]' != d ) { |
||
854 | |||
855 | json = d.match( /{.*}$/ ); |
||
856 | |||
857 | if ( null !== json && 0 < json.length ) { |
||
858 | json = jQuery.parseJSON( json[ 0 ] ); |
||
859 | } else { |
||
860 | json = {}; |
||
861 | } |
||
862 | |||
863 | if ( 'object' != typeof json || ! jQuery.isEmptyObject( json ) ) { |
||
864 | |||
865 | if ( 'object' != typeof json ) { |
||
866 | if ( window.console ) console.log( d ); |
||
867 | if ( window.console ) console.log( json ); |
||
868 | |||
869 | newItems.push( { |
||
870 | id: "", |
||
871 | name: <?php echo json_encode( __( 'There was a server error with your AJAX request.', 'pods' ) ); ?> |
||
872 | } ); |
||
873 | |||
874 | } else { |
||
875 | newItems.push( { |
||
876 | id : "", |
||
877 | name: <?php echo json_encode( __( '-- Select Related Field --', 'pods' ) ); ?> |
||
878 | } ); |
||
879 | |||
880 | for ( fieldID in json ) { |
||
881 | if ( json.hasOwnProperty( fieldID ) ) { |
||
882 | fieldName = json[ fieldID ]; |
||
883 | |||
884 | newItems.push( { |
||
885 | id : fieldID, |
||
886 | name : fieldName, |
||
887 | selected: (selectedValue == fieldID) |
||
888 | } ); |
||
889 | } |
||
890 | } |
||
891 | } |
||
892 | collection.reset( newItems ); |
||
893 | jQuery( '#pods-form-ui-field-data-' + id + '-sister-id' ).val( selectedValue ); |
||
894 | |||
895 | } else { |
||
896 | // None found |
||
897 | collection.reset( { |
||
898 | id : "", |
||
899 | name: <?php echo json_encode( __( 'No Related Fields Found', 'pods' ) ); ?> |
||
900 | } ); |
||
901 | } |
||
902 | |||
903 | } else { |
||
904 | // None found |
||
905 | collection.reset( { |
||
906 | id : "", |
||
907 | name: <?php echo json_encode( __( 'No Related Fields Found', 'pods' ) ); ?> |
||
908 | } ); |
||
909 | } |
||
910 | |||
911 | sisterFieldsProcessing[ fieldKey ] = false; |
||
912 | }, |
||
913 | error : function () { |
||
914 | // None found |
||
915 | collection.reset( { |
||
916 | id : "", |
||
917 | name: <?php echo json_encode( __( 'No Related Fields Found', 'pods' ) ); ?> |
||
918 | } ); |
||
919 | |||
920 | sisterFieldsProcessing[ fieldKey ] = false; |
||
921 | } |
||
922 | } ); |
||
923 | } |
||
924 | </script> |
||
925 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state