1
|
|
|
<?php |
2
|
|
|
$field = array_merge( $field_settings['field_defaults'], $field ); |
3
|
|
|
|
4
|
|
|
// Migrate pick object when saving |
5
|
|
|
if ( 'pod' == pods_v_sanitized( 'pick_object', $field ) ) { |
6
|
|
|
if ( isset( PodsMeta::$post_types[ $field['pick_val'] ] ) ) { |
7
|
|
|
$field['pick_object'] = 'post_type'; |
8
|
|
|
} elseif ( isset( PodsMeta::$taxonomies[ $field['pick_val'] ] ) ) { |
9
|
|
|
$field['pick_object'] = 'taxonomy'; |
10
|
|
|
} elseif ( 'user' === $field['pick_val'] && ! empty( PodsMeta::$user ) ) { |
11
|
|
|
$field['pick_object'] = 'user'; |
12
|
|
|
$field['pick_val'] = ''; |
13
|
|
|
} elseif ( 'comment' === $field['pick_val'] && ! empty( PodsMeta::$comment ) ) { |
14
|
|
|
$field['pick_object'] = 'comment'; |
15
|
|
|
$field['pick_val'] = ''; |
16
|
|
|
} elseif ( 'media' === $field['pick_val'] && ! empty( PodsMeta::$media ) ) { |
17
|
|
|
$field['pick_object'] = 'media'; |
18
|
|
|
$field['pick_val'] = ''; |
19
|
|
|
} |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
$ignored_pick_objects = apply_filters( '', array( 'table' ) ); |
23
|
|
|
|
24
|
|
|
if ( ! in_array( pods_v_sanitized( 'pick_object', $field ), $ignored_pick_objects, true ) ) { |
25
|
|
|
// Set pick object |
26
|
|
|
$field['pick_object'] = trim( pods_v_sanitized( 'pick_object', $field ) . '-' . pods_v_sanitized( 'pick_val', $field ), '-' ); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
// Unset pick_val for the field to be used above |
30
|
|
|
if ( isset( $field['pick_val'] ) ) { |
31
|
|
|
unset( $field['pick_val'] ); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
// Remove weight as we're going to allow reordering here |
35
|
|
|
unset( $field['weight'], $field['options'], $field['table_info'] ); |
36
|
|
|
|
37
|
|
|
// Remove options, we don't need it in the JSON |
38
|
|
|
$data = array( |
39
|
|
|
'row' => $pods_i, |
40
|
|
|
); |
41
|
|
|
?> |
42
|
|
|
<tr id="row-<?php echo esc_attr( $pods_i ); ?>" class="pods-manage-row pods-field-init pods-field-<?php echo esc_attr( pods_v_sanitized( 'name', $field ) ) . ( '--1' === $pods_i ? ' flexible-row' : ' pods-submittable-fields' ); ?>" valign="top"<?php PodsForm::data( $data ); ?>> |
43
|
|
|
<th scope="row" class="check-field pods-manage-sort"> |
44
|
|
|
<img src="<?php echo esc_url( PODS_URL ); ?>ui/images/handle.gif" alt="<?php esc_attr_e( 'Move', 'pods' ); ?>" /> |
45
|
|
|
</th> |
46
|
|
|
<td class="pods-manage-row-label"> |
47
|
|
|
<strong> |
48
|
|
|
<a class="pods-manage-row-edit row-label" title="<?php esc_attr_e( 'Edit this field', 'pods' ); ?>" href="#edit-field"> |
49
|
|
|
<?php echo esc_html( pods_v( 'label', $field ) ); ?> |
50
|
|
|
</a> |
51
|
|
|
<abbr title="required" class="required<?php echo esc_attr( 1 == pods_v( 'required', $field ) ? '' : ' hidden' ); ?>">*</abbr> |
52
|
|
|
</strong> |
53
|
|
|
|
54
|
|
|
<?php |
55
|
|
|
if ( '__1' != pods_v_sanitized( 'id', $field ) ) { |
56
|
|
|
?> |
57
|
|
|
<span class="pods-manage-row-more"> |
58
|
|
|
[id: <?php echo esc_html( pods_v_sanitized( 'id', $field ) ); ?>] |
59
|
|
|
</span> |
60
|
|
|
<?php |
61
|
|
|
} |
62
|
|
|
?> |
63
|
|
|
|
64
|
|
|
<div class="row-actions"> |
65
|
|
|
<span class="edit"> |
66
|
|
|
<a title="<?php esc_attr_e( 'Edit this field', 'pods' ); ?>" class="pods-manage-row-edit" href="#edit-field"><?php _e( 'Edit', 'pods' ); ?></a> | |
67
|
|
|
</span> <span class="duplicate"> |
68
|
|
|
<a title="<?php esc_attr_e( 'Duplicate this field', 'pods' ); ?>" class="pods-manage-row-duplicate" href="#duplicate-field"><?php _e( 'Duplicate', 'pods' ); ?></a> | |
69
|
|
|
</span> <span class="trash pods-manage-row-delete"> |
70
|
|
|
<a class="submitdelete" title="<?php esc_attr_e( 'Delete this field', 'pods' ); ?>" href="#delete-field"><?php _e( 'Delete', 'pods' ); ?></a> |
71
|
|
|
</span> |
72
|
|
|
</div> |
73
|
|
|
<div class="pods-manage-row-wrapper" id="pods-manage-field-<?php echo esc_attr( $pods_i ); ?>"> |
74
|
|
|
<input type="hidden" name="field_data_json[<?php echo esc_attr( $pods_i ); ?>]" value="<?php echo esc_attr( ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ? json_encode( $field, JSON_UNESCAPED_UNICODE ) : json_encode( $field ) ) ); ?>" class="field_data" /> |
|
|
|
|
75
|
|
|
|
76
|
|
|
<div class="pods-manage-field pods-dependency"> |
77
|
|
|
<input type="hidden" name="field_data[<?php echo esc_attr( $pods_i ); ?>][id]" value="<?php echo esc_attr( pods_v( 'id', $field ) ); ?>" /> |
78
|
|
|
<div> |
79
|
|
|
</div> |
80
|
|
|
</td> |
81
|
|
|
<td class="pods-manage-row-name"> |
82
|
|
|
<a title="Edit this field" class="pods-manage-row-edit row-name" href="#edit-field"><?php echo esc_html( pods_v( 'name', $field ) ); ?></a> |
83
|
|
|
</td> |
84
|
|
|
<td class="pods-manage-row-type"> |
85
|
|
|
<?php |
86
|
|
|
$type = 'Unknown'; |
87
|
|
|
|
88
|
|
|
if ( isset( $field_types[ pods_v_sanitized( 'type', $field ) ] ) ) { |
89
|
|
|
$type = $field_types[ pods_v_sanitized( 'type', $field ) ]['label']; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
echo esc_html( $type ) . ' <span class="pods-manage-row-more">[type: ' . pods_v_sanitized( 'type', $field ) . ']</span>'; |
93
|
|
|
|
94
|
|
|
$pick_object = trim( pods_v_sanitized( 'pick_object', $field ) . '-' . pods_v_sanitized( 'pick_val', $field ), '-' ); |
95
|
|
|
|
96
|
|
|
if ( 'pick' == pods_v_sanitized( 'type', $field ) && '' != pods_v_sanitized( 'pick_object', $field, '' ) ) { |
97
|
|
|
$pick_object_name = null; |
98
|
|
|
|
99
|
|
|
foreach ( $field_settings['pick_object'] as $object => $object_label ) { |
100
|
|
|
if ( null !== $pick_object_name ) { |
101
|
|
|
break; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
if ( '-- Select --' === $object_label ) { |
105
|
|
|
continue; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
if ( is_array( $object_label ) ) { |
109
|
|
|
foreach ( $object_label as $sub_object => $sub_object_label ) { |
110
|
|
|
if ( $pick_object === $sub_object ) { |
111
|
|
|
$ies = strlen( $object ) - 3; |
112
|
|
|
|
113
|
|
|
if ( $ies === strpos( $object, 'ies' ) ) { |
114
|
|
|
$object = substr( $object, 0, $ies ) . 'y'; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
$object = rtrim( $object, 's' ); |
118
|
|
|
|
119
|
|
|
$pick_object_name = esc_html( $sub_object_label ) . ' <small>(' . esc_html( $object ) . ')</small>'; |
120
|
|
|
|
121
|
|
|
break; |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
} elseif ( pods_v_sanitized( 'pick_object', $field ) === $object ) { |
125
|
|
|
$pick_object_name = $object_label; |
126
|
|
|
|
127
|
|
|
break; |
128
|
|
|
}//end if |
129
|
|
|
}//end foreach |
130
|
|
|
|
131
|
|
|
if ( null === $pick_object_name ) { |
132
|
|
|
$pick_object_name = ucwords( str_replace( array( '-', '_' ), ' ', pods_v( 'pick_object', $field ) ) ); |
133
|
|
|
|
134
|
|
|
if ( 0 < strlen( pods_v( 'pick_val', $field ) ) ) { |
135
|
|
|
$pick_object_name = pods_v( 'pick_val', $field ) . ' (' . $pick_object_name . ')'; |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
?> |
139
|
|
|
<br /><span class="pods-manage-field-type-desc">› <?php echo $pick_object_name; ?></span> |
140
|
|
|
<?php |
141
|
|
|
}//end if |
142
|
|
|
?> |
143
|
|
|
</td> |
144
|
|
|
</tr> |
145
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.