Markup (JSON-LD) structured in schema.org - Version 2.4.2

Version Description

(2016-03-09) =

  • Fixed : Updated image size detection to use curl first, as attachment_url_to_postid() hits the database
  • Updated : Added a transient cache class to cache taxing operations
  • Updated : Turkish translation.
Download this release

Release Info

Developer miiitaka
Plugin Icon 128x128 Markup (JSON-LD) structured in schema.org
Version 2.4.2
Comparing to
See all releases

Code changes from version 2.4.1 to 2.4.2

includes/wp-structuring-admin-db.php CHANGED
@@ -108,8 +108,8 @@ class Structuring_Markup_Admin_Db {
108
  'update_date' => date( "Y-m-d H:i:s" )
109
  );
110
 
111
- // LocalBusiness Convert data
112
- if ( $key === 'local_business' && $activate === 'on' ) {
113
  $args['options'] = $this->convert_local_business( $list->options );
114
  }
115
  }
108
  'update_date' => date( "Y-m-d H:i:s" )
109
  );
110
 
111
+ // LocalBusiness Convert data(In the case of version 2.3.x)
112
+ if ( $key === 'local_business' && $activate === 'on' && strpos( $options['version'], '2.3.' ) !== false ) {
113
  $args['options'] = $this->convert_local_business( $list->options );
114
  }
115
  }
