Version Description
Download this release
Release Info
Developer | borkweb |
Plugin | Event Tickets |
Version | 4.12.1.2 |
Comparing to | |
See all releases |
Code changes from version 4.12.1.1 to 4.12.1.2
- common/src/resources/js/dropdowns.js +2 -5
- common/src/resources/js/dropdowns.min.js +509 -1
- event-tickets.php +2 -1
- readme.txt +6 -1
- src/Tribe/Main.php +1 -1
common/src/resources/js/dropdowns.js
CHANGED
@@ -49,9 +49,6 @@ var tribe_dropdowns = window.tribe_dropdowns || {};
|
|
49 |
return null;
|
50 |
};
|
51 |
|
52 |
-
obj.allow_html_markup = function ( m ) {
|
53 |
-
return m;
|
54 |
-
};
|
55 |
|
56 |
/**
|
57 |
* Better Search ID for Select2, compatible with WordPress ID from WP_Query
|
@@ -266,7 +263,7 @@ var tribe_dropdowns = window.tribe_dropdowns || {};
|
|
266 |
|
267 |
// Don't Remove HTML elements or escape elements
|
268 |
if ( $select.is( '[data-allow-html]' ) ) {
|
269 |
-
|
270 |
}
|
271 |
|
272 |
// If we are dealing with a Input Hidden we need to set the Data for it to work.
|
@@ -356,7 +353,7 @@ var tribe_dropdowns = window.tribe_dropdowns || {};
|
|
356 |
args.data = { results: [] };
|
357 |
|
358 |
// Allows HTML from Select2 AJAX calls
|
359 |
-
|
360 |
|
361 |
// Format for Parents breadcrumbs
|
362 |
args.formatResult = function ( item, container, query ) {
|
49 |
return null;
|
50 |
};
|
51 |
|
|
|
|
|
|
|
52 |
|
53 |
/**
|
54 |
* Better Search ID for Select2, compatible with WordPress ID from WP_Query
|
263 |
|
264 |
// Don't Remove HTML elements or escape elements
|
265 |
if ( $select.is( '[data-allow-html]' ) ) {
|
266 |
+
|
267 |
}
|
268 |
|
269 |
// If we are dealing with a Input Hidden we need to set the Data for it to work.
|
353 |
args.data = { results: [] };
|
354 |
|
355 |
// Allows HTML from Select2 AJAX calls
|
356 |
+
|
357 |
|
358 |
// Format for Parents breadcrumbs
|
359 |
args.formatResult = function ( item, container, query ) {
|
common/src/resources/js/dropdowns.min.js
CHANG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|
|
|
|
|
1 |
+
/* global console, jQuery */
|
2 |
+
var tribe_dropdowns = window.tribe_dropdowns || {};
|
3 |
+
|
4 |
+
( function( $, obj, _ ) {
|
5 |
+
'use strict';
|
6 |
+
|
7 |
+
obj.selector = {
|
8 |
+
dropdown: '.tribe-dropdown',
|
9 |
+
created: '.tribe-dropdown-created',
|
10 |
+
searchField: '.select2-search__field',
|
11 |
+
};
|
12 |
+
|
13 |
+
// Setup a Dependent
|
14 |
+
$.fn.tribe_dropdowns = function () {
|
15 |
+
obj.dropdown( this, {} );
|
16 |
+
|
17 |
+
return this;
|
18 |
+
};
|
19 |
+
|
20 |
+
obj.freefrom_create_search_choice = function( params ) {
|
21 |
+
var term = $.trim( params.term );
|
22 |
+
|
23 |
+
if ( '' === term ) {
|
24 |
+
return null;
|
25 |
+
}
|
26 |
+
|
27 |
+
var args = this.options.options;
|
28 |
+
var $select = args.$select;
|
29 |
+
|
30 |
+
if (
|
31 |
+
term.match( args.regexToken )
|
32 |
+
&& (
|
33 |
+
! $select.is( '[data-int]' )
|
34 |
+
|| (
|
35 |
+
$select.is( '[data-int]' )
|
36 |
+
&& term.match( /\d+/ )
|
37 |
+
)
|
38 |
+
)
|
39 |
+
) {
|
40 |
+
var choice = { id: term, text: term, new: true };
|
41 |
+
|
42 |
+
if ( $select.is( '[data-create-choice-template]' ) ) {
|
43 |
+
choice.text = _.template( $select.data( 'createChoiceTemplate' ) )( { term: term } );
|
44 |
+
}
|
45 |
+
|
46 |
+
return choice;
|
47 |
+
}
|
48 |
+
|
49 |
+
return null;
|
50 |
+
};
|
51 |
+
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Better Search ID for Select2, compatible with WordPress ID from WP_Query
|
55 |
+
*
|
56 |
+
* @param {object|string} e Searched object or the actual ID
|
57 |
+
* @return {string} ID of the object
|
58 |
+
*/
|
59 |
+
obj.search_id = function ( e ) {
|
60 |
+
var id = undefined;
|
61 |
+
|
62 |
+
if ( 'undefined' !== typeof e.id ){
|
63 |
+
id = e.id;
|
64 |
+
} else if ( 'undefined' !== typeof e.ID ){
|
65 |
+
id = e.ID;
|
66 |
+
} else if ( 'undefined' !== typeof e.value ){
|
67 |
+
id = e.value;
|
68 |
+
}
|
69 |
+
return undefined === e ? undefined : id;
|
70 |
+
};
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Better way of matching results
|
74 |
+
*
|
75 |
+
* @param {string} term Which term we are searching for
|
76 |
+
* @param {string} text Search here
|
77 |
+
* @return {boolean}
|
78 |
+
*/
|
79 |
+
obj.matcher = function ( params, data ) {
|
80 |
+
// If there are no search terms, return all of the data
|
81 |
+
if ( $.trim( params.term ) === '') {
|
82 |
+
return data;
|
83 |
+
}
|
84 |
+
|
85 |
+
// Do not display the item if there is no 'text' property
|
86 |
+
if ( typeof data.text === 'undefined' ) {
|
87 |
+
return null;
|
88 |
+
}
|
89 |
+
|
90 |
+
var term = $.trim( params.term );
|
91 |
+
var text = data.text;
|
92 |
+
var $select = $( data.element ).closest( 'select' );
|
93 |
+
var args = $select.data( 'dropdown' );
|
94 |
+
var result = text.toUpperCase().indexOf( term.toUpperCase() ) !== -1;
|
95 |
+
|
96 |
+
if ( ! result && 'undefined' !== typeof args.tags ){
|
97 |
+
var possible = _.where( args.tags, { text: text } );
|
98 |
+
if ( args.tags.length > 0 && _.isObject( possible ) ){
|
99 |
+
var test_value = obj.search_id( possible[0] );
|
100 |
+
result = test_value.toUpperCase().indexOf( term.toUpperCase() ) !== -1;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
return result;
|
105 |
+
};
|
106 |
+
|
107 |
+
/**
|
108 |
+
* If the element used as the basis of a dropdown specifies one or more numeric/text
|
109 |
+
* identifiers in its val attribute, then use those to preselect the appropriate options.
|
110 |
+
*
|
111 |
+
* @param {object} $select
|
112 |
+
* @param {function} make_selection
|
113 |
+
*/
|
114 |
+
obj.init_selection = function( $select, make_selection ) {
|
115 |
+
var isMultiple = $select.is( '[multiple]' );
|
116 |
+
var options = $select.data( 'dropdown' );
|
117 |
+
var isEmpty = $select.data( 'isEmpty' );
|
118 |
+
var currentValues = $select.val().split( options.regexSplit );
|
119 |
+
var selectedItems = [];
|
120 |
+
|
121 |
+
$( currentValues ).each( function( index, value ) {
|
122 |
+
var searchFor = { id: this, text: this };
|
123 |
+
var data = options.ajax ? $select.data( 'options' ) : options.data;
|
124 |
+
var locatedItem = find_item( searchFor, data );
|
125 |
+
|
126 |
+
if ( locatedItem && locatedItem.selected ) {
|
127 |
+
selectedItems.push( locatedItem );
|
128 |
+
}
|
129 |
+
} );
|
130 |
+
|
131 |
+
if ( selectedItems.length && isMultiple ) {
|
132 |
+
make_selection( selectedItems );
|
133 |
+
} else if ( selectedItems.length ) {
|
134 |
+
make_selection( selectedItems[ 0 ] );
|
135 |
+
} else {
|
136 |
+
make_selection( false );
|
137 |
+
return;
|
138 |
+
}
|
139 |
+
};
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Searches array 'haystack' for objects that match 'description'.
|
143 |
+
*
|
144 |
+
* The 'description' object should take the form { id: number, text: string }. The first
|
145 |
+
* object within the haystack that matches one of those two properties will be returned.
|
146 |
+
*
|
147 |
+
* If objects contain an array named 'children', then that array will also be searched.
|
148 |
+
*
|
149 |
+
* @param {Object} description
|
150 |
+
* @param {Array} haystack
|
151 |
+
*
|
152 |
+
* @return {Object|boolean}
|
153 |
+
*/
|
154 |
+
function find_item( description, haystack ) {
|
155 |
+
if ( ! $.isArray( haystack ) ) {
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
|
159 |
+
for ( var index in haystack ) {
|
160 |
+
var possible_match = haystack[ index ];
|
161 |
+
|
162 |
+
if ( possible_match.hasOwnProperty( 'id' ) && possible_match.id == description.id ) {
|
163 |
+
return possible_match;
|
164 |
+
}
|
165 |
+
|
166 |
+
if ( possible_match.hasOwnProperty( 'text' ) && possible_match.text == description.text ) {
|
167 |
+
return possible_match;
|
168 |
+
}
|
169 |
+
|
170 |
+
if ( possible_match.hasOwnProperty( 'children' ) && $.isArray( possible_match.children ) ) {
|
171 |
+
var subsearch = find_item( description, possible_match.children );
|
172 |
+
|
173 |
+
if ( subsearch ) {
|
174 |
+
return subsearch;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
return false;
|
180 |
+
}
|
181 |
+
|
182 |
+
obj.getSelectClasses = function( $select ) {
|
183 |
+
var classesToRemove = [
|
184 |
+
'select2-hidden-accessible',
|
185 |
+
'hide-before-select2-init',
|
186 |
+
];
|
187 |
+
var originalClasses = $select.attr( 'class' ).split( /\s+/ );
|
188 |
+
return _.difference( originalClasses, classesToRemove );
|
189 |
+
};
|
190 |
+
|
191 |
+
obj.element = function( field, args ) {
|
192 |
+
var $select = $( field );
|
193 |
+
var args = $.extend( {}, args );
|
194 |
+
var carryOverData = [
|
195 |
+
'depends',
|
196 |
+
'condition',
|
197 |
+
'conditionNot',
|
198 |
+
'condition-not',
|
199 |
+
'conditionNotEmpty',
|
200 |
+
'condition-not-empty',
|
201 |
+
'conditionEmpty',
|
202 |
+
'condition-empty',
|
203 |
+
'conditionIsNumeric',
|
204 |
+
'condition-is-numeric',
|
205 |
+
'conditionIsNotNumeric',
|
206 |
+
'condition-is-not-numeric',
|
207 |
+
'conditionChecked',
|
208 |
+
'condition-is-checked',
|
209 |
+
];
|
210 |
+
|
211 |
+
var $container;
|
212 |
+
|
213 |
+
// Add a class for dropdown created
|
214 |
+
$select.addClass( obj.selector.created.className() );
|
215 |
+
|
216 |
+
// args.debug = true;
|
217 |
+
|
218 |
+
// For Reference we save the jQuery element as an Arg.
|
219 |
+
args.$select = $select;
|
220 |
+
|
221 |
+
// Auto define the Width of the Select2.
|
222 |
+
args.dropdownAutoWidth = true;
|
223 |
+
args.width = 'resolve';
|
224 |
+
|
225 |
+
// CSS for the container
|
226 |
+
args.containerCss = {};
|
227 |
+
|
228 |
+
// Only apply visibility when it's a Visible Select2.
|
229 |
+
if ( $select.is( ':visible' ) ) {
|
230 |
+
args.containerCss.display = 'inline-block';
|
231 |
+
args.containerCss.position = 'relative';
|
232 |
+
}
|
233 |
+
|
234 |
+
// CSS for the dropdown
|
235 |
+
args.dropdownCss = {};
|
236 |
+
args.dropdownCss.width = 'auto';
|
237 |
+
|
238 |
+
// When we have this we replace the default with what's in the param.
|
239 |
+
if ( $select.is( '[data-dropdown-css-width]' ) ) {
|
240 |
+
args.dropdownCss.width = $select.data( 'dropdown-css-width' );
|
241 |
+
|
242 |
+
if ( ! args.dropdownCss.width || 'false' === args.dropdownCss.width ) {
|
243 |
+
delete args.dropdownCss.width;
|
244 |
+
delete args.containerCss;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
// By default we allow The field to be cleared
|
249 |
+
args.allowClear = true;
|
250 |
+
if ( $select.is( '[data-prevent-clear]' ) ) {
|
251 |
+
args.allowClear = false;
|
252 |
+
}
|
253 |
+
|
254 |
+
// Pass the "Searching..." placeholder if specified
|
255 |
+
if ( $select.is( '[data-searching-placeholder]' ) ) {
|
256 |
+
args.formatSearching = $select.data( 'searching-placeholder' );
|
257 |
+
}
|
258 |
+
|
259 |
+
// If we are dealing with a Input Hidden we need to set the Data for it to work
|
260 |
+
if ( ! $select.is( '[data-placeholder]' ) && $select.is( '[placeholder]' ) ) {
|
261 |
+
args.placeholder = $select.attr( 'placeholder' );
|
262 |
+
}
|
263 |
+
|
264 |
+
// Don't Remove HTML elements or escape elements
|
265 |
+
if ( $select.is( '[data-allow-html]' ) ) {
|
266 |
+
|
267 |
+
}
|
268 |
+
|
269 |
+
// If we are dealing with a Input Hidden we need to set the Data for it to work.
|
270 |
+
if ( $select.is( '[data-options]' ) ) {
|
271 |
+
args.data = $select.data( 'options' );
|
272 |
+
}
|
273 |
+
|
274 |
+
// With less then 10 args we wouldn't show the search.
|
275 |
+
args.minimumResultsForSearch = 10;
|
276 |
+
|
277 |
+
// Prevents the Search box to show
|
278 |
+
if ( $select.is( '[data-hide-search]' ) ) {
|
279 |
+
args.minimumResultsForSearch = Infinity;
|
280 |
+
}
|
281 |
+
|
282 |
+
// Makes sure search shows up.
|
283 |
+
if ( $select.is( '[data-force-search]' ) ) {
|
284 |
+
delete args.minimumResultsForSearch;
|
285 |
+
}
|
286 |
+
|
287 |
+
// Allows freeform entry
|
288 |
+
if ( $select.is( '[data-freeform]' ) ) {
|
289 |
+
args.createTag = obj.freefrom_create_search_choice;
|
290 |
+
args.tags = true;
|
291 |
+
$select.data( 'tags', true );
|
292 |
+
}
|
293 |
+
|
294 |
+
if ( $select.is( '[multiple]' ) ) {
|
295 |
+
args.multiple = true;
|
296 |
+
|
297 |
+
// Set the max select items, if defined
|
298 |
+
if ( $select.is( '[data-maximum-selection-size]' ) ) {
|
299 |
+
args.maximumSelectionSize = $select.data( 'maximum-selection-size' );
|
300 |
+
}
|
301 |
+
|
302 |
+
// If you don't have separator, add one (comma)
|
303 |
+
if ( ! $select.is( 'data-separator' ) ) {
|
304 |
+
$select.data( 'separator', ',' );
|
305 |
+
}
|
306 |
+
|
307 |
+
if ( ! _.isArray( $select.data( 'separator' ) ) ) {
|
308 |
+
args.tokenSeparators = [ $select.data( 'separator' ) ];
|
309 |
+
} else {
|
310 |
+
args.tokenSeparators = $select.data( 'separator' );
|
311 |
+
}
|
312 |
+
args.separator = $select.data( 'separator' );
|
313 |
+
|
314 |
+
// Define the regular Exp based on
|
315 |
+
args.regexSeparatorElements = [ '^(' ];
|
316 |
+
args.regexSplitElements = [ '(?:' ];
|
317 |
+
$.each( args.tokenSeparators, function ( i, token ) {
|
318 |
+
args.regexSeparatorElements.push( '[^' + token + ']+' );
|
319 |
+
args.regexSplitElements.push( '[' + token + ']' );
|
320 |
+
} );
|
321 |
+
args.regexSeparatorElements.push( ')$' );
|
322 |
+
args.regexSplitElements.push( ')' );
|
323 |
+
|
324 |
+
args.regexSeparatorString = args.regexSeparatorElements.join( '' );
|
325 |
+
args.regexSplitString = args.regexSplitElements.join( '' );
|
326 |
+
|
327 |
+
args.regexToken = new RegExp( args.regexSeparatorString, 'ig' );
|
328 |
+
args.regexSplit = new RegExp( args.regexSplitString, 'ig' );
|
329 |
+
}
|
330 |
+
|
331 |
+
// Select also allows Tags, so we go with that too
|
332 |
+
if ( $select.is( '[data-tags]' ) ) {
|
333 |
+
args.tags = $select.data( 'tags' );
|
334 |
+
|
335 |
+
args.createSearchChoice = function( term, data ) {
|
336 |
+
if ( term.match( args.regexToken ) ) {
|
337 |
+
return { id: term, text: term };
|
338 |
+
}
|
339 |
+
};
|
340 |
+
|
341 |
+
if ( 0 === args.tags.length ) {
|
342 |
+
args.formatNoMatches = function() {
|
343 |
+
return $select.attr( 'placeholder' );
|
344 |
+
};
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
// When we have a source, we do an AJAX call
|
349 |
+
if ( $select.is( '[data-source]' ) ) {
|
350 |
+
var source = $select.data( 'source' );
|
351 |
+
|
352 |
+
// For AJAX we reset the data
|
353 |
+
args.data = { results: [] };
|
354 |
+
|
355 |
+
// Allows HTML from Select2 AJAX calls
|
356 |
+
|
357 |
+
|
358 |
+
// Format for Parents breadcrumbs
|
359 |
+
args.formatResult = function ( item, container, query ) {
|
360 |
+
if ( 'undefined' !== typeof item.breadcrumbs ) {
|
361 |
+
return $.merge( item.breadcrumbs, [ item.text ] ).join( ' » ' );
|
362 |
+
}
|
363 |
+
|
364 |
+
return item.text;
|
365 |
+
};
|
366 |
+
|
367 |
+
// instead of writing the function to execute the request we use Select2's convenient helper.
|
368 |
+
args.ajax = {
|
369 |
+
dataType: 'json',
|
370 |
+
type: 'POST',
|
371 |
+
url: obj.ajaxurl(),
|
372 |
+
|
373 |
+
// parse the results into the format expected by Select2.
|
374 |
+
processResults: function ( response, page, query ) {
|
375 |
+
if ( ! $.isPlainObject( response ) || 'undefined' === typeof response.success ) {
|
376 |
+
console.error( 'We received a malformed Object, could not complete the Select2 Search.' );
|
377 |
+
return { results: [] };
|
378 |
+
}
|
379 |
+
|
380 |
+
if (
|
381 |
+
! $.isPlainObject( response.data )
|
382 |
+
|| 'undefined' === typeof response.data.results
|
383 |
+
) {
|
384 |
+
console.error( 'We received a malformed results array, could not complete the Select2 Search.' );
|
385 |
+
return { results: [] };
|
386 |
+
}
|
387 |
+
|
388 |
+
if ( ! response.success ) {
|
389 |
+
if ( 'string' === $.type( response.data.message ) ) {
|
390 |
+
console.error( response.data.message );
|
391 |
+
} else {
|
392 |
+
console.error( 'The Select2 search failed in some way... Verify the source.' );
|
393 |
+
}
|
394 |
+
return { results: [] };
|
395 |
+
}
|
396 |
+
|
397 |
+
return response.data;
|
398 |
+
},
|
399 |
+
};
|
400 |
+
|
401 |
+
// By default only send the source
|
402 |
+
args.ajax.data = function( search, page ) {
|
403 |
+
return {
|
404 |
+
action: 'tribe_dropdown',
|
405 |
+
source: source,
|
406 |
+
search: search,
|
407 |
+
page: page,
|
408 |
+
args: $select.data( 'source-args' ),
|
409 |
+
};
|
410 |
+
};
|
411 |
+
}
|
412 |
+
|
413 |
+
// Save data on Dropdown
|
414 |
+
$select.data( 'dropdown', args );
|
415 |
+
|
416 |
+
$container = $select.select2( args );
|
417 |
+
|
418 |
+
// Propagating original input classes to the select2 container.
|
419 |
+
$container.data( 'select2' ).$container.addClass( obj.getSelectClasses( $select ).join( ' ' ) );
|
420 |
+
|
421 |
+
// Propagating original input classes to the select2 container.
|
422 |
+
$container.data( 'select2' ).$container.removeClass( 'hide-before-select2-init' );
|
423 |
+
|
424 |
+
$container.on( 'select2:open', obj.action_select2_open );
|
425 |
+
|
426 |
+
/**
|
427 |
+
* @todo @bordoni Investigate how and if we should be doing this.
|
428 |
+
*
|
429 |
+
if ( carryOverData.length > 0 ) {
|
430 |
+
carryOverData.map( function( dataKey ) {
|
431 |
+
var attr = 'data-' + dataKey;
|
432 |
+
var val = $select.attr( attr );
|
433 |
+
|
434 |
+
if ( ! val ) {
|
435 |
+
return;
|
436 |
+
}
|
437 |
+
|
438 |
+
this.attr( attr, val );
|
439 |
+
}, $container );
|
440 |
+
}
|
441 |
+
*/
|
442 |
+
};
|
443 |
+
|
444 |
+
obj.ajaxurl = function() {
|
445 |
+
if ( 'undefined' !== typeof window.ajaxurl ) {
|
446 |
+
return window.ajaxurl;
|
447 |
+
}
|
448 |
+
|
449 |
+
if ( 'undefined' !== typeof TEC && 'undefined' !== typeof TEC.ajaxurl ) {
|
450 |
+
return TEC.ajaxurl;
|
451 |
+
}
|
452 |
+
|
453 |
+
console.error( 'Dropdowns framework cannot properly do an AJAX request without the WordPress `ajaxurl` variable setup.' );
|
454 |
+
};
|
455 |
+
|
456 |
+
obj.action_select2_open = function( event ) {
|
457 |
+
var $select = $( this );
|
458 |
+
var args = $select.data( 'dropdown' );
|
459 |
+
var select2Data = $select.data( 'select2' );
|
460 |
+
var $search = select2Data.$dropdown.find( obj.selector.searchField );
|
461 |
+
|
462 |
+
select2Data.$dropdown.addClass( obj.selector.dropdown.className() );
|
463 |
+
|
464 |
+
// If we have a placeholder for search, apply it!
|
465 |
+
if ( $select.is( '[data-search-placeholder]' ) ) {
|
466 |
+
$search.attr( 'placeholder', $select.data( 'searchPlaceholder' ) );
|
467 |
+
}
|
468 |
+
};
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Configure the Drop Down Fields
|
472 |
+
*
|
473 |
+
* @param {jQuery} $fields All the fields from the page
|
474 |
+
* @param {array} args Allow extending the arguments
|
475 |
+
*
|
476 |
+
* @return {jQuery} Affected fields
|
477 |
+
*/
|
478 |
+
obj.dropdown = function( $fields, args ) {
|
479 |
+
var $elements = $fields.not( '.select2-offscreen, .select2-container, ' + obj.selector.created.className() );
|
480 |
+
|
481 |
+
if ( 0 === $elements.length ) {
|
482 |
+
return $elements;
|
483 |
+
}
|
484 |
+
|
485 |
+
// Default args to avoid Undefined
|
486 |
+
if ( ! args ) {
|
487 |
+
args = {};
|
488 |
+
}
|
489 |
+
|
490 |
+
$elements
|
491 |
+
.each( function( index, element ) {
|
492 |
+
// Apply element to all given items and pass args
|
493 |
+
obj.element( element, args );
|
494 |
+
} );
|
495 |
+
|
496 |
+
// return to be able to chain jQuery calls
|
497 |
+
return $elements;
|
498 |
+
};
|
499 |
+
|
500 |
+
$( function() {
|
501 |
+
$( obj.selector.dropdown ).tribe_dropdowns();
|
502 |
+
} );
|
503 |
+
|
504 |
+
// Addresses some problems with Select2 inputs not being initialized when using a browser's "Back" button.
|
505 |
+
$( window ).on( 'unload', function() {
|
506 |
+
$( obj.selector.dropdown ).tribe_dropdowns();
|
507 |
+
});
|
508 |
+
|
509 |
+
} )( jQuery, tribe_dropdowns, window.underscore || window._ );
|
event-tickets.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Event Tickets
|
4 |
Plugin URI: http://m.tri.be/1acb
|
5 |
Description: Event Tickets allows you to sell basic tickets and collect RSVPs from any post, page, or event.
|
6 |
-
Version: 4.12.1.
|
7 |
Author: Modern Tribe, Inc.
|
8 |
Author URI: http://m.tri.be/28
|
9 |
License: GPLv2 or later
|
@@ -74,3 +74,4 @@ if ( tribe_is_not_min_php_version() ) {
|
|
74 |
require_once EVENT_TICKETS_DIR . '/src/Tribe/Main.php';
|
75 |
|
76 |
Tribe__Tickets__Main::instance();
|
|
3 |
Plugin Name: Event Tickets
|
4 |
Plugin URI: http://m.tri.be/1acb
|
5 |
Description: Event Tickets allows you to sell basic tickets and collect RSVPs from any post, page, or event.
|
6 |
+
Version: 4.12.1.2
|
7 |
Author: Modern Tribe, Inc.
|
8 |
Author URI: http://m.tri.be/28
|
9 |
License: GPLv2 or later
|
74 |
require_once EVENT_TICKETS_DIR . '/src/Tribe/Main.php';
|
75 |
|
76 |
Tribe__Tickets__Main::instance();
|
77 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: ModernTribe, brianjessee, camwynsp, paulkim, sc0ttkclark, aguseo,
|
|
4 |
Tags: RSVP, events, tickets, event management, calendar, ticket sales, community, registration, api, dates, date, posts, workshop, conference, meeting, seminar, concert, summit, ticket integration, event ticketing
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.4.1
|
7 |
-
Stable tag: 4.12.1.
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -117,6 +117,10 @@ Currently, the following add-ons are available for Event Tickets:
|
|
117 |
|
118 |
== Changelog ==
|
119 |
|
|
|
|
|
|
|
|
|
120 |
= [4.12.1.1] 2020-05-29 =
|
121 |
|
122 |
* Fix - Resolve PHP notices that can cause the Events to not show tickets or RSVPs. [ET-836]
|
@@ -1167,3 +1171,4 @@ Currently, the following add-ons are available for Event Tickets:
|
|
1167 |
= [4.0] 2015-12-02 =
|
1168 |
|
1169 |
* Initial release
|
|
4 |
Tags: RSVP, events, tickets, event management, calendar, ticket sales, community, registration, api, dates, date, posts, workshop, conference, meeting, seminar, concert, summit, ticket integration, event ticketing
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.4.1
|
7 |
+
Stable tag: 4.12.1.2
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
117 |
|
118 |
== Changelog ==
|
119 |
|
120 |
+
= [4.12.1.2] 2020-06-09 =
|
121 |
+
|
122 |
+
* Security - Remove deprecated usage of escapeMarkup in Select2 (props to miha.jirov for reporting this).
|
123 |
+
|
124 |
= [4.12.1.1] 2020-05-29 =
|
125 |
|
126 |
* Fix - Resolve PHP notices that can cause the Events to not show tickets or RSVPs. [ET-836]
|
1171 |
= [4.0] 2015-12-02 =
|
1172 |
|
1173 |
* Initial release
|
1174 |
+
|
src/Tribe/Main.php
CHANGED
@@ -7,7 +7,7 @@ class Tribe__Tickets__Main {
|
|
7 |
/**
|
8 |
* Current version of this plugin
|
9 |
*/
|
10 |
-
const VERSION = '4.12.1.
|
11 |
|
12 |
/**
|
13 |
* Used to store the version history.
|
7 |
/**
|
8 |
* Current version of this plugin
|
9 |
*/
|
10 |
+
const VERSION = '4.12.1.2';
|
11 |
|
12 |
/**
|
13 |
* Used to store the version history.
|