PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | libraries/wordpress/application.php +23 -3 1.8.7 → 1.8.16 View file →
@@ -722,12 +722,17 @@
722 722 */
723 723 public function printYesNoButtons($name, $label_yes, $label_no, $cur_value = '1', $yes_value = '1', $no_value = '0', $onclick = '', $class_list = [])
724 724 {
725 725 $html = '';
726 - $id_yes = $name . '-on';
727 - $id_no = $name . '-off';
728 726
729 727 /**
728 + * Normalize ID attribute for checkbox.
729 + *
730 + * @since 1.8.8
731 + */
732 + $id_yes = preg_replace("/[^a-z0-9_]+/", '-', $name . '-on');
733 +
734 + /**
730 735 * New toggle button in iOS style.
731 736 *
732 737 * @since 1.3.0
733 738 */
@@ -811,8 +816,14 @@
811 816 * the form containing the input field gets submitted. It should
812 817 * be set to true when the form does not get submitted.
813 818 */
814 819 'fullNumberOnBlur' => false,
820 + /**
821 + * Allow to dispatch an event to transport the selected country data.
822 + *
823 + * @since 1.18.8 (J) - 1.8.8 (WP)
824 + */
825 + 'countryDataEvent' => null,
815 826 );
816 827
817 828 // merge config object with user's specified properties
818 829 $final_opts = array_merge($default_opts, $opts);
@@ -818,10 +829,13 @@
818 829 $final_opts = array_merge($default_opts, $opts);
819 830 $data = json_encode($final_opts);
820 831
821 832 // apply set full number on blur
822 - $full_number_on_blur = (int)$final_opts['fullNumberOnBlur'];
833 + $full_number_on_blur = (int) $final_opts['fullNumberOnBlur'];
823 834
835 + // check if an event should be dispatched with the selected country data
836 + $countryDataEvent = $final_opts['countryDataEvent'] ? json_encode($final_opts['countryDataEvent']) : 0;
837 +
824 838 $document = JFactory::getDocument();
825 839
826 840 if ($load_assets) {
827 841 $document->addStyleSheet(VBO_SITE_URI . 'resources/intlTelInput.css');
@@ -840,8 +854,14 @@
840 854 if ($full_number_on_blur) {
841 855 jQuery('#$selector').val(cur_phone);
842 856 } else {
843 857 jQuery('#$selector').intlTelInput('setNumber', cur_phone);
858 + }
859 + if ($countryDataEvent && typeof VBOCore !== 'undefined') {
860 + let countryData = jQuery('#$selector').intlTelInput('getSelectedCountryData');
861 + if (countryData && countryData?.iso2) {
862 + VBOCore.emitEvent($countryDataEvent, countryData);
863 + }
844 864 }
845 865 });
846 866 jQuery('#$selector').closest('form').on('submit', function() {
847 867 // always make sure the input field contains the complete phone number