PluginProbe
Assistant – Every Day Productivity Apps / 1.4.7
Assistant – Every Day Productivity Apps v1.4.7
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
← All changes | backend/src/Helpers/MediaPathHelper.php +15 -2 0.7.0.21.4.7 View file →
@@ -6,8 +6,17 @@
6 6
7 7 class MediaPathHelper {
8 8
9 9 /**
10 + * Array of data keys to ignore when parsing data.
11 + *
12 + * @var array
13 + */
14 + static private $data_blacklist = [
15 + '_seopress_analysis_data'
16 + ];
17 +
18 + /**
10 19 * Replaces the imported attachment in an object or array.
11 20 *
12 21 * @param object|array|string $data
13 22 * @param array $imported
@@ -187,9 +196,9 @@
187 196 * @param string $string
188 197 * @return array
189 198 */
190 199 static public function get_image_urls_from_string( $string ) {
191 - $pattern = '#https?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/)\.(jpg|jpeg|png|gif))#';
200 + $pattern = '#https?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/|_)\.(jpg|jpeg|png|gif|svg|webp))#';
192 201 $urls = [];
193 202
194 203 if ( preg_match_all( $pattern, $string, $matches ) ) {
195 204 if ( isset( $matches[0] ) && ! empty( $matches[0] ) ) {
@@ -209,8 +218,12 @@
209 218 static public function get_image_urls_from_data( $data ) {
210 219 $urls = [];
211 220
212 221 foreach ( $data as $key => $val ) {
222 + if ( in_array( $key, self::$data_blacklist ) ) {
223 + continue;
224 + }
225 +
213 226 $val = maybe_unserialize( $val );
214 227
215 228 if ( is_object( $val ) || is_array( $val ) ) {
216 229 $urls = array_merge( $urls, self::get_image_urls_from_data( $val ) );
@@ -240,9 +253,9 @@
240 253 'height' => null,
241 254 'ext' => null,
242 255 ];
243 256
244 - preg_match_all( '/(-(\d+)x(\d+))\.(jpg|jpeg|png|gif)/', $url, $matches );
257 + preg_match_all( '/(-(\d+)x(\d+))\.(jpg|jpeg|png|gif|svg)/', $url, $matches );
245 258
246 259 if ( isset( $matches[1] ) && ! empty( $matches[1] ) ) {
247 260 $info['full_size_url'] = str_replace( $matches[1], '', $url );
248 261 }