Kadence Themes Toolkit - Version 4.4

Version Description

  • Update: New Welcome Page with helpful info.
  • Update: Add local jquery.validator
  • Update: Column shortcode gen.
Download this release

Release Info

Developer britner
Plugin Icon wp plugin Kadence Themes Toolkit
Version 4.4
Comparing to
See all releases

Code changes from version 4.3 to 4.4

assets/jquery.validate.js ADDED
@@ -0,0 +1,1257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * jQuery Validation Plugin 1.11.0pre
3
+ *
4
+ * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
5
+ * http://docs.jquery.com/Plugins/Validation
6
+ *
7
+ * Copyright (c) 2012 Jörn Zaefferer
8
+ *
9
+ * Dual licensed under the MIT and GPL licenses:
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ * http://www.gnu.org/licenses/gpl.html
12
+ */
13
+
14
+ (function($) {
15
+
16
+ $.extend($.fn, {
17
+ // http://docs.jquery.com/Plugins/Validation/validate
18
+ validate: function( options ) {
19
+
20
+ // if nothing is selected, return nothing; can't chain anyway
21
+ if (!this.length) {
22
+ if (options && options.debug && window.console) {
23
+ console.warn( "nothing selected, can't validate, returning nothing" );
24
+ }
25
+ return;
26
+ }
27
+
28
+ // check if a validator for this form was already created
29
+ var validator = $.data(this[0], 'validator');
30
+ if ( validator ) {
31
+ return validator;
32
+ }
33
+
34
+ // Add novalidate tag if HTML5.
35
+ this.attr('novalidate', 'novalidate');
36
+
37
+ validator = new $.validator( options, this[0] );
38
+ $.data(this[0], 'validator', validator);
39
+
40
+ if ( validator.settings.onsubmit ) {
41
+
42
+ this.validateDelegate( ":submit", "click", function(ev) {
43
+ if ( validator.settings.submitHandler ) {
44
+ validator.submitButton = ev.target;
45
+ }
46
+ // allow suppressing validation by adding a cancel class to the submit button
47
+ if ( $(ev.target).hasClass('cancel') ) {
48
+ validator.cancelSubmit = true;
49
+ }
50
+ });
51
+
52
+ // validate the form on submit
53
+ this.submit( function( event ) {
54
+ if ( validator.settings.debug ) {
55
+ // prevent form submit to be able to see console output
56
+ event.preventDefault();
57
+ }
58
+ function handle() {
59
+ var hidden;
60
+ if ( validator.settings.submitHandler ) {
61
+ if (validator.submitButton) {
62
+ // insert a hidden input as a replacement for the missing submit button
63
+ hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
64
+ }
65
+ validator.settings.submitHandler.call( validator, validator.currentForm, event );
66
+ if (validator.submitButton) {
67
+ // and clean up afterwards; thanks to no-block-scope, hidden can be referenced
68
+ hidden.remove();
69
+ }
70
+ return false;
71
+ }
72
+ return true;
73
+ }
74
+
75
+ // prevent submit for invalid forms or custom submit handlers
76
+ if ( validator.cancelSubmit ) {
77
+ validator.cancelSubmit = false;
78
+ return handle();
79
+ }
80
+ if ( validator.form() ) {
81
+ if ( validator.pendingRequest ) {
82
+ validator.formSubmitted = true;
83
+ return false;
84
+ }
85
+ return handle();
86
+ } else {
87
+ validator.focusInvalid();
88
+ return false;
89
+ }
90
+ });
91
+ }
92
+
93
+ return validator;
94
+ },
95
+ // http://docs.jquery.com/Plugins/Validation/valid
96
+ valid: function() {
97
+ if ( $(this[0]).is('form')) {
98
+ return this.validate().form();
99
+ } else {
100
+ var valid = true;
101
+ var validator = $(this[0].form).validate();
102
+ this.each(function() {
103
+ valid &= validator.element(this);
104
+ });
105
+ return valid;
106
+ }
107
+ },
108
+ // attributes: space seperated list of attributes to retrieve and remove
109
+ removeAttrs: function(attributes) {
110
+ var result = {},
111
+ $element = this;
112
+ $.each(attributes.split(/\s/), function(index, value) {
113
+ result[value] = $element.attr(value);
114
+ $element.removeAttr(value);
115
+ });
116
+ return result;
117
+ },
118
+ // http://docs.jquery.com/Plugins/Validation/rules
119
+ rules: function(command, argument) {
120
+ var element = this[0];
121
+
122
+ if (command) {
123
+ var settings = $.data(element.form, 'validator').settings;
124
+ var staticRules = settings.rules;
125
+ var existingRules = $.validator.staticRules(element);
126
+ switch(command) {
127
+ case "add":
128
+ $.extend(existingRules, $.validator.normalizeRule(argument));
129
+ staticRules[element.name] = existingRules;
130
+ if (argument.messages) {
131
+ settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
132
+ }
133
+ break;
134
+ case "remove":
135
+ if (!argument) {
136
+ delete staticRules[element.name];
137
+ return existingRules;
138
+ }
139
+ var filtered = {};
140
+ $.each(argument.split(/\s/), function(index, method) {
141
+ filtered[method] = existingRules[method];
142
+ delete existingRules[method];
143
+ });
144
+ return filtered;
145
+ }
146
+ }
147
+
148
+ var data = $.validator.normalizeRules(
149
+ $.extend(
150
+ {},
151
+ $.validator.metadataRules(element),
152
+ $.validator.classRules(element),
153
+ $.validator.attributeRules(element),
154
+ $.validator.staticRules(element)
155
+ ), element);
156
+
157
+ // make sure required is at front
158
+ if (data.required) {
159
+ var param = data.required;
160
+ delete data.required;
161
+ data = $.extend({required: param}, data);
162
+ }
163
+
164
+ return data;
165
+ }
166
+ });
167
+
168
+ // Custom selectors
169
+ $.extend($.expr[":"], {
170
+ // http://docs.jquery.com/Plugins/Validation/blank
171
+ blank: function(a) {return !$.trim("" + a.value);},
172
+ // http://docs.jquery.com/Plugins/Validation/filled
173
+ filled: function(a) {return !!$.trim("" + a.value);},
174
+ // http://docs.jquery.com/Plugins/Validation/unchecked
175
+ unchecked: function(a) {return !a.checked;}
176
+ });
177
+
178
+ // constructor for validator
179
+ $.validator = function( options, form ) {
180
+ this.settings = $.extend( true, {}, $.validator.defaults, options );
181
+ this.currentForm = form;
182
+ this.init();
183
+ };
184
+
185
+ $.validator.format = function(source, params) {
186
+ if ( arguments.length === 1 ) {
187
+ return function() {
188
+ var args = $.makeArray(arguments);
189
+ args.unshift(source);
190
+ return $.validator.format.apply( this, args );
191
+ };
192
+ }
193
+ if ( arguments.length > 2 && params.constructor !== Array ) {
194
+ params = $.makeArray(arguments).slice(1);
195
+ }
196
+ if ( params.constructor !== Array ) {
197
+ params = [ params ];
198
+ }
199
+ $.each(params, function(i, n) {
200
+ source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
201
+ });
202
+ return source;
203
+ };
204
+
205
+ $.extend($.validator, {
206
+
207
+ defaults: {
208
+ messages: {},
209
+ groups: {},
210
+ rules: {},
211
+ errorClass: "error",
212
+ validClass: "valid",
213
+ errorElement: "label",
214
+ focusInvalid: true,
215
+ errorContainer: $( [] ),
216
+ errorLabelContainer: $( [] ),
217
+ onsubmit: true,
218
+ ignore: ":hidden",
219
+ ignoreTitle: false,
220
+ onfocusin: function(element, event) {
221
+ this.lastActive = element;
222
+
223
+ // hide error label and remove error class on focus if enabled
224
+ if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
225
+ if ( this.settings.unhighlight ) {
226
+ this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
227
+ }
228
+ this.addWrapper(this.errorsFor(element)).hide();
229
+ }
230
+ },
231
+ onfocusout: function(element, event) {
232
+ if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
233
+ this.element(element);
234
+ }
235
+ },
236
+ onkeyup: function(element, event) {
237
+ if ( event.which === 9 && this.elementValue(element) === '' ) {
238
+ return;
239
+ } else if ( element.name in this.submitted || element === this.lastActive ) {
240
+ this.element(element);
241
+ }
242
+ },
243
+ onclick: function(element, event) {
244
+ // click on selects, radiobuttons and checkboxes
245
+ if ( element.name in this.submitted ) {
246
+ this.element(element);
247
+ }
248
+ // or option elements, check parent select in that case
249
+ else if (element.parentNode.name in this.submitted) {
250
+ this.element(element.parentNode);
251
+ }
252
+ },
253
+ highlight: function(element, errorClass, validClass) {
254
+ if (element.type === 'radio') {
255
+ this.findByName(element.name).addClass(errorClass).removeClass(validClass);
256
+ } else {
257
+ $(element).addClass(errorClass).removeClass(validClass);
258
+ }
259
+ },
260
+ unhighlight: function(element, errorClass, validClass) {
261
+ if (element.type === 'radio') {
262
+ this.findByName(element.name).removeClass(errorClass).addClass(validClass);
263
+ } else {
264
+ $(element).removeClass(errorClass).addClass(validClass);
265
+ }
266
+ }
267
+ },
268
+
269
+ // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
270
+ setDefaults: function(settings) {
271
+ $.extend( $.validator.defaults, settings );
272
+ },
273
+
274
+ messages: {
275
+ required: "This field is required.",
276
+ remote: "Please fix this field.",
277
+ email: "Please enter a valid email address.",
278
+ url: "Please enter a valid URL.",
279
+ date: "Please enter a valid date.",
280
+ dateISO: "Please enter a valid date (ISO).",
281
+ number: "Please enter a valid number.",
282
+ digits: "Please enter only digits.",
283
+ creditcard: "Please enter a valid credit card number.",
284
+ equalTo: "Please enter the same value again.",
285
+ maxlength: $.validator.format("Please enter no more than {0} characters."),
286
+ minlength: $.validator.format("Please enter at least {0} characters."),
287
+ rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
288
+ range: $.validator.format("Please enter a value between {0} and {1}."),
289
+ max: $.validator.format("Please enter a value less than or equal to {0}."),
290
+ min: $.validator.format("Please enter a value greater than or equal to {0}.")
291
+ },
292
+
293
+ autoCreateRanges: false,
294
+
295
+ prototype: {
296
+
297
+ init: function() {
298
+ this.labelContainer = $(this.settings.errorLabelContainer);
299
+ this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
300
+ this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
301
+ this.submitted = {};
302
+ this.valueCache = {};
303
+ this.pendingRequest = 0;
304
+ this.pending = {};
305
+ this.invalid = {};
306
+ this.reset();
307
+
308
+ var groups = (this.groups = {});
309
+ $.each(this.settings.groups, function(key, value) {
310
+ $.each(value.split(/\s/), function(index, name) {
311
+ groups[name] = key;
312
+ });
313
+ });
314
+ var rules = this.settings.rules;
315
+ $.each(rules, function(key, value) {
316
+ rules[key] = $.validator.normalizeRule(value);
317
+ });
318
+
319
+ function delegate(event) {
320
+ var validator = $.data(this[0].form, "validator"),
321
+ eventType = "on" + event.type.replace(/^validate/, "");
322
+ if (validator.settings[eventType]) {
323
+ validator.settings[eventType].call(validator, this[0], event);
324
+ }
325
+ }
326
+ $(this.currentForm)
327
+ .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " +
328
+ "[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
329
+ "[type='email'], [type='datetime'], [type='date'], [type='month'], " +
330
+ "[type='week'], [type='time'], [type='datetime-local'], " +
331
+ "[type='range'], [type='color'] ",
332
+ "focusin focusout keyup", delegate)
333
+ .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);
334
+
335
+ if (this.settings.invalidHandler) {
336
+ $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
337
+ }
338
+ },
339
+
340
+ // http://docs.jquery.com/Plugins/Validation/Validator/form
341
+ form: function() {
342
+ this.checkForm();
343
+ $.extend(this.submitted, this.errorMap);
344
+ this.invalid = $.extend({}, this.errorMap);
345
+ if (!this.valid()) {
346
+ $(this.currentForm).triggerHandler("invalid-form", [this]);
347
+ }
348
+ this.showErrors();
349
+ return this.valid();
350
+ },
351
+
352
+ checkForm: function() {
353
+ this.prepareForm();
354
+ for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
355
+ this.check( elements[i] );
356
+ }
357
+ return this.valid();
358
+ },
359
+
360
+ // http://docs.jquery.com/Plugins/Validation/Validator/element
361
+ element: function( element ) {
362
+ element = this.validationTargetFor( this.clean( element ) );
363
+ this.lastElement = element;
364
+ this.prepareElement( element );
365
+ this.currentElements = $(element);
366
+ var result = this.check( element ) !== false;
367
+ if (result) {
368
+ delete this.invalid[element.name];
369
+ } else {
370
+ this.invalid[element.name] = true;
371
+ }
372
+ if ( !this.numberOfInvalids() ) {
373
+ // Hide error containers on last error
374
+ this.toHide = this.toHide.add( this.containers );
375
+ }
376
+ this.showErrors();
377
+ return result;
378
+ },
379
+
380
+ // http://docs.jquery.com/Plugins/Validation/Validator/showErrors
381
+ showErrors: function(errors) {
382
+ if(errors) {
383
+ // add items to error list and map
384
+ $.extend( this.errorMap, errors );
385
+ this.errorList = [];
386
+ for ( var name in errors ) {
387
+ this.errorList.push({
388
+ message: errors[name],
389
+ element: this.findByName(name)[0]
390
+ });
391
+ }
392
+ // remove items from success list
393
+ this.successList = $.grep( this.successList, function(element) {
394
+ return !(element.name in errors);
395
+ });
396
+ }
397
+ if (this.settings.showErrors) {
398
+ this.settings.showErrors.call( this, this.errorMap, this.errorList );
399
+ } else {
400
+ this.defaultShowErrors();
401
+ }
402
+ },
403
+
404
+ // http://docs.jquery.com/Plugins/Validation/Validator/resetForm
405
+ resetForm: function() {
406
+ if ( $.fn.resetForm ) {
407
+ $( this.currentForm ).resetForm();
408
+ }
409
+ this.submitted = {};
410
+ this.lastElement = null;
411
+ this.prepareForm();
412
+ this.hideErrors();
413
+ this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
414
+ },
415
+
416
+ numberOfInvalids: function() {
417
+ return this.objectLength(this.invalid);
418
+ },
419
+
420
+ objectLength: function( obj ) {
421
+ var count = 0;
422
+ for ( var i in obj ) {
423
+ count++;
424
+ }
425
+ return count;
426
+ },
427
+
428
+ hideErrors: function() {
429
+ this.addWrapper( this.toHide ).hide();
430
+ },
431
+
432
+ valid: function() {
433
+ return this.size() === 0;
434
+ },
435
+
436
+ size: function() {
437
+ return this.errorList.length;
438
+ },
439
+
440
+ focusInvalid: function() {
441
+ if( this.settings.focusInvalid ) {
442
+ try {
443
+ $(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
444
+ .filter(":visible")
445
+ .focus()
446
+ // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
447
+ .trigger("focusin");
448
+ } catch(e) {
449
+ // ignore IE throwing errors when focusing hidden elements
450
+ }
451
+ }
452
+ },
453
+
454
+ findLastActive: function() {
455
+ var lastActive = this.lastActive;
456
+ return lastActive && $.grep(this.errorList, function(n) {
457
+ return n.element.name === lastActive.name;
458
+ }).length === 1 && lastActive;
459
+ },
460
+
461
+ elements: function() {
462
+ var validator = this,
463
+ rulesCache = {};
464
+
465
+ // select all valid inputs inside the form (no submit or reset buttons)
466
+ return $(this.currentForm)
467
+ .find("input, select, textarea")
468
+ .not(":submit, :reset, :image, [disabled]")
469
+ .not( this.settings.ignore )
470
+ .filter(function() {
471
+ if ( !this.name && validator.settings.debug && window.console ) {
472
+ console.error( "%o has no name assigned", this);
473
+ }
474
+
475
+ // select only the first element for each name, and only those with rules specified
476
+ if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
477
+ return false;
478
+ }
479
+
480
+ rulesCache[this.name] = true;
481
+ return true;
482
+ });
483
+ },
484
+
485
+ clean: function( selector ) {
486
+ return $( selector )[0];
487
+ },
488
+
489
+ errors: function() {
490
+ var errorClass = this.settings.errorClass.replace(' ', '.');
491
+ return $( this.settings.errorElement + "." + errorClass, this.errorContext );
492
+ },
493
+
494
+ reset: function() {
495
+ this.successList = [];
496
+ this.errorList = [];
497
+ this.errorMap = {};
498
+ this.toShow = $([]);
499
+ this.toHide = $([]);
500
+ this.currentElements = $([]);
501
+ },
502
+
503
+ prepareForm: function() {
504
+ this.reset();
505
+ this.toHide = this.errors().add( this.containers );
506
+ },
507
+
508
+ prepareElement: function( element ) {
509
+ this.reset();
510
+ this.toHide = this.errorsFor(element);
511
+ },
512
+
513
+ elementValue: function( element ) {
514
+ var type = $(element).attr('type'),
515
+ val = $(element).val();
516
+
517
+ if ( type === 'radio' || type === 'checkbox' ) {
518
+ return $('input[name="' + $(element).attr('name') + '"]:checked').val();
519
+ }
520
+
521
+ if ( typeof val === 'string' ) {
522
+ return val.replace(/\r/g, "");
523
+ }
524
+ return val;
525
+ },
526
+
527
+ check: function( element ) {
528
+ element = this.validationTargetFor( this.clean( element ) );
529
+
530
+ var rules = $(element).rules();
531
+ var dependencyMismatch = false;
532
+ var val = this.elementValue(element);
533
+ var result;
534
+
535
+ for (var method in rules ) {
536
+ var rule = { method: method, parameters: rules[method] };
537
+ try {
538
+
539
+ result = $.validator.methods[method].call( this, val, element, rule.parameters );
540
+
541
+ // if a method indicates that the field is optional and therefore valid,
542
+ // don't mark it as valid when there are no other rules
543
+ if ( result === "dependency-mismatch" ) {
544
+ dependencyMismatch = true;
545
+ continue;
546
+ }
547
+ dependencyMismatch = false;
548
+
549
+ if ( result === "pending" ) {
550
+ this.toHide = this.toHide.not( this.errorsFor(element) );
551
+ return;
552
+ }
553
+
554
+ if( !result ) {
555
+ this.formatAndAdd( element, rule );
556
+ return false;
557
+ }
558
+ } catch(e) {
559
+ if ( this.settings.debug && window.console ) {
560
+ console.log("exception occured when checking element " + element.id + ", check the '" + rule.method + "' method", e);
561
+ }
562
+ throw e;
563
+ }
564
+ }
565
+ if (dependencyMismatch) {
566
+ return;
567
+ }
568
+ if ( this.objectLength(rules) ) {
569
+ this.successList.push(element);
570
+ }
571
+ return true;
572
+ },
573
+
574
+ // return the custom message for the given element and validation method
575
+ // specified in the element's "messages" metadata
576
+ customMetaMessage: function(element, method) {
577
+ if (!$.metadata) {
578
+ return;
579
+ }
580
+ var meta = this.settings.meta ? $(element).metadata()[this.settings.meta] : $(element).metadata();
581
+ return meta && meta.messages && meta.messages[method];
582
+ },
583
+
584
+ // return the custom message for the given element and validation method
585
+ // specified in the element's HTML5 data attribute
586
+ customDataMessage: function(element, method) {
587
+ return $(element).data('msg-' + method.toLowerCase()) || (element.attributes && $(element).attr('data-msg-' + method.toLowerCase()));
588
+ },
589
+
590
+ // return the custom message for the given element name and validation method
591
+ customMessage: function( name, method ) {
592
+ var m = this.settings.messages[name];
593
+ return m && (m.constructor === String ? m : m[method]);
594
+ },
595
+
596
+ // return the first defined argument, allowing empty strings
597
+ findDefined: function() {
598
+ for(var i = 0; i < arguments.length; i++) {
599
+ if (arguments[i] !== undefined) {
600
+ return arguments[i];
601
+ }
602
+ }
603
+ return undefined;
604
+ },
605
+
606
+ defaultMessage: function( element, method) {
607
+ return this.findDefined(
608
+ this.customMessage( element.name, method ),
609
+ this.customDataMessage( element, method ),
610
+ this.customMetaMessage( element, method ),
611
+ // title is never undefined, so handle empty string as undefined
612
+ !this.settings.ignoreTitle && element.title || undefined,
613
+ $.validator.messages[method],
614
+ "<strong>Warning: No message defined for " + element.name + "</strong>"
615
+ );
616
+ },
617
+
618
+ formatAndAdd: function( element, rule ) {
619
+ var message = this.defaultMessage( element, rule.method ),
620
+ theregex = /\$?\{(\d+)\}/g;
621
+ if ( typeof message === "function" ) {
622
+ message = message.call(this, rule.parameters, element);
623
+ } else if (theregex.test(message)) {
624
+ message = $.validator.format(message.replace(theregex, '{$1}'), rule.parameters);
625
+ }
626
+ this.errorList.push({
627
+ message: message,
628
+ element: element
629
+ });
630
+
631
+ this.errorMap[element.name] = message;
632
+ this.submitted[element.name] = message;
633
+ },
634
+
635
+ addWrapper: function(toToggle) {
636
+ if ( this.settings.wrapper ) {
637
+ toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
638
+ }
639
+ return toToggle;
640
+ },
641
+
642
+ defaultShowErrors: function() {
643
+ var i, elements;
644
+ for ( i = 0; this.errorList[i]; i++ ) {
645
+ var error = this.errorList[i];
646
+ if ( this.settings.highlight ) {
647
+ this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
648
+ }
649
+ this.showLabel( error.element, error.message );
650
+ }
651
+ if( this.errorList.length ) {
652
+ this.toShow = this.toShow.add( this.containers );
653
+ }
654
+ if (this.settings.success) {
655
+ for ( i = 0; this.successList[i]; i++ ) {
656
+ this.showLabel( this.successList[i] );
657
+ }
658
+ }
659
+ if (this.settings.unhighlight) {
660
+ for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
661
+ this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
662
+ }
663
+ }
664
+ this.toHide = this.toHide.not( this.toShow );
665
+ this.hideErrors();
666
+ this.addWrapper( this.toShow ).show();
667
+ },
668
+
669
+ validElements: function() {
670
+ return this.currentElements.not(this.invalidElements());
671
+ },
672
+
673
+ invalidElements: function() {
674
+ return $(this.errorList).map(function() {
675
+ return this.element;
676
+ });
677
+ },
678
+
679
+ showLabel: function(element, message) {
680
+ var label = this.errorsFor( element );
681
+ if ( label.length ) {
682
+ // refresh error/success class
683
+ label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
684
+
685
+ // check if we have a generated label, replace the message then
686
+ if ( label.attr("generated") ) {
687
+ label.html(message);
688
+ }
689
+ } else {
690
+ // create label
691
+ label = $("<" + this.settings.errorElement + "/>")
692
+ .attr({"for": this.idOrName(element), generated: true})
693
+ .addClass(this.settings.errorClass)
694
+ .html(message || "");
695
+ if ( this.settings.wrapper ) {
696
+ // make sure the element is visible, even in IE
697
+ // actually showing the wrapped element is handled elsewhere
698
+ label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
699
+ }
700
+ if ( !this.labelContainer.append(label).length ) {
701
+ if ( this.settings.errorPlacement ) {
702
+ this.settings.errorPlacement(label, $(element) );
703
+ } else {
704
+ label.insertAfter(element);
705
+ }
706
+ }
707
+ }
708
+ if ( !message && this.settings.success ) {
709
+ label.text("");
710
+ if ( typeof this.settings.success === "string" ) {
711
+ label.addClass( this.settings.success );
712
+ } else {
713
+ this.settings.success( label, element );
714
+ }
715
+ }
716
+ this.toShow = this.toShow.add(label);
717
+ },
718
+
719
+ errorsFor: function(element) {
720
+ var name = this.idOrName(element);
721
+ return this.errors().filter(function() {
722
+ return $(this).attr('for') === name;
723
+ });
724
+ },
725
+
726
+ idOrName: function(element) {
727
+ return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
728
+ },
729
+
730
+ validationTargetFor: function(element) {
731
+ // if radio/checkbox, validate first element in group instead
732
+ if (this.checkable(element)) {
733
+ element = this.findByName( element.name ).not(this.settings.ignore)[0];
734
+ }
735
+ return element;
736
+ },
737
+
738
+ checkable: function( element ) {
739
+ return (/radio|checkbox/i).test(element.type);
740
+ },
741
+
742
+ findByName: function( name ) {
743
+ return $(this.currentForm).find('[name="' + name + '"]');
744
+ },
745
+
746
+ getLength: function(value, element) {
747
+ switch( element.nodeName.toLowerCase() ) {
748
+ case 'select':
749
+ return $("option:selected", element).length;
750
+ case 'input':
751
+ if( this.checkable( element) ) {
752
+ return this.findByName(element.name).filter(':checked').length;
753
+ }
754
+ }
755
+ return value.length;
756
+ },
757
+
758
+ depend: function(param, element) {
759
+ return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
760
+ },
761
+
762
+ dependTypes: {
763
+ "boolean": function(param, element) {
764
+ return param;
765
+ },
766
+ "string": function(param, element) {
767
+ return !!$(param, element.form).length;
768
+ },
769
+ "function": function(param, element) {
770
+ return param(element);
771
+ }
772
+ },
773
+
774
+ optional: function(element) {
775
+ var val = this.elementValue(element);
776
+ return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
777
+ },
778
+
779
+ startRequest: function(element) {
780
+ if (!this.pending[element.name]) {
781
+ this.pendingRequest++;
782
+ this.pending[element.name] = true;
783
+ }
784
+ },
785
+
786
+ stopRequest: function(element, valid) {
787
+ this.pendingRequest--;
788
+ // sometimes synchronization fails, make sure pendingRequest is never < 0
789
+ if (this.pendingRequest < 0) {
790
+ this.pendingRequest = 0;
791
+ }
792
+ delete this.pending[element.name];
793
+ if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
794
+ $(this.currentForm).submit();
795
+ this.formSubmitted = false;
796
+ } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
797
+ $(this.currentForm).triggerHandler("invalid-form", [this]);
798
+ this.formSubmitted = false;
799
+ }
800
+ },
801
+
802
+ previousValue: function(element) {
803
+ return $.data(element, "previousValue") || $.data(element, "previousValue", {
804
+ old: null,
805
+ valid: true,
806
+ message: this.defaultMessage( element, "remote" )
807
+ });
808
+ }
809
+
810
+ },
811
+
812
+ classRuleSettings: {
813
+ required: {required: true},
814
+ email: {email: true},
815
+ url: {url: true},
816
+ date: {date: true},
817
+ dateISO: {dateISO: true},
818
+ number: {number: true},
819
+ digits: {digits: true},
820
+ creditcard: {creditcard: true}
821
+ },
822
+
823
+ addClassRules: function(className, rules) {
824
+ if ( className.constructor === String ) {
825
+ this.classRuleSettings[className] = rules;
826
+ } else {
827
+ $.extend(this.classRuleSettings, className);
828
+ }
829
+ },
830
+
831
+ classRules: function(element) {
832
+ var rules = {};
833
+ var classes = $(element).attr('class');
834
+ if ( classes ) {
835
+ $.each(classes.split(' '), function() {
836
+ if (this in $.validator.classRuleSettings) {
837
+ $.extend(rules, $.validator.classRuleSettings[this]);
838
+ }
839
+ });
840
+ }
841
+ return rules;
842
+ },
843
+
844
+ attributeRules: function(element) {
845
+ var rules = {};
846
+ var $element = $(element);
847
+
848
+ for (var method in $.validator.methods) {
849
+ var value;
850
+
851
+ // support for <input required> in both html5 and older browsers
852
+ if (method === 'required') {
853
+ value = $element.get(0).getAttribute(method);
854
+ // Some browsers return an empty string for the required attribute
855
+ // and non-HTML5 browsers might have required="" markup
856
+ if (value === "") {
857
+ value = true;
858
+ }
859
+ // force non-HTML5 browsers to return bool
860
+ value = !!value;
861
+ } else {
862
+ value = $element.attr(method);
863
+ }
864
+
865
+ if (value) {
866
+ rules[method] = value;
867
+ } else if ($element[0].getAttribute("type") === method) {
868
+ rules[method] = true;
869
+ }
870
+ }
871
+
872
+ // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
873
+ if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
874
+ delete rules.maxlength;
875
+ }
876
+
877
+ return rules;
878
+ },
879
+
880
+ metadataRules: function(element) {
881
+ if (!$.metadata) {
882
+ return {};
883
+ }
884
+
885
+ var meta = $.data(element.form, 'validator').settings.meta;
886
+ return meta ?
887
+ $(element).metadata()[meta] :
888
+ $(element).metadata();
889
+ },
890
+
891
+ staticRules: function(element) {
892
+ var rules = {};
893
+ var validator = $.data(element.form, 'validator');
894
+ if (validator.settings.rules) {
895
+ rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
896
+ }
897
+ return rules;
898
+ },
899
+
900
+ normalizeRules: function(rules, element) {
901
+ // handle dependency check
902
+ $.each(rules, function(prop, val) {
903
+ // ignore rule when param is explicitly false, eg. required:false
904
+ if (val === false) {
905
+ delete rules[prop];
906
+ return;
907
+ }
908
+ if (val.param || val.depends) {
909
+ var keepRule = true;
910
+ switch (typeof val.depends) {
911
+ case "string":
912
+ keepRule = !!$(val.depends, element.form).length;
913
+ break;
914
+ case "function":
915
+ keepRule = val.depends.call(element, element);
916
+ break;
917
+ }
918
+ if (keepRule) {
919
+ rules[prop] = val.param !== undefined ? val.param : true;
920
+ } else {
921
+ delete rules[prop];
922
+ }
923
+ }
924
+ });
925
+
926
+ // evaluate parameters
927
+ $.each(rules, function(rule, parameter) {
928
+ rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
929
+ });
930
+
931
+ // clean number parameters
932
+ $.each(['minlength', 'maxlength', 'min', 'max'], function() {
933
+ if (rules[this]) {
934
+ rules[this] = Number(rules[this]);
935
+ }
936
+ });
937
+ $.each(['rangelength', 'range'], function() {
938
+ if (rules[this]) {
939
+ rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
940
+ }
941
+ });
942
+
943
+ if ($.validator.autoCreateRanges) {
944
+ // auto-create ranges
945
+ if (rules.min && rules.max) {
946
+ rules.range = [rules.min, rules.max];
947
+ delete rules.min;
948
+ delete rules.max;
949
+ }
950
+ if (rules.minlength && rules.maxlength) {
951
+ rules.rangelength = [rules.minlength, rules.maxlength];
952
+ delete rules.minlength;
953
+ delete rules.maxlength;
954
+ }
955
+ }
956
+
957
+ // To support custom messages in metadata ignore rule methods titled "messages"
958
+ if (rules.messages) {
959
+ delete rules.messages;
960
+ }
961
+
962
+ return rules;
963
+ },
964
+
965
+ // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
966
+ normalizeRule: function(data) {
967
+ if( typeof data === "string" ) {
968
+ var transformed = {};
969
+ $.each(data.split(/\s/), function() {
970
+ transformed[this] = true;
971
+ });
972
+ data = transformed;
973
+ }
974
+ return data;
975
+ },
976
+
977
+ // http://docs.jquery.com/Plugins/Validation/Validator/addMethod
978
+ addMethod: function(name, method, message) {
979
+ $.validator.methods[name] = method;
980
+ $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
981
+ if (method.length < 3) {
982
+ $.validator.addClassRules(name, $.validator.normalizeRule(name));
983
+ }
984
+ },
985
+
986
+ methods: {
987
+
988
+ // http://docs.jquery.com/Plugins/Validation/Methods/required
989
+ required: function(value, element, param) {
990
+ // check if dependency is met
991
+ if ( !this.depend(param, element) ) {
992
+ return "dependency-mismatch";
993
+ }
994
+ if ( element.nodeName.toLowerCase() === "select" ) {
995
+ // could be an array for select-multiple or a string, both are fine this way
996
+ var val = $(element).val();
997
+ return val && val.length > 0;
998
+ }
999
+ if ( this.checkable(element) ) {
1000
+ return this.getLength(value, element) > 0;
1001
+ }
1002
+ return $.trim(value).length > 0;
1003
+ },
1004
+
1005
+ // http://docs.jquery.com/Plugins/Validation/Methods/remote
1006
+ remote: function(value, element, param) {
1007
+ if ( this.optional(element) ) {
1008
+ return "dependency-mismatch";
1009
+ }
1010
+
1011
+ var previous = this.previousValue(element);
1012
+ if (!this.settings.messages[element.name] ) {
1013
+ this.settings.messages[element.name] = {};
1014
+ }
1015
+ previous.originalMessage = this.settings.messages[element.name].remote;
1016
+ this.settings.messages[element.name].remote = previous.message;
1017
+
1018
+ param = typeof param === "string" && {url:param} || param;
1019
+
1020
+ if ( this.pending[element.name] ) {
1021
+ return "pending";
1022
+ }
1023
+ if ( previous.old === value ) {
1024
+ return previous.valid;
1025
+ }
1026
+
1027
+ previous.old = value;
1028
+ var validator = this;
1029
+ this.startRequest(element);
1030
+ var data = {};
1031
+ data[element.name] = value;
1032
+ $.ajax($.extend(true, {
1033
+ url: param,
1034
+ mode: "abort",
1035
+ port: "validate" + element.name,
1036
+ dataType: "json",
1037
+ data: data,
1038
+ success: function(response) {
1039
+ validator.settings.messages[element.name].remote = previous.originalMessage;
1040
+ var valid = response === true || response === "true";
1041
+ if ( valid ) {
1042
+ var submitted = validator.formSubmitted;
1043
+ validator.prepareElement(element);
1044
+ validator.formSubmitted = submitted;
1045
+ validator.successList.push(element);
1046
+ delete validator.invalid[element.name];
1047
+ validator.showErrors();
1048
+ } else {
1049
+ var errors = {};
1050
+ var message = response || validator.defaultMessage( element, "remote" );
1051
+ errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
1052
+ validator.invalid[element.name] = true;
1053
+ validator.showErrors(errors);
1054
+ }
1055
+ previous.valid = valid;
1056
+ validator.stopRequest(element, valid);
1057
+ }
1058
+ }, param));
1059
+ return "pending";
1060
+ },
1061
+
1062
+ // http://docs.jquery.com/Plugins/Validation/Methods/minlength
1063
+ minlength: function(value, element, param) {
1064
+ var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
1065
+ return this.optional(element) || length >= param;
1066
+ },
1067
+
1068
+ // http://docs.jquery.com/Plugins/Validation/Methods/maxlength
1069
+ maxlength: function(value, element, param) {
1070
+ var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
1071
+ return this.optional(element) || length <= param;
1072
+ },
1073
+
1074
+ // http://docs.jquery.com/Plugins/Validation/Methods/rangelength
1075
+ rangelength: function(value, element, param) {
1076
+ var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
1077
+ return this.optional(element) || ( length >= param[0] && length <= param[1] );
1078
+ },
1079
+
1080
+ // http://docs.jquery.com/Plugins/Validation/Methods/min
1081
+ min: function( value, element, param ) {
1082
+ return this.optional(element) || value >= param;
1083
+ },
1084
+
1085
+ // http://docs.jquery.com/Plugins/Validation/Methods/max
1086
+ max: function( value, element, param ) {
1087
+ return this.optional(element) || value <= param;
1088
+ },
1089
+
1090
+ // http://docs.jquery.com/Plugins/Validation/Methods/range
1091
+ range: function( value, element, param ) {
1092
+ return this.optional(element) || ( value >= param[0] && value <= param[1] );
1093
+ },
1094
+
1095
+ // http://docs.jquery.com/Plugins/Validation/Methods/email
1096
+ email: function(value, element) {
1097
+ // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
1098
+ 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);
1099
+ },
1100
+
1101
+ // http://docs.jquery.com/Plugins/Validation/Methods/url
1102
+ url: function(value, element) {
1103
+ // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
1104
+ 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);
1105
+ },
1106
+
1107
+ // http://docs.jquery.com/Plugins/Validation/Methods/date
1108
+ date: function(value, element) {
1109
+ return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
1110
+ },
1111
+
1112
+ // http://docs.jquery.com/Plugins/Validation/Methods/dateISO
1113
+ dateISO: function(value, element) {
1114
+ return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value);
1115
+ },
1116
+
1117
+ // http://docs.jquery.com/Plugins/Validation/Methods/number
1118
+ number: function(value, element) {
1119
+ return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
1120
+ },
1121
+
1122
+ // http://docs.jquery.com/Plugins/Validation/Methods/digits
1123
+ digits: function(value, element) {
1124
+ return this.optional(element) || /^\d+$/.test(value);
1125
+ },
1126
+
1127
+ // http://docs.jquery.com/Plugins/Validation/Methods/creditcard
1128
+ // based on http://en.wikipedia.org/wiki/Luhn
1129
+ creditcard: function(value, element) {
1130
+ if ( this.optional(element) ) {
1131
+ return "dependency-mismatch";
1132
+ }
1133
+ // accept only spaces, digits and dashes
1134
+ if (/[^0-9 \-]+/.test(value)) {
1135
+ return false;
1136
+ }
1137
+ var nCheck = 0,
1138
+ nDigit = 0,
1139
+ bEven = false;
1140
+
1141
+ value = value.replace(/\D/g, "");
1142
+
1143
+ for (var n = value.length - 1; n >= 0; n--) {
1144
+ var cDigit = value.charAt(n);
1145
+ nDigit = parseInt(cDigit, 10);
1146
+ if (bEven) {
1147
+ if ((nDigit *= 2) > 9) {
1148
+ nDigit -= 9;
1149
+ }
1150
+ }
1151
+ nCheck += nDigit;
1152
+ bEven = !bEven;
1153
+ }
1154
+
1155
+ return (nCheck % 10) === 0;
1156
+ },
1157
+
1158
+ // http://docs.jquery.com/Plugins/Validation/Methods/equalTo
1159
+ equalTo: function(value, element, param) {
1160
+ // bind to the blur event of the target in order to revalidate whenever the target field is updated
1161
+ // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
1162
+ var target = $(param);
1163
+ if (this.settings.onfocusout) {
1164
+ target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
1165
+ $(element).valid();
1166
+ });
1167
+ }
1168
+ return value === target.val();
1169
+ }
1170
+
1171
+ }
1172
+
1173
+ });
1174
+
1175
+ // deprecated, use $.validator.format instead
1176
+ $.format = $.validator.format;
1177
+
1178
+ }(jQuery));
1179
+
1180
+ // ajax mode: abort
1181
+ // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
1182
+ // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
1183
+ (function($) {
1184
+ var pendingRequests = {};
1185
+ // Use a prefilter if available (1.5+)
1186
+ if ( $.ajaxPrefilter ) {
1187
+ $.ajaxPrefilter(function(settings, _, xhr) {
1188
+ var port = settings.port;
1189
+ if (settings.mode === "abort") {
1190
+ if ( pendingRequests[port] ) {
1191
+ pendingRequests[port].abort();
1192
+ }
1193
+ pendingRequests[port] = xhr;
1194
+ }
1195
+ });
1196
+ } else {
1197
+ // Proxy ajax
1198
+ var ajax = $.ajax;
1199
+ $.ajax = function(settings) {
1200
+ var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
1201
+ port = ( "port" in settings ? settings : $.ajaxSettings ).port;
1202
+ if (mode === "abort") {
1203
+ if ( pendingRequests[port] ) {
1204
+ pendingRequests[port].abort();
1205
+ }
1206
+ return (pendingRequests[port] = ajax.apply(this, arguments));
1207
+ }
1208
+ return ajax.apply(this, arguments);
1209
+ };
1210
+ }
1211
+ }(jQuery));
1212
+
1213
+ // provides cross-browser focusin and focusout events
1214
+ // IE has native support, in other browsers, use event caputuring (neither bubbles)
1215
+
1216
+ // provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
1217
+ // handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
1218
+ (function($) {
1219
+ // only implement if not provided by jQuery core (since 1.4)
1220
+ // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs
1221
+ if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
1222
+ $.each({
1223
+ focus: 'focusin',
1224
+ blur: 'focusout'
1225
+ }, function( original, fix ){
1226
+ $.event.special[fix] = {
1227
+ setup:function() {
1228
+ this.addEventListener( original, handler, true );
1229
+ },
1230
+ teardown:function() {
1231
+ this.removeEventListener( original, handler, true );
1232
+ },
1233
+ handler: function(e) {
1234
+ var args = arguments;
1235
+ args[0] = $.event.fix(e);
1236
+ args[0].type = fix;
1237
+ return $.event.handle.apply(this, args);
1238
+ }
1239
+ };
1240
+ function handler(e) {
1241
+ e = $.event.fix(e);
1242
+ e.type = fix;
1243
+ return $.event.handle.call(this, e);
1244
+ }
1245
+ });
1246
+ }
1247
+ $.extend($.fn, {
1248
+ validateDelegate: function(delegate, type, handler) {
1249
+ return this.bind(type, function(event) {
1250
+ var target = $(event.target);
1251
+ if (target.is(delegate)) {
1252
+ return handler.apply(target, arguments);
1253
+ }
1254
+ });
1255
+ }
1256
+ });
1257
+ }(jQuery));
page-contact.php CHANGED
@@ -2,40 +2,36 @@
2
  /*
3
  Template Name: Contact
4
  */
5
- global $virtue, $post;
6
- $map = get_post_meta( $post->ID, '_kad_contact_map', true );
7
- $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true );
8
- $contactformtitle = get_post_meta( $post->ID, '_kad_contact_form_title', true );
9
- $form = get_post_meta( $post->ID, '_kad_contact_form', true );
10
- if ($form == 'yes') { ?>
11
- <script type="text/javascript">jQuery(document).ready(function ($) {$.extend($.validator.messages, {
12
- required: "<?php echo __('This field is required.', 'virtue-toolkit'); ?>",
13
- email: "<?php echo __('Please enter a valid email address.', 'virtue-toolkit'); ?>",
14
- });
15
- $("#contactForm").validate();
16
- });</script>
17
- <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/assets/js/jquery.validate.js"></script>
18
  <?php }
19
- if ($map == 'yes') {
20
- $address = get_post_meta( $post->ID, '_kad_contact_address', true );
21
- $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true );
22
- $height = get_post_meta( $post->ID, '_kad_contact_mapheight', true );
23
- $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true );
24
- if(isset($virtue['google_map_api']) && !empty($virtue['google_map_api'])) {
25
- $gmap_api = $virtue['google_map_api'];
26
- } else {
27
- $gmap_api = 'AIzaSyBt7JOCM4XQTEi9jzdqB8alFc1Vm_3mbfQ';
28
- }
29
- if(!empty($height)) {
30
- $mapheight = $height;
31
- } else {
32
- $mapheight = 300;
33
- }
34
- if(!empty($mapzoom)) {
35
- $zoom = $mapzoom;
36
- } else {
37
- $zoom = 15;
38
- } ?>
39
  <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?php echo esc_attr($gmap_api);?>"></script>
40
  <script type="text/javascript">
41
  jQuery(window).load(function() {
@@ -93,7 +89,6 @@ Template Name: Contact
93
  </script>
94
  <?php echo '<style type="text/css" media="screen">#map_address {height:'.esc_attr($mapheight).'px; margin-bottom:20px;}</style>';
95
  }
96
-
97
  if(isset($_POST['submitted'])) {
98
  if(isset($form_math) && $form_math == 'yes') {
99
  $math_answer = trim($_POST['kad_captcha']);
2
  /*
3
  Template Name: Contact
4
  */
5
+
6
+ global $virtue, $post;
7
+ $map = get_post_meta( $post->ID, '_kad_contact_map', true );
8
+ $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true );
9
+ $contactformtitle = get_post_meta( $post->ID, '_kad_contact_form_title', true );
10
+ $form = get_post_meta( $post->ID, '_kad_contact_form', true );
11
+ if ($form == 'yes') { ?>
12
+ <script type="text/javascript">jQuery(document).ready(function ($) {$.extend($.validator.messages, {required: "<?php echo esc_attr(__('This field is required.', 'virtue-toolkit')); ?>",email: "<?php echo esc_attr(__('Please enter a valid email address.', 'virtue-toolkit')); ?>",});$("#contactForm").validate();});</script>
13
+ <script type="text/javascript" src="<?php echo VIRTUE_TOOLKIT_URL ?>assets/jquery.validate.js"></script>
 
 
 
 
14
  <?php }
15
+ if ($map == 'yes') {
16
+ $address = get_post_meta( $post->ID, '_kad_contact_address', true );
17
+ $maptype = get_post_meta( $post->ID, '_kad_contact_maptype', true );
18
+ $height = get_post_meta( $post->ID, '_kad_contact_mapheight', true );
19
+ $mapzoom = get_post_meta( $post->ID, '_kad_contact_zoom', true );
20
+ if(isset($virtue['google_map_api']) && !empty($virtue['google_map_api'])) {
21
+ $gmap_api = $virtue['google_map_api'];
22
+ } else {
23
+ $gmap_api = 'AIzaSyBt7JOCM4XQTEi9jzdqB8alFc1Vm_3mbfQ';
24
+ }
25
+ if(!empty($height)) {
26
+ $mapheight = $height;
27
+ } else {
28
+ $mapheight = 300;
29
+ }
30
+ if(!empty($mapzoom)) {
31
+ $zoom = $mapzoom;
32
+ } else {
33
+ $zoom = 15;
34
+ } ?>
35
  <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?php echo esc_attr($gmap_api);?>"></script>
36
  <script type="text/javascript">
37
  jQuery(window).load(function() {
89
  </script>
90
  <?php echo '<style type="text/css" media="screen">#map_address {height:'.esc_attr($mapheight).'px; margin-bottom:20px;}</style>';
91
  }
 
92
  if(isset($_POST['submitted'])) {
93
  if(isset($form_math) && $form_math == 'yes') {
94
  $math_answer = trim($_POST['kad_captcha']);
post-types.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  // Custom post types
3
- function kad_portfolio_post_init() {
4
  $portfoliolabels = array(
5
  'name' => __('Portfolio', 'virtue-toolkit'),
6
  'singular_name' => __('Portfolio Item', 'virtue-toolkit'),
@@ -57,20 +57,20 @@ function kad_portfolio_post_init() {
57
 
58
  register_post_type( 'portfolio', $portargs );
59
  }
60
- add_action( 'init', 'kad_portfolio_post_init', 1 );
61
- function kad_portfolio_permalink_init(){
62
- global $wp_rewrite;
63
- $port_rewrite = apply_filters('kadence_portfolio_permalink_slug', 'portfolio');
64
- $portfolio_structure = '/'.$port_rewrite.'/%portfolio%';
65
- $wp_rewrite->add_rewrite_tag("%portfolio%", '([^/]+)', "portfolio=");
66
- $wp_rewrite->add_permastruct('portfolio', $portfolio_structure, false);
67
  }
68
- add_action( 'init', 'kad_portfolio_permalink_init', 2 );
69
 
70
  // Add filter to plugin init function
71
- add_filter('post_type_link', 'kad_portfolio_permalink', 10, 3);
72
 
73
- function kad_portfolio_permalink($permalink, $post_id, $leavename) {
74
  $post = get_post($post_id);
75
  $rewritecode = array(
76
  '%year%',
1
  <?php
2
  // Custom post types
3
+ function kadence_toolkit_portfolio_post_init() {
4
  $portfoliolabels = array(
5
  'name' => __('Portfolio', 'virtue-toolkit'),
6
  'singular_name' => __('Portfolio Item', 'virtue-toolkit'),
57
 
58
  register_post_type( 'portfolio', $portargs );
59
  }
60
+ add_action( 'init', 'kadence_toolkit_portfolio_post_init', 1 );
61
+ function kadence_toolkit_portfolio_permalink_init(){
62
+ global $wp_rewrite;
63
+ $port_rewrite = apply_filters('kadence_portfolio_permalink_slug', 'portfolio');
64
+ $portfolio_structure = '/'.$port_rewrite.'/%portfolio%';
65
+ $wp_rewrite->add_rewrite_tag("%portfolio%", '([^/]+)', "portfolio=");
66
+ $wp_rewrite->add_permastruct('portfolio', $portfolio_structure, false);
67
  }
68
+ add_action( 'init', 'kadence_toolkit_portfolio_permalink_init', 2 );
69
 
70
  // Add filter to plugin init function
71
+ add_filter('post_type_link', 'kadence_toolkit_portfolio_permalink', 10, 3);
72
 
73
+ function kadence_toolkit_portfolio_permalink($permalink, $post_id, $leavename) {
74
  $post = get_post($post_id);
75
  $rewritecode = array(
76
  '%year%',
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: britner
3
  Tags:
4
  Requires at least: 4.0
5
- Tested up to: 4.7
6
- Stable tag: 4.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -43,6 +43,11 @@ Install the plugin into the `/wp-content/plugins/` folder, and activate it.
43
 
44
  == Changelog ==
45
 
 
 
 
 
 
46
  = 4.3 =
47
  * Update: add Icons
48
  * Update: Add local select js
2
  Contributors: britner
3
  Tags:
4
  Requires at least: 4.0
5
+ Tested up to: 4.8
6
+ Stable tag: 4.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
43
 
44
  == Changelog ==
45
 
46
+ = 4.4 =
47
+ * Update: New Welcome Page with helpful info.
48
+ * Update: Add local jquery.validator
49
+ * Update: Column shortcode gen.
50
+
51
  = 4.3 =
52
  * Update: add Icons
53
  * Update: Add local select js
shortcode_ajax.php CHANGED
@@ -1,64 +1,72 @@
1
  <?php
2
- function virtue_columns_ajax_tinymce() {
3
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) // check for rights
4
  die(__("You are not allowed to be here"));
 
5
 
6
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/columns/columns_popup.php');
7
  }
8
- add_action('wp_ajax_kadcolumns_tinymce', 'virtue_columns_ajax_tinymce');
9
 
10
- function virtue_icons_ajax_tinymce() {
11
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts'))
12
  die(__("You are not allowed to be here"));
 
13
 
14
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/icons/icon_popup.php');
15
  }
16
- add_action('wp_ajax_kadicons_tinymce', 'virtue_icons_ajax_tinymce');
17
 
18
- function virtue_quote_ajax_tinymce() {
19
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts'))
20
  die(__("You are not allowed to be here"));
 
21
 
22
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/pullquote/quote_popup.php');
23
  }
24
- add_action('wp_ajax_kadquote_tinymce', 'virtue_quote_ajax_tinymce');
25
 
26
- function virtue_youtube_ajax_tinymce() {
27
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts'))
28
  die(__("You are not allowed to be here"));
 
29
 
30
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/youtube/youtube_popup.php');
31
  }
32
- add_action('wp_ajax_kadyoutube_tinymce', 'virtue_youtube_ajax_tinymce');
33
 
34
- function virtue_vimeo_ajax_tinymce() {
35
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts'))
36
  die(__("You are not allowed to be here"));
 
37
 
38
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/vimeo/vimeo_popup.php');
39
  }
40
- add_action('wp_ajax_kadvimeo_tinymce', 'virtue_vimeo_ajax_tinymce');
41
 
42
- function virtue_btns_ajax_tinymce() {
43
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts'))
44
  die(__("You are not allowed to be here"));
 
45
 
46
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/btns/btns_popup.php');
47
  }
48
- add_action('wp_ajax_kadbtns_tinymce', 'virtue_btns_ajax_tinymce');
49
 
50
- function virtue_divider_ajax_tinymce() {
51
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts'))
52
  die(__("You are not allowed to be here"));
 
53
 
54
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/divider/divider_popup.php');
55
  }
56
- add_action('wp_ajax_kaddivider_tinymce', 'virtue_divider_ajax_tinymce');
57
 
58
- function virtue_accordion_ajax_tinymce() {
59
- if (!current_user_can('edit_pages') && !current_user_can('edit_posts'))
60
  die(__("You are not allowed to be here"));
 
61
 
62
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/accordion/accordion_popup.php');
63
  }
64
- add_action('wp_ajax_kadaccordion_tinymce', 'virtue_accordion_ajax_tinymce');
1
  <?php
2
+ function virtue_toolkit_columns_ajax_tinymce() {
3
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')){
4
  die(__("You are not allowed to be here"));
5
+ }
6
 
7
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/columns/columns_popup.php');
8
  }
9
+ add_action('wp_ajax_kadcolumns_tinymce', 'virtue_toolkit_columns_ajax_tinymce');
10
 
11
+ function virtue_toolkit_icons_ajax_tinymce() {
12
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) {
13
  die(__("You are not allowed to be here"));
14
+ }
15
 
16
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/icons/icon_popup.php');
17
  }
18
+ add_action('wp_ajax_kadicons_tinymce', 'virtue_toolkit_icons_ajax_tinymce');
19
 
20
+ function virtue_toolkit_quote_ajax_tinymce() {
21
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) {
22
  die(__("You are not allowed to be here"));
23
+ }
24
 
25
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/pullquote/quote_popup.php');
26
  }
27
+ add_action('wp_ajax_kadquote_tinymce', 'virtue_toolkit_quote_ajax_tinymce');
28
 
29
+ function virtue_toolkit_youtube_ajax_tinymce() {
30
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) {
31
  die(__("You are not allowed to be here"));
32
+ }
33
 
34
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/youtube/youtube_popup.php');
35
  }
36
+ add_action('wp_ajax_kadyoutube_tinymce', 'virtue_toolkit_youtube_ajax_tinymce');
37
 
38
+ function virtue_toolkit_vimeo_ajax_tinymce() {
39
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) {
40
  die(__("You are not allowed to be here"));
41
+ }
42
 
43
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/vimeo/vimeo_popup.php');
44
  }
45
+ add_action('wp_ajax_kadvimeo_tinymce', 'virtue_toolkit_vimeo_ajax_tinymce');
46
 
47
+ function virtue_toolkit_btns_ajax_tinymce() {
48
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) {
49
  die(__("You are not allowed to be here"));
50
+ }
51
 
52
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/btns/btns_popup.php');
53
  }
54
+ add_action('wp_ajax_kadbtns_tinymce', 'virtue_toolkit_btns_ajax_tinymce');
55
 
56
+ function virtue_toolkit_divider_ajax_tinymce() {
57
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) {
58
  die(__("You are not allowed to be here"));
59
+ }
60
 
61
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/divider/divider_popup.php');
62
  }
63
+ add_action('wp_ajax_kaddivider_tinymce', 'virtue_toolkit_divider_ajax_tinymce');
64
 
65
+ function virtue_toolkit_accordion_ajax_tinymce() {
66
+ if (!current_user_can('edit_pages') && !current_user_can('edit_posts')) {
67
  die(__("You are not allowed to be here"));
68
+ }
69
 
70
  include_once( dirname(dirname(__FILE__)) . '/virtue-toolkit/shortcodes/accordion/accordion_popup.php');
71
  }
72
+ add_action('wp_ajax_kadaccordion_tinymce', 'virtue_toolkit_accordion_ajax_tinymce');
shortcodes.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  //Shortcode for accordion
3
- function kad_accordion_shortcode_function($atts, $content ) {
4
  extract(shortcode_atts(array(
5
  'id' => rand(1, 999)
6
  ), $atts));
@@ -17,15 +17,15 @@ function kad_accordion_shortcode_function($atts, $content ) {
17
  } else {
18
  $eo = "odd";
19
  }
20
- $tabs[] = '<div class="panel panel-default panel-'.$eo.'"><div class="panel-heading"><a class="accordion-toggle '.$tab['open'].'" data-toggle="collapse" data-parent="#accordionname'.$id.'" href="#collapse'.$id.$tab['link'].'"><h5><i class="icon-minus kt-icon-minus primary-color"></i><i class="icon-plus kt-icon-plus"></i>'.$tab['title'].'</h5></a></div><div id="collapse'.$id.$tab['link'].'" class="panel-collapse collapse '.$tab['in'].'"><div class="panel-body postclass">'.$tab['content'].'</div></div></div>';
21
  $i++;
22
  }
23
- $return = "\n".'<div class="panel-group kt-accordion" id="accordionname'.$id.'">'.implode( "\n", $tabs ).'</div>'."\n";
24
  }
25
  return $return;
26
  }
27
 
28
- function kad_accordion_pane_function($atts, $content ) {
29
  extract(shortcode_atts(array(
30
  'title' => 'Pane %d',
31
  'start' => ''
@@ -42,11 +42,11 @@ function kad_accordion_pane_function($atts, $content ) {
42
  }
43
  global $kt_pane_count, $kt_panes;
44
  $x = $kt_pane_count;
45
- $kt_panes[$x] = array( 'title' => $title, 'open' => $open, 'in' => $in, 'link' => $kt_pane_count, 'content' => do_shortcode( $content ) );
46
 
47
  $kt_pane_count++;
48
  }
49
- function kad_tab_shortcode_function($atts, $content ) {
50
  extract(shortcode_atts(array(
51
  'id' => rand(1, 9999),
52
  'style' => '1',
@@ -58,17 +58,17 @@ function kad_tab_shortcode_function($atts, $content ) {
58
  do_shortcode( $content );
59
  if( is_array( $kt_tabs ) && !empty($kt_tabs)) {
60
  foreach( $kt_tabs as $nav ){
61
- $tabnav[] = '<li class="'.$nav['active'].'"><a href="#sctab'.$id.$nav['link'].'">'.$nav['title'].'</a></li>';
62
  }
63
  foreach( $kt_tabs as $tab ){
64
- $tabs[] = '<div class="tab-pane clearfix '.$tab['active'].'" id="sctab'.$id.$tab['link'].'">'.$tab['content'].'</div>';
65
  }
66
 
67
  $return = "\n".'<ul class="nav nav-tabs sc_tabs kt-tabs kt-sc-tabs kt-tabs-style'.esc_attr($style).'">'.implode( "\n", $tabnav ).'</ul> <div class="tab-content kt-tab-content postclass">'.implode( "\n", $tabs ).'</div>'."\n";
68
  }
69
  return $return;
70
  }
71
- function kad_tab_pane_function($atts, $content ) {
72
  extract(shortcode_atts(array(
73
  'title' => 'Tab %d',
74
  'start' => ''
@@ -81,53 +81,53 @@ function kad_tab_pane_function($atts, $content ) {
81
  global $kt_tab_count, $kt_tabs;
82
 
83
  $x = $kt_tab_count;
84
- $kt_tabs[$x] = array( 'title' => $title, 'active' => $active, 'link' => $kt_tab_count, 'content' => do_shortcode( $content ) );
85
 
86
  $kt_tab_count++;
87
  }
88
 
89
  //Shortcode for columns
90
- function kad_column_shortcode_function( $atts, $content ) {
91
- return '<div class="row">'.do_shortcode($content).'</div>';
92
  }
93
- function kad_hcolumn_shortcode_function( $atts, $content ) {
94
- return '<div class="row">'.do_shortcode($content).'</div>';
95
  }
96
- function kad_column11_function( $atts, $content ) {
97
- return '<div class="col-md-11">'.do_shortcode($content).'</div>';
98
  }
99
- function kad_column10_function( $atts, $content ) {
100
- return '<div class="col-md-10">'.do_shortcode($content).'</div>';
101
  }
102
- function kad_column9_function( $atts, $content ) {
103
- return '<div class="col-md-9">'.do_shortcode($content).'</div>';
104
  }
105
- function kad_column8_function( $atts, $content ) {
106
- return '<div class="col-md-8">'.do_shortcode($content).'</div>';
107
  }
108
- function kad_column7_function( $atts, $content ) {
109
- return '<div class="col-md-7">'.do_shortcode($content).'</div>';
110
  }
111
- function kad_column6_function( $atts, $content ) {
112
- return '<div class="col-md-6">'.do_shortcode($content).'</div>';
113
  }
114
- function kad_column5_function( $atts, $content ) {
115
- return '<div class="col-md-5">'.do_shortcode($content).'</div>';
116
  }
117
- function kad_column4_function( $atts, $content ) {
118
- return '<div class="col-md-4">'.do_shortcode($content).'</div>';
119
  }
120
- function kad_column3_function( $atts, $content ) {
121
- return '<div class="col-md-3">'.do_shortcode($content).'</div>';
122
  }
123
- function kad_column2_function( $atts, $content ) {
124
- return '<div class="col-md-2">'.do_shortcode($content).'</div>';
125
  }
126
- function kad_column1_function( $atts, $content ) {
127
- return '<div class="col-md-1">'.do_shortcode($content).'</div>';
128
  }
129
  //Shortcode for Icons
130
- function kad_icon_shortcode_function( $atts) {
131
  extract(shortcode_atts(array(
132
  'icon' => '',
133
  'size' => '',
@@ -135,26 +135,27 @@ function kad_icon_shortcode_function( $atts) {
135
  'float'=> ''
136
  ), $atts));
137
  if ($float != '') {
138
- $output = '<i class="'.$icon.'" style="font-size:'.$size.'; color:'.$color.'; float:'.$float.'; padding:10px;"></i>';
139
  } else {
140
- $output = '<i class="'.$icon.'" style="font-size:'.$size.'; color:'.$color.';"></i>';
141
  }
142
  return $output;
143
  }
144
  // Video Shortcode
145
- function kad_video_shortcode_function( $atts, $content) {
146
  extract(shortcode_atts(array(
147
  'width' => '',
148
  ), $atts));
149
- if($width != '') { $output = '<div style="max-width:'.$width.'px;"><div class="videofit">'.$content.'</div></div>';}
150
- else { $output = '<div class="videofit">'.$content.'</div>'; }
 
 
 
151
  return $output;
152
  }
153
  // Based on Ultimate Shortcodes youtube and vimeo shortcodes
154
- function kad_youtube_shortcode_function( $atts, $content) {
155
  // Prepare data
156
- $return = array();
157
- $params = array();
158
  $atts = shortcode_atts(array(
159
  'url' => false,
160
  'width' => 600,
@@ -164,56 +165,73 @@ function kad_youtube_shortcode_function( $atts, $content) {
164
  'controls' => 'true',
165
  'hidecontrols' => 'false',
166
  'fs' => 'true',
 
 
 
167
  'modestbranding' => 'false',
168
  'theme' => 'dark'
169
  ), $atts, 'kad_youtube' );
 
 
170
 
171
- if ( !$atts['url'] ) return '<p class="error">YouTube: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
 
 
172
  $id = ( preg_match( '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $atts['url'], $match ) ) ? $match[1] : false;
173
  // Check that url is specified
174
- if ( !$id ) return '<p class="error">YouTube: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
 
 
175
  // Prepare params
176
  if($atts['hidecontrols'] == 'true') {$atts['controls'] = 'false';}
177
- foreach ( array('autoplay', 'controls', 'fs', 'modestbranding', 'theme' ) as $param ) $params[$param] = str_replace( array( 'false', 'true', 'alt' ), array( '0', '1', '2' ), $atts[$param] );
178
  // Prepare player parameters
 
179
  $params = http_build_query( $params );
180
- if($atts['maxwidth']) {$maxwidth = 'style="max-width:'.$atts['maxwidth'].'px;"';} else{ $maxwidth = '';}
181
  // Create player
182
  $return[] = '<div class="kad-youtube-shortcode videofit" '.$maxwidth.' >';
183
- $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="//www.youtube.com/embed/' . $id . '?' . $params . '" frameborder="0" allowfullscreen="true"></iframe>';
184
  $return[] = '</div>';
185
  // Return result
186
  return implode( '', $return );
187
  }
188
- function kad_vimeo_shortcode_function( $atts, $content) {
189
- $return = array();
190
  $atts = shortcode_atts( array(
191
  'url' => false,
192
  'width' => 600,
193
  'height' => 400,
194
- 'maxwidth' => '',
195
  'autoplay' => 'no'
196
  ), $atts, 'vimeo' );
197
- if ( !$atts['url'] ) return '<p class="error">Vimeo: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
198
- $id = ( preg_match( '~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match ) ) ? $match[1] : false;
199
- // Check that url is specified
200
- if ( !$id ) return '<p class="error">Vimeo: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
- if($atts['maxwidth']) {$maxwidth = 'style="max-width:'.$atts['maxwidth'].'px;"';} else{ $maxwidth = '';}
203
- $autoplay = ( $atts['autoplay'] === 'yes' ) ? '&amp;autoplay=1' : '';
204
- // Create player
205
- $return[] = '<div class="kad-vimeo-shortcode videofit '.$maxwidth.'">';
206
- $return[] = '<iframe width="' . $atts['width'] . '" height="' . $atts['height'] .
207
- '" src="//player.vimeo.com/video/' . $id . '?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff' .
208
- $autoplay . '" frameborder="0" allowfullscreen="true"></iframe>';
209
- $return[] = '</div>';
210
- // Return result
211
  return implode( '', $return );
212
  }
213
  //Button
214
- function kad_button_shortcode_function( $atts) {
215
  extract(shortcode_atts(array(
216
- 'id' => rand(1, 99),
217
  'bcolor' => '',
218
  'bhovercolor' => '',
219
  'thovercolor' => '',
@@ -222,43 +240,43 @@ function kad_button_shortcode_function( $atts) {
222
  'target' => '_self',
223
  'tcolor' => '',
224
  ), $atts));
225
- $output = '<a href="'.$link.'" class="btn button btn-shortcode kad-btn kad-btn-primary" id="kadbtn'.$id.'" target="'.$target.'" style="';
226
  if(!empty($bcolor)) {
227
- $output .= 'background-color:'.$bcolor.';';
228
  }
229
  if(!empty($tcolor)) {
230
- $output .= 'color:'.$tcolor.';';
231
  }
232
  $output .= '"';
233
  if($thovercolor == $tcolor) {$thovercolor = null;}
234
  if(!empty($bhovercolor) || !empty($thovercolor)) {
235
- $output .= 'onMouseOver="this.style.background=\''.$bhovercolor.'\',this.style.color=\''.$thovercolor.'\'" onMouseOut="this.style.background=\''.$bcolor.'\', this.style.color=\''.$tcolor.'\'"';
236
  }
237
- $output .= '>'.$text.'</a>';
238
 
239
  return $output;
240
  }
241
- function kad_blockquote_shortcode_function( $atts, $content) {
242
  extract(shortcode_atts(array(
243
  'align' => 'center',
244
  ), $atts));
245
  switch ($align)
246
  {
247
  case "center":
248
- $output = '<div class="blockquote blockquote-full postclass clearfix">' . do_shortcode($content) . '</div>';
249
  break;
250
 
251
  case "left":
252
- $output = '<div class="blockquote blockquote-left postclass clearfix">' . do_shortcode($content) . '</div>';
253
  break;
254
 
255
  case "right":
256
- $output = '<div class="blockquote blockquote-right postclass clearfix">' . do_shortcode($content) . '</div>';
257
  break;
258
  }
259
  return $output;
260
  }
261
- function kad_pullquote_shortcode_function( $atts, $content) {
262
  extract( shortcode_atts( array(
263
  'align' => 'center'
264
  ), $atts ));
@@ -266,73 +284,75 @@ function kad_pullquote_shortcode_function( $atts, $content) {
266
  switch ($align)
267
  {
268
  case "center":
269
- $output = '<div class="pullquote pullquote-center">' . do_shortcode($content) . '</div>';
270
  break;
271
 
272
  case "right":
273
- $output = '<div class="pullquote pullquote-right">' . do_shortcode($content) . '</div>';
274
  break;
275
 
276
  case "left":
277
- $output = '<div class="pullquote pullquote-left">' . do_shortcode($content) . '</div>';
278
  break;
279
  }
280
 
281
  return $output;
282
  }
283
- function kad_hrule_function( ) {
284
  return '<div class="hrule clearfix"></div>';
285
  }
286
- function kad_hrpadding10_function( ) {
287
  return '<div class="space_20 clearfix"></div>';
288
  }
289
- function kad_hrpadding20_function( ) {
290
  return '<div class="space_40 clearfix"></div>';
291
  }
292
- function kad_hrpadding40_function( ) {
293
  return '<div class="space_80 clearfix"></div>';
294
  }
295
- function kad_clearfix_function( ) {
296
  return '<div class="clearfix"></div>';
297
  }
298
- function kad_columnhelper_function( ) {
299
  return '';
300
  }
301
- function virtuetoolkit_register_shortcodes(){
302
- add_shortcode('accordion', 'kad_accordion_shortcode_function');
303
- add_shortcode('pane', 'kad_accordion_pane_function');
304
- add_shortcode('tabs', 'kad_tab_shortcode_function');
305
- add_shortcode('tab', 'kad_tab_pane_function');
306
- add_shortcode('columns', 'kad_column_shortcode_function');
307
- add_shortcode('hcolumns', 'kad_hcolumn_shortcode_function');
308
- add_shortcode('span11', 'kad_column11_function');
309
- add_shortcode('span10', 'kad_column10_function');
310
- add_shortcode('span9', 'kad_column9_function');
311
- add_shortcode('span8', 'kad_column8_function');
312
- add_shortcode('span7', 'kad_column7_function');
313
- add_shortcode('span6', 'kad_column6_function');
314
- add_shortcode('span5', 'kad_column5_function');
315
- add_shortcode('span4', 'kad_column4_function');
316
- add_shortcode('span3', 'kad_column3_function');
317
- add_shortcode('span2', 'kad_column2_function');
318
- add_shortcode('span1', 'kad_column1_function');
319
- add_shortcode('columnhelper', 'kad_columnhelper_function');
320
- add_shortcode('icon', 'kad_icon_shortcode_function');
321
- add_shortcode('pullquote', 'kad_pullquote_shortcode_function');
322
- add_shortcode('blockquote', 'kad_blockquote_shortcode_function');
323
- add_shortcode('btn', 'kad_button_shortcode_function');
324
- add_shortcode('hr', 'kad_hrule_function');
325
- add_shortcode('space_20', 'kad_hrpadding10_function');
326
- add_shortcode('space_40', 'kad_hrpadding20_function');
327
- add_shortcode('space_80', 'kad_hrpadding40_function');
328
- add_shortcode('kad_youtube', 'kad_youtube_shortcode_function');
329
- add_shortcode('kad_vimeo', 'kad_vimeo_shortcode_function');
330
- add_shortcode('clear', 'kad_clearfix_function');
331
- }
332
- add_action( 'init', 'virtuetoolkit_register_shortcodes');
 
 
333
 
334
 
335
- function virtue_register_button( $buttons ) {
336
  array_push( $buttons, "|", "kadcolumns" );
337
  array_push( $buttons, "|", "kaddivider" );
338
  array_push( $buttons, "|", "kadaccordion" );
@@ -343,7 +363,7 @@ function virtue_register_button( $buttons ) {
343
  array_push( $buttons, "|", "kadvimeo" );
344
  return $buttons;
345
  }
346
- function virtue_add_plugin( $plugin_array ) {
347
  $plugin_array['kadcolumns'] = VIRTUE_TOOLKIT_URL . '/shortcodes/columns/columns_shortgen.js';
348
  $plugin_array['kadicon'] = VIRTUE_TOOLKIT_URL . '/shortcodes/icons/icon_shortgen.js';
349
  $plugin_array['kadaccordion'] = VIRTUE_TOOLKIT_URL . '/shortcodes/accordion/accordion_shortgen.js';
@@ -354,22 +374,22 @@ function virtue_add_plugin( $plugin_array ) {
354
  $plugin_array['kaddivider'] = VIRTUE_TOOLKIT_URL . '/shortcodes/divider/divider_shortgen.js';
355
  return $plugin_array;
356
  }
357
- function virtue_tinymce_shortcode_button() {
358
 
359
  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
360
  return;
361
  }
362
 
363
  if ( get_user_option('rich_editing') == 'true' ) {
364
- add_filter( 'mce_external_plugins', 'virtue_add_plugin' );
365
- add_filter( 'mce_buttons_3', 'virtue_register_button' );
366
  }
367
 
368
  }
369
- add_action('init', 'virtue_tinymce_shortcode_button');
370
 
371
  // Clean up Shortcodes
372
- function kadtool_content_clean_shortcodes($content){
373
  $array = array (
374
  '<p>[' => '[',
375
  ']</p>' => ']',
@@ -378,8 +398,8 @@ function kadtool_content_clean_shortcodes($content){
378
  $content = strtr($content, $array);
379
  return $content;
380
  }
381
- add_filter('the_content', 'kadtool_content_clean_shortcodes');
382
- function kadtool_widget_clean_shortcodes($text){
383
  $array = array (
384
  '<p>[' => '[',
385
  ']</p>' => ']',
@@ -390,5 +410,5 @@ function kadtool_widget_clean_shortcodes($text){
390
  $text = strtr($text, $array);
391
  return $text;
392
  }
393
- add_filter('widget_text', 'kadtool_widget_clean_shortcodes');
394
  add_filter('widget_text', 'do_shortcode', 50);
1
  <?php
2
  //Shortcode for accordion
3
+ function virtue_toolkit_accordion_shortcode_function($atts, $content ) {
4
  extract(shortcode_atts(array(
5
  'id' => rand(1, 999)
6
  ), $atts));
17
  } else {
18
  $eo = "odd";
19
  }
20
+ $tabs[] = '<div class="panel panel-default panel-'.esc_attr($eo).'"><div class="panel-heading"><a class="accordion-toggle '.esc_attr($tab['open']).'" data-toggle="collapse" data-parent="#accordionname'.esc_attr($id).'" href="#collapse'.esc_attr($id.$tab['link']).'"><h5><i class="icon-minus kt-icon-minus primary-color"></i><i class="icon-plus kt-icon-plus"></i>'.wp_kses_post($tab['title']).'</h5></a></div><div id="collapse'.esc_attr($id.$tab['link']).'" class="panel-collapse collapse '.esc_attr($tab['in']).'"><div class="panel-body postclass">'.do_shortcode(wp_kses_post($tab['content'])).'</div></div></div>';
21
  $i++;
22
  }
23
+ $return = "\n".'<div class="panel-group kt-accordion" id="accordionname'.esc_attr($id).'">'.implode( "\n", $tabs ).'</div>'."\n";
24
  }
25
  return $return;
26
  }
27
 
28
+ function virtue_toolkit_accordion_pane_function($atts, $content ) {
29
  extract(shortcode_atts(array(
30
  'title' => 'Pane %d',
31
  'start' => ''
42
  }
43
  global $kt_pane_count, $kt_panes;
44
  $x = $kt_pane_count;
45
+ $kt_panes[$x] = array( 'title' => $title, 'open' => $open, 'in' => $in, 'link' => $kt_pane_count, 'content' => $content );
46
 
47
  $kt_pane_count++;
48
  }
49
+ function virtue_toolkit_tab_shortcode_function($atts, $content ) {
50
  extract(shortcode_atts(array(
51
  'id' => rand(1, 9999),
52
  'style' => '1',
58
  do_shortcode( $content );
59
  if( is_array( $kt_tabs ) && !empty($kt_tabs)) {
60
  foreach( $kt_tabs as $nav ){
61
+ $tabnav[] = '<li class="'.esc_attr($nav['active']).'"><a href="#sctab'.esc_attr($id.$nav['link']).'">'.wp_kses_post($nav['title']).'</a></li>';
62
  }
63
  foreach( $kt_tabs as $tab ){
64
+ $tabs[] = '<div class="tab-pane clearfix '.esc_attr($tab['active']).'" id="sctab'.esc_attr($id.$tab['link']).'">'.do_shortcode( wp_kses_post($tab['content'])).'</div>';
65
  }
66
 
67
  $return = "\n".'<ul class="nav nav-tabs sc_tabs kt-tabs kt-sc-tabs kt-tabs-style'.esc_attr($style).'">'.implode( "\n", $tabnav ).'</ul> <div class="tab-content kt-tab-content postclass">'.implode( "\n", $tabs ).'</div>'."\n";
68
  }
69
  return $return;
70
  }
71
+ function virtue_toolkit_tab_pane_function($atts, $content ) {
72
  extract(shortcode_atts(array(
73
  'title' => 'Tab %d',
74
  'start' => ''
81
  global $kt_tab_count, $kt_tabs;
82
 
83
  $x = $kt_tab_count;
84
+ $kt_tabs[$x] = array( 'title' => $title, 'active' => $active, 'link' => $kt_tab_count, 'content' => $content );
85
 
86
  $kt_tab_count++;
87
  }
88
 
89
  //Shortcode for columns
90
+ function virtue_toolkit_column_shortcode_function( $atts, $content ) {
91
+ return '<div class="row">'.do_shortcode(wp_kses_post($content)).'</div>';
92
  }
93
+ function virtue_toolkit_hcolumn_shortcode_function( $atts, $content ) {
94
+ return '<div class="row">'.do_shortcode(wp_kses_post($content)).'</div>';
95
  }
96
+ function virtue_toolkit_column11_function( $atts, $content ) {
97
+ return '<div class="col-md-11">'.do_shortcode(wp_kses_post($content)).'</div>';
98
  }
99
+ function virtue_toolkit_column10_function( $atts, $content ) {
100
+ return '<div class="col-md-10">'.do_shortcode(wp_kses_post($content)).'</div>';
101
  }
102
+ function virtue_toolkit_column9_function( $atts, $content ) {
103
+ return '<div class="col-md-9">'.do_shortcode(wp_kses_post($content)).'</div>';
104
  }
105
+ function virtue_toolkit_column8_function( $atts, $content ) {
106
+ return '<div class="col-md-8">'.do_shortcode(wp_kses_post($content)).'</div>';
107
  }
108
+ function virtue_toolkit_column7_function( $atts, $content ) {
109
+ return '<div class="col-md-7">'.do_shortcode(wp_kses_post($content)).'</div>';
110
  }
111
+ function virtue_toolkit_column6_function( $atts, $content ) {
112
+ return '<div class="col-md-6">'.do_shortcode(wp_kses_post($content)).'</div>';
113
  }
114
+ function virtue_toolkit_column5_function( $atts, $content ) {
115
+ return '<div class="col-md-5">'.do_shortcode(wp_kses_post($content)).'</div>';
116
  }
117
+ function virtue_toolkit_column4_function( $atts, $content ) {
118
+ return '<div class="col-md-4">'.do_shortcode(wp_kses_post($content)).'</div>';
119
  }
120
+ function virtue_toolkit_column3_function( $atts, $content ) {
121
+ return '<div class="col-md-3">'.do_shortcode(wp_kses_post($content)).'</div>';
122
  }
123
+ function virtue_toolkit_column2_function( $atts, $content ) {
124
+ return '<div class="col-md-2">'.do_shortcode(wp_kses_post($content)).'</div>';
125
  }
126
+ function virtue_toolkit_column1_function( $atts, $content ) {
127
+ return '<div class="col-md-1">'.do_shortcode(wp_kses_post($content)).'</div>';
128
  }
129
  //Shortcode for Icons
130
+ function virtue_toolkit_icon_shortcode_function( $atts) {
131
  extract(shortcode_atts(array(
132
  'icon' => '',
133
  'size' => '',
135
  'float'=> ''
136
  ), $atts));
137
  if ($float != '') {
138
+ $output = '<i class="'.esc_attr($icon).'" style="font-size:'.esc_attr($size).'; color:'.esc_attr($color).'; float:'.esc_attr($float).'; padding:10px;"></i>';
139
  } else {
140
+ $output = '<i class="'.esc_attr($icon).'" style="font-size:'.esc_attr($size).'; color:'.esc_attr($color).';"></i>';
141
  }
142
  return $output;
143
  }
144
  // Video Shortcode
145
+ function virtue_toolkit_video_shortcode_function( $atts, $content) {
146
  extract(shortcode_atts(array(
147
  'width' => '',
148
  ), $atts));
149
+ if(!empty($width)) {
150
+ $output = '<div style="max-width:'.esc_attr($width).'px;"><div class="videofit">'.wp_kses_post($content).'</div></div>';
151
+ } else {
152
+ $output = '<div class="videofit">'.wp_kses_post($content).'</div>';
153
+ }
154
  return $output;
155
  }
156
  // Based on Ultimate Shortcodes youtube and vimeo shortcodes
157
+ function virtue_toolkit_youtube_shortcode_function( $atts, $content) {
158
  // Prepare data
 
 
159
  $atts = shortcode_atts(array(
160
  'url' => false,
161
  'width' => 600,
165
  'controls' => 'true',
166
  'hidecontrols' => 'false',
167
  'fs' => 'true',
168
+ 'loop' => 'false',
169
+ 'rel' => 'false',
170
+ 'vq' => '',
171
  'modestbranding' => 'false',
172
  'theme' => 'dark'
173
  ), $atts, 'kad_youtube' );
174
+ $return = array();
175
+ $params = array();
176
 
177
+ if ( !$atts['url'] ){
178
+ return '<p class="error">YouTube: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
179
+ }
180
  $id = ( preg_match( '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $atts['url'], $match ) ) ? $match[1] : false;
181
  // Check that url is specified
182
+ if ( !$id ) {
183
+ return '<p class="error">YouTube: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
184
+ }
185
  // Prepare params
186
  if($atts['hidecontrols'] == 'true') {$atts['controls'] = 'false';}
187
+ foreach ( array('autoplay', 'controls', 'fs', 'modestbranding', 'theme', 'rel', 'loop' ) as $param ) $params[$param] = str_replace( array( 'false', 'true', 'alt' ), array( '0', '1', '2' ), $atts[$param] );
188
  // Prepare player parameters
189
+ if(!empty($atts['vq']) ) {$params['vq'] = $atts['vq']; }
190
  $params = http_build_query( $params );
191
+ if($atts['maxwidth']) {$maxwidth = 'style="max-width:'.esc_attr($atts['maxwidth']).'px;"';} else{ $maxwidth = '';}
192
  // Create player
193
  $return[] = '<div class="kad-youtube-shortcode videofit" '.$maxwidth.' >';
194
+ $return[] = '<iframe width="' . esc_attr($atts['width']) . '" height="' . esc_attr($atts['height']) . '" src="//www.youtube.com/embed/' . esc_attr($id) . '?' . esc_attr($params) . '" frameborder="0" allowfullscreen="true"></iframe>';
195
  $return[] = '</div>';
196
  // Return result
197
  return implode( '', $return );
198
  }
199
+ function virtue_toolkit_vimeo_shortcode_function( $atts, $content) {
 
200
  $atts = shortcode_atts( array(
201
  'url' => false,
202
  'width' => 600,
203
  'height' => 400,
204
+ 'maxwidth' => '',
205
  'autoplay' => 'no'
206
  ), $atts, 'vimeo' );
207
+
208
+ if ( !$atts['url'] ){
209
+ return '<p class="error">Vimeo: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
210
+ }
211
+ $id = ( preg_match( '~(?:<iframe [^>]*src=")?(?:https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/videos?)?\/([0-9]+)[^\s]*)"?(?:[^>]*></iframe>)?(?:<p>.*</p>)?~ix', $atts['url'], $match ) ) ? $match[1] : false;
212
+ // Check that url is specified
213
+ if ( !$id ) {
214
+ return '<p class="error">Vimeo: ' . __( 'please specify correct url', 'virtue-toolkit' ) . '</p>';
215
+ }
216
+ $return = array();
217
+ if($atts['maxwidth']) {
218
+ $maxwidth = 'style="max-width:'.esc_attr($atts['maxwidth']).'px;"';
219
+ } else{
220
+ $maxwidth = '';
221
+ }
222
+ $autoplay = ( $atts['autoplay'] === 'yes' ) ? '&amp;autoplay=1' : '';
223
+ // Create player
224
+ $return[] = '<div class="kad-vimeo-shortcode videofit '.$maxwidth.'">';
225
+ $return[] = '<iframe width="' . esc_attr($atts['width']) . '" height="' . esc_attr($atts['height']) .'" src="//player.vimeo.com/video/' . esc_attr($id) . '?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff' .esc_attr($autoplay) . '" frameborder="0" allowfullscreen="true"></iframe>';
226
+ $return[] = '</div>';
227
 
228
+ // Return result
 
 
 
 
 
 
 
 
229
  return implode( '', $return );
230
  }
231
  //Button
232
+ function virtue_toolkit_button_shortcode_function( $atts) {
233
  extract(shortcode_atts(array(
234
+ 'id' => rand(1, 999),
235
  'bcolor' => '',
236
  'bhovercolor' => '',
237
  'thovercolor' => '',
240
  'target' => '_self',
241
  'tcolor' => '',
242
  ), $atts));
243
+ $output = '<a href="'.esc_url($link).'" class="btn button btn-shortcode kad-btn kad-btn-primary" id="kadbtn'.esc_attr($id).'" target="'.esc_attr($target).'" style="';
244
  if(!empty($bcolor)) {
245
+ $output .= 'background-color:'.esc_attr($bcolor).';';
246
  }
247
  if(!empty($tcolor)) {
248
+ $output .= 'color:'.esc_attr($tcolor).';';
249
  }
250
  $output .= '"';
251
  if($thovercolor == $tcolor) {$thovercolor = null;}
252
  if(!empty($bhovercolor) || !empty($thovercolor)) {
253
+ $output .= 'onMouseOver="this.style.background=\''.esc_attr($bhovercolor).'\',this.style.color=\''.esc_attr($thovercolor).'\'" onMouseOut="this.style.background=\''.esc_attr($bcolor).'\', this.style.color=\''.esc_attr($tcolor).'\'"';
254
  }
255
+ $output .= '>'.wp_kses_post($text).'</a>';
256
 
257
  return $output;
258
  }
259
+ function virtue_toolkit_blockquote_shortcode_function( $atts, $content) {
260
  extract(shortcode_atts(array(
261
  'align' => 'center',
262
  ), $atts));
263
  switch ($align)
264
  {
265
  case "center":
266
+ $output = '<div class="blockquote blockquote-full postclass clearfix">' . do_shortcode(wp_kses_post($content)) . '</div>';
267
  break;
268
 
269
  case "left":
270
+ $output = '<div class="blockquote blockquote-left postclass clearfix">' . do_shortcode(wp_kses_post($content)) . '</div>';
271
  break;
272
 
273
  case "right":
274
+ $output = '<div class="blockquote blockquote-right postclass clearfix">' . do_shortcode(wp_kses_post($content)) . '</div>';
275
  break;
276
  }
277
  return $output;
278
  }
279
+ function virtue_toolkit_pullquote_shortcode_function( $atts, $content) {
280
  extract( shortcode_atts( array(
281
  'align' => 'center'
282
  ), $atts ));
284
  switch ($align)
285
  {
286
  case "center":
287
+ $output = '<div class="pullquote pullquote-center">' . do_shortcode(wp_kses_post($content)) . '</div>';
288
  break;
289
 
290
  case "right":
291
+ $output = '<div class="pullquote pullquote-right">' . do_shortcode(wp_kses_post($content)) . '</div>';
292
  break;
293
 
294
  case "left":
295
+ $output = '<div class="pullquote pullquote-left">' . do_shortcode(wp_kses_post($content)) . '</div>';
296
  break;
297
  }
298
 
299
  return $output;
300
  }
301
+ function virtue_toolkit_hrule_function( ) {
302
  return '<div class="hrule clearfix"></div>';
303
  }
304
+ function virtue_toolkit_hrpadding10_function( ) {
305
  return '<div class="space_20 clearfix"></div>';
306
  }
307
+ function virtue_toolkit_hrpadding20_function( ) {
308
  return '<div class="space_40 clearfix"></div>';
309
  }
310
+ function virtue_toolkit_hrpadding40_function( ) {
311
  return '<div class="space_80 clearfix"></div>';
312
  }
313
+ function virtue_toolkit_clearfix_function( ) {
314
  return '<div class="clearfix"></div>';
315
  }
316
+ function virtue_toolkit_columnhelper_function( ) {
317
  return '';
318
  }
319
+ function virtue_toolkit_register_shortcodes(){
320
+ add_shortcode('accordion', 'virtue_toolkit_accordion_shortcode_function');
321
+ add_shortcode('pane', 'virtue_toolkit_accordion_pane_function');
322
+ add_shortcode('tabs', 'virtue_toolkit_tab_shortcode_function');
323
+ add_shortcode('tab', 'virtue_toolkit_tab_pane_function');
324
+ add_shortcode('columns', 'virtue_toolkit_column_shortcode_function');
325
+ add_shortcode('hcolumns', 'virtue_toolkit_hcolumn_shortcode_function');
326
+ add_shortcode('span11', 'virtue_toolkit_column11_function');
327
+ add_shortcode('span10', 'virtue_toolkit_column10_function');
328
+ add_shortcode('span9', 'virtue_toolkit_column9_function');
329
+ add_shortcode('span8', 'virtue_toolkit_column8_function');
330
+ add_shortcode('span7', 'virtue_toolkit_column7_function');
331
+ add_shortcode('span6', 'virtue_toolkit_column6_function');
332
+ add_shortcode('span5', 'virtue_toolkit_column5_function');
333
+ add_shortcode('span4', 'virtue_toolkit_column4_function');
334
+ add_shortcode('span3', 'virtue_toolkit_column3_function');
335
+ add_shortcode('span2', 'virtue_toolkit_column2_function');
336
+ add_shortcode('span1', 'virtue_toolkit_column1_function');
337
+ add_shortcode('columnhelper', 'virtue_toolkit_columnhelper_function');
338
+ add_shortcode('icon', 'virtue_toolkit_icon_shortcode_function');
339
+ add_shortcode('pullquote', 'virtue_toolkit_pullquote_shortcode_function');
340
+ add_shortcode('blockquote', 'virtue_toolkit_blockquote_shortcode_function');
341
+ add_shortcode('btn', 'virtue_toolkit_button_shortcode_function');
342
+ add_shortcode('hr', 'virtue_toolkit_hrule_function');
343
+ add_shortcode('space_20', 'virtue_toolkit_hrpadding10_function');
344
+ add_shortcode('space_40', 'virtue_toolkit_hrpadding20_function');
345
+ add_shortcode('space_80', 'virtue_toolkit_hrpadding40_function');
346
+ add_shortcode('kad_youtube', 'virtue_toolkit_youtube_shortcode_function');
347
+ add_shortcode('kt_youtube', 'virtue_toolkit_youtube_shortcode_function');
348
+ add_shortcode('kad_vimeo', 'virtue_toolkit_vimeo_shortcode_function');
349
+ add_shortcode('kt_vimeo', 'virtue_toolkit_vimeo_shortcode_function');
350
+ add_shortcode('clear', 'virtue_toolkit_clearfix_function');
351
+ }
352
+ add_action( 'init', 'virtue_toolkit_register_shortcodes');
353
 
354
 
355
+ function virtue_toolkit_register_button( $buttons ) {
356
  array_push( $buttons, "|", "kadcolumns" );
357
  array_push( $buttons, "|", "kaddivider" );
358
  array_push( $buttons, "|", "kadaccordion" );
363
  array_push( $buttons, "|", "kadvimeo" );
364
  return $buttons;
365
  }
366
+ function virtue_toolkit_add_plugin( $plugin_array ) {
367
  $plugin_array['kadcolumns'] = VIRTUE_TOOLKIT_URL . '/shortcodes/columns/columns_shortgen.js';
368
  $plugin_array['kadicon'] = VIRTUE_TOOLKIT_URL . '/shortcodes/icons/icon_shortgen.js';
369
  $plugin_array['kadaccordion'] = VIRTUE_TOOLKIT_URL . '/shortcodes/accordion/accordion_shortgen.js';
374
  $plugin_array['kaddivider'] = VIRTUE_TOOLKIT_URL . '/shortcodes/divider/divider_shortgen.js';
375
  return $plugin_array;
376
  }
377
+ function virtue_toolkit_tinymce_shortcode_button() {
378
 
379
  if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
380
  return;
381
  }
382
 
383
  if ( get_user_option('rich_editing') == 'true' ) {
384
+ add_filter( 'mce_external_plugins', 'virtue_toolkit_add_plugin' );
385
+ add_filter( 'mce_buttons_3', 'virtue_toolkit_register_button' );
386
  }
387
 
388
  }
389
+ add_action('init', 'virtue_toolkit_tinymce_shortcode_button');
390
 
391
  // Clean up Shortcodes
392
+ function virtue_toolkit_content_clean_shortcodes($content){
393
  $array = array (
394
  '<p>[' => '[',
395
  ']</p>' => ']',
398
  $content = strtr($content, $array);
399
  return $content;
400
  }
401
+ add_filter('the_content', 'virtue_toolkit_content_clean_shortcodes');
402
+ function virtue_toolkit_widget_clean_shortcodes($text){
403
  $array = array (
404
  '<p>[' => '[',
405
  ']</p>' => ']',
410
  $text = strtr($text, $array);
411
  return $text;
412
  }
413
+ add_filter('widget_text', 'virtue_toolkit_widget_clean_shortcodes');
414
  add_filter('widget_text', 'do_shortcode', 50);
shortcodes/columns/columns_popup.php CHANGED
@@ -10,7 +10,7 @@ global $wp_scripts;
10
  <title><?php _e("Insert Columns", 'virtue-toolkit'); ?></title>
11
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
12
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
13
- <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
14
  <base target="_self" />
15
  <?php wp_print_scripts(); ?>
16
  <script type="text/javascript">
@@ -27,7 +27,7 @@ var ButtonDialog = {
27
  tinyMCEPopup.execCommand('mceRemoveNode', false, null);
28
 
29
  // set up variables to contain our input values
30
- var coutput = jQuery('#icon-dialog select#columnoutput').val();
31
 
32
  var output = '';
33
 
@@ -153,13 +153,6 @@ tinyMCEPopup.onInit.add(ButtonDialog.init, ButtonDialog);
153
  <div>
154
  <p>Choose a Column Layout:</p>
155
  </div>
156
- <div class="option-row">
157
- <label for="column-option">Choose Column Output:</label>
158
- <select name="column-one" id="columnoutput">
159
- <option value="2">Shortcodes</option>
160
- <option value="1">Visual Aid</option>
161
- </select>
162
- </div>
163
  <div class="option-row">
164
  <label for="2column">Two Column</label>
165
  <input type="radio" name="column" value="2column" id="2column">
10
  <title><?php _e("Insert Columns", 'virtue-toolkit'); ?></title>
11
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
12
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
13
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
14
  <base target="_self" />
15
  <?php wp_print_scripts(); ?>
16
  <script type="text/javascript">
27
  tinyMCEPopup.execCommand('mceRemoveNode', false, null);
28
 
29
  // set up variables to contain our input values
30
+ var coutput = 2;
31
 
32
  var output = '';
33
 
153
  <div>
154
  <p>Choose a Column Layout:</p>
155
  </div>
 
 
 
 
 
 
 
156
  <div class="option-row">
157
  <label for="2column">Two Column</label>
158
  <input type="radio" name="column" value="2column" id="2column">
template-contact.php CHANGED
@@ -10,12 +10,12 @@ global $post, $pinnacle;
10
  $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true );
11
  if ($form == 'yes') { ?>
12
  <script type="text/javascript">jQuery(document).ready(function ($) {$.extend($.validator.messages, {
13
- required: "<?php echo __('This field is required.', 'virtue-toolkit'); ?>",
14
- email: "<?php echo __('Please enter a valid email address.', 'virtue-toolkit'); ?>",
15
  });
16
  $("#contactForm").validate();
17
  });</script>
18
- <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/assets/js/jquery.validate-ck.js"></script>
19
  <?php }
20
  if ($map == 'yes') { ?>
21
  <?php $address = get_post_meta( $post->ID, '_kad_contact_address', true );
@@ -109,7 +109,7 @@ global $post, $pinnacle;
109
  $nameError = __('Please enter your name.', 'virtue-toolkit');
110
  $hasError = true;
111
  } else {
112
- $name = trim($_POST['contactName']);
113
  }
114
 
115
  if(trim($_POST['email']) === '') {
@@ -119,7 +119,7 @@ global $post, $pinnacle;
119
  $emailError = __('You entered an invalid email address.', 'virtue-toolkit');
120
  $hasError = true;
121
  } else {
122
- $email = trim($_POST['email']);
123
  }
124
 
125
  if(trim($_POST['comments']) === '') {
@@ -129,7 +129,7 @@ global $post, $pinnacle;
129
  if(function_exists('stripslashes')) {
130
  $comments = stripslashes(trim($_POST['comments']));
131
  } else {
132
- $comments = trim($_POST['comments']);
133
  }
134
  }
135
 
@@ -143,16 +143,16 @@ global $post, $pinnacle;
143
  } else {
144
  $emailTo = get_option('admin_email');
145
  }
146
- $sitename = get_bloginfo('name');
147
- $subject = '['.$sitename . ' ' . __("Contact", "kadencetoolkit").'] '. __("From", "kadencetoolkit") . ' ' . $name;
148
- $body = __('Name', 'virtue-toolkit').": $name \n\n";
149
- $body .= __('Email', 'virtue-toolkit').": $email \n\n";
150
- $body .= __('Comments', 'virtue-toolkit').":\n $comments";
151
- $headers = 'Reply-To: ' . $name . '<' . $email . '>' . "\r\n";
152
 
153
- wp_mail($emailTo, $subject, $body, $headers);
154
- $emailSent = true;
155
- }
156
 
157
  } ?>
158
  <?php get_template_part('templates/page', 'header'); ?>
10
  $form_math = get_post_meta( $post->ID, '_kad_contact_form_math', true );
11
  if ($form == 'yes') { ?>
12
  <script type="text/javascript">jQuery(document).ready(function ($) {$.extend($.validator.messages, {
13
+ required: "<?php echo esc_attr(__('This field is required.', 'virtue-toolkit')); ?>",
14
+ email: "<?php echo esc_attr(__('Please enter a valid email address.', 'virtue-toolkit')); ?>",
15
  });
16
  $("#contactForm").validate();
17
  });</script>
18
+ <script type="text/javascript" src="<?php echo VIRTUE_TOOLKIT_URL ?>assets/jquery.validate.js"></script>
19
  <?php }
20
  if ($map == 'yes') { ?>
21
  <?php $address = get_post_meta( $post->ID, '_kad_contact_address', true );
109
  $nameError = __('Please enter your name.', 'virtue-toolkit');
110
  $hasError = true;
111
  } else {
112
+ $name = sanitize_text_field($_POST['contactName']);
113
  }
114
 
115
  if(trim($_POST['email']) === '') {
119
  $emailError = __('You entered an invalid email address.', 'virtue-toolkit');
120
  $hasError = true;
121
  } else {
122
+ $email = sanitize_email($_POST['email']);
123
  }
124
 
125
  if(trim($_POST['comments']) === '') {
129
  if(function_exists('stripslashes')) {
130
  $comments = stripslashes(trim($_POST['comments']));
131
  } else {
132
+ $comments = wp_kses_post($_POST['comments']);
133
  }
134
  }
135
 
143
  } else {
144
  $emailTo = get_option('admin_email');
145
  }
146
+ $sitename = get_bloginfo('name');
147
+ $subject = '['.$sitename . ' ' . __("Contact", "kadencetoolkit").'] '. __("From", "kadencetoolkit") . ' ' . $name;
148
+ $body = __('Name', 'virtue-toolkit').": $name \n\n";
149
+ $body .= __('Email', 'virtue-toolkit').": $email \n\n";
150
+ $body .= __('Comments', 'virtue-toolkit').":\n $comments";
151
+ $headers = 'Reply-To: ' . $name . '<' . $email . '>' . "\r\n";
152
 
153
+ wp_mail($emailTo, $subject, $body, $headers);
154
+ $emailSent = true;
155
+ }
156
 
157
  } ?>
158
  <?php get_template_part('templates/page', 'header'); ?>
virtue_toolkit.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Kadence Toolkit
5
  Description: Custom Portfolio and Shortcode functionality for free Kadence WordPress themes
6
- Version: 4.3
7
  Author: Kadence Themes
8
  Author URI: https://kadencethemes.com/
9
  License: GPLv2 or later
@@ -19,12 +19,20 @@ function virtue_toolkit_deactivation() {
19
  }
20
  register_deactivation_hook(__FILE__, 'virtue_toolkit_deactivation');
21
 
22
- add_filter( 'kadence_theme_options_args', 'kadencetoolkit_redux_args_new');
23
- function kadencetoolkit_redux_args_new( $args ) {
24
- $args['customizer_only'] = false;
25
- $args['save_defaults'] = true;
26
- return $args;
27
  }
 
 
 
 
 
 
 
 
28
  require_once('kadence_image_processing.php');
29
  require_once('post-types.php');
30
  require_once('gallery.php');
@@ -33,36 +41,30 @@ require_once('shortcodes.php');
33
  require_once('shortcode_ajax.php');
34
  require_once('pagetemplater.php');
35
  require_once('metaboxes.php');
 
36
 
37
- if(!defined('VIRTUE_TOOLKIT_PATH')){
38
- define('VIRTUE_TOOLKIT_PATH', realpath(plugin_dir_path(__FILE__)) . DIRECTORY_SEPARATOR );
39
- }
40
- if(!defined('VIRTUE_TOOLKIT_URL')){
41
- define('VIRTUE_TOOLKIT_URL', plugin_dir_url(__FILE__) );
42
- }
43
-
44
- function kadencetoolkit_textdomain() {
45
  load_plugin_textdomain( 'virtue-toolkit', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
46
  }
47
- add_action( 'plugins_loaded', 'kadencetoolkit_textdomain' );
48
 
49
 
50
- function kadencetoolkit_admin_scripts() {
51
- wp_register_style('kadencetoolkit_adminstyles', VIRTUE_TOOLKIT_URL . '/assets/toolkit_admin.css', false, 23);
52
- wp_enqueue_style('kadencetoolkit_adminstyles');
53
 
54
  }
55
 
56
- add_action('admin_enqueue_scripts', 'kadencetoolkit_admin_scripts');
57
 
58
- function kadence_toolkit_flushpermalinks() {
59
  $hasflushed = get_option('kadence_toolkit_flushpermalinks', '0');
60
  if($hasflushed != '1') {
61
  flush_rewrite_rules();
62
  update_option('kadence_toolkit_flushpermalinks', '1');
63
  }
64
  }
65
- add_action('init', 'kadence_toolkit_flushpermalinks');
66
 
67
 
68
  add_action( 'after_setup_theme', 'virtue_toolkit_add_in_slider_sections', 1);
@@ -90,4 +92,3 @@ function virtue_toolkit_add_in_slider_sections() {
90
 
91
 
92
 
93
-
3
  /*
4
  Plugin Name: Kadence Toolkit
5
  Description: Custom Portfolio and Shortcode functionality for free Kadence WordPress themes
6
+ Version: 4.4
7
  Author: Kadence Themes
8
  Author URI: https://kadencethemes.com/
9
  License: GPLv2 or later
19
  }
20
  register_deactivation_hook(__FILE__, 'virtue_toolkit_deactivation');
21
 
22
+ add_filter( 'kadence_theme_options_args', 'virtue_toolkit_redux_args_new');
23
+ function virtue_toolkit_redux_args_new( $args ) {
24
+ $args['customizer_only'] = false;
25
+ $args['save_defaults'] = true;
26
+ return $args;
27
  }
28
+
29
+ if(!defined('VIRTUE_TOOLKIT_PATH')){
30
+ define('VIRTUE_TOOLKIT_PATH', realpath(plugin_dir_path(__FILE__)) . DIRECTORY_SEPARATOR );
31
+ }
32
+ if(!defined('VIRTUE_TOOLKIT_URL')){
33
+ define('VIRTUE_TOOLKIT_URL', plugin_dir_url(__FILE__) );
34
+ }
35
+
36
  require_once('kadence_image_processing.php');
37
  require_once('post-types.php');
38
  require_once('gallery.php');
41
  require_once('shortcode_ajax.php');
42
  require_once('pagetemplater.php');
43
  require_once('metaboxes.php');
44
+ require_once('welcome.php');
45
 
46
+ function virtue_toolkit_textdomain() {
 
 
 
 
 
 
 
47
  load_plugin_textdomain( 'virtue-toolkit', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
48
  }
49
+ add_action( 'plugins_loaded', 'virtue_toolkit_textdomain' );
50
 
51
 
52
+ function virtue_toolkit_admin_scripts() {
53
+ wp_register_style('virtue_toolkit_adminstyles', VIRTUE_TOOLKIT_URL . '/assets/toolkit_admin.css', false, 23);
54
+ wp_enqueue_style('virtue_toolkit_adminstyles');
55
 
56
  }
57
 
58
+ add_action('admin_enqueue_scripts', 'virtue_toolkit_admin_scripts');
59
 
60
+ function virtue_toolkit_flushpermalinks() {
61
  $hasflushed = get_option('kadence_toolkit_flushpermalinks', '0');
62
  if($hasflushed != '1') {
63
  flush_rewrite_rules();
64
  update_option('kadence_toolkit_flushpermalinks', '1');
65
  }
66
  }
67
+ add_action('init', 'virtue_toolkit_flushpermalinks');
68
 
69
 
70
  add_action( 'after_setup_theme', 'virtue_toolkit_add_in_slider_sections', 1);
92
 
93
 
94
 
 
welcome.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Build Welcome Page
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ if ( ! class_exists( 'virtue_toolkit_welcome' ) ) {
8
+ class virtue_toolkit_welcome {
9
+ private $my_theme;
10
+ public $theme_name;
11
+ public $version;
12
+ public function __construct() {
13
+ if ( is_admin() ) {
14
+ $this->my_theme = wp_get_theme(); // Get theme data
15
+ if($this->my_theme->get( 'Name' ) == 'Ascend' || $this->my_theme->get( 'Name' ) == 'Virtue' || $this->my_theme->get( 'Name' ) == 'Pinnacle' ) {
16
+ $this->theme_name = $this->my_theme->get( 'Name' );
17
+ } elseif ($this->my_theme->get( 'Template') == 'ascend' ){
18
+ $this->theme_name = 'Ascend';
19
+ } elseif($this->my_theme->get( 'Template') == 'virtue' ) {
20
+ $this->theme_name = 'Virtue';
21
+ } elseif($this->my_theme->get( 'Template') == 'pinnacle' ){
22
+ $this->theme_name = 'Pinnacle';
23
+ } else {
24
+ $this->theme_name = 'Not Kadence';
25
+ }
26
+ if($this->theme_name != 'Not Kadence') {
27
+ add_action( 'admin_menu', array( $this, 'add_menu' ) );
28
+ }
29
+ add_action( 'tgmpa_register', array($this, 'register_importer'), 30);
30
+ add_filter( 'plugin_action_links_virtue-toolkit/virtue_toolkit.php', array($this, 'add_settings_link') );
31
+ }
32
+ }
33
+ // Add option page menu
34
+ public function add_menu() {
35
+ $page = add_theme_page(__( 'Getting Started with: ', 'virtue-toolkit' ) . $this->theme_name, __( 'Getting Started', 'virtue-toolkit' ), 'manage_options', 'kadence_welcome_page', array( $this, 'config_page'));
36
+ add_action( 'admin_print_styles-' . $page, array( $this, 'css_scripts' ) );
37
+ }
38
+ // Loads admin style sheets
39
+ public function css_scripts() {
40
+ wp_enqueue_style( 'toolkit-welcome-css', VIRTUE_TOOLKIT_URL . '/welcome/toolkit-welcome.css', array(), $this->version, 'all');
41
+ wp_enqueue_script('toolkit-welcome-js', VIRTUE_TOOLKIT_URL . '/welcome/toolkit-welcome.js',array(), $this->version, true);
42
+ add_thickbox();
43
+ }
44
+ public function config_page() {
45
+ if($this->theme_name == 'Not Kadence') { ?>
46
+ <div class="wrap kt_theme_welcome">
47
+ <h2 class="notices"></h2>
48
+ <div class="kt_title_area">
49
+ <h1>
50
+ <?php echo __('The Kadence Toolkit is only designed to work with Kadence Themes', 'virtue-toolkit'); ?>
51
+ </h1>
52
+ </div>
53
+ </div>
54
+ <?php
55
+ } else {
56
+
57
+ ?>
58
+ <div class="wrap kt_theme_welcome">
59
+ <h2 class="notices"></h2>
60
+ <div class="kt_title_area">
61
+ <h1>
62
+ <?php echo apply_filters('kt_getting_started_page_title', __('Getting Started with ', 'virtue-toolkit'). $this->theme_name ); ?>
63
+ </h1>
64
+ <h4>
65
+ <?php echo apply_filters('kt_getting_started_page_subtitle', __('Demo content, recomended plugins and helpful links.', 'virtue-toolkit') ); ?>
66
+ </h4>
67
+ </div>
68
+ <?php ob_start(); ?>
69
+ <div class="kad-panel-left kt-admin-clearfix">
70
+ <div class="kad-panel-contain">
71
+ <h2 class="nav-tab-wrapper">
72
+ <?php do_action('kt_getting_started_nav_before'); ?>
73
+ <a class="nav-tab nav-tab-active" data-tab-id="kt-helplinks" href="#"><?php echo __('Helpful Links', 'virtue-toolkit');?></a>
74
+ <a class="nav-tab" data-tab-id="kt-plugins" href="#"><?php echo __('Recomended Plugins', 'virtue-toolkit');?></a>
75
+ <a class="nav-tab" data-tab-id="kt-demo-content" href="#"><?php echo __('Demo Content', 'virtue-toolkit');?></a>
76
+ <?php do_action('kt_getting_started_nav_after'); ?>
77
+ </h2>
78
+ <?php do_action('kt_getting_started_before'); ?>
79
+ <div id="kt-helplinks" class="nav-tab-content panel_open kt-admin-clearfix">
80
+ <div class="kad-helpful-links kt-main">
81
+ <h4><?php echo __('Getting Started', 'virtue-toolkit');?></h4>
82
+ <?php echo '<a href="http://docs.kadencethemes.com/'.esc_attr(strtolower($this->theme_name)).'-free/" target="_blank">'.esc_html($this->theme_name) . __( ' Documention', 'virtue-toolkit').'</a>';?>
83
+ <a href="https://www.kadencethemes.com/kadence-themes-demo-content/" target="_blank"><?php echo __('Demo Content', 'virtue-toolkit');?></a>
84
+ <a href="https://www.kadencethemes.com/kadence-tutorials/" target="_blank"><?php echo __('Tutorials', 'virtue-toolkit');?></a>
85
+ <h4 class="kt-next-section"><?php echo __('Support', 'virtue-toolkit');?></h4>
86
+ <?php if($this->theme_name == 'Ascend') {
87
+ $link = 'https://wordpress.org/support/theme/ascend';
88
+ } else if($this->theme_name == 'Virtue') {
89
+ $link = 'https://wordpress.org/support/theme/virtue';
90
+ } else if($this->theme_name == 'Pinnacle') {
91
+ $link = 'https://wordpress.org/support/theme/pinnacle';
92
+ }
93
+ echo '<a href="'.esc_url($link).'" target="_blank">'.esc_html($this->theme_name) . __(' Support Forms', 'virtue-toolkit').'</a>';?>
94
+ </div>
95
+ </div>
96
+ <div id="kt-plugins" class="nav-tab-content kt-admin-clearfix">
97
+ <div class="kad-recomended-plugins kt-main">
98
+ <h4><?php echo __('Recomended Plugins', 'virtue-toolkit');?></h4>
99
+ <p><?php echo __('These are plugins are not required. Just some cool plugins with cool features that can really enhance your site.', 'virtue-toolkit');?></p>
100
+ <div class="kt_suggest_section kt-admin-clearfix">
101
+ <?php
102
+ $suggested = $this->suggested_plugins();
103
+ foreach ($suggested as $plugin) {
104
+ echo '<div class="kt_plugin_box">';
105
+ echo '<img src="'.$plugin['image'].'">';
106
+ echo '<h3>'.$plugin['name'].'</h3>';
107
+ echo '<h5>'.$plugin['activated'].'</h5>';
108
+ echo '<p>'.$plugin['desc'].'</p>';
109
+ echo '<a class="kt_plugin_button '.esc_attr($plugin['class']).'" href="'.esc_attr($plugin['action']).'">'.esc_html($plugin['action_title']).'</a>';
110
+ echo '</div>';
111
+ }
112
+ ?>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ <div id="kt-demo-content" class="nav-tab-content kt-admin-clearfix">
117
+ <div class="kad-recomended-plugins kt-main">
118
+ <h4><?php echo __('Install Demo Content Importer', 'virtue-toolkit');?></h4>
119
+ <p><?php echo __('This importer plugin allows you to fill your site with demo content from one of the theme demos.', 'virtue-toolkit');?></p>
120
+ <p><?php echo __('For a turorial on how to use the Importer go here:', 'virtue-toolkit'). ' <a href="https://www.kadencethemes.com/kadence-themes-demo-content/" target="_blank">https://www.kadencethemes.com/kadence-themes-demo-content/</a>'; ?></p>
121
+ <div class="kt_demo_section kt-admin-clearfix">
122
+ <div class="kt_plugin_box">
123
+ <img src="<?php echo VIRTUE_TOOLKIT_URL . 'welcome/images/kip_logo.jpg';?>">
124
+ <h3>Kadence Importer</h3>
125
+ <?php if(is_plugin_active('kadence-importer/kadence-importer.php')) { ?>
126
+ <h5>Activated</h5>
127
+ <p>Kadence Importer plugin adds an import tool so you can fill your site with demo content</p>
128
+ <a class="kt_plugin_button" href="<?php echo admin_url('tools.php?page=kadence-importer');?>">Plugin Settings</a>
129
+ <?php } else { ?>
130
+ <h5>Inactive</h5>
131
+ <p>Kadence Importer plugin adds an import tool so you can fill your site with demo content</p>
132
+ <a class="kt_plugin_button" href="<?php echo admin_url('themes.php?page=install-recommended-plugins');?>">Install/Activate Plugin</a>
133
+ <?php } ?>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ </div>
138
+ <?php do_action('kt_getting_started_after'); ?>
139
+ </div>
140
+ </div>
141
+ <div class="kad-panel-bottom kt-admin-clearfix">
142
+ <div class="kad-featured-items kt-admin-clearfix">
143
+ <div class="featured">
144
+ <h4><?php echo __('Featured Theme', 'virtue-toolkit');?></h4>
145
+ <a href="https://www.kadencethemes.com/product/ascend-wordpress-theme/?utm_source=toolkit&utm_medium=cpc&utm_campaign=ascend_free" target="_blank">
146
+ <img src="<?php echo VIRTUE_TOOLKIT_URL . 'welcome/images/theme_feat.jpg';?>">
147
+ </a>
148
+ <a href="https://www.kadencethemes.com/product/ascend-wordpress-theme/?utm_source=toolkit&utm_medium=cpc&utm_campaign=ascend_free" target="_blank"><h3>Ascend</h3></a>
149
+ <p>Ascend will surpass your expectations over and over again. Amazingly versatile, easily customizable and loaded with features you will love. Easily install and start right from one of our many demos.</p>
150
+ <a href="https://www.kadencethemes.com/product/ascend-wordpress-theme/?utm_source=toolkit&utm_medium=cpc&utm_campaign=ascend_free" target="_blank"><h5>FREE THEME</h5></a>
151
+ </div>
152
+ <div class="featured">
153
+ <h4><?php echo __('Featured Plugin', 'virtue-toolkit');?></h4>
154
+ <a href="https://www.kadencethemes.com/product/kadence-woo-extras/?utm_source=toolkit&utm_medium=cpc&utm_campaign=woo_extra" target="_blank">
155
+ <img src="<?php echo VIRTUE_TOOLKIT_URL . 'welcome/images/plugin_feat.jpg';?>">
156
+ </a>
157
+ <a href="https://www.kadencethemes.com/product/kadence-woo-extras/?utm_source=toolkit&utm_medium=cpc&utm_campaign=woo_extra" target="_blank"><h3>Kadence Woo Extras</h3></a>
158
+ <p>Kadence Woo Extras is a powerful plugin for adding special features to your e-commerce site. Advanced product galleries, reviews, cart notices, size charts, variation swatches, and more.</p>
159
+ <a href="https://www.kadencethemes.com/product/ascend-wordpress-theme/?utm_source=toolkit&utm_medium=cpc&utm_campaign=ascend_free" target="_blank"><h5>PREMIUM PLUGIN</h5></a>
160
+ </div>
161
+ </div>
162
+ </div>
163
+ <?php
164
+ $welcome_content = ob_get_clean();
165
+ echo apply_filters( 'kt_getting_started_content', $welcome_content );
166
+ ?>
167
+ </div>
168
+ <?php
169
+ }
170
+ }
171
+ public function suggested_plugins() {
172
+ $suggested = array(
173
+ 'siteorigin-panels' => array(
174
+ 'slug' => 'siteorigin-panels',
175
+ 'plugin_check' => 'siteorigin-panels/siteorigin-panels.php',
176
+ 'name' => 'Page Builder',
177
+ 'desc' => 'A drag and drop, responsive page builder that simplifies building your website.',
178
+ 'image' => VIRTUE_TOOLKIT_URL . 'welcome/images/pb_logo.jpg',
179
+ 'author' => 'SiteOrigin'
180
+ ),
181
+ 'black-studio-tinymce-widget' => array(
182
+ 'slug' => 'black-studio-tinymce-widget',
183
+ 'plugin_check' => 'black-studio-tinymce-widget/black-studio-tinymce-widget.php',
184
+ 'name' => 'Visual Editor Widget',
185
+ 'desc' => 'This plugin adds a new Visual Editor widget that allows you to insert rich text and media objects in your sidebars and pagebuilder widget areas.',
186
+ 'image' => VIRTUE_TOOLKIT_URL . 'welcome/images/ve_logo.jpg',
187
+ 'author' => 'Black Studio'
188
+ ),
189
+ 'woocommerce' => array(
190
+ 'slug' => 'woocommerce',
191
+ 'plugin_check' => 'woocommerce/woocommerce.php',
192
+ 'name' => 'WooCommerce',
193
+ 'desc' => 'WooCommerce is a free eCommerce plugin that allows you to sell anything, beautifully. Built to integrate seamlessly with WordPress.',
194
+ 'image' => VIRTUE_TOOLKIT_URL . 'welcome/images/woo_logo.jpg',
195
+ 'author' => 'WooThemes'
196
+ ),
197
+ 'wordpress-seo' => array(
198
+ 'slug' => 'wordpress-seo',
199
+ 'plugin_check' => 'wordpress-seo/wp-seo.php',
200
+ 'name' => 'Yoast SEO',
201
+ 'desc' => 'Improve your WordPress SEO: Write better content and have a fully optimized WordPress site using Yoast SEO plugin.',
202
+ 'image' => VIRTUE_TOOLKIT_URL . 'welcome/images/ws_logo.jpg',
203
+ 'author' => 'Yoast'
204
+ ),
205
+ 'contact-form-7' => array(
206
+ 'slug' => 'contact-form-7',
207
+ 'plugin_check' => 'contact-form-7/contact-form-7.php',
208
+ 'name' => 'Contact Form 7',
209
+ 'desc' => 'Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup.',
210
+ 'image' => VIRTUE_TOOLKIT_URL . 'welcome/images/cf7_logo.jpg',
211
+ 'author' => 'Contact Form 7'
212
+ ),
213
+ );
214
+ foreach ($suggested as $plugin) {
215
+ if(is_plugin_active($plugin['plugin_check'])) {
216
+ $action = admin_url('plugins.php');
217
+ $action_title = __('Manage Plugins', 'pinnacle');
218
+ $activated = __('Activated', 'pinnacle');
219
+ $class = '';
220
+ } else {
221
+ $action = admin_url('plugin-install.php?tab=plugin-information&amp;plugin='.$plugin['slug']);
222
+ $action_title = 'Install/Activate Plugin';
223
+ $activated = 'Inactive';
224
+ $class = 'thickbox onclick';
225
+ }
226
+ $output[$plugin['slug']] = array(
227
+ 'image' => $plugin['image'],
228
+ 'name' => $plugin['name'],
229
+ 'author' => $plugin['author'],
230
+ 'desc' => $plugin['desc'],
231
+ 'action' => $action,
232
+ 'action_title' => $action_title,
233
+ 'activated' => $activated,
234
+ 'class' => $class,
235
+ );
236
+ }
237
+
238
+ return $output;
239
+
240
+ }
241
+ public function register_importer() {
242
+ $plugins = array();
243
+ $plugins[] = array(
244
+ 'name' => 'Kadence Importer',
245
+ 'slug' => 'kadence-importer',
246
+ 'source' => 'https://s3.amazonaws.com/ktupdates/importer/kadence-importer.zip',
247
+ 'required' => false,
248
+ 'version' => '2.0',
249
+ 'force_activation' => false,
250
+ 'force_deactivation' => false,
251
+ 'external_url' => '',
252
+ );
253
+ $config = array(
254
+ 'domain' => 'virtue-toolkit', // Text domain - likely want to be the same as your theme.
255
+ 'default_path' => '', // Default absolute path to pre-packaged plugins
256
+ 'parent_slug' => 'themes.php', // Parent menu slug.
257
+ 'menu' => 'install-recommended-plugins', // Menu slug
258
+ 'has_notices' => false, // Show admin notices or not
259
+ 'is_automatic' => false, // Automatically activate plugins after installation or not
260
+ 'message' => '', // Message to output right before the plugins table
261
+ 'strings' => array(
262
+ 'page_title' => __( 'Install Recommended Plugins', 'virtue-toolkit' ),
263
+ 'menu_title' => __( 'Theme Plugins', 'virtue-toolkit' ),
264
+ 'installing' => __( 'Installing Plugin: %s', 'virtue-toolkit' ), // %1$s = plugin name
265
+ 'oops' => __( 'Something went wrong with the plugin API.', 'virtue-toolkit' ),
266
+ 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'virtue-toolkit' ), // %1$s = plugin name(s)
267
+ 'notice_can_install_recommended' => _n_noop( 'This theme comes packaged with the following premium plugin: %1$s. Plugin is not required, but suggested.', 'This theme comes packaged with the following premium plugins: %1$s. Plugins are not required, but suggested.', 'virtue-toolkit' ), // %1$s = plugin name(s)
268
+ 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'virtue-toolkit' ), // %1$s = plugin name(s)
269
+ 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' , 'virtue-toolkit'), // %1$s = plugin name(s)
270
+ 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' , 'virtue-toolkit'), // %1$s = plugin name(s)
271
+ 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'virtue-toolkit' ), // %1$s = plugin name(s)
272
+ 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' , 'virtue-toolkit'), // %1$s = plugin name(s)
273
+ 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' , 'virtue-toolkit'), // %1$s = plugin name(s)
274
+ 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'virtue-toolkit' ),
275
+ 'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins', 'virtue-toolkit' ),
276
+ 'return' => __( 'Return to recommended Plugins Installer', 'virtue-toolkit' ),
277
+ 'plugin_activated' => __( 'Plugin activated successfully.', 'virtue-toolkit' ),
278
+ 'complete' => __( 'All plugins installed and activated successfully. %s', 'virtue-toolkit' ), // %1$s = dashboard link
279
+ 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error'
280
+ )
281
+ );
282
+ if($this->theme_name != 'Not Kadence') {
283
+ tgmpa( $plugins, $config );
284
+ }
285
+ }
286
+ public function add_settings_link( $links ) {
287
+ $settings_link = '<a href="'.admin_url('themes.php?page=kadence_welcome_page').'">' . __( 'Settings', 'virtue-toolkit' ) . '</a>';
288
+ array_push($links, $settings_link );
289
+ return $links;
290
+ }
291
+ }
292
+ }
293
+
294
+ $GLOBALS['virtue_toolkit_welcome'] = new virtue_toolkit_welcome;
welcome/images/cf7_logo.jpg ADDED
Binary file
welcome/images/kip_logo.jpg ADDED
Binary file
welcome/images/pb_logo.jpg ADDED
Binary file
welcome/images/plugin_feat.jpg ADDED
Binary file
welcome/images/portfolio-icon.png ADDED
Binary file
welcome/images/theme_feat.jpg ADDED
Binary file
welcome/images/ve_logo.jpg ADDED
Binary file
welcome/images/woo_logo.jpg ADDED
Binary file
welcome/images/ws_logo.jpg ADDED
Binary file
welcome/toolkit-welcome.css ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .kt_theme_welcome h1 {
2
+ font-size: 42px;
3
+ line-height: 1.2;
4
+ font-weight: 300;
5
+ margin-bottom: 10px;
6
+ }
7
+ .kt_theme_welcome h4 {
8
+ color: #555;
9
+ font-size: 18px;
10
+ line-height: 1.6;
11
+ font-weight: bold;
12
+ letter-spacing: 1.2px;
13
+ margin: 0;
14
+ }
15
+ .kt_theme_welcome .kt_title_area h4{
16
+ font-weight:400;
17
+ }
18
+ .kt-admin-clearfix:before, .kt-admin-clearfix:after {
19
+ content: '';
20
+ clear:both;
21
+ display:table;
22
+ }
23
+ .kad-panel-left, .kad-panel-bottom {
24
+ max-width:1200px;
25
+ float: none;
26
+ padding: 0 30px 30px 20px;
27
+ box-sizing: border-box;
28
+ }
29
+ .kt_theme_welcome .nav-tab {
30
+ font-size: 18px;
31
+ font-weight: 300;
32
+ padding: 10px 20px;
33
+ border: 0;
34
+ letter-spacing: -1px;
35
+ }
36
+ .kt_title_area {
37
+ padding: 20px;
38
+ }
39
+ .kt_theme_welcome .nav-tab-active, .kt_theme_welcome .nav-tab-active:focus, .kt_theme_welcome .nav-tab-active:focus:active, .kt_theme_welcome .nav-tab-active:hover {
40
+ background:white;
41
+ }
42
+ .wrap.kt_theme_welcome h2.nav-tab-wrapper {
43
+ border: 0;
44
+ }
45
+ .kad-helpful-links a:focus {
46
+ box-shadow: none;
47
+ }
48
+ .nav-tab-content {
49
+ background: white;
50
+ padding: 20px 30px;
51
+ }
52
+ .kad-panel-left .nav-tab-content {
53
+ display: none;
54
+ }
55
+ .kad-panel-left .nav-tab-content.panel_open {
56
+ display: block;
57
+ }
58
+ .kad-panel-right, .kad-panel-left {
59
+ margin-top: 60px;
60
+ }
61
+ .kt-main {
62
+ max-width: 600px;
63
+ }
64
+ .kt-main h2 {
65
+ margin: 10px 0 20px 0;
66
+ }
67
+ .kt-main input[type='text'] {
68
+ margin-right: 5px;
69
+ padding: 8px;
70
+ }
71
+
72
+ .kt-main .submit input#submit {
73
+ color: #00b5e2;
74
+ text-shadow: none;
75
+ font-size: 16px;
76
+ font-weight: 700;
77
+ padding: 10px 20px;
78
+ line-height: 20px;
79
+ background: white;
80
+ height: auto;
81
+ box-shadow: none;
82
+ border: 2px solid #00b5e2;
83
+ }
84
+
85
+ .kt-main .form-table th {
86
+ line-height: 40px;
87
+ padding: 15px 10px 0 0;
88
+ }
89
+
90
+ .kt-main a {
91
+ color: #00b5e2;
92
+ }
93
+
94
+ .kt-main .submit input#submit:hover {
95
+ color: #fff;
96
+ background: #00b5e2;
97
+ }
98
+ .kt-main input[type='text'] {
99
+ margin-right: 5px;
100
+ }
101
+ .kt-main .form-table td input[type=checkbox], .kt-main .form-table td span.description {
102
+ line-height: 35px;
103
+ }
104
+ .kad-helpful-links a {
105
+ display: block;
106
+ padding: 10px 0;
107
+ font-size: 16px;
108
+ font-weight: 300;
109
+ cursor: pointer;
110
+ }
111
+ h4.kt-next-section {
112
+ margin-top: 20px;
113
+ }
114
+ ul.celist{ list-style-type: square; list-style-position:inside; }
115
+ .hidden {visibility:hidden;}
116
+ .alert { background-color: #fffedf; font-weight: bold; padding: 10px; text-align: center; }
117
+ .icon-pos {
118
+ padding-right:10px;
119
+ padding-left:10px;
120
+ /* Positions icon from the top */
121
+ position: relative;
122
+ top: 3px;
123
+ }
124
+ .kt-main input[type='text'],
125
+ .kt-main textarea {
126
+ width: 90%;
127
+ box-sizing: border-box;
128
+ -moz-box-sizing: border-box;
129
+ -webkit-box-sizing: border-box;
130
+ }
131
+
132
+ .kad-recomended-plugins.kt-main {
133
+ max-width: 100%;
134
+ }
135
+ .kt_plugin_box h5 {
136
+ margin: 0;
137
+ color: #777;
138
+ border: 1px solid #777;
139
+ display: inline-block;
140
+ padding: 0 6px;
141
+ }
142
+
143
+ a.kt_plugin_button {
144
+ text-decoration: none;
145
+ color: white;
146
+ background: #555;
147
+ padding: 8px 12px;
148
+ display: inline-block;
149
+ }
150
+ a.kt_plugin_button:hover {
151
+ opacity: .9;
152
+ }
153
+ .kt_plugin_box {
154
+ padding: 20px;
155
+ width: 46%;
156
+ float: left;
157
+ margin-right: 2%;
158
+ border: 5px solid #eee;
159
+ margin-left: 2%;
160
+ margin-bottom: 2%;
161
+ margin-top: 2%;
162
+ text-align: center;
163
+ box-sizing: border-box;
164
+ }
165
+ .kt_plugin_box span {
166
+ display: block;
167
+ margin-top: 5px;
168
+ font-style: italic;
169
+ }
170
+ .kt_plugin_box p {
171
+ min-height: 80px;
172
+ }
173
+ .kt_plugin_box img {
174
+ max-width: 100%;
175
+ }
176
+ .kad-featured-items {
177
+ background: #fff;
178
+ max-width: 100%;
179
+ padding: 20px 10px;
180
+ }
181
+ .kad-featured-items .featured {
182
+ float: left;
183
+ width: 50%;
184
+ padding: 10px 20px;
185
+ box-sizing: border-box;
186
+ }
187
+ .kad-featured-items .featured img {
188
+ max-width: 100%;
189
+ }
190
+ .kad-featured-items .featured h4 {
191
+ font-weight: bold;
192
+ letter-spacing: 2px;
193
+ text-transform: uppercase;
194
+ padding: 0 0 10px 0;
195
+ color: #555;
196
+ }
197
+ .kad-featured-items .featured a {
198
+ text-decoration: none;
199
+ display: block;
200
+ }
201
+
202
+ .kad-featured-items .featured h5 {
203
+ color: #00b5e2;
204
+ }
welcome/toolkit-welcome.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+ $('.kad-panel-left .nav-tab').click(function (event) {
3
+ event.preventDefault();
4
+
5
+ var panel = $(this);
6
+ var active = $(this).closest('.nav-tab-wrapper').find('.nav-tab-active');
7
+ var opencontent = $(this).closest('.kad-panel-contain').find('.nav-tab-content.panel_open');
8
+ var contentid = $(this).data('tab-id');
9
+
10
+ if (panel.hasClass('nav-tab-active')) {
11
+ //leave
12
+ } else {
13
+ panel.addClass('nav-tab-active');
14
+ active.removeClass('nav-tab-active');
15
+ opencontent.removeClass('panel_open');
16
+ $('#'+contentid).addClass('panel_open');
17
+ }
18
+
19
+ return false;
20
+
21
+ });
22
+ });