WP SEO Structured Data Schema - Version 1.3

Version Description

  • Data recover
  • Image issue
  • Image from gallery
  • Fix data save issue
  • Schema update for different Criteria
Download this release

Release Info

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

Code changes from version 1.2 to 1.3

assets/css/admin.css CHANGED
@@ -1,16 +1,16 @@
 
 
 
1
  .wseo_loading{
2
  background: url('../images/loading.gif') no-repeat center center;
3
  padding: 11px;
4
  }
5
  .field-container {
6
- display: inline-block;
7
- width: 100%;
8
  }
9
- .field-container:after{
10
- content: ".";
11
- height: 0;
12
- visibility: hidden;
13
  display: block;
 
14
  clear: both;
15
  }
16
  .field-container label {
@@ -191,4 +191,43 @@ p.description .required {
191
  }
192
  .select2-results__option[aria-selected=true] {
193
  background: #f3f3f3;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }
1
+ .kSeo-hidden{
2
+ display: none;
3
+ }
4
  .wseo_loading{
5
  background: url('../images/loading.gif') no-repeat center center;
6
  padding: 11px;
7
  }
8
  .field-container {
9
+ margin-bottom: 15px;
 
10
  }
11
+ .field-container:after {
 
 
 
12
  display: block;
13
+ content: "";
14
  clear: both;
15
  }
16
  .field-container label {
191
  }
192
  .select2-results__option[aria-selected=true] {
193
  background: #f3f3f3;
194
+ }
195
+
196
+ /* hidden */
197
+ .rt-tab-container .field-container .kSeo-checkbox-wrapper input {
198
+ width: auto;
199
+ }
200
+ .all-type-data{
201
+ display: none;
202
+ }
203
+ .kSeo-image-wrapper {
204
+ display: inline-block;
205
+ position: relative;
206
+ }
207
+ span.kSeoImgAdd, span.kSeoImgRemove {
208
+ position: absolute;
209
+ top: -8px;
210
+ cursor: pointer;
211
+ }
212
+ span.kSeoImgAdd{
213
+ left: -8px;
214
+ color: green;
215
+ }
216
+ span.kSeoImgRemove{
217
+ right: -8px;
218
+ color: red;
219
+ }
220
+ .kSeo-image-preview {
221
+ min-width: 140px;
222
+ min-height: 80px;
223
+ background: rgba(176, 176, 176, 0.72);
224
+ padding: 5px;
225
+ text-align: center;
226
+ }
227
+ .kSeo-image-preview img {
228
+ display: block;
229
+ }
230
+ .image-info span {
231
+ display: block;
232
+ margin-top: 5px;
233
  }
assets/js/admin.js CHANGED
@@ -1,43 +1,54 @@
1
- (function($){
2
  'use strict';
3
- $('.kcseo-date').datepicker({
4
- dateFormat : 'yy-mm-dd'
 
 
 
 
 
 
 
5
  });
 
6
  showHideType();
7
- $("#site_type").change(function(){
8
  showHideType();
9
  });
10
 
11
- if($("#kcseo-wordpres-seo-structured-data-schema-meta-box").length){
12
 
13
  $("select.select2").select2({
14
- dropdownAutoWidth : true,
15
- width : '100%'
16
  });
17
- }else{
18
  $("select.select2").select2({
19
- dropdownAutoWidth : true
20
  });
21
  }
22
 
23
 
24
- $(".social-remove").on('click', function(){
25
- $(this).parent('.sfield').slideUp('slow').remove();
 
 
 
 
26
  });
27
 
28
- $("#social-add").on('click', function(){
29
- var bindElement = jQuery("#social-add");
30
  var count = $("#social-field-holder .sfield").length;
31
- var arg = 'id='+count;
32
- AjaxCall( bindElement, 'newSocial', arg, function(data){
33
- if(data.data){
34
- console.log(data.data);
35
  $("#social-field-holder").append(data.data);
36
  }
37
  });
38
  });
39
 
40
- $('.schema-tooltip').each(function() { // Notice the .each() loop, discussed below
41
  $(this).qtip({
42
  content: {
43
  text: $(this).next('div') // Use the "div" element next to this for the content
@@ -48,10 +59,8 @@
48
  }
49
  });
50
  });
51
- $(document).ready(function() {
52
- $(".rt-tab-nav li:first-child a").trigger('click');
53
- });
54
- $(".rt-tab-nav li").on('click', 'a', function(e){
55
  e.preventDefault();
56
  var container = $(this).parents('.rt-tab-container');
57
  var nav = container.children('.rt-tab-nav');
@@ -65,34 +74,82 @@
65
  container.find($id).show();
66
  });
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  })(jQuery);
69
 
70
 
71
- function showHideType(){
72
- var id = jQuery("#site_type option:selected").val();
73
- if(id == "Person"){
74
- jQuery(".form-table tr.person").show();
75
- }else{
76
- jQuery(".form-table tr.person").hide();
 
 
 
 
 
 
77
  }
78
- if(id == "Organization"){
79
- jQuery(".form-table tr.business-info").hide();
80
- }else{
81
- jQuery(".form-table tr.business-info").show();
82
  }
83
  }
84
- function wpSchemaSettings(e){
85
 
86
  jQuery('#response').hide();
87
- arg=jQuery( e ).serialize();
88
  bindElement = jQuery('#tlpSaveButton');
89
- AjaxCall( bindElement, 'kcSeoWpSchemaSettings', arg, function(data){
90
  console.log(data);
91
  jQuery('#response').addClass('updated');
92
- if(!data.error){
93
  jQuery('#response').removeClass('error');
94
  jQuery('#response').show('slow').text(data.msg);
95
- }else{
96
  jQuery('#response').addClass('error');
97
  jQuery('#response').show('slow').text(data.msg);
98
  }
@@ -100,18 +157,20 @@ function wpSchemaSettings(e){
100
 
101
  }
102
 
103
- function AjaxCall( element, action, arg, handle){
104
- if(action) data = "action=" + action;
105
- if(arg) data = arg + "&action=" + action;
106
- if(arg && !action) data = arg;
107
- data = data ;
108
 
109
  jQuery.ajax({
110
  type: "post",
111
  url: ajaxurl,
112
  data: data,
113
- beforeSend: function() { jQuery("<span class='wseo_loading'></span>").insertAfter(element); },
114
- success: function( data ){
 
 
115
  jQuery(".wseo_loading").remove();
116
  handle(data);
117
  }
1
+ (function ($) {
2
  'use strict';
3
+
4
+ $(document).ready(function () {
5
+ $(".rt-tab-nav li:first-child a").trigger('click');
6
+ if ($(".kcseo-date").length) {
7
+ $('.kcseo-date').datepicker({
8
+ 'format': 'yyyy-mm-dd',
9
+ 'autoclose': true
10
+ });
11
+ }
12
  });
13
+
14
  showHideType();
15
+ $("#site_type, #_schema_aggregate_rating_schema_type").change(function () {
16
  showHideType();
17
  });
18
 
19
+ if ($("#kcseo-wordpres-seo-structured-data-schema-meta-box").length) {
20
 
21
  $("select.select2").select2({
22
+ dropdownAutoWidth: true,
23
+ width: '100%'
24
  });
25
+ } else {
26
  $("select.select2").select2({
27
+ dropdownAutoWidth: true
28
  });
29
  }
30
 
31
 
32
+ $(document).on('click', ".social-remove", function () {
33
+ if (confirm("Are you sure?")) {
34
+ $(this).parent('.sfield').slideUp('slow', function () {
35
+ $(this).remove();
36
+ });
37
+ }
38
  });
39
 
40
+ $("#social-add").on('click', function () {
41
+ var bindElement = $("#social-add");
42
  var count = $("#social-field-holder .sfield").length;
43
+ var arg = 'id=' + count;
44
+ AjaxCall(bindElement, 'newSocial', arg, function (data) {
45
+ if (data.data) {
 
46
  $("#social-field-holder").append(data.data);
47
  }
48
  });
49
  });
50
 
51
+ $('.schema-tooltip').each(function () { // Notice the .each() loop, discussed below
52
  $(this).qtip({
53
  content: {
54
  text: $(this).next('div') // Use the "div" element next to this for the content
59
  }
60
  });
61
  });
62
+
63
+ $(".rt-tab-nav li").on('click', 'a', function (e) {
 
 
64
  e.preventDefault();
65
  var container = $(this).parents('.rt-tab-container');
66
  var nav = container.children('.rt-tab-nav');
74
  container.find($id).show();
75
  });
76
 
77
+ $(".kSeoImgAdd").on("click", function (e) {
78
+ var file_frame,
79
+ $this = $(this).parents('.kSeo-image-wrapper');
80
+ if (undefined !== file_frame) {
81
+ file_frame.open();
82
+ return;
83
+ }
84
+ file_frame = wp.media.frames.file_frame = wp.media({
85
+ title: 'Select or Upload Media For your profile gallery',
86
+ button: {
87
+ text: 'Use this media'
88
+ },
89
+ multiple: false
90
+ });
91
+ file_frame.on('select', function () {
92
+ var attachment = file_frame.state().get('selection').first().toJSON(),
93
+ imgId = attachment.id,
94
+ imgUrl = (typeof attachment.sizes.thumbnail === "undefined") ? attachment.url : attachment.sizes.thumbnail.url,
95
+ imgInfo = "<span><strong>URL: </strong>" + attachment.sizes.full.url + "</span>",
96
+ imgInfo = imgInfo + "<span><strong>Width: </strong>" + attachment.sizes.full.width + "px</span>",
97
+ imgInfo = imgInfo + "<span><strong>Height: </strong>" + attachment.sizes.full.height + "px</span>";
98
+ $this.find('input').val(imgId);
99
+ $this.find('.kSeoImgRemove').removeClass('kSeo-hidden');
100
+ $this.find('img').remove();
101
+ $this.find('.kSeo-image-preview').append("<img src='" + imgUrl + "' />");
102
+ $this.parents('.kSeo-image').find('.image-info').html(imgInfo);
103
+ });
104
+ // Now display the actual file_frame
105
+ file_frame.open();
106
+ });
107
+
108
+ $(".kSeoImgRemove").on("click", function (e) {
109
+ e.preventDefault();
110
+ if (confirm("Are you sure?")) {
111
+ var $this = $(this).parents('.kSeo-image-wrapper');
112
+ $this.find('input').val('');
113
+ $this.find('.kSeoImgRemove').addClass('kSeo-hidden');
114
+ $this.find('img').remove();
115
+ $this.parents('.kSeo-image').find('.image-info').html('');
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
  }
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
  }
assets/vendor/bootstrap-datepicker/bootstrap-datepicker.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Datepicker for Bootstrap v1.6.4 (https://github.com/eternicode/bootstrap-datepicker)
3
+ *
4
+ * Copyright 2012 Stefan Petre
5
+ * Improvements by Andrew Rowls
6
+ * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
7
+ */
8
+ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a,b){function c(){return new Date(Date.UTC.apply(Date,arguments))}function d(){var a=new Date;return c(a.getFullYear(),a.getMonth(),a.getDate())}function e(a,b){return a.getUTCFullYear()===b.getUTCFullYear()&&a.getUTCMonth()===b.getUTCMonth()&&a.getUTCDate()===b.getUTCDate()}function f(a){return function(){return this[a].apply(this,arguments)}}function g(a){return a&&!isNaN(a.getTime())}function h(b,c){function d(a,b){return b.toLowerCase()}var e,f=a(b).data(),g={},h=new RegExp("^"+c.toLowerCase()+"([A-Z])");c=new RegExp("^"+c.toLowerCase());for(var i in f)c.test(i)&&(e=i.replace(h,d),g[e]=f[i]);return g}function i(b){var c={};if(q[b]||(b=b.split("-")[0],q[b])){var d=q[b];return a.each(p,function(a,b){b in d&&(c[b]=d[b])}),c}}var j=function(){var b={get:function(a){return this.slice(a)[0]},contains:function(a){for(var b=a&&a.valueOf(),c=0,d=this.length;d>c;c++)if(this[c].valueOf()===b)return c;return-1},remove:function(a){this.splice(a,1)},replace:function(b){b&&(a.isArray(b)||(b=[b]),this.clear(),this.push.apply(this,b))},clear:function(){this.length=0},copy:function(){var a=new j;return a.replace(this),a}};return function(){var c=[];return c.push.apply(c,arguments),a.extend(c,b),c}}(),k=function(b,c){a(b).data("datepicker",this),this._process_options(c),this.dates=new j,this.viewDate=this.o.defaultViewDate,this.focusDate=null,this.element=a(b),this.isInput=this.element.is("input"),this.inputField=this.isInput?this.element:this.element.find("input"),this.component=this.element.hasClass("date")?this.element.find(".add-on, .input-group-addon, .btn"):!1,this.hasInput=this.component&&this.inputField.length,this.component&&0===this.component.length&&(this.component=!1),this.isInline=!this.component&&this.element.is("div"),this.picker=a(r.template),this._check_template(this.o.templates.leftArrow)&&this.picker.find(".prev").html(this.o.templates.leftArrow),this._check_template(this.o.templates.rightArrow)&&this.picker.find(".next").html(this.o.templates.rightArrow),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("datepicker-inline").appendTo(this.element):this.picker.addClass("datepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("datepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("thead .datepicker-title, tfoot .today, tfoot .clear").attr("colspan",function(a,b){return parseInt(b)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.setDaysOfWeekHighlighted(this.o.daysOfWeekHighlighted),this.setDatesDisabled(this.o.datesDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};k.prototype={constructor:k,_resolveViewName:function(a,c){return 0===a||"days"===a||"month"===a?0:1===a||"months"===a||"year"===a?1:2===a||"years"===a||"decade"===a?2:3===a||"decades"===a||"century"===a?3:4===a||"centuries"===a||"millennium"===a?4:c===b?!1:c},_check_template:function(c){try{if(c===b||""===c)return!1;if((c.match(/[<>]/g)||[]).length<=0)return!0;var d=a(c);return d.length>0}catch(e){return!1}},_process_options:function(b){this._o=a.extend({},this._o,b);var e=this.o=a.extend({},this._o),f=e.language;q[f]||(f=f.split("-")[0],q[f]||(f=o.language)),e.language=f,e.startView=this._resolveViewName(e.startView,0),e.minViewMode=this._resolveViewName(e.minViewMode,0),e.maxViewMode=this._resolveViewName(e.maxViewMode,4),e.startView=Math.min(e.startView,e.maxViewMode),e.startView=Math.max(e.startView,e.minViewMode),e.multidate!==!0&&(e.multidate=Number(e.multidate)||!1,e.multidate!==!1&&(e.multidate=Math.max(0,e.multidate))),e.multidateSeparator=String(e.multidateSeparator),e.weekStart%=7,e.weekEnd=(e.weekStart+6)%7;var g=r.parseFormat(e.format);e.startDate!==-(1/0)&&(e.startDate?e.startDate instanceof Date?e.startDate=this._local_to_utc(this._zero_time(e.startDate)):e.startDate=r.parseDate(e.startDate,g,e.language,e.assumeNearbyYear):e.startDate=-(1/0)),e.endDate!==1/0&&(e.endDate?e.endDate instanceof Date?e.endDate=this._local_to_utc(this._zero_time(e.endDate)):e.endDate=r.parseDate(e.endDate,g,e.language,e.assumeNearbyYear):e.endDate=1/0),e.daysOfWeekDisabled=e.daysOfWeekDisabled||[],a.isArray(e.daysOfWeekDisabled)||(e.daysOfWeekDisabled=e.daysOfWeekDisabled.split(/[,\s]*/)),e.daysOfWeekDisabled=a.map(e.daysOfWeekDisabled,function(a){return parseInt(a,10)}),e.daysOfWeekHighlighted=e.daysOfWeekHighlighted||[],a.isArray(e.daysOfWeekHighlighted)||(e.daysOfWeekHighlighted=e.daysOfWeekHighlighted.split(/[,\s]*/)),e.daysOfWeekHighlighted=a.map(e.daysOfWeekHighlighted,function(a){return parseInt(a,10)}),e.datesDisabled=e.datesDisabled||[],a.isArray(e.datesDisabled)||(e.datesDisabled=[e.datesDisabled]),e.datesDisabled=a.map(e.datesDisabled,function(a){return r.parseDate(a,g,e.language,e.assumeNearbyYear)});var h=String(e.orientation).toLowerCase().split(/\s+/g),i=e.orientation.toLowerCase();if(h=a.grep(h,function(a){return/^auto|left|right|top|bottom$/.test(a)}),e.orientation={x:"auto",y:"auto"},i&&"auto"!==i)if(1===h.length)switch(h[0]){case"top":case"bottom":e.orientation.y=h[0];break;case"left":case"right":e.orientation.x=h[0]}else i=a.grep(h,function(a){return/^left|right$/.test(a)}),e.orientation.x=i[0]||"auto",i=a.grep(h,function(a){return/^top|bottom$/.test(a)}),e.orientation.y=i[0]||"auto";else;if(e.defaultViewDate){var j=e.defaultViewDate.year||(new Date).getFullYear(),k=e.defaultViewDate.month||0,l=e.defaultViewDate.day||1;e.defaultViewDate=c(j,k,l)}else e.defaultViewDate=d()},_events:[],_secondaryEvents:[],_applyEvents:function(a){for(var c,d,e,f=0;f<a.length;f++)c=a[f][0],2===a[f].length?(d=b,e=a[f][1]):3===a[f].length&&(d=a[f][1],e=a[f][2]),c.on(e,d)},_unapplyEvents:function(a){for(var c,d,e,f=0;f<a.length;f++)c=a[f][0],2===a[f].length?(e=b,d=a[f][1]):3===a[f].length&&(e=a[f][1],d=a[f][2]),c.off(d,e)},_buildEvents:function(){var b={keyup:a.proxy(function(b){-1===a.inArray(b.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:a.proxy(this.keydown,this),paste:a.proxy(this.paste,this)};this.o.showOnFocus===!0&&(b.focus=a.proxy(this.show,this)),this.isInput?this._events=[[this.element,b]]:this.component&&this.hasInput?this._events=[[this.inputField,b],[this.component,{click:a.proxy(this.show,this)}]]:this._events=[[this.element,{click:a.proxy(this.show,this),keydown:a.proxy(this.keydown,this)}]],this._events.push([this.element,"*",{blur:a.proxy(function(a){this._focused_from=a.target},this)}],[this.element,{blur:a.proxy(function(a){this._focused_from=a.target},this)}]),this.o.immediateUpdates&&this._events.push([this.element,{"changeYear changeMonth":a.proxy(function(a){this.update(a.date)},this)}]),this._secondaryEvents=[[this.picker,{click:a.proxy(this.click,this)}],[a(window),{resize:a.proxy(this.place,this)}],[a(document),{mousedown:a.proxy(function(a){this.element.is(a.target)||this.element.find(a.target).length||this.picker.is(a.target)||this.picker.find(a.target).length||this.isInline||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(b,c){var d=c||this.dates.get(-1),e=this._utc_to_local(d);this.element.trigger({type:b,date:e,dates:a.map(this.dates,this._utc_to_local),format:a.proxy(function(a,b){0===arguments.length?(a=this.dates.length-1,b=this.o.format):"string"==typeof a&&(b=a,a=this.dates.length-1),b=b||this.o.format;var c=this.dates.get(a);return r.formatDate(c,b,this.o.language)},this)})},show:function(){return this.inputField.prop("disabled")||this.inputField.prop("readonly")&&this.o.enableOnReadonly===!1?void 0:(this.isInline||this.picker.appendTo(this.o.container),this.place(),this.picker.show(),this._attachSecondaryEvents(),this._trigger("show"),(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.o.disableTouchKeyboard&&a(this.element).blur(),this)},hide:function(){return this.isInline||!this.picker.is(":visible")?this:(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&this.inputField.val()&&this.setValue(),this._trigger("hide"),this)},destroy:function(){return this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().datepicker,this.isInput||delete this.element.data().date,this},paste:function(b){var c;if(b.originalEvent.clipboardData&&b.originalEvent.clipboardData.types&&-1!==a.inArray("text/plain",b.originalEvent.clipboardData.types))c=b.originalEvent.clipboardData.getData("text/plain");else{if(!window.clipboardData)return;c=window.clipboardData.getData("Text")}this.setDate(c),this.update(),b.preventDefault()},_utc_to_local:function(a){return a&&new Date(a.getTime()+6e4*a.getTimezoneOffset())},_local_to_utc:function(a){return a&&new Date(a.getTime()-6e4*a.getTimezoneOffset())},_zero_time:function(a){return a&&new Date(a.getFullYear(),a.getMonth(),a.getDate())},_zero_utc_time:function(a){return a&&new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))},getDates:function(){return a.map(this.dates,this._utc_to_local)},getUTCDates:function(){return a.map(this.dates,function(a){return new Date(a)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){var a=this.dates.get(-1);return"undefined"!=typeof a?new Date(a):null},clearDates:function(){this.inputField&&this.inputField.val(""),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()},setDates:function(){var b=a.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,b),this._trigger("changeDate"),this.setValue(),this},setUTCDates:function(){var b=a.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,a.map(b,this._utc_to_local)),this._trigger("changeDate"),this.setValue(),this},setDate:f("setDates"),setUTCDate:f("setUTCDates"),remove:f("destroy"),setValue:function(){var a=this.getFormattedDate();return this.inputField.val(a),this},getFormattedDate:function(c){c===b&&(c=this.o.format);var d=this.o.language;return a.map(this.dates,function(a){return r.formatDate(a,c,d)}).join(this.o.multidateSeparator)},getStartDate:function(){return this.o.startDate},setStartDate:function(a){return this._process_options({startDate:a}),this.update(),this.updateNavArrows(),this},getEndDate:function(){return this.o.endDate},setEndDate:function(a){return this._process_options({endDate:a}),this.update(),this.updateNavArrows(),this},setDaysOfWeekDisabled:function(a){return this._process_options({daysOfWeekDisabled:a}),this.update(),this.updateNavArrows(),this},setDaysOfWeekHighlighted:function(a){return this._process_options({daysOfWeekHighlighted:a}),this.update(),this},setDatesDisabled:function(a){this._process_options({datesDisabled:a}),this.update(),this.updateNavArrows()},place:function(){if(this.isInline)return this;var b=this.picker.outerWidth(),c=this.picker.outerHeight(),d=10,e=a(this.o.container),f=e.width(),g="body"===this.o.container?a(document).scrollTop():e.scrollTop(),h=e.offset(),i=[];this.element.parents().each(function(){var b=a(this).css("z-index");"auto"!==b&&0!==b&&i.push(parseInt(b))});var j=Math.max.apply(Math,i)+this.o.zIndexOffset,k=this.component?this.component.parent().offset():this.element.offset(),l=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),m=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),n=k.left-h.left,o=k.top-h.top;"body"!==this.o.container&&(o+=g),this.picker.removeClass("datepicker-orient-top datepicker-orient-bottom datepicker-orient-right datepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("datepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(n-=b-m)):k.left<0?(this.picker.addClass("datepicker-orient-left"),n-=k.left-d):n+b>f?(this.picker.addClass("datepicker-orient-right"),n+=m-b):this.picker.addClass("datepicker-orient-left");var p,q=this.o.orientation.y;if("auto"===q&&(p=-g+o-c,q=0>p?"bottom":"top"),this.picker.addClass("datepicker-orient-"+q),"top"===q?o-=c+parseInt(this.picker.css("padding-top")):o+=l,this.o.rtl){var r=f-(n+m);this.picker.css({top:o,right:r,zIndex:j})}else this.picker.css({top:o,left:n,zIndex:j});return this},_allow_update:!0,update:function(){if(!this._allow_update)return this;var b=this.dates.copy(),c=[],d=!1;return arguments.length?(a.each(arguments,a.proxy(function(a,b){b instanceof Date&&(b=this._local_to_utc(b)),c.push(b)},this)),d=!0):(c=this.isInput?this.element.val():this.element.data("date")||this.inputField.val(),c=c&&this.o.multidate?c.split(this.o.multidateSeparator):[c],delete this.element.data().date),c=a.map(c,a.proxy(function(a){return r.parseDate(a,this.o.format,this.o.language,this.o.assumeNearbyYear)},this)),c=a.grep(c,a.proxy(function(a){return!this.dateWithinRange(a)||!a},this),!0),this.dates.replace(c),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate?this.viewDate=new Date(this.o.endDate):this.viewDate=this.o.defaultViewDate,d?this.setValue():c.length&&String(b)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&b.length&&this._trigger("clearDate"),this.fill(),this.element.change(),this},fillDow:function(){var b=this.o.weekStart,c="<tr>";for(this.o.calendarWeeks&&(this.picker.find(".datepicker-days .datepicker-switch").attr("colspan",function(a,b){return parseInt(b)+1}),c+='<th class="cw">&#160;</th>');b<this.o.weekStart+7;)c+='<th class="dow',a.inArray(b,this.o.daysOfWeekDisabled)>-1&&(c+=" disabled"),c+='">'+q[this.o.language].daysMin[b++%7]+"</th>";c+="</tr>",this.picker.find(".datepicker-days thead").append(c)},fillMonths:function(){for(var a=this._utc_to_local(this.viewDate),b="",c=0;12>c;){var d=a&&a.getMonth()===c?" focused":"";b+='<span class="month'+d+'">'+q[this.o.language].monthsShort[c++]+"</span>"}this.picker.find(".datepicker-months td").html(b)},setRange:function(b){b&&b.length?this.range=a.map(b,function(a){return a.valueOf()}):delete this.range,this.fill()},getClassNames:function(b){var c=[],d=this.viewDate.getUTCFullYear(),e=this.viewDate.getUTCMonth(),f=new Date;return b.getUTCFullYear()<d||b.getUTCFullYear()===d&&b.getUTCMonth()<e?c.push("old"):(b.getUTCFullYear()>d||b.getUTCFullYear()===d&&b.getUTCMonth()>e)&&c.push("new"),this.focusDate&&b.valueOf()===this.focusDate.valueOf()&&c.push("focused"),this.o.todayHighlight&&b.getUTCFullYear()===f.getFullYear()&&b.getUTCMonth()===f.getMonth()&&b.getUTCDate()===f.getDate()&&c.push("today"),-1!==this.dates.contains(b)&&c.push("active"),this.dateWithinRange(b)||c.push("disabled"),this.dateIsDisabled(b)&&c.push("disabled","disabled-date"),-1!==a.inArray(b.getUTCDay(),this.o.daysOfWeekHighlighted)&&c.push("highlighted"),this.range&&(b>this.range[0]&&b<this.range[this.range.length-1]&&c.push("range"),-1!==a.inArray(b.valueOf(),this.range)&&c.push("selected"),b.valueOf()===this.range[0]&&c.push("range-start"),b.valueOf()===this.range[this.range.length-1]&&c.push("range-end")),c},_fill_yearsView:function(c,d,e,f,g,h,i,j){var k,l,m,n,o,p,q,r,s,t,u;for(k="",l=this.picker.find(c),m=parseInt(g/e,10)*e,o=parseInt(h/f,10)*f,p=parseInt(i/f,10)*f,n=a.map(this.dates,function(a){return parseInt(a.getUTCFullYear()/f,10)*f}),l.find(".datepicker-switch").text(m+"-"+(m+9*f)),q=m-f,r=-1;11>r;r+=1)s=[d],t=null,-1===r?s.push("old"):10===r&&s.push("new"),-1!==a.inArray(q,n)&&s.push("active"),(o>q||q>p)&&s.push("disabled"),q===this.viewDate.getFullYear()&&s.push("focused"),j!==a.noop&&(u=j(new Date(q,0,1)),u===b?u={}:"boolean"==typeof u?u={enabled:u}:"string"==typeof u&&(u={classes:u}),u.enabled===!1&&s.push("disabled"),u.classes&&(s=s.concat(u.classes.split(/\s+/))),u.tooltip&&(t=u.tooltip)),k+='<span class="'+s.join(" ")+'"'+(t?' title="'+t+'"':"")+">"+q+"</span>",q+=f;l.find("td").html(k)},fill:function(){var d,e,f=new Date(this.viewDate),g=f.getUTCFullYear(),h=f.getUTCMonth(),i=this.o.startDate!==-(1/0)?this.o.startDate.getUTCFullYear():-(1/0),j=this.o.startDate!==-(1/0)?this.o.startDate.getUTCMonth():-(1/0),k=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,l=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,m=q[this.o.language].today||q.en.today||"",n=q[this.o.language].clear||q.en.clear||"",o=q[this.o.language].titleFormat||q.en.titleFormat;if(!isNaN(g)&&!isNaN(h)){this.picker.find(".datepicker-days .datepicker-switch").text(r.formatDate(f,o,this.o.language)),this.picker.find("tfoot .today").text(m).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot .clear").text(n).toggle(this.o.clearBtn!==!1),this.picker.find("thead .datepicker-title").text(this.o.title).toggle(""!==this.o.title),this.updateNavArrows(),this.fillMonths();var p=c(g,h-1,28),s=r.getDaysInMonth(p.getUTCFullYear(),p.getUTCMonth());p.setUTCDate(s),p.setUTCDate(s-(p.getUTCDay()-this.o.weekStart+7)%7);var t=new Date(p);p.getUTCFullYear()<100&&t.setUTCFullYear(p.getUTCFullYear()),t.setUTCDate(t.getUTCDate()+42),t=t.valueOf();for(var u,v=[];p.valueOf()<t;){if(p.getUTCDay()===this.o.weekStart&&(v.push("<tr>"),this.o.calendarWeeks)){var w=new Date(+p+(this.o.weekStart-p.getUTCDay()-7)%7*864e5),x=new Date(Number(w)+(11-w.getUTCDay())%7*864e5),y=new Date(Number(y=c(x.getUTCFullYear(),0,1))+(11-y.getUTCDay())%7*864e5),z=(x-y)/864e5/7+1;v.push('<td class="cw">'+z+"</td>")}u=this.getClassNames(p),u.push("day"),this.o.beforeShowDay!==a.noop&&(e=this.o.beforeShowDay(this._utc_to_local(p)),e===b?e={}:"boolean"==typeof e?e={enabled:e}:"string"==typeof e&&(e={classes:e}),e.enabled===!1&&u.push("disabled"),e.classes&&(u=u.concat(e.classes.split(/\s+/))),e.tooltip&&(d=e.tooltip)),u=a.isFunction(a.uniqueSort)?a.uniqueSort(u):a.unique(u),v.push('<td class="'+u.join(" ")+'"'+(d?' title="'+d+'"':"")+">"+p.getUTCDate()+"</td>"),d=null,p.getUTCDay()===this.o.weekEnd&&v.push("</tr>"),p.setUTCDate(p.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(v.join(""));var A=q[this.o.language].monthsTitle||q.en.monthsTitle||"Months",B=this.picker.find(".datepicker-months").find(".datepicker-switch").text(this.o.maxViewMode<2?A:g).end().find("span").removeClass("active");if(a.each(this.dates,function(a,b){b.getUTCFullYear()===g&&B.eq(b.getUTCMonth()).addClass("active")}),(i>g||g>k)&&B.addClass("disabled"),g===i&&B.slice(0,j).addClass("disabled"),g===k&&B.slice(l+1).addClass("disabled"),this.o.beforeShowMonth!==a.noop){var C=this;a.each(B,function(c,d){var e=new Date(g,c,1),f=C.o.beforeShowMonth(e);f===b?f={}:"boolean"==typeof f?f={enabled:f}:"string"==typeof f&&(f={classes:f}),f.enabled!==!1||a(d).hasClass("disabled")||a(d).addClass("disabled"),f.classes&&a(d).addClass(f.classes),f.tooltip&&a(d).prop("title",f.tooltip)})}this._fill_yearsView(".datepicker-years","year",10,1,g,i,k,this.o.beforeShowYear),this._fill_yearsView(".datepicker-decades","decade",100,10,g,i,k,this.o.beforeShowDecade),this._fill_yearsView(".datepicker-centuries","century",1e3,100,g,i,k,this.o.beforeShowCentury)}},updateNavArrows:function(){if(this._allow_update){var a=new Date(this.viewDate),b=a.getUTCFullYear(),c=a.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-(1/0)&&b<=this.o.startDate.getUTCFullYear()&&c<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&b>=this.o.endDate.getUTCFullYear()&&c>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:case 3:case 4:this.o.startDate!==-(1/0)&&b<=this.o.startDate.getUTCFullYear()||this.o.maxViewMode<2?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&b>=this.o.endDate.getUTCFullYear()||this.o.maxViewMode<2?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(b){b.preventDefault(),b.stopPropagation();var e,f,g,h,i,j,k;e=a(b.target),e.hasClass("datepicker-switch")&&this.showMode(1);var l=e.closest(".prev, .next");l.length>0&&(f=r.modes[this.viewMode].navStep*(l.hasClass("prev")?-1:1),0===this.viewMode?(this.viewDate=this.moveMonth(this.viewDate,f),this._trigger("changeMonth",this.viewDate)):(this.viewDate=this.moveYear(this.viewDate,f),1===this.viewMode&&this._trigger("changeYear",this.viewDate)),this.fill()),e.hasClass("today")&&!e.hasClass("day")&&(this.showMode(-2),this._setDate(d(),"linked"===this.o.todayBtn?null:"view")),e.hasClass("clear")&&this.clearDates(),e.hasClass("disabled")||(e.hasClass("day")&&(g=parseInt(e.text(),10)||1,h=this.viewDate.getUTCFullYear(),i=this.viewDate.getUTCMonth(),e.hasClass("old")&&(0===i?(i=11,h-=1,j=!0,k=!0):(i-=1,j=!0)),e.hasClass("new")&&(11===i?(i=0,h+=1,j=!0,k=!0):(i+=1,j=!0)),this._setDate(c(h,i,g)),k&&this._trigger("changeYear",this.viewDate),j&&this._trigger("changeMonth",this.viewDate)),e.hasClass("month")&&(this.viewDate.setUTCDate(1),g=1,i=e.parent().find("span").index(e),h=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(i),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode?(this._setDate(c(h,i,g)),this.showMode()):this.showMode(-1),this.fill()),(e.hasClass("year")||e.hasClass("decade")||e.hasClass("century"))&&(this.viewDate.setUTCDate(1),g=1,i=0,h=parseInt(e.text(),10)||0,this.viewDate.setUTCFullYear(h),e.hasClass("year")&&(this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(c(h,i,g))),e.hasClass("decade")&&(this._trigger("changeDecade",this.viewDate),3===this.o.minViewMode&&this._setDate(c(h,i,g))),e.hasClass("century")&&(this._trigger("changeCentury",this.viewDate),4===this.o.minViewMode&&this._setDate(c(h,i,g))),this.showMode(-1),this.fill())),this.picker.is(":visible")&&this._focused_from&&a(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(a){var b=this.dates.contains(a);if(a||this.dates.clear(),-1!==b?(this.o.multidate===!0||this.o.multidate>1||this.o.toggleActive)&&this.dates.remove(b):this.o.multidate===!1?(this.dates.clear(),this.dates.push(a)):this.dates.push(a),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(a,b){b&&"date"!==b||this._toggle_multidate(a&&new Date(a)),b&&"view"!==b||(this.viewDate=a&&new Date(a)),this.fill(),this.setValue(),b&&"view"===b||this._trigger("changeDate"),this.inputField&&this.inputField.change(),!this.o.autoclose||b&&"date"!==b||this.hide()},moveDay:function(a,b){var c=new Date(a);return c.setUTCDate(a.getUTCDate()+b),c},moveWeek:function(a,b){return this.moveDay(a,7*b)},moveMonth:function(a,b){if(!g(a))return this.o.defaultViewDate;if(!b)return a;var c,d,e=new Date(a.valueOf()),f=e.getUTCDate(),h=e.getUTCMonth(),i=Math.abs(b);if(b=b>0?1:-1,1===i)d=-1===b?function(){return e.getUTCMonth()===h}:function(){return e.getUTCMonth()!==c},c=h+b,e.setUTCMonth(c),(0>c||c>11)&&(c=(c+12)%12);else{for(var j=0;i>j;j++)e=this.moveMonth(e,b);c=e.getUTCMonth(),e.setUTCDate(f),d=function(){return c!==e.getUTCMonth()}}for(;d();)e.setUTCDate(--f),e.setUTCMonth(c);return e},moveYear:function(a,b){return this.moveMonth(a,12*b)},moveAvailableDate:function(a,b,c){do{if(a=this[c](a,b),!this.dateWithinRange(a))return!1;c="moveDay"}while(this.dateIsDisabled(a));return a},weekOfDateIsDisabled:function(b){return-1!==a.inArray(b.getUTCDay(),this.o.daysOfWeekDisabled)},dateIsDisabled:function(b){return this.weekOfDateIsDisabled(b)||a.grep(this.o.datesDisabled,function(a){return e(b,a)}).length>0},dateWithinRange:function(a){return a>=this.o.startDate&&a<=this.o.endDate},keydown:function(a){if(!this.picker.is(":visible"))return void((40===a.keyCode||27===a.keyCode)&&(this.show(),a.stopPropagation()));var b,c,d=!1,e=this.focusDate||this.viewDate;switch(a.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),a.preventDefault(),a.stopPropagation();break;case 37:case 38:case 39:case 40:if(!this.o.keyboardNavigation||7===this.o.daysOfWeekDisabled.length)break;b=37===a.keyCode||38===a.keyCode?-1:1,0===this.viewMode?a.ctrlKey?(c=this.moveAvailableDate(e,b,"moveYear"),c&&this._trigger("changeYear",this.viewDate)):a.shiftKey?(c=this.moveAvailableDate(e,b,"moveMonth"),c&&this._trigger("changeMonth",this.viewDate)):37===a.keyCode||39===a.keyCode?c=this.moveAvailableDate(e,b,"moveDay"):this.weekOfDateIsDisabled(e)||(c=this.moveAvailableDate(e,b,"moveWeek")):1===this.viewMode?((38===a.keyCode||40===a.keyCode)&&(b=4*b),c=this.moveAvailableDate(e,b,"moveMonth")):2===this.viewMode&&((38===a.keyCode||40===a.keyCode)&&(b=4*b),c=this.moveAvailableDate(e,b,"moveYear")),c&&(this.focusDate=this.viewDate=c,this.setValue(),this.fill(),a.preventDefault());break;case 13:if(!this.o.forceParse)break;e=this.focusDate||this.dates.get(-1)||this.viewDate,this.o.keyboardNavigation&&(this._toggle_multidate(e),d=!0),this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(a.preventDefault(),a.stopPropagation(),this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}d&&(this.dates.length?this._trigger("changeDate"):this._trigger("clearDate"),this.inputField&&this.inputField.change())},showMode:function(a){a&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(this.o.maxViewMode,this.viewMode+a))),this.picker.children("div").hide().filter(".datepicker-"+r.modes[this.viewMode].clsName).show(),this.updateNavArrows()}};var l=function(b,c){a(b).data("datepicker",this),this.element=a(b),this.inputs=a.map(c.inputs,function(a){return a.jquery?a[0]:a}),delete c.inputs,n.call(a(this.inputs),c).on("changeDate",a.proxy(this.dateUpdated,this)),this.pickers=a.map(this.inputs,function(b){return a(b).data("datepicker")}),this.updateDates()};l.prototype={updateDates:function(){this.dates=a.map(this.pickers,function(a){return a.getUTCDate()}),this.updateRanges()},updateRanges:function(){var b=a.map(this.dates,function(a){return a.valueOf()});a.each(this.pickers,function(a,c){c.setRange(b)})},dateUpdated:function(b){if(!this.updating){this.updating=!0;var c=a(b.target).data("datepicker");if("undefined"!=typeof c){var d=c.getUTCDate(),e=a.inArray(b.target,this.inputs),f=e-1,g=e+1,h=this.inputs.length;if(-1!==e){if(a.each(this.pickers,function(a,b){b.getUTCDate()||b.setUTCDate(d)}),d<this.dates[f])for(;f>=0&&d<this.dates[f];)this.pickers[f--].setUTCDate(d);else if(d>this.dates[g])for(;h>g&&d>this.dates[g];)this.pickers[g++].setUTCDate(d);this.updateDates(),delete this.updating}}}},remove:function(){a.map(this.pickers,function(a){a.remove()}),delete this.element.data().datepicker}};var m=a.fn.datepicker,n=function(c){var d=Array.apply(null,arguments);d.shift();var e;if(this.each(function(){var b=a(this),f=b.data("datepicker"),g="object"==typeof c&&c;if(!f){var j=h(this,"date"),m=a.extend({},o,j,g),n=i(m.language),p=a.extend({},o,n,j,g);b.hasClass("input-daterange")||p.inputs?(a.extend(p,{inputs:p.inputs||b.find("input").toArray()}),f=new l(this,p)):f=new k(this,p),b.data("datepicker",f)}"string"==typeof c&&"function"==typeof f[c]&&(e=f[c].apply(f,d))}),e===b||e instanceof k||e instanceof l)return this;if(this.length>1)throw new Error("Using only allowed for the collection of a single element ("+c+" function)");return e};a.fn.datepicker=n;var o=a.fn.datepicker.defaults={assumeNearbyYear:!1,autoclose:!1,beforeShowDay:a.noop,beforeShowMonth:a.noop,beforeShowYear:a.noop,beforeShowDecade:a.noop,beforeShowCentury:a.noop,calendarWeeks:!1,clearBtn:!1,toggleActive:!1,daysOfWeekDisabled:[],daysOfWeekHighlighted:[],datesDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,maxViewMode:4,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-(1/0),startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0,disableTouchKeyboard:!1,enableOnReadonly:!0,showOnFocus:!0,zIndexOffset:10,container:"body",immediateUpdates:!1,title:"",templates:{leftArrow:"&laquo;",rightArrow:"&raquo;"}},p=a.fn.datepicker.locale_opts=["format","rtl","weekStart"];a.fn.datepicker.Constructor=k;var q=a.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear",titleFormat:"MM yyyy"}},r={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10},{clsName:"decades",navFnc:"FullDecade",navStep:100},{clsName:"centuries",navFnc:"FullCentury",navStep:1e3}],isLeapYear:function(a){return a%4===0&&a%100!==0||a%400===0},getDaysInMonth:function(a,b){return[31,r.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\u5e74\u6708\u65e5\[-`{-~\t\n\r]+/g,parseFormat:function(a){if("function"==typeof a.toValue&&"function"==typeof a.toDisplay)return a;var b=a.replace(this.validParts,"\x00").split("\x00"),c=a.match(this.validParts);if(!b||!b.length||!c||0===c.length)throw new Error("Invalid date format.");return{separators:b,parts:c}},parseDate:function(e,f,g,h){function i(a,b){return b===!0&&(b=10),100>a&&(a+=2e3,a>(new Date).getFullYear()+b&&(a-=100)),a}function j(){var a=this.slice(0,s[n].length),b=s[n].slice(0,a.length);return a.toLowerCase()===b.toLowerCase()}if(!e)return b;if(e instanceof Date)return e;if("string"==typeof f&&(f=r.parseFormat(f)),f.toValue)return f.toValue(e,f,g);var l,m,n,o,p=/([\-+]\d+)([dmwy])/,s=e.match(/([\-+]\d+)([dmwy])/g),t={d:"moveDay",m:"moveMonth",w:"moveWeek",y:"moveYear"},u={yesterday:"-1d",today:"+0d",tomorrow:"+1d"};if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(e)){for(e=new Date,n=0;n<s.length;n++)l=p.exec(s[n]),m=parseInt(l[1]),o=t[l[2]],e=k.prototype[o](e,m);return c(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}if("undefined"!=typeof u[e]&&(e=u[e],s=e.match(/([\-+]\d+)([dmwy])/g),/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(e))){for(e=new Date,n=0;n<s.length;n++)l=p.exec(s[n]),m=parseInt(l[1]),o=t[l[2]],e=k.prototype[o](e,m);return c(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}s=e&&e.match(this.nonpunctuation)||[],e=new Date;var v,w,x={},y=["yyyy","yy","M","MM","m","mm","d","dd"],z={yyyy:function(a,b){return a.setUTCFullYear(h?i(b,h):b)},yy:function(a,b){return a.setUTCFullYear(h?i(b,h):b)},m:function(a,b){if(isNaN(a))return a;for(b-=1;0>b;)b+=12;for(b%=12,a.setUTCMonth(b);a.getUTCMonth()!==b;)a.setUTCDate(a.getUTCDate()-1);return a},d:function(a,b){return a.setUTCDate(b)}};z.M=z.MM=z.mm=z.m,z.dd=z.d,e=d();var A=f.parts.slice();if(s.length!==A.length&&(A=a(A).filter(function(b,c){return-1!==a.inArray(c,y)}).toArray()),s.length===A.length){var B;for(n=0,B=A.length;B>n;n++){if(v=parseInt(s[n],10),l=A[n],isNaN(v))switch(l){case"MM":w=a(q[g].months).filter(j),v=a.inArray(w[0],q[g].months)+1;break;case"M":w=a(q[g].monthsShort).filter(j),v=a.inArray(w[0],q[g].monthsShort)+1}x[l]=v}var C,D;for(n=0;n<y.length;n++)D=y[n],D in x&&!isNaN(x[D])&&(C=new Date(e),z[D](C,x[D]),isNaN(C)||(e=C))}return e},formatDate:function(b,c,d){if(!b)return"";if("string"==typeof c&&(c=r.parseFormat(c)),
9
+ c.toDisplay)return c.toDisplay(b,c,d);var e={d:b.getUTCDate(),D:q[d].daysShort[b.getUTCDay()],DD:q[d].days[b.getUTCDay()],m:b.getUTCMonth()+1,M:q[d].monthsShort[b.getUTCMonth()],MM:q[d].months[b.getUTCMonth()],yy:b.getUTCFullYear().toString().substring(2),yyyy:b.getUTCFullYear()};e.dd=(e.d<10?"0":"")+e.d,e.mm=(e.m<10?"0":"")+e.m,b=[];for(var f=a.extend([],c.separators),g=0,h=c.parts.length;h>=g;g++)f.length&&b.push(f.shift()),b.push(e[c.parts[g]]);return b.join("")},headTemplate:'<thead><tr><th colspan="7" class="datepicker-title"></th></tr><tr><th class="prev">&laquo;</th><th colspan="5" class="datepicker-switch"></th><th class="next">&raquo;</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};r.template='<div class="datepicker"><div class="datepicker-days"><table class="table-condensed">'+r.headTemplate+"<tbody></tbody>"+r.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+r.headTemplate+r.contTemplate+r.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+r.headTemplate+r.contTemplate+r.footTemplate+'</table></div><div class="datepicker-decades"><table class="table-condensed">'+r.headTemplate+r.contTemplate+r.footTemplate+'</table></div><div class="datepicker-centuries"><table class="table-condensed">'+r.headTemplate+r.contTemplate+r.footTemplate+"</table></div></div>",a.fn.datepicker.DPGlobal=r,a.fn.datepicker.noConflict=function(){return a.fn.datepicker=m,this},a.fn.datepicker.version="1.6.4",a(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(b){var c=a(this);c.data("datepicker")||(b.preventDefault(),n.call(c,"show"))}),a(function(){n.call(a('[data-provide="datepicker-inline"]'))})});
assets/vendor/bootstrap-datepicker/bootstrap-datepicker3.standalone.min.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Datepicker for Bootstrap v1.6.4 (https://github.com/eternicode/bootstrap-datepicker)
3
+ *
4
+ * Copyright 2012 Stefan Petre
5
+ * Improvements by Andrew Rowls
6
+ * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
7
+ */
8
+ .datepicker{border-radius:4px;direction:ltr}.datepicker-inline{width:220px}.datepicker.datepicker-rtl{direction:rtl}.datepicker.datepicker-rtl table tr td span{float:right}.datepicker-dropdown{top:0;left:0;padding:4px}.datepicker-dropdown:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid rgba(0,0,0,.15);border-top:0;border-bottom-color:rgba(0,0,0,.2);position:absolute}.datepicker-dropdown:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;border-top:0;position:absolute}.datepicker-dropdown.datepicker-orient-left:before{left:6px}.datepicker-dropdown.datepicker-orient-left:after{left:7px}.datepicker-dropdown.datepicker-orient-right:before{right:6px}.datepicker-dropdown.datepicker-orient-right:after{right:7px}.datepicker-dropdown.datepicker-orient-bottom:before{top:-7px}.datepicker-dropdown.datepicker-orient-bottom:after{top:-6px}.datepicker-dropdown.datepicker-orient-top:before{bottom:-7px;border-bottom:0;border-top:7px solid rgba(0,0,0,.15)}.datepicker-dropdown.datepicker-orient-top:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.datepicker table{margin:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker table tr td,.datepicker table tr th{text-align:center;width:30px;height:30px;border-radius:4px;border:none}.table-striped .datepicker table tr td,.table-striped .datepicker table tr th{background-color:transparent}.datepicker table tr td.new,.datepicker table tr td.old{color:#777}.datepicker table tr td.day:hover,.datepicker table tr td.focused{background:#eee;cursor:pointer}.datepicker table tr td.disabled,.datepicker table tr td.disabled:hover{background:0 0;color:#777;cursor:default}.datepicker table tr td.highlighted{color:#000;background-color:#d9edf7;border-color:#85c5e5;border-radius:0}.datepicker table tr td.highlighted.focus,.datepicker table tr td.highlighted:focus{color:#000;background-color:#afd9ee;border-color:#298fc2}.datepicker table tr td.highlighted:hover{color:#000;background-color:#afd9ee;border-color:#52addb}.datepicker table tr td.highlighted.active,.datepicker table tr td.highlighted:active{color:#000;background-color:#afd9ee;border-color:#52addb}.datepicker table tr td.highlighted.active.focus,.datepicker table tr td.highlighted.active:focus,.datepicker table tr td.highlighted.active:hover,.datepicker table tr td.highlighted:active.focus,.datepicker table tr td.highlighted:active:focus,.datepicker table tr td.highlighted:active:hover{color:#000;background-color:#91cbe8;border-color:#298fc2}.datepicker table tr td.highlighted.disabled.focus,.datepicker table tr td.highlighted.disabled:focus,.datepicker table tr td.highlighted.disabled:hover,.datepicker table tr td.highlighted[disabled].focus,.datepicker table tr td.highlighted[disabled]:focus,.datepicker table tr td.highlighted[disabled]:hover,fieldset[disabled] .datepicker table tr td.highlighted.focus,fieldset[disabled] .datepicker table tr td.highlighted:focus,fieldset[disabled] .datepicker table tr td.highlighted:hover{background-color:#d9edf7;border-color:#85c5e5}.datepicker table tr td.highlighted.focused{background:#afd9ee}.datepicker table tr td.highlighted.disabled,.datepicker table tr td.highlighted.disabled:active{background:#d9edf7;color:#777}.datepicker table tr td.today{color:#000;background-color:#ffdb99;border-color:#ffb733}.datepicker table tr td.today.focus,.datepicker table tr td.today:focus{color:#000;background-color:#ffc966;border-color:#b37400}.datepicker table tr td.today:hover{color:#000;background-color:#ffc966;border-color:#f59e00}.datepicker table tr td.today.active,.datepicker table tr td.today:active{color:#000;background-color:#ffc966;border-color:#f59e00}.datepicker table tr td.today.active.focus,.datepicker table tr td.today.active:focus,.datepicker table tr td.today.active:hover,.datepicker table tr td.today:active.focus,.datepicker table tr td.today:active:focus,.datepicker table tr td.today:active:hover{color:#000;background-color:#ffbc42;border-color:#b37400}.datepicker table tr td.today.disabled.focus,.datepicker table tr td.today.disabled:focus,.datepicker table tr td.today.disabled:hover,.datepicker table tr td.today[disabled].focus,.datepicker table tr td.today[disabled]:focus,.datepicker table tr td.today[disabled]:hover,fieldset[disabled] .datepicker table tr td.today.focus,fieldset[disabled] .datepicker table tr td.today:focus,fieldset[disabled] .datepicker table tr td.today:hover{background-color:#ffdb99;border-color:#ffb733}.datepicker table tr td.today.focused{background:#ffc966}.datepicker table tr td.today.disabled,.datepicker table tr td.today.disabled:active{background:#ffdb99;color:#777}.datepicker table tr td.range{color:#000;background-color:#eee;border-color:#bbb;border-radius:0}.datepicker table tr td.range.focus,.datepicker table tr td.range:focus{color:#000;background-color:#d5d5d5;border-color:#7c7c7c}.datepicker table tr td.range:hover{color:#000;background-color:#d5d5d5;border-color:#9d9d9d}.datepicker table tr td.range.active,.datepicker table tr td.range:active{color:#000;background-color:#d5d5d5;border-color:#9d9d9d}.datepicker table tr td.range.active.focus,.datepicker table tr td.range.active:focus,.datepicker table tr td.range.active:hover,.datepicker table tr td.range:active.focus,.datepicker table tr td.range:active:focus,.datepicker table tr td.range:active:hover{color:#000;background-color:#c3c3c3;border-color:#7c7c7c}.datepicker table tr td.range.disabled.focus,.datepicker table tr td.range.disabled:focus,.datepicker table tr td.range.disabled:hover,.datepicker table tr td.range[disabled].focus,.datepicker table tr td.range[disabled]:focus,.datepicker table tr td.range[disabled]:hover,fieldset[disabled] .datepicker table tr td.range.focus,fieldset[disabled] .datepicker table tr td.range:focus,fieldset[disabled] .datepicker table tr td.range:hover{background-color:#eee;border-color:#bbb}.datepicker table tr td.range.focused{background:#d5d5d5}.datepicker table tr td.range.disabled,.datepicker table tr td.range.disabled:active{background:#eee;color:#777}.datepicker table tr td.range.highlighted{color:#000;background-color:#e4eef3;border-color:#9dc1d3}.datepicker table tr td.range.highlighted.focus,.datepicker table tr td.range.highlighted:focus{color:#000;background-color:#c1d7e3;border-color:#4b88a6}.datepicker table tr td.range.highlighted:hover{color:#000;background-color:#c1d7e3;border-color:#73a6c0}.datepicker table tr td.range.highlighted.active,.datepicker table tr td.range.highlighted:active{color:#000;background-color:#c1d7e3;border-color:#73a6c0}.datepicker table tr td.range.highlighted.active.focus,.datepicker table tr td.range.highlighted.active:focus,.datepicker table tr td.range.highlighted.active:hover,.datepicker table tr td.range.highlighted:active.focus,.datepicker table tr td.range.highlighted:active:focus,.datepicker table tr td.range.highlighted:active:hover{color:#000;background-color:#a8c8d8;border-color:#4b88a6}.datepicker table tr td.range.highlighted.disabled.focus,.datepicker table tr td.range.highlighted.disabled:focus,.datepicker table tr td.range.highlighted.disabled:hover,.datepicker table tr td.range.highlighted[disabled].focus,.datepicker table tr td.range.highlighted[disabled]:focus,.datepicker table tr td.range.highlighted[disabled]:hover,fieldset[disabled] .datepicker table tr td.range.highlighted.focus,fieldset[disabled] .datepicker table tr td.range.highlighted:focus,fieldset[disabled] .datepicker table tr td.range.highlighted:hover{background-color:#e4eef3;border-color:#9dc1d3}.datepicker table tr td.range.highlighted.focused{background:#c1d7e3}.datepicker table tr td.range.highlighted.disabled,.datepicker table tr td.range.highlighted.disabled:active{background:#e4eef3;color:#777}.datepicker table tr td.range.today{color:#000;background-color:#f7ca77;border-color:#f1a417}.datepicker table tr td.range.today.focus,.datepicker table tr td.range.today:focus{color:#000;background-color:#f4b747;border-color:#815608}.datepicker table tr td.range.today:hover{color:#000;background-color:#f4b747;border-color:#bf800c}.datepicker table tr td.range.today.active,.datepicker table tr td.range.today:active{color:#000;background-color:#f4b747;border-color:#bf800c}.datepicker table tr td.range.today.active.focus,.datepicker table tr td.range.today.active:focus,.datepicker table tr td.range.today.active:hover,.datepicker table tr td.range.today:active.focus,.datepicker table tr td.range.today:active:focus,.datepicker table tr td.range.today:active:hover{color:#000;background-color:#f2aa25;border-color:#815608}.datepicker table tr td.range.today.disabled.focus,.datepicker table tr td.range.today.disabled:focus,.datepicker table tr td.range.today.disabled:hover,.datepicker table tr td.range.today[disabled].focus,.datepicker table tr td.range.today[disabled]:focus,.datepicker table tr td.range.today[disabled]:hover,fieldset[disabled] .datepicker table tr td.range.today.focus,fieldset[disabled] .datepicker table tr td.range.today:focus,fieldset[disabled] .datepicker table tr td.range.today:hover{background-color:#f7ca77;border-color:#f1a417}.datepicker table tr td.range.today.disabled,.datepicker table tr td.range.today.disabled:active{background:#f7ca77;color:#777}.datepicker table tr td.selected,.datepicker table tr td.selected.highlighted{color:#fff;background-color:#777;border-color:#555;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td.selected.focus,.datepicker table tr td.selected.highlighted.focus,.datepicker table tr td.selected.highlighted:focus,.datepicker table tr td.selected:focus{color:#fff;background-color:#5e5e5e;border-color:#161616}.datepicker table tr td.selected.highlighted:hover,.datepicker table tr td.selected:hover{color:#fff;background-color:#5e5e5e;border-color:#373737}.datepicker table tr td.selected.active,.datepicker table tr td.selected.highlighted.active,.datepicker table tr td.selected.highlighted:active,.datepicker table tr td.selected:active{color:#fff;background-color:#5e5e5e;border-color:#373737}.datepicker table tr td.selected.active.focus,.datepicker table tr td.selected.active:focus,.datepicker table tr td.selected.active:hover,.datepicker table tr td.selected.highlighted.active.focus,.datepicker table tr td.selected.highlighted.active:focus,.datepicker table tr td.selected.highlighted.active:hover,.datepicker table tr td.selected.highlighted:active.focus,.datepicker table tr td.selected.highlighted:active:focus,.datepicker table tr td.selected.highlighted:active:hover,.datepicker table tr td.selected:active.focus,.datepicker table tr td.selected:active:focus,.datepicker table tr td.selected:active:hover{color:#fff;background-color:#4c4c4c;border-color:#161616}.datepicker table tr td.selected.disabled.focus,.datepicker table tr td.selected.disabled:focus,.datepicker table tr td.selected.disabled:hover,.datepicker table tr td.selected.highlighted.disabled.focus,.datepicker table tr td.selected.highlighted.disabled:focus,.datepicker table tr td.selected.highlighted.disabled:hover,.datepicker table tr td.selected.highlighted[disabled].focus,.datepicker table tr td.selected.highlighted[disabled]:focus,.datepicker table tr td.selected.highlighted[disabled]:hover,.datepicker table tr td.selected[disabled].focus,.datepicker table tr td.selected[disabled]:focus,.datepicker table tr td.selected[disabled]:hover,fieldset[disabled] .datepicker table tr td.selected.focus,fieldset[disabled] .datepicker table tr td.selected.highlighted.focus,fieldset[disabled] .datepicker table tr td.selected.highlighted:focus,fieldset[disabled] .datepicker table tr td.selected.highlighted:hover,fieldset[disabled] .datepicker table tr td.selected:focus,fieldset[disabled] .datepicker table tr td.selected:hover{background-color:#777;border-color:#555}.datepicker table tr td.active,.datepicker table tr td.active.highlighted{color:#fff;background-color:#337ab7;border-color:#2e6da4;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td.active.focus,.datepicker table tr td.active.highlighted.focus,.datepicker table tr td.active.highlighted:focus,.datepicker table tr td.active:focus{color:#fff;background-color:#286090;border-color:#122b40}.datepicker table tr td.active.highlighted:hover,.datepicker table tr td.active:hover{color:#fff;background-color:#286090;border-color:#204d74}.datepicker table tr td.active.active,.datepicker table tr td.active.highlighted.active,.datepicker table tr td.active.highlighted:active,.datepicker table tr td.active:active{color:#fff;background-color:#286090;border-color:#204d74}.datepicker table tr td.active.active.focus,.datepicker table tr td.active.active:focus,.datepicker table tr td.active.active:hover,.datepicker table tr td.active.highlighted.active.focus,.datepicker table tr td.active.highlighted.active:focus,.datepicker table tr td.active.highlighted.active:hover,.datepicker table tr td.active.highlighted:active.focus,.datepicker table tr td.active.highlighted:active:focus,.datepicker table tr td.active.highlighted:active:hover,.datepicker table tr td.active:active.focus,.datepicker table tr td.active:active:focus,.datepicker table tr td.active:active:hover{color:#fff;background-color:#204d74;border-color:#122b40}.datepicker table tr td.active.disabled.focus,.datepicker table tr td.active.disabled:focus,.datepicker table tr td.active.disabled:hover,.datepicker table tr td.active.highlighted.disabled.focus,.datepicker table tr td.active.highlighted.disabled:focus,.datepicker table tr td.active.highlighted.disabled:hover,.datepicker table tr td.active.highlighted[disabled].focus,.datepicker table tr td.active.highlighted[disabled]:focus,.datepicker table tr td.active.highlighted[disabled]:hover,.datepicker table tr td.active[disabled].focus,.datepicker table tr td.active[disabled]:focus,.datepicker table tr td.active[disabled]:hover,fieldset[disabled] .datepicker table tr td.active.focus,fieldset[disabled] .datepicker table tr td.active.highlighted.focus,fieldset[disabled] .datepicker table tr td.active.highlighted:focus,fieldset[disabled] .datepicker table tr td.active.highlighted:hover,fieldset[disabled] .datepicker table tr td.active:focus,fieldset[disabled] .datepicker table tr td.active:hover{background-color:#337ab7;border-color:#2e6da4}.datepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;border-radius:4px}.datepicker table tr td span.focused,.datepicker table tr td span:hover{background:#eee}.datepicker table tr td span.disabled,.datepicker table tr td span.disabled:hover{background:0 0;color:#777;cursor:default}.datepicker table tr td span.active,.datepicker table tr td span.active.disabled,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active:hover{color:#fff;background-color:#337ab7;border-color:#2e6da4;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datepicker table tr td span.active.disabled.focus,.datepicker table tr td span.active.disabled:focus,.datepicker table tr td span.active.disabled:hover.focus,.datepicker table tr td span.active.disabled:hover:focus,.datepicker table tr td span.active.focus,.datepicker table tr td span.active:focus,.datepicker table tr td span.active:hover.focus,.datepicker table tr td span.active:hover:focus{color:#fff;background-color:#286090;border-color:#122b40}.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active.disabled:hover:hover,.datepicker table tr td span.active:hover,.datepicker table tr td span.active:hover:hover{color:#fff;background-color:#286090;border-color:#204d74}.datepicker table tr td span.active.active,.datepicker table tr td span.active.disabled.active,.datepicker table tr td span.active.disabled:active,.datepicker table tr td span.active.disabled:hover.active,.datepicker table tr td span.active.disabled:hover:active,.datepicker table tr td span.active:active,.datepicker table tr td span.active:hover.active,.datepicker table tr td span.active:hover:active{color:#fff;background-color:#286090;border-color:#204d74}.datepicker table tr td span.active.active.focus,.datepicker table tr td span.active.active:focus,.datepicker table tr td span.active.active:hover,.datepicker table tr td span.active.disabled.active.focus,.datepicker table tr td span.active.disabled.active:focus,.datepicker table tr td span.active.disabled.active:hover,.datepicker table tr td span.active.disabled:active.focus,.datepicker table tr td span.active.disabled:active:focus,.datepicker table tr td span.active.disabled:active:hover,.datepicker table tr td span.active.disabled:hover.active.focus,.datepicker table tr td span.active.disabled:hover.active:focus,.datepicker table tr td span.active.disabled:hover.active:hover,.datepicker table tr td span.active.disabled:hover:active.focus,.datepicker table tr td span.active.disabled:hover:active:focus,.datepicker table tr td span.active.disabled:hover:active:hover,.datepicker table tr td span.active:active.focus,.datepicker table tr td span.active:active:focus,.datepicker table tr td span.active:active:hover,.datepicker table tr td span.active:hover.active.focus,.datepicker table tr td span.active:hover.active:focus,.datepicker table tr td span.active:hover.active:hover,.datepicker table tr td span.active:hover:active.focus,.datepicker table tr td span.active:hover:active:focus,.datepicker table tr td span.active:hover:active:hover{color:#fff;background-color:#204d74;border-color:#122b40}.datepicker table tr td span.active.disabled.disabled.focus,.datepicker table tr td span.active.disabled.disabled:focus,.datepicker table tr td span.active.disabled.disabled:hover,.datepicker table tr td span.active.disabled.focus,.datepicker table tr td span.active.disabled:focus,.datepicker table tr td span.active.disabled:hover,.datepicker table tr td span.active.disabled:hover.disabled.focus,.datepicker table tr td span.active.disabled:hover.disabled:focus,.datepicker table tr td span.active.disabled:hover.disabled:hover,.datepicker table tr td span.active.disabled:hover[disabled].focus,.datepicker table tr td span.active.disabled:hover[disabled]:focus,.datepicker table tr td span.active.disabled:hover[disabled]:hover,.datepicker table tr td span.active.disabled[disabled].focus,.datepicker table tr td span.active.disabled[disabled]:focus,.datepicker table tr td span.active.disabled[disabled]:hover,.datepicker table tr td span.active:hover.disabled.focus,.datepicker table tr td span.active:hover.disabled:focus,.datepicker table tr td span.active:hover.disabled:hover,.datepicker table tr td span.active:hover[disabled].focus,.datepicker table tr td span.active:hover[disabled]:focus,.datepicker table tr td span.active:hover[disabled]:hover,.datepicker table tr td span.active[disabled].focus,.datepicker table tr td span.active[disabled]:focus,.datepicker table tr td span.active[disabled]:hover,fieldset[disabled] .datepicker table tr td span.active.disabled.focus,fieldset[disabled] .datepicker table tr td span.active.disabled:focus,fieldset[disabled] .datepicker table tr td span.active.disabled:hover,fieldset[disabled] .datepicker table tr td span.active.disabled:hover.focus,fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus,fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover,fieldset[disabled] .datepicker table tr td span.active.focus,fieldset[disabled] .datepicker table tr td span.active:focus,fieldset[disabled] .datepicker table tr td span.active:hover,fieldset[disabled] .datepicker table tr td span.active:hover.focus,fieldset[disabled] .datepicker table tr td span.active:hover:focus,fieldset[disabled] .datepicker table tr td span.active:hover:hover{background-color:#337ab7;border-color:#2e6da4}.datepicker table tr td span.new,.datepicker table tr td span.old{color:#777}.datepicker .datepicker-switch{width:145px}.datepicker .datepicker-switch,.datepicker .next,.datepicker .prev,.datepicker tfoot tr th{cursor:pointer}.datepicker .datepicker-switch:hover,.datepicker .next:hover,.datepicker .prev:hover,.datepicker tfoot tr th:hover{background:#eee}.datepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.input-group.date .input-group-addon{cursor:pointer}.input-daterange{width:100%}.input-daterange input{text-align:center}.input-daterange input:first-child{border-radius:3px 0 0 3px}.input-daterange input:last-child{border-radius:0 3px 3px 0}.input-daterange .input-group-addon{width:auto;min-width:16px;padding:4px 5px;line-height:1.42857143;text-shadow:0 1px 0 #fff;border-width:1px 0;margin-left:-5px;margin-right:-5px}.datepicker.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);-moz-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;color:#333;font-size:13px;line-height:1.42857143}.datepicker.datepicker-inline td,.datepicker.datepicker-inline th,.datepicker.dropdown-menu td,.datepicker.dropdown-menu th{padding:0 5px}
9
+ /*# sourceMappingURL=bootstrap-datepicker3.standalone.min.css.map */
lib/classes/KcSeoHelper.php CHANGED
@@ -17,20 +17,20 @@ if ( ! class_exists( 'KcSeoSettings' ) ):
17
  }
18
 
19
 
20
- function isValidBase64( $string ) {
21
- $decoded = base64_decode( $string, true );
22
  // Check if there is no invalid character in string
23
- if ( ! preg_match( '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string ) ) {
24
  return false;
25
  }
26
 
27
  // Decode the string in strict mode and send the response
28
- if ( ! base64_decode( $string, true ) ) {
29
  return false;
30
  }
31
 
32
  // Encode and compare it to original one
33
- if ( base64_encode( $decoded ) != $string ) {
34
  return false;
35
  }
36
 
@@ -70,7 +70,7 @@ if ( ! class_exists( 'KcSeoSettings' ) ):
70
  } else if ( $type == 'url' ) {
71
  $newValue = esc_url( $value );
72
  } else if ( $type == 'textarea' ) {
73
- $newValue = wp_kses_post( $value );
74
  } else {
75
  $newValue = sanitize_text_field( $value );
76
  }
@@ -96,6 +96,79 @@ if ( ! class_exists( 'KcSeoSettings' ) ):
96
 
97
  return $newValue;
98
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
 
101
  endif;
17
  }
18
 
19
 
20
+ function isValidBase64( $string = null ) {
21
+ $decoded = @base64_decode( $string, true );
22
  // Check if there is no invalid character in string
23
+ if ( ! @preg_match( '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $string ) ) {
24
  return false;
25
  }
26
 
27
  // Decode the string in strict mode and send the response
28
+ if ( ! @base64_decode( $string, true ) ) {
29
  return false;
30
  }
31
 
32
  // Encode and compare it to original one
33
+ if ( @base64_encode( $decoded ) != $string ) {
34
  return false;
35
  }
36
 
70
  } else if ( $type == 'url' ) {
71
  $newValue = esc_url( $value );
72
  } else if ( $type == 'textarea' ) {
73
+ $newValue = wp_kses( $value, array() );
74
  } else {
75
  $newValue = sanitize_text_field( $value );
76
  }
96
 
97
  return $newValue;
98
  }
99
+
100
+
101
+ function imageInfo($attachment_id){
102
+ $data = array();
103
+ $imgData = wp_get_attachment_metadata($attachment_id);
104
+ $data['url'] = wp_get_attachment_url( $attachment_id, "full");
105
+ $data['width'] = !empty($imgData['width']) ? absint($imgData['width']) : 0;
106
+ $data['height'] = !empty($imgData['height']) ? absint($imgData['height']) : 0;
107
+ return $data;
108
+ }
109
+
110
+ function fix1_2DataMigration(){
111
+ global $KcSeoWPSchema;
112
+ $fix_1_2 = get_option($KcSeoWPSchema->options['1_2_fix']);
113
+ $installed_version = get_option($KcSeoWPSchema->options['installed_version']);
114
+ if(empty($fix_1_2) && empty($installed_version)){
115
+ global $wpdb;
116
+ $ids = array();
117
+ $posts = $wpdb->get_results( "
118
+ SELECT posts.ID FROM {$wpdb->prefix}posts as posts
119
+ WHERE posts.post_type = 'post'
120
+ AND EXISTS (
121
+ SELECT * FROM `{$wpdb->prefix}postmeta` as postmeta
122
+ WHERE postmeta.`meta_key` LIKE '_schema_%'
123
+ AND postmeta.`post_id`=posts.ID
124
+ )" );
125
+ if ( $posts ) {
126
+ foreach ( $posts as $id ) {
127
+ $ids[] = $id->ID;
128
+ }
129
+ }
130
+ $pages = $wpdb->get_results( "
131
+ SELECT posts.ID FROM {$wpdb->prefix}posts as posts
132
+ WHERE posts.post_type = 'page'
133
+ AND EXISTS (
134
+ SELECT * FROM `{$wpdb->prefix}postmeta` as postmeta
135
+ WHERE postmeta.`meta_key` LIKE '_schema_%'
136
+ AND postmeta.`post_id`=posts.ID
137
+ )" );
138
+ if ( $pages ) {
139
+ foreach ( $pages as $id ) {
140
+ $ids[] = $id->ID;
141
+ }
142
+ }
143
+
144
+
145
+ if ( ! empty( $ids ) ) {
146
+ $schemaModel = new KcSeoSchemaModel;
147
+ $schemaFields = $schemaModel->schemaTypes();
148
+ foreach ( $ids as $id ) {
149
+ foreach ( $schemaFields as $schemaID => $schema ) {
150
+ $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
151
+ $getRawMeta = get_post_meta( $id, $schemaMetaId, true );
152
+ $metaData = array();
153
+ if ( ! empty( $getRawMeta ) ) {
154
+ if ( $KcSeoWPSchema->isValidBase64( $getRawMeta ) ) {
155
+ $metaData = @unserialize( base64_decode( $getRawMeta ) );
156
+ } else {
157
+ $metaData = @unserialize( $getRawMeta );
158
+ }
159
+ }
160
+ $metaData = ( ! empty( $metaData ) ? $metaData : array() );
161
+ if ( ! empty( $metaData ) && is_array( $metaData ) ) {
162
+ $metaData['active'] = true;
163
+ update_post_meta( $id, $schemaMetaId, $metaData );
164
+ }
165
+ }
166
+ }
167
+ }
168
+
169
+ update_option($KcSeoWPSchema->options['1_2_fix'], true);
170
+ }
171
+ }
172
  }
173
 
174
  endif;
lib/classes/KcSeoInit.php CHANGED
@@ -1,157 +1,177 @@
1
  <?php
2
 
3
- if(!class_exists('KcSeoInit')):
4
-
5
- class KcSeoInit
6
- {
7
- function __construct()
8
- {
9
- add_action( 'init', array($this, 'kcSeoScript'));
10
- add_action( 'admin_menu' , array($this, 'kcSeo_Wp_Schema_menu'));
11
- add_action( 'plugins_loaded', array($this, 'kcSeo_pluginInit') );
12
- add_action( 'wp_ajax_kcSeoWpSchemaSettings', array($this, 'kcSeoWpSchemaSettings'));
13
- add_action( 'wp_ajax_newSocial', array($this, 'newSocial'));
14
- add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
15
-
16
- // for MU Site
17
- add_action( 'activated_plugin', array( $this, 'update_queue' ), 10, 2 );
18
- add_action( 'deactivated_plugin', array( $this, 'update_queue' ), 10, 2 );
19
-
20
- // register_activation_hook(KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME, array($this, 'uninstall'));
21
  // register_deactivation_hook(KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME, array($this, 'uninstall'));
22
 
23
- // Uninstall hook
24
-
25
- }
26
- function update_queue( $plugin, $network_wide = null ) {
27
- if ( !$network_wide )
28
- return;
29
- list( $action ) = explode( '_', current_filter(), 2 );
30
-
31
- $action = str_replace( 'activated', 'activate', $action );
32
- $queue = get_site_option( "network_{$action}_queue", array() );
33
-
34
- $queue[$plugin] = ( has_filter( $action . '_' . $plugin ) || has_filter( $action . '_plugin' ) );
35
- update_site_option( "network_{$action}_queue", $queue );
36
- }
37
- function admin_enqueue_scripts(){
38
- global $pagenow;
39
- // validate page
40
- $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : null;
41
- if( $pagenow != 'admin.php' || $page != 'wp-seo-schema' ) return;
42
- // scripts
43
- wp_enqueue_script(array(
44
- 'jquery',
45
- 'jquery-ui-datepicker',
46
- 'kcseo-select2-js',
47
- 'kcseo-tooltip-js',
48
- 'kcseo-admin-js',
49
- ));
50
-
51
- // styles
52
- wp_enqueue_style(array(
53
- 'kcseo-ui-css',
54
- 'kcseo-select2-css',
55
- 'kcseo-tooltip-css',
56
- 'kcseo-admin-css',
57
- ));
58
- }
59
-
60
- function kcSeoScript(){
61
- global $KcSeoWPSchema;
62
- // register team scripts and styles
63
- $scripts = array();
64
- $styles = array();
65
- if(is_admin()) {
66
-
67
-
68
- $scripts[] = array(
69
- 'handle' => 'kcseo-select2-js',
70
- 'src' => $KcSeoWPSchema->assetsUrl . 'js/select2.min.js',
71
- 'deps' => array('jquery'),
72
- 'footer' => true
73
- );
74
- $scripts[] = array(
75
- 'handle' => 'kcseo-tooltip-js',
76
- 'src' => $KcSeoWPSchema->assetsUrl . 'js/jquery.qtip.js',
77
- 'deps' => array('jquery'),
78
- 'footer' => true
79
- );
80
- $scripts[] = array(
81
- 'handle' => 'kcseo-admin-js',
82
- 'src' => $KcSeoWPSchema->assetsUrl . 'js/admin.js',
83
- 'deps' => array('jquery'),
84
- 'footer' => true
85
- );
86
- $styles['kcseo-ui-css'] = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/base/jquery-ui.css';
87
- $styles['kcseo-select2-css'] = $KcSeoWPSchema->assetsUrl .'css/select2.min.css';
88
- $styles['kcseo-tooltip-css'] = $KcSeoWPSchema->assetsUrl .'css/jquery.qtip.css';
89
- $styles['kcseo-admin-css'] = $KcSeoWPSchema->assetsUrl .'css/admin.css';
90
- }
91
- foreach( $scripts as $script )
92
- {
93
- wp_register_script( $script['handle'], $script['src'], $script['deps'], $KcSeoWPSchema->options['version'], $script['footer'] );
94
- }
95
- foreach( $styles as $k => $v )
96
- {
97
- wp_register_style( $k, $v, false, $KcSeoWPSchema->options['version'] );
98
- }
99
- }
100
-
101
- function newSocial(){
102
- $schemaModel = new KcSeoSchemaModel;
103
- $id = ($_REQUEST['id'] ? $_REQUEST['id'] +1 : 0 );
104
- $html = null;
105
- $html = "<div class='sfield'>";
106
- $html .= "<select name='social[$id][id]'>";
107
- foreach ($schemaModel->socialList() as $skey => $social) {
108
- $html .= "<option value='$skey'>$social</option>";
109
- }
110
- $html .= "</select>";
111
- $html .= "<input type='text' name='social[$id][link]'>";
112
- $html .= '<span class="dashicons dashicons-trash social-remove"></span>';
113
- $html .= "</div>";
114
-
115
-
116
- wp_send_json( array('data' => $html) );
117
- die();
118
- }
119
-
120
- function kcSeoWpSchemaSettings(){
121
- global $KcSeoWPSchema;
122
- $error = true;
123
- $msg = null;
124
- if($KcSeoWPSchema->verifyNonce()){
125
- unset($_REQUEST['action']);
126
- update_option( $KcSeoWPSchema->options['settings'], $_REQUEST );
127
- $error = false;
128
- $msg = __('Settings successfully updated',KCSEO_WP_SCHEMA_SLUG);
129
- }else{
130
- $msg = __('Security Error !!',KCSEO_WP_SCHEMA_SLUG);
131
- }
132
- $response = array(
133
- 'error'=> $error,
134
- 'msg' => $msg
135
- );
136
- wp_send_json( $response );
137
- die();
138
- }
139
-
140
- function wp_schema_page(){
141
- global $KcSeoWPSchema;
142
- $KcSeoWPSchema->render('settings');
143
- }
144
-
145
- function kcSeo_Wp_Schema_menu(){
146
- global $KcSeoWPSchema;
147
- add_menu_page( 'WP SEO Structured Data Schema', 'WP SEO Schema', 'manage_options', 'wp-seo-schema', array($this,'wp_schema_page'), $KcSeoWPSchema->assetsUrl . 'images/wp-seo-schema.png');
148
-
149
- }
150
-
151
-
152
- function kcSeo_pluginInit(){
153
- load_plugin_textdomain( KCSEO_WP_SCHEMA_SLUG, FALSE, KCSEO_WP_SCHEMA_LANGUAGE_PATH );
154
- }
155
-
156
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  endif;
1
  <?php
2
 
3
+ if ( ! class_exists( 'KcSeoInit' ) ):
4
+
5
+ class KcSeoInit {
6
+ function __construct() {
7
+ add_action( 'init', array( $this, 'kcSeoScript' ) );
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
+
14
+ // for MU Site
15
+ add_action( 'activated_plugin', array( $this, 'update_queue' ), 10, 2 );
16
+ add_action( 'deactivated_plugin', array( $this, 'update_queue' ), 10, 2 );
17
+
18
+ register_activation_hook( KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME, array( $this, 'activePlugin' ) );
 
 
19
  // register_deactivation_hook(KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME, array($this, 'uninstall'));
20
 
21
+ // Uninstall hook
22
+
23
+ }
24
+
25
+
26
+ function update_queue( $plugin, $network_wide = null ) {
27
+ if ( ! $network_wide ) {
28
+ return;
29
+ }
30
+ list( $action ) = explode( '_', current_filter(), 2 );
31
+
32
+ $action = str_replace( 'activated', 'activate', $action );
33
+ $queue = get_site_option( "network_{$action}_queue", array() );
34
+
35
+ $queue[ $plugin ] = ( has_filter( $action . '_' . $plugin ) || has_filter( $action . '_plugin' ) );
36
+ update_site_option( "network_{$action}_queue", $queue );
37
+ }
38
+
39
+ function admin_enqueue_scripts() {
40
+ global $pagenow;
41
+ // validate page
42
+ $page = isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : null;
43
+ if ( $pagenow != 'admin.php' || $page != 'wp-seo-schema' ) {
44
+ return;
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() {
66
+ global $KcSeoWPSchema;
67
+ // register team scripts and styles
68
+ $scripts = array();
69
+ $styles = array();
70
+ if ( is_admin() ) {
71
+
72
+
73
+ $scripts[] = array(
74
+ 'handle' => 'kcseo-select2-js',
75
+ 'src' => $KcSeoWPSchema->assetsUrl . 'js/select2.min.js',
76
+ 'deps' => array( 'jquery' ),
77
+ 'footer' => true
78
+ );
79
+ $scripts[] = array(
80
+ 'handle' => 'kcseo-tooltip-js',
81
+ 'src' => $KcSeoWPSchema->assetsUrl . 'js/jquery.qtip.js',
82
+ 'deps' => array( 'jquery' ),
83
+ 'footer' => true
84
+ );
85
+
86
+ $scripts[] = array(
87
+ 'handle' => 'kcseo-datepicker',
88
+ 'src' => $KcSeoWPSchema->assetsUrl . 'vendor/bootstrap-datepicker/bootstrap-datepicker.min.js',
89
+ 'deps' => array( 'jquery' ),
90
+ 'footer' => false
91
+ );
92
+ $scripts[] = array(
93
+ 'handle' => 'kcseo-admin-js',
94
+ 'src' => $KcSeoWPSchema->assetsUrl . 'js/admin.js',
95
+ 'deps' => array( 'jquery' ),
96
+ 'footer' => true
97
+ );
98
+ $styles['kcseo-datepicker'] = $KcSeoWPSchema->assetsUrl . 'vendor/bootstrap-datepicker/bootstrap-datepicker3.standalone.min.css';
99
+ $styles['kcseo-select2-css'] = $KcSeoWPSchema->assetsUrl . 'css/select2.min.css';
100
+ $styles['kcseo-tooltip-css'] = $KcSeoWPSchema->assetsUrl . 'css/jquery.qtip.css';
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'] );
109
+ }
110
+ }
111
+
112
+ function newSocial() {
113
+ $schemaModel = new KcSeoSchemaModel;
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
+ }
121
+ $html .= "</select>";
122
+ $html .= "<input type='text' name='social[$id][link]'>";
123
+ $html .= '<span class="dashicons dashicons-trash social-remove"></span>';
124
+ $html .= "</div>";
125
+
126
+
127
+ wp_send_json( array( 'data' => $html ) );
128
+ die();
129
+ }
130
+
131
+ function kcSeoWpSchemaSettings() {
132
+ global $KcSeoWPSchema;
133
+ $error = true;
134
+ $msg = null;
135
+ if ( $KcSeoWPSchema->verifyNonce() ) {
136
+ unset( $_REQUEST['action'] );
137
+ update_option( $KcSeoWPSchema->options['settings'], $_REQUEST );
138
+ $error = false;
139
+ $msg = __( 'Settings successfully updated', KCSEO_WP_SCHEMA_SLUG );
140
+ } else {
141
+ $msg = __( 'Security Error !!', KCSEO_WP_SCHEMA_SLUG );
142
+ }
143
+ $response = array(
144
+ 'error' => $error,
145
+ 'msg' => $msg
146
+ );
147
+ wp_send_json( $response );
148
+ die();
149
+ }
150
+
151
+ function wp_schema_page() {
152
+ global $KcSeoWPSchema;
153
+ $KcSeoWPSchema->render( 'settings' );
154
+ }
155
+
156
+ function kcSeo_Wp_Schema_menu() {
157
+ global $KcSeoWPSchema;
158
+ add_menu_page( 'WP SEO Structured Data Schema', 'WP SEO Schema', 'manage_options', 'wp-seo-schema',
159
+ array( $this, 'wp_schema_page' ), $KcSeoWPSchema->assetsUrl . 'images/wp-seo-schema.png' );
160
+
161
+ }
162
+
163
+
164
+ function kcSeo_pluginInit() {
165
+ load_plugin_textdomain( KCSEO_WP_SCHEMA_SLUG, false, KCSEO_WP_SCHEMA_LANGUAGE_PATH );
166
+ $this->activePlugin();
167
+ }
168
+
169
+
170
+ function activePlugin() {
171
+ global $KcSeoWPSchema;
172
+ $KcSeoWPSchema->fix1_2DataMigration();
173
+ update_option($KcSeoWPSchema->options['installed_version'],$KcSeoWPSchema->options['version']);
174
+ }
175
+
176
+ }
177
  endif;
lib/classes/KcSeoMetaData.php CHANGED
@@ -20,14 +20,14 @@ if(!class_exists('KcSeoMetaData')):
20
  // scripts
21
  wp_enqueue_script(array(
22
  'jquery',
23
- 'jquery-ui-datepicker',
24
  'kcseo-select2-js',
25
  'kcseo-admin-js',
26
  ));
27
 
28
  // styles
29
  wp_enqueue_style(array(
30
- 'kcseo-ui-css',
31
  'kcseo-select2-css',
32
  'kcseo-admin-css',
33
  ));
@@ -52,7 +52,6 @@ if(!class_exists('KcSeoMetaData')):
52
  }
53
 
54
  function meta_box_wp_schema($post){
55
-
56
  global $KcSeoWPSchema;
57
  wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' );
58
  $schemas = new KcSeoSchemaModel;
@@ -66,13 +65,19 @@ if(!class_exists('KcSeoMetaData')):
66
  $htmlMenu = null;
67
  $htmlCont = null;
68
  $htmlMenu .= "<ul class='rt-tab-nav'>";
69
- foreach($schemas->schemaTypes() as $schemaID => $schema){
 
70
  $tabId = $KcSeoWPSchema->KcSeoPrefix.$schemaID;
71
  $htmlMenu .= '<li><a href="#'.$tabId.'">'.$schema['title'].'</a></li>';
72
  $htmlCont .="<div id='{$tabId}' class='rt-tab-content'>";
 
 
73
  foreach($schema['fields'] as $fieldId => $data){
74
- $data['schemaId'] = $schemaID;
75
- $htmlCont .= $schemas->get_field($fieldId,$data, $post->ID);
 
 
 
76
  }
77
  $htmlCont .="</div>";
78
  }
@@ -86,7 +91,8 @@ if(!class_exists('KcSeoMetaData')):
86
  function save_KcSeo_schema_data($post_id,$post, $update){
87
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
88
  global $KcSeoWPSchema;
89
- if (!wp_verify_nonce(@$_REQUEST['_kcseo_nonce'], $KcSeoWPSchema->nonceText())) return $post_id;
 
90
 
91
  // Check permissions
92
  if (!empty($_GET['post_type'])) {
@@ -97,23 +103,22 @@ if(!class_exists('KcSeoMetaData')):
97
 
98
  $meta = array();
99
  $schemaModel = new KcSeoSchemaModel;
100
- foreach($schemaModel->schemaTypes() as $schemaID => $schema){
 
101
  $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix.$schemaID;
102
  $data = array();
103
  foreach($schema['fields'] as $fieldId => $fieldData){
104
-
105
  $value = (!empty($_REQUEST[$schemaMetaId][$fieldId]) ? $_REQUEST[$schemaMetaId][$fieldId] : null);
106
  $value = $KcSeoWPSchema->sanitize($fieldData, $value);
107
- if($value){
108
- $data[$fieldId] = $value;
109
- }
110
  }
111
- $meta[$schemaMetaId] = base64_encode(serialize($data));
112
- }
113
-
114
- foreach($meta as $mKey => $mValue){
115
- update_post_meta($post_id, $mKey, $mValue);
116
  }
 
 
 
 
 
117
  }
118
 
119
  }
20
  // scripts
21
  wp_enqueue_script(array(
22
  'jquery',
23
+ 'kcseo-datepicker',
24
  'kcseo-select2-js',
25
  'kcseo-admin-js',
26
  ));
27
 
28
  // styles
29
  wp_enqueue_style(array(
30
+ 'kcseo-datepicker',
31
  'kcseo-select2-css',
32
  'kcseo-admin-css',
33
  ));
52
  }
53
 
54
  function meta_box_wp_schema($post){
 
55
  global $KcSeoWPSchema;
56
  wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' );
57
  $schemas = new KcSeoSchemaModel;
65
  $htmlMenu = null;
66
  $htmlCont = null;
67
  $htmlMenu .= "<ul class='rt-tab-nav'>";
68
+ $schemaFields = $schemas->schemaTypes();
69
+ foreach($schemaFields as $schemaID => $schema){
70
  $tabId = $KcSeoWPSchema->KcSeoPrefix.$schemaID;
71
  $htmlMenu .= '<li><a href="#'.$tabId.'">'.$schema['title'].'</a></li>';
72
  $htmlCont .="<div id='{$tabId}' class='rt-tab-content'>";
73
+ $metaData = get_post_meta($post->ID, $tabId, true );
74
+ $metaData = (is_array($metaData) ? $metaData : array());
75
  foreach($schema['fields'] as $fieldId => $data){
76
+ $data['fieldId'] = $fieldId;
77
+ $data['id'] = $tabId."_".$fieldId;
78
+ $data['name']=$tabId."[{$fieldId}]";
79
+ $data['value'] = (!empty($metaData[$fieldId]) ? $metaData[$fieldId] : null);
80
+ $htmlCont .= $schemas->get_field($data);
81
  }
82
  $htmlCont .="</div>";
83
  }
91
  function save_KcSeo_schema_data($post_id,$post, $update){
92
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
93
  global $KcSeoWPSchema;
94
+ $nonce = !empty($_REQUEST['_kcseo_nonce']) ? $_REQUEST['_kcseo_nonce'] : null;
95
+ if (!wp_verify_nonce($nonce , $KcSeoWPSchema->nonceText())) return $post_id;
96
 
97
  // Check permissions
98
  if (!empty($_GET['post_type'])) {
103
 
104
  $meta = array();
105
  $schemaModel = new KcSeoSchemaModel;
106
+ $schemaFields = $schemaModel->schemaTypes();
107
+ foreach($schemaFields as $schemaID => $schema){
108
  $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix.$schemaID;
109
  $data = array();
110
  foreach($schema['fields'] as $fieldId => $fieldData){
 
111
  $value = (!empty($_REQUEST[$schemaMetaId][$fieldId]) ? $_REQUEST[$schemaMetaId][$fieldId] : null);
112
  $value = $KcSeoWPSchema->sanitize($fieldData, $value);
113
+ $data[$fieldId] = $value;
 
 
114
  }
115
+ $meta[$schemaMetaId] = $data;
 
 
 
 
116
  }
117
+ if(count($meta) > 0){
118
+ foreach($meta as $mKey => $mValue){
119
+ update_post_meta($post_id, $mKey, $mValue);
120
+ }
121
+ }
122
  }
123
 
124
  }
lib/classes/KcSeoOutput.php CHANGED
@@ -18,7 +18,7 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
18
  $metaData["@context"] = "http://schema.org/";
19
  $metaData["@type"] = "WebSite";
20
 
21
- if ( ! empty( $settings['homeonly'] ) ) {
22
  $author_url = ( ! empty( $settings['siteurl'] ) ? $settings['siteurl'] : get_home_url() );
23
  $to_remove = array( 'http://', 'https://', 'www.' );
24
  foreach ( $to_remove as $item ) {
@@ -42,6 +42,16 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
42
  $webMeta["@context"] = "http://schema.org";
43
  $siteType = ! empty( $settings['site_type'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_type'] ) : null;
44
  $webMeta["@type"] = $siteType;
 
 
 
 
 
 
 
 
 
 
45
 
46
  if ( ! empty( $settings['additionalType'] ) ) {
47
  $aType = explode( "\r\n", $settings['additionalType'] );
@@ -63,7 +73,12 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
63
  $webMeta["birthDate"] = ! empty( $settings['person']['birthDate'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['birthDate'] ) : null;
64
  } else {
65
  $webMeta["name"] = ! empty( $settings['type_name'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['type_name'] ) : null;
66
- $webMeta["logo"] = ! empty( $settings['logo_url'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['logo_url'], 'url' ) : null;
 
 
 
 
 
67
  }
68
  if ( $siteType != "Organization" && $siteType != "Person" ) {
69
  $webMeta["description"] = ! empty( $settings['business_info']['description'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['business_info']['description'], 'textarea' ) : null;
@@ -101,6 +116,7 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
101
  "@type" => "ContactPoint",
102
  "telephone" => ! empty( $settings['contact']['telephone'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['telephone'] ) : '',
103
  "contactType" => ! empty( $settings['contact']['contactType'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['contactType'] ) : '',
 
104
  "contactOption" => ! empty( $settings['contact']['contactOption'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['contactOption'] ) : '',
105
  "areaServed" => ! empty( $settings['area_served'] ) ? implode( ',',
106
  ! empty( $settings['area_served'] ) ? $settings['area_served'] : array() ) : '',
@@ -120,25 +136,11 @@ if ( ! class_exists( 'KcSeoOutput' ) ):
120
  }
121
 
122
  if ( is_single() || is_page() ) {
123
-
124
  foreach ( $schemaModel->schemaTypes() as $schemaID => $schema ) {
125
  $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
126
- $getRawMeta = get_post_meta( $post->ID, $schemaMetaId, true );
127
- $metaData = array();
128
- if ( ! empty( $getRawMeta ) ) {
129
- if ( $KcSeoWPSchema->isValidBase64( $getRawMeta ) ) {
130
- $metaData = unserialize( base64_decode( $getRawMeta ) );
131
- } else {
132
- $metaData = unserialize( $getRawMeta );
133
- }
134
- }
135
- $metaData = ( ! empty( $metaData ) ? $metaData : array() );
136
- $firstItem = null;
137
- if ( ! empty( $metaData ) && is_array( $metaData ) ) {
138
- $firstItem = current( $metaData );
139
- }
140
-
141
- if ( ! empty( $metaData ) && is_array( $metaData ) && $firstItem ) {
142
  $html .= $schemaModel->schemaOutput( $schemaID, $metaData );
143
  }
144
  }
18
  $metaData["@context"] = "http://schema.org/";
19
  $metaData["@type"] = "WebSite";
20
 
21
+ if ( ! empty( $settings['homeonly'] ) && $settings['homeonly']) {
22
  $author_url = ( ! empty( $settings['siteurl'] ) ? $settings['siteurl'] : get_home_url() );
23
  $to_remove = array( 'http://', 'https://', 'www.' );
24
  foreach ( $to_remove as $item ) {
42
  $webMeta["@context"] = "http://schema.org";
43
  $siteType = ! empty( $settings['site_type'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_type'] ) : null;
44
  $webMeta["@type"] = $siteType;
45
+ if($siteType != "Organization"){
46
+ if(! empty( $settings['site_image'] ) && $imgID = absint($settings['site_image'])){
47
+ $image_url = wp_get_attachment_url( $imgID, 'full' );
48
+ $webMeta["image"] = $KcSeoWPSchema->sanitizeOutPut( $image_url, 'url' );
49
+ }else{
50
+ $webMeta["image"] = null;
51
+ }
52
+ $webMeta["priceRange"] = ! empty( $settings['site_price_range'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_price_range'] ) : null;
53
+ $webMeta["telephone"] = ! empty( $settings['site_telephone'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['site_telephone'] ) : null;
54
+ }
55
 
56
  if ( ! empty( $settings['additionalType'] ) ) {
57
  $aType = explode( "\r\n", $settings['additionalType'] );
73
  $webMeta["birthDate"] = ! empty( $settings['person']['birthDate'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['person']['birthDate'] ) : null;
74
  } else {
75
  $webMeta["name"] = ! empty( $settings['type_name'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['type_name'] ) : null;
76
+ if(! empty( $settings['organization_logo'] ) && $imgID = absint($settings['organization_logo'])){
77
+ $image_url = wp_get_attachment_url( $imgID, 'full' );
78
+ $webMeta["logo"] = $KcSeoWPSchema->sanitizeOutPut( $image_url, 'url' );
79
+ }else{
80
+ $webMeta["logo"] = null;
81
+ }
82
  }
83
  if ( $siteType != "Organization" && $siteType != "Person" ) {
84
  $webMeta["description"] = ! empty( $settings['business_info']['description'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['business_info']['description'], 'textarea' ) : null;
116
  "@type" => "ContactPoint",
117
  "telephone" => ! empty( $settings['contact']['telephone'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['telephone'] ) : '',
118
  "contactType" => ! empty( $settings['contact']['contactType'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['contactType'] ) : '',
119
+ "email" => ! empty( $settings['contact']['email'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['email'] ) : '',
120
  "contactOption" => ! empty( $settings['contact']['contactOption'] ) ? $KcSeoWPSchema->sanitizeOutPut( $settings['contact']['contactOption'] ) : '',
121
  "areaServed" => ! empty( $settings['area_served'] ) ? implode( ',',
122
  ! empty( $settings['area_served'] ) ? $settings['area_served'] : array() ) : '',
136
  }
137
 
138
  if ( is_single() || is_page() ) {
 
139
  foreach ( $schemaModel->schemaTypes() as $schemaID => $schema ) {
140
  $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
141
+ $metaData = get_post_meta($post->ID, $schemaMetaId, true );
142
+ $metaData = (is_array($metaData) ? $metaData : array());
143
+ if ( ! empty( $metaData ) && !empty( $metaData['active'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  $html .= $schemaModel->schemaOutput( $schemaID, $metaData );
145
  }
146
  }
lib/init.php CHANGED
@@ -10,7 +10,9 @@ if(!class_exists('KcSeoWPSchema')){
10
  $this->KcSeoPrefix = "_schema_";
11
  $this->options = array(
12
  'settings' => 'kcseo_wp_schema',
13
- 'version' => '1.2'
 
 
14
  );
15
 
16
  $this->incPath = dirname(__FILE__);
@@ -24,9 +26,6 @@ if(!class_exists('KcSeoWPSchema')){
24
  $this->KcSeoLoadModel($this->modelPath);
25
  $this->KcSeoLoadClass($this->classesPath);
26
 
27
- //register_activation_hook(KCSEO_WP_SCHEMA_PATH, array($this, 'activate'));
28
- //register_deactivation_hook(KCSEO_WP_SCHEMA_PATH, array($this, 'deactivate'));
29
-
30
  }
31
 
32
  function KcSeoLoadClass($dir) {
10
  $this->KcSeoPrefix = "_schema_";
11
  $this->options = array(
12
  'settings' => 'kcseo_wp_schema',
13
+ 'installed_version' => 'kcseo_wp_installed_version',
14
+ 'version' => '1.3',
15
+ '1_2_fix' => "kcseo_wp_1_2_data_fix"
16
  );
17
 
18
  $this->incPath = dirname(__FILE__);
26
  $this->KcSeoLoadModel($this->modelPath);
27
  $this->KcSeoLoadClass($this->classesPath);
28
 
 
 
 
29
  }
30
 
31
  function KcSeoLoadClass($dir) {
lib/models/KcSeoSchemaModel.php CHANGED
@@ -1,1542 +1,1717 @@
1
  <?php
2
 
3
- if(!class_exists('KcSeoSchemaModel')):
4
- class KcSeoSchemaModel
5
- {
6
- function __construct()
7
- {
8
 
9
- }
10
 
11
- function schemaOutput($schemaID, $metaData){
12
- $html = null;
13
 
14
- if($schemaID){
15
- global $KcSeoWPSchema;
16
- switch($schemaID){
17
- case "article":
18
- $article = array();
19
- $article["@context"] = "http://schema.org";
20
- $article["@type"] = "Article";
21
- if(!empty($metaData['headline'])){
22
- $article["headline"] = $KcSeoWPSchema->sanitizeOutPut($metaData['headline']);
23
- }if(!empty($metaData['mainEntityOfPage'])){
24
- $article["mainEntityOfPage"] = array(
25
- "@type" => "WebPage",
26
- "@id" => $KcSeoWPSchema->sanitizeOutPut($metaData["mainEntityOfPage"])
27
- );
28
- }if(!empty($metaData['author'])){
29
- $article["author"] = $KcSeoWPSchema->sanitizeOutPut($metaData['author']);
30
- }if(!empty($metaData['publisher'])){
31
- if(!empty($metaData['publisherImage'])){
32
- $img = $this->imgInfo($metaData['publisherImage']);
33
- $plA = array(
34
- "@type" => "ImageObject",
35
- "url" => $KcSeoWPSchema->sanitizeOutPut($metaData['publisherImage'], 'url'),
36
- "height" => intval($img['height']),
37
- "width" => intval($img['width']),
38
- );
39
- }else{
40
- $plA = array();
41
- }
42
- $article["publisher"] = array(
43
- "@type" => "Organization",
44
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['publisher']),
45
- "logo" => $plA
46
- );
47
- }if(!empty($metaData['alternativeHeadline'])){
48
- $article["alternativeHeadline"] = $KcSeoWPSchema->sanitizeOutPut($metaData['alternativeHeadline']);
49
- }if(!empty($metaData['image'])){
50
- $img = $this->imgInfo($metaData['image']);
51
- $article["image"] = array(
52
- "@type" => "ImageObject",
53
- "url" => $KcSeoWPSchema->sanitizeOutPut($metaData['image']),
54
- "height" => $img['height'],
55
- "width" =>$img['width']
56
- );
57
- }if(!empty($metaData['datePublished'])){
58
- $article["datePublished"] = $KcSeoWPSchema->sanitizeOutPut($metaData['datePublished']);
59
- }if(!empty($metaData['dateModified'])){
60
- $article["dateModified"] = $KcSeoWPSchema->sanitizeOutPut($metaData['dateModified']);
61
- }if(!empty($metaData['description'])){
62
- $article["description"] = $KcSeoWPSchema->sanitizeOutPut($metaData['description'], 'textarea');
63
- }if(!empty($metaData['articleBody'])){
64
- $article["articleBody"] = $KcSeoWPSchema->sanitizeOutPut($metaData['articleBody'], 'textarea');
65
- }
66
- $html .= $this->get_jsonEncode($article);
67
- break;
 
 
 
 
 
 
 
 
 
68
 
69
- case "news_article":
70
- $newsArticle = array();
71
- $newsArticle["@context"] = "http://schema.org";
72
- $newsArticle["@type"] = "NewsArticle";
73
- if(!empty($metaData['headline'])){
74
- $newsArticle["headline"] = $KcSeoWPSchema->sanitizeOutPut($metaData['headline']);
75
- }if(!empty($metaData['mainEntityOfPage'])){
76
- $newsArticle["mainEntityOfPage"] = array(
77
- "@type" => "WebPage",
78
- "@id" => $KcSeoWPSchema->sanitizeOutPut($metaData["mainEntityOfPage"])
79
- );
80
- }if(!empty($metaData['author'])){
81
- $newsArticle["author"] = $KcSeoWPSchema->sanitizeOutPut($metaData['author']);
82
- }if(!empty($metaData['image'])){
83
- $img = $this->imgInfo($metaData['image']);
84
- $newsArticle["image"] = array(
85
- "@type" => "ImageObject",
86
- "url" => $KcSeoWPSchema->sanitizeOutPut($metaData['image'], 'url'),
87
- "height" => $img['height'],
88
- "width" =>$img['width']
89
- );
90
- }if(!empty($metaData['datePublished'])){
91
- $newsArticle["datePublished"] = $KcSeoWPSchema->sanitizeOutPut($metaData['datePublished']);
92
- }if(!empty($metaData['dateModified'])){
93
- $newsArticle["dateModified"] = $KcSeoWPSchema->sanitizeOutPut($metaData['dateModified']);
94
- }if(!empty($metaData['publisher'])){
95
- if(!empty($metaData['publisherImage'])){
96
- $img = $this->imgInfo($metaData['publisherImage']);
97
- $plA = array(
98
- "@type" => "ImageObject",
99
- "url" => $KcSeoWPSchema->sanitizeOutPut($metaData['publisherImage'], 'url'),
100
- "height" => intval($img['height']),
101
- "width" => intval($img['width']),
102
- );
103
- }else{
104
- $plA = array();
105
- }
106
- $newsArticle["publisher"] = array(
107
- "@type" => "Organization",
108
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['publisher']),
109
- "logo" => $plA
110
- );
111
- }if(!empty($metaData['description'])){
112
- $newsArticle["description"] = $KcSeoWPSchema->sanitizeOutPut($metaData['description'], 'textarea');
113
- }if(!empty($metaData['articleBody'])){
114
- $newsArticle["articleBody"] = $KcSeoWPSchema->sanitizeOutPut($metaData['articleBody'], 'textarea');
115
- }
116
- $html .= $this->get_jsonEncode($newsArticle);
117
- break;
 
 
 
 
 
 
 
 
118
 
119
- case "blog_posting":
120
- $blogPosting = array();
121
- $blogPosting["@context"] = "http://schema.org";
122
- $blogPosting["@type"] = "BlogPosting";
123
- if(!empty($metaData['headline'])){
124
- $blogPosting["headline"] = $KcSeoWPSchema->sanitizeOutPut($metaData['headline']);
125
- }if(!empty($metaData['mainEntityOfPage'])){
126
- $blogPosting["mainEntityOfPage"] = array(
127
- "@type" => "WebPage",
128
- "@id" => $KcSeoWPSchema->sanitizeOutPut($metaData["mainEntityOfPage"])
129
- );
130
- }if(!empty($metaData['author'])){
131
- $blogPosting["author"] = $KcSeoWPSchema->sanitizeOutPut($metaData['author']);
132
- }if(!empty($metaData['image'])){
133
- $img = $this->imgInfo($metaData['image']);
134
- $blogPosting["image"] = array(
135
- "@type" => "ImageObject",
136
- "url" => $KcSeoWPSchema->sanitizeOutPut($metaData['image'], 'url'),
137
- "height" => $img['height'],
138
- "width" =>$img['width']
139
- );
140
- }if(!empty($metaData['datePublished'])){
141
- $blogPosting["datePublished"] = $KcSeoWPSchema->sanitizeOutPut($metaData['datePublished']);
142
- }if(!empty($metaData['dateModified'])){
143
- $blogPosting["dateModified"] = $KcSeoWPSchema->sanitizeOutPut($metaData['dateModified']);
144
- }if(!empty($metaData['publisher'])){
145
- if($metaData['publisherImage']){
146
- $img = $this->imgInfo($metaData['publisherImage']);
147
- $plA = array(
148
- "@type" => "ImageObject",
149
- "url" => $KcSeoWPSchema->sanitizeOutPut($metaData['publisherImage']),
150
- "height" => intval($img['height']),
151
- "width" => intval($img['width']),
152
- );
153
- }else{
154
- $plA = array();
155
- }
156
- $blogPosting["publisher"] = array(
157
- "@type" => "Organization",
158
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['publisher']),
159
- "logo" => $plA
160
- );
161
- }if(!empty($metaData['description'])){
162
- $blogPosting["description"] = $KcSeoWPSchema->sanitizeOutPut($metaData['description'], 'textarea');
163
- }if(!empty($metaData['articleBody'])){
164
- $blogPosting["articleBody"] = $KcSeoWPSchema->sanitizeOutPut($metaData['articleBody'], 'textarea');
165
- }
166
- $html .= $this->get_jsonEncode($blogPosting);
167
- break;
 
 
 
 
 
 
 
 
168
 
169
- case 'event':
170
- $event = array();
171
- $event["@context"] = "http://schema.org";
172
- $event["@type"] = "Event";
173
- if(!empty($metaData['name'])){
174
- $event["name"] = $KcSeoWPSchema->sanitizeOutPut($metaData['name']);
175
- }if(!empty($metaData['startDate'])){
176
- $event["startDate"] = $KcSeoWPSchema->sanitizeOutPut($metaData['startDate']);
177
- }if(!empty($metaData['locationName'])){
178
- $event["location"] = array(
179
- "@type" => "Place",
180
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['locationName']),
181
- "address" => $KcSeoWPSchema->sanitizeOutPut($metaData['locationAddress'])
182
- );
183
- }if(!empty($metaData['price'])){
184
- $event["offers"] = array(
185
- "@type" => "Offer",
186
- "price" => $KcSeoWPSchema->sanitizeOutPut($metaData['price']),
187
- "priceCurrency" => !empty($metaData['priceCurrency']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['priceCurrency']) : null,
188
- "url" => !empty($metaData['url']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['url'], 'url') : null
189
- );
190
- }
191
- $html .= $this->get_jsonEncode($event);
192
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
- case 'product':
195
- $product = array();
196
- $product["@context"] = "http://schema.org";
197
- $product["@type"] = "Product";
198
- if (!empty($metaData['name'])) {
199
- $product["name"] = $KcSeoWPSchema->sanitizeOutPut($metaData['name']);
200
- }
201
- if (!empty($metaData['image'])) {
202
- $product["image"] = $KcSeoWPSchema->sanitizeOutPut($metaData['image']);
203
- }
204
- if (!empty($metaData['description'])) {
205
- $product["description"] = $KcSeoWPSchema->sanitizeOutPut($metaData['description']);
206
- }
207
- if (!empty($metaData['brand'])) {
208
- $product["brand"] = array(
209
- "@type" => "Thing",
210
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['brand'])
211
- );
212
- }
213
- if (!empty($metaData['ratingValue'])) {
214
- $product["aggregateRating"] = array(
215
- "@type" => "AggregateRating",
216
- "ratingValue" => !empty($metaData['ratingValue']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['ratingValue']) : null,
217
- "reviewCount" => !empty($metaData['reviewCount']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['reviewCount']) : null
218
- );
219
- }
220
- if (!empty($metaData['price'])) {
221
- $product["offers"] = array(
222
- "@type" => "Offer",
223
- "price" => $KcSeoWPSchema->sanitizeOutPut($metaData['price']),
224
- "priceCurrency" => !empty($metaData['priceCurrency']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['priceCurrency']) : null,
225
- "itemCondition" => !empty($metaData['itemCondition']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['itemCondition']) : null,
226
- "availability" => !empty($metaData['availability']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['availability']) : null,
227
- "url" => !empty($metaData['url']) ? $KcSeoWPSchema->sanitizeOutPut($metaData['url']) : null
228
- );
229
- }
230
- $html .= $this->get_jsonEncode($product);
231
- break;
232
 
233
- case 'video':
234
- $video = array();
235
- $video["@context"] = "http://schema.org";
236
- $video["@type"] = "VideoObject";
237
- if(!empty($metaData['name'])){
238
- $video["name"] = $KcSeoWPSchema->sanitizeOutPut($metaData['name']);
239
- }if(!empty($metaData['description'])){
240
- $video["description"] = $KcSeoWPSchema->sanitizeOutPut($metaData['description'], 'textarea');
241
- }if(!empty($metaData['description'])){
242
- $video["description"] = $KcSeoWPSchema->sanitizeOutPut($metaData['description']);
243
- }if(!empty($metaData['thumbnailUrl'])){
244
- $video["thumbnailUrl"] = $KcSeoWPSchema->sanitizeOutPut($metaData['thumbnailUrl'], 'url');
245
- }if(!empty($metaData['uploadDate'])){
246
- $video["uploadDate"] = $KcSeoWPSchema->sanitizeOutPut($metaData['uploadDate']);
247
- }if(!empty($metaData['duration'])){
248
- $video["duration"] = $KcSeoWPSchema->sanitizeOutPut($metaData['duration']);
249
- }if(!empty($metaData['contentUrl'])){
250
- $video["contentUrl"] = $KcSeoWPSchema->sanitizeOutPut($metaData['contentUrl'], 'url');
251
- }if(!empty($metaData['interactionCount'])){
252
- $video["interactionCount"] = $KcSeoWPSchema->sanitizeOutPut($metaData['interactionCount']);
253
- }if(!empty($metaData['expires'])){
254
- $video["expires"] = $KcSeoWPSchema->sanitizeOutPut($metaData['expires']);
255
- }
256
- $html .= $this->get_jsonEncode($video);
257
- break;
 
 
 
 
 
 
 
 
258
 
259
- case 'service':
260
- $service = array();
261
- $service["@context"] = "http://schema.org";
262
- $service["@type"] = "Service";
263
- if(!empty($metaData['name'])){
264
- $service["name"] = $KcSeoWPSchema->sanitizeOutPut($metaData['name']);
265
- }if(!empty($metaData['serviceType'])){
266
- $service["serviceType"] = $KcSeoWPSchema->sanitizeOutPut($metaData['serviceType']);
267
- }if(!empty($metaData['locationName'])){
268
- $service["location"] = array(
269
- "@type" => "Place",
270
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['locationName']),
271
- "address" => $KcSeoWPSchema->sanitizeOutPut($metaData['locationAddress'])
272
- );
273
- }if(!empty($metaData['award'])){
274
- $service["award"] = $KcSeoWPSchema->sanitizeOutPut($metaData['award']);
275
- }if(!empty($metaData['category'])){
276
- $service["category"] = $KcSeoWPSchema->sanitizeOutPut($metaData['category']);
277
- }if(!empty($metaData['providerMobility'])){
278
- $service["providerMobility"] = $KcSeoWPSchema->sanitizeOutPut($metaData['providerMobility']);
279
- }if(!empty($metaData['additionalType'])){
280
- $service["additionalType"] = $KcSeoWPSchema->sanitizeOutPut($metaData['additionalType']);
281
- }if(!empty($metaData['alternateName'])){
282
- $service["alternateName"] = $KcSeoWPSchema->sanitizeOutPut($metaData['alternateName']);
283
- }if(!empty($metaData['image'])){
284
- $service["image"] = $KcSeoWPSchema->sanitizeOutPut($metaData['image']);
285
- }if(!empty($metaData['mainEntityOfPage'])){
286
- $service["mainEntityOfPage"] = $KcSeoWPSchema->sanitizeOutPut($metaData['mainEntityOfPage']);
287
- }if(!empty($metaData['sameAs'])){
288
- $service["sameAs"] = $KcSeoWPSchema->sanitizeOutPut($metaData['sameAs']);
289
- }if(!empty($metaData['url'])){
290
- $service["url"] = $KcSeoWPSchema->sanitizeOutPut($metaData['url'], 'url');
291
- }
292
- $html .= $this->get_jsonEncode($service);
293
- break;
 
 
 
 
 
 
 
 
 
 
 
 
294
 
295
- case 'review':
296
- $review = array();
297
- $review["@context"] = "http://schema.org";
298
- $review["@type"] = "Review";
299
- if(!empty($metaData['itemName'])){
300
- $review["itemReviewed"] = array(
301
- "@type" => "Thing",
302
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['itemName'])
303
- );
304
- }if(!empty($metaData['ratingValue'])){
305
- $review["reviewRating"] = array(
306
- "@type" => "Rating",
307
- "ratingValue" => $KcSeoWPSchema->sanitizeOutPut($metaData['ratingValue']),
308
- "bestRating" => $KcSeoWPSchema->sanitizeOutPut($metaData['bestRating']),
309
- "worstRating" => $KcSeoWPSchema->sanitizeOutPut($metaData['worstRating'])
310
- );
311
- }if(!empty($metaData['name'])){
312
- $review["name"] = $KcSeoWPSchema->sanitizeOutPut($metaData['name']);
313
- }if(!empty($metaData['author'])){
314
- $review["author"] = array(
315
- "@type" => "Person",
316
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['author'])
317
- );
318
- }if(!empty($metaData['reviewBody'])){
319
- $review["reviewBody"] = $KcSeoWPSchema->sanitizeOutPut($metaData['reviewBody']);
320
- }if(!empty($metaData['datePublished'])){
321
- $review["datePublished"] = $KcSeoWPSchema->sanitizeOutPut($metaData['datePublished']);
322
- }if(!empty($metaData['publisher'])){
323
- $review["publisher"] = array(
324
- "@type" => "Organization",
325
- "name" => $KcSeoWPSchema->sanitizeOutPut($metaData['publisher'])
326
- );
327
- }
328
- $html .= $this->get_jsonEncode($review);
329
- break;
330
- case 'aggregate_rating':
331
- $aRating = array();
332
- $aRating["@context"] = "http://schema.org";
333
- $aRating["@type"] = !empty($metaData['schema_type']) ? $metaData['schema_type'] : "LocalBusiness";
334
- if(!empty($metaData['name'])){
335
- $aRating["name"] = $KcSeoWPSchema->sanitizeOutPut($metaData['name']);
336
- }if(!empty($metaData['description'])){
337
- $aRating["description"] = $KcSeoWPSchema->sanitizeOutPut($metaData['description'], 'textarea');
338
- }if(!empty($metaData['ratingValue'])){
339
- $rValue = array();
340
- $rValue["@type"] = "AggregateRating";
341
- $rValue["ratingValue"] = $KcSeoWPSchema->sanitizeOutPut($metaData['ratingValue']);
342
- if(!empty($metaData['bestRating'])){
343
- $rValue["bestRating"] = $KcSeoWPSchema->sanitizeOutPut($metaData['bestRating']);
344
- }if(!empty($metaData['worstRating'])){
345
- $rValue["worstRating"] = $KcSeoWPSchema->sanitizeOutPut($metaData['worstRating']);
346
- }if(!empty($metaData['ratingCount'])){
347
- $rValue["ratingCount"] = $KcSeoWPSchema->sanitizeOutPut($metaData['ratingCount']);
348
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
349
 
350
- $aRating["aggregateRating"] = $rValue;
351
- }
352
- $html .= $this->get_jsonEncode($aRating);
353
- break;
354
 
355
- default:
356
- break;
357
- }
 
 
 
 
 
 
 
 
 
 
358
 
359
- }
360
- return $html;
361
- }
 
362
 
363
- function get_field($fieldId,$data,$pid = null){
364
- $html = null;
365
- if($fieldId){
366
- global $KcSeoWPSchema;
367
- $schemaId = $KcSeoWPSchema->KcSeoPrefix.$data['schemaId'];
368
- $id = $KcSeoWPSchema->KcSeoPrefix.$data['schemaId']."_".$fieldId;
369
- $name = $schemaId."[{$fieldId}]";
370
- $getRawMeta = get_post_meta($pid, $schemaId, true );
371
- $metaData = array();
372
- if(!empty($getRawMeta)) {
373
- if ($KcSeoWPSchema->isValidBase64($getRawMeta)) {
374
- $metaData = unserialize(base64_decode($getRawMeta));
375
- } else {
376
- $metaData = unserialize($getRawMeta);
377
- }
378
- }
379
- $value = (!empty($metaData[$fieldId]) ? esc_attr(stripslashes($metaData[$fieldId])) : null);
380
 
 
381
 
382
- $class = isset($data['class']) ? ($data['class'] ? $data['class'] : null) : null;
383
- $require = (isset($data['required']) ? ($data['required'] ? "<span class='required'>*</span>" : null ) : null);
384
- $title = (isset($data['title']) ? ($data['title'] ? $data['title'] : null ) : null);
385
- $desc = (isset($data['desc']) ? ($data['desc'] ? $data['desc'] : null ) : null);
386
 
387
- $html .="<div class='field-container' id='".$id.'-container'."'>";
388
- $html .="<label class='field-label' for='{$id}'>{$title}{$require}</label>";
389
- $html .="<div class='field-content' id='".$id.'-content'."'>";
390
- switch($data['type']){
391
- case 'text':
392
- $html .= "<input type='text' id='{$id}' class='{$class}' name='{$name}' value='{$value}' />";
393
- break;
394
 
395
- case 'number':
396
- if($fieldId == 'price'){
397
- $html .= "<input type='number' step='any' id='{$id}' class='{$class}' name='{$name}' value='{$value}' />";
398
- }else{
399
- $html .= "<input type='number' id='{$id}' class='{$class}' name='{$name}' value='{$value}' />";
400
- }
401
- break;
402
- case 'textarea':
403
- $html .= "<textarea id='{$id}' class='{$class}' name='{$name}' >{$value}</textarea>";
404
- break;
405
- case 'select':
406
- $html .="<select name='{$name}' class='select2 {$class}' id='{$id}'>";
407
- if(!empty($data['empty'])){
408
- $html .="<option value=''>{$data['empty']}</option>";
409
- }
410
- if(!empty($data['options']) && is_array($data['options'])) {
411
- if ($this->isAssoc($data['options'])) {
412
- foreach ($data['options'] as $optKey => $optValue) {
413
- $slt = ($optKey == $value ? "selected" : null);
414
- $html .= "<option value='{$optKey}' {$slt}>{$optValue}</option>";
415
- }
416
- } else {
417
- foreach ($data['options'] as $optValue) {
418
- $slt = ($optValue == $value ? "selected" : null);
419
- $html .= "<option value='{$optValue}' {$slt}>{$optValue}</option>";
420
- }
421
- }
422
- }
423
- $html .="</select>";
424
- break;
425
- default:
426
- $html .= "<input id='{$id}' type='{$data['type']}' value='{$value}' name='$name' />";
427
- break;
428
 
429
- }
430
- $html .= "<p class='description'>{$desc}</p>";
431
- $html .="</div>";
432
- $html .="</div>";
433
- }
434
 
435
- return $html;
436
- }
 
 
 
 
 
 
 
 
437
 
438
- public function schemaTypes(){
439
- return array(
440
- 'article' => array(
441
- 'title' => "Article",
442
- 'fields' => array(
443
- 'headline' => array(
444
- 'title' => 'Headline',
445
- 'type' => 'text',
446
- 'desc' => 'Article title',
447
- 'required' => true
448
- ),
449
- 'mainEntityOfPage'=> array(
450
- 'title' => 'Page URL',
451
- 'type' => 'url',
452
- 'desc' => 'The canonical URL of the article page',
453
- 'required' => true
454
- ),
455
- 'author' => array(
456
- 'title' => 'Author Name',
457
- 'type' => 'text',
458
- 'desc' => 'Author display name',
459
- 'required' => true
460
- ),
461
- 'image' => array(
462
- 'title' => 'Image URL',
463
- 'type' => 'url',
464
- 'desc' => 'Image url',
465
- 'required' => true
466
- ),
467
- 'datePublished' => array(
468
- 'title' => 'Published date',
469
- 'type' => 'text',
470
- 'class' => 'kcseo-date',
471
- 'required' => true,
472
- 'desc' => 'Like this: 2015-12-25'
473
- ),
474
- 'dateModified' => array(
475
- 'title' => 'Modified date',
476
- 'type' => 'text',
477
- 'class' => 'kcseo-date',
478
- 'required' => true,
479
- 'desc' => 'Like this: 2015-12-25'
480
- ),
481
- 'publisher' => array(
482
- 'title' => 'Publisher',
483
- 'type' => 'text',
484
- 'desc' => 'Publisher name or Organization name',
485
- 'required' => true
486
- ),
487
- 'publisherImage' => array(
488
- 'title' => 'Publisher Logo',
489
- 'type' => 'url',
490
- 'desc' => 'Logos should have a wide aspect ratio, not a square icon.<br>Logos should be no wider than 600px, and no taller than 60px.<br>Always retain the original aspect ratio of the logo when resizing. Ideally, logos are exactly 60px tall with width <= 600px. If maintaining a height of 60px would cause the width to exceed 600px, downscale the logo to exactly 600px wide and reduce the height accordingly below 60px to maintain the original aspect ratio.<br>',
491
- 'required' => true
492
- ),
493
- 'description' => array(
494
- 'title' => 'Description',
495
- 'type' => 'textarea',
496
- 'desc' => 'Short description'
497
- ),
498
- 'articleBody' => array(
499
- 'title' => 'Article body',
500
- 'type' => 'textarea',
501
- 'desc' => 'Article content'
502
- ),
503
- 'alternativeHeadline' => array(
504
- 'title' => 'Alternative headline',
505
- 'type' => 'text',
506
- 'desc' => 'A secondary headline for the article.'
507
- ),
508
- )
509
- ),
510
- 'blog_posting' => array(
511
- 'title' => 'Blog Posting',
512
- 'fields' => array(
513
- 'headline' => array(
514
- 'title' => 'Headline',
515
- 'type' => 'text',
516
- 'desc' => 'Blog posting title',
517
- 'required' => true
518
- ),
519
- 'mainEntityOfPage'=> array(
520
- 'title' => 'Page URL',
521
- 'type' => 'url',
522
- 'desc' => 'The canonical URL of the article page',
523
- 'required' => true
524
- ),
525
- 'author' => array(
526
- 'title' => 'Author name',
527
- 'type' => 'text',
528
- 'desc' => 'Author display name',
529
- 'required' => true
530
- ),
531
- 'image' => array(
532
- 'title' => 'Image URL',
533
- 'type' => 'url',
534
- 'desc' => 'Image url, The representative image of the article. Only a marked-up image that directly belongs to the article should be specified. Images should be at least 696 pixels wide. Images should be in .jpg, .png, or. gif format.',
535
- 'required' => true
536
- ),
537
- 'datePublished' => array(
538
- 'title' => 'Published date',
539
- 'type' => 'text',
540
- 'class' => 'kcseo-date',
541
- 'desc' => 'Like this: 2015-12-25',
542
- 'required' => true
543
- ),
544
- 'dateModified' => array(
545
- 'title' => 'Modified date',
546
- 'type' => 'text',
547
- 'class' => 'kcseo-date',
548
- 'desc' => 'Like this: 2015-12-25',
549
- 'required' => true
550
- ),
551
- 'publisher' => array(
552
- 'title' => 'Publisher',
553
- 'type' => 'text',
554
- 'desc' => 'Publisher name or Organization name',
555
- 'required' => true
556
- ),
557
- 'publisherImage' => array(
558
- 'title' => 'Publisher Logo',
559
- 'type' => 'url',
560
- 'desc' => 'Logos should have a wide aspect ratio, not a square icon.<br>Logos should be no wider than 600px, and no taller than 60px.<br>Always retain the original aspect ratio of the logo when resizing. Ideally, logos are exactly 60px tall with width <= 600px. If maintaining a height of 60px would cause the width to exceed 600px, downscale the logo to exactly 600px wide and reduce the height accordingly below 60px to maintain the original aspect ratio.<br>',
561
- 'required' => true
562
- ),
563
- 'description' => array(
564
- 'title' => 'Description',
565
- 'type' => 'textarea',
566
- 'desc' => 'Short description'
567
- ),
568
- 'articleBody' => array(
569
- 'title' => 'Article body',
570
- 'type' => 'textarea',
571
- 'desc' => 'Article content'
572
- )
573
- )
574
- ),
575
- 'news_article' => array(
576
- 'title' => 'News Article',
577
- 'fields' => array(
578
- 'headline' => array(
579
- 'title' => 'Headline',
580
- 'type' => 'text',
581
- 'desc' => 'Article title',
582
- 'required' => true
583
- ),
584
- 'mainEntityOfPage'=> array(
585
- 'title' => 'Page URL',
586
- 'type' => 'url',
587
- 'desc' => 'The canonical URL of the article page',
588
- 'required' => true
589
- ),
590
- 'author' => array(
591
- 'title' => 'Author',
592
- 'type' => 'text',
593
- 'desc' => 'Author display name',
594
- 'required' => true
595
- ),
596
- 'image' => array(
597
- 'title' => 'Image',
598
- 'type' => 'url',
599
- 'desc' => 'Image url',
600
- 'required' => true
601
- ),
602
- 'datePublished' => array(
603
- 'title' => 'Published date',
604
- 'type' => 'text',
605
- 'class' => 'kcseo-date',
606
- 'desc' => 'Like this: 2015-12-25',
607
- 'required' => true
608
- ),
609
- 'dateModified' => array(
610
- 'title' => 'Modified date',
611
- 'type' => 'text',
612
- 'class' => 'kcseo-date',
613
- 'required' => true,
614
- 'desc' => 'Like this: 2015-12-25'
615
- ),
616
- 'publisher' => array(
617
- 'title' => 'Publisher',
618
- 'type' => 'text',
619
- 'desc' => 'Publisher name or Organization name',
620
- 'required' => true
621
- ),
622
- 'publisherImage' => array(
623
- 'title' => 'Publisher Logo',
624
- 'type' => 'url',
625
- 'desc' => 'Logos should have a wide aspect ratio, not a square icon.<br>Logos should be no wider than 600px, and no taller than 60px.<br>Always retain the original aspect ratio of the logo when resizing. Ideally, logos are exactly 60px tall with width <= 600px. If maintaining a height of 60px would cause the width to exceed 600px, downscale the logo to exactly 600px wide and reduce the height accordingly below 60px to maintain the original aspect ratio.<br>',
626
- 'required' => true
627
- ),
628
- 'description' => array(
629
- 'title' => 'Description',
630
- 'type' => 'textarea',
631
- 'desc' => 'Short description'
632
- ),
633
- 'articleBody' => array(
634
- 'title' => 'Article body',
635
- 'type' => 'textarea',
636
- 'desc' => 'Article body content'
637
- )
638
- )
639
- ),
640
- 'event' => array(
641
- 'title' => 'Event',
642
- 'fields' => array(
643
- 'name' => array(
644
- 'title' => 'Name',
645
- 'type' => 'text',
646
- 'required' => true,
647
- 'desc' => "The name of the event."
648
- ),
649
- 'locationName' => array(
650
- 'title' => 'Location name',
651
- 'type' => 'text',
652
- 'required' => true,
653
- 'desc' => "Event Location name"
654
- ),
655
- 'locationAddress' => array(
656
- 'title' => 'Location address',
657
- 'type' => 'text',
658
- 'required' => true,
659
- 'desc' => "The location of for example where the event is happening, an organization is located, or where an action takes place."
660
- ),
661
- 'startDate' => array(
662
- 'title' => 'Start date',
663
- 'type' => 'text',
664
- 'class' => 'kcseo-date',
665
- 'required' => true,
666
- 'desc' => "Event start date"
667
- ),
668
- 'price' => array(
669
- 'title' => 'Price (Recommended)',
670
- 'type' => 'number',
671
- '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>"
672
- ),
673
- 'priceCurrency' => array(
674
- 'title' => 'Price currency',
675
- 'type' => 'text',
676
- 'desc' => "The 3-letter currency code. (USD)"
677
- ),
678
- 'url' => array(
679
- 'title' => 'URL (Recommended)',
680
- 'type' => 'url',
681
- 'placeholder' => 'URL',
682
- 'desc' => "A link to the event's details page. <span class='required'>Not required but (Recommended)</span>"
683
- ),
684
- )
685
- ),
686
- 'product' => array(
687
- 'title' => 'Product',
688
- 'fields' => array(
689
- 'name' => array(
690
- 'title' => 'Name',
691
- 'type' => 'text',
692
- 'required' => true,
693
- 'desc' => "The name of the product."
694
- ),
695
- 'image' => array(
696
- 'title' => 'Image URL',
697
- 'type' => 'url',
698
- 'desc' => "The URL of a product photo. Pictures clearly showing the product, e.g. against a white background, are preferred."
699
- ),
700
- 'description' => array(
701
- 'title' => 'Description',
702
- 'type' => 'textarea',
703
- 'desc' => "Product description."
704
- ),
705
- 'brand' => array(
706
- 'title' => 'Brand',
707
- 'type' => 'text',
708
- 'desc' => "The brand of the product."
709
- ),
710
- 'ratingValue' => array(
711
- 'title' => 'Ratting value',
712
- 'type' => 'text',
713
- 'desc' => "Rating value. (1 , 2.5, 3, 5 etc)"
714
- ),
715
- 'reviewCount' => array(
716
- 'title' => 'Total review count',
717
- 'type' => 'number',
718
- 'desc' => "Rating ratting value. <span class='required'>This is required if (Ratting value) is given</span>"
719
- ),
720
- 'price' => array(
721
- 'title' => 'Price',
722
- 'type' => 'number',
723
- 'desc' => "The lowest available price, including service charges and fees, of this type of ticket."
724
- ),
725
- 'priceCurrency' => array(
726
- 'title' => 'Price currency',
727
- 'type' => 'text',
728
- 'desc' => "The 3-letter currency code."
729
- ),
730
- 'availability' => array(
731
- 'title' => 'Availability',
732
- 'type' => 'select',
733
- 'empty' => "Select one",
734
- 'options' => array(
735
- 'http://schema.org/InStock' => 'InStock',
736
- 'http://schema.org/InStoreOnly' => 'InStoreOnly',
737
- 'http://schema.org/OutOfStock' => 'OutOfStock',
738
- 'http://schema.org/SoldOut' => 'SoldOut',
739
- 'http://schema.org/OnlineOnly' => 'OnlineOnly',
740
- 'http://schema.org/LimitedAvailability' => 'LimitedAvailability',
741
- 'http://schema.org/Discontinued' => 'Discontinued',
742
- 'http://schema.org/PreOrder' => 'PreOrder',
743
- ),
744
- 'desc' => "Select a availability type",
745
- ),
746
- 'itemCondition' => array(
747
- 'title' => 'Product condition',
748
- 'type' => 'select',
749
- 'empty' => "Select one",
750
- 'options' => array(
751
- 'http://schema.org/NewCondition' => 'NewCondition',
752
- 'http://schema.org/UsedCondition' => 'UsedCondition',
753
- 'http://schema.org/DamagedCondition' => 'DamagedCondition',
754
- 'http://schema.org/RefurbishedCondition' => 'RefurbishedCondition',
755
- ),
756
- 'desc' => "Select a condition"
757
- ),
758
- 'url' => array(
759
- 'title' => 'Product URL',
760
- 'type' => 'url',
761
- 'desc' => "A URL to the product web page (that includes the Offer). (Don't use offerURL for markup that appears on the product page itself.)"
762
- ),
763
- )
764
- ),
765
- 'video' => array(
766
- 'title' => 'Video',
767
- 'fields' => array(
768
- 'name' => array(
769
- 'title' => 'Name',
770
- 'type' => 'text',
771
- 'required' => true,
772
- 'desc' => "The title of the video"
773
- ),
774
- 'description' => array(
775
- 'title' => 'Description',
776
- 'type' => 'textarea',
777
- 'required' => true,
778
- 'desc' => "The description of the video"
779
- ),
780
- 'thumbnailUrl' => array(
781
- 'title' => 'Thumbnail URL',
782
- 'type' => 'url',
783
- 'placeholder' => 'URL',
784
- 'required' => true,
785
- 'desc' => "A URL pointing to the video thumbnail image file. Images must be at least 160x90 pixels and at most 1920x1080 pixels."
786
- ),
787
- 'uploadDate' => array(
788
- 'title' => 'Updated date',
789
- 'type' => 'text',
790
- 'class' => 'kcseo-date',
791
- 'desc' => '2015-02-05T08:00:00+08:00'
792
- ),
793
- 'duration' => array(
794
- 'title' => 'Duration',
795
- 'type' => 'text',
796
- 'desc' => "The duration of the video in ISO 8601 format.(PT1M33S)"
797
- ),
798
- 'contentUrl' => array(
799
- 'title' => 'Content URL',
800
- 'type' => 'url',
801
- 'placeholder' => 'URL',
802
- 'desc' => "A URL pointing to the actual video media file. This file should be in .mpg, .mpeg, .mp4, .m4v, .mov, .wmv, .asf, .avi, .ra, .ram, .rm, .flv, or other video file format."
803
- ),
804
- 'embedUrl' => array(
805
- 'title' => 'Embed URL',
806
- 'placeholder' => 'URL',
807
- 'type' => 'url',
808
- 'desc' => "A URL pointing to a player for the specific video. Usually this is the information in the src element of an < embed> tag.Example: Dailymotion: http://www.dailymotion.com/swf/x1o2g."
809
- ),
810
- 'interactionCount' => array(
811
- 'title' => 'Interaction count',
812
- 'type' => 'text',
813
- 'desc' => "The number of times the video has been viewed."
814
- ),
815
- 'expires' => array(
816
- 'title' => 'Expires',
817
- 'type' => 'text',
818
- 'class' => 'kcseo-date',
819
- 'desc' => "Like this: 2015-12-25"
820
- ),
821
- )
822
- ),
823
- 'service' => array(
824
- 'title' => 'Service',
825
- 'fields' => array(
826
- 'name' => array(
827
- 'title' => 'Name',
828
- 'type' => 'text',
829
- 'required' => true,
830
- 'desc' => "The name of the Service."
831
- ),
832
- 'serviceType' => array(
833
- 'title' => 'Service type',
834
- 'type' => 'text',
835
- 'required' => true,
836
- 'desc' => "The type of service being offered, e.g. veterans' benefits, emergency relief, etc."
837
- ),
838
- 'additionalType' => array(
839
- 'title' => 'Additional type',
840
- 'type' => 'url',
841
- 'placeholder' => 'URL',
842
- 'desc' => "An additional type for the service, typically used for adding more specific types from external vocabularies in microdata syntax."
843
- ),
844
- 'locationName' => array(
845
- 'title' => 'Served location name ',
846
- 'type' => 'text',
847
- 'desc' => "The geographic area where a service or offered item is provided."
848
- ),
849
- 'locationAddress' => array(
850
- 'title' => 'Served location address',
851
- 'type' => 'text',
852
- 'desc' => "The geographic area where a service or offered item is provided.<span class='required'>This field is required when location name is set</span>"
853
- ),
854
- 'award' => array(
855
- 'title' => 'Award',
856
- 'type' => 'text',
857
- 'desc' => "An award won by or for this service."
858
- ),
859
- 'category' => array(
860
- 'title' => 'Category',
861
- 'type' => 'text',
862
- 'desc' => "A category for the service."
863
- ),
864
- 'providerMobility' => array(
865
- 'title' => 'Provider mobility',
866
- 'type' => 'text',
867
- 'desc' => "Indicates the mobility of a provided service (e.g. 'static', 'dynamic')."
868
- ),
869
- 'description' => array(
870
- 'title' => 'Description',
871
- 'type' => 'textarea',
872
- 'require' => true,
873
- 'desc' => "A short description of the service."
874
- ),
875
- 'image' => array(
876
- 'title' => 'Image URL',
877
- 'type' => 'url',
878
- 'require' => false,
879
- 'desc' => "An image of the service. This should be a URL."
880
- ),
881
- 'mainEntityOfPage' => array(
882
- 'title' => 'Main entity of page URL',
883
- 'type' => 'url',
884
- 'require' => false,
885
- 'desc' => "Indicates a page (or other CreativeWork) for which this thing is the main entity being described."
886
- ),
887
- 'sameAs' => array(
888
- 'title' => 'Same as URL',
889
- 'type' => 'url',
890
- 'placeholder' => 'URL',
891
- 'desc' => "URL of a reference Web page that unambiguously indicates the service's identity. E.g. the URL of the service's Wikipedia page, Freebase page, or official website."
892
- ),
893
- 'url' => array(
894
- 'title' => 'Url of the service',
895
- 'type' => 'url',
896
- 'placeholder' => 'URL',
897
- 'desc' => "URL of the service."
898
- ),
899
- 'alternateName' => array(
900
- 'title' => 'Alternate name',
901
- 'type' => 'text',
902
- 'desc' => 'An alias for the service.'
903
- ),
904
- )
905
- ),
906
- 'review' => array(
907
- 'title' => 'Review',
908
- 'fields' => array(
909
- 'itemName' => array(
910
- 'title' => 'Name of the reviewed item',
911
- 'type' => 'text',
912
- 'required' => true,
913
- 'desc' => "The item that is being reviewed."
914
- ),
915
- 'reviewBody' => array(
916
- 'title' => 'Review body',
917
- 'type' => 'text',
918
- 'required' => true,
919
- 'desc' => "The actual body of the review."
920
- ),
921
- 'name' => array(
922
- 'title' => 'Review name',
923
- 'type' => 'text',
924
- 'required' => true,
925
- 'desc' => "A particular name for the review."
926
- ),
927
- 'author' => array(
928
- 'title' => 'Author',
929
- 'type' => 'text',
930
- 'required' => true,
931
- 'author' => 'Author name',
932
- 'desc' => "The author of the review. The reviewer’s name needs to be a valid name."
933
- ),
934
- 'datePublished' => array(
935
- 'title' => 'Date of Published',
936
- 'type' => 'text',
937
- 'class' => 'kcseo-date',
938
- 'desc' => "Like this: 2015-12-25"
939
- ),
940
- 'ratingValue' => array(
941
- 'title' => 'Rating value',
942
- 'type' => 'number',
943
- 'desc' => "A numerical quality rating for the item."
944
- ),
945
- 'bestRating' => array(
946
- 'title' => 'Best rating',
947
- 'type' => 'number',
948
- 'desc' => "The highest value allowed in this rating system."
949
- ),
950
- 'worstRating' => array(
951
- 'title' => 'Worst rating',
952
- 'type' => 'number',
953
- '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."
954
- ),
955
- 'publisher' => array(
956
- 'title' => 'Name of the organization',
957
- 'type' => 'text',
958
- 'desc' => 'The publisher of the review.'
959
- )
960
- )
961
- ),
962
- 'aggregate_rating' => array(
963
- 'title' => 'Aggregate Ratings',
964
- 'fields' => array(
965
- 'schema_type' => array(
966
- 'title' => 'Schema type',
967
- 'type' => 'select',
968
- 'required' => true,
969
- 'options' => $this->site_type(),
970
- 'empty' => "Select one",
971
- 'desc' => "Use the most appropriate schema type for what is being reviewed."
972
- ),
973
- 'name' => array(
974
- 'title' => 'Name of the item',
975
- 'type' => 'text',
976
- 'required' => true,
977
- 'desc' => "The item that is being rated."
978
- ),
979
- 'description' => array(
980
- 'title' => 'Description',
981
- 'type' => 'textarea',
982
- 'desc' => "Description for thr review"
983
- ),
984
- 'ratingCount' => array(
985
- 'title' => 'Rating Count',
986
- 'type' => 'number',
987
- 'required' => true,
988
- '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>"
989
- ),
990
- 'reviewCount' => array(
991
- 'title' => 'Review Count',
992
- 'type' => 'number',
993
- 'required' => true,
994
- '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."
995
- ),
996
- 'ratingValue' => array(
997
- 'title' => 'Rating Value',
998
- 'type' => 'number',
999
- 'required' => true,
1000
- 'desc' => "A numerical quality rating for the item."
1001
- ),
1002
- 'ratingValue' => array(
1003
- 'title' => 'Rating Value',
1004
- 'type' => 'number',
1005
- 'required' => true,
1006
- 'desc' => "A numerical quality rating for the item."
1007
- ),
1008
- 'bestRating' => array(
1009
- 'title' => 'Best Rating',
1010
- 'type' => 'number',
1011
- 'required' => true,
1012
- '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."
1013
- ),
1014
- 'worstRating' => array(
1015
- 'title' => 'Worst Rating',
1016
- 'type' => 'number',
1017
- 'required' => true,
1018
- '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."
1019
- )
1020
- )
1021
- )
1022
- );
1023
- }
1024
 
1025
- function get_jsonEncode($data = array()){
1026
- $html = null;
1027
- /** @var TYPE_NAME $data */
1028
- if(!empty($data) && is_array($data)){
1029
- $html .= '<script type="application/ld+json">' .json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . '</script>';
1030
- }
1031
- return $html;
1032
- }
1033
 
1034
- function site_type(){
1035
- return array(
1036
- 'Organization',
1037
- 'LocalBusiness',
1038
- 'AccountingService',
1039
- 'Attorney',
1040
- 'AutoBodyShop',
1041
- 'AutoDealer',
1042
- 'AutoPartsStore',
1043
- 'AutoRental',
1044
- 'AutoRepair',
1045
- 'AutoWash',
1046
- 'Bakery',
1047
- 'BarOrPub',
1048
- 'BeautySalon',
1049
- 'BedAndBreakfast',
1050
- 'BikeStore',
1051
- 'BookStore',
1052
- 'CafeOrCoffeeShop',
1053
- 'ChildCare',
1054
- 'ClothingStore',
1055
- 'ComputerStore',
1056
- 'DaySpa',
1057
- 'Dentist',
1058
- 'DryCleaningOrLaundry',
1059
- 'Electrician',
1060
- 'ElectronicsStore',
1061
- 'EmergencyService',
1062
- 'EntertainmentBusiness',
1063
- 'EventVenue',
1064
- 'ExerciseGym',
1065
- 'FinancialService',
1066
- 'Florist',
1067
- 'FoodEstablishment',
1068
- 'FurnitureStore',
1069
- 'GardenStore',
1070
- 'GeneralContractor',
1071
- 'GolfCourse',
1072
- 'HairSalon',
1073
- 'HardwareStore',
1074
- 'HealthAndBeautyBusiness',
1075
- 'HobbyShop',
1076
- 'Store',
1077
- 'HomeAndConstructionBusiness',
1078
- 'HomeGoodsStore',
1079
- 'Hospital',
1080
- 'Hotel',
1081
- 'HousePainter',
1082
- 'HVACBusiness',
1083
- 'HVACBusiness',
1084
- 'InsuranceAgency',
1085
- 'JewelryStore',
1086
- 'LiquorStore',
1087
- 'Locksmith',
1088
- 'LodgingBusiness',
1089
- 'MedicalClinic',
1090
- 'MensClothingStore',
1091
- 'MobilePhoneStore',
1092
- 'Motel',
1093
- 'MotorcycleDealer',
1094
- 'MotorcycleRepair',
1095
- 'MovingCompany',
1096
- 'MusicStore',
1097
- 'NailSalon',
1098
- 'NightClub',
1099
- 'Notary',
1100
- 'OfficeEquipmentStore',
1101
- 'Optician',
1102
- 'Person',
1103
- 'PetStore',
1104
- 'Physician',
1105
- 'Plumber',
1106
- 'ProfessionalService',
1107
- 'RealEstateAgent',
1108
- 'Residence',
1109
- 'Restaurant',
1110
- 'RoofingContractor',
1111
- 'RVPark',
1112
- 'School',
1113
- 'SelfStorage',
1114
- 'ShoeStore',
1115
- 'SkiResort',
1116
- 'SportingGoodsStore',
1117
- 'SportsClub',
1118
- 'Store',
1119
- 'TattooParlor',
1120
- 'Taxi',
1121
- 'TennisComplex',
1122
- 'TireShop',
1123
- 'ToyStore',
1124
- 'TravelAgency',
1125
- 'VeterinaryCare',
1126
- 'WholesaleStore',
1127
- 'Winery'
1128
- );
1129
- }
1130
 
1131
- function countryList(){
1132
- return array(
1133
- "AF" => "Afghanistan",
1134
- "AX" => "Aland Islands",
1135
- "AL" => "Albania",
1136
- "DZ" => "Algeria",
1137
- "AS" => "American Samoa",
1138
- "AD" => "Andorra",
1139
- "AO" => "Angola",
1140
- "AI" => "Anguilla",
1141
- "AQ" => "Antarctica",
1142
- "AG" => "Antigua and Barbuda",
1143
- "AR" => "Argentina",
1144
- "AM" => "Armenia",
1145
- "AW" => "Aruba",
1146
- "AU" => "Australia",
1147
- "AT" => "Austria",
1148
- "AZ" => "Azerbaijan",
1149
- "BS" => "Bahamas",
1150
- "BH" => "Bahrain",
1151
- "BD" => "Bangladesh",
1152
- "BB" => "Barbados",
1153
- "BY" => "Belarus",
1154
- "BE" => "Belgium",
1155
- "BZ" => "Belize",
1156
- "BJ" => "Benin",
1157
- "BM" => "Bermuda",
1158
- "BT" => "Bhutan",
1159
- "BO" => "Bolivia, Plurinational State of",
1160
- "BQ" => "Bonaire, Sint Eustatius and Saba",
1161
- "BA" => "Bosnia and Herzegovina",
1162
- "BW" => "Botswana",
1163
- "BV" => "Bouvet Island",
1164
- "BR" => "Brazil",
1165
- "IO" => "British Indian Ocean Territory",
1166
- "BN" => "Brunei Darussalam",
1167
- "BG" => "Bulgaria",
1168
- "BF" => "Burkina Faso",
1169
- "BI" => "Burundi",
1170
- "KH" => "Cambodia",
1171
- "CM" => "Cameroon",
1172
- "CA" => "Canada",
1173
- "CV" => "Cape Verde",
1174
- "KY" => "Cayman Islands",
1175
- "CF" => "Central African Republic",
1176
- "TD" => "Chad",
1177
- "CL" => "Chile",
1178
- "CN" => "China",
1179
- "CX" => "Christmas Island",
1180
- "CC" => "Cocos (Keeling) Islands",
1181
- "CO" => "Colombia",
1182
- "KM" => "Comoros",
1183
- "CG" => "Congo",
1184
- "CD" => "Congo, the Democratic Republic of the",
1185
- "CK" => "Cook Islands",
1186
- "CR" => "Costa Rica",
1187
- "CI" => "Côte d Ivoire",
1188
- "HR" => "Croatia",
1189
- "CU" => "Cuba",
1190
- "CW" => "Curaçao",
1191
- "CY" => "Cyprus",
1192
- "CZ" => "Czech Republic",
1193
- "DK" => "Denmark",
1194
- "DJ" => "Djibouti",
1195
- "DM" => "Dominica",
1196
- "DO" => "Dominican Republic",
1197
- "EC" => "Ecuador",
1198
- "EG" => "Egypt",
1199
- "SV" => "El Salvador",
1200
- "GQ" => "Equatorial Guinea",
1201
- "ER" => "Eritrea",
1202
- "EE" => "Estonia",
1203
- "ET" => "Ethiopia",
1204
- "FK" => "Falkland Islands (Malvinas)",
1205
- "FO" => "Faroe Islands",
1206
- "FJ" => "Fiji",
1207
- "FI" => "Finland",
1208
- "FR" => "France",
1209
- "GF" => "French Guiana",
1210
- "PF" => "French Polynesia",
1211
- "TF" => "French Southern Territories",
1212
- "GA" => "Gabon",
1213
- "GM" => "Gambia",
1214
- "GE" => "Georgia",
1215
- "DE" => "Germany",
1216
- "GH" => "Ghana",
1217
- "GI" => "Gibraltar",
1218
- "GR" => "Greece",
1219
- "GL" => "Greenland",
1220
- "GD" => "Grenada",
1221
- "GP" => "Guadeloupe",
1222
- "GU" => "Guam",
1223
- "GT" => "Guatemala",
1224
- "GG" => "Guernsey",
1225
- "GN" => "Guinea",
1226
- "GW" => "Guinea-Bissau",
1227
- "GY" => "Guyana",
1228
- "HT" => "Haiti",
1229
- "HM" => "Heard Island and McDonald Islands",
1230
- "VA" => "Holy See (Vatican City State)",
1231
- "HN" => "Honduras",
1232
- "HK" => "Hong Kong",
1233
- "HU" => "Hungary",
1234
- "IS" => "Iceland",
1235
- "IN" => "India",
1236
- "ID" => "Indonesia",
1237
- "IR" => "Iran, Islamic Republic of",
1238
- "IQ" => "Iraq",
1239
- "IE" => "Ireland",
1240
- "IM" => "Isle of Man",
1241
- "IL" => "Israel",
1242
- "IT" => "Italy",
1243
- "JM" => "Jamaica",
1244
- "JP" => "Japan",
1245
- "JE" => "Jersey",
1246
- "JO" => "Jordan",
1247
- "KZ" => "Kazakhstan",
1248
- "KE" => "Kenya",
1249
- "KI" => "Kiribati",
1250
- "KP" => "Korea, Democratic People's Republic of",
1251
- "KR" => "Korea, Republic of,",
1252
- "KW" => "Kuwait",
1253
- "KG" => "Kyrgyzstan",
1254
- "LA" => "Lao Peoples Democratic Republic",
1255
- "LV" => "Latvia",
1256
- "LB" => "Lebanon",
1257
- "LS" => "Lesotho",
1258
- "LR" => "Liberia",
1259
- "LY" => "Libya",
1260
- "LI" => "Liechtenstein",
1261
- "LT" => "Lithuania",
1262
- "LU" => "Luxembourg",
1263
- "MO" => "Macao",
1264
- "MK" => "Macedonia, the former Yugoslav Republic of",
1265
- "MG" => "Madagascar",
1266
- "MW" => "Malawi",
1267
- "MY" => "Malaysia",
1268
- "MV" => "Maldives",
1269
- "ML" => "Mali",
1270
- "MT" => "Malta",
1271
- "MH" => "Marshall Islands",
1272
- "MQ" => "Martinique",
1273
- "MR" => "Mauritania",
1274
- "MU" => "Mauritius",
1275
- "YT" => "Mayotte",
1276
- "MX" => "Mexico",
1277
- "FM" => "Micronesia, Federated States of",
1278
- "MD" => "Moldova, Republic of",
1279
- "MC" => "Monaco",
1280
- "MN" => "Mongolia",
1281
- "ME" => "Montenegro",
1282
- "MS" => "Montserrat",
1283
- "MA" => "Morocco",
1284
- "MZ" => "Mozambique",
1285
- "MM" => "Myanmar",
1286
- "NA" => "Namibia",
1287
- "NR" => "Nauru",
1288
- "NP" => "Nepal",
1289
- "NL" => "Netherlands",
1290
- "NC" => "New Caledonia",
1291
- "NZ" => "New Zealand",
1292
- "NI" => "Nicaragua",
1293
- "NE" => "Niger",
1294
- "NG" => "Nigeria",
1295
- "NU" => "Niue",
1296
- "NF" => "Norfolk Island",
1297
- "MP" => "Northern Mariana Islands",
1298
- "NO" => "Norway",
1299
- "OM" => "Oman",
1300
- "PK" => "Pakistan",
1301
- "PW" => "Palau",
1302
- "PS" => "Palestine, State of",
1303
- "PA" => "Panama",
1304
- "PG" => "Papua New Guinea",
1305
- "PY" => "Paraguay",
1306
- "PE" => "Peru",
1307
- "PH" => "Philippines",
1308
- "PN" => "Pitcairn",
1309
- "PL" => "Poland",
1310
- "PT" => "Portugal",
1311
- "PR" => "Puerto Rico",
1312
- "QA" => "Qatar",
1313
- "RE" => "Reunion",
1314
- "RO" => "Romania",
1315
- "RU" => "Russian Federation",
1316
- "RW" => "Rwanda",
1317
- "BL" => "Saint Barthélemy",
1318
- "SH" => "Saint Helena, Ascension and Tristan da Cunha",
1319
- "KN" => "Saint Kitts and Nevis",
1320
- "LC" => "Saint Lucia",
1321
- "MF" => "Saint Martin (French part)",
1322
- "PM" => "Saint Pierre and Miquelon",
1323
- "VC" => "Saint Vincent and the Grenadines",
1324
- "WS" => "Samoa",
1325
- "SM" => "San Marino",
1326
- "ST" => "Sao Tome and Principe",
1327
- "SA" => "Saudi Arabia",
1328
- "SN" => "Senegal",
1329
- "RS" => "Serbia",
1330
- "SC" => "Seychelles",
1331
- "SL" => "Sierra Leone",
1332
- "SG" => "Singapore",
1333
- "SX" => "Sint Maarten (Dutch part)",
1334
- "SK" => "Slovakia",
1335
- "SI" => "Slovenia",
1336
- "SB" => "Solomon Islands",
1337
- "SO" => "Somalia",
1338
- "ZA" => "South Africa",
1339
- "GS" => "South Georgia and the South Sandwich Islands",
1340
- "SS" => "South Sudan",
1341
- "ES" => "Spain",
1342
- "LK" => "Sri Lanka",
1343
- "SD" => "Sudan",
1344
- "SR" => "Suriname",
1345
- "SJ" => "Svalbard and Jan Mayen",
1346
- "SZ" => "Swaziland",
1347
- "SE" => "Sweden",
1348
- "CH" => "Switzerland",
1349
- "SY" => "Syrian Arab Republic",
1350
- "TW" => "Taiwan, Province of China",
1351
- "TJ" => "Tajikistan",
1352
- "TZ" => "Tanzania, United Republic of",
1353
- "TH" => "Thailand",
1354
- "TL" => "Timor-Leste",
1355
- "TG" => "Togo",
1356
- "TK" => "Tokelau",
1357
- "TO" => "Tonga",
1358
- "TT" => "Trinidad and Tobago",
1359
- "TN" => "Tunisia",
1360
- "TR" => "Turkey",
1361
- "TM" => "Turkmenistan",
1362
- "TC" => "Turks and Caicos Islands",
1363
- "TV" => "Tuvalu",
1364
- "UG" => "Uganda",
1365
- "UA" => "Ukraine",
1366
- "AE" => "United Arab Emirates",
1367
- "GB" => "United Kingdom",
1368
- "US" => "United States",
1369
- "UM" => "United States Minor Outlying Islands",
1370
- "UY" => "Uruguay",
1371
- "UZ" => "Uzbekistan",
1372
- "VU" => "Vanuatu",
1373
- "VE" => "Venezuela, Bolivarian Republic of",
1374
- "VN" => "Viet Nam",
1375
- "VG" => "Virgin Islands, British",
1376
- "VI" => "Virgin Islands, U.S.",
1377
- "WF" => "Wallis and Futuna",
1378
- "EH" => "Western Sahara",
1379
- "YE" => "Yemen",
1380
- "ZM" => "Zambia",
1381
- "ZW" => "Zimbabwe",
1382
- );
1383
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1384
 
1385
- function contactType(){
1386
- return array(
1387
- "Customer Service",
1388
- "Technical Support",
1389
- "Billing Support",
1390
- "Bill Payment",
1391
- "Sales",
1392
- "Reservations",
1393
- "Credit Card Support",
1394
- "Emergency",
1395
- "Baggage Tracking",
1396
- "Roadside Assistance",
1397
- "Package Tracking"
1398
- );
1399
- }
1400
 
1401
- function languageList(){
1402
- return array(
1403
- "Akan",
1404
- "Amharic",
1405
- "Arabic",
1406
- "Assamese",
1407
- "Awadhi",
1408
- "Azerbaijani",
1409
- "Balochi",
1410
- "Belarusian",
1411
- "Bengali",
1412
- "Bhojpuri",
1413
- "Burmese",
1414
- "Cantonese",
1415
- "Cebuano",
1416
- "Chewa",
1417
- "Chhattisgarhi",
1418
- "Chittagonian",
1419
- "Czech",
1420
- "Deccan",
1421
- "Dhundhari",
1422
- "Dutch",
1423
- "English",
1424
- "French",
1425
- "Fula",
1426
- "Gan",
1427
- "German",
1428
- "Greek",
1429
- "Gujarati",
1430
- "Haitian Creole",
1431
- "Hakka",
1432
- "Haryanvi",
1433
- "Hausa",
1434
- "Hiligaynon",
1435
- "Hindi / Urdu",
1436
- "Hmong",
1437
- "Hungarian",
1438
- "Igbo",
1439
- "Ilokano",
1440
- "Italian",
1441
- "Japanese",
1442
- "Javanese",
1443
- "Jin",
1444
- "Kannada",
1445
- "Kazakh",
1446
- "Khmer",
1447
- "Kinyarwanda",
1448
- "Kirundi",
1449
- "Konkani",
1450
- "Korean",
1451
- "Kurdish",
1452
- "Madurese",
1453
- "Magahi",
1454
- "Maithili",
1455
- "Malagasy",
1456
- "Malay/Indonesian",
1457
- "Malayalam",
1458
- "Mandarin",
1459
- "Marathi",
1460
- "Marwari",
1461
- "Min Bei",
1462
- "Min Dong",
1463
- "Min Nan",
1464
- "Mossi",
1465
- "Nepali",
1466
- "Oriya",
1467
- "Oromo",
1468
- "Pashto",
1469
- "Persian",
1470
- "Polish",
1471
- "Portuguese",
1472
- "Punjabi",
1473
- "Quechua",
1474
- "Romanian",
1475
- "Russian",
1476
- "Saraiki",
1477
- "Serbo-Croatian",
1478
- "Shona",
1479
- "Sindhi",
1480
- "Sinhalese",
1481
- "Somali",
1482
- "Spanish",
1483
- "Sundanese",
1484
- "Swahili",
1485
- "Swedish",
1486
- "Sylheti",
1487
- "Tagalog",
1488
- "Tamil",
1489
- "Telugu",
1490
- "Thai",
1491
- "Turkish",
1492
- "Ukrainian",
1493
- "Uyghur",
1494
- "Uzbek",
1495
- "Vietnamese",
1496
- "Wu",
1497
- "Xhosa",
1498
- "Xiang",
1499
- "Yoruba",
1500
- "Zulu",
1501
- );
1502
- }
1503
 
1504
- function socialList(){
1505
- return array(
1506
- 'facebook' => __('Facebook'),
1507
- 'twitter' => __('Twitter'),
1508
- 'google-plus' => __('Google+'),
1509
- 'instagram' => __('Instagram'),
1510
- 'youtube' => __('Youtube'),
1511
- 'linkedin' => __('LinkedIn'),
1512
- 'myspace' => __('Myspace'),
1513
- 'pinterest' => __('Pinterest'),
1514
- 'soundcloud' => __('SoundCloud'),
1515
- 'tumblr' => __('Tumblr'),
1516
- 'wikidata' => __('Wikidata'),
1517
- );
1518
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1519
 
1520
- function imgInfo($url = null){
1521
- $img = array();
1522
- if($url){
1523
- $imgA = @getimagesize($url);
1524
- if(is_array($imgA) && !empty($imgA)){
1525
- $img['width'] = $imgA[0];
1526
- $img['height'] = $imgA[1];
1527
- }else{
1528
- $img['width'] = 0;
1529
- $img['height'] = 0;
1530
- }
1531
- }
1532
- return $img;
1533
- }
1534
- function isAssoc($array)
1535
- {
1536
- $keys = array_keys($array);
1537
- return $keys !== array_keys($keys);
1538
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1539
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1540
 
1541
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1542
  endif;
1
  <?php
2
 
3
+ if ( ! class_exists( 'KcSeoSchemaModel' ) ):
4
+ class KcSeoSchemaModel {
5
+ function __construct() {
 
 
6
 
7
+ }
8
 
9
+ function schemaOutput( $schemaID, $metaData ) {
10
+ $html = null;
11
 
12
+ if ( $schemaID ) {
13
+ global $KcSeoWPSchema;
14
+ switch ( $schemaID ) {
15
+ case "article":
16
+ $article = array();
17
+ $article["@context"] = "http://schema.org";
18
+ $article["@type"] = "Article";
19
+ if ( ! empty( $metaData['headline'] ) ) {
20
+ $article["headline"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['headline'] );
21
+ }
22
+ if ( ! empty( $metaData['mainEntityOfPage'] ) ) {
23
+ $article["mainEntityOfPage"] = array(
24
+ "@type" => "WebPage",
25
+ "@id" => $KcSeoWPSchema->sanitizeOutPut( $metaData["mainEntityOfPage"] )
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'] ) ) {
33
+ $img = $KcSeoWPSchema->imageInfo( absint( $metaData['publisherImage'] ) );
34
+ $plA = array(
35
+ "@type" => "ImageObject",
36
+ "url" => $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' ),
37
+ "height" => $img['height'],
38
+ "width" => $img['width']
39
+ );
40
+ } else {
41
+ $plA = array();
42
+ }
43
+ $article["publisher"] = array(
44
+ "@type" => "Organization",
45
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['publisher'] ),
46
+ "logo" => $plA
47
+ );
48
+ }
49
+ if ( ! empty( $metaData['alternativeHeadline'] ) ) {
50
+ $article["alternativeHeadline"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['alternativeHeadline'] );
51
+ }
52
+ if ( ! empty( $metaData['image'] ) ) {
53
+ $img = $KcSeoWPSchema->imageInfo( absint( $metaData['image'] ) );
54
+ $article["image"] = array(
55
+ "@type" => "ImageObject",
56
+ "url" => $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' ),
57
+ "height" => $img['height'],
58
+ "width" => $img['width']
59
+ );
60
+ }
61
+ if ( ! empty( $metaData['datePublished'] ) ) {
62
+ $article["datePublished"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['datePublished'] );
63
+ }
64
+ if ( ! empty( $metaData['dateModified'] ) ) {
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;
75
 
76
+ case "news_article":
77
+ $newsArticle = array();
78
+ $newsArticle["@context"] = "http://schema.org";
79
+ $newsArticle["@type"] = "NewsArticle";
80
+ if ( ! empty( $metaData['headline'] ) ) {
81
+ $newsArticle["headline"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['headline'] );
82
+ }
83
+ if ( ! empty( $metaData['mainEntityOfPage'] ) ) {
84
+ $newsArticle["mainEntityOfPage"] = array(
85
+ "@type" => "WebPage",
86
+ "@id" => $KcSeoWPSchema->sanitizeOutPut( $metaData["mainEntityOfPage"] )
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'] ) );
94
+ $newsArticle["image"] = array(
95
+ "@type" => "ImageObject",
96
+ "url" => $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' ),
97
+ "height" => $img['height'],
98
+ "width" => $img['width']
99
+ );
100
+ }
101
+ if ( ! empty( $metaData['datePublished'] ) ) {
102
+ $newsArticle["datePublished"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['datePublished'] );
103
+ }
104
+ if ( ! empty( $metaData['dateModified'] ) ) {
105
+ $newsArticle["dateModified"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['dateModified'] );
106
+ }
107
+ if ( ! empty( $metaData['publisher'] ) ) {
108
+ if ( ! empty( $metaData['publisherImage'] ) ) {
109
+ $img = $KcSeoWPSchema->imageInfo( absint( $metaData['publisherImage'] ) );
110
+ $plA = array(
111
+ "@type" => "ImageObject",
112
+ "url" => $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' ),
113
+ "height" => $img['height'],
114
+ "width" => $img['width']
115
+ );
116
+ } else {
117
+ $plA = array();
118
+ }
119
+ $newsArticle["publisher"] = array(
120
+ "@type" => "Organization",
121
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['publisher'] ),
122
+ "logo" => $plA
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;
133
 
134
+ case "blog_posting":
135
+ $blogPosting = array();
136
+ $blogPosting["@context"] = "http://schema.org";
137
+ $blogPosting["@type"] = "BlogPosting";
138
+ if ( ! empty( $metaData['headline'] ) ) {
139
+ $blogPosting["headline"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['headline'] );
140
+ }
141
+ if ( ! empty( $metaData['mainEntityOfPage'] ) ) {
142
+ $blogPosting["mainEntityOfPage"] = array(
143
+ "@type" => "WebPage",
144
+ "@id" => $KcSeoWPSchema->sanitizeOutPut( $metaData["mainEntityOfPage"] )
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'] ) );
152
+ $blogPosting["image"] = array(
153
+ "@type" => "ImageObject",
154
+ "url" => $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' ),
155
+ "height" => $img['height'],
156
+ "width" => $img['width']
157
+ );
158
+ }
159
+ if ( ! empty( $metaData['datePublished'] ) ) {
160
+ $blogPosting["datePublished"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['datePublished'] );
161
+ }
162
+ if ( ! empty( $metaData['dateModified'] ) ) {
163
+ $blogPosting["dateModified"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['dateModified'] );
164
+ }
165
+ if ( ! empty( $metaData['publisher'] ) ) {
166
+ if ( ! empty( $metaData['publisherImage'] ) ) {
167
+ $img = $KcSeoWPSchema->imageInfo( absint( $metaData['publisherImage'] ) );
168
+ $plA = array(
169
+ "@type" => "ImageObject",
170
+ "url" => $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' ),
171
+ "height" => $img['height'],
172
+ "width" => $img['width']
173
+ );
174
+ } else {
175
+ $plA = array();
176
+ }
177
+ $blogPosting["publisher"] = array(
178
+ "@type" => "Organization",
179
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['publisher'] ),
180
+ "logo" => $plA
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;
191
 
192
+ case 'event':
193
+ $event = array();
194
+ $event["@context"] = "http://schema.org";
195
+ $event["@type"] = "Event";
196
+ if ( ! empty( $metaData['name'] ) ) {
197
+ $event["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
198
+ }
199
+ if ( ! empty( $metaData['startDate'] ) ) {
200
+ $event["startDate"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['startDate'] );
201
+ }
202
+ if ( ! empty( $metaData['endDate'] ) ) {
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(
210
+ "@type" => "Person",
211
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['performerName'] )
212
+ );
213
+ }
214
+ if ( ! empty( $metaData['image'] ) ) {
215
+ $event["image"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['image'], 'url' );
216
+ }
217
+ if ( ! empty( $metaData['locationName'] ) ) {
218
+ $event["location"] = array(
219
+ "@type" => "Place",
220
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['locationName'] ),
221
+ "address" => $KcSeoWPSchema->sanitizeOutPut( $metaData['locationAddress'] )
222
+ );
223
+ }
224
+ if ( ! empty( $metaData['price'] ) ) {
225
+ $event["offers"] = array(
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'] ) ) {
233
+ $event["url"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['url'], 'url' );
234
+ }
235
+ $html .= $this->get_jsonEncode( $event );
236
+ break;
237
 
238
+ case 'product':
239
+ $product = array();
240
+ $product["@context"] = "http://schema.org";
241
+ $product["@type"] = "Product";
242
+ if ( ! empty( $metaData['name'] ) ) {
243
+ $product["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
244
+ }
245
+ if ( ! empty( $metaData['image'] ) ) {
246
+ $product["image"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['image'] );
247
+ }
248
+ if ( ! empty( $metaData['description'] ) ) {
249
+ $product["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'] );
250
+ }
251
+ if ( ! empty( $metaData['brand'] ) ) {
252
+ $product["brand"] = array(
253
+ "@type" => "Thing",
254
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['brand'] )
255
+ );
256
+ }
257
+ if ( ! empty( $metaData['ratingValue'] ) ) {
258
+ $product["aggregateRating"] = array(
259
+ "@type" => "AggregateRating",
260
+ "ratingValue" => ! empty( $metaData['ratingValue'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['ratingValue'] ) : null,
261
+ "reviewCount" => ! empty( $metaData['reviewCount'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['reviewCount'] ) : null
262
+ );
263
+ }
264
+ if ( ! empty( $metaData['price'] ) ) {
265
+ $product["offers"] = array(
266
+ "@type" => "Offer",
267
+ "price" => $KcSeoWPSchema->sanitizeOutPut( $metaData['price'] ),
268
+ "priceCurrency" => ! empty( $metaData['priceCurrency'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['priceCurrency'] ) : null,
269
+ "itemCondition" => ! empty( $metaData['itemCondition'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['itemCondition'] ) : null,
270
+ "availability" => ! empty( $metaData['availability'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['availability'] ) : null,
271
+ "url" => ! empty( $metaData['url'] ) ? $KcSeoWPSchema->sanitizeOutPut( $metaData['url'] ) : null
272
+ );
273
+ }
274
+ $html .= $this->get_jsonEncode( $product );
275
+ break;
276
 
277
+ case 'video':
278
+ $video = array();
279
+ $video["@context"] = "http://schema.org";
280
+ $video["@type"] = "VideoObject";
281
+ if ( ! empty( $metaData['name'] ) ) {
282
+ $video["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
283
+ }
284
+ if ( ! empty( $metaData['description'] ) ) {
285
+ $video["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
286
+ }
287
+ if ( ! empty( $metaData['description'] ) ) {
288
+ $video["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'] );
289
+ }
290
+ if ( ! empty( $metaData['thumbnailUrl'] ) ) {
291
+ $video["thumbnailUrl"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['thumbnailUrl'], 'url' );
292
+ }
293
+ if ( ! empty( $metaData['uploadDate'] ) ) {
294
+ $video["uploadDate"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['uploadDate'] );
295
+ }
296
+ if ( ! empty( $metaData['duration'] ) ) {
297
+ $video["duration"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['duration'] );
298
+ }
299
+ if ( ! empty( $metaData['contentUrl'] ) ) {
300
+ $video["contentUrl"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['contentUrl'], 'url' );
301
+ }
302
+ if ( ! empty( $metaData['interactionCount'] ) ) {
303
+ $video["interactionCount"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['interactionCount'] );
304
+ }
305
+ if ( ! empty( $metaData['expires'] ) ) {
306
+ $video["expires"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['expires'] );
307
+ }
308
+ $html .= $this->get_jsonEncode( $video );
309
+ break;
310
 
311
+ case 'service':
312
+ $service = array();
313
+ $service["@context"] = "http://schema.org";
314
+ $service["@type"] = "Service";
315
+ if ( ! empty( $metaData['name'] ) ) {
316
+ $service["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
317
+ }
318
+ if ( ! empty( $metaData['serviceType'] ) ) {
319
+ $service["serviceType"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['serviceType'] );
320
+ }
321
+ /*
322
+ if ( ! empty( $metaData['locationName'] ) ) {
323
+ $service["location"] = array(
324
+ "@type" => "Place",
325
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['locationName'] ),
326
+ "address" => $KcSeoWPSchema->sanitizeOutPut( $metaData['locationAddress'] )
327
+ );
328
+ }*/
329
+ if ( ! empty( $metaData['award'] ) ) {
330
+ $service["award"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['award'] );
331
+ }
332
+ if ( ! empty( $metaData['category'] ) ) {
333
+ $service["category"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['category'] );
334
+ }
335
+ if ( ! empty( $metaData['providerMobility'] ) ) {
336
+ $service["providerMobility"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['providerMobility'] );
337
+ }
338
+ if ( ! empty( $metaData['additionalType'] ) ) {
339
+ $service["additionalType"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['additionalType'] );
340
+ }
341
+ if ( ! empty( $metaData['alternateName'] ) ) {
342
+ $service["alternateName"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['alternateName'] );
343
+ }
344
+ if ( ! empty( $metaData['image'] ) ) {
345
+ $service["image"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['image'] );
346
+ }
347
+ if ( ! empty( $metaData['mainEntityOfPage'] ) ) {
348
+ $service["mainEntityOfPage"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['mainEntityOfPage'] );
349
+ }
350
+ if ( ! empty( $metaData['sameAs'] ) ) {
351
+ $service["sameAs"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['sameAs'] );
352
+ }
353
+ if ( ! empty( $metaData['url'] ) ) {
354
+ $service["url"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['url'], 'url' );
355
+ }
356
+ $html .= $this->get_jsonEncode( $service );
357
+ break;
358
 
359
+ case 'review':
360
+ $review = array();
361
+ $review["@context"] = "http://schema.org";
362
+ $review["@type"] = "Review";
363
+ if ( ! empty( $metaData['itemName'] ) ) {
364
+ $review["itemReviewed"] = array(
365
+ "@type" => "Thing",
366
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['itemName'] )
367
+ );
368
+ }
369
+ if ( ! empty( $metaData['ratingValue'] ) ) {
370
+ $review["reviewRating"] = array(
371
+ "@type" => "Rating",
372
+ "ratingValue" => $KcSeoWPSchema->sanitizeOutPut( $metaData['ratingValue'] ),
373
+ "bestRating" => $KcSeoWPSchema->sanitizeOutPut( $metaData['bestRating'] ),
374
+ "worstRating" => $KcSeoWPSchema->sanitizeOutPut( $metaData['worstRating'] )
375
+ );
376
+ }
377
+ if ( ! empty( $metaData['name'] ) ) {
378
+ $review["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
379
+ }
380
+ if ( ! empty( $metaData['author'] ) ) {
381
+ $review["author"] = array(
382
+ "@type" => "Person",
383
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['author'] )
384
+ );
385
+ }
386
+ if ( ! empty( $metaData['reviewBody'] ) ) {
387
+ $review["reviewBody"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['reviewBody'] );
388
+ }
389
+ if ( ! empty( $metaData['datePublished'] ) ) {
390
+ $review["datePublished"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['datePublished'] );
391
+ }
392
+ if ( ! empty( $metaData['publisher'] ) ) {
393
+ $review["publisher"] = array(
394
+ "@type" => "Organization",
395
+ "name" => $KcSeoWPSchema->sanitizeOutPut( $metaData['publisher'] )
396
+ );
397
+ }
398
+ $html .= $this->get_jsonEncode( $review );
399
+ break;
400
+ case 'aggregate_rating':
401
+ $aRating = array();
402
+ $aRating["@context"] = "http://schema.org";
403
+ $aRating["@type"] = ! empty( $metaData['schema_type'] ) ? $metaData['schema_type'] : "LocalBusiness";
404
+ if ( ! empty( $metaData['name'] ) ) {
405
+ $aRating["name"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['name'] );
406
+ }
407
+ if ( ! empty( $metaData['description'] ) ) {
408
+ $aRating["description"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['description'], 'textarea' );
409
+ }
410
+ if( $aRating["@type"] != "Organization"){
411
+ if ( ! empty( $metaData['image'] ) ) {
412
+ $img = $KcSeoWPSchema->imageInfo( absint( $metaData['image'] ) );
413
+ $aRating["image"] = array(
414
+ "@type" => "ImageObject",
415
+ "url" => $KcSeoWPSchema->sanitizeOutPut( $img['url'], 'url' ),
416
+ "height" => $img['height'],
417
+ "width" => $img['width']
418
+ );
419
+ }
420
+ if ( ! empty( $metaData['priceRange'] ) ) {
421
+ $aRating["priceRange"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['priceRange'] );
422
+ }
423
+ if ( ! empty( $metaData['telephone'] ) ) {
424
+ $aRating["telephone"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['telephone'] );
425
+ }
426
 
427
+ if ( ! empty( $metaData['address'] ) ) {
428
+ $aRating["address"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['address'] );
429
+ }
430
+ }
431
 
432
+ if ( ! empty( $metaData['ratingValue'] ) ) {
433
+ $rValue = array();
434
+ $rValue["@type"] = "AggregateRating";
435
+ $rValue["ratingValue"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['ratingValue'] );
436
+ if ( ! empty( $metaData['bestRating'] ) ) {
437
+ $rValue["bestRating"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['bestRating'] );
438
+ }
439
+ if ( ! empty( $metaData['worstRating'] ) ) {
440
+ $rValue["worstRating"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['worstRating'] );
441
+ }
442
+ if ( ! empty( $metaData['ratingCount'] ) ) {
443
+ $rValue["ratingCount"] = $KcSeoWPSchema->sanitizeOutPut( $metaData['ratingCount'] );
444
+ }
445
 
446
+ $aRating["aggregateRating"] = $rValue;
447
+ }
448
+ $html .= $this->get_jsonEncode( $aRating );
449
+ break;
450
 
451
+ default:
452
+ break;
453
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
 
455
+ }
456
 
457
+ return $html;
458
+ }
 
 
459
 
460
+ function get_field( $data ) {
461
+ $html = null;
462
+ global $KcSeoWPSchema;
463
+ $id = $data['id'];
464
+ $name = $data['name'];
465
+ $value = $data['value'];
 
466
 
467
+ $class = isset( $data['class'] ) ? ( $data['class'] ? $data['class'] : null ) : null;
468
+ $require = ( isset( $data['required'] ) ? ( $data['required'] ? "<span class='required'>*</span>" : null ) : null );
469
+ $title = ( isset( $data['title'] ) ? ( $data['title'] ? $data['title'] : null ) : null );
470
+ $desc = ( isset( $data['desc'] ) ? ( $data['desc'] ? $data['desc'] : null ) : null );
471
+ $holderClass = ( !empty( $data['holderClass'] ) ? $data['holderClass'] : null );
472
+ $html .= "<div class='field-container {$holderClass}' id='" . $id . '-container' . "'>";
473
+ $html .= "<label class='field-label' for='{$id}'>{$title}{$require}</label>";
474
+ $html .= "<div class='field-content' id='" . $id . '-content' . "'>";
475
+ switch ( $data['type'] ) {
476
+ case 'checkbox':
477
+ $checked = ( $value ? "checked" : null );
478
+ $html .= "<div class='kSeo-checkbox-wrapper'>";
479
+ $html .= "<label for='{$id}'><input type='checkbox' id='{$id}' class='{$class}' name='{$name}' {$checked} value='1' /> Enable</label>";
480
+ $html .= "</div>";
481
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
 
483
+ case 'text':
484
+ $html .= "<input type='text' id='{$id}' class='{$class}' name='{$name}' value='" . esc_html( $value ) . "' />";
485
+ break;
 
 
486
 
487
+ case 'number':
488
+ if ( $data['fieldId'] == 'price' ) {
489
+ $html .= "<input type='number' step='any' id='{$id}' class='{$class}' name='{$name}' value='" . esc_attr( $value ) . "' />";
490
+ } else {
491
+ $html .= "<input type='number' id='{$id}' class='{$class}' name='{$name}' value='" . esc_attr( $value ) . "' />";
492
+ }
493
+ break;
494
+ case 'textarea':
495
+ $html .= "<textarea id='{$id}' class='{$class}' name='{$name}' >" . wp_kses( $value, array() ) . "</textarea>";
496
+ break;
497
 
498
+ case 'image':
499
+ $html .= '<div class="kSeo-image">';
500
+ $ImageId = ! empty( $value ) ? absint( $value ) : 0;
501
+ $image = $ingInfo = null;
502
+ if ( $ImageId ) {
503
+ $image = wp_get_attachment_image( $ImageId, "thumbnail" );
504
+ $imgData = $KcSeoWPSchema->imageInfo( $ImageId );
505
+ $ingInfo .= "<span><strong>URL: </strong>{$imgData['url']}</span>";
506
+ $ingInfo .= "<span><strong>Width: </strong>{$imgData['width']}px</span>";
507
+ $ingInfo .= "<span><strong>Height: </strong>{$imgData['height']}px</span>";
508
+ }
509
+ $html .= "<div class='kSeo-image-wrapper'>";
510
+ $html .= '<span class="kSeoImgAdd"><span class="dashicons dashicons-plus-alt"></span></span>';
511
+ $html .= '<span class="kSeoImgRemove ' . ( $image ? null : "kSeo-hidden" ) . '"><span class="dashicons dashicons-trash"></span></span>';
512
+ $html .= '<div class="kSeo-image-preview">' . $image . '</div>';
513
+ $html .= "<input type='hidden' name='{$name}' value='" . absint( $ImageId ) . "' />";
514
+ $html .= "</div>";
515
+ $html .= "<div class='image-info'>{$ingInfo}</div>";
516
+ $html .= '</div>';
517
+ break;
518
+ case 'select':
519
+ $html .= "<select name='{$name}' class='select2 {$class}' id='{$id}'>";
520
+ if ( ! empty( $data['empty'] ) ) {
521
+ $html .= "<option value=''>{$data['empty']}</option>";
522
+ }
523
+ if ( ! empty( $data['options'] ) && is_array( $data['options'] ) ) {
524
+ if ( $this->isAssoc( $data['options'] ) ) {
525
+ foreach ( $data['options'] as $optKey => $optValue ) {
526
+ $slt = ( $optKey == $value ? "selected" : null );
527
+ $html .= "<option value='" . esc_attr( $optKey ) . "' {$slt}>" . esc_html( $optValue ) . "</option>";
528
+ }
529
+ } else {
530
+ foreach ( $data['options'] as $optValue ) {
531
+ $slt = ( $optValue == $value ? "selected" : null );
532
+ $html .= "<option value='" . esc_attr( $optValue ) . "' {$slt}>" . esc_html( $optValue ) . "</option>";
533
+ }
534
+ }
535
+ }
536
+ $html .= "</select>";
537
+ break;
538
+ default:
539
+ $html .= "<input id='{$id}' type='{$data['type']}' value='" . esc_attr( $value ) . "' name='$name' />";
540
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
 
542
+ }
543
+ $html .= "<p class='description'>{$desc}</p>";
544
+ $html .= "</div>";
545
+ $html .= "</div>";
 
 
 
 
546
 
547
+ return $html;
548
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
 
550
+ public function schemaTypes() {
551
+ return array(
552
+ 'article' => array(
553
+ 'title' => "Article",
554
+ 'fields' => array(
555
+ 'active' => array(
556
+ 'type' => 'checkbox'
557
+ ),
558
+ 'headline' => array(
559
+ 'title' => 'Headline',
560
+ 'type' => 'text',
561
+ 'desc' => 'Article title',
562
+ 'required' => true
563
+ ),
564
+ 'mainEntityOfPage' => array(
565
+ 'title' => 'Page URL',
566
+ 'type' => 'url',
567
+ 'desc' => 'The canonical URL of the article page',
568
+ 'required' => true
569
+ ),
570
+ 'author' => array(
571
+ 'title' => 'Author Name',
572
+ 'type' => 'text',
573
+ 'desc' => 'Author display name',
574
+ 'required' => true
575
+ ),
576
+ 'image' => array(
577
+ 'title' => 'Article Feature Image',
578
+ 'type' => 'image',
579
+ 'required' => true,
580
+ 'desc' => 'Images should be at least 696 pixels wide.<br>Images should be in .jpg, .png, or. gif format.'
581
+ ),
582
+ 'datePublished' => array(
583
+ 'title' => 'Published date',
584
+ 'type' => 'text',
585
+ 'class' => 'kcseo-date',
586
+ 'required' => true,
587
+ 'desc' => 'Like this: 2015-12-25'
588
+ ),
589
+ 'dateModified' => array(
590
+ 'title' => 'Modified date',
591
+ 'type' => 'text',
592
+ 'class' => 'kcseo-date',
593
+ 'required' => true,
594
+ 'desc' => 'Like this: 2015-12-25'
595
+ ),
596
+ 'publisher' => array(
597
+ 'title' => 'Publisher',
598
+ 'type' => 'text',
599
+ 'desc' => 'Publisher name or Organization name',
600
+ 'required' => true
601
+ ),
602
+ 'publisherImage' => array(
603
+ 'title' => 'Publisher Logo',
604
+ 'type' => 'image',
605
+ 'desc' => 'Logos should have a wide aspect ratio, not a square icon.<br>Logos should be no wider than 600px, and no taller than 60px.<br>Always retain the original aspect ratio of the logo when resizing. Ideally, logos are exactly 60px tall with width <= 600px. If maintaining a height of 60px would cause the width to exceed 600px, downscale the logo to exactly 600px wide and reduce the height accordingly below 60px to maintain the original aspect ratio.<br>',
606
+ 'required' => true
607
+ ),
608
+ 'description' => array(
609
+ 'title' => 'Description',
610
+ 'type' => 'textarea',
611
+ 'desc' => 'Short description'
612
+ ),
613
+ 'articleBody' => array(
614
+ 'title' => 'Article body',
615
+ 'type' => 'textarea',
616
+ 'desc' => 'Article content'
617
+ ),
618
+ 'alternativeHeadline' => array(
619
+ 'title' => 'Alternative headline',
620
+ 'type' => 'text',
621
+ 'desc' => 'A secondary headline for the article.'
622
+ ),
623
+ )
624
+ ),
625
+ 'blog_posting' => array(
626
+ 'title' => 'Blog Posting',
627
+ 'fields' => array(
628
+ 'active' => array(
629
+ 'type' => 'checkbox'
630
+ ),
631
+ 'headline' => array(
632
+ 'title' => 'Headline',
633
+ 'type' => 'text',
634
+ 'desc' => 'Blog posting title',
635
+ 'required' => true
636
+ ),
637
+ 'mainEntityOfPage' => array(
638
+ 'title' => 'Page URL',
639
+ 'type' => 'url',
640
+ 'desc' => 'The canonical URL of the article page',
641
+ 'required' => true
642
+ ),
643
+ 'author' => array(
644
+ 'title' => 'Author name',
645
+ 'type' => 'text',
646
+ 'desc' => 'Author display name',
647
+ 'required' => true
648
+ ),
649
+ 'image' => array(
650
+ 'title' => 'Feature Image',
651
+ 'type' => 'image',
652
+ 'desc' => "The representative image of the article. Only a marked-up image that directly belongs to the article should be specified.<br> Images should be at least 696 pixels wide. <br>Images should be in .jpg, .png, or. gif format.",
653
+ 'required' => true
654
+ ),
655
+ 'datePublished' => array(
656
+ 'title' => 'Published date',
657
+ 'type' => 'text',
658
+ 'class' => 'kcseo-date',
659
+ 'desc' => 'Like this: 2015-12-25',
660
+ 'required' => true
661
+ ),
662
+ 'dateModified' => array(
663
+ 'title' => 'Modified date',
664
+ 'type' => 'text',
665
+ 'class' => 'kcseo-date',
666
+ 'desc' => 'Like this: 2015-12-25',
667
+ 'required' => true
668
+ ),
669
+ 'publisher' => array(
670
+ 'title' => 'Publisher',
671
+ 'type' => 'text',
672
+ 'desc' => 'Publisher name or Organization name',
673
+ 'required' => true
674
+ ),
675
+ 'publisherImage' => array(
676
+ 'title' => 'Publisher Logo',
677
+ 'type' => 'image',
678
+ 'desc' => "Logos should have a wide aspect ratio, not a square icon.<br>Logos should be no wider than 600px, and no taller than 60px.<br>Always retain the original aspect ratio of the logo when resizing. Ideally, logos are exactly 60px tall with width <= 600px. If maintaining a height of 60px would cause the width to exceed 600px, downscale the logo to exactly 600px wide and reduce the height accordingly below 60px to maintain the original aspect ratio.<br>",
679
+ 'required' => true
680
+ ),
681
+ 'description' => array(
682
+ 'title' => 'Description',
683
+ 'type' => 'textarea',
684
+ 'desc' => 'Short description'
685
+ ),
686
+ 'articleBody' => array(
687
+ 'title' => 'Article body',
688
+ 'type' => 'textarea',
689
+ 'desc' => 'Article content'
690
+ )
691
+ )
692
+ ),
693
+ 'news_article' => array(
694
+ 'title' => 'News Article',
695
+ 'fields' => array(
696
+ 'active' => array(
697
+ 'type' => 'checkbox'
698
+ ),
699
+ 'headline' => array(
700
+ 'title' => 'Headline',
701
+ 'type' => 'text',
702
+ 'desc' => 'Article title',
703
+ 'required' => true
704
+ ),
705
+ 'mainEntityOfPage' => array(
706
+ 'title' => 'Page URL',
707
+ 'type' => 'url',
708
+ 'desc' => 'The canonical URL of the article page',
709
+ 'required' => true
710
+ ),
711
+ 'author' => array(
712
+ 'title' => 'Author',
713
+ 'type' => 'text',
714
+ 'desc' => 'Author display name',
715
+ 'required' => true
716
+ ),
717
+ 'image' => array(
718
+ 'title' => 'Image',
719
+ 'type' => 'image',
720
+ 'desc' => "The representative image of the article. Only a marked-up image that directly belongs to the article should be specified.<br> Images should be at least 696 pixels wide. <br>Images should be in .jpg, .png, or. gif format.",
721
+ 'required' => true
722
+ ),
723
+ 'datePublished' => array(
724
+ 'title' => 'Published date',
725
+ 'type' => 'text',
726
+ 'class' => 'kcseo-date',
727
+ 'desc' => 'Like this: 2015-12-25',
728
+ 'required' => true
729
+ ),
730
+ 'dateModified' => array(
731
+ 'title' => 'Modified date',
732
+ 'type' => 'text',
733
+ 'class' => 'kcseo-date',
734
+ 'required' => true,
735
+ 'desc' => 'Like this: 2015-12-25'
736
+ ),
737
+ 'publisher' => array(
738
+ 'title' => 'Publisher',
739
+ 'type' => 'text',
740
+ 'desc' => 'Publisher name or Organization name',
741
+ 'required' => true
742
+ ),
743
+ 'publisherImage' => array(
744
+ 'title' => 'Publisher Logo',
745
+ 'type' => 'image',
746
+ 'desc' => 'Logos should have a wide aspect ratio, not a square icon.<br>Logos should be no wider than 600px, and no taller than 60px.<br>Always retain the original aspect ratio of the logo when resizing. Ideally, logos are exactly 60px tall with width <= 600px. If maintaining a height of 60px would cause the width to exceed 600px, downscale the logo to exactly 600px wide and reduce the height accordingly below 60px to maintain the original aspect ratio.<br>',
747
+ 'required' => true
748
+ ),
749
+ 'description' => array(
750
+ 'title' => 'Description',
751
+ 'type' => 'textarea',
752
+ 'desc' => 'Short description'
753
+ ),
754
+ 'articleBody' => array(
755
+ 'title' => 'Article body',
756
+ 'type' => 'textarea',
757
+ 'desc' => 'Article body content'
758
+ )
759
+ )
760
+ ),
761
+ 'event' => array(
762
+ 'title' => 'Event',
763
+ 'fields' => array(
764
+ 'active' => array(
765
+ 'type' => 'checkbox'
766
+ ),
767
+ 'name' => array(
768
+ 'title' => 'Name',
769
+ 'type' => 'text',
770
+ 'required' => true,
771
+ 'desc' => "The name of the event."
772
+ ),
773
+ 'locationName' => array(
774
+ 'title' => 'Location name',
775
+ 'type' => 'text',
776
+ 'required' => true,
777
+ 'desc' => "Event Location name"
778
+ ),
779
+ 'locationAddress' => array(
780
+ 'title' => 'Location address',
781
+ 'type' => 'text',
782
+ 'required' => true,
783
+ 'desc' => "The location of for example where the event is happening, an organization is located, or where an action takes place."
784
+ ),
785
+ 'startDate' => array(
786
+ 'title' => 'Start date',
787
+ 'type' => 'text',
788
+ 'class' => 'kcseo-date',
789
+ 'required' => true,
790
+ 'desc' => "Event start date"
791
+ ),
792
+ 'endDate' => array(
793
+ 'title' => 'End date (Recommended)',
794
+ 'type' => 'text',
795
+ 'class' => 'kcseo-date',
796
+ 'desc' => "Event end date"
797
+ ),
798
+ 'description' => array(
799
+ 'title' => 'Description (Recommended)',
800
+ 'type' => 'textarea',
801
+ 'desc' => "Event description"
802
+ ),
803
+ 'performerName' => array(
804
+ 'title' => 'Performer Name (Recommended)',
805
+ 'type' => 'text',
806
+ 'desc' => "The performer's name."
807
+ ),
808
+ 'image' => array(
809
+ 'title' => 'Image URL (Recommended)',
810
+ 'type' => 'url',
811
+ 'desc' => "URL of an image or logo for the event or tour"
812
+ ),
813
+ 'price' => array(
814
+ 'title' => 'Price (Recommended)',
815
+ 'type' => 'number',
816
+ '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>"
817
+ ),
818
+ 'priceCurrency' => array(
819
+ 'title' => 'Price currency',
820
+ 'type' => 'text',
821
+ 'desc' => "The 3-letter currency code. (USD)"
822
+ ),
823
+ 'url' => array(
824
+ 'title' => 'URL (Recommended)',
825
+ 'type' => 'url',
826
+ 'placeholder' => 'URL',
827
+ 'desc' => "A link to the event's details page. <span class='required'>Not required but (Recommended)</span>"
828
+ ),
829
+ )
830
+ ),
831
+ 'product' => array(
832
+ 'title' => 'Product',
833
+ 'fields' => array(
834
+ 'active' => array(
835
+ 'type' => 'checkbox'
836
+ ),
837
+ 'name' => array(
838
+ 'title' => 'Name',
839
+ 'type' => 'text',
840
+ 'required' => true,
841
+ 'desc' => "The name of the product."
842
+ ),
843
+ 'image' => array(
844
+ 'title' => 'Image',
845
+ 'type' => 'image',
846
+ 'desc' => "The URL of a product photo. Pictures clearly showing the product, e.g. against a white background, are preferred."
847
+ ),
848
+ 'description' => array(
849
+ 'title' => 'Description',
850
+ 'type' => 'textarea',
851
+ 'desc' => "Product description."
852
+ ),
853
+ 'brand' => array(
854
+ 'title' => 'Brand',
855
+ 'type' => 'text',
856
+ 'desc' => "The brand of the product."
857
+ ),
858
+ 'ratingValue' => array(
859
+ 'title' => 'Ratting value',
860
+ 'type' => 'text',
861
+ 'desc' => "Rating value. (1 , 2.5, 3, 5 etc)"
862
+ ),
863
+ 'reviewCount' => array(
864
+ 'title' => 'Total review count',
865
+ 'type' => 'number',
866
+ 'desc' => "Rating ratting value. <span class='required'>This is required if (Ratting value) is given</span>"
867
+ ),
868
+ 'price' => array(
869
+ 'title' => 'Price',
870
+ 'type' => 'number',
871
+ 'desc' => "The lowest available price, including service charges and fees, of this type of ticket."
872
+ ),
873
+ 'priceCurrency' => array(
874
+ 'title' => 'Price currency',
875
+ 'type' => 'text',
876
+ 'desc' => "The 3-letter currency code."
877
+ ),
878
+ 'availability' => array(
879
+ 'title' => 'Availability',
880
+ 'type' => 'select',
881
+ 'empty' => "Select one",
882
+ 'options' => array(
883
+ 'http://schema.org/InStock' => 'InStock',
884
+ 'http://schema.org/InStoreOnly' => 'InStoreOnly',
885
+ 'http://schema.org/OutOfStock' => 'OutOfStock',
886
+ 'http://schema.org/SoldOut' => 'SoldOut',
887
+ 'http://schema.org/OnlineOnly' => 'OnlineOnly',
888
+ 'http://schema.org/LimitedAvailability' => 'LimitedAvailability',
889
+ 'http://schema.org/Discontinued' => 'Discontinued',
890
+ 'http://schema.org/PreOrder' => 'PreOrder',
891
+ ),
892
+ 'desc' => "Select a availability type",
893
+ ),
894
+ 'itemCondition' => array(
895
+ 'title' => 'Product condition',
896
+ 'type' => 'select',
897
+ 'empty' => "Select one",
898
+ 'options' => array(
899
+ 'http://schema.org/NewCondition' => 'NewCondition',
900
+ 'http://schema.org/UsedCondition' => 'UsedCondition',
901
+ 'http://schema.org/DamagedCondition' => 'DamagedCondition',
902
+ 'http://schema.org/RefurbishedCondition' => 'RefurbishedCondition',
903
+ ),
904
+ 'desc' => "Select a condition"
905
+ ),
906
+ 'url' => array(
907
+ 'title' => 'Product URL',
908
+ 'type' => 'url',
909
+ 'desc' => "A URL to the product web page (that includes the Offer). (Don't use offerURL for markup that appears on the product page itself.)"
910
+ ),
911
+ )
912
+ ),
913
+ 'video' => array(
914
+ 'title' => 'Video',
915
+ 'fields' => array(
916
+ 'active' => array(
917
+ 'type' => 'checkbox'
918
+ ),
919
+ 'name' => array(
920
+ 'title' => 'Name',
921
+ 'type' => 'text',
922
+ 'required' => true,
923
+ 'desc' => "The title of the video"
924
+ ),
925
+ 'description' => array(
926
+ 'title' => 'Description',
927
+ 'type' => 'textarea',
928
+ 'required' => true,
929
+ 'desc' => "The description of the video"
930
+ ),
931
+ 'thumbnailUrl' => array(
932
+ 'title' => 'Thumbnail URL',
933
+ 'type' => 'url',
934
+ 'placeholder' => "URL",
935
+ 'required' => true,
936
+ 'desc' => "A URL pointing to the video thumbnail image file. Images must be at least 160x90 pixels and at most 1920x1080 pixels."
937
+ ),
938
+ 'uploadDate' => array(
939
+ 'title' => 'Updated date',
940
+ 'type' => 'text',
941
+ 'class' => 'kcseo-date',
942
+ 'desc' => '2015-02-05T08:00:00+08:00'
943
+ ),
944
+ 'duration' => array(
945
+ 'title' => 'Duration',
946
+ 'type' => 'text',
947
+ 'desc' => "The duration of the video in ISO 8601 format.(PT1M33S)"
948
+ ),
949
+ 'contentUrl' => array(
950
+ 'title' => 'Content URL',
951
+ 'type' => 'url',
952
+ 'placeholder' => 'URL',
953
+ 'desc' => "A URL pointing to the actual video media file. This file should be in .mpg, .mpeg, .mp4, .m4v, .mov, .wmv, .asf, .avi, .ra, .ram, .rm, .flv, or other video file format."
954
+ ),
955
+ 'embedUrl' => array(
956
+ 'title' => 'Embed URL',
957
+ 'placeholder' => 'URL',
958
+ 'type' => 'url',
959
+ 'desc' => "A URL pointing to a player for the specific video. Usually this is the information in the src element of an < embed> tag.Example: Dailymotion: http://www.dailymotion.com/swf/x1o2g."
960
+ ),
961
+ 'interactionCount' => array(
962
+ 'title' => 'Interaction count',
963
+ 'type' => 'text',
964
+ 'desc' => "The number of times the video has been viewed."
965
+ ),
966
+ 'expires' => array(
967
+ 'title' => 'Expires',
968
+ 'type' => 'text',
969
+ 'class' => 'kcseo-date',
970
+ 'desc' => "Like this: 2015-12-25"
971
+ ),
972
+ )
973
+ ),
974
+ 'service' => array(
975
+ 'title' => 'Service',
976
+ 'fields' => array(
977
+ 'active' => array(
978
+ 'type' => 'checkbox'
979
+ ),
980
+ 'name' => array(
981
+ 'title' => 'Name',
982
+ 'type' => 'text',
983
+ 'required' => true,
984
+ 'desc' => "The name of the Service."
985
+ ),
986
+ 'serviceType' => array(
987
+ 'title' => 'Service type',
988
+ 'type' => 'text',
989
+ 'required' => true,
990
+ 'desc' => "The type of service being offered, e.g. veterans' benefits, emergency relief, etc."
991
+ ),
992
+ 'additionalType' => array(
993
+ 'title' => 'Additional type(URL)',
994
+ 'type' => 'url',
995
+ 'placeholder' => 'URL',
996
+ 'desc' => "An additional type for the service, typically used for adding more specific types from external vocabularies in microdata syntax."
997
+ ),
998
+ 'award' => array(
999
+ 'title' => 'Award',
1000
+ 'type' => 'text',
1001
+ 'desc' => "An award won by or for this service."
1002
+ ),
1003
+ 'category' => array(
1004
+ 'title' => 'Category',
1005
+ 'type' => 'text',
1006
+ 'desc' => "A category for the service."
1007
+ ),
1008
+ 'providerMobility' => array(
1009
+ 'title' => 'Provider mobility',
1010
+ 'type' => 'text',
1011
+ 'desc' => "Indicates the mobility of a provided service (e.g. 'static', 'dynamic')."
1012
+ ),
1013
+ 'description' => array(
1014
+ 'title' => 'Description',
1015
+ 'type' => 'textarea',
1016
+ 'require' => true,
1017
+ 'desc' => "A short description of the service."
1018
+ ),
1019
+ 'image' => array(
1020
+ 'title' => 'Image URL',
1021
+ 'type' => 'url',
1022
+ 'require' => false,
1023
+ 'desc' => "An image of the service. This should be a URL."
1024
+ ),
1025
+ 'mainEntityOfPage' => array(
1026
+ 'title' => 'Main entity of page URL',
1027
+ 'type' => 'url',
1028
+ 'require' => false,
1029
+ 'desc' => "Indicates a page (or other CreativeWork) for which this thing is the main entity being described."
1030
+ ),
1031
+ 'sameAs' => array(
1032
+ 'title' => 'Same as URL',
1033
+ 'type' => 'url',
1034
+ 'placeholder' => 'URL',
1035
+ 'desc' => "URL of a reference Web page that unambiguously indicates the service's identity. E.g. the URL of the service's Wikipedia page, Freebase page, or official website."
1036
+ ),
1037
+ 'url' => array(
1038
+ 'title' => 'Url of the service',
1039
+ 'type' => 'url',
1040
+ 'placeholder' => 'URL',
1041
+ 'desc' => "URL of the service."
1042
+ ),
1043
+ 'alternateName' => array(
1044
+ 'title' => 'Alternate name',
1045
+ 'type' => 'text',
1046
+ 'desc' => 'An alias for the service.'
1047
+ ),
1048
+ )
1049
+ ),
1050
+ 'review' => array(
1051
+ 'title' => 'Review',
1052
+ 'fields' => array(
1053
+ 'active' => array(
1054
+ 'type' => 'checkbox'
1055
+ ),
1056
+ 'itemName' => array(
1057
+ 'title' => 'Name of the reviewed item',
1058
+ 'type' => 'text',
1059
+ 'required' => true,
1060
+ 'desc' => "The item that is being reviewed."
1061
+ ),
1062
+ 'reviewBody' => array(
1063
+ 'title' => 'Review body',
1064
+ 'type' => 'text',
1065
+ 'required' => true,
1066
+ 'desc' => "The actual body of the review."
1067
+ ),
1068
+ 'name' => array(
1069
+ 'title' => 'Review name',
1070
+ 'type' => 'text',
1071
+ 'required' => true,
1072
+ 'desc' => "A particular name for the review."
1073
+ ),
1074
+ 'author' => array(
1075
+ 'title' => 'Author',
1076
+ 'type' => 'text',
1077
+ 'required' => true,
1078
+ 'author' => 'Author name',
1079
+ 'desc' => "The author of the review. The reviewer’s name needs to be a valid name."
1080
+ ),
1081
+ 'datePublished' => array(
1082
+ 'title' => 'Date of Published',
1083
+ 'type' => 'text',
1084
+ 'class' => 'kcseo-date',
1085
+ 'desc' => "Like this: 2015-12-25"
1086
+ ),
1087
+ 'ratingValue' => array(
1088
+ 'title' => 'Rating value',
1089
+ 'type' => 'number',
1090
+ 'desc' => "A numerical quality rating for the item."
1091
+ ),
1092
+ 'bestRating' => array(
1093
+ 'title' => 'Best rating',
1094
+ 'type' => 'number',
1095
+ 'desc' => "The highest value allowed in this rating system."
1096
+ ),
1097
+ 'worstRating' => array(
1098
+ 'title' => 'Worst rating',
1099
+ 'type' => 'number',
1100
+ '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."
1101
+ ),
1102
+ 'publisher' => array(
1103
+ 'title' => 'Name of the organization',
1104
+ 'type' => 'text',
1105
+ 'desc' => 'The publisher of the review.'
1106
+ )
1107
+ )
1108
+ ),
1109
+ 'aggregate_rating' => array(
1110
+ 'title' => 'Aggregate Ratings',
1111
+ 'fields' => array(
1112
+ 'active' => array(
1113
+ 'type' => 'checkbox'
1114
+ ),
1115
+ 'schema_type' => array(
1116
+ 'title' => 'Schema type',
1117
+ 'type' => 'select',
1118
+ 'required' => true,
1119
+ 'options' => $this->site_type(),
1120
+ 'empty' => "Select one",
1121
+ 'desc' => "Use the most appropriate schema type for what is being reviewed."
1122
+ ),
1123
+ 'name' => array(
1124
+ 'title' => 'Name of the item',
1125
+ 'type' => 'text',
1126
+ 'required' => true,
1127
+ 'desc' => "The item that is being rated."
1128
+ ),
1129
+ 'image' => array(
1130
+ 'title' => 'Image',
1131
+ 'type' => 'image',
1132
+ 'required' => true,
1133
+ 'holderClass' => 'kSeo-hidden aggregate-except-organization-holder'
1134
+ ),
1135
+ 'priceRange' => array(
1136
+ 'title' => 'Price Range (Recommended)',
1137
+ 'type' => 'text',
1138
+ 'holderClass' => 'kSeo-hidden aggregate-except-organization-holder',
1139
+ 'desc' => "The price range of the business, for example $$$."
1140
+ ),
1141
+ 'telephone' => array(
1142
+ 'title' => 'Telephone (Recommended)',
1143
+ 'type' => 'text',
1144
+ 'holderClass' => 'kSeo-hidden aggregate-except-organization-holder'
1145
+ ),
1146
+ 'address' => array(
1147
+ 'title' => 'Address (Recommended)',
1148
+ 'type' => 'text',
1149
+ 'holderClass' => 'kSeo-hidden aggregate-except-organization-holder',
1150
+ ),
1151
+ 'description' => array(
1152
+ 'title' => 'Description',
1153
+ 'type' => 'textarea',
1154
+ 'desc' => "Description for thr review"
1155
+ ),
1156
+ 'ratingCount' => array(
1157
+ 'title' => 'Rating Count',
1158
+ 'type' => 'number',
1159
+ 'required' => true,
1160
+ '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>"
1161
+ ),
1162
+ 'reviewCount' => array(
1163
+ 'title' => 'Review Count',
1164
+ 'type' => 'number',
1165
+ 'required' => true,
1166
+ '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."
1167
+ ),
1168
+ 'ratingValue' => array(
1169
+ 'title' => 'Rating Value',
1170
+ 'type' => 'number',
1171
+ 'required' => true,
1172
+ 'desc' => "A numerical quality rating for the item."
1173
+ ),
1174
+ 'ratingValue' => array(
1175
+ 'title' => 'Rating Value',
1176
+ 'type' => 'number',
1177
+ 'required' => true,
1178
+ 'desc' => "A numerical quality rating for the item."
1179
+ ),
1180
+ 'bestRating' => array(
1181
+ 'title' => 'Best Rating',
1182
+ 'type' => 'number',
1183
+ 'required' => true,
1184
+ '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."
1185
+ ),
1186
+ 'worstRating' => array(
1187
+ 'title' => 'Worst Rating',
1188
+ 'type' => 'number',
1189
+ 'required' => true,
1190
+ '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."
1191
+ )
1192
+ )
1193
+ )
1194
+ );
1195
+ }
1196
 
1197
+ function get_jsonEncode( $data = array() ) {
1198
+ $html = null;
1199
+ /** @var TYPE_NAME $data */
1200
+ if ( ! empty( $data ) && is_array( $data ) ) {
1201
+ $html .= '<script type="application/ld+json">' . json_encode( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) . '</script>';
1202
+ }
 
 
 
 
 
 
 
 
 
1203
 
1204
+ return $html;
1205
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1206
 
1207
+ function site_type() {
1208
+ return array(
1209
+ 'Organization',
1210
+ 'LocalBusiness',
1211
+ 'AccountingService',
1212
+ 'Attorney',
1213
+ 'AutoBodyShop',
1214
+ 'AutoDealer',
1215
+ 'AutoPartsStore',
1216
+ 'AutoRental',
1217
+ 'AutoRepair',
1218
+ 'AutoWash',
1219
+ 'Bakery',
1220
+ 'BarOrPub',
1221
+ 'BeautySalon',
1222
+ 'BedAndBreakfast',
1223
+ 'BikeStore',
1224
+ 'BookStore',
1225
+ 'CafeOrCoffeeShop',
1226
+ 'ChildCare',
1227
+ 'ClothingStore',
1228
+ 'ComputerStore',
1229
+ 'DaySpa',
1230
+ 'Dentist',
1231
+ 'DryCleaningOrLaundry',
1232
+ 'Electrician',
1233
+ 'ElectronicsStore',
1234
+ 'EmergencyService',
1235
+ 'EntertainmentBusiness',
1236
+ 'EventVenue',
1237
+ 'ExerciseGym',
1238
+ 'FinancialService',
1239
+ 'Florist',
1240
+ 'FoodEstablishment',
1241
+ 'FurnitureStore',
1242
+ 'GardenStore',
1243
+ 'GeneralContractor',
1244
+ 'GolfCourse',
1245
+ 'HairSalon',
1246
+ 'HardwareStore',
1247
+ 'HealthAndBeautyBusiness',
1248
+ 'HobbyShop',
1249
+ 'Store',
1250
+ 'HomeAndConstructionBusiness',
1251
+ 'HomeGoodsStore',
1252
+ 'Hospital',
1253
+ 'Hotel',
1254
+ 'HousePainter',
1255
+ 'HVACBusiness',
1256
+ 'HVACBusiness',
1257
+ 'InsuranceAgency',
1258
+ 'JewelryStore',
1259
+ 'LiquorStore',
1260
+ 'Locksmith',
1261
+ 'LodgingBusiness',
1262
+ 'MedicalClinic',
1263
+ 'MensClothingStore',
1264
+ 'MobilePhoneStore',
1265
+ 'Motel',
1266
+ 'MotorcycleDealer',
1267
+ 'MotorcycleRepair',
1268
+ 'MovingCompany',
1269
+ 'MusicStore',
1270
+ 'NailSalon',
1271
+ 'NightClub',
1272
+ 'Notary',
1273
+ 'OfficeEquipmentStore',
1274
+ 'Optician',
1275
+ 'Person',
1276
+ 'PetStore',
1277
+ 'Physician',
1278
+ 'Plumber',
1279
+ 'ProfessionalService',
1280
+ 'RealEstateAgent',
1281
+ 'Residence',
1282
+ 'Restaurant',
1283
+ 'RoofingContractor',
1284
+ 'RVPark',
1285
+ 'School',
1286
+ 'SelfStorage',
1287
+ 'ShoeStore',
1288
+ 'SkiResort',
1289
+ 'SportingGoodsStore',
1290
+ 'SportsClub',
1291
+ 'Store',
1292
+ 'TattooParlor',
1293
+ 'Taxi',
1294
+ 'TennisComplex',
1295
+ 'TireShop',
1296
+ 'ToyStore',
1297
+ 'TravelAgency',
1298
+ 'VeterinaryCare',
1299
+ 'WholesaleStore',
1300
+ 'Winery'
1301
+ );
1302
+ }
1303
 
1304
+ function countryList() {
1305
+ return array(
1306
+ "AF" => "Afghanistan",
1307
+ "AX" => "Aland Islands",
1308
+ "AL" => "Albania",
1309
+ "DZ" => "Algeria",
1310
+ "AS" => "American Samoa",
1311
+ "AD" => "Andorra",
1312
+ "AO" => "Angola",
1313
+ "AI" => "Anguilla",
1314
+ "AQ" => "Antarctica",
1315
+ "AG" => "Antigua and Barbuda",
1316
+ "AR" => "Argentina",
1317
+ "AM" => "Armenia",
1318
+ "AW" => "Aruba",
1319
+ "AU" => "Australia",
1320
+ "AT" => "Austria",
1321
+ "AZ" => "Azerbaijan",
1322
+ "BS" => "Bahamas",
1323
+ "BH" => "Bahrain",
1324
+ "BD" => "Bangladesh",
1325
+ "BB" => "Barbados",
1326
+ "BY" => "Belarus",
1327
+ "BE" => "Belgium",
1328
+ "BZ" => "Belize",
1329
+ "BJ" => "Benin",
1330
+ "BM" => "Bermuda",
1331
+ "BT" => "Bhutan",
1332
+ "BO" => "Bolivia, Plurinational State of",
1333
+ "BQ" => "Bonaire, Sint Eustatius and Saba",
1334
+ "BA" => "Bosnia and Herzegovina",
1335
+ "BW" => "Botswana",
1336
+ "BV" => "Bouvet Island",
1337
+ "BR" => "Brazil",
1338
+ "IO" => "British Indian Ocean Territory",
1339
+ "BN" => "Brunei Darussalam",
1340
+ "BG" => "Bulgaria",
1341
+ "BF" => "Burkina Faso",
1342
+ "BI" => "Burundi",
1343
+ "KH" => "Cambodia",
1344
+ "CM" => "Cameroon",
1345
+ "CA" => "Canada",
1346
+ "CV" => "Cape Verde",
1347
+ "KY" => "Cayman Islands",
1348
+ "CF" => "Central African Republic",
1349
+ "TD" => "Chad",
1350
+ "CL" => "Chile",
1351
+ "CN" => "China",
1352
+ "CX" => "Christmas Island",
1353
+ "CC" => "Cocos (Keeling) Islands",
1354
+ "CO" => "Colombia",
1355
+ "KM" => "Comoros",
1356
+ "CG" => "Congo",
1357
+ "CD" => "Congo, the Democratic Republic of the",
1358
+ "CK" => "Cook Islands",
1359
+ "CR" => "Costa Rica",
1360
+ "CI" => "Côte d Ivoire",
1361
+ "HR" => "Croatia",
1362
+ "CU" => "Cuba",
1363
+ "CW" => "Curaçao",
1364
+ "CY" => "Cyprus",
1365
+ "CZ" => "Czech Republic",
1366
+ "DK" => "Denmark",
1367
+ "DJ" => "Djibouti",
1368
+ "DM" => "Dominica",
1369
+ "DO" => "Dominican Republic",
1370
+ "EC" => "Ecuador",
1371
+ "EG" => "Egypt",
1372
+ "SV" => "El Salvador",
1373
+ "GQ" => "Equatorial Guinea",
1374
+ "ER" => "Eritrea",
1375
+ "EE" => "Estonia",
1376
+ "ET" => "Ethiopia",
1377
+ "FK" => "Falkland Islands (Malvinas)",
1378
+ "FO" => "Faroe Islands",
1379
+ "FJ" => "Fiji",
1380
+ "FI" => "Finland",
1381
+ "FR" => "France",
1382
+ "GF" => "French Guiana",
1383
+ "PF" => "French Polynesia",
1384
+ "TF" => "French Southern Territories",
1385
+ "GA" => "Gabon",
1386
+ "GM" => "Gambia",
1387
+ "GE" => "Georgia",
1388
+ "DE" => "Germany",
1389
+ "GH" => "Ghana",
1390
+ "GI" => "Gibraltar",
1391
+ "GR" => "Greece",
1392
+ "GL" => "Greenland",
1393
+ "GD" => "Grenada",
1394
+ "GP" => "Guadeloupe",
1395
+ "GU" => "Guam",
1396
+ "GT" => "Guatemala",
1397
+ "GG" => "Guernsey",
1398
+ "GN" => "Guinea",
1399
+ "GW" => "Guinea-Bissau",
1400
+ "GY" => "Guyana",
1401
+ "HT" => "Haiti",
1402
+ "HM" => "Heard Island and McDonald Islands",
1403
+ "VA" => "Holy See (Vatican City State)",
1404
+ "HN" => "Honduras",
1405
+ "HK" => "Hong Kong",
1406
+ "HU" => "Hungary",
1407
+ "IS" => "Iceland",
1408
+ "IN" => "India",
1409
+ "ID" => "Indonesia",
1410
+ "IR" => "Iran, Islamic Republic of",
1411
+ "IQ" => "Iraq",
1412
+ "IE" => "Ireland",
1413
+ "IM" => "Isle of Man",
1414
+ "IL" => "Israel",
1415
+ "IT" => "Italy",
1416
+ "JM" => "Jamaica",
1417
+ "JP" => "Japan",
1418
+ "JE" => "Jersey",
1419
+ "JO" => "Jordan",
1420
+ "KZ" => "Kazakhstan",
1421
+ "KE" => "Kenya",
1422
+ "KI" => "Kiribati",
1423
+ "KP" => "Korea, Democratic People's Republic of",
1424
+ "KR" => "Korea, Republic of,",
1425
+ "KW" => "Kuwait",
1426
+ "KG" => "Kyrgyzstan",
1427
+ "LA" => "Lao Peoples Democratic Republic",
1428
+ "LV" => "Latvia",
1429
+ "LB" => "Lebanon",
1430
+ "LS" => "Lesotho",
1431
+ "LR" => "Liberia",
1432
+ "LY" => "Libya",
1433
+ "LI" => "Liechtenstein",
1434
+ "LT" => "Lithuania",
1435
+ "LU" => "Luxembourg",
1436
+ "MO" => "Macao",
1437
+ "MK" => "Macedonia, the former Yugoslav Republic of",
1438
+ "MG" => "Madagascar",
1439
+ "MW" => "Malawi",
1440
+ "MY" => "Malaysia",
1441
+ "MV" => "Maldives",
1442
+ "ML" => "Mali",
1443
+ "MT" => "Malta",
1444
+ "MH" => "Marshall Islands",
1445
+ "MQ" => "Martinique",
1446
+ "MR" => "Mauritania",
1447
+ "MU" => "Mauritius",
1448
+ "YT" => "Mayotte",
1449
+ "MX" => "Mexico",
1450
+ "FM" => "Micronesia, Federated States of",
1451
+ "MD" => "Moldova, Republic of",
1452
+ "MC" => "Monaco",
1453
+ "MN" => "Mongolia",
1454
+ "ME" => "Montenegro",
1455
+ "MS" => "Montserrat",
1456
+ "MA" => "Morocco",
1457
+ "MZ" => "Mozambique",
1458
+ "MM" => "Myanmar",
1459
+ "NA" => "Namibia",
1460
+ "NR" => "Nauru",
1461
+ "NP" => "Nepal",
1462
+ "NL" => "Netherlands",
1463
+ "NC" => "New Caledonia",
1464
+ "NZ" => "New Zealand",
1465
+ "NI" => "Nicaragua",
1466
+ "NE" => "Niger",
1467
+ "NG" => "Nigeria",
1468
+ "NU" => "Niue",
1469
+ "NF" => "Norfolk Island",
1470
+ "MP" => "Northern Mariana Islands",
1471
+ "NO" => "Norway",
1472
+ "OM" => "Oman",
1473
+ "PK" => "Pakistan",
1474
+ "PW" => "Palau",
1475
+ "PS" => "Palestine, State of",
1476
+ "PA" => "Panama",
1477
+ "PG" => "Papua New Guinea",
1478
+ "PY" => "Paraguay",
1479
+ "PE" => "Peru",
1480
+ "PH" => "Philippines",
1481
+ "PN" => "Pitcairn",
1482
+ "PL" => "Poland",
1483
+ "PT" => "Portugal",
1484
+ "PR" => "Puerto Rico",
1485
+ "QA" => "Qatar",
1486
+ "RE" => "Reunion",
1487
+ "RO" => "Romania",
1488
+ "RU" => "Russian Federation",
1489
+ "RW" => "Rwanda",
1490
+ "BL" => "Saint Barthélemy",
1491
+ "SH" => "Saint Helena, Ascension and Tristan da Cunha",
1492
+ "KN" => "Saint Kitts and Nevis",
1493
+ "LC" => "Saint Lucia",
1494
+ "MF" => "Saint Martin (French part)",
1495
+ "PM" => "Saint Pierre and Miquelon",
1496
+ "VC" => "Saint Vincent and the Grenadines",
1497
+ "WS" => "Samoa",
1498
+ "SM" => "San Marino",
1499
+ "ST" => "Sao Tome and Principe",
1500
+ "SA" => "Saudi Arabia",
1501
+ "SN" => "Senegal",
1502
+ "RS" => "Serbia",
1503
+ "SC" => "Seychelles",
1504
+ "SL" => "Sierra Leone",
1505
+ "SG" => "Singapore",
1506
+ "SX" => "Sint Maarten (Dutch part)",
1507
+ "SK" => "Slovakia",
1508
+ "SI" => "Slovenia",
1509
+ "SB" => "Solomon Islands",
1510
+ "SO" => "Somalia",
1511
+ "ZA" => "South Africa",
1512
+ "GS" => "South Georgia and the South Sandwich Islands",
1513
+ "SS" => "South Sudan",
1514
+ "ES" => "Spain",
1515
+ "LK" => "Sri Lanka",
1516
+ "SD" => "Sudan",
1517
+ "SR" => "Suriname",
1518
+ "SJ" => "Svalbard and Jan Mayen",
1519
+ "SZ" => "Swaziland",
1520
+ "SE" => "Sweden",
1521
+ "CH" => "Switzerland",
1522
+ "SY" => "Syrian Arab Republic",
1523
+ "TW" => "Taiwan, Province of China",
1524
+ "TJ" => "Tajikistan",
1525
+ "TZ" => "Tanzania, United Republic of",
1526
+ "TH" => "Thailand",
1527
+ "TL" => "Timor-Leste",
1528
+ "TG" => "Togo",
1529
+ "TK" => "Tokelau",
1530
+ "TO" => "Tonga",
1531
+ "TT" => "Trinidad and Tobago",
1532
+ "TN" => "Tunisia",
1533
+ "TR" => "Turkey",
1534
+ "TM" => "Turkmenistan",
1535
+ "TC" => "Turks and Caicos Islands",
1536
+ "TV" => "Tuvalu",
1537
+ "UG" => "Uganda",
1538
+ "UA" => "Ukraine",
1539
+ "AE" => "United Arab Emirates",
1540
+ "GB" => "United Kingdom",
1541
+ "US" => "United States",
1542
+ "UM" => "United States Minor Outlying Islands",
1543
+ "UY" => "Uruguay",
1544
+ "UZ" => "Uzbekistan",
1545
+ "VU" => "Vanuatu",
1546
+ "VE" => "Venezuela, Bolivarian Republic of",
1547
+ "VN" => "Viet Nam",
1548
+ "VG" => "Virgin Islands, British",
1549
+ "VI" => "Virgin Islands, U.S.",
1550
+ "WF" => "Wallis and Futuna",
1551
+ "EH" => "Western Sahara",
1552
+ "YE" => "Yemen",
1553
+ "ZM" => "Zambia",
1554
+ "ZW" => "Zimbabwe",
1555
+ );
1556
+ }
1557
 
1558
+ function contactType() {
1559
+ return array(
1560
+ "Customer Service",
1561
+ "Technical Support",
1562
+ "Billing Support",
1563
+ "Bill Payment",
1564
+ "Sales",
1565
+ "Reservations",
1566
+ "Credit Card Support",
1567
+ "Emergency",
1568
+ "Baggage Tracking",
1569
+ "Roadside Assistance",
1570
+ "Package Tracking"
1571
+ );
1572
+ }
1573
 
1574
+ function languageList() {
1575
+ return array(
1576
+ "Akan",
1577
+ "Amharic",
1578
+ "Arabic",
1579
+ "Assamese",
1580
+ "Awadhi",
1581
+ "Azerbaijani",
1582
+ "Balochi",
1583
+ "Belarusian",
1584
+ "Bengali",
1585
+ "Bhojpuri",
1586
+ "Burmese",
1587
+ "Cantonese",
1588
+ "Cebuano",
1589
+ "Chewa",
1590
+ "Chhattisgarhi",
1591
+ "Chittagonian",
1592
+ "Czech",
1593
+ "Deccan",
1594
+ "Dhundhari",
1595
+ "Dutch",
1596
+ "English",
1597
+ "French",
1598
+ "Fula",
1599
+ "Gan",
1600
+ "German",
1601
+ "Greek",
1602
+ "Gujarati",
1603
+ "Haitian Creole",
1604
+ "Hakka",
1605
+ "Haryanvi",
1606
+ "Hausa",
1607
+ "Hiligaynon",
1608
+ "Hindi / Urdu",
1609
+ "Hmong",
1610
+ "Hungarian",
1611
+ "Igbo",
1612
+ "Ilokano",
1613
+ "Italian",
1614
+ "Japanese",
1615
+ "Javanese",
1616
+ "Jin",
1617
+ "Kannada",
1618
+ "Kazakh",
1619
+ "Khmer",
1620
+ "Kinyarwanda",
1621
+ "Kirundi",
1622
+ "Konkani",
1623
+ "Korean",
1624
+ "Kurdish",
1625
+ "Madurese",
1626
+ "Magahi",
1627
+ "Maithili",
1628
+ "Malagasy",
1629
+ "Malay/Indonesian",
1630
+ "Malayalam",
1631
+ "Mandarin",
1632
+ "Marathi",
1633
+ "Marwari",
1634
+ "Min Bei",
1635
+ "Min Dong",
1636
+ "Min Nan",
1637
+ "Mossi",
1638
+ "Nepali",
1639
+ "Oriya",
1640
+ "Oromo",
1641
+ "Pashto",
1642
+ "Persian",
1643
+ "Polish",
1644
+ "Portuguese",
1645
+ "Punjabi",
1646
+ "Quechua",
1647
+ "Romanian",
1648
+ "Russian",
1649
+ "Saraiki",
1650
+ "Serbo-Croatian",
1651
+ "Shona",
1652
+ "Sindhi",
1653
+ "Sinhalese",
1654
+ "Somali",
1655
+ "Spanish",
1656
+ "Sundanese",
1657
+ "Swahili",
1658
+ "Swedish",
1659
+ "Sylheti",
1660
+ "Tagalog",
1661
+ "Tamil",
1662
+ "Telugu",
1663
+ "Thai",
1664
+ "Turkish",
1665
+ "Ukrainian",
1666
+ "Uyghur",
1667
+ "Uzbek",
1668
+ "Vietnamese",
1669
+ "Wu",
1670
+ "Xhosa",
1671
+ "Xiang",
1672
+ "Yoruba",
1673
+ "Zulu",
1674
+ );
1675
+ }
1676
+
1677
+ function socialList() {
1678
+ return array(
1679
+ 'facebook' => __( 'Facebook' ),
1680
+ 'twitter' => __( 'Twitter' ),
1681
+ 'google-plus' => __( 'Google+' ),
1682
+ 'instagram' => __( 'Instagram' ),
1683
+ 'youtube' => __( 'Youtube' ),
1684
+ 'linkedin' => __( 'LinkedIn' ),
1685
+ 'myspace' => __( 'Myspace' ),
1686
+ 'pinterest' => __( 'Pinterest' ),
1687
+ 'soundcloud' => __( 'SoundCloud' ),
1688
+ 'tumblr' => __( 'Tumblr' ),
1689
+ 'wikidata' => __( 'Wikidata' ),
1690
+ );
1691
+ }
1692
+
1693
+ function imgInfo( $url = null ) {
1694
+ $img = array();
1695
+ if ( $url ) {
1696
+ $imgA = @getimagesize( $url );
1697
+ if ( is_array( $imgA ) && ! empty( $imgA ) ) {
1698
+ $img['width'] = $imgA[0];
1699
+ $img['height'] = $imgA[1];
1700
+ } else {
1701
+ $img['width'] = 0;
1702
+ $img['height'] = 0;
1703
+ }
1704
+ }
1705
+
1706
+ return $img;
1707
+ }
1708
+
1709
+ function isAssoc( $array ) {
1710
+ $keys = array_keys( $array );
1711
+
1712
+ return $keys !== array_keys( $keys );
1713
+ }
1714
+
1715
+
1716
+ }
1717
  endif;
lib/views/settings.php CHANGED
@@ -1,371 +1,482 @@
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>',KCSEO_WP_SCHEMA_SLUG);?></h3>
12
- <div class="setting-holder">
13
- <table width="40%" cellpadding="10" class="form-table">
14
- <tr class="default">
15
- <th>Website Url <span class="required">*</span></th>
16
- <td align="left" scope="row">
17
- <div class="with-tooltip">
18
- <input type="text" class="regular-text" name="web_url" value="<?php echo (!empty($settings['web_url']) ? esc_attr($settings['web_url']) : get_home_url()); ?>" />
19
- <div class="schema-tooltip-holder">
20
- <span class="schema-tooltip"></span>
21
- <div class="hidden">
22
- <p><b>Tip:</b> For more detailed information on how to configure this plugin, please visit:
23
- <a href="http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/">http://kcseopro.com/wordpress-seo-structured-data-schema-plugin/</a></p>
24
- </div>
25
- </div>
26
- </div>
27
- </td>
28
- </tr>
29
- <tr class="default">
30
- <th>Type</th>
31
- <td align="left" scope="row">
32
- <select id="site_type" name="site_type" class="select2">
33
- <option value="">Select one type</option>
34
- <?php
35
- $siteType = !empty($settings['site_type']) ? $settings['site_type'] : null;
36
- foreach($schemaModel->site_type() as $site){
37
- $slt = ($site == $siteType ? "selected" : null);
38
- echo "<option value='$site' $slt>$site</option>";
39
- }
40
- ?>
41
- </select>
42
- </td>
43
- </tr>
44
- <tr class="default">
45
- <th>Organization or Business name</th>
46
- <td align="left" scope="row">
47
- <input type="text" class="regular-text" name="type_name" value="<?php echo (!empty($settings['type_name']) ? $settings['type_name'] : null); ?>" />
48
- </td>
49
- </tr>
50
- <tr class="default">
51
- <th>Additional Type</th>
52
- <td align="left" scope="row">
53
- <div class="with-tooltip">
54
- <textarea name="additionalType" placeholder="http://example1.com&#10;http://example2.com&#10;http://example3.com" rows="6" cols="50" class="additional-type"><?php echo (!empty($settings['additionalType']) ? esc_attr(@$settings['additionalType']) : null); ?></textarea>
55
- <p class="description">Add "Additional Type" URL(s) by separate ideas</p>
56
- <div class="schema-tooltip-holder">
57
- <span class="schema-tooltip"></span>
58
- <div class="hidden">
59
- <p><b>Tip:</b> Product Ontology is an extension to schema using WikiPedia definitions that enables you to further define a type by adding an “AdditionalType” attribute.Example for a Tailor (which is not available as a schema “Type”): Pick LocalBusiness as a generic Type, then add additional type as follows:
60
- <a href="https://en.wikipedia.org/wiki/Tailor">https://en.wikipedia.org/wiki/<span>Tailor</span></a>
61
- Change to this format and enter in Additional Type field:
62
- <a href="http://www.productontology.org/id/Tailor">http://www.productontology.org/id/<span>Tailor</span></a>
63
- For more info visit:<a href="http://kcseopro.com/product-ontology-schema/">http://kcseopro.com/product-ontology-schema/</a>
64
- </p>
65
- </div>
66
- </div>
67
- </div>
68
- </td>
69
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- <tr class="default business-info">
72
- <th style="font-size: 18px; padding: 30px 0 5px;">Others local business info</th>
73
- </tr>
74
- <tr class="default business-info">
75
- <th>Description</th>
76
- <td align="left" scope="row">
77
- <textarea cols="50" rows="6" name="business_info[description]"><?php echo (!empty($settings['business_info']['description']) ? esc_attr($settings['business_info']['description']) : null); ?></textarea>
78
- </td>
79
- </tr>
80
- <tr class="default business-info">
81
- <th>Operation Hours</th>
82
- <td align="left" scope="row">
83
- <div class="with-tooltip">
84
- <textarea name="business_info[openingHours]" placeholder="Mo-Sa 11:00-14:30&#10;Mo-Th 17:00-21:30&#10;Fr-Sa 17:00-22:00" rows="4" cols="50" class="additional-type"><?php echo (!empty($settings['business_info']['openingHours']) ? esc_attr($settings['business_info']['openingHours']) : null); ?></textarea>
85
- <p class="description">- Days are specified using the following two-letter combinations: Mo, Tu, We, Th, Fr, Sa, Su.</br>
86
- - Times are specified using 24:00 time. For example, 3pm is specified as 15:00. <br>
87
- - Add Opening Hours by separate line</p>
88
- <div class="schema-tooltip-holder">
89
- <span class="schema-tooltip"></span>
90
- <div class="hidden">
91
- <p>
92
- <b>Tip:</b> Once you save these structured data schema settings, validate your home page url here:
93
- <a href="https://developers.google.com/structured-data/testing-tool/">https://developers.google.com/structured-data/testing-tool/</a>
94
- </p>
95
- </div>
96
- </div>
97
- </td>
98
- </tr>
99
- <tr class="default business-info">
100
- <th style="font-size: 16px;">GeoCoordinates</th>
101
- </tr>
102
- <tr class="default business-info">
103
- <th style="text-align: right">Longitude</th>
104
- <td align="left" scope="row">
105
- <input type="text" class="regular-text" name="business_info[longitude]" value="<?php echo (!empty($settings['business_info']['longitude']) ? esc_attr($settings['business_info']['longitude']) : null); ?>" />
106
- </td>
107
- </tr>
108
- <tr class="default business-info">
109
- <th style="text-align: right">Latitude</th>
110
- <td align="left" scope="row">
111
- <input type="text" class="regular-text" name="business_info[latitude]" value="<?php echo (!empty($settings['business_info']['latitude']) ? esc_attr($settings['business_info']['latitude']) : null); ?>" />
112
- </td>
113
- </tr>
 
 
 
 
 
 
 
 
114
 
115
 
116
- <tr class="default person">
117
- <th style="font-size: 18px; padding: 30px 0 5px;">Person</th>
118
- </tr>
119
- <tr class="default person">
120
- <th>Name</th>
121
- <td align="left" scope="row">
122
- <input type="text" class="regular-text" name="person[name]" value="<?php echo (!empty($settings['person']['name']) ? esc_attr($settings['person']['name']) : null); ?>" />
123
- </td>
124
- </tr>
125
- <tr class="default person">
126
- <th>Work For</th>
127
- <td align="left" scope="row">
128
- <input type="text" class="regular-text" name="person[worksFor]"
129
- value="<?php echo (!empty($settings['person']['worksFor']) ? esc_attr($settings['person']['worksFor']) : null); ?>" />
 
130
 
131
- </td>
132
- </tr>
133
- <tr class="default person">
134
- <th>Job Title</th>
135
- <td align="left" scope="row">
136
- <input type="text" class="regular-text" name="person[jobTitle]"
137
- value="<?php echo (@$settings['person']['jobTitle'] ? @$settings['person']['jobTitle'] : null); ?>" />
138
 
139
- </td>
140
- </tr>
141
- <tr class="default person">
142
- <th>Image</th>
143
- <td align="left" scope="row">
144
- <input type="text" class="regular-text" name="person[image]"
145
- value="<?php echo (!empty($settings['person']['image']) ? esc_attr($settings['person']['image']) : null); ?>" />
146
- <p class="description">Add your personal photo here</p>
147
- </td>
148
- </tr>
149
- <tr class="default person">
150
- <th>Description</th>
151
- <td align="left" scope="row">
152
- <input type="text" class="regular-text" name="person[description]"
153
- value="<?php echo (!empty($settings['person']['description']) ? esc_attr($settings['person']['description']) : null); ?>" />
154
- </td>
155
- </tr>
156
- <tr class="default person">
157
- <th>Birth date</th>
158
- <td align="left" scope="row">
159
- <input type="text" class="regular-text kcseo-date" name="person[birthDate]"
160
- value="<?php echo (!empty($settings['person']['birthDate']) ? esc_attr($settings['person']['birthDate']) : null); ?>" />
161
 
162
- </td>
163
- </tr>
164
- <tr class="default">
165
- <th style="font-size: 18px; padding: 30px 0 5px;">Address</th>
166
- </tr>
167
- <tr class="default">
168
- <th>Address Country</th>
169
- <td align="left" scope="row">
170
- <select class="select2" name="address[country]">
171
- <option value="">Select a country</option>
172
- <?php
173
- $aCountry = !empty($settings['address']['country']) ? $settings['address']['country'] : null;
174
- foreach($schemaModel->countryList() as $country){
175
- $slt = ($country == $aCountry ? "selected" : null);
176
- echo "<option value='$country' $slt>$country</option>";
177
- }
178
- ?>
179
- </select>
180
- </td>
181
- </tr>
182
- <tr class="default">
183
- <th>Address Locality</th>
184
- <td align="left" scope="row">
185
- <input type="text" class="regular-text" name="address[locality]" value="<?php echo (!empty($settings['address']['locality']) ? esc_attr($settings['address']['locality']) : null); ?>" />
186
- <p class="description">City (i.e Kansas city)</p>
187
- </tr>
188
- <tr class="default">
189
- <th>Address Region</th>
190
- <td align="left" scope="row">
191
- <input type="text" class="regular-text" name="address[region]" value="<?php echo (!empty($settings['address']['region']) ? esc_attr($settings['address']['region']) : null); ?>" />
192
- <p class="description">State (i.e. MO)</p>
193
- </tr>
194
- <tr class="default">
195
- <th>Postal Code</th>
196
- <td align="left" scope="row">
197
- <input type="text" class="regular-text" name="address[postalcode]" value="<?php echo (!empty($settings['address']['postalcode']) ? esc_attr($settings['address']['postalcode']) : null); ?>" />
198
- </tr>
199
- <tr class="default">
200
- <th>Street Address</th>
201
- <td align="left" scope="row">
202
- <input type="text" class="regular-text" name="address[street]" value="<?php echo (!empty($settings['address']['street']) ? esc_attr($settings['address']['street']) : null); ?>" />
203
- </tr>
204
- </table>
205
- </div>
206
- <div id="tabs-kcseo-container" class="rt-tab-container">
207
- <ul class="rt-tab-nav">
208
- <li class="current"><a href="#tab-logo-url">Organization Logo</a></li>
209
- <li><a href="#tab-social-profile">Social Profile</a></li>
210
- <li><a href="#tab-corporate-contract">Corporate Contacts</a></li>
211
- </ul>
212
- <div id="tab-logo-url" class="rt-tab-content">
213
- <table width="100%" cellpadding="10" class="form-table">
214
- <tr class="field_logo">
215
- <th>Logo URL </th>
216
- <td scope="row">
217
- <input type="text" class="regular-text" name="logo_url" value="<?php echo (!empty($settings['logo_url']) ? esc_attr($settings['logo_url']) : null); ?>" />
218
- </td>
219
- </tr>
220
- </table>
221
- </div>
222
- <div id="tab-social-profile" class="rt-tab-content">
223
- <table width="100%" cellpadding="10" class="form-table">
224
- <tr class="field_social">
225
- <th>Company Name </th>
226
- <td align="left" scope="row">
227
- <input type="text" class="regular-text" name="social_company_name" value="<?php echo (!empty($settings['social_company_name']) ? esc_attr($settings['social_company_name']) : null); ?>" />
228
- </td>
229
- </tr>
230
- <tr class="field_social_title">
231
- <th style="font-size: 18px; padding: 10px 0;">Social Profiles</th>
232
- </tr>
233
- <tr class="social_field_link">
234
- <th>Social Profile</th>
235
- <th>
236
- <div id="social-field-holder">
237
- <?php
238
- $socialP = (!empty($settings['social']) ? $settings['social'] : array());
239
- if(is_array($socialP) && !empty($socialP)) {
240
- $html = null;
241
- $i = 0;
242
- foreach ($socialP as $socialD) {
243
- $html .= "<div class='sfield'>";
244
- $html .= "<select name='social[$i][id]'>";
245
- foreach ($schemaModel->socialList() as $sId => $social) {
246
- $slt = ($sId == $socialD['id'] ? "selected" : null);
247
- $html .= "<option value='$sId' $slt>$social</option>";
248
- }
249
- $html .= "</select>";
250
- $html .= "<input type='text' name='social[$i][link]' value='{$socialD['link']}'>";
251
- $html .= '<span class="dashicons dashicons-trash social-remove"></span>';
252
- $html .= "</div>";
253
- $i++;
254
- }
255
- echo $html;
256
- }
257
- ?>
258
- </div>
259
- <a class="button button-primary add-new" id="social-add" >Add Social Profile</a>
260
- </th>
261
- </tr>
262
- </table>
263
- </div>
264
- <div id="tab-corporate-contract" class="rt-tab-content">
265
- <table width="100%" cellpadding="10" class="form-table">
266
- <tr class="field_contact">
267
- <th style="font-size: 18px; padding: 10px 0;">Contacts</th>
268
- </tr>
269
- <tr class="field_contact">
270
- <th>Contact Type </th>
271
- <td scope="row">
272
- <select name="contact[contactType]" class="select2" style="width: 200px">
273
- <?php
274
- $contactType = !empty($settings['contact']['contactType']) ? $settings['contact']['contactType'] : null;
275
- foreach($schemaModel->contactType() as $cType){
276
- $slt = ($cType == $contactType ? "selected" : null);
277
- echo "<option value='$cType' $slt>$cType</option>";
278
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
- ?>
281
- </select>
282
- </td>
283
 
284
- </tr>
285
- <tr class="field_contact">
286
- <th>Contact Phone </th>
287
- <td align="left" scope="row">
288
- <input type="text" class="regular-text" name="contact[telephone]" value="<?php echo (!empty($settings['contact']['telephone']) ? esc_attr($settings['contact']['telephone']) : null); ?>" />
289
- <p class="description kco-telephone">Please follow the format below<span style="font-size: 11px;">+1-505-998-3793</span><span style="font-size: 11px;">(425) 123-4567</span><span style="font-size: 11px;">( 33 1) 42 68 53 01</span><span style="font-size: 11px;">+44-2078225951</span><span style="font-size: 11px;">1 (855) 469-6378</span>
290
- </p>
291
- </td>
292
- </tr>
293
- <tr class="field_contact">
294
- <th>Contact Option </th>
295
- <td align="left" scope="row">
296
- <select name="contact[contactOption]" class="select2 withEmptyOption" style="width: 200px">
297
- <option value="">Select an option</option>
298
- <option value="TollFree" <?php
299
- $cPtOpt = !empty($settings['contact']['contactOption']) ? $settings['contact']['contactOption'] : null;
300
- echo ($cPtOpt == "TollFree" ? "selected" : null); ?>>TollFree</option>
301
- <option value="HearingImpairedSupported" <?php echo ($settings['contact']['contactOption'] == "HearingImpairedSupported" ? "selected" : null); ?>>HearingImpairedSupported</option>
302
- </select>
303
- </td>
304
- </tr>
305
- <tr class="field_contact">
306
- <th>Area Served</th>
307
- <td align="left" scope="row">
308
- <div class="area_served_wrapper">
309
- <select id="area_served" class="select2" name="area_served[]" multiple="multiple" style="width: 50%">
310
- <?php
311
- $areaServed = !empty($settings['area_served']) ? $settings['area_served'] : array();
312
- foreach($schemaModel->countryList() as $country){
313
- $slt = (in_array($country, $areaServed) ? "selected" : null);
314
- echo "<option value='$country' $slt>$country</option>";
315
- }
316
- ?>
317
- </select>
318
- </div>
319
- </td>
320
- </tr>
321
- <tr class="field_contact">
322
- <th>Available language </th>
323
- <td scope="row" class="lang">
324
- <select class="select2" name="availableLanguage[]" style="width: 50%" multiple="multiple">
325
- <?php
326
- $lanAvailable = !empty($settings['availableLanguage']) ? $settings['availableLanguage'] : array();
327
- foreach($schemaModel->languageList() as $language){
328
- $slt = (in_array($language, $lanAvailable) ? "selected" : null);
329
- echo "<option value='$language' $slt>$language</option>";
330
- }
331
- ?>
332
- </select>
333
- </td>
334
- </tr>
335
- </table>
336
- </div>
337
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
 
339
- <h2>Site Name in Search Results</h2>
340
- <table width="100%" cellpadding="10" class="form-table">
341
- <tr class="default">
342
- <th>Enable Site link Search Box</th>
343
- <td align="left" scope="row">
344
- <input type="checkbox" name="homeonly" <?php echo (!empty($settings['homeonly']) ? "checked" : null); ?> value="1" />
345
- </td>
346
- </tr>
347
- <tr class="default">
348
- <th>Site Name: </th>
349
- <td align="left" scope="row">
350
- <input type="text" class="regular-text" name="sitename" value="<?php echo (!empty($settings['sitename']) ? esc_attr($settings['sitename']) : null); ?>" />
351
- </td>
352
- </tr>
353
- <tr class="default">
354
- <th>Site Alternative Name: </th>
355
- <td align="left" scope="row">
356
- <input type="text" class="regular-text" name="siteaname" value="<?php echo (!empty($settings['siteaname']) ? esc_attr($settings['siteaname']) : null); ?>" />
357
- </td>
358
- </tr>
359
- <tr class="default">
360
- <th>Site Url: </th>
361
- <td align="left" scope="row">
362
- <input type="text" class="regular-text" name="siteurl" value="<?php echo (!empty($settings['siteurl']) ? esc_attr($settings['siteurl']) : get_home_url()); ?>" />
363
- </td>
364
- </tr>
365
- </table>
366
- <p class="submit"><input type="submit" name="submit" id="tlpSaveButton" class="button button-primary" value="<?php _e('Save Changes', KCSEO_WP_SCHEMA_SLUG); ?>"></p>
 
 
 
 
 
 
367
 
368
- <?php wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' ); ?>
369
- </form>
370
- <div id="response"></div>
371
  </div>
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
+ <p class="submit"><input type="submit" name="submit" id="tlpSaveButton" class="button button-primary"
477
+ value="<?php _e( 'Save Changes', KCSEO_WP_SCHEMA_SLUG ); ?>"></p>
478
 
479
+ <?php wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' ); ?>
480
+ </form>
481
+ <div id="response"></div>
482
  </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.6
7
- Stable tag: 1.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
  = 1.2 =
97
  * Meta field issue
98
  * Layout change
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.6
7
+ Stable tag: 1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
93
 
94
  == Changelog ==
95
 
96
+ = 1.3 =
97
+ * Data recover
98
+ * Image issue
99
+ * Image from gallery
100
+ * Fix data save issue
101
+ * Schema update for different Criteria
102
+
103
  = 1.2 =
104
  * Meta field issue
105
  * Layout change
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: 1.2
7
  * Author: kcseopro
8
  * Author URI: http://kcseopro.com/
9
  * License: A "Slug" license name e.g. GPL2
@@ -13,15 +13,13 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  }
14
  define('KCSEO_WP_SCHEMA_SLUG', 'wp-seo-structured-data-schema');
15
  define('KCSEO_WP_SCHEMA_PATH', dirname(__FILE__));
16
- define('KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME', __FILE__);
17
  define('KCSEO_WP_SCHEMA_URL', plugins_url('', __FILE__));
18
  define('KCSEO_WP_SCHEMA_LANGUAGE_PATH', dirname( plugin_basename( __FILE__ ) ) . '/languages');
19
 
20
  require ('lib/init.php');
21
 
22
-
23
- register_activation_hook(__FILE__, 'kcSeo_active');
24
-
25
  /**
26
  *
27
  */
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: 1.3
7
  * Author: kcseopro
8
  * Author URI: http://kcseopro.com/
9
  * License: A "Slug" license name e.g. GPL2
13
  }
14
  define('KCSEO_WP_SCHEMA_SLUG', 'wp-seo-structured-data-schema');
15
  define('KCSEO_WP_SCHEMA_PATH', dirname(__FILE__));
16
+ define('KCSEO_WP_SCHEMA_PLUGIN_ACTIVE_FILE_NAME', plugin_basename( __FILE__ ));
17
  define('KCSEO_WP_SCHEMA_URL', plugins_url('', __FILE__));
18
  define('KCSEO_WP_SCHEMA_LANGUAGE_PATH', dirname( plugin_basename( __FILE__ ) ) . '/languages');
19
 
20
  require ('lib/init.php');
21
 
22
+ //register_activation_hook(__FILE__, 'kcSeo_active');
 
 
23
  /**
24
  *
25
  */