WP SEO Structured Data Schema - Version 2.2

Version Description

Download this release

Release Info

Developer kcseopro
Plugin Icon 128x128 WP SEO Structured Data Schema
Version 2.2
Comparing to
See all releases

Code changes from version 2.1 to 2.2

assets/css/admin.css CHANGED
@@ -59,7 +59,7 @@ ul.rt-tab-nav li{
59
  cursor: pointer;
60
  display: inline-block;
61
  float: left;
62
- margin: 0;
63
  }
64
 
65
  ul.rt-tab-nav li:focus{
59
  cursor: pointer;
60
  display: inline-block;
61
  float: left;
62
+ margin: 2px 0;
63
  }
64
 
65
  ul.rt-tab-nav li:focus{
assets/js/admin.js CHANGED
@@ -116,63 +116,81 @@
116
  }
117
  });
118
 
119
- })(jQuery);
120
-
121
-
122
- function showHideType() {
123
- if(jQuery('#_schema_aggregate_rating_schema_type').length){
124
- var id = jQuery("#_schema_aggregate_rating_schema_type option:selected").val();
125
- }
126
- if(jQuery('#site_type').length){
127
- var id = jQuery("#site_type option:selected").val();
128
- }
129
 
130
- if (id == "Person") {
131
- jQuery(".form-table tr.person, .aggregate-person-holder").show();
132
- } else {
133
- jQuery(".form-table tr.person, .aggregate-person-holder").hide();
134
- }
135
- if (id == "Organization") {
136
- jQuery(".form-table tr.business-info,.form-table tr.all-type-data, .aggregate-except-organization-holder").hide();
137
- } else {
138
- jQuery(".form-table tr.business-info,.form-table tr.all-type-data, .aggregate-except-organization-holder").show();
139
- }
140
- }
141
- function wpSchemaSettings(e) {
142
-
143
- jQuery('#response').hide();
144
- arg = jQuery(e).serialize();
145
- bindElement = jQuery('#tlpSaveButton');
146
- AjaxCall(bindElement, 'kcSeoWpSchemaSettings', arg, function (data) {
147
- console.log(data);
148
- jQuery('#response').addClass('updated');
149
- if (!data.error) {
150
- jQuery('#response').removeClass('error');
151
- jQuery('#response').show('slow').text(data.msg);
152
  } else {
153
- jQuery('#response').addClass('error');
154
- jQuery('#response').show('slow').text(data.msg);
155
  }
156
- });
157
-
158
- }
159
-
160
- function AjaxCall(element, action, arg, handle) {
161
- if (action) data = "action=" + action;
162
- if (arg) data = arg + "&action=" + action;
163
- if (arg && !action) data = arg;
164
- data = data;
165
-
166
- jQuery.ajax({
167
- type: "post",
168
- url: ajaxurl,
169
- data: data,
170
- beforeSend: function () {
171
- jQuery("<span class='wseo_loading'></span>").insertAfter(element);
172
- },
173
- success: function (data) {
174
- jQuery(".wseo_loading").remove();
175
- handle(data);
176
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  });
178
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
  });
118
 
119
+ function showHideType() {
120
+ if($('#_schema_aggregate_rating_schema_type').length){
121
+ var id = $("#_schema_aggregate_rating_schema_type option:selected").val();
122
+ }
123
+ if($('#site_type').length){
124
+ var id = $("#site_type option:selected").val();
125
+ }
 
 
 
126
 
127
+ if (id == "Person") {
128
+ $(".form-table tr.person, .aggregate-person-holder").show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  } else {
130
+ $(".form-table tr.person, .aggregate-person-holder").hide();
 
131
  }
132
+ if (id == "Organization") {
133
+ $(".form-table tr.business-info,.form-table tr.all-type-data, .aggregate-except-organization-holder").hide();
134
+ } else {
135
+ $(".form-table tr.business-info,.form-table tr.all-type-data, .aggregate-except-organization-holder").show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
+ }
138
+
139
+ $("#kcseo-option-settings").on('submit', function (e) {
140
+ e.preventDefault();
141
+ $('#response').hide();
142
+ var arg = $(this).serialize(),
143
+ bindElement = $('#tlpSaveButton');
144
+ AjaxCall(bindElement, 'kcSeoWpSchemaSettings', arg, function (data) {
145
+ $('#response').addClass('updated');
146
+ if (!data.error) {
147
+ $('#response').removeClass('error');
148
+ } else {
149
+ $('#response').addClass('error');
150
+ }
151
+ $('#response').show('slow').text(data.msg);
152
+ });
153
  });
154
+ $("#kcseo-main-settings").on('submit', function (e) {
155
+ e.preventDefault();
156
+ $('#response').hide();
157
+ var arg = $(this).serialize(),
158
+ bindElement = $('#tlpSaveButton');
159
+ AjaxCall(bindElement, 'kcSeoMainSettings_action', arg, function (data) {
160
+ $('#response').addClass('updated');
161
+ if (!data.error) {
162
+ $('#response').removeClass('error');
163
+ $('#response').show('slow').text(data.msg);
164
+ } else {
165
+ $('#response').addClass('error');
166
+ $('#response').show('slow').text(data.msg);
167
+ }
168
+ });
169
+ return false;
170
+ });
171
+
172
+
173
+ function AjaxCall(element, action, arg, handle) {
174
+ var data;
175
+ if (action) data = "action=" + action;
176
+ if (arg) data = arg + "&action=" + action;
177
+ if (arg && !action) data = arg;
178
+ data = data;
179
+
180
+ $.ajax({
181
+ type: "post",
182
+ url: ajaxurl,
183
+ data: data,
184
+ beforeSend: function () {
185
+ $("<span class='wseo_loading'></span>").insertAfter(element);
186
+ },
187
+ success: function (data) {
188
+ $(".wseo_loading").remove();
189
+ handle(data);
190
+ }
191
+ });
192
+ }
193
+
194
+ })(jQuery);
195
+
196
+
lib/classes/KcSeoInit.php CHANGED
@@ -8,6 +8,7 @@ if ( ! class_exists( 'KcSeoInit' ) ):
8
  add_action( 'admin_menu', array( $this, 'kcSeo_Wp_Schema_menu' ) );
9
  add_action( 'plugins_loaded', array( $this, 'kcSeo_pluginInit' ) );
10
  add_action( 'wp_ajax_kcSeoWpSchemaSettings', array( $this, 'kcSeoWpSchemaSettings' ) );
 
11
  add_action( 'wp_ajax_newSocial', array( $this, 'newSocial' ) );
12
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
13
 
@@ -39,7 +40,7 @@ if ( ! class_exists( 'KcSeoInit' ) ):
39
  global $pagenow;
40
  // validate page
41
  $page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : null;
42
- if ( $pagenow != 'admin.php' || $page != 'wp-seo-schema' ) {
43
  return;
44
  }
45
  // scripts
@@ -145,8 +146,33 @@ if ( ! class_exists( 'KcSeoInit' ) ):
145
  wp_send_json( $response );
146
  die();
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
  function wp_schema_page() {
 
 
 
 
150
  global $KcSeoWPSchema;
151
  $KcSeoWPSchema->render( 'settings' );
152
  }
@@ -155,6 +181,8 @@ if ( ! class_exists( 'KcSeoInit' ) ):
155
  global $KcSeoWPSchema;
156
  add_menu_page( 'WP SEO Structured Data Schema', 'WP SEO Schema', 'manage_options', 'wp-seo-schema',
157
  array( $this, 'wp_schema_page' ), $KcSeoWPSchema->assetsUrl . 'images/wp-seo-schema.png' );
 
 
158
 
159
  }
160
 
8
  add_action( 'admin_menu', array( $this, 'kcSeo_Wp_Schema_menu' ) );
9
  add_action( 'plugins_loaded', array( $this, 'kcSeo_pluginInit' ) );
10
  add_action( 'wp_ajax_kcSeoWpSchemaSettings', array( $this, 'kcSeoWpSchemaSettings' ) );
11
+ add_action( 'wp_ajax_kcSeoMainSettings_action', array( $this, 'kcSeoMainSettings_action' ) );
12
  add_action( 'wp_ajax_newSocial', array( $this, 'newSocial' ) );
13
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
14
 
40
  global $pagenow;
41
  // validate page
42
  $page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : null;
43
+ if ( $pagenow != 'admin.php' && ($page == 'wp-seo-schema' || $page == 'wp-seo-schema-settings') ) {
44
  return;
45
  }
46
  // scripts
146
  wp_send_json( $response );
147
  die();
148
  }
149
+ function kcSeoMainSettings_action(){
150
+ global $KcSeoWPSchema;
151
+ $error = true;
152
+ $msg = null;
153
+ if ( $KcSeoWPSchema->verifyNonce() ) {
154
+ unset( $_REQUEST['action'] );
155
+ unset( $_REQUEST['_kcseo_nonce'] );
156
+ unset( $_REQUEST['_wp_http_referer'] );
157
+ update_option( $KcSeoWPSchema->options['main_settings'], $_REQUEST );
158
+ $error = false;
159
+ $msg = __( 'Settings successfully updated', KCSEO_WP_SCHEMA_SLUG );
160
+ } else {
161
+ $msg = __( 'Security Error !!', KCSEO_WP_SCHEMA_SLUG );
162
+ }
163
+ $response = array(
164
+ 'error' => $error,
165
+ 'msg' => $msg
166
+ );
167
+ wp_send_json( $response );
168
+ die();
169
+ }
170
 
171
  function wp_schema_page() {
172
+ global $KcSeoWPSchema;
173
+ $KcSeoWPSchema->render( 'schema-options' );
174
+ }
175
+ function wp_schema_setting_page() {
176
  global $KcSeoWPSchema;
177
  $KcSeoWPSchema->render( 'settings' );
178
  }
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', 'wp-seo-schema-settings',
185
+ array( $this, 'wp_schema_setting_page' ));
186
 
187
  }
188
 
