1 | <?php |
||
14 | class LSX_Schema_Graph_Piece implements WPSEO_Graph_Piece { |
||
|
|||
15 | /** |
||
16 | * A value object with context variables. |
||
17 | * |
||
18 | * @var \WPSEO_Schema_Context |
||
19 | */ |
||
20 | public $context; |
||
21 | /** |
||
22 | * This is the post type that you want the piece to output for. |
||
23 | * |
||
24 | * @var string; |
||
25 | */ |
||
26 | public $post_type; |
||
27 | /** |
||
28 | * If this is a top level parent |
||
29 | * |
||
30 | * @var boolean |
||
31 | */ |
||
32 | public $is_top_level; |
||
33 | /** |
||
34 | * This holds the meta_key => scehma_type of the fields you want to add to your subtrip. |
||
35 | * |
||
36 | * @var array() |
||
37 | */ |
||
38 | public $place_ids; |
||
39 | /** |
||
40 | * This holds an object or the current trip post. |
||
41 | * |
||
42 | * @var WP_Post(); |
||
43 | */ |
||
44 | public $post; |
||
45 | /** |
||
46 | * This holds URL for the trip |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | public $post_url; |
||
51 | /** |
||
52 | * Constructor. |
||
53 | * |
||
54 | * @param \WPSEO_Schema_Context $context A value object with context variables. |
||
55 | */ |
||
56 | public function __construct( WPSEO_Schema_Context $context ) { |
||
57 | $this->context = $context; |
||
58 | $this->place_ids = array(); |
||
59 | $this->post = get_post( $this->context->id ); |
||
60 | $this->post_url = get_permalink( $this->context->id ); |
||
61 | $this->is_top_level = false; |
||
62 | if ( is_object( $this->post ) && isset( $this->post->post_parent ) && ( false === $this->post->post_parent || 0 === $this->post->post_parent || '' === $this->post->post_parent ) ) { |
||
63 | $this->is_top_level = true; |
||
64 | } |
||
65 | } |
||
66 | /** |
||
67 | * Determines whether or not a piece should be added to the graph. |
||
68 | * |
||
69 | * @return bool |
||
70 | */ |
||
71 | public function is_needed() { |
||
72 | if ( ! is_singular() ) { |
||
73 | return false; |
||
74 | } |
||
75 | if ( false === $this->context->site_represents ) { |
||
76 | return false; |
||
77 | } |
||
78 | return LSX_Schema_Utils::is_type( get_post_type(), $this->post_type ); |
||
79 | } |
||
80 | /** |
||
81 | * Returns Review data. |
||
82 | * |
||
83 | * @return array $data Review data. |
||
84 | */ |
||
85 | public function generate() { |
||
88 | } |
||
89 | /** |
||
90 | * Gets the connected reviews post type and set it as the "Review" schema |
||
91 | * |
||
92 | * @param array $data An array of offers already added. |
||
93 | * @param string $data_key |
||
94 | * @param boolean $include_aggregate |
||
95 | * @return array $data |
||
96 | */ |
||
97 | public function add_reviews( $data, $data_key = 'reviews', $include_aggregate = true ) { |
||
135 | } |
||
136 | /** |
||
137 | * Gets the connected posts and set it as the "Article" schema |
||
138 | * |
||
139 | * @param array $data An array of offers already added. |
||
140 | * @param string $data_key |
||
141 | * @return array $data |
||
142 | */ |
||
143 | public function add_articles( $data, $data_key = 'subjectOf' ) { |
||
144 | $posts = get_post_meta( $this->context->id, 'post_to_' . $this->post_type, false ); |
||
145 | $posts_array = array(); |
||
146 | if ( ! empty( $posts ) ) { |
||
147 | foreach ( $posts as $post_id ) { |
||
148 | $post_args = array( |
||
149 | 'articleBody' => wp_strip_all_tags( get_the_excerpt( $post_id ) ), |
||
150 | 'headline' => get_the_title( $post_id ), |
||
151 | ); |
||
152 | $section = get_the_term_list( $post_id, 'category' ); |
||
153 | if ( ! is_wp_error( $section ) && '' !== $section && false !== $section ) { |
||
154 | $post_args['articleSection'] = wp_strip_all_tags( $section ); |
||
155 | } |
||
156 | if ( $this->context->site_represents_reference ) { |
||
157 | $post_args['publisher'] = $this->context->site_represents_reference; |
||
158 | } |
||
159 | $image_url = get_the_post_thumbnail_url( $post_id, 'lsx-thumbnail-wide' ); |
||
160 | if ( false !== $image_url ) { |
||
161 | $post_args['image'] = $image_url; |
||
162 | } |
||
163 | $posts_array = LSX_Schema_Utils::add_article( $posts_array, $post_id, $this->context, $post_args ); |
||
164 | } |
||
165 | if ( ! empty( $posts_array ) ) { |
||
166 | $data[ $data_key ] = $posts_array; |
||
167 | } |
||
168 | } |
||
169 | return $data; |
||
170 | } |
||
171 | /** |
||
172 | * Adds the Project and Testimonials attached to the Team Member |
||
173 | * |
||
174 | * @param array $data |
||
175 | * |
||
176 | * @return array $data |
||
177 | */ |
||
178 | public function add_connections( $data ) { |
||
194 | } |
||
195 | /** |
||
196 | * Adds the terms for the taxonomy |
||
197 | * |
||
198 | * @param array $data Review data. |
||
199 | * @param array $data_key the parameter name you wish to assign it to. |
||
200 | * @param array $taxonomy the taxonomy to grab terms for. |
||
201 | * |
||
202 | * @return array $data Review data. |
||
203 | */ |
||
204 | public function add_taxonomy_terms( $data, $data_key, $taxonomy ) { |
||
212 | } |
||
213 | /** |
||
214 | * Adds the custom field value for the supplied key |
||
215 | * |
||
216 | * @param array $data Schema data. |
||
217 | * @param string $data_key the parameter name you wish to assign it to. |
||
218 | * @param string $meta_key the taxonomy to grab terms for. |
||
219 | * @param boolean $single A single custom field or an array |
||
220 | * |
||
221 | * @return array $data Review data. |
||
222 | */ |
||
223 | public function add_custom_field( $data, $data_key, $meta_key, $single = true ) { |
||
229 | } |
||
230 | } |
||
231 | } |
||
232 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths