WP Simple Booking Calendar - Version 1.0

Version Description

  • First release

=

Download this release

Release Info

Developer bryght
Plugin Icon 128x128 WP Simple Booking Calendar
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (46) hide show
  1. css/sbc-controller.css +58 -0
  2. css/sbc-shortcode.css +17 -0
  3. css/sbc.css +146 -0
  4. js/jquery.form.min.js +11 -0
  5. js/jquery.validate.min.js +16 -0
  6. js/sbc-controller.js +105 -0
  7. js/sbc-shortcode.js +28 -0
  8. js/sbc.js +49 -0
  9. languages/.htaccess +2 -0
  10. languages/sbc-da_DK.mo +0 -0
  11. languages/sbc-da_DK.po +181 -0
  12. languages/sbc-de_DE.mo +0 -0
  13. languages/sbc-de_DE.po +181 -0
  14. languages/sbc-en_US.mo +0 -0
  15. languages/sbc-en_US.po +181 -0
  16. languages/sbc-es_ES.mo +0 -0
  17. languages/sbc-es_ES.po +181 -0
  18. languages/sbc-fr-FR.po +181 -0
  19. languages/sbc-fr_FR.mo +0 -0
  20. languages/sbc-it-IT.po +181 -0
  21. languages/sbc-it_IT.mo +0 -0
  22. languages/sbc-nl_NL.mo +0 -0
  23. languages/sbc-nl_NL.po +181 -0
  24. library/.htaccess +2 -0
  25. library/WpSimpleBookingCalendar.php +39 -0
  26. library/WpSimpleBookingCalendar/Ajax.php +98 -0
  27. library/WpSimpleBookingCalendar/Controller.php +292 -0
  28. library/WpSimpleBookingCalendar/Exception.php +12 -0
  29. library/WpSimpleBookingCalendar/Model.php +146 -0
  30. library/WpSimpleBookingCalendar/Shortcode.php +130 -0
  31. library/WpSimpleBookingCalendar/View.php +154 -0
  32. library/WpSimpleBookingCalendar/Widget.php +110 -0
  33. readme.txt +78 -0
  34. screenshot-1.jpg +0 -0
  35. screenshot-2.jpg +0 -0
  36. screenshot-3.jpg +0 -0
  37. views/.htaccess +2 -0
  38. views/calendar/calendar.phtml +112 -0
  39. views/controller/edit.phtml +53 -0
  40. views/controller/index.phtml +62 -0
  41. views/message.phtml +10 -0
  42. views/shortcode/metabox.phtml +41 -0
  43. views/shortcode/sbc.phtml +24 -0
  44. views/widget/form.phtml +25 -0
  45. views/widget/widget.phtml +26 -0
  46. wp-simple-booking-calendar.php +45 -0