lib/classes/KcSeoOutput.php CHANGED
@@ -131,8 +131,17 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
131
  "postalCode" => ! empty( $settings['address']['postalcode'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['postalcode'] ) : null,
132
  "streetAddress" => ! empty( $settings['address']['street'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['street'] ) : null
133
  );
 
 
 
134
  if ( $webMeta["@type"] ) {
135
- $html .= $schemaModel->get_jsonEncode( $webMeta );
 
 
 
 
 
 
136
  }
137
 
138
  if ( is_single() || is_page() ) {
131
  "postalCode" => ! empty( $settings['address']['postalcode'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['postalcode'] ) : null,
132
  "streetAddress" => ! empty( $settings['address']['street'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['address']['street'] ) : null
133
  );
134
+
135
+ $main_settings = get_option( $KcSeoWPSchema->options['main_settings'] );
136
+ $site_schema = !empty($main_settings['site_schema']) ? $main_settings['site_schema'] : 'home_page';
137
  if ( $webMeta["@type"] ) {
138
+ if($site_schema == 'home_page'){
139
+ if(is_home() || is_front_page()){
140
+ $html .= $schemaModel->get_jsonEncode( $webMeta );
141
+ }
142
+ }elseif($site_schema == 'all'){
143
+ $html .= $schemaModel->get_jsonEncode( $webMeta );
144
+ }
145
  }
146
 
147
  if ( is_single() || is_page() ) {
lib/init.php CHANGED
@@ -9,9 +9,10 @@ if ( ! class_exists( 'KcSeoWPSchema' ) ) {
9
  function __construct() {
10
  $this->KcSeoPrefix = "_schema_";
11
  $this->options = array(
 
12
  'settings' => 'kcseo_wp_schema',
13
  'installed_version' => 'kcseo_wp_installed_version',
14
- 'version' => '2.1',
15
  '1_2_fix' => "kcseo_wp_1_2_data_fix"
16
  );
17
 
9
  function __construct() {
10
  $this->KcSeoPrefix = "_schema_";
11
  $this->options = array(
12
+ 'main_settings' => 'kcseo_wp_schema_settings',
13
  'settings' => 'kcseo_wp_schema',
14
  'installed_version' => 'kcseo_wp_installed_version',
15
+ 'version' => '2.2',
16
  '1_2_fix' => "kcseo_wp_1_2_data_fix"
17
  );
18
 
lib/models/KcSeoSchemaModel.php CHANGED
@@ -26,7 +26,10 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
26
  );
27
  }
28
  if ( ! empty( $metaData['author'] ) ) {
29
- $article["author"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['author'] );
 
 
 
30
  }
31
  if ( ! empty( $metaData['publisher'] ) ) {
32
  if ( ! empty( $metaData['publisherImage'] ) ) {
@@ -65,10 +68,12 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
65
  $article["dateModified"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['dateModified'] );
66
  }
67
  if ( ! empty( $metaData['description'] ) ) {
68
- $article["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
 
69
  }
70
  if ( ! empty( $metaData['articleBody'] ) ) {
71
- $article["articleBody"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['articleBody'], 'textarea' );
 
72
  }
73
  $html .= $this->get_jsonEncode( $article );
74
  break;
@@ -87,7 +92,10 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
87
  );
88
  }
89
  if ( ! empty( $metaData['author'] ) ) {
90
- $newsArticle["author"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['author'] );
 
 
 
91
  }
92
  if ( ! empty( $metaData['image'] ) ) {
93
  $img = $KcSeoWPSchema->imageInfo( absint( $metaData['image'] ) );
@@ -123,10 +131,12 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
123
  );
124
  }
125
  if ( ! empty( $metaData['description'] ) ) {
126
- $newsArticle["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
 
127
  }
128
  if ( ! empty( $metaData['articleBody'] ) ) {
129
- $newsArticle["articleBody"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['articleBody'], 'textarea' );
 
130
  }
131
  $html .= $this->get_jsonEncode( $newsArticle );
132
  break;
@@ -145,7 +155,10 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
145
  );
146
  }
147
  if ( ! empty( $metaData['author'] ) ) {
148
- $blogPosting["author"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['author'] );
 
 
 
149
  }
150
  if ( ! empty( $metaData['image'] ) ) {
151
  $img = $KcSeoWPSchema->imageInfo( absint( $metaData['image'] ) );
@@ -181,10 +194,12 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
181
  );
182
  }
183
  if ( ! empty( $metaData['description'] ) ) {
184
- $blogPosting["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
 
185
  }
186
  if ( ! empty( $metaData['articleBody'] ) ) {
187
- $blogPosting["articleBody"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['articleBody'], 'textarea' );
 
188
  }
189
  $html .= $this->get_jsonEncode( $blogPosting );
190
  break;
@@ -203,7 +218,8 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
203
  $event["endDate"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['endDate'] );
204
  }
205
  if ( ! empty( $metaData['description'] ) ) {
206
- $event["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
 
207
  }
208
  if ( ! empty( $metaData['performerName'] ) ) {
209
  $event["performer"] = array(
@@ -226,7 +242,8 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
226
  "@type" => "Offer",
227
  "price" => $KcSeoWPSchema->sanitizeOutPut( $metaData['price'] ),
228
  "priceCurrency" => ! empty( $metaData['priceCurrency'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['priceCurrency'] ) : null,
229
- "url" => ! empty( $metaData['url'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['url'], 'url' ) : null
 
230
  );
231
  }
232
  if ( ! empty( $metaData['url'] ) ) {
@@ -283,7 +300,8 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
283
  $video["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
284
  }
285
  if ( ! empty( $metaData['description'] ) ) {
286
- $video["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
 
287
  }
288
  if ( ! empty( $metaData['description'] ) ) {
289
  $video["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'] );
@@ -406,7 +424,8 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
406
  $aRating["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
407
  }
408
  if ( ! empty( $metaData['description'] ) ) {
409
- $aRating["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
 
410
  }
411
  if ( $aRating["@type"] != "Organization" ) {
412
  if ( ! empty( $metaData['image'] ) ) {
@@ -457,10 +476,12 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
457
  $restaurant["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
458
  }
459
  if ( ! empty( $metaData['description'] ) ) {
460
- $restaurant["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
 
461
  }
462
  if ( ! empty( $metaData['openingHours'] ) ) {
463
- $restaurant["openingHours"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['openingHours'], 'textarea' );
 
464
  }
465
  if ( ! empty( $metaData['telephone'] ) ) {
466
  $restaurant["telephone"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['telephone'] );
@@ -484,6 +505,41 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
484
  $html .= $this->get_jsonEncode( $restaurant );
485
  break;
486
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  default:
488
  break;
489
  }
@@ -528,7 +584,8 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
528
  }
529
  break;
530
  case 'textarea':
531
- $html .= "<textarea id='{$id}' class='{$class}' name='{$name}' >" . wp_kses( $value, array() ) . "</textarea>";
 
532
  break;
533
 
534
  case 'image':
@@ -1230,53 +1287,102 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
1230
  'restaurant' => array(
1231
  'title' => 'Restaurant',
1232
  'fields' => array(
1233
- 'active' => array(
1234
  'type' => 'checkbox'
1235
  ),
1236
- 'name' => array(
1237
  'title' => 'Name of the Restaurant',
1238
  'type' => 'text',
1239
  'required' => true
1240
  ),
1241
- 'description' => array(
1242
  'title' => 'Description of the Restaurant',
1243
  'type' => 'textarea',
1244
  ),
1245
- 'openingHours' => array(
1246
  'title' => 'Opening Hours',
1247
  'type' => 'textarea',
1248
  'desc' => 'Mo,Tu,We,Th,Fr,Sa,Su 11:30-23:00'
1249
  ),
1250
- 'telephone' => array(
1251
  'title' => 'Opening Hours',
1252
  'type' => 'text',
1253
  'desc' => '+155501003333'
1254
  ),
1255
- 'menu' => array(
1256
  'title' => 'Menu',
1257
  'type' => 'text',
1258
  'desc' => 'http://example.com/menu'
1259
  ),
1260
- 'image' => array(
1261
  'title' => 'Image',
1262
  'type' => 'image',
1263
  'required' => true
1264
  ),
1265
- 'address' => array(
1266
  'title' => 'Address',
1267
  'type' => 'textarea'
1268
  ),
1269
- 'priceRange' => array(
1270
  'title' => 'Price Range',
1271
  'type' => 'text',
1272
  'desc' => 'The price range of the business, for example $$$'
1273
  ),
1274
- 'servesCuisine' => array(
1275
  'title' => 'Serves Cuisine',
1276
  'type' => 'text',
1277
  'desc' => 'The cuisine of the restaurant.'
1278
  )
1279
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1280
  )
1281
  );
1282
  }
@@ -1285,7 +1391,8 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
1285
  $html = null;
1286
  /** @var TYPE_NAME $data */
1287
  if ( ! empty( $data ) && is_array( $data ) ) {
1288
- $html .= '<script type="application/ld+json">' . json_encode( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) . '</script>';
 
1289
  }
1290
 
1291
  return $html;
@@ -1296,7 +1403,6 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
1296
  'Organization',
1297
  'LocalBusiness',
1298
  'AccountingService',
1299
- 'Attorney',
1300
  'AutoBodyShop',
1301
  'AutoDealer',
1302
  'AutoPartsStore',
@@ -1343,6 +1449,7 @@ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
1343
  'HVACBusiness',
1344
  'InsuranceAgency',
1345
  'JewelryStore',
 
1346
  'LiquorStore',
1347
  'Locksmith',
1348
  'LodgingBusiness',
26
  );
27
  }
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'] ) ) {
35
  if ( ! empty( $metaData['publisherImage'] ) ) {
68
  $article["dateModified"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['dateModified'] );
69
  }
70
  if ( ! empty( $metaData['description'] ) ) {
71
+ $article["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
72
+ 'textarea' );
73
  }
74
  if ( ! empty( $metaData['articleBody'] ) ) {
75
+ $article["articleBody"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['articleBody'],
76
+ 'textarea' );
77
  }
78
  $html .= $this->get_jsonEncode( $article );
79
  break;
92
  );
93
  }
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'] ) ) {
101
  $img = $KcSeoWPSchema->imageInfo( absint( $metaData['image'] ) );
131
  );
132
  }
133
  if ( ! empty( $metaData['description'] ) ) {
134
+ $newsArticle["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
135
+ 'textarea' );
136
  }
137
  if ( ! empty( $metaData['articleBody'] ) ) {
138
+ $newsArticle["articleBody"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['articleBody'],
139
+ 'textarea' );
140
  }
141
  $html .= $this->get_jsonEncode( $newsArticle );
142
  break;
155
  );
156
  }
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'] ) ) {
164
  $img = $KcSeoWPSchema->imageInfo( absint( $metaData['image'] ) );
194
  );
195
  }
196
  if ( ! empty( $metaData['description'] ) ) {
197
+ $blogPosting["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
198
+ 'textarea' );
199
  }
200
  if ( ! empty( $metaData['articleBody'] ) ) {
201
+ $blogPosting["articleBody"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['articleBody'],
202
+ 'textarea' );
203
  }
204
  $html .= $this->get_jsonEncode( $blogPosting );
205
  break;
218
  $event["endDate"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['endDate'] );
219
  }
