Passed
Push — dependabot/composer/wpackagist... ( cb63fc )
by
unknown
07:56
created
partials/content-custom.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@
 block discarded – undo
15 15
 
16 16
 	<div class="entry-content">
17 17
 		<?php
18
-			the_content();
19
-
20
-			wp_link_pages( array(
21
-				'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
22
-				'after'       => '</div></div>',
23
-				'link_before' => '<span>',
24
-				'link_after'  => '</span>',
25
-			) );
26
-		?>
18
+               the_content();
19
+
20
+               wp_link_pages( array(
21
+                    'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
22
+                    'after'       => '</div></div>',
23
+                    'link_before' => '<span>',
24
+                    'link_after'  => '</span>',
25
+               ) );
26
+          ?>
27 27
 	</div><!-- .entry-content -->
28 28
 
29 29
 	<?php lsx_entry_bottom(); ?>
Please login to merge, or discard this patch.
partials/content-page.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@
 block discarded – undo
18 18
 		<?php lsx_entry_inside_top(); ?>
19 19
 
20 20
 		<?php
21
-			the_content();
22
-
23
-			wp_link_pages( array(
24
-				'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
25
-				'after'       => '</div></div>',
26
-				'link_before' => '<span>',
27
-				'link_after'  => '</span>',
28
-			) );
29
-		?>
21
+               the_content();
22
+
23
+               wp_link_pages( array(
24
+                    'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
25
+                    'after'       => '</div></div>',
26
+                    'link_before' => '<span>',
27
+                    'link_after'  => '</span>',
28
+               ) );
29
+          ?>
30 30
 	</div><!-- .entry-content -->
31 31
 
32 32
 	<?php lsx_entry_bottom(); ?>
Please login to merge, or discard this patch.
partials/content-widget-review.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit;
9
+     exit;
10 10
 }
11 11
 global $comment, $stored_comment, $_product, $rating;
12 12
 $the_comment = $comment;
13 13
 if ( null !== $stored_comment ) {
14
-	$the_comment = $stored_comment;
14
+     $the_comment = $stored_comment;
15 15
 }
16 16
 ?>
17 17
 <div class="lsx-woocommerce-review-slot">
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
 			<p class="lsx-woocommerce-reviewer">
35 35
 				<?php
36
-					/* translators: %s: review author */
37
-					echo wp_kses_post( esc_html__( 'by ', 'lsx' ) . get_comment_author( $the_comment->comment_ID ) );
38
-				?>
36
+                         /* translators: %s: review author */
37
+                         echo wp_kses_post( esc_html__( 'by ', 'lsx' ) . get_comment_author( $the_comment->comment_ID ) );
38
+                    ?>
39 39
 			</p>
40 40
 
41 41
 			<div class="lsx-woocommerce-content">
Please login to merge, or discard this patch.
page.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 		<?php if ( have_posts() ) : ?>
21 21
 
22 22
 			<?php
23
-			while ( have_posts() ) :
24
-				the_post();
25
-			?>
23
+               while ( have_posts() ) :
24
+                    the_post();
25
+               ?>
26 26
 
27 27
 				<?php get_template_part( 'partials/content', 'page' ); ?>
28 28
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 	<?php lsx_content_after(); ?>
38 38
 
39 39
 	<?php
40
-	if ( comments_open() ) {
41
-		comments_template();
42
-	}
43
-	?>
40
+     if ( comments_open() ) {
41
+          comments_template();
42
+     }
43
+     ?>
44 44
 
45 45
 </div><!-- #primary -->
46 46
 
Please login to merge, or discard this patch.
page-templates/template-sitemap.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
 		<?php if ( have_posts() ) : ?>
24 24
 
25 25
 			<?php
26
-			while ( have_posts() ) :
27
-				the_post();
28
-				?>
26
+               while ( have_posts() ) :
27
+                    the_post();
28
+                    ?>
29 29
 
30 30
 				<?php lsx_entry_before(); ?>
31 31
 
Please login to merge, or discard this patch.
page-templates/template-archives.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 		<?php if ( have_posts() ) : ?>
24 24
 
25 25
 			<?php
