Version Description
(2017-02-21) = * Fixed : Call to undefined function imagecreatefromstring().
Download this release
Release Info
Developer | miiitaka |
Plugin | Markup (JSON-LD) structured in schema.org |
Version | 3.2.1 |
Comparing to | |
See all releases |
Code changes from version 3.2.0 to 3.2.1
- includes/wp-structuring-display.php +23 -77
- readme.txt +4 -1
- wp-structuring-markup.php +5 -6
includes/wp-structuring-display.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
-
* @version 3.2.
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
@@ -192,7 +192,7 @@ class Structuring_Markup_Display {
|
|
192 |
/**
|
193 |
* Return image dimensions
|
194 |
*
|
195 |
-
* @version 3.1
|
196 |
* @since 2.3.3
|
197 |
* @author Justin Frydman
|
198 |
* @author Kazuya Takami
|
@@ -200,73 +200,19 @@ class Structuring_Markup_Display {
|
|
200 |
* @return array | boolean $dimensions
|
201 |
*/
|
202 |
private function get_image_dimensions ( $url ) {
|
203 |
-
|
204 |
-
$cache = new Structuring_Markup_Cache( $url );
|
205 |
-
if ( $cache->get() !== false ) {
|
206 |
-
return $cache->get();
|
207 |
-
}
|
208 |
-
|
209 |
-
if ( function_exists( 'curl_version' ) ) {
|
210 |
-
$headers = array( 'Range: bytes=0-32768' );
|
211 |
-
|
212 |
-
$curl = curl_init( $url );
|
213 |
-
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
|
214 |
-
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
|
215 |
-
curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0 );
|
216 |
-
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, 0 );
|
217 |
-
$data = curl_exec( $curl );
|
218 |
-
curl_close( $curl );
|
219 |
-
|
220 |
-
$image = @imagecreatefromstring( $data );
|
221 |
-
|
222 |
-
if ( $image ) {
|
223 |
-
$width = imagesx( $image );
|
224 |
-
$height = imagesy( $image );
|
225 |
-
|
226 |
-
$dimensions = array( $width, $height );
|
227 |
-
|
228 |
-
/** cache for an hour */
|
229 |
-
$cache->set( $dimensions, HOUR_IN_SECONDS );
|
230 |
-
|
231 |
-
return $dimensions;
|
232 |
-
}
|
233 |
-
}
|
234 |
-
|
235 |
-
if ( $image = @getimagesize( $url ) ) {
|
236 |
-
$dimensions = array( $image[0], $image[1] );
|
237 |
-
|
238 |
-
/** cache for an hour */
|
239 |
-
$cache->set( $dimensions, HOUR_IN_SECONDS );
|
240 |
-
|
241 |
-
return $dimensions;
|
242 |
-
}
|
243 |
-
|
244 |
-
if ( $image = @getimagesize( str_replace( 'https://', 'http://', $url ) ) ) {
|
245 |
-
$dimensions = array( $image[0], $image[1] );
|
246 |
|
247 |
-
|
248 |
-
$
|
249 |
-
|
250 |
-
return
|
251 |
-
}
|
252 |
-
|
253 |
-
/** this hits the database and be very slow if the user is using a URL that doesn't exist in the WP Library */
|
254 |
-
if ( $image = wp_get_attachment_image_src( attachment_url_to_postid( $url ), 'full' ) ) {
|
255 |
-
$dimensions = array( $image[1], $image[2] );
|
256 |
-
|
257 |
-
// cache for an hour
|
258 |
-
$cache->set( $dimensions, HOUR_IN_SECONDS );
|
259 |
-
|
260 |
-
return $dimensions;
|
261 |
}
|
262 |
-
|
263 |
-
return __return_false();
|
264 |
}
|
265 |
|
266 |
/**
|
267 |
* Setting schema.org Article
|
268 |
*
|
269 |
-
* @version 3.1
|
270 |
* @since 1.1.0
|
271 |
* @param array $options
|
272 |
*/
|
@@ -314,11 +260,11 @@ class Structuring_Markup_Display {
|
|
314 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
315 |
"logo" => array(
|
316 |
"@type" => "ImageObject",
|
317 |
-
"url" =>
|
318 |
-
"width" => $logo[
|
319 |
-
"height" => $logo[
|
320 |
)
|
321 |
-
)
|
322 |
);
|
323 |
$args = array_merge( $args, $publisher_args );
|
324 |
}
|
@@ -329,7 +275,7 @@ class Structuring_Markup_Display {
|
|
329 |
/**
|
330 |
* Setting schema.org BlogPosting
|
331 |
*
|
332 |
-
* @version 3.1
|
333 |
* @since 1.2.0
|
334 |
* @param array $options
|
335 |
*/
|
@@ -378,11 +324,11 @@ class Structuring_Markup_Display {
|
|
378 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
379 |
"logo" => array(
|
380 |
"@type" => "ImageObject",
|
381 |
-
"url" =>
|
382 |
-
"width" => $logo[
|
383 |
-
"height" => $logo[
|
384 |
)
|
385 |
-
)
|
386 |
);
|
387 |
$args = array_merge( $args, $publisher_args );
|
388 |
}
|
@@ -597,7 +543,7 @@ class Structuring_Markup_Display {
|
|
597 |
/**
|
598 |
* Setting schema.org NewsArticle
|
599 |
*
|
600 |
-
* @version 3.1
|
601 |
* @since 1.0.0
|
602 |
* @param array $options
|
603 |
*/
|
@@ -625,7 +571,7 @@ class Structuring_Markup_Display {
|
|
625 |
);
|
626 |
|
627 |
if ( has_post_thumbnail( $post->ID ) ) {
|
628 |
-
$images
|
629 |
|
630 |
$images_args = array(
|
631 |
"image" => array(
|
@@ -646,11 +592,11 @@ class Structuring_Markup_Display {
|
|
646 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
647 |
"logo" => array(
|
648 |
"@type" => "ImageObject",
|
649 |
-
"url" =>
|
650 |
-
"width" => $logo[
|
651 |
-
"height" => $logo[
|
652 |
)
|
653 |
-
)
|
654 |
);
|
655 |
$args = array_merge( $args, $publisher_args );
|
656 |
}
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
+
* @version 3.2.1
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
192 |
/**
|
193 |
* Return image dimensions
|
194 |
*
|
195 |
+
* @version 3.2.1
|
196 |
* @since 2.3.3
|
197 |
* @author Justin Frydman
|
198 |
* @author Kazuya Takami
|
200 |
* @return array | boolean $dimensions
|
201 |
*/
|
202 |
private function get_image_dimensions ( $url ) {
|
203 |
+
$image = wp_get_image_editor( $url );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
+
if ( ! is_wp_error( $image ) ) {
|
206 |
+
return $image->get_size();
|
207 |
+
} else {
|
208 |
+
return __return_false();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
}
|
|
|
|
|
210 |
}
|
211 |
|
212 |
/**
|
213 |
* Setting schema.org Article
|
214 |
*
|
215 |
+
* @version 3.2.1
|
216 |
* @since 1.1.0
|
217 |
* @param array $options
|
218 |
*/
|
260 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
261 |
"logo" => array(
|
262 |
"@type" => "ImageObject",
|
263 |
+
"url" => $options['logo'],
|
264 |
+
"width" => $logo['width'],
|
265 |
+
"height" => $logo['height']
|
266 |
)
|
267 |
+
)
|
268 |
);
|
269 |
$args = array_merge( $args, $publisher_args );
|
270 |
}
|
275 |
/**
|
276 |
* Setting schema.org BlogPosting
|
277 |
*
|
278 |
+
* @version 3.2.1
|
279 |
* @since 1.2.0
|
280 |
* @param array $options
|
281 |
*/
|
324 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
325 |
"logo" => array(
|
326 |
"@type" => "ImageObject",
|
327 |
+
"url" => $options['logo'],
|
328 |
+
"width" => $logo['width'],
|
329 |
+
"height" => $logo['height']
|
330 |
)
|
331 |
+
)
|
332 |
);
|
333 |
$args = array_merge( $args, $publisher_args );
|
334 |
}
|
543 |
/**
|
544 |
* Setting schema.org NewsArticle
|
545 |
*
|
546 |
+
* @version 3.2.1
|
547 |
* @since 1.0.0
|
548 |
* @param array $options
|
549 |
*/
|
571 |
);
|
572 |
|
573 |
if ( has_post_thumbnail( $post->ID ) ) {
|
574 |
+
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
575 |
|
576 |
$images_args = array(
|
577 |
"image" => array(
|
592 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
593 |
"logo" => array(
|
594 |
"@type" => "ImageObject",
|
595 |
+
"url" => $options['logo'],
|
596 |
+
"width" => $logo['width'],
|
597 |
+
"height" => $logo['height']
|
598 |
)
|
599 |
+
)
|
600 |
);
|
601 |
$args = array_merge( $args, $publisher_args );
|
602 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: miiitaka
|
|
3 |
Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
|
4 |
Requires at least: 4.3.1
|
5 |
Tested up to: 4.7.2
|
6 |
-
Stable tag: 3.2.
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
@@ -54,6 +54,9 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
|
|
54 |
|
55 |
== Changelog ==
|
56 |
|
|
|
|
|
|
|
57 |
= 3.2.0 (2017-01-30) =
|
58 |
* Fixed : Invalid breadcrumb markup.
|
59 |
* Fixed : Some items are not displayed on "Organization schema.org".
|
3 |
Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
|
4 |
Requires at least: 4.3.1
|
5 |
Tested up to: 4.7.2
|
6 |
+
Stable tag: 3.2.1
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
54 |
|
55 |
== Changelog ==
|
56 |
|
57 |
+
= 3.2.1 (2017-02-21) =
|
58 |
+
* Fixed : Call to undefined function imagecreatefromstring().
|
59 |
+
|
60 |
= 3.2.0 (2017-01-30) =
|
61 |
* Fixed : Invalid breadcrumb markup.
|
62 |
* Fixed : Some items are not displayed on "Organization schema.org".
|
wp-structuring-markup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Markup (JSON-LD) structured in schema.org
|
4 |
Plugin URI: https://github.com/miiitaka/wp-structuring-markup
|
5 |
Description: Allows you to include schema.org JSON-LD syntax markup on your website
|
6 |
-
Version: 3.2.
|
7 |
Author: Kazuya Takami
|
8 |
Author URI: https://www.terakoya.work/
|
9 |
License: GPLv2 or later
|
@@ -18,7 +18,7 @@ new Structuring_Markup();
|
|
18 |
* Schema.org Basic Class
|
19 |
*
|
20 |
* @author Kazuya Takami
|
21 |
-
* @version 3.2.
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
@@ -26,11 +26,11 @@ class Structuring_Markup {
|
|
26 |
/**
|
27 |
* Variable definition.
|
28 |
*
|
29 |
-
* @version 3.2.
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
private $text_domain = 'wp-structuring-markup';
|
33 |
-
private $version = '3.2.
|
34 |
|
35 |
/**
|
36 |
* Constructor Define.
|
@@ -205,11 +205,10 @@ class Structuring_Markup {
|
|
205 |
/**
|
206 |
* Display Page Template Require.
|
207 |
*
|
208 |
-
* @version 3.1
|
209 |
* @since 1.3.0
|
210 |
*/
|
211 |
public function wp_head () {
|
212 |
-
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-cache.php' );
|
213 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-opening-hours.php' );
|
214 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
|
215 |
new Structuring_Markup_Display( $this->version );
|
3 |
Plugin Name: Markup (JSON-LD) structured in schema.org
|
4 |
Plugin URI: https://github.com/miiitaka/wp-structuring-markup
|
5 |
Description: Allows you to include schema.org JSON-LD syntax markup on your website
|
6 |
+
Version: 3.2.1
|
7 |
Author: Kazuya Takami
|
8 |
Author URI: https://www.terakoya.work/
|
9 |
License: GPLv2 or later
|
18 |
* Schema.org Basic Class
|
19 |
*
|
20 |
* @author Kazuya Takami
|
21 |
+
* @version 3.2.1
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
26 |
/**
|
27 |
* Variable definition.
|
28 |
*
|
29 |
+
* @version 3.2.1
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
private $text_domain = 'wp-structuring-markup';
|
33 |
+
private $version = '3.2.1';
|
34 |
|
35 |
/**
|
36 |
* Constructor Define.
|
205 |
/**
|
206 |
* Display Page Template Require.
|
207 |
*
|
208 |
+
* @version 3.2.1
|
209 |
* @since 1.3.0
|
210 |
*/
|
211 |
public function wp_head () {
|
|
|
212 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-opening-hours.php' );
|
213 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
|
214 |
new Structuring_Markup_Display( $this->version );
|