includes/wp-structuring-cache.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Structuring Markup Transient Cache
4
+ *
5
+ * @author Justin Frydman
6
+ * @since 2.4.2
7
+ * @version 2.4.2
8
+ */
9
+ class Structuring_Markup_Cache {
10
+
11
+ /**
12
+ * The key to be stored
13
+ *
14
+ * @since 2.4.2
15
+ * @version 2.4.2
16
+ */
17
+ private $key;
18
+
19
+ /**
20
+ * The prefix for a stored transient
21
+ * This prefix should never exceed 7 characters
22
+ *
23
+ * @since 2.4.2
24
+ * @version 2.4.2
25
+ */
26
+ private $prefix = 'struct_';
27
+
28
+ /**
29
+ * Constructor Define.
30
+ *
31
+ * @since 2.4.2
32
+ * @version 2.4.2
33
+ * @param string $key Unique key for this transient
34
+ */
35
+ public function __construct ( $key ) {
36
+ assert( !empty( $key ) );
37
+
38
+ $this->key = (string) $key;
39
+ }
40
+
41
+ /**
42
+ * Store a transient
43
+ *
44
+ * @since 2.4.2
45
+ * @version 2.4.2
46
+ * @see https://codex.wordpress.org/Easier_Expression_of_Time_Constants
47
+ * @param string $value - The value to be stored in the cache
48
+ * @param string $ttl - The time to live in the cache. Wordpress Time Constants can be used
49
+ * @return bool - If the transient was set properly
50
+ */
51
+ public function set( $value, $ttl ) {
52
+ assert( !empty( $value ) );
53
+ assert( !empty( $ttl ) );
54
+
55
+ return set_transient( $this->prepared_key(), $value, $ttl );
56
+ }
57
+
58
+ /**
59
+ * Get a transient
60
+ *
61
+ * @since 2.4.2
62
+ * @version 2.4.2
63
+ * @return string $transient_value - The value from the cache
64
+ */
65
+ public function get() {
66
+ return get_transient( $this->prepared_key() );
67
+ }
68
+
69
+ /**
70
+ * Delete a transient
71
+ *
72
+ * @since 2.4.2
73
+ * @version 2.4.2
74
+ * @return bool - If the transient was properly deleted
75
+ */
76
+ public function delete () {
77
+ return delete_transient( $this->prepared_key() );
78
+ }
79
+
80
+ /**
81
+ * Prepare a transient for storage or retrieval
82
+ * There is a 40 character transient limit
83
+ *
84
+ * @since 2.4.2
85
+ * @version 2.4.2
86
+ * @return string $prepared_key - The prefixed and MD5'd key
87
+ */
88
+ private function prepared_key() {
89
+ return $this->prefix . md5( $this->key );
90
+ }
91
+ }
includes/wp-structuring-display.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
- * @version 2.3.3
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
@@ -136,16 +136,19 @@ class Structuring_Markup_Display {
136
  * Return image dimensions
137
  *
138
  * @since 2.3.3
139
- * @version 2.3.3
140
  * @author Justin Frydman
141
  * @param string $url
142
  * @return array $dimensions
143
  */
144
  private function get_image_dimensions ( $url ) {
145
- if( $image = wp_get_attachment_image_src( attachment_url_to_postid( $url ), 'full' ) ) {
146
- return array( $image[1], $image[2] );
147
- }
148
-
 
 
 
149
  if( function_exists( 'curl_version' ) ) {
150
  $headers = array( 'Range: bytes=0-32768' );
151
 
@@ -162,19 +165,44 @@ class Structuring_Markup_Display {
162
  if( $image ) {
163
  $width = imagesx( $image );
164
  $height = imagesy( $image );
165
-
166
- return array( $width, $height );
 
 
 
 
 
167
  }
168
  }
169
 
170
  if( $image = @getimagesize( $url ) ) {
171
- return array( $image[0], $image[1] );
 
 
 
 
 
172
  }
173
 
174
  if( $image = @getimagesize( str_replace( 'https://', 'http://', $url ) ) ) {
175
- return array( $image[0], $image[1] );
 
 
 
 
 
176
  }
177
-
 
 
 
 
 
 
 
 
 
 
178
  return false;
179
  }
180
 
@@ -603,4 +631,4 @@ class Structuring_Markup_Display {
603
 
604
  $this->set_schema_json( $args );
605
  }
606
- }
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
+ * @version 2.4.2
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
136
  * Return image dimensions
137
  *
138
  * @since 2.3.3
139
+ * @version 2.4.2
140
  * @author Justin Frydman
141
  * @param string $url
142
  * @return array $dimensions
143
  */
144
  private function get_image_dimensions ( $url ) {
145
+ $cache = new Structuring_Markup_Cache( $url );
146
+
147
+ // check for cached dimensions
148
+ if( $cache->get() !== false ) {
149
+ return $cache->get();
150
+ }
151
+
152
  if( function_exists( 'curl_version' ) ) {
153
  $headers = array( 'Range: bytes=0-32768' );
154
 
165
  if( $image ) {
166
  $width = imagesx( $image );
167
  $height = imagesy( $image );
168
+
169
+ $dimensions = array( $width, $height );
170
+
171
+ // cache for an hour
172
+ $cache->set( $dimensions, HOUR_IN_SECONDS );
173
+
174
+ return $dimensions;
175
  }
176
  }
177
 
178
  if( $image = @getimagesize( $url ) ) {
179
+ $dimensions = array( $image[0], $image[1] );
180
+
181
+ // cache for an hour
182
+ $cache->set( $dimensions, HOUR_IN_SECONDS );
183
+
184
+ return $dimensions;
185
  }
186
 
187
  if( $image = @getimagesize( str_replace( 'https://', 'http://', $url ) ) ) {
188
+ $dimensions = array( $image[0], $image[1] );
189
+
190
+ // cache for an hour
191
+ $cache->set( $dimensions, HOUR_IN_SECONDS );
192
+
193
+ return $dimensions;
194
  }
195
+
196
+ // this hits the database and be very slow if the user is using a URL that doesn't exist in the WP Library
197
+ if( $image = wp_get_attachment_image_src( attachment_url_to_postid( $url ), 'full' ) ) {
198
+ $dimensions = array( $image[1], $image[2] );
199
+
200
+ // cache for an hour
201
+ $cache->set( $dimensions, HOUR_IN_SECONDS );
202
+
203
+ return $dimensions;
204
+ }
205
+
206
  return false;
207
  }
208
 
631
 
632
  $this->set_schema_json( $args );
633
  }
