224 |
--------------------------------------------------------------------------------
/smashing-fields-approach-3/vendor/advanced-custom-fields/core/fields/page_link.php:
--------------------------------------------------------------------------------
1 | name = 'page_link';
18 | $this->label = __("Page Link",'acf');
19 | $this->category = __("Relational",'acf');
20 | $this->defaults = array(
21 | 'post_type' => array('all'),
22 | 'multiple' => 0,
23 | 'allow_null' => 0,
24 | );
25 |
26 |
27 | // do not delete!
28 | parent::__construct();
29 |
30 | }
31 |
32 |
33 | /*
34 | * load_field()
35 | *
36 | * This filter is appied to the $field after it is loaded from the database
37 | *
38 | * @type filter
39 | * @since 3.6
40 | * @date 23/01/13
41 | *
42 | * @param $field - the field array holding all the field options
43 | *
44 | * @return $field - the field array holding all the field options
45 | */
46 |
47 | function load_field( $field )
48 | {
49 |
50 | // validate post_type
51 | if( !$field['post_type'] || !is_array($field['post_type']) || in_array('', $field['post_type']) )
52 | {
53 | $field['post_type'] = array( 'all' );
54 | }
55 |
56 |
57 | // return
58 | return $field;
59 | }
60 |
61 |
62 | /*
63 | * create_field()
64 | *
65 | * Create the HTML interface for your field
66 | *
67 | * @param $field - an array holding all the field's data
68 | *
69 | * @type action
70 | * @since 3.6
71 | * @date 23/01/13
72 | */
73 |
74 | function create_field( $field )
75 | {
76 | // let post_object create the field
77 | $field['type'] = 'post_object';
78 |
79 | do_action('acf/create_field', $field );
80 | }
81 |
82 |
83 | /*
84 | * create_options()
85 | *
86 | * Create extra options for your field. This is rendered when editing a field.
87 | * The value of $field['name'] can be used (like bellow) to save extra data to the $field
88 | *
89 | * @type action
90 | * @since 3.6
91 | * @date 23/01/13
92 | *
93 | * @param $field - an array holding all the field's data
94 | */
95 |
96 | function create_options( $field )
97 | {
98 | $key = $field['name'];
99 |
100 | ?>
101 |
167 | $v )
203 | {
204 | $value[ $k ] = get_permalink($v);
205 | }
206 | }
207 | else
208 | {
209 | $value = get_permalink($value);
210 | }
211 |
212 | return $value;
213 | }
214 |
215 | }
216 |
217 | new acf_field_page_link();
218 |
219 | ?>
--------------------------------------------------------------------------------
/smashing-fields-approach-3/vendor/advanced-custom-fields/core/fields/password.php:
--------------------------------------------------------------------------------
1 | name = 'password';
19 | $this->label = __("Password",'acf');
20 | $this->defaults = array(
21 | 'placeholder' => '',
22 | 'prepend' => '',
23 | 'append' => ''
24 | );
25 |
26 |
27 | // do not delete!
28 | parent::__construct();
29 | }
30 |
31 |
32 | /*
33 | * create_field()
34 | *
35 | * Create the HTML interface for your field
36 | *
37 | * @param $field - an array holding all the field's data
38 | *
39 | * @type action
40 | * @since 3.6
41 | * @date 23/01/13
42 | */
43 |
44 | function create_field( $field )
45 | {
46 | // vars
47 | $o = array( 'id', 'class', 'name', 'value', 'placeholder' );
48 | $e = '';
49 |
50 |
51 | // prepend
52 | if( $field['prepend'] !== "" )
53 | {
54 | $field['class'] .= ' acf-is-prepended';
55 | $e .= '
' . $field['prepend'] . '
';
56 | }
57 |
58 |
59 | // append
60 | if( $field['append'] !== "" )
61 | {
62 | $field['class'] .= ' acf-is-appended';
63 | $e .= '
' . $field['append'] . '
';
68 | $e .= '
103 |
104 |
105 |
106 |
107 |
108 |
109 | 'text',
112 | 'name' => 'fields[' .$key.'][placeholder]',
113 | 'value' => $field['placeholder'],
114 | ));
115 | ?>
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 | 'text',
127 | 'name' => 'fields[' .$key.'][prepend]',
128 | 'value' => $field['prepend'],
129 | ));
130 | ?>
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 | 'text',
142 | 'name' => 'fields[' .$key.'][append]',
143 | 'value' => $field['append'],
144 | ));
145 | ?>
146 |
147 |
148 |
--------------------------------------------------------------------------------
/smashing-fields-approach-3/vendor/advanced-custom-fields/core/fields/radio.php:
--------------------------------------------------------------------------------
1 | name = 'radio';
18 | $this->label = __("Radio Button",'acf');
19 | $this->category = __("Choice",'acf');
20 | $this->defaults = array(
21 | 'layout' => 'vertical',
22 | 'choices' => array(),
23 | 'default_value' => '',
24 | 'other_choice' => 0,
25 | 'save_other_choice' => 0,
26 | );
27 |
28 |
29 | // do not delete!
30 | parent::__construct();
31 |
32 | }
33 |
34 |
35 | /*
36 | * create_field()
37 | *
38 | * Create the HTML interface for your field
39 | *
40 | * @param $field - an array holding all the field's data
41 | *
42 | * @type action
43 | * @since 3.6
44 | * @date 23/01/13
45 | */
46 |
47 | function create_field( $field )
48 | {
49 | // vars
50 | $i = 0;
51 | $e = '
';
110 |
111 | echo $e;
112 |
113 | }
114 |
115 |
116 | /*
117 | * create_options()
118 | *
119 | * Create extra options for your field. This is rendered when editing a field.
120 | * The value of $field['name'] can be used (like bellow) to save extra data to the $field
121 | *
122 | * @type action
123 | * @since 3.6
124 | * @date 23/01/13
125 | *
126 | * @param $field - an array holding all the field's data
127 | */
128 |
129 | function create_options( $field )
130 | {
131 | // vars
132 | $key = $field['name'];
133 |
134 | // implode checkboxes so they work in a textarea
135 | if( is_array($field['choices']) )
136 | {
137 | foreach( $field['choices'] as $k => $v )
138 | {
139 | $field['choices'][ $k ] = $k . ' : ' . $v;
140 | }
141 | $field['choices'] = implode("\n", $field['choices']);
142 | }
143 |
144 | ?>
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 | 'textarea',
162 | 'class' => 'textarea field_option-choices',
163 | 'name' => 'fields['.$key.'][choices]',
164 | 'value' => $field['choices'],
165 | ));
166 |
167 | ?>
168 |
169 | 'true_false',
173 | 'name' => 'fields['.$key.'][other_choice]',
174 | 'value' => $field['other_choice'],
175 | 'message' => __("Add 'other' choice to allow for custom values", 'acf')
176 | ));
177 |
178 | ?>
179 |
180 | style="display:none">
181 | 'true_false',
185 | 'name' => 'fields['.$key.'][save_other_choice]',
186 | 'value' => $field['save_other_choice'],
187 | 'message' => __("Save 'other' values to the field's choices", 'acf')
188 | ));
189 |
190 | ?>
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 | 'text',
203 | 'name' => 'fields['.$key.'][default_value]',
204 | 'value' => $field['default_value'],
205 | ));
206 |
207 | ?>
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 | 'radio',
219 | 'name' => 'fields['.$key.'][layout]',
220 | 'value' => $field['layout'],
221 | 'layout' => 'horizontal',
222 | 'choices' => array(
223 | 'vertical' => __("Vertical",'acf'),
224 | 'horizontal' => __("Horizontal",'acf')
225 | )
226 | ));
227 |
228 | ?>
229 |
230 |
231 |
--------------------------------------------------------------------------------
/smashing-fields-approach-3/vendor/advanced-custom-fields/core/fields/select.php:
--------------------------------------------------------------------------------
1 | name = 'select';
18 | $this->label = __("Select",'acf');
19 | $this->category = __("Choice",'acf');
20 | $this->defaults = array(
21 | 'multiple' => 0,
22 | 'allow_null' => 0,
23 | 'choices' => array(),
24 | 'default_value' => ''
25 | );
26 |
27 |
28 | // do not delete!
29 | parent::__construct();
30 |
31 |
32 | // extra
33 | //add_filter('acf/update_field/type=select', array($this, 'update_field'), 5, 2);
34 | add_filter('acf/update_field/type=checkbox', array($this, 'update_field'), 5, 2);
35 | add_filter('acf/update_field/type=radio', array($this, 'update_field'), 5, 2);
36 | }
37 |
38 |
39 | /*
40 | * create_field()
41 | *
42 | * Create the HTML interface for your field
43 | *
44 | * @param $field - an array holding all the field's data
45 | *
46 | * @type action
47 | * @since 3.6
48 | * @date 23/01/13
49 | */
50 |
51 | function create_field( $field )
52 | {
53 | // vars
54 | $optgroup = false;
55 |
56 |
57 | // determin if choices are grouped (2 levels of array)
58 | if( is_array($field['choices']) )
59 | {
60 | foreach( $field['choices'] as $k => $v )
61 | {
62 | if( is_array($v) )
63 | {
64 | $optgroup = true;
65 | }
66 | }
67 | }
68 |
69 |
70 | // value must be array
71 | if( !is_array($field['value']) )
72 | {
73 | // perhaps this is a default value with new lines in it?
74 | if( strpos($field['value'], "\n") !== false )
75 | {
76 | // found multiple lines, explode it
77 | $field['value'] = explode("\n", $field['value']);
78 | }
79 | else
80 | {
81 | $field['value'] = array( $field['value'] );
82 | }
83 | }
84 |
85 |
86 | // trim value
87 | $field['value'] = array_map('trim', $field['value']);
88 |
89 |
90 | // multiple select
91 | $multiple = '';
92 | if( $field['multiple'] )
93 | {
94 | // create a hidden field to allow for no selections
95 | echo '
';
96 |
97 | $multiple = ' multiple="multiple" size="5" ';
98 | $field['name'] .= '[]';
99 | }
100 |
101 |
102 | // html
103 | echo '
';
104 |
105 |
106 | // null
107 | if( $field['allow_null'] )
108 | {
109 | echo '- ' . __("Select",'acf') . ' - ';
110 | }
111 |
112 | // loop through values and add them as options
113 | if( is_array($field['choices']) )
114 | {
115 | foreach( $field['choices'] as $key => $value )
116 | {
117 | if( $optgroup )
118 | {
119 | // this select is grouped with optgroup
120 | if($key != '') echo '';
121 |
122 | if( is_array($value) )
123 | {
124 | foreach($value as $id => $label)
125 | {
126 | $selected = in_array($id, $field['value']) ? 'selected="selected"' : '';
127 |
128 | echo ''.$label.' ';
129 | }
130 | }
131 |
132 | if($key != '') echo ' ';
133 | }
134 | else
135 | {
136 | $selected = in_array($key, $field['value']) ? 'selected="selected"' : '';
137 | echo ''.$value.' ';
138 | }
139 | }
140 | }
141 |
142 | echo ' ';
143 | }
144 |
145 |
146 | /*
147 | * create_options()
148 | *
149 | * Create extra options for your field. This is rendered when editing a field.
150 | * The value of $field['name'] can be used (like bellow) to save extra data to the $field
151 | *
152 | * @type action
153 | * @since 3.6
154 | * @date 23/01/13
155 | *
156 | * @param $field - an array holding all the field's data
157 | */
158 |
159 | function create_options( $field )
160 | {
161 | $key = $field['name'];
162 |
163 |
164 | // implode choices so they work in a textarea
165 | if( is_array($field['choices']) )
166 | {
167 | foreach( $field['choices'] as $k => $v )
168 | {
169 | $field['choices'][ $k ] = $k . ' : ' . $v;
170 | }
171 | $field['choices'] = implode("\n", $field['choices']);
172 | }
173 |
174 | ?>
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 | 'textarea',
187 | 'class' => 'textarea field_option-choices',
188 | 'name' => 'fields['.$key.'][choices]',
189 | 'value' => $field['choices'],
190 | ));
191 |
192 | ?>
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 | 'textarea',
205 | 'name' => 'fields['.$key.'][default_value]',
206 | 'value' => $field['default_value'],
207 | ));
208 |
209 | ?>
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 | 'radio',
220 | 'name' => 'fields['.$key.'][allow_null]',
221 | 'value' => $field['allow_null'],
222 | 'choices' => array(
223 | 1 => __("Yes",'acf'),
224 | 0 => __("No",'acf'),
225 | ),
226 | 'layout' => 'horizontal',
227 | ));
228 | ?>
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 | 'radio',
239 | 'name' => 'fields['.$key.'][multiple]',
240 | 'value' => $field['multiple'],
241 | 'choices' => array(
242 | 1 => __("Yes",'acf'),
243 | 0 => __("No",'acf'),
244 | ),
245 | 'layout' => 'horizontal',
246 | ));
247 | ?>
248 |
249 |
250 | value
331 | foreach($field['choices'] as $choice)
332 | {
333 | if(strpos($choice, ' : ') !== false)
334 | {
335 | $choice = explode(' : ', $choice);
336 | $new_choices[ trim($choice[0]) ] = trim($choice[1]);
337 | }
338 | else
339 | {
340 | $new_choices[ trim($choice) ] = trim($choice);
341 | }
342 | }
343 | }
344 |
345 |
346 | // update choices
347 | $field['choices'] = $new_choices;
348 |
349 |
350 | return $field;
351 | }
352 |
353 | }
354 |
355 | new acf_field_select();
356 |
357 | ?>
358 |
--------------------------------------------------------------------------------
/smashing-fields-approach-3/vendor/advanced-custom-fields/core/fields/tab.php:
--------------------------------------------------------------------------------
1 | name = 'tab';
19 | $this->label = __("Tab",'acf');
20 | $this->category = __("Layout",'acf');
21 |
22 |
23 | // do not delete!
24 | parent::__construct();
25 | }
26 |
27 |
28 | /*
29 | * create_field()
30 | *
31 | * Create the HTML interface for your field
32 | *
33 | * @param $field - an array holding all the field's data
34 | *
35 | * @type action
36 | * @since 3.6
37 | * @date 23/01/13
38 | */
39 |
40 | function create_field( $field )
41 | {
42 | echo '
' . $field['label'] . '
';
43 | }
44 |
45 |
46 |
47 | /*
48 | * create_options()
49 | *
50 | * Create extra options for your field. This is rendered when editing a field.
51 | * The value of $field['name'] can be used (like bellow) to save extra data to the $field
52 | *
53 | * @param $field - an array holding all the field's data
54 | *
55 | * @type action
56 | * @since 3.6
57 | * @date 23/01/13
58 | */
59 |
60 | function create_options( $field )
61 | {
62 | ?>
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/smashing-fields-approach-3/vendor/advanced-custom-fields/core/fields/text.php:
--------------------------------------------------------------------------------
1 | name = 'text';
19 | $this->label = __("Text",'acf');
20 | $this->defaults = array(
21 | 'default_value' => '',
22 | 'formatting' => 'html',
23 | 'maxlength' => '',
24 | 'placeholder' => '',
25 | 'prepend' => '',
26 | 'append' => ''
27 | );
28 |
29 |
30 | // do not delete!
31 | parent::__construct();
32 | }
33 |
34 |
35 |
36 | /*
37 | * create_field()
38 | *
39 | * Create the HTML interface for your field
40 | *
41 | * @param $field - an array holding all the field's data
42 | *
43 | * @type action
44 | * @since 3.6
45 | * @date 23/01/13
46 | */
47 |
48 | function create_field( $field )
49 | {
50 | // vars
51 | $o = array( 'id', 'class', 'name', 'value', 'placeholder' );
52 | $e = '';
53 |
54 |
55 | // maxlength
56 | if( $field['maxlength'] !== "" )
57 | {
58 | $o[] = 'maxlength';
59 | }
60 |
61 |
62 | // prepend
63 | if( $field['prepend'] !== "" )
64 | {
65 | $field['class'] .= ' acf-is-prepended';
66 | $e .= '
' . $field['prepend'] . '
';
67 | }
68 |
69 |
70 | // append
71 | if( $field['append'] !== "" )
72 | {
73 | $field['class'] .= ' acf-is-appended';
74 | $e .= '
' . $field['append'] . '
';
75 | }
76 |
77 |
78 | $e .= '