26
-			while ( have_posts() ) :
27
-				the_post();
28
-				?>
26
+               while ( have_posts() ) :
27
+                    the_post();
28
+                    ?>
29 29
 
30 30
 				<?php lsx_entry_before(); ?>
31 31
 
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 
39 39
 						<ul>
40 40
 							<?php
41
-								$loop = new WP_Query(
42
-									array(
43
-										'posts_per_page' => 30,
44
-									)
45
-								);
46
-							?>
41
+                                        $loop = new WP_Query(
42
+                                             array(
43
+                                                  'posts_per_page' => 30,
44
+                                             )
45
+                                        );
46
+                                   ?>
47 47
 
48 48
 							<?php if ( $loop->have_posts() ) : ?>
49 49
 
50 50
 								<?php while ( $loop->have_posts() ) : ?>
51 51
 
52 52
 									<?php
53
-										$loop->the_post();
54
-										$loop->is_home = false;
55
-									?>
53
+                                                  $loop->the_post();
54
+                                                  $loop->is_home = false;
55
+                                             ?>
56 56
 
57 57
 									<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time( get_option( 'date_format' ) ); ?> - <?php echo esc_html( $post->comment_count ); ?> <?php esc_html_e( 'comments', 'lsx' ); ?></li>
58 58
 
Please login to merge, or discard this patch.
archive.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 			<div class="post-wrapper">
23 23
 
24 24
 				<?php
25
-				while ( have_posts() ) :
26
-					the_post();
27
-					?>
25
+                    while ( have_posts() ) :
26
+                         the_post();
27
+                         ?>
28 28
 
29 29
 					<?php get_template_part( 'partials/content', get_post_format() ); ?>
30 30
 
Please login to merge, or discard this patch.
includes/bbpress/bbpress.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+     exit;
11 11
 }
12 12
 
13 13
 global $bbpress;
14 14
 
15 15
 if ( ! function_exists( 'lsx_bbpress_scripts_add_styles' ) ) :
16 16
 
17
-	/**
18
-	 * bbPress enqueue styles.
19
-	 *
20
-	 * @package    lsx
21
-	 * @subpackage bbpress
22
-	 */
23
-	function lsx_bbpress_scripts_add_styles() {
24
-		wp_enqueue_style( 'bbpress-lsx', get_template_directory_uri() . '/assets/css/bb-press/bb-press.css', array( 'lsx_main' ), LSX_VERSION );
25
-		wp_style_add_data( 'bbpress-lsx', 'rtl', 'replace' );
26
-	}
17
+     /**
18
+      * bbPress enqueue styles.
19
+      *
20
+      * @package    lsx
21
+      * @subpackage bbpress
22
+      */
23
+     function lsx_bbpress_scripts_add_styles() {
24
+          wp_enqueue_style( 'bbpress-lsx', get_template_directory_uri() . '/assets/css/bb-press/bb-press.css', array( 'lsx_main' ), LSX_VERSION );
25
+          wp_style_add_data( 'bbpress-lsx', 'rtl', 'replace' );
26
+     }
27 27
 
28
-	add_action( 'wp_enqueue_scripts', 'lsx_bbpress_scripts_add_styles' );
28
+     add_action( 'wp_enqueue_scripts', 'lsx_bbpress_scripts_add_styles' );
29 29
 
30 30
 endif;
31 31
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 add_filter( 'get_the_archive_title', 'modify_archive_title', 10, 1 );
35 35
 
36 36
 function modify_archive_title( $title ) {
37
-	if ( ! is_post_type_archive( 'forum' ) ) {
38
-		return $title;
39
-	}
40
-	$title = __( 'Forums', 'lsx' );
41
-	return $title;
37
+     if ( ! is_post_type_archive( 'forum' ) ) {
38
+          return $title;
39
+     }
40
+     $title = __( 'Forums', 'lsx' );
41
+     return $title;
42 42
 }
Please login to merge, or discard this patch.
includes/classes/class-lsx-schema-utils.php 1 patch
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -10,212 +10,212 @@
 block discarded – undo
10 10
  * @since 11.6
11 11
  */