634
+ }
languages/wp-structuring-markup-tr_TR.mo ADDED
Binary file
languages/wp-structuring-markup-tr_TR.po ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 Markup (JSON-LD) structured in schema.org
2
+ # This file is distributed under the same license as the Markup (JSON-LD) structured in schema.org package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Markup (JSON-LD) structured in schema.org 2.4.1\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
7
+ "markup\n"
8
+ "POT-Creation-Date: 2016-03-01 08:58:28+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2016-03-08 03:21+0200\n"
13
+ "Last-Translator: Keremcan Buyuktaskin <keremcan@gmail.com>\n"
14
+ "Language-Team: Keremcan Buyuktaskin <keremcan@gmail.com>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "Language: tr_TR\n"
17
+ "X-Generator: Poedit 1.6.6\n"
18
+ "X-Poedit-Basepath: D:\\Google Drive\\Sites\\Tayland Gezi\\wp-content\\plugins"
19
+ "\\wp-structuring-markup\n"
20
+
21
+ #: includes/wp-structuring-admin-list.php:43
22
+ msgid "Schema.org Settings List"
23
+ msgstr "Schema.org Ayarları Listesi"
24
+
25
+ #: includes/wp-structuring-admin-list.php:50
26
+ msgid "Status"
27
+ msgstr "Durum"
28
+
29
+ #: includes/wp-structuring-admin-list.php:51
30
+ msgid "Schema Type"
31
+ msgstr "Şema Tipi"
32
+
33
+ #: includes/wp-structuring-admin-list.php:52
34
+ #: includes/wp-structuring-admin-post.php:115
35
+ msgid "Output On"
36
+ msgstr "Devredeki Çıktı"
37
+
38
+ #: includes/wp-structuring-admin-list.php:53
39
+ msgid "ShortCode"
40
+ msgstr "Kısa Kod"
41
+
42
+ #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:155
43
+ msgid "Edit"
44
+ msgstr "Düzenle"
45
+
46
+ #: includes/wp-structuring-admin-list.php:87
47
+ msgid "Without registration."
48
+ msgstr "Kayıt olmadan."
49
+
50
+ #: includes/wp-structuring-admin-post.php:90
51
+ msgid "Schema.org Register"
52
+ msgstr "Schema.org Kayıt"
53
+
54
+ #: includes/wp-structuring-admin-post.php:120
55
+ #: includes/wp-structuring-admin-post.php:128
56
+ #: includes/wp-structuring-admin-post.php:154
57
+ #: includes/wp-structuring-admin-post.php:163
58
+ #: includes/wp-structuring-admin-post.php:173
59
+ #: includes/wp-structuring-admin-post.php:184
60
+ #: includes/wp-structuring-admin-post.php:195
61
+ msgid "Posts"
62
+ msgstr "Yazılar"
63
+
64
+ #: includes/wp-structuring-admin-post.php:136
65
+ #: includes/wp-structuring-admin-post.php:152
66
+ #: includes/wp-structuring-admin-post.php:171
67
+ #: includes/wp-structuring-admin-post.php:182
68
+ #: includes/wp-structuring-admin-post.php:193
69
+ msgid "All Pages (In Header)"
70
+ msgstr "Tüm Sayfalar (Üst Kısımda)"
71
+
72
+ #: includes/wp-structuring-admin-post.php:144
73
+ msgid "Event Post Page"
74
+ msgstr "Etkinlik Yazı Sayfası"
75
+
76
+ #: includes/wp-structuring-admin-post.php:153
77
+ #: includes/wp-structuring-admin-post.php:172
78
+ #: includes/wp-structuring-admin-post.php:183
79
+ #: includes/wp-structuring-admin-post.php:194
80
+ msgid "Homepage"
81
+ msgstr "Ana Sayfa"
82
+
83
+ #: includes/wp-structuring-admin-post.php:155
84
+ #: includes/wp-structuring-admin-post.php:174
85
+ #: includes/wp-structuring-admin-post.php:185
86
+ #: includes/wp-structuring-admin-post.php:196
87
+ msgid "Pages"
88
+ msgstr "Sayfalar"
89
+
90
+ #: includes/wp-structuring-custom-post-event.php:34
91
+ #: includes/wp-structuring-custom-post-event.php:35
92
+ msgid "Event Posts"
93
+ msgstr "Etkinlik Yazıları"
94
+
95
+ #: includes/wp-structuring-custom-post-event.php:73
96
+ msgid "Schema.org Type Event"
97
+ msgstr "Schema.org Tip Etkinliği"
98
+
99
+ #: includes/wp-structuring-custom-post-event.php:95
100
+ msgid "USD"
101
+ msgstr "USD"
102
+
103
+ #: includes/wp-structuring-custom-post-event.php:100
104
+ msgid "Event Name"
105
+ msgstr "Etkinlik Adı"
106
+
107
+ #: includes/wp-structuring-custom-post-event.php:105
108
+ msgid "Start Date"
109
+ msgstr "Başlangıç Tarihi"
110
+
111
+ #: includes/wp-structuring-custom-post-event.php:111
112
+ msgid "Event URL"
113
+ msgstr "Etkinlik URL'si"
114
+
115
+ #: includes/wp-structuring-custom-post-event.php:116
116
+ msgid "Place Name"
117
+ msgstr "Yer Adı"
118
+
119
+ #: includes/wp-structuring-custom-post-event.php:121
120
+ msgid "Place URL"
121
+ msgstr "Yer URL'si"
122
+
123
+ #: includes/wp-structuring-custom-post-event.php:126
124
+ msgid "Place Address"
125
+ msgstr "Yer Adresi"
126
+
127
+ #: includes/wp-structuring-custom-post-event.php:131
128
+ msgid "Price"
129
+ msgstr "Fiyat"
130
+
131
+ #: includes/wp-structuring-custom-post-event.php:136
132
+ msgid "Currency"
133
+ msgstr "Para Birimi"
134
+
135
+ #: wp-structuring-markup.php:146 wp-structuring-markup.php:147
136
+ msgid "Schema.org Settings"
137
+ msgstr "Schema.org Ayarları"
138
+
139
+ #: wp-structuring-markup.php:154
140
+ msgid "Schema.org Setting Edit"
141
+ msgstr "Schema.org Ayarları Düzenle"
142
+
143
+ #. Plugin Name of the plugin/theme
144
+ msgid "Markup (JSON-LD) structured in schema.org"
145
+ msgstr "Markup (JSON-LD) structured in schema.org"
146
+
147
+ #. Plugin URI of the plugin/theme
148
+ msgid "https://wordpress.org/plugins/wp-structuring-markup/"
149
+ msgstr "https://wordpress.org/plugins/wp-structuring-markup/"
150
+
151
+ #. Description of the plugin/theme
152
+ msgid "Allows you to include schema.org JSON-LD syntax markup on your website"
153
+ msgstr ""
154
+ "Web sitenizde schema.org JSON-LD sözdizimi biçimlendirmesini dahil etmenize "
155
+ "izin verir"
156
+
157
+ #. Author of the plugin/theme
158
+ msgid "Kazuya Takami"
159
+ msgstr "Kazuya Takami"
160
+
161
+ #. Author URI of the plugin/theme
162
+ msgid "http://programp.com/"
163
+ msgstr "http://programp.com/"
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.4.1
6
- Stable tag: 2.4.0
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -52,9 +52,15 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
52
 
