Version Description
(2016-08-17) = * Fixed : Type Person and Organization Non-display case "sameAs" is empty. * Checked : WordPress version 4.6.0 operation check.
Download this release
Release Info
Developer | miiitaka |
Plugin | Markup (JSON-LD) structured in schema.org |
Version | 3.0.4 |
Comparing to | |
See all releases |
Code changes from version 3.0.3 to 3.0.4
- includes/wp-structuring-display.php +70 -68
- readme.txt +6 -2
- wp-structuring-markup.php +1 -1
includes/wp-structuring-display.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
-
* @version 3.0.
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
@@ -38,7 +38,7 @@ class Structuring_Markup_Display {
|
|
38 |
$structuring_markup_args = $db->get_list_options();
|
39 |
|
40 |
echo '<!-- Markup (JSON-LD) structured in schema.org START -->' . PHP_EOL;
|
41 |
-
|
42 |
$this->get_schema_data( 'all', $structuring_markup_args );
|
43 |
if ( is_home() || is_front_page() ) {
|
44 |
$this->get_schema_data( 'home', $structuring_markup_args );
|
@@ -186,69 +186,69 @@ class Structuring_Markup_Display {
|
|
186 |
* @param string $url
|
187 |
* @return array $dimensions
|
188 |
*/
|
189 |
-
|
190 |
$cache = new Structuring_Markup_Cache( $url );
|
191 |
-
|
192 |
/** check for cached dimensions */
|
193 |
-
if( $cache->get() !== false ) {
|
194 |
return $cache->get();
|
195 |
}
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
}
|
253 |
|
254 |
/**
|
@@ -465,7 +465,7 @@ class Structuring_Markup_Display {
|
|
465 |
* Setting schema.org LocalBusiness
|
466 |
*
|
467 |
* @since 2.3.0
|
468 |
-
* @version 3.0.
|
469 |
* @param array $options
|
470 |
*/
|
471 |
private function set_schema_local_business ( array $options ) {
|
@@ -508,8 +508,8 @@ class Structuring_Markup_Display {
|
|
508 |
"postalCode" => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : "",
|
509 |
"addressCountry" => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ""
|
510 |
);
|
511 |
-
$args
|
512 |
-
|
513 |
|
514 |
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
515 |
$geo_array["geo"] = array(
|
@@ -618,7 +618,7 @@ class Structuring_Markup_Display {
|
|
618 |
"@type" => "ImageObject",
|
619 |
"url" => isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "",
|
620 |
"width" => $logo[0],
|
621 |
-
|
622 |
)
|
623 |
),
|
624 |
"description" => $content
|
@@ -674,7 +674,7 @@ class Structuring_Markup_Display {
|
|
674 |
$socials["sameAs"][] = esc_url( $value );
|
675 |
}
|
676 |
}
|
677 |
-
if (
|
678 |
$args = array_merge( $args, $socials );
|
679 |
}
|
680 |
}
|
@@ -685,7 +685,7 @@ class Structuring_Markup_Display {
|
|
685 |
* Setting schema.org Person
|
686 |
*
|
687 |
* @since 2.4.0
|
688 |
-
* @version
|
689 |
* @param array $options
|
690 |
*/
|
691 |
private function set_schema_person ( array $options ) {
|
@@ -706,7 +706,9 @@ class Structuring_Markup_Display {
|
|
706 |
$socials["sameAs"][] = esc_html( $value );
|
707 |
}
|
708 |
}
|
709 |
-
|
|
|
|
|
710 |
}
|
711 |
$this->set_schema_json( $args );
|
712 |
}
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
+
* @version 3.0.4
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
38 |
$structuring_markup_args = $db->get_list_options();
|
39 |
|
40 |
echo '<!-- Markup (JSON-LD) structured in schema.org START -->' . PHP_EOL;
|
41 |
+
|
42 |
$this->get_schema_data( 'all', $structuring_markup_args );
|
43 |
if ( is_home() || is_front_page() ) {
|
44 |
$this->get_schema_data( 'home', $structuring_markup_args );
|
186 |
* @param string $url
|
187 |
* @return array $dimensions
|
188 |
*/
|
189 |
+
private function get_image_dimensions ( $url ) {
|
190 |
$cache = new Structuring_Markup_Cache( $url );
|
191 |
+
|
192 |
/** check for cached dimensions */
|
193 |
+
if ( $cache->get() !== false ) {
|
194 |
return $cache->get();
|
195 |
}
|
196 |
+
|
197 |
+
if ( function_exists( 'curl_version' ) ) {
|
198 |
+
$headers = array( 'Range: bytes=0-32768' );
|
199 |
+
|
200 |
+
$curl = curl_init( $url );
|
201 |
+
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
|
202 |
+
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
|
203 |
+
curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0 );
|
204 |
+
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, 0 );
|
205 |
+
$data = curl_exec( $curl );
|
206 |
+
curl_close( $curl );
|
207 |
+
|
208 |
+
$image = @imagecreatefromstring( $data );
|
209 |
+
|
210 |
+
if ( $image ) {
|
211 |
+
$width = imagesx( $image );
|
212 |
+
$height = imagesy( $image );
|
213 |
+
|
214 |
+
$dimensions = array( $width, $height );
|
215 |
+
|
216 |
+
/** cache for an hour */
|
217 |
+
$cache->set( $dimensions, HOUR_IN_SECONDS );
|
218 |
+
|
219 |
+
return $dimensions;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
if ( $image = @getimagesize( $url ) ) {
|
224 |
+
$dimensions = array( $image[0], $image[1] );
|
225 |
+
|
226 |
+
/** cache for an hour */
|
227 |
+
$cache->set( $dimensions, HOUR_IN_SECONDS );
|
228 |
+
|
229 |
+
return $dimensions;
|
230 |
+
}
|
231 |
+
|
232 |
+
if ( $image = @getimagesize( str_replace( 'https://', 'http://', $url ) ) ) {
|
233 |
+
$dimensions = array( $image[0], $image[1] );
|
234 |
+
|
235 |
+
/** cache for an hour */
|
236 |
+
$cache->set( $dimensions, HOUR_IN_SECONDS );
|
237 |
+
|
238 |
+
return $dimensions;
|
239 |
+
}
|
240 |
+
|
241 |
+
/** this hits the database and be very slow if the user is using a URL that doesn't exist in the WP Library */
|
242 |
+
if ( $image = wp_get_attachment_image_src( attachment_url_to_postid( $url ), 'full' ) ) {
|
243 |
+
$dimensions = array( $image[1], $image[2] );
|
244 |
+
|
245 |
+
// cache for an hour
|
246 |
+
$cache->set( $dimensions, HOUR_IN_SECONDS );
|
247 |
+
|
248 |
+
return $dimensions;
|
249 |
+
}
|
250 |
+
|
251 |
+
return false;
|
252 |
}
|
253 |
|
254 |
/**
|
465 |
* Setting schema.org LocalBusiness
|
466 |
*
|
467 |
* @since 2.3.0
|
468 |
+
* @version 3.0.4
|
469 |
* @param array $options
|
470 |
*/
|
471 |
private function set_schema_local_business ( array $options ) {
|
508 |
"postalCode" => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : "",
|
509 |
"addressCountry" => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ""
|
510 |
);
|
511 |
+
$args = array_merge( $args, $address_array );
|
512 |
+
$geo_array = array();
|
513 |
|
514 |
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
515 |
$geo_array["geo"] = array(
|
618 |
"@type" => "ImageObject",
|
619 |
"url" => isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "",
|
620 |
"width" => $logo[0],
|
621 |
+
"height" => $logo[1]
|
622 |
)
|
623 |
),
|
624 |
"description" => $content
|
674 |
$socials["sameAs"][] = esc_url( $value );
|
675 |
}
|
676 |
}
|
677 |
+
if ( count( $socials["sameAs"] ) > 0 ) {
|
678 |
$args = array_merge( $args, $socials );
|
679 |
}
|
680 |
}
|
685 |
* Setting schema.org Person
|
686 |
*
|
687 |
* @since 2.4.0
|
688 |
+
* @version 3.0.4
|
689 |
* @param array $options
|
690 |
*/
|
691 |
private function set_schema_person ( array $options ) {
|
706 |
$socials["sameAs"][] = esc_html( $value );
|
707 |
}
|
708 |
}
|
709 |
+
if ( count( $socials["sameAs"] ) > 0 ) {
|
710 |
+
$args = array_merge( $args, $socials );
|
711 |
+
}
|
712 |
}
|
713 |
$this->set_schema_json( $args );
|
714 |
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
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.
|
6 |
-
Stable tag: 3.0.
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
@@ -53,6 +53,10 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
|
|
53 |
|
54 |
== Changelog ==
|
55 |
|
|
|
|
|
|
|
|
|
56 |
= 3.0.3 (2016-07-27) =
|
57 |
* Fixed : If you select a static page in a display of the front page, the home page is not output at the output page. (Added is_front_page function)
|
58 |
|
2 |
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.6.0
|
6 |
+
Stable tag: 3.0.4
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
53 |
|
54 |
== Changelog ==
|
55 |
|
56 |
+
= 3.0.4 (2016-08-17) =
|
57 |
+
* Fixed : Type Person and Organization Non-display case "sameAs" is empty.
|
58 |
+
* Checked : WordPress version 4.6.0 operation check.
|
59 |
+
|
60 |
= 3.0.3 (2016-07-27) =
|
61 |
* Fixed : If you select a static page in a display of the front page, the home page is not output at the output page. (Added is_front_page function)
|
62 |
|
wp-structuring-markup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Markup (JSON-LD) structured in schema.org
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
|
5 |
Description: Allows you to include schema.org JSON-LD syntax markup on your website
|
6 |
-
Version: 3.0.
|
7 |
Author: Kazuya Takami
|
8 |
Author URI: http://programp.com/
|
9 |
License: GPLv2 or later
|
3 |
Plugin Name: Markup (JSON-LD) structured in schema.org
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
|
5 |
Description: Allows you to include schema.org JSON-LD syntax markup on your website
|
6 |
+
Version: 3.0.4
|
7 |
Author: Kazuya Takami
|
8 |
Author URI: http://programp.com/
|
9 |
License: GPLv2 or later
|