Code Duplication    Length = 32-32 lines in 2 locations

projects/packages/post-images/src/class-post-images.php 1 location

@@ 147-178 (lines=32) @@
144
			unset( $GLOBALS['post'] );
145
		}
146
147
		foreach ( $galleries as $gallery ) {
148
			if ( isset( $gallery['type'] ) && 'slideshow' === $gallery['type'] && ! empty( $gallery['ids'] ) ) {
149
				$image_ids  = explode( ',', $gallery['ids'] );
150
				$image_size = isset( $gallery['size'] ) ? $gallery['size'] : 'thumbnail';
151
				foreach ( $image_ids as $image_id ) {
152
					$image = wp_get_attachment_image_src( $image_id, $image_size );
153
					if ( ! empty( $image[0] ) ) {
154
						list( $raw_src ) = explode( '?', $image[0] ); // pull off any Query string (?w=250).
155
						$raw_src         = wp_specialchars_decode( $raw_src ); // rawify it.
156
						$raw_src         = esc_url_raw( $raw_src ); // clean it.
157
						$images[]        = array(
158
							'type' => 'image',
159
							'from' => 'gallery',
160
							'src'  => $raw_src,
161
							'href' => $permalink,
162
						);
163
					}
164
				}
165
			} elseif ( ! empty( $gallery['src'] ) ) {
166
				foreach ( $gallery['src'] as $src ) {
167
					list( $raw_src ) = explode( '?', $src ); // pull off any Query string (?w=250).
168
					$raw_src         = wp_specialchars_decode( $raw_src ); // rawify it.
169
					$raw_src         = esc_url_raw( $raw_src ); // clean it.
170
					$images[]        = array(
171
						'type' => 'image',
172
						'from' => 'gallery',
173
						'src'  => $raw_src,
174
						'href' => $permalink,
175
					);
176
				}
177
			}
178
		}
179
180
		return $images;
181
	}

projects/plugins/jetpack/class.jetpack-post-images.php 1 location

@@ 139-170 (lines=32) @@
136
			unset( $GLOBALS['post'] );
137
		}
138
139
		foreach ( $galleries as $gallery ) {
140
			if ( isset( $gallery['type'] ) && 'slideshow' === $gallery['type'] && ! empty( $gallery['ids'] ) ) {
141
				$image_ids  = explode( ',', $gallery['ids'] );
142
				$image_size = isset( $gallery['size'] ) ? $gallery['size'] : 'thumbnail';
143
				foreach ( $image_ids as $image_id ) {
144
					$image = wp_get_attachment_image_src( $image_id, $image_size );
145
					if ( ! empty( $image[0] ) ) {
146
						list( $raw_src ) = explode( '?', $image[0] ); // pull off any Query string (?w=250)
147
						$raw_src         = wp_specialchars_decode( $raw_src ); // rawify it
148
						$raw_src         = esc_url_raw( $raw_src ); // clean it
149
						$images[]        = array(
150
							'type' => 'image',
151
							'from' => 'gallery',
152
							'src'  => $raw_src,
153
							'href' => $permalink,
154
						);
155
					}
156
				}
157
			} elseif ( ! empty( $gallery['src'] ) ) {
158
				foreach ( $gallery['src'] as $src ) {
159
					list( $raw_src ) = explode( '?', $src ); // pull off any Query string (?w=250)
160
					$raw_src         = wp_specialchars_decode( $raw_src ); // rawify it
161
					$raw_src         = esc_url_raw( $raw_src ); // clean it
162
					$images[]        = array(
163
						'type' => 'image',
164
						'from' => 'gallery',
165
						'src'  => $raw_src,
166
						'href' => $permalink,
167
					);
168
				}
169
			}
170
		}
171
172
		return $images;
173
	}