53
  == Changelog ==
54
 
 
 
 
 
 
 
55
  = 2.4.1 (2016-03-01) =
56
 
57
- * Updated : Translation.
58
 
59
  = 2.4.0 (2016-02-06) =
60
 
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.4.2
6
+ Stable tag: 2.4.2
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
52
 
53
  == Changelog ==
54
 
55
+ = 2.4.2 (2016-03-09) =
56
+
57
+ * Fixed : Updated image size detection to use curl first, as attachment_url_to_postid() hits the database
58
+ * Updated : Added a transient cache class to cache taxing operations
59
+ * Updated : Turkish translation.
60
+
61
  = 2.4.1 (2016-03-01) =
62
 
63
+ * Updated : Japanese translation.
64
 
65
  = 2.4.0 (2016-02-06) =
66
 
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: 2.4.1
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
9
  License: GPLv2 or later
@@ -19,7 +19,7 @@ new Structuring_Markup();
19
  *
20
  * @author Kazuya Takami
21
  * @since 1.0.0
22
- * @version 2.4.0
23
  */
24
  class Structuring_Markup {
25
 
@@ -27,10 +27,10 @@ class Structuring_Markup {
27
  * Variable definition.
28
  *
29
  * @since 1.3.0
30
- * @version 2.4.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
- private $version = '2.4.0';
34
 
35
  /**
36
  * Constructor Define.
@@ -217,9 +217,10 @@ class Structuring_Markup {
217
  * Display Page Template Require.
218
  *
219
  * @since 1.3.0
220
- * @version 1.3.0
221
  */
222
  public function wp_head () {
 
223
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-opening-hours.php' );
224
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
225
  new Structuring_Markup_Display();
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: 2.4.2
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
9
  License: GPLv2 or later
19
  *
20
  * @author Kazuya Takami
21
  * @since 1.0.0
22
+ * @version 2.4.2
23
  */
24
  class Structuring_Markup {
25
 
27
  * Variable definition.
28
  *
29
  * @since 1.3.0
30
+ * @version 2.4.2
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
+ private $version = '2.4.2';
34
 
35
  /**
36
  * Constructor Define.
217
  * Display Page Template Require.
218
  *
219
  * @since 1.3.0
220
+ * @version 2.4.2
221
  */
222
  public function wp_head () {
223
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-cache.php' );
224
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-opening-hours.php' );
225
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
226
  new Structuring_Markup_Display();