12 12
 class LSX_Schema_Utils {
13
-	/**
14
-	 * Determines whether a given post type should have Review schema.
15
-	 *
16
-	 * @param string $post_type       Post type to check.
17
-	 * @param string $comparison_type Post type to check against.
18
-	 *
19
-	 * @return bool True if it has schema, false if not.
20
-	 */
21
-	public static function is_type( $post_type = null, $comparison_type = null ) {
22
-		if ( is_null( $comparison_type ) ) {
23
-			return false;
24
-		}
25
-		if ( is_null( $post_type ) ) {
26
-			$post_type = get_post_type();
27
-		}
28
-		/**
29
-		 * Filter: 'wpseo_schema_$this->post_type_post_types' - Allow changing for which post types we output Review schema.
30
-		 *
31
-		 * @api string[] $post_types The post types for which we output Review.
32
-		 */
33
-		$post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) );
34
-		return in_array( $post_type, $post_types );
35
-	}
36
-	/**
37
-	 * Retrieve a users Schema ID.
38
-	 *
39
-	 * @param string               $place_id The Name of the Reviewer you need a for.
40
-	 * @param string               $type the type of the place.
41
-	 * @param WPSEO_Schema_Context $context A value object with context variables.
42
-	 *
43
-	 * @return string The user's schema ID.
44
-	 */
45
-	public static function get_places_schema_id( $place_id, $type, $context ) {
46
-		$url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) );
47
-		return trailingslashit( $url );
48
-	}
49
-	/**
50
-	 * Retrieve a users Schema ID.
51
-	 *
52
-	 * @param string               $name The Name of the Reviewer you need a for.
53
-	 * @param WPSEO_Schema_Context $context A value object with context variables.
54
-	 *
55
-	 * @return string The user's schema ID.
56
-	 */
57
-	public static function get_subtrip_schema_id( $name, $context ) {
58
-		$url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id );
59
-		return trailingslashit( $url );
60
-	}
61
-	/**
62
-	 * Retrieve an offer Schema ID.
63
-	 *
64
-	 * @param string               $id      post ID of the place being added.
65
-	 * @param WPSEO_Schema_Context $context A value object with context variables.
66
-	 * @param string               $local   if the Schema is local true / false.
67
-	 *
68
-	 * @return string The user's schema ID.
69
-	 */
70
-	public static function get_offer_schema_id( $id, $context, $local = false ) {
71
-		if ( false === $local ) {
72
-			$url = $context->site_url;
73
-		} else {
74
-			$url = get_permalink( $context->id );
75
-		}
76
-		$url .= '#/schema/offer/';
77
-		$url .= wp_hash( $id . get_the_title( $id ) );
78
-		return trailingslashit( $url );
79
-	}
80
-	/**
81
-	 * Retrieve an review Schema ID.
82
-	 *
83
-	 * @param string               $id      post ID of the place being added.
84
-	 * @param WPSEO_Schema_Context $context A value object with context variables.
85
-	 * @param string               $local   if the Schema is local true / false.
86
-	 *
87
-	 * @return string The user's schema ID.
88
-	 */
89
-	public static function get_review_schema_id( $id, $context, $local = false ) {
90
-		if ( false === $local ) {
91
-			$url = $context->site_url;
92
-		} else {
93
-			$url = get_permalink( $context->id );
94
-		}
95
-		$url .= '#/schema/review/';
96
-		$url .= wp_hash( $id . get_the_title( $id ) );
97
-		return trailingslashit( $url );
98
-	}
99
-	/**
100
-	 * Retrieve an Article Schema ID.
101
-	 *
102
-	 * @param string               $id      post ID of the place being added.
103
-	 * @param WPSEO_Schema_Context $context A value object with context variables.
104
-	 * @param string               $local   if the Schema is local true / false.
105
-	 *
106
-	 * @return string The user's schema ID.
107
-	 */
108
-	public static function get_article_schema_id( $id, $context, $local = false ) {
109
-		if ( false === $local ) {
110
-			$url = get_permalink( $id ) . \Schema_IDs::ARTICLE_HASH;
111
-		} else {
112
-			$url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) );
113
-		}
114
-		return trailingslashit( $url );
115
-	}
116
-	/**
117
-	 * Retrieve a users Schema ID.
118
-	 *
119
-	 * @param string               $name The Name of the Reviewer you need a for.
120
-	 * @param WPSEO_Schema_Context $context A value object with context variables.
121
-	 *
122
-	 * @return string The user's schema ID.
123
-	 */
124
-	public static function get_author_schema_id( $name, $email, $context ) {
125
-		return $context->site_url . \Schema_IDs::PERSON_HASH . wp_hash( $name . $email );
126
-	}
127
-	/**
128
-	 * Generates the place graph piece for the subtrip / Itinerary arrays.
129
-	 *
130
-	 * @param array                $data         subTrip / itinerary data.
131
-	 * @param string               $type         The type in data to save the terms in.
132
-	 * @param string               $post_id      The post ID of the current Place to add.
133
-	 * @param WPSEO_Schema_Context $context      The post ID of the current Place to add.
134
-	 * @param string               $contained_in The @id of the containedIn place.
135
-	 *
136
-	 * @return mixed array $data Place data.
137
-	 */
138
-	public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) {
139
-		$at_id = self::get_places_schema_id( $post_id, $type, $context );
140
-		$place = array(
141
-			'@type'       => $type,
142
-			'@id'         => $at_id,
143
-			'name'        => get_the_title( $post_id ),
144
-			'description' => get_the_excerpt( $post_id ),
145
-			'url'         => get_permalink( $post_id ),
146
-		);
147
-		if ( false !== $contained_in ) {
148
-			$place['containedInPlace'] = array(
149
-				'@type' => 'Country',
150
-				'@id'   => $contained_in,
151
-			);
152
-		}
153
-		$data[] = $place;
154
-		return $data;
155
-	}
156
-	/**
157
-	 * Adds an image node if the post has a featured image.
158
-	 *
159
-	 * @param array                $data         The Review data.
160
-	 * @param WPSEO_Schema_Context $context      The post ID of the current Place to add.
161
-	 *
162
-	 * @return array $data The Review data.
163
-	 */
164
-	public static function add_image( $data, $context ) {
165
-		if ( $context->has_image ) {
166
-			$data['image'] = array(
167
-				'@id' => $context->canonical . \Schema_IDs::PRIMARY_IMAGE_HASH,
168
-			);
169
-		}
170
-		return $data;
171
-	}
172
-	/**
173
-	 * Generates the itemReviewed schema
174
-	 *
175
-	 * @param  array  $items The array of IDS.
176
-	 * @param  string $type The schema type.
177
-	 * @return array $schema An array of the schema markup.
178
-	 */
179
-	public static function get_item_reviewed( $items = array(), $type = '' ) {
180
-		$schema = array();
181
-		if ( false !== $items && ! empty( $items ) && '' !== $type ) {
182
-			array_unique( $items );
183
-			foreach ( $items as $item ) {
184
-				$title = get_the_title( $item );
185
-				if ( '' !== $title ) {
186
-					$item_schema = array(
187
-						'@type' => $type,
188
-						'name'  => $title,
189
-					);
190
-					$schema[]    = $item_schema;
191
-				}
192
-			}
193
-		}
194
-		return $schema;
195
-	}
196
-	/**
197
-	 * Adds a term or multiple terms, comma separated, to a field.
198
-	 *
199
-	 * @param array  $data     Review data.
200
-	 * @param string $post_id  The ID of the item to fetch terms.
201
-	 * @param string $key      The key in data to save the terms in.
202
-	 * @param string $taxonomy The taxonomy to retrieve the terms from.
203
-	 *
204
-	 * @return mixed array $data Review data.
205
-	 */
206
-	public static function add_terms( $data, $post_id, $key, $taxonomy ) {
207
-		$terms = get_the_terms( $post_id, $taxonomy );
208
-		if ( is_array( $terms ) ) {
209
-			$keywords = array();
210
-			foreach ( $terms as $term ) {
211
-				// We are checking against the WordPress internal translation.
212
-				// @codingStandardsIgnoreLine
213
-				if ( __( 'Uncategorized', 'lsx' ) !== $term->name ) {
214
-					$keywords[] = $term->name;
215
-				}
216
-			}
217
-			$data[ $key ] = implode( ',', $keywords );
218
-		}
219
-		return $data;
220
-	}
13
+     /**
14
+      * Determines whether a given post type should have Review schema.
15
+      *
16
+      * @param string $post_type       Post type to check.
17
+      * @param string $comparison_type Post type to check against.
18
+      *
19
+      * @return bool True if it has schema, false if not.
20
+      */
21
+     public static function is_type( $post_type = null, $comparison_type = null ) {
22
+          if ( is_null( $comparison_type ) ) {
23
+               return false;
24
+          }
25
+          if ( is_null( $post_type ) ) {
26
+               $post_type = get_post_type();
27
+          }
28
+          /**
29
+           * Filter: 'wpseo_schema_$this->post_type_post_types' - Allow changing for which post types we output Review schema.
30
+           *
31
+           * @api string[] $post_types The post types for which we output Review.
32
+           */
33
+          $post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) );
34
+          return in_array( $post_type, $post_types );
35
+     }
36
+     /**
37
+      * Retrieve a users Schema ID.
38
+      *
39
+      * @param string               $place_id The Name of the Reviewer you need a for.
40
+      * @param string               $type the type of the place.
41
+      * @param WPSEO_Schema_Context $context A value object with context variables.
42
+      *
43
+      * @return string The user's schema ID.
44
+      */
45
+     public static function get_places_schema_id( $place_id, $type, $context ) {
46
+          $url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) );
47
+          return trailingslashit( $url );
48
+     }
49
+     /**
50
+      * Retrieve a users Schema ID.
51
+      *
52
+      * @param string               $name The Name of the Reviewer you need a for.
53
+      * @param WPSEO_Schema_Context $context A value object with context variables.
54
+      *
55
+      * @return string The user's schema ID.
56
+      */
57
+     public static function get_subtrip_schema_id( $name, $context ) {
58
+          $url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id );
59
+          return trailingslashit( $url );
60
+     }
61
+     /**
62
+      * Retrieve an offer Schema ID.
63
+      *
64
+      * @param string               $id      post ID of the place being added.
65
+      * @param WPSEO_Schema_Context $context A value object with context variables.
66
+      * @param string               $local   if the Schema is local true / false.
67
+      *
68
+      * @return string The user's schema ID.
69
+      */
70
+     public static function get_offer_schema_id( $id, $context, $local = false ) {
71
+          if ( false === $local ) {
72
+               $url = $context->site_url;
73
+          } else {
74
+               $url = get_permalink( $context->id );
75
+          }
76
+          $url .= '#/schema/offer/';
77
+          $url .= wp_hash( $id . get_the_title( $id ) );
78
+          return trailingslashit( $url );
79
+     }
80
+     /**
81
+      * Retrieve an review Schema ID.
82
+      *
83
+      * @param string               $id      post ID of the place being added.
84
+      * @param WPSEO_Schema_Context $context A value object with context variables.
85
+      * @param string               $local   if the Schema is local true / false.
86
+      *
87
+      * @return string The user's schema ID.
88
+      */
89
+     public static function get_review_schema_id( $id, $context, $local = false ) {
90
+          if ( false === $local ) {
91
+               $url = $context->site_url;
92
+          } else {
93
+               $url = get_permalink( $context->id );
94
+          }
95
+          $url .= '#/schema/review/';
96
+          $url .= wp_hash( $id . get_the_title( $id ) );
97
+          return trailingslashit( $url );
98
+     }
99
+     /**
100
+      * Retrieve an Article Schema ID.
101
+      *
102
+      * @param string               $id      post ID of the place being added.
103
+      * @param WPSEO_Schema_Context $context A value object with context variables.
104
+      * @param string               $local   if the Schema is local true / false.
105
+      *
106
+      * @return string The user's schema ID.
107
+      */
108
+     public static function get_article_schema_id( $id, $context, $local = false ) {
109
+          if ( false === $local ) {
110
+               $url = get_permalink( $id ) . \Schema_IDs::ARTICLE_HASH;
111
+          } else {
112
+               $url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) );
113
+          }
114
+          return trailingslashit( $url );
115
+     }
116
+     /**
117
+      * Retrieve a users Schema ID.
118
+      *
119
+      * @param string               $name The Name of the Reviewer you need a for.
120
+      * @param WPSEO_Schema_Context $context A value object with context variables.
121
+      *
122
+      * @return string The user's schema ID.
123
+      */
124
+     public static function get_author_schema_id( $name, $email, $context ) {
125
+          return $context->site_url . \Schema_IDs::PERSON_HASH . wp_hash( $name . $email );
126
+     }
127
+     /**
128
+      * Generates the place graph piece for the subtrip / Itinerary arrays.
129
+      *
130
+      * @param array                $data         subTrip / itinerary data.
131
+      * @param string               $type         The type in data to save the terms in.
132
+      * @param string               $post_id      The post ID of the current Place to add.
133
+      * @param WPSEO_Schema_Context $context      The post ID of the current Place to add.
134
+      * @param string               $contained_in The @id of the containedIn place.
135
+      *
136
+      * @return mixed array $data Place data.
137
+      */
138
+     public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) {
139
+          $at_id = self::get_places_schema_id( $post_id, $type, $context );
140
+          $place = array(
141
+               '@type'       => $type,
142
+               '@id'         => $at_id,
143
+               'name'        => get_the_title( $post_id ),
144
+               'description' => get_the_excerpt( $post_id ),
145
+               'url'         => get_permalink( $post_id ),
146
+          );
147
+          if ( false !== $contained_in ) {
148
+               $place['containedInPlace'] = array(
149
+                    '@type' => 'Country',
150
+                    '@id'   => $contained_in,
151
+               );
152
+          }
153
+          $data[] = $place;
154
+          return $data;
155
+     }
156
+     /**
157
+      * Adds an image node if the post has a featured image.
158
+      *
159
+      * @param array                $data         The Review data.
160
+      * @param WPSEO_Schema_Context $context      The post ID of the current Place to add.
161
+      *
162
+      * @return array $data The Review data.
163
+      */
164
+     public static function add_image( $data, $context ) {
165
+          if ( $context->has_image ) {
166
+               $data['image'] = array(
167
+                    '@id' => $context->canonical . \Schema_IDs::PRIMARY_IMAGE_HASH,
168
+               );
169
+          }
170
+          return $data;
171
+     }
172
+     /**
173
+      * Generates the itemReviewed schema
174
+      *
175
+      * @param  array  $items The array of IDS.
176
+      * @param  string $type The schema type.
177
+      * @return array $schema An array of the schema markup.
178
+      */
179
+     public static function get_item_reviewed( $items = array(), $type = '' ) {
180
+          $schema = array();
181
+          if ( false !== $items && ! empty( $items ) && '' !== $type ) {
182
+               array_unique( $items );
183
+               foreach ( $items as $item ) {
184
+                    $title = get_the_title( $item );
185
+                    if ( '' !== $title ) {
186
+                         $item_schema = array(
187
+                              '@type' => $type,
188
+                              'name'  => $title,
189
+                         );
190
+                         $schema[]    = $item_schema;
191
+                    }
192
+               }
193
+          }
194
+          return $schema;
195
+     }
196
+     /**
197
+      * Adds a term or multiple terms, comma separated, to a field.
198
+      *
199
+      * @param array  $data     Review data.
200
+      * @param string $post_id  The ID of the item to fetch terms.
201
+      * @param string $key      The key in data to save the terms in.
202
+      * @param string $taxonomy The taxonomy to retrieve the terms from.
203
+      *
204
+      * @return mixed array $data Review data.
205
+      */
206
+     public static function add_terms( $data, $post_id, $key, $taxonomy ) {
207
+          $terms = get_the_terms( $post_id, $taxonomy );
208
+          if ( is_array( $terms ) ) {
209
+               $keywords = array();
210
+               foreach ( $terms as $term ) {
211
+                    // We are checking against the WordPress internal translation.
212
+                    // @codingStandardsIgnoreLine
213
+                    if ( __( 'Uncategorized', 'lsx' ) !== $term->name ) {
214
+                         $keywords[] = $term->name;
215
+                    }
216
+               }
217
+               $data[ $key ] = implode( ',', $keywords );
218
+          }
219
+          return $data;
220
+     }
221 221
 }
Please login to merge, or discard this patch.