���� JFIF    �� �        "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777��  { �" ��     �� 5    !1AQa"q�2��BR��#b�������  ��  ��   ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Ə��ܯsO"B�c>; �e�4��5�k��/CB��.  �J?��;�҈�������������������~�<�VZ�ꭼ2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m���)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��modskinlienminh.com - WSOX ENC readme.txt000064400000054635146730610170006564 0ustar00=== Elementor Header & Footer Builder === Contributors: brainstormforce, Nikschavan Tags: elementor, header footer builder, header template, footer template, elementor widget, WordPress header, WordPress footer, elementor menu, website header design, footer design, blocks Donate link: https://www.paypal.me/BrainstormForce Requires at least: 4.4 Requires PHP: 5.4 Tested up to: 6.5 Stable tag: 1.6.28 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Create Header, Footer and Blocks for your WordPress website using Elementor Page Builder for free. ## Description ## Have you ever imagined you could create your website header and footer with Elementor for FREE? Elementor Header & Footer Builder is a simple yet powerful WordPress plugin that allows you to create a layout with Elementor and set it as - Header - Footer - Block (anywhere on the website) [Try it out on a free dummy site](https://bsf.io/hfe-demo) = Create Attractive Designs = Elementor editor gives you the flexibility to design beautiful sections. Using it you can create out of the box header and footer designs. = Pick Display Locations = Want to display a custom header template only on the homepage or on the blog archive page or on the entire website? Well, this plugin allows choosing a specific target location to display header and footer on. = Add Elementor Blocks Anywhere = Apart from header and footer, you can design custom templates with Elementor and set it at any place on the website with a shortcode. = ‘Before Footer’ Template = Along with the main footer, the plugin gives the additional area - above the footer - where you can append your custom template. This gives great flexibility in footer design. = Available With Elementor Canvas Template = Your custom header/footer layout can be easily displayed on the pages where Elementor Canvas Template is enabled. = Comes With Inbuilt Widgets = The plugin offers inbuilt widgets that help to create header/footer layouts. These widgets offer basic required features so you don’t have to look for extra plugins. = WORKS WITH ALL THEMES = Elementor Header & Footer Builder plugin works with all WordPress themes. Few of the themes have direct support while for few you can choose a method to add theme support. In case you face any difficulty displaying header/footer, manually choose the theme support method. Visit Appearance > Elementor Header & Footer Builder > Theme Support. Select a method to suit your current theme and you are good to go! = STEPS TO USE THE PLUGIN = Step 1 - Visit Appearance > Elementor Header & Footer Builder and click on the ‘Add New’. Step 2 - Select ‘Type of Template’ (header/footer/block). Set its display location and user roles. Step 3 - Publish it. Step 4 - Edit it with Elementor and design a section. Step 5 - Save it and you are done! You can refer to our step-by-step article that will help you [set Elementor headers and footers](https://ultimateelementor.com/header-footer-with-elementor/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description) quickly. = LOOKING FOR PREMIUM ELEMENTOR ADDONS AND WIDGETS? = Check [Ultimate Addons for Elementor](https://ultimateelementor.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description). It is a library of creative and unique Elementor widgets that add more functionality and flexibility to your favorite page builder. = HAVE YOU TRIED ASTRA WITH ELEMENTOR? = Powering over 1+ Million WordPress websites, Astra is loved for the performance and ease-of-use it offers. People love Astra for - **Better Performance** - Optimized code and modular architecture make Astra the most lightweight theme for a faster loading website! **Page Builder's Best Friend** - Astra works great with all page builders. Its support for custom layouts, Elementor templates, and ready-made starter sites makes it the best [theme for Elementor](https://wpastra.com/theme-for-elementor/?utm_source=wp-repo&utm_medium=astra_desc&utm_campaign=header_footer_elementor). **Ready-to-use complete website templates** - Astra offers free ready-made website demos built with Elementor. You can choose any of the [Elementor Templates](https://wpastra.com/elementor-templates-free-downloads/ "Elementor Templates"), tweak them as you want and go live in minutes! = SUPPORTED & ACTIVELY DEVELOPED = Need help with something? Have an issue to report? Visit [Plugin’s Forum](https://wordpress.org/plugins/header-footer-elementor/ "Plugin’s Forum"). [Get in touch](https://github.com/Nikschavan/header-footer-elementor "Elementor Header & Footer Builder on GitHub") with us on GitHub. Made with love at [Brainstorm Force](https://www.brainstormforce.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description "Brainstorm Force")! == Installation == 1. Go to `Plugins -> Add New` and search for Elementor Header & Footer Builder. 2. Activate the plugin through the 'Plugins' screen in WordPress. 3. Go to `Appearance -> Elementor Header & Footer Builder` to build a header or footer layout using Elementor. 4. After the layout is ready assign it as header or footer using the option `Select the type of template this is` (screenshot) == Frequently Asked Questions == = How Does This Plugin Work? = 1. Go to Appearance -> Elementor Header & Footer Builder to build a header or footer layout using Elementor. 2. Click on “Add New” and design a template with Elementor. 3. Once the template is ready, set is as a header/footer/block using options “Type of Template” (screenshot). 4. a) For Header/Footer - Select the target location with the option “Display On”. With this Header/Footer will be visible only on selected locations for selected “User Roles”. b) For Custom Block - Just copy the shortcode and add it anywhere on the website. Your designed template will display automatically. Display conditions or user roles will not be effective with shortcodes. = Can You Create a Mobile Responsive Header/Footer Using This Plugin? = Yes, You can create the mobile responsive layout of your header using the plugin. The Elementor Header & Footer Builder plugin just gives you a container where you can completely design the header using Elementor Page Builder, So the process of creating the mobile responsive layout is exactly the same as you would create a responsive layout of your other Elementor page. Here is a documentation by Elementor Page builder which explains how you can create mobile responsive layouts using Elementor - [https://elementor.com/introducing-mobile-editing/](https://elementor.com/introducing-mobile-editing/) This same applies when you are creating your Header/Footer using this plugin. == Screenshots == 1. Go to Appearance -> Elementor Header & Footer Builder to create a new template. 2. Assign template to be a header/footer and select display rules. 3. 3. For blocks, select the type of template as Custom Blocks. You can copy the shortcode and use it anywhere. 4. Methods to add Theme Support. 5. Default widgets available with Elementor Header & Footer Builder. == Changelog == = 1.6.28 = - Fix: Error messages appearing for Display rules. = 1.6.27 = - Improvement: Compatibility with latest Elementor and Elementor Pro 3.21 version. - Improvement: Compatibility with PHP 8.3 version. - Fix: This update addressed a security bug. Props to Wordfence. = 1.6.26 = - Improvement: Compatibility with latest Elementor and Elementor Pro 3.20 version. - Improvement: Compatibility with PHP 8.2 version. = 1.6.25 = - Security Fix: Hardened the security of the plugin. Props: Wordfence. - Fix: Automatic translation support for templates on Specific Pages / Posts / Taxonomies, etc. - Fix: Navigation Menu - Multistep submenu fails to display when a border radius is applied to dropdown. = 1.6.24 = - Improvement: Compatibility with latest Elementor and Elementor Pro 3.19 version. - Fix: White Label - Astra's theme name does not change when Astra is white-labeled. - Fix: Navigation Menu - Language switcher flags not displaying when using Polylang plugin. = 1.6.23 = - Fix: This update addressed a security bug. Props to WordPress Plugin Review Team and Plugin Vulnerabilities Team for reporting it to our team. Please make sure you are using the latest version on your website. = 1.6.22 = - Fix: Retina Image - Navigating to custom URL by clicking on images. = 1.6.21 = - Fix: Site Logo - Width and height settings not applying to the logo. = 1.6.20 = - Fix: Flyout menu not appearing correctly. = 1.6.19 = - Fix: Header and Footer layout broken after last update. = 1.6.18 = - Improvement: Compatibility with latest Elementor and Elementor Pro 3.18 version. - Improvement: Compatibility with WordPress VIP Go rules. = 1.6.17 = - Improvement: Compatibility with latest Elementor and Elementor Pro 3.17 version. - Fix: Site Logo - Added an alt text for the default logo. = 1.6.16 = - Compatibility with latest Elementor and Elementor Pro 3.16 version. - Compatibility with PHP 8.1 version. = 1.6.15 = - Improvement: Compatibility with latest Elementor and Elementor Pro 3.15 version. - Improvement: Added WPML support. - Fix: Navigation Menu - HTML validation error on mobile layout related to tabindex inside elements with attribute [role="button"]. - Fix: Polylang plugin language causes conflicts when set up with a custom Header Footer. - Fix: Site Logo - Align icons not rendering in Elementor editor settings. = 1.6.14 = - Improvement: Compatibility with Elementor version 3.13 and Elementor Pro version 3.13 - Fix: Navigation Menu - Accessibility error corrected for [aria-hidden="true"] attribute. = 1.6.13 = - Compatibility with Elementor version 3.7.2 and Elementor Pro version 3.7.3. = 1.6.12 = - Compatibility with Elementor and Elementor Pro. = 1.6.11 = - Improvement: Compatibility with Elementor Pro version 3.7 - Fix: Removed meta tag attribute [maximum-scale=1] for a better accessibility. = 1.6.10 = - Improvement: Compatibility with Elementor version 3.6. Removed elementor deprecated functions and replaced with latest functions. Now to work with Elementor Header & Footer Builder, Elementor minimum version 3.5.0 or higher will be required. = 1.6.9 = - Improvement: Compatibility with Elementor Pro version 3.6 - Fix: Navigation Menu - If Polylang language switcher is present in the menu, it closes the menu with a click. = 1.6.8 = - Improvement: WordPress 5.9 compatibility. = 1.6.7 = - Improvement: Added GDPR support to Subscription form. = 1.6.6 = - Improvement: Added compatibility to Elementor core version 3.5.0. Now to work with EHF, Elementor minimum version 3.1.0 or higher will be required. - Fix: PHP warning of undefined array key on responsive controls in all widgets. = 1.6.5 = - Fix: Hide empty cart count badge hiding even when cart is not empty. = 1.6.4 = - Improvement: Elementor 3.4 compatibility. = 1.6.3 = - Improvement: WordPress 5.8 compatibility. - Improvement: Elementor 3.3 compatibility. = 1.6.2 = - Improvement: Copyright - Added custom link attributes support. - Improvement: Page Title - Added custom link attributes support. - Improvement: Retina Image - Added custom link attributes support. - Improvement: Search - Added gradient color support to the search button. - Improvement: Site Logo - Added custom link attributes support. - Improvement: Site Title - Added custom link attributes support. - Fix: Templates views section not displaying correctly and related code conflicting with Yoast SEO plugin. - Fix: Widgets icon color issue with Elementor's dark mode. = 1.6.1 = - Fix: Footer misplaced in the header or content area due to a bug introduced in v1.6.0. = 1.6.0 = - New: Added Email Subscription and About Us section on the settings page. - New: Renamed the plugin to Elementor Header & Footer Builder. - Improvement: Added an option to hide + & - sign added by Twenty Twenty-One Theme. - Fix: Navigation Menu - Border for dropdown is also applying to the menu trigger icon. - Fix: Navigation Menu - Fix top distance option for dropdown adding a top-margin to sub-menu. - Fix: Navigation Menu - Fixed active color issues in case of full-page anchor links used in nav links. - Fix: Navigation Menu - Navigation schema not working. = 1.5.9 = - Improvement: Added notice to update Elementor to v3.0.0 or higher Elementor has deprecated few functions and namespaces with its v3.0.0. Following Elementor, our plugin too deprecates similar functions and namespaces. You will now require the Elementor v3.0.0 or higher. - Improvement: Elementor 3.2 Compatibility - Added Elementor Global Color and Typography scheme support. - Fix: Navigation Menu - Last menu item button disappearing while switching from mobile to desktop. - Fix: Navigation Menu - Last menu item button alignment not working in RTL view. = 1.5.8 = - Fix: Hardened allowed options in the editor to enforce better security policies. = 1.5.7 = - Improvement: Compatibility with Elementor v3.1. - Fix: Navigation Menu - Undefined index notice when menu is not set. = 1.5.6 = - Fix: Buttons showing cart subtotal. = 1.5.5 = - Improvement: Compatibility with Elementor v3.1. - Improvement: Cart - Added Items Count hover color options. - Fix: jQuery shorthand deprecation warning for click() and focus() functions. - Fix: Cart - Fixed fatal error due to cart initialization. = 1.5.4 = - Improvement: Compatibility to PHP v8.0. - Improvement: Improved compatibility with Astra theme. - Improvement: Navigation Menu - Added option to toggle menu item. - Fix: Added 'alt' attribute to the widgets containing images. - Fix: Closed the missing HTML tag in footer in the global theme compatibility. - Fix: Navigation Menu - Alignment option not working for the last menu item set as 'Button'. = 1.5.3 = - Fix: Polylang plugin conflicting issue with target rules. - Fix: Navigation Menu - Double link attributes issue with translation plugins. = 1.5.2 = - Improvement: Compatibility with Polylang. - Improvement: Navigation Menu - Added 'SiteNavigationElement' schema support. - Improvement: Navigation Menu - Added support to SVG for toggle and close icon. - Improvement: Navigation Menu - Added active color support to the link hover effects. - Improvement: Page Title - Added option to disable the link. - Fix: Exclude EHF templates from query for target rules - Specific Pages / Posts / taxonomies etc. - Fix: Cart - Missing wrapper class in the control selector. - Fix: Navigation Menu - Added responsive support to flyout box width. = 1.5.1 = - Fix: Retained GeneratePress theme's after header while using EHF header. - Fix: Target rule 'Specific Pages/Posts/Taxonomies etc' not working. - Fix: Cart - Error in some cases. = 1.5.0 = - New: Search widget. - New: Users can now share non-personal usage data to help us test and develop better products. ( Know More ) - Improvement: UI improvements. - Improvement: Navigation Menu - Added active color for dropdown and current menu parent. - Improvement: Navigation Menu - Changed the tablet breakpoint to 1024 in order to support iPad Pro. - Fix: Compatibility to PHP v7.4. - Fix: GeneratePress theme header now overriden by EHF. - Fix: Cart - Count not increasing with AJAX call. - Fix: Page Title - Added support for archive title. - Fix: Site Title - Custom URL not working. = 1.4.1 = - Fix: EHF header overlapping Astra WooCommerce Off-Canvas. - Fix: WooCommerce Menu Cart - 'div' tag of custom cart layout was not closed. - Fix: WooCommerce Menu Cart - Fatal error with count when cart is empty. = 1.4.0 = - New: WooCommerce Menu Cart widget. - Improvement: Compatibility to Elementor Pro v2.9 full site editing. - Improvement: In-built support to Hello Elementor theme. - Improvement: WPML support to before footer template. - Improvement: Navigation Menu - Added option to convert last item into CTA. = 1.3.1 = - Fix: Copyright - Link with open in new tab not working. - Fix: Navigation Menu - Hamburger menu click not working on responsive devices. - Deprecated: Removed the theme dependency for the plugin, so removed the associated notice. = 1.3.0 = - New: Added 'Site Logo' widget. - New: Added 'Site Title' widget. - New: Added 'Site Tagline' widget. - New: Added 'Navigation Menu' widget. - New: Added 'Page Title' widget. - Improvement: Elementor v2.9 compatibility. = 1.2.2 = - Fix: Add default fallback theme support after checking if current theme does not add it. = 1.2.1 = - Categorize the Elementor widgets in a separate category in the Elementor window. - Hide target rules options when a custom block template is selected. = 1.2.0 = - New: Support all the themes, Includes two separate fallback methods so that you can create custom headers and footers for any theme. - New: Added target rule engine, which allows you to have different headers/footers for different pages. - New: Added Retina Image Elementor widget, which can be used as a Site Logo. - New: Added Copyright widget and Shortcode for current year & site title. - Improvement: Allow before footer to work on Elementor Canvas Template when not using Astra Theme. - Improvement: Added support of `Before Footer` action for all the themes. = 1.1.4 = - Fix: Flush permalinks on plugin update to Elementor error when trying to edit the Header/Footer. = 1.1.3 = - Improvement: Allow changing the permalinks for the hfe templates (#162) - Fix: WPML Translations do not work when using the Elementor Template as a shortcode. (#159) - Fix: Page content appears over the header. (#150) - Fix: Remove the deprecated function warning for shortcode functions. (Props @hogash #145) = 1.1.2 = - Fix: Depracated function warning from Elementor's method `\Elementor\Post_CSS_File` = 1.1.1 = - Fix: Blank header being displayed when only footer is translated using WPML. = 1.1.0 = - New: Rename plugin to be Header Footer & Blocks builder as now the blocks templates can be used as shortcodes. - New: Add templates before the footer for Astra Theme. Options for other themes will be coming soon. - New: Use templates (Blocks) anywhere in your content with the help of shortcodes. - Improvement: Improved the UI of the metabox for Header Footer post type. = 1.0.16 = - Fix: Make the theme not supported notice dismissable. - Fix: Use specific selector when adding z-index for the header. = 1.0.15 = - Fix: Default Header being displayed for Generatepress and Gensis theme after v1.0.14. = 1.0.14 = - Fix: Fixes possible PHP notices/Errors due to WP_Query being called early for all the supported themes. = 1.0.13 = - Fix: PHP Notices and errors due to WP_Query being called early when some plugins use filters inside WP_Query. = 1.0.12 = - Fix: Compatibility with Elementor 2.0 changed canvas template path. = 1.0.11 = - Load the CSS footer early in the page to avoid slow rendering of CSS. - Change the schema.org links to be https. - Fix: Added correct schema markup for the footer. = 1.0.10 = - Load the header layout correctly in the in Elementor canvas template. - Load the Elementor Pro CSS/JS files in . - Provide more filters for the helper functions. = 1.0.9 = - Add Support for WPML. - Updated the missing strings from the translations template. = 1.0.8 = - Allow filters to override the WP_Query parameters when retreiving the Header / Footer template id. = 1.0.7 = - Fix: Dismissable notice not actually dismissing. = 1.0.6 = - New: Option to display the header/footer on the pages using Elementor Canvas Template. = 1.0.5 = - Fix: Correctly check if Elementor actually is active before using its methods. This fixes errors for sites using older versions of PHP where Elementor does not actually get activated. = 1.0.4 = - Improvement: Use Elementor's created instance when rendering the markup for header/footer - Credits itay9001 = 1.0.3 = - Fix: Adding theme support for the plugin does not remove the "no supported" notice. = 1.0.2 = - New: Added support for the OceanWP Theme. - Fix: Load the Elementor header assets correctly in the header. This fixes header looking different just when loading the page as previously Elementor would load its CSS in the footer. - Introduced helper functions for rendering and checking the headers to make it simpler to integrate HFE with more themes. = 1.0.1 = - New: Added support for the Astra WordPress theme - The Fastest, Most Lightweight & Customizable WordPress Theme. * Moved the menu under Appearance -> Header Footer Builder. * Fix: Header content getting hidden behind tha page content. * Use Elemenntor's canvas template when designing header and footer layout to have full width experience. = 1.0.0 = * Initial Release. inc/js/frontend.js000064400000066146146730610170010130 0ustar00( function( $ ) { /** * Search widget JS */ var WidgethfeSearchButton = function( $scope, $ ){ if ( 'undefined' == typeof $scope ) return; var $input = $scope.find( "input.hfe-search-form__input" ); var $clear = $scope.find( "button#clear" ); var $clear_with_button = $scope.find( "button#clear-with-button" ); var $search_button = $scope.find( ".hfe-search-submit" ); var $toggle_search = $scope.find( ".hfe-search-icon-toggle input" ); $scope.find( '.hfe-search-icon-toggle' ).on( 'click', function( ){ $scope.find( ".hfe-search-form__input" ).trigger( 'focus' ); }); $scope.find( ".hfe-search-form__input" ).on( 'focus', function(){ $scope.find( ".hfe-search-button-wrapper" ).addClass( "hfe-input-focus" ); }); $scope.find( ".hfe-search-form__input" ).blur( function() { $scope.find( ".hfe-search-button-wrapper" ).removeClass( "hfe-input-focus" ); }); $search_button.on( 'touchstart click', function(){ $input.submit(); }); $toggle_search.css( 'padding-right', $toggle_search.next().outerWidth() + 'px' ); $input.on( 'keyup', function(){ $clear.style = (this.value.length) ? $clear.css('visibility','visible'): $clear.css('visibility','hidden'); $clear_with_button.style = (this.value.length) ? $clear_with_button.css('visibility','visible'): $clear_with_button.css('visibility','hidden'); $clear_with_button.css( 'right', $search_button.outerWidth() + 'px' ); }); $clear.on("click",function(){ this.style = $clear.css('visibility','hidden'); $input.value = ""; }); $clear_with_button.on("click",function(){ this.style = $clear_with_button.css('visibility','hidden'); $input.value = ""; }); }; /** * Nav Menu handler Function. * */ var WidgethfeNavMenuHandler = function( $scope, $ ) { if ( 'undefined' == typeof $scope ) return; var id = $scope.data( 'id' ); var wrapper = $scope.find('.elementor-widget-hfe-nav-menu '); var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); var flyout_data = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'flyout-class' ); var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' ); var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' ); var menu_items_links = $( '.elementor-element-' + id + ' .hfe-nav-menu nav li a' ); var menu_items_links_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper li a' ); if (menu_items_links.length > 0) { _handle_current_menu_item_class( menu_items_links ); } if (menu_items_links_flyout.length > 0) { _handle_current_menu_item_class( menu_items_links_flyout ); } $( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); _toggleClick( id ); _handlePolylangSwitcher( $scope ); _handleSinglePageMenu( id, layout ); if( 'horizontal' !== layout ){ _eventClick( id ); }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) { _eventClick( id ); }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { _eventClick( id ); } $( '.elementor-element-' + id + ' .hfe-flyout-trigger .hfe-nav-menu-icon' ).off( 'click keyup' ).on( 'click keyup', function() { _openMenu( id ); } ); $( '.elementor-element-' + id + ' .hfe-flyout-close' ).off( 'click keyup' ).on( 'click keyup', function() { _closeMenu( id ); } ); $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).off( 'click' ).on( 'click', function() { _closeMenu( id ); } ); $scope.find( '.sub-menu' ).each( function() { var parent = $( this ).closest( '.menu-item' ); $scope.find( parent ).addClass( 'parent-has-child' ); $scope.find( parent ).removeClass( 'parent-has-no-child' ); }); if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); } _borderClass( id ); $( window ).on( 'resize', function(){ if( 'horizontal' !== layout ) { _eventClick( id ); }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) { _eventClick( id ); }else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { _eventClick( id ); } if( 'horizontal' == layout && window.matchMedia( "( min-width: 977px )" ).matches){ $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).next().css( 'position', 'absolute'); } if( 'expandible' == layout || 'flyout' == layout ){ _toggleClick( id ); }else if ( 'vertical' == layout || 'horizontal' == layout ) { if( window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))){ _toggleClick( id ); }else if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { _toggleClick( id ); } } _borderClass( id ); }); // Acessibility functions $scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-haspopup', 'true' ); $scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-expanded', 'false' ); var hef_navmenu_toggle = $scope.find( '.hfe-nav-menu__toggle' ); hef_navmenu_toggle.attr( 'aria-haspopup', 'true' ); hef_navmenu_toggle.attr( 'aria-expanded', 'false' ); if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { hef_navmenu_toggle.find('i').attr('aria-hidden', 'false'); } if ( window.matchMedia( "( max-width: 768px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') ) { hef_navmenu_toggle.find('i').attr('aria-hidden', 'false'); } // End of accessibility functions $( document ).trigger( 'hfe_nav_menu_init', id ); $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).on( 'keyup', function(e){ var $this = $( this ); if( $this.parent().hasClass( 'menu-active' ) ) { $this.parent().removeClass( 'menu-active' ); $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); }else { $this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); $this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); $this.parent().siblings().find( '.hfe-has-submenu-container a' ).attr( 'aria-expanded', 'false' ); $this.parent().next().removeClass( 'menu-active' ); $this.parent().prev().removeClass( 'menu-active' ); event.preventDefault(); $this.parent().addClass( 'menu-active' ); if( 'horizontal' !== layout ){ $this.addClass( 'sub-menu-active' ); } $this.find( 'a' ).attr( 'aria-expanded', 'true' ); $this.next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); if ( 'horizontal' !== layout ) { $this.next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { $this.next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { $this.next().css( 'position', 'relative'); } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { $this.next().css( 'position', 'absolute'); } } } }); $( '.elementor-element-' + id + ' li.menu-item' ).on( 'keyup', function(e){ var $this = $( this ); $this.next().find( 'a' ).attr( 'aria-expanded', 'false' ); $this.prev().find( 'a' ).attr( 'aria-expanded', 'false' ); $this.next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.siblings().removeClass( 'menu-active' ); $this.next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); $this.prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' ); }); }; function _handle_current_menu_item_class( layout_links ) { layout_links.each( function () { var $this = $( this ); if ($this.is( '[href*="#"]' )) { var menu_item_parent = $this.parent(); menu_item_parent.removeClass( 'current-menu-item current-menu-ancestor' ); $this.click( function () { var current_index = menu_item_parent.index(), parent_element = $this.closest( 'ul' ); parent_element.find( 'li' ).not( ':eq(' + current_index + ')' ).removeClass( 'current-menu-item current-menu-ancestor' ); menu_item_parent.addClass( 'current-menu-item current-menu-ancestor' ); } ) } } ); } function _openMenu( id ) { var flyout_content = $( '#hfe-flyout-content-id-' + id ); var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); var wrap_width = flyout_content.width() + 'px'; var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeIn( 100 ); if( 'left' == layout ) { $( 'body' ).css( 'margin-left' , '0' ); container.css( 'left', '0' ); if( 'push' == layout_type ) { $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ position: 'absolute', width: '100%', 'margin-left' : wrap_width, 'margin-right' : 'auto' }); } container.addClass( 'hfe-flyout-show' ); } else { $( 'body' ).css( 'margin-right', '0' ); container.css( 'right', '0' ); if( 'push' == layout_type ) { $( 'body' ).addClass( 'hfe-flyout-animating' ).css({ position: 'absolute', width: '100%', 'margin-left' : '-' + wrap_width, 'margin-right' : 'auto', }); } container.addClass( 'hfe-flyout-show' ); } } function _closeMenu( id ) { var flyout_content = $( '#hfe-flyout-content-id-' + id ); var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' ); var wrap_width = flyout_content.width() + 'px'; var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' ); var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout ); $( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeOut( 100 ); if( 'left' == layout ) { container.css( 'left', '-' + wrap_width ); if( 'push' == layout_type ) { $( 'body' ).css({ position: '', 'margin-left' : '', 'margin-right' : '', }); setTimeout( function() { $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ width: '', }); }); } container.removeClass( 'hfe-flyout-show' ); } else { container.css( 'right', '-' + wrap_width ); if( 'push' == layout_type ) { $( 'body' ).css({ position: '', 'margin-right' : '', 'margin-left' : '', }); setTimeout( function() { $( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ width: '', }); }); } container.removeClass( 'hfe-flyout-show' ); } } function _eventClick( id ){ var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); $( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).off( 'click' ).on( 'click', function( event ) { var $this = $( this ); if( $( '.elementor-element-' + id ).hasClass( 'hfe-link-redirect-child' ) ) { if( $this.hasClass( 'sub-menu-active' ) ) { if( ! $this.next().hasClass( 'sub-menu-open' ) ) { $this.find( 'a' ).attr( 'aria-expanded', 'false' ); if( 'horizontal' !== layout ){ event.preventDefault(); $this.next().css( 'position', 'relative' ); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { event.preventDefault(); $this.next().css( 'position', 'relative' ); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches && ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { event.preventDefault(); $this.next().css( 'position', 'relative' ); } $this.removeClass( 'sub-menu-active' ); $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); } else{ $this.find( 'a' ).attr( 'aria-expanded', 'false' ); $this.removeClass( 'sub-menu-active' ); $this.nextAll('.sub-menu').removeClass( 'sub-menu-open' ); $this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); $this.nextAll('.sub-menu').css( { 'transition': 'none'} ); if ( 'horizontal' !== layout ){ $this.next().css( 'position', 'relative' ); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { $this.next().css( 'position', 'relative' ); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches && ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { $this.next().css( 'position', 'absolute' ); } } } else { $this.find( 'a' ).attr( 'aria-expanded', 'true' ); if ( 'horizontal' !== layout ) { event.preventDefault(); $this.next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { event.preventDefault(); $this.next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { event.preventDefault(); if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { $this.next().css( 'position', 'relative'); } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { $this.next().css( 'position', 'absolute'); } } $this.addClass( 'sub-menu-active' ); $this.nextAll('.sub-menu').addClass( 'sub-menu-open' ); $this.nextAll('.sub-menu').css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); $this.nextAll('.sub-menu').css( { 'transition': '0.3s ease'} ); } } }); $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).off( 'click keyup' ).on( 'click keyup',function( event ) { var $this = $( this ); if( $this.parent().parent().hasClass( 'menu-active' ) ) { event.preventDefault(); $this.parent().parent().removeClass( 'menu-active' ); $this.parent().parent().next().css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } ); if ( 'horizontal' !== layout ) { $this.parent().parent().next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { $this.parent().parent().next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { $this.parent().parent().next().css( 'position', 'relative'); } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { $this.parent().parent().next().css( 'position', 'absolute'); } } }else { event.preventDefault(); $this.parent().parent().addClass( 'menu-active' ); $this.parent().parent().next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } ); if ( 'horizontal' !== layout ) { $this.parent().parent().next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) { $this.parent().parent().next().css( 'position', 'relative'); } else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) { if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { $this.parent().parent().next().css( 'position', 'relative'); } else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) { $this.parent().parent().next().css( 'position', 'absolute'); } } } }); } function _borderClass( id ){ var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' ); var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' ); var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); if ( window.matchMedia( "( max-width: 767px )" ).matches ) { if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet')){ $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' ); $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); } }else{ $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); } } }else if ( window.matchMedia( "( max-width: 1024px )" ).matches ) { if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) { $( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown'); if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' ); $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); } }else{ $( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown'); if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); } } }else { var $parent_element = $( '.elementor-element-' + id ); $parent_element.find( 'nav').removeClass( 'hfe-dropdown' ); if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' ); $parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' ); } } var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); if( 'expandible' == layout ){ if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){ $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' ); $( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' ); } } } function _toggleClick( id ){ if ( $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).hasClass( 'hfe-active-menu-full-width' ) ){ $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().css( 'left', '0' ); var width = $( '.elementor-element-' + id ).closest('.elementor-section').outerWidth(); var sec_pos = $( '.elementor-element-' + id ).closest('.elementor-section').offset().left - $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().offset().left; $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().css( 'width', width + 'px' ); $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).next().css( 'left', sec_pos + 'px' ); } $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).off( 'click keyup' ).on( 'click keyup', function( event ) { var $this = $( this ); var $selector = $this.next(); if ( $this.hasClass( 'hfe-active-menu' ) ) { var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); var full_width = $selector.data( 'full-width' ); var toggle_icon = $( '.elementor-element-' + id + ' nav' ).data( 'toggle-icon' ); $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( toggle_icon ); $this.removeClass( 'hfe-active-menu' ); $this.attr( 'aria-expanded', 'false' ); if ( 'yes' == full_width ){ $this.removeClass( 'hfe-active-menu-full-width' ); $selector.css( 'width', 'auto' ); $selector.css( 'left', '0' ); $selector.css( 'z-index', '0' ); } } else { var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' ); var full_width = $selector.data( 'full-width' ); var close_icon = $( '.elementor-element-' + id + ' nav' ).data( 'close-icon' ); $( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( close_icon ); $this.addClass( 'hfe-active-menu' ); $this.attr( 'aria-expanded', 'true' ); if ( 'yes' == full_width ){ $this.addClass( 'hfe-active-menu-full-width' ); var width = $( '.elementor-element-' + id ).closest('.elementor-section').outerWidth(); var sec_pos = $( '.elementor-element-' + id ).closest('.elementor-section').offset().left - $selector.offset().left; $selector.css( 'width', width + 'px' ); $selector.css( 'left', sec_pos + 'px' ); $selector.css( 'z-index', '9999' ); } } if( $( '.elementor-element-' + id + ' nav' ).hasClass( 'menu-is-active' ) ) { $( '.elementor-element-' + id + ' nav' ).removeClass( 'menu-is-active' ); }else { $( '.elementor-element-' + id + ' nav' ).addClass( 'menu-is-active' ); } } ); } function _handleSinglePageMenu( id, layout ) { $( '.elementor-element-' + id + ' ul.hfe-nav-menu li a' ).on( 'click', function () { var $this = $( this ); var link = $this.attr( 'href' ); var linkValue = ''; if ( link.includes( '#' ) ) { var index = link.indexOf( '#' ); linkValue = link.slice( index + 1 ); } if ( linkValue.length > 0 ) { if ( 'expandible' == layout ) { $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" ); if ($this.hasClass( 'hfe-sub-menu-item' )) { $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); } } else { if ( window.matchMedia( '(max-width: 1024px)' ).matches && ( 'horizontal' == layout || 'vertical' == layout ) ) { $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" ); if ($this.hasClass( 'hfe-sub-menu-item' )) { $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); } } else { if ($this.hasClass( 'hfe-sub-menu-item' )) { _closeMenu( id ); $( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" ); } _closeMenu( id ); } } } } ); } /** * This function handles polylang plugin's lang switcher if present in the menu. * * @param {Object} $scope The current element(hfe nav menu) wrapped with jQuery. */ function _handlePolylangSwitcher( $scope ) { var polylangSwitcher = $scope.find( '.hfe-nav-menu nav .pll-parent-menu-item a.hfe-menu-item' ); var hrefProperty = polylangSwitcher.prop( 'href' ); if ( undefined !== hrefProperty && hrefProperty.includes( '#' ) ) { var index = hrefProperty.indexOf( '#' ); var value = hrefProperty.slice( index ); if ( value === '#pll_switcher' ) { polylangSwitcher.prop( 'href', '#' ); } } } $( window ).on( 'elementor/frontend/init', function () { elementorFrontend.hooks.addAction( 'frontend/element_ready/navigation-menu.default', WidgethfeNavMenuHandler ); elementorFrontend.hooks.addAction( 'frontend/element_ready/hfe-search-button.default', WidgethfeSearchButton ); }); } )( jQuery ); inc/js/hfe-elementor-pro-compatibility.js000064400000002214146730610170014472 0ustar00(function($){ EHF_EPRO_Compatibility = { /** * Binds events for the Elementor Header Footer. * * @since 1.4.0 * @access private * @method _bind */ init: function() { elementor.on( "document:loaded", function() { setTimeout( function() { jQuery.each( elementorFrontend.documentsManager.documents, function ( index, document ) { var $documentElement = document.$element; var ids_array = JSON.parse( hfe_admin.ids_array ); ids_array.forEach( function( item, index ){ var elementor_id = $documentElement.data( 'elementor-id' ); if( elementor_id == ids_array[index].id ){ $documentElement.find( '.elementor-document-handle__title' ).text( elementor.translate('edit_element', [ids_array[index].value] ) ); } } ); }); }, 1000 ); }); } }; /** * Initialize EHF_EPRO_Compatibility */ $(function(){ EHF_EPRO_Compatibility.init(); }); })(jQuery); inc/class-hfe-update.php000064400000010216146730610170011160 0ustar00 * @copyright Copyright (c) 2019, Header Footer Elementor * @link https://github.com/Nikschavan/header-footer-elementor/ * @since HFE 1.1.4 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } if ( ! class_exists( 'HFE_Update' ) ) { /** * HFE_Update initial setup * * @since 1.1.4 */ class HFE_Update { /** * Option key for stored version number. * * @since 1.1.4 * @var string */ private $db_option_key = '_hfe_db_version'; /** * Constructor * * @since 1.1.4 */ public function __construct() { // Theme Updates. if ( is_admin() ) { add_action( 'admin_init', [ $this, 'init' ], 5 ); } else { add_action( 'wp', [ $this, 'init' ], 5 ); } } /** * Implement theme update logic. * * @since 1.1.4 */ public function init() { do_action( 'hfe_update_before' ); if ( ! $this->needs_db_update() ) { return; } $db_version = get_option( $this->db_option_key, false ); if ( version_compare( $db_version, '1.2.0-beta.2', '<' ) ) { $this->setup_default_terget_rules(); } // flush rewrite rules on plugin update. flush_rewrite_rules(); // PHPCS:Ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules $this->update_db_version(); do_action( 'hfe_update_after' ); } /** * Set default target rules for header, footer, before footers being used before target rules were added to the plugin. * * @since 1.2.0-beta.1 * @return void */ private function setup_default_terget_rules() { $default_include_locations = [ 'rule' => [ 0 => 'basic-global' ], 'specific' => [], ]; $header_id = $this->get_legacy_template_id( 'type_header' ); $footer_id = $this->get_legacy_template_id( 'type_footer' ); $before_footer_id = $this->get_legacy_template_id( 'type_before_footer' ); // Header. if ( ! empty( $header_id ) ) { update_post_meta( $header_id, 'ehf_target_include_locations', $default_include_locations ); } // Footer. if ( ! empty( $footer_id ) ) { update_post_meta( $footer_id, 'ehf_target_include_locations', $default_include_locations ); } // Before Footer. if ( ! empty( $before_footer_id ) ) { update_post_meta( $before_footer_id, 'ehf_target_include_locations', $default_include_locations ); } } /** * Get header or footer template id based on the meta query. * * @param String $type Type of the template header/footer. * * @return Mixed Returns the header or footer template id if found, else returns string ''. */ public function get_legacy_template_id( $type ) { $args = [ 'post_type' => 'elementor-hf', 'meta_key' => 'ehf_template_type', 'meta_value' => $type, // PHPCS:Ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value 'meta_type' => 'post', 'meta_compare' => '>=', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => [ // PHPCS:Ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query 'relation' => 'OR', [ 'key' => 'ehf_template_type', 'value' => $type, 'compare' => '==', 'type' => 'post', ], ], ]; $args = apply_filters( 'hfe_get_template_id_args', $args ); $template = new WP_Query( $args ); if ( $template->have_posts() ) { $posts = wp_list_pluck( $template->posts, 'ID' ); return $posts[0]; } return ''; } /** * Check if db upgrade is required. * * @since 1.1.4 * @return true|false True if stored database version is lower than constant; false if otherwise. */ private function needs_db_update() { $db_version = get_option( $this->db_option_key, false ); if ( false === $db_version || version_compare( $db_version, HFE_VER ) ) { return true; } return false; } /** * Update DB version. * * @since 1.1.4 * @return void */ private function update_db_version() { update_option( $this->db_option_key, HFE_VER ); } } } new HFE_Update(); inc/lib/astra-notices/class-astra-notices.php000064400000024755146730610170015251 0ustar00get_notice_by_id( $notice_id ); $capability = isset( $notice['capability'] ) ? $notice['capability'] : 'manage_options'; if ( ! apply_filters( 'astra_notices_user_cap_check', current_user_can( $capability ) ) ) { return; } if ( false === wp_verify_nonce( $nonce, 'astra-notices' ) ) { wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'header-footer-elementor' ) ); } // Valid inputs? if ( ! empty( $notice_id ) ) { if ( ! empty( $repeat_notice_after ) ) { set_transient( $notice_id, true, $repeat_notice_after ); } else { update_user_meta( get_current_user_id(), $notice_id, 'notice-dismissed' ); } wp_send_json_success(); } wp_send_json_error(); } /** * Enqueue Scripts. * * @since 1.0.0 * @return void */ public function enqueue_scripts() { wp_register_style( 'astra-notices', self::get_url() . 'notices.css', array(), self::$version ); wp_register_script( 'astra-notices', self::get_url() . 'notices.js', array( 'jquery' ), self::$version, true ); wp_localize_script( 'astra-notices', 'astraNotices', array( '_notice_nonce' => wp_create_nonce( 'astra-notices' ), ) ); } /** * Sort the notices based on the given priority of the notice. * This function is called from usort() * * @since 1.5.2 * @param array $notice_1 First notice. * @param array $notice_2 Second Notice. * @return array */ public function sort_notices( $notice_1, $notice_2 ) { if ( ! isset( $notice_1['priority'] ) ) { $notice_1['priority'] = 10; } if ( ! isset( $notice_2['priority'] ) ) { $notice_2['priority'] = 10; } return $notice_1['priority'] - $notice_2['priority']; } /** * Get all registered notices. * Since v1.1.8 it is recommended to register the notices on * * @return array|null */ private function get_notices() { usort( self::$notices, array( $this, 'sort_notices' ) ); return self::$notices; } /** * Get notice by notice_id * * @param string $notice_id Notice id. * * @return array notice based on the notice id. */ private function get_notice_by_id( $notice_id ) { if ( empty( $notice_id ) ) { return array(); } $notices = $this->get_notices(); $notice = wp_list_filter( $notices, array( 'id' => $notice_id, ) ); return ! empty( $notice ) ? $notice[0] : array(); } /** * Display the notices in the WordPress admin. * * @since 1.0.0 * @return void */ public function show_notices() { $defaults = array( 'id' => '', // Optional, Notice ID. If empty it set `astra-notices-id-<$array-index>`. 'type' => 'info', // Optional, Notice type. Default `info`. Expected [info, warning, notice, error]. 'message' => '', // Optional, Message. 'show_if' => true, // Optional, Show notice on custom condition. E.g. 'show_if' => if( is_admin() ) ? true, false, . 'repeat-notice-after' => '', // Optional, Dismiss-able notice time. It'll auto show after given time. 'display-notice-after' => false, // Optional, Dismiss-able notice time. It'll auto show after given time. 'class' => '', // Optional, Additional notice wrapper class. 'priority' => 10, // Priority of the notice. 'display-with-other-notices' => true, // Should the notice be displayed if other notices are being displayed from Astra_Notices. 'is_dismissible' => true, 'capability' => 'manage_options', // User capability - This capability is required for the current user to see this notice. ); // Count for the notices that are rendered. $notices_displayed = 0; $notices = $this->get_notices(); foreach ( $notices as $key => $notice ) { $notice = wp_parse_args( $notice, $defaults ); // Show notices only for users with `manage_options` cap. if ( ! current_user_can( $notice['capability'] ) ) { continue; } $notice['id'] = self::get_notice_id( $notice, $key ); $notice['classes'] = self::get_wrap_classes( $notice ); // Notices visible after transient expire. if ( isset( $notice['show_if'] ) && true === $notice['show_if'] ) { // don't display the notice if it is not supposed to be displayed with other notices. if ( 0 !== $notices_displayed && false === $notice['display-with-other-notices'] ) { continue; } if ( self::is_expired( $notice ) ) { self::markup( $notice ); ++$notices_displayed; } } } } /** * Render a notice. * * @since 1.0.0 * @param array $notice Notice markup. * @return void */ public static function markup( $notice = array() ) { wp_enqueue_script( 'astra-notices' ); wp_enqueue_style( 'astra-notices' ); do_action( 'astra_notice_before_markup' ); do_action( "astra_notice_before_markup_{$notice['id']}" ); ?>
.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} inc/lib/target-rule/target-rule.js000064400000017011146730610170013114 0ustar00;(function ( $, window, undefined ) { var init_target_rule_select2 = function( selector ) { $(selector).astselect2({ placeholder: astRules.search, ajax: { url: ajaxurl, dataType: 'json', method: 'post', delay: 250, data: function (params) { return { q: params.term, // search term page: params.page, action: 'hfe_get_posts_by_query', nonce: astRules.ajax_nonce }; }, processResults: function (data) { // console.log(data); // console.log("inside"); // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to // alter the remote JSON data return { results: data }; }, cache: true }, minimumInputLength: 2, language: astRules.ast_lang }); }; var update_target_rule_input = function(wrapper) { var rule_input = wrapper.find('.ast-target_rule-input'); var old_value = rule_input.val(); var new_value = []; wrapper.find('.astra-target-rule-condition').each(function(i) { var $this = $(this); var temp_obj = {}; var rule_condition = $this.find('select.target_rule-condition'); var specific_page = $this.find('select.target_rule-specific-page'); var rule_condition_val = rule_condition.val(); var specific_page_val = specific_page.val(); if ( '' != rule_condition_val ) { temp_obj = { type : rule_condition_val, specific: specific_page_val } new_value.push( temp_obj ); }; }) var rules_string = JSON.stringify( new_value ); rule_input.val( rules_string ); }; var update_close_button = function(wrapper) { type = wrapper.closest('.ast-target-rule-wrapper').attr('data-type'); rules = wrapper.find('.astra-target-rule-condition'); show_close = false; if ( 'display' == type ) { if ( rules.length > 1 ) { show_close = true; } }else{ show_close = true; } rules.each(function() { if ( show_close ) { jQuery(this).find('.target_rule-condition-delete').removeClass('ast-hidden'); }else{ jQuery(this).find('.target_rule-condition-delete').addClass('ast-hidden'); } }); }; var update_exclusion_button = function( force_show, force_hide ) { var display_on = $('.ast-target-rule-display-on-wrap'); var exclude_on = $('.ast-target-rule-exclude-on-wrap'); var exclude_field_wrap = exclude_on.closest('tr'); var add_exclude_block = display_on.find('.target_rule-add-exclusion-rule'); var exclude_conditions = exclude_on.find('.astra-target-rule-condition'); if ( true == force_hide ) { exclude_field_wrap.addClass( 'ast-hidden' ); add_exclude_block.removeClass( 'ast-hidden' ); }else if( true == force_show ){ exclude_field_wrap.removeClass( 'ast-hidden' ); add_exclude_block.addClass( 'ast-hidden' ); }else{ if ( 1 == exclude_conditions.length && '' == $(exclude_conditions[0]).find('select.target_rule-condition').val() ) { exclude_field_wrap.addClass( 'ast-hidden' ); add_exclude_block.removeClass( 'ast-hidden' ); }else{ exclude_field_wrap.removeClass( 'ast-hidden' ); add_exclude_block.addClass( 'ast-hidden' ); } } }; $(document).ready(function($) { jQuery( '.astra-target-rule-condition' ).each( function() { var $this = $( this ), condition = $this.find('select.target_rule-condition'), condition_val = condition.val(), specific_page = $this.next( '.target_rule-specific-page-wrap' ); if( 'specifics' == condition_val ) { specific_page.slideDown( 300 ); } } ); jQuery('select.target-rule-select2').each(function(index, el) { init_target_rule_select2( el ); }); jQuery('.ast-target-rule-selector-wrapper').each(function() { update_close_button( jQuery(this) ); }) /* Show hide exclusion button */ update_exclusion_button(); jQuery( document ).on( 'change', '.astra-target-rule-condition select.target_rule-condition' , function( e ) { var $this = jQuery(this), this_val = $this.val(), field_wrap = $this.closest('.ast-target-rule-wrapper'); if( 'specifics' == this_val ) { $this.closest( '.astra-target-rule-condition' ).next( '.target_rule-specific-page-wrap' ).slideDown( 300 ); } else { $this.closest( '.astra-target-rule-condition' ).next( '.target_rule-specific-page-wrap' ).slideUp( 300 ); } update_target_rule_input( field_wrap ); } ); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'change', '.target-rule-select2', function(e) { var $this = jQuery( this ), field_wrap = $this.closest('.ast-target-rule-wrapper'); update_target_rule_input( field_wrap ); }); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'click', '.target_rule-add-rule-wrap a', function(e) { e.preventDefault(); e.stopPropagation(); var $this = jQuery( this ), id = $this.attr( 'data-rule-id' ), new_id = parseInt(id) + 1, type = $this.attr( 'data-rule-type' ), rule_wrap = $this.closest('.ast-target-rule-selector-wrapper').find('.target_rule-builder-wrap'), template = wp.template( 'astra-target-rule-' + type + '-condition' ), field_wrap = $this.closest('.ast-target-rule-wrapper'); rule_wrap.append( template( { id : new_id, type : type } ) ); init_target_rule_select2( '.ast-target-rule-'+type+'-on .target-rule-select2' ); $this.attr( 'data-rule-id', new_id ); update_close_button( field_wrap ); }); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'click', '.target_rule-condition-delete', function(e) { var $this = jQuery( this ), rule_condition = $this.closest('.astra-target-rule-condition'), field_wrap = $this.closest('.ast-target-rule-wrapper'); cnt = 0, data_type = field_wrap.attr( 'data-type' ), optionVal = $this.siblings('.target_rule-condition-wrap').children('.target_rule-condition').val(); if ( 'exclude' == data_type ) { if ( 1 === field_wrap.find('.target_rule-condition').length ) { field_wrap.find('.target_rule-condition').val(''); field_wrap.find('.target_rule-specific-page').val(''); field_wrap.find('.target_rule-condition').trigger('change'); update_exclusion_button( false, true ); }else{ $this.parent('.astra-target-rule-condition').next('.target_rule-specific-page-wrap').remove(); rule_condition.remove(); } } else { $this.parent('.astra-target-rule-condition').next('.target_rule-specific-page-wrap').remove(); rule_condition.remove(); } field_wrap.find('.astra-target-rule-condition').each(function(i) { var condition = jQuery( this ), old_rule_id = condition.attr('data-rule'), select_location = condition.find('.target_rule-condition'), select_specific = condition.find('.target_rule-specific-page'), location_name = select_location.attr( 'name' ); condition.attr( 'data-rule', i ); select_location.attr( 'name', location_name.replace('['+old_rule_id+']', '['+i+']') ); condition.removeClass('ast-target-rule-'+old_rule_id).addClass('ast-target-rule-'+i); cnt = i; }); field_wrap.find('.target_rule-add-rule-wrap a').attr( 'data-rule-id', cnt ) update_close_button( field_wrap ); update_target_rule_input( field_wrap ); }); jQuery( '.ast-target-rule-selector-wrapper' ).on( 'click', '.target_rule-add-exclusion-rule a', function(e) { e.preventDefault(); e.stopPropagation(); update_exclusion_button( true ); }); }); }(jQuery, window)); inc/lib/target-rule/target-rule.css000064400000004600146730610170013270 0ustar00/* Select2 */ .post-type-astra_adv_header span.select2.select2-container.select2-container--default, .post-type-astra-advanced-hook span.select2.select2-container.select2-container--default { margin-top: 0; } .post-type-astra_adv_header li.select2-results__option.select2-results__message, .post-type-astra-advanced-hook li.select2-results__option.select2-results__message { background: #ecebeb; margin-bottom: 0; } .ast-target-rule-wrapper .select2-container { display: inline-block; position: relative; vertical-align: middle; width: 100% !important; } .ast-target-rule-wrapper .select2-container--default.select2-container--focus .select2-selection--multiple, .ast-target-rule-wrapper .select2-container--default .select2-selection--multiple { border: 1px solid #ddd; margin-top: 10px; } .ast-target-rule-wrapper .select2-container .select2-search--inline, .ast-target-rule-wrapper .select2-container--default .select2-search--inline .select2-search__field { width: 100% !important; } /* Target Rule field */ .astra-target-rule-condition, .astra-user-role-condition { position: relative; margin-top: 10px; } .target_rule-specific-page-wrap { position: relative; padding: 0 30px 0 0; } .user_role-add-rule-wrap, .target_rule-add-rule-wrap, .target_rule-add-exclusion-rule, .user_role-add-rule-wrap { margin-top: 15px; } .ast-target-rule-display-on, .ast-target-rule-exclude-on { margin-bottom: 10px; } .target_rule-condition-delete, .user_role-condition-delete { position: absolute; color: #999; right: 0px; top: 0px; font-size: 18px; line-height: 18px; width: 18px; height: 18px; display: inline-block; cursor: pointer; top: 50%; transform: translateY(-50%); } .target_rule-condition-delete:hover { color: #d54e21; } .target_rule-add-rule-wrap { display: inline-block; } .target_rule-add-exclusion-rule { display: inline-block; margin-left: 10px; } .configure-content [data-element="exclude_from"], .configure-content [data-element="exclusive_on"] { padding-bottom: 0; } .configure-content .ast-allow-specific-posts input, .configure-content .ast-post-types { margin-right: 3px; } .hide-on-devices input[type=checkbox] { margin-right: 5px; } .search-panel.search-close-icon { pointer-events: auto; cursor: pointer; } .ast-hidden { display: none !important; } inc/lib/target-rule/i18n/bg.js000064400000001612146730610170012030 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/tr.js000064400000001405146730610170012065 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/dsb.js000064400000001767146730610170012223 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/dsb",[],function(){var e=["znamuško","znamušce","znamuška","znamuškow"],t=["zapisk","zapiska","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Pšosym lašuj "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Pšosym zapódaj nanejmjenjej "+r+" "+n(r,e)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(e){return"Móžoš jano "+e.maximum+" "+n(e.maximum,t)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/zh-CN.js000064400000001401146730610170012353 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/it.js000064400000001554146730610170012061 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/pt.js000064400000001533146730610170012065 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"caractere",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/el.js000064400000002154146730610170012042 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ja.js000064400000001520146730610170012030 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/az.js000064400000001275146730610170012057 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ar.js000064400000001544146730610170012046 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum;return"الرجاء حذف "+t+" عناصر"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"الرجاء إضافة "+t+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){return"تستطيع إختيار "+e.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/sv.js000064400000001422146730610170012067 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/af.js000064400000001516146730610170012031 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Verwyders asseblief "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Voer asseblief "+t+" of meer karakters";return n},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var t="Kies asseblief net "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ps.js000064400000001773146730610170012072 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="د مهربانۍ لمخي "+t+" توری ړنګ کړئ";return t!=1&&(n=n.replace("توری","توري")),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لږ تر لږه "+t+" يا ډېر توري وليکئ";return n},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(e){var t="تاسو يوازي "+e.maximum+" قلم په نښه کولای سی";return e.maximum!=1&&(t=t.replace("قلم","قلمونه")),t},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/bs.js000064400000001654146730610170012052 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bs",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/th.js000064400000002030146730610170012046 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/fa.js000064400000001754146730610170012035 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/da.js000064400000001450146730610170012024 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Angiv venligst "+t+" tegn mindre"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Angiv venligst "+t+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/sk.js000064400000002362146730610170012060 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/vi.js000064400000001440146730610170012055 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+" ký tự";return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/sr.js000064400000001652146730610170012070 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/hu.js000064400000001442146730610170012055 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/de.js000064400000001525146730610170012033 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/cs.js000064400000002344146730610170012050 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadejte o jeden znak méně.":n<=4?"Prosím, zadejte o "+e(n,!0)+" znaky méně.":"Prosím, zadejte o "+n+" znaků méně."},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadejte ještě jeden znak.":n<=4?"Prosím, zadejte ještě další "+e(n,!0)+" znaky.":"Prosím, zadejte ještě dalších "+n+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku.":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky.":"Můžete zvolit maximálně "+n+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/gl.js000064400000001566146730610170012052 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var t=e.input.length-e.maximum;return t===1?"Elimine un carácter":"Elimine "+t+" caracteres"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t===1?"Engada un carácter":"Engada "+t+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return e.maximum===1?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/hi.js000064400000002145146730610170012042 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/sr-Cyrl.js000064400000002053146730610170012773 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ko.js000064400000001526146730610170012055 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/nb.js000064400000001407146730610170012041 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn "+t+" tegn til";return n+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/fr.js000064400000001563146730610170012054 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Supprimez "+t+" caractère"+(t>1)?"s":""},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Saisissez au moins "+t+" caractère"+(t>1)?"s":""},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1)?"s":""},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/id.js000064400000001360146730610170012034 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/hy.js000064400000001755146730610170012070 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Խնդրում ենք հեռացնել "+t+" նշան";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Խնդրում ենք մուտքագրել "+t+" կամ ավել նշաններ";return n},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(e){var t="Դուք կարող եք ընտրել առավելագույնը "+e.maximum+" կետ";return t},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/es.js000064400000001574146730610170012056 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/fi.js000064400000001416146730610170012040 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/lv.js000064400000001550146730610170012062 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/hsb.js000064400000001770146730610170012221 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hsb",[],function(){var e=["znamješko","znamješce","znamješka","znamješkow"],t=["zapisk","zapiskaj","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Prošu zhašej "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Prošu zapodaj znajmjeńša "+r+" "+n(r,e)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(e){return"Móžeš jenož "+e.maximum+" "+n(e.maximum,t)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/mk.js000064400000001723146730610170012052 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/km.js000064400000002051146730610170012045 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ro.js000064400000001616146730610170012064 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+" sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/pt-BR.js000064400000001525146730610170012367 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/he.js000064400000001667146730610170012046 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/hr.js000064400000001507146730610170012054 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/uk.js000064400000002135146730610170012060 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/sl.js000064400000001572146730610170012063 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Prosim zbrišite "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Prosim vpišite še "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var t="Označite lahko največ "+e.maximum+" predmet";return e.maximum==2?t+="a":e.maximum!=1&&(t+="e"),t},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/pl.js000064400000001635146730610170012060 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ru.js000064400000002147146730610170012072 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ca.js000064400000001554146730610170012030 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/eu.js000064400000001514146730610170012052 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/nl.js000064400000001600146730610170012046 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/zh-TW.js000064400000001304146730610170012407 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/is.js000064400000001405146730610170012053 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/en.js000064400000001473146730610170012047 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/et.js000064400000001407146730610170012052 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/lt.js000064400000001621146730610170012057 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/i18n/ms.js000064400000001427146730610170012063 0ustar00/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();inc/lib/target-rule/user-role.js000064400000004640146730610170012602 0ustar00;(function ( $, window, undefined ) { var user_role_update_close_button = function(wrapper) { type = wrapper.closest('.ast-user-role-wrapper').attr('data-type'); rules = wrapper.find('.astra-user-role-condition'); show_close = false; if ( rules.length > 1 ) { show_close = true; } rules.each(function() { if ( show_close ) { jQuery(this).find('.user_role-condition-delete').removeClass('ast-hidden'); }else{ jQuery(this).find('.user_role-condition-delete').addClass('ast-hidden'); } }); }; $(document).ready(function($) { jQuery('.ast-user-role-selector-wrapper').each(function() { user_role_update_close_button( jQuery(this) ); }) jQuery( '.ast-user-role-selector-wrapper' ).on( 'click', '.user_role-add-rule-wrap a', function(e) { e.preventDefault(); e.stopPropagation(); var $this = jQuery( this ), id = $this.attr( 'data-rule-id' ), new_id = parseInt(id) + 1, rule_wrap = $this.closest('.ast-user-role-selector-wrapper').find('.user_role-builder-wrap'), template = wp.template( 'astra-user-role-condition' ), field_wrap = $this.closest('.ast-user-role-wrapper'); rule_wrap.append( template( { id : new_id } ) ); $this.attr( 'data-rule-id', new_id ); user_role_update_close_button( field_wrap ); }); jQuery( '.ast-user-role-selector-wrapper' ).on( 'click', '.user_role-condition-delete', function(e) { var $this = jQuery( this ), rule_condition = $this.closest('.astra-user-role-condition'), field_wrap = $this.closest('.ast-user-role-wrapper'); cnt = 0, data_type = field_wrap.attr( 'data-type' ), optionVal = $this.siblings('.user_role-condition-wrap').children('.user_role-condition').val(); rule_condition.remove(); field_wrap.find('.astra-user-role-condition').each(function(i) { var condition = jQuery( this ), old_rule_id = condition.attr('data-rule'), select_location = condition.find('.user_role-condition'), location_name = select_location.attr( 'name' ); condition.attr( 'data-rule', i ); select_location.attr( 'name', location_name.replace('['+old_rule_id+']', '['+i+']') ); condition.removeClass('ast-user-role-'+old_rule_id).addClass('ast-user-role-'+i); cnt = i; }); field_wrap.find('.user_role-add-rule-wrap a').attr( 'data-rule-id', cnt ) user_role_update_close_button( field_wrap ); }); }); }(jQuery, window));inc/lib/target-rule/class-astra-target-rules-fields.php000064400000141547146730610170017145 0ustar00 true, '_builtin' => true, ); $post_types = get_post_types( $args, 'objects' ); unset( $post_types['attachment'] ); $args['_builtin'] = false; $custom_post_type = get_post_types( $args, 'objects' ); $post_types = apply_filters( 'astra_location_rule_post_types', array_merge( $post_types, $custom_post_type ) ); $special_pages = array( 'special-404' => __( '404 Page', 'header-footer-elementor' ), 'special-search' => __( 'Search Page', 'header-footer-elementor' ), 'special-blog' => __( 'Blog / Posts Page', 'header-footer-elementor' ), 'special-front' => __( 'Front Page', 'header-footer-elementor' ), 'special-date' => __( 'Date Archive', 'header-footer-elementor' ), 'special-author' => __( 'Author Archive', 'header-footer-elementor' ), ); if ( class_exists( 'WooCommerce' ) ) { $special_pages['special-woo-shop'] = __( 'WooCommerce Shop Page', 'header-footer-elementor' ); } $selection_options = array( 'basic' => array( 'label' => __( 'Basic', 'header-footer-elementor' ), 'value' => array( 'basic-global' => __( 'Entire Website', 'header-footer-elementor' ), 'basic-singulars' => __( 'All Singulars', 'header-footer-elementor' ), 'basic-archives' => __( 'All Archives', 'header-footer-elementor' ), ), ), 'special-pages' => array( 'label' => __( 'Special Pages', 'header-footer-elementor' ), 'value' => $special_pages, ), ); $args = array( 'public' => true, ); $taxonomies = get_taxonomies( $args, 'objects' ); if ( ! empty( $taxonomies ) ) { foreach ( $taxonomies as $taxonomy ) { // skip post format taxonomy. if ( 'post_format' == $taxonomy->name ) { continue; } foreach ( $post_types as $post_type ) { $post_opt = self::get_post_target_rule_options( $post_type, $taxonomy ); if ( isset( $selection_options[ $post_opt['post_key'] ] ) ) { if ( ! empty( $post_opt['value'] ) && is_array( $post_opt['value'] ) ) { foreach ( $post_opt['value'] as $key => $value ) { if ( ! in_array( $value, $selection_options[ $post_opt['post_key'] ]['value'] ) ) { $selection_options[ $post_opt['post_key'] ]['value'][ $key ] = $value; } } } } else { $selection_options[ $post_opt['post_key'] ] = array( 'label' => $post_opt['label'], 'value' => $post_opt['value'], ); } } } } $selection_options['specific-target'] = array( 'label' => __( 'Specific Target', 'header-footer-elementor' ), 'value' => array( 'specifics' => __( 'Specific Pages / Posts / Taxonomies, etc.', 'header-footer-elementor' ), ), ); /** * Filter options displayed in the display conditions select field of Display conditions. * * @since 1.5.0 */ return apply_filters( 'astra_display_on_list', $selection_options ); } /** * Get user selection options. * * @return array */ public static function get_user_selections() { $selection_options = array( 'basic' => array( 'label' => __( 'Basic', 'header-footer-elementor' ), 'value' => array( 'all' => __( 'All', 'header-footer-elementor' ), 'logged-in' => __( 'Logged In', 'header-footer-elementor' ), 'logged-out' => __( 'Logged Out', 'header-footer-elementor' ), ), ), 'advanced' => array( 'label' => __( 'Advanced', 'header-footer-elementor' ), 'value' => array(), ), ); /* User roles */ $roles = get_editable_roles(); foreach ( $roles as $slug => $data ) { $selection_options['advanced']['value'][ $slug ] = $data['name']; } /** * Filter options displayed in the user select field of Display conditions. * * @since 1.5.0 */ return apply_filters( 'astra_user_roles_list', $selection_options ); } /** * Get location label by key. * * @param string $key Location option key. * @return string */ public static function get_location_by_key( $key ) { if ( ! isset( self::$location_selection ) || empty( self::$location_selection ) ) { self::$location_selection = self::get_location_selections(); } $location_selection = self::$location_selection; foreach ( $location_selection as $location_grp ) { if ( isset( $location_grp['value'][ $key ] ) ) { return $location_grp['value'][ $key ]; } } if ( strpos( $key, 'post-' ) !== false ) { $post_id = (int) str_replace( 'post-', '', $key ); return get_the_title( $post_id ); } // taxonomy options. if ( strpos( $key, 'tax-' ) !== false ) { $tax_id = (int) str_replace( 'tax-', '', $key ); $term = get_term( $tax_id ); if ( ! is_wp_error( $term ) ) { $term_taxonomy = ucfirst( str_replace( '_', ' ', $term->taxonomy ) ); return $term->name . ' - ' . $term_taxonomy; } else { return ''; } } return $key; } /** * Get user label by key. * * @param string $key User option key. * @return string */ public static function get_user_by_key( $key ) { if ( ! isset( self::$user_selection ) || empty( self::$user_selection ) ) { self::$user_selection = self::get_user_selections(); } $user_selection = self::$user_selection; if ( isset( $user_selection['basic']['value'][ $key ] ) ) { return $user_selection['basic']['value'][ $key ]; } elseif ( $user_selection['advanced']['value'][ $key ] ) { return $user_selection['advanced']['value'][ $key ]; } return $key; } /** * Ajax handeler to return the posts based on the search query. * When searching for the post/pages only titles are searched for. * * @since 1.0.0 */ function hfe_get_posts_by_query() { check_ajax_referer( 'hfe-get-posts-by-query', 'nonce' ); $search_string = isset( $_POST['q'] ) ? sanitize_text_field( $_POST['q'] ) : ''; $data = array(); $result = array(); $args = array( 'public' => true, '_builtin' => false, ); $output = 'names'; // names or objects, note names is the default. $operator = 'and'; // also supports 'or'. $post_types = get_post_types( $args, $output, $operator ); unset( $post_types['elementor-hf'] ); //Exclude EHF templates. $post_types['Posts'] = 'post'; $post_types['Pages'] = 'page'; foreach ( $post_types as $key => $post_type ) { $data = array(); add_filter( 'posts_search', array( $this, 'search_only_titles' ), 10, 2 ); $query = new \WP_Query( array( 's' => $search_string, 'post_type' => $post_type, 'posts_per_page' => - 1, ) ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); $title = get_the_title(); $title .= ( 0 != $query->post->post_parent ) ? ' (' . get_the_title( $query->post->post_parent ) . ')' : ''; $id = get_the_id(); $data[] = array( 'id' => 'post-' . $id, 'text' => $title, ); } } if ( is_array( $data ) && ! empty( $data ) ) { $result[] = array( 'text' => $key, 'children' => $data, ); } } $data = array(); wp_reset_postdata(); $args = array( 'public' => true, ); $output = 'objects'; // names or objects, note names is the default. $operator = 'and'; // also supports 'or'. $taxonomies = get_taxonomies( $args, $output, $operator ); foreach ( $taxonomies as $taxonomy ) { $terms = get_terms( $taxonomy->name, array( 'orderby' => 'count', 'hide_empty' => 0, 'name__like' => $search_string, ) ); $data = array(); $label = ucwords( $taxonomy->label ); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { $term_taxonomy_name = ucfirst( str_replace( '_', ' ', $taxonomy->name ) ); $data[] = array( 'id' => 'tax-' . $term->term_id, 'text' => $term->name . ' archive page', ); $data[] = array( 'id' => 'tax-' . $term->term_id . '-single-' . $taxonomy->name, 'text' => 'All singulars from ' . $term->name, ); } } if ( is_array( $data ) && ! empty( $data ) ) { $result[] = array( 'text' => $label, 'children' => $data, ); } } // return the result in json. wp_send_json( $result ); } /** * Return search results only by post title. * This is only run from hfe_get_posts_by_query() * * @param (string) $search Search SQL for WHERE clause. * @param (WP_Query) $wp_query The current WP_Query object. * * @return (string) The Modified Search SQL for WHERE clause. */ function search_only_titles( $search, $wp_query ) { if ( ! empty( $search ) && ! empty( $wp_query->query_vars['search_terms'] ) ) { global $wpdb; $q = $wp_query->query_vars; $n = ! empty( $q['exact'] ) ? '' : '%'; $search = array(); foreach ( (array) $q['search_terms'] as $term ) { $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $n . $wpdb->esc_like( $term ) . $n ); } if ( ! is_user_logged_in() ) { $search[] = "$wpdb->posts.post_password = ''"; } $search = ' AND ' . implode( ' AND ', $search ); } return $search; } /** * Function Name: admin_styles. * Function Description: admin_styles. */ public function admin_styles() { wp_enqueue_script( 'astra-select2', AST_TARGET_RULE_URI . 'select2.js', array( 'jquery' ), AST_TARGET_RULE_VER, true ); $wp_lang = get_locale(); $ast_lang = ''; if ( '' !== $wp_lang ) { $select2_lang = array( '' => 'en', 'hi_IN' => 'hi', 'mr' => 'mr', 'af' => 'af', 'ar' => 'ar', 'ary' => 'ar', 'as' => 'as', 'azb' => 'az', 'az' => 'az', 'bel' => 'be', 'bg_BG' => 'bg', 'bn_BD' => 'bn', 'bo' => 'bo', 'bs_BA' => 'bs', 'ca' => 'ca', 'ceb' => 'ceb', 'cs_CZ' => 'cs', 'cy' => 'cy', 'da_DK' => 'da', 'de_CH' => 'de', 'de_DE' => 'de', 'de_DE_formal' => 'de', 'de_CH_informal' => 'de', 'dzo' => 'dz', 'el' => 'el', 'en_CA' => 'en', 'en_GB' => 'en', 'en_AU' => 'en', 'en_NZ' => 'en', 'en_ZA' => 'en', 'eo' => 'eo', 'es_MX' => 'es', 'es_VE' => 'es', 'es_CR' => 'es', 'es_CO' => 'es', 'es_GT' => 'es', 'es_ES' => 'es', 'es_CL' => 'es', 'es_PE' => 'es', 'es_AR' => 'es', 'et' => 'et', 'eu' => 'eu', 'fa_IR' => 'fa', 'fi' => 'fi', 'fr_BE' => 'fr', 'fr_FR' => 'fr', 'fr_CA' => 'fr', 'gd' => 'gd', 'gl_ES' => 'gl', 'gu' => 'gu', 'haz' => 'haz', 'he_IL' => 'he', 'hr' => 'hr', 'hu_HU' => 'hu', 'hy' => 'hy', 'id_ID' => 'id', 'is_IS' => 'is', 'it_IT' => 'it', 'ja' => 'ja', 'jv_ID' => 'jv', 'ka_GE' => 'ka', 'kab' => 'kab', 'km' => 'km', 'ko_KR' => 'ko', 'ckb' => 'ku', 'lo' => 'lo', 'lt_LT' => 'lt', 'lv' => 'lv', 'mk_MK' => 'mk', 'ml_IN' => 'ml', 'mn' => 'mn', 'ms_MY' => 'ms', 'my_MM' => 'my', 'nb_NO' => 'nb', 'ne_NP' => 'ne', 'nl_NL' => 'nl', 'nl_NL_formal' => 'nl', 'nl_BE' => 'nl', 'nn_NO' => 'nn', 'oci' => 'oc', 'pa_IN' => 'pa', 'pl_PL' => 'pl', 'ps' => 'ps', 'pt_BR' => 'pt', 'pt_PT_ao90' => 'pt', 'pt_PT' => 'pt', 'rhg' => 'rhg', 'ro_RO' => 'ro', 'ru_RU' => 'ru', 'sah' => 'sah', 'si_LK' => 'si', 'sk_SK' => 'sk', 'sl_SI' => 'sl', 'sq' => 'sq', 'sr_RS' => 'sr', 'sv_SE' => 'sv', 'szl' => 'szl', 'ta_IN' => 'ta', 'te' => 'te', 'th' => 'th', 'tl' => 'tl', 'tr_TR' => 'tr', 'tt_RU' => 'tt', 'tah' => 'ty', 'ug_CN' => 'ug', 'uk' => 'uk', 'ur' => 'ur', 'uz_UZ' => 'uz', 'vi' => 'vi', 'zh_CN' => 'zh', 'zh_TW' => 'zh', 'zh_HK' => 'zh', ); if ( isset( $select2_lang[ $wp_lang ] ) && file_exists( AST_TARGET_RULE_DIR . 'i18n/' . $select2_lang[ $wp_lang ] . '.js' ) ) { $ast_lang = $select2_lang[ $wp_lang ]; wp_enqueue_script( 'astra-select2-lang', AST_TARGET_RULE_URI . 'i18n/' . $select2_lang[ $wp_lang ] . '.js', array( 'jquery', 'astra-select2', ), AST_TARGET_RULE_VER, true ); } } wp_register_script( 'astra-target-rule', AST_TARGET_RULE_URI . 'target-rule.js', array( 'jquery', 'astra-select2', ), AST_TARGET_RULE_VER, true ); wp_enqueue_script( 'astra-target-rule' ); wp_register_script( 'astra-user-role', AST_TARGET_RULE_URI . 'user-role.js', array( 'jquery', ), AST_TARGET_RULE_VER, true ); wp_enqueue_script( 'astra-user-role' ); wp_register_style( 'astra-select2', AST_TARGET_RULE_URI . 'select2.css', '', AST_TARGET_RULE_VER ); wp_enqueue_style( 'astra-select2' ); wp_register_style( 'astra-target-rule', AST_TARGET_RULE_URI . 'target-rule.css', '', AST_TARGET_RULE_VER ); wp_enqueue_style( 'astra-target-rule' ); /** * Registered localize vars */ $localize_vars = array( 'ast_lang' => $ast_lang, 'please_enter' => __( 'Please enter', 'header-footer-elementor' ), 'please_delete' => __( 'Please delete', 'header-footer-elementor' ), 'more_char' => __( 'or more characters', 'header-footer-elementor' ), 'character' => __( 'character', 'header-footer-elementor' ), 'loading' => __( 'Loading more results…', 'header-footer-elementor' ), 'only_select' => __( 'You can only select', 'header-footer-elementor' ), 'item' => __( 'item', 'header-footer-elementor' ), 'char_s' => __( 's', 'header-footer-elementor' ), 'no_result' => __( 'No results found', 'header-footer-elementor' ), 'searching' => __( 'Searching…', 'header-footer-elementor' ), 'not_loader' => __( 'The results could not be loaded.', 'header-footer-elementor' ), 'search' => __( 'Search pages / post / categories', 'header-footer-elementor' ), 'ajax_nonce' => wp_create_nonce( 'hfe-get-posts-by-query' ), ); wp_localize_script( 'astra-select2', 'astRules', $localize_vars ); } /** * Function Name: target_rule_settings_field. * Function Description: Function to handle new input type. * * @param string $name string parameter. * @param string $settings string parameter. * @param string $value string parameter. */ public static function target_rule_settings_field( $name, $settings, $value ) { $input_name = $name; $type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule'; $class = isset( $settings['class'] ) ? $settings['class'] : ''; $rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule'; $add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', 'header-footer-elementor' ); $saved_values = $value; $output = ''; if ( isset( self::$location_selection ) || empty( self::$location_selection ) ) { self::$location_selection = self::get_location_selections(); } $selection_options = self::$location_selection; /* WP Template Format */ $output .= ''; /* Wrapper Start */ $output .= '
'; // $output .= ''; $output .= '
'; $output .= self::generate_target_rule_selector( $rule_type, $selection_options, $input_name, $saved_values, $add_rule_label ); $output .= '
'; /* Wrapper end */ $output .= '
'; echo $output; } /** * Get target rules for generating the markup for rule selector. * * @since 1.0.0 * * @param object $post_type post type parameter. * @param object $taxonomy taxonomy for creating the target rule markup. */ public static function get_post_target_rule_options( $post_type, $taxonomy ) { $post_key = str_replace( ' ', '-', strtolower( $post_type->label ) ); $post_label = ucwords( $post_type->label ); $post_name = $post_type->name; $post_option = array(); /* translators: %s post label */ $all_posts = sprintf( __( 'All %s', 'header-footer-elementor' ), $post_label ); $post_option[ $post_name . '|all' ] = $all_posts; if ( 'pages' != $post_key ) { /* translators: %s post label */ $all_archive = sprintf( __( 'All %s Archive', 'header-footer-elementor' ), $post_label ); $post_option[ $post_name . '|all|archive' ] = $all_archive; } if ( in_array( $post_type->name, $taxonomy->object_type ) ) { $tax_label = ucwords( $taxonomy->label ); $tax_name = $taxonomy->name; /* translators: %s taxonomy label */ $tax_archive = sprintf( __( 'All %s Archive', 'header-footer-elementor' ), $tax_label ); $post_option[ $post_name . '|all|taxarchive|' . $tax_name ] = $tax_archive; } $post_output['post_key'] = $post_key; $post_output['label'] = $post_label; $post_output['value'] = $post_option; return $post_output; } /** * Generate markup for rendering the location selction. * * @since 1.0.0 * @param String $type Rule type display|exclude. * @param Array $selection_options Array for available selection fields. * @param String $input_name Input name for the settings. * @param Array $saved_values Array of saved valued. * @param String $add_rule_label Label for the Add rule button. * * @return HTML Markup for for the location settings. */ public static function generate_target_rule_selector( $type, $selection_options, $input_name, $saved_values, $add_rule_label ) { $output = '
'; if ( ! is_array( $saved_values ) || ( is_array( $saved_values ) && empty( $saved_values ) ) ) { $saved_values = array(); $saved_values['rule'][0] = ''; $saved_values['specific'][0] = ''; } $index = 0; if ( is_array( $saved_values ) && is_array( $saved_values['rule'] ) ) { foreach ( $saved_values['rule'] as $index => $data ) { $output .= '
'; /* Condition Selection */ $output .= ''; $output .= '
'; $output .= ''; $output .= '
'; $output .= '
'; /* Specific page selection */ $output .= ''; } } $output .= '
'; /* Add new rule */ $output .= '
'; $output .= '' . $add_rule_label . ''; $output .= '
'; if ( 'display' == $type ) { /* Add new rule */ $output .= '
'; $output .= '' . __( 'Add Exclusion Rule', 'header-footer-elementor' ) . ''; $output .= '
'; } return $output; } /** * Get current layout. * Checks of the passed post id of the layout is to be displayed in the page. * * @param int $layout_id Layout ID. * @param string $option Option prefix. * * @return int|boolean If the current layout is to be displayed it will be returned back else a boolean will be passed. */ public function get_current_layout( $layout_id, $option ) { $post_id = ( ! is_404() && ! is_search() && ! is_archive() && ! is_home() ) ? get_the_id() : false; $current_layout = false; $is_exclude = false; $is_user_role = false; $display_on = get_post_meta( $layout_id, $option . '-location', true ); $exclude_on = get_post_meta( $layout_id, $option . '-exclusion', true ); $user_roles = get_post_meta( $layout_id, $option . '-users', true ); /* Parse Display On Condition */ $is_display = $this->parse_layout_display_condition( $post_id, $display_on ); if ( true == $is_display ) { /* Parse Exclude On Condition */ $is_exclude = $this->parse_layout_display_condition( $post_id, $exclude_on ); /* Parse User Role Condition */ $is_user_role = $this->parse_user_role_condition( $post_id, $user_roles ); } if ( $is_display && ! $is_exclude && $is_user_role ) { $current_layout = $layout_id; } // filter target page settings. $current_layout = apply_filters( 'astra_target_page_settings', $current_layout, $layout_id ); return $current_layout; } /** * Checks for the display condition for the current page/ * * @param int $post_id Current post ID. * @param array $rules Array of rules Display on | Exclude on. * * @return boolean Returns true or false depending on if the $rules match for the current page and the layout is to be displayed. */ public function parse_layout_display_condition( $post_id, $rules ) { $display = false; $current_post_type = get_post_type( $post_id ); if ( isset( $rules['rule'] ) && is_array( $rules['rule'] ) && ! empty( $rules['rule'] ) ) { foreach ( $rules['rule'] as $key => $rule ) { if ( strrpos( $rule, 'all' ) !== false ) { $rule_case = 'all'; } else { $rule_case = $rule; } switch ( $rule_case ) { case 'basic-global': $display = true; break; case 'basic-singulars': if ( is_singular() ) { $display = true; } break; case 'basic-archives': if ( is_archive() ) { $display = true; } break; case 'special-404': if ( is_404() ) { $display = true; } break; case 'special-search': if ( is_search() ) { $display = true; } break; case 'special-blog': if ( is_home() ) { $display = true; } break; case 'special-front': if ( is_front_page() ) { $display = true; } break; case 'special-date': if ( is_date() ) { $display = true; } break; case 'special-author': if ( is_author() ) { $display = true; } break; case 'special-woo-shop': if ( function_exists( 'is_shop' ) && is_shop() ) { $display = true; } break; case 'all': $rule_data = explode( '|', $rule ); $post_type = isset( $rule_data[0] ) ? $rule_data[0] : false; $archieve_type = isset( $rule_data[2] ) ? $rule_data[2] : false; $taxonomy = isset( $rule_data[3] ) ? $rule_data[3] : false; if ( false === $archieve_type ) { $current_post_type = get_post_type( $post_id ); if ( false !== $post_id && $current_post_type == $post_type ) { $display = true; } } else { if ( is_archive() ) { $current_post_type = get_post_type(); if ( $current_post_type == $post_type ) { if ( 'archive' == $archieve_type ) { $display = true; } elseif ( 'taxarchive' == $archieve_type ) { $obj = get_queried_object(); $current_taxonomy = ''; if ( '' !== $obj && null !== $obj ) { $current_taxonomy = $obj->taxonomy; } if ( $current_taxonomy == $taxonomy ) { $display = true; } } } } } break; case 'specifics': if ( isset( $rules['specific'] ) && is_array( $rules['specific'] ) ) { foreach ( $rules['specific'] as $specific_page ) { $specific_data = explode( '-', $specific_page ); $specific_post_type = isset( $specific_data[0] ) ? $specific_data[0] : false; $specific_post_id = isset( $specific_data[1] ) ? $specific_data[1] : false; if ( 'post' == $specific_post_type ) { if ( $specific_post_id == $post_id ) { $display = true; } } elseif ( isset( $specific_data[2] ) && ( 'single' == $specific_data[2] ) && 'tax' == $specific_post_type ) { if ( is_singular() ) { $term_details = get_term( $specific_post_id ); if ( isset( $term_details->taxonomy ) ) { $has_term = has_term( (int) $specific_post_id, $term_details->taxonomy, $post_id ); if ( $has_term ) { $display = true; } } } } elseif ( 'tax' == $specific_post_type ) { $tax_id = get_queried_object_id(); if ( $specific_post_id == $tax_id ) { $display = true; } } } } break; default: break; } if ( $display ) { break; } } } return $display; } /** * Function Name: target_user_role_settings_field. * Function Description: Function to handle new input type. * * @param string $name string parameter. * @param string $settings string parameter. * @param string $value string parameter. */ public static function target_user_role_settings_field( $name, $settings, $value ) { $input_name = $name; $type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule'; $class = isset( $settings['class'] ) ? $settings['class'] : ''; $rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule'; $add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', 'header-footer-elementor' ); $saved_values = $value; $output = ''; if ( ! isset( self::$user_selection ) || empty( self::$user_selection ) ) { self::$user_selection = self::get_user_selections(); } $selection_options = self::$user_selection; /* WP Template Format */ $output .= ''; if ( ! is_array( $saved_values ) || ( is_array( $saved_values ) && empty( $saved_values ) ) ) { $saved_values = array(); $saved_values[0] = ''; } $index = 0; $output .= '
'; $output .= '
'; $output .= '
'; foreach ( $saved_values as $index => $data ) { $output .= '
'; $output .= ''; /* Condition Selection */ $output .= '
'; $output .= ''; $output .= '
'; $output .= '
'; } $output .= '
'; /* Add new rule */ $output .= '
'; $output .= '' . $add_rule_label . ''; $output .= '
'; $output .= '
'; $output .= '
'; echo $output; } /** * Parse user role condition. * * @since 1.0.0 * @param int $post_id Post ID. * @param Array $rules Current user rules. * * @return boolean True = user condition passes. False = User condition does not pass. */ public function parse_user_role_condition( $post_id, $rules ) { $show_popup = true; if ( is_array( $rules ) && ! empty( $rules ) ) { $show_popup = false; foreach ( $rules as $i => $rule ) { switch ( $rule ) { case '': case 'all': $show_popup = true; break; case 'logged-in': if ( is_user_logged_in() ) { $show_popup = true; } break; case 'logged-out': if ( ! is_user_logged_in() ) { $show_popup = true; } break; default: if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); if ( isset( $current_user->roles ) && is_array( $current_user->roles ) && in_array( $rule, $current_user->roles ) ) { $show_popup = true; } } break; } if ( $show_popup ) { break; } } } return $show_popup; } /** * Get current page type * * @since 1.0.0 * * @return string Page Type. */ public function get_current_page_type() { if ( null === self::$current_page_type ) { $page_type = ''; $current_id = false; if ( is_404() ) { $page_type = 'is_404'; } elseif ( is_search() ) { $page_type = 'is_search'; } elseif ( is_archive() ) { $page_type = 'is_archive'; if ( is_category() || is_tag() || is_tax() ) { $page_type = 'is_tax'; } elseif ( is_date() ) { $page_type = 'is_date'; } elseif ( is_author() ) { $page_type = 'is_author'; } elseif ( function_exists( 'is_shop' ) && is_shop() ) { $page_type = 'is_woo_shop_page'; } } elseif ( is_home() ) { $page_type = 'is_home'; } elseif ( is_front_page() ) { $page_type = 'is_front_page'; $current_id = get_the_id(); } elseif ( is_singular() ) { $page_type = 'is_singular'; $current_id = get_the_id(); } else { $current_id = get_the_id(); } self::$current_page_data['ID'] = $current_id; self::$current_page_type = $page_type; } return self::$current_page_type; } /** * Get posts by conditions * * @since 1.0.0 * @param string $post_type Post Type. * @param array $option meta option name. * * @return object Posts. */ public function get_posts_by_conditions( $post_type, $option ) { global $wpdb; global $post; $post_type = $post_type ? esc_sql( $post_type ) : esc_sql( $post->post_type ); if ( is_array( self::$current_page_data ) && isset( self::$current_page_data[ $post_type ] ) ) { return apply_filters( 'astra_get_display_posts_by_conditions', self::$current_page_data[ $post_type ], $post_type ); } $current_page_type = $this->get_current_page_type(); self::$current_page_data[ $post_type ] = array(); $option['current_post_id'] = self::$current_page_data['ID']; $meta_header = self::get_meta_option_post( $post_type, $option ); /* Meta option is enabled */ if ( false === $meta_header ) { $current_post_type = esc_sql( get_post_type() ); $current_post_id = false; $q_obj = get_queried_object(); $current_id = esc_sql( get_the_id() ); // Find WPML Object ID for current page. if ( defined( 'ICL_SITEPRESS_VERSION' ) ) { $default_lang = apply_filters( 'wpml_default_language', '' ); $current_lang = apply_filters( 'wpml_current_language', '' ); if( $default_lang !== $current_lang ) { $current_post_type = get_post_type( $current_id ); $current_id = apply_filters( 'wpml_object_id', $current_id, $current_post_type, true, $default_lang ); } } $location = isset( $option['location'] ) ? esc_sql( $option['location'] ) : ''; $query = "SELECT p.ID, pm.meta_value FROM {$wpdb->postmeta} as pm INNER JOIN {$wpdb->posts} as p ON pm.post_id = p.ID WHERE pm.meta_key = '{$location}' AND p.post_type = '{$post_type}' AND p.post_status = 'publish'"; $orderby = ' ORDER BY p.post_date DESC'; /* Entire Website */ $meta_args = "pm.meta_value LIKE '%\"basic-global\"%'"; switch ( $current_page_type ) { case 'is_404': $meta_args .= " OR pm.meta_value LIKE '%\"special-404\"%'"; break; case 'is_search': $meta_args .= " OR pm.meta_value LIKE '%\"special-search\"%'"; break; case 'is_archive': case 'is_tax': case 'is_date': case 'is_author': $meta_args .= " OR pm.meta_value LIKE '%\"basic-archives\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|archive\"%'"; if ( 'is_tax' == $current_page_type && ( is_category() || is_tag() || is_tax() ) ) { if ( is_object( $q_obj ) ) { $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|taxarchive|{$q_obj->taxonomy}\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$q_obj->term_id}\"%'"; } } elseif ( 'is_date' == $current_page_type ) { $meta_args .= " OR pm.meta_value LIKE '%\"special-date\"%'"; } elseif ( 'is_author' == $current_page_type ) { $meta_args .= " OR pm.meta_value LIKE '%\"special-author\"%'"; } break; case 'is_home': $meta_args .= " OR pm.meta_value LIKE '%\"special-blog\"%'"; break; case 'is_front_page': $current_post_id = $current_id; $meta_args .= " OR pm.meta_value LIKE '%\"special-front\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'"; break; case 'is_singular': $current_post_id = $current_id; $meta_args .= " OR pm.meta_value LIKE '%\"basic-singulars\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'"; $meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'"; $taxonomies = get_object_taxonomies( $q_obj->post_type ); $terms = wp_get_post_terms( $q_obj->ID, $taxonomies ); foreach ( $terms as $key => $term ) { $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$term->term_id}-single-{$term->taxonomy}\"%'"; } break; case 'is_woo_shop_page': $meta_args .= " OR pm.meta_value LIKE '%\"special-woo-shop\"%'"; break; case '': $current_post_id = $current_id; break; } // Ignore the PHPCS warning about constant declaration. // @codingStandardsIgnoreStart $posts = $wpdb->get_results( $query . ' AND (' . $meta_args . ')' . $orderby ); // @codingStandardsIgnoreEnd foreach ( $posts as $local_post ) { self::$current_page_data[ $post_type ][ $local_post->ID ] = array( 'id' => $local_post->ID, 'location' => unserialize( $local_post->meta_value ), ); } $option['current_post_id'] = $current_post_id; $this->remove_exclusion_rule_posts( $post_type, $option ); $this->remove_user_rule_posts( $post_type, $option ); } return apply_filters( 'astra_get_display_posts_by_conditions', self::$current_page_data[ $post_type ], $post_type ); } /** * Remove exclusion rule posts. * * @since 1.0.0 * @param string $post_type Post Type. * @param array $option meta option name. */ public function remove_exclusion_rule_posts( $post_type, $option ) { $exclusion = isset( $option['exclusion'] ) ? $option['exclusion'] : ''; $current_post_id = isset( $option['current_post_id'] ) ? $option['current_post_id'] : false; foreach ( self::$current_page_data[ $post_type ] as $c_post_id => $c_data ) { $exclusion_rules = get_post_meta( $c_post_id, $exclusion, true ); $is_exclude = $this->parse_layout_display_condition( $current_post_id, $exclusion_rules ); if ( $is_exclude ) { unset( self::$current_page_data[ $post_type ][ $c_post_id ] ); } } } /** * Remove user rule posts. * * @since 1.0.0 * @param int $post_type Post Type. * @param array $option meta option name. */ public function remove_user_rule_posts( $post_type, $option ) { $users = isset( $option['users'] ) ? $option['users'] : ''; $current_post_id = isset( $option['current_post_id'] ) ? $option['current_post_id'] : false; foreach ( self::$current_page_data[ $post_type ] as $c_post_id => $c_data ) { $user_rules = get_post_meta( $c_post_id, $users, true ); $is_user = $this->parse_user_role_condition( $current_post_id, $user_rules ); if ( ! $is_user ) { unset( self::$current_page_data[ $post_type ][ $c_post_id ] ); } } } /** * Same display_on notice. * * @since 1.0.0 * @param int $post_type Post Type. * @param array $option meta option name. */ public static function same_display_on_notice( $post_type, $option ) { global $wpdb; global $post; $all_rules = array(); $already_set_rule = array(); $location = isset( $option['location'] ) ? $option['location'] : ''; $all_headers = $wpdb->get_results( $wpdb->prepare( "SELECT p.ID, p.post_title, pm.meta_value FROM {$wpdb->postmeta} as pm INNER JOIN {$wpdb->posts} as p ON pm.post_id = p.ID WHERE pm.meta_key = %s AND p.post_type = %s AND p.post_status = 'publish'", $location, $post_type ) ); foreach ( $all_headers as $header ) { $location_rules = unserialize( $header->meta_value ); if ( is_array( $location_rules ) && isset( $location_rules['rule'] ) ) { foreach ( $location_rules['rule'] as $key => $rule ) { if ( ! isset( $all_rules[ $rule ] ) ) { $all_rules[ $rule ] = array(); } if ( 'specifics' == $rule && isset( $location_rules['specific'] ) && is_array( $location_rules['specific'] ) ) { foreach ( $location_rules['specific'] as $s_index => $s_value ) { $all_rules[ $rule ][ $s_value ][ $header->ID ] = array( 'ID' => $header->ID, 'name' => $header->post_title, ); } } else { $all_rules[ $rule ][ $header->ID ] = array( 'ID' => $header->ID, 'name' => $header->post_title, ); } } } } if ( empty( $post ) ) { return; } $current_post_data = get_post_meta( $post->ID, $location, true ); if ( is_array( $current_post_data ) && isset( $current_post_data['rule'] ) ) { foreach ( $current_post_data['rule'] as $c_key => $c_rule ) { if ( ! isset( $all_rules[ $c_rule ] ) ) { continue; } if ( 'specifics' === $c_rule ) { foreach ( $current_post_data['specific'] as $s_index => $s_id ) { if ( ! isset( $all_rules[ $c_rule ][ $s_id ] ) ) { continue; } foreach ( $all_rules[ $c_rule ][ $s_id ] as $p_id => $data ) { if ( $p_id == $post->ID ) { continue; } $already_set_rule[] = $data['name']; } } } else { foreach ( $all_rules[ $c_rule ] as $p_id => $data ) { if ( $p_id == $post->ID ) { continue; } $already_set_rule[] = $data['name']; } } } } if ( ! empty( $already_set_rule ) ) { add_action( 'admin_notices', function() use ( $already_set_rule ) { $rule_set_titles = '' . implode( ',', $already_set_rule ) . ''; /* translators: %s post title. */ $notice = sprintf( __( 'The same display setting is already exist in %s post/s.', 'header-footer-elementor' ), $rule_set_titles ); echo '
'; echo '

' . $notice . '

'; echo '
'; } ); } } /** * Meta option post. * * @since 1.0.0 * @param string $post_type Post Type. * @param array $option meta option name. * * @return false | object */ public static function get_meta_option_post( $post_type, $option ) { $page_meta = ( isset( $option['page_meta'] ) && '' != $option['page_meta'] ) ? $option['page_meta'] : false; if ( false !== $page_meta ) { $current_post_id = isset( $option['current_post_id'] ) ? $option['current_post_id'] : false; $meta_id = get_post_meta( $current_post_id, $option['page_meta'], true ); if ( false !== $meta_id && '' != $meta_id ) { self::$current_page_data[ $post_type ][ $meta_id ] = array( 'id' => $meta_id, 'location' => '', ); return self::$current_page_data[ $post_type ]; } } return false; } /** * Get post selection. * * @since 1.0.0 * @param string $post_type Post Type. * * @return object Posts. */ public static function get_post_selection( $post_type ) { $query_args = array( 'post_type' => $post_type, 'posts_per_page' => -1, 'post_status' => 'publish', ); $all_headers = get_posts( $query_args ); $headers = array(); if ( ! empty( $all_headers ) ) { $headers = array( '' => __( 'Select', 'header-footer-elementor' ), ); foreach ( $all_headers as $i => $data ) { $headers[ $data->ID ] = $data->post_title; } } return $headers; } /** * Formated rule meta value to save. * * @since 1.0.0 * @param array $save_data PostData. * @param string $key varaible key. * * @return array Rule data. */ public static function get_format_rule_value( $save_data, $key ) { $meta_value = array(); if ( isset( $save_data[ $key ]['rule'] ) ) { $save_data[ $key ]['rule'] = array_unique( $save_data[ $key ]['rule'] ); if ( isset( $save_data[ $key ]['specific'] ) ) { $save_data[ $key ]['specific'] = array_unique( $save_data[ $key ]['specific'] ); } // Unset the specifics from rule. This will be readded conditionally in next condition. $index = array_search( '', $save_data[ $key ]['rule'] ); if ( false !== $index ) { unset( $save_data[ $key ]['rule'][ $index ] ); } $index = array_search( 'specifics', $save_data[ $key ]['rule'] ); if ( false !== $index ) { unset( $save_data[ $key ]['rule'][ $index ] ); // Only re-add the specifics key if there are specific rules added. if ( isset( $save_data[ $key ]['specific'] ) && is_array( $save_data[ $key ]['specific'] ) ) { array_push( $save_data[ $key ]['rule'], 'specifics' ); } } foreach ( $save_data[ $key ] as $meta_key => $value ) { if ( ! empty( $value ) ) { $meta_value[ $meta_key ] = array_map( 'esc_attr', $value ); } } if ( ! isset( $meta_value['rule'] ) || ! in_array( 'specifics', $meta_value['rule'] ) ) { $meta_value['specific'] = array(); } if ( empty( $meta_value['rule'] ) ) { $meta_value = array(); } } return $meta_value; } } /** * Kicking this off by calling 'get_instance()' method */ Astra_Target_Rules_Fields::get_instance(); inc/lib/target-rule/select2.js000064400000430057146730610170012233 0ustar00/*! * Select2 4.0.5 * https://select2.github.io * * Released under the MIT license * https://github.com/select2/select2/blob/master/LICENSE.md */ (function (factory) { /* Whenever you update select2 script please add astselect2 handler */ /* select2 handler changed to astselect2 */ var existingVersion = jQuery.fn.select2 || null; if (existingVersion) { delete jQuery.fn.select2; } if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof module === 'object' && module.exports) { // Node/CommonJS module.exports = function (root, jQuery) { if (jQuery === undefined) { // require('jQuery') returns a factory that requires window to // build a jQuery instance, we normalize how we use modules // that require this pattern but the window provided is a noop // if it's defined (how jquery works) if (typeof window !== 'undefined') { jQuery = require('jquery'); } else { jQuery = require('jquery')(root); } } factory(jQuery); return jQuery; }; } else { // Browser globals factory(jQuery); } jQuery.fn.astselect2 = jQuery.fn.select2; if (existingVersion) { delete jQuery.fn.select2; jQuery.fn.select2 = existingVersion; } /* select2 handler changed to astselect2 code end */ } (function (jQuery) { // This is needed so we can catch the AMD loader configuration and use it // The inner file should be wrapped (by `banner.start.js`) in a function that // returns the AMD loader references. var S2 =(function () { // Restore the Select2 AMD loader so it can be used // Needed mostly in the language files, where the loader is not inserted if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { var S2 = jQuery.fn.select2.amd; } var S2;(function () { if (!S2 || !S2.requirejs) { if (!S2) { S2 = {}; } else { require = S2; } /** * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. * Released under MIT license, http://github.com/requirejs/almond/LICENSE */ //Going sloppy to avoid 'use strict' string cost, but strict practices should //be followed. /*global setTimeout: false */ var requirejs, require, define; (function (undef) { var main, req, makeMap, handlers, defined = {}, waiting = {}, config = {}, defining = {}, hasOwn = Object.prototype.hasOwnProperty, aps = [].slice, jsSuffixRegExp = /\.js$/; function hasProp(obj, prop) { return hasOwn.call(obj, prop); } /** * Given a relative module name, like ./something, normalize it to * a real name that can be mapped to a path. * @param {String} name the relative name * @param {String} baseName a real name that the name arg is relative * to. * @returns {String} normalized name */ function normalize(name, baseName) { var nameParts, nameSegment, mapValue, foundMap, lastIndex, foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, baseParts = baseName && baseName.split("/"), map = config.map, starMap = (map && map['*']) || {}; //Adjust any relative paths. if (name) { name = name.split('/'); lastIndex = name.length - 1; // If wanting node ID compatibility, strip .js from end // of IDs. Have to do this here, and not in nameToUrl // because node allows either .js or non .js to map // to same file. if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); } // Starts with a '.' so need the baseName if (name[0].charAt(0) === '.' && baseParts) { //Convert baseName to array, and lop off the last part, //so that . matches that 'directory' and not name of the baseName's //module. For instance, baseName of 'one/two/three', maps to //'one/two/three.js', but we want the directory, 'one/two' for //this normalization. normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); name = normalizedBaseParts.concat(name); } //start trimDots for (i = 0; i < name.length; i++) { part = name[i]; if (part === '.') { name.splice(i, 1); i -= 1; } else if (part === '..') { // If at the start, or previous value is still .., // keep them so that when converted to a path it may // still work when converted to a path, even though // as an ID it is less than ideal. In larger point // releases, may be better to just kick out an error. if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { continue; } else if (i > 0) { name.splice(i - 1, 2); i -= 2; } } } //end trimDots name = name.join('/'); } //Apply map config if available. if ((baseParts || starMap) && map) { nameParts = name.split('/'); for (i = nameParts.length; i > 0; i -= 1) { nameSegment = nameParts.slice(0, i).join("/"); if (baseParts) { //Find the longest baseName segment match in the config. //So, do joins on the biggest to smallest lengths of baseParts. for (j = baseParts.length; j > 0; j -= 1) { mapValue = map[baseParts.slice(0, j).join('/')]; //baseName segment has config, find if it has one for //this name. if (mapValue) { mapValue = mapValue[nameSegment]; if (mapValue) { //Match, update name to the new value. foundMap = mapValue; foundI = i; break; } } } } if (foundMap) { break; } //Check for a star map match, but just hold on to it, //if there is a shorter segment match later in a matching //config, then favor over this star map. if (!foundStarMap && starMap && starMap[nameSegment]) { foundStarMap = starMap[nameSegment]; starI = i; } } if (!foundMap && foundStarMap) { foundMap = foundStarMap; foundI = starI; } if (foundMap) { nameParts.splice(0, foundI, foundMap); name = nameParts.join('/'); } } return name; } function makeRequire(relName, forceSync) { return function () { //A version of a require function that passes a moduleName //value for items that may need to //look up paths relative to the moduleName var args = aps.call(arguments, 0); //If first arg is not require('string'), and there is only //one arg, it is the array form without a callback. Insert //a null so that the following concat is correct. if (typeof args[0] !== 'string' && args.length === 1) { args.push(null); } return req.apply(undef, args.concat([relName, forceSync])); }; } function makeNormalize(relName) { return function (name) { return normalize(name, relName); }; } function makeLoad(depName) { return function (value) { defined[depName] = value; }; } function callDep(name) { if (hasProp(waiting, name)) { var args = waiting[name]; delete waiting[name]; defining[name] = true; main.apply(undef, args); } if (!hasProp(defined, name) && !hasProp(defining, name)) { throw new Error('No ' + name); } return defined[name]; } //Turns a plugin!resource to [plugin, resource] //with the plugin being undefined if the name //did not have a plugin prefix. function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; } //Creates a parts array for a relName where first part is plugin ID, //second part is resource ID. Assumes relName has already been normalized. function makeRelParts(relName) { return relName ? splitPrefix(relName) : []; } /** * Makes a name map, normalizing the name, and using a plugin * for normalization if necessary. Grabs a ref to plugin * too, as an optimization. */ makeMap = function (name, relParts) { var plugin, parts = splitPrefix(name), prefix = parts[0], relResourceName = relParts[1]; name = parts[1]; if (prefix) { prefix = normalize(prefix, relResourceName); plugin = callDep(prefix); } //Normalize according if (prefix) { if (plugin && plugin.normalize) { name = plugin.normalize(name, makeNormalize(relResourceName)); } else { name = normalize(name, relResourceName); } } else { name = normalize(name, relResourceName); parts = splitPrefix(name); prefix = parts[0]; name = parts[1]; if (prefix) { plugin = callDep(prefix); } } //Using ridiculous property names for space reasons return { f: prefix ? prefix + '!' + name : name, //fullName n: name, pr: prefix, p: plugin }; }; function makeConfig(name) { return function () { return (config && config.config && config.config[name]) || {}; }; } handlers = { require: function (name) { return makeRequire(name); }, exports: function (name) { var e = defined[name]; if (typeof e !== 'undefined') { return e; } else { return (defined[name] = {}); } }, module: function (name) { return { id: name, uri: '', exports: defined[name], config: makeConfig(name) }; } }; main = function (name, deps, callback, relName) { var cjsModule, depName, ret, map, i, relParts, args = [], callbackType = typeof callback, usingExports; //Use name if no relName relName = relName || name; relParts = makeRelParts(relName); //Call the callback to define the module, if necessary. if (callbackType === 'undefined' || callbackType === 'function') { //Pull out the defined dependencies and pass the ordered //values to the callback. //Default to [require, exports, module] if no deps deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; for (i = 0; i < deps.length; i += 1) { map = makeMap(deps[i], relParts); depName = map.f; //Fast path CommonJS standard dependencies. if (depName === "require") { args[i] = handlers.require(name); } else if (depName === "exports") { //CommonJS module spec 1.1 args[i] = handlers.exports(name); usingExports = true; } else if (depName === "module") { //CommonJS module spec 1.1 cjsModule = args[i] = handlers.module(name); } else if (hasProp(defined, depName) || hasProp(waiting, depName) || hasProp(defining, depName)) { args[i] = callDep(depName); } else if (map.p) { map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); args[i] = defined[depName]; } else { throw new Error(name + ' missing ' + depName); } } ret = callback ? callback.apply(defined[name], args) : undefined; if (name) { //If setting exports via "module" is in play, //favor that over return value and exports. After that, //favor a non-undefined return value over exports use. if (cjsModule && cjsModule.exports !== undef && cjsModule.exports !== defined[name]) { defined[name] = cjsModule.exports; } else if (ret !== undef || !usingExports) { //Use the return value from the function. defined[name] = ret; } } } else if (name) { //May just be an object definition for the module. Only //worry about defining if have a module name. defined[name] = callback; } }; requirejs = require = req = function (deps, callback, relName, forceSync, alt) { if (typeof deps === "string") { if (handlers[deps]) { //callback in this case is really relName return handlers[deps](callback); } //Just return the module wanted. In this scenario, the //deps arg is the module name, and second arg (if passed) //is just the relName. //Normalize module name, if it contains . or .. return callDep(makeMap(deps, makeRelParts(callback)).f); } else if (!deps.splice) { //deps is a config object, not an array. config = deps; if (config.deps) { req(config.deps, config.callback); } if (!callback) { return; } if (callback.splice) { //callback is an array, which means it is a dependency list. //Adjust args if there are dependencies deps = callback; callback = relName; relName = null; } else { deps = undef; } } //Support require(['a']) callback = callback || function () {}; //If relName is a function, it is an errback handler, //so remove it. if (typeof relName === 'function') { relName = forceSync; forceSync = alt; } //Simulate async callback; if (forceSync) { main(undef, deps, callback, relName); } else { //Using a non-zero value because of concern for what old browsers //do, and latest browsers "upgrade" to 4 if lower value is used: //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: //If want a value immediately, use require('id') instead -- something //that works in almond on the global level, but not guaranteed and //unlikely to work in other AMD implementations. setTimeout(function () { main(undef, deps, callback, relName); }, 4); } return req; }; /** * Just drops the config on the floor, but returns req in case * the config return value is used. */ req.config = function (cfg) { return req(cfg); }; /** * Expose module registry for debugging and tooling */ requirejs._defined = defined; define = function (name, deps, callback) { if (typeof name !== 'string') { throw new Error('See almond README: incorrect module build, no module name'); } //This module may not have dependencies if (!deps.splice) { //deps is not an array, so probably means //an object literal or factory function for //the value. Adjust args. callback = deps; deps = []; } if (!hasProp(defined, name) && !hasProp(waiting, name)) { waiting[name] = [name, deps, callback]; } }; define.amd = { jQuery: true }; }()); S2.requirejs = requirejs;S2.require = require;S2.define = define; } }()); S2.define("almond", function(){}); /* global jQuery:false, $:false */ S2.define('jquery',[],function () { var _$ = jQuery || $; if (_$ == null && console && console.error) { console.error( 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 'found. Make sure that you are including jQuery before Select2 on your ' + 'web page.' ); } return _$; }); S2.define('select2/utils',[ 'jquery' ], function ($) { var Utils = {}; Utils.Extend = function (ChildClass, SuperClass) { var __hasProp = {}.hasOwnProperty; function BaseConstructor () { this.constructor = ChildClass; } for (var key in SuperClass) { if (__hasProp.call(SuperClass, key)) { ChildClass[key] = SuperClass[key]; } } BaseConstructor.prototype = SuperClass.prototype; ChildClass.prototype = new BaseConstructor(); ChildClass.__super__ = SuperClass.prototype; return ChildClass; }; function getMethods (theClass) { var proto = theClass.prototype; var methods = []; for (var methodName in proto) { var m = proto[methodName]; if (typeof m !== 'function') { continue; } if (methodName === 'constructor') { continue; } methods.push(methodName); } return methods; } Utils.Decorate = function (SuperClass, DecoratorClass) { var decoratedMethods = getMethods(DecoratorClass); var superMethods = getMethods(SuperClass); function DecoratedClass () { var unshift = Array.prototype.unshift; var argCount = DecoratorClass.prototype.constructor.length; var calledConstructor = SuperClass.prototype.constructor; if (argCount > 0) { unshift.call(arguments, SuperClass.prototype.constructor); calledConstructor = DecoratorClass.prototype.constructor; } calledConstructor.apply(this, arguments); } DecoratorClass.displayName = SuperClass.displayName; function ctr () { this.constructor = DecoratedClass; } DecoratedClass.prototype = new ctr(); for (var m = 0; m < superMethods.length; m++) { var superMethod = superMethods[m]; DecoratedClass.prototype[superMethod] = SuperClass.prototype[superMethod]; } var calledMethod = function (methodName) { // Stub out the original method if it's not decorating an actual method var originalMethod = function () {}; if (methodName in DecoratedClass.prototype) { originalMethod = DecoratedClass.prototype[methodName]; } var decoratedMethod = DecoratorClass.prototype[methodName]; return function () { var unshift = Array.prototype.unshift; unshift.call(arguments, originalMethod); return decoratedMethod.apply(this, arguments); }; }; for (var d = 0; d < decoratedMethods.length; d++) { var decoratedMethod = decoratedMethods[d]; DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); } return DecoratedClass; }; var Observable = function () { this.listeners = {}; }; Observable.prototype.on = function (event, callback) { this.listeners = this.listeners || {}; if (event in this.listeners) { this.listeners[event].push(callback); } else { this.listeners[event] = [callback]; } }; Observable.prototype.trigger = function (event) { var slice = Array.prototype.slice; var params = slice.call(arguments, 1); this.listeners = this.listeners || {}; // Params should always come in as an array if (params == null) { params = []; } // If there are no arguments to the event, use a temporary object if (params.length === 0) { params.push({}); } // Set the `_type` of the first object to the event params[0]._type = event; if (event in this.listeners) { this.invoke(this.listeners[event], slice.call(arguments, 1)); } if ('*' in this.listeners) { this.invoke(this.listeners['*'], arguments); } }; Observable.prototype.invoke = function (listeners, params) { for (var i = 0, len = listeners.length; i < len; i++) { listeners[i].apply(this, params); } }; Utils.Observable = Observable; Utils.generateChars = function (length) { var chars = ''; for (var i = 0; i < length; i++) { var randomChar = Math.floor(Math.random() * 36); chars += randomChar.toString(36); } return chars; }; Utils.bind = function (func, context) { return function () { func.apply(context, arguments); }; }; Utils._convertData = function (data) { for (var originalKey in data) { var keys = originalKey.split('-'); var dataLevel = data; if (keys.length === 1) { continue; } for (var k = 0; k < keys.length; k++) { var key = keys[k]; // Lowercase the first letter // By default, dash-separated becomes camelCase key = key.substring(0, 1).toLowerCase() + key.substring(1); if (!(key in dataLevel)) { dataLevel[key] = {}; } if (k == keys.length - 1) { dataLevel[key] = data[originalKey]; } dataLevel = dataLevel[key]; } delete data[originalKey]; } return data; }; Utils.hasScroll = function (index, el) { // Adapted from the function created by @ShadowScripter // and adapted by @BillBarry on the Stack Exchange Code Review website. // The original code can be found at // http://codereview.stackexchange.com/q/13338 // and was designed to be used with the Sizzle selector engine. var $el = $(el); var overflowX = el.style.overflowX; var overflowY = el.style.overflowY; //Check both x and y declarations if (overflowX === overflowY && (overflowY === 'hidden' || overflowY === 'visible')) { return false; } if (overflowX === 'scroll' || overflowY === 'scroll') { return true; } return ($el.innerHeight() < el.scrollHeight || $el.innerWidth() < el.scrollWidth); }; Utils.escapeMarkup = function (markup) { var replaceMap = { '\\': '\', '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', '/': '/' }; // Do not try to escape the markup if it's not a string if (typeof markup !== 'string') { return markup; } return String(markup).replace(/[&<>"'\/\\]/g, function (match) { return replaceMap[match]; }); }; // Append an array of jQuery nodes to a given element. Utils.appendMany = function ($element, $nodes) { // jQuery 1.7.x does not support $.fn.append() with an array // Fall back to a jQuery object collection using $.fn.add() if ($.fn.jquery.substr(0, 3) === '1.7') { var $jqNodes = $(); $.map($nodes, function (node) { $jqNodes = $jqNodes.add(node); }); $nodes = $jqNodes; } $element.append($nodes); }; return Utils; }); S2.define('select2/results',[ 'jquery', './utils' ], function ($, Utils) { function Results ($element, options, dataAdapter) { this.$element = $element; this.data = dataAdapter; this.options = options; Results.__super__.constructor.call(this); } Utils.Extend(Results, Utils.Observable); Results.prototype.render = function () { var $results = $( '' ); if (this.options.get('multiple')) { $results.attr('aria-multiselectable', 'true'); } this.$results = $results; return $results; }; Results.prototype.clear = function () { this.$results.empty(); }; Results.prototype.displayMessage = function (params) { var escapeMarkup = this.options.get('escapeMarkup'); this.clear(); this.hideLoading(); var $message = $( '
  • ' ); var message = this.options.get('translations').get(params.message); $message.append( escapeMarkup( message(params.args) ) ); $message[0].className += ' select2-results__message'; this.$results.append($message); }; Results.prototype.hideMessages = function () { this.$results.find('.select2-results__message').remove(); }; Results.prototype.append = function (data) { this.hideLoading(); var $options = []; if (data.results == null || data.results.length === 0) { if (this.$results.children().length === 0) { this.trigger('results:message', { message: 'noResults' }); } return; } data.results = this.sort(data.results); for (var d = 0; d < data.results.length; d++) { var item = data.results[d]; var $option = this.option(item); $options.push($option); } this.$results.append($options); }; Results.prototype.position = function ($results, $dropdown) { var $resultsContainer = $dropdown.find('.select2-results'); $resultsContainer.append($results); }; Results.prototype.sort = function (data) { var sorter = this.options.get('sorter'); return sorter(data); }; Results.prototype.highlightFirstItem = function () { var $options = this.$results .find('.select2-results__option[aria-selected]'); var $selected = $options.filter('[aria-selected=true]'); // Check if there are any selected options if ($selected.length > 0) { // If there are selected options, highlight the first $selected.first().trigger('mouseenter'); } else { // If there are no selected options, highlight the first option // in the dropdown $options.first().trigger('mouseenter'); } this.ensureHighlightVisible(); }; Results.prototype.setClasses = function () { var self = this; this.data.current(function (selected) { var selectedIds = $.map(selected, function (s) { return s.id.toString(); }); var $options = self.$results .find('.select2-results__option[aria-selected]'); $options.each(function () { var $option = $(this); var item = $.data(this, 'data'); // id needs to be converted to a string when comparing var id = '' + item.id; if ((item.element != null && item.element.selected) || (item.element == null && $.inArray(id, selectedIds) > -1)) { $option.attr('aria-selected', 'true'); } else { $option.attr('aria-selected', 'false'); } }); }); }; Results.prototype.showLoading = function (params) { this.hideLoading(); var loadingMore = this.options.get('translations').get('searching'); var loading = { disabled: true, loading: true, text: loadingMore(params) }; var $loading = this.option(loading); $loading.className += ' loading-results'; this.$results.prepend($loading); }; Results.prototype.hideLoading = function () { this.$results.find('.loading-results').remove(); }; Results.prototype.option = function (data) { var option = document.createElement('li'); option.className = 'select2-results__option'; var attrs = { 'role': 'treeitem', 'aria-selected': 'false' }; if (data.disabled) { delete attrs['aria-selected']; attrs['aria-disabled'] = 'true'; } if (data.id == null) { delete attrs['aria-selected']; } if (data._resultId != null) { option.id = data._resultId; } if (data.title) { option.title = data.title; } if (data.children) { attrs.role = 'group'; attrs['aria-label'] = data.text; delete attrs['aria-selected']; } for (var attr in attrs) { var val = attrs[attr]; option.setAttribute(attr, val); } if (data.children) { var $option = $(option); var label = document.createElement('strong'); label.className = 'select2-results__group'; var $label = $(label); this.template(data, label); var $children = []; for (var c = 0; c < data.children.length; c++) { var child = data.children[c]; var $child = this.option(child); $children.push($child); } var $childrenContainer = $('', { 'class': 'select2-results__options select2-results__options--nested' }); $childrenContainer.append($children); $option.append(label); $option.append($childrenContainer); } else { this.template(data, option); } $.data(option, 'data', data); return option; }; Results.prototype.bind = function (container, $container) { var self = this; var id = container.id + '-results'; this.$results.attr('id', id); container.on('results:all', function (params) { self.clear(); self.append(params.data); if (container.isOpen()) { self.setClasses(); self.highlightFirstItem(); } }); container.on('results:append', function (params) { self.append(params.data); if (container.isOpen()) { self.setClasses(); } }); container.on('query', function (params) { self.hideMessages(); self.showLoading(params); }); container.on('select', function () { if (!container.isOpen()) { return; } self.setClasses(); self.highlightFirstItem(); }); container.on('unselect', function () { if (!container.isOpen()) { return; } self.setClasses(); self.highlightFirstItem(); }); container.on('open', function () { // When the dropdown is open, aria-expended="true" self.$results.attr('aria-expanded', 'true'); self.$results.attr('aria-hidden', 'false'); self.setClasses(); self.ensureHighlightVisible(); }); container.on('close', function () { // When the dropdown is closed, aria-expended="false" self.$results.attr('aria-expanded', 'false'); self.$results.attr('aria-hidden', 'true'); self.$results.removeAttr('aria-activedescendant'); }); container.on('results:toggle', function () { var $highlighted = self.getHighlightedResults(); if ($highlighted.length === 0) { return; } $highlighted.trigger('mouseup'); }); container.on('results:select', function () { var $highlighted = self.getHighlightedResults(); if ($highlighted.length === 0) { return; } var data = $highlighted.data('data'); if ($highlighted.attr('aria-selected') == 'true') { self.trigger('close', {}); } else { self.trigger('select', { data: data }); } }); container.on('results:previous', function () { var $highlighted = self.getHighlightedResults(); var $options = self.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); // If we are already at te top, don't move further if (currentIndex === 0) { return; } var nextIndex = currentIndex - 1; // If none are highlighted, highlight the first if ($highlighted.length === 0) { nextIndex = 0; } var $next = $options.eq(nextIndex); $next.trigger('mouseenter'); var currentOffset = self.$results.offset().top; var nextTop = $next.offset().top; var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); if (nextIndex === 0) { self.$results.scrollTop(0); } else if (nextTop - currentOffset < 0) { self.$results.scrollTop(nextOffset); } }); container.on('results:next', function () { var $highlighted = self.getHighlightedResults(); var $options = self.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); var nextIndex = currentIndex + 1; // If we are at the last option, stay there if (nextIndex >= $options.length) { return; } var $next = $options.eq(nextIndex); $next.trigger('mouseenter'); var currentOffset = self.$results.offset().top + self.$results.outerHeight(false); var nextBottom = $next.offset().top + $next.outerHeight(false); var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; if (nextIndex === 0) { self.$results.scrollTop(0); } else if (nextBottom > currentOffset) { self.$results.scrollTop(nextOffset); } }); container.on('results:focus', function (params) { params.element.addClass('select2-results__option--highlighted'); }); container.on('results:message', function (params) { self.displayMessage(params); }); if ($.fn.mousewheel) { this.$results.on('mousewheel', function (e) { var top = self.$results.scrollTop(); var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); if (isAtTop) { self.$results.scrollTop(0); e.preventDefault(); e.stopPropagation(); } else if (isAtBottom) { self.$results.scrollTop( self.$results.get(0).scrollHeight - self.$results.height() ); e.preventDefault(); e.stopPropagation(); } }); } this.$results.on('mouseup', '.select2-results__option[aria-selected]', function (evt) { var $this = $(this); var data = $this.data('data'); if ($this.attr('aria-selected') === 'true') { if (self.options.get('multiple')) { self.trigger('unselect', { originalEvent: evt, data: data }); } else { self.trigger('close', {}); } return; } self.trigger('select', { originalEvent: evt, data: data }); }); this.$results.on('mouseenter', '.select2-results__option[aria-selected]', function (evt) { var data = $(this).data('data'); self.getHighlightedResults() .removeClass('select2-results__option--highlighted'); self.trigger('results:focus', { data: data, element: $(this) }); }); }; Results.prototype.getHighlightedResults = function () { var $highlighted = this.$results .find('.select2-results__option--highlighted'); return $highlighted; }; Results.prototype.destroy = function () { this.$results.remove(); }; Results.prototype.ensureHighlightVisible = function () { var $highlighted = this.getHighlightedResults(); if ($highlighted.length === 0) { return; } var $options = this.$results.find('[aria-selected]'); var currentIndex = $options.index($highlighted); var currentOffset = this.$results.offset().top; var nextTop = $highlighted.offset().top; var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); var offsetDelta = nextTop - currentOffset; nextOffset -= $highlighted.outerHeight(false) * 2; if (currentIndex <= 2) { this.$results.scrollTop(0); } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { this.$results.scrollTop(nextOffset); } }; Results.prototype.template = function (result, container) { var template = this.options.get('templateResult'); var escapeMarkup = this.options.get('escapeMarkup'); var content = template(result, container); if (content == null) { container.style.display = 'none'; } else if (typeof content === 'string') { container.innerHTML = escapeMarkup(content); } else { $(container).append(content); } }; return Results; }); S2.define('select2/keys',[ ], function () { var KEYS = { BACKSPACE: 8, TAB: 9, ENTER: 13, SHIFT: 16, CTRL: 17, ALT: 18, ESC: 27, SPACE: 32, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, DELETE: 46 }; return KEYS; }); S2.define('select2/selection/base',[ 'jquery', '../utils', '../keys' ], function ($, Utils, KEYS) { function BaseSelection ($element, options) { this.$element = $element; this.options = options; BaseSelection.__super__.constructor.call(this); } Utils.Extend(BaseSelection, Utils.Observable); BaseSelection.prototype.render = function () { var $selection = $( '' ); this._tabindex = 0; if (this.$element.data('old-tabindex') != null) { this._tabindex = this.$element.data('old-tabindex'); } else if (this.$element.attr('tabindex') != null) { this._tabindex = this.$element.attr('tabindex'); } $selection.attr('title', this.$element.attr('title')); $selection.attr('tabindex', this._tabindex); this.$selection = $selection; return $selection; }; BaseSelection.prototype.bind = function (container, $container) { var self = this; var id = container.id + '-container'; var resultsId = container.id + '-results'; this.container = container; this.$selection.on('focus', function (evt) { self.trigger('focus', evt); }); this.$selection.on('blur', function (evt) { self._handleBlur(evt); }); this.$selection.on('keydown', function (evt) { self.trigger('keypress', evt); if (evt.which === KEYS.SPACE) { evt.preventDefault(); } }); container.on('results:focus', function (params) { self.$selection.attr('aria-activedescendant', params.data._resultId); }); container.on('selection:update', function (params) { self.update(params.data); }); container.on('open', function () { // When the dropdown is open, aria-expanded="true" self.$selection.attr('aria-expanded', 'true'); self.$selection.attr('aria-owns', resultsId); self._attachCloseHandler(container); }); container.on('close', function () { // When the dropdown is closed, aria-expanded="false" self.$selection.attr('aria-expanded', 'false'); self.$selection.removeAttr('aria-activedescendant'); self.$selection.removeAttr('aria-owns'); self.$selection.focus(); self._detachCloseHandler(container); }); container.on('enable', function () { self.$selection.attr('tabindex', self._tabindex); }); container.on('disable', function () { self.$selection.attr('tabindex', '-1'); }); }; BaseSelection.prototype._handleBlur = function (evt) { var self = this; // This needs to be delayed as the active element is the body when the tab // key is pressed, possibly along with others. window.setTimeout(function () { // Don't trigger `blur` if the focus is still in the selection if ( (document.activeElement == self.$selection[0]) || ($.contains(self.$selection[0], document.activeElement)) ) { return; } self.trigger('blur', evt); }, 1); }; BaseSelection.prototype._attachCloseHandler = function (container) { var self = this; $(document.body).on('mousedown.select2.' + container.id, function (e) { var $target = $(e.target); var $select = $target.closest('.select2'); var $all = $('.select2.select2-container--open'); $all.each(function () { var $this = $(this); if (this == $select[0]) { return; } var $element = $this.data('element'); $element.select2('close'); }); }); }; BaseSelection.prototype._detachCloseHandler = function (container) { $(document.body).off('mousedown.select2.' + container.id); }; BaseSelection.prototype.position = function ($selection, $container) { var $selectionContainer = $container.find('.selection'); $selectionContainer.append($selection); }; BaseSelection.prototype.destroy = function () { this._detachCloseHandler(this.container); }; BaseSelection.prototype.update = function (data) { throw new Error('The `update` method must be defined in child classes.'); }; return BaseSelection; }); S2.define('select2/selection/single',[ 'jquery', './base', '../utils', '../keys' ], function ($, BaseSelection, Utils, KEYS) { function SingleSelection () { SingleSelection.__super__.constructor.apply(this, arguments); } Utils.Extend(SingleSelection, BaseSelection); SingleSelection.prototype.render = function () { var $selection = SingleSelection.__super__.render.call(this); $selection.addClass('select2-selection--single'); $selection.html( '' + '' + '' + '' ); return $selection; }; SingleSelection.prototype.bind = function (container, $container) { var self = this; SingleSelection.__super__.bind.apply(this, arguments); var id = container.id + '-container'; this.$selection.find('.select2-selection__rendered').attr('id', id); this.$selection.attr('aria-labelledby', id); this.$selection.on('mousedown', function (evt) { // Only respond to left clicks if (evt.which !== 1) { return; } self.trigger('toggle', { originalEvent: evt }); }); this.$selection.on('focus', function (evt) { // User focuses on the container }); this.$selection.on('blur', function (evt) { // User exits the container }); container.on('focus', function (evt) { if (!container.isOpen()) { self.$selection.focus(); } }); container.on('selection:update', function (params) { self.update(params.data); }); }; SingleSelection.prototype.clear = function () { this.$selection.find('.select2-selection__rendered').empty(); }; SingleSelection.prototype.display = function (data, container) { var template = this.options.get('templateSelection'); var escapeMarkup = this.options.get('escapeMarkup'); return escapeMarkup(template(data, container)); }; SingleSelection.prototype.selectionContainer = function () { return $(''); }; SingleSelection.prototype.update = function (data) { if (data.length === 0) { this.clear(); return; } var selection = data[0]; var $rendered = this.$selection.find('.select2-selection__rendered'); var formatted = this.display(selection, $rendered); $rendered.empty().append(formatted); $rendered.prop('title', selection.title || selection.text); }; return SingleSelection; }); S2.define('select2/selection/multiple',[ 'jquery', './base', '../utils' ], function ($, BaseSelection, Utils) { function MultipleSelection ($element, options) { MultipleSelection.__super__.constructor.apply(this, arguments); } Utils.Extend(MultipleSelection, BaseSelection); MultipleSelection.prototype.render = function () { var $selection = MultipleSelection.__super__.render.call(this); $selection.addClass('select2-selection--multiple'); $selection.html( '' ); return $selection; }; MultipleSelection.prototype.bind = function (container, $container) { var self = this; MultipleSelection.__super__.bind.apply(this, arguments); this.$selection.on('click', function (evt) { self.trigger('toggle', { originalEvent: evt }); }); this.$selection.on( 'click', '.select2-selection__choice__remove', function (evt) { // Ignore the event if it is disabled if (self.options.get('disabled')) { return; } var $remove = $(this); var $selection = $remove.parent(); var data = $selection.data('data'); self.trigger('unselect', { originalEvent: evt, data: data }); } ); }; MultipleSelection.prototype.clear = function () { this.$selection.find('.select2-selection__rendered').empty(); }; MultipleSelection.prototype.display = function (data, container) { var template = this.options.get('templateSelection'); var escapeMarkup = this.options.get('escapeMarkup'); return escapeMarkup(template(data, container)); }; MultipleSelection.prototype.selectionContainer = function () { var $container = $( '
  • ' + '' + '×' + '' + '
  • ' ); return $container; }; MultipleSelection.prototype.update = function (data) { this.clear(); if (data.length === 0) { return; } var $selections = []; for (var d = 0; d < data.length; d++) { var selection = data[d]; var $selection = this.selectionContainer(); var formatted = this.display(selection, $selection); $selection.append(formatted); $selection.prop('title', selection.title || selection.text); $selection.data('data', selection); $selections.push($selection); } var $rendered = this.$selection.find('.select2-selection__rendered'); Utils.appendMany($rendered, $selections); }; return MultipleSelection; }); S2.define('select2/selection/placeholder',[ '../utils' ], function (Utils) { function Placeholder (decorated, $element, options) { this.placeholder = this.normalizePlaceholder(options.get('placeholder')); decorated.call(this, $element, options); } Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { if (typeof placeholder === 'string') { placeholder = { id: '', text: placeholder }; } return placeholder; }; Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { var $placeholder = this.selectionContainer(); $placeholder.html(this.display(placeholder)); $placeholder.addClass('select2-selection__placeholder') .removeClass('select2-selection__choice'); return $placeholder; }; Placeholder.prototype.update = function (decorated, data) { var singlePlaceholder = ( data.length == 1 && data[0].id != this.placeholder.id ); var multipleSelections = data.length > 1; if (multipleSelections || singlePlaceholder) { return decorated.call(this, data); } this.clear(); var $placeholder = this.createPlaceholder(this.placeholder); this.$selection.find('.select2-selection__rendered').append($placeholder); }; return Placeholder; }); S2.define('select2/selection/allowClear',[ 'jquery', '../keys' ], function ($, KEYS) { function AllowClear () { } AllowClear.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); if (this.placeholder == null) { if (this.options.get('debug') && window.console && console.error) { console.error( 'Select2: The `allowClear` option should be used in combination ' + 'with the `placeholder` option.' ); } } this.$selection.on('mousedown', '.select2-selection__clear', function (evt) { self._handleClear(evt); }); container.on('keypress', function (evt) { self._handleKeyboardClear(evt, container); }); }; AllowClear.prototype._handleClear = function (_, evt) { // Ignore the event if it is disabled if (this.options.get('disabled')) { return; } var $clear = this.$selection.find('.select2-selection__clear'); // Ignore the event if nothing has been selected if ($clear.length === 0) { return; } evt.stopPropagation(); var data = $clear.data('data'); for (var d = 0; d < data.length; d++) { var unselectData = { data: data[d] }; // Trigger the `unselect` event, so people can prevent it from being // cleared. this.trigger('unselect', unselectData); // If the event was prevented, don't clear it out. if (unselectData.prevented) { return; } } this.$element.val(this.placeholder.id).trigger('change'); this.trigger('toggle', {}); }; AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { if (container.isOpen()) { return; } if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { this._handleClear(evt); } }; AllowClear.prototype.update = function (decorated, data) { decorated.call(this, data); if (this.$selection.find('.select2-selection__placeholder').length > 0 || data.length === 0) { return; } var $remove = $( '' + '×' + '' ); $remove.data('data', data); this.$selection.find('.select2-selection__rendered').prepend($remove); }; return AllowClear; }); S2.define('select2/selection/search',[ 'jquery', '../utils', '../keys' ], function ($, Utils, KEYS) { function Search (decorated, $element, options) { decorated.call(this, $element, options); } Search.prototype.render = function (decorated) { var $search = $( '' ); this.$searchContainer = $search; this.$search = $search.find('input'); var $rendered = decorated.call(this); this._transferTabIndex(); return $rendered; }; Search.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('open', function () { self.$search.trigger('focus'); }); container.on('close', function () { self.$search.val(''); self.$search.removeAttr('aria-activedescendant'); self.$search.trigger('focus'); }); container.on('enable', function () { self.$search.prop('disabled', false); self._transferTabIndex(); }); container.on('disable', function () { self.$search.prop('disabled', true); }); container.on('focus', function (evt) { self.$search.trigger('focus'); }); container.on('results:focus', function (params) { self.$search.attr('aria-activedescendant', params.id); }); this.$selection.on('focusin', '.select2-search--inline', function (evt) { self.trigger('focus', evt); }); this.$selection.on('focusout', '.select2-search--inline', function (evt) { self._handleBlur(evt); }); this.$selection.on('keydown', '.select2-search--inline', function (evt) { evt.stopPropagation(); self.trigger('keypress', evt); self._keyUpPrevented = evt.isDefaultPrevented(); var key = evt.which; if (key === KEYS.BACKSPACE && self.$search.val() === '') { var $previousChoice = self.$searchContainer .prev('.select2-selection__choice'); if ($previousChoice.length > 0) { var item = $previousChoice.data('data'); self.searchRemoveChoice(item); evt.preventDefault(); } } }); // Try to detect the IE version should the `documentMode` property that // is stored on the document. This is only implemented in IE and is // slightly cleaner than doing a user agent check. // This property is not available in Edge, but Edge also doesn't have // this bug. var msie = document.documentMode; var disableInputEvents = msie && msie <= 11; // Workaround for browsers which do not support the `input` event // This will prevent double-triggering of events for browsers which support // both the `keyup` and `input` events. this.$selection.on( 'input.searchcheck', '.select2-search--inline', function (evt) { // IE will trigger the `input` event when a placeholder is used on a // search box. To get around this issue, we are forced to ignore all // `input` events in IE and keep using `keyup`. if (disableInputEvents) { self.$selection.off('input.search input.searchcheck'); return; } // Unbind the duplicated `keyup` event self.$selection.off('keyup.search'); } ); this.$selection.on( 'keyup.search input.search', '.select2-search--inline', function (evt) { // IE will trigger the `input` event when a placeholder is used on a // search box. To get around this issue, we are forced to ignore all // `input` events in IE and keep using `keyup`. if (disableInputEvents && evt.type === 'input') { self.$selection.off('input.search input.searchcheck'); return; } var key = evt.which; // We can freely ignore events from modifier keys if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { return; } // Tabbing will be handled during the `keydown` phase if (key == KEYS.TAB) { return; } self.handleSearch(evt); } ); }; /** * This method will transfer the tabindex attribute from the rendered * selection to the search box. This allows for the search box to be used as * the primary focus instead of the selection container. * * @private */ Search.prototype._transferTabIndex = function (decorated) { this.$search.attr('tabindex', this.$selection.attr('tabindex')); this.$selection.attr('tabindex', '-1'); }; Search.prototype.createPlaceholder = function (decorated, placeholder) { this.$search.attr('placeholder', placeholder.text); }; Search.prototype.update = function (decorated, data) { var searchHadFocus = this.$search[0] == document.activeElement; this.$search.attr('placeholder', ''); decorated.call(this, data); this.$selection.find('.select2-selection__rendered') .append(this.$searchContainer); this.resizeSearch(); if (searchHadFocus) { this.$search.focus(); } }; Search.prototype.handleSearch = function () { this.resizeSearch(); if (!this._keyUpPrevented) { var input = this.$search.val(); this.trigger('query', { term: input }); } this._keyUpPrevented = false; }; Search.prototype.searchRemoveChoice = function (decorated, item) { this.trigger('unselect', { data: item }); this.$search.val(item.text); this.handleSearch(); }; Search.prototype.resizeSearch = function () { this.$search.css('width', '25px'); var width = ''; if (this.$search.attr('placeholder') !== '') { width = this.$selection.find('.select2-selection__rendered').innerWidth(); } else { var minimumWidth = this.$search.val().length + 1; width = (minimumWidth * 0.75) + 'em'; } this.$search.css('width', width); }; return Search; }); S2.define('select2/selection/eventRelay',[ 'jquery' ], function ($) { function EventRelay () { } EventRelay.prototype.bind = function (decorated, container, $container) { var self = this; var relayEvents = [ 'open', 'opening', 'close', 'closing', 'select', 'selecting', 'unselect', 'unselecting' ]; var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting']; decorated.call(this, container, $container); container.on('*', function (name, params) { // Ignore events that should not be relayed if ($.inArray(name, relayEvents) === -1) { return; } // The parameters should always be an object params = params || {}; // Generate the jQuery event for the Select2 event var evt = $.Event('select2:' + name, { params: params }); self.$element.trigger(evt); // Only handle preventable events if it was one if ($.inArray(name, preventableEvents) === -1) { return; } params.prevented = evt.isDefaultPrevented(); }); }; return EventRelay; }); S2.define('select2/translation',[ 'jquery', 'require' ], function ($, require) { function Translation (dict) { this.dict = dict || {}; } Translation.prototype.all = function () { return this.dict; }; Translation.prototype.get = function (key) { return this.dict[key]; }; Translation.prototype.extend = function (translation) { this.dict = $.extend({}, translation.all(), this.dict); }; // Static functions Translation._cache = {}; Translation.loadPath = function (path) { if (!(path in Translation._cache)) { var translations = require(path); Translation._cache[path] = translations; } return new Translation(Translation._cache[path]); }; return Translation; }); S2.define('select2/diacritics',[ ], function () { var diacritics = { '\u24B6': 'A', '\uFF21': 'A', '\u00C0': 'A', '\u00C1': 'A', '\u00C2': 'A', '\u1EA6': 'A', '\u1EA4': 'A', '\u1EAA': 'A', '\u1EA8': 'A', '\u00C3': 'A', '\u0100': 'A', '\u0102': 'A', '\u1EB0': 'A', '\u1EAE': 'A', '\u1EB4': 'A', '\u1EB2': 'A', '\u0226': 'A', '\u01E0': 'A', '\u00C4': 'A', '\u01DE': 'A', '\u1EA2': 'A', '\u00C5': 'A', '\u01FA': 'A', '\u01CD': 'A', '\u0200': 'A', '\u0202': 'A', '\u1EA0': 'A', '\u1EAC': 'A', '\u1EB6': 'A', '\u1E00': 'A', '\u0104': 'A', '\u023A': 'A', '\u2C6F': 'A', '\uA732': 'AA', '\u00C6': 'AE', '\u01FC': 'AE', '\u01E2': 'AE', '\uA734': 'AO', '\uA736': 'AU', '\uA738': 'AV', '\uA73A': 'AV', '\uA73C': 'AY', '\u24B7': 'B', '\uFF22': 'B', '\u1E02': 'B', '\u1E04': 'B', '\u1E06': 'B', '\u0243': 'B', '\u0182': 'B', '\u0181': 'B', '\u24B8': 'C', '\uFF23': 'C', '\u0106': 'C', '\u0108': 'C', '\u010A': 'C', '\u010C': 'C', '\u00C7': 'C', '\u1E08': 'C', '\u0187': 'C', '\u023B': 'C', '\uA73E': 'C', '\u24B9': 'D', '\uFF24': 'D', '\u1E0A': 'D', '\u010E': 'D', '\u1E0C': 'D', '\u1E10': 'D', '\u1E12': 'D', '\u1E0E': 'D', '\u0110': 'D', '\u018B': 'D', '\u018A': 'D', '\u0189': 'D', '\uA779': 'D', '\u01F1': 'DZ', '\u01C4': 'DZ', '\u01F2': 'Dz', '\u01C5': 'Dz', '\u24BA': 'E', '\uFF25': 'E', '\u00C8': 'E', '\u00C9': 'E', '\u00CA': 'E', '\u1EC0': 'E', '\u1EBE': 'E', '\u1EC4': 'E', '\u1EC2': 'E', '\u1EBC': 'E', '\u0112': 'E', '\u1E14': 'E', '\u1E16': 'E', '\u0114': 'E', '\u0116': 'E', '\u00CB': 'E', '\u1EBA': 'E', '\u011A': 'E', '\u0204': 'E', '\u0206': 'E', '\u1EB8': 'E', '\u1EC6': 'E', '\u0228': 'E', '\u1E1C': 'E', '\u0118': 'E', '\u1E18': 'E', '\u1E1A': 'E', '\u0190': 'E', '\u018E': 'E', '\u24BB': 'F', '\uFF26': 'F', '\u1E1E': 'F', '\u0191': 'F', '\uA77B': 'F', '\u24BC': 'G', '\uFF27': 'G', '\u01F4': 'G', '\u011C': 'G', '\u1E20': 'G', '\u011E': 'G', '\u0120': 'G', '\u01E6': 'G', '\u0122': 'G', '\u01E4': 'G', '\u0193': 'G', '\uA7A0': 'G', '\uA77D': 'G', '\uA77E': 'G', '\u24BD': 'H', '\uFF28': 'H', '\u0124': 'H', '\u1E22': 'H', '\u1E26': 'H', '\u021E': 'H', '\u1E24': 'H', '\u1E28': 'H', '\u1E2A': 'H', '\u0126': 'H', '\u2C67': 'H', '\u2C75': 'H', '\uA78D': 'H', '\u24BE': 'I', '\uFF29': 'I', '\u00CC': 'I', '\u00CD': 'I', '\u00CE': 'I', '\u0128': 'I', '\u012A': 'I', '\u012C': 'I', '\u0130': 'I', '\u00CF': 'I', '\u1E2E': 'I', '\u1EC8': 'I', '\u01CF': 'I', '\u0208': 'I', '\u020A': 'I', '\u1ECA': 'I', '\u012E': 'I', '\u1E2C': 'I', '\u0197': 'I', '\u24BF': 'J', '\uFF2A': 'J', '\u0134': 'J', '\u0248': 'J', '\u24C0': 'K', '\uFF2B': 'K', '\u1E30': 'K', '\u01E8': 'K', '\u1E32': 'K', '\u0136': 'K', '\u1E34': 'K', '\u0198': 'K', '\u2C69': 'K', '\uA740': 'K', '\uA742': 'K', '\uA744': 'K', '\uA7A2': 'K', '\u24C1': 'L', '\uFF2C': 'L', '\u013F': 'L', '\u0139': 'L', '\u013D': 'L', '\u1E36': 'L', '\u1E38': 'L', '\u013B': 'L', '\u1E3C': 'L', '\u1E3A': 'L', '\u0141': 'L', '\u023D': 'L', '\u2C62': 'L', '\u2C60': 'L', '\uA748': 'L', '\uA746': 'L', '\uA780': 'L', '\u01C7': 'LJ', '\u01C8': 'Lj', '\u24C2': 'M', '\uFF2D': 'M', '\u1E3E': 'M', '\u1E40': 'M', '\u1E42': 'M', '\u2C6E': 'M', '\u019C': 'M', '\u24C3': 'N', '\uFF2E': 'N', '\u01F8': 'N', '\u0143': 'N', '\u00D1': 'N', '\u1E44': 'N', '\u0147': 'N', '\u1E46': 'N', '\u0145': 'N', '\u1E4A': 'N', '\u1E48': 'N', '\u0220': 'N', '\u019D': 'N', '\uA790': 'N', '\uA7A4': 'N', '\u01CA': 'NJ', '\u01CB': 'Nj', '\u24C4': 'O', '\uFF2F': 'O', '\u00D2': 'O', '\u00D3': 'O', '\u00D4': 'O', '\u1ED2': 'O', '\u1ED0': 'O', '\u1ED6': 'O', '\u1ED4': 'O', '\u00D5': 'O', '\u1E4C': 'O', '\u022C': 'O', '\u1E4E': 'O', '\u014C': 'O', '\u1E50': 'O', '\u1E52': 'O', '\u014E': 'O', '\u022E': 'O', '\u0230': 'O', '\u00D6': 'O', '\u022A': 'O', '\u1ECE': 'O', '\u0150': 'O', '\u01D1': 'O', '\u020C': 'O', '\u020E': 'O', '\u01A0': 'O', '\u1EDC': 'O', '\u1EDA': 'O', '\u1EE0': 'O', '\u1EDE': 'O', '\u1EE2': 'O', '\u1ECC': 'O', '\u1ED8': 'O', '\u01EA': 'O', '\u01EC': 'O', '\u00D8': 'O', '\u01FE': 'O', '\u0186': 'O', '\u019F': 'O', '\uA74A': 'O', '\uA74C': 'O', '\u01A2': 'OI', '\uA74E': 'OO', '\u0222': 'OU', '\u24C5': 'P', '\uFF30': 'P', '\u1E54': 'P', '\u1E56': 'P', '\u01A4': 'P', '\u2C63': 'P', '\uA750': 'P', '\uA752': 'P', '\uA754': 'P', '\u24C6': 'Q', '\uFF31': 'Q', '\uA756': 'Q', '\uA758': 'Q', '\u024A': 'Q', '\u24C7': 'R', '\uFF32': 'R', '\u0154': 'R', '\u1E58': 'R', '\u0158': 'R', '\u0210': 'R', '\u0212': 'R', '\u1E5A': 'R', '\u1E5C': 'R', '\u0156': 'R', '\u1E5E': 'R', '\u024C': 'R', '\u2C64': 'R', '\uA75A': 'R', '\uA7A6': 'R', '\uA782': 'R', '\u24C8': 'S', '\uFF33': 'S', '\u1E9E': 'S', '\u015A': 'S', '\u1E64': 'S', '\u015C': 'S', '\u1E60': 'S', '\u0160': 'S', '\u1E66': 'S', '\u1E62': 'S', '\u1E68': 'S', '\u0218': 'S', '\u015E': 'S', '\u2C7E': 'S', '\uA7A8': 'S', '\uA784': 'S', '\u24C9': 'T', '\uFF34': 'T', '\u1E6A': 'T', '\u0164': 'T', '\u1E6C': 'T', '\u021A': 'T', '\u0162': 'T', '\u1E70': 'T', '\u1E6E': 'T', '\u0166': 'T', '\u01AC': 'T', '\u01AE': 'T', '\u023E': 'T', '\uA786': 'T', '\uA728': 'TZ', '\u24CA': 'U', '\uFF35': 'U', '\u00D9': 'U', '\u00DA': 'U', '\u00DB': 'U', '\u0168': 'U', '\u1E78': 'U', '\u016A': 'U', '\u1E7A': 'U', '\u016C': 'U', '\u00DC': 'U', '\u01DB': 'U', '\u01D7': 'U', '\u01D5': 'U', '\u01D9': 'U', '\u1EE6': 'U', '\u016E': 'U', '\u0170': 'U', '\u01D3': 'U', '\u0214': 'U', '\u0216': 'U', '\u01AF': 'U', '\u1EEA': 'U', '\u1EE8': 'U', '\u1EEE': 'U', '\u1EEC': 'U', '\u1EF0': 'U', '\u1EE4': 'U', '\u1E72': 'U', '\u0172': 'U', '\u1E76': 'U', '\u1E74': 'U', '\u0244': 'U', '\u24CB': 'V', '\uFF36': 'V', '\u1E7C': 'V', '\u1E7E': 'V', '\u01B2': 'V', '\uA75E': 'V', '\u0245': 'V', '\uA760': 'VY', '\u24CC': 'W', '\uFF37': 'W', '\u1E80': 'W', '\u1E82': 'W', '\u0174': 'W', '\u1E86': 'W', '\u1E84': 'W', '\u1E88': 'W', '\u2C72': 'W', '\u24CD': 'X', '\uFF38': 'X', '\u1E8A': 'X', '\u1E8C': 'X', '\u24CE': 'Y', '\uFF39': 'Y', '\u1EF2': 'Y', '\u00DD': 'Y', '\u0176': 'Y', '\u1EF8': 'Y', '\u0232': 'Y', '\u1E8E': 'Y', '\u0178': 'Y', '\u1EF6': 'Y', '\u1EF4': 'Y', '\u01B3': 'Y', '\u024E': 'Y', '\u1EFE': 'Y', '\u24CF': 'Z', '\uFF3A': 'Z', '\u0179': 'Z', '\u1E90': 'Z', '\u017B': 'Z', '\u017D': 'Z', '\u1E92': 'Z', '\u1E94': 'Z', '\u01B5': 'Z', '\u0224': 'Z', '\u2C7F': 'Z', '\u2C6B': 'Z', '\uA762': 'Z', '\u24D0': 'a', '\uFF41': 'a', '\u1E9A': 'a', '\u00E0': 'a', '\u00E1': 'a', '\u00E2': 'a', '\u1EA7': 'a', '\u1EA5': 'a', '\u1EAB': 'a', '\u1EA9': 'a', '\u00E3': 'a', '\u0101': 'a', '\u0103': 'a', '\u1EB1': 'a', '\u1EAF': 'a', '\u1EB5': 'a', '\u1EB3': 'a', '\u0227': 'a', '\u01E1': 'a', '\u00E4': 'a', '\u01DF': 'a', '\u1EA3': 'a', '\u00E5': 'a', '\u01FB': 'a', '\u01CE': 'a', '\u0201': 'a', '\u0203': 'a', '\u1EA1': 'a', '\u1EAD': 'a', '\u1EB7': 'a', '\u1E01': 'a', '\u0105': 'a', '\u2C65': 'a', '\u0250': 'a', '\uA733': 'aa', '\u00E6': 'ae', '\u01FD': 'ae', '\u01E3': 'ae', '\uA735': 'ao', '\uA737': 'au', '\uA739': 'av', '\uA73B': 'av', '\uA73D': 'ay', '\u24D1': 'b', '\uFF42': 'b', '\u1E03': 'b', '\u1E05': 'b', '\u1E07': 'b', '\u0180': 'b', '\u0183': 'b', '\u0253': 'b', '\u24D2': 'c', '\uFF43': 'c', '\u0107': 'c', '\u0109': 'c', '\u010B': 'c', '\u010D': 'c', '\u00E7': 'c', '\u1E09': 'c', '\u0188': 'c', '\u023C': 'c', '\uA73F': 'c', '\u2184': 'c', '\u24D3': 'd', '\uFF44': 'd', '\u1E0B': 'd', '\u010F': 'd', '\u1E0D': 'd', '\u1E11': 'd', '\u1E13': 'd', '\u1E0F': 'd', '\u0111': 'd', '\u018C': 'd', '\u0256': 'd', '\u0257': 'd', '\uA77A': 'd', '\u01F3': 'dz', '\u01C6': 'dz', '\u24D4': 'e', '\uFF45': 'e', '\u00E8': 'e', '\u00E9': 'e', '\u00EA': 'e', '\u1EC1': 'e', '\u1EBF': 'e', '\u1EC5': 'e', '\u1EC3': 'e', '\u1EBD': 'e', '\u0113': 'e', '\u1E15': 'e', '\u1E17': 'e', '\u0115': 'e', '\u0117': 'e', '\u00EB': 'e', '\u1EBB': 'e', '\u011B': 'e', '\u0205': 'e', '\u0207': 'e', '\u1EB9': 'e', '\u1EC7': 'e', '\u0229': 'e', '\u1E1D': 'e', '\u0119': 'e', '\u1E19': 'e', '\u1E1B': 'e', '\u0247': 'e', '\u025B': 'e', '\u01DD': 'e', '\u24D5': 'f', '\uFF46': 'f', '\u1E1F': 'f', '\u0192': 'f', '\uA77C': 'f', '\u24D6': 'g', '\uFF47': 'g', '\u01F5': 'g', '\u011D': 'g', '\u1E21': 'g', '\u011F': 'g', '\u0121': 'g', '\u01E7': 'g', '\u0123': 'g', '\u01E5': 'g', '\u0260': 'g', '\uA7A1': 'g', '\u1D79': 'g', '\uA77F': 'g', '\u24D7': 'h', '\uFF48': 'h', '\u0125': 'h', '\u1E23': 'h', '\u1E27': 'h', '\u021F': 'h', '\u1E25': 'h', '\u1E29': 'h', '\u1E2B': 'h', '\u1E96': 'h', '\u0127': 'h', '\u2C68': 'h', '\u2C76': 'h', '\u0265': 'h', '\u0195': 'hv', '\u24D8': 'i', '\uFF49': 'i', '\u00EC': 'i', '\u00ED': 'i', '\u00EE': 'i', '\u0129': 'i', '\u012B': 'i', '\u012D': 'i', '\u00EF': 'i', '\u1E2F': 'i', '\u1EC9': 'i', '\u01D0': 'i', '\u0209': 'i', '\u020B': 'i', '\u1ECB': 'i', '\u012F': 'i', '\u1E2D': 'i', '\u0268': 'i', '\u0131': 'i', '\u24D9': 'j', '\uFF4A': 'j', '\u0135': 'j', '\u01F0': 'j', '\u0249': 'j', '\u24DA': 'k', '\uFF4B': 'k', '\u1E31': 'k', '\u01E9': 'k', '\u1E33': 'k', '\u0137': 'k', '\u1E35': 'k', '\u0199': 'k', '\u2C6A': 'k', '\uA741': 'k', '\uA743': 'k', '\uA745': 'k', '\uA7A3': 'k', '\u24DB': 'l', '\uFF4C': 'l', '\u0140': 'l', '\u013A': 'l', '\u013E': 'l', '\u1E37': 'l', '\u1E39': 'l', '\u013C': 'l', '\u1E3D': 'l', '\u1E3B': 'l', '\u017F': 'l', '\u0142': 'l', '\u019A': 'l', '\u026B': 'l', '\u2C61': 'l', '\uA749': 'l', '\uA781': 'l', '\uA747': 'l', '\u01C9': 'lj', '\u24DC': 'm', '\uFF4D': 'm', '\u1E3F': 'm', '\u1E41': 'm', '\u1E43': 'm', '\u0271': 'm', '\u026F': 'm', '\u24DD': 'n', '\uFF4E': 'n', '\u01F9': 'n', '\u0144': 'n', '\u00F1': 'n', '\u1E45': 'n', '\u0148': 'n', '\u1E47': 'n', '\u0146': 'n', '\u1E4B': 'n', '\u1E49': 'n', '\u019E': 'n', '\u0272': 'n', '\u0149': 'n', '\uA791': 'n', '\uA7A5': 'n', '\u01CC': 'nj', '\u24DE': 'o', '\uFF4F': 'o', '\u00F2': 'o', '\u00F3': 'o', '\u00F4': 'o', '\u1ED3': 'o', '\u1ED1': 'o', '\u1ED7': 'o', '\u1ED5': 'o', '\u00F5': 'o', '\u1E4D': 'o', '\u022D': 'o', '\u1E4F': 'o', '\u014D': 'o', '\u1E51': 'o', '\u1E53': 'o', '\u014F': 'o', '\u022F': 'o', '\u0231': 'o', '\u00F6': 'o', '\u022B': 'o', '\u1ECF': 'o', '\u0151': 'o', '\u01D2': 'o', '\u020D': 'o', '\u020F': 'o', '\u01A1': 'o', '\u1EDD': 'o', '\u1EDB': 'o', '\u1EE1': 'o', '\u1EDF': 'o', '\u1EE3': 'o', '\u1ECD': 'o', '\u1ED9': 'o', '\u01EB': 'o', '\u01ED': 'o', '\u00F8': 'o', '\u01FF': 'o', '\u0254': 'o', '\uA74B': 'o', '\uA74D': 'o', '\u0275': 'o', '\u01A3': 'oi', '\u0223': 'ou', '\uA74F': 'oo', '\u24DF': 'p', '\uFF50': 'p', '\u1E55': 'p', '\u1E57': 'p', '\u01A5': 'p', '\u1D7D': 'p', '\uA751': 'p', '\uA753': 'p', '\uA755': 'p', '\u24E0': 'q', '\uFF51': 'q', '\u024B': 'q', '\uA757': 'q', '\uA759': 'q', '\u24E1': 'r', '\uFF52': 'r', '\u0155': 'r', '\u1E59': 'r', '\u0159': 'r', '\u0211': 'r', '\u0213': 'r', '\u1E5B': 'r', '\u1E5D': 'r', '\u0157': 'r', '\u1E5F': 'r', '\u024D': 'r', '\u027D': 'r', '\uA75B': 'r', '\uA7A7': 'r', '\uA783': 'r', '\u24E2': 's', '\uFF53': 's', '\u00DF': 's', '\u015B': 's', '\u1E65': 's', '\u015D': 's', '\u1E61': 's', '\u0161': 's', '\u1E67': 's', '\u1E63': 's', '\u1E69': 's', '\u0219': 's', '\u015F': 's', '\u023F': 's', '\uA7A9': 's', '\uA785': 's', '\u1E9B': 's', '\u24E3': 't', '\uFF54': 't', '\u1E6B': 't', '\u1E97': 't', '\u0165': 't', '\u1E6D': 't', '\u021B': 't', '\u0163': 't', '\u1E71': 't', '\u1E6F': 't', '\u0167': 't', '\u01AD': 't', '\u0288': 't', '\u2C66': 't', '\uA787': 't', '\uA729': 'tz', '\u24E4': 'u', '\uFF55': 'u', '\u00F9': 'u', '\u00FA': 'u', '\u00FB': 'u', '\u0169': 'u', '\u1E79': 'u', '\u016B': 'u', '\u1E7B': 'u', '\u016D': 'u', '\u00FC': 'u', '\u01DC': 'u', '\u01D8': 'u', '\u01D6': 'u', '\u01DA': 'u', '\u1EE7': 'u', '\u016F': 'u', '\u0171': 'u', '\u01D4': 'u', '\u0215': 'u', '\u0217': 'u', '\u01B0': 'u', '\u1EEB': 'u', '\u1EE9': 'u', '\u1EEF': 'u', '\u1EED': 'u', '\u1EF1': 'u', '\u1EE5': 'u', '\u1E73': 'u', '\u0173': 'u', '\u1E77': 'u', '\u1E75': 'u', '\u0289': 'u', '\u24E5': 'v', '\uFF56': 'v', '\u1E7D': 'v', '\u1E7F': 'v', '\u028B': 'v', '\uA75F': 'v', '\u028C': 'v', '\uA761': 'vy', '\u24E6': 'w', '\uFF57': 'w', '\u1E81': 'w', '\u1E83': 'w', '\u0175': 'w', '\u1E87': 'w', '\u1E85': 'w', '\u1E98': 'w', '\u1E89': 'w', '\u2C73': 'w', '\u24E7': 'x', '\uFF58': 'x', '\u1E8B': 'x', '\u1E8D': 'x', '\u24E8': 'y', '\uFF59': 'y', '\u1EF3': 'y', '\u00FD': 'y', '\u0177': 'y', '\u1EF9': 'y', '\u0233': 'y', '\u1E8F': 'y', '\u00FF': 'y', '\u1EF7': 'y', '\u1E99': 'y', '\u1EF5': 'y', '\u01B4': 'y', '\u024F': 'y', '\u1EFF': 'y', '\u24E9': 'z', '\uFF5A': 'z', '\u017A': 'z', '\u1E91': 'z', '\u017C': 'z', '\u017E': 'z', '\u1E93': 'z', '\u1E95': 'z', '\u01B6': 'z', '\u0225': 'z', '\u0240': 'z', '\u2C6C': 'z', '\uA763': 'z', '\u0386': '\u0391', '\u0388': '\u0395', '\u0389': '\u0397', '\u038A': '\u0399', '\u03AA': '\u0399', '\u038C': '\u039F', '\u038E': '\u03A5', '\u03AB': '\u03A5', '\u038F': '\u03A9', '\u03AC': '\u03B1', '\u03AD': '\u03B5', '\u03AE': '\u03B7', '\u03AF': '\u03B9', '\u03CA': '\u03B9', '\u0390': '\u03B9', '\u03CC': '\u03BF', '\u03CD': '\u03C5', '\u03CB': '\u03C5', '\u03B0': '\u03C5', '\u03C9': '\u03C9', '\u03C2': '\u03C3' }; return diacritics; }); S2.define('select2/data/base',[ '../utils' ], function (Utils) { function BaseAdapter ($element, options) { BaseAdapter.__super__.constructor.call(this); } Utils.Extend(BaseAdapter, Utils.Observable); BaseAdapter.prototype.current = function (callback) { throw new Error('The `current` method must be defined in child classes.'); }; BaseAdapter.prototype.query = function (params, callback) { throw new Error('The `query` method must be defined in child classes.'); }; BaseAdapter.prototype.bind = function (container, $container) { // Can be implemented in subclasses }; BaseAdapter.prototype.destroy = function () { // Can be implemented in subclasses }; BaseAdapter.prototype.generateResultId = function (container, data) { var id = container.id + '-result-'; id += Utils.generateChars(4); if (data.id != null) { id += '-' + data.id.toString(); } else { id += '-' + Utils.generateChars(4); } return id; }; return BaseAdapter; }); S2.define('select2/data/select',[ './base', '../utils', 'jquery' ], function (BaseAdapter, Utils, $) { function SelectAdapter ($element, options) { this.$element = $element; this.options = options; SelectAdapter.__super__.constructor.call(this); } Utils.Extend(SelectAdapter, BaseAdapter); SelectAdapter.prototype.current = function (callback) { var data = []; var self = this; this.$element.find(':selected').each(function () { var $option = $(this); var option = self.item($option); data.push(option); }); callback(data); }; SelectAdapter.prototype.select = function (data) { var self = this; data.selected = true; // If data.element is a DOM node, use it instead if ($(data.element).is('option')) { data.element.selected = true; this.$element.trigger('change'); return; } if (this.$element.prop('multiple')) { this.current(function (currentData) { var val = []; data = [data]; data.push.apply(data, currentData); for (var d = 0; d < data.length; d++) { var id = data[d].id; if ($.inArray(id, val) === -1) { val.push(id); } } self.$element.val(val); self.$element.trigger('change'); }); } else { var val = data.id; this.$element.val(val); this.$element.trigger('change'); } }; SelectAdapter.prototype.unselect = function (data) { var self = this; if (!this.$element.prop('multiple')) { return; } data.selected = false; if ($(data.element).is('option')) { data.element.selected = false; this.$element.trigger('change'); return; } this.current(function (currentData) { var val = []; for (var d = 0; d < currentData.length; d++) { var id = currentData[d].id; if (id !== data.id && $.inArray(id, val) === -1) { val.push(id); } } self.$element.val(val); self.$element.trigger('change'); }); }; SelectAdapter.prototype.bind = function (container, $container) { var self = this; this.container = container; container.on('select', function (params) { self.select(params.data); }); container.on('unselect', function (params) { self.unselect(params.data); }); }; SelectAdapter.prototype.destroy = function () { // Remove anything added to child elements this.$element.find('*').each(function () { // Remove any custom data set by Select2 $.removeData(this, 'data'); }); }; SelectAdapter.prototype.query = function (params, callback) { var data = []; var self = this; var $options = this.$element.children(); $options.each(function () { var $option = $(this); if (!$option.is('option') && !$option.is('optgroup')) { return; } var option = self.item($option); var matches = self.matches(params, option); if (matches !== null) { data.push(matches); } }); callback({ results: data }); }; SelectAdapter.prototype.addOptions = function ($options) { Utils.appendMany(this.$element, $options); }; SelectAdapter.prototype.option = function (data) { var option; if (data.children) { option = document.createElement('optgroup'); option.label = data.text; } else { option = document.createElement('option'); if (option.textContent !== undefined) { option.textContent = data.text; } else { option.innerText = data.text; } } if (data.id !== undefined) { option.value = data.id; } if (data.disabled) { option.disabled = true; } if (data.selected) { option.selected = true; } if (data.title) { option.title = data.title; } var $option = $(option); var normalizedData = this._normalizeItem(data); normalizedData.element = option; // Override the option's data with the combined data $.data(option, 'data', normalizedData); return $option; }; SelectAdapter.prototype.item = function ($option) { var data = {}; data = $.data($option[0], 'data'); if (data != null) { return data; } if ($option.is('option')) { data = { id: $option.val(), text: $option.text(), disabled: $option.prop('disabled'), selected: $option.prop('selected'), title: $option.prop('title') }; } else if ($option.is('optgroup')) { data = { text: $option.prop('label'), children: [], title: $option.prop('title') }; var $children = $option.children('option'); var children = []; for (var c = 0; c < $children.length; c++) { var $child = $($children[c]); var child = this.item($child); children.push(child); } data.children = children; } data = this._normalizeItem(data); data.element = $option[0]; $.data($option[0], 'data', data); return data; }; SelectAdapter.prototype._normalizeItem = function (item) { if (!$.isPlainObject(item)) { item = { id: item, text: item }; } item = $.extend({}, { text: '' }, item); var defaults = { selected: false, disabled: false }; if (item.id != null) { item.id = item.id.toString(); } if (item.text != null) { item.text = item.text.toString(); } if (item._resultId == null && item.id && this.container != null) { item._resultId = this.generateResultId(this.container, item); } return $.extend({}, defaults, item); }; SelectAdapter.prototype.matches = function (params, data) { var matcher = this.options.get('matcher'); return matcher(params, data); }; return SelectAdapter; }); S2.define('select2/data/array',[ './select', '../utils', 'jquery' ], function (SelectAdapter, Utils, $) { function ArrayAdapter ($element, options) { var data = options.get('data') || []; ArrayAdapter.__super__.constructor.call(this, $element, options); this.addOptions(this.convertToOptions(data)); } Utils.Extend(ArrayAdapter, SelectAdapter); ArrayAdapter.prototype.select = function (data) { var $option = this.$element.find('option').filter(function (i, elm) { return elm.value == data.id.toString(); }); if ($option.length === 0) { $option = this.option(data); this.addOptions($option); } ArrayAdapter.__super__.select.call(this, data); }; ArrayAdapter.prototype.convertToOptions = function (data) { var self = this; var $existing = this.$element.find('option'); var existingIds = $existing.map(function () { return self.item($(this)).id; }).get(); var $options = []; // Filter out all items except for the one passed in the argument function onlyItem (item) { return function () { return $(this).val() == item.id; }; } for (var d = 0; d < data.length; d++) { var item = this._normalizeItem(data[d]); // Skip items which were pre-loaded, only merge the data if ($.inArray(item.id, existingIds) >= 0) { var $existingOption = $existing.filter(onlyItem(item)); var existingData = this.item($existingOption); var newData = $.extend(true, {}, item, existingData); var $newOption = this.option(newData); $existingOption.replaceWith($newOption); continue; } var $option = this.option(item); if (item.children) { var $children = this.convertToOptions(item.children); Utils.appendMany($option, $children); } $options.push($option); } return $options; }; return ArrayAdapter; }); S2.define('select2/data/ajax',[ './array', '../utils', 'jquery' ], function (ArrayAdapter, Utils, $) { function AjaxAdapter ($element, options) { this.ajaxOptions = this._applyDefaults(options.get('ajax')); if (this.ajaxOptions.processResults != null) { this.processResults = this.ajaxOptions.processResults; } AjaxAdapter.__super__.constructor.call(this, $element, options); } Utils.Extend(AjaxAdapter, ArrayAdapter); AjaxAdapter.prototype._applyDefaults = function (options) { var defaults = { data: function (params) { return $.extend({}, params, { q: params.term }); }, transport: function (params, success, failure) { var $request = $.ajax(params); $request.then(success); $request.fail(failure); return $request; } }; return $.extend({}, defaults, options, true); }; AjaxAdapter.prototype.processResults = function (results) { return results; }; AjaxAdapter.prototype.query = function (params, callback) { var matches = []; var self = this; if (this._request != null) { // JSONP requests cannot always be aborted if ($.isFunction(this._request.abort)) { this._request.abort(); } this._request = null; } var options = $.extend({ type: 'GET' }, this.ajaxOptions); if (typeof options.url === 'function') { options.url = options.url.call(this.$element, params); } if (typeof options.data === 'function') { options.data = options.data.call(this.$element, params); } function request () { var $request = options.transport(options, function (data) { var results = self.processResults(data, params); if (self.options.get('debug') && window.console && console.error) { // Check to make sure that the response included a `results` key. if (!results || !results.results || !$.isArray(results.results)) { console.error( 'Select2: The AJAX results did not return an array in the ' + '`results` key of the response.' ); } } callback(results); }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property if ($request.status && $request.status === '0') { return; } self.trigger('results:message', { message: 'errorLoading' }); }); self._request = $request; } if (this.ajaxOptions.delay && params.term != null) { if (this._queryTimeout) { window.clearTimeout(this._queryTimeout); } this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); } else { request(); } }; return AjaxAdapter; }); S2.define('select2/data/tags',[ 'jquery' ], function ($) { function Tags (decorated, $element, options) { var tags = options.get('tags'); var createTag = options.get('createTag'); if (createTag !== undefined) { this.createTag = createTag; } var insertTag = options.get('insertTag'); if (insertTag !== undefined) { this.insertTag = insertTag; } decorated.call(this, $element, options); if ($.isArray(tags)) { for (var t = 0; t < tags.length; t++) { var tag = tags[t]; var item = this._normalizeItem(tag); var $option = this.option(item); this.$element.append($option); } } } Tags.prototype.query = function (decorated, params, callback) { var self = this; this._removeOldTags(); if (params.term == null || params.page != null) { decorated.call(this, params, callback); return; } function wrapper (obj, child) { var data = obj.results; for (var i = 0; i < data.length; i++) { var option = data[i]; var checkChildren = ( option.children != null && !wrapper({ results: option.children }, true) ); var optionText = (option.text || '').toUpperCase(); var paramsTerm = (params.term || '').toUpperCase(); var checkText = optionText === paramsTerm; if (checkText || checkChildren) { if (child) { return false; } obj.data = data; callback(obj); return; } } if (child) { return true; } var tag = self.createTag(params); if (tag != null) { var $option = self.option(tag); $option.attr('data-select2-tag', true); self.addOptions([$option]); self.insertTag(data, tag); } obj.results = data; callback(obj); } decorated.call(this, params, wrapper); }; Tags.prototype.createTag = function (decorated, params) { var term = $.trim(params.term); if (term === '') { return null; } return { id: term, text: term }; }; Tags.prototype.insertTag = function (_, data, tag) { data.unshift(tag); }; Tags.prototype._removeOldTags = function (_) { var tag = this._lastTag; var $options = this.$element.find('option[data-select2-tag]'); $options.each(function () { if (this.selected) { return; } $(this).remove(); }); }; return Tags; }); S2.define('select2/data/tokenizer',[ 'jquery' ], function ($) { function Tokenizer (decorated, $element, options) { var tokenizer = options.get('tokenizer'); if (tokenizer !== undefined) { this.tokenizer = tokenizer; } decorated.call(this, $element, options); } Tokenizer.prototype.bind = function (decorated, container, $container) { decorated.call(this, container, $container); this.$search = container.dropdown.$search || container.selection.$search || $container.find('.select2-search__field'); }; Tokenizer.prototype.query = function (decorated, params, callback) { var self = this; function createAndSelect (data) { // Normalize the data object so we can use it for checks var item = self._normalizeItem(data); // Check if the data object already exists as a tag // Select it if it doesn't var $existingOptions = self.$element.find('option').filter(function () { return $(this).val() === item.id; }); // If an existing option wasn't found for it, create the option if (!$existingOptions.length) { var $option = self.option(item); $option.attr('data-select2-tag', true); self._removeOldTags(); self.addOptions([$option]); } // Select the item, now that we know there is an option for it select(item); } function select (data) { self.trigger('select', { data: data }); } params.term = params.term || ''; var tokenData = this.tokenizer(params, this.options, createAndSelect); if (tokenData.term !== params.term) { // Replace the search term if we have the search box if (this.$search.length) { this.$search.val(tokenData.term); this.$search.focus(); } params.term = tokenData.term; } decorated.call(this, params, callback); }; Tokenizer.prototype.tokenizer = function (_, params, options, callback) { var separators = options.get('tokenSeparators') || []; var term = params.term; var i = 0; var createTag = this.createTag || function (params) { return { id: params.term, text: params.term }; }; while (i < term.length) { var termChar = term[i]; if ($.inArray(termChar, separators) === -1) { i++; continue; } var part = term.substr(0, i); var partParams = $.extend({}, params, { term: part }); var data = createTag(partParams); if (data == null) { i++; continue; } callback(data); // Reset the term to not include the tokenized portion term = term.substr(i + 1) || ''; i = 0; } return { term: term }; }; return Tokenizer; }); S2.define('select2/data/minimumInputLength',[ ], function () { function MinimumInputLength (decorated, $e, options) { this.minimumInputLength = options.get('minimumInputLength'); decorated.call(this, $e, options); } MinimumInputLength.prototype.query = function (decorated, params, callback) { params.term = params.term || ''; if (params.term.length < this.minimumInputLength) { this.trigger('results:message', { message: 'inputTooShort', args: { minimum: this.minimumInputLength, input: params.term, params: params } }); return; } decorated.call(this, params, callback); }; return MinimumInputLength; }); S2.define('select2/data/maximumInputLength',[ ], function () { function MaximumInputLength (decorated, $e, options) { this.maximumInputLength = options.get('maximumInputLength'); decorated.call(this, $e, options); } MaximumInputLength.prototype.query = function (decorated, params, callback) { params.term = params.term || ''; if (this.maximumInputLength > 0 && params.term.length > this.maximumInputLength) { this.trigger('results:message', { message: 'inputTooLong', args: { maximum: this.maximumInputLength, input: params.term, params: params } }); return; } decorated.call(this, params, callback); }; return MaximumInputLength; }); S2.define('select2/data/maximumSelectionLength',[ ], function (){ function MaximumSelectionLength (decorated, $e, options) { this.maximumSelectionLength = options.get('maximumSelectionLength'); decorated.call(this, $e, options); } MaximumSelectionLength.prototype.query = function (decorated, params, callback) { var self = this; this.current(function (currentData) { var count = currentData != null ? currentData.length : 0; if (self.maximumSelectionLength > 0 && count >= self.maximumSelectionLength) { self.trigger('results:message', { message: 'maximumSelected', args: { maximum: self.maximumSelectionLength } }); return; } decorated.call(self, params, callback); }); }; return MaximumSelectionLength; }); S2.define('select2/dropdown',[ 'jquery', './utils' ], function ($, Utils) { function Dropdown ($element, options) { this.$element = $element; this.options = options; Dropdown.__super__.constructor.call(this); } Utils.Extend(Dropdown, Utils.Observable); Dropdown.prototype.render = function () { var $dropdown = $( '' + '' + '' ); $dropdown.attr('dir', this.options.get('dir')); this.$dropdown = $dropdown; return $dropdown; }; Dropdown.prototype.bind = function () { // Should be implemented in subclasses }; Dropdown.prototype.position = function ($dropdown, $container) { // Should be implmented in subclasses }; Dropdown.prototype.destroy = function () { // Remove the dropdown from the DOM this.$dropdown.remove(); }; return Dropdown; }); S2.define('select2/dropdown/search',[ 'jquery', '../utils' ], function ($, Utils) { function Search () { } Search.prototype.render = function (decorated) { var $rendered = decorated.call(this); var $search = $( '' + '' + '' ); this.$searchContainer = $search; this.$search = $search.find('input'); $rendered.prepend($search); return $rendered; }; Search.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); this.$search.on('keydown', function (evt) { self.trigger('keypress', evt); self._keyUpPrevented = evt.isDefaultPrevented(); }); // Workaround for browsers which do not support the `input` event // This will prevent double-triggering of events for browsers which support // both the `keyup` and `input` events. this.$search.on('input', function (evt) { // Unbind the duplicated `keyup` event $(this).off('keyup'); }); this.$search.on('keyup input', function (evt) { self.handleSearch(evt); }); container.on('open', function () { self.$search.attr('tabindex', 0); self.$search.focus(); window.setTimeout(function () { self.$search.focus(); }, 0); }); container.on('close', function () { self.$search.attr('tabindex', -1); self.$search.val(''); }); container.on('focus', function () { if (!container.isOpen()) { self.$search.focus(); } }); container.on('results:all', function (params) { if (params.query.term == null || params.query.term === '') { var showSearch = self.showSearch(params); if (showSearch) { self.$searchContainer.removeClass('select2-search--hide'); } else { self.$searchContainer.addClass('select2-search--hide'); } } }); }; Search.prototype.handleSearch = function (evt) { if (!this._keyUpPrevented) { var input = this.$search.val(); this.trigger('query', { term: input }); } this._keyUpPrevented = false; }; Search.prototype.showSearch = function (_, params) { return true; }; return Search; }); S2.define('select2/dropdown/hidePlaceholder',[ ], function () { function HidePlaceholder (decorated, $element, options, dataAdapter) { this.placeholder = this.normalizePlaceholder(options.get('placeholder')); decorated.call(this, $element, options, dataAdapter); } HidePlaceholder.prototype.append = function (decorated, data) { data.results = this.removePlaceholder(data.results); decorated.call(this, data); }; HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { if (typeof placeholder === 'string') { placeholder = { id: '', text: placeholder }; } return placeholder; }; HidePlaceholder.prototype.removePlaceholder = function (_, data) { var modifiedData = data.slice(0); for (var d = data.length - 1; d >= 0; d--) { var item = data[d]; if (this.placeholder.id === item.id) { modifiedData.splice(d, 1); } } return modifiedData; }; return HidePlaceholder; }); S2.define('select2/dropdown/infiniteScroll',[ 'jquery' ], function ($) { function InfiniteScroll (decorated, $element, options, dataAdapter) { this.lastParams = {}; decorated.call(this, $element, options, dataAdapter); this.$loadingMore = this.createLoadingMore(); this.loading = false; } InfiniteScroll.prototype.append = function (decorated, data) { this.$loadingMore.remove(); this.loading = false; decorated.call(this, data); if (this.showLoadingMore(data)) { this.$results.append(this.$loadingMore); } }; InfiniteScroll.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('query', function (params) { self.lastParams = params; self.loading = true; }); container.on('query:append', function (params) { self.lastParams = params; self.loading = true; }); this.$results.on('scroll', function () { var isLoadMoreVisible = $.contains( document.documentElement, self.$loadingMore[0] ); if (self.loading || !isLoadMoreVisible) { return; } var currentOffset = self.$results.offset().top + self.$results.outerHeight(false); var loadingMoreOffset = self.$loadingMore.offset().top + self.$loadingMore.outerHeight(false); if (currentOffset + 50 >= loadingMoreOffset) { self.loadMore(); } }); }; InfiniteScroll.prototype.loadMore = function () { this.loading = true; var params = $.extend({}, {page: 1}, this.lastParams); params.page++; this.trigger('query:append', params); }; InfiniteScroll.prototype.showLoadingMore = function (_, data) { return data.pagination && data.pagination.more; }; InfiniteScroll.prototype.createLoadingMore = function () { var $option = $( '
  • ' ); var message = this.options.get('translations').get('loadingMore'); $option.html(message(this.lastParams)); return $option; }; return InfiniteScroll; }); S2.define('select2/dropdown/attachBody',[ 'jquery', '../utils' ], function ($, Utils) { function AttachBody (decorated, $element, options) { this.$dropdownParent = options.get('dropdownParent') || $(document.body); decorated.call(this, $element, options); } AttachBody.prototype.bind = function (decorated, container, $container) { var self = this; var setupResultsEvents = false; decorated.call(this, container, $container); container.on('open', function () { self._showDropdown(); self._attachPositioningHandler(container); if (!setupResultsEvents) { setupResultsEvents = true; container.on('results:all', function () { self._positionDropdown(); self._resizeDropdown(); }); container.on('results:append', function () { self._positionDropdown(); self._resizeDropdown(); }); } }); container.on('close', function () { self._hideDropdown(); self._detachPositioningHandler(container); }); this.$dropdownContainer.on('mousedown', function (evt) { evt.stopPropagation(); }); }; AttachBody.prototype.destroy = function (decorated) { decorated.call(this); this.$dropdownContainer.remove(); }; AttachBody.prototype.position = function (decorated, $dropdown, $container) { // Clone all of the container classes $dropdown.attr('class', $container.attr('class')); $dropdown.removeClass('select2'); $dropdown.addClass('select2-container--open'); $dropdown.css({ position: 'absolute', top: -999999 }); this.$container = $container; }; AttachBody.prototype.render = function (decorated) { var $container = $(''); var $dropdown = decorated.call(this); $container.append($dropdown); this.$dropdownContainer = $container; return $container; }; AttachBody.prototype._hideDropdown = function (decorated) { this.$dropdownContainer.detach(); }; AttachBody.prototype._attachPositioningHandler = function (decorated, container) { var self = this; var scrollEvent = 'scroll.select2.' + container.id; var resizeEvent = 'resize.select2.' + container.id; var orientationEvent = 'orientationchange.select2.' + container.id; var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.each(function () { $(this).data('select2-scroll-position', { x: $(this).scrollLeft(), y: $(this).scrollTop() }); }); $watchers.on(scrollEvent, function (ev) { var position = $(this).data('select2-scroll-position'); $(this).scrollTop(position.y); }); $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, function (e) { self._positionDropdown(); self._resizeDropdown(); }); }; AttachBody.prototype._detachPositioningHandler = function (decorated, container) { var scrollEvent = 'scroll.select2.' + container.id; var resizeEvent = 'resize.select2.' + container.id; var orientationEvent = 'orientationchange.select2.' + container.id; var $watchers = this.$container.parents().filter(Utils.hasScroll); $watchers.off(scrollEvent); $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); }; AttachBody.prototype._positionDropdown = function () { var $window = $(window); var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); var newDirection = null; var offset = this.$container.offset(); offset.bottom = offset.top + this.$container.outerHeight(false); var container = { height: this.$container.outerHeight(false) }; container.top = offset.top; container.bottom = offset.top + container.height; var dropdown = { height: this.$dropdown.outerHeight(false) }; var viewport = { top: $window.scrollTop(), bottom: $window.scrollTop() + $window.height() }; var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); var css = { left: offset.left, top: container.bottom }; // Determine what the parent element is to use for calciulating the offset var $offsetParent = this.$dropdownParent; // For statically positoned elements, we need to get the element // that is determining the offset if ($offsetParent.css('position') === 'static') { $offsetParent = $offsetParent.offsetParent(); } var parentOffset = $offsetParent.offset(); css.top -= parentOffset.top; css.left -= parentOffset.left; if (!isCurrentlyAbove && !isCurrentlyBelow) { newDirection = 'below'; } if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { newDirection = 'above'; } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { newDirection = 'below'; } if (newDirection == 'above' || (isCurrentlyAbove && newDirection !== 'below')) { css.top = container.top - parentOffset.top - dropdown.height; } if (newDirection != null) { this.$dropdown .removeClass('select2-dropdown--below select2-dropdown--above') .addClass('select2-dropdown--' + newDirection); this.$container .removeClass('select2-container--below select2-container--above') .addClass('select2-container--' + newDirection); } this.$dropdownContainer.css(css); }; AttachBody.prototype._resizeDropdown = function () { var css = { width: this.$container.outerWidth(false) + 'px' }; if (this.options.get('dropdownAutoWidth')) { css.minWidth = css.width; css.position = 'relative'; css.width = 'auto'; } this.$dropdown.css(css); }; AttachBody.prototype._showDropdown = function (decorated) { this.$dropdownContainer.appendTo(this.$dropdownParent); this._positionDropdown(); this._resizeDropdown(); }; return AttachBody; }); S2.define('select2/dropdown/minimumResultsForSearch',[ ], function () { function countResults (data) { var count = 0; for (var d = 0; d < data.length; d++) { var item = data[d]; if (item.children) { count += countResults(item.children); } else { count++; } } return count; } function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { this.minimumResultsForSearch = options.get('minimumResultsForSearch'); if (this.minimumResultsForSearch < 0) { this.minimumResultsForSearch = Infinity; } decorated.call(this, $element, options, dataAdapter); } MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { if (countResults(params.data.results) < this.minimumResultsForSearch) { return false; } return decorated.call(this, params); }; return MinimumResultsForSearch; }); S2.define('select2/dropdown/selectOnClose',[ ], function () { function SelectOnClose () { } SelectOnClose.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('close', function (params) { self._handleSelectOnClose(params); }); }; SelectOnClose.prototype._handleSelectOnClose = function (_, params) { if (params && params.originalSelect2Event != null) { var event = params.originalSelect2Event; // Don't select an item if the close event was triggered from a select or // unselect event if (event._type === 'select' || event._type === 'unselect') { return; } } var $highlightedResults = this.getHighlightedResults(); // Only select highlighted results if ($highlightedResults.length < 1) { return; } var data = $highlightedResults.data('data'); // Don't re-select already selected resulte if ( (data.element != null && data.element.selected) || (data.element == null && data.selected) ) { return; } this.trigger('select', { data: data }); }; return SelectOnClose; }); S2.define('select2/dropdown/closeOnSelect',[ ], function () { function CloseOnSelect () { } CloseOnSelect.prototype.bind = function (decorated, container, $container) { var self = this; decorated.call(this, container, $container); container.on('select', function (evt) { self._selectTriggered(evt); }); container.on('unselect', function (evt) { self._selectTriggered(evt); }); }; CloseOnSelect.prototype._selectTriggered = function (_, evt) { var originalEvent = evt.originalEvent; // Don't close if the control key is being held if (originalEvent && originalEvent.ctrlKey) { return; } this.trigger('close', { originalEvent: originalEvent, originalSelect2Event: evt }); }; return CloseOnSelect; }); S2.define('select2/i18n/en',[],function () { // English return { errorLoading: function () { return 'The results could not be loaded.'; }, inputTooLong: function (args) { var overChars = args.input.length - args.maximum; var message = 'Please delete ' + overChars + ' character'; if (overChars != 1) { message += 's'; } return message; }, inputTooShort: function (args) { var remainingChars = args.minimum - args.input.length; var message = 'Please enter ' + remainingChars + ' or more characters'; return message; }, loadingMore: function () { return 'Loading more results…'; }, maximumSelected: function (args) { var message = 'You can only select ' + args.maximum + ' item'; if (args.maximum != 1) { message += 's'; } return message; }, noResults: function () { return 'No results found'; }, searching: function () { return 'Searching…'; } }; }); S2.define('select2/defaults',[ 'jquery', 'require', './results', './selection/single', './selection/multiple', './selection/placeholder', './selection/allowClear', './selection/search', './selection/eventRelay', './utils', './translation', './diacritics', './data/select', './data/array', './data/ajax', './data/tags', './data/tokenizer', './data/minimumInputLength', './data/maximumInputLength', './data/maximumSelectionLength', './dropdown', './dropdown/search', './dropdown/hidePlaceholder', './dropdown/infiniteScroll', './dropdown/attachBody', './dropdown/minimumResultsForSearch', './dropdown/selectOnClose', './dropdown/closeOnSelect', './i18n/en' ], function ($, require, ResultsList, SingleSelection, MultipleSelection, Placeholder, AllowClear, SelectionSearch, EventRelay, Utils, Translation, DIACRITICS, SelectData, ArrayData, AjaxData, Tags, Tokenizer, MinimumInputLength, MaximumInputLength, MaximumSelectionLength, Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, EnglishTranslation) { function Defaults () { this.reset(); } Defaults.prototype.apply = function (options) { options = $.extend(true, {}, this.defaults, options); if (options.dataAdapter == null) { if (options.ajax != null) { options.dataAdapter = AjaxData; } else if (options.data != null) { options.dataAdapter = ArrayData; } else { options.dataAdapter = SelectData; } if (options.minimumInputLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MinimumInputLength ); } if (options.maximumInputLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MaximumInputLength ); } if (options.maximumSelectionLength > 0) { options.dataAdapter = Utils.Decorate( options.dataAdapter, MaximumSelectionLength ); } if (options.tags) { options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); } if (options.tokenSeparators != null || options.tokenizer != null) { options.dataAdapter = Utils.Decorate( options.dataAdapter, Tokenizer ); } if (options.query != null) { var Query = require(options.amdBase + 'compat/query'); options.dataAdapter = Utils.Decorate( options.dataAdapter, Query ); } if (options.initSelection != null) { var InitSelection = require(options.amdBase + 'compat/initSelection'); options.dataAdapter = Utils.Decorate( options.dataAdapter, InitSelection ); } } if (options.resultsAdapter == null) { options.resultsAdapter = ResultsList; if (options.ajax != null) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, InfiniteScroll ); } if (options.placeholder != null) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, HidePlaceholder ); } if (options.selectOnClose) { options.resultsAdapter = Utils.Decorate( options.resultsAdapter, SelectOnClose ); } } if (options.dropdownAdapter == null) { if (options.multiple) { options.dropdownAdapter = Dropdown; } else { var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); options.dropdownAdapter = SearchableDropdown; } if (options.minimumResultsForSearch !== 0) { options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, MinimumResultsForSearch ); } if (options.closeOnSelect) { options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, CloseOnSelect ); } if ( options.dropdownCssClass != null || options.dropdownCss != null || options.adaptDropdownCssClass != null ) { var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, DropdownCSS ); } options.dropdownAdapter = Utils.Decorate( options.dropdownAdapter, AttachBody ); } if (options.selectionAdapter == null) { if (options.multiple) { options.selectionAdapter = MultipleSelection; } else { options.selectionAdapter = SingleSelection; } // Add the placeholder mixin if a placeholder was specified if (options.placeholder != null) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, Placeholder ); } if (options.allowClear) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, AllowClear ); } if (options.multiple) { options.selectionAdapter = Utils.Decorate( options.selectionAdapter, SelectionSearch ); } if ( options.containerCssClass != null || options.containerCss != null || options.adaptContainerCssClass != null ) { var ContainerCSS = require(options.amdBase + 'compat/containerCss'); options.selectionAdapter = Utils.Decorate( options.selectionAdapter, ContainerCSS ); } options.selectionAdapter = Utils.Decorate( options.selectionAdapter, EventRelay ); } if (typeof options.language === 'string') { // Check if the language is specified with a region if (options.language.indexOf('-') > 0) { // Extract the region information if it is included var languageParts = options.language.split('-'); var baseLanguage = languageParts[0]; options.language = [options.language, baseLanguage]; } else { options.language = [options.language]; } } if ($.isArray(options.language)) { var languages = new Translation(); options.language.push('en'); var languageNames = options.language; for (var l = 0; l < languageNames.length; l++) { var name = languageNames[l]; var language = {}; try { // Try to load it with the original name language = Translation.loadPath(name); } catch (e) { try { // If we couldn't load it, check if it wasn't the full path name = this.defaults.amdLanguageBase + name; language = Translation.loadPath(name); } catch (ex) { // The translation could not be loaded at all. Sometimes this is // because of a configuration problem, other times this can be // because of how Select2 helps load all possible translation files. if (options.debug && window.console && console.warn) { console.warn( 'Select2: The language file for "' + name + '" could not be ' + 'automatically loaded. A fallback will be used instead.' ); } continue; } } languages.extend(language); } options.translations = languages; } else { var baseTranslation = Translation.loadPath( this.defaults.amdLanguageBase + 'en' ); var customTranslation = new Translation(options.language); customTranslation.extend(baseTranslation); options.translations = customTranslation; } return options; }; Defaults.prototype.reset = function () { function stripDiacritics (text) { // Used 'uni range + named function' from http://jsperf.com/diacritics/18 function match(a) { return DIACRITICS[a] || a; } return text.replace(/[^\u0000-\u007E]/g, match); } function matcher (params, data) { // Always return the object if there is nothing to compare if ($.trim(params.term) === '') { return data; } // Do a recursive check for options with children if (data.children && data.children.length > 0) { // Clone the data object if there are children // This is required as we modify the object to remove any non-matches var match = $.extend(true, {}, data); // Check each child of the option for (var c = data.children.length - 1; c >= 0; c--) { var child = data.children[c]; var matches = matcher(params, child); // If there wasn't a match, remove the object in the array if (matches == null) { match.children.splice(c, 1); } } // If any children matched, return the new object if (match.children.length > 0) { return match; } // If there were no matching children, check just the plain object return matcher(params, match); } var original = stripDiacritics(data.text).toUpperCase(); var term = stripDiacritics(params.term).toUpperCase(); // Check if the text contains the term if (original.indexOf(term) > -1) { return data; } // If it doesn't contain the term, don't return anything return null; } this.defaults = { amdBase: './', amdLanguageBase: './i18n/', closeOnSelect: true, debug: false, dropdownAutoWidth: false, escapeMarkup: Utils.escapeMarkup, language: EnglishTranslation, matcher: matcher, minimumInputLength: 0, maximumInputLength: 0, maximumSelectionLength: 0, minimumResultsForSearch: 0, selectOnClose: false, sorter: function (data) { return data; }, templateResult: function (result) { return result.text; }, templateSelection: function (selection) { return selection.text; }, theme: 'default', width: 'resolve' }; }; Defaults.prototype.set = function (key, value) { var camelKey = $.camelCase(key); var data = {}; data[camelKey] = value; var convertedData = Utils._convertData(data); $.extend(this.defaults, convertedData); }; var defaults = new Defaults(); return defaults; }); S2.define('select2/options',[ 'require', 'jquery', './defaults', './utils' ], function (require, $, Defaults, Utils) { function Options (options, $element) { this.options = options; if ($element != null) { this.fromElement($element); } this.options = Defaults.apply(this.options); if ($element && $element.is('input')) { var InputCompat = require(this.get('amdBase') + 'compat/inputData'); this.options.dataAdapter = Utils.Decorate( this.options.dataAdapter, InputCompat ); } } Options.prototype.fromElement = function ($e) { var excludedData = ['select2']; if (this.options.multiple == null) { this.options.multiple = $e.prop('multiple'); } if (this.options.disabled == null) { this.options.disabled = $e.prop('disabled'); } if (this.options.language == null) { if ($e.prop('lang')) { this.options.language = $e.prop('lang').toLowerCase(); } else if ($e.closest('[lang]').prop('lang')) { this.options.language = $e.closest('[lang]').prop('lang'); } } if (this.options.dir == null) { if ($e.prop('dir')) { this.options.dir = $e.prop('dir'); } else if ($e.closest('[dir]').prop('dir')) { this.options.dir = $e.closest('[dir]').prop('dir'); } else { this.options.dir = 'ltr'; } } $e.prop('disabled', this.options.disabled); $e.prop('multiple', this.options.multiple); if ($e.data('select2Tags')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-select2-tags` attribute has been changed to ' + 'use the `data-data` and `data-tags="true"` attributes and will be ' + 'removed in future versions of Select2.' ); } $e.data('data', $e.data('select2Tags')); $e.data('tags', true); } if ($e.data('ajaxUrl')) { if (this.options.debug && window.console && console.warn) { console.warn( 'Select2: The `data-ajax-url` attribute has been changed to ' + '`data-ajax--url` and support for the old attribute will be removed' + ' in future versions of Select2.' ); } $e.attr('ajax--url', $e.data('ajaxUrl')); $e.data('ajax--url', $e.data('ajaxUrl')); } var dataset = {}; // Prefer the element's `dataset` attribute if it exists // jQuery 1.x does not correctly handle data attributes with multiple dashes if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { dataset = $.extend(true, {}, $e[0].dataset, $e.data()); } else { dataset = $e.data(); } var data = $.extend(true, {}, dataset); data = Utils._convertData(data); for (var key in data) { if ($.inArray(key, excludedData) > -1) { continue; } if ($.isPlainObject(this.options[key])) { $.extend(this.options[key], data[key]); } else { this.options[key] = data[key]; } } return this; }; Options.prototype.get = function (key) { return this.options[key]; }; Options.prototype.set = function (key, val) { this.options[key] = val; }; return Options; }); S2.define('select2/core',[ 'jquery', './options', './utils', './keys' ], function ($, Options, Utils, KEYS) { var Select2 = function ($element, options) { if ($element.data('select2') != null) { $element.data('select2').destroy(); } this.$element = $element; this.id = this._generateId($element); options = options || {}; this.options = new Options(options, $element); Select2.__super__.constructor.call(this); // Set up the tabindex var tabindex = $element.attr('tabindex') || 0; $element.data('old-tabindex', tabindex); $element.attr('tabindex', '-1'); // Set up containers and adapters var DataAdapter = this.options.get('dataAdapter'); this.dataAdapter = new DataAdapter($element, this.options); var $container = this.render(); this._placeContainer($container); var SelectionAdapter = this.options.get('selectionAdapter'); this.selection = new SelectionAdapter($element, this.options); this.$selection = this.selection.render(); this.selection.position(this.$selection, $container); var DropdownAdapter = this.options.get('dropdownAdapter'); this.dropdown = new DropdownAdapter($element, this.options); this.$dropdown = this.dropdown.render(); this.dropdown.position(this.$dropdown, $container); var ResultsAdapter = this.options.get('resultsAdapter'); this.results = new ResultsAdapter($element, this.options, this.dataAdapter); this.$results = this.results.render(); this.results.position(this.$results, this.$dropdown); // Bind events var self = this; // Bind the container to all of the adapters this._bindAdapters(); // Register any DOM event handlers this._registerDomEvents(); // Register any internal event handlers this._registerDataEvents(); this._registerSelectionEvents(); this._registerDropdownEvents(); this._registerResultsEvents(); this._registerEvents(); // Set the initial state this.dataAdapter.current(function (initialData) { self.trigger('selection:update', { data: initialData }); }); // Hide the original select $element.addClass('select2-hidden-accessible'); $element.attr('aria-hidden', 'true'); // Synchronize any monitored attributes this._syncAttributes(); $element.data('select2', this); }; Utils.Extend(Select2, Utils.Observable); Select2.prototype._generateId = function ($element) { var id = ''; if ($element.attr('id') != null) { id = $element.attr('id'); } else if ($element.attr('name') != null) { id = $element.attr('name') + '-' + Utils.generateChars(2); } else { id = Utils.generateChars(4); } id = id.replace(/(:|\.|\[|\]|,)/g, ''); id = 'select2-' + id; return id; }; Select2.prototype._placeContainer = function ($container) { $container.insertAfter(this.$element); var width = this._resolveWidth(this.$element, this.options.get('width')); if (width != null) { $container.css('width', width); } }; Select2.prototype._resolveWidth = function ($element, method) { var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; if (method == 'resolve') { var styleWidth = this._resolveWidth($element, 'style'); if (styleWidth != null) { return styleWidth; } return this._resolveWidth($element, 'element'); } if (method == 'element') { var elementWidth = $element.outerWidth(false); if (elementWidth <= 0) { return 'auto'; } return elementWidth + 'px'; } if (method == 'style') { var style = $element.attr('style'); if (typeof(style) !== 'string') { return null; } var attrs = style.split(';'); for (var i = 0, l = attrs.length; i < l; i = i + 1) { var attr = attrs[i].replace(/\s/g, ''); var matches = attr.match(WIDTH); if (matches !== null && matches.length >= 1) { return matches[1]; } } return null; } return method; }; Select2.prototype._bindAdapters = function () { this.dataAdapter.bind(this, this.$container); this.selection.bind(this, this.$container); this.dropdown.bind(this, this.$container); this.results.bind(this, this.$container); }; Select2.prototype._registerDomEvents = function () { var self = this; this.$element.on('change.select2', function () { self.dataAdapter.current(function (data) { self.trigger('selection:update', { data: data }); }); }); this.$element.on('focus.select2', function (evt) { self.trigger('focus', evt); }); this._syncA = Utils.bind(this._syncAttributes, this); this._syncS = Utils.bind(this._syncSubtree, this); if (this.$element[0].attachEvent) { this.$element[0].attachEvent('onpropertychange', this._syncA); } var observer = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver ; if (observer != null) { this._observer = new observer(function (mutations) { $.each(mutations, self._syncA); $.each(mutations, self._syncS); }); this._observer.observe(this.$element[0], { attributes: true, childList: true, subtree: false }); } else if (this.$element[0].addEventListener) { this.$element[0].addEventListener( 'DOMAttrModified', self._syncA, false ); this.$element[0].addEventListener( 'DOMNodeInserted', self._syncS, false ); this.$element[0].addEventListener( 'DOMNodeRemoved', self._syncS, false ); } }; Select2.prototype._registerDataEvents = function () { var self = this; this.dataAdapter.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerSelectionEvents = function () { var self = this; var nonRelayEvents = ['toggle', 'focus']; this.selection.on('toggle', function () { self.toggleDropdown(); }); this.selection.on('focus', function (params) { self.focus(params); }); this.selection.on('*', function (name, params) { if ($.inArray(name, nonRelayEvents) !== -1) { return; } self.trigger(name, params); }); }; Select2.prototype._registerDropdownEvents = function () { var self = this; this.dropdown.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerResultsEvents = function () { var self = this; this.results.on('*', function (name, params) { self.trigger(name, params); }); }; Select2.prototype._registerEvents = function () { var self = this; this.on('open', function () { self.$container.addClass('select2-container--open'); }); this.on('close', function () { self.$container.removeClass('select2-container--open'); }); this.on('enable', function () { self.$container.removeClass('select2-container--disabled'); }); this.on('disable', function () { self.$container.addClass('select2-container--disabled'); }); this.on('blur', function () { self.$container.removeClass('select2-container--focus'); }); this.on('query', function (params) { if (!self.isOpen()) { self.trigger('open', {}); } this.dataAdapter.query(params, function (data) { self.trigger('results:all', { data: data, query: params }); }); }); this.on('query:append', function (params) { this.dataAdapter.query(params, function (data) { self.trigger('results:append', { data: data, query: params }); }); }); this.on('keypress', function (evt) { var key = evt.which; if (self.isOpen()) { if (key === KEYS.ESC || key === KEYS.TAB || (key === KEYS.UP && evt.altKey)) { self.close(); evt.preventDefault(); } else if (key === KEYS.ENTER) { self.trigger('results:select', {}); evt.preventDefault(); } else if ((key === KEYS.SPACE && evt.ctrlKey)) { self.trigger('results:toggle', {}); evt.preventDefault(); } else if (key === KEYS.UP) { self.trigger('results:previous', {}); evt.preventDefault(); } else if (key === KEYS.DOWN) { self.trigger('results:next', {}); evt.preventDefault(); } } else { if (key === KEYS.ENTER || key === KEYS.SPACE || (key === KEYS.DOWN && evt.altKey)) { self.open(); evt.preventDefault(); } } }); }; Select2.prototype._syncAttributes = function () { this.options.set('disabled', this.$element.prop('disabled')); if (this.options.get('disabled')) { if (this.isOpen()) { this.close(); } this.trigger('disable', {}); } else { this.trigger('enable', {}); } }; Select2.prototype._syncSubtree = function (evt, mutations) { var changed = false; var self = this; // Ignore any mutation events raised for elements that aren't options or // optgroups. This handles the case when the select element is destroyed if ( evt && evt.target && ( evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' ) ) { return; } if (!mutations) { // If mutation events aren't supported, then we can only assume that the // change affected the selections changed = true; } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { for (var n = 0; n < mutations.addedNodes.length; n++) { var node = mutations.addedNodes[n]; if (node.selected) { changed = true; } } } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { changed = true; } // Only re-pull the data if we think there is a change if (changed) { this.dataAdapter.current(function (currentData) { self.trigger('selection:update', { data: currentData }); }); } }; /** * Override the trigger method to automatically trigger pre-events when * there are events that can be prevented. */ Select2.prototype.trigger = function (name, args) { var actualTrigger = Select2.__super__.trigger; var preTriggerMap = { 'open': 'opening', 'close': 'closing', 'select': 'selecting', 'unselect': 'unselecting' }; if (args === undefined) { args = {}; } if (name in preTriggerMap) { var preTriggerName = preTriggerMap[name]; var preTriggerArgs = { prevented: false, name: name, args: args }; actualTrigger.call(this, preTriggerName, preTriggerArgs); if (preTriggerArgs.prevented) { args.prevented = true; return; } } actualTrigger.call(this, name, args); }; Select2.prototype.toggleDropdown = function () { if (this.options.get('disabled')) { return; } if (this.isOpen()) { this.close(); } else { this.open(); } }; Select2.prototype.open = function () { if (this.isOpen()) { return; } this.trigger('query', {}); }; Select2.prototype.close = function () { if (!this.isOpen()) { return; } this.trigger('close', {}); }; Select2.prototype.isOpen = function () { return this.$container.hasClass('select2-container--open'); }; Select2.prototype.hasFocus = function () { return this.$container.hasClass('select2-container--focus'); }; Select2.prototype.focus = function (data) { // No need to re-trigger focus events if we are already focused if (this.hasFocus()) { return; } this.$container.addClass('select2-container--focus'); this.trigger('focus', {}); }; Select2.prototype.enable = function (args) { if (this.options.get('debug') && window.console && console.warn) { console.warn( 'Select2: The `select2("enable")` method has been deprecated and will' + ' be removed in later Select2 versions. Use $element.prop("disabled")' + ' instead.' ); } if (args == null || args.length === 0) { args = [true]; } var disabled = !args[0]; this.$element.prop('disabled', disabled); }; Select2.prototype.data = function () { if (this.options.get('debug') && arguments.length > 0 && window.console && console.warn) { console.warn( 'Select2: Data can no longer be set using `select2("data")`. You ' + 'should consider setting the value instead using `$element.val()`.' ); } var data = []; this.dataAdapter.current(function (currentData) { data = currentData; }); return data; }; Select2.prototype.val = function (args) { if (this.options.get('debug') && window.console && console.warn) { console.warn( 'Select2: The `select2("val")` method has been deprecated and will be' + ' removed in later Select2 versions. Use $element.val() instead.' ); } if (args == null || args.length === 0) { return this.$element.val(); } var newVal = args[0]; if ($.isArray(newVal)) { newVal = $.map(newVal, function (obj) { return obj.toString(); }); } this.$element.val(newVal).trigger('change'); }; Select2.prototype.destroy = function () { this.$container.remove(); if (this.$element[0].detachEvent) { this.$element[0].detachEvent('onpropertychange', this._syncA); } if (this._observer != null) { this._observer.disconnect(); this._observer = null; } else if (this.$element[0].removeEventListener) { this.$element[0] .removeEventListener('DOMAttrModified', this._syncA, false); this.$element[0] .removeEventListener('DOMNodeInserted', this._syncS, false); this.$element[0] .removeEventListener('DOMNodeRemoved', this._syncS, false); } this._syncA = null; this._syncS = null; this.$element.off('.select2'); this.$element.attr('tabindex', this.$element.data('old-tabindex')); this.$element.removeClass('select2-hidden-accessible'); this.$element.attr('aria-hidden', 'false'); this.$element.removeData('select2'); this.dataAdapter.destroy(); this.selection.destroy(); this.dropdown.destroy(); this.results.destroy(); this.dataAdapter = null; this.selection = null; this.dropdown = null; this.results = null; }; Select2.prototype.render = function () { var $container = $( '' + '' + '' + '' ); $container.attr('dir', this.options.get('dir')); this.$container = $container; this.$container.addClass('select2-container--' + this.options.get('theme')); $container.data('element', this.$element); return $container; }; return Select2; }); S2.define('jquery-mousewheel',[ 'jquery' ], function ($) { // Used to shim jQuery.mousewheel for non-full builds. return $; }); S2.define('jquery.select2',[ 'jquery', 'jquery-mousewheel', './select2/core', './select2/defaults' ], function ($, _, Select2, Defaults) { if ($.fn.select2 == null) { // All methods that should return the element var thisMethods = ['open', 'close', 'destroy']; $.fn.select2 = function (options) { options = options || {}; if (typeof options === 'object') { this.each(function () { var instanceOptions = $.extend(true, {}, options); var instance = new Select2($(this), instanceOptions); }); return this; } else if (typeof options === 'string') { var ret; var args = Array.prototype.slice.call(arguments, 1); this.each(function () { var instance = $(this).data('select2'); if (instance == null && window.console && console.error) { console.error( 'The select2(\'' + options + '\') method was called on an ' + 'element that is not using Select2.' ); } ret = instance[options].apply(instance, args); }); // Check if we should be returning `this` if ($.inArray(options, thisMethods) > -1) { return this; } return ret; } else { throw new Error('Invalid arguments for Select2: ' + options); } }; } if ($.fn.select2.defaults == null) { $.fn.select2.defaults = Defaults; } return Select2; }); // Return the AMD loader configuration so it can be used outside of this file return { define: S2.define, require: S2.require }; }()); // Autoload the jQuery bindings // We know that all of the modules exist above this, so we're safe var select2 = S2.require('jquery.select2'); // Hold the AMD module references on the jQuery function that was just loaded // This allows Select2 to use the internal loader outside of this file, such // as in the language files. jQuery.fn.select2.amd = S2; // Return the Select2 instance for anyone who is importing it. return select2; }));inc/class-hfe-elementor-canvas-compat.php000064400000005372146730610170014431 0ustar00=' ) ) { add_action( 'elementor/page_templates/canvas/before_content', [ $this, 'render_header' ] ); } else { add_action( 'wp_head', [ $this, 'render_header' ] ); } } if ( hfe_footer_enabled() ) { // Action `elementor/page_templates/canvas/after_content` is introduced in Elementor Version 1.9.0. if ( version_compare( ELEMENTOR_VERSION, '1.9.0', '>=' ) ) { add_action( 'elementor/page_templates/canvas/after_content', [ $this, 'render_footer' ] ); } else { add_action( 'wp_footer', [ $this, 'render_footer' ] ); } } if ( hfe_is_before_footer_enabled() ) { // check if current page template is Elemenntor Canvas. if ( 'elementor_canvas' == get_page_template_slug() ) { $override_cannvas_template = get_post_meta( hfe_get_before_footer_id(), 'display-on-canvas-template', true ); if ( '1' == $override_cannvas_template ) { add_action( 'elementor/page_templates/canvas/after_content', 'hfe_render_before_footer', 9 ); } } } } /** * Render the header if display template on elementor canvas is enabled * and current template is Elementor Canvas */ public function render_header() { // bail if current page template is not Elemenntor Canvas. if ( 'elementor_canvas' !== get_page_template_slug() ) { return; } $override_cannvas_template = get_post_meta( get_hfe_header_id(), 'display-on-canvas-template', true ); if ( '1' == $override_cannvas_template ) { hfe_render_header(); } } /** * Render the footer if display template on elementor canvas is enabled * and current template is Elementor Canvas */ public function render_footer() { // bail if current page template is not Elemenntor Canvas. if ( 'elementor_canvas' !== get_page_template_slug() ) { return; } $override_cannvas_template = get_post_meta( get_hfe_footer_id(), 'display-on-canvas-template', true ); if ( '1' == $override_cannvas_template ) { hfe_render_footer(); } } } HFE_Elementor_Canvas_Compat::instance(); inc/class-header-footer-elementor.php000064400000047703146730610170013665 0ustar00template = get_template(); $is_elementor_callable = ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) ? true : false; $required_elementor_version = '3.5.0'; $is_elementor_outdated = ( $is_elementor_callable && ( ! version_compare( ELEMENTOR_VERSION, $required_elementor_version, '>=' ) ) ) ? true : false; if ( ( ! $is_elementor_callable ) || $is_elementor_outdated ) { $this->elementor_not_available( $is_elementor_callable, $is_elementor_outdated ); } if ( $is_elementor_callable ) { self::$elementor_instance = Elementor\Plugin::instance(); $this->includes(); $this->load_textdomain(); add_action( 'init', [ $this, 'setup_settings_page' ] ); if ( 'genesis' == $this->template ) { require HFE_DIR . 'themes/genesis/class-hfe-genesis-compat.php'; } elseif ( 'astra' == $this->template ) { require HFE_DIR . 'themes/astra/class-hfe-astra-compat.php'; } elseif ( 'bb-theme' == $this->template || 'beaver-builder-theme' == $this->template ) { $this->template = 'beaver-builder-theme'; require HFE_DIR . 'themes/bb-theme/class-hfe-bb-theme-compat.php'; } elseif ( 'generatepress' == $this->template ) { require HFE_DIR . 'themes/generatepress/class-hfe-generatepress-compat.php'; } elseif ( 'oceanwp' == $this->template ) { require HFE_DIR . 'themes/oceanwp/class-hfe-oceanwp-compat.php'; } elseif ( 'storefront' == $this->template ) { require HFE_DIR . 'themes/storefront/class-hfe-storefront-compat.php'; } elseif ( 'hello-elementor' == $this->template ) { require HFE_DIR . 'themes/hello-elementor/class-hfe-hello-elementor-compat.php'; } else { add_filter( 'hfe_settings_tabs', [ $this, 'setup_unsupported_theme' ] ); add_action( 'init', [ $this, 'setup_fallback_support' ] ); } if ( 'yes' === get_option( 'hfe_plugin_is_activated' ) ) { add_action( 'admin_init', [ $this, 'show_setup_wizard' ] ); } // Scripts and styles. add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_scripts' ] ); add_filter( 'body_class', [ $this, 'body_class' ] ); add_action( 'switch_theme', [ $this, 'reset_unsupported_theme_notice' ] ); add_shortcode( 'hfe_template', [ $this, 'render_template' ] ); add_action( 'astra_notice_before_markup_header-footer-elementor-rating', [ $this, 'rating_notice_css' ] ); add_action( 'admin_init', [ $this, 'register_notices' ] ); // BSF Analytics Tracker. if ( ! class_exists( 'BSF_Analytics_Loader' ) ) { require_once HFE_DIR . 'admin/bsf-analytics/class-bsf-analytics-loader.php'; } $bsf_analytics = BSF_Analytics_Loader::get_instance(); $bsf_analytics->set_entity( [ 'bsf' => [ 'product_name' => 'Elementor Header & Footer builder', 'path' => HFE_DIR . 'admin/bsf-analytics', 'author' => 'Brainstorm Force', 'time_to_display' => '+24 hours', ], ] ); } } /** * Reset the Unsupported theme nnotice after a theme is switched. * * @since 1.0.16 * * @return void */ public function reset_unsupported_theme_notice() { delete_user_meta( get_current_user_id(), 'unsupported-theme' ); } /** * Register Astra Notices. * * @since 1.2.0 * * @return void */ public function register_notices() { $image_path = HFE_URL . 'assets/images/header-footer-elementor-icon.svg'; Astra_Notices::add_notice( [ 'id' => 'header-footer-elementor-rating', 'type' => '', 'message' => sprintf( '
    %2$s
    %3$s
    ', $image_path, __( 'Hello! Seems like you have used Elementor Header & Footer Builder to build this website — Thanks a ton!', 'header-footer-elementor' ), __( 'Could you please do us a BIG favor and give it a 5-star rating on WordPress? This would boost our motivation and help other users make a comfortable decision while choosing the Elementor Header & Footer Builder.', 'header-footer-elementor' ), 'https://wordpress.org/support/plugin/header-footer-elementor/reviews/?filter=5#new-post', __( 'Ok, you deserve it', 'header-footer-elementor' ), MONTH_IN_SECONDS, __( 'Nope, maybe later', 'header-footer-elementor' ), __( 'I already did', 'header-footer-elementor' ) ), 'show_if' => ( hfe_header_enabled() || hfe_footer_enabled() || hfe_is_before_footer_enabled() ) ? true : false, 'repeat-notice-after' => MONTH_IN_SECONDS, 'display-notice-after' => 1296000, // Display notice after 15 days. 'priority' => 18, 'display-with-other-notices' => false, ] ); } /** * Enqueue CSS for the Rating Notice. * * @since 1.2.0 * @return void */ public function rating_notice_css() { wp_enqueue_style( 'hfe-admin-style', HFE_URL . 'assets/css/admin-header-footer-elementor.css', [], HFE_VER ); } /** * Prints the admin notics when Elementor is not installed or activated or version outdated. * * @since 1.5.9 * @param boolean $is_elementor_callable specifies if elementor is available. * @param boolean $is_elementor_outdated specifies if elementor version is old. */ public function elementor_not_available( $is_elementor_callable, $is_elementor_outdated ) { if ( ( ! did_action( 'elementor/loaded' ) ) || ( ! $is_elementor_callable ) ) { add_action( 'admin_notices', [ $this, 'elementor_not_installed_activated' ] ); add_action( 'network_admin_notices', [ $this, 'elementor_not_installed_activated' ] ); return; } if ( $is_elementor_outdated ) { add_action( 'admin_notices', [ $this, 'elementor_outdated' ] ); add_action( 'network_admin_notices', [ $this, 'elementor_outdated' ] ); return; } } /** * Prints the admin notics when Elementor is not installed or activated. */ public function elementor_not_installed_activated() { $screen = get_current_screen(); if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { return; } if ( ! did_action( 'elementor/loaded' ) ) { // Check user capability. if ( ! ( current_user_can( 'activate_plugins' ) && current_user_can( 'install_plugins' ) ) ) { return; } /* TO DO */ $class = 'notice notice-error'; /* translators: %s: html tags */ $message = sprintf( __( 'The %1$sElementor Header & Footer Builder%2$s plugin requires %1$sElementor%2$s plugin installed & activated.', 'header-footer-elementor' ), '', '' ); $plugin = 'elementor/elementor.php'; if ( _is_elementor_installed() ) { $action_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin ); $button_label = __( 'Activate Elementor', 'header-footer-elementor' ); } else { $action_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' ); $button_label = __( 'Install Elementor', 'header-footer-elementor' ); } $button = '

    ' . esc_html( $button_label ) . '

    '; printf( '

    %2$s

    %3$s
    ', esc_attr( $class ), wp_kses_post( $message ), wp_kses_post( $button ) ); } } /** * Prints the admin notics when Elementor version is outdated. */ public function elementor_outdated() { // Check user capability. if ( ! ( current_user_can( 'activate_plugins' ) && current_user_can( 'install_plugins' ) ) ) { return; } /* TO DO */ $class = 'notice notice-error'; /* translators: %s: html tags */ $message = sprintf( __( 'The %1$sElementor Header & Footer Builder%2$s plugin has stopped working because you are using an older version of %1$sElementor%2$s plugin.', 'header-footer-elementor' ), '', '' ); $plugin = 'elementor/elementor.php'; if ( file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) ) { $action_url = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin . '&', 'upgrade-plugin_' . $plugin ); $button_label = __( 'Update Elementor', 'header-footer-elementor' ); } else { $action_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' ); $button_label = __( 'Install Elementor', 'header-footer-elementor' ); } $button = '

    ' . esc_html( $button_label ) . '

    '; printf( '

    %2$s

    %3$s
    ', esc_attr( $class ), wp_kses_post( $message ), wp_kses_post( $button ) ); } /** * Prints the admin notics when Elementor is not installed or activated. */ public function show_setup_wizard() { $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; if ( 'plugins' !== $screen_id ) { return; } /* TO DO */ $class = 'notice notice-info is-dismissible'; $setting_url = admin_url( 'edit.php?post_type=elementor-hf' ); $image_path = HFE_URL . 'assets/images/header-footer-elementor-icon.svg'; /* translators: %s: html tags */ $notice_message = sprintf( __( 'Thank you for installing %1$s Elementor Header & Footer Builder %2$s Plugin! Click here to %3$sget started. %4$s', 'header-footer-elementor' ), '', '', '', '' ); Astra_Notices::add_notice( [ 'id' => 'header-footer-install-notice', 'type' => 'info', /* translators: %s: html tags */ 'message' => sprintf( '

    %2$s

    ', $image_path, $notice_message ), 'repeat-notice-after' => false, 'priority' => 18, 'display-with-other-notices' => false, ] ); } /** * Loads the globally required files for the plugin. */ public function includes() { require_once HFE_DIR . 'admin/class-hfe-admin.php'; require_once HFE_DIR . 'inc/hfe-functions.php'; // Load Elementor Canvas Compatibility. require_once HFE_DIR . 'inc/class-hfe-elementor-canvas-compat.php'; // Load WPML & Polylang Compatibility if WPML is installed and activated. if ( defined( 'ICL_SITEPRESS_VERSION' ) || defined( 'POLYLANG_BASENAME' ) ) { require_once HFE_DIR . 'inc/compatibility/class-hfe-wpml-compatibility.php'; } // Load the Admin Notice Class. require_once HFE_DIR . 'inc/lib/astra-notices/class-astra-notices.php'; // Load Target rules. require_once HFE_DIR . 'inc/lib/target-rule/class-astra-target-rules-fields.php'; // Setup upgrade routines. require_once HFE_DIR . 'inc/class-hfe-update.php'; // Load the widgets. require HFE_DIR . 'inc/widgets-manager/class-widgets-loader.php'; } /** * Loads textdomain for the plugin. */ public function load_textdomain() { load_plugin_textdomain( 'header-footer-elementor' ); } /** * Enqueue styles and scripts. */ public function enqueue_scripts() { wp_enqueue_style( 'hfe-style', HFE_URL . 'assets/css/header-footer-elementor.css', [], HFE_VER ); if ( class_exists( '\Elementor\Plugin' ) ) { $elementor = \Elementor\Plugin::instance(); $elementor->frontend->enqueue_styles(); } if ( class_exists( '\ElementorPro\Plugin' ) ) { $elementor_pro = \ElementorPro\Plugin::instance(); $elementor_pro->enqueue_styles(); } if ( hfe_header_enabled() ) { if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $css_file = new \Elementor\Core\Files\CSS\Post( get_hfe_header_id() ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { $css_file = new \Elementor\Post_CSS_File( get_hfe_header_id() ); } $css_file->enqueue(); } if ( hfe_footer_enabled() ) { if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $css_file = new \Elementor\Core\Files\CSS\Post( get_hfe_footer_id() ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { $css_file = new \Elementor\Post_CSS_File( get_hfe_footer_id() ); } $css_file->enqueue(); } if ( hfe_is_before_footer_enabled() ) { if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $css_file = new \Elementor\Core\Files\CSS\Post( hfe_get_before_footer_id() ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { $css_file = new \Elementor\Post_CSS_File( hfe_get_before_footer_id() ); } $css_file->enqueue(); } } /** * Load admin styles on header footer elementor edit screen. */ public function enqueue_admin_scripts() { global $pagenow; $screen = get_current_screen(); if ( ( 'elementor-hf' == $screen->id && ( 'post.php' == $pagenow || 'post-new.php' == $pagenow ) ) || ( 'edit.php' == $pagenow && 'edit-elementor-hf' == $screen->id ) ) { wp_enqueue_style( 'hfe-admin-style', HFE_URL . 'admin/assets/css/ehf-admin.css', [], HFE_VER ); wp_enqueue_script( 'hfe-admin-script', HFE_URL . 'admin/assets/js/ehf-admin.js', [ 'jquery', 'updates' ], HFE_VER, true ); } } /** * Adds classes to the body tag conditionally. * * @param Array $classes array with class names for the body tag. * * @return Array array with class names for the body tag. */ public function body_class( $classes ) { if ( hfe_header_enabled() ) { $classes[] = 'ehf-header'; } if ( hfe_footer_enabled() ) { $classes[] = 'ehf-footer'; } $classes[] = 'ehf-template-' . $this->template; $classes[] = 'ehf-stylesheet-' . get_stylesheet(); return $classes; } /** * Display Settings Page options * * @since 1.6.0 */ public function setup_settings_page() { require_once HFE_DIR . 'inc/class-hfe-settings-page.php'; } /** * Display Unsupported theme notice if the current theme does add support for 'header-footer-elementor' * * @param array $hfe_settings_tabs settings array tabs. * @since 1.0.3 */ public function setup_unsupported_theme( $hfe_settings_tabs = [] ) { if ( ! current_theme_supports( 'header-footer-elementor' ) ) { $hfe_settings_tabs['hfe_settings'] = [ 'name' => __( 'Theme Support', 'header-footer-elementor' ), 'url' => admin_url( 'themes.php?page=hfe-settings' ), ]; } return $hfe_settings_tabs; } /** * Add support for theme if the current theme does add support for 'header-footer-elementor' * * @since 1.6.1 */ public function setup_fallback_support() { if ( ! current_theme_supports( 'header-footer-elementor' ) ) { $hfe_compatibility_option = get_option( 'hfe_compatibility_option', '1' ); if ( '1' === $hfe_compatibility_option ) { if ( ! class_exists( 'HFE_Default_Compat' ) ) { require_once HFE_DIR . 'themes/default/class-hfe-default-compat.php'; } } elseif ( '2' === $hfe_compatibility_option ) { require HFE_DIR . 'themes/default/class-global-theme-compatibility.php'; } } } /** * Prints the Header content. */ public static function get_header_content() { $header_content = self::$elementor_instance->frontend->get_builder_content_for_display( get_hfe_header_id() ); echo $header_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Prints the Footer content. */ public static function get_footer_content() { echo "'; } /** * Prints the Before Footer content. */ public static function get_before_footer_content() { echo "'; } /** * Get option for the plugin settings * * @param mixed $setting Option name. * @param mixed $default Default value to be received if the option value is not stored in the option. * * @return mixed. */ public static function get_settings( $setting = '', $default = '' ) { if ( 'type_header' == $setting || 'type_footer' == $setting || 'type_before_footer' == $setting ) { $templates = self::get_template_id( $setting ); $template = ! is_array( $templates ) ? $templates : $templates[0]; $template = apply_filters( "hfe_get_settings_{$setting}", $template ); return $template; } } /** * Get header or footer template id based on the meta query. * * @param String $type Type of the template header/footer. * * @return Mixed Returns the header or footer template id if found, else returns string ''. */ public static function get_template_id( $type ) { $option = [ 'location' => 'ehf_target_include_locations', 'exclusion' => 'ehf_target_exclude_locations', 'users' => 'ehf_target_user_roles', ]; $hfe_templates = Astra_Target_Rules_Fields::get_instance()->get_posts_by_conditions( 'elementor-hf', $option ); foreach ( $hfe_templates as $template ) { if ( get_post_meta( absint( $template['id'] ), 'ehf_template_type', true ) === $type ) { if ( function_exists( 'pll_current_language' ) ) { if ( pll_current_language( 'slug' ) == pll_get_post_language( $template['id'], 'slug' ) ) { return $template['id']; } } else { return $template['id']; } } } return ''; } /** * Callback to shortcode. * * @param array $atts attributes for shortcode. */ public function render_template( $atts ) { $atts = shortcode_atts( [ 'id' => '', ], $atts, 'hfe_template' ); $id = ! empty( $atts['id'] ) ? apply_filters( 'hfe_render_template_id', intval( $atts['id'] ) ) : ''; if ( empty( $id ) ) { return ''; } if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $css_file = new \Elementor\Core\Files\CSS\Post( $id ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { // Load elementor styles. $css_file = new \Elementor\Post_CSS_File( $id ); } $css_file->enqueue(); return self::$elementor_instance->frontend->get_builder_content_for_display( $id ); } } /** * Is elementor plugin installed. */ if ( ! function_exists( '_is_elementor_installed' ) ) { /** * Check if Elementor is installed * * @since 1.6.0 * * @access public */ function _is_elementor_installed() { return ( file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) ) ? true : false; } } inc/widgets-manager/class-widgets-loader.php000064400000014455146730610170015137 0ustar00 [ 'path' => 'inc/js/frontend.js', 'dep' => [ 'jquery' ], 'in_footer' => true, ], ]; return $js_files; } /** * Returns Script array. * * @return array() * @since 1.3.0 */ public static function get_widget_list() { $widget_list = [ 'retina', 'copyright', 'copyright-shortcode', 'navigation-menu', 'menu-walker', 'site-title', 'page-title', 'site-tagline', 'site-logo', 'cart', 'search-button', ]; return $widget_list; } /** * Include Widgets files * * Load widgets files * * @since 1.2.0 * @access public */ public function include_widgets_files() { $js_files = $this->get_widget_script(); $widget_list = $this->get_widget_list(); if ( ! empty( $widget_list ) ) { foreach ( $widget_list as $handle => $data ) { require_once HFE_DIR . '/inc/widgets-manager/widgets/class-' . $data . '.php'; } } if ( ! empty( $js_files ) ) { foreach ( $js_files as $handle => $data ) { wp_register_script( $handle, HFE_URL . $data['path'], $data['dep'], HFE_VER, $data['in_footer'] ); } } $tag_validation = [ 'article', 'aside', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', 'nav', 'p', 'section', 'span' ]; wp_localize_script( 'elementor-editor', 'HfeWidgetsData', [ 'allowed_tags' => $tag_validation, ] ); // Emqueue the widgets style. wp_enqueue_style( 'hfe-widgets-style', HFE_URL . 'inc/widgets-css/frontend.css', [], HFE_VER ); } /** * Provide the SVG support for Retina Logo widget. * * @param array $mimes which return mime type. * * @since 1.2.0 * @return $mimes. */ public function hfe_svg_mime_types( $mimes ) { // New allowed mime types. $mimes['svg'] = 'image/svg+xml'; return $mimes; } /** * Register Category * * @since 1.2.0 * @param object $this_cat class. */ public function register_widget_category( $this_cat ) { $category = __( 'Elementor Header & Footer Builder', 'header-footer-elementor' ); $this_cat->add_category( 'hfe-widgets', [ 'title' => $category, 'icon' => 'eicon-font', ] ); return $this_cat; } /** * Register Widgets * * Register new Elementor widgets. * * @since 1.2.0 * @access public */ public function register_widgets() { // Its is now safe to include Widgets files. $this->include_widgets_files(); // Register Widgets. Plugin::instance()->widgets_manager->register( new Widgets\Retina() ); Plugin::instance()->widgets_manager->register( new Widgets\Copyright() ); Plugin::instance()->widgets_manager->register( new Widgets\Navigation_Menu() ); Plugin::instance()->widgets_manager->register( new Widgets\Page_Title() ); Plugin::instance()->widgets_manager->register( new Widgets\Site_Title() ); Plugin::instance()->widgets_manager->register( new Widgets\Site_Tagline() ); Plugin::instance()->widgets_manager->register( new Widgets\Site_Logo() ); Plugin::instance()->widgets_manager->register( new Widgets\Search_Button() ); if ( class_exists( 'woocommerce' ) ) { Plugin::instance()->widgets_manager->register( new Widgets\Cart() ); } } /** * Cart Fragments. * * Refresh the cart fragments. * * @since 1.5.0 * @param array $fragments Array of fragments. * @access public */ public function wc_refresh_mini_cart_count( $fragments ) { $has_cart = is_a( WC()->cart, 'WC_Cart' ); if ( ! $has_cart ) { return $fragments; } $cart_badge_count = ( null !== WC()->cart ) ? WC()->cart->get_cart_contents_count() : ''; if ( null !== WC()->cart ) { $fragments['span.hfe-cart-count'] = '' . WC()->cart->get_cart_contents_count() . ''; $fragments['span.elementor-button-text.hfe-subtotal'] = '' . WC()->cart->get_cart_subtotal() . ''; } $fragments['span.elementor-button-icon[data-counter]'] = '' . __( 'Cart', 'header-footer-elementor' ) . ''; return $fragments; } /** * Validate an HTML tag against a safe allowed list. * * @since 1.5.8 * @param string $tag specifies the HTML Tag. * @access public */ public static function validate_html_tag( $tag ) { // Check if Elementor method exists, else we will run custom validation code. if ( method_exists( 'Elementor\Utils', 'validate_html_tag' ) ) { return Utils::validate_html_tag( $tag ); } else { $allowed_tags = [ 'article', 'aside', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', 'nav', 'p', 'section', 'span' ]; return in_array( strtolower( $tag ), $allowed_tags ) ? $tag : 'div'; } } } /** * Initiate the class. */ Widgets_Loader::instance(); inc/widgets-manager/widgets/class-copyright.php000064400000012613146730610170015675 0ustar00register_content_copy_right_controls(); } /** * Register Copyright General Controls. * * @since 1.2.0 * @access protected */ protected function register_content_copy_right_controls() { $this->start_controls_section( 'section_title', [ 'label' => __( 'Copyright', 'header-footer-elementor' ), ] ); $this->add_control( 'shortcode', [ 'label' => __( 'Copyright Text', 'header-footer-elementor' ), 'type' => Controls_Manager::TEXTAREA, 'dynamic' => [ 'active' => true, ], 'default' => __( 'Copyright © [hfe_current_year] [hfe_site_title] | Powered by [hfe_site_title]', 'header-footer-elementor' ), ] ); $this->add_control( 'link', [ 'label' => __( 'Link', 'header-footer-elementor' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'header-footer-elementor' ), ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .hfe-copyright-wrapper' => 'text-align: {{VALUE}};', ], 'frontend_available' => true, ] ); $this->add_control( 'title_color', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'selectors' => [ // Stronger selector to avoid section style from overwriting. '{{WRAPPER}} .hfe-copyright-wrapper a, {{WRAPPER}} .hfe-copyright-wrapper' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'caption_typography', 'selector' => '{{WRAPPER}} .hfe-copyright-wrapper, {{WRAPPER}} .hfe-copyright-wrapper a', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); } /** * Render Copyright output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.2.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $link = isset( $settings['link']['url'] ) ? $settings['link']['url'] : ''; if ( ! empty( $link ) ) { $this->add_link_attributes( 'link', $settings['link'] ); } $copy_right_shortcode = do_shortcode( shortcode_unautop( $settings['shortcode'] ) ); ?> get_settings( 'shortcode' ) ); } /** * Render shortcode widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 1.3.0 * @access protected */ protected function content_template() {} } inc/widgets-manager/widgets/class-site-logo.php000064400000052740146730610170015574 0ustar00register_content_site_logo_controls(); $this->register_site_logo_styling_controls(); $this->register_site_logo_caption_styling_controls(); } /** * Register Site Logo General Controls. * * @since 1.3.0 * @access protected */ protected function register_content_site_logo_controls() { $this->start_controls_section( 'section_site_image', [ 'label' => __( 'Site Logo', 'header-footer-elementor' ), ] ); $this->add_control( 'site_logo_fallback', [ 'label' => __( 'Custom Image', 'header-footer-elementor' ), 'type' => Controls_Manager::SWITCHER, 'yes' => __( 'Yes', 'header-footer-elementor' ), 'no' => __( 'No', 'header-footer-elementor' ), 'default' => 'no', 'render_type' => 'template', ] ); $this->add_control( 'custom_image', [ 'label' => __( 'Add Image', 'header-footer-elementor' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'condition' => [ 'site_logo_fallback' => 'yes', ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'site_logo_size', 'label' => __( 'Image Size', 'header-footer-elementor' ), 'default' => 'medium', ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'eicon-text-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .hfe-site-logo-container, {{WRAPPER}} .hfe-caption-width figcaption' => 'text-align: {{VALUE}};', ], 'frontend_available' => true, ] ); $this->add_control( 'caption_source', [ 'label' => __( 'Caption', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'no' => __( 'No', 'header-footer-elementor' ), 'yes' => __( 'Yes', 'header-footer-elementor' ), ], 'default' => 'no', ] ); $this->add_control( 'caption', [ 'label' => __( 'Custom Caption', 'header-footer-elementor' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Enter caption', 'header-footer-elementor' ), 'condition' => [ 'caption_source' => 'yes', ], 'dynamic' => [ 'active' => true, ], 'label_block' => true, ] ); $this->add_control( 'link_to', [ 'label' => __( 'Link', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'header-footer-elementor' ), 'none' => __( 'None', 'header-footer-elementor' ), 'file' => __( 'Media File', 'header-footer-elementor' ), 'custom' => __( 'Custom URL', 'header-footer-elementor' ), ], ] ); $this->add_control( 'link', [ 'label' => __( 'Link', 'header-footer-elementor' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true, ], 'placeholder' => __( 'https://your-link.com', 'header-footer-elementor' ), 'condition' => [ 'link_to' => 'custom', ], 'show_label' => false, ] ); $this->add_control( 'open_lightbox', [ 'label' => __( 'Lightbox', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'header-footer-elementor' ), 'yes' => __( 'Yes', 'header-footer-elementor' ), 'no' => __( 'No', 'header-footer-elementor' ), ], 'condition' => [ 'link_to' => 'file', ], ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'header-footer-elementor' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); } /** * Register Site Image Style Controls. * * @since 1.3.0 * @access protected */ protected function register_site_logo_styling_controls() { $this->start_controls_section( 'section_style_site_logo_image', [ 'label' => __( 'Site logo', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'width', [ 'label' => __( 'Width', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'unit' => '%', ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'size_units' => [ '%', 'px', 'vw' ], 'range' => [ '%' => [ 'min' => 1, 'max' => 100, ], 'px' => [ 'min' => 1, 'max' => 1000, ], 'vw' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo .hfe-site-logo-container img' => 'width: {{SIZE}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'space', [ 'label' => __( 'Max Width', 'header-footer-elementor' ) . ' (%)', 'type' => Controls_Manager::SLIDER, 'default' => [ 'unit' => '%', ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'size_units' => [ '%' ], 'range' => [ '%' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo img' => 'max-width: {{SIZE}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->add_control( 'separator_panel_style', [ 'type' => Controls_Manager::DIVIDER, 'style' => 'thick', ] ); $this->add_control( 'site_logo_background_color', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .hfe-site-logo-set .hfe-site-logo-container' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'site_logo_image_border', [ 'label' => __( 'Border Style', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'label_block' => false, 'options' => [ 'none' => __( 'None', 'header-footer-elementor' ), 'solid' => __( 'Solid', 'header-footer-elementor' ), 'double' => __( 'Double', 'header-footer-elementor' ), 'dotted' => __( 'Dotted', 'header-footer-elementor' ), 'dashed' => __( 'Dashed', 'header-footer-elementor' ), ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo-container .hfe-site-logo-img' => 'border-style: {{VALUE}};', ], ] ); $this->add_control( 'site_logo_image_border_size', [ 'label' => __( 'Border Width', 'header-footer-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'default' => [ 'top' => '1', 'bottom' => '1', 'left' => '1', 'right' => '1', 'unit' => 'px', ], 'condition' => [ 'site_logo_image_border!' => 'none', ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo-container .hfe-site-logo-img' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'site_logo_image_border_color', [ 'label' => __( 'Border Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'condition' => [ 'site_logo_image_border!' => 'none', ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-site-logo-container .hfe-site-logo-img' => 'border-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'image_border_radius', [ 'label' => __( 'Border Radius', 'header-footer-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow', 'exclude' => [ 'box_shadow_position', ], 'selector' => '{{WRAPPER}} .hfe-site-logo img', ] ); $this->start_controls_tabs( 'image_effects' ); $this->start_controls_tab( 'normal', [ 'label' => __( 'Normal', 'header-footer-elementor' ), ] ); $this->add_control( 'opacity', [ 'label' => __( 'Opacity', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo img' => 'opacity: {{SIZE}};', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters', 'selector' => '{{WRAPPER}} .hfe-site-logo img', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'hover', [ 'label' => __( 'Hover', 'header-footer-elementor' ), ] ); $this->add_control( 'opacity_hover', [ 'label' => __( 'Opacity', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo:hover img' => 'opacity: {{SIZE}};', ], ] ); $this->add_control( 'background_hover_transition', [ 'label' => __( 'Transition Duration', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 3, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-site-logo img' => 'transition-duration: {{SIZE}}s', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters_hover', 'selector' => '{{WRAPPER}} .hfe-site-logo:hover img', ] ); $this->add_control( 'hover_animation', [ 'label' => __( 'Hover Animation', 'header-footer-elementor' ), 'type' => Controls_Manager::HOVER_ANIMATION, ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Site Logo style Controls. * * @since 1.3.0 * @access protected */ protected function register_site_logo_caption_styling_controls() { $this->start_controls_section( 'section_style_caption', [ 'label' => __( 'Caption', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'caption_source!' => 'none', ], ] ); $this->add_control( 'text_color', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .widget-image-caption' => 'color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], ] ); $this->add_control( 'caption_background_color', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .widget-image-caption' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'caption_typography', 'selector' => '{{WRAPPER}} .widget-image-caption', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'caption_text_shadow', 'selector' => '{{WRAPPER}} .widget-image-caption', ] ); $this->add_responsive_control( 'caption_padding', [ 'label' => __( 'Padding', 'header-footer-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .widget-image-caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'caption_space', [ 'label' => __( 'Spacing', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 0, 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .widget-image-caption' => 'margin-top: {{SIZE}}{{UNIT}}; margin-bottom: 0px;', ], 'frontend_available' => true, ] ); $this->end_controls_section(); } /** * Check if the current widget has caption * * @access private * @since 1.3.0 * * @param array $settings returns settings. * * @return boolean */ private function has_caption( $settings ) { return ( ! empty( $settings['caption_source'] ) && 'no' !== $settings['caption_source'] ); } /** * Get the caption for current widget. * * @access private * @since 1.3.0 * @param array $settings returns the caption. * * @return string */ private function get_caption( $settings ) { $caption = ''; if ( 'yes' === $settings['caption_source'] ) { $caption = ! empty( $settings['caption'] ) ? $settings['caption'] : ''; } return $caption; } /** * Render Site Image output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.3.0 * @param array $size returns the size of an image. * @access public */ public function site_image_url( $size ) { $settings = $this->get_settings_for_display(); if ( ! empty( $settings['custom_image']['url'] ) ) { $logo = wp_get_attachment_image_src( $settings['custom_image']['id'], $size, true ); } else { $logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), $size, true ); } return $logo[0]; } /** * Render Site Image output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.3.0 * @access protected */ protected function render() { $link = ''; $settings = $this->get_settings_for_display(); $has_caption = $this->has_caption( $settings ); $this->add_render_attribute( 'wrapper', 'class', 'hfe-site-logo' ); $size = $settings['site_logo_size_size']; $site_image = $this->site_image_url( $size ); if ( site_url() . '/wp-includes/images/media/default.png' === $site_image ) { $site_image = site_url() . '/wp-content/plugins/elementor/assets/images/placeholder.png'; } else { $site_image = $site_image; } if ( 'file' === $settings['link_to'] ) { $link = $site_image; $this->add_render_attribute( 'link', 'href', $link ); } elseif ( 'default' === $settings['link_to'] ) { $link = site_url(); $this->add_render_attribute( 'link', 'href', $link ); } else { $link = $this->get_link_url( $settings ); if ( $link ) { $this->add_link_attributes( 'link', $link ); } } $class = ''; if ( Plugin::$instance->editor->is_edit_mode() ) { $class = 'elementor-non-clickable'; } else { $class = 'elementor-clickable'; } ?>
    print_render_attribute_string( 'wrapper' ); ?>>
    print_render_attribute_string( 'link' ); ?>> null, // Width. 1 => null, // Height. 'bfi_thumb' => true, 'crop' => true, ]; $has_custom_size = false; if ( ! empty( $image_dimension['width'] ) ) { $has_custom_size = true; $image_size[0] = $image_dimension['width']; } if ( ! empty( $image_dimension['height'] ) ) { $has_custom_size = true; $image_size[1] = $image_dimension['height']; } if ( ! $has_custom_size ) { $image_size = 'full'; } } $image_url = $site_image; if ( ! empty( $settings['custom_image']['url'] ) ) { $image_data = wp_get_attachment_image_src( $settings['custom_image']['id'], $image_size, true ); } else { $image_data = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), $image_size, true ); } $site_image_class = 'elementor-animation-'; if ( ! empty( $settings['hover_animation'] ) ) { $img_animation = $settings['hover_animation']; } if ( ! empty( $image_data ) ) { $image_url = $image_data[0]; } if ( site_url() . '/wp-includes/images/media/default.png' === $image_url ) { $image_url = site_url() . '/wp-content/plugins/elementor/assets/images/placeholder.png'; } else { $image_url = $image_url; } $class_animation = $site_image_class . $img_animation; $image_unset = site_url() . '/wp-content/plugins/elementor/assets/images/placeholder.png'; if ( $image_unset !== $image_url ) { $image_url = $image_url; } ?>
    <?php echo esc_attr( $alt_text ); ?>
    get_caption( $settings ); ?>
    register_general_content_controls(); $this->register_heading_typo_content_controls(); } /** * Register Advanced Heading General Controls. * * @since 1.3.0 * @access protected */ protected function register_general_content_controls() { $this->start_controls_section( 'section_general_fields', [ 'label' => __( 'General', 'header-footer-elementor' ), ] ); $this->add_control( 'before', [ 'label' => __( 'Before Title Text', 'header-footer-elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'after', [ 'label' => __( 'After Title Text', 'header-footer-elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'icon', [ 'label' => __( 'Icon', 'header-footer-elementor' ), 'type' => Controls_Manager::ICONS, 'label_block' => 'true', ] ); $this->add_control( 'icon_indent', [ 'label' => __( 'Icon Spacing', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'condition' => [ 'icon[value]!' => '', ], 'selectors' => [ '{{WRAPPER}} .hfe-icon' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'custom_link', [ 'label' => __( 'Link', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'custom' => __( 'Custom URL', 'header-footer-elementor' ), 'default' => __( 'Default', 'header-footer-elementor' ), ], 'default' => 'default', ] ); $this->add_control( 'heading_link', [ 'label' => __( 'Link', 'header-footer-elementor' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'header-footer-elementor' ), 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => get_home_url(), ], 'condition' => [ 'custom_link' => 'custom', ], ] ); $this->add_control( 'size', [ 'label' => __( 'Size', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'header-footer-elementor' ), 'small' => __( 'Small', 'header-footer-elementor' ), 'medium' => __( 'Medium', 'header-footer-elementor' ), 'large' => __( 'Large', 'header-footer-elementor' ), 'xl' => __( 'XL', 'header-footer-elementor' ), 'xxl' => __( 'XXL', 'header-footer-elementor' ), ], ] ); $this->add_control( 'heading_tag', [ 'label' => __( 'HTML Tag', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'header-footer-elementor' ), 'h2' => __( 'H2', 'header-footer-elementor' ), 'h3' => __( 'H3', 'header-footer-elementor' ), 'h4' => __( 'H4', 'header-footer-elementor' ), 'h5' => __( 'H5', 'header-footer-elementor' ), 'h6' => __( 'H6', 'header-footer-elementor' ), ], 'default' => 'h2', ] ); $this->add_responsive_control( 'heading_text_align', [ 'label' => __( 'Alignment', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'fa fa-align-right', ], 'justify' => [ 'title' => __( 'Justify', 'header-footer-elementor' ), 'icon' => 'fa fa-align-justify', ], ], 'selectors' => [ '{{WRAPPER}} .hfe-heading' => 'text-align: {{VALUE}};', ], 'prefix_class' => 'hfe%s-heading-align-', 'frontend_available' => true, ] ); $this->end_controls_section(); } /** * Register Advanced Heading Typography Controls. * * @since 1.3.0 * @access protected */ protected function register_heading_typo_content_controls() { $this->start_controls_section( 'section_heading_typography', [ 'label' => __( 'Title', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'heading_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .elementor-heading-title, {{WRAPPER}} .hfe-heading a', ] ); $this->add_control( 'heading_color', [ 'label' => __( 'Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .hfe-heading-text' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-icon i' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-icon svg' => 'fill: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'heading_shadow', 'selector' => '{{WRAPPER}} .hfe-heading-text', ] ); $this->add_control( 'blend_mode', [ 'label' => __( 'Blend Mode', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Normal', 'header-footer-elementor' ), 'multiply' => 'Multiply', 'screen' => 'Screen', 'overlay' => 'Overlay', 'darken' => 'Darken', 'lighten' => 'Lighten', 'color-dodge' => 'Color Dodge', 'saturation' => 'Saturation', 'color' => 'Color', 'difference' => 'Difference', 'exclusion' => 'Exclusion', 'hue' => 'Hue', 'luminosity' => 'Luminosity', ], 'selectors' => [ '{{WRAPPER}} .hfe-heading-text' => 'mix-blend-mode: {{VALUE}}', ], 'separator' => 'none', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_icon', [ 'label' => __( 'Icon', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'icon[value]!' => '', ], ] ); $this->add_control( 'icon_color', [ 'label' => __( 'Icon Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'condition' => [ 'icon[value]!' => '', ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-icon i' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-icon svg' => 'fill: {{VALUE}};', ], ] ); $this->add_control( 'icons_hover_color', [ 'label' => __( 'Icon Hover Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'icon[value]!' => '', ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-icon:hover i' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-icon:hover svg' => 'fill: {{VALUE}};', ], ] ); $this->end_controls_section(); } /** * Render Heading output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.3.0 * @access protected */ protected function render() { $settings = $this->get_settings(); $title = get_bloginfo( 'name' ); $this->add_inline_editing_attributes( 'heading_title', 'basic' ); if ( ! empty( $settings['size'] ) ) { $this->add_render_attribute( 'title', 'class', 'elementor-size-' . $settings['size'] ); } if ( ! empty( $settings['heading_link']['url'] ) ) { $this->add_link_attributes( 'url', $settings['heading_link'] ); } $heading_size_tag = Widgets_Loader::validate_html_tag( $settings['heading_tag'] ); ?>
    get_render_attribute_string( 'url' ) ); ?>> < class="hfe-heading elementor-heading-title elementor-size-"> 'true' ] ); ?> >
    <# if ( '' == settings.heading_title ) { return; } if ( '' == settings.size ){ return; } if ( '' != settings.heading_link.url ) { view.addRenderAttribute( 'url', 'href', settings.heading_link.url ); } var iconHTML = elementor.helpers.renderIcon( view, settings.icon, { 'aria-hidden': true }, 'i' , 'object' ); var headingSizeTag = settings.heading_tag; if ( typeof elementor.helpers.validateHTMLTag === "function" ) { headingSizeTag = elementor.helpers.validateHTMLTag( headingSizeTag ); } else if( HfeWidgetsData.allowed_tags ) { headingSizeTag = HfeWidgetsData.allowed_tags.includes( headingSizeTag.toLowerCase() ) ? headingSizeTag : 'div'; } #>
    <# if ( '' != settings.heading_link.url ) { #> <# } #> <{{{ headingSizeTag }}} class="hfe-heading elementor-heading-title elementor-size-{{{ settings.size }}}"> <# if( '' != settings.icon.value ){ #> {{{ iconHTML.value }}} <# } #> <#if ( '' != settings.before ){#> {{{ settings.before }}} <#}#> <# if ( '' != settings.after ){#> {{{ settings.after }}} <#}#> <# if ( '' != settings.heading_link.url ) { #> <# } #>
    nav_menu_index++; } /** * Retrieve the list of available menus. * * Used to get the list of available menus. * * @since 1.3.0 * @access private * * @return array get WordPress menus list. */ private function get_available_menus() { $menus = wp_get_nav_menus(); $options = []; foreach ( $menus as $menu ) { $options[ $menu->slug ] = $menu->name; } return $options; } /** * Check if the Elementor is updated. * * @since 1.3.0 * * @return boolean if Elementor updated. */ public static function is_elementor_updated() { if ( class_exists( 'Elementor\Icons_Manager' ) ) { return true; } else { return false; } } /** * Register Nav Menu controls. * * @since 1.5.7 * @access protected */ protected function register_controls() { $this->register_general_content_controls(); $this->register_style_content_controls(); $this->register_dropdown_content_controls(); } /** * Register Nav Menu General Controls. * * @since 1.3.0 * @access protected */ protected function register_general_content_controls() { $this->start_controls_section( 'section_menu', [ 'label' => __( 'Menu', 'header-footer-elementor' ), ] ); $menus = $this->get_available_menus(); if ( ! empty( $menus ) ) { $this->add_control( 'menu', [ 'label' => __( 'Menu', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => $menus, 'default' => array_keys( $menus )[0], 'save_default' => true, /* translators: %s Nav menu URL */ 'description' => sprintf( __( 'Go to the Menus screen to manage your menus.', 'header-footer-elementor' ), admin_url( 'nav-menus.php' ) ), ] ); } else { $this->add_control( 'menu', [ 'type' => Controls_Manager::RAW_HTML, /* translators: %s Nav menu URL */ 'raw' => sprintf( __( 'There are no menus in your site.
    Go to the Menus screen to create one.', 'header-footer-elementor' ), admin_url( 'nav-menus.php?action=edit&menu=0' ) ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); } $this->add_control( 'menu_last_item', [ 'label' => __( 'Last Menu Item', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'none' => __( 'Default', 'header-footer-elementor' ), 'cta' => __( 'Button', 'header-footer-elementor' ), ], 'default' => 'none', 'condition' => [ 'layout!' => 'expandible', ], ] ); $this->add_control( 'schema_support', [ 'label' => __( 'Enable Schema Support', 'header-footer-elementor' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'header-footer-elementor' ), 'label_off' => __( 'No', 'header-footer-elementor' ), 'return_value' => 'yes', 'default' => 'no', 'render_type' => 'template', 'separator' => 'before', ] ); $current_theme = wp_get_theme(); if ( 'Twenty Twenty-One' === $current_theme->get( 'Name' ) ) { $this->add_control( 'hide_theme_icons', [ 'label' => __( 'Hide + & - Sign', 'header-footer-elementor' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'header-footer-elementor' ), 'label_off' => __( 'No', 'header-footer-elementor' ), 'return_value' => 'yes', 'default' => 'no', 'prefix_class' => 'hfe-nav-menu__theme-icon-', ] ); } $this->end_controls_section(); $this->start_controls_section( 'section_layout', [ 'label' => __( 'Layout', 'header-footer-elementor' ), ] ); $this->add_control( 'layout', [ 'label' => __( 'Layout', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'horizontal', 'options' => [ 'horizontal' => __( 'Horizontal', 'header-footer-elementor' ), 'vertical' => __( 'Vertical', 'header-footer-elementor' ), 'expandible' => __( 'Expanded', 'header-footer-elementor' ), 'flyout' => __( 'Flyout', 'header-footer-elementor' ), ], ] ); $this->add_control( 'navmenu_align', [ 'label' => __( 'Alignment', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Justify', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-stretch', ], ], 'default' => 'left', 'condition' => [ 'layout' => [ 'horizontal', 'vertical' ], ], 'prefix_class' => 'hfe-nav-menu__align-', ] ); $this->add_control( 'flyout_layout', [ 'label' => __( 'Flyout Orientation', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Left', 'header-footer-elementor' ), 'right' => __( 'Right', 'header-footer-elementor' ), ], 'condition' => [ 'layout' => 'flyout', ], ] ); $this->add_control( 'flyout_type', [ 'label' => __( 'Appear Effect', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'label_block' => false, 'options' => [ 'normal' => __( 'Slide', 'header-footer-elementor' ), 'push' => __( 'Push', 'header-footer-elementor' ), ], 'render_type' => 'template', 'condition' => [ 'layout' => 'flyout', ], ] ); $this->add_responsive_control( 'hamburger_align', [ 'label' => __( 'Hamburger Align', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors_dictionary' => [ 'left' => 'margin-right: auto', 'center' => 'margin: 0 auto', 'right' => 'margin-left: auto', ], 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu__toggle, {{WRAPPER}} .hfe-nav-menu-icon' => '{{VALUE}}', ], 'condition' => [ 'layout' => [ 'expandible', 'flyout' ], ], 'label_block' => false, 'frontend_available' => true, ] ); $this->add_responsive_control( 'hamburger_menu_align', [ 'label' => __( 'Menu Items Align', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-right', ], 'space-between' => [ 'title' => __( 'Justify', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-stretch', ], ], 'default' => 'space-between', 'condition' => [ 'layout' => [ 'expandible', 'flyout' ], ], 'selectors' => [ '{{WRAPPER}} li.menu-item a' => 'justify-content: {{VALUE}};', '{{WRAPPER}} li .elementor-button-wrapper' => 'text-align: {{VALUE}};', '{{WRAPPER}}.hfe-menu-item-flex-end li .elementor-button-wrapper' => 'text-align: right;', ], 'prefix_class' => 'hfe-menu-item-', 'frontend_available' => true, ] ); $this->add_control( 'submenu_icon', [ 'label' => __( 'Submenu Icon', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'arrow', 'options' => [ 'arrow' => __( 'Arrows', 'header-footer-elementor' ), 'plus' => __( 'Plus Sign', 'header-footer-elementor' ), 'classic' => __( 'Classic', 'header-footer-elementor' ), ], 'prefix_class' => 'hfe-submenu-icon-', ] ); $this->add_control( 'submenu_animation', [ 'label' => __( 'Submenu Animation', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'options' => [ 'none' => __( 'Default', 'header-footer-elementor' ), 'slide_up' => __( 'Slide Up', 'header-footer-elementor' ), ], 'prefix_class' => 'hfe-submenu-animation-', 'condition' => [ 'layout' => 'horizontal', ], ] ); $this->add_control( 'link_redirect', [ 'label' => __( 'Action On Menu Click', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'child', 'description' => __( 'For Horizontal layout, this will affect on the selected breakpoint', 'header-footer-elementor' ), 'options' => [ 'child' => __( 'Open Submenu', 'header-footer-elementor' ), 'self_link' => __( 'Redirect To Self Link', 'header-footer-elementor' ), ], 'prefix_class' => 'hfe-link-redirect-', ] ); $this->add_control( 'heading_responsive', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Responsive', 'header-footer-elementor' ), 'separator' => 'before', 'condition' => [ 'layout' => [ 'horizontal', 'vertical' ], ], ] ); $this->add_control( 'dropdown', [ 'label' => __( 'Breakpoint', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'tablet', 'options' => [ 'mobile' => __( 'Mobile (768px >)', 'header-footer-elementor' ), 'tablet' => __( 'Tablet (1025px >)', 'header-footer-elementor' ), 'none' => __( 'None', 'header-footer-elementor' ), ], 'prefix_class' => 'hfe-nav-menu__breakpoint-', 'condition' => [ 'layout' => [ 'horizontal', 'vertical' ], ], 'render_type' => 'template', ] ); $this->add_control( 'resp_align', [ 'label' => __( 'Alignment', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'center', 'description' => __( 'This is the alignement of menu icon on selected responsive breakpoints.', 'header-footer-elementor' ), 'condition' => [ 'layout' => [ 'horizontal', 'vertical' ], 'dropdown!' => 'none', ], 'selectors_dictionary' => [ 'left' => 'margin-right: auto', 'center' => 'margin: 0 auto', 'right' => 'margin-left: auto', ], 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu__toggle' => '{{VALUE}}', ], ] ); $this->add_control( 'full_width_dropdown', [ 'label' => __( 'Full Width', 'header-footer-elementor' ), 'description' => __( 'Enable this option to stretch the Sub Menu to Full Width.', 'header-footer-elementor' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'header-footer-elementor' ), 'label_off' => __( 'No', 'header-footer-elementor' ), 'return_value' => 'yes', 'default' => 'yes', 'condition' => [ 'dropdown!' => 'none', 'layout!' => 'flyout', ], 'render_type' => 'template', ] ); if ( $this->is_elementor_updated() ) { $this->add_control( 'dropdown_icon', [ 'label' => __( 'Menu Icon', 'header-footer-elementor' ), 'type' => Controls_Manager::ICONS, 'label_block' => 'true', 'default' => [ 'value' => 'fas fa-align-justify', 'library' => 'fa-solid', ], 'condition' => [ 'dropdown!' => 'none', ], ] ); } else { $this->add_control( 'dropdown_icon', [ 'label' => __( 'Icon', 'header-footer-elementor' ), 'type' => Controls_Manager::ICON, 'label_block' => 'true', 'default' => 'fa fa-align-justify', 'condition' => [ 'dropdown!' => 'none', ], ] ); } if ( $this->is_elementor_updated() ) { $this->add_control( 'dropdown_close_icon', [ 'label' => __( 'Close Icon', 'header-footer-elementor' ), 'type' => Controls_Manager::ICONS, 'label_block' => 'true', 'default' => [ 'value' => 'far fa-window-close', 'library' => 'fa-regular', ], 'condition' => [ 'dropdown!' => 'none', ], ] ); } else { $this->add_control( 'dropdown_close_icon', [ 'label' => __( 'Close Icon', 'header-footer-elementor' ), 'type' => Controls_Manager::ICON, 'label_block' => 'true', 'default' => 'fa fa-close', 'condition' => [ 'dropdown!' => 'none', ], ] ); } $this->end_controls_section(); } /** * Register Nav Menu General Controls. * * @since 1.3.0 * @access protected */ protected function register_style_content_controls() { $this->start_controls_section( 'section_style_main-menu', [ 'label' => __( 'Main Menu', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'layout!' => 'expandible', ], ] ); $this->add_responsive_control( 'width_flyout_menu_item', [ 'label' => __( 'Flyout Box Width', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 500, 'min' => 100, ], ], 'default' => [ 'size' => 300, 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .hfe-flyout-wrapper .hfe-side' => 'width: {{SIZE}}{{UNIT}}', '{{WRAPPER}} .hfe-flyout-open.left' => 'left: -{{SIZE}}{{UNIT}}', '{{WRAPPER}} .hfe-flyout-open.right' => 'right: -{{SIZE}}{{UNIT}}', ], 'condition' => [ 'layout' => 'flyout', ], 'render_type' => 'template', 'frontend_available' => true, ] ); $this->add_responsive_control( 'padding_flyout_menu_item', [ 'label' => __( 'Flyout Box Padding', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'default' => [ 'size' => 30, 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .hfe-flyout-content' => 'padding: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'layout' => 'flyout', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'padding_horizontal_menu_item', [ 'label' => __( 'Horizontal Padding', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'max' => 50, ], ], 'default' => [ 'size' => 15, 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}', '{{WRAPPER}} .menu-item a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 20px );padding-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .hfe-nav-menu__layout-vertical .menu-item ul ul a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 40px );padding-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .hfe-nav-menu__layout-vertical .menu-item ul ul ul a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 60px );padding-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .hfe-nav-menu__layout-vertical .menu-item ul ul ul ul a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 80px );padding-right: {{SIZE}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'padding_vertical_menu_item', [ 'label' => __( 'Vertical Padding', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'max' => 50, ], ], 'default' => [ 'size' => 15, 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item, {{WRAPPER}} .menu-item a.hfe-sub-menu-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'menu_space_between', [ 'label' => __( 'Space Between', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'max' => 100, ], ], 'selectors' => [ 'body:not(.rtl) {{WRAPPER}} .hfe-nav-menu__layout-horizontal .hfe-nav-menu > li.menu-item:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}}', 'body.rtl {{WRAPPER}} .hfe-nav-menu__layout-horizontal .hfe-nav-menu > li.menu-item:not(:last-child)' => 'margin-left: {{SIZE}}{{UNIT}}', '{{WRAPPER}} nav:not(.hfe-nav-menu__layout-horizontal) .hfe-nav-menu > li.menu-item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}', '(tablet)body:not(.rtl) {{WRAPPER}}.hfe-nav-menu__breakpoint-tablet .hfe-nav-menu__layout-horizontal .hfe-nav-menu > li.menu-item:not(:last-child)' => 'margin-right: 0px', '(mobile)body:not(.rtl) {{WRAPPER}}.hfe-nav-menu__breakpoint-mobile .hfe-nav-menu__layout-horizontal .hfe-nav-menu > li.menu-item:not(:last-child)' => 'margin-right: 0px', '(tablet)body {{WRAPPER}} nav.hfe-nav-menu__layout-vertical .hfe-nav-menu > li.menu-item:not(:last-child)' => 'margin-bottom: 0px', '(mobile)body {{WRAPPER}} nav.hfe-nav-menu__layout-vertical .hfe-nav-menu > li.menu-item:not(:last-child)' => 'margin-bottom: 0px', ], 'condition' => [ 'layout!' => 'expandible', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'menu_row_space', [ 'label' => __( 'Row Spacing', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'max' => 100, ], ], 'selectors' => [ 'body:not(.rtl) {{WRAPPER}} .hfe-nav-menu__layout-horizontal .hfe-nav-menu > li.menu-item' => 'margin-bottom: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'layout' => 'horizontal', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'menu_top_space', [ 'label' => __( 'Menu Item Top Spacing', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-flyout-wrapper .hfe-nav-menu > li.menu-item:first-child' => 'margin-top: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'layout' => 'flyout', ], 'frontend_available' => true, ] ); $this->add_control( 'bg_color_flyout', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#FFFFFF', 'selectors' => [ '{{WRAPPER}} .hfe-flyout-content' => 'background-color: {{VALUE}}', ], 'condition' => [ 'layout' => 'flyout', ], ] ); $this->add_control( 'pointer', [ 'label' => __( 'Link Hover Effect', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'options' => [ 'none' => __( 'None', 'header-footer-elementor' ), 'underline' => __( 'Underline', 'header-footer-elementor' ), 'overline' => __( 'Overline', 'header-footer-elementor' ), 'double-line' => __( 'Double Line', 'header-footer-elementor' ), 'framed' => __( 'Framed', 'header-footer-elementor' ), 'text' => __( 'Text', 'header-footer-elementor' ), ], 'condition' => [ 'layout' => [ 'horizontal' ], ], ] ); $this->add_control( 'animation_line', [ 'label' => __( 'Animation', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'fade', 'options' => [ 'fade' => 'Fade', 'slide' => 'Slide', 'grow' => 'Grow', 'drop-in' => 'Drop In', 'drop-out' => 'Drop Out', 'none' => 'None', ], 'condition' => [ 'layout' => [ 'horizontal' ], 'pointer' => [ 'underline', 'overline', 'double-line' ], ], ] ); $this->add_control( 'animation_framed', [ 'label' => __( 'Frame Animation', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'fade', 'options' => [ 'fade' => 'Fade', 'grow' => 'Grow', 'shrink' => 'Shrink', 'draw' => 'Draw', 'corners' => 'Corners', 'none' => 'None', ], 'condition' => [ 'layout' => [ 'horizontal' ], 'pointer' => 'framed', ], ] ); $this->add_control( 'animation_text', [ 'label' => __( 'Animation', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'grow', 'options' => [ 'grow' => 'Grow', 'shrink' => 'Shrink', 'sink' => 'Sink', 'float' => 'Float', 'skew' => 'Skew', 'rotate' => 'Rotate', 'none' => 'None', ], 'condition' => [ 'layout' => [ 'horizontal' ], 'pointer' => 'text', ], ] ); $this->add_control( 'style_divider', [ 'type' => Controls_Manager::DIVIDER, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'menu_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'separator' => 'before', 'selector' => '{{WRAPPER}} a.hfe-menu-item, {{WRAPPER}} a.hfe-sub-menu-item', ] ); $this->start_controls_tabs( 'tabs_menu_item_style' ); $this->start_controls_tab( 'tab_menu_item_normal', [ 'label' => __( 'Normal', 'header-footer-elementor' ), ] ); $this->add_control( 'color_menu_item', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item, {{WRAPPER}} .sub-menu a.hfe-sub-menu-item' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'bg_color_menu_item', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item, {{WRAPPER}} .sub-menu, {{WRAPPER}} nav.hfe-dropdown, {{WRAPPER}} .hfe-dropdown-expandible' => 'background-color: {{VALUE}}', ], 'condition' => [ 'layout!' => 'flyout', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_menu_item_hover', [ 'label' => __( 'Hover', 'header-footer-elementor' ), ] ); $this->add_control( 'color_menu_item_hover', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item:hover, {{WRAPPER}} .sub-menu a.hfe-sub-menu-item:hover, {{WRAPPER}} .menu-item.current-menu-item a.hfe-menu-item, {{WRAPPER}} .menu-item a.hfe-menu-item.highlighted, {{WRAPPER}} .menu-item a.hfe-menu-item:focus' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'bg_color_menu_item_hover', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item:hover, {{WRAPPER}} .sub-menu a.hfe-sub-menu-item:hover, {{WRAPPER}} .menu-item.current-menu-item a.hfe-menu-item, {{WRAPPER}} .menu-item a.hfe-menu-item.highlighted, {{WRAPPER}} .menu-item a.hfe-menu-item:focus' => 'background-color: {{VALUE}}', ], 'condition' => [ 'layout!' => 'flyout', ], ] ); $this->add_control( 'pointer_color_menu_item_hover', [ 'label' => __( 'Link Hover Effect Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu-layout:not(.hfe-pointer__framed) .menu-item.parent a.hfe-menu-item:before, {{WRAPPER}} .hfe-nav-menu-layout:not(.hfe-pointer__framed) .menu-item.parent a.hfe-menu-item:after' => 'background-color: {{VALUE}}', '{{WRAPPER}} .hfe-nav-menu-layout:not(.hfe-pointer__framed) .menu-item.parent .sub-menu .hfe-has-submenu-container a:after' => 'background-color: unset', '{{WRAPPER}} .hfe-pointer__framed .menu-item.parent a.hfe-menu-item:before, {{WRAPPER}} .hfe-pointer__framed .menu-item.parent a.hfe-menu-item:after' => 'border-color: {{VALUE}}', ], 'condition' => [ 'pointer!' => [ 'none', 'text' ], 'layout!' => 'flyout', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_menu_item_active', [ 'label' => __( 'Active', 'header-footer-elementor' ), ] ); $this->add_control( 'color_menu_item_active', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .menu-item.current-menu-item a.hfe-menu-item, {{WRAPPER}} .menu-item.current-menu-ancestor a.hfe-menu-item' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'bg_color_menu_item_active', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .menu-item.current-menu-item a.hfe-menu-item, {{WRAPPER}} .menu-item.current-menu-ancestor a.hfe-menu-item' => 'background-color: {{VALUE}}', ], 'condition' => [ 'layout!' => 'flyout', ], ] ); $this->add_control( 'pointer_color_menu_item_active', [ 'label' => __( 'Link Hover Effect Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu-layout:not(.hfe-pointer__framed) .menu-item.parent.current-menu-item a.hfe-menu-item:before, {{WRAPPER}} .hfe-nav-menu-layout:not(.hfe-pointer__framed) .menu-item.parent.current-menu-item a.hfe-menu-item:after' => 'background-color: {{VALUE}}', '{{WRAPPER}} .hfe-nav-menu:not(.hfe-pointer__framed) .menu-item.parent .sub-menu .hfe-has-submenu-container a.current-menu-item:after' => 'background-color: unset', '{{WRAPPER}} .hfe-pointer__framed .menu-item.parent.current-menu-item a.hfe-menu-item:before, {{WRAPPER}} .hfe-pointer__framed .menu-item.parent.current-menu-item a.hfe-menu-item:after' => 'border-color: {{VALUE}}', ], 'condition' => [ 'pointer!' => [ 'none', 'text' ], 'layout!' => 'flyout', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Nav Menu General Controls. * * @since 1.3.0 * @access protected */ protected function register_dropdown_content_controls() { $this->start_controls_section( 'section_style_dropdown', [ 'label' => __( 'Dropdown', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'dropdown_description', [ 'raw' => __( 'Note: On desktop, below style options will apply to the submenu. On mobile, this will apply to the entire menu.', 'header-footer-elementor' ), 'type' => Controls_Manager::RAW_HTML, 'content_classes' => 'elementor-descriptor', 'condition' => [ 'layout!' => [ 'expandible', 'flyout', ], ], ] ); $this->start_controls_tabs( 'tabs_dropdown_item_style' ); $this->start_controls_tab( 'tab_dropdown_item_normal', [ 'label' => __( 'Normal', 'header-footer-elementor' ), ] ); $this->add_control( 'color_dropdown_item', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .sub-menu a.hfe-sub-menu-item, {{WRAPPER}} .elementor-menu-toggle, {{WRAPPER}} nav.hfe-dropdown li a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown li a.hfe-sub-menu-item, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-sub-menu-item' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'background_color_dropdown_item', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#fff', 'selectors' => [ '{{WRAPPER}} .sub-menu, {{WRAPPER}} nav.hfe-dropdown, {{WRAPPER}} nav.hfe-dropdown-expandible, {{WRAPPER}} nav.hfe-dropdown .menu-item a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown .menu-item a.hfe-sub-menu-item' => 'background-color: {{VALUE}}', ], 'separator' => 'after', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_dropdown_item_hover', [ 'label' => __( 'Hover', 'header-footer-elementor' ), ] ); $this->add_control( 'color_dropdown_item_hover', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .sub-menu a.hfe-sub-menu-item:hover, {{WRAPPER}} .elementor-menu-toggle:hover, {{WRAPPER}} nav.hfe-dropdown li a.hfe-menu-item:hover, {{WRAPPER}} nav.hfe-dropdown li a.hfe-sub-menu-item:hover, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-menu-item:hover, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-sub-menu-item:hover' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'background_color_dropdown_item_hover', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .sub-menu a.hfe-sub-menu-item:hover, {{WRAPPER}} nav.hfe-dropdown li a.hfe-menu-item:hover, {{WRAPPER}} nav.hfe-dropdown li a.hfe-sub-menu-item:hover, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-menu-item:hover, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-sub-menu-item:hover' => 'background-color: {{VALUE}}', ], 'separator' => 'after', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_dropdown_item_active', [ 'label' => __( 'Active', 'header-footer-elementor' ), ] ); $this->add_control( 'color_dropdown_item_active', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .sub-menu .menu-item.current-menu-item a.hfe-sub-menu-item.hfe-sub-menu-item-active, {{WRAPPER}} nav.hfe-dropdown .menu-item.current-menu-item a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown .menu-item.current-menu-ancestor a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown .sub-menu .menu-item.current-menu-item a.hfe-sub-menu-item.hfe-sub-menu-item-active ' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'background_color_dropdown_item_active', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .sub-menu .menu-item.current-menu-item a.hfe-sub-menu-item.hfe-sub-menu-item-active, {{WRAPPER}} nav.hfe-dropdown .menu-item.current-menu-item a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown .menu-item.current-menu-ancestor a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown .sub-menu .menu-item.current-menu-item a.hfe-sub-menu-item.hfe-sub-menu-item-active' => 'background-color: {{VALUE}}', ], 'separator' => 'after', ] ); $this->end_controls_tabs(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'dropdown_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], 'separator' => 'before', 'selector' => ' {{WRAPPER}} .sub-menu li a.hfe-sub-menu-item, {{WRAPPER}} nav.hfe-dropdown li a.hfe-sub-menu-item, {{WRAPPER}} nav.hfe-dropdown li a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-sub-menu-item', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'dropdown_border', 'selector' => '{{WRAPPER}} nav.hfe-nav-menu__layout-horizontal .sub-menu, {{WRAPPER}} nav:not(.hfe-nav-menu__layout-horizontal) .sub-menu.sub-menu-open, {{WRAPPER}} nav.hfe-dropdown .hfe-nav-menu, {{WRAPPER}} nav.hfe-dropdown-expandible .hfe-nav-menu', ] ); $this->add_responsive_control( 'dropdown_border_radius', [ 'label' => __( 'Border Radius', 'header-footer-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .sub-menu' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .sub-menu li.menu-item:first-child' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius: {{RIGHT}}{{UNIT}};overflow:hidden;', '{{WRAPPER}} .sub-menu li.menu-item:last-child' => 'border-bottom-right-radius: {{BOTTOM}}{{UNIT}}; border-bottom-left-radius: {{LEFT}}{{UNIT}};overflow:hidden', '{{WRAPPER}} nav.hfe-dropdown' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} nav.hfe-dropdown li.menu-item:first-child' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius: {{RIGHT}}{{UNIT}};overflow:hidden', '{{WRAPPER}} nav.hfe-dropdown li.menu-item:last-child' => 'border-bottom-right-radius: {{BOTTOM}}{{UNIT}}; border-bottom-left-radius: {{LEFT}}{{UNIT}};overflow:hidden', '{{WRAPPER}} nav.hfe-dropdown-expandible' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} nav.hfe-dropdown-expandible li.menu-item:first-child' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius: {{RIGHT}}{{UNIT}};overflow:hidden', '{{WRAPPER}} nav.hfe-dropdown-expandible li.menu-item:last-child' => 'border-bottom-right-radius: {{BOTTOM}}{{UNIT}}; border-bottom-left-radius: {{LEFT}}{{UNIT}};overflow:hidden', ], 'frontend_available' => true, ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'dropdown_box_shadow', 'exclude' => [ 'box_shadow_position', ], 'selector' => '{{WRAPPER}} .hfe-nav-menu .sub-menu, {{WRAPPER}} nav.hfe-dropdown, {{WRAPPER}} nav.hfe-dropdown-expandible', 'separator' => 'after', ] ); $this->add_responsive_control( 'width_dropdown_item', [ 'label' => __( 'Dropdown Width (px)', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], ], 'default' => [ 'size' => '220', 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} ul.sub-menu' => 'width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'layout' => 'horizontal', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'padding_horizontal_dropdown_item', [ 'label' => __( 'Horizontal Padding', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .sub-menu li a.hfe-sub-menu-item, {{WRAPPER}} nav.hfe-dropdown li a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-menu-item' => 'padding-left: {{SIZE}}{{UNIT}}; padding-right: {{SIZE}}{{UNIT}}', '{{WRAPPER}} nav.hfe-dropdown-expandible a.hfe-sub-menu-item, {{WRAPPER}} nav.hfe-dropdown li a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 20px );padding-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .hfe-dropdown .menu-item ul ul a.hfe-sub-menu-item, {{WRAPPER}} .hfe-dropdown-expandible .menu-item ul ul a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 40px );padding-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .hfe-dropdown .menu-item ul ul ul a.hfe-sub-menu-item, {{WRAPPER}} .hfe-dropdown-expandible .menu-item ul ul ul a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 60px );padding-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .hfe-dropdown .menu-item ul ul ul ul a.hfe-sub-menu-item, {{WRAPPER}} .hfe-dropdown-expandible .menu-item ul ul ul ul a.hfe-sub-menu-item' => 'padding-left: calc( {{SIZE}}{{UNIT}} + 80px );padding-right: {{SIZE}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'padding_vertical_dropdown_item', [ 'label' => __( 'Vertical Padding', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'default' => [ 'size' => 15, 'unit' => 'px', ], 'range' => [ 'px' => [ 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .sub-menu a.hfe-sub-menu-item, {{WRAPPER}} nav.hfe-dropdown li a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown li a.hfe-sub-menu-item, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-menu-item, {{WRAPPER}} nav.hfe-dropdown-expandible li a.hfe-sub-menu-item' => 'padding-top: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}}', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'distance_from_menu', [ 'label' => __( 'Top Distance', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => -100, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} nav.hfe-nav-menu__layout-horizontal:not(.hfe-dropdown) ul.sub-menu, {{WRAPPER}} nav.hfe-nav-menu__layout-expandible.menu-is-active, {{WRAPPER}} nav.hfe-nav-menu__layout-vertical:not(.hfe-dropdown) ul.sub-menu' => 'margin-top: {{SIZE}}px;', '{{WRAPPER}} .hfe-dropdown.menu-is-active' => 'margin-top: {{SIZE}}px;', ], 'condition' => [ 'layout' => [ 'horizontal', 'vertical', 'expandible' ], ], 'frontend_available' => true, ] ); $this->add_control( 'heading_dropdown_divider', [ 'label' => __( 'Divider', 'header-footer-elementor' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'dropdown_divider_border', [ 'label' => __( 'Border Style', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'solid', 'label_block' => false, 'options' => [ 'none' => __( 'None', 'header-footer-elementor' ), 'solid' => __( 'Solid', 'header-footer-elementor' ), 'double' => __( 'Double', 'header-footer-elementor' ), 'dotted' => __( 'Dotted', 'header-footer-elementor' ), 'dashed' => __( 'Dashed', 'header-footer-elementor' ), ], 'selectors' => [ '{{WRAPPER}} .sub-menu li.menu-item:not(:last-child), {{WRAPPER}} nav.hfe-dropdown li.menu-item:not(:last-child), {{WRAPPER}} nav.hfe-dropdown-expandible li.menu-item:not(:last-child)' => 'border-bottom-style: {{VALUE}};', ], ] ); $this->add_control( 'divider_border_color', [ 'label' => __( 'Border Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#c4c4c4', 'selectors' => [ '{{WRAPPER}} .sub-menu li.menu-item:not(:last-child), {{WRAPPER}} nav.hfe-dropdown li.menu-item:not(:last-child), {{WRAPPER}} nav.hfe-dropdown-expandible li.menu-item:not(:last-child)' => 'border-bottom-color: {{VALUE}};', ], 'condition' => [ 'dropdown_divider_border!' => 'none', ], ] ); $this->add_control( 'dropdown_divider_width', [ 'label' => __( 'Border Width', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'default' => [ 'size' => '1', 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .sub-menu li.menu-item:not(:last-child), {{WRAPPER}} nav.hfe-dropdown li.menu-item:not(:last-child), {{WRAPPER}} nav.hfe-dropdown-expandible li.menu-item:not(:last-child)' => 'border-bottom-width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'dropdown_divider_border!' => 'none', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'style_toggle', [ 'label' => __( 'Menu Trigger & Close Icon', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_toggle_style' ); $this->start_controls_tab( 'toggle_style_normal', [ 'label' => __( 'Normal', 'header-footer-elementor' ), ] ); $this->add_control( 'toggle_color', [ 'label' => __( 'Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} div.hfe-nav-menu-icon' => 'color: {{VALUE}}', '{{WRAPPER}} div.hfe-nav-menu-icon svg' => 'fill: {{VALUE}}', ], ] ); $this->add_control( 'toggle_background_color', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu-icon' => 'background-color: {{VALUE}}; padding: 0.35em;', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'toggle_hover', [ 'label' => __( 'Hover', 'header-footer-elementor' ), ] ); $this->add_control( 'toggle_hover_color', [ 'label' => __( 'Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} div.hfe-nav-menu-icon:hover' => 'color: {{VALUE}}', '{{WRAPPER}} div.hfe-nav-menu-icon:hover svg' => 'fill: {{VALUE}}', ], ] ); $this->add_control( 'toggle_hover_background_color', [ 'label' => __( 'Background Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu-icon:hover' => 'background-color: {{VALUE}}; padding: 0.35em;', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'toggle_size', [ 'label' => __( 'Icon Size', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 15, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu-icon' => 'font-size: {{SIZE}}{{UNIT}}', '{{WRAPPER}} .hfe-nav-menu-icon svg' => 'font-size: {{SIZE}}px;line-height: {{SIZE}}px;height: {{SIZE}}px;width: {{SIZE}}px;', ], 'frontend_available' => true, 'separator' => 'before', ] ); $this->add_responsive_control( 'toggle_border_width', [ 'label' => __( 'Border Width', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu-icon' => 'border-width: {{SIZE}}{{UNIT}}; padding: 0.35em;', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'toggle_border_radius', [ 'label' => __( 'Border Radius', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .hfe-nav-menu-icon' => 'border-radius: {{SIZE}}{{UNIT}}', ], 'frontend_available' => true, ] ); $this->add_control( 'close_color_flyout', [ 'label' => __( 'Close Icon Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '#7A7A7A', 'selectors' => [ '{{WRAPPER}} .hfe-flyout-close' => 'color: {{VALUE}}', '{{WRAPPER}} .hfe-flyout-close svg' => 'fill: {{VALUE}}', ], 'condition' => [ 'layout' => 'flyout', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'close_flyout_size', [ 'label' => __( 'Close Icon Size', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 15, ], ], 'selectors' => [ '{{WRAPPER}} .hfe-flyout-close, {{WRAPPER}} .hfe-flyout-close svg' => 'height: {{SIZE}}px; width: {{SIZE}}px; font-size: {{SIZE}}px; line-height: {{SIZE}}px;', ], 'condition' => [ 'layout' => 'flyout', ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'style_button', [ 'label' => __( 'Button', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'menu_last_item' => 'cta', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'all_typography', 'label' => __( 'Typography', 'header-footer-elementor' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], 'selector' => '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button', ] ); $this->add_responsive_control( 'padding', [ 'label' => __( 'Padding', 'header-footer-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'frontend_available' => true, ] ); $this->start_controls_tabs( '_button_style' ); $this->start_controls_tab( '_button_normal', [ 'label' => __( 'Normal', 'header-footer-elementor' ), ] ); $this->add_control( 'all_text_color', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'all_background_color', 'label' => __( 'Background Color', 'header-footer-elementor' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button', 'fields_options' => [ 'color' => [ 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], ], ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'all_border', 'label' => __( 'Border', 'header-footer-elementor' ), 'selector' => '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button', ] ); $this->add_control( 'all_border_radius', [ 'label' => __( 'Border Radius', 'header-footer-elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'all_button_box_shadow', 'selector' => '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'all_button_hover', [ 'label' => __( 'Hover', 'header-footer-elementor' ), ] ); $this->add_control( 'all_hover_color', [ 'label' => __( 'Text Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button:hover' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'all_background_hover_color', 'label' => __( 'Background Color', 'header-footer-elementor' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button:hover', 'fields_options' => [ 'color' => [ 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], ], ], ] ); $this->add_control( 'all_border_hover_color', [ 'label' => __( 'Border Hover Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'all_button_hover_box_shadow', 'selector' => '{{WRAPPER}} .menu-item a.hfe-menu-item.elementor-button:hover', 'separator' => 'after', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Add itemprop for Navigation Schema. * * @since 1.5.2 * @param string $atts link attributes. * @access public */ public function handle_link_attrs( $atts ) { $atts .= ' itemprop="url"'; return $atts; } /** * Add itemprop to the li tag of Navigation Schema. * * @since 1.6.0 * @param string $value link attributes. * @access public */ public function handle_li_values( $value ) { $value .= ' itemprop="name"'; return $value; } /** * Get the menu and close icon HTML. * * @since 1.5.2 * @param array $settings Widget settings array. * @access public */ public function get_menu_close_icon( $settings ) { $menu_icon = ''; $close_icon = ''; $icons = []; $icon_settings = [ $settings['dropdown_icon'], $settings['dropdown_close_icon'], ]; foreach ( $icon_settings as $icon ) { if ( $this->is_elementor_updated() ) { ob_start(); \Elementor\Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true', 'tabindex' => '0', ] ); $menu_icon = ob_get_clean(); } else { $menu_icon = ''; } array_push( $icons, $menu_icon ); } return $icons; } /** * Render Nav Menu output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.3.0 * @access protected */ protected function render() { $menus = $this->get_available_menus(); if ( empty( $menus ) ) { return false; } $settings = $this->get_settings_for_display(); $menu_close_icons = []; $menu_close_icons = $this->get_menu_close_icon( $settings ); $args = [ 'echo' => false, 'menu' => $settings['menu'], 'menu_class' => 'hfe-nav-menu', 'menu_id' => 'menu-' . $this->get_nav_menu_index() . '-' . $this->get_id(), 'fallback_cb' => '__return_empty_string', 'container' => '', 'walker' => new Menu_Walker, ]; if ( 'yes' === $settings['schema_support'] ) { $this->add_render_attribute( 'hfe-nav-menu', 'itemscope', 'itemscope' ); $this->add_render_attribute( 'hfe-nav-menu', 'itemtype', 'http://schema.org/SiteNavigationElement' ); add_filter( 'hfe_nav_menu_attrs', [ $this, 'handle_link_attrs' ] ); add_filter( 'nav_menu_li_values', [ $this, 'handle_li_values' ] ); } if ( 'flyout' === $settings['layout'] ) { $this->add_render_attribute( 'hfe-flyout', 'class', 'hfe-flyout-wrapper' ); if ( 'cta' === $settings['menu_last_item'] ) { $this->add_render_attribute( 'hfe-flyout', 'data-last-item', $settings['menu_last_item'] ); } ?>
    print_render_attribute_string( 'hfe-flyout' ); ?> >
    add_render_attribute( 'hfe-main-menu', 'class', [ 'hfe-nav-menu', 'hfe-layout-' . $settings['layout'], ] ); $this->add_render_attribute( 'hfe-main-menu', 'class', 'hfe-nav-menu-layout' ); $this->add_render_attribute( 'hfe-main-menu', 'class', $settings['layout'] ); $this->add_render_attribute( 'hfe-main-menu', 'data-layout', $settings['layout'] ); if ( 'cta' === $settings['menu_last_item'] ) { $this->add_render_attribute( 'hfe-main-menu', 'data-last-item', $settings['menu_last_item'] ); } if ( $settings['pointer'] ) { if ( 'horizontal' === $settings['layout'] || 'vertical' === $settings['layout'] ) { $this->add_render_attribute( 'hfe-main-menu', 'class', 'hfe-pointer__' . $settings['pointer'] ); if ( in_array( $settings['pointer'], [ 'double-line', 'underline', 'overline' ], true ) ) { $key = 'animation_line'; $this->add_render_attribute( 'hfe-main-menu', 'class', 'hfe-animation__' . $settings[ $key ] ); } elseif ( 'framed' === $settings['pointer'] || 'text' === $settings['pointer'] ) { $key = 'animation_' . $settings['pointer']; $this->add_render_attribute( 'hfe-main-menu', 'class', 'hfe-animation__' . $settings[ $key ] ); } } } if ( 'expandible' === $settings['layout'] ) { $this->add_render_attribute( 'hfe-nav-menu', 'class', 'hfe-dropdown-expandible' ); } $this->add_render_attribute( 'hfe-nav-menu', 'class', [ 'hfe-nav-menu__layout-' . $settings['layout'], 'hfe-nav-menu__submenu-' . $settings['submenu_icon'], ] ); $this->add_render_attribute( 'hfe-nav-menu', 'data-toggle-icon', $menu_close_icons[0] ); $this->add_render_attribute( 'hfe-nav-menu', 'data-close-icon', $menu_close_icons[1] ); $this->add_render_attribute( 'hfe-nav-menu', 'data-full-width', $settings['full_width_dropdown'] ); ?>
    print_render_attribute_string( 'hfe-main-menu' ); ?>>
    register_content_page_title_controls(); $this->register_page_title_style_controls(); } /** * Register Page Title General Controls. * * @since 1.3.0 * @access protected */ protected function register_content_page_title_controls() { $this->start_controls_section( 'section_general_fields', [ 'label' => __( 'Title', 'header-footer-elementor' ), ] ); $this->add_control( 'archive_title_note', [ 'type' => Controls_Manager::RAW_HTML, /* translators: %1$s doc link */ 'raw' => sprintf( __( 'Note: Archive page title will be visible on frontend.', 'header-footer-elementor' ) ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', ] ); $this->add_control( 'before', [ 'label' => __( 'Before Title Text', 'header-footer-elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'after', [ 'label' => __( 'After Title Text', 'header-footer-elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'new_page_title_select_icon', [ 'label' => __( 'Select Icon', 'header-footer-elementor' ), 'type' => Controls_Manager::ICONS, 'render_type' => 'template', ] ); $this->add_control( 'page_title_icon_indent', [ 'label' => __( 'Icon Spacing', 'header-footer-elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'condition' => [ 'new_page_title_select_icon[value]!' => '', ], 'selectors' => [ '{{WRAPPER}} .hfe-page-title-icon' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'page_custom_link', [ 'label' => __( 'Link', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'custom' => __( 'Custom URL', 'header-footer-elementor' ), 'default' => __( 'Default', 'header-footer-elementor' ), 'none' => __( 'None', 'header-footer-elementor' ), ], 'default' => 'default', ] ); $this->add_control( 'page_heading_link', [ 'label' => __( 'Link', 'header-footer-elementor' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'header-footer-elementor' ), 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => get_home_url(), ], 'condition' => [ 'page_custom_link' => 'custom', ], ] ); $this->add_control( 'heading_tag', [ 'label' => __( 'HTML Tag', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'header-footer-elementor' ), 'h2' => __( 'H2', 'header-footer-elementor' ), 'h3' => __( 'H3', 'header-footer-elementor' ), 'h4' => __( 'H4', 'header-footer-elementor' ), 'h5' => __( 'H5', 'header-footer-elementor' ), 'h6' => __( 'H6', 'header-footer-elementor' ), ], 'default' => 'h2', ] ); $this->add_control( 'size', [ 'label' => __( 'Size', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'header-footer-elementor' ), 'small' => __( 'Small', 'header-footer-elementor' ), 'medium' => __( 'Medium', 'header-footer-elementor' ), 'large' => __( 'Large', 'header-footer-elementor' ), 'xl' => __( 'XL', 'header-footer-elementor' ), 'xxl' => __( 'XXL', 'header-footer-elementor' ), ], ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'header-footer-elementor' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'header-footer-elementor' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => __( 'Center', 'header-footer-elementor' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => __( 'Right', 'header-footer-elementor' ), 'icon' => 'eicon-text-align-right', ], 'justify' => [ 'title' => __( 'Justified', 'header-footer-elementor' ), 'icon' => 'eicon-text-align-justify', ], ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-page-title-wrapper' => 'text-align: {{VALUE}};', ], 'frontend_available' => true, ] ); $this->end_controls_section(); } /** * Register Page Title Style Controls. * * @since 1.3.0 * @access protected */ protected function register_page_title_style_controls() { $this->start_controls_section( 'section_title_typography', [ 'label' => __( 'Title', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .elementor-heading-title, {{WRAPPER}} .hfe-page-title a', ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .elementor-heading-title, {{WRAPPER}} .hfe-page-title a' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-page-title-icon i' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-page-title-icon svg' => 'fill: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'title_shadow', 'selector' => '{{WRAPPER}} .elementor-heading-title', ] ); $this->add_control( 'blend_mode', [ 'label' => __( 'Blend Mode', 'header-footer-elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Normal', 'header-footer-elementor' ), 'multiply' => 'Multiply', 'screen' => 'Screen', 'overlay' => 'Overlay', 'darken' => 'Darken', 'lighten' => 'Lighten', 'color-dodge' => 'Color Dodge', 'saturation' => 'Saturation', 'color' => 'Color', 'difference' => 'Difference', 'exclusion' => 'Exclusion', 'hue' => 'Hue', 'luminosity' => 'Luminosity', ], 'selectors' => [ '{{WRAPPER}} .elementor-heading-title' => 'mix-blend-mode: {{VALUE}}', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_icon', [ 'label' => __( 'Icon', 'header-footer-elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'new_page_title_select_icon[value]!' => '', ], ] ); $this->add_control( 'page_title_icon_color', [ 'label' => __( 'Icon Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'condition' => [ 'new_page_title_select_icon[value]!' => '', ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-page-title-icon i' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-page-title-icon svg' => 'fill: {{VALUE}};', ], ] ); $this->add_control( 'page_title_icons_hover_color', [ 'label' => __( 'Icon Hover Color', 'header-footer-elementor' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'new_page_title_select_icon[value]!' => '', ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .hfe-page-title-icon:hover i' => 'color: {{VALUE}};', '{{WRAPPER}} .hfe-page-title-icon:hover svg' => 'fill: {{VALUE}};', ], ] ); $this->end_controls_section(); } /** * Render page title widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.3.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_inline_editing_attributes( 'page_title', 'basic' ); if ( ! empty( $settings['page_heading_link']['url'] ) ) { $this->add_link_attributes( 'url', $settings['page_heading_link'] ); } $heading_size_tag = Widgets_Loader::validate_html_tag( $settings['heading_tag'] ); ?>
    get_render_attribute_string( 'url' ) ); ?>> < class="elementor-heading-title elementor-size-"> 'true' ] ); ?> >
    <# if ( '' == settings.page_title ) { return; } if ( '' != settings.page_heading_link.url ) { view.addRenderAttribute( 'url', 'href', settings.page_heading_link.url ); } var iconHTML = elementor.helpers.renderIcon( view, settings.new_page_title_select_icon, { 'aria-hidden': true }, 'i' , 'object' ); var headingSizeTag = settings.heading_tag; if ( typeof elementor.helpers.validateHTMLTag === "function" ) { headingSizeTag = elementor.helpers.validateHTMLTag( settings.heading_tag ); } else if( HfeWidgetsData.allowed_tags ) { headingSizeTag = HfeWidgetsData.allowed_tags.includes( headingSizeTag.toLowerCase() ) ? headingSizeTag : 'div'; } #>
    <# if ( '' != settings.page_heading_link.url ) { #> <# } #> <{{{ headingSizeTag }}} class="elementor-heading-title elementor-size-"> <# if( '' != settings.new_page_title_select_icon.value ){ #> {{{iconHTML.value}}} <# } #> <# if ( '' != settings.before ) { #> {{{ settings.before }}} <# } #> <# if ( '' != settings.after ) { #> {{{ settings.after }}} <# } #> <# if ( '' != settings.page_heading_link.url ) { #> <# } #>
    classes ) ? [] : (array) $item->classes; $submenu = $args->has_children ? ' hfe-has-submenu' : ''; if ( 0 === $depth ) { array_push( $classes, 'parent' ); } $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); $class_names = ' class="' . esc_attr( $class_names ) . $submenu . ' hfe-creative-menu"'; $value = apply_filters( 'nav_menu_li_values', $value ); $output .= $indent . '