Version Description
- Delete data when delete your plugin (Fixed)
Download this release
Release Info
Developer | kcseopro |
Plugin | WP SEO Structured Data Schema |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.2 to 2.4
- lib/classes/KcSeoInit.php +31 -26
- lib/classes/KcSeoOutput.php +50 -1
- lib/init.php +1 -1
- lib/models/KcSeoSchemaModel.php +40 -31
- readme.txt +8 -1
- wp-seo-structured-data-schema.php +5 -2
lib/classes/KcSeoInit.php
CHANGED
@@ -23,6 +23,7 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
23 |
}
|
24 |
|
25 |
|
|
|
26 |
function update_queue( $plugin, $network_wide = null ) {
|
27 |
if ( ! $network_wide ) {
|
28 |
return;
|
@@ -40,26 +41,25 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
40 |
global $pagenow;
|
41 |
// validate page
|
42 |
$page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : null;
|
43 |
-
if ( $pagenow
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
-
// scripts
|
47 |
-
wp_enqueue_media();
|
48 |
-
wp_enqueue_script( array(
|
49 |
-
'jquery',
|
50 |
-
'kcseo-datepicker',
|
51 |
-
'kcseo-select2-js',
|
52 |
-
'kcseo-tooltip-js',
|
53 |
-
'kcseo-admin-js',
|
54 |
-
) );
|
55 |
-
|
56 |
-
// styles
|
57 |
-
wp_enqueue_style( array(
|
58 |
-
'kcseo-datepicker',
|
59 |
-
'kcseo-select2-css',
|
60 |
-
'kcseo-tooltip-css',
|
61 |
-
'kcseo-admin-css',
|
62 |
-
) );
|
63 |
}
|
64 |
|
65 |
function kcSeoScript() {
|
@@ -101,7 +101,8 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
101 |
$styles['kcseo-admin-css'] = $KcSeoWPSchema->assetsUrl . 'css/admin.css';
|
102 |
}
|
103 |
foreach ( $scripts as $script ) {
|
104 |
-
wp_register_script( $script['handle'], $script['src'], $script['deps'], time(),
|
|
|
105 |
}
|
106 |
foreach ( $styles as $k => $v ) {
|
107 |
wp_register_style( $k, $v, false, $KcSeoWPSchema->options['version'] );
|
@@ -113,7 +114,7 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
113 |
$id = ( $_REQUEST['id'] ? $_REQUEST['id'] + 1 : 0 );
|
114 |
$html = null;
|
115 |
$html = "<div class='sfield'>";
|
116 |
-
$html
|
117 |
foreach ( $schemaModel->socialList() as $skey => $social ) {
|
118 |
$html .= "<option value='$skey'>$social</option>";
|
119 |
}
|
@@ -146,7 +147,8 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
146 |
wp_send_json( $response );
|
147 |
die();
|
148 |
}
|
149 |
-
|
|
|
150 |
global $KcSeoWPSchema;
|
151 |
$error = true;
|
152 |
$msg = null;
|
@@ -172,6 +174,7 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
172 |
global $KcSeoWPSchema;
|
173 |
$KcSeoWPSchema->render( 'schema-options' );
|
174 |
}
|
|
|
175 |
function wp_schema_setting_page() {
|
176 |
global $KcSeoWPSchema;
|
177 |
$KcSeoWPSchema->render( 'settings' );
|
@@ -181,8 +184,9 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
181 |
global $KcSeoWPSchema;
|
182 |
add_menu_page( 'WP SEO Structured Data Schema', 'WP SEO Schema', 'manage_options', 'wp-seo-schema',
|
183 |
array( $this, 'wp_schema_page' ), $KcSeoWPSchema->assetsUrl . 'images/wp-seo-schema.png' );
|
184 |
-
add_submenu_page( 'wp-seo-schema', 'WP SEO Schema settings', 'Settings', 'manage_options',
|
185 |
-
|
|
|
186 |
|
187 |
}
|
188 |
|
@@ -191,14 +195,15 @@ if ( ! class_exists( 'KcSeoInit' ) ):
|
|
191 |
load_plugin_textdomain( KCSEO_WP_SCHEMA_SLUG, false, KCSEO_WP_SCHEMA_LANGUAGE_PATH );
|
192 |
$this->updateVariableAndFixIssue();
|
193 |
}
|
|
|
194 |
function activePlugin() {
|
195 |
$this->updateVariableAndFixIssue();
|
196 |
}
|
197 |
|
198 |
-
function updateVariableAndFixIssue(){
|
199 |
global $KcSeoWPSchema;
|
200 |
$KcSeoWPSchema->fix1_2DataMigration();
|
201 |
-
update_option($KcSeoWPSchema->options['installed_version']
|
202 |
}
|
203 |
|
204 |
}
|
23 |
}
|
24 |
|
25 |
|
26 |
+
|
27 |
function update_queue( $plugin, $network_wide = null ) {
|
28 |
if ( ! $network_wide ) {
|
29 |
return;
|
41 |
global $pagenow;
|
42 |
// validate page
|
43 |
$page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : null;
|
44 |
+
if ( $pagenow == 'admin.php' && ($page == 'wp-seo-schema' || $page == 'wp-seo-schema-settings') ) {
|
45 |
+
// scripts
|
46 |
+
wp_enqueue_media();
|
47 |
+
wp_enqueue_script( array(
|
48 |
+
'jquery',
|
49 |
+
'kcseo-datepicker',
|
50 |
+
'kcseo-select2-js',
|
51 |
+
'kcseo-tooltip-js',
|
52 |
+
'kcseo-admin-js',
|
53 |
+
) );
|
54 |
+
|
55 |
+
// styles
|
56 |
+
wp_enqueue_style( array(
|
57 |
+
'kcseo-datepicker',
|
58 |
+
'kcseo-select2-css',
|
59 |
+
'kcseo-tooltip-css',
|
60 |
+
'kcseo-admin-css',
|
61 |
+
) );
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
function kcSeoScript() {
|
101 |
$styles['kcseo-admin-css'] = $KcSeoWPSchema->assetsUrl . 'css/admin.css';
|
102 |
}
|
103 |
foreach ( $scripts as $script ) {
|
104 |
+
wp_register_script( $script['handle'], $script['src'], $script['deps'], time(),
|
105 |
+
$script['footer'] ); //$KcSeoWPSchema->options['version']
|
106 |
}
|
107 |
foreach ( $styles as $k => $v ) {
|
108 |
wp_register_style( $k, $v, false, $KcSeoWPSchema->options['version'] );
|
114 |
$id = ( $_REQUEST['id'] ? $_REQUEST['id'] + 1 : 0 );
|
115 |
$html = null;
|
116 |
$html = "<div class='sfield'>";
|
117 |
+
$html .= "<select name='social[$id][id]'>";
|
118 |
foreach ( $schemaModel->socialList() as $skey => $social ) {
|
119 |
$html .= "<option value='$skey'>$social</option>";
|
120 |
}
|
147 |
wp_send_json( $response );
|
148 |
die();
|
149 |
}
|
150 |
+
|
151 |
+
function kcSeoMainSettings_action() {
|
152 |
global $KcSeoWPSchema;
|
153 |
$error = true;
|
154 |
$msg = null;
|
174 |
global $KcSeoWPSchema;
|
175 |
$KcSeoWPSchema->render( 'schema-options' );
|
176 |
}
|
177 |
+
|
178 |
function wp_schema_setting_page() {
|
179 |
global $KcSeoWPSchema;
|
180 |
$KcSeoWPSchema->render( 'settings' );
|
184 |
global $KcSeoWPSchema;
|
185 |
add_menu_page( 'WP SEO Structured Data Schema', 'WP SEO Schema', 'manage_options', 'wp-seo-schema',
|
186 |
array( $this, 'wp_schema_page' ), $KcSeoWPSchema->assetsUrl . 'images/wp-seo-schema.png' );
|
187 |
+
add_submenu_page( 'wp-seo-schema', 'WP SEO Schema settings', 'Settings', 'manage_options',
|
188 |
+
'wp-seo-schema-settings',
|
189 |
+
array( $this, 'wp_schema_setting_page' ) );
|
190 |
|
191 |
}
|
192 |
|
195 |
load_plugin_textdomain( KCSEO_WP_SCHEMA_SLUG, false, KCSEO_WP_SCHEMA_LANGUAGE_PATH );
|
196 |
$this->updateVariableAndFixIssue();
|
197 |
}
|
198 |
+
|
199 |
function activePlugin() {
|
200 |
$this->updateVariableAndFixIssue();
|
201 |
}
|
202 |
|
203 |
+
function updateVariableAndFixIssue() {
|
204 |
global $KcSeoWPSchema;
|
205 |
$KcSeoWPSchema->fix1_2DataMigration();
|
206 |
+
update_option( $KcSeoWPSchema->options['installed_version'], $KcSeoWPSchema->options['version'] );
|
207 |
}
|
208 |
|
209 |
}
|
lib/classes/KcSeoOutput.php
CHANGED
@@ -4,7 +4,56 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
|
|
4 |
|
5 |
class KcSeoOutput {
|
6 |
function __construct() {
|
7 |
-
add_action( 'wp_footer', array( $this, '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
|
10 |
function load_schema() {
|
4 |
|
5 |
class KcSeoOutput {
|
6 |
function __construct() {
|
7 |
+
add_action( 'wp_footer', array( $this, 'footer' ), 1 );
|
8 |
+
add_action( 'kcseo_footer', array( $this, 'debug_mark' ), 2 );
|
9 |
+
add_action( 'kcseo_footer', array( $this, 'load_schema' ), 3 );
|
10 |
+
}
|
11 |
+
private function is_premium(){
|
12 |
+
return false;
|
13 |
+
}
|
14 |
+
private function head_product_name() {
|
15 |
+
if ( $this->is_premium() ) {
|
16 |
+
return 'WP SEO Structured Data pro plugin';
|
17 |
+
}
|
18 |
+
else {
|
19 |
+
return 'WP SEO Structured Data Plugin';
|
20 |
+
}
|
21 |
+
}
|
22 |
+
public function debug_mark( $echo = true ) {
|
23 |
+
$marker = sprintf(
|
24 |
+
'<!-- This site is optimized with Phil Singleton\'s ' . $this->head_product_name() . ' v%1$s - https://kcseopro.com/wordpress-seo-structured-data-schema-plugin/ -->',
|
25 |
+
KCSEO_WP_SCHEMA_VERSION
|
26 |
+
);
|
27 |
+
|
28 |
+
if ( $echo === false ) {
|
29 |
+
return $marker;
|
30 |
+
}
|
31 |
+
else {
|
32 |
+
echo "\n${marker}\n";
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
function footer(){
|
37 |
+
|
38 |
+
global $wp_query;
|
39 |
+
|
40 |
+
$old_wp_query = null;
|
41 |
+
|
42 |
+
if ( ! $wp_query->is_main_query() ) {
|
43 |
+
$old_wp_query = $wp_query;
|
44 |
+
wp_reset_query();
|
45 |
+
}
|
46 |
+
wp_reset_postdata(); // TODO This is for wrong theme loop
|
47 |
+
do_action( 'kcseo_footer' );
|
48 |
+
|
49 |
+
echo "\n<!-- / ", $this->head_product_name(), ". -->\n\n";
|
50 |
+
|
51 |
+
if ( ! empty( $old_wp_query ) ) {
|
52 |
+
$GLOBALS['wp_query'] = $old_wp_query;
|
53 |
+
unset( $old_wp_query );
|
54 |
+
}
|
55 |
+
|
56 |
+
return;
|
57 |
}
|
58 |
|
59 |
function load_schema() {
|
lib/init.php
CHANGED
@@ -12,7 +12,7 @@ if ( ! class_exists( 'KcSeoWPSchema' ) ) {
|
|
12 |
'main_settings' => 'kcseo_wp_schema_settings',
|
13 |
'settings' => 'kcseo_wp_schema',
|
14 |
'installed_version' => 'kcseo_wp_installed_version',
|
15 |
-
'version' =>
|
16 |
'1_2_fix' => "kcseo_wp_1_2_data_fix"
|
17 |
);
|
18 |
|
12 |
'main_settings' => 'kcseo_wp_schema_settings',
|
13 |
'settings' => 'kcseo_wp_schema',
|
14 |
'installed_version' => 'kcseo_wp_installed_version',
|
15 |
+
'version' => KCSEO_WP_SCHEMA_VERSION,
|
16 |
'1_2_fix' => "kcseo_wp_1_2_data_fix"
|
17 |
);
|
18 |
|
lib/models/KcSeoSchemaModel.php
CHANGED
@@ -28,7 +28,7 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
28 |
if ( ! empty( $metaData['author'] ) ) {
|
29 |
$article["author"] = array(
|
30 |
"@type" => "Person",
|
31 |
-
"name"
|
32 |
);
|
33 |
}
|
34 |
if ( ! empty( $metaData['publisher'] ) ) {
|
@@ -94,7 +94,7 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
94 |
if ( ! empty( $metaData['author'] ) ) {
|
95 |
$newsArticle["author"] = array(
|
96 |
"@type" => "Person",
|
97 |
-
"name"
|
98 |
);
|
99 |
}
|
100 |
if ( ! empty( $metaData['image'] ) ) {
|
@@ -157,7 +157,7 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
157 |
if ( ! empty( $metaData['author'] ) ) {
|
158 |
$blogPosting["author"] = array(
|
159 |
"@type" => "Person",
|
160 |
-
"name"
|
161 |
);
|
162 |
}
|
163 |
if ( ! empty( $metaData['image'] ) ) {
|
@@ -517,20 +517,20 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
517 |
'textarea' );
|
518 |
}
|
519 |
if ( ! empty( $metaData['image'] ) ) {
|
520 |
-
$img
|
521 |
$localBusiness["image"] = $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' );
|
522 |
}
|
523 |
if ( ! empty( $metaData['priceRange'] ) ) {
|
524 |
$localBusiness["priceRange"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['priceRange'] );
|
525 |
}
|
526 |
if ( ! empty( $metaData['addressLocality'] ) || ! empty( $metaData['addressRegion'] )
|
527 |
-
|
528 |
$localBusiness["address"] = array(
|
529 |
-
"@type"
|
530 |
"addressLocality" => $KcSeoWPSchema->sanitizeOutPut( $metaData['addressLocality'] ),
|
531 |
-
"addressRegion"
|
532 |
-
"postalCode"=> $KcSeoWPSchema->sanitizeOutPut( $metaData['postalCode'] ),
|
533 |
-
"streetAddress"=> $KcSeoWPSchema->sanitizeOutPut( $metaData['streetAddress'] )
|
534 |
);
|
535 |
}
|
536 |
|
@@ -555,6 +555,7 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
555 |
$id = $data['id'];
|
556 |
$name = $data['name'];
|
557 |
$value = $data['value'];
|
|
|
558 |
|
559 |
$class = isset( $data['class'] ) ? ( $data['class'] ? $data['class'] : null ) : null;
|
560 |
$require = ( isset( $data['required'] ) ? ( $data['required'] ? "<span class='required'>*</span>" : null ) : null );
|
@@ -577,11 +578,7 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
577 |
break;
|
578 |
|
579 |
case 'number':
|
580 |
-
|
581 |
-
$html .= "<input type='number' step='any' id='{$id}' class='{$class}' name='{$name}' value='" . esc_attr( $value ) . "' />";
|
582 |
-
} else {
|
583 |
-
$html .= "<input type='number' id='{$id}' class='{$class}' name='{$name}' value='" . esc_attr( $value ) . "' />";
|
584 |
-
}
|
585 |
break;
|
586 |
case 'textarea':
|
587 |
$html .= "<textarea id='{$id}' class='{$class}' name='{$name}' >" . wp_kses( $value,
|
@@ -906,6 +903,7 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
906 |
'price' => array(
|
907 |
'title' => 'Price (Recommended)',
|
908 |
'type' => 'number',
|
|
|
909 |
'desc' => "This is highly recommended. The lowest available price, including service charges and fees, of this type of ticket. <span class='required'>Not required but (Recommended)</span>"
|
910 |
),
|
911 |
'priceCurrency' => array(
|
@@ -950,17 +948,19 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
950 |
),
|
951 |
'ratingValue' => array(
|
952 |
'title' => 'Ratting value',
|
953 |
-
'type' => '
|
954 |
'desc' => "Rating value. (1 , 2.5, 3, 5 etc)"
|
955 |
),
|
956 |
'reviewCount' => array(
|
957 |
'title' => 'Total review count',
|
958 |
'type' => 'number',
|
|
|
959 |
'desc' => "Rating ratting value. <span class='required'>This is required if (Ratting value) is given</span>"
|
960 |
),
|
961 |
'price' => array(
|
962 |
'title' => 'Price',
|
963 |
'type' => 'number',
|
|
|
964 |
'desc' => "The lowest available price, including service charges and fees, of this type of ticket."
|
965 |
),
|
966 |
'priceCurrency' => array(
|
@@ -1180,16 +1180,19 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
1180 |
'ratingValue' => array(
|
1181 |
'title' => 'Rating value',
|
1182 |
'type' => 'number',
|
|
|
1183 |
'desc' => "A numerical quality rating for the item."
|
1184 |
),
|
1185 |
'bestRating' => array(
|
1186 |
'title' => 'Best rating',
|
1187 |
'type' => 'number',
|
|
|
1188 |
'desc' => "The highest value allowed in this rating system."
|
1189 |
),
|
1190 |
'worstRating' => array(
|
1191 |
'title' => 'Worst rating',
|
1192 |
'type' => 'number',
|
|
|
1193 |
'desc' => "The lowest value allowed in this rating system. * Required if the rating system is not on a 5-point scale. If worstRating is omitted, 1 is assumed."
|
1194 |
),
|
1195 |
'publisher' => array(
|
@@ -1249,23 +1252,27 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
1249 |
'ratingCount' => array(
|
1250 |
'title' => 'Rating Count',
|
1251 |
'type' => 'number',
|
|
|
1252 |
'required' => true,
|
1253 |
'desc' => "The total number of ratings for the item on your site. <span class='required'>* At least one of ratingCount or reviewCount is required.</span>"
|
1254 |
),
|
1255 |
'reviewCount' => array(
|
1256 |
'title' => 'Review Count',
|
1257 |
'type' => 'number',
|
|
|
1258 |
'required' => true,
|
1259 |
'desc' => "Specifies the number of people who provided a review with or without an accompanying rating. At least one of ratingCount or reviewCount is required."
|
1260 |
),
|
1261 |
'ratingValue' => array(
|
1262 |
'title' => 'Rating Value',
|
1263 |
'type' => 'number',
|
|
|
1264 |
'required' => true,
|
1265 |
'desc' => "A numerical quality rating for the item."
|
1266 |
),
|
1267 |
'ratingValue' => array(
|
1268 |
'title' => 'Rating Value',
|
|
|
1269 |
'type' => 'number',
|
1270 |
'required' => true,
|
1271 |
'desc' => "A numerical quality rating for the item."
|
@@ -1273,12 +1280,14 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
1273 |
'bestRating' => array(
|
1274 |
'title' => 'Best Rating',
|
1275 |
'type' => 'number',
|
|
|
1276 |
'required' => true,
|
1277 |
'desc' => "The highest value allowed in this rating system. <span class='required'>* Required if the rating system is not a 5-point scale.</span> If bestRating is omitted, 5 is assumed."
|
1278 |
),
|
1279 |
'worstRating' => array(
|
1280 |
'title' => 'Worst Rating',
|
1281 |
'type' => 'number',
|
|
|
1282 |
'required' => true,
|
1283 |
'desc' => "The lowest value allowed in this rating system. <span class='required'>* Required if the rating system is not a 5-point scale.</span> If worstRating is omitted, 1 is assumed."
|
1284 |
)
|
@@ -1338,47 +1347,47 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
|
|
1338 |
'localBusiness' => array(
|
1339 |
'title' => 'Local Business',
|
1340 |
'fields' => array(
|
1341 |
-
'active'
|
1342 |
'type' => 'checkbox'
|
1343 |
),
|
1344 |
-
'name'
|
1345 |
-
'title'
|
1346 |
-
'type'
|
1347 |
'required' => true
|
1348 |
),
|
1349 |
-
'description'
|
1350 |
'title' => 'Description',
|
1351 |
'type' => 'textarea',
|
1352 |
),
|
1353 |
-
'image'
|
1354 |
'title' => 'Business Logo',
|
1355 |
'type' => 'image',
|
1356 |
'required' => true
|
1357 |
),
|
1358 |
-
'priceRange'
|
1359 |
-
'title'
|
1360 |
-
'type'
|
1361 |
-
'desc'
|
1362 |
),
|
1363 |
'addressLocality' => array(
|
1364 |
'title' => 'Address locality',
|
1365 |
'type' => 'text',
|
1366 |
-
'desc'
|
1367 |
),
|
1368 |
-
'addressRegion'
|
1369 |
'title' => 'Address region',
|
1370 |
'type' => 'text',
|
1371 |
-
'desc'
|
1372 |
),
|
1373 |
-
'postalCode'
|
1374 |
'title' => 'Postal code',
|
1375 |
'type' => 'text',
|
1376 |
),
|
1377 |
-
'streetAddress'
|
1378 |
'title' => 'Street address',
|
1379 |
'type' => 'text',
|
1380 |
),
|
1381 |
-
'telephone'
|
1382 |
'title' => 'Telephone (Recommended)',
|
1383 |
'type' => 'text',
|
1384 |
)
|
28 |
if ( ! empty( $metaData['author'] ) ) {
|
29 |
$article["author"] = array(
|
30 |
"@type" => "Person",
|
31 |
+
"name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['author'] )
|
32 |
);
|
33 |
}
|
34 |
if ( ! empty( $metaData['publisher'] ) ) {
|
94 |
if ( ! empty( $metaData['author'] ) ) {
|
95 |
$newsArticle["author"] = array(
|
96 |
"@type" => "Person",
|
97 |
+
"name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['author'] )
|
98 |
);
|
99 |
}
|
100 |
if ( ! empty( $metaData['image'] ) ) {
|
157 |
if ( ! empty( $metaData['author'] ) ) {
|
158 |
$blogPosting["author"] = array(
|
159 |
"@type" => "Person",
|
160 |
+
"name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['author'] )
|
161 |
);
|
162 |
}
|
163 |
if ( ! empty( $metaData['image'] ) ) {
|
517 |
'textarea' );
|
518 |
}
|
519 |
if ( ! empty( $metaData['image'] ) ) {
|
520 |
+
$img = $KcSeoWPSchema->imageInfo( absint( $metaData['image'] ) );
|
521 |
$localBusiness["image"] = $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' );
|
522 |
}
|
523 |
if ( ! empty( $metaData['priceRange'] ) ) {
|
524 |
$localBusiness["priceRange"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['priceRange'] );
|
525 |
}
|
526 |
if ( ! empty( $metaData['addressLocality'] ) || ! empty( $metaData['addressRegion'] )
|
527 |
+
|| ! empty( $metaData['postalCode'] ) || ! empty( $metaData['streetAddress'] ) ) {
|
528 |
$localBusiness["address"] = array(
|
529 |
+
"@type" => "PostalAddress",
|
530 |
"addressLocality" => $KcSeoWPSchema->sanitizeOutPut( $metaData['addressLocality'] ),
|
531 |
+
"addressRegion" => $KcSeoWPSchema->sanitizeOutPut( $metaData['addressRegion'] ),
|
532 |
+
"postalCode" => $KcSeoWPSchema->sanitizeOutPut( $metaData['postalCode'] ),
|
533 |
+
"streetAddress" => $KcSeoWPSchema->sanitizeOutPut( $metaData['streetAddress'] )
|
534 |
);
|
535 |
}
|
536 |
|
555 |
$id = $data['id'];
|
556 |
$name = $data['name'];
|
557 |
$value = $data['value'];
|
558 |
+
$attr = !empty($data['attr']) ? $data['attr'] : null;
|
559 |
|
560 |
$class = isset( $data['class'] ) ? ( $data['class'] ? $data['class'] : null ) : null;
|
561 |
$require = ( isset( $data['required'] ) ? ( $data['required'] ? "<span class='required'>*</span>" : null ) : null );
|
578 |
break;
|
579 |
|
580 |
case 'number':
|
581 |
+
$html .= "<input type='number' {$attr} id='{$id}' class='{$class}' name='{$name}' value='" . esc_attr( $value ) . "' />";
|
|
|
|
|
|
|
|
|
582 |
break;
|
583 |
case 'textarea':
|
584 |
$html .= "<textarea id='{$id}' class='{$class}' name='{$name}' >" . wp_kses( $value,
|
903 |
'price' => array(
|
904 |
'title' => 'Price (Recommended)',
|
905 |
'type' => 'number',
|
906 |
+
'attr' => 'step="any"',
|
907 |
'desc' => "This is highly recommended. The lowest available price, including service charges and fees, of this type of ticket. <span class='required'>Not required but (Recommended)</span>"
|
908 |
),
|
909 |
'priceCurrency' => array(
|
948 |
),
|
949 |
'ratingValue' => array(
|
950 |
'title' => 'Ratting value',
|
951 |
+
'type' => 'number',
|
952 |
'desc' => "Rating value. (1 , 2.5, 3, 5 etc)"
|
953 |
),
|
954 |
'reviewCount' => array(
|
955 |
'title' => 'Total review count',
|
956 |
'type' => 'number',
|
957 |
+
'attr' => 'step="any"',
|
958 |
'desc' => "Rating ratting value. <span class='required'>This is required if (Ratting value) is given</span>"
|
959 |
),
|
960 |
'price' => array(
|
961 |
'title' => 'Price',
|
962 |
'type' => 'number',
|
963 |
+
'attr' => 'step="any"',
|
964 |
'desc' => "The lowest available price, including service charges and fees, of this type of ticket."
|
965 |
),
|
966 |
'priceCurrency' => array(
|
1180 |
'ratingValue' => array(
|
1181 |
'title' => 'Rating value',
|
1182 |
'type' => 'number',
|
1183 |
+
'attr' => 'step="any"',
|
1184 |
'desc' => "A numerical quality rating for the item."
|
1185 |
),
|
1186 |
'bestRating' => array(
|
1187 |
'title' => 'Best rating',
|
1188 |
'type' => 'number',
|
1189 |
+
'attr' => 'step="any"',
|
1190 |
'desc' => "The highest value allowed in this rating system."
|
1191 |
),
|
1192 |
'worstRating' => array(
|
1193 |
'title' => 'Worst rating',
|
1194 |
'type' => 'number',
|
1195 |
+
'attr' => 'step="any"',
|
1196 |
'desc' => "The lowest value allowed in this rating system. * Required if the rating system is not on a 5-point scale. If worstRating is omitted, 1 is assumed."
|
1197 |
),
|
1198 |
'publisher' => array(
|
1252 |
'ratingCount' => array(
|
1253 |
'title' => 'Rating Count',
|
1254 |
'type' => 'number',
|
1255 |
+
'attr' => 'step="any"',
|
1256 |
'required' => true,
|
1257 |
'desc' => "The total number of ratings for the item on your site. <span class='required'>* At least one of ratingCount or reviewCount is required.</span>"
|
1258 |
),
|
1259 |
'reviewCount' => array(
|
1260 |
'title' => 'Review Count',
|
1261 |
'type' => 'number',
|
1262 |
+
'attr' => 'step="any"',
|
1263 |
'required' => true,
|
1264 |
'desc' => "Specifies the number of people who provided a review with or without an accompanying rating. At least one of ratingCount or reviewCount is required."
|
1265 |
),
|
1266 |
'ratingValue' => array(
|
1267 |
'title' => 'Rating Value',
|
1268 |
'type' => 'number',
|
1269 |
+
'attr' => 'step="any"',
|
1270 |
'required' => true,
|
1271 |
'desc' => "A numerical quality rating for the item."
|
1272 |
),
|
1273 |
'ratingValue' => array(
|
1274 |
'title' => 'Rating Value',
|
1275 |
+
'attr' => 'step="any"',
|
1276 |
'type' => 'number',
|
1277 |
'required' => true,
|
1278 |
'desc' => "A numerical quality rating for the item."
|
1280 |
'bestRating' => array(
|
1281 |
'title' => 'Best Rating',
|
1282 |
'type' => 'number',
|
1283 |
+
'attr' => 'step="any"',
|
1284 |
'required' => true,
|
1285 |
'desc' => "The highest value allowed in this rating system. <span class='required'>* Required if the rating system is not a 5-point scale.</span> If bestRating is omitted, 5 is assumed."
|
1286 |
),
|
1287 |
'worstRating' => array(
|
1288 |
'title' => 'Worst Rating',
|
1289 |
'type' => 'number',
|
1290 |
+
'attr' => 'step="any"',
|
1291 |
'required' => true,
|
1292 |
'desc' => "The lowest value allowed in this rating system. <span class='required'>* Required if the rating system is not a 5-point scale.</span> If worstRating is omitted, 1 is assumed."
|
1293 |
)
|
1347 |
'localBusiness' => array(
|
1348 |
'title' => 'Local Business',
|
1349 |
'fields' => array(
|
1350 |
+
'active' => array(
|
1351 |
'type' => 'checkbox'
|
1352 |
),
|
1353 |
+
'name' => array(
|
1354 |
+
'title' => 'Name',
|
1355 |
+
'type' => 'text',
|
1356 |
'required' => true
|
1357 |
),
|
1358 |
+
'description' => array(
|
1359 |
'title' => 'Description',
|
1360 |
'type' => 'textarea',
|
1361 |
),
|
1362 |
+
'image' => array(
|
1363 |
'title' => 'Business Logo',
|
1364 |
'type' => 'image',
|
1365 |
'required' => true
|
1366 |
),
|
1367 |
+
'priceRange' => array(
|
1368 |
+
'title' => 'Price Range (Recommended)',
|
1369 |
+
'type' => 'text',
|
1370 |
+
'desc' => "The price range of the business, for example $$$."
|
1371 |
),
|
1372 |
'addressLocality' => array(
|
1373 |
'title' => 'Address locality',
|
1374 |
'type' => 'text',
|
1375 |
+
'desc' => 'City (i.e Kansas city)'
|
1376 |
),
|
1377 |
+
'addressRegion' => array(
|
1378 |
'title' => 'Address region',
|
1379 |
'type' => 'text',
|
1380 |
+
'desc' => 'State (i.e. MO)'
|
1381 |
),
|
1382 |
+
'postalCode' => array(
|
1383 |
'title' => 'Postal code',
|
1384 |
'type' => 'text',
|
1385 |
),
|
1386 |
+
'streetAddress' => array(
|
1387 |
'title' => 'Street address',
|
1388 |
'type' => 'text',
|
1389 |
),
|
1390 |
+
'telephone' => array(
|
1391 |
'title' => 'Telephone (Recommended)',
|
1392 |
'type' => 'text',
|
1393 |
)
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: seo, schema, structured data, rich snippets, microdata, json-ld, search engine optimization, local seo, google, sitelinks, schema.org, microformat, serp, amp
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.8
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -93,6 +93,13 @@ You'll find the [FAQ on Kcseopro.com](http://kcseopro.com/).
|
|
93 |
|
94 |
== Changelog ==
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
= 2.1 =
|
97 |
* Can delete all save data
|
98 |
* Restaurant Schema (New)
|
4 |
Tags: seo, schema, structured data, rich snippets, microdata, json-ld, search engine optimization, local seo, google, sitelinks, schema.org, microformat, serp, amp
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.8
|
7 |
+
Stable tag: 2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 2.4 =
|
97 |
+
* Delete data when delete your plugin (Fixed)
|
98 |
+
|
99 |
+
= 2.3 =
|
100 |
+
* Fix the conflict with Event Manager plugin
|
101 |
+
* Add New schema generator at footer
|
102 |
+
|
103 |
= 2.1 =
|
104 |
* Can delete all save data
|
105 |
* Restaurant Schema (New)
|
wp-seo-structured-data-schema.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
*Plugin Name: WP SEO Structured Data Schema
|
4 |
* Plugin URI: http://kcseopro.com/
|
5 |
* Description: Comprehensive JSON-LD based Structured Data solution for WordPress for adding schema for organizations, businesses, blog posts, ratings & more.
|
6 |
-
* Version: 2.
|
7 |
* Author: kcseopro
|
8 |
* Author URI: http://kcseopro.com/
|
9 |
* License: A "Slug" license name e.g. GPL2
|
@@ -18,6 +18,9 @@ if (!defined('JSON_PRETTY_PRINT'))
|
|
18 |
if (!defined('JSON_UNESCAPED_UNICODE'))
|
19 |
define('JSON_UNESCAPED_UNICODE', 256);
|
20 |
|
|
|
|
|
|
|
21 |
define('KCSEO_WP_SCHEMA_SLUG', 'wp-seo-structured-data-schema');
|
22 |
define('KCSEO_WP_SCHEMA_PATH', dirname(__FILE__));
|
23 |
define('KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME', plugin_basename( __FILE__ ));
|
@@ -29,7 +32,7 @@ register_uninstall_hook( __FILE__, 'KCSEO_uninstall');
|
|
29 |
|
30 |
function KCSEO_uninstall(){
|
31 |
global $KcSeoWPSchema;
|
32 |
-
$settings = get_option( $KcSeoWPSchema->options['
|
33 |
if(! empty( $settings['delete-data'])){
|
34 |
$schemas = new KcSeoSchemaModel;
|
35 |
$schemaFields = $schemas->schemaTypes();
|
3 |
*Plugin Name: WP SEO Structured Data Schema
|
4 |
* Plugin URI: http://kcseopro.com/
|
5 |
* Description: Comprehensive JSON-LD based Structured Data solution for WordPress for adding schema for organizations, businesses, blog posts, ratings & more.
|
6 |
+
* Version: 2.4
|
7 |
* Author: kcseopro
|
8 |
* Author URI: http://kcseopro.com/
|
9 |
* License: A "Slug" license name e.g. GPL2
|
18 |
if (!defined('JSON_UNESCAPED_UNICODE'))
|
19 |
define('JSON_UNESCAPED_UNICODE', 256);
|
20 |
|
21 |
+
|
22 |
+
$plugin_data = get_file_data( __FILE__, array( 'Version' => 'Version' ), false );
|
23 |
+
define( 'KCSEO_WP_SCHEMA_VERSION', $plugin_data['Version'] );
|
24 |
define('KCSEO_WP_SCHEMA_SLUG', 'wp-seo-structured-data-schema');
|
25 |
define('KCSEO_WP_SCHEMA_PATH', dirname(__FILE__));
|
26 |
define('KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME', plugin_basename( __FILE__ ));
|
32 |
|
33 |
function KCSEO_uninstall(){
|
34 |
global $KcSeoWPSchema;
|
35 |
+
$settings = get_option( $KcSeoWPSchema->options['main_settings'] );
|
36 |
if(! empty( $settings['delete-data'])){
|
37 |
$schemas = new KcSeoSchemaModel;
|
38 |
$schemaFields = $schemas->schemaTypes();
|