220
  if ( ! empty( $metaData['description'] ) ) {
221
+ $event["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
222
+ 'textarea' );
223
  }
224
  if ( ! empty( $metaData['performerName'] ) ) {
225
  $event["performer"] = array(
242
  "@type" => "Offer",
243
  "price" => $KcSeoWPSchema->sanitizeOutPut( $metaData['price'] ),
244
  "priceCurrency" => ! empty( $metaData['priceCurrency'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['priceCurrency'] ) : null,
245
+ "url" => ! empty( $metaData['url'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['url'],
246
+ 'url' ) : null
247
  );
248
  }
249
  if ( ! empty( $metaData['url'] ) ) {
300
  $video["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
301
  }
302
  if ( ! empty( $metaData['description'] ) ) {
303
+ $video["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
304
+ 'textarea' );
305
  }
306
  if ( ! empty( $metaData['description'] ) ) {
307
  $video["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'] );
424
  $aRating["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
425
  }
426
  if ( ! empty( $metaData['description'] ) ) {
427
+ $aRating["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
428
+ 'textarea' );
429
  }
430
  if ( $aRating["@type"] != "Organization" ) {
431
  if ( ! empty( $metaData['image'] ) ) {
476
  $restaurant["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
477
  }
478
  if ( ! empty( $metaData['description'] ) ) {
479
+ $restaurant["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
480
+ 'textarea' );
481
  }
482
  if ( ! empty( $metaData['openingHours'] ) ) {
483
+ $restaurant["openingHours"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['openingHours'],
484
+ 'textarea' );
485
  }
486
  if ( ! empty( $metaData['telephone'] ) ) {
487
  $restaurant["telephone"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['telephone'] );
505
  $html .= $this->get_jsonEncode( $restaurant );
506
  break;
507
 
508
+ case 'localBusiness':
509
+ $localBusiness = array();
510
+ $localBusiness["@context"] = "http://schema.org";
511
+ $localBusiness["@type"] = "LocalBusiness";
512
+ if ( ! empty( $metaData['name'] ) ) {
513
+ $localBusiness["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
514
+ }
515
+ if ( ! empty( $metaData['description'] ) ) {
516
+ $localBusiness["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'],
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
+
537
+ if ( ! empty( $metaData['telephone'] ) ) {
538
+ $localBusiness["telephone"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['telephone'] );
539
+ }
540
+ $html .= $this->get_jsonEncode( $localBusiness );
541
+ break;
542
+
543
  default:
544
  break;
545
  }
584
  }
585
  break;
586
  case 'textarea':
587
+ $html .= "<textarea id='{$id}' class='{$class}' name='{$name}' >" . wp_kses( $value,
588
+ array() ) . "</textarea>";
589
  break;
590
 
591
  case 'image':
1287
  'restaurant' => array(
1288
  'title' => 'Restaurant',
1289
  'fields' => array(
1290
+ 'active' => array(
1291
  'type' => 'checkbox'
1292
  ),
1293
+ 'name' => array(
1294
  'title' => 'Name of the Restaurant',
1295
  'type' => 'text',
1296
  'required' => true
1297
  ),
1298
+ 'description' => array(
1299
  'title' => 'Description of the Restaurant',
1300
  'type' => 'textarea',
1301
  ),
1302
+ 'openingHours' => array(
1303
  'title' => 'Opening Hours',
1304
  'type' => 'textarea',
1305
  'desc' => 'Mo,Tu,We,Th,Fr,Sa,Su 11:30-23:00'
1306
  ),
1307
+ 'telephone' => array(
1308
  'title' => 'Opening Hours',
1309
  'type' => 'text',
1310
  'desc' => '+155501003333'
1311
  ),
1312
+ 'menu' => array(
1313
  'title' => 'Menu',
1314
  'type' => 'text',
1315
  'desc' => 'http://example.com/menu'
1316
  ),
1317
+ 'image' => array(
1318
  'title' => 'Image',
1319
  'type' => 'image',
1320
  'required' => true
1321
  ),
1322
+ 'address' => array(
1323
  'title' => 'Address',
1324
  'type' => 'textarea'
1325
  ),
1326
+ 'priceRange' => array(
1327
  'title' => 'Price Range',
1328
  'type' => 'text',
1329
  'desc' => 'The price range of the business, for example $$$'
1330
  ),
1331
+ 'servesCuisine' => array(
1332
  'title' => 'Serves Cuisine',
1333
  'type' => 'text',
1334
  'desc' => 'The cuisine of the restaurant.'
1335
  )
1336
  )
1337
+ ),
1338
+ 'localBusiness' => array(
1339
+ 'title' => 'Local Business',
1340
+ 'fields' => array(
1341
+ 'active' => array(
1342
+ 'type' => 'checkbox'
1343
+ ),
1344
+ 'name' => array(
1345
+ 'title' => 'Name',
1346
+ 'type' => 'text',
1347
+ 'required' => true
1348
+ ),
1349
+ 'description' => array(
1350
+ 'title' => 'Description',
1351
+ 'type' => 'textarea',
1352
+ ),
1353
+ 'image' => array(
1354
+ 'title' => 'Business Logo',
1355
+ 'type' => 'image',
1356
+ 'required' => true
1357
+ ),
1358
+ 'priceRange' => array(
1359
+ 'title' => 'Price Range (Recommended)',
1360
+ 'type' => 'text',
1361
+ 'desc' => "The price range of the business, for example $$$."
1362
+ ),
1363
+ 'addressLocality' => array(
1364
+ 'title' => 'Address locality',
1365
+ 'type' => 'text',
1366
+ 'desc' => 'City (i.e Kansas city)'
1367
+ ),
1368
+ 'addressRegion' => array(
1369
+ 'title' => 'Address region',
1370
+ 'type' => 'text',
1371
+ 'desc' => 'State (i.e. MO)'
1372
+ ),
1373
+ 'postalCode' => array(
1374
+ 'title' => 'Postal code',
1375
+ 'type' => 'text',
1376
+ ),
1377
+ 'streetAddress' => array(
1378
+ 'title' => 'Street address',
1379
+ 'type' => 'text',
1380
+ ),
1381
+ 'telephone' => array(
1382
+ 'title' => 'Telephone (Recommended)',
1383
+ 'type' => 'text',
1384
+ )
1385
+ )
1386
  )
1387
  );
1388
  }
1391
  $html = null;
1392
  /** @var TYPE_NAME $data */
1393
  if ( ! empty( $data ) && is_array( $data ) ) {
1394
+ $html .= '<script type="application/ld+json">' . json_encode( $data,
1395
+ JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) . '</script>';
1396
  }
1397
 
1398
  return $html;
1403
  'Organization',
1404
  'LocalBusiness',
1405
  'AccountingService',
 
1406
  'AutoBodyShop',
1407
  'AutoDealer',
1408
  'AutoPartsStore',
1449
  'HVACBusiness',
1450
  'InsuranceAgency',
1451
  'JewelryStore',
1452
+ 'LegalService',
1453
  'LiquorStore',
1454
  'Locksmith',
1455
  'LodgingBusiness',
lib/views/schema-options.php ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $KcSeoWPSchema;
3
+ $settings = get_option( $KcSeoWPSchema->options['settings'] );
4
+ $schemaModel = new KcSeoSchemaModel;
5
+ ?>
6
+ <div class="wrap">
7
+ <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br/></div>
8
+ <h2><?php _e( 'WP SEO Structured Data Schema', KCSEO_WP_SCHEMA_SLUG ); ?></h2>
9
+ <form id="kcseo-option-settings">
10
+
11
+ <h3><?php _e( 'General settings for WP SEO Structured Data Schema by <a href="http://kcseopro.com/">KCSEOPro.com</a>',
12
+ KCSEO_WP_SCHEMA_SLUG ); ?></h3>
13
+ <div class="setting-holder">
14
+ <table width="40%" cellpadding="10" class="form-table">
15
+ <tr class="default">
16
+ <th>Website Url <span class="required">*</span></th>
17
+ <td align="left" scope="row">
18
+ <div class="with-tooltip">
19
+ <input type="text" class="regular-text" name="web_url"
20
+ value="<?php echo( ! empty( $settings['web_url'] ) ? esc_attr( $settings['web_url'] ) : get_home_url() ); ?>"/>
21
+ <div class="schema-tooltip-holder">
22
+ <span class="schema-tooltip"></span>
23
+ <div class="hidden">
24
+ <p><b>Tip:</b> For more detailed information on how to configure this plugin, please
25
+ visit:
26
+ <a href="http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/">http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/</a>
27
+ </p>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </td>
32
+ </tr>
33
+ <tr class="default">
34
+ <th>Type</th>
35
+ <td align="left" scope="row">
36
+ <select id="site_type" name="site_type" class="select2">
37
+ <option value="">Select one type</option>
38
+ <?php
39
+ $siteType = ! empty( $settings['site_type'] ) ? $settings['site_type'] : null;
40
+ foreach ( $schemaModel->site_type() as $site ) {
41
+ $slt = ( $site == $siteType ? "selected" : null );
42
+ echo "<option value='$site' $slt>$site</option>";
43
+ }
44
+ ?>
45
+ </select>
46
+ </td>
47
+ </tr>
48
+ <tr class="default">
49
+ <th>Organization or Business name</th>
50
+ <td align="left" scope="row">
51
+ <input type="text" class="regular-text" name="type_name"
52
+ value="<?php echo( ! empty( $settings['type_name'] ) ? $settings['type_name'] : null ); ?>"/>
53
+ </td>
54
+ </tr>
55
+ <tr class="default all-type-data">
56
+ <th>Site Image <span class="required">*</span></th>
57
+ <td align="left" scope="row">
58
+ <div class="kSeo-image">
59
+ <div class="kSeo-image-wrapper">
60
+ <?php
61
+ $siteImageId = ! empty( $settings['site_image'] ) ? absint( $settings['site_image'] ) : 0;
62
+ $siteImage = $ingInfo = null;
63
+ if ( $siteImageId ) {
64
+ $siteImage = wp_get_attachment_image( $siteImageId, "thumbnail" );
65
+ $imgData = $KcSeoWPSchema->imageInfo( $siteImageId );
66
+ $ingInfo .= "<span><strong>URL: </strong>{$imgData['url']}</span>";
67
+ $ingInfo .= "<span><strong>Width: </strong>{$imgData['width']}px</span>";
68
+ $ingInfo .= "<span><strong>Height: </strong>{$imgData['height']}px</span>";
69
+ }
70
+ ?>
71
+ <span class="kSeoImgAdd"><span class="dashicons dashicons-plus-alt"></span></span>
72
+ <span class="kSeoImgRemove <?php echo( $siteImageId ? null : "kSeo-hidden" ); ?>"><span
73
+ class="dashicons dashicons-trash"></span></span>
74
+ <div class="kSeo-image-preview"><?php echo $siteImage; ?></div>
75
+ <input type="hidden" name="site_image" value="<?php echo $siteImageId; ?>"/>
76
+ </div>
77
+ <div class='image-info'><?php echo $ingInfo; ?></div>
78
+ </div>
79
+ </td>
80
+ </tr>
81
+ <tr class="default all-type-data">
82
+ <th>Price Range <span class="required">*</span></th>
83
+ <td align="left" scope="row">
84
+ <input type="text" class="regular-text" name="site_price_range"
85
+ value="<?php echo( ! empty( $settings['site_price_range'] ) ? $settings['site_price_range'] : null ); ?>"/>
86
+ <div class="description">The price range of the business, for example $$$.</div>
87
+ </td>
88
+ </tr>
89
+ <tr class="default all-type-data">
90
+ <th>Site Telephone <span class="required">*</span></th>
91
+ <td align="left" scope="row">
92
+ <input type="text" class="regular-text" name="site_telephone"
93
+ value="<?php echo( ! empty( $settings['site_telephone'] ) ? $settings['site_telephone'] : null ); ?>"/>
94
+ <div class="description">The telephone number.</div>
95
+ </td>
96
+ </tr>
97
+ <tr class="default">
98
+ <th>Additional Type</th>
99
+ <td align="left" scope="row">
100
+ <div class="with-tooltip">
101
+ <textarea name="additionalType"
102
+ placeholder="http://example1.com&#10;http://example2.com&#10;http://example3.com"
103
+ rows="6" cols="50"
104
+ class="additional-type"><?php echo( ! empty( $settings['additionalType'] ) ? esc_attr( @$settings['additionalType'] ) : null ); ?></textarea>
105
+ <p class="description">Add "Additional Type" URL(s) by separate ideas</p>
106
+ <div class="schema-tooltip-holder">
107
+ <span class="schema-tooltip"></span>
108
+ <div class="hidden">
109
+ <p><b>Tip:</b> Product Ontology is an extension to schema using WikiPedia
110
+ definitions that enables you to further define a type by adding an
111
+ “AdditionalType” attribute.Example for a Tailor (which is not available as a
112
+ schema “Type”): Pick LocalBusiness as a generic Type, then add additional type
113
+ as follows:
114
+ <a href="https://en.wikipedia.org/wiki/Tailor">https://en.wikipedia.org/wiki/<span>Tailor</span></a>
115
+ Change to this format and enter in Additional Type field:
116
+ <a href="http://www.productontology.org/id/Tailor">http://www.productontology.org/id/<span>Tailor</span></a>
117
+ For more info visit:<a href="http://kcseopro.com/product-ontology-schema/">http://kcseopro.com/product-ontology-schema/</a>
118
+ </p>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ </td>
123
+ </tr>
124
+
125
+ <tr class="default business-info">
126
+ <th style="font-size: 18px; padding: 30px 0 5px;">Others local business info</th>
127
+ </tr>
128
+ <tr class="default business-info">
129
+ <th>Description</th>
130
+ <td align="left" scope="row">
131
+ <textarea cols="50" rows="6"
132
+ name="business_info[description]"><?php echo( ! empty( $settings['business_info']['description'] ) ? esc_attr( $settings['business_info']['description'] ) : null ); ?></textarea>
133
+ </td>
134
+ </tr>
135
+ <tr class="default business-info">
136
+ <th>Operation Hours</th>
137
+ <td align="left" scope="row">
138
+ <div class="with-tooltip">
139
+ <textarea name="business_info[openingHours]"
140
+ placeholder="Mo-Sa 11:00-14:30&#10;Mo-Th 17:00-21:30&#10;Fr-Sa 17:00-22:00"
141
+ rows="4" cols="50"
142
+ class="additional-type"><?php echo( ! empty( $settings['business_info']['openingHours'] ) ? esc_attr( $settings['business_info']['openingHours'] ) : null ); ?></textarea>
143
+ <p class="description">- Days are specified using the following two-letter combinations: Mo,
144
+ Tu, We, Th, Fr, Sa, Su.</br>
145
+ - Times are specified using 24:00 time. For example, 3pm is specified as 15:00. <br>
146
+ - Add Opening Hours by separate line</p>
147
+ <div class="schema-tooltip-holder">
148
+ <span class="schema-tooltip"></span>
149
+ <div class="hidden">
150
+ <p>
151
+ <b>Tip:</b> Once you save these structured data schema settings, validate your
152
+ home page url here:
153
+ <a href="https://developers.google.com/structured-data/testing-tool/">https://developers.google.com/structured-data/testing-tool/</a>
154
+ </p>
155
+ </div>
156
+ </div>
157
+ </td>
158
+ </tr>
159
+ <tr class="default business-info">
160
+ <th style="font-size: 16px;">GeoCoordinates</th>
161
+ </tr>
162
+ <tr class="default business-info">
163
+ <th style="text-align: right">Longitude</th>
164
+ <td align="left" scope="row">
165
+ <input type="text" class="regular-text" name="business_info[longitude]"
166
+ value="<?php echo( ! empty( $settings['business_info']['longitude'] ) ? esc_attr( $settings['business_info']['longitude'] ) : null ); ?>"/>
167
+ </td>
168
+ </tr>
169
+ <tr class="default business-info">
170
+ <th style="text-align: right">Latitude</th>
171
+ <td align="left" scope="row">
172
+ <input type="text" class="regular-text" name="business_info[latitude]"
173
+ value="<?php echo( ! empty( $settings['business_info']['latitude'] ) ? esc_attr( $settings['business_info']['latitude'] ) : null ); ?>"/>
174
+ </td>
175
+ </tr>
176
+
177
+
178
+ <tr class="default person">
179
+ <th style="font-size: 18px; padding: 30px 0 5px;">Person</th>
180
+ </tr>
181
+ <tr class="default person">
182
+ <th>Name</th>
183
+ <td align="left" scope="row">
184
+ <input type="text" class="regular-text" name="person[name]"
185
+ value="<?php echo( ! empty( $settings['person']['name'] ) ? esc_attr( $settings['person']['name'] ) : null ); ?>"/>
186
+ </td>
187
+ </tr>
188
+ <tr class="default person">
189
+ <th>Work For</th>
190
+ <td align="left" scope="row">
191
+ <input type="text" class="regular-text" name="person[worksFor]"
192
+ value="<?php echo( ! empty( $settings['person']['worksFor'] ) ? esc_attr( $settings['person']['worksFor'] ) : null ); ?>"/>
193
+
194
+ </td>
195
+ </tr>
196
+ <tr class="default person">
197
+ <th>Job Title</th>
198
+ <td align="left" scope="row">
199
+ <input type="text" class="regular-text" name="person[jobTitle]"
200
+ value="<?php echo( @$settings['person']['jobTitle'] ? @$settings['person']['jobTitle'] : null ); ?>"/>
201
+
202
+ </td>
203
+ </tr>
204
+ <tr class="default person">
205
+ <th>Image</th>
206
+ <td align="left" scope="row">
207
+ <input type="text" class="regular-text" name="person[image]"
208
+ value="<?php echo( ! empty( $settings['person']['image'] ) ? esc_attr( $settings['person']['image'] ) : null ); ?>"/>
209
+ <p class="description">Add your personal photo here</p>
210
+ </td>
211
+ </tr>
212
+ <tr class="default person">
213
+ <th>Description</th>
214
+ <td align="left" scope="row">
215
+ <input type="text" class="regular-text" name="person[description]"
216
+ value="<?php echo( ! empty( $settings['person']['description'] ) ? esc_attr( $settings['person']['description'] ) : null ); ?>"/>
217
+ </td>
218
+ </tr>
219
+ <tr class="default person">
220
+ <th>Birth date</th>
221
+ <td align="left" scope="row">
222
+ <input type="text" class="regular-text kcseo-date" name="person[birthDate]"
223
+ value="<?php echo( ! empty( $settings['person']['birthDate'] ) ? esc_attr( $settings['person']['birthDate'] ) : null ); ?>"/>
224
+
225
+ </td>
226
+ </tr>
227
+ <tr class="default">
228
+ <th style="font-size: 18px; padding: 30px 0 5px;">Address</th>
229
+ </tr>
230
+ <tr class="default">
231
+ <th>Address Country</th>
232
+ <td align="left" scope="row">
233
+ <select class="select2" name="address[country]">
234
+ <option value="">Select a country</option>
235
+ <?php
236
+ $aCountry = ! empty( $settings['address']['country'] ) ? $settings['address']['country'] : null;
237
+ foreach ( $schemaModel->countryList() as $country ) {
238
+ $slt = ( $country == $aCountry ? "selected" : null );
239
+ echo "<option value='$country' $slt>$country</option>";
240
+ }
241
+ ?>
242
+ </select>
243
+ </td>
244
+ </tr>
245
+ <tr class="default">
246
+ <th>Address Locality</th>
247
+ <td align="left" scope="row">
248
+ <input type="text" class="regular-text" name="address[locality]"
249
+ value="<?php echo( ! empty( $settings['address']['locality'] ) ? esc_attr( $settings['address']['locality'] ) : null ); ?>"/>
250
+ <p class="description">City (i.e Kansas city)</p>
251
+ </tr>
252
+ <tr class="default">
253
+ <th>Address Region</th>
254
+ <td align="left" scope="row">
255
+ <input type="text" class="regular-text" name="address[region]"
256
+ value="<?php echo( ! empty( $settings['address']['region'] ) ? esc_attr( $settings['address']['region'] ) : null ); ?>"/>
257
+ <p class="description">State (i.e. MO)</p>
258
+ </tr>
259
+ <tr class="default">
260
+ <th>Postal Code</th>
261
+ <td align="left" scope="row">
262
+ <input type="text" class="regular-text" name="address[postalcode]"
263
+ value="<?php echo( ! empty( $settings['address']['postalcode'] ) ? esc_attr( $settings['address']['postalcode'] ) : null ); ?>"/>
264
+ </tr>
265
+ <tr class="default">
266
+ <th>Street Address</th>
267
+ <td align="left" scope="row">
268
+ <input type="text" class="regular-text" name="address[street]"
269
+ value="<?php echo( ! empty( $settings['address']['street'] ) ? esc_attr( $settings['address']['street'] ) : null ); ?>"/>
270
+ </tr>
271
+ </table>
272
+ </div>
273
+ <div id="tabs-kcseo-container" class="rt-tab-container">
274
+ <ul class="rt-tab-nav">
275
+ <li class="current"><a href="#tab-logo-url">Organization Logo</a></li>
276
+ <li><a href="#tab-social-profile">Social Profile</a></li>
277
+ <li><a href="#tab-corporate-contract">Corporate Contacts</a></li>
278
+ </ul>
279
+ <div id="tab-logo-url" class="rt-tab-content">
280
+ <table width="100%" cellpadding="10" class="form-table">
281
+ <tr class="field_logo">
282
+ <th>Select Organization Logo</th>
283
+ <td scope="row" style="position: relative">
284
+ <div class="kSeo-image">
285
+ <div class="kSeo-image-wrapper">
286
+ <?php
287
+ $organizationLogoId = ! empty( $settings['organization_logo'] ) ? absint( $settings['organization_logo'] ) : null;
288
+ $organizeImage = $imgInfo = null;
289
+ if ( $organizationLogoId ) {
290
+ $organizeImage = wp_get_attachment_image( $organizationLogoId, "thumbnail" );
291
+ $imgData = $KcSeoWPSchema->imageInfo( $organizationLogoId );
292
+ $imgInfo .= "<span><strong>URL: </strong>{$imgData['url']}</span>";
293
+ $imgInfo .= "<span><strong>Width: </strong>{$imgData['width']}px</span>";
294
+ $imgInfo .= "<span><strong>Height: </strong>{$imgData['height']}px</span>";
295
+ }
296
+ ?>
297
+ <span class="kSeoImgAdd"><span class="dashicons dashicons-plus-alt"></span></span>
298
+ <span
299
+ class="kSeoImgRemove <?php echo( $organizationLogoId ? null : "kSeo-hidden" ); ?>"><span
300
+ class="dashicons dashicons-trash"></span></span>
301
+ <div class="kSeo-image-preview"><?php echo $organizeImage; ?></div>
302
+ <input type="hidden" name="organization_logo" value="<?php echo $organizationLogoId; ?>"/>
303
+ </div>
304
+ <div class='image-info'><?php echo $imgInfo; ?></div>
305
+ </div>
306
+ <div class="schema-tooltip-holder" style="left: 200px">
307
+ <span class="schema-tooltip"></span>
308
+ <div class="hidden">
309
+ <p><b>Tip:</b> For some Rich Snippets that use the image property, no dimensions are specified, For other Rich Snippets that use the image property, Google specifies at least 160x90 pixels and at most 1920x1080 pixels. For Google Search, the documentation for their Rich Snippets is at
310
+ <a href="https://developers.google.com/structured-data/rich-snippets/.">https://developers.google.com/structured-data/rich-snippets/.</a>
311
+ </p>
312
+ </div>
313
+ </div>
314
+ </td>
315
+ </tr>
316
+ </table>
317
+ </div>
318
+ <div id="tab-social-profile" class="rt-tab-content">
319
+ <table width="100%" cellpadding="10" class="form-table">
320
+ <tr class="field_social">
321
+ <th>Company Name</th>
322
+ <td align="left" scope="row">
323
+ <input type="text" class="regular-text" name="social_company_name"
324
+ value="<?php echo( ! empty( $settings['social_company_name'] ) ? esc_attr( $settings['social_company_name'] ) : null ); ?>"/>
325
+ </td>
326
+ </tr>
327
+ <tr class="field_social_title">
328
+ <th style="font-size: 18px; padding: 10px 0;">Social Profiles</th>
329
+ </tr>
330
+ <tr class="social_field_link">
331
+ <th>Social Profile</th>
332
+ <th>
333
+ <div id="social-field-holder">
334
+ <?php
335
+ $socialP = ( ! empty( $settings['social'] ) ? $settings['social'] : array() );
336
+ if ( is_array( $socialP ) && ! empty( $socialP ) ) {
337
+ $html = null;
338
+ $i = 0;
339
+ foreach ( $socialP as $socialD ) {
340
+ $html .= "<div class='sfield'>";
341
+ $html .= "<select name='social[$i][id]'>";
342
+ foreach ( $schemaModel->socialList() as $sId => $social ) {
343
+ $slt = ( $sId == $socialD['id'] ? "selected" : null );
344
+ $html .= "<option value='$sId' $slt>$social</option>";
345
+ }
346
+ $html .= "</select>";
347
+ $html .= "<input type='text' name='social[$i][link]' value='{$socialD['link']}'>";
348
+ $html .= '<span class="dashicons dashicons-trash social-remove"></span>';
349
+ $html .= "</div>";
350
+ $i ++;
351
+ }
352
+ echo $html;
353
+ }
354
+ ?>
355
+ </div>
356
+ <a class="button button-primary add-new" id="social-add">Add Social Profile</a>
357
+ </th>
358
+ </tr>
359
+ </table>
360
+ </div>
361
+ <div id="tab-corporate-contract" class="rt-tab-content">
362
+ <table width="100%" cellpadding="10" class="form-table">
363
+ <tr class="field_contact">
364
+ <th style="font-size: 18px; padding: 10px 0;">Contacts</th>
365
+ </tr>
366
+ <tr class="field_contact">
367
+ <th>Contact Type</th>
368
+ <td scope="row">
369
+ <select name="contact[contactType]" class="select2" style="width: 200px">
370
+ <?php
371
+ $contactType = ! empty( $settings['contact']['contactType'] ) ? $settings['contact']['contactType'] : null;
372
+ foreach ( $schemaModel->contactType() as $cType ) {
373
+ $slt = ( $cType == $contactType ? "selected" : null );
374
+ echo "<option value='$cType' $slt>$cType</option>";
375
+ }
376
+
377
+ ?>
378
+ </select>
379
+ </td>
380
+
381
+ </tr>
382
+ <tr class="field_contact">
383
+ <th>Contact Phone</th>
384
+ <td align="left" scope="row">
385
+ <input type="text" class="regular-text" name="contact[telephone]"
386
+ value="<?php echo( ! empty( $settings['contact']['telephone'] ) ? esc_attr( $settings['contact']['telephone'] ) : null ); ?>"/>
387
+ <p class="description kco-telephone">Please follow the format below<span
388
+ style="font-size: 11px;">+1-505-998-3793</span><span style="font-size: 11px;">(425) 123-4567</span><span
389
+ style="font-size: 11px;">( 33 1) 42 68 53 01</span><span style="font-size: 11px;">+44-2078225951</span><span
390
+ style="font-size: 11px;">1 (855) 469-6378</span>
391
+ </p>
392
+ </td>
393
+ </tr>
394
+ <tr class="field_contact">
395
+ <th>Contact Email</th>
396
+ <td align="left" scope="row">
397
+ <input type="text" class="regular-text" name="contact[email]"
398
+ value="<?php echo( ! empty( $settings['contact']['email'] ) ? sanitize_email( $settings['contact']['email'] ) : null ); ?>"/>
399
+ </td>
400
+ </tr>
401
+ <tr class="field_contact">
402
+ <th>Contact Option</th>
403
+ <td align="left" scope="row">
404
+ <select name="contact[contactOption]" class="select2 withEmptyOption" style="width: 200px">
405
+ <option value="">Select an option</option>
406
+ <option value="TollFree" <?php
407
+ $cPtOpt = ! empty( $settings['contact']['contactOption'] ) ? $settings['contact']['contactOption'] : null;
408
+ echo( $cPtOpt == "TollFree" ? "selected" : null ); ?>>TollFree
409
+ </option>
410
+ <option
411
+ value="HearingImpairedSupported" <?php echo( $settings['contact']['contactOption'] == "HearingImpairedSupported" ? "selected" : null ); ?>>
412
+ HearingImpairedSupported
413
+ </option>
414
+ </select>
415
+ </td>
416
+ </tr>
417
+ <tr class="field_contact">
418
+ <th>Area Served</th>
419
+ <td align="left" scope="row">
420
+ <div class="area_served_wrapper">
421
+ <select id="area_served" class="select2" name="area_served[]" multiple="multiple"
422
+ style="width: 50%">
423
+ <?php
424
+ $areaServed = ! empty( $settings['area_served'] ) ? $settings['area_served'] : array();
425
+ foreach ( $schemaModel->countryList() as $country ) {
426
+ $slt = ( in_array( $country, $areaServed ) ? "selected" : null );
427
+ echo "<option value='$country' $slt>$country</option>";
428
+ }
429
+ ?>
430
+ </select>
431
+ </div>
432
+ </td>
433
+ </tr>
434
+ <tr class="field_contact">
435
+ <th>Available language</th>
436
+ <td scope="row" class="lang">
437
+ <select class="select2" name="availableLanguage[]" style="width: 50%" multiple="multiple">
438
+ <?php
439
+ $lanAvailable = ! empty( $settings['availableLanguage'] ) ? $settings['availableLanguage'] : array();
440
+ foreach ( $schemaModel->languageList() as $language ) {
441
+ $slt = ( in_array( $language, $lanAvailable ) ? "selected" : null );
442
+ echo "<option value='$language' $slt>$language</option>";
443
+ }
444
+ ?>
445
+ </select>
446
+ </td>
447
+ </tr>
448
+ </table>
449
+ </div>
450
+ </div>
451
+
452
+ <h2>Site Name in Search Results</h2>
453
+ <table width="100%" cellpadding="10" class="form-table">
454
+ <tr class="default">
455
+ <th>Enable Site link Search Box</th>
456
+ <td align="left" scope="row">
457
+ <input type="checkbox"
458
+ name="homeonly" <?php echo( ! empty( $settings['homeonly'] ) ? "checked" : null ); ?>
459
+ value="1"/>
460
+ </td>
461
+ </tr>
462
+ <tr class="default">
463
+ <th>Site Name:</th>
464
+ <td align="left" scope="row">
465
+ <input type="text" class="regular-text" name="sitename"
466
+ value="<?php echo( ! empty( $settings['sitename'] ) ? esc_attr( $settings['sitename'] ) : null ); ?>"/>
467
+ </td>
468
+ </tr>
469
+ <tr class="default">
470
+ <th>Site Alternative Name:</th>
471
+ <td align="left" scope="row">
472
+ <input type="text" class="regular-text" name="siteaname"
473
+ value="<?php echo( ! empty( $settings['siteaname'] ) ? esc_attr( $settings['siteaname'] ) : null ); ?>"/>
474
+ </td>
475
+ </tr>
476
+ <tr class="default">
477
+ <th>Site Url:</th>
478
+ <td align="left" scope="row">
479
+ <input type="text" class="regular-text" name="siteurl"
480
+ value="<?php echo( ! empty( $settings['siteurl'] ) ? esc_attr( $settings['siteurl'] ) : get_home_url() ); ?>"/>
481
+ </td>
482
+ </tr>
483
+ </table>
484
+ <p class="submit"><input type="submit" name="submit" id="tlpSaveButton" class="button button-primary"
485
+ value="<?php _e( 'Save Changes', KCSEO_WP_SCHEMA_SLUG ); ?>"></p>
486
+
487
+ <?php wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' ); ?>
488
+ </form>
489
+ <div id="response"></div>
490
+ </div>
lib/views/settings.php CHANGED
@@ -1,496 +1,34 @@
1
  <?php
2
  global $KcSeoWPSchema;
3
- $settings = get_option( $KcSeoWPSchema->options['settings'] );
4
- $schemaModel = new KcSeoSchemaModel;
5
  ?>
6
  <div class="wrap">
7
  <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br/></div>
8
- <h2><?php _e( 'WP SEO Structured Data Schema', KCSEO_WP_SCHEMA_SLUG ); ?></h2>
9
- <form id="kcseo-settings" onsubmit="wpSchemaSettings(this); return false;">
10
 
11
- <h3><?php _e( 'General settings for WP SEO Structured Data Schema by <a href="http://kcseopro.com/">KCSEOPro.com</a>',
12
- KCSEO_WP_SCHEMA_SLUG ); ?></h3>
13
- <div class="setting-holder">
14
- <table width="40%" cellpadding="10" class="form-table">
15
- <tr class="default">
16
- <th>Website Url <span class="required">*</span></th>
17
- <td align="left" scope="row">
18
- <div class="with-tooltip">
19
- <input type="text" class="regular-text" name="web_url"
20
- value="<?php echo( ! empty( $settings['web_url'] ) ? esc_attr( $settings['web_url'] ) : get_home_url() ); ?>"/>
21
- <div class="schema-tooltip-holder">
22
- <span class="schema-tooltip"></span>
23
- <div class="hidden">
24
- <p><b>Tip:</b> For more detailed information on how to configure this plugin, please
25
- visit:
26
- <a href="http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/">http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/</a>
27
- </p>
28
- </div>
29
- </div>
30
- </div>
31
- </td>
32
- </tr>
33
- <tr class="default">
34
- <th>Type</th>
35
- <td align="left" scope="row">
36
- <select id="site_type" name="site_type" class="select2">
37
- <option value="">Select one type</option>
38
- <?php
39
- $siteType = ! empty( $settings['site_type'] ) ? $settings['site_type'] : null;
40
- foreach ( $schemaModel->site_type() as $site ) {
41
- $slt = ( $site == $siteType ? "selected" : null );
42
- echo "<option value='$site' $slt>$site</option>";
43
- }
44
- ?>
45
- </select>
46
- </td>
47
- </tr>
48
- <tr class="default">
49
- <th>Organization or Business name</th>
50
- <td align="left" scope="row">
51
- <input type="text" class="regular-text" name="type_name"
52
- value="<?php echo( ! empty( $settings['type_name'] ) ? $settings['type_name'] : null ); ?>"/>
53
- </td>
54
- </tr>
55
- <tr class="default all-type-data">
56
- <th>Site Image <span class="required">*</span></th>
57
- <td align="left" scope="row">
58
- <div class="kSeo-image">
59
- <div class="kSeo-image-wrapper">
60
- <?php
61
- $siteImageId = ! empty( $settings['site_image'] ) ? absint( $settings['site_image'] ) : 0;
62
- $siteImage = $ingInfo = null;
63
- if ( $siteImageId ) {
64
- $siteImage = wp_get_attachment_image( $siteImageId, "thumbnail" );
65
- $imgData = $KcSeoWPSchema->imageInfo( $siteImageId );
66
- $ingInfo .= "<span><strong>URL: </strong>{$imgData['url']}</span>";
67
- $ingInfo .= "<span><strong>Width: </strong>{$imgData['width']}px</span>";
68
- $ingInfo .= "<span><strong>Height: </strong>{$imgData['height']}px</span>";
69
- }
70
- ?>
71
- <span class="kSeoImgAdd"><span class="dashicons dashicons-plus-alt"></span></span>
72
- <span class="kSeoImgRemove <?php echo( $siteImageId ? null : "kSeo-hidden" ); ?>"><span
73
- class="dashicons dashicons-trash"></span></span>
74
- <div class="kSeo-image-preview"><?php echo $siteImage; ?></div>
75
- <input type="hidden" name="site_image" value="<?php echo $siteImageId; ?>"/>
76
- </div>
77
- <div class='image-info'><?php echo $ingInfo; ?></div>
78
- </div>
79
- </td>
80
- </tr>
81
- <tr class="default all-type-data">
82
- <th>Price Range <span class="required">*</span></th>
83
- <td align="left" scope="row">
84
- <input type="text" class="regular-text" name="site_price_range"
85
- value="<?php echo( ! empty( $settings['site_price_range'] ) ? $settings['site_price_range'] : null ); ?>"/>
86
- <div class="description">The price range of the business, for example $$$.</div>
87
- </td>
88
- </tr>
89
- <tr class="default all-type-data">
90
- <th>Site Telephone <span class="required">*</span></th>
91
- <td align="left" scope="row">
92
- <input type="text" class="regular-text" name="site_telephone"
93
- value="<?php echo( ! empty( $settings['site_telephone'] ) ? $settings['site_telephone'] : null ); ?>"/>
94
- <div class="description">The telephone number.</div>
95
- </td>
96
- </tr>
97
- <tr class="default">
98
- <th>Additional Type</th>
99
- <td align="left" scope="row">
100
- <div class="with-tooltip">
101
- <textarea name="additionalType"
102
- placeholder="http://example1.com&#10;http://example2.com&#10;http://example3.com"
103
- rows="6" cols="50"
104
- class="additional-type"><?php echo( ! empty( $settings['additionalType'] ) ? esc_attr( @$settings['additionalType'] ) : null ); ?></textarea>
105
- <p class="description">Add "Additional Type" URL(s) by separate ideas</p>
106
- <div class="schema-tooltip-holder">
107
- <span class="schema-tooltip"></span>
108
- <div class="hidden">
109
- <p><b>Tip:</b> Product Ontology is an extension to schema using WikiPedia
110
- definitions that enables you to further define a type by adding an
111
- “AdditionalType” attribute.Example for a Tailor (which is not available as a
112
- schema “Type”): Pick LocalBusiness as a generic Type, then add additional type
113
- as follows:
114
- <a href="https://en.wikipedia.org/wiki/Tailor">https://en.wikipedia.org/wiki/<span>Tailor</span></a>
115
- Change to this format and enter in Additional Type field:
116
- <a href="http://www.productontology.org/id/Tailor">http://www.productontology.org/id/<span>Tailor</span></a>
117
- For more info visit:<a href="http://kcseopro.com/product-ontology-schema/">http://kcseopro.com/product-ontology-schema/</a>
118
- </p>
119
- </div>
120
- </div>
121
- </div>
122
- </td>
123
- </tr>
124
-
125
- <tr class="default business-info">
126
- <th style="font-size: 18px; padding: 30px 0 5px;">Others local business info</th>
127
- </tr>
128
- <tr class="default business-info">
129
- <th>Description</th>
130
- <td align="left" scope="row">
131
- <textarea cols="50" rows="6"
132
- name="business_info[description]"><?php echo( ! empty( $settings['business_info']['description'] ) ? esc_attr( $settings['business_info']['description'] ) : null ); ?></textarea>
133
- </td>
134
- </tr>
135
- <tr class="default business-info">
136
- <th>Operation Hours</th>
137
- <td align="left" scope="row">
138
- <div class="with-tooltip">
139
- <textarea name="business_info[openingHours]"
140
- placeholder="Mo-Sa 11:00-14:30&#10;Mo-Th 17:00-21:30&#10;Fr-Sa 17:00-22:00"
141
- rows="4" cols="50"
142
- class="additional-type"><?php echo( ! empty( $settings['business_info']['openingHours'] ) ? esc_attr( $settings['business_info']['openingHours'] ) : null ); ?></textarea>
143
- <p class="description">- Days are specified using the following two-letter combinations: Mo,
144
- Tu, We, Th, Fr, Sa, Su.</br>
145
- - Times are specified using 24:00 time. For example, 3pm is specified as 15:00. <br>
146
- - Add Opening Hours by separate line</p>
147
- <div class="schema-tooltip-holder">
148
- <span class="schema-tooltip"></span>
149
- <div class="hidden">
150
- <p>
151
- <b>Tip:</b> Once you save these structured data schema settings, validate your
152
- home page url here:
153
- <a href="https://developers.google.com/structured-data/testing-tool/">https://developers.google.com/structured-data/testing-tool/</a>
154
- </p>
155
- </div>
156
- </div>
157
- </td>
158
- </tr>
159
- <tr class="default business-info">
160
- <th style="font-size: 16px;">GeoCoordinates</th>
161
- </tr>
162
- <tr class="default business-info">
163
- <th style="text-align: right">Longitude</th>
164
- <td align="left" scope="row">
165
- <input type="text" class="regular-text" name="business_info[longitude]"
166
- value="<?php echo( ! empty( $settings['business_info']['longitude'] ) ? esc_attr( $settings['business_info']['longitude'] ) : null ); ?>"/>
167
- </td>
168
- </tr>
169
- <tr class="default business-info">
170
- <th style="text-align: right">Latitude</th>
171
- <td align="left" scope="row">
172
- <input type="text" class="regular-text" name="business_info[latitude]"
173
- value="<?php echo( ! empty( $settings['business_info']['latitude'] ) ? esc_attr( $settings['business_info']['latitude'] ) : null ); ?>"/>
174
- </td>
175
- </tr>
176
-
177
-
178
- <tr class="default person">
179
- <th style="font-size: 18px; padding: 30px 0 5px;">Person</th>
180
- </tr>
181
- <tr class="default person">
182
- <th>Name</th>
183
- <td align="left" scope="row">
184
- <input type="text" class="regular-text" name="person[name]"
185
- value="<?php echo( ! empty( $settings['person']['name'] ) ? esc_attr( $settings['person']['name'] ) : null ); ?>"/>
186
- </td>
187
- </tr>
188
- <tr class="default person">
189
- <th>Work For</th>
190
- <td align="left" scope="row">
191
- <input type="text" class="regular-text" name="person[worksFor]"
192
- value="<?php echo( ! empty( $settings['person']['worksFor'] ) ? esc_attr( $settings['person']['worksFor'] ) : null ); ?>"/>
193
-
194
- </td>
195
- </tr>
196
- <tr class="default person">
197
- <th>Job Title</th>
198
- <td align="left" scope="row">
199
- <input type="text" class="regular-text" name="person[jobTitle]"
200
- value="<?php echo( @$settings['person']['jobTitle'] ? @$settings['person']['jobTitle'] : null ); ?>"/>
201
-
202
- </td>
203
- </tr>
204
- <tr class="default person">
205
- <th>Image</th>
206
- <td align="left" scope="row">
207
- <input type="text" class="regular-text" name="person[image]"
208
- value="<?php echo( ! empty( $settings['person']['image'] ) ? esc_attr( $settings['person']['image'] ) : null ); ?>"/>
209
- <p class="description">Add your personal photo here</p>
210
- </td>
211
- </tr>
212
- <tr class="default person">
213
- <th>Description</th>
214
- <td align="left" scope="row">
215
- <input type="text" class="regular-text" name="person[description]"
216
- value="<?php echo( ! empty( $settings['person']['description'] ) ? esc_attr( $settings['person']['description'] ) : null ); ?>"/>
217
- </td>
218
- </tr>
219
- <tr class="default person">
220
- <th>Birth date</th>
221
- <td align="left" scope="row">
222
- <input type="text" class="regular-text kcseo-date" name="person[birthDate]"
223
- value="<?php echo( ! empty( $settings['person']['birthDate'] ) ? esc_attr( $settings['person']['birthDate'] ) : null ); ?>"/>
224
-
225
- </td>
226
- </tr>
227
- <tr class="default">
228
- <th style="font-size: 18px; padding: 30px 0 5px;">Address</th>
229
- </tr>
230
- <tr class="default">
231
- <th>Address Country</th>
232
- <td align="left" scope="row">
233
- <select class="select2" name="address[country]">
234
- <option value="">Select a country</option>
235
- <?php
236
- $aCountry = ! empty( $settings['address']['country'] ) ? $settings['address']['country'] : null;
237
- foreach ( $schemaModel->countryList() as $country ) {
238
- $slt = ( $country == $aCountry ? "selected" : null );
239
- echo "<option value='$country' $slt>$country</option>";
240
- }
241
- ?>
242
- </select>
243
- </td>
244
- </tr>
245
- <tr class="default">
246
- <th>Address Locality</th>
247
- <td align="left" scope="row">
248
- <input type="text" class="regular-text" name="address[locality]"
249
- value="<?php echo( ! empty( $settings['address']['locality'] ) ? esc_attr( $settings['address']['locality'] ) : null ); ?>"/>
250
- <p class="description">City (i.e Kansas city)</p>
251
- </tr>
252
- <tr class="default">
253
- <th>Address Region</th>
254
- <td align="left" scope="row">
255
- <input type="text" class="regular-text" name="address[region]"
256
- value="<?php echo( ! empty( $settings['address']['region'] ) ? esc_attr( $settings['address']['region'] ) : null ); ?>"/>
257
- <p class="description">State (i.e. MO)</p>
258
- </tr>
259
- <tr class="default">
260
- <th>Postal Code</th>
261
- <td align="left" scope="row">
262
- <input type="text" class="regular-text" name="address[postalcode]"
263
- value="<?php echo( ! empty( $settings['address']['postalcode'] ) ? esc_attr( $settings['address']['postalcode'] ) : null ); ?>"/>
264
- </tr>
265
- <tr class="default">
266
- <th>Street Address</th>
267
- <td align="left" scope="row">
268
- <input type="text" class="regular-text" name="address[street]"
269
- value="<?php echo( ! empty( $settings['address']['street'] ) ? esc_attr( $settings['address']['street'] ) : null ); ?>"/>
270
- </tr>
271
- </table>
272
- </div>
273
- <div id="tabs-kcseo-container" class="rt-tab-container">
274
- <ul class="rt-tab-nav">
275
- <li class="current"><a href="#tab-logo-url">Organization Logo</a></li>
276
- <li><a href="#tab-social-profile">Social Profile</a></li>
277
- <li><a href="#tab-corporate-contract">Corporate Contacts</a></li>
278
- </ul>
279
- <div id="tab-logo-url" class="rt-tab-content">
280
- <table width="100%" cellpadding="10" class="form-table">
281
- <tr class="field_logo">
282
- <th>Select Organization Logo</th>
283
- <td scope="row">
284
- <div class="kSeo-image">
285
- <div class="kSeo-image-wrapper">
286
- <?php
287
- $organizationLogoId = ! empty( $settings['organization_logo'] ) ? absint( $settings['organization_logo'] ) : null;
288
- $organizeImage = $imgInfo = null;
289
- if ( $organizationLogoId ) {
290
- $organizeImage = wp_get_attachment_image( $organizationLogoId, "thumbnail" );
291
- $imgData = $KcSeoWPSchema->imageInfo( $organizationLogoId );
292
- $imgInfo .= "<span><strong>URL: </strong>{$imgData['url']}</span>";
293
- $imgInfo .= "<span><strong>Width: </strong>{$imgData['width']}px</span>";
294
- $imgInfo .= "<span><strong>Height: </strong>{$imgData['height']}px</span>";
295
- }
296
- ?>
297
- <span class="kSeoImgAdd"><span class="dashicons dashicons-plus-alt"></span></span>
298
- <span
299
- class="kSeoImgRemove <?php echo( $organizationLogoId ? null : "kSeo-hidden" ); ?>"><span
300
- class="dashicons dashicons-trash"></span></span>
301
- <div class="kSeo-image-preview"><?php echo $organizeImage; ?></div>
302
- <input type="hidden" name="organization_logo" value="<?php echo $organizationLogoId; ?>"/>
303
- </div>
304
- <div class='image-info'><?php echo $imgInfo; ?></div>
305
- </div>
306
- </td>
307
- </tr>
308
- </table>
309
- </div>
310
- <div id="tab-social-profile" class="rt-tab-content">
311
- <table width="100%" cellpadding="10" class="form-table">
312
- <tr class="field_social">
313
- <th>Company Name</th>
314
- <td align="left" scope="row">
315
- <input type="text" class="regular-text" name="social_company_name"
316
- value="<?php echo( ! empty( $settings['social_company_name'] ) ? esc_attr( $settings['social_company_name'] ) : null ); ?>"/>
317
- </td>
318
- </tr>
319
- <tr class="field_social_title">
320
- <th style="font-size: 18px; padding: 10px 0;">Social Profiles</th>
321
- </tr>
322
- <tr class="social_field_link">
323
- <th>Social Profile</th>
324
- <th>
325
- <div id="social-field-holder">
326
- <?php
327
- $socialP = ( ! empty( $settings['social'] ) ? $settings['social'] : array() );
328
- if ( is_array( $socialP ) && ! empty( $socialP ) ) {
329
- $html = null;
330
- $i = 0;
331
- foreach ( $socialP as $socialD ) {
332
- $html .= "<div class='sfield'>";
333
- $html .= "<select name='social[$i][id]'>";
334
- foreach ( $schemaModel->socialList() as $sId => $social ) {
335
- $slt = ( $sId == $socialD['id'] ? "selected" : null );
336
- $html .= "<option value='$sId' $slt>$social</option>";
337
- }
338
- $html .= "</select>";
339
- $html .= "<input type='text' name='social[$i][link]' value='{$socialD['link']}'>";
340
- $html .= '<span class="dashicons dashicons-trash social-remove"></span>';
341
- $html .= "</div>";
342
- $i ++;
343
- }
344
- echo $html;
345
- }
346
- ?>
347
- </div>
348
- <a class="button button-primary add-new" id="social-add">Add Social Profile</a>
349
- </th>
350
- </tr>
351
- </table>
352
- </div>
353
- <div id="tab-corporate-contract" class="rt-tab-content">
354
- <table width="100%" cellpadding="10" class="form-table">
355
- <tr class="field_contact">
356
- <th style="font-size: 18px; padding: 10px 0;">Contacts</th>
357
- </tr>
358
- <tr class="field_contact">
359
- <th>Contact Type</th>
360
- <td scope="row">
361
- <select name="contact[contactType]" class="select2" style="width: 200px">
362
- <?php
363
- $contactType = ! empty( $settings['contact']['contactType'] ) ? $settings['contact']['contactType'] : null;
364
- foreach ( $schemaModel->contactType() as $cType ) {
365
- $slt = ( $cType == $contactType ? "selected" : null );
366
- echo "<option value='$cType' $slt>$cType</option>";
367
- }
368
-
369
- ?>
370
- </select>
371
- </td>
372
-
373
- </tr>
374
- <tr class="field_contact">
375
- <th>Contact Phone</th>
376
- <td align="left" scope="row">
377
- <input type="text" class="regular-text" name="contact[telephone]"
378
- value="<?php echo( ! empty( $settings['contact']['telephone'] ) ? esc_attr( $settings['contact']['telephone'] ) : null ); ?>"/>
379
- <p class="description kco-telephone">Please follow the format below<span
380
- style="font-size: 11px;">+1-505-998-3793</span><span style="font-size: 11px;">(425) 123-4567</span><span
381
- style="font-size: 11px;">( 33 1) 42 68 53 01</span><span style="font-size: 11px;">+44-2078225951</span><span
382
- style="font-size: 11px;">1 (855) 469-6378</span>
383
- </p>
384
- </td>
385
- </tr>
386
- <tr class="field_contact">
387
- <th>Contact Email</th>
388
- <td align="left" scope="row">
389
- <input type="text" class="regular-text" name="contact[email]"
390
- value="<?php echo( ! empty( $settings['contact']['email'] ) ? sanitize_email( $settings['contact']['email'] ) : null ); ?>"/>
391
- </td>
392
- </tr>
393
- <tr class="field_contact">
394
- <th>Contact Option</th>
395
- <td align="left" scope="row">
396
- <select name="contact[contactOption]" class="select2 withEmptyOption" style="width: 200px">
397
- <option value="">Select an option</option>
398
- <option value="TollFree" <?php
399
- $cPtOpt = ! empty( $settings['contact']['contactOption'] ) ? $settings['contact']['contactOption'] : null;
400
- echo( $cPtOpt == "TollFree" ? "selected" : null ); ?>>TollFree
401
- </option>
402
- <option
403
- value="HearingImpairedSupported" <?php echo( $settings['contact']['contactOption'] == "HearingImpairedSupported" ? "selected" : null ); ?>>
404
- HearingImpairedSupported
405
- </option>
406
- </select>
407
- </td>
408
- </tr>
409
- <tr class="field_contact">
410
- <th>Area Served</th>
411
- <td align="left" scope="row">
412
- <div class="area_served_wrapper">
413
- <select id="area_served" class="select2" name="area_served[]" multiple="multiple"
414
- style="width: 50%">
415
- <?php
416
- $areaServed = ! empty( $settings['area_served'] ) ? $settings['area_served'] : array();
417
- foreach ( $schemaModel->countryList() as $country ) {
418
- $slt = ( in_array( $country, $areaServed ) ? "selected" : null );
419
- echo "<option value='$country' $slt>$country</option>";
420
- }
421
- ?>
422
- </select>
423
- </div>
424
- </td>
425
- </tr>
426
- <tr class="field_contact">
427
- <th>Available language</th>
428
- <td scope="row" class="lang">
429
- <select class="select2" name="availableLanguage[]" style="width: 50%" multiple="multiple">
430
- <?php
431
- $lanAvailable = ! empty( $settings['availableLanguage'] ) ? $settings['availableLanguage'] : array();
432
- foreach ( $schemaModel->languageList() as $language ) {
433
- $slt = ( in_array( $language, $lanAvailable ) ? "selected" : null );
434
- echo "<option value='$language' $slt>$language</option>";
435
- }
436
- ?>
437
- </select>
438
- </td>
439
- </tr>
440
- </table>
441
- </div>
442
- </div>
443
-
444
- <h2>Site Name in Search Results</h2>
445
- <table width="100%" cellpadding="10" class="form-table">
446
- <tr class="default">
447
- <th>Enable Site link Search Box</th>
448
- <td align="left" scope="row">
449
- <input type="checkbox"
450
- name="homeonly" <?php echo( ! empty( $settings['homeonly'] ) ? "checked" : null ); ?>
451
- value="1"/>
452
- </td>
453
- </tr>
454
- <tr class="default">
455
- <th>Site Name:</th>
456
- <td align="left" scope="row">
457
- <input type="text" class="regular-text" name="sitename"
458
- value="<?php echo( ! empty( $settings['sitename'] ) ? esc_attr( $settings['sitename'] ) : null ); ?>"/>
459
- </td>
460
- </tr>
461
- <tr class="default">
462
- <th>Site Alternative Name:</th>
463
- <td align="left" scope="row">
464
- <input type="text" class="regular-text" name="siteaname"
465
- value="<?php echo( ! empty( $settings['siteaname'] ) ? esc_attr( $settings['siteaname'] ) : null ); ?>"/>
466
- </td>
467
- </tr>
468
- <tr class="default">
469
- <th>Site Url:</th>
470
- <td align="left" scope="row">
471
- <input type="text" class="regular-text" name="siteurl"
472
- value="<?php echo( ! empty( $settings['siteurl'] ) ? esc_attr( $settings['siteurl'] ) : get_home_url() ); ?>"/>
473
- </td>
474
- </tr>
475
- </table>
476
- <h2>Schema Settings</h2>
477
- <table width="100%" cellpadding="10" class="form-table">
478
  <tr class="default">
479
  <th>Delete all data</th>
480
  <td align="left" scope="row">
481
- <input type="checkbox"
482
- name="delete-data" <?php echo( ! empty( $settings['delete-data'] ) ? "checked" : null ); ?>
483
- value="1"
484
- id="delete-data"
485
- /><label for="delete-data">Enable</label>
486
- <p class="description">This will delete all schema data when plugin is deleted.</p>
487
  </td>
488
  </tr>
489
- </table>
490
  <p class="submit"><input type="submit" name="submit" id="tlpSaveButton" class="button button-primary"
491
  value="<?php _e( 'Save Changes', KCSEO_WP_SCHEMA_SLUG ); ?>"></p>
492
 
493
  <?php wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' ); ?>
494
  </form>
495
  <div id="response"></div>
496
- </div>
1
  <?php
2
  global $KcSeoWPSchema;
3
+ $settings = get_option( $KcSeoWPSchema->options['main_settings'] );
 
4
  ?>
5
  <div class="wrap">
6
  <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br/></div>
7
+ <h2><?php _e( 'Schema Settings', KCSEO_WP_SCHEMA_SLUG ); ?></h2>
8
+ <form id="kcseo-main-settings" >
9
 
10
+ <table width="40%" cellpadding="10" class="form-table">
11
+ <tr class="default">
12
+ <th>Business / Org Schema</th>
13
+ <td align="left" scope="row">
14
+ <?php $dd = !empty($settings['site_schema']) ? $settings['site_schema'] : 'home_page'; ?>
15
+ <input type="radio" <?php echo ($dd == 'home_page' ? 'checked' : null); ?> name="site_schema" value="home_page" id="site_schema_home"><label for="site_schema_home">Home page only</label><br>
16
+ <input type="radio" <?php echo ($dd == 'all' ? 'checked' : null); ?> name="site_schema" value="all" id="site_schema_all"><label for="site_schema_all">Sitewide (Apply General Settings schema sitewide)</label>
17
+ </td>
18
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <tr class="default">
20
  <th>Delete all data</th>
21
  <td align="left" scope="row">
22
+ <?php $dd = !empty($settings['delete-data']) ? "checked" : null; ?>
23
+ <input type="checkbox" <?php echo $dd; ?> name="delete-data" value="1" id="delete-data"><label for="delete-data">Enable</label>
24
+ <p class="description">This will delete all schema created and applied by this plugin when plugin is deleted.</p>
 
 
 
25
  </td>
26
  </tr>
27
+ </table>
28
  <p class="submit"><input type="submit" name="submit" id="tlpSaveButton" class="button button-primary"
29
  value="<?php _e( 'Save Changes', KCSEO_WP_SCHEMA_SLUG ); ?>"></p>
30
 
31
  <?php wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' ); ?>
32
  </form>
33
  <div id="response"></div>
34
+ </div>
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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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.1
7
  * Author: kcseopro
8
  * Author URI: http://kcseopro.com/
9
  * License: A "Slug" license name e.g. GPL2
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.2
7
  * Author: kcseopro
8
  * Author URI: http://kcseopro.com/
9
  * License: A "Slug" license name e.g. GPL2