div { display:inline-block; margin:0; }
25 | .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
26 | .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
27 | .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
28 | .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
29 | .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
30 | .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.min.css:
--------------------------------------------------------------------------------
1 | /*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
2 | * http://trentrichardson.com/examples/timepicker
3 | * Copyright (c) 2016 Trent Richardson; Licensed MIT */
4 |
5 | .ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{float:left;clear:left;padding:0 0 0 5px}.ui-timepicker-div dl dd{margin:0 10px 10px 40%}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0 0;border:0;margin:0;padding:0}.ui-timepicker-div .ui_tpicker_unit_hide{display:none}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input{background:0 0;color:inherit;border:0;outline:0;border-bottom:solid 1px #555;width:95%}.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus{border-bottom-color:#aaa}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right;padding:0 5px 0 0}.ui-timepicker-rtl dl dt{float:right;clear:right}.ui-timepicker-rtl dl dd{margin:0 40% 10px 10px}.ui-timepicker-div.ui-timepicker-oneLine{padding-right:2px}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,.ui-timepicker-div.ui-timepicker-oneLine dt{display:none}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label{display:block;padding-top:2px}.ui-timepicker-div.ui-timepicker-oneLine dl{text-align:right}.ui-timepicker-div.ui-timepicker-oneLine dl dd,.ui-timepicker-div.ui-timepicker-oneLine dl dd>div{display:inline-block;margin:0}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before{content:':';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before{content:'.';display:inline-block}.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{display:none}
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/acf-post-functions.php:
--------------------------------------------------------------------------------
1 | templates data.
7 | *
8 | * @date 29/8/17
9 | * @since 5.6.2
10 | *
11 | * @param void
12 | * @return array
13 | */
14 | function acf_get_post_templates() {
15 |
16 | // Defaults.
17 | $post_templates = array(
18 | 'page' => array()
19 | );
20 |
21 | // Loop over post types and append their templates.
22 | if( method_exists('WP_Theme', 'get_page_templates') ) {
23 | $post_types = acf_get_post_types();
24 | foreach( $post_types as $post_type ) {
25 | $templates = wp_get_theme()->get_page_templates( null, $post_type );
26 | if( $templates ) {
27 | $post_templates[ $post_type ] = $templates;
28 | }
29 | }
30 | }
31 |
32 | // Return.
33 | return $post_templates;
34 | }
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/acf-user-functions.php:
--------------------------------------------------------------------------------
1 | $user ) {
25 | $order[ $i ] = array_search($user->ID, $args['include']);
26 | }
27 |
28 | // Sort results.
29 | array_multisort($order, $users);
30 | }
31 |
32 | // Return
33 | return $users;
34 | }
35 |
36 | /**
37 | * acf_get_user_result
38 | *
39 | * Returns a result containing "id" and "text" for the given user.
40 | *
41 | * @date 21/5/19
42 | * @since 5.8.1
43 | *
44 | * @param WP_User $user The user object.
45 | * @return array
46 | */
47 | function acf_get_user_result( $user ) {
48 |
49 | // Vars.
50 | $id = $user->ID;
51 | $text = $user->user_login;
52 |
53 | // Add name.
54 | if( $user->first_name && $user->last_name ) {
55 | $text .= " ({$user->first_name} {$user->last_name})";
56 | } elseif( $user->last_name ) {
57 | $text .= " ({$user->first_name})";
58 | }
59 | return compact('id', 'text');
60 | }
61 |
62 |
63 | /**
64 | * acf_get_user_role_labels
65 | *
66 | * Returns an array of user roles in the format "name => label".
67 | *
68 | * @date 20/5/19
69 | * @since 5.8.1
70 | *
71 | * @param array $roles A specific array of roles.
72 | * @return array
73 | */
74 | function acf_get_user_role_labels( $roles = array() ) {
75 |
76 | // Load all roles if none provided.
77 | if( !$roles ) {
78 | $roles = get_editable_roles();
79 | }
80 |
81 | // Loop over roles and populare labels.
82 | $lables = array();
83 | foreach( $roles as $role ) {
84 | $lables[ $role ] = translate_user_role( $role );
85 | }
86 |
87 | // Return labels.
88 | return $lables;
89 | }
90 |
91 | /**
92 | * acf_allow_unfiltered_html
93 | *
94 | * Returns true if the current user is allowed to save unfiltered HTML.
95 | *
96 | * @date 9/1/19
97 | * @since 5.7.10
98 | *
99 | * @param void
100 | * @return bool
101 | */
102 | function acf_allow_unfiltered_html() {
103 |
104 | // Check capability.
105 | $allow_unfiltered_html = current_user_can('unfiltered_html');
106 |
107 | /**
108 | * Filters whether the current user is allowed to save unfiltered HTML.
109 | *
110 | * @date 9/1/19
111 | * @since 5.7.10
112 | *
113 | * @param bool allow_unfiltered_html The result.
114 | */
115 | return apply_filters( 'acf/allow_unfiltered_html', $allow_unfiltered_html );
116 | }
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-notices.php:
--------------------------------------------------------------------------------
1 | '',
34 |
35 | /** @type string Optional HTML alternative to text.
36 | 'html' => '', */
37 |
38 | /** @type string The type of notice (warning, error, success, info). */
39 | 'type' => 'info',
40 |
41 | /** @type bool If the notice can be dismissed. */
42 | 'dismissible' => true,
43 | );
44 |
45 | /**
46 | * render
47 | *
48 | * Renders the notice HTML.
49 | *
50 | * @date 27/12/18
51 | * @since 5.8.0
52 | *
53 | * @param void
54 | * @return void
55 | */
56 | function render() {
57 |
58 | // Ensure text contains punctuation.
59 | // todo: Remove this after updating translations.
60 | $text = $this->get('text');
61 | if( substr($text, -1) !== '.' && substr($text, -1) !== '>' ) {
62 | $text .= '.';
63 | }
64 |
65 | // Print HTML.
66 | printf('%s
',
67 |
68 | // Type class.
69 | $this->get('type'),
70 |
71 | // Dismissible class.
72 | $this->get('dismissible') ? 'is-dismissible' : '',
73 |
74 | // InnerHTML
75 | $this->has('html') ? $this->get('html') : wpautop($text)
76 | );
77 | }
78 | }
79 |
80 | endif; // class_exists check
81 |
82 | /**
83 | * acf_new_admin_notice
84 | *
85 | * Instantiates and returns a new model.
86 | *
87 | * @date 23/12/18
88 | * @since 5.8.0
89 | *
90 | * @param array $data Optional data to set.
91 | * @return ACF_Admin_Notice
92 | */
93 | function acf_new_admin_notice( $data = false ) {
94 |
95 | // Create notice.
96 | $instance = new ACF_Admin_Notice( $data );
97 |
98 | // Register notice.
99 | acf_get_store( 'notices' )->set( $instance->cid, $instance );
100 |
101 | // Return notice.
102 | return $instance;
103 | }
104 |
105 | /**
106 | * acf_render_admin_notices
107 | *
108 | * Renders all admin notices HTML.
109 | *
110 | * @date 10/1/19
111 | * @since 5.7.10
112 | *
113 | * @param void
114 | * @return void
115 | */
116 | function acf_render_admin_notices() {
117 |
118 | // Get notices.
119 | $notices = acf_get_store( 'notices' )->get_data();
120 |
121 | // Loop over notices and render.
122 | if( $notices ) {
123 | foreach( $notices as $notice ) {
124 | $notice->render();
125 | }
126 | }
127 | }
128 |
129 | // Render notices during admin action.
130 | add_action('admin_notices', 'acf_render_admin_notices', 99);
131 |
132 | /**
133 | * acf_add_admin_notice
134 | *
135 | * Creates and returns a new notice.
136 | *
137 | * @date 17/10/13
138 | * @since 5.0.0
139 | *
140 | * @param string $text The admin notice text.
141 | * @param string $class The type of notice (warning, error, success, info).
142 | * @return ACF_Admin_Notice
143 | */
144 | function acf_add_admin_notice( $text = '', $type = 'info' ) {
145 | return acf_new_admin_notice( array( 'text' => $text, 'type' => $type ) );
146 | }
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin.php:
--------------------------------------------------------------------------------
1 | = 5.3 ) {
95 | $body_class = 'acf-admin-5-3';
96 | } else {
97 | $body_class = 'acf-admin-3-8';
98 | }
99 |
100 | // Append and return.
101 | return $classes . ' ' . $body_class;
102 | }
103 |
104 | /**
105 | * info_page_html
106 | *
107 | * Renders the Info page HTML.
108 | *
109 | * @date 5/11/19
110 | * @since 5.8.7
111 | *
112 | * @param void
113 | * @return void
114 | */
115 | function info_page_html() {
116 |
117 | // Vars.
118 | $view = array(
119 | 'version' => acf_get_setting('version'),
120 | 'have_pro' => acf_get_setting('pro'),
121 | 'tabs' => array(
122 | 'new' => __("What's New", 'acf'),
123 | 'changelog' => __("Changelog", 'acf')
124 | ),
125 | 'active' => 'new'
126 | );
127 |
128 | // Find active tab.
129 | if( isset($_GET['tab']) && $_GET['tab'] === 'changelog' ) {
130 | $view['active'] = 'changelog';
131 | }
132 |
133 | // Load view.
134 | acf_get_view('settings-info', $view);
135 | }
136 | }
137 |
138 | // Instantiate.
139 | acf_new_instance('ACF_Admin');
140 |
141 | endif; // class_exists check
142 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool.php:
--------------------------------------------------------------------------------
1 | name;
40 | }
41 |
42 |
43 | /**
44 | * get_title
45 | *
46 | * This function will return the Tool's title
47 | *
48 | * @date 19/10/17
49 | * @since 5.6.3
50 | *
51 | * @param n/a
52 | * @return n/a
53 | */
54 |
55 | function get_title() {
56 | return $this->title;
57 | }
58 |
59 |
60 | /**
61 | * get_url
62 | *
63 | * This function will return the Tool's title
64 | *
65 | * @date 19/10/17
66 | * @since 5.6.3
67 | *
68 | * @param n/a
69 | * @return n/a
70 | */
71 |
72 | function get_url() {
73 | return acf_get_admin_tool_url( $this->name );
74 | }
75 |
76 |
77 | /**
78 | * is_active
79 | *
80 | * This function will return true if the tool is active
81 | *
82 | * @date 19/10/17
83 | * @since 5.6.3
84 | *
85 | * @param n/a
86 | * @return bool
87 | */
88 |
89 | function is_active() {
90 | return acf_maybe_get_GET('tool') === $this->name;
91 | }
92 |
93 |
94 | /*
95 | * __construct
96 | *
97 | * This function will setup the class functionality
98 | *
99 | * @type function
100 | * @date 27/6/17
101 | * @since 5.6.0
102 | *
103 | * @param n/a
104 | * @return n/a
105 | */
106 |
107 | function __construct() {
108 |
109 | // initialize
110 | $this->initialize();
111 |
112 | }
113 |
114 |
115 | /**
116 | * initialize
117 | *
118 | * This function will initialize the admin tool
119 | *
120 | * @date 10/10/17
121 | * @since 5.6.3
122 | *
123 | * @param n/a
124 | * @return n/a
125 | */
126 |
127 | function initialize() {
128 |
129 | /* do nothing */
130 |
131 | }
132 |
133 |
134 |
135 | /**
136 | * load
137 | *
138 | * This function is called during the admin page load
139 | *
140 | * @date 10/10/17
141 | * @since 5.6.3
142 | *
143 | * @param n/a
144 | * @return n/a
145 | */
146 |
147 | function load() {
148 |
149 | /* do nothing */
150 |
151 | }
152 |
153 |
154 | /**
155 | * html
156 | *
157 | * This function will output the metabox HTML
158 | *
159 | * @date 10/10/17
160 | * @since 5.6.3
161 | *
162 | * @param n/a
163 | * @return n/a
164 | */
165 |
166 | function html() {
167 |
168 |
169 |
170 | }
171 |
172 |
173 | /**
174 | * submit
175 | *
176 | * This function will run when the tool's form has been submit
177 | *
178 | * @date 10/10/17
179 | * @since 5.6.3
180 | *
181 | * @param n/a
182 | * @return n/a
183 | */
184 |
185 | function submit() {
186 |
187 |
188 | }
189 |
190 |
191 | }
192 |
193 | endif; // class_exists check
194 |
195 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-fields.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 | + Add Field button to create your first field.",'acf'); ?>
15 |
16 |
17 | $field ):
20 |
21 | acf_get_view('field-group-field', array( 'field' => $field, 'i' => $i ));
22 |
23 | endforeach;
24 |
25 | endif; ?>
26 |
27 |
28 |
29 |
34 |
35 | 'acfcloneindex',
40 | 'key' => 'acfcloneindex',
41 | 'label' => __('New Field','acf'),
42 | 'name' => 'new_field',
43 | 'type' => 'text'
44 | ));
45 |
46 | ?>
47 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-locations.php:
--------------------------------------------------------------------------------
1 |
7 |
36 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-admin-page-upgrade.php:
--------------------------------------------------------------------------------
1 |
14 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
See what\'s new', 'acf' ), admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info') ); ?>
34 |
35 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-admin-tools.php:
--------------------------------------------------------------------------------
1 |
19 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-group.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | $rule ):
8 |
9 | // validate rule
10 | $rule = acf_validate_location_rule($rule);
11 |
12 | // append id and group
13 | $rule['id'] = "rule_{$i}";
14 | $rule['group'] = $group_id;
15 |
16 | // view
17 | acf_get_view('html-location-rule', array(
18 | 'rule' => $rule
19 | ));
20 |
21 | endforeach; ?>
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-rule.php:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | 'select',
20 | 'name' => 'param',
21 | 'prefix' => $prefix,
22 | 'value' => $rule['param'],
23 | 'choices' => $choices,
24 | 'class' => 'refresh-location-rule'
25 | ));
26 |
27 | }
28 |
29 | ?>
30 | |
31 |
32 | 'select',
43 | 'name' => 'operator',
44 | 'prefix' => $prefix,
45 | 'value' => $rule['operator'],
46 | 'choices' => $choices
47 | ));
48 |
49 | // custom
50 | } else {
51 |
52 | echo $choices;
53 |
54 | }
55 |
56 | ?>
57 | |
58 |
59 | 'select',
70 | 'name' => 'value',
71 | 'prefix' => $prefix,
72 | 'value' => $rule['value'],
73 | 'choices' => $choices
74 | ));
75 |
76 | // custom
77 | } else {
78 |
79 | echo $choices;
80 |
81 | }
82 |
83 | ?>
84 | |
85 |
86 |
87 | |
88 |
89 |
90 | |
91 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-notice-upgrade.php:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
; ?>)
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
43 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/ajax/class-acf-ajax-check-screen.php:
--------------------------------------------------------------------------------
1 | request, array(
30 | 'screen' => '',
31 | 'post_id' => 0,
32 | 'ajax' => true,
33 | 'exists' => array()
34 | ));
35 |
36 | // vars
37 | $response = array(
38 | 'results' => array(),
39 | 'style' => ''
40 | );
41 |
42 | // get field groups
43 | $field_groups = acf_get_field_groups( $args );
44 |
45 | // loop through field groups
46 | if( $field_groups ) {
47 | foreach( $field_groups as $i => $field_group ) {
48 |
49 | // vars
50 | $item = array(
51 | 'id' => 'acf-' . $field_group['key'],
52 | 'key' => $field_group['key'],
53 | 'title' => $field_group['title'],
54 | 'position' => $field_group['position'],
55 | 'style' => $field_group['style'],
56 | 'label' => $field_group['label_placement'],
57 | 'edit' => acf_get_field_group_edit_link( $field_group['ID'] ),
58 | 'html' => ''
59 | );
60 |
61 | // append html if doesnt already exist on page
62 | if( !in_array($field_group['key'], $args['exists']) ) {
63 |
64 | // load fields
65 | $fields = acf_get_fields( $field_group );
66 |
67 | // get field HTML
68 | ob_start();
69 |
70 | // render
71 | acf_render_fields( $fields, $args['post_id'], 'div', $field_group['instruction_placement'] );
72 |
73 | $item['html'] = ob_get_clean();
74 | }
75 |
76 | // append
77 | $response['results'][] = $item;
78 | }
79 |
80 | // Get style from first field group.
81 | $response['style'] = acf_get_field_group_style( $field_groups[0] );
82 | }
83 |
84 | // Custom metabox order.
85 | if( $this->get('screen') == 'post' ) {
86 | $response['sorted'] = get_user_option('meta-box-order_' . $this->get('post_type'));
87 | }
88 |
89 | // return
90 | return $response;
91 | }
92 | }
93 |
94 | acf_new_instance('ACF_Ajax_Check_Screen');
95 |
96 | endif; // class_exists check
97 |
98 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/ajax/class-acf-ajax-upgrade.php:
--------------------------------------------------------------------------------
1 | has('value') ) {
30 | return acf_update_user_setting( $this->get('name'), $this->get('value') );
31 |
32 | // get
33 | } else {
34 | return acf_get_user_setting( $this->get('name') );
35 | }
36 | }
37 | }
38 |
39 | acf_new_instance('ACF_Ajax_User_Setting');
40 |
41 | endif; // class_exists check
42 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-output.php:
--------------------------------------------------------------------------------
1 | name = 'output';
25 | $this->label = 'output';
26 | $this->public = false;
27 | $this->defaults = array(
28 | 'html' => false
29 | );
30 |
31 | }
32 |
33 |
34 | /*
35 | * render_field()
36 | *
37 | * Create the HTML interface for your field
38 | *
39 | * @param $field (array) the $field being rendered
40 | *
41 | * @type action
42 | * @since 3.6
43 | * @date 23/01/13
44 | *
45 | * @param $field (array) the $field being edited
46 | * @return n/a
47 | */
48 |
49 | function render_field( $field ) {
50 |
51 | // bail early if no html
52 | if( !$field['html'] ) return;
53 |
54 |
55 | // html
56 | if( is_string($field['html']) && !function_exists($field['html']) ) {
57 |
58 | echo $field['html'];
59 |
60 | // function
61 | } else {
62 |
63 | call_user_func_array($field['html'], array($field));
64 |
65 | }
66 |
67 | }
68 |
69 | }
70 |
71 |
72 | // initialize
73 | acf_register_field_type( 'acf_field_output' );
74 |
75 | endif; // class_exists check
76 |
77 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-password.php:
--------------------------------------------------------------------------------
1 | name = 'password';
25 | $this->label = __("Password",'acf');
26 | $this->defaults = array(
27 | 'placeholder' => '',
28 | 'prepend' => '',
29 | 'append' => '',
30 | );
31 |
32 | }
33 |
34 |
35 | /*
36 | * render_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 render_field( $field ) {
48 |
49 | acf_get_field_type('text')->render_field( $field );
50 |
51 | }
52 |
53 |
54 | /*
55 | * render_field_settings()
56 | *
57 | * Create extra options for your field. This is rendered when editing a field.
58 | * The value of $field['name'] can be used (like bellow) to save extra data to the $field
59 | *
60 | * @type action
61 | * @since 3.6
62 | * @date 23/01/13
63 | *
64 | * @param $field - an array holding all the field's data
65 | */
66 |
67 | function render_field_settings( $field ) {
68 |
69 | // placeholder
70 | acf_render_field_setting( $field, array(
71 | 'label' => __('Placeholder Text','acf'),
72 | 'instructions' => __('Appears within the input','acf'),
73 | 'type' => 'text',
74 | 'name' => 'placeholder',
75 | ));
76 |
77 |
78 | // prepend
79 | acf_render_field_setting( $field, array(
80 | 'label' => __('Prepend','acf'),
81 | 'instructions' => __('Appears before the input','acf'),
82 | 'type' => 'text',
83 | 'name' => 'prepend',
84 | ));
85 |
86 |
87 | // append
88 | acf_render_field_setting( $field, array(
89 | 'label' => __('Append','acf'),
90 | 'instructions' => __('Appears after the input','acf'),
91 | 'type' => 'text',
92 | 'name' => 'append',
93 | ));
94 | }
95 |
96 | }
97 |
98 |
99 | // initialize
100 | acf_register_field_type( 'acf_field_password' );
101 |
102 | endif; // class_exists check
103 |
104 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-separator.php:
--------------------------------------------------------------------------------
1 | name = 'separator';
25 | $this->label = __("Separator",'acf');
26 | $this->category = 'layout';
27 |
28 | }
29 |
30 |
31 | /*
32 | * render_field()
33 | *
34 | * Create the HTML interface for your field
35 | *
36 | * @param $field - an array holding all the field's data
37 | *
38 | * @type action
39 | * @since 3.6
40 | * @date 23/01/13
41 | */
42 |
43 | function render_field( $field ) {
44 |
45 | /* do nothing */
46 |
47 | }
48 |
49 |
50 | /*
51 | * load_field()
52 | *
53 | * This filter is appied to the $field after it is loaded from the database
54 | *
55 | * @type filter
56 | * @since 3.6
57 | * @date 23/01/13
58 | *
59 | * @param $field - the field array holding all the field options
60 | *
61 | * @return $field - the field array holding all the field options
62 | */
63 |
64 | function load_field( $field ) {
65 |
66 | // remove name to avoid caching issue
67 | $field['name'] = '';
68 |
69 |
70 | // remove required to avoid JS issues
71 | $field['required'] = 0;
72 |
73 |
74 | // set value other than 'null' to avoid ACF loading / caching issue
75 | $field['value'] = false;
76 |
77 |
78 | // return
79 | return $field;
80 |
81 | }
82 |
83 | }
84 |
85 |
86 | // initialize
87 | acf_register_field_type( 'acf_field_separator' );
88 |
89 | endif; // class_exists check
90 |
91 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-url.php:
--------------------------------------------------------------------------------
1 | name = 'url';
25 | $this->label = __("Url",'acf');
26 | $this->defaults = array(
27 | 'default_value' => '',
28 | 'placeholder' => '',
29 | );
30 |
31 | }
32 |
33 |
34 | /*
35 | * render_field()
36 | *
37 | * Create the HTML interface for your field
38 | *
39 | * @param $field - an array holding all the field's data
40 | *
41 | * @type action
42 | * @since 3.6
43 | * @date 23/01/13
44 | */
45 |
46 | function render_field( $field ) {
47 |
48 | // vars
49 | $atts = array();
50 | $keys = array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'pattern' );
51 | $keys2 = array( 'readonly', 'disabled', 'required' );
52 | $html = '';
53 |
54 |
55 | // atts (value="123")
56 | foreach( $keys as $k ) {
57 | if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
58 | }
59 |
60 |
61 | // atts2 (disabled="disabled")
62 | foreach( $keys2 as $k ) {
63 | if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
64 | }
65 |
66 |
67 | // remove empty atts
68 | $atts = acf_clean_atts( $atts );
69 |
70 |
71 | // render
72 | $html .= '';
73 | $html .= '' . acf_get_text_input( $atts ) ;
74 | $html .= '
';
75 |
76 |
77 | // return
78 | echo $html;
79 |
80 | }
81 |
82 |
83 | /*
84 | * render_field_settings()
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 render_field_settings( $field ) {
97 |
98 | // default_value
99 | acf_render_field_setting( $field, array(
100 | 'label' => __('Default Value','acf'),
101 | 'instructions' => __('Appears when creating a new post','acf'),
102 | 'type' => 'text',
103 | 'name' => 'default_value',
104 | ));
105 |
106 |
107 | // placeholder
108 | acf_render_field_setting( $field, array(
109 | 'label' => __('Placeholder Text','acf'),
110 | 'instructions' => __('Appears within the input','acf'),
111 | 'type' => 'text',
112 | 'name' => 'placeholder',
113 | ));
114 |
115 | }
116 |
117 |
118 | /*
119 | * validate_value
120 | *
121 | * description
122 | *
123 | * @type function
124 | * @date 11/02/2014
125 | * @since 5.0.0
126 | *
127 | * @param $post_id (int)
128 | * @return $post_id (int)
129 | */
130 |
131 | function validate_value( $valid, $value, $field, $input ){
132 |
133 | // bail early if empty
134 | if( empty($value) ) {
135 |
136 | return $valid;
137 |
138 | }
139 |
140 |
141 | if( strpos($value, '://') !== false ) {
142 |
143 | // url
144 |
145 | } elseif( strpos($value, '//') === 0 ) {
146 |
147 | // protocol relative url
148 |
149 | } else {
150 |
151 | $valid = __('Value must be a valid URL', 'acf');
152 |
153 | }
154 |
155 |
156 | // return
157 | return $valid;
158 |
159 | }
160 |
161 | }
162 |
163 |
164 | // initialize
165 | acf_register_field_type( 'acf_field_url' );
166 |
167 | endif; // class_exists check
168 |
169 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-attachment.php:
--------------------------------------------------------------------------------
1 | name = 'attachment';
27 | $this->label = __("Attachment",'acf');
28 | $this->category = 'forms';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $attachment = acf_maybe_get( $screen, 'attachment' );
51 |
52 |
53 | // validate
54 | if( !$attachment ) return false;
55 |
56 |
57 | // get attachment mime type
58 | $mime_type = get_post_mime_type( $attachment );
59 |
60 |
61 | // no specific mime
62 | if( !strpos($rule['value'], '/') ) {
63 |
64 | // explode into [0] => type, [1] => mime
65 | $bits = explode('/', $mime_type);
66 |
67 |
68 | // if type matches, fake the $mime_type to match
69 | if( $rule['value'] === $bits[0] ) {
70 |
71 | $mime_type = $rule['value'];
72 |
73 | }
74 | }
75 |
76 |
77 | // match
78 | return $this->compare( $mime_type, $rule );
79 |
80 | }
81 |
82 |
83 | /*
84 | * rule_operators
85 | *
86 | * This function returns the available values for this rule type
87 | *
88 | * @type function
89 | * @date 30/5/17
90 | * @since 5.6.0
91 | *
92 | * @param n/a
93 | * @return (array)
94 | */
95 |
96 | function rule_values( $choices, $rule ) {
97 |
98 | // vars
99 | $mimes = get_allowed_mime_types();
100 | $choices = array(
101 | 'all' => __('All', 'acf')
102 | );
103 |
104 |
105 | // loop
106 | foreach( $mimes as $type => $mime ) {
107 |
108 | $group = current( explode('/', $mime) );
109 | $choices[ $group ][ $group ] = sprintf( __('All %s formats', 'acf'), $group);
110 | $choices[ $group ][ $mime ] = "$type ($mime)";
111 |
112 | }
113 |
114 |
115 | // return
116 | return $choices;
117 |
118 | }
119 |
120 | }
121 |
122 | // initialize
123 | acf_register_location_rule( 'acf_location_attachment' );
124 |
125 | endif; // class_exists check
126 |
127 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-comment.php:
--------------------------------------------------------------------------------
1 | name = 'comment';
27 | $this->label = __("Comment",'acf');
28 | $this->category = 'forms';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $comment = acf_maybe_get( $screen, 'comment' );
51 |
52 |
53 | // bail early if not comment
54 | if( !$comment ) return false;
55 |
56 |
57 | // return
58 | return $this->compare( $comment, $rule );
59 |
60 | }
61 |
62 |
63 | /*
64 | * rule_operators
65 | *
66 | * This function returns the available values for this rule type
67 | *
68 | * @type function
69 | * @date 30/5/17
70 | * @since 5.6.0
71 | *
72 | * @param n/a
73 | * @return (array)
74 | */
75 |
76 | function rule_values( $choices, $rule ) {
77 |
78 | // vars
79 | $choices = array( 'all' => __('All', 'acf') );
80 | $choices = array_merge( $choices, acf_get_pretty_post_types() );
81 | // change this to post types that support comments
82 |
83 | // return
84 | return $choices;
85 |
86 | }
87 |
88 | }
89 |
90 | // initialize
91 | acf_register_location_rule( 'acf_location_comment' );
92 |
93 | endif; // class_exists check
94 |
95 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user-role.php:
--------------------------------------------------------------------------------
1 | name = 'current_user_role';
27 | $this->label = __("Current User Role",'acf');
28 | $this->category = 'user';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // bail early if not logged in
50 | if( !is_user_logged_in() ) return false;
51 |
52 |
53 | // vars
54 | $user = wp_get_current_user();
55 |
56 |
57 | // super_admin
58 | if( $rule['value'] == 'super_admin' ) {
59 |
60 | $result = is_super_admin( $user->ID );
61 |
62 | // role
63 | } else {
64 |
65 | $result = in_array( $rule['value'], $user->roles );
66 |
67 | }
68 |
69 |
70 | // reverse if 'not equal to'
71 | if( $rule['operator'] == '!=' ) {
72 |
73 | $result = !$result;
74 |
75 | }
76 |
77 |
78 | // return
79 | return $result;
80 |
81 | }
82 |
83 |
84 | /*
85 | * rule_operators
86 | *
87 | * This function returns the available values for this rule type
88 | *
89 | * @type function
90 | * @date 30/5/17
91 | * @since 5.6.0
92 | *
93 | * @param n/a
94 | * @return (array)
95 | */
96 |
97 | function rule_values( $choices, $rule ) {
98 |
99 | // global
100 | global $wp_roles;
101 |
102 |
103 | // specific roles
104 | $choices = $wp_roles->get_names();
105 |
106 |
107 | // multi-site
108 | if( is_multisite() ) {
109 |
110 | $prepend = array( 'super_admin' => __('Super Admin', 'acf') );
111 | $choices = array_merge( $prepend, $choices );
112 |
113 | }
114 |
115 |
116 | // return
117 | return $choices;
118 |
119 | }
120 |
121 | }
122 |
123 | // initialize
124 | acf_register_location_rule( 'acf_location_current_user_role' );
125 |
126 | endif; // class_exists check
127 |
128 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-current-user.php:
--------------------------------------------------------------------------------
1 | name = 'current_user';
27 | $this->label = __("Current User",'acf');
28 | $this->category = 'user';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // logged in
50 | if( $rule['value'] == 'logged_in' ) {
51 |
52 | $result = is_user_logged_in();
53 |
54 | // viewing_front
55 | } elseif( $rule['value'] == 'viewing_front' ) {
56 |
57 | $result = !is_admin();
58 |
59 | // viewing_back
60 | } elseif( $rule['value'] == 'viewing_back' ) {
61 |
62 | $result = is_admin();
63 |
64 | }
65 |
66 |
67 | // reverse if 'not equal to'
68 | if( $rule['operator'] == '!=' ) {
69 |
70 | $result = !$result;
71 |
72 | }
73 |
74 |
75 | // return
76 | return $result;
77 |
78 | }
79 |
80 |
81 | /*
82 | * rule_operators
83 | *
84 | * This function returns the available values for this rule type
85 | *
86 | * @type function
87 | * @date 30/5/17
88 | * @since 5.6.0
89 | *
90 | * @param n/a
91 | * @return (array)
92 | */
93 |
94 | function rule_values( $choices, $rule ) {
95 |
96 | return array(
97 | 'logged_in' => __('Logged in', 'acf'),
98 | 'viewing_front' => __('Viewing front end', 'acf'),
99 | 'viewing_back' => __('Viewing back end', 'acf')
100 | );
101 |
102 | }
103 |
104 | }
105 |
106 | // initialize
107 | acf_register_location_rule( 'acf_location_current_user' );
108 |
109 | endif; // class_exists check
110 |
111 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu-item.php:
--------------------------------------------------------------------------------
1 | name = 'nav_menu_item';
27 | $this->label = __("Menu Item",'acf');
28 | $this->category = 'forms';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $nav_menu_item = acf_maybe_get( $screen, 'nav_menu_item' );
51 |
52 |
53 | // bail early if not nav_menu_item
54 | if( !$nav_menu_item ) return false;
55 |
56 |
57 | // append nav_menu data
58 | if( !isset($screen['nav_menu']) ) {
59 | $screen['nav_menu'] = acf_get_data('nav_menu_id');
60 | }
61 |
62 |
63 | // return
64 | return acf_get_location_rule('nav_menu')->rule_match( $result, $rule, $screen );
65 |
66 | }
67 |
68 |
69 | /*
70 | * rule_operators
71 | *
72 | * This function returns the available values for this rule type
73 | *
74 | * @type function
75 | * @date 30/5/17
76 | * @since 5.6.0
77 | *
78 | * @param n/a
79 | * @return (array)
80 | */
81 |
82 | function rule_values( $choices, $rule ) {
83 |
84 | // get menu choices
85 | $choices = acf_get_location_rule('nav_menu')->rule_values( $choices, $rule );
86 |
87 |
88 | // append item types?
89 | // dificult to get these details
90 |
91 |
92 | // return
93 | return $choices;
94 |
95 | }
96 |
97 | }
98 |
99 | // initialize
100 | acf_register_location_rule( 'acf_location_nav_menu_item' );
101 |
102 | endif; // class_exists check
103 |
104 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-nav-menu.php:
--------------------------------------------------------------------------------
1 | name = 'nav_menu';
27 | $this->label = __("Menu",'acf');
28 | $this->category = 'forms';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $nav_menu = acf_maybe_get( $screen, 'nav_menu' );
51 |
52 |
53 | // bail early if not nav_menu
54 | if( !$nav_menu ) return false;
55 |
56 |
57 | // location
58 | if( substr($rule['value'], 0, 9) === 'location/' ) {
59 |
60 | // vars
61 | $location = substr($rule['value'], 9);
62 | $menu_locations = get_nav_menu_locations();
63 |
64 |
65 | // bail ealry if no location
66 | if( !isset($menu_locations[$location]) ) return false;
67 |
68 |
69 | // if location matches, update value
70 | if( $menu_locations[$location] == $nav_menu ) {
71 |
72 | $nav_menu = $rule['value'];
73 |
74 | }
75 |
76 | }
77 |
78 |
79 | // return
80 | return $this->compare( $nav_menu, $rule );
81 |
82 | }
83 |
84 |
85 | /*
86 | * rule_operators
87 | *
88 | * This function returns the available values for this rule type
89 | *
90 | * @type function
91 | * @date 30/5/17
92 | * @since 5.6.0
93 | *
94 | * @param n/a
95 | * @return (array)
96 | */
97 |
98 | function rule_values( $choices, $rule ) {
99 |
100 | // all
101 | $choices = array(
102 | 'all' => __('All', 'acf'),
103 | );
104 |
105 |
106 | // locations
107 | $nav_locations = get_registered_nav_menus();
108 | if( !empty($nav_locations) ) {
109 | $cat = __('Menu Locations', 'acf');
110 | foreach( $nav_locations as $slug => $title ) {
111 | $choices[ $cat ][ 'location/'.$slug ] = $title;
112 | }
113 | }
114 |
115 |
116 | // specific menus
117 | $nav_menus = wp_get_nav_menus();
118 | if( !empty($nav_menus) ) {
119 | $cat = __('Menus', 'acf');
120 | foreach( $nav_menus as $nav_menu ) {
121 | $choices[ $cat ][ $nav_menu->term_id ] = $nav_menu->name;
122 | }
123 | }
124 |
125 |
126 | // return
127 | return $choices;
128 |
129 | }
130 |
131 | }
132 |
133 | // initialize
134 | acf_register_location_rule( 'acf_location_nav_menu' );
135 |
136 | endif; // class_exists check
137 |
138 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-parent.php:
--------------------------------------------------------------------------------
1 | name = 'page_parent';
27 | $this->label = __("Page Parent",'acf');
28 | $this->category = 'page';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $post_id = acf_maybe_get( $screen, 'post_id' );
51 | $page_parent = acf_maybe_get( $screen, 'page_parent' );
52 |
53 |
54 | // no page parent
55 | if( $page_parent === null ) {
56 |
57 | // bail early if no post id
58 | if( !$post_id ) return false;
59 |
60 |
61 | // get post parent
62 | $post = get_post( $post_id );
63 | $page_parent = $post->post_parent;
64 |
65 | }
66 |
67 |
68 | // compare
69 | return $this->compare( $page_parent, $rule );
70 |
71 | }
72 |
73 |
74 | /*
75 | * rule_operators
76 | *
77 | * This function returns the available values for this rule type
78 | *
79 | * @type function
80 | * @date 30/5/17
81 | * @since 5.6.0
82 | *
83 | * @param n/a
84 | * @return (array)
85 | */
86 |
87 | function rule_values( $choices, $rule ) {
88 |
89 | return acf_get_location_rule('page')->rule_values( $choices, $rule );
90 |
91 | }
92 |
93 | }
94 |
95 | // initialize
96 | acf_register_location_rule( 'acf_location_page_parent' );
97 |
98 | endif; // class_exists check
99 |
100 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page-template.php:
--------------------------------------------------------------------------------
1 | name = 'page_template';
27 | $this->label = __("Page Template",'acf');
28 | $this->category = 'page';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // Check if this rule is relevant to the current screen.
50 | // Find $post_id in the process.
51 | if( isset($screen['post_type']) ) {
52 | $post_type = $screen['post_type'];
53 | } elseif( isset($screen['post_id']) ) {
54 | $post_type = get_post_type( $screen['post_id'] );
55 | } else {
56 | return false;
57 | }
58 |
59 | // If this rule is set to "default" template, avoid matching on non "page" post types.
60 | // Fixes issue where post templates were added in WP 4.7 and field groups appeared on all post type edit screens.
61 | if( $rule['value'] === 'default' && $post_type !== 'page' ) {
62 | return false;
63 | }
64 |
65 | // Return.
66 | return acf_get_location_rule('post_template')->rule_match( $result, $rule, $screen );
67 | }
68 |
69 |
70 | /*
71 | * rule_operators
72 | *
73 | * This function returns the available values for this rule type
74 | *
75 | * @type function
76 | * @date 30/5/17
77 | * @since 5.6.0
78 | *
79 | * @param n/a
80 | * @return (array)
81 | */
82 |
83 | function rule_values( $choices, $rule ) {
84 |
85 | // Default choices.
86 | $choices = array(
87 | 'default' => apply_filters( 'default_page_template_title', __('Default Template', 'acf') )
88 | );
89 |
90 | // Load all templates, and merge in 'page' templates.
91 | $post_templates = acf_get_post_templates();
92 | if( isset($post_templates['page']) ) {
93 | $choices = array_merge($choices, $post_templates['page']);
94 | }
95 |
96 | // Return choices.
97 | return $choices;
98 | }
99 |
100 | }
101 |
102 | // initialize
103 | acf_register_location_rule( 'acf_location_page_template' );
104 |
105 | endif; // class_exists check
106 |
107 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-page.php:
--------------------------------------------------------------------------------
1 | name = 'page';
27 | $this->label = __("Page",'acf');
28 | $this->category = 'page';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | return acf_get_location_rule('post')->rule_match( $result, $rule, $screen );
50 |
51 | }
52 |
53 |
54 | /*
55 | * rule_operators
56 | *
57 | * This function returns the available values for this rule type
58 | *
59 | * @type function
60 | * @date 30/5/17
61 | * @since 5.6.0
62 | *
63 | * @param n/a
64 | * @return (array)
65 | */
66 |
67 | function rule_values( $choices, $rule ) {
68 |
69 | // get posts grouped by post type
70 | $groups = acf_get_grouped_posts(array(
71 | 'post_type' => 'page'
72 | ));
73 |
74 |
75 | // pop
76 | $choices = array_pop( $groups );
77 |
78 |
79 | // convert posts to titles
80 | foreach( $choices as &$item ) {
81 |
82 | $item = acf_get_post_title( $item );
83 |
84 | }
85 |
86 |
87 | // return
88 | return $choices;
89 |
90 | }
91 |
92 | }
93 |
94 | // initialize
95 | acf_register_location_rule( 'acf_location_page' );
96 |
97 | endif; // class_exists check
98 |
99 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-category.php:
--------------------------------------------------------------------------------
1 | name = 'post_category';
27 | $this->label = __("Post Category",'acf');
28 | $this->category = 'post';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | return acf_get_location_rule('post_taxonomy')->rule_match( $result, $rule, $screen );
50 |
51 | }
52 |
53 |
54 | /*
55 | * rule_operators
56 | *
57 | * This function returns the available values for this rule type
58 | *
59 | * @type function
60 | * @date 30/5/17
61 | * @since 5.6.0
62 | *
63 | * @param n/a
64 | * @return (array)
65 | */
66 |
67 | function rule_values( $choices, $rule ) {
68 |
69 | $terms = acf_get_taxonomy_terms( 'category' );
70 |
71 | if( !empty($terms) ) {
72 |
73 | $choices = array_pop($terms);
74 |
75 | }
76 |
77 | return $choices;
78 |
79 | }
80 |
81 | }
82 |
83 | // initialize
84 | acf_register_location_rule( 'acf_location_post_category' );
85 |
86 | endif; // class_exists check
87 |
88 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-format.php:
--------------------------------------------------------------------------------
1 | name = 'post_format';
27 | $this->label = __("Post Format",'acf');
28 | $this->category = 'post';
29 |
30 | }
31 |
32 |
33 | /*
34 | * get_post_type
35 | *
36 | * This function will return the current post_type
37 | *
38 | * @type function
39 | * @date 25/11/16
40 | * @since 5.5.0
41 | *
42 | * @param $options (int)
43 | * @return (mixed)
44 | */
45 |
46 | function get_post_type( $screen ) {
47 |
48 | // vars
49 | $post_id = acf_maybe_get( $screen, 'post_id' );
50 | $post_type = acf_maybe_get( $screen, 'post_type' );
51 |
52 |
53 | // post_type
54 | if( $post_type ) return $post_type;
55 |
56 |
57 | // $post_id
58 | if( $post_id ) return get_post_type( $post_id );
59 |
60 |
61 | // return
62 | return false;
63 |
64 | }
65 |
66 |
67 | /*
68 | * rule_match
69 | *
70 | * This function is used to match this location $rule to the current $screen
71 | *
72 | * @type function
73 | * @date 3/01/13
74 | * @since 3.5.7
75 | *
76 | * @param $match (boolean)
77 | * @param $rule (array)
78 | * @return $options (array)
79 | */
80 |
81 | function rule_match( $result, $rule, $screen ) {
82 |
83 | // vars
84 | $post_format = acf_maybe_get( $screen, 'post_format' );
85 |
86 |
87 | // find post format
88 | if( !$post_format ) {
89 |
90 | // get post id
91 | $post_id = acf_maybe_get( $screen, 'post_id' );
92 | $post_type = $this->get_post_type( $screen );
93 |
94 |
95 | // bail early if not a post
96 | if( !$post_id || !$post_type ) return false;
97 |
98 |
99 | // does post_type support 'post-format'
100 | if( post_type_supports($post_type, 'post-formats') ) {
101 |
102 | // update
103 | $post_format = get_post_format($post_id);
104 | $post_format = $post_format ? $post_format : 'standard';
105 |
106 | }
107 |
108 | }
109 |
110 |
111 | // compare
112 | return $this->compare( $post_format, $rule );
113 |
114 | }
115 |
116 |
117 | /*
118 | * rule_operators
119 | *
120 | * This function returns the available values for this rule type
121 | *
122 | * @type function
123 | * @date 30/5/17
124 | * @since 5.6.0
125 | *
126 | * @param n/a
127 | * @return (array)
128 | */
129 |
130 | function rule_values( $choices, $rule ) {
131 |
132 | return get_post_format_strings();
133 |
134 | }
135 |
136 | }
137 |
138 | // initialize
139 | acf_register_location_rule( 'acf_location_post_format' );
140 |
141 | endif; // class_exists check
142 |
143 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-status.php:
--------------------------------------------------------------------------------
1 | name = 'post_status';
27 | $this->label = __("Post Status",'acf');
28 | $this->category = 'post';
29 |
30 | }
31 |
32 |
33 | /*
34 | * get_post_type
35 | *
36 | * This function will return the current post_type
37 | *
38 | * @type function
39 | * @date 25/11/16
40 | * @since 5.5.0
41 | *
42 | * @param $options (int)
43 | * @return (mixed)
44 | */
45 |
46 | function get_post_type( $screen ) {
47 |
48 | // vars
49 | $post_id = acf_maybe_get( $screen, 'post_id' );
50 | $post_type = acf_maybe_get( $screen, 'post_type' );
51 |
52 |
53 | // post_type
54 | if( $post_type ) return $post_type;
55 |
56 |
57 | // $post_id
58 | if( $post_id ) return get_post_type( $post_id );
59 |
60 |
61 | // return
62 | return false;
63 |
64 | }
65 |
66 |
67 | /*
68 | * rule_match
69 | *
70 | * This function is used to match this location $rule to the current $screen
71 | *
72 | * @type function
73 | * @date 3/01/13
74 | * @since 3.5.7
75 | *
76 | * @param $match (boolean)
77 | * @param $rule (array)
78 | * @return $options (array)
79 | */
80 |
81 | function rule_match( $result, $rule, $screen ) {
82 |
83 | // vars
84 | $post_status = acf_maybe_get( $screen, 'post_status' );
85 |
86 |
87 | // find post format
88 | if( !$post_status ) {
89 |
90 | // get post id
91 | $post_id = acf_maybe_get( $screen, 'post_id' );
92 |
93 |
94 | // bail early if not a post
95 | if( !$post_id ) return false;
96 |
97 |
98 | // update
99 | $post_status = get_post_status( $post_id );
100 |
101 | }
102 |
103 |
104 | // auto-draft = draft
105 | if( $post_status == 'auto-draft' ) {
106 |
107 | $post_status = 'draft';
108 |
109 | }
110 |
111 |
112 | // match
113 | return $this->compare( $post_status, $rule );
114 |
115 | }
116 |
117 |
118 | /*
119 | * rule_operators
120 | *
121 | * This function returns the available values for this rule type
122 | *
123 | * @type function
124 | * @date 30/5/17
125 | * @since 5.6.0
126 | *
127 | * @param n/a
128 | * @return (array)
129 | */
130 |
131 | function rule_values( $choices, $rule ) {
132 |
133 | // globals
134 | global $wp_post_statuses;
135 |
136 |
137 | // append
138 | if( !empty($wp_post_statuses) ) {
139 |
140 | foreach( $wp_post_statuses as $status ) {
141 |
142 | $choices[ $status->name ] = $status->label;
143 |
144 | }
145 |
146 | }
147 |
148 |
149 | // return choices
150 | return $choices;
151 |
152 | }
153 |
154 | }
155 |
156 | // initialize
157 | acf_register_location_rule( 'acf_location_post_status' );
158 |
159 | endif; // class_exists check
160 |
161 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-taxonomy.php:
--------------------------------------------------------------------------------
1 | name = 'post_taxonomy';
27 | $this->label = __("Post Taxonomy",'acf');
28 | $this->category = 'post';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $post_id = acf_maybe_get( $screen, 'post_id' );
51 | $post_terms = acf_maybe_get( $screen, 'post_terms' );
52 |
53 | // Allow compatibility for attachments.
54 | if( !$post_id ) {
55 | $post_id = acf_maybe_get( $screen, 'attachment_id' );
56 | }
57 |
58 | // bail early if not a post
59 | if( !$post_id ) return false;
60 |
61 | // get selected term from rule
62 | $term = acf_get_term( $rule['value'] );
63 |
64 | // bail early if no term
65 | if( !$term || is_wp_error($term) ) return false;
66 |
67 | // if ajax, find the terms for the correct category
68 | if( $post_terms !== null ) {
69 | $post_terms = acf_maybe_get( $post_terms, $term->taxonomy, array() );
70 |
71 | // if not ajax, load post's terms
72 | } else {
73 | $post_terms = wp_get_post_terms( $post_id, $term->taxonomy, array('fields' => 'ids') );
74 | }
75 |
76 | // If no terms, this is a new post and should be treated as if it has the "Uncategorized" (1) category ticked
77 | if( !$post_terms && $term->taxonomy == 'category' ) {
78 | $post_terms = array( 1 );
79 | }
80 |
81 | // compare term IDs and slugs
82 | if( in_array($term->term_id, $post_terms) || in_array($term->slug, $post_terms) ) {
83 | $result = true;
84 | }
85 |
86 | // reverse if 'not equal to'
87 | if( $rule['operator'] == '!=' ) {
88 | $result = !$result;
89 | }
90 |
91 | // return
92 | return $result;
93 | }
94 |
95 |
96 | /*
97 | * rule_operators
98 | *
99 | * This function returns the available values for this rule type
100 | *
101 | * @type function
102 | * @date 30/5/17
103 | * @since 5.6.0
104 | *
105 | * @param n/a
106 | * @return (array)
107 | */
108 |
109 | function rule_values( $choices, $rule ) {
110 |
111 | // get
112 | $choices = acf_get_taxonomy_terms();
113 |
114 |
115 | // unset post_format
116 | if( isset($choices['post_format']) ) {
117 |
118 | unset( $choices['post_format']) ;
119 |
120 | }
121 |
122 |
123 | // return
124 | return $choices;
125 |
126 | }
127 |
128 | }
129 |
130 | // initialize
131 | acf_register_location_rule( 'acf_location_post_taxonomy' );
132 |
133 | endif; // class_exists check
134 |
135 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post-type.php:
--------------------------------------------------------------------------------
1 | name = 'post_type';
27 | $this->label = __("Post Type",'acf');
28 | $this->category = 'post';
29 |
30 | }
31 |
32 |
33 | /*
34 | * get_post_type
35 | *
36 | * This function will return the current post_type
37 | *
38 | * @type function
39 | * @date 25/11/16
40 | * @since 5.5.0
41 | *
42 | * @param $options (int)
43 | * @return (mixed)
44 | */
45 |
46 | function get_post_type( $screen ) {
47 |
48 | // vars
49 | $post_id = acf_maybe_get( $screen, 'post_id' );
50 | $post_type = acf_maybe_get( $screen, 'post_type' );
51 |
52 |
53 | // post_type
54 | if( $post_type ) return $post_type;
55 |
56 |
57 | // $post_id
58 | if( $post_id ) return get_post_type( $post_id );
59 |
60 |
61 | // return
62 | return false;
63 |
64 | }
65 |
66 |
67 | /*
68 | * rule_match
69 | *
70 | * This function is used to match this location $rule to the current $screen
71 | *
72 | * @type function
73 | * @date 3/01/13
74 | * @since 3.5.7
75 | *
76 | * @param $match (boolean)
77 | * @param $rule (array)
78 | * @return $options (array)
79 | */
80 |
81 | function rule_match( $result, $rule, $screen ) {
82 |
83 | // vars
84 | $post_type = $this->get_post_type( $screen );
85 |
86 |
87 | // bail early if no post_type found (not a post)
88 | if( !$post_type ) return false;
89 |
90 |
91 | // match
92 | return $this->compare( $post_type, $rule );
93 |
94 | }
95 |
96 |
97 | /*
98 | * rule_operators
99 | *
100 | * This function returns the available values for this rule type
101 | *
102 | * @type function
103 | * @date 30/5/17
104 | * @since 5.6.0
105 | *
106 | * @param n/a
107 | * @return (array)
108 | */
109 |
110 | function rule_values( $choices, $rule ) {
111 |
112 | // get post types
113 | // - removed show_ui to allow 3rd party code to register a post type using a custom admin edit page
114 | $post_types = acf_get_post_types(array(
115 | 'show_ui' => 1,
116 | 'exclude' => array('attachment')
117 | ));
118 |
119 |
120 | // return choices
121 | return acf_get_pretty_post_types( $post_types );
122 |
123 | }
124 |
125 | }
126 |
127 | // initialize
128 | acf_register_location_rule( 'acf_location_post_type' );
129 |
130 | endif; // class_exists check
131 |
132 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-post.php:
--------------------------------------------------------------------------------
1 | name = 'post';
27 | $this->label = __("Post",'acf');
28 | $this->category = 'post';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $post_id = acf_maybe_get( $screen, 'post_id' );
51 |
52 |
53 | // bail early if not post
54 | if( !$post_id ) return false;
55 |
56 |
57 | // compare
58 | return $this->compare( $post_id, $rule );
59 |
60 | }
61 |
62 |
63 | /*
64 | * rule_operators
65 | *
66 | * This function returns the available values for this rule type
67 | *
68 | * @type function
69 | * @date 30/5/17
70 | * @since 5.6.0
71 | *
72 | * @param n/a
73 | * @return (array)
74 | */
75 |
76 | function rule_values( $choices, $rule ) {
77 |
78 | // get post types
79 | $post_types = acf_get_post_types(array(
80 | 'show_ui' => 1,
81 | 'exclude' => array('page', 'attachment')
82 | ));
83 |
84 |
85 | // get posts grouped by post type
86 | $groups = acf_get_grouped_posts(array(
87 | 'post_type' => $post_types
88 | ));
89 |
90 |
91 | if( !empty($groups) ) {
92 |
93 | foreach( array_keys($groups) as $group_title ) {
94 |
95 | // vars
96 | $posts = acf_extract_var( $groups, $group_title );
97 |
98 |
99 | // override post data
100 | foreach( array_keys($posts) as $post_id ) {
101 |
102 | // update
103 | $posts[ $post_id ] = acf_get_post_title( $posts[ $post_id ] );
104 |
105 | };
106 |
107 |
108 | // append to $choices
109 | $choices[ $group_title ] = $posts;
110 |
111 | }
112 |
113 | }
114 |
115 |
116 | // return
117 | return $choices;
118 |
119 | }
120 |
121 | }
122 |
123 | // initialize
124 | acf_register_location_rule( 'acf_location_post' );
125 |
126 | endif; // class_exists check
127 |
128 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-taxonomy.php:
--------------------------------------------------------------------------------
1 | name = 'taxonomy';
27 | $this->label = __("Taxonomy",'acf');
28 | $this->category = 'forms';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $taxonomy = acf_maybe_get( $screen, 'taxonomy' );
51 |
52 |
53 | // bail early if not taxonomy
54 | if( !$taxonomy ) return false;
55 |
56 |
57 | // return
58 | return $this->compare( $taxonomy, $rule );
59 |
60 | }
61 |
62 |
63 | /*
64 | * rule_operators
65 | *
66 | * This function returns the available values for this rule type
67 | *
68 | * @type function
69 | * @date 30/5/17
70 | * @since 5.6.0
71 | *
72 | * @param n/a
73 | * @return (array)
74 | */
75 |
76 | function rule_values( $choices, $rule ) {
77 |
78 | // vars
79 | $choices = array( 'all' => __('All', 'acf') );
80 | $choices = array_merge( $choices, acf_get_taxonomy_labels() );
81 |
82 |
83 | // return
84 | return $choices;
85 |
86 | }
87 |
88 | }
89 |
90 | // initialize
91 | acf_register_location_rule( 'acf_location_taxonomy' );
92 |
93 | endif; // class_exists check
94 |
95 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-form.php:
--------------------------------------------------------------------------------
1 | name = 'user_form';
22 | $this->label = __("User Form", 'acf');
23 | $this->category = 'user';
24 | }
25 |
26 | /**
27 | * rule_match
28 | *
29 | * Determines if the given location $rule is a match for the current $screen.
30 | *
31 | * @date 17/9/19
32 | * @since 5.8.1
33 | *
34 | * @param bool $result Whether or not this location rule is a match.
35 | * @param array $rule The locatio rule data.
36 | * @param array $screen The current screen data.
37 | * @return bool
38 | */
39 | function rule_match( $result, $rule, $screen ) {
40 |
41 | // Extract vars.
42 | $user_form = acf_maybe_get($screen, 'user_form');
43 |
44 | // Return false if no user_form data.
45 | if( !$user_form ) {
46 | return false;
47 | }
48 |
49 | // The "Add / Edit" choice (foolishly valued "edit") should match true for either "add" or "edit".
50 | if( $rule['value'] === 'edit' && $user_form === 'add' ) {
51 | $user_form = 'edit';
52 | }
53 |
54 | // Compare and return.
55 | return $this->compare( $user_form, $rule );
56 | }
57 |
58 | /**
59 | * rule_values
60 | *
61 | * Returns an array of values for this location rule.
62 | *
63 | * @date 17/9/19
64 | * @since 5.8.1
65 | *
66 | * @param array $choices An empty array.
67 | * @param array $rule The locatio rule data.
68 | * @return type Description.
69 | */
70 | function rule_values( $choices, $rule ) {
71 | return array(
72 | 'all' => __('All', 'acf'),
73 | 'add' => __('Add', 'acf'),
74 | 'edit' => __('Add / Edit', 'acf'),
75 | 'register' => __('Register', 'acf')
76 | );
77 | }
78 | }
79 |
80 | // Register.
81 | acf_register_location_rule( 'ACF_Location_User_Form' );
82 |
83 | endif; // class_exists check
84 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-user-role.php:
--------------------------------------------------------------------------------
1 | name = 'user_role';
22 | $this->label = __("User Role", 'acf');
23 | $this->category = 'user';
24 | }
25 |
26 | /**
27 | * rule_match
28 | *
29 | * Determines if the given location $rule is a match for the current $screen.
30 | *
31 | * @date 17/9/19
32 | * @since 5.8.1
33 | *
34 | * @param bool $result Whether or not this location rule is a match.
35 | * @param array $rule The locatio rule data.
36 | * @param array $screen The current screen data.
37 | * @return bool
38 | */
39 | function rule_match( $result, $rule, $screen ) {
40 |
41 | // Extract vars.
42 | $user_id = acf_maybe_get( $screen, 'user_id' );
43 | $user_role = acf_maybe_get( $screen, 'user_role' );
44 |
45 | // Allow $user_role to be supplied (third-party compatibility).
46 | if( $user_role ) {
47 | // Do nothing
48 |
49 | // Determine $user_role from $user_id.
50 | } elseif( $user_id ) {
51 |
52 | // Use default role for new user.
53 | if( $user_id == 'new' ) {
54 | $user_role = get_option('default_role');
55 |
56 | // Check if user can, and if so, set the value allowing them to match.
57 | } elseif( user_can($user_id, $rule['value']) ) {
58 | $user_role = $rule['value'];
59 | }
60 |
61 | // Return false if not a user.
62 | } else {
63 | return false;
64 | }
65 |
66 | // Compare and return.
67 | return $this->compare( $user_role, $rule );
68 |
69 | }
70 |
71 | /**
72 | * rule_values
73 | *
74 | * Returns an array of values for this location rule.
75 | *
76 | * @date 17/9/19
77 | * @since 5.8.1
78 | *
79 | * @param array $choices An empty array.
80 | * @param array $rule The locatio rule data.
81 | * @return array
82 | */
83 | function rule_values( $choices, $rule ) {
84 | global $wp_roles;
85 |
86 | // Merge roles with defaults and return.
87 | return wp_parse_args($wp_roles->get_names(), array(
88 | 'all' => __('All', 'acf')
89 | ));
90 | }
91 | }
92 |
93 | // initialize
94 | acf_register_location_rule( 'ACF_Location_User_Role' );
95 |
96 | endif; // class_exists check
97 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-widget.php:
--------------------------------------------------------------------------------
1 | name = 'widget';
27 | $this->label = __("Widget",'acf');
28 | $this->category = 'forms';
29 |
30 | }
31 |
32 |
33 | /*
34 | * rule_match
35 | *
36 | * This function is used to match this location $rule to the current $screen
37 | *
38 | * @type function
39 | * @date 3/01/13
40 | * @since 3.5.7
41 | *
42 | * @param $match (boolean)
43 | * @param $rule (array)
44 | * @return $options (array)
45 | */
46 |
47 | function rule_match( $result, $rule, $screen ) {
48 |
49 | // vars
50 | $widget = acf_maybe_get( $screen, 'widget' );
51 |
52 |
53 | // bail early if not widget
54 | if( !$widget ) return false;
55 |
56 |
57 | // return
58 | return $this->compare( $widget, $rule );
59 |
60 | }
61 |
62 |
63 | /*
64 | * rule_operators
65 | *
66 | * This function returns the available values for this rule type
67 | *
68 | * @type function
69 | * @date 30/5/17
70 | * @since 5.6.0
71 | *
72 | * @param n/a
73 | * @return (array)
74 | */
75 |
76 | function rule_values( $choices, $rule ) {
77 |
78 | // global
79 | global $wp_widget_factory;
80 |
81 |
82 | // vars
83 | $choices = array( 'all' => __('All', 'acf') );
84 |
85 |
86 | // loop
87 | if( !empty( $wp_widget_factory->widgets ) ) {
88 |
89 | foreach( $wp_widget_factory->widgets as $widget ) {
90 |
91 | $choices[ $widget->id_base ] = $widget->name;
92 |
93 | }
94 |
95 | }
96 |
97 |
98 | // return
99 | return $choices;
100 |
101 | }
102 |
103 | }
104 |
105 | // initialize
106 | acf_register_location_rule( 'acf_location_widget' );
107 |
108 | endif; // class_exists check
109 |
110 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location.php:
--------------------------------------------------------------------------------
1 | initialize();
36 |
37 | // Add filters.
38 | $this->add_filter( 'acf/location/rule_match/' . $this->name, array($this, 'rule_match'), 5, 3 );
39 | $this->add_filter( 'acf/location/rule_operators/' . $this->name, array($this, 'rule_operators'), 5, 2 );
40 | $this->add_filter( 'acf/location/rule_values/' . $this->name, array($this, 'rule_values'), 5, 2 );
41 | }
42 |
43 | /**
44 | * add_filter
45 | *
46 | * Maybe adds a filter callback.
47 | *
48 | * @date 17/9/19
49 | * @since 5.8.1
50 | *
51 | * @param string $tag The filter name.
52 | * @param callable $function_to_add The callback function.
53 | * @param int $priority The filter priority.
54 | * @param int $accepted_args The number of args to accept.
55 | * @return void
56 | */
57 | function add_filter( $tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1 ) {
58 | if( is_callable($function_to_add) ) {
59 | add_filter( $tag, $function_to_add, $priority, $accepted_args );
60 | }
61 | }
62 |
63 | /**
64 | * initialize
65 | *
66 | * Sets up the class functionality.
67 | *
68 | * @date 5/03/2014
69 | * @since 5.0.0
70 | *
71 | * @param void
72 | * @return void
73 | */
74 | function initialize() {
75 | // Do nothing.
76 | }
77 |
78 | /**
79 | * compare
80 | *
81 | * Compares the given value and rule params returning true when they match.
82 | *
83 | * @date 17/9/19
84 | * @since 5.8.1
85 | *
86 | * @param mixed $value The value to compare against.
87 | * @param array $rule The locatio rule data.
88 | * @return bool
89 | */
90 | function compare( $value, $rule ) {
91 |
92 | // Allow "all" to match any value.
93 | if( $rule['value'] === 'all' ) {
94 | $match = true;
95 |
96 | // Compare all other values.
97 | } else {
98 | $match = ( $value == $rule['value'] );
99 | }
100 |
101 | // Allow for "!=" operator.
102 | if( $rule['operator'] == '!=' ) {
103 | $match = !$match;
104 | }
105 |
106 | // Return.
107 | return $match;
108 | }
109 | }
110 |
111 | endif; // class_exists check
112 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/walkers/class-acf-walker-nav-menu-edit.php:
--------------------------------------------------------------------------------
1 | ]+class="[^"]*field-move)/',
35 | $this->get_fields( $item, $depth, $args, $id ),
36 | $item_output
37 | );
38 | }
39 |
40 |
41 | /**
42 | * Get custom fields HTML
43 | *
44 | * @since 5.0.0
45 | * @since 5.7.2 Added action based on https://github.com/ineagu/wp-menu-item-custom-fields
46 | *
47 | * @param object $item Menu item data object.
48 | * @param int $depth Depth of menu item. Used for padding.
49 | * @param array $args Menu item args.
50 | * @param int $id Nav menu ID.
51 | * @return string
52 | */
53 | function get_fields( $item, $depth, $args = array(), $id = 0 ) {
54 | ob_start();
55 |
56 | /**
57 | * Get menu item custom fields from plugins/themes
58 | *
59 | * @since 5.7.2
60 | *
61 | * @param int $item_id post ID of menu
62 | * @param object $item Menu item data object.
63 | * @param int $depth Depth of menu item. Used for padding.
64 | * @param array $args Menu item args.
65 | * @param int $id Nav menu ID.
66 | */
67 | do_action( 'wp_nav_menu_item_custom_fields', $item->ID, $item, $depth, $args, $id );
68 | return ob_get_clean();
69 | }
70 | }
71 |
72 | endif;
73 |
74 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/includes/walkers/class-acf-walker-taxonomy-field.php:
--------------------------------------------------------------------------------
1 | 'parent', 'id' => 'term_id' );
12 |
13 | function __construct( $field ) {
14 |
15 | $this->field = $field;
16 |
17 | }
18 |
19 | function start_el( &$output, $term, $depth = 0, $args = array(), $current_object_id = 0) {
20 |
21 | // vars
22 | $selected = in_array( $term->term_id, $this->field['value'] );
23 |
24 |
25 | // append
26 | $output .= '';
27 |
28 | }
29 |
30 | function end_el( &$output, $term, $depth = 0, $args = array() ) {
31 |
32 | // append
33 | $output .= '' . "\n";
34 |
35 | }
36 |
37 | function start_lvl( &$output, $depth = 0, $args = array() ) {
38 |
39 | // append
40 | $output .= '' . "\n";
41 |
42 | }
43 |
44 | function end_lvl( &$output, $depth = 0, $args = array() ) {
45 |
46 | // append
47 | $output .= '
' . "\n";
48 |
49 | }
50 |
51 | }
52 |
53 | endif;
54 |
55 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ar.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ar.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-bg_BG.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-bg_BG.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-cs_CZ.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-cs_CZ.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-de_CH.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-de_CH.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-de_DE.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-de_DE.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-de_DE_formal.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-de_DE_formal.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-es_ES.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-es_ES.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fa_IR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fa_IR.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fi.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fi.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fr_CA.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fr_CA.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fr_FR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-fr_FR.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-he_IL.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-he_IL.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-hr_HR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-hr_HR.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-hu_HU.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-hu_HU.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-id_ID.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-id_ID.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-it_IT.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-it_IT.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ja.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ja.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-nb_NO.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-nb_NO.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-nl_NL.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-nl_NL.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-pl_PL.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-pl_PL.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-pt_BR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-pt_BR.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-pt_PT.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-pt_PT.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ro_RO.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ro_RO.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ru_RU.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-ru_RU.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-sk_SK.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-sk_SK.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-sv_SE.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-sv_SE.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-tr_TR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-tr_TR.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-uk.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-uk.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-zh_CN.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/api/wp-content/plugins/advanced-custom-fields-pro/lang/acf-zh_CN.mo
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-options-page.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
43 |
44 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/pro/assets/css/acf-pro-field-group.css:
--------------------------------------------------------------------------------
1 | .acf-field-setting-fc_layout .acf-fc-meta{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta li{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min{float:left;width:33%;padding-right:10px}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend{min-width:45px}.acf-field-setting-fc_layout .acf-input-wrap.select{border-radius:0 3px 3px 0 !important;border:#DFDFDF solid 1px}.acf-field-setting-fc_layout .acf-input-wrap.select select{margin:0;border:0 none;padding:3px;height:26px}.acf-field-setting-fc_layout .acf-fl-actions{visibility:hidden}.acf-field-setting-fc_layout .acf-fl-actions .reorder-layout{cursor:move}.acf-field-setting-fc_layout .acf-fl-actions a{padding:1px 0;font-size:13px;line-height:20px}.acf-field-setting-fc_layout:hover .acf-fl-actions,.acf-field-setting-fc_layout.-hover .acf-fl-actions{visibility:visible}.acf-field-object-clone[data-display="seamless"] .acf-field-setting-instructions,.acf-field-object-clone[data-display="seamless"] .acf-field-setting-layout,.acf-field-object-clone[data-display="seamless"] .acf-field-setting-wrapper,.acf-field-object-clone[data-display="seamless"] .acf-field-setting-conditional_logic{display:none}
2 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/pro/locations/class-acf-location-block.php:
--------------------------------------------------------------------------------
1 | name = 'block';
27 | $this->label = __("Block",'acf');
28 | $this->category = 'forms';
29 | }
30 |
31 |
32 | /*
33 | * rule_match
34 | *
35 | * This function is used to match this location $rule to the current $screen
36 | *
37 | * @type function
38 | * @date 3/01/13
39 | * @since 3.5.7
40 | *
41 | * @param $match (boolean)
42 | * @param $rule (array)
43 | * @return $options (array)
44 | */
45 |
46 | function rule_match( $result, $rule, $screen ) {
47 |
48 | // vars
49 | $block = acf_maybe_get( $screen, 'block' );
50 |
51 | // bail early if not block
52 | if( !$block ) return false;
53 |
54 | // compare
55 | return $this->compare( $block, $rule );
56 | }
57 |
58 |
59 | /*
60 | * rule_operators
61 | *
62 | * This function returns the available values for this rule type
63 | *
64 | * @type function
65 | * @date 30/5/17
66 | * @since 5.6.0
67 | *
68 | * @param n/a
69 | * @return (array)
70 | */
71 |
72 | function rule_values( $choices, $rule ) {
73 |
74 | // vars
75 | $blocks = acf_get_block_types();
76 |
77 | // loop
78 | if( $blocks ) {
79 | $choices['all'] = __('All', 'acf');
80 | foreach( $blocks as $block ) {
81 | $choices[ $block['name'] ] = $block['title'];
82 | }
83 | }
84 |
85 | // return
86 | return $choices;
87 | }
88 |
89 | }
90 |
91 | // initialize
92 | acf_register_location_rule( 'ACF_Location_Block' );
93 |
94 | endif; // class_exists check
95 |
96 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/advanced-custom-fields-pro/pro/locations/class-acf-location-options-page.php:
--------------------------------------------------------------------------------
1 | name = 'options_page';
26 | $this->label = __("Options Page",'acf');
27 | $this->category = 'forms';
28 |
29 | }
30 |
31 |
32 | /*
33 | * rule_match
34 | *
35 | * This function is used to match this location $rule to the current $screen
36 | *
37 | * @type function
38 | * @date 3/01/13
39 | * @since 3.5.7
40 | *
41 | * @param $match (boolean)
42 | * @param $rule (array)
43 | * @return $options (array)
44 | */
45 |
46 | function rule_match( $result, $rule, $screen ) {
47 |
48 | $options_page = acf_maybe_get( $screen, 'options_page' );
49 | return $this->compare( $options_page, $rule );
50 |
51 | }
52 |
53 |
54 | /*
55 | * rule_operators
56 | *
57 | * This function returns the available values for this rule type
58 | *
59 | * @type function
60 | * @date 30/5/17
61 | * @since 5.6.0
62 | *
63 | * @param n/a
64 | * @return (array)
65 | */
66 |
67 | function rule_values( $choices, $rule ) {
68 |
69 | // vars
70 | $pages = acf_get_options_pages();
71 |
72 |
73 | // populate
74 | if( !empty($pages) ) {
75 | foreach( $pages as $page ) {
76 | $choices[ $page['menu_slug'] ] = $page['page_title'];
77 | }
78 | } else {
79 | $choices[''] = __('No options pages exist', 'acf');
80 | }
81 |
82 |
83 | // return
84 | return $choices;
85 |
86 | }
87 |
88 | }
89 |
90 | // initialize
91 | acf_register_location_rule( 'acf_location_options_page' );
92 |
93 | endif; // class_exists check
94 |
95 | ?>
--------------------------------------------------------------------------------
/api/wp-content/plugins/index.php:
--------------------------------------------------------------------------------
1 | ID, $tax);
18 | }
19 | return $terms;
20 | }
21 | return [];
22 | }
23 |
24 | public static function getEssentials(WP_Post $post) {
25 | $formatted = new stdClass();
26 | $formatted->ID = $post->ID;
27 | $formatted->date = $post->post_date;
28 | $formatted->title = $post->post_title;
29 | $formatted->name = $post->post_name;
30 | $formatted->type = $post->post_type;
31 | $formatted->permalink = get_permalink($post->ID);
32 | $formatted->featuredImage = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
33 | $formatted->template = Utilities::getTemplateSlug($post);
34 | $formatted->terms = self::getTerms($post);
35 | $formatted = apply_filters('trbl_rest_api/get_essentials', $formatted);
36 | $formatted = apply_filters('trbl_rest_api/get_essentials/' . $formatted->type, $formatted);
37 | return $formatted;
38 | }
39 |
40 | public static function getFullPost(WP_Post $post) {
41 | $formatted = self::getEssentials($post);
42 | $formatted->content = apply_filters('the_content', get_post_field('post_content', $post->ID));
43 | $formatted->acf = get_fields($post->ID);
44 | $formatted = apply_filters('trbl_rest_api/get_full_post', $formatted);
45 | $formatted = apply_filters('trbl_rest_api/get_full_post/' . $formatted->type, $formatted);
46 | return $formatted;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/Fields.php:
--------------------------------------------------------------------------------
1 | registerFields();
10 | }
11 |
12 | public function registerFields() {
13 | if( function_exists('acf_add_local_field_group') ):
14 |
15 | acf_add_local_field_group(array(
16 | 'key' => 'group_5d9c85572620f',
17 | 'title' => 'TRBL REST API Settings',
18 | 'fields' => array(
19 | array(
20 | 'key' => 'field_5d9c85630b1dd',
21 | 'label' => 'Enabled Endpoints',
22 | 'name' => 'enabled_endpoints',
23 | 'type' => 'select',
24 | 'instructions' => '',
25 | 'required' => 0,
26 | 'conditional_logic' => 0,
27 | 'wrapper' => array(
28 | 'width' => '',
29 | 'class' => '',
30 | 'id' => '',
31 | ),
32 | 'choices' => Utilities::getPostTypes(),
33 | 'default_value' => [],
34 | 'allow_null' => 0,
35 | 'multiple' => 1,
36 | 'ui' => 1,
37 | 'ajax' => 0,
38 | 'return_format' => 'array',
39 | 'placeholder' => '',
40 | ),
41 | array(
42 | 'key' => 'field_5d9c858174618',
43 | 'label' => 'Searchable Post Types',
44 | 'name' => 'searchable_post_types',
45 | 'type' => 'select',
46 | 'instructions' => '',
47 | 'required' => 0,
48 | 'conditional_logic' => 0,
49 | 'wrapper' => array(
50 | 'width' => '',
51 | 'class' => '',
52 | 'id' => '',
53 | ),
54 | 'choices' => Utilities::getPostTypes(),
55 | 'default_value' => array(
56 | ),
57 | 'allow_null' => 0,
58 | 'multiple' => 1,
59 | 'ui' => 1,
60 | 'ajax' => 0,
61 | 'return_format' => 'array',
62 | 'placeholder' => '',
63 | ),
64 | ),
65 | 'location' => array(
66 | array(
67 | array(
68 | 'param' => 'options_page',
69 | 'operator' => '==',
70 | 'value' => 'trbl_rest_api_settings',
71 | ),
72 | ),
73 | ),
74 | 'menu_order' => 0,
75 | 'position' => 'normal',
76 | 'style' => 'default',
77 | 'label_placement' => 'top',
78 | 'instruction_placement' => 'label',
79 | 'hide_on_screen' => '',
80 | 'active' => true,
81 | 'description' => '',
82 | ));
83 |
84 | endif;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/GetMany.php:
--------------------------------------------------------------------------------
1 | post_type = $post_type;
19 | $this->path = $path;
20 | add_action('rest_api_init', array($this, 'register'));
21 | }
22 |
23 | public function register() {
24 | register_rest_route(TRBLRest::NAMESPACE, '/' . $this->path, array(
25 | 'methods' => 'GET',
26 | 'callback' => array($this, 'callback'),
27 | 'args' => Query::ARGS,
28 | ));
29 | }
30 |
31 | public function callback(WP_REST_Request $request) {
32 | $args = Query::makeQueryArgsFromRequest($request, array(
33 | 'post_type' => $this->post_type
34 | ));
35 |
36 | $query = new WP_Query($args);
37 | return new WP_REST_Response(Utilities::formatPagedResults($query), 200);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/GetOne.php:
--------------------------------------------------------------------------------
1 | post_type = $post_type;
16 | $this->path = $path;
17 | add_action('rest_api_init', array($this, 'register'));
18 | }
19 |
20 | public function register() {
21 | register_rest_route(TRBLRest::NAMESPACE, '/' . $this->path . '/(?P[0-9a-zA-Z-_\/]+)/', array(
22 | 'methods' => 'GET',
23 | 'callback' => array($this, 'callback'),
24 | ));
25 | }
26 |
27 | public function callback(WP_REST_Request $request) {
28 | $id = $request->get_param('id');
29 |
30 | if (is_numeric($id)) {
31 | $post = get_post($id);
32 | } else {
33 | $post = get_page_by_path($id, 'object', $this->post_type);
34 | }
35 |
36 | if ($post && $post->post_status === 'publish') {
37 | return new WP_REST_Response(Factory::getFullPost($post), 200);
38 | } else {
39 | return new WP_REST_Response(array(
40 | 'message' => 'Not Found',
41 | ), 404);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/Plugin.php:
--------------------------------------------------------------------------------
1 | registerOptions();
26 | $this->registerFields();
27 |
28 | // Only filter relationship and post object ACF fields
29 | // if responding to a REST request
30 | if (Utilities::isREST()) {
31 | new ACFFilters();
32 | }
33 | }
34 | }
35 |
36 | public function registerOptions() {
37 | acf_add_options_page(array(
38 | 'page_title' => 'TRBL REST API Settings',
39 | 'menu_title' => 'TRBL REST API Settings',
40 | 'menu_slug' => 'trbl_rest_api_settings',
41 | 'post_id' => 'trbl_rest_api_settings',
42 | 'capability' => 'edit_posts',
43 | 'parent' => 'options-general.php',
44 | 'redirect' => false
45 | ));
46 | }
47 |
48 | public function registerFields() {
49 | new Fields();
50 | }
51 |
52 | public function registerEndpoints() {
53 | new Query();
54 | new Preview();
55 |
56 | $active_post_types = get_field('enabled_endpoints', 'trbl_rest_api_settings');
57 |
58 | if (is_array($active_post_types) && count($active_post_types)) {
59 | foreach($active_post_types as $type) {
60 | $post_type = get_post_type_object($type);
61 | if ($post_type->rest_base) {
62 | new GetOne($type, $post_type->rest_base);
63 | new GetMany($type, $post_type->rest_base);
64 | }
65 | }
66 | }
67 | }
68 |
69 | public function addMetaOrTitleSearch ($q) {
70 | if( $title = $q->get( '_meta_or_title' ) ) {
71 | add_filter( 'get_meta_sql', function( $sql ) use ( $title ) {
72 | global $wpdb;
73 |
74 | // Only run once:
75 | static $nr = 0;
76 | if( 0 != $nr++ ) return $sql;
77 |
78 | // Modify WHERE part:
79 | $sql['where'] = sprintf(
80 | " AND ( %s OR %s ) ",
81 | $wpdb->prepare( "{$wpdb->posts}.post_title LIKE '%%%s%%'", $title ),
82 | mb_substr( $sql['where'], 5, mb_strlen( $sql['where'] ) )
83 | );
84 |
85 | return $sql;
86 | });
87 | }
88 | }
89 | }
90 |
91 | new TRBLRest();
92 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/Preview.php:
--------------------------------------------------------------------------------
1 | [0-9]+)/', array(
18 | 'methods' => 'GET',
19 | 'callback' => array($this, 'callback'),
20 | 'permission_callback' => function () {
21 | return current_user_can('edit_posts');
22 | }
23 | ));
24 | }
25 |
26 | public function callback(WP_REST_Request $request) {
27 | // Revisions are drafts so here we remove the default 'publish' status
28 | remove_action('pre_get_posts', 'set_default_status_to_publish');
29 | $id = $request->get_param('id');
30 | if ($revisions = wp_get_post_revisions($id, array( 'check_enabled' => false ))) {
31 | $last_revision = reset($revisions);
32 | $rev_post = wp_get_post_revision($last_revision->ID);
33 | $formatted = Factory::getFullPost($rev_post);
34 | $formatted->featuredImage = wp_get_attachment_url(get_post_thumbnail_id($rev_post->post_parent));
35 | return new WP_REST_Response($formatted, 200);
36 | } elseif ($post = get_post($id)) {
37 | // There are no revisions, just return the saved parent post
38 | return new WP_REST_Response(Factory::getFullPost($post), 200);
39 | } else {
40 | return new WP_REST_Response(array(
41 | 'message' => 'Not Found',
42 | ), 404);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/Setup/Dependencies.php:
--------------------------------------------------------------------------------
1 | dependencies = array();
14 | $this->dependencies[] = new Dependency('ACF', 'Advanced custom fields is not installed or activated. Please install it for this plugin to function properly.');
15 | }
16 |
17 | private function checkDependencies() : bool
18 | {
19 | $are_met = true;
20 | foreach ($this->dependencies as $dependency) {
21 | $are_met = $dependency->checkDependency();
22 | }
23 | return $are_met;
24 | }
25 |
26 | public static function areMet() : bool
27 | {
28 | if (!isset(self::$instance)) {
29 | self::$instance = new self();
30 | }
31 |
32 | return self::$instance->checkDependencies();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/Setup/Dependency.php:
--------------------------------------------------------------------------------
1 | class_name = $class_name;
13 | $this->error_message = $error_message;
14 | }
15 |
16 | public function checkDependency() : bool
17 | {
18 | if (!$this->isMet()) {
19 | add_action('admin_notices', array( $this, 'showAdminNotice' ));
20 | return false;
21 | }
22 | return true;
23 | }
24 |
25 | public function showAdminNotice()
26 | {
27 | $class = 'notice notice-error';
28 | printf('', esc_attr($class), esc_html($this->error_message));
29 | }
30 |
31 | private function isMet() : bool
32 | {
33 | return class_exists($this->class_name);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/Utilities.php:
--------------------------------------------------------------------------------
1 | false,
15 | 'publicly_queryable' => true
16 | );
17 |
18 | foreach (get_post_types($args, 'object') as $post_type) {
19 | $post_types[$post_type->name] = $post_type->labels->name;
20 | }
21 |
22 | //These need to be added manually as they are builtin
23 | $post_types['page'] = 'Page';
24 | $post_types['post'] = 'Post';
25 |
26 | return $post_types;
27 | }
28 |
29 | public static function getTemplateSlug(WP_Post $post) : string {
30 | $id = $post->ID;
31 |
32 | if ($post->post_type === 'revision') {
33 | $id = $post->post_parent;
34 | }
35 |
36 | // Add template name to object
37 | $template = get_page_template_slug($id);
38 | // Clean up template filename
39 | $template = str_replace('.php', '', $template);
40 | $template = str_replace('page-', '', $template);
41 | if ($template === '') {
42 | $template = 'default';
43 | }
44 |
45 | return $template;
46 | }
47 |
48 | public static function formatPagedResults(WP_Query $query) {
49 | $response = new stdClass();
50 | $response->post_count = $query->post_count;
51 | $response->max_num_pages = $query->max_num_pages;
52 | $response->found_posts = $query->found_posts;
53 | $response->posts = [];
54 |
55 | if ($query->have_posts()) {
56 | foreach ($query->posts as $post) {
57 | array_push($response->posts, Factory::getEssentials($post));
58 | }
59 | }
60 | return $response;
61 | }
62 |
63 | public static function isREST() {
64 | $current_url = wp_parse_url( add_query_arg( array( ) ) );
65 | return strpos( $current_url['path'], TRBLRest::NAMESPACE) !== false;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/src/fields.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "key": "group_5d9c85572620f",
4 | "title": "TRBL REST API Settings",
5 | "fields": [
6 | {
7 | "key": "field_5d9c85630b1dd",
8 | "label": "Enabled Endpoints",
9 | "name": "enabled_endpoints",
10 | "type": "select",
11 | "instructions": "",
12 | "required": 0,
13 | "conditional_logic": 0,
14 | "wrapper": {
15 | "width": "",
16 | "class": "",
17 | "id": ""
18 | },
19 | "choices": [],
20 | "default_value": [],
21 | "allow_null": 0,
22 | "multiple": 1,
23 | "ui": 1,
24 | "ajax": 0,
25 | "return_format": "array",
26 | "placeholder": ""
27 | },
28 | {
29 | "key": "field_5d9c858174618",
30 | "label": "Searchable Post Types",
31 | "name": "searchable_post_types",
32 | "type": "select",
33 | "instructions": "",
34 | "required": 0,
35 | "conditional_logic": 0,
36 | "wrapper": {
37 | "width": "",
38 | "class": "",
39 | "id": ""
40 | },
41 | "choices": [],
42 | "default_value": [],
43 | "allow_null": 0,
44 | "multiple": 1,
45 | "ui": 1,
46 | "ajax": 0,
47 | "return_format": "array",
48 | "placeholder": ""
49 | }
50 | ],
51 | "location": [
52 | [
53 | {
54 | "param": "options_page",
55 | "operator": "==",
56 | "value": "trbl_rest_api_settings"
57 | }
58 | ]
59 | ],
60 | "menu_order": 0,
61 | "position": "normal",
62 | "style": "default",
63 | "label_placement": "top",
64 | "instruction_placement": "label",
65 | "hide_on_screen": "",
66 | "active": true,
67 | "description": ""
68 | }
69 | ]
70 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/vendor/autoload.php:
--------------------------------------------------------------------------------
1 | array($baseDir . '/src'),
10 | );
11 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/vendor/composer/autoload_real.php:
--------------------------------------------------------------------------------
1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27 | if ($useStaticLoader) {
28 | require_once __DIR__ . '/autoload_static.php';
29 |
30 | call_user_func(\Composer\Autoload\ComposerStaticInit7cfdeb7c15aeba20f643b4535514076e::getInitializer($loader));
31 | } else {
32 | $map = require __DIR__ . '/autoload_namespaces.php';
33 | foreach ($map as $namespace => $path) {
34 | $loader->set($namespace, $path);
35 | }
36 |
37 | $map = require __DIR__ . '/autoload_psr4.php';
38 | foreach ($map as $namespace => $path) {
39 | $loader->setPsr4($namespace, $path);
40 | }
41 |
42 | $classMap = require __DIR__ . '/autoload_classmap.php';
43 | if ($classMap) {
44 | $loader->addClassMap($classMap);
45 | }
46 | }
47 |
48 | $loader->register(true);
49 |
50 | return $loader;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/vendor/composer/autoload_static.php:
--------------------------------------------------------------------------------
1 |
11 | array (
12 | 'TRBLRest\\' => 9,
13 | ),
14 | );
15 |
16 | public static $prefixDirsPsr4 = array (
17 | 'TRBLRest\\' =>
18 | array (
19 | 0 => __DIR__ . '/../..' . '/src',
20 | ),
21 | );
22 |
23 | public static function getInitializer(ClassLoader $loader)
24 | {
25 | return \Closure::bind(function () use ($loader) {
26 | $loader->prefixLengthsPsr4 = ComposerStaticInit7cfdeb7c15aeba20f643b4535514076e::$prefixLengthsPsr4;
27 | $loader->prefixDirsPsr4 = ComposerStaticInit7cfdeb7c15aeba20f643b4535514076e::$prefixDirsPsr4;
28 |
29 | }, null, ClassLoader::class);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/api/wp-content/plugins/trbl-rest/vendor/composer/installed.json:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/api/wp-content/themes/index.php:
--------------------------------------------------------------------------------
1 | 'Mega Menu',
10 | // 'menu_title' => 'Mega Menu',
11 | // 'menu_slug' => 'mainMenu',
12 | // 'parent_slug' => 'themes.php',
13 | // ));
14 | // }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/api/wp-content/themes/next-wp-rest/src/CORS.php:
--------------------------------------------------------------------------------
1 | post_status === 'draft' || $post->post_status === 'auto-draft' || $post->post_status === 'future') {
13 | // post is a draft
14 | $permalink_url = get_home_url();
15 | $post_type = get_post_type($post);
16 | $permalink_url = '/wp-draft';
17 |
18 | if ($post->post_type !== 'page') {
19 | $permalink_url = '/' . $post_type . $permalink_url;
20 | }
21 | }
22 |
23 | return add_query_arg(
24 | array(
25 | 'preview_id' => $post->ID,
26 | '_wpnonce' => wp_create_nonce('wp_rest')
27 | ),
28 | $permalink_url
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/api/wp-content/themes/next-wp-rest/src/Routes.php:
--------------------------------------------------------------------------------
1 | namespace, '/global-data', array(
13 | 'methods' => 'GET',
14 | 'callback' => array($this, 'globalData')
15 | ));
16 | });
17 | }
18 |
19 | public function globalData() {
20 | return array(
21 | 'megaMenu' => get_field('megaMenu', 'option') ? get_field('megaMenu', 'option') : new stdClass(),
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/api/wp-content/themes/next-wp-rest/src/SetupACF.php:
--------------------------------------------------------------------------------
1 | ID);
18 | $post->content = parse_blocks($content_post->post_content);
19 | return $post;
20 | }
21 |
22 | public function addFeaturedImage($post) {
23 | $feature = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'feature');
24 | $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'search');
25 |
26 | if ($feature) {
27 | $post->featuredImage = $feature[0];
28 | $post->searchThumbnail = $thumbnail[0];
29 | }
30 |
31 | return $post;
32 | }
33 |
34 | public function addTemplateData($page) {
35 | if ($page->template === 'blog') {
36 | $args = array(
37 | 'post_type' => 'post',
38 | 'posts_per_page' => 6,
39 | );
40 |
41 | if ($page->acf['featuredPost']) {
42 | $args['post__not_in'] = array($page->acf['featuredPost']->ID);
43 | }
44 |
45 | $initialPosts = new WP_Query($args);
46 |
47 | $formattedInitialPosts = [];
48 |
49 | if ($initialPosts->have_posts()) {
50 | foreach ($initialPosts->posts as $post) {
51 | array_push($formattedInitialPosts, Factory::getEssentials($post));
52 | }
53 |
54 | $page->initialPosts = $formattedInitialPosts;
55 | }
56 | }
57 |
58 | if ($page->template === 'projects') {
59 | $args = array(
60 | 'post_type' => 'project',
61 | 'posts_per_page' => 6,
62 | );
63 |
64 | $initialProjects = new WP_Query($args);
65 |
66 | $formattedInitialProjects = [];
67 |
68 | if ($initialProjects->have_posts()) {
69 | foreach ($initialProjects->posts as $project) {
70 | array_push($formattedInitialProjects, Factory::getEssentials($project));
71 | }
72 |
73 | $page->initialProjects = $formattedInitialProjects;
74 | }
75 | }
76 |
77 | return $page;
78 | }
79 |
80 | public function addMetaToForm($form) {
81 | $form->acf = get_fields($form->ID);
82 | return $form;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/api/wp-content/themes/next-wp-rest/src/SetupTheme.php:
--------------------------------------------------------------------------------
1 | array($baseDir . '/src'),
10 | );
11 |
--------------------------------------------------------------------------------
/api/wp-content/themes/next-wp-rest/vendor/composer/autoload_real.php:
--------------------------------------------------------------------------------
1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27 | if ($useStaticLoader) {
28 | require_once __DIR__ . '/autoload_static.php';
29 |
30 | call_user_func(\Composer\Autoload\ComposerStaticInit6582bbe9e8cad392a961c72404189e90::getInitializer($loader));
31 | } else {
32 | $map = require __DIR__ . '/autoload_namespaces.php';
33 | foreach ($map as $namespace => $path) {
34 | $loader->set($namespace, $path);
35 | }
36 |
37 | $map = require __DIR__ . '/autoload_psr4.php';
38 | foreach ($map as $namespace => $path) {
39 | $loader->setPsr4($namespace, $path);
40 | }
41 |
42 | $classMap = require __DIR__ . '/autoload_classmap.php';
43 | if ($classMap) {
44 | $loader->addClassMap($classMap);
45 | }
46 | }
47 |
48 | $loader->register(true);
49 |
50 | return $loader;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/api/wp-content/themes/next-wp-rest/vendor/composer/autoload_static.php:
--------------------------------------------------------------------------------
1 |
11 | array (
12 | 'NextWPRest\\' => 11,
13 | ),
14 | );
15 |
16 | public static $prefixDirsPsr4 = array (
17 | 'NextWPRest\\' =>
18 | array (
19 | 0 => __DIR__ . '/../..' . '/src',
20 | ),
21 | );
22 |
23 | public static function getInitializer(ClassLoader $loader)
24 | {
25 | return \Closure::bind(function () use ($loader) {
26 | $loader->prefixLengthsPsr4 = ComposerStaticInit6582bbe9e8cad392a961c72404189e90::$prefixLengthsPsr4;
27 | $loader->prefixDirsPsr4 = ComposerStaticInit6582bbe9e8cad392a961c72404189e90::$prefixDirsPsr4;
28 |
29 | }, null, ClassLoader::class);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/api/wp-content/themes/next-wp-rest/vendor/composer/installed.json:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/client/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 | [*]
3 | indent_style = space
4 | indent_size = 2
5 | charset = utf-8
6 | trim_trailing_whitespace = true
7 | insert_final_newline = true
8 | end_of_line = lf
9 | max_line_length = null
10 |
--------------------------------------------------------------------------------
/client/.env.example:
--------------------------------------------------------------------------------
1 | CMS_URL=http://localhost:8080
2 | UI_URL=http://localhost:3000
3 | NODE_ENV=dev
4 | NODE_PATH=src/
5 | SASS_PATH=src/scss
6 | PORT=3000
7 |
--------------------------------------------------------------------------------
/client/cms.js:
--------------------------------------------------------------------------------
1 | import getConfig from 'next/config';
2 |
3 | const { publicRuntimeConfig } = getConfig();
4 |
5 | export default {
6 | getGlobalData: () => fetch(`${publicRuntimeConfig.CMS_URL}/wp-json/next-wp-rest/v1/global-data`),
7 | getByPath: path => fetch(`${publicRuntimeConfig.CMS_URL}/wp-json/trbl-rest/v1/${path}`),
8 | previewDataById: (id, nonce, options) => fetch(`${publicRuntimeConfig.CMS_URL}/wp-json/trbl-rest/v1/preview/${id}/?_wpnonce=${nonce}`, { ...options }),
9 | getAllByType: type => fetch(`${publicRuntimeConfig.CMS_URL}/wp-json/trbl-rest/v1/${type}?per_page=-1`),
10 | };
11 |
--------------------------------------------------------------------------------
/client/components/head.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import NextHead from 'next/head';
4 | import getConfig from 'next/config';
5 |
6 | const defaultDescription = 'Next WP REST is a boilerplate provided by TRBL that allows WP to be used in a headless capacity.';
7 | const defaultOGURL = 'https://trbl.design';
8 | const defaultOGImage = '/public/img/default-og-image.jpg';
9 | const defaultKeywords = '';
10 | const { publicRuntimeConfig } = getConfig();
11 |
12 | const Head = (props) => {
13 | const {
14 | title, description, url, ogImage, keywords,
15 | } = props;
16 |
17 | return (
18 |
19 |
20 | {title || 'Next WP Rest'}
21 |
25 |
29 |
33 |
37 |
41 |
45 |
49 |
53 |
57 |
61 |
65 |
69 |
73 |
74 | );
75 | };
76 |
77 | Head.propTypes = {
78 | title: PropTypes.string,
79 | description: PropTypes.string,
80 | keywords: PropTypes.string,
81 | url: PropTypes.string,
82 | ogImage: PropTypes.oneOfType([
83 | PropTypes.string,
84 | PropTypes.bool,
85 | ]),
86 | };
87 |
88 | Head.defaultProps = {
89 | title: '',
90 | description: '',
91 | keywords: '',
92 | url: '',
93 | ogImage: false,
94 | };
95 |
96 | export default Head;
97 |
--------------------------------------------------------------------------------
/client/next.config.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config();
2 |
3 | module.exports = {
4 | publicRuntimeConfig: {
5 | CMS_URL: process.env.CMS_URL,
6 | UI_URL: process.env.UI_URL,
7 | },
8 | sassLoaderOptions: {
9 | includePaths: ['scss'],
10 | },
11 | webpack: (config) => {
12 | const configCopy = { ...config };
13 | configCopy.node = {
14 | fs: 'empty',
15 | };
16 |
17 | return configCopy;
18 | },
19 | };
20 |
--------------------------------------------------------------------------------
/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "next-wp-rest-client",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "node server.js",
7 | "build": "next build",
8 | "start": "NODE_ENV=production node server.js -p $PORT"
9 | },
10 | "dependencies": {
11 | "@zeit/next-css": "^1.0.1",
12 | "@zeit/next-sass": "^1.0.1",
13 | "dotenv": "^8.1.0",
14 | "express": "^4.17.1",
15 | "isomorphic-fetch": "^2.2.1",
16 | "next": "^9.3.5",
17 | "next-routes": "^1.4.2",
18 | "node-sass": "^4.12.0",
19 | "prop-types": "^15.7.2",
20 | "react": "16.10.1",
21 | "react-dom": "16.10.1"
22 | },
23 | "devDependencies": {
24 | "babel-eslint": "^10.0.1",
25 | "eslint": "^5.16.0",
26 | "eslint-config-airbnb": "^17.1.0",
27 | "eslint-plugin-import": "^2.17.2",
28 | "eslint-plugin-jsx-a11y": "^6.2.1",
29 | "eslint-plugin-react": "^7.12.4"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/client/pages/404.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import cms from '../cms';
3 |
4 | const NotFound = (props) => {
5 | return (
6 |
7 |
Not Found
8 |
9 | );
10 | };
11 |
12 | NotFound.getInitialProps = async (_, status) => {
13 | const pageRequest = await cms.getByPath('pages/not-found');
14 | const data = await pageRequest.json();
15 | const { status: errorPageStatus } = pageRequest;
16 |
17 | return {
18 | status,
19 | data: errorPageStatus <= 400 ? data : undefined,
20 | };
21 | };
22 |
23 | export default NotFound;
24 |
--------------------------------------------------------------------------------
/client/pages/_app.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react';
2 | import App from 'next/app';
3 | import { Router } from '../routes';
4 |
5 | import cms from '../cms';
6 | import Error from './_error';
7 |
8 | import '../scss/app.scss';
9 |
10 | const baseClass = 'app';
11 |
12 | Router.events.on('routeChangeComplete', () => {
13 | window.scrollTo(0, 0);
14 | });
15 |
16 | const NextWPRestApp = (props) => {
17 | const {
18 | Component,
19 | componentProps,
20 | status,
21 | error,
22 | router,
23 | } = props;
24 |
25 | useEffect(() => {
26 | console.log('%cNext WP Rest boilerplate built by %cTRBL %c(https://trbl.design)', 'font-weight: bolder;', ' font-weight: bolder; color: #ff4553;', 'font-weight: bolder;');
27 | }, []);
28 |
29 | return (
30 |
31 | {status >= 400
32 | ? (
33 |
37 | ) : (
38 |
42 | )}
43 |
44 | )
45 | }
46 |
47 | NextWPRestApp.getInitialProps = async ({ Component, ctx }) => {
48 | const { res } = ctx;
49 |
50 | // If rendered page has getInitialProps, get 'em
51 | const componentProps = Component.getInitialProps
52 | ? await Component.getInitialProps(ctx)
53 | : {};
54 |
55 | const globalDataRequest = await cms.getGlobalData();
56 | const globalData = await globalDataRequest.json();
57 |
58 | // If a rendered page has returned a status greater than 400,
59 | // Get error page data
60 | if (componentProps.status && componentProps.status >= 400) {
61 | res.status(componentProps.status);
62 | return {
63 | status: componentProps.status,
64 | error: await Error.getInitialProps(ctx, componentProps.status),
65 | };
66 | }
67 |
68 | return {
69 | globalData,
70 | componentProps,
71 | };
72 | }
73 |
74 | export default NextWPRestApp;
75 |
--------------------------------------------------------------------------------
/client/pages/_error.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 | import cms from '../cms';
4 |
5 | const Error = (props) => {
6 | const { status } = props;
7 |
8 | return (
9 |
10 |
Error status: {status}
11 |
12 | );
13 | };
14 |
15 | Error.getInitialProps = async (_, status) => {
16 | const pageRequest = await cms.getByPath('pages/not-found');
17 | const data = await pageRequest.json();
18 | const { status: errorPageStatus } = pageRequest;
19 |
20 | return {
21 | status,
22 | data: errorPageStatus <= 400 ? data : undefined,
23 | };
24 | };
25 |
26 | Error.defaultProps = {
27 | status: 400,
28 | }
29 |
30 | Error.propTypes = {
31 | status: PropTypes.number,
32 | };
33 |
34 | export default Error;
35 |
--------------------------------------------------------------------------------
/client/pages/index.js:
--------------------------------------------------------------------------------
1 | import React, { Fragment } from 'react';
2 | import PropTypes from 'prop-types';
3 | import getConfig from 'next/config';
4 |
5 | import Head from '../components/head';
6 |
7 | import cms from '../cms';
8 |
9 | const { publicRuntimeConfig: { UI_URL } } = getConfig();
10 |
11 | const Page = (props) => {
12 | const {
13 | router: {
14 | query,
15 | },
16 | pageData: {
17 | title,
18 | acf: {
19 | meta: {
20 | metaTitle,
21 | metaDescription,
22 | metaKeywords,
23 | metaOgImage,
24 | } = {
25 | metaTitle: '',
26 | metaDescription: '',
27 | metaKeywords: '',
28 | metaOgImage: '',
29 | },
30 | } = {},
31 | },
32 | } = props;
33 |
34 | return (
35 |
36 |
43 | {title}
44 |
45 | );
46 | };
47 |
48 | Page.getInitialProps = async (ctx) => {
49 | const {
50 | req,
51 | query: {
52 | slug,
53 | preview_id: postID,
54 | _wpnonce: nonce,
55 | },
56 | } = ctx;
57 |
58 | let pageRequest;
59 |
60 | if (nonce && postID) {
61 | pageRequest = await cms.previewDataById(postID, nonce, {
62 | headers: {
63 | Cookie: req.headers.cookie,
64 | },
65 | });
66 | } else {
67 | pageRequest = await cms.getByPath(`pages/${slug || 'home'}`);
68 | }
69 |
70 | const pageData = await pageRequest.json();
71 | const { status } = pageRequest;
72 |
73 | if (pageData.length === 0) {
74 | return {
75 | status: 404,
76 | message: 'not-found',
77 | };
78 | }
79 |
80 | return { pageData, status };
81 | };
82 |
83 | Page.propTypes = {
84 | router: PropTypes.shape({
85 | query: PropTypes.shape({
86 | slug: PropTypes.string,
87 | }),
88 | }).isRequired,
89 | pageData: PropTypes.shape({
90 | title: PropTypes.string.isRequired,
91 | acf: PropTypes.oneOfType([
92 | PropTypes.shape({
93 | meta: PropTypes.shape({
94 | metaTitle: PropTypes.string,
95 | metaDescription: PropTypes.string,
96 | metaKeywords: PropTypes.string,
97 | metaOgImage: PropTypes.oneOfType([
98 | PropTypes.shape({
99 | url: PropTypes.string,
100 | }),
101 | PropTypes.bool,
102 | ]),
103 | }),
104 | }),
105 | PropTypes.bool,
106 | ]),
107 | }).isRequired,
108 | };
109 |
110 | export default Page;
111 |
--------------------------------------------------------------------------------
/client/routes.js:
--------------------------------------------------------------------------------
1 | const nextRoutes = require('next-routes');
2 |
3 | const routes = nextRoutes();
4 |
5 | routes.add('page', '/:slug*', '/');
6 |
7 | module.exports = routes;
8 |
--------------------------------------------------------------------------------
/client/scss/_styles.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trouble/next-wp-rest/3db6a81434fce294383243747142899d1e08adb7/client/scss/_styles.scss
--------------------------------------------------------------------------------
/client/scss/app.scss:
--------------------------------------------------------------------------------
1 | html {
2 | font-family: sans-serif;
3 | }
4 |
--------------------------------------------------------------------------------
/client/server.js:
--------------------------------------------------------------------------------
1 | require('isomorphic-fetch');
2 | require('dotenv').config();
3 |
4 | const express = require('express');
5 | const next = require('next');
6 | const routes = require('./routes');
7 |
8 | const dev = process.env.NODE_ENV !== 'production';
9 |
10 | const app = next({ dev });
11 | const handler = routes.getRequestHandler(app);
12 |
13 | const { PORT } = process.env;
14 |
15 | app
16 | .prepare()
17 | .then(() => {
18 | const server = express();
19 |
20 | const port = PORT || 3000;
21 |
22 | server.get('/favicon.png', (req, res) => {
23 | return res.sendStatus(404);
24 | });
25 |
26 | server.use(handler);
27 |
28 | server.listen(port, (err) => {
29 | if (err) throw err;
30 | console.log(`> Ready on http://localhost:${port}`);
31 | });
32 | })
33 | .catch((ex) => {
34 | console.error(ex.stack);
35 | process.exit(1);
36 | });
37 |
--------------------------------------------------------------------------------