css/sbc-controller.css ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @CHARSET "UTF-8";
2
+
3
+ #sbc-wrapper div.postbox-container {
4
+ float: none;
5
+ padding: 0;
6
+ min-width: 440px;
7
+ width: 440px;
8
+ }
9
+
10
+ #sbc-wrapper div.postbox div.inside {
11
+ margin: 14px 18px 18px;
12
+ position: relative;
13
+ }
14
+
15
+ #sbc-wrapper div.postbox-container p {
16
+ margin: 20px 0;
17
+ }
18
+
19
+ #sbc-wrapper div.postbox-container label {
20
+ display: block;
21
+ font-size: 12px;
22
+ font-weight: bold;
23
+ margin: 0 0 3px;
24
+ }
25
+
26
+ #sbc-wrapper div.postbox-container label em {
27
+ color: #62625A;
28
+ font-weight: normal;
29
+ }
30
+
31
+ #sbc-wrapper div.postbox div.inside textarea {
32
+ width: 100%;
33
+ }
34
+
35
+ #sbc-wrapper div.postbox div.inside input, #sbc-wrapper div.postbox div.inside textarea {
36
+ margin: 1px;
37
+ padding: 3px;
38
+ }
39
+
40
+ #sbc-wrapper div.postbox div.inside input.error, #sbc-wrapper div.postbox div.inside textarea.error {
41
+ margin: 1px 1px 3px 1px;
42
+ padding: 3px;
43
+ }
44
+
45
+ #sbc-wrapper .tablenav {
46
+ line-height: 30px;
47
+ }
48
+
49
+ #sbc-wrapper p.search-box {
50
+ height: 30px;
51
+ line-height: 30px;
52
+ margin: 0;
53
+ }
54
+
55
+ #sbc-wrapper div.loader {
56
+ display: none;
57
+ height: 55px;
58
+ }
css/sbc-shortcode.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @CHARSET "UTF-8";
2
+
3
+ /* ----- Token Metabox ----- */
4
+ #sbc-metabox h4 {
5
+ border-bottom: 1px dashed #dfdfdf;
6
+ font-size: 14px;
7
+ margin: 0;
8
+ padding: 10px 0;
9
+ }
10
+
11
+ #sbc-metabox .form-table th {
12
+ vertical-align: middle;
13
+ }
14
+
15
+ #sbc-metabox .form-table th.top {
16
+ vertical-align: top;
17
+ }
css/sbc.css ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @CHARSET "UTF-8";
2
+
3
+ #sbc-calendar-wrapper {
4
+ font-family: Arial, Helvetica, sans-serif;
5
+ font-size: 12px;
6
+ clear: both;
7
+ overflow: hidden;
8
+ }
9
+
10
+ #sbc-calendar-wrapper .sbc-status-free {
11
+ background-color: #dfc;
12
+ }
13
+
14
+ #sbc-calendar-wrapper .sbc-status-booked {
15
+ background-color: #ffc0bd;
16
+ }
17
+
18
+ #sbc-calendar-wrapper .sbc-status-changeover {
19
+ background-color: #fee2a0;
20
+ }
21
+
22
+ #sbc-calendar-wrapper table {
23
+ border: 0;
24
+ border-collapse: separate;
25
+ border-spacing: 2px;
26
+ table-layout: fixed;
27
+ margin: 0;
28
+ padding: 0;
29
+ }
30
+
31
+ #sbc-calendar-wrapper table tr td {
32
+ border: 0;
33
+ padding: 0;
34
+ line-height: 12px;
35
+ vertical-align: middle;
36
+ }
37
+
38
+ #sbc-calendar {
39
+ float: left;
40
+ margin: 0 20px 30px 0;
41
+ }
42
+
43
+ .sbc-calendar-month {
44
+ float: left;
45
+ padding: 10px;
46
+ width: 172px;
47
+ border: 1px solid #ccc;
48
+ background-color: #fff;
49
+ margin-right: 10px;
50
+ }
51
+
52
+ #sbc-calendar .sbc-navigation {
53
+ padding-bottom: 10px;
54
+ line-height: 21px;
55
+ }
56
+
57
+ #sbc-calendar .sbc-navigation select {
58
+ margin: 0;
59
+ }
60
+
61
+ #sbc-calendar .sbc-loader {
62
+ background-color: #ffc0bd;
63
+ font-weight: bold;
64
+ margin: 4px 0;
65
+ padding: 1px 0;
66
+ text-align: center;
67
+ visibility: hidden;
68
+ }
69
+
70
+ #sbc-calendar .sbc-loader-visible {
71
+ visibility: visible;
72
+ }
73
+
74
+ #sbc-calendar table {
75
+ border-top: 1px solid #000;
76
+ }
77
+
78
+ #sbc-calendar table thead th,#sbc-calendar tr td {
79
+ color: #333;
80
+ font-family: Arial, Helvetica, sans-serif;
81
+ font-size: 12px;
82
+ text-align: center;
83
+ line-height: 16px;
84
+ padding: 8px 0 4px;
85
+ width: 22px;
86
+ height: 22px;
87
+ }
88
+
89
+ #sbc-calendar table tfoot td {
90
+ padding-top: 5px;
91
+ text-align: left;
92
+ }
93
+
94
+ #sbc-calendar tr td {
95
+ border: 1px solid #fff;
96
+ padding: 2px 0;
97
+ }
98
+
99
+ #sbc-calendar tr td.pad {
100
+ width: auto;
101
+ }
102
+
103
+ #sbc-calendar td.sbc-status-free {
104
+ border-color: #dfc;
105
+ }
106
+
107
+ #sbc-calendar td.sbc-status-booked {
108
+ border-color: #ffc0bd;
109
+ }
110
+
111
+ #sbc-calendar td.sbc-status-changeover {
112
+ border-color: #fee2a0;
113
+ }
114
+
115
+ #sbc-calendar td.sbc-today {
116
+ border-color: #aeaeae
117
+ }
118
+
119
+ #sbc-editor {
120
+ border: 1px solid #ccc;
121
+ float: left;
122
+ padding: 5px;
123
+ }
124
+
125
+ #sbc-editor td.sbc-editor-day {
126
+ font-family: Arial, Helvetica, sans-serif;
127
+ font-size: 12px;
128
+ text-align: center;
129
+ width: 25px;
130
+ }
131
+
132
+ #sbc-editor td.sbc-editor-status select {
133
+ width: 120px;
134
+ }
135
+
136
+
137
+ .widget-sbc #sbc-calendar {
138
+ float: none;
139
+ margin: 0 0 10px 0;
140
+ }
141
+
142
+ .alignRight {
143
+ text-align: right !important;
144
+ }
145
+
146
+ span.powered-by {width:192px; text-align:center; padding-top:3px; clear:both; }
js/jquery.form.min.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Form Plugin
3
+ * version: 2.43 (12-MAR-2010)
4
+ * @requires jQuery v1.3.2 or later
5
+ *
6
+ * Examples and documentation at: http://malsup.com/jquery/form/
7
+ * Dual licensed under the MIT and GPL licenses:
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ * http://www.gnu.org/licenses/gpl.html
10
+ */
11
+ ;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log('ajaxSubmit: skipping submit process - no element selected');return this}if(typeof options=='function')options={success:options};var url=$.trim(this.attr('action'));if(url){url=(url.match(/^([^#]+)/)||[])[1]}url=url||window.location.href||'';options=$.extend({url:url,type:this.attr('method')||'GET',iframeSrc:/^https/i.test(window.location.href||'')?'javascript:false':'about:blank'},options||{});var veto={};this.trigger('form-pre-serialize',[this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');return this}if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log('ajaxSubmit: submit aborted via beforeSerialize callback');return this}var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n]instanceof Array){for(var k in options.data[n])a.push({name:n,value:options.data[n][k]})}else a.push({name:n,value:options.data[n]})}}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log('ajaxSubmit: submit aborted via beforeSubmit callback');return this}this.trigger('form-submit-validate',[a,this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-submit-validate trigger');return this}var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null}else options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm()});if(options.clearForm)callbacks.push(function(){$form.clearForm()});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){var fn=options.replaceTarget?'replaceWith':'html';$(options.target)[fn](data).each(oldSuccess,arguments)})}else if(options.success)callbacks.push(options.success);options.success=function(data,status,xhr){for(var i=0,max=callbacks.length;i<max;i++)callbacks[i].apply(options,[data,status,xhr||$form,$form])};var files=$('input:file',this).fieldValue();var found=false;for(var j=0;j<files.length;j++)if(files[j])found=true;var multipart=false;if((files.length&&options.iframe!==false)||options.iframe||found||multipart){if(options.closeKeepAlive)$.get(options.closeKeepAlive,fileUpload);else fileUpload()}else $.ajax(options);this.trigger('form-submit-notify',[this,options]);return this;function fileUpload(){var form=$form[0];if($(':input[name=submit]',form).length){alert('Error: Form elements must not be named "submit".');return}var opts=$.extend({},$.ajaxSettings,options);var s=$.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var id='jqFormIO'+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" src="'+opts.iframeSrc+'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />');var io=$io[0];$io.css({position:'absolute',top:'-1000px',left:'-1000px'});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:'n/a',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr('src',opts.iframeSrc)}};var g=opts.global;if(g&&!$.active++)$.event.trigger("ajaxStart");if(g)$.event.trigger("ajaxSend",[xhr,opts]);if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&$.active--;return}if(xhr.aborted)return;var cbInvoked=false;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){opts.extraData=opts.extraData||{};opts.extraData[n]=sub.value;if(sub.type=="image"){opts.extraData[n+'.x']=form.clk_x;opts.extraData[n+'.y']=form.clk_y}}}function doSubmit(){var t=$form.attr('target'),a=$form.attr('action');form.setAttribute('target',id);if(form.getAttribute('method')!='POST')form.setAttribute('method','POST');if(form.getAttribute('action')!=opts.url)form.setAttribute('action',opts.url);if(!opts.skipEncodingOverride){$form.attr({encoding:'multipart/form-data',enctype:'multipart/form-data'})}if(opts.timeout)setTimeout(function(){timedOut=true;cb()},opts.timeout);var extraInputs=[];try{if(opts.extraData)for(var n in opts.extraData)extraInputs.push($('<input type="hidden" name="'+n+'" value="'+opts.extraData[n]+'" />').appendTo(form)[0]);$io.appendTo('body');$io.data('form-plugin-onload',cb);form.submit()}finally{form.setAttribute('action',a);t?form.setAttribute('target',t):$form.removeAttr('target');$(extraInputs).remove()}};if(opts.forceSync)doSubmit();else setTimeout(doSubmit,10);var domCheckCount=100;function cb(){if(cbInvoked)return;var ok=true;try{if(timedOut)throw'timeout';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;var isXml=opts.dataType=='xml'||doc.XMLDocument||$.isXMLDoc(doc);log('isXml='+isXml);if(!isXml&&(doc.body==null||doc.body.innerHTML=='')){if(--domCheckCount){log('requeing onLoad callback, DOM not available');setTimeout(cb,250);return}log('Could not access iframe DOM after 100 tries.');return}log('response detected');cbInvoked=true;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={'content-type':opts.dataType};return headers[header]};if(opts.dataType=='json'||opts.dataType=='script'){var ta=doc.getElementsByTagName('textarea')[0];if(ta)xhr.responseText=ta.value;else{var pre=doc.getElementsByTagName('pre')[0];if(pre)xhr.responseText=pre.innerHTML}}else if(opts.dataType=='xml'&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText)}data=$.httpData(xhr,opts.dataType)}catch(e){log('error caught:',e);ok=false;xhr.error=e;$.handleError(opts,xhr,'error',e)}if(ok){opts.success(data,'success');if(g)$.event.trigger("ajaxSuccess",[xhr,opts])}if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g&&!--$.active)$.event.trigger("ajaxStop");if(opts.complete)opts.complete(xhr,ok?'success':'error');setTimeout(function(){$io.removeData('form-plugin-onload');$io.remove();xhr.responseXML=null},100)};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(s)}else doc=(new DOMParser()).parseFromString(s,'text/xml');return(doc&&doc.documentElement&&doc.documentElement.tagName!='parsererror')?doc:null}}};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind('submit.form-plugin',function(e){e.preventDefault();$(this).ajaxSubmit(options)}).bind('click.form-plugin',function(e){var target=e.target;var $el=$(target);if(!($el.is(":submit,input:image"))){var t=$el.closest(':submit');if(t.length==0)return;target=t[0]}var form=this;form.clk=target;if(target.type=='image'){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY}else if(typeof $.fn.offset=='function'){var offset=$el.offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top}else{form.clk_x=e.pageX-target.offsetLeft;form.clk_y=e.pageY-target.offsetTop}}setTimeout(function(){form.clk=form.clk_x=form.clk_y=null},100)})};$.fn.ajaxFormUnbind=function(){return this.unbind('submit.form-plugin click.form-plugin')};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y})}continue}var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)a.push({name:n,value:v[j]})}else if(v!==null&&typeof v!='undefined')a.push({name:n,value:v})}if(!semantic&&form.clk){var $input=$(form.clk),input=$input[0],n=input.name;if(n&&!input.disabled&&input.type=='image'){a.push({name:n,value:$input.val()});a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y})}}return a};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic))};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n)return;var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++)a.push({name:n,value:v[i]})}else if(v!==null&&typeof v!='undefined')a.push({name:this.name,value:v})});return $.param(a)};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))continue;v.constructor==Array?$.merge(val,v):val.push(v)}return val};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v)v=(op.attributes&&op.attributes['value']&&!(op.attributes['value'].specified))?op.text:op.value;if(one)return v;a.push(v)}}return a}return el.value};$.fn.clearForm=function(){return this.each(function(){$('input,select,textarea',this).clearFields()})};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=='text'||t=='password'||tag=='textarea')this.value='';else if(t=='checkbox'||t=='radio')this.checked=false;else if(tag=='select')this.selectedIndex=-1})};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType))this.reset()})};$.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b})};$.fn.selected=function(select){if(select==undefined)select=true;return this.each(function(){var t=this.type;if(t=='checkbox'||t=='radio')this.checked=select;else if(this.tagName.toLowerCase()=='option'){var $sel=$(this).parent('select');if(select&&$sel[0]&&$sel[0].type=='select-one'){$sel.find('option').selected(false)}this.selected=select}})};function log(){if($.fn.ajaxSubmit.debug){var msg='[jquery.form] '+Array.prototype.join.call(arguments,'');if(window.console&&window.console.log)window.console.log(msg);else if(window.opera&&window.opera.postError)window.opera.postError(msg)}}})(jQuery);
js/jquery.validate.min.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery validation plug-in 1.6
3
+ *
4
+ * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
5
+ * http://docs.jquery.com/Plugins/Validation
6
+ *
7
+ * Copyright (c) 2006 - 2008 Jörn Zaefferer
8
+ *
9
+ * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
10
+ *
11
+ * Dual licensed under the MIT and GPL licenses:
12
+ * http://www.opensource.org/licenses/mit-license.php
13
+ * http://www.gnu.org/licenses/gpl.html
14
+ */
15
+ ;(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode)},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox, select, option",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
16
+ +", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$.event.special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$.event.special[fix].handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};});$.extend($.fn,{delegate:function(type,delegate,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});},triggerEvent:function(type,target){return this.triggerHandler(type,[$.event.fix({type:type,target:target})]);}})})(jQuery);
js/sbc-controller.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * @package WP Simple Booking Calendar
3
+ *
4
+ * Copyright (c) 2011 WP Simple Booking Calendar
5
+ */
6
+
7
+ jQuery(function($) {
8
+
9
+ // Delete calendar
10
+ $('#sbc-wrapper a.submitdelete').bind('click', function(event) {
11
+ var $calendarRow = $(this).closest('tr').addClass('error');
12
+ if (!confirm($(this).attr('title'))) {
13
+ $calendarRow.removeClass('error');
14
+ return false;
15
+ }
16
+ });
17
+
18
+
19
+ /**
20
+ * Editor
21
+ */
22
+ var $editCalendarForm = $('#sbc-wrapper #edit-calendar');
23
+ if ($editCalendarForm.length) {
24
+ sbcCalendarData = JSON.parse(sbcCalendarDataJson);
25
+ }
26
+
27
+ function getCurrentMonth() {
28
+ return $('#sbc-calendar .sbc-navigation select[name="sbcMonth"]').val();
29
+ }
30
+
31
+ function getCurrentYear() {
32
+ return $('#sbc-calendar .sbc-navigation select[name="sbcYear"]').val();
33
+ }
34
+
35
+ // Form validation
36
+ $editCalendarForm.validate({
37
+ errorClass: 'error',
38
+ onSubmit: false
39
+ });
40
+ $editCalendarForm.bind('submit', function() {
41
+ $('input[name="calendarData"]', $editCalendarForm).val(JSON.stringify(sbcCalendarData));
42
+ if ($editCalendarForm.valid()) {
43
+ return true;
44
+ }
45
+ return false;
46
+ });
47
+
48
+ // Status selector
49
+ $('#sbc-editor select').live('change', function() {
50
+ var $this = $(this);
51
+ var statusClass = $this.find('option:selected').attr('class');
52
+
53
+ // Update editor class
54
+ $this.closest('tr').children('td.sbc-editor-day').attr('class', 'sbc-editor-day ' + statusClass);
55
+
56
+ // Update calendar class
57
+ $('#sbc-wrapper table tbody td.sbc-' + $this.attr('name'))
58
+ .removeClass('sbc-status-free')
59
+ .removeClass('sbc-status-booked')
60
+ .removeClass('sbc-status-changeover')
61
+ .addClass(statusClass);
62
+
63
+ // Update calendar data
64
+ var currentYear = 'year' + getCurrentYear();
65
+ var currentMonth = 'month' + getCurrentMonth();
66
+ var currentDay = $this.attr('name');
67
+
68
+ if (!(currentYear in sbcCalendarData)) {
69
+ sbcCalendarData[currentYear] = {};
70
+ }
71
+
72
+ if (!(currentMonth in sbcCalendarData[currentYear])) {
73
+ sbcCalendarData[currentYear][currentMonth] = {};
74
+ }
75
+
76
+ sbcCalendarData[currentYear][currentMonth][currentDay] = $this.val();
77
+ });
78
+
79
+
80
+ /**
81
+ * Editor navigation
82
+ */
83
+ function ajaxCalendarUpdate(operation) {
84
+ var data = {
85
+ action: 'calendarNavigation',
86
+ operation: operation,
87
+ calendarData: JSON.stringify(sbcCalendarData),
88
+ month: getCurrentMonth(),
89
+ year: getCurrentYear()
90
+ };
91
+ $('#sbc-calendar-wrapper div.sbc-loader').addClass('sbc-loader-visible');
92
+ $.post(ajaxurl, data, function(response) {
93
+ $('#sbc-calendar-wrapper').html(response);
94
+ });
95
+ }
96
+
97
+ $('a.sbc-prev-month, a.sbc-next-month', $('#sbc-calendar-wrapper')).live('click', function(event) {
98
+ event.preventDefault();
99
+ ajaxCalendarUpdate($(this).is('.sbc-prev-month') ? 'prevMonth' : 'nextMonth');
100
+ });
101
+
102
+ $('#sbc-calendar .sbc-navigation select').live('change', function() {
103
+ ajaxCalendarUpdate('date');
104
+ });
105
+ });
js/sbc-shortcode.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * @package WP Simple Booking Calendar
3
+ *
4
+ * Copyright (c) 2011 WP Simple Booking Calendar
5
+ */
6
+
7
+ jQuery(function($) {
8
+
9
+ var $container = $('#sbc-metabox');
10
+ $container.find('p.submit input[type=button]').bind('click', function(event) {
11
+ event.preventDefault();
12
+ var attributes = '';
13
+ $container.find('table.form-table td').find(':input').each(function() {
14
+ var $this = $(this);
15
+
16
+ var name = $this.attr('name');
17
+ name = name.substring('sbcMetabox'.length + 1, name.length - 1);
18
+
19
+ var value = $.trim($this.val().replace(/"/g, '{quot}').replace(/</g, '&lt;').replace(/>/g, '&gt;'));
20
+ if (value != '' && value != 'default') {
21
+ attributes += ' ' + name + '="' + value + '"';
22
+ }
23
+ });
24
+
25
+ send_to_editor('[sbc' + attributes + '] ');
26
+ });
27
+
28
+ });
js/sbc.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * @package WP Simple Booking Calendar
3
+ *
4
+ * Copyright (c) 2011 WP Simple Booking Calendar
5
+ */
6
+
7
+ jQuery(function($) {
8
+
9
+ $('div.sbc-calendar-wrapper').each(function() {
10
+ var $calendar = $(this);
11
+
12
+ function getCurrentMonth() {
13
+ return $('.sbc-navigation select[name="sbcMonth"]', $calendar).val();
14
+ }
15
+
16
+ function getCurrentYear() {
17
+ return $('.sbc-navigation select[name="sbcYear"]', $calendar).val();
18
+ }
19
+
20
+ function ajaxCalendarUpdate(operation) {
21
+ var ajaxUrl = $('form', $calendar).attr('action');
22
+ var data = {
23
+ action: 'calendarNavigation',
24
+ operation: operation,
25
+ month: getCurrentMonth(),
26
+ year: getCurrentYear(),
27
+ id: $('form input[name="sbcId"]', $calendar).val()
28
+ };
29
+ $('div.sbc-loader', $calendar).addClass('sbc-loader-visible');
30
+ $.post(ajaxUrl, data, function(response) {
31
+ $calendar.find('#sbc-calendar').replaceWith(response);
32
+ $('.sbc-navigation select', $calendar).bind('change', changeMonthOrYear);
33
+ });
34
+ }
35
+
36
+ // Prev/next month
37
+ $('a.sbc-prev-month, a.sbc-next-month', $calendar).live('click', function(event) {
38
+ event.preventDefault();
39
+ ajaxCalendarUpdate($(this).is('.sbc-prev-month') ? 'prevMonth' : 'nextMonth');
40
+ });
41
+
42
+ // Custom month/year
43
+ function changeMonthOrYear () {
44
+ ajaxCalendarUpdate('date');
45
+ }
46
+ $('.sbc-navigation select', $calendar).bind('change', changeMonthOrYear);
47
+ });
48
+
49
+ });
languages/.htaccess ADDED
@@ -0,0 +1,2 @@
 
 
1
+ Order deny,allow
2
+ Deny from all
languages/sbc-da_DK.mo ADDED
Binary file
languages/sbc-da_DK.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Beschikbaarheid\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-01-26 10:51+0100\n"
6
+ "PO-Revision-Date: 2011-08-11 12:21+0200\n"
7
+ "Last-Translator: BWS <zos@bestwebsoft.com>\n"
8
+ "Language-Team: Lennart Visscher <lennart@local-marketing.nl>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: library/WpSimpleBookingCalendar/Controller.php:56
20
+ #: library/WpSimpleBookingCalendar/Widget.php:25
21
+ #: views/controller/edit.phtml:11
22
+ #: views/controller/index.phtml:11
23
+ msgid "Beschikbaarheid"
24
+ msgstr ""
25
+
26
+ #: library/WpSimpleBookingCalendar/Controller.php:211
27
+ msgid "Calendar Added"
28
+ msgstr ""
29
+
30
+ #: library/WpSimpleBookingCalendar/Controller.php:217
31
+ msgid "Failed to add new calendar"
32
+ msgstr ""
33
+
34
+ #: library/WpSimpleBookingCalendar/Controller.php:225
35
+ msgid "Add New Calendar"
36
+ msgstr ""
37
+
38
+ #: library/WpSimpleBookingCalendar/Controller.php:242
39
+ msgid "Calendar Updated"
40
+ msgstr ""
41
+
42
+ #: library/WpSimpleBookingCalendar/Controller.php:248
43
+ #, php-format
44
+ msgid "Failed to update calendar #%d"
45
+ msgstr ""
46
+
47
+ #: library/WpSimpleBookingCalendar/Controller.php:256
48
+ #: library/WpSimpleBookingCalendar/Controller.php:280
49
+ #, php-format
50
+ msgid "Wrong calendar ID: %d"
51
+ msgstr ""
52
+
53
+ #: library/WpSimpleBookingCalendar/Controller.php:266
54
+ msgid "Edit Calendar"
55
+ msgstr ""
56
+
57
+ #: library/WpSimpleBookingCalendar/Controller.php:284
58
+ msgid "Calendar Removed"
59
+ msgstr ""
60
+
61
+ #: library/WpSimpleBookingCalendar/Controller.php:288
62
+ #, php-format
63
+ msgid "Unable to delete calendar %d"
64
+ msgstr ""
65
+
66
+ #: library/WpSimpleBookingCalendar/Shortcode.php:35
67
+ #: library/WpSimpleBookingCalendar/Shortcode.php:36
68
+ msgid "Generate Beschikbaarheid Token"
69
+ msgstr ""
70
+
71
+ #: library/WpSimpleBookingCalendar/View.php:117
72
+ #, php-format
73
+ msgid "Can't find view template: %s"
74
+ msgstr ""
75
+
76
+ #: library/WpSimpleBookingCalendar/Widget.php:24
77
+ msgid "Use this widget to add booking calendar to the sidebar"
78
+ msgstr ""
79
+
80
+ #: views/calendar/calendar.phtml:49
81
+ msgid "Loading..."
82
+ msgstr "Loading..."
83
+
84
+ #: views/calendar/calendar.phtml:54
85
+ msgid "&lt;&lt; Previous"
86
+ msgstr "&lt;&lt; Forrige"
87
+
88
+ #: views/calendar/calendar.phtml:54
89
+ msgid "Next &gt;&gt;"
90
+ msgstr "Næste &gt;&gt;"
91
+
92
+ #: views/calendar/calendar.phtml:93
93
+ #: views/calendar/calendar.phtml:117
94
+ msgid "Free"
95
+ msgstr "Ledigt"
96
+
97
+ #: views/calendar/calendar.phtml:97
98
+ #: views/calendar/calendar.phtml:117
99
+ msgid "Booked"
100
+ msgstr "Booket"
101
+
102
+ #: views/calendar/calendar.phtml:101
103
+ #: views/calendar/calendar.phtml:117
104
+ msgid "Changeover"
105
+ msgstr "Afventer"
106
+
107
+ #: views/controller/edit.phtml:20
108
+ msgid "Click to toggle"
109
+ msgstr ""
110
+
111
+ #: views/controller/edit.phtml:24
112
+ #: views/controller/index.phtml:17
113
+ msgid "Calendar Name"
114
+ msgstr ""
115
+
116
+ #: views/controller/edit.phtml:37
117
+ msgid "Save Changes"
118
+ msgstr ""
119
+
120
+ #: views/controller/index.phtml:11
121
+ msgid "Add New"
122
+ msgstr ""
123
+
124
+ #: views/controller/index.phtml:18
125
+ msgid "Created"
126
+ msgstr ""
127
+
128
+ #: views/controller/index.phtml:19
129
+ msgid "Modified"
130
+ msgstr ""
131
+
132
+ #: views/controller/index.phtml:26
133
+ #: views/controller/index.phtml:28
134
+ msgid "Edit"
135
+ msgstr ""
136
+
137
+ #: views/controller/index.phtml:28
138
+ msgid "Edit this calendar"
139
+ msgstr ""
140
+
141
+ #: views/controller/index.phtml:29
142
+ msgid "Are you sure you want to delete this calendar?"
143
+ msgstr ""
144
+
145
+ #: views/controller/index.phtml:29
146
+ msgid "Delete"
147
+ msgstr ""
148
+
149
+ #: views/controller/index.phtml:45
150
+ msgid "No calendars found."
151
+ msgstr ""
152
+
153
+ #: views/shortcode/metabox.phtml:30
154
+ #: views/widget/form.phtml:23
155
+ msgid "Yes"
156
+ msgstr ""
157
+
158
+ #: views/shortcode/metabox.phtml:30
159
+ #: views/widget/form.phtml:23
160
+ msgid "No"
161
+ msgstr ""
162
+
163
+ #: views/shortcode/metabox.phtml:31
164
+ #: views/widget/form.phtml:24
165
+ msgid "Select Calendar"
166
+ msgstr ""
167
+
168
+ #: views/shortcode/metabox.phtml:32
169
+ #: views/widget/form.phtml:25
170
+ msgid "Show Legend"
171
+ msgstr ""
172
+
173
+ #: views/shortcode/metabox.phtml:33
174
+ #: views/widget/form.phtml:26
175
+ msgid "Show Calendar Title"
176
+ msgstr ""
177
+
178
+ #: views/shortcode/metabox.phtml:39
179
+ msgid "Send Token to Editor &raquo;"
180
+ msgstr ""
181
+
languages/sbc-de_DE.mo ADDED
Binary file
languages/sbc-de_DE.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Beschikbaarheid\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-01-26 10:51+0100\n"
6
+ "PO-Revision-Date: 2011-08-11 12:21+0200\n"
7
+ "Last-Translator: BWS <zos@bestwebsoft.com>\n"
8
+ "Language-Team: Lennart Visscher <lennart@local-marketing.nl>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: library/WpSimpleBookingCalendar/Controller.php:56
20
+ #: library/WpSimpleBookingCalendar/Widget.php:25
21
+ #: views/controller/edit.phtml:11
22
+ #: views/controller/index.phtml:11
23
+ msgid "Beschikbaarheid"
24
+ msgstr ""
25
+
26
+ #: library/WpSimpleBookingCalendar/Controller.php:211
27
+ msgid "Calendar Added"
28
+ msgstr ""
29
+
30
+ #: library/WpSimpleBookingCalendar/Controller.php:217
31
+ msgid "Failed to add new calendar"
32
+ msgstr ""
33
+
34
+ #: library/WpSimpleBookingCalendar/Controller.php:225
35
+ msgid "Add New Calendar"
36
+ msgstr ""
37
+
38
+ #: library/WpSimpleBookingCalendar/Controller.php:242
39
+ msgid "Calendar Updated"
40
+ msgstr ""
41
+
42
+ #: library/WpSimpleBookingCalendar/Controller.php:248
43
+ #, php-format
44
+ msgid "Failed to update calendar #%d"
45
+ msgstr ""
46
+
47
+ #: library/WpSimpleBookingCalendar/Controller.php:256
48
+ #: library/WpSimpleBookingCalendar/Controller.php:280
49
+ #, php-format
50
+ msgid "Wrong calendar ID: %d"
51
+ msgstr ""
52
+
53
+ #: library/WpSimpleBookingCalendar/Controller.php:266
54
+ msgid "Edit Calendar"
55
+ msgstr ""
56
+
57
+ #: library/WpSimpleBookingCalendar/Controller.php:284
58
+ msgid "Calendar Removed"
59
+ msgstr ""
60
+
61
+ #: library/WpSimpleBookingCalendar/Controller.php:288
62
+ #, php-format
63
+ msgid "Unable to delete calendar %d"
64
+ msgstr ""
65
+
66
+ #: library/WpSimpleBookingCalendar/Shortcode.php:35
67
+ #: library/WpSimpleBookingCalendar/Shortcode.php:36
68
+ msgid "Generate Beschikbaarheid Token"
69
+ msgstr ""
70
+
71
+ #: library/WpSimpleBookingCalendar/View.php:117
72
+ #, php-format
73
+ msgid "Can't find view template: %s"
74
+ msgstr ""
75
+
76
+ #: library/WpSimpleBookingCalendar/Widget.php:24
77
+ msgid "Use this widget to add booking calendar to the sidebar"
78
+ msgstr ""
79
+
80
+ #: views/calendar/calendar.phtml:49
81
+ msgid "Loading..."
82
+ msgstr "Loading..."
83
+
84
+ #: views/calendar/calendar.phtml:54
85
+ msgid "&lt;&lt; Previous"
86
+ msgstr "&lt;&lt; Züruck"
87
+
88
+ #: views/calendar/calendar.phtml:54
89
+ msgid "Next &gt;&gt;"
90
+ msgstr "Weiter &gt;&gt;"
91
+
92
+ #: views/calendar/calendar.phtml:93
93
+ #: views/calendar/calendar.phtml:117
94
+ msgid "Free"
95
+ msgstr "Frei"
96
+
97
+ #: views/calendar/calendar.phtml:97
98
+ #: views/calendar/calendar.phtml:117
99
+ msgid "Booked"
100
+ msgstr "Belegt"
101
+
102
+ #: views/calendar/calendar.phtml:101
103
+ #: views/calendar/calendar.phtml:117
104
+ msgid "Changeover"
105
+ msgstr "Wechseltag"
106
+
107
+ #: views/controller/edit.phtml:20
108
+ msgid "Click to toggle"
109
+ msgstr ""
110
+
111
+ #: views/controller/edit.phtml:24
112
+ #: views/controller/index.phtml:17
113
+ msgid "Calendar Name"
114
+ msgstr ""
115
+
116
+ #: views/controller/edit.phtml:37
117
+ msgid "Save Changes"
118
+ msgstr ""
119
+
120
+ #: views/controller/index.phtml:11
121
+ msgid "Add New"
122
+ msgstr ""
123
+
124
+ #: views/controller/index.phtml:18
125
+ msgid "Created"
126
+ msgstr ""
127
+
128
+ #: views/controller/index.phtml:19
129
+ msgid "Modified"
130
+ msgstr ""
131
+
132
+ #: views/controller/index.phtml:26
133
+ #: views/controller/index.phtml:28
134
+ msgid "Edit"
135
+ msgstr ""
136
+
137
+ #: views/controller/index.phtml:28
138
+ msgid "Edit this calendar"
139
+ msgstr ""
140
+
141
+ #: views/controller/index.phtml:29
142
+ msgid "Are you sure you want to delete this calendar?"
143
+ msgstr ""
144
+
145
+ #: views/controller/index.phtml:29
146
+ msgid "Delete"
147
+ msgstr ""
148
+
149
+ #: views/controller/index.phtml:45
150
+ msgid "No calendars found."
151
+ msgstr ""
152
+
153
+ #: views/shortcode/metabox.phtml:30
154
+ #: views/widget/form.phtml:23
155
+ msgid "Yes"
156
+ msgstr ""
157
+
158
+ #: views/shortcode/metabox.phtml:30
159
+ #: views/widget/form.phtml:23
160
+ msgid "No"
161
+ msgstr ""
162
+
163
+ #: views/shortcode/metabox.phtml:31
164
+ #: views/widget/form.phtml:24
165
+ msgid "Select Calendar"
166
+ msgstr ""
167
+
168
+ #: views/shortcode/metabox.phtml:32
169
+ #: views/widget/form.phtml:25
170
+ msgid "Show Legend"
171
+ msgstr ""
172
+
173
+ #: views/shortcode/metabox.phtml:33
174
+ #: views/widget/form.phtml:26
175
+ msgid "Show Calendar Title"
176
+ msgstr ""
177
+
178
+ #: views/shortcode/metabox.phtml:39
179
+ msgid "Send Token to Editor &raquo;"
180
+ msgstr ""
181
+
languages/sbc-en_US.mo ADDED
Binary file
languages/sbc-en_US.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP Simple Booking Calendar\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-01-26 10:51+0100\n"
6
+ "PO-Revision-Date: 2011-08-11 12:21+0200\n"
7
+ "Last-Translator: BWS <zos@bestwebsoft.com>\n"
8
+ "Language-Team: Lennart Visscher <lennart@local-marketing.nl>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: library/WpSimpleBookingCalendar/Controller.php:56
20
+ #: library/WpSimpleBookingCalendar/Widget.php:25
21
+ #: views/controller/edit.phtml:11
22
+ #: views/controller/index.phtml:11
23
+ msgid "WP Simple Booking Calendar"
24
+ msgstr ""
25
+
26
+ #: library/WpSimpleBookingCalendar/Controller.php:211
27
+ msgid "Calendar Added"
28
+ msgstr ""
29
+
30
+ #: library/WpSimpleBookingCalendar/Controller.php:217
31
+ msgid "Failed to add new calendar"
32
+ msgstr ""
33
+
34
+ #: library/WpSimpleBookingCalendar/Controller.php:225
35
+ msgid "Add New Calendar"
36
+ msgstr ""
37
+
38
+ #: library/WpSimpleBookingCalendar/Controller.php:242
39
+ msgid "Calendar Updated"
40
+ msgstr ""
41
+
42
+ #: library/WpSimpleBookingCalendar/Controller.php:248
43
+ #, php-format
44
+ msgid "Failed to update calendar #%d"
45
+ msgstr ""
46
+
47
+ #: library/WpSimpleBookingCalendar/Controller.php:256
48
+ #: library/WpSimpleBookingCalendar/Controller.php:280
49
+ #, php-format
50
+ msgid "Wrong calendar ID: %d"
51
+ msgstr ""
52
+
53
+ #: library/WpSimpleBookingCalendar/Controller.php:266
54
+ msgid "Edit Calendar"
55
+ msgstr ""
56
+
57
+ #: library/WpSimpleBookingCalendar/Controller.php:284
58
+ msgid "Calendar Removed"
59
+ msgstr ""
60
+
61
+ #: library/WpSimpleBookingCalendar/Controller.php:288
62
+ #, php-format
63
+ msgid "Unable to delete calendar %d"
64
+ msgstr ""
65
+
66
+ #: library/WpSimpleBookingCalendar/Shortcode.php:35
67
+ #: library/WpSimpleBookingCalendar/Shortcode.php:36
68
+ msgid "Generate WP Simple Booking Calendar Token"
69
+ msgstr ""
70
+
71
+ #: library/WpSimpleBookingCalendar/View.php:117
72
+ #, php-format
73
+ msgid "Can't find view template: %s"
74
+ msgstr ""
75
+
76
+ #: library/WpSimpleBookingCalendar/Widget.php:24
77
+ msgid "Use this widget to add booking calendar to the sidebar"
78
+ msgstr ""
79
+
80
+ #: views/calendar/calendar.phtml:49
81
+ msgid "Loading..."
82
+ msgstr ""
83
+
84
+ #: views/calendar/calendar.phtml:54
85
+ msgid "&lt;&lt; Previous"
86
+ msgstr ""
87
+
88
+ #: views/calendar/calendar.phtml:54
89
+ msgid "Next &gt;&gt;"
90
+ msgstr ""
91
+
92
+ #: views/calendar/calendar.phtml:93
93
+ #: views/calendar/calendar.phtml:117
94
+ msgid "Free"
95
+ msgstr ""
96
+
97
+ #: views/calendar/calendar.phtml:97
98
+ #: views/calendar/calendar.phtml:117
99
+ msgid "Booked"
100
+ msgstr ""
101
+
102
+ #: views/calendar/calendar.phtml:101
103
+ #: views/calendar/calendar.phtml:117
104
+ msgid "Changeover"
105
+ msgstr ""
106
+
107
+ #: views/controller/edit.phtml:20
108
+ msgid "Click to toggle"
109
+ msgstr ""
110
+
111
+ #: views/controller/edit.phtml:24
112
+ #: views/controller/index.phtml:17
113
+ msgid "Calendar Name"
114
+ msgstr ""
115
+
116
+ #: views/controller/edit.phtml:37
117
+ msgid "Save Changes"
118
+ msgstr ""
119
+
120
+ #: views/controller/index.phtml:11
121
+ msgid "Add New"
122
+ msgstr ""
123
+
124
+ #: views/controller/index.phtml:18
125
+ msgid "Created"
126
+ msgstr ""
127
+
128
+ #: views/controller/index.phtml:19
129
+ msgid "Modified"
130
+ msgstr ""
131
+
132
+ #: views/controller/index.phtml:26
133
+ #: views/controller/index.phtml:28
134
+ msgid "Edit"
135
+ msgstr ""
136
+
137
+ #: views/controller/index.phtml:28
138
+ msgid "Edit this calendar"
139
+ msgstr ""
140
+
141
+ #: views/controller/index.phtml:29
142
+ msgid "Are you sure you want to delete this calendar?"
143
+ msgstr ""
144
+
145
+ #: views/controller/index.phtml:29
146
+ msgid "Delete"
147
+ msgstr ""
148
+
149
+ #: views/controller/index.phtml:45
150
+ msgid "No calendars found."
151
+ msgstr ""
152
+
153
+ #: views/shortcode/metabox.phtml:30
154
+ #: views/widget/form.phtml:23
155
+ msgid "Yes"
156
+ msgstr ""
157
+
158
+ #: views/shortcode/metabox.phtml:30
159
+ #: views/widget/form.phtml:23
160
+ msgid "No"
161
+ msgstr ""
162
+
163
+ #: views/shortcode/metabox.phtml:31
164
+ #: views/widget/form.phtml:24
165
+ msgid "Select Calendar"
166
+ msgstr ""
167
+
168
+ #: views/shortcode/metabox.phtml:32
169
+ #: views/widget/form.phtml:25
170
+ msgid "Show Legend"
171
+ msgstr ""
172
+
173
+ #: views/shortcode/metabox.phtml:33
174
+ #: views/widget/form.phtml:26
175
+ msgid "Show Calendar Title"
176
+ msgstr ""
177
+
178
+ #: views/shortcode/metabox.phtml:39
179
+ msgid "Send Token to Editor &raquo;"
180
+ msgstr ""
181
+
languages/sbc-es_ES.mo ADDED
Binary file
languages/sbc-es_ES.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Beschikbaarheid\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-01-26 10:51+0100\n"
6
+ "PO-Revision-Date: 2011-08-11 12:21+0200\n"
7
+ "Last-Translator: BWS <zos@bestwebsoft.com>\n"
8
+ "Language-Team: Lennart Visscher <lennart@local-marketing.nl>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: library/WpSimpleBookingCalendar/Controller.php:56
20
+ #: library/WpSimpleBookingCalendar/Widget.php:25
21
+ #: views/controller/edit.phtml:11
22
+ #: views/controller/index.phtml:11
23
+ msgid "Beschikbaarheid"
24
+ msgstr ""
25
+
26
+ #: library/WpSimpleBookingCalendar/Controller.php:211
27
+ msgid "Calendar Added"
28
+ msgstr ""
29
+
30
+ #: library/WpSimpleBookingCalendar/Controller.php:217
31
+ msgid "Failed to add new calendar"
32
+ msgstr ""
33
+
34
+ #: library/WpSimpleBookingCalendar/Controller.php:225
35
+ msgid "Add New Calendar"
36
+ msgstr ""
37
+
38
+ #: library/WpSimpleBookingCalendar/Controller.php:242
39
+ msgid "Calendar Updated"
40
+ msgstr ""
41
+
42
+ #: library/WpSimpleBookingCalendar/Controller.php:248
43
+ #, php-format
44
+ msgid "Failed to update calendar #%d"
45
+ msgstr ""
46
+
47
+ #: library/WpSimpleBookingCalendar/Controller.php:256
48
+ #: library/WpSimpleBookingCalendar/Controller.php:280
49
+ #, php-format
50
+ msgid "Wrong calendar ID: %d"
51
+ msgstr ""
52
+
53
+ #: library/WpSimpleBookingCalendar/Controller.php:266
54
+ msgid "Edit Calendar"
55
+ msgstr ""
56
+
57
+ #: library/WpSimpleBookingCalendar/Controller.php:284
58
+ msgid "Calendar Removed"
59
+ msgstr ""
60
+
61
+ #: library/WpSimpleBookingCalendar/Controller.php:288
62
+ #, php-format
63
+ msgid "Unable to delete calendar %d"
64
+ msgstr ""
65
+
66
+ #: library/WpSimpleBookingCalendar/Shortcode.php:35
67
+ #: library/WpSimpleBookingCalendar/Shortcode.php:36
68
+ msgid "Generate Beschikbaarheid Token"
69
+ msgstr ""
70
+
71
+ #: library/WpSimpleBookingCalendar/View.php:117
72
+ #, php-format
73
+ msgid "Can't find view template: %s"
74
+ msgstr ""
75
+
76
+ #: library/WpSimpleBookingCalendar/Widget.php:24
77
+ msgid "Use this widget to add booking calendar to the sidebar"
78
+ msgstr ""
79
+
80
+ #: views/calendar/calendar.phtml:49
81
+ msgid "Loading..."
82
+ msgstr "Loading..."
83
+
84
+ #: views/calendar/calendar.phtml:54
85
+ msgid "&lt;&lt; Previous"
86
+ msgstr "&lt;&lt; Anterior"
87
+
88
+ #: views/calendar/calendar.phtml:54
89
+ msgid "Next &gt;&gt;"
90
+ msgstr "Siguiente &gt;&gt;"
91
+
92
+ #: views/calendar/calendar.phtml:93
93
+ #: views/calendar/calendar.phtml:117
94
+ msgid "Free"
95
+ msgstr "Libre"
96
+
97
+ #: views/calendar/calendar.phtml:97
98
+ #: views/calendar/calendar.phtml:117
99
+ msgid "Booked"
100
+ msgstr "Reservado"
101
+
102
+ #: views/calendar/calendar.phtml:101
103
+ #: views/calendar/calendar.phtml:117
104
+ msgid "Changeover"
105
+ msgstr "Relevo"
106
+
107
+ #: views/controller/edit.phtml:20
108
+ msgid "Click to toggle"
109
+ msgstr ""
110
+
111
+ #: views/controller/edit.phtml:24
112
+ #: views/controller/index.phtml:17
113
+ msgid "Calendar Name"
114
+ msgstr ""
115
+
116
+ #: views/controller/edit.phtml:37
117
+ msgid "Save Changes"
118
+ msgstr ""
119
+
120
+ #: views/controller/index.phtml:11
121
+ msgid "Add New"
122
+ msgstr ""
123
+
124
+ #: views/controller/index.phtml:18
125
+ msgid "Created"
126
+ msgstr ""
127
+
128
+ #: views/controller/index.phtml:19
129
+ msgid "Modified"
130
+ msgstr ""
131
+
132
+ #: views/controller/index.phtml:26
133
+ #: views/controller/index.phtml:28
134
+ msgid "Edit"
135
+ msgstr ""
136
+
137
+ #: views/controller/index.phtml:28
138
+ msgid "Edit this calendar"
139
+ msgstr ""
140
+
141
+ #: views/controller/index.phtml:29
142
+ msgid "Are you sure you want to delete this calendar?"
143
+ msgstr ""
144
+
145
+ #: views/controller/index.phtml:29
146
+ msgid "Delete"
147
+ msgstr ""
148
+
149
+ #: views/controller/index.phtml:45
150
+ msgid "No calendars found."
151
+ msgstr ""
152
+
153
+ #: views/shortcode/metabox.phtml:30
154
+ #: views/widget/form.phtml:23
155
+ msgid "Yes"
156
+ msgstr ""
157
+
158
+ #: views/shortcode/metabox.phtml:30
159
+ #: views/widget/form.phtml:23
160
+ msgid "No"
161
+ msgstr ""
162
+
163
+ #: views/shortcode/metabox.phtml:31
164
+ #: views/widget/form.phtml:24
165
+ msgid "Select Calendar"
166
+ msgstr ""
167
+
168
+ #: views/shortcode/metabox.phtml:32
169
+ #: views/widget/form.phtml:25
170
+ msgid "Show Legend"
171
+ msgstr ""
172
+
173
+ #: views/shortcode/metabox.phtml:33
174
+ #: views/widget/form.phtml:26
175
+ msgid "Show Calendar Title"
176
+ msgstr ""
177
+
178
+ #: views/shortcode/metabox.phtml:39
179
+ msgid "Send Token to Editor &raquo;"
180
+ msgstr ""
181
+
languages/sbc-fr-FR.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Beschikbaarheid\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-01-26 10:51+0100\n"
6
+ "PO-Revision-Date: 2011-08-11 12:21+0200\n"
7
+ "Last-Translator: BWS <zos@bestwebsoft.com>\n"
8
+ "Language-Team: Lennart Visscher <lennart@local-marketing.nl>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: library/WpSimpleBookingCalendar/Controller.php:56
20
+ #: library/WpSimpleBookingCalendar/Widget.php:25
21
+ #: views/controller/edit.phtml:11
22
+ #: views/controller/index.phtml:11
23
+ msgid "Beschikbaarheid"
24
+ msgstr ""
25
+
26
+ #: library/WpSimpleBookingCalendar/Controller.php:211
27
+ msgid "Calendar Added"
28
+ msgstr ""
29
+
30
+ #: library/WpSimpleBookingCalendar/Controller.php:217
31
+ msgid "Failed to add new calendar"
32
+ msgstr ""
33
+
34
+ #: library/WpSimpleBookingCalendar/Controller.php:225
35
+ msgid "Add New Calendar"
36
+ msgstr ""
37
+
38
+ #: library/WpSimpleBookingCalendar/Controller.php:242
39
+ msgid "Calendar Updated"
40
+ msgstr ""
41
+
42
+ #: library/WpSimpleBookingCalendar/Controller.php:248
43
+ #, php-format
44
+ msgid "Failed to update calendar #%d"
45
+ msgstr ""
46
+
47
+ #: library/WpSimpleBookingCalendar/Controller.php:256
48
+ #: library/WpSimpleBookingCalendar/Controller.php:280
49
+ #, php-format
50
+ msgid "Wrong calendar ID: %d"
51
+ msgstr ""
52
+
53
+ #: library/WpSimpleBookingCalendar/Controller.php:266
54
+ msgid "Edit Calendar"
55
+ msgstr ""
56
+
57
+ #: library/WpSimpleBookingCalendar/Controller.php:284
58
+ msgid "Calendar Removed"
59
+ msgstr ""
60
+
61
+ #: library/WpSimpleBookingCalendar/Controller.php:288
62
+ #, php-format
63
+ msgid "Unable to delete calendar %d"
64
+ msgstr ""
65
+
66
+ #: library/WpSimpleBookingCalendar/Shortcode.php:35
67
+ #: library/WpSimpleBookingCalendar/Shortcode.php:36
68
+ msgid "Generate Beschikbaarheid Token"
69
+ msgstr ""
70
+
71
+ #: library/WpSimpleBookingCalendar/View.php:117
72
+ #, php-format
73
+ msgid "Can't find view template: %s"
74
+ msgstr ""
75
+
76
+ #: library/WpSimpleBookingCalendar/Widget.php:24
77
+ msgid "Use this widget to add booking calendar to the sidebar"
78
+ msgstr ""
79
+
80
+ #: views/calendar/calendar.phtml:49
81
+ msgid "Loading..."
82
+ msgstr "Loading..."
83
+
84
+ #: views/calendar/calendar.phtml:54
85
+ msgid "&lt;&lt; Previous"
86
+ msgstr "&lt;&lt; Précédent"
87
+
88
+ #: views/calendar/calendar.phtml:54
89
+ msgid "Next &gt;&gt;"
90
+ msgstr "Suivant &gt;&gt;"
91
+
92
+ #: views/calendar/calendar.phtml:93
93
+ #: views/calendar/calendar.phtml:117
94
+ msgid "Free"
95
+ msgstr "Libre"
96
+
97
+ #: views/calendar/calendar.phtml:97
98
+ #: views/calendar/calendar.phtml:117
99
+ msgid "Booked"
100
+ msgstr "Occupé"
101
+
102
+ #: views/calendar/calendar.phtml:101
103
+ #: views/calendar/calendar.phtml:117
104
+ msgid "Changeover"
105
+ msgstr "Changement"
106
+
107
+ #: views/controller/edit.phtml:20
108
+ msgid "Click to toggle"
109
+ msgstr ""
110
+
111
+ #: views/controller/edit.phtml:24
112
+ #: views/controller/index.phtml:17
113
+ msgid "Calendar Name"
114
+ msgstr ""
115
+
116
+ #: views/controller/edit.phtml:37
117
+ msgid "Save Changes"
118
+ msgstr ""
119
+
120
+ #: views/controller/index.phtml:11
121
+ msgid "Add New"
122
+ msgstr ""
123
+
124
+ #: views/controller/index.phtml:18
125
+ msgid "Created"
126
+ msgstr ""
127
+
128
+ #: views/controller/index.phtml:19
129
+ msgid "Modified"
130
+ msgstr ""
131
+
132
+ #: views/controller/index.phtml:26
133
+ #: views/controller/index.phtml:28
134
+ msgid "Edit"
135
+ msgstr ""
136
+
137
+ #: views/controller/index.phtml:28
138
+ msgid "Edit this calendar"
139
+ msgstr ""
140
+
141
+ #: views/controller/index.phtml:29
142
+ msgid "Are you sure you want to delete this calendar?"
143
+ msgstr ""
144
+
145
+ #: views/controller/index.phtml:29
146
+ msgid "Delete"
147
+ msgstr ""
148
+
149
+ #: views/controller/index.phtml:45
150
+ msgid "No calendars found."
151
+ msgstr ""
152
+
153
+ #: views/shortcode/metabox.phtml:30
154
+ #: views/widget/form.phtml:23
155
+ msgid "Yes"
156
+ msgstr ""
157
+
158
+ #: views/shortcode/metabox.phtml:30
159
+ #: views/widget/form.phtml:23
160
+ msgid "No"
161
+ msgstr ""
162
+
163
+ #: views/shortcode/metabox.phtml:31
164
+ #: views/widget/form.phtml:24
165
+ msgid "Select Calendar"
166
+ msgstr ""
167
+
168
+ #: views/shortcode/metabox.phtml:32
169
+ #: views/widget/form.phtml:25
170
+ msgid "Show Legend"
171
+ msgstr ""
172
+
173
+ #: views/shortcode/metabox.phtml:33
174
+ #: views/widget/form.phtml:26
175
+ msgid "Show Calendar Title"
176
+ msgstr ""
177
+
178
+ #: views/shortcode/metabox.phtml:39
179
+ msgid "Send Token to Editor &raquo;"
180
+ msgstr ""
181
+
languages/sbc-fr_FR.mo ADDED
Binary file
languages/sbc-it-IT.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Beschikbaarheid\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-01-26 10:51+0100\n"
6
+ "PO-Revision-Date: 2011-08-11 12:21+0200\n"
7
+ "Last-Translator: BWS <zos@bestwebsoft.com>\n"
8
+ "Language-Team: Lennart Visscher <lennart@local-marketing.nl>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: library/WpSimpleBookingCalendar/Controller.php:56
20
+ #: library/WpSimpleBookingCalendar/Widget.php:25
21
+ #: views/controller/edit.phtml:11
22
+ #: views/controller/index.phtml:11
23
+ msgid "Beschikbaarheid"
24
+ msgstr ""
25
+
26
+ #: library/WpSimpleBookingCalendar/Controller.php:211
27
+ msgid "Calendar Added"
28
+ msgstr ""
29
+
30
+ #: library/WpSimpleBookingCalendar/Controller.php:217
31
+ msgid "Failed to add new calendar"
32
+ msgstr ""
33
+
34
+ #: library/WpSimpleBookingCalendar/Controller.php:225
35
+ msgid "Add New Calendar"
36
+ msgstr ""
37
+
38
+ #: library/WpSimpleBookingCalendar/Controller.php:242
39
+ msgid "Calendar Updated"
40
+ msgstr ""
41
+
42
+ #: library/WpSimpleBookingCalendar/Controller.php:248
43
+ #, php-format
44
+ msgid "Failed to update calendar #%d"
45
+ msgstr ""
46
+
47
+ #: library/WpSimpleBookingCalendar/Controller.php:256
48
+ #: library/WpSimpleBookingCalendar/Controller.php:280
49
+ #, php-format
50
+ msgid "Wrong calendar ID: %d"
51
+ msgstr ""
52
+
53
+ #: library/WpSimpleBookingCalendar/Controller.php:266
54
+ msgid "Edit Calendar"
55
+ msgstr ""
56
+
57
+ #: library/WpSimpleBookingCalendar/Controller.php:284
58
+ msgid "Calendar Removed"
59
+ msgstr ""
60
+
61
+ #: library/WpSimpleBookingCalendar/Controller.php:288
62
+ #, php-format
63
+ msgid "Unable to delete calendar %d"
64
+ msgstr ""
65
+
66
+ #: library/WpSimpleBookingCalendar/Shortcode.php:35
67
+ #: library/WpSimpleBookingCalendar/Shortcode.php:36
68
+ msgid "Generate Beschikbaarheid Token"
69
+ msgstr ""
70
+
71
+ #: library/WpSimpleBookingCalendar/View.php:117
72
+ #, php-format
73
+ msgid "Can't find view template: %s"
74
+ msgstr ""
75
+
76
+ #: library/WpSimpleBookingCalendar/Widget.php:24
77
+ msgid "Use this widget to add booking calendar to the sidebar"
78
+ msgstr ""
79
+
80
+ #: views/calendar/calendar.phtml:49
81
+ msgid "Loading..."
82
+ msgstr "Loading..."
83
+
84
+ #: views/calendar/calendar.phtml:54
85
+ msgid "&lt;&lt; Previous"
86
+ msgstr "&lt;&lt; Precedente"
87
+
88
+ #: views/calendar/calendar.phtml:54
89
+ msgid "Next &gt;&gt;"
90
+ msgstr "Successivo &gt;&gt;"
91
+
92
+ #: views/calendar/calendar.phtml:93
93
+ #: views/calendar/calendar.phtml:117
94
+ msgid "Free"
95
+ msgstr "Libero"
96
+
97
+ #: views/calendar/calendar.phtml:97
98
+ #: views/calendar/calendar.phtml:117
99
+ msgid "Booked"
100
+ msgstr "Prenotato"
101
+
102
+ #: views/calendar/calendar.phtml:101
103
+ #: views/calendar/calendar.phtml:117
104
+ msgid "Changeover"
105
+ msgstr "Cambio"
106
+
107
+ #: views/controller/edit.phtml:20
108
+ msgid "Click to toggle"
109
+ msgstr ""
110
+
111
+ #: views/controller/edit.phtml:24
112
+ #: views/controller/index.phtml:17
113
+ msgid "Calendar Name"
114
+ msgstr ""
115
+
116
+ #: views/controller/edit.phtml:37
117
+ msgid "Save Changes"
118
+ msgstr ""
119
+
120
+ #: views/controller/index.phtml:11
121
+ msgid "Add New"
122
+ msgstr ""
123
+
124
+ #: views/controller/index.phtml:18
125
+ msgid "Created"
126
+ msgstr ""
127
+
128
+ #: views/controller/index.phtml:19
129
+ msgid "Modified"
130
+ msgstr ""
131
+
132
+ #: views/controller/index.phtml:26
133
+ #: views/controller/index.phtml:28
134
+ msgid "Edit"
135
+ msgstr ""
136
+
137
+ #: views/controller/index.phtml:28
138
+ msgid "Edit this calendar"
139
+ msgstr ""
140
+
141
+ #: views/controller/index.phtml:29
142
+ msgid "Are you sure you want to delete this calendar?"
143
+ msgstr ""
144
+
145
+ #: views/controller/index.phtml:29
146
+ msgid "Delete"
147
+ msgstr ""
148
+
149
+ #: views/controller/index.phtml:45
150
+ msgid "No calendars found."
151
+ msgstr ""
152
+
153
+ #: views/shortcode/metabox.phtml:30
154
+ #: views/widget/form.phtml:23
155
+ msgid "Yes"
156
+ msgstr ""
157
+
158
+ #: views/shortcode/metabox.phtml:30
159
+ #: views/widget/form.phtml:23
160
+ msgid "No"
161
+ msgstr ""
162
+
163
+ #: views/shortcode/metabox.phtml:31
164
+ #: views/widget/form.phtml:24
165
+ msgid "Select Calendar"
166
+ msgstr ""
167
+
168
+ #: views/shortcode/metabox.phtml:32
169
+ #: views/widget/form.phtml:25
170
+ msgid "Show Legend"
171
+ msgstr ""
172
+
173
+ #: views/shortcode/metabox.phtml:33
174
+ #: views/widget/form.phtml:26
175
+ msgid "Show Calendar Title"
176
+ msgstr ""
177
+
178
+ #: views/shortcode/metabox.phtml:39
179
+ msgid "Send Token to Editor &raquo;"
180
+ msgstr ""
181
+
languages/sbc-it_IT.mo ADDED
Binary file
languages/sbc-nl_NL.mo ADDED
Binary file
languages/sbc-nl_NL.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Beschikbaarheid\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-01-26 10:51+0100\n"
6
+ "PO-Revision-Date: 2011-08-11 12:21+0200\n"
7
+ "Last-Translator: BWS <zos@bestwebsoft.com>\n"
8
+ "Language-Team: Lennart Visscher <lennart@local-marketing.nl>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: library/WpSimpleBookingCalendar/Controller.php:56
20
+ #: library/WpSimpleBookingCalendar/Widget.php:25
21
+ #: views/controller/edit.phtml:11
22
+ #: views/controller/index.phtml:11
23
+ msgid "Beschikbaarheid"
24
+ msgstr ""
25
+
26
+ #: library/WpSimpleBookingCalendar/Controller.php:211
27
+ msgid "Calendar Added"
28
+ msgstr ""
29
+
30
+ #: library/WpSimpleBookingCalendar/Controller.php:217
31
+ msgid "Failed to add new calendar"
32
+ msgstr ""
33
+
34
+ #: library/WpSimpleBookingCalendar/Controller.php:225
35
+ msgid "Add New Calendar"
36
+ msgstr ""
37
+
38
+ #: library/WpSimpleBookingCalendar/Controller.php:242
39
+ msgid "Calendar Updated"
40
+ msgstr ""
41
+
42
+ #: library/WpSimpleBookingCalendar/Controller.php:248
43
+ #, php-format
44
+ msgid "Failed to update calendar #%d"
45
+ msgstr ""
46
+
47
+ #: library/WpSimpleBookingCalendar/Controller.php:256
48
+ #: library/WpSimpleBookingCalendar/Controller.php:280
49
+ #, php-format
50
+ msgid "Wrong calendar ID: %d"
51
+ msgstr ""
52
+
53
+ #: library/WpSimpleBookingCalendar/Controller.php:266
54
+ msgid "Edit Calendar"
55
+ msgstr ""
56
+
57
+ #: library/WpSimpleBookingCalendar/Controller.php:284
58
+ msgid "Calendar Removed"
59
+ msgstr ""
60
+
61
+ #: library/WpSimpleBookingCalendar/Controller.php:288
62
+ #, php-format
63
+ msgid "Unable to delete calendar %d"
64
+ msgstr ""
65
+
66
+ #: library/WpSimpleBookingCalendar/Shortcode.php:35
67
+ #: library/WpSimpleBookingCalendar/Shortcode.php:36
68
+ msgid "Generate Beschikbaarheid Token"
69
+ msgstr ""
70
+
71
+ #: library/WpSimpleBookingCalendar/View.php:117
72
+ #, php-format
73
+ msgid "Can't find view template: %s"
74
+ msgstr ""
75
+
76
+ #: library/WpSimpleBookingCalendar/Widget.php:24
77
+ msgid "Use this widget to add booking calendar to the sidebar"
78
+ msgstr ""
79
+
80
+ #: views/calendar/calendar.phtml:49
81
+ msgid "Loading..."
82
+ msgstr "Laden..."
83
+
84
+ #: views/calendar/calendar.phtml:54
85
+ msgid "&lt;&lt; Previous"
86
+ msgstr "&lt;&lt; Vorige"
87
+
88
+ #: views/calendar/calendar.phtml:54
89
+ msgid "Next &gt;&gt;"
90
+ msgstr "Volgende &gt;&gt;"
91
+
92
+ #: views/calendar/calendar.phtml:93
93
+ #: views/calendar/calendar.phtml:117
94
+ msgid "Free"
95
+ msgstr "Beschikbaar"
96
+
97
+ #: views/calendar/calendar.phtml:97
98
+ #: views/calendar/calendar.phtml:117
99
+ msgid "Booked"
100
+ msgstr "Bezet"
101
+
102
+ #: views/calendar/calendar.phtml:101
103
+ #: views/calendar/calendar.phtml:117
104
+ msgid "Changeover"
105
+ msgstr "Wisseldag"
106
+
107
+ #: views/controller/edit.phtml:20
108
+ msgid "Click to toggle"
109
+ msgstr ""
110
+
111
+ #: views/controller/edit.phtml:24
112
+ #: views/controller/index.phtml:17
113
+ msgid "Calendar Name"
114
+ msgstr ""
115
+
116
+ #: views/controller/edit.phtml:37
117
+ msgid "Save Changes"
118
+ msgstr ""
119
+
120
+ #: views/controller/index.phtml:11
121
+ msgid "Add New"
122
+ msgstr ""
123
+
124
+ #: views/controller/index.phtml:18
125
+ msgid "Created"
126
+ msgstr ""
127
+
128
+ #: views/controller/index.phtml:19
129
+ msgid "Modified"
130
+ msgstr ""
131
+
132
+ #: views/controller/index.phtml:26
133
+ #: views/controller/index.phtml:28
134
+ msgid "Edit"
135
+ msgstr ""
136
+
137
+ #: views/controller/index.phtml:28
138
+ msgid "Edit this calendar"
139
+ msgstr ""
140
+
141
+ #: views/controller/index.phtml:29
142
+ msgid "Are you sure you want to delete this calendar?"
143
+ msgstr ""
144
+
145
+ #: views/controller/index.phtml:29
146
+ msgid "Delete"
147
+ msgstr ""
148
+
149
+ #: views/controller/index.phtml:45
150
+ msgid "No calendars found."
151
+ msgstr ""
152
+
153
+ #: views/shortcode/metabox.phtml:30
154
+ #: views/widget/form.phtml:23
155
+ msgid "Yes"
156
+ msgstr ""
157
+
158
+ #: views/shortcode/metabox.phtml:30
159
+ #: views/widget/form.phtml:23
160
+ msgid "No"
161
+ msgstr ""
162
+
163
+ #: views/shortcode/metabox.phtml:31
164
+ #: views/widget/form.phtml:24
165
+ msgid "Select Calendar"
166
+ msgstr ""
167
+
168
+ #: views/shortcode/metabox.phtml:32
169
+ #: views/widget/form.phtml:25
170
+ msgid "Show Legend"
171
+ msgstr ""
172
+
173
+ #: views/shortcode/metabox.phtml:33
174
+ #: views/widget/form.phtml:26
175
+ msgid "Show Calendar Title"
176
+ msgstr ""
177
+
178
+ #: views/shortcode/metabox.phtml:39
179
+ msgid "Send Token to Editor &raquo;"
180
+ msgstr ""
181
+
library/.htaccess ADDED
@@ -0,0 +1,2 @@
 
 
1
+ Order deny,allow
2
+ Deny from all
library/WpSimpleBookingCalendar.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2011 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar
10
+ */
11
+ class WpSimpleBookingCalendar
12
+ {
13
+ /**
14
+ * Plugin initialization
15
+ * @return void
16
+ */
17
+ public static function init()
18
+ {
19
+ // Backend hooks and action callbacks
20
+ if (is_admin())
21
+ {
22
+ add_action('admin_menu', create_function('', 'new WpSimpleBookingCalendar_Controller();'));
23
+ }
24
+ else
25
+ {
26
+ wp_enqueue_style('sbc', SBC_DIR_URL . 'css/sbc.css');
27
+ wp_enqueue_script('sbc', SBC_DIR_URL . 'js/sbc.js', array('jquery'));
28
+ }
29
+
30
+ // Register shortcode
31
+ add_action('init', create_function('', 'new WpSimpleBookingCalendar_Shortcode();'));
32
+
33
+ // Register AJAX actions
34
+ add_action('init', create_function('', 'new WpSimpleBookingCalendar_Ajax();'));
35
+
36
+ // Register widget
37
+ add_action('widgets_init', create_function('', 'return register_widget("WpSimpleBookingCalendar_Widget");'));
38
+ }
39
+ }
library/WpSimpleBookingCalendar/Ajax.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar ajax class
10
+ */
11
+ class WpSimpleBookingCalendar_Ajax
12
+ {
13
+ /**
14
+ * Constructor
15
+ */
16
+ public function __construct()
17
+ {
18
+ add_action('wp_ajax_calendarNavigation', array($this, 'calendarNavigation'));
19
+ add_action('wp_ajax_nopriv_calendarNavigation', array($this, 'calendarNavigation'));
20
+ }
21
+
22
+ /**
23
+ * Ajax navigation (next/prev month)
24
+ * @return void
25
+ */
26
+ public function calendarNavigation()
27
+ {
28
+ $currentTimestamp = current_time('timestamp');
29
+ $currentYear = (int) gmdate('Y', $currentTimestamp);
30
+ $currentMonth = (int) gmdate('m', $currentTimestamp);
31
+
32
+ // Prepare variables
33
+ $inputMonth = filter_input(INPUT_POST, 'month', FILTER_VALIDATE_INT, array('options' => array(
34
+ 'default' => $currentMonth,
35
+ 'min_range' => 1,
36
+ 'max_range' => 12
37
+ )));
38
+ $inputYear = filter_input(INPUT_POST, 'year', FILTER_VALIDATE_INT, array('options' => array(
39
+ 'default' => $currentYear,
40
+ 'min_range' => $currentYear,
41
+ 'max_range' => $currentYear + 15
42
+ )));
43
+
44
+
45
+ $operation = filter_input(INPUT_POST, 'operation', FILTER_SANITIZE_STRING);
46
+
47
+ if (in_array($operation, array('nextMonth', 'prevMonth')))
48
+ {
49
+ // Additional validation
50
+ if ($operation == 'nextMonth' && $inputMonth == 12 && $inputYear >= $currentYear + 15)
51
+ {
52
+ $inputYear == $currentYear + 14;
53
+ }
54
+ if ($operation == 'prevMonth' && $inputMonth == 1 && $inputYear <= $currentYear)
55
+ {
56
+ $inputYear = $currentYear + 1;
57
+ }
58
+
59
+ $newTimestamp = strtotime(($operation == 'nextMonth' ? '+' : '-') . '1 month',
60
+ gmmktime(1, 1, 1, $inputMonth, 1, $inputYear));
61
+ }
62
+ else
63
+ {
64
+ $newTimestamp = gmmktime(null, null, null, $inputMonth, 1, $inputYear);
65
+ }
66
+
67
+ // Prepare calendar data
68
+ $calendarData = filter_input(INPUT_POST, 'calendarData');
69
+
70
+
71
+ if (!empty($calendarData))
72
+ {
73
+ $includeCalendarEditor = true;
74
+ }
75
+ else
76
+ {
77
+ $includeCalendarEditor = false;
78
+ $model = new WpSimpleBookingCalendar_Model();
79
+ $calendar = $model->getCalendar();
80
+ $calendarData = (isset($calendar['calendarJson']) ? $calendar['calendarJson'] : null);
81
+ }
82
+
83
+ // Disable cache
84
+ header('Cache-Control: no-cache', true);
85
+ header('Pragma: no-cache', true);
86
+
87
+
88
+ // Render calendar
89
+ $view = new WpSimpleBookingCalendar_View();
90
+ $view->setTemplate('calendar/calendar')
91
+ ->assign('timestamp', $newTimestamp)
92
+ ->assign('calendarData', json_decode($calendarData))
93
+ ->assign('includeCalendarEditor', $includeCalendarEditor)
94
+ ->render();
95
+
96
+ exit;
97
+ }
98
+ }
library/WpSimpleBookingCalendar/Controller.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2011 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar controller class
10
+ */
11
+ class WpSimpleBookingCalendar_Controller
12
+ {
13
+ /**
14
+ * Controller hook
15
+ */
16
+ const HOOK = 'wp-simple-booking-calendar';
17
+
18
+ /**
19
+ * The list of supported actions
20
+ * @var array
21
+ */
22
+ protected static $_supportedActions = array('index', 'add', 'edit', 'delete');
23
+
24
+ /**
25
+ * Controller name
26
+ * @var string
27
+ */
28
+ protected $_displayName;
29
+
30
+ /**
31
+ * View object
32
+ * @var WpSimpleBookingCalendar_View
33
+ */
34
+ protected $_view = null;
35
+
36
+ /**
37
+ * Model object
38
+ * @var WpSimpleBookingCalendar_Model
39
+ */
40
+ protected $_model = null;
41
+
42
+ /**
43
+ * Model class
44
+ * @var string
45
+ */
46
+ protected $_modelClass;
47
+
48
+ /**
49
+ * Constructor
50
+ */
51
+ public function __construct()
52
+ {
53
+ $this->_view = new WpSimpleBookingCalendar_View();
54
+ $this->_model = new WpSimpleBookingCalendar_Model();
55
+
56
+ $adminPage = add_menu_page(__('WP Simple Booking Calendar', 'sbc'), __('WP Simple Booking Calendar', 'sbc'), 'manage_options', self::HOOK, array($this, 'render'));
57
+ add_action('admin_print_scripts-' . $adminPage, array($this, 'enqueueAdminScripts'));
58
+ add_action('admin_print_styles-' . $adminPage, array($this, 'enqueueAdminStyles'));
59
+ }
60
+
61
+ /**
62
+ * Enqueues admin javascripts
63
+ * @return void
64
+ */
65
+ public function enqueueAdminScripts()
66
+ {
67
+ wp_enqueue_script('postbox');
68
+ wp_enqueue_script('dashboard');
69
+ wp_enqueue_script('jquery-ui-draggable');
70
+ wp_enqueue_script('jquery-ui-droppable');
71
+ wp_enqueue_script('json2');
72
+ wp_enqueue_script('jquery.form', SBC_DIR_URL . 'js/jquery.form.min.js', array('jquery'));
73
+ wp_enqueue_script('jquery.validate', SBC_DIR_URL . 'js/jquery.validate.min.js', array('jquery.form'));
74
+ wp_enqueue_script(self::HOOK . '-controller', SBC_DIR_URL . 'js/sbc-controller.js', array('json2', 'jquery.validate'));
75
+ }
76
+
77
+ /**
78
+ * Enqueues admin CSS files
79
+ * @return void
80
+ */
81
+ public function enqueueAdminStyles()
82
+ {
83
+ wp_enqueue_style(self::HOOK, SBC_DIR_URL . 'css/sbc.css');
84
+ wp_enqueue_style(self::HOOK . '-controller', SBC_DIR_URL . 'css/sbc-controller.css');
85
+ }
86
+
87
+ /**
88
+ * Returns controller url
89
+ * @return string
90
+ */
91
+ public function getControllerUrl()
92
+ {
93
+ return esc_url(admin_url('admin.php?page=' . self::HOOK));
94
+ }
95
+
96
+ /**
97
+ * Validates and returns current controller action
98
+ * @return string
99
+ */
100
+ public function getCurrentAction()
101
+ {
102
+ $action = filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
103
+ if (!in_array($action, self::$_supportedActions))
104
+ {
105
+ $action = self::$_supportedActions[0];
106
+ }
107
+ return $action;
108
+ }
109
+
110
+ /**
111
+ * Renders controller action
112
+ * @return void
113
+ */
114
+ public function render()
115
+ {
116
+ $actionMethod = $this->getCurrentAction() . 'Action';
117
+ $this->$actionMethod();
118
+ }
119
+
120
+ /**
121
+ * Prepares form data for indexAction & editAction
122
+ * @return array
123
+ */
124
+ protected function _processFormData()
125
+ {
126
+ $calendarName = filter_input(INPUT_POST, 'calendarName', FILTER_SANITIZE_STRING);
127
+
128
+ // Filter calendar data
129
+ $calendarData = json_decode(filter_input(INPUT_POST, 'calendarData'), true);
130
+ if (is_array($calendarData))
131
+ {
132
+ ksort($calendarData);
133
+
134
+ // Process each year
135
+ foreach ($calendarData as $year => $months)
136
+ {
137
+ ksort($calendarData[$year]);
138
+
139
+ // Process each month
140
+ if (is_array($months))
141
+ {
142
+ foreach ($months as $month => $days)
143
+ {
144
+ ksort($calendarData[$year][$month]);
145
+
146
+ // Process each day
147
+ if (is_array($days))
148
+ {
149
+ foreach ($days as $day => $bookingStatus)
150
+ {
151
+ if (!in_array($bookingStatus, array('booked', 'changeover')))
152
+ {
153
+ unset($calendarData[$year][$month][$day]);
154
+ }
155
+ }
156
+ }
157
+
158
+ if (empty($calendarData[$year][$month]))
159
+ {
160
+ unset($calendarData[$year][$month]);
161
+ }
162
+ }
163
+ }
164
+
165
+ if (empty($calendarData[$year]))
166
+ {
167
+ unset($calendarData[$year]);
168
+ }
169
+ }
170
+ }
171
+ else
172
+ {
173
+ $calendarData = array();
174
+ }
175
+
176
+ return array (
177
+ 'calendarName' => $calendarName,
178
+ 'calendarJson' => json_encode($calendarData)
179
+ );
180
+ }
181
+
182
+ /**
183
+ * Action: list of calendars
184
+ * @return void
185
+ */
186
+ public function indexAction()
187
+ {
188
+ $searchQuery = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_STRING);
189
+
190
+ $this->_view->setTemplate('controller/index')
191
+ ->assign('controllerUrl', $this->getControllerUrl())
192
+ ->assign('calendar', $this->_model->getCalendar())
193
+ ->assign('dateFormat', get_option('date_format'))
194
+ ->assign('timeFormat', get_option('time_format'))
195
+ ->assign('searchQuery', $searchQuery)
196
+ ->render();
197
+ }
198
+
199
+ /**
200
+ * Action: new calendar
201
+ * @return void
202
+ */
203
+ public function addAction()
204
+ {
205
+ $formData = $this->_processFormData();
206
+
207
+ if (!empty($_POST))
208
+ {
209
+ if ($this->_model->insertCalendar($formData))
210
+ {
211
+ $this->_view->messageHelper(__('Calendar Added', 'sbc'));
212
+ $this->indexAction();
213
+ return;
214
+ }
215
+ else
216
+ {
217
+ $this->_view->messageHelper(__('Failed to add new calendar', 'sbc'));
218
+ }
219
+ }
220
+
221
+ $this->_view->setTemplate('controller/edit')
222
+ ->assign('controllerUrl', $this->getControllerUrl())
223
+ ->assign('calendarName', $formData['calendarName'])
224
+ ->assign('calendarData', json_decode($formData['calendarJson']))
225
+ ->assign('actionName', __('Add New Calendar', 'sbc'))
226
+ ->assign('onceAction', self::HOOK)
227
+ ->render();
228
+ }
229
+
230
+ /**
231
+ * Action: edit calendar
232
+ * @return void
233
+ */
234
+ public function editAction()
235
+ {
236
+ if (!empty($_POST))
237
+ {
238
+ $formData = $this->_processFormData();
239
+ if ($this->_model->updateCalendar($formData))
240
+ {
241
+ $this->_view->messageHelper(__('Calendar Updated', 'sbc'));
242
+ $this->indexAction();
243
+ return;
244
+ }
245
+ else
246
+ {
247
+ $this->_view->messageHelper(__('Failed to update calendar', 'sbc'));
248
+ }
249
+ }
250
+ else
251
+ {
252
+ $formData = $this->_model->getCalendar();
253
+ if (!$formData)
254
+ {
255
+ $this->_view->messageHelper(__('No calendar found', 'sbc'));
256
+ $this->indexAction();
257
+ return;
258
+ }
259
+ }
260
+
261
+ $this->_view->setTemplate('controller/edit')
262
+ ->assign('controllerUrl', $this->getControllerUrl())
263
+ ->assign('calendarName', $formData['calendarName'])
264
+ ->assign('calendarData', json_decode($formData['calendarJson']))
265
+ ->assign('actionName', __('Edit Calendar', 'sbc'))
266
+ ->assign('onceAction', self::HOOK)
267
+ ->render();
268
+ }
269
+
270
+ /**
271
+ * Action: delete calendar
272
+ * @return void
273
+ */
274
+ public function deleteAction()
275
+ {
276
+ if (!$this->_model->getCalendar())
277
+ {
278
+ $message = __('No calendar found', 'sbc');
279
+ }
280
+ elseif ($this->_model->deleteCalendar())
281
+ {
282
+ $message = __('Calendar Removed', 'sbc');
283
+ }
284
+ else
285
+ {
286
+ $message = __('Unable to delete calendar', 'sbc');
287
+ }
288
+
289
+ $this->_view->messageHelper($message);
290
+ $this->indexAction();
291
+ }
292
+ }
library/WpSimpleBookingCalendar/Exception.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2011 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar exceptions class
10
+ */
11
+ class WpSimpleBookingCalendar_Exception extends Exception
12
+ {}
library/WpSimpleBookingCalendar/Model.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2011 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar model class
10
+ */
11
+ class WpSimpleBookingCalendar_Model
12
+ {
13
+ /**
14
+ * The lookup key used to locate the options record in the wp_options table
15
+ */
16
+ const OPTIONS_KEY = 'wp-simple-booking-calendar-options';
17
+
18
+ /**
19
+ * Options array
20
+ * @var array
21
+ */
22
+ protected $_options = array();
23
+
24
+ /**
25
+ * Performs initializion of the options structure
26
+ */
27
+ public function __construct()
28
+ {
29
+ $options = get_option(self::OPTIONS_KEY);
30
+
31
+ if (false === $options)
32
+ {
33
+ $options = array();
34
+ }
35
+
36
+ $this->_options = $options;
37
+ }
38
+
39
+ /**
40
+ * Updates the option identified by $name with the value provided in $value
41
+ * @param string $name The option name
42
+ * @param mixed $value The option value
43
+ * @return WpSimpleBookingCalendar_Model
44
+ */
45
+ public function setOption($name, $value)
46
+ {
47
+ $this->_options[$name] = $value;
48
+ return $this;
49
+ }
50
+
51
+ /**
52
+ * Returns a value of the option identified by $name
53
+ * @param string $name The option name
54
+ * @return mixed|null
55
+ */
56
+ public function getOption($name)
57
+ {
58
+ $value = array_key_exists($name, $this->_options) ? $this->_options[$name] : null;
59
+ return $value;
60
+ }
61
+
62
+ /**
63
+ * Saves the internal options data to the wp_options table
64
+ * @return boolean
65
+ */
66
+ public function save()
67
+ {
68
+ return update_option(self::OPTIONS_KEY, $this->_options);
69
+ }
70
+
71
+
72
+ /**
73
+ * Return calendar data
74
+ * @return mixed
75
+ */
76
+ public function getCalendar()
77
+ {
78
+ $calendar = $this->getOption('calendars');
79
+ if (isset($calendar[1])) {
80
+ $calendar = $calendar[1];
81
+ }
82
+ return (array_key_exists('calendarName', $calendar) ? $calendar : null);
83
+ }
84
+
85
+
86
+ /**
87
+ * Insert new calendar
88
+ * @param array $data
89
+ * @return boolean
90
+ */
91
+ public function insertCalendar($data)
92
+ {
93
+ $oldCalendar = $this->getCalendar();
94
+ if ($oldCalendar != null || isset($oldCalendar['calendarName']))
95
+ {
96
+ return false;
97
+ }
98
+
99
+ $newCalendar = array(
100
+ 'calendarName' => $data['calendarName'],
101
+ 'calendarJson' => $data['calendarJson'],
102
+ 'dateCreated' => time(),
103
+ 'dateModified' => time()
104
+ );
105
+
106
+ $newCalendar = array(
107
+ 1 => $newCalendar
108
+ );
109
+ return $this->setOption('calendars', $newCalendar)->save();
110
+ }
111
+
112
+ /**
113
+ * Update calendar
114
+ * @param array $data
115
+ * @return boolean
116
+ */
117
+ public function updateCalendar($data)
118
+ {
119
+ $oldCalendar = $this->getCalendar();
120
+
121
+ $updatedCalendar = array(
122
+ 'calendarName' => $data['calendarName'],
123
+ 'calendarJson' => $data['calendarJson'],
124
+ 'dateModified' => time()
125
+ );
126
+
127
+ if ($oldCalendar == null || !isset($oldCalendar['calendarName']))
128
+ {
129
+ return $this->insertCalendar($data);
130
+ }
131
+
132
+ $newData = array_merge($oldCalendar, $updatedCalendar);
133
+
134
+ return $this->setOption('calendars', array(1 => $newData))->save();
135
+
136
+ }
137
+
138
+ /**
139
+ * Delete calendar
140
+ * @return void
141
+ */
142
+ public function deleteCalendar()
143
+ {
144
+ return $this->setOption('calendars', null)->save();
145
+ }
146
+ }
library/WpSimpleBookingCalendar/Shortcode.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2011 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar shortcode class
10
+ */
11
+ class WpSimpleBookingCalendar_Shortcode
12
+ {
13
+ /**
14
+ * Constructor
15
+ */
16
+ public function __construct()
17
+ {
18
+ if (is_admin())
19
+ {
20
+ add_action('admin_menu', array($this, 'registerMetabox'));
21
+ }
22
+ else
23
+ {
24
+ add_shortcode('sbc', array($this, 'processShortcode'));
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Shortcode constructor metabox & scripts
30
+ * @return void
31
+ */
32
+ public function registerMetabox()
33
+ {
34
+ // Metabox
35
+ add_meta_box('sbc-metabox', __('Generate WP Simple Booking Calendar Token', 'sbc'), array($this, 'renderMetabox'), 'post', 'normal', 'high');
36
+ add_meta_box('sbc-metabox', __('Generate WP Simple Booking Calendar Token', 'sbc'), array($this, 'renderMetabox'), 'page', 'normal', 'high');
37
+
38
+ // Scripts & styles
39
+ add_action('admin_print_scripts', array($this, 'enqueueMetaboxScripts'));
40
+ add_action('admin_print_styles', array($this, 'enqueueMetaboxStyles'));
41
+ }
42
+
43
+ /**
44
+ * Enqueues admin scripts
45
+ * @return void
46
+ */
47
+ public function enqueueMetaboxScripts()
48
+ {
49
+ if (!empty($GLOBALS['editing']))
50
+ {
51
+ wp_enqueue_script('sbc-shortcode', SBC_DIR_URL . 'js/sbc-shortcode.js', array('jquery'));
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Enqueues admin styles
57
+ * @return void
58
+ */
59
+ public function enqueueMetaboxStyles()
60
+ {
61
+ if (!empty($GLOBALS['editing']))
62
+ {
63
+ wp_enqueue_style('sbc-shortcode', SBC_DIR_URL . 'css/sbc-shortcode.css');
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Renders shortcode metabox
69
+ * @return void
70
+ */
71
+ public function renderMetabox()
72
+ {
73
+ $model = new WpSimpleBookingCalendar_Model();
74
+ $view = new WpSimpleBookingCalendar_View();
75
+ $view->setTemplate('shortcode/metabox')
76
+ ->assign('calendar', $model->getCalendar())
77
+ ->render();
78
+ }
79
+
80
+ /**
81
+ * Validates the [sbc] shortcode parameters
82
+ * @param array $atts User defined attributes in shortcode tag
83
+ * @return array
84
+ */
85
+ public static function validateAttributes($atts)
86
+ {
87
+ $atts = (array) $atts;
88
+
89
+ // Validate booleans
90
+ $booleans = array('title');
91
+ foreach ($booleans as $key)
92
+ {
93
+ if (isset($atts[$key]))
94
+ {
95
+ // Replace string values: Yes = true, No = false
96
+ if (is_bool($atts[$key]) !== true)
97
+ {
98
+ $value = (strcasecmp($atts[$key], 'yes') == 0 || $atts[$key] == '1');
99
+ }
100
+ else
101
+ {
102
+ $value = $atts[$key];
103
+ }
104
+
105
+ $atts[$key] = $value;
106
+ }
107
+ }
108
+
109
+ // Process attributes
110
+ $defaults = array('id' => null, 'title' => true);
111
+ return shortcode_atts($defaults, $atts);
112
+ }
113
+
114
+ /**
115
+ * Processes the [sbc] shortcode
116
+ * @param array $atts User defined attributes in shortcode tag
117
+ * @param string $content
118
+ * @return string Processed shortcode string
119
+ */
120
+ public function processShortcode($atts, $content = '')
121
+ {
122
+ $values = $this->validateAttributes($atts);
123
+ $model = new WpSimpleBookingCalendar_Model();
124
+ $view = new WpSimpleBookingCalendar_View();
125
+ return $view->setTemplate('shortcode/sbc')
126
+ ->assign('showTitle', $values['title'])
127
+ ->assign('calendar', $model->getCalendar())
128
+ ->fetch();
129
+ }
130
+ }
library/WpSimpleBookingCalendar/View.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2011 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar view class
10
+ */
11
+ class WpSimpleBookingCalendar_View
12
+ {
13
+ /**
14
+ * View variables array
15
+ * @var array
16
+ */
17
+ protected $_variables = array();
18
+
19
+ /**
20
+ * Absolute path for view
21
+ * @var string
22
+ */
23
+ protected $_path = null;
24
+
25
+ /**
26
+ * Base directory for views
27
+ * @var string
28
+ */
29
+ protected $_directory = 'views';
30
+
31
+ /**
32
+ * View script extension
33
+ * @var string
34
+ */
35
+ protected $_extension = '.phtml';
36
+
37
+ /**
38
+ * Template file name to render
39
+ * @var string
40
+ */
41
+ protected $_template = null;
42
+
43
+ /**
44
+ * Constructor
45
+ */
46
+ public function __construct()
47
+ {
48
+ // Looking for a basic directory where plugin resides
49
+ list($pluginDir) = explode('/', plugin_basename(__FILE__));
50
+
51
+ // making up an absolute path to views directory
52
+ $pathArray = array(WP_PLUGIN_DIR, $pluginDir, $this->_directory);
53
+
54
+ $this->_path = implode('/', $pathArray);
55
+ }
56
+
57
+ /**
58
+ * Sets a template filename that will be used later in render() method.
59
+ * Performs a reset of the view variables
60
+ * @param string $template The template filename, without extension
61
+ * @return WpSimpleBookingCalendar_View
62
+ */
63
+ public function setTemplate($template)
64
+ {
65
+ $this->_template = $template;
66
+ $this->_variables = array();
67
+ return $this;
68
+ }
69
+
70
+ /**
71
+ * Updates the view variable identified by $name with the value provided in $value
72
+ * @param string $name The variable name
73
+ * @param mixed $value The variable value
74
+ * @return WpSimpleBookingCalendar_View
75
+ */
76
+ public function __set($name, $value)
77
+ {
78
+ $this->_variables[$name] = $value;
79
+ return $this;
80
+ }
81
+
82
+ /**
83
+ * Updates the view variable identified by $name with the value provided in $value
84
+ * This is an alias for {@link __set()}
85
+ * @param string $name The variable name
86
+ * @param mixed $value The variable value
87
+ * @return WpSimpleBookingCalendar_View
88
+ */
89
+ public function assign($name, $value)
90
+ {
91
+ return $this->__set($name, $value);
92
+ }
93
+
94
+ /**
95
+ * Returns a value of the option identified by $name
96
+ * @param string $name The option name
97
+ * @return mixed|null
98
+ */
99
+ public function __get($name)
100
+ {
101
+ $value = array_key_exists($name, $this->_variables) ? $this->_variables[$name] : null;
102
+ return $value;
103
+ }
104
+
105
+ /**
106
+ * Renders the view script
107
+ * @param string $template
108
+ * @throws WpSimpleBookingCalendar_Exception
109
+ * @return WpSimpleBookingCalendar_View
110
+ */
111
+ public function render($template = null)
112
+ {
113
+ $file = $this->_path . '/' . ($template !== null ? $template : $this->_template) . $this->_extension;
114
+
115
+ if (!is_readable($file))
116
+ {
117
+ throw new WpSimpleBookingCalendar_Exception(sprintf(__("Can't find view template: %s", 'sbc'), $file));
118
+ }
119
+
120
+ include $file;
121
+
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Returns the rendered view script
127
+ * @return string
128
+ */
129
+ public function fetch()
130
+ {
131
+ ob_start();
132
+
133
+ $this->render();
134
+ $contents = ob_get_contents();
135
+
136
+ ob_end_clean();
137
+
138
+ return $contents;
139
+ }
140
+
141
+ /**
142
+ * Renders the given message
143
+ * @param string $message The message to display
144
+ * @param string $type The message type
145
+ * @return void
146
+ */
147
+ public function messageHelper($message, $type = 'updated')
148
+ {
149
+ $this->setTemplate('message')
150
+ ->assign('message', $message)
151
+ ->assign('type', $type)
152
+ ->render();
153
+ }
154
+ }
library/WpSimpleBookingCalendar/Widget.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2011 WP Simple Booking Calendar
6
+ */
7
+
8
+ /**
9
+ * WP Simple Booking Calendar widget class
10
+ */
11
+ class WpSimpleBookingCalendar_Widget extends WP_Widget
12
+ {
13
+ /**
14
+ * List of supported parameters
15
+ * @var array
16
+ */
17
+ protected $_supportedParams = array('id', 'title');
18
+
19
+ /**
20
+ * Constructor
21
+ */
22
+ public function __construct()
23
+ {
24
+ $widgetOptions = array('classname' => 'widget-sbc', 'description' => __('Use this widget to add booking calendar to the sidebar', 'sbc'));
25
+ parent::__construct(false, __('WP Simple Booking Calendar', 'sbc'), $widgetOptions);
26
+ }
27
+
28
+ /**
29
+ * Merge user defined arguments into defaults array
30
+ * @param string|array $args Value to merge with defaults
31
+ * @return array Merged user defined values with defaults
32
+ */
33
+ protected function _parseArgs($args)
34
+ {
35
+ $defaults = array('title' => 'yes');
36
+ foreach ($this->_supportedParams as $key)
37
+ {
38
+ $defaults[$key] = (isset($this->_defaults[$key]) ? $this->_defaults[$key] : '');
39
+ }
40
+
41
+ return wp_parse_args((array) $args, $defaults);
42
+ }
43
+
44
+ /**
45
+ * Processes widget options to be saved
46
+ * @param array $newInstance New settings for this instance as input by the user via form()
47
+ * @param array $oldInstance Old settings for this instance
48
+ * @return array Settings to save or bool false to cancel saving
49
+ */
50
+ public function update($newInstance, $oldInstance)
51
+ {
52
+ $instance = $oldInstance;
53
+ $newInstance = $this->_parseArgs($newInstance);
54
+
55
+ foreach ($this->_supportedParams as $name)
56
+ {
57
+ $instance[$name] = strip_tags($newInstance[$name]);
58
+ }
59
+
60
+ return $instance;
61
+ }
62
+
63
+ /**
64
+ * Outputs the options form on admin
65
+ * @param array $instance Current settings
66
+ * @return void
67
+ */
68
+ public function form($instance)
69
+ {
70
+ $view = new WpSimpleBookingCalendar_View();
71
+ $model = new WpSimpleBookingCalendar_Model();
72
+
73
+ $view->setTemplate('widget/form')
74
+ ->assign('widget', $this)
75
+ ->assign('settings', $this->_parseArgs($instance))
76
+ ->assign('calendar', $model->getCalendar())
77
+ ->render();
78
+ }
79
+
80
+ /**
81
+ * Outputs the content of the widget
82
+ * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
83
+ * @param array $instance The settings for the particular instance of the widget
84
+ * @return string The content of the widget
85
+ */
86
+ public function widget($args, $instance)
87
+ {
88
+ $settings = array();
89
+ foreach ($this->_supportedParams as $name)
90
+ {
91
+ if (!empty($instance[$name]))
92
+ {
93
+ $settings[$name] = apply_filters('widget_' . $name, $instance[$name]);
94
+ }
95
+ }
96
+
97
+ $settings = WpSimpleBookingCalendar_Shortcode::validateAttributes($settings);
98
+
99
+ // View setup
100
+ $view = new WpSimpleBookingCalendar_View();
101
+ $model = new WpSimpleBookingCalendar_Model();
102
+
103
+ $view->setTemplate('widget/widget')
104
+ ->assign('widget', $this)
105
+ ->assign('showTitle', $settings['title'])
106
+ ->assign('calendar', $model->getCalendar())
107
+ ->assign('args', $args)
108
+ ->render();
109
+ }
110
+ }
readme.txt ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP Simple Booking Calendar ===
2
+ Contributors: Bryght, BestWebSoft
3
+ Tags: availability calendar, booking calendar, reservation calendar, availability, booking, calendar, hotel, holiday home, dateblocker, date blocker, scheme, bed and breakfast
4
+ Requires at least: 3.0
5
+ Tested up to: 3.4.2
6
+ Stable tag: 1.0
7
+
8
+ Availability calendar / booking calendar to show when something is booked or free, for example your holiday home.
9
+
10
+
11
+ == Description ==
12
+ Availability calendar for WordPress. See http://www.wpsimplebookingcalendar.com for more info!
13
+
14
+ You can use the calendar as:
15
+
16
+ * Availability calendar / booking calendar for a holiday house
17
+ * Availability calendar / booking calendar for a Bed & Breakfast
18
+ * Reservation scheme for an object
19
+ * Availability of employees
20
+ * Whatever you like!
21
+
22
+ Features of the free version:
23
+
24
+ * Create a calendar and set status per date
25
+ * Generate a token to insert the calendar in a page or post
26
+ * WP Simple Booking Calendar Widget
27
+ * Can be translated in any language using PO files
28
+
29
+ Features of the full version:
30
+
31
+ * Create an unlimited number of calendars
32
+ * Show a legend near the calendar
33
+ * Multiple month view
34
+ * Generate a token to insert the calendar in a page or post
35
+ * WP Simple Booking Calendar Widget
36
+ * Can be translated in any language using PO files
37
+ * Download the full version at: http://www.wpsimplebookingcalendar.com
38
+
39
+
40
+ == Installation ==
41
+
42
+ 1. Upload `wp-simple-booking-calendar` directory to the `/wp-content/plugins/` directory
43
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
44
+ 3. Go to the settings page of the plugin to setup a calendar
45
+ 4. Embed the calendar on any page or post using the shortcode **[sbc]**
46
+
47
+ A sidebar widget is also available.
48
+
49
+
50
+ == Frequently Asked Questions ==
51
+
52
+ = How can I embed the calendar on a page or post? =
53
+
54
+ Use the 'Generate token' field below your editor. An example of a token: [sbc id="1" legend="no" title="yes" view="1"]. If you paste this token in a page it will show the calendar with ID 1, no legend, with title and a 1 month view.
55
+
56
+ = How can I remove the calendar title from displaying? =
57
+
58
+ Edit the shortcode: title="no".
59
+
60
+ = I have another question =
61
+
62
+ Please see http://www.wpsimplebookingcalendar.com for more information and ask your questions there!
63
+
64
+
65
+ == Screenshots ==
66
+
67
+ 1. Two month view of the booking calendar (free version supports one month view only)
68
+ 2. The calendar in a sidebar as widget
69
+ 3. Editing the calendar
70
+
71
+ == Changelog ==
72
+
73
+ = 1.0 =
74
+ * First release
75
+
76
+ == Upgrade Notice ==
77
+ = 1.0 =
78
+ * Stable release
screenshot-1.jpg ADDED
Binary file
screenshot-2.jpg ADDED
Binary file
screenshot-3.jpg ADDED
Binary file
views/.htaccess ADDED
@@ -0,0 +1,2 @@
 
 
1
+ Order deny,allow
2
+ Deny from all
views/calendar/calendar.phtml ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+
8
+ global $wp_locale;
9
+
10
+ $weekBegins = intval(get_option('start_of_week'));
11
+
12
+ $currentTimestamp = current_time('timestamp');
13
+ $currentYear = (int) gmdate('Y', ($this->timestamp ? $this->timestamp : $currentTimestamp));
14
+ $currentMonth = (int) gmdate('m', ($this->timestamp ? $this->timestamp : $currentTimestamp));
15
+
16
+ $unixMonth = mktime(0, 0, 0, $currentMonth, 1, $currentYear);
17
+ $daysInMonth = intval(date('t', $unixMonth));
18
+
19
+ ?>
20
+ <div id="sbc-calendar">
21
+ <div class="sbc-calendar-month">
22
+ <?php if (!$this->includeCalendarEditor): ?>
23
+ <form action="<?php echo esc_url(admin_url('admin-ajax.php')) ?>" method="post">
24
+ <?php endif ?>
25
+ <div class="sbc-navigation">
26
+ <select name="sbcMonth">
27
+ <?php for ($monthIndex = 1; $monthIndex <= 12; $monthIndex++): ?>
28
+ <option value="<?php echo esc_attr($monthIndex) ?>" <?php if ($monthIndex == $currentMonth): ?> selected="selected"<?php endif ?>><?php echo esc_html($wp_locale->get_month($monthIndex)) ?></option>
29
+ <?php endfor ?>
30
+ </select>
31
+ <select name="sbcYear">
32
+ <?php $yearIndexStart = (int) gmdate('Y', $currentTimestamp) ?>
33
+ <?php for ($yearIndex = $yearIndexStart; $yearIndex <= $yearIndexStart + 15; $yearIndex++): ?>
34
+ <option value="<?php echo esc_attr($yearIndex) ?>" <?php if ($yearIndex == $currentYear): ?> selected="selected"<?php endif ?>><?php echo esc_html($yearIndex) ?></option>
35
+ <?php endfor ?>
36
+ </select>
37
+ </div>
38
+ <?php if (!$this->includeCalendarEditor): ?>
39
+ </form>
40
+ <?php endif ?>
41
+ <table>
42
+ <thead>
43
+ <tr>
44
+ <?php for ($weekDay = 0; $weekDay <= 6; $weekDay++): ?>
45
+ <th scope="col"><?php echo esc_attr($wp_locale->get_weekday_initial($wp_locale->get_weekday(($weekDay + $weekBegins) % 7))) ?></th>
46
+ <?php endfor ?>
47
+ </tr>
48
+ </thead>
49
+ <tfoot>
50
+ <tr>
51
+ <td colspan="7" class="pad">
52
+ <div class="sbc-loader"><?php esc_html_e('Loading...', 'sbc') ?></div>
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <td colspan="7" class="pad">
57
+ <a class="sbc-prev-month" href="#"><?php _e('&lt;&lt; Previous', 'sbc') ?></a> | <a class="sbc-next-month" href="#"><?php _e('Next &gt;&gt;', 'sbc') ?></a>
58
+ </td>
59
+ </tr>
60
+ </tfoot>
61
+ <tbody>
62
+ <tr>
63
+ <?php $pad = calendar_week_mod(date('w', $unixMonth) - $weekBegins); if (0 != $pad): ?>
64
+ <td colspan="<?php echo esc_attr($pad) ?>" class="pad">&nbsp;</td>
65
+ <?php endif ?>
66
+
67
+ <?php for ($day = 1; $day <= $daysInMonth; ++$day): ?>
68
+ <?php if (!empty($newRow)): $newRow = false ?>
69
+ </tr>
70
+ <tr>
71
+ <?php endif ?>
72
+
73
+ <?php $dayStatus = (!empty($this->calendarData->{'year' . $currentYear}->{'month' . $currentMonth}->{'day' . $day}) ? $this->calendarData->{'year' . $currentYear}->{'month' . $currentMonth}->{'day' . $day} : 'free') ?>
74
+ <?php $isToday = ($day == gmdate('j', $currentTimestamp) && $currentMonth == gmdate('m', $currentTimestamp) && $currentYear == gmdate('Y', $currentTimestamp)) ?>
75
+ <td class="sbc-day<?php echo esc_attr($day) ?> sbc-status-<?php echo esc_attr($dayStatus) ?> <?php if ($isToday): ?> sbc-today<?php endif ?>">
76
+ <?php echo esc_html($day) ?>
77
+ </td>
78
+
79
+ <?php if (6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $currentMonth, $day, $currentYear)) - $weekBegins)): $newRow = true; endif ?>
80
+ <?php endfor ?>
81
+
82
+ <?php $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $currentMonth, $day, $currentYear)) - $weekBegins); if ($pad != 0 && $pad != 7): ?>
83
+ <td class="pad" colspan="<?php echo esc_attr($pad) ?>">&nbsp;</td>
84
+ <?php endif ?>
85
+ </tr>
86
+ </tbody>
87
+ </table>
88
+ </div>
89
+ </div>
90
+
91
+
92
+ <?php if ($this->includeCalendarEditor): ?>
93
+ <div id="sbc-editor">
94
+ <table>
95
+ <tbody>
96
+ <?php for ($day = 1; $day <= $daysInMonth; ++$day): $dayStatus = (!empty($this->calendarData->{'year' . $currentYear}->{'month' . $currentMonth}->{'day' . $day}) ? $this->calendarData->{'year' . $currentYear}->{'month' . $currentMonth}->{'day' . $day} : 'free') ?>
97
+ <tr>
98
+ <td class="sbc-editor-day sbc-status-<?php echo esc_attr($dayStatus) ?>"><?php echo esc_html($day) ?></td>
99
+ <td class="sbc-editor-status">
100
+ <select name="day<?php echo esc_attr($day) ?>">
101
+ <?php $bookingStatus = array('free' => __('Free', 'sbc'), 'booked' => __('Booked', 'sbc'), 'changeover' => __('Changeover', 'sbc')) ?>
102
+ <?php foreach ($bookingStatus as $statusKey => $statusName): ?>
103
+ <option class="sbc-status-<?php echo esc_attr($statusKey) ?>" value="<?php echo esc_attr($statusKey) ?>"<?php if ($statusKey == $dayStatus): ?> selected="selected"<?php endif ?>><?php echo esc_html($statusName) ?></option>
104
+ <?php endforeach ?>
105
+ </select>
106
+ </td>
107
+ </tr>
108
+ <?php endfor ?>
109
+ </tbody>
110
+ </table>
111
+ </div>
112
+ <?php endif ?>
views/controller/edit.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+ ?>
8
+
9
+ <div id="sbc-wrapper" class="wrap">
10
+ <div id="icon-options-general" class="icon32"><br /></div>
11
+ <h2><a href="<?php echo esc_url($this->controllerUrl) ?>"><?php esc_html_e('WP Simple Booking Calendar', 'sbc') ?></a></h2>
12
+
13
+ <div class="postbox-container">
14
+ <div class="metabox-holder">
15
+ <div class="meta-box-sortables ui-sortable">
16
+
17
+ <form id="edit-calendar" method="post" action="">
18
+
19
+ <div class="postbox">
20
+ <div class="handlediv" title="<?php esc_attr_e('Click to toggle', 'sbc') ?>"><br /></div>
21
+ <h3 class="hndle"><span><?php echo esc_html($this->actionName) ?></span></h3>
22
+ <div class="inside">
23
+ <p>
24
+ <label for="calendarName"><?php esc_html_e('Calendar Name', 'sbc') ?></label>
25
+ <input type="text" id="calendarName" name="calendarName" class="required widefat" value="<?php echo esc_attr($this->calendarName) ?>" minlength="3" maxlength="200" />
26
+ </p>
27
+ <div id="sbc-calendar-wrapper">
28
+ <?php $this->includeCalendarEditor = true; $this->render('calendar/calendar') ?>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <p class="submit">
34
+ <?php wp_nonce_field($this->onceAction) ?>
35
+ <input type="hidden" name="action" value="save" />
36
+ <input type="hidden" name="calendarData" value="" />
37
+ <input class="button-primary" type="submit" name="submit" value="<?php esc_attr_e('Save Changes', 'sbc') ?>" />
38
+ </p>
39
+
40
+ </form>
41
+
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ <?php if (current_user_can('manage_options')): ?>
48
+ <script type="text/javascript">
49
+ //<![CDATA[
50
+ sbcCalendarDataJson = '<?php echo json_encode((is_object($this->calendarData) ? $this->calendarData : (object) array())); ?>';
51
+ //]]>
52
+ </script>
53
+ <?php endif ?>
views/controller/index.phtml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+ ?>
8
+
9
+ <div id="sbc-wrapper" class="wrap">
10
+ <div id="icon-options-general" class="icon32"><br /></div>
11
+ <h2><?php esc_html_e('WP Simple Booking Calendar', 'sbc') ?>
12
+ <?php if (!is_array($this->calendar) || count($this->calendar) == 0): ?>
13
+ <a class="button add-new-h2" href="<?php echo esc_url($this->controllerUrl) ?>&amp;action=add"><?php esc_html_e('Add New', 'sbc') ?></a>
14
+ <?php endif; ?>
15
+ </h2>
16
+
17
+ <?php if (is_array($this->calendar) && count($this->calendar)): ?>
18
+ <table class="widefat post fixed" cellspacing="0">
19
+ <thead>
20
+ <tr class="alt">
21
+ <th class="manage-column column-name"><?php esc_html_e('Calendar Name', 'sbc') ?></th>
22
+ <th class="manage-column column-created"><?php esc_html_e('Created', 'sbc') ?></th>
23
+ <th class="manage-column column-modified"><?php esc_html_e('Modified', 'sbc') ?></th>
24
+ </tr>
25
+ </thead>
26
+ <tbody>
27
+ <tr valign="top">
28
+ <td class="post-title column-title">
29
+ <strong><a title="<?php esc_attr_e('Edit', 'sbc') ?> ‟<?php echo esc_attr($this->calendar['calendarName']) ?>”" href="<?php echo esc_url($this->controllerUrl) ?>&amp;action=edit" class="row-title"><?php echo esc_html($this->calendar['calendarName']) ?></a></strong>
30
+ <div class="row-actions">
31
+ <span class="edit"><a title="<?php esc_attr_e('Edit this calendar', 'sbc') ?>" href="<?php echo esc_url($this->controllerUrl) ?>&amp;action=edit"><?php esc_html_e('Edit', 'sbc') ?></a> | </span>
32
+ <span class="trash"><a title="<?php esc_attr_e('Are you sure you want to delete this calendar?', 'sbc') ?>" href="<?php echo esc_url($this->controllerUrl) ?>&amp;action=delete" class="submitdelete"><?php esc_html_e('Delete', 'sbc') ?></a></span>
33
+ </div>
34
+ </td>
35
+ <td class="street column-created">
36
+ <?php echo esc_html(date($this->dateFormat, $this->calendar['dateCreated'])) ?><br/>
37
+ <?php echo esc_html(date($this->timeFormat, $this->calendar['dateCreated'])) ?>
38
+ </td>
39
+ <td class="street column-modified">
40
+ <?php echo esc_html(date($this->dateFormat, $this->calendar['dateModified'])) ?><br/>
41
+ <?php echo esc_html(date($this->timeFormat, $this->calendar['dateModified'])) ?>
42
+ </td>
43
+ </tr>
44
+ </tbody>
45
+ </table>
46
+ <div class="updated">
47
+ <span style="color: #21759B; font-size:16px;">Get the full version</span>
48
+ <p style="font-size: 14px;">- Show multiple months<br />
49
+ - Create an unlimited number of calendars<br />
50
+ - Show a legend near the calendar<br />
51
+ - Show or hide the months in a dropdown<br />
52
+ - Change the start day of the week<br />
53
+ - Save notes per date in back-end<br />
54
+ - Only $25 (no yearly costs!)<br />
55
+ - Download directly, no registration required<br />
56
+ - Not satisfied? Money back guarantee!</p>
57
+ <p><a class="button-secondary" href="http://www.wpsimplebookingcalendar.com/" target="_blank">Read more</a></p>
58
+ </div>
59
+ <?php else: ?>
60
+ <p><?php esc_html_e('No calendar found.', 'sbc') ?></p>
61
+ <?php endif ?>
62
+ </div>
views/message.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+ ?>
8
+ <div class="updated fade">
9
+ <p><strong><?php echo esc_html($this->message) ?></strong></p>
10
+ </div>
views/shortcode/metabox.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+
8
+ function renderTokenOption(WpSimpleBookingCalendar_View $view, $title, $name, $options)
9
+ {
10
+ ?>
11
+ <tr>
12
+ <th scope="row">
13
+ <label for="sbcMetabox_<?php esc_attr_e($name) ?>"><?php echo $title ?>:</label>
14
+ </th>
15
+ <td>
16
+ <select name="sbcMetabox[<?php esc_attr_e($name) ?>]" id="sbcMetabox_<?php esc_attr_e($name) ?>">
17
+ <?php foreach ((array) $options as $value => $label): ?>
18
+ <option value="<?php esc_attr_e($value) ?>"><?php esc_html_e($label) ?></option>
19
+ <?php endforeach ?>
20
+ </select>
21
+ </td>
22
+ </tr>
23
+ <?php
24
+ }
25
+
26
+ ?>
27
+ <table class="form-table">
28
+ <tbody>
29
+ <?php
30
+ $yesNoOptions = array('yes' => __('Yes', 'sbc'), 'no' => __('No', 'sbc'));
31
+
32
+ renderTokenOption($this, __('Show Calendar Title', 'sbc'), 'title', $yesNoOptions);
33
+ ?>
34
+ </tbody>
35
+ </table>
36
+
37
+ <p class="submit">
38
+ <input type="button" value="<?php esc_attr_e('Send Token to Editor &raquo;', 'sbc') ?>" />
39
+ </p>
40
+
41
+ <div class="clear"></div>
views/shortcode/sbc.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+
8
+ if (null !== $this->calendar):
9
+
10
+ $this->calendarData = json_decode($this->calendar['calendarJson']);
11
+
12
+ if ($this->showTitle):
13
+ ?>
14
+ <h2 class="sbc-title"><?php echo esc_html($this->calendar['calendarName']) ?></h2>
15
+ <?php
16
+ endif;
17
+
18
+ ?>
19
+ <div id="sbc-calendar-wrapper" class="sbc-calendar-wrapper">
20
+ <?php $this->render('calendar/calendar'); ?>
21
+ </div>
22
+ <?php
23
+
24
+ endif;
views/widget/form.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+
8
+ if (!function_exists('renderSbcWidgetOption')): function renderSbcWidgetOption(WpSimpleBookingCalendar_View $view, $title, $name, $options = array())
9
+ {
10
+ ?>
11
+ <p>
12
+ <label for="<?php echo $view->widget->get_field_id($name) ?>"><?php echo $title ?>:</label>
13
+ <select name="<?php echo $view->widget->get_field_name($name) ?>" id="<?php echo $view->widget->get_field_id($name) ?>">
14
+ <?php foreach ($options as $value => $label): ?>
15
+ <option value="<?php esc_attr_e($value) ?>"<?php if ($view->settings[$name] == $value): ?> selected="selected"<?php endif ?>><?php esc_html_e($label) ?></option>
16
+ <?php endforeach ?>
17
+ </select>
18
+ </p>
19
+ <?php
20
+ }
21
+ endif;
22
+
23
+ $yesNoOptions = array('yes' => __('Yes', 'sbc'), 'no' => __('No', 'sbc'));
24
+
25
+ renderSbcWidgetOption($this, __('Show Calendar Title', 'sbc'), 'title', $yesNoOptions);
views/widget/widget.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP Simple Booking Calendar
4
+ *
5
+ * Copyright (c) 2010 Lennart Visscher
6
+ */
7
+
8
+ if (null === $this->calendar):
9
+ return;
10
+ endif;
11
+
12
+ echo $this->args['before_widget'];
13
+
14
+ if ($this->showTitle):
15
+ echo $this->args['before_title'], esc_html($this->calendar['calendarName']), $this->args['after_title'];
16
+ endif;
17
+
18
+ $this->calendarData = json_decode($this->calendar['calendarJson']);
19
+
20
+ ?>
21
+ <div id="sbc-calendar-wrapper" class="sbc-calendar-wrapper">
22
+ <?php $this->render('calendar/calendar') ?>
23
+ </div>
24
+ <?php
25
+
26
+ echo $this->args['after_widget'];
wp-simple-booking-calendar.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: WP Simple Booking Calendar
4
+ * Plugin URI: http://www.wpsimplebookingcalendar.com
5
+ * Description: WP Simple Booking Calendar - Free Version.
6
+ * Version: 1.0
7
+ * Author: WP Simple Booking Calendar
8
+ * Author URI: http://www.wpsimplebookingcalendar.com
9
+ * License: GPL2
10
+ *
11
+ * Copyright (c) 2011 WP Simple Booking Calendar
12
+ */
13
+
14
+ /* Copyright 2011 WP Simple Booking Calendar
15
+
16
+ This program is free software; you can redistribute it and/or modify
17
+ it under the terms of the GNU General Public License, version 2, as
18
+ published by the Free Software Foundation.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
+ */
29
+
30
+ // Translation
31
+ load_plugin_textdomain('sbc', false, dirname(plugin_basename(__FILE__)) . '/languages/');
32
+
33
+ // Initialization
34
+ define('SBC_DIR_URL', plugin_dir_url(__FILE__));
35
+
36
+ require_once 'library/WpSimpleBookingCalendar/Exception.php';
37
+ require_once 'library/WpSimpleBookingCalendar/Model.php';
38
+ require_once 'library/WpSimpleBookingCalendar/View.php';
39
+ require_once 'library/WpSimpleBookingCalendar/Controller.php';
40
+ require_once 'library/WpSimpleBookingCalendar/Shortcode.php';
41
+ require_once 'library/WpSimpleBookingCalendar/Widget.php';
42
+ require_once 'library/WpSimpleBookingCalendar/Ajax.php';
43
+ require_once 'library/WpSimpleBookingCalendar.php';
44
+
45
+ WpSimpleBookingCalendar::init();