rebase from live enviornment

This commit is contained in:
Rachit Bhargava
2024-01-09 22:14:20 -05:00
parent ff0b49a046
commit 3a22fcaa4a
15968 changed files with 2344674 additions and 45234 deletions

View File

@@ -0,0 +1,685 @@
=== Search & Filter Pro ===
Contributors: DesignsAndCode, CodeAmp
Donate link:
Tags: posts, custom posts, products, category, filter, taxonomy, post meta, custom fields, search, wordpress, post type, post date, author
Requires at least: 5.1
Tested up to: 6.0
Stable tag: 2.5.16
Search and Filtering for posts, products and custom posts. Allow your users to Search & Filter by taxonomies, custom fields and more.
== Description ==
Search & Filter Pro is a advanced search and filtering plugin for WordPress. It allows you to Search & Filter your posts / custom posts / products by any number of parameters allowing your users to easily find what they are looking for on your site, whether it be a blog post, a product in an online shop and much more.
Users can filter by Categories, Tags, Taxonomies, Custom Fields, Post Meta, Post Dates, Post Types and Authors, or any combination of these easily.
Great for searching in your online shop, tested with: WooCommerce and WP eCommerce, Easy Digital Downloads
= Field types include: =
* dropdown selects
* checkboxes
* radio buttons
* multi selects
* range slider
* number range
* date picker
* single or multiselect comboboxes with autocomplete
== Installation ==
= Uploading in WordPress Dashboard =
1. Navigate to the 'Add New' in the plugins dashboard
2. Navigate to the 'Upload' area
3. Select `search-filter-pro.zip` from your computer
4. Click 'Install Now'
5. Activate the plugin in the Plugin dashboard
= Using FTP =
1. Download `search-filter-pro.zip`
2. Extract the `search-filter-pro` directory to your computer
3. Upload the `search-filter-pro` directory to the `/wp-content/plugins/` directory
4. Activate the plugin in the Plugin dashboard
== Frequently Asked Questions ==
== Screenshots ==
== Changelog ==
= 2.5.16 =
* Fix - an issue with our pagination functions causing fatal errors.
= 2.5.15 =
* New - Add debugging hooks
* Fix - an undefined index warning in the active query class
* Fix - undefined index warnings when "include with children" is used in a taxonomy field
* Fix - check to make sure wc_get_product is available before using it
* Fix - add date sorting options to the secondary sort in the query settings
* Fix - add new pagination functions for our results.php template to work around issues with pagination not displaying in some scenarios
* Fix - infinite scroll was not triggering in some scenarios when the class name used was found on other parts of the page
= 2.5.14 =
* New - Add support for PODS date format in our date picker
* New - Add `search_filter_cache_should_index_post` filter to conditionally exclude posts from the cache
* Fix - An issue where a product variation was not synced correctly when only the variation was updated
* Fix - An issue when using a number range field and using a step value between 0 and 1.
* Improvement - hide ajax settings when using 3rd party integrations
* Improvement - add support for PHP 8.1 and 8.2
= 2.5.13 =
* Fix - an issue with infinite scroll triggering after pressing "back" in certain browsers.
* Fix - an issue with canonical redirects being triggered when using Polylang Pro + WooCommerce.
* Fix - remove replaceAll polyfill which was causing conflicts with other plugins.
= 2.5.12 =
* Fix - Support ajax in multiple results areas when using our third party integrations
* Fix - an issue with the author field not hiding admin authors (when that option was enabled)
* Fix - pagination issues with some of our integrations when using multiple search forms + results
* Fix - an issue where the query was not integrating with the Custom Layouts block
* Fix - issues in the admin UI since WordPress 5.9
* Fix - update to using wp_initialize_site for multisite - thanks to Chrissyd
* Update - minimum required WordPress version to 5.1
= 2.5.11 =
* Fix - an issue with ajax and the results URL not being correctly detected
* Fix - updated some of our plugin update procedures
* New - options to use text input control for selecting post meta keys (to prevent loading of all meta keys in large databases) - available via the settings page
* New - action - `search_filter_remove_pagination` - use this before your template pagination functions to stop S&F from modifying the pagination
= 2.5.10 =
* Fix - Fix an ajax issue for Dynamic Content maps - * Note: if you are using the maps + posts display method, you might need to reset this option.
* Fix - Translate the labels for options in the `sort` field via WPMLs Advanced Translation editor
= 2.5.9 =
* Fix - Update fix for Dynamic Content maps integration
* Fix - An issue with with WPML Advanced Translation Editor (the text for our submit and reset buttons was not being detected)
= 2.5.8 =
* Fix - an issue with Ajax and Dynamic Content's Google maps widget
* Fix - a PHP notice in our admin notices
* New - experimental hook for displaying WooCommerce variations individually
= 2.5.7 =
* Fix - scroll (on pagination only) was not working correctly
* Fix - duplicate search form stopped working in a previous update
* Fix - an issue with the cache not progressing on nginx + php8
* Fix - a PHP8 admin issue where checkboxes were not being set
* New - initial support for Dynamic.ooo Posts + Maps combined
* New - basic support for multiple ajax areas via hooks
* New - support for WPMLs advanced translation editor
= 2.5.6 =
* Fix - a PHP 5.x error due to a trailing comma
= 2.5.5 =
* Fix - an issue where the cache wouldn't restart because of an incorrect permissions check
* Fix - a PHP error that would be thrown under certain conditions
* Fix - an issue with WPML + ACF, and syncing data for relationship fields
* Fix - PHP 8 Compatibility
* Fix - Issues with multiple Dynamic Content Posts widgets + Search Forms on the same page (update required for DC to 1.13.0)
* New - Add support for Dynamic Content Google Maps widget
* Compatibility + tested upto WP 5.7
= 2.5.4 =
* Fix - a WooCommerce issue that was introduced where variations data was not being saved correctly
= 2.5.3 =
* Fix - `hide empty` in taxonomy fields was ignoring certain posts completely based on their post stati
* Fix - issues with the combobox "No Results Message" with post meta fields
* Fix - js warnings on admin pages
* Fix - issues relating to jQuery migrate plugin being removed
* Fix - an issue with refocussing the search box after pressing enter to submit
* Fix - a css issue with the datepicker dropdown
* Remove - js library dependency for admin tooltips
* Update - Select2 library to 4.0.13
* Compatibility + tested upto WP 5.6
* New - Display Results method - integration with Dynamic Posts v2 from Dynamic Content for Elementor
= 2.5.2 =
* Fix - a warning about stripslashes expecting a string
* Fix - an issue where getting labels for ACF fields was failing on private posts
* Fix - an issue with infinite scroll not working when the pagination selector was not set
* Fix - a JS warning where we using attribute to set checked state in certain admin screens
* Fix - an issue where infinite scroll was causing issues on taxonomy archives
* Fix - an issue where scrolling to results was fired before the content had loaded, causing an unwanted offset
* Fix - an issue with EDD Purchase buttons not using ajax to add to cart after a search
* Fix - an issue when WooCommerce is enabled with S&F, and interference being caused to non related search forms
* Fix - some compatibility issues with WPML and WooCommerce product variations
* New - better integration with WC products shortcode, simply add a `search_filter_id` argument to integrate
= 2.5.1 =
* NOTICE - if you are using Search & Filter with Easy Digital Downloads please read the new integration notes first
* Fix - a PolyLang issue when permalinks were disabled and the default language is not in the URL params
* Fix - an issue with range min / max being detected, when using certain post stati
* Fix - an issue with a loop not using `wp_reset_postdata` after
* Fix - change another loop so that it improves compatibility with plugins + themes
* Fix - respect `infinite-scroll-end` when it is found on the first page of results
* Fix - some compatibility issues with php7.4 using the `implode` function
* Fix - our tables were not being created on some server setups - modified dbdelta sql
* Fix - admin - an issue where pagination selector was showing when it shouldn't be
* Fix - an issue with setting wpdb prefix at too early, causing an issue in some multisites
* Fix - an issue with custom post stati not being picked up properly on cache rebuild
* Fix - an issue with Polylang working with our page builder extensions
* New - action - `search_filter_filter_next_query` - runs when the shortcode is run
* Improvement - integration with EDD - simply add `search_filter_id` to you downloads shortcode to get up and running
* Security - fix a potential security issue + add some hardening measures
= 2.5.0 =
* Fix - issues with number range fields not setting the "max" value by default
* Fix - some errors were being thrown when checking if a term exists
* Fix - some php warnings related to an object being countable
* Fix - issues with forming the URL for taxonomy archives in certain circumstances
* Fix - an issue with the current author being detected when enabling this feature on author archives
* Fix - issues with multiple date pickers and auto submit activating properly when selecting a date
* Fix - a warning about an undefined variable
* Fix - an issue with reset form not working properly on taxonomy archives
* Fix - allow `update_post_cache` action in admin
* Fix - an issue with URL encoding in pagination
* Fix - an issue with whitespace being removed from user choices in choice fields
* Fix - a Polylang issue with the wrong language form being loaded, when auto submit is off
* Fix - an issue with URL encoding in sort order fields
* Fix - an issue where our meta queries (in query settings) were not respecting WordPress Time Zone when "current date" was used
* Fix - an issue when using the OR comparison inside a field, and non latin characters
* Fix - an issue with searches not working when pressing the back button on iOS Safari
* Fix - an issue with stock status not being stored on the parent product in a variable product
* Fix - an issue with WooCommerce shop page, where it was not registering as `filtered` when using the search input box
* Fix - issues detecting post meta for WC variations
* Fix - added date and datetime meta type options for ordering by meta values
* Fix - re-fix mobile Safari back button issue
* Fix - an issue where multiple meta keys with the same name (but different cases) were not being correctly detected
* New - added "Relevance" to default order by and sort fields
* Improvement - updates to license page
= 2.4.6 =
* Fix - properly disable `maintain search form state` as this was causing potential security issues
* Fix - a character encoding issue when checking if ajax can be enabled on a particular page
* Fix - an issue with the sf-option-active class not being removed when using the reset button and submit form is disabled
* Fix - some issue with sf-option-active not being set correctly on radio buttons in certain circumstances
* Improvement - add support for pagination without the `page` prefix, ie, the updated Elementor Pro Posts widget uses /%postname%/%pageno%
* Improvement - set `paged` using `set_query_var` for better compatibility with other plugins
= 2.4.5 =
* Fix - an issue with noUiSlider when "Display values as" is set to "text" in range fields
* Fix - an issue with Beaver Builder Themer auto scrolling to results on page load (when using our display method "archive")
* Fix - an issue with Ajax requests and Polylang
* Fix - some issues with filtering WC shop in some themes
= 2.4.4 =
* Fix - an error being thrown when creating new sites in wpmu
* Fix - return the original IDs of taxonomy terms, when no translated term is found (when using translation plugins) - this allows for taxonomies that are not translated to retain their settings
* Fix - an issue where some of our 3rd party integrations were not working in ajax requests (very rare)
* Fix - an issue where the `filter_next_query` shortcode was being ignored in ajax requests
* Fix - an issue with Ajax URLs not always being set correctly when using PolyLang
* Updated - noUiSlider to v11.1.0
* Updated - chosen to v1.8.7
* New - added a `skip` argument for our `filter_next_query` shortcode, to access those tricky queries
= 2.4.3 =
* Fix - refix enable_taxonomy_archives variable warnings
* Fix - an issue with Beaver Builder Themer scrolling to the results on page load (this occured when pagination was set)
* Fix - silenced (@)set_time_limit as this was throwing warnings on some hosts
* Update - update the plugin to point to our new domain for auth and updates, searchandfilter.com :)
= 2.4.2 =
* Fix - removed an unwanted `exit` causing various and seemingly unrelated issues
= 2.4.1 =
* New - added JS events `sf:ajaxformstart` and `sf:ajaxformfinish` to detect when updating the form has started/finished
* Improvement - speed improvements to the cache, when saving posts and when rebuilding the entire cache
* Fix - an issue where filtering on taxonomy archives was not working with WooCommerce
* Fix - WooCommerce variations were not being taking into consideration in the batch size when rebuilding the cache
* Fix - an issue with WC not showing category/taxonomy descriptions or sub categories on archives
* Fix - exclude products from results that are "not in catalog" for WC
* Fix - an issue where the count was incorrect when using the private publish option with WooCommerce products
* Fix - changing a search form settings to include product variations, or not, didn't trigger a rebuild of the cache in some cases
* Fix - some WC issues when converting child IDs to parent IDs
* Fix - an issue with pagination on taxonomy archives
* Fix - an issue with ACF where option labels were not being correctly detected
* Fix - an issue with uninstall not working correctly sometimes
* Fix - an issue with infinite scroll not activating when the `Only use Ajax on the results page` setting is off
* Fix - an issue with Polylang when searching posts that are not managed by Polylang
= 2.4.0 =
* NOTICE - If you are using S&F with Woocommerce Variations and experiencing issues, you may need to rebuild the S&F cache
* New - change the "no results" message for comboboxes
* Fix - WooCommerce deprecated `woocommerce_get_page_id` in 3.0
* Fix - various WooCommerce issues relating to Variations - Woocommerce users' who use variations may need to rebuild S&F cache
* Fix - correctly set the `sf-option-active` class on multi select items (this includes checkboxes)
* Fix - properly escape some strings
* Fix - destroy noUiSlider (if it exists) before init, in case it has been init by another plugin (improved compatibility)
* Fix - some issues with levels / nesting of hierarchical taxonomies
* Fix - some issues with polylang and ajax requests
* Fix - an issue with a number range field not resetting properly
* Fix - an issue with the range slider in firefox, when ajax was disabled and auto submit was on
* Fix - an issue with `enable on taxonomy archives` when taxonomies were shared between multiple post types
* Fix - a PHP error when using multiple date pickers with post meta
* Fix - the infinite scroll loader will now check the parent it is attached to and use the correct html tag for the loader
* Fix - an issue with the icon not loading for available fields
* Fix - an issue with "enable on taxonomy archives" and pagination not working correctly
* Fix - an issue with min / max values being correctly autodetected for range fields
* Fix - some issues with rounding & formatting on numeric and slider range fields
* Fix - range dropdown & radio fields were not respecting the step value when it came to the last / max option
* Fix - some layout issues in the admin
* Fix - issues with the later versions of Relevanssi
* Fix - some issues with refocusing the search box after a search is performed
* Fix - issues with taxonomy rewrites when using `enable on taxonomy archives`
* Fix - an issue with the date range fields being auto submitted when only 1 has been selected
* Fix - an issue with ACF using `get_field_object` - and returning the wrong options depending on language
* Fix - some issues with the cache building in the background
* Fix - some issues with ajax filtering with fragment urls
* Fix - a PHP warning when creating the first search form after install
* Fix - a PHP warning - incorrect usage of `count`, displaying warnings when saving posts that are to be cached
* Update - update chosen to v1.8.2
* Update - update select2 to v4.0.5
= 2.3.4 =
* Fix - issues in some environments where infinite scroll wasn't activating after a performing search, or getting the page var wrong
* Fix - infinite scroll offset was not being applied correctly
* Improvement - changed scope of some CSS classes in admin ui for better compatibility with other plugins
* Fix - some bugs causing issues with 3rd part plugin compatibility
* Fix - a bug where S&F wouldn't cache new items added to media
= 2.3.3 =
* New - added action `search_filter_api_header`, to allow for modification of the headers that are sent with our ajax requests
* New - added offset for activation of infinite scroll in the display results tab
* New - added new shortcode action `filter_next_query` - this will apply filtering to the next `WP_Query` found
* Fix - an issue with infinite scroll activating multiple times, if you have multiple instances of a search form on a page
* Fix - speed issues with WPML when using media library grid view (and S&F is set to search media)
* Fix - incorrect type cast of a settings variable causing settings not to be loaded correctly in some circumstances
= 2.3.2 =
* Fix - PHP warnings & errors when using WooCommerce & Taxonomy Archive display mode
* Fix - Some issues with the correct fields appearing in the "display results" tab
= 2.3.1 =
* New - Plugin data (such as saved search forms & cache) will no longer be deleted when uninstalling - to remove all data use the new option in the settings page
* New - Search & Filter can now be used to filter your taxonomy archives - currently only works with "Post Type Archive" and "WooCommerce" display methods
* Fix - WPML issue was re-introduced in 2.3.0
* Fix - A Polylang issue when using the shortcode display method & ajax
* Fix - `sf-option-active` class was not updating when using ajax, with autocount off (as the form no longer gets refreshed)
* Fix - issue with "include children in parents" for taxonomy fields
* Fix - an issue with `?sf_data` being appended to pagination in ajax requests
* Fix - issue with Visual Composer plugin only working after first interaction (ajax)
* Fix - an issue with infinite scroll triggering on incorrect pages
* Fix - an issue where the `sf_results_url` filter was not being applied to pagination
* Fix - an issue with Archive display method & polylang
* Compatibility - store the results URL in its own custom field for better compatibility with migration tools which search/replace urls. *Notice*, you will need to edit and hit "save" in your search forms before migrating your sites (so the url can be copied in to the correct custom field)
= 2.3.0 =
* New - Added support for visual composer post grids (free addon plugin required) - create results layouts using visual composer!
* New - Infinite scroll for all display methods - how to setup - https://searchandfilter.com/documentation/search-results/infinite-scroll/
* New - Added support for ACF relationship fields
* New - added `none` sort order option for choice meta fields, allowing preservation of the order of options (if set from external plugins)
* New - added option to specify decimal seperator for number range fields
* Update - Select2 JS library to 4.0.3
* Update - Chosen JS library to 1.6.2
* Update - noUiSlider JS library to 8.5.1
* Performance - improvements when generating forms with many options
* Performance - do not reload the S&F form (ajax) if auto count is not enabled - speed improvement
* Performance - store search related data in transients so that search forms are rendered quickly when used outside of Results Pages (enable via settings page)
* Performance - improved cache building speeds
* Fix - combobox issues on touch devices
* Fix - thousands seperator was not displaying for certain input types
* Fix - some issues with Polylang plugin after Polylang updates
* Fix - issues with the post type field not being set
* Fix - IDs for input fields are now generated randomly based on current timestamp - using the same search form multiple times on a page caused errors with labels & IDs (clicking a label in one form would update the other instance)
* Fix - an issue when using `update_post_cache` filter on already deleted posts
* Fix - PHP notices when using Woocommerce with a static homepage
* Fix - variatons not working correctly in woocommerce, S&F was returning matches for attribute combinations (of variations) which did not exist, but did exist within a particular product
* Fix - potential infinite loop when results contain results shortcodes :/
* Fix - "Only use Ajax on the results page" was not working correctly on post type archives when the taxonomy archives were based of the post type archive URL
* Fix - S&F pagination was taking over taxonomy archive pagination when the display method was set to `post type archive` and the taxonomy archives path had the post type as base rewrite
* Fix - `hide empty` and `show count` options no longer have any effect when auto count is disabled.
* Fix - default sorting by numeric meta keys was not working when they were decimals / floating point numbers.. all numeric sorting is now converted to decimal sorting to 4 decimal places which also works for standard numeric sorting
* Fix - an issue where numerical ranges using the "overlap" comparison were not returning the correct results
* Fix - an issue where numerical ranges were not auto detecing the max value correctly, when using different start/end meta keys
* Fix - issues with WPML & PolyLang
* Fix - some issues with Ajax when using ajax in certain display modes
* Fix - issues when search forms are within the results area, and replaced with an ajax request
* Removed - help tab on admin screens as it was unused
= 2.2.0 =
* New - field - posts per page
* New - added system status screen
* New - Added Select2 JS as an alternative to Chosen for comboboxes - seems to have better mobile support - change this in main S&F settings screen
* New - added support for custom post stati (statuses)
* New - use slugs instead of IDs in shortcodes (check the shortcodes metabox)
* Improved - allow post meta keys and values to contain spaces & special characters
* Improved - updated Chosen JS to - v1.5.2
* Improved - reset button - choose if the reset button submits the form after resetting it
* Improved - new admin notices for settings that can potentially cause errors
* Improved - admin UI tweaks
* Improved - added `stop()` to scrolling animations before starting to scroll the page
* Fix - issues with PHP 7
* Fix - properly escape some input fields
* Fix - S&F incorrectly warning network activated plugins are not enabled
* Fix - refocus input fields after the form has been auto submitted
* Fix - an error with the range slider and decimals
* Fix - JS event "sf:ajaxfinish" now fired after all S&F process have completed (such as updating the search form)
* Fix - various pagination issues
* Fix - an issue with pagination and the new `custom` display method
* Fix - renamed a global function to prevent conflicts
* Fix - Display problems when using WooCommerce shop on the homepage with S&F
* Fix - Issues with the woocommerce orderby dropdown
* Fix - an issue with the action `search_filter_query_posts` not working correctly
* Fix - a bug sometimes causing tag and category fields to be detected as undefined causing search issues
* Fix - issues with detecting when attachments were updated and rebuilding the cache
* Fix - pressing enter in the search box reset the timer for autosubmit
* Fix - added EDD prep_query shortcode to shortcodes box
* Fix - fix some compatibility issues with WPML where WPML was converting taxonomy term IDs into the current language rather than post language
* Fix - use global function `get_queried_object` rather than `$wp_query->queried_object` for consistency
* Fix - issues with the author field and detecting defaults
* Notice - WP 4.6 tested & compatible + PHP 7
= 2.1.2 =
* New - Sort order can be displayed as radio buttons
* New - filters for all URLs used in S&F - this allows for dynamically changing the various URLs for example to force https or similar - https://searchandfilter.com/documentation/action-filter-reference/
* Fix - an issue with `include_children` and allowing the AND operator to be used
* Fix - an issue with hierarchical lists not being display correctly
= 2.1.1 =
* New - added `data-sf-count` attributes to inputs which have count variables
* Improvement - default cache speed is set to slow
* Fix - an issue with pagination filters
* Fix - issues with PolyLang - should now be working again with PolyLang v1.7.12
* Fix - minify issues with CSS & JS files
* Fix - issues with depth in hierarchical fields
* Fix - an issue where S&F was hijacking pagination when it wasn't supposed to
* Fix - a couple of minor issues with the author field
* Fix - S&F `sf:init` was incorrectly firing after each ajax request, it is now fired only on page load & once initialised
* Fix - An issue where post date fields were not being set correctly in the front end
* Fix - a PHP/pass by reference overload issue
* Fix - an issue with `number_format` & PHP warnings in admin
* Fix - an issue with undefined taxonomy slugs in the S&F cache
* Fix - an issue with `wp_json_encode`
= 2.1.0 =
* Notice - depth classes for hierarchical fields fields have renamed to avoid conflicts - from `.level-0` to `.sf-level-0`
* Notice - properly prefix range & min / max classes = from `.range-min`, `.range-max` and `.meta-range` to `.sf-range-min`, `.sf-range-max` and `.sf-meta-range`
* New - sync meta fields - when using "number" or "choice" type meta fields, the values can now be auto detected - values can also be sorted
* New - sync ACF fields - use above in choice fields with auto detection - S&F can now retreive built in ACF labels for values too
* New - added support for ordering by multiple fields (the default posts order)
* New - added support for ordering posts by Post Type
* New - lots of improvements to post meta fields (number) more UI options and input types
* New - added support for decimals and number formatting in post meta (number) fields
* New - new compare options for date range and number fields - great for date ranges and bookings/promotional systems
* New - added sort by relevance option for Relevanssi under the Advanced tab
* New - added options to control the display of sticky posts (under the Posts tab)
* New - Settings page
* New - Settings - control caching speed & background processes
* New - Settings - added settings to lazyload JS and an option to load jQuery language files for the datepicker
* New - accessibility - WCAG 2.0 compliant - some html restructuring (mostly adding in labels) and added screen reader text option to all text/number input fields and selects
* New - filter - allows users to filter any field in the search form and most of the options
* New - added counts to the active query class
* Improvement - authors now use slugs instead of IDs in the URL
* Improvement - updated Chosen & noUiSlider to their latest versions
* Improvement - show internal taxonomy names as well as labels throughout admin UI
* Improvement - support for WooCommerce shop when it is set to category display
* Improvement - speed updates/optimisations to the cache and auto count
* Improvement - better admin notices & warnings
* Fix - issues with WPML and loading the correct taxonomies etc
* Fix - issues with caching and the attachment post type
* Fix - an issue where getting counts for taxonomies was occuring twice
* Fix - URL Encoding issue with meta fields
* Fix - an issue when using multiple search forms on a single page & pagination not working correctly
* Fix - removed an error message which was showing whenever the cache was restarting - it was unnecessary
* Fix - whitespace being trimmed from textareas in certain field types
* Fix - some pagination issues when using post type archive
* Fix - do not enable auto count by default
* Fix - Post Type archive display method now properly uses the Posts Page (as defined under `settings` -> `reading`) where applicable when the post type is set to `post`
* Fix - a bug where html entities were matched when searching in chosen comboboxes such as `nbsp`
* Fix - an admin bug where selecting Post Type Archive as the results method would show the wrong options after saving
* Fix - a few admin UI bugs
* Fix - a bug with the ajax start/end events
* WP 4.4 compat - tested with 2016 theme
= 2.0.3 =
* New - update search form (auto count) without submitting the form
* New - added variable `search_filter_id` to all queries to easily identify which S&F form your queries are being modified by - use `$query['search_filter_id'];`
* New - added RTL support for all JS plugins - chosen comboxbox, jQuery datepicker and noUiSlider
* New - added action to trigger the rebuild of the cache for a specific post (`do_action('search_filter_update_post_cache', 1984);` where 1984 is the post ID)
* Fix - issue with Firefox "rembering" disabled state on soft refresh - now a soft page refresh in FF also forces all inputs to be enabled to overcome this issue
* Fix - issue with comboboxes finding child terms (hierarchical enabled)
* Fix - issue with URI encoding in search field
* Fix - issues with multiple results shortcodes when meta data defaults are set
* Fix - issues with WP Types plugin and nested post meta values
* Fix - caching issues with post meta when there are multiple values
* Fix - issue with search term & stripslashes
* Fix - compatibility issue with Relevanssi
* Fix - correctly show count numbers when "detect defaults from current page" is selected
* Fix - re-implement `save_post` filter outside of `is_admin` for rebuilding the cache from the front end
= 2.0.2 =
* New - use S&F with even more templates (Archive Mode) by adding a shortcode/action before your loop
* Fix - set priority of Ajax (with results shortcode) search to `200` on `init` hook - it was being fired sometimes before taxonomies had been declared
* Fix - `array_merge` errors when using hierarchical taxonomies and including children in parents
* Fix - JS errors with multiple search forms on the same page at the same time
* Fix - JS error error in Firefox where refreshing the page sometimes caused a disabled state on the search form
* Fix - an issue in Avada + woocommerce, when setting up the query, and only using 1 post type S&F now passes a string instead of an array
* Fix - a PHP error and delimiters in the Active Query class
* Fix - an issue with maintain search form state passing `page_id` when permalinks are disabled
* Fix - undefined variable notice in author walker
* Fix - undefined variable notice in edit search form screen
= 2.0.1 =
* NOTICE - DO NOT UPDATE UNTIL YOU HAVE READ THE RELEASE NOTES: https://searchandfilter.com/documentation/2-0-upgrade-notes/
* Version bump so all beta testers get the latest update via the dashboard
= 2.0 =
* New - caching of results for fast speeds even on large databases
* New - direct support for the WooCommerce shop page
* New - direct support for WooCommerce product variations
* New - integration with Easy Digital Downloads (EDD) shortcodes - just add the S&F prep_query shortcode directly before the EDD shortcode ie - `[searchandfilter id="14" action="prep_query"]`
* New - use post type archives to display your results (single post type only)
* New - huge speed and accuracy improvements for meta queries - no more `%like%` queries for serialised meta
* New - auto count - dynamically display counts next to field options based on the current search & settings
* New - auto count - drill down fields - hide options which yield no results
* New - allow for multiple meta keys to be queried when doing ranges
* New - prepolutate search form based on current archive - works for post types, tags, categories, taxonomies and authors
* New - datepicker - supports jQuery UI i18n, dropdown for years & months option, placeholder text customisation
* New - methods for accessing what has been searched
* Improvement - moved all Ajax logic to front end for better compatibility with other plugins (esp shortcode based)
* Improvement - huge amount of refactoring - some parts completely rewritten and optimized, JS rewrite
* Improvement - show which meta keys are selected in widget title
* Improvement - change labels on checkbox and radio fields - don't wrap the inputs inside the labels
* Fix - some problems with pagination links sometimes pointing to the ajax URL
* Fix - Fix an issue with `include_children` now working
* New - relationships can now be defined across taxonomy and meta fields
* Fix - Issues with pagination
* fix - removed references to CSS images that were not being used
* Fix - localised some sloppy CSS rules for compatibility
* Fix - some issues with currencies and decimals when using number ranges
* Fix - an issue with exclude post IDs not working correctly
* Fix - UTF characters in taxonomy term names
* Fix - `orderby` getting added to the URL on non WooCommerce search forms
* Fix - IE8 JS error - Object.keys() compatibility
* Fix - IE10 JS error / reload error - the `input` event was triggering when it was not supposed to causing an ajax request to be performed
* Fix - Admin - function definition in wrong scope causing errors in strict mode on some browsers
* Removed - .postform classes that have crept back into build - but added classes and IDs on every input element
* Removed - the global $sf_form_data - changed to $searchandfilter
* Notice - you should no longer use `pre_get_posts` to modify queries, there is a new filter which takes an array of arguments `sf_edit_query_args` which must be used to also update count number and other non main queries
* In progress - support for PolyLang - testing so far seems good
= 1.4.3.1 =
* Fix - add serialised tick box to post meta fields
* Fix - added a "data is serialised" checkbox to meta fields
* Dropped - built in pagination functions - `sf_pagination_numbers` and `sf_pagination_prev_next` are now redundant
= 1.4.1 =
* New - Added IDs to search forms for easy css targeting - also renamed ID on results container to keep in line with naming conventions
* New - added reset button
* New - dropdown number range
* New - added options to use timestamps in post meta
* fix - a bug when sanitizing keys from post meta
* fix - a bug with autosuggest & encoding
* fix - issues with searching serialised post meta
* fix - throwing an error when trying to access the `all_items` label of a taxonomy when it does not exist
* fix - some dependencies with JS/CSS allowing them to be removed more easily
* fix - some tweaks to automatic updates
* fix - layout issues with search form UI and WP 4.1
* fix - various fixes and improvements with compatibility and WPML
= 1.4.0 =
* New - search media/attachments
* New - added post meta defaults - now you can add constraints for meta data such as searching only products in stock, excluding featured posts or restricting all searches to specific meta data values
* New - scroll to top of page when updating results with ajax
* New - use the shortcode to display results without ajax too (results shortcode only worked with ajax setups previously)
* New - allow regular pagination when using a shortcode for results - (use wp next_posts_link & previous_posts_link, plus added support for wp_pagenavi plugin)
* New - added AND / OR operator to define relationships between tag, category and taxonomy fields
* New - optionally include children in parent searches (categories, hierarchical taxonomies)
* New - improvded UI - add taxonomy browser to help find IDs easily
* New - improved ajax/template UI
* New - minify CSS & JS - finally integrated grunt ;) - non minified versions still available
* New - duplicate search form - a link has been added to the main S&F admin screen underneath each form for easy duplicating!
* New - added support for Relevanssi when using shortcodes to display results
* New - add "today" for date comparisons in meta queries in post meta defaults
* Updated - the default results template (shortcode) to include new pagination options
* Fixed - an error when users are not using permalinks, and submitting the search form
* Fixed - "OR" operator for checkboxes with taxonomies was broken
* Fixed - a JS error when no terms were being shown for a checkbox/radio field
* Fixed - an error when using `maintain state` and getting 404 on results
* Fixed - an error when detecting if a meta field was serialised or not
* Fixed - an error when saving a post meta field with a poorly formatted name
* Fixed - ajax pagination without shortcode
* Fixed - meta fields with the value `0` being ignored
* Fixed - some updates to the plugin auto updater - some users weren't seeing udpates in the dashboard even when activated
= 1.3.0 =
* New - JavaScript rewrite - refactored - faster cleaner code
* New - add setting to allow the default sort order of results - check settings panel -> posts
* New - Speed improvements - searching usually caused 2 header requests (a POST and a redirect) - now uses only a single GET request
* New - play nice with other scripts - can now initialise the search form via JS if the form/html is loaded in dynamically
* New - mulitple search forms on the same page!
* New - add data to JS events for targeting individual forms on the same page
* New - maintain search state - keep user search settings while looking at results pages
* New - for Ajax w/ Shortcodes - Added results URL - this allows the widget to be placed anywhere in your site
* New - shortcode meta box - for easier access to shortcodes within the Search Form editor
* New - allow auto submit when ajax is not enabled
* New - shareable/bookmarkable URLs when using shortcodes (this was already available without)
* Fixed - an issue with auto submit
* Fixed - an issue with a significant delay to fetch initial results when using ajax (with shortcode) - initial results are now loaded server side on page load
* Fixed - bad html and "hide_empty" was not working as expected - it was disabling inputs rather than hiding them
* Fixed - i18n for "prev" and "next" in pagination
* Fixed - post date field was not working correctly when using ajax w/ shortcodes
* Improved - integration with WPML - better URLs and works fully with shortcodes
* Removed - *Beta* Auto Count - this feature is likely to be even more broken (it had plenty of bugs already) - it is recommended you disable this for now. The next major update will inlcude a revised & working version of this.
= 1.2.7 =
* Fixed an issue with array_replace_recursive for older PHP version
= 1.2.6 =
* Fixed an issue with headers in admin when publishing a post
= 1.2.5 =
* Fixed a JS error in IE8
* Added new settings panel - set defaults search parameters
* Settings Panel - include/exclude categories
* Settings Panel - exclude posts by ID
* Settings Panel - choose to search by Post Status
* Settings Panel - Added Results Per Page for controlling the number of results you see
* Settings Panel - UI refinements
* Settings Panel - more to come (meta)!
* Category, Tag & Taxonomy fields - new option (advanced) to sync included/excluded posts with new settings parameters
= 1.2.4 =
* DO NOT UPGRADE IF YOU WERE HAVING ISSUES WITH AJAX FUNCTIONALITY AND WAITING FOR A PATCH, ONLY THE TWO UPDATES BELOW ARE INCLUDED IN THIS UPDATE:
* Fix - ajax shortcode functionality - search field is now working again!
* Fix - ajax shortcode functionality - fixed custom field/meta search
* Fix - ajax shortcode functionality - fixed a bug with categories
= 1.2.3 =
* DO NOT UPGRADE IF YOU WERE HAVING ISSUES WITH AJAX FUNCTIONALITY AND WAITING FOR A PATCH, ONLY THE TWO UPDATES BELOW ARE INCLUDED IN THIS UPDATE:
* Fix - ajax shortcode functionality - only displays published posts (it was also fetching drafts)
* Fix - ajax shortcode functionality - auto submit now working
= 1.2.2 =
* Fix - stopped using short syntax array in php (`[]`) which is only supported in php version 5.4+
= 1.2.1 =
* Fix - a JS error for older Ajax setups
= 1.2.0 =
* NEW - completely reworked how to use Ajax - simply use a shortcode to place where you want the results to display and you're set to go!
* Fix - allow paths in template names - S&F was previously stripping out slashes so couldn't access templates in sub directories
* Fix - various small bug fixes
= 1.1.8 =
* New - add new way to modify the main search query for individual forms
* New - added a new JS init event
= 1.1.7 =
* New - *beta* - Auto count for taxonomies - when using tag, category and taxonomies only in a search form, you can now enable a live update of fields, which means as users make filter selections, unavailable combinations will be hidden (this is beta and would love feedback especially from users with high numbers of posts/taxonomies)
* New - date picker for custom fields / post meta - dates must be stored as YYYYMMDD or as timestamps in order to use this field
* New - added JS events to capture start / end of ajax loading so you can add in your own custom loaders
* Fix - prefixed taxonomy and meta field names properly - there were collisions on the set defaults function, for example if a tax and meta share the same key there would be a collision
* Fix - errors with number ranges & range slider
* Fix - an error with detecting if a meta value is serialized
* Fix - scope issue with date fields auto submitting correctly
= 1.1.6 =
* **Notice** - dropped - `.postform` css class this was redundant and left in by error - any users using this should update their CSS to use the new and improved options provided:
* New - class names added to all field list items for easy CSS styling + added classes to all options for form inputs for easy targeting of specific field values
* New - added a `<span class="sf-count">` wrapper to all fields where a count was being shown for easy styling
* Fix - removed all reference to `__DIR__` for PHP versions < 5.3
* Fix - Some general tweaks for WPML
* Fix - a bug when choosing all post types still adding "post_types" to the url
= 1.1.5 =
* **Notice** - this update breaks previous Sort Order fields, so make sure if you have a Sort Order Field to rebuild it once you've updated!
* New - Sort Order - in addition to sorting by Meta Value, users can now sort their results by ID, author, title, name, date, date modified, parent ID, random, comment count and menu order, users can also choose whether they they want only ASC or DESC directions - both are optional.
* New - Autocomplete Comboboxes - user friendly select boxes powered by Chosen - text input with auto-complete for selects and multiple selects - just tick the box when choosing a select or multiselect input type
* Fix - add a lower priority to `init` hook when parsing taxonomies - this helps ensure S&F runs after your custom taxonomies have been created
* Fix - add a lower priority to `pre_get_posts` - helps with modifying the main query after other plugins/custom code have run
* Fix - a problem with meta values having spaces
= 1.1.4 =
* New - Meta Suggestions - auto detect values for your custom fields / post meta
* Enhancement - improved Post Meta UI (admin)
* Fix - an error with displaying templates (there was a PHP error being thrown in some environments)
* Fix - an error where ajax enabled search forms were causing a refresh loop on some mobile browsers
= 1.1.3 =
* New - display meta data as dropdowns, checkboxes, radio buttons and multi selects
* New - added date formats to date field
* fix - auto submit & date picker issues
* fix - widget titles not displaying
* fix - missed a history.pushstate check for AJAX enabled search forms
* fix - dashboard menu conflict with other plugins
* fix - submit label was not updating
* fix - post count for authors was showing only for posts - now works with all post types
* compat - add fallback for `array_replace` for <= PHP 5.3 users
= 1.1.2 =
* New - customsise results URL - add a slug for your search results to display on (eg yousite.com/product-search)
* fix - js error when Ajax pagination links are undefined
* fix - date picker dom structure updated to match that of all other fields
* fix - scope issue when using auto submit on Ajax search forms
= 1.1.1 =
* fix - fixed an error where JS would hide the submit button :/
* fix - fixed an error where parent categories/taxonomies weren't showing their results
= 1.1.0 =
* New - AJAX - searches can be performed using Ajax
* fix - removed redundant js/css calls
= 1.0.0 =
* Initial release
== Upgrade Notice ==
= 2.5.7 =
PHP 8 users - if you are seeing errors on upgrading, please disable Search & Filter before proceeding with the update and it will complete successfully. This is related to the duplicate Search Form bug (now fixed in this version).

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
<?php // Silence is golden

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="15.491px" height="15.491px" viewBox="0 0 15.491 15.491" enable-background="new 0 0 15.491 15.491" xml:space="preserve">
<path fill="#231F20" d="M0,7.781l2.674-2.674V6.96H6.96V2.675H5.106L7.781,0l2.674,2.674H8.601V6.96h4.285V5.106l2.675,2.674
l-2.675,2.675V8.601H8.601v4.285h1.854l-2.674,2.675l-2.675-2.675H6.96V8.601H2.675v1.854L0,7.781z"/>
</svg>

After

Width:  |  Height:  |  Size: 717 B

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,366 @@
(function ( $ ) {
"use strict";
$(function () {
/*
* UTIL
*/
function log_info(container, text)
{
var $output = {};
if(container=="cache") {
$output = $continue_cache_manual_output;
}
$output.append(text + "\n");
$output.scrollTop($output.prop('scrollHeight'));
}
function clear_log(container)
{
var $output = {};
if(container=="cache") {
$output = $continue_cache_manual_output;
}
$output.empty();
}
var meta_prefs_action_name = "meta_prefs_set";
// Place your administration-specific JavaScript here
var $metabox_prefs = $('#screen-meta #screen-options-wrap .metabox-prefs.view-mode');
var $screen_options_link = $('#screen-options-link-wrap');
var $screen_options_wrap = $('#screen-options-wrap');
//then metabox not found
if($metabox_prefs.length==0)
{
$metabox_prefs = $('#screen-meta #screen-options-wrap h5').after('<div class="metabox-prefs"><label for="welcome-hide" class="handle-custom-prefs"><input data-target="#search-filter-welcome-panel" name="welcome-hide" type="checkbox" id="welcome-hide" value="welcome">Welcome</label><br class="clear" /></div>');
}
$metabox_prefs.find("legend").after('<label for="welcome-hide" class="handle-custom-prefs"><input data-target="#search-filter-welcome-panel" name="welcome-hide" type="checkbox" id="welcome-hide" value="welcome">Welcome</label>');
//initialise checked state by seeing if the target has hidden class
$metabox_prefs.find('.handle-custom-prefs input[type="checkbox"]').each(function()
{
var $this = $(this);
var hide_element = $(this).attr('data-target');
if(!$(hide_element).hasClass("hidden"))
{
$this.prop("checked", true);
}
});
//
$metabox_prefs.find('.handle-custom-prefs input[type="checkbox"]').off("change"); //remove existing handlers
$metabox_prefs.find('.handle-custom-prefs input[type="checkbox"]').on( 'change', function()
{
var hide_element = $(this).attr('data-target');
var show_option_value = 0;
if(this.checked) {
$(hide_element).removeClass("hidden");
show_option_value = 1;
}
else
{
$(hide_element).addClass("hidden");
}
//run ajax to set option
$.post( ajaxurl, {show: show_option_value, action: meta_prefs_action_name});/*.done(function(data)
{//don't do anything
if(data)
{
}
});*/
});
$(".handle-dismiss-button").on( 'click', function()
{
var hide_element = $(this).attr('data-target');
var show_option_value = 0;
//hide element
$(hide_element).addClass("hidden");
//uncheck checkbox
$metabox_prefs.find('.handle-custom-prefs input[type="checkbox"][data-target="'+hide_element+'"]').prop("checked", false);
//add user feedback that the element has been hidden and can be shown again by adding flicker effect to the screen options button
//$screen_options_link.css('background-color', '#f00');
/*if($screen_options_wrap.css("display")=="none")
{//don't run if the screen options are open
$screen_options_link.delay(200).queue(function(next){
$(this).addClass('highlight');
next();
}).delay(600).queue(function(next){
$(this).removeClass('highlight');
next();
});
}*/
//run ajax to set option
$.post( ajaxurl, {show: "0", action: meta_prefs_action_name});
});
var $cache_view = {};
var $cache_views = $('#search-filter-cache .cache-metabox');
$cache_view['disabled'] = $('#search-filter-cache .status-disabled');
$cache_view['inprogress'] = $('#search-filter-cache .status-inprogress');
$cache_view['error'] = $('#search-filter-cache .status-error');
$cache_view['ready'] = $('#search-filter-cache .status-ready');
$cache_view['finished'] = $('#search-filter-cache .status-finished')
$cache_view['restart'] = $('#search-filter-cache .status-restart')
$cache_view['termcache'] = $('#search-filter-cache .status-termcache')
var last_cache_update_request = null;
var has_restart_submit = false;
var $rc_spinner = $("#search-filter-cache .rebuild-cache-spinner");
var $rc_button = $("#search-filter-cache .button.rebuild-cache");
var has_rc_error = false;
/* check progress of caching */
setInterval( function() {
get_cache_progress();
}, 15000);
function get_cache_progress()
{
if(has_restart_submit==false)
{
var sfid = $(this).data("sfid");
var cache_action = "cache_progress";
if(last_cache_update_request)
{
last_cache_update_request.abort();
}
last_cache_update_request = $.post( ajaxurl, {action: cache_action}, function(){}, 'json').done(function(data)
{//don't do anything
handleAjaxUpdate(data);
});
}
}
get_cache_progress();
function handleAjaxUpdate(data)
{
last_cache_update_request = null;
$rc_spinner.css("visibility", "hidden");
$rc_button.removeClass("disabled");
if(data)
{
if(data.status!="")
{
$cache_views.hide();
$('#cache-info .notice-rc-error').hide();
$('#cache-info .cache-metabox .notice-please-wait').hide();
if((data.restart==true)&&(data.status!="ready"))
{
$cache_view["restart"].show();
$('#cache-info .notice-rc-error').hide();
$('#cache-info .cache-metabox .notice-please-wait').show();
}
else
{
$cache_view[data.status].show();
if(data.status == "inprogress")
{
if(typeof(data.progress_percent)!="undefined")
{
$('#cache-info .cache-metabox .progress-percent').html(data.progress_percent);
$('#cache-info .cache-metabox .progress-current').html(data.current_post_index);
$('#cache-info .cache-metabox .progress-total').html(data.total_post_index);
$('#cache-info .cache-metabox .media-progress-bar div').css("width", data.progress_percent+"%");
}
else
{
}
}
if(data.error_count==0)
{
$('#cache-info .cache-metabox .notice-stalled').hide();
$('#cache-info .cache-metabox .notice-building').show();
}
else
{
$('#cache-info .cache-metabox .notice-stalled').show();
$('#cache-info .cache-metabox .notice-building').hide();
}
}
if(data.rc_status!="connect_success")
{//then this install can't initiate a remote connection
has_rc_error = true;
if(((data.status == "inprogress")||(data.status == "termcache"))&& (!data.restart))
{
$('#cache-info .notice-rc-error').show();
}
else if((data.restart==true)&&(data.status!="ready"))
{
$('#cache-info .cache-metabox .notice-please-wait').show();
}
}
else
{
has_rc_error = false;
}
}
}
}
function initCacheButton()
{
$rc_button.on("click", function(){
if($(this).hasClass("disabled"))
{
return false;
}
var sfid = $(this).data("sfid");
var cache_action = "cache_restart";
if(last_cache_update_request)
{
last_cache_update_request.abort();
}
has_restart_submit = true;
$rc_spinner.css("visibility", "visible");
$(this).addClass("disabled");
last_cache_update_request = $.post( ajaxurl, {action: cache_action}, function(){}, 'json').done(function(data)
{//don't do anything
has_restart_submit = false;
handleAjaxUpdate(data);
});
});
}
initCacheButton();
/*
S&F Admin Cache Page
*/
var $cache_page = $('body.search-filter_page_search-filter-cache');
if($cache_page.length>0)
{
var $method_value = $cache_page.find('#search-filter-cache-method-value');
var method_value = $method_value.text();
var $switch_method_button = $cache_page.find('#search-filter-cache-method-switch');
var $continue_cache_button = $cache_page.find('#search-filter-cache-manual-continue');
var $restart_cache_button = $cache_page.find('#search-filter-cache-manual-restart');
var $continue_cache_manual_output = $cache_page.find('#search-filter-cache-manual-output');
$switch_method_button.on("click",function(){
var method_value = $method_value.text();
var set_method = "";
if(method_value=="automatic")
{
set_method = "manual";
}
else
{
set_method = "automatic";
}
$.get(ajaxurl, {action: 'search_filter_cache_set_method', method: set_method}, function(data){
if(data=="1")
{
$method_value.text(set_method);
}
});
});
$continue_cache_button.on("click",function(){
log_info("cache", "SF: Continuing Cache...");
$.get(ajaxurl, {action: 'cache_progress_manual'}, function(data){
log_info("cache", "SF: Data received..");
var locked_str = "";
if(data.restart==true)
{
locked_str += " [restart]";
}
if(data.locked==true)
{
locked_str += " [locked] [EC: "+data.error_count+"]";
}
log_info("cache", "SF: Batch: "+data.current_post_index + "/" + data.total_post_index + " (" + data.progress_percent + "%) | PID: "+data.process_id+locked_str);
}, 'json');
});
$restart_cache_button.on("click",function(){
log_info("cache", "SF: Restarting...");
$.get(ajaxurl, {action: 'cache_restart_manual'}, function(data){
log_info("cache", "SF: Data received..");
var locked_str = "";
if(data.restart==true)
{
locked_str += " [restart]";
}
if(data.locked==true)
{
locked_str += " [locked] [EC: "+data.error_count+"]";
}
log_info("cache", "SF: Batch: "+data.current_post_index + "/" + data.total_post_index + " (" + data.progress_percent + "%) | PID: "+data.process_id+locked_str);
}, 'json');
});
}
});
}(jQuery));

View File

@@ -0,0 +1 @@
<?php // Silence is golden

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,618 @@
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.9.0
*/
class SF_EDD_SL_Plugin_Updater {
private $api_url = '';
private $api_data = array();
private $plugin_file = '';
private $name = '';
private $slug = '';
private $version = '';
private $wp_override = false;
private $beta = false;
private $health_check_timeout = 5;
/**
* Class constructor.
*
* @uses plugin_basename()
* @uses hook()
*
* @param string $_api_url The URL pointing to the custom API endpoint.
* @param string $_plugin_file Path to the plugin file.
* @param array $_api_data Optional data to send with API calls.
*/
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
global $edd_plugin_data;
$this->api_url = trailingslashit( $_api_url );
$this->api_data = $_api_data;
$this->plugin_file = $_plugin_file;
$this->name = plugin_basename( $_plugin_file );
$this->slug = basename( $_plugin_file, '.php' );
$this->version = $_api_data['version'];
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
$edd_plugin_data[ $this->slug ] = $this->api_data;
/**
* Fires after the $edd_plugin_data is setup.
*
* @since x.x.x
*
* @param array $edd_plugin_data Array of EDD SL plugin data.
*/
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
// Set up hooks.
$this->init();
}
/**
* Set up WordPress filters to hook into WP's update process.
*
* @uses add_filter()
*
* @return void
*/
public function init() {
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
add_action( 'after_plugin_row', array( $this, 'show_update_notification' ), 10, 2 );
add_action( 'admin_init', array( $this, 'show_changelog' ) );
}
/**
* Check for Updates at the defined API endpoint and modify the update array.
*
* This function dives into the update API just when WordPress creates its update array,
* then adds a custom API call and injects the custom plugin data retrieved from the API.
* It is reassembled from parts of the native WordPress plugin update code.
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
*
* @uses api_request()
*
* @param array $_transient_data Update array build by WordPress.
* @return array Modified update array with custom plugin data.
*/
public function check_update( $_transient_data ) {
global $pagenow;
if ( ! is_object( $_transient_data ) ) {
$_transient_data = new stdClass();
}
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
return $_transient_data;
}
$current = $this->get_repo_api_data();
if ( false !== $current && is_object( $current ) && isset( $current->new_version ) ) {
if ( version_compare( $this->version, $current->new_version, '<' ) ) {
$_transient_data->response[ $this->name ] = $current;
} else {
// Populating the no_update information is required to support auto-updates in WordPress 5.5.
$_transient_data->no_update[ $this->name ] = $current;
}
}
$_transient_data->last_checked = time();
$_transient_data->checked[ $this->name ] = $this->version;
return $_transient_data;
}
/**
* Get repo API data from store.
* Save to cache.
*
* @return \stdClass
*/
public function get_repo_api_data() {
$version_info = $this->get_cached_version_info();
if ( false === $version_info ) {
$version_info = $this->api_request(
'plugin_latest_version',
array(
'slug' => $this->slug,
'beta' => $this->beta,
)
);
if ( ! $version_info ) {
return false;
}
// This is required for your plugin to support auto-updates in WordPress 5.5.
$version_info->plugin = $this->name;
$version_info->id = $this->name;
$this->set_version_info_cache( $version_info );
}
return $version_info;
}
/**
* Show the update notification on multisite subsites.
*
* @param string $file
* @param array $plugin
*/
public function show_update_notification( $file, $plugin ) {
// Return early if in the network admin, or if this is not a multisite install.
if ( is_network_admin() || ! is_multisite() ) {
return;
}
if ( ! current_user_can( 'update_plugins' ) ) {
return;
}
if ( $this->name !== $file ) {
return;
}
// Do not print any message if update does not exist.
$update_cache = get_site_transient( 'update_plugins' );
if ( ! isset( $update_cache->response[ $this->name ] ) ) {
if ( ! is_object( $update_cache ) ) {
$update_cache = new stdClass();
}
$update_cache->response[ $this->name ] = $this->get_repo_api_data();
}
// Return early if this plugin isn't in the transient->response or if the site is running the current or newer version of the plugin.
if ( empty( $update_cache->response[ $this->name ] ) || version_compare( $this->version, $update_cache->response[ $this->name ]->new_version, '>=' ) ) {
return;
}
printf(
'<tr class="plugin-update-tr %3$s" id="%1$s-update" data-slug="%1$s" data-plugin="%2$s">',
$this->slug,
$file,
in_array( $this->name, $this->get_active_plugins(), true ) ? 'active' : 'inactive'
);
echo '<td colspan="3" class="plugin-update colspanchange">';
echo '<div class="update-message notice inline notice-warning notice-alt"><p>';
$changelog_link = '';
if ( ! empty( $update_cache->response[ $this->name ]->sections->changelog ) ) {
$changelog_link = add_query_arg(
array(
'edd_sl_action' => 'view_plugin_changelog',
'plugin' => urlencode( $this->name ),
'slug' => urlencode( $this->slug ),
'TB_iframe' => 'true',
'width' => 77,
'height' => 911,
),
self_admin_url( 'index.php' )
);
}
$update_link = add_query_arg(
array(
'action' => 'upgrade-plugin',
'plugin' => urlencode( $this->name ),
),
self_admin_url( 'update.php' )
);
printf(
/* translators: the plugin name. */
esc_html__( 'There is a new version of %1$s available.', 'easy-digital-downloads' ),
esc_html( $plugin['Name'] )
);
if ( empty( $update_cache->response[ $this->name ]->package ) && ! empty( $changelog_link ) ) {
printf(
/* translators: 1. opening anchor tag, do not translate 2. the new plugin version 3. closing anchor tag, do not translate. */
__( ' %1$sView version %2$s details%3$s.', 'easy-digital-downloads' ),
'<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
esc_html( $update_cache->response[ $this->name ]->new_version ),
'</a>'
);
} elseif ( ! empty( $changelog_link ) ) {
printf(
__( ' %1$sView version %2$s details%3$s or %4$supdate now%5$s.', 'easy-digital-downloads' ),
'<a target="_blank" class="thickbox open-plugin-details-modal" href="' . esc_url( $changelog_link ) . '">',
esc_html( $update_cache->response[ $this->name ]->new_version ),
'</a>',
'<a target="_blank" class="update-link" href="' . esc_url( wp_nonce_url( $update_link, 'upgrade-plugin_' . $file ) ) . '">',
'</a>'
);
} else {
printf(
' %1$s%2$s%3$s',
'<a target="_blank" class="update-link" href="' . esc_url( wp_nonce_url( $update_link, 'upgrade-plugin_' . $file ) ) . '">',
esc_html__( 'Update now.', 'easy-digital-downloads' ),
'</a>'
);
}
do_action( "in_plugin_update_message-{$file}", $plugin, $plugin );
echo '</p></div></td></tr>';
}
/**
* Gets the plugins active in a multisite network.
*
* @return array
*/
private function get_active_plugins() {
$active_plugins = (array) get_option( 'active_plugins' );
$active_network_plugins = (array) get_site_option( 'active_sitewide_plugins' );
return array_merge( $active_plugins, array_keys( $active_network_plugins ) );
}
/**
* Updates information on the "View version x.x details" page with custom data.
*
* @uses api_request()
*
* @param mixed $_data
* @param string $_action
* @param object $_args
* @return object $_data
*/
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
if ( 'plugin_information' !== $_action ) {
return $_data;
}
if ( ! isset( $_args->slug ) || ( $_args->slug !== $this->slug ) ) {
return $_data;
}
$to_send = array(
'slug' => $this->slug,
'is_ssl' => is_ssl(),
'fields' => array(
'banners' => array(),
'reviews' => false,
'icons' => array(),
),
);
// Get the transient where we store the api request for this plugin for 24 hours
$edd_api_request_transient = $this->get_cached_version_info();
// If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
if ( empty( $edd_api_request_transient ) ) {
$api_response = $this->api_request( 'plugin_information', $to_send );
// Expires in 3 hours
$this->set_version_info_cache( $api_response );
if ( false !== $api_response ) {
$_data = $api_response;
}
} else {
$_data = $edd_api_request_transient;
}
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
$_data->sections = $this->convert_object_to_array( $_data->sections );
}
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
$_data->banners = $this->convert_object_to_array( $_data->banners );
}
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
$_data->icons = $this->convert_object_to_array( $_data->icons );
}
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
}
if ( ! isset( $_data->plugin ) ) {
$_data->plugin = $this->name;
}
return $_data;
}
/**
* Convert some objects to arrays when injecting data into the update API
*
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
*
* @since 3.6.5
*
* @param stdClass $data
*
* @return array
*/
private function convert_object_to_array( $data ) {
if ( ! is_array( $data ) && ! is_object( $data ) ) {
return array();
}
$new_data = array();
foreach ( $data as $key => $value ) {
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
}
return $new_data;
}
/**
* Disable SSL verification in order to prevent download update failures
*
* @param array $args
* @param string $url
* @return object $array
*/
public function http_request_args( $args, $url ) {
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
$args['sslverify'] = $this->verify_ssl();
}
return $args;
}
/**
* Calls the API and, if successfull, returns the object delivered by the API.
*
* @uses get_bloginfo()
* @uses wp_remote_post()
* @uses is_wp_error()
*
* @param string $_action The requested action.
* @param array $_data Parameters for the API action.
* @return false|object
*/
private function api_request( $_action, $_data ) {
global $edd_plugin_url_available;
// Do a quick status check on this domain if we haven't already checked it.
$store_hash = md5( $this->api_url );
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
$test_url_parts = wp_parse_url( $this->api_url );
$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
if ( empty( $host ) ) {
$edd_plugin_url_available[ $store_hash ] = false;
} else {
$test_url = $scheme . '://' . $host . $port;
$response = wp_remote_get(
$test_url,
array(
'timeout' => $this->health_check_timeout,
'sslverify' => $this->verify_ssl(),
)
);
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
}
}
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
return false;
}
$data = array_merge( $this->api_data, $_data );
if ( $data['slug'] !== $this->slug ) {
return;
}
// Don't allow a plugin to ping itself
if ( trailingslashit( home_url() ) === $this->api_url ) {
return false;
}
return $this->get_version_from_remote();
}
/**
* If available, show the changelog for sites in a multisite install.
*/
public function show_changelog() {
if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) {
return;
}
if ( empty( $_REQUEST['plugin'] ) ) {
return;
}
if ( empty( $_REQUEST['slug'] ) || $this->slug !== $_REQUEST['slug'] ) {
return;
}
if ( ! current_user_can( 'update_plugins' ) ) {
wp_die( esc_html__( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), esc_html__( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
}
$version_info = $this->get_repo_api_data();
if ( isset( $version_info->sections ) ) {
$sections = $this->convert_object_to_array( $version_info->sections );
if ( ! empty( $sections['changelog'] ) ) {
echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
}
}
exit;
}
/**
* Gets the current version information from the remote site.
*
* @return array|false
*/
private function get_version_from_remote() {
$api_params = array(
'edd_action' => 'get_version',
'license' => ! empty( $this->api_data['license'] ) ? $this->api_data['license'] : '',
'item_name' => isset( $this->api_data['item_name'] ) ? $this->api_data['item_name'] : false,
'item_id' => isset( $this->api_data['item_id'] ) ? $this->api_data['item_id'] : false,
'version' => isset( $this->api_data['version'] ) ? $this->api_data['version'] : false,
'slug' => $this->slug,
'author' => $this->api_data['author'],
'url' => home_url(),
'beta' => $this->beta,
'php_version' => phpversion(),
'wp_version' => get_bloginfo( 'version' ),
);
/**
* Filters the parameters sent in the API request.
*
* @param array $api_params The array of data sent in the request.
* @param array $this->api_data The array of data set up in the class constructor.
* @param string $this->plugin_file The full path and filename of the file.
*/
$api_params = apply_filters( 'edd_sl_plugin_updater_api_params', $api_params, $this->api_data, $this->plugin_file );
$request = wp_remote_post(
$this->api_url,
array(
'timeout' => 15,
'sslverify' => $this->verify_ssl(),
'body' => $api_params,
)
);
if ( is_wp_error( $request ) ) {
return false;
}
$request = json_decode( wp_remote_retrieve_body( $request ) );
if ( $request && isset( $request->sections ) ) {
$request->sections = maybe_unserialize( $request->sections );
} else {
$request = false;
}
if ( $request && isset( $request->banners ) ) {
$request->banners = maybe_unserialize( $request->banners );
}
if ( $request && isset( $request->icons ) ) {
$request->icons = maybe_unserialize( $request->icons );
}
if ( ! empty( $request->sections ) ) {
foreach ( $request->sections as $key => $section ) {
$request->$key = (array) $section;
}
}
return $request;
}
/**
* Get the version info from the cache, if it exists.
*
* @param string $cache_key
* @return object
*/
public function get_cached_version_info( $cache_key = '' ) {
if ( empty( $cache_key ) ) {
$cache_key = $this->get_cache_key();
}
$cache = get_option( $cache_key );
// Cache is expired
if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
return false;
}
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
$cache['value'] = json_decode( $cache['value'] );
if ( ! empty( $cache['value']->icons ) ) {
$cache['value']->icons = (array) $cache['value']->icons;
}
return $cache['value'];
}
/**
* Adds the plugin version information to the database.
*
* @param string $value
* @param string $cache_key
*/
public function set_version_info_cache( $value = '', $cache_key = '' ) {
if ( empty( $cache_key ) ) {
$cache_key = $this->get_cache_key();
}
$data = array(
'timeout' => strtotime( '+3 hours', time() ),
'value' => wp_json_encode( $value ),
);
update_option( $cache_key, $data, 'no' );
// Delete the duplicate option
delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
}
/**
* Returns if the SSL of the store should be verified.
*
* @since 1.6.13
* @return bool
*/
private function verify_ssl() {
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
}
/**
* Gets the unique key (option name) for a plugin.
*
* @since 1.9.0
* @return string
*/
private function get_cache_key() {
$string = $this->slug . $this->api_data['license'] . $this->beta;
return 'edd_sl_' . md5( serialize( $string ) );
}
}

View File

@@ -0,0 +1,586 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter_Post_Data_Validation
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Admin_Notices {
private $plugin_slug = '';
private $error_log = array();
private $all_search_form_ids = array();
private $post_message_log = array();
private $all_post_message_log = array();
private $warning_log = array();
private $success_log = array();
public function __construct( $plugin_slug ) {
/*
* Call $plugin_slug from public plugin class.
*/
$this->plugin_slug = $plugin_slug;
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
}
// notices shown when viewing all posts
public function set_all_post_notices() {
// $this->get_all_search_forms_wlang();
if ( ( Search_Filter_Helper::has_wpml() ) && ( defined( 'ICL_LANGUAGE_CODE' ) ) ) {
if ( ICL_LANGUAGE_CODE == 'all' ) {// this means a user has selected "all languages" - so loop loop through each language and check for errors - appending lang code
$langs = icl_get_languages( 'skip_missing=0&orderby=KEY&order=DIR&link_empty_to=str' );
foreach ( $langs as $lang ) {
if ( isset( $lang['code'] ) ) {
$search_form_ids = $this->get_all_search_forms_wlang( $lang['code'] );
$this->set_all_post_notices_wlang( $search_form_ids, $lang['code'] );
}
}
// reset current language - should be "all"
global $sitepress;
if ( ! empty( $sitepress ) ) {
$sitepress->switch_lang( ICL_LANGUAGE_CODE );
}
} else {
// user must be on a specifc language, let wpml filter the rest
$search_form_ids = $this->get_all_search_forms_wlang();
$this->set_all_post_notices_wlang( $search_form_ids );
}
} else {
$search_form_ids = $this->get_all_search_forms_wlang();
$this->set_all_post_notices_wlang( $search_form_ids );
}
}
public function get_all_search_forms_wlang( $lang = '' ) {
if ( $lang != '' ) {
if ( Search_Filter_Helper::has_wpml() ) {
global $sitepress;
if ( ! empty( $sitepress ) ) {
$sitepress->switch_lang( $lang );
}
}
}
$search_form_query = new WP_Query( 'post_type=search-filter-widget&fields=ids&post_status=publish&posts_per_page=-1' );
$all_search_form_ids = $search_form_query->get_posts();
return $all_search_form_ids;
}
// pass search form IDs to test for potential problems
public function set_all_post_notices_wlang( $search_form_ids, $lang = '' ) {
$lang_text = '';
if ( $lang != '' ) {
$lang_text = '<span class="sf-error-langcode">[' . $lang . ']</span>';
}
$woocommerce_error_count = 0;
$woocommerce_form_count = 0;
$post_type_archive_count = array();
foreach ( $search_form_ids as $search_form_id ) {
// $search_form_id
// echo $search_form_id;
$settings = Search_Filter_Helper::get_settings_meta( $search_form_id );
$fields = Search_Filter_Helper::get_fields_meta( $search_form_id );
if ( isset( $settings['display_results_as'] ) ) {
$display_results_as = $settings['display_results_as'];
if ( $display_results_as == 'archive' ) {// warning - check to see if custom template is selected
} elseif ( $display_results_as == 'post_type_archive' ) {// warning - check to see if custom template is selected
if ( isset( $settings['post_types'] ) ) {
$post_types = array_keys( $settings['post_types'] );
}
if ( count( $post_types ) == 1 ) {
$post_type = $post_types[0];
if ( ! isset( $post_type_archive_count[ $post_type ] ) ) {
$post_type_archive_count[ $post_type ] = 0;
}
$post_type_archive_count[ $post_type ]++;
}
} elseif ( $display_results_as == 'custom_woocommerce_store' ) {
// count number of forms using WooCommerce shop - can only be one
$woocommerce_form_count++;
}
}
}
if ( $woocommerce_form_count > 0 ) {// the there is a form with WooCommerce
// check to make sure woocommerce is enabled
if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
$message = array(
'type' => 'error',
'message' => sprintf( __( 'WooCommerce is not enabled and is in use in your search forms. Choose a different display method or enable <strong>WooCommerce</strong> plugin.%s', $this->plugin_slug ), $lang_text ),
);
array_push( $this->all_post_message_log, $message );
}
// display error if more than 1 set
if ( $woocommerce_form_count > 1 ) {
$message = array(
'type' => 'error',
'message' => sprintf( __( 'There are <strong>%1$d</strong> Search Forms using display mode <strong>WooCommerce Shop</strong> - you may only have <strong>1</strong>%2$s', $this->plugin_slug ), $woocommerce_form_count, $lang_text ),
);
array_push( $this->all_post_message_log, $message );
}
}
// post type archive
foreach ( $post_type_archive_count as $post_type => $post_count ) {
if ( $post_count > 1 ) {
// then there is an error - there are multiple search forms using post type archive, with the same post type - must be unique (==1)
$post_type_object = get_post_type_object( $post_type );
$label_name = '';
if ( isset( $post_type_object->label ) ) {
$label_name = $post_type_object->label;
}
$message = array(
'type' => 'error',
'message' => sprintf( __( 'There are <strong>%1$d</strong> Search Forms set to use <strong>Post Type Archive</strong> display mode for the post type <strong>%2$s</strong> - you may only have <strong>1</strong>%3$s', $this->plugin_slug ), $post_count, $label_name, $lang_text ),
);
array_push( $this->all_post_message_log, $message );
}
}
}
public function display_all_post_notices() {
foreach ( $this->all_post_message_log as $post_message ) {
?>
<div class="<?php echo $post_message['type']; ?>">
<p>
<?php
// _e( '<strong>Search &amp; Filter Error: </strong> ', $this->plugin_slug );
_e( '<strong>Error: </strong> ', $this->plugin_slug );
echo $post_message['message'];
?>
</p>
</div>
<?php
}
}
// notices shown when editing a specific post
public function set_post_notices( $post_id = 0 ) {
if ( $post_id == 0 ) {
global $post;
$post_id = $post->ID;
}
$this->post_message_log = array();
// setup errors
$settings = Search_Filter_Helper::get_settings_meta( $post_id );
$fields = Search_Filter_Helper::get_fields_meta( $post_id );
if ( isset( $settings['display_results_as'] ) ) {
$display_results_as = $settings['display_results_as'];
if ( $display_results_as == 'archive' ) {// warning - check to see if custom template is selected
// error - check if template exists
if ( isset( $settings['use_template_manual_toggle'] ) ) {
$use_template_manual = (bool) $settings['use_template_manual_toggle'];
if ( $use_template_manual ) {
// check to see if we have a valid template specified
$template_error = false;
$template_name_manual = trim( $settings['template_name_manual'] );
$located = locate_template( $template_name_manual );
if ( ! empty( $located ) ) {
$template_error = false;
} else {
$template_error = true;
}
if ( $template_error ) {
$message = array(
'type' => 'error',
'message' => sprintf( __( 'The custom template file `<strong>%s</strong>` cannot be found - go to <strong>Display Results</strong> tab to fix', $this->plugin_slug ), $template_name_manual ),
);
array_push( $this->post_message_log, $message );
}
} else {
$message = array(
'type' => 'sf-notice',
'message' => __( 'You have not specified a <strong>custom template</strong> file for your results - this may lead to unexpected behaviour when displaying your results', $this->plugin_slug ),
);
array_push( $this->post_message_log, $message );
}
}
} elseif ( $display_results_as == 'post_type_archive' ) {
// check to see if there is only 1 post type set
if ( isset( $settings['post_types'] ) ) {
$post_types = array_keys( $settings['post_types'] );
} else {
$settings['post_types'] = array();
}
$this->set_max_post_types_error( $post_types, 1 );
$this->set_post_type_archive_attributes_error( $post_types );
// check for duplicates - can't have 2 search forms set to post type archive, with the same post type
$args = array(
'property_key' => 'display_results_as',
'property_value' => 'post_type_archive',
'secondary_key' => 'post_types',
'secondary_value' => $post_types,
);
$total_forms_with_properties = $this->count_forms_with_properties( $args );
if ( $total_forms_with_properties > 1 ) {
if ( count( $post_types ) == 1 ) {
$post_type_object = get_post_type_object( $post_types[0] );
$label_name = '';
if ( isset( $post_type_object->label ) ) {
$label_name = $post_type_object->label;
}
$message = array(
'type' => 'error',
'message' => sprintf( __( 'There are <strong>%1$d</strong> Search Forms set to use <strong>Post Type Archive</strong> display mode for the post type <strong>%2$s</strong> - you may only have <strong>1</strong>', $this->plugin_slug ), $total_forms_with_properties, $label_name ),
);
array_push( $this->post_message_log, $message );
}
}
} elseif ( $display_results_as == 'shortcode' ) {
// check to make sure the results url is filled in
if ( isset( $settings['results_url'] ) ) {
$results_url = trim( $settings['results_url'] );
$this->set_results_url_error( $results_url );
if ( $results_url != '' ) {// ensure there is a results URL before doing this check
// this is just a warning, if the user is using SSL, try to warn in case they are not using https in their URL
// is_ssl()
}
}
} elseif ( $display_results_as == 'custom_woocommerce_store' ) {
// check to make sure woocommerce is enabled
if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
$message = array(
'type' => 'error',
'message' => __( 'WooCommerce is not enabled. Choose a different display method or enable <strong>WooCommerce</strong> plugin.', $this->plugin_slug ),
);
array_push( $this->post_message_log, $message );
} else {
// check to make only product / variation post type is selected
if ( ! isset( $settings['post_types'] ) ) {
$settings['post_types'] = array();
}
$this->set_post_types_error( array_keys( $settings['post_types'] ), array( 'product', 'product_variation' ) );
}
// check for duplicates - can't have 2 search forms set to WooCommerce store
$args = array(
'property_key' => 'display_results_as',
'property_value' => 'custom_woocommerce_store',
);
$total_forms_with_properties = $this->count_forms_with_properties( $args );
if ( $total_forms_with_properties > 1 ) {
$message = array(
'type' => 'error',
'message' => sprintf( __( 'There are <strong>%d</strong> Search Forms using display mode <strong>WooCommerce Shop</strong> - you may only have <strong>1</strong>', $this->plugin_slug ), $total_forms_with_properties ),
);
array_push( $this->post_message_log, $message );
}
} elseif ( $display_results_as == 'custom_edd_store' ) {
// check to make sure edd is enabled
if ( ! is_plugin_active( 'easy-digital-downloads/easy-digital-downloads.php' ) ) {
$message = array(
'type' => 'error',
'message' => __( 'Easy Digital Downloads is not enabled. Choose a different display method or enable <strong>Easy Digital Downloads</strong> plugin.', $this->plugin_slug ),
);
array_push( $this->post_message_log, $message );
} else {
if ( isset( $settings['post_types'] ) ) {
// check to make only download post type is selected
$this->set_post_types_error( array_keys( $settings['post_types'] ), array( 'download' ) );
}
}
// check to make sure results url is filled in
if ( isset( $settings['results_url'] ) ) {
$results_url = trim( $settings['results_url'] );
$this->set_results_url_error( $results_url );
}
}
}
// fields
// meta fields
// if choice, check to make sure some options have been added
// cache
// check / display progress - warn if not yet complete
}
public function has_property_value( $settings, $property_key, $property_value ) {
if ( isset( $settings[ $property_key ] ) ) {
if ( $property_key == 'post_types' ) {// special case
$post_types = array_keys( $settings[ $property_key ] );
if ( $post_types == $property_value ) {
return true;
}
} else {
if ( $settings[ $property_key ] == $property_value ) {
return true;
}
}
}
return false;
}
function array_equal( $a1, $a2 ) {
return ! array_diff( $a1, $a2 ) && ! array_diff( $a2, $a1 );
}
public function count_forms_with_properties( $args ) {
$form_count = 0;
$this->get_all_search_forms();
foreach ( $this->all_search_form_ids as $search_form_id ) {
// as we only want to update "enabled", then load all settings and update only this key
$search_form_settings = Search_Filter_Helper::get_settings_meta( $search_form_id );
$first_match = false;
$second_match = false;
if ( $this->has_property_value( $search_form_settings, $args['property_key'], $args['property_value'] ) ) {
$first_match = true;
}
if ( ! isset( $args['secondary_key'] ) ) {
$second_match = true; // its not a match but we ignore it
} elseif ( ( isset( $args['secondary_key'] ) ) && ( isset( $args['secondary_value'] ) ) ) {
if ( $this->has_property_value( $search_form_settings, $args['secondary_key'], $args['secondary_value'] ) ) {
$second_match = true;
}
}
if ( ( $first_match == true ) && ( $second_match == true ) ) {
$form_count++;
}
}
return $form_count;
}
public function get_all_search_forms() {
$search_form_query = new WP_Query( 'post_type=search-filter-widget&fields=ids&post_status=publish&posts_per_page=-1' );
$this->all_search_form_ids = $search_form_query->get_posts();
}
// fg
public function set_post_type_archive_attributes_error( $post_types ) {
if ( count( $post_types ) == 1 ) {
// check to see if the post type is public - otherwise the archive URL simply will not work
if ( $post_types[0] == 'post' ) {// ignore for posts - we treat the blog page as its archive
return;
}
$post_type_object = get_post_type_object( $post_types[0] );
$archive_error = false;
if ( isset( $post_type_object->has_archive ) ) {
if ( $post_type_object->has_archive == false ) {
// has_archive
$archive_error = true;
}
} else {
$archive_error = true;
}
if ( $archive_error == true ) {
$label_name = '';
if ( isset( $post_type_object->label ) ) {
$label_name = $post_type_object->label;
}
$message = array(
'type' => 'error',
'message' => sprintf( __( 'The `<strong>has_archive</strong>` attribute is set to false for the post type <strong>%s</strong> - this must be enabled in order to use the Post Type Archive in WP', $this->plugin_slug ), $label_name ),
);
array_push( $this->post_message_log, $message );
}
}
}
// check to ensure the post types selected are only in the required list
public function set_max_post_types_error( $post_types, $max_post_types ) {
if ( count( $post_types ) > $max_post_types ) {
$message = array(
'type' => 'error',
'message' => sprintf( __( 'You can only select <strong>%d</strong> post type(s) - or change your display method', $this->plugin_slug ), $max_post_types ),
);
array_push( $this->post_message_log, $message );
}
}
// check to ensure the post types selected are only in the required list
public function set_post_types_error( $post_types, $req_post_types ) {
$error = false;
foreach ( $post_types as $post_type ) {
if ( ! in_array( $post_type, $req_post_types ) ) {
$error = true;
}
}
$post_types_labels = array();
foreach ( $req_post_types as $post_type ) {
$post_type_object = get_post_type_object( $post_type );
$label_name = '';
if ( isset( $post_type_object->label ) ) {
$label_name = $post_type_object->label;
}
array_push( $post_types_labels, $label_name );
}
if ( $error == true ) {
$message = array(
'type' => 'error',
'message' => __( 'You can only select the following post types: ', $this->plugin_slug ) . '<strong>' . implode( ', ', $post_types_labels ) . '</strong>' . __( ' (or change your display method)', $this->plugin_slug ),
);
array_push( $this->post_message_log, $message );
}
}
public function set_results_url_error( $results_url ) {
if ( $results_url == '' ) {
$message = array(
'type' => 'error',
'message' => __( 'Your <strong>Results URL</strong> is empty - go to <strong>Display Results</strong> tab to fix', $this->plugin_slug ),
);
array_push( $this->post_message_log, $message );
}
}
public function display_post_notices() {
foreach ( $this->post_message_log as $post_message ) {
?>
<div class="notice <?php echo $post_message['type']; ?>">
<p>
<?php
$message_level = __( 'Error: ', $this->plugin_slug );
if ( $post_message['type'] == 'sf-notice' ) {
$message_level = __( 'Notice:', $this->plugin_slug );
}
// _e( '<strong>Search &amp; Filter Error: </strong> ', $this->plugin_slug );
echo '<strong>' . $message_level . '</strong> ';
echo $post_message['message'];
?>
</p>
</div>
<?php
}
}
public function get_post_notices() {
return $this->post_message_log;
}
public function clear_post_notices() {
$this->post_message_log = array();
}
public function admin_notices() {
global $current_screen;
global $current_user;
$user_id = $current_user->ID;
// set default user meta
if ( $current_screen->id == 'edit-search-filter-widget' ) {
if ( ! get_user_meta( $user_id, $this->plugin_slug . '-show-welcome-notice' ) ) {
add_user_meta( $user_id, $this->plugin_slug . '-show-welcome-notice', '1', true );
}
$this->set_all_post_notices();
$this->display_all_post_notices();
} elseif ( $current_screen->id == $this->plugin_slug . '-widget' ) {
$this->set_post_notices();
$this->display_post_notices();
}
global $wpdb;
$table_error = false;
/*
?>
<div class="error">
<p>
<?php _e( '<strong>Search &amp; Filter Error: </strong> The caching tables are missing - ', $this->plugin_slug ); ?>
<a href="<?php echo admin_url( 'admin-ajax.php?action=search_filter_build_cache_table' ); ?>"><?php _e( 'click here to create them', $this->plugin_slug ); ?></a>
</p>
</div>
<?php
*/
}
}

View File

@@ -0,0 +1,670 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter_Post_Data_Validation
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Post_Data_Validation {
public function __construct() {
/*
* Call $plugin_slug from public plugin class.
*/
$this->plugin_slug = 'search-filter';
}
public function get_clean_widget_data( $widget_data ) {
$clean_widget = array();
if ( $widget_data['type'] == 'search' ) {
$clean_widget = $this->clean_search_widget( $widget_data );
} elseif ( ( $widget_data['type'] == 'tag' ) || ( $widget_data['type'] == 'category' ) || ( $widget_data['type'] == 'taxonomy' ) ) {
$clean_widget = $this->clean_taxonomy_widget( $widget_data );
} elseif ( $widget_data['type'] == 'post_type' ) {
$clean_widget = $this->clean_post_type_widget( $widget_data );
} elseif ( $widget_data['type'] == 'post_date' ) {
$clean_widget = $this->clean_post_date_widget( $widget_data );
} elseif ( $widget_data['type'] == 'author' ) {
$clean_widget = $this->clean_author_widget( $widget_data );
} elseif ( $widget_data['type'] == 'post_meta' ) {
$clean_widget = $this->clean_post_meta_widget( $widget_data );
} elseif ( $widget_data['type'] == 'sort_order' ) {
$clean_widget = $this->clean_sort_order_widget( $widget_data );
} elseif ( $widget_data['type'] == 'posts_per_page' ) {
$clean_widget = $this->clean_posts_per_page_widget( $widget_data );
} elseif ( $widget_data['type'] == 'submit' ) {
$clean_widget = $this->clean_submit_widget( $widget_data );
} elseif ( $widget_data['type'] == 'reset' ) {
$clean_widget = $this->clean_reset_widget( $widget_data );
}
return $clean_widget;
}
private function clean_search_widget( $widget_data ) {
$clean_widget = array();
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['placeholder'] = sanitize_text_field( $widget_data['placeholder'] );
$clean_widget['accessibility_label'] = sanitize_text_field( $widget_data['accessibility_label'] );
return $clean_widget;
}
private function clean_taxonomy_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'taxonomy_name' => '',
'input_type' => '',
'heading' => '',
'all_items_label' => '',
'operator' => '',
'show_count' => '',
'hide_empty' => '',
'hierarchical' => '',
'include_children' => '',
'accessibility_label' => '',
'drill_down' => '',
'order_by' => '',
'order_dir' => '',
'exclude_ids' => '',
'sync_include_exclude' => '',
'combo_box' => '',
'no_results_message' => '',
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['accessibility_label'] = sanitize_text_field( $widget_data['accessibility_label'] );
$clean_widget['all_items_label'] = sanitize_text_field( $widget_data['all_items_label'] );
$clean_widget['show_count'] = $this->sanitize_checkbox( $widget_data['show_count'] );
$clean_widget['hide_empty'] = $this->sanitize_checkbox( $widget_data['hide_empty'] );
$clean_widget['hierarchical'] = $this->sanitize_checkbox( $widget_data['hierarchical'] );
$clean_widget['include_children'] = $this->sanitize_checkbox( $widget_data['include_children'] );
$clean_widget['drill_down'] = $this->sanitize_checkbox( $widget_data['drill_down'] );
$clean_widget['sync_include_exclude'] = $this->sanitize_checkbox( $widget_data['sync_include_exclude'] );
$clean_widget['combo_box'] = $this->sanitize_checkbox( $widget_data['combo_box'] );
$clean_widget['no_results_message'] = sanitize_text_field( $widget_data['no_results_message'] );
$clean_widget['operator'] = sanitize_key( $widget_data['operator'] );
$clean_widget['order_by'] = sanitize_key( $widget_data['order_by'] );
$clean_widget['order_dir'] = sanitize_key( $widget_data['order_dir'] );
$clean_widget['exclude_ids'] = $this->clean_exclude_ids( $widget_data['exclude_ids'] );
// if($widget_data['type']=="taxonomy")
// {
$clean_widget['taxonomy_name'] = sanitize_text_field( $widget_data['taxonomy_name'] );
// }
return $clean_widget;
}
private function clean_post_type_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'post_types' => array(),
'input_type' => '',
'heading' => '',
'all_items_label' => '',
'show_count' => '',
'hide_empty' => '',
'accessibility_label' => '',
'order_by' => '',
'order_dir' => '',
'combo_box' => '',
'no_results_message' => '',
);
$widget_data = array_replace( $defaults, $widget_data );
foreach ( $widget_data['post_types'] as $key => $val ) {
$clean_widget['post_types'][ $key ] = $this->sanitize_checkbox( $val );
}
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['all_items_label'] = sanitize_text_field( $widget_data['all_items_label'] );
$clean_widget['accessibility_label'] = sanitize_text_field( $widget_data['accessibility_label'] );
$clean_widget['combo_box'] = $this->sanitize_checkbox( $widget_data['combo_box'] );
$clean_widget['no_results_message'] = sanitize_text_field( $widget_data['no_results_message'] );
// $clean_widget['show_count'] = $this->sanitize_checkbox($widget_data['show_count']);
// $clean_widget['hide_empty'] = $this->sanitize_checkbox($widget_data['hide_empty']);
// $clean_widget['order_by'] = sanitize_key($widget_data['order_by']);
// $clean_widget['order_dir'] = sanitize_key($widget_data['order_dir']);
return $clean_widget;
}
private function clean_post_date_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'input_type' => '',
'heading' => '',
'date_format' => '',
'accessibility_label' => '',
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['accessibility_label'] = sanitize_text_field( $widget_data['accessibility_label'] );
$clean_widget['date_format'] = sanitize_text_field( $widget_data['date_format'] );
$clean_widget['date_from_prefix'] = sanitize_text_field( $widget_data['date_from_prefix'] );
$clean_widget['date_from_postfix'] = sanitize_text_field( $widget_data['date_from_postfix'] );
$clean_widget['date_from_placeholder'] = sanitize_text_field( $widget_data['date_from_placeholder'] );
$clean_widget['date_to_prefix'] = sanitize_text_field( $widget_data['date_to_prefix'] );
$clean_widget['date_to_postfix'] = sanitize_text_field( $widget_data['date_to_postfix'] );
$clean_widget['date_to_placeholder'] = sanitize_text_field( $widget_data['date_to_placeholder'] );
$clean_widget['date_use_dropdown_month'] = $this->sanitize_checkbox( $widget_data['date_use_dropdown_month'] );
$clean_widget['date_use_dropdown_year'] = $this->sanitize_checkbox( $widget_data['date_use_dropdown_year'] );
return $clean_widget;
}
private function clean_author_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'input_type' => '',
'heading' => '',
'optioncount' => '',
'exclude_admin' => '',
'show_fullname' => '',
'order_by' => '',
'order_dir' => '',
'hide_empty' => '',
'operator' => '',
'all_items_label' => '',
'accessibility_label' => '',
'exclude' => '',
'combo_box' => '',
'no_results_message' => '',
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['all_items_label'] = sanitize_text_field( $widget_data['all_items_label'] );
$clean_widget['accessibility_label'] = sanitize_text_field( $widget_data['accessibility_label'] );
$clean_widget['optioncount'] = $this->sanitize_checkbox( $widget_data['optioncount'] );
$clean_widget['exclude_admin'] = $this->sanitize_checkbox( $widget_data['exclude_admin'] );
$clean_widget['show_fullname'] = $this->sanitize_checkbox( $widget_data['show_fullname'] );
$clean_widget['hide_empty'] = $this->sanitize_checkbox( $widget_data['hide_empty'] );
$clean_widget['combo_box'] = $this->sanitize_checkbox( $widget_data['combo_box'] );
$clean_widget['no_results_message'] = sanitize_text_field( $widget_data['no_results_message'] );
$clean_widget['operator'] = sanitize_key( $widget_data['operator'] );
$clean_widget['order_by'] = sanitize_key( $widget_data['order_by'] );
$clean_widget['order_dir'] = sanitize_key( $widget_data['order_dir'] );
$clean_widget['exclude'] = $this->clean_exclude_ids( $widget_data['exclude'] );
return $clean_widget;
}
private function clean_post_meta_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'heading' => '',
'input_type' => '',
'meta_type' => '',
'meta_key' => '',
'meta_key_manual' => '',
'meta_key_manual_toggle' => '',
'choice_heading' => '',
'choice_meta_key' => '',
'choice_get_option_mode' => 'auto',
'choice_order_option_by' => 'value',
'choice_order_option_dir' => 'asc',
'choice_order_option_type' => 'alphabetic',
'choice_is_acf' => '',
'choice_accessibility_label' => '',
'number_heading' => '',
'number_start_meta_key' => '',
'number_end_meta_key' => '',
'number_use_same_toggle' => '',
'number_accessibility_label' => '',
'date_heading' => '',
'date_start_meta_key' => '',
'date_end_meta_key' => '',
'date_meta_key' => '',
'date_use_same_toggle' => '',
'date_from_prefix' => '',
'date_from_postfix' => '',
'date_from_placeholder' => '',
'date_to_prefix' => '',
'date_to_postfix' => '',
'date_to_placeholder' => '',
'date_use_dropdown_year' => '',
'date_use_dropdown_month' => '',
'date_accessibility_label' => '',
'number_input_type' => '',
'number_is_decimal' => '',
'choice_input_type' => '',
'combo_box' => '',
'no_results_message' => '',
'show_count' => '',
'hide_empty' => '',
'date_input_type' => '',
'range_min_detect' => '',
'range_max_detect' => '',
'range_min' => '0',
'range_max' => '1000',
'range_step' => '10',
'thousand_seperator' => '',
'decimal_seperator' => '',
'decimal_places' => '0',
'number_decimal_places' => '2',
'number_values_seperator' => ' - ',
'number_display_values_as' => 'textinput',
'number_display_input_as' => 'singlefield',
'range_value_prefix' => '',
'range_value_postfix' => '',
'date_output_format' => 'd/m/Y',
'date_input_format' => 'timestamp',
'date_compare_mode' => 'userrange',
'number_compare_mode' => 'userrange',
'operator' => '',
'all_items_label' => '',
'all_items_label_number' => '',
'meta_options' => array(),
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['meta_type'] = sanitize_key( $widget_data['meta_type'] );
$clean_widget['number_input_type'] = sanitize_key( $widget_data['number_input_type'] );
$clean_widget['number_is_decimal'] = $this->sanitize_checkbox( $widget_data['number_is_decimal'] );
$clean_widget['choice_input_type'] = sanitize_key( $widget_data['choice_input_type'] );
$clean_widget['date_input_type'] = sanitize_key( $widget_data['date_input_type'] );
// $clean_widget['meta_key_manual'] = sanitize_text_field($widget_data['meta_key_manual']);
$clean_widget['meta_key_manual_toggle'] = $this->sanitize_checkbox( $widget_data['meta_key_manual_toggle'] );
$clean_widget['combo_box'] = $this->sanitize_checkbox( $widget_data['combo_box'] );
$clean_widget['no_results_message'] = sanitize_text_field( $widget_data['no_results_message'] );
$clean_widget['show_count'] = $this->sanitize_checkbox( $widget_data['show_count'] );
$clean_widget['hide_empty'] = $this->sanitize_checkbox( $widget_data['hide_empty'] );
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['choice_meta_key'] = sanitize_text_field( $widget_data['choice_meta_key'] );
$clean_widget['choice_accessibility_label'] = sanitize_text_field( $widget_data['choice_accessibility_label'] );
$clean_widget['choice_get_option_mode'] = sanitize_key( $widget_data['choice_get_option_mode'] );
$clean_widget['choice_order_option_by'] = sanitize_key( $widget_data['choice_order_option_by'] );
$clean_widget['choice_order_option_dir'] = sanitize_key( $widget_data['choice_order_option_dir'] );
$clean_widget['choice_order_option_type'] = sanitize_key( $widget_data['choice_order_option_type'] );
$clean_widget['choice_is_acf'] = $this->sanitize_checkbox( $widget_data['choice_is_acf'] );
$clean_widget['date_accessibility_label'] = sanitize_text_field( $widget_data['date_accessibility_label'] );
$clean_widget['date_meta_key'] = sanitize_text_field( $widget_data['date_meta_key'] );
$clean_widget['date_start_meta_key'] = sanitize_text_field( $widget_data['date_start_meta_key'] );
$clean_widget['date_end_meta_key'] = sanitize_text_field( $widget_data['date_end_meta_key'] );
$clean_widget['date_use_same_toggle'] = $this->sanitize_checkbox( $widget_data['date_use_same_toggle'] );
$clean_widget['number_accessibility_label'] = sanitize_text_field( $widget_data['number_accessibility_label'] );
$clean_widget['number_start_meta_key'] = sanitize_text_field( $widget_data['number_start_meta_key'] );
$clean_widget['number_end_meta_key'] = sanitize_text_field( $widget_data['number_end_meta_key'] );
$clean_widget['number_use_same_toggle'] = $this->sanitize_checkbox( $widget_data['number_use_same_toggle'] );
if ( $clean_widget['meta_type'] == 'number' ) {
$clean_widget['heading'] = sanitize_text_field( $widget_data['number_heading'] );
$clean_widget['meta_key'] = sanitize_text_field( $widget_data['number_start_meta_key'] );
} elseif ( $clean_widget['meta_type'] == 'choice' ) {
$clean_widget['heading'] = sanitize_text_field( $widget_data['choice_heading'] );
$clean_widget['meta_key'] = sanitize_text_field( $widget_data['choice_meta_key'] );
} elseif ( $clean_widget['meta_type'] == 'date' ) {
$clean_widget['heading'] = sanitize_text_field( $widget_data['date_heading'] );
$clean_widget['meta_key'] = sanitize_text_field( $widget_data['date_start_meta_key'] );
}
$clean_widget['date_from_prefix'] = $this->sanitize_text_field_kws( $widget_data['date_from_prefix'] );
$clean_widget['date_from_postfix'] = $this->sanitize_text_field_kws( $widget_data['date_from_postfix'] );
$clean_widget['date_from_placeholder'] = sanitize_text_field( $widget_data['date_from_placeholder'] );
$clean_widget['date_to_prefix'] = $this->sanitize_text_field_kws( $widget_data['date_to_prefix'] );
$clean_widget['date_to_postfix'] = $this->sanitize_text_field_kws( $widget_data['date_to_postfix'] );
$clean_widget['date_to_placeholder'] = sanitize_text_field( $widget_data['date_to_placeholder'] );
$clean_widget['date_use_dropdown_month'] = $this->sanitize_checkbox( $widget_data['date_use_dropdown_month'] );
$clean_widget['date_use_dropdown_year'] = $this->sanitize_checkbox( $widget_data['date_use_dropdown_year'] );
$clean_widget['decimal_places'] = (int) $widget_data['decimal_places'];
if ( $clean_widget['decimal_places'] > 5 ) {
$clean_widget['decimal_places'] = 5;
} elseif ( $clean_widget['decimal_places'] < 0 ) {
$clean_widget['decimal_places'] = 0;
}
$clean_widget['number_decimal_places'] = (int) $widget_data['number_decimal_places'];
if ( $clean_widget['number_decimal_places'] > 5 ) {
$clean_widget['number_decimal_places'] = 5;
} elseif ( $clean_widget['number_decimal_places'] < 0 ) {
$clean_widget['number_decimal_places'] = 0;
}
$clean_widget['thousand_seperator'] = $this->sanitize_text_field_kws( $widget_data['thousand_seperator'] );
$clean_widget['decimal_seperator'] = $this->sanitize_text_field_kws( $widget_data['decimal_seperator'] );
$clean_widget['number_values_seperator'] = $this->sanitize_text_field_kws( $widget_data['number_values_seperator'] );
$clean_widget['number_display_values_as'] = sanitize_text_field( $widget_data['number_display_values_as'] );
$clean_widget['number_display_input_as'] = sanitize_text_field( $widget_data['number_display_input_as'] );
$clean_widget['range_min_detect'] = $this->sanitize_checkbox( $widget_data['range_min_detect'] );
$clean_widget['range_max_detect'] = $this->sanitize_checkbox( $widget_data['range_max_detect'] );
// convert all numeric data to correct format based on decimal places and `is_decimal`
$range_min = $widget_data['range_min'];
$range_max = $widget_data['range_max'];
$range_step = $widget_data['range_step'];
$decimal_point = '.';
if ( $clean_widget['number_is_decimal'] == 0 ) {// if data is not actually decimal, its really only cosmetic to display the the decimal places - so remove all decimals to reset them to 0 on the next `number_format` call
$range_min = number_format( (float) $range_min, 0, $decimal_point, '' );
$range_max = number_format( (float) $range_max, 0, $decimal_point, '' );
$range_step = number_format( (float) $range_step, 0, $decimal_point, '' );
} else { // also remove any data in extra decimal places
$range_min = number_format( (float) $range_min, $clean_widget['number_decimal_places'], $decimal_point, '' );
$range_max = number_format( (float) $range_max, $clean_widget['number_decimal_places'], $decimal_point, '' );
$range_step = number_format( (float) $range_step, $clean_widget['number_decimal_places'], $decimal_point, '' );
}
$decimal_places = $clean_widget['decimal_places'];
if ( $clean_widget['number_input_type'] == 'range-number' ) {
$decimal_places = 0;
}
$clean_widget['range_min'] = number_format( (float) $range_min, $decimal_places, $decimal_point, '' );
$clean_widget['range_max'] = number_format( (float) $range_max, $decimal_places, $decimal_point, '' );
$clean_widget['range_step'] = number_format( (float) $range_step, $decimal_places, $decimal_point, '' );
$clean_widget['range_value_prefix'] = $this->sanitize_text_field_kws( $widget_data['range_value_prefix'] );
$clean_widget['range_value_postfix'] = $this->sanitize_text_field_kws( $widget_data['range_value_postfix'] );
$clean_widget['date_input_format'] = sanitize_text_field( $widget_data['date_input_format'] );
$clean_widget['date_compare_mode'] = sanitize_text_field( $widget_data['date_compare_mode'] );
$clean_widget['number_compare_mode'] = sanitize_text_field( $widget_data['number_compare_mode'] );
$clean_widget['date_output_format'] = sanitize_text_field( $widget_data['date_output_format'] );
$clean_widget['all_items_label'] = sanitize_text_field( $widget_data['all_items_label'] );
$clean_widget['all_items_label_number'] = sanitize_text_field( $widget_data['all_items_label_number'] );
$clean_widget['operator'] = sanitize_key( $widget_data['operator'] );
$clean_widget['meta_options'] = array();
$so_count = 0;
if ( $clean_widget['choice_get_option_mode'] == 'manual' ) {
if ( isset( $widget_data['meta_options'] ) ) {
foreach ( $widget_data['meta_options'] as $meta_option ) {
$clean_widget['meta_options'][ $so_count ] = array();
foreach ( $meta_option as $key => $val ) {
if ( $key == 'option_value' ) {
$clean_widget['meta_options'][ $so_count ][ $key ] = sanitize_text_field( $val );
} elseif ( $key == 'option_label' ) {
$clean_widget['meta_options'][ $so_count ][ $key ] = sanitize_text_field( $val );
}
}
$so_count++;
}
}
}
return $clean_widget;
}
function sanitize_text_field_kws( $str ) {
$filtered = wp_check_invalid_utf8( $str );
if ( strpos( $filtered, '<' ) !== false ) {
$filtered = wp_pre_kses_less_than( $filtered );
// This will strip extra whitespace for us.
$filtered = wp_strip_all_tags( $filtered, true );
} else {
$filtered = ( preg_replace( '/[\r\n\t ]+/', ' ', $filtered ) );
}
$found = false;
while ( preg_match( '/%[a-f0-9]{2}/i', $filtered, $match ) ) {
$filtered = str_replace( $match[0], '', $filtered );
$found = true;
}
if ( $found ) {
// Strip out the whitespace that may now exist after removing the octets.
$filtered = trim( preg_replace( '/ +/', ' ', $filtered ) );
}
/**
* Filter a sanitized text field string.
*
* @since 2.9.0
*
* @param string $filtered The sanitized string.
* @param string $str The string prior to being sanitized.
*/
return apply_filters( 'sanitize_text_field', $filtered, $str );
}
private function clean_sort_order_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
/*
'meta_key' => '',
'meta_key_manual' => '',
'meta_key_manual_toggle' => '',*/
/*
'sort_by' => '',
'sort_dir' => '',
'sort_label' => '',*/
'input_type' => '',
'accessibility_label' => '',
'heading' => '',
'all_items_label' => '',
'sort_options' => array(),
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
// $clean_widget['meta_key'] = sanitize_key($widget_data['meta_key']);
// $clean_widget['meta_key_manual'] = sanitize_key($widget_data['meta_key_manual']);
// $clean_widget['meta_key_manual_toggle'] = $this->sanitize_checkbox($widget_data['meta_key_manual_toggle']);
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['all_items_label'] = sanitize_text_field( $widget_data['all_items_label'] );
$clean_widget['accessibility_label'] = sanitize_text_field( $widget_data['accessibility_label'] );
$clean_widget['sort_options'] = array();
$so_count = 0;
if ( isset( $widget_data['sort_options'] ) ) {
foreach ( $widget_data['sort_options'] as $sort_option ) {
$clean_widget['sort_options'][ $so_count ] = array();
foreach ( $sort_option as $key => $val ) {
if ( $key == 'meta_key' ) {
$clean_widget['sort_options'][ $so_count ][ $key ] = sanitize_text_field( $val );
} elseif ( $key == 'name' ) {
$clean_widget['sort_options'][ $so_count ][ $key ] = sanitize_text_field( $val );
} elseif ( $key == 'sort_type' ) {
$clean_widget['sort_options'][ $so_count ][ $key ] = sanitize_key( $val );
} elseif ( $key == 'sort_by' ) {
$clean_widget['sort_options'][ $so_count ][ $key ] = sanitize_key( $val );
} elseif ( $key == 'sort_dir' ) {
$clean_widget['sort_options'][ $so_count ][ $key ] = sanitize_key( $val );
} elseif ( $key == 'sort_label' ) {
$clean_widget['sort_options'][ $so_count ][ $key ] = sanitize_text_field( $val );
}
}
$so_count++;
}
}
return $clean_widget;
}
private function clean_posts_per_page_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'input_type' => '',
'accessibility_label' => '',
'heading' => '',
'all_items_label' => '',
'ppp_min' => '25',
'ppp_max' => '100',
'ppp_step' => '25',
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['all_items_label'] = sanitize_text_field( $widget_data['all_items_label'] );
$clean_widget['accessibility_label'] = sanitize_text_field( $widget_data['accessibility_label'] );
$clean_widget['ppp_min'] = (int) $widget_data['ppp_min'];
$clean_widget['ppp_max'] = (int) $widget_data['ppp_max'];
$clean_widget['ppp_step'] = (int) $widget_data['ppp_step'];
return $clean_widget;
}
private function clean_submit_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'heading' => '',
'label' => 'Submit',
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['label'] = sanitize_text_field( $widget_data['label'] );
return $clean_widget;
}
private function clean_reset_widget( $widget_data ) {
$clean_widget = array();
$defaults = array(
'heading' => '',
'label' => 'Reset',
'submit_form' => 'always',
'input_type' => 'link',
);
$widget_data = array_replace( $defaults, $widget_data );
$clean_widget['type'] = sanitize_text_field( $widget_data['type'] );
$clean_widget['heading'] = sanitize_text_field( $widget_data['heading'] );
$clean_widget['input_type'] = sanitize_key( $widget_data['input_type'] );
$clean_widget['submit_form'] = sanitize_key( $widget_data['submit_form'] );
$clean_widget['label'] = sanitize_text_field( $widget_data['label'] );
return $clean_widget;
}
// utility functions
public function sanitize_checkbox( $value ) {
if ( $value != '' ) {
return 1;
} else {
return 0;
}
}
public function clean_exclude_ids( $exclude_ids ) {
return implode( ',', $this->arrayToInt( array_map( 'trim', explode( ',', $exclude_ids ) ) ) );
}
private function arrayToInt( array $arr ) {
foreach ( $arr as &$a ) {
$a = trim( $a );
if ( $a != '' ) {
$a = (int) $a;
}
}
return array_filter( $arr );
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter_Widgets_Admin
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Widgets_Admin {
public function __construct() {
/*
* Call $plugin_slug from public plugin class.
*/
$this->plugin_slug = 'search-filter';
// Load widgets admin style she et and JavaScript.
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
/*
AJAX */
/*
add_action( 'wp_ajax_meta_prefs_set', array($this, 'meta_prefs_set') ); //if logged in
add_action( 'wp_ajax_nopriv_meta_prefs_set', array($this, 'meta_prefs_set') ); //if not logged in
*/
}
public function enqueue_admin_styles() {
// wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( 'assets/css/admin.css' ), array(), Search_Filter_Admin::VERSION );
}
public function enqueue_admin_scripts() {
wp_enqueue_script( $this->plugin_slug . '-admin-widgets-script', plugins_url( '/assets/js/admin-widgets.js', dirname( __FILE__ ) ), array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery' ), Search_Filter_Admin::VERSION );
// wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), Search_Filter_Admin::VERSION );
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden

View File

@@ -0,0 +1 @@
<?php // Silence is golden

View File

@@ -0,0 +1,40 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="available-fields" class="widgets-search-filter-draggables ui-search-filter-sortable" data-allow-expand="0">
<p class="description"><?php _e("Drag any of these Available Fields in to the <strong>Search Form UI</strong> to start building your Search Form.", $this->plugin_slug ); ?></p>
<?php
$this->display_meta_box_field("search");
$this->display_meta_box_field("tag");
$this->display_meta_box_field("category");
$this->display_meta_box_field("taxonomy");
$this->display_meta_box_field("post_type");
$this->display_meta_box_field("post_date");
$this->display_meta_box_field("post_meta");
$this->display_meta_box_field("author");
$this->display_meta_box_field("sort_order");
$this->display_meta_box_field("posts_per_page");
$this->display_meta_box_field("submit");
$this->display_meta_box_field("reset");
?>
</div>

View File

@@ -0,0 +1,200 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<?php
if(!$cache_options)
{
_e('Cache has not started yet...', $this->plugin_slug);
}
else
{
?>
<p>
<?php
$status = $cache_options['status'];
$current_post = $cache_options['current_post_index'];
$total_posts = $cache_options['total_post_index'];
$progress_percent = $cache_options['progress_percent'];
$last_update = $cache_options['last_update'];
$error_count = $cache_options['error_count'];
$locked = $cache_options['locked'];
$restart = $cache_options['restart'];
$caching_data = $cache_options['caching_data'];
$cache_list = $cache_options['cache_list'];
$connection_status = $cache_options['rc_status'];
$connection_text = "";
$run_method = "automatic";
if(isset($cache_options['run_method']))
{
$run_method = $cache_options['run_method'];
}
//warn if any duplicates in cache
$cache_list_duplicates = array_unique( array_diff_assoc( $cache_list, array_unique( $cache_list ) ) );
if($connection_status=="connect_success")
{
//wp reomte get works great
$connection_text = "Success, `wp_remote_post` works";
}
else if($connection_status=="user_bypass")
{
//means a user changed this in the settings to use Ajax
$connection_text = "Success, using Ajax | User disabled `wp_remote_post`";
}
else if($connection_status=="connect_error")
{
//means a wp_remote_post failed
$connection_text = "Failed, `wp_remote_post";
if(($status=="inprogress")||($status=="termcache"))
{
$connection_text .= " | Looks like its resumed via Ajax because status is `$status``";
}
}
else if($connection_status=="routing_error")
{
//means a wp_remove_get worked, but didn't contain the data we expected
}
/*else if($connection_status=="termcache")
{
//historic - used to be the process that ran after the build of the main cache table (when the term table was built separately after the cache table
}*/
?>
</p>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Status: ', $this->plugin_slug); ?>
</th>
<td>
<strong><?php echo $status; ?></strong>
<?php
if($restart==true)
{
echo "<br /><em style=\"font-weight:normal;color:#888888;\">".__('Restarting ', $this->plugin_slug)."</em>";
}
?>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Current Progress: ', $this->plugin_slug); ?>
</th>
<td>
<strong><?php echo $current_post; ?> / <?php echo $total_posts; ?> (<?php echo $progress_percent; ?>%)</strong><br />
<em style="font-weight:normal;color:#888888;"><?php echo sprintf(__('Last Updated: %s', $this->plugin_slug), date(DATE_RFC2822, $last_update)); ?></em>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Run Method: ', $this->plugin_slug); ?>
</th>
<td>
<span id="search-filter-cache-method-value"><?php echo $run_method; ?></span> <a href="#" id="search-filter-cache-method-switch">(<?php _e('switch', $this->plugin_slug); ?>)</a>
<?php
if($run_method=="manual")
///if($run_method=="automatic")
{
?>
<br />
<br />
<!--<input type="hidden" id="search-filter-cache-manual-url" ="<?php echo esc_url(add_query_arg('action', 'cache_progress', admin_url( 'admin-ajax.php' ))); ?>" />-->
<!--PAGE <input type="number" id="sfdc-movies-paged" value="1" step="1" />-->
<button style="margin-bottom:10px;" id="search-filter-cache-manual-continue">Continue Cache &gt; &gt;</button> <button id="search-filter-cache-manual-restart">Restart</button><br />
<label><input type="checkbox" id="search-filter-cache-auto-load" />Auto Load the Next Posts?</label>
<pre style="width:500px;background-color:#dddddd; padding:10px;max-height:250px;overflow-y:scroll;" id="search-filter-cache-manual-output"></pre>
<?php
}
?>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Connection Status: ', $this->plugin_slug); ?>
</th>
<td>
<?php echo $connection_text; ?>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Locked: ', $this->plugin_slug); ?>
</th>
<td>
<?php echo ($locked == true) ? "True" : "False"; ?>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Error Count: ', $this->plugin_slug); ?>
</th>
<td>
<?php echo $error_count; ?>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Cache List', $this->plugin_slug); ?>
</th>
<td>
<?php
if(!empty($cache_list_duplicates))
{
echo '<strong>'.__("Notice: Duplicates Found: ", $this->plugin_slug).'</strong>';
?>
<pre style="width:500px;background-color:#dddddd; padding:10px;max-height:250px;overflow-y:scroll;"><?php var_dump($cache_list_duplicates); ?></pre>
<?php
}
?>
<pre style="width:500px;background-color:#dddddd; padding:10px;max-height:250px;overflow-y:scroll;"><?php var_dump($cache_list); ?></pre>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Cached Data', $this->plugin_slug); ?>
</th>
<td>
<pre style="width:500px;background-color:#dddddd; padding:10px;max-height:250px;overflow-y:scroll;"><?php var_dump($caching_data); ?></pre>
</td>
</tr>
</tbody>
</table>
</p>
<!--<form method="post" action="options.php">
<?php submit_button(); ?>
</form>-->
<?php
}
?>
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<!-- @TODO: Provide markup for your options page here. -->
</div>

View File

@@ -0,0 +1,123 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?><a href="#" class="add-new-h2">Add New</a></h2>
<ul class="subsubsub">
<li class=""><a href="#">All <span class="count">(15)</span></a> |</li>
<li class=""><a href="#" class="current">Active <span class="count">(4)</span></a> |</li>
<li class=""><a href="#">Inactive <span class="count">(11)</span></a></li>
</ul>
<form method="get" action="">
<p class="search-box">
<label class="screen-reader-text" for="plugin-search-input">Search Installed Plugins:</label>
<input type="search" id="plugin-search-input" name="s" value="">
<input type="submit" name="" id="search-submit" class="button" value="Search Something">
</p>
</form>
<div class="clear"></div>
<!-- Messages -->
<h3>Messages</h3>
<div id="message" class="updated"><p>Message <strong>updated</strong>.</p></div>
<div id="message" class="error"><p>Message <strong>error</strong>.</p></div>
<hr />
<!-- Layout -->
<h3>Layout</h3>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<div class="postbox opened">
<h3>Post Body</h3>
<div class="inside">
Desc
<div class="clear"></div>
</div>
<ul class="subsubsub">
<li class="all"><a href="edit-comments.php?comment_status=all">All</a> |</li>
<li class="moderated"><a href="edit-comments.php?comment_status=moderated">Pending <span class="count">(<span class="pending-count">0</span>)</span></a> |</li>
<li class="approved"><a href="edit-comments.php?comment_status=approved">Approved</a> |</li>
<li class="spam"><a href="edit-comments.php?comment_status=spam">Spam <span class="count">(<span class="spam-count">0</span>)</span></a> |</li>
<li class="trash"><a href="edit-comments.php?comment_status=trash">Trash <span class="count">(<span class="trash-count">0</span>)</span></a></li>
</ul>
</div>
</div>
<div id="postbox-container-1" class="postbox-container">
<div class="postbox opened">
<h3>Postbox Container 1</h3>
<div class="inside">
Desc
</div>
</div>
</div>
<div id="postbox-container-2" class="postbox-container">
<div class="postbox opened">
<h3>Postbox Container 2</h3>
<div class="inside">
Desc
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<hr />
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-3">
<div id="postbox-container-1" class="postbox-container">
<div class="postbox opened">
<h3>Postbox Container 1</h3>
<div class="inside">
Desc
</div>
</div>
</div>
<div id="postbox-container-2" class="postbox-container">
<div class="postbox opened">
<h3>Postbox Container 2</h3>
<div class="inside">
Desc
</div>
</div>
</div>
<div id="postbox-container-3" class="postbox-container">
<div class="postbox opened">
<h3>Postbox Container 2</h3>
<div class="inside">
Desc
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<hr />
<!-- Buttons -->
<h3>Buttons</h3>
<p class="submit">
<input type="submit" name="submit" id="submit" class="button button-primary" value="Primary Button">
<input type="submit" name="submit" id="submit" class="button button-secondary" value="Secondary Button">
</p>
</div>

View File

@@ -0,0 +1,121 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<h3><?php _e('Search &amp; Filter License'); ?></h3>
<form method="post" action="options.php">
<?php settings_fields('search_filter_license'); ?>
<?php _e('Enter your license key to enable updates.'); ?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('License Key'); ?>
</th>
<td>
<input id="search_filter_license_key" name="search_filter_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" />
<input type="submit" class="button" value="Save Changes" style="display:inline-block;">
</td>
</tr>
<?php if( $status !== false ) { ?>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('License Status'); ?>
</th>
<td>
<?php
if($status === "invalid") {
echo '<span style="color:red;">';//<?php _e('Invalid: ');
if ( $error === "expired" ){
echo ucwords($error);
}
else{
echo "Invalid License Key";
}
echo '</span>';
}
else {
?><span style="color:green;"><?php _e('Active'); ?></span><?php
}
?>
</td>
</tr>
<?php }
else {
?>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('License Status'); ?>
</th>
<td>
<em>License Inactive</em>
</td>
</tr>
<?php
}
?>
<?php if( $expires !== false && $expires !== '' ) { ?>
<?php
if(( $error !== false && $error === 'expired' )||($error === false)) {
?>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('License Valid Until'); ?>
</th>
<td>
<?php
$time = time();
$expires_time = strtotime($expires);
//$color = "red";
if($time <= $expires_time){
//$color = "green";
}
echo '<span>'.date('jS F Y', strtotime($expires)).'</span>';
?>
</td>
</tr>
<?php } ?>
<?php } ?>
<?php if( false !== $license ) { ?>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Activate License'); ?>
</th>
<td>
<?php if( $status !== false && $status == 'valid' ) { ?>
<?php wp_nonce_field( 'search_filter_nonce', 'search_filter_nonce' ); ?>
<input type="submit" class="button-secondary" name="edd_license_deactivate" value="<?php _e('Deactivate License'); ?>"/>
<?php } else {
wp_nonce_field( 'search_filter_nonce', 'search_filter_nonce' ); ?>
<input type="submit" class="button-secondary" name="search_filter_license_activate" value="<?php _e('Activate License'); ?>"/>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>

View File

@@ -0,0 +1,157 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="cache-info" class="widgets-search-filter-draggables ui-search-filter-sortable setup" data-allow-expand="0">
<p class="description-inline notice-building notice-rc-error" style="background-color:#FFDCD6;padding:10px;border:1px solid #F2C7B4;">
<?php _e("<strong>Notice</strong>: Running background processes is either disabled or has failed in this environment.<br /><br />Therefore you must leave this page open to complete caching.", $this->plugin_slug); ?>
</p>
<?php
global $post;
$cache_view = array(
"disabled" => array('style'=>''),
"ready" => array('style'=>''),
"finished" => array('style'=>''),
"inprogress" => array('style'=>''),
"error" => array('style'=>'')
);
$values['status'] = "inprogress";
$values['enabled'] = 1;
?>
<div class="cache-metabox status-wait" style="display:block;">
<p class="description-inline">
<?php _e("<em>Fetching cache information...</em>", $this->plugin_slug); ?>
</p>
</div>
<div class="cache-metabox status-disabled">
<p class="description-inline">
<?php _e("<strong>Notice:</strong> Cache is not enabled, this is required for advanced features.", $this->plugin_slug); ?>
</p>
<?php
$enabled_style="";
$disabled_style="";
?>
<p class="description-inline" style="text-align:right;">
<span name="save" type="submit" class="button button-large toggle-cache" data-sfid="<?php echo $post->ID; ?>" data-enable-cache="1"><?php _e("Enable", $this->plugin_slug); ?></span>
</p>
</div>
<div class="cache-metabox status-inprogress"<?php echo $cache_view['inprogress']['style']; ?>>
<p class="description-inline">
<strong><?php _e("Current Progress:", $this->plugin_slug); ?> </strong>
</p>
<p class="description-inline">
<?php _e("<span class='progress-current'>0</span> / <span class='progress-total'>0</span> posts - <strong><span class='progress-percent'>0</span>%</strong>", $this->plugin_slug); ?>
</p>
<div class="media-progress-bar"><div style="width: 0%"></div></div>
<p class="description-inline notice-building">
<?php _e("Building cache...", $this->plugin_slug); ?>
</p>
<p class="description-inline notice-stalled">
<?php _e("<strong>Caching paused: </strong> attempting to resume...", $this->plugin_slug); ?>
</p>
<p class="description-inline notice-building notice-alert">
<?php _e("Search results will only contain posts when caching has completed.", $this->plugin_slug); ?>
</p>
</div>
<div class="cache-metabox status-termcache">
<p class="description-inline">
<strong><?php _e("Current Progress:", $this->plugin_slug); ?> </strong>
</p>
<p class="description-inline">
<?php _e("Building the Term Cache", $this->plugin_slug); ?>
</p>
<div class="media-progress-bar"><div style="width: 0%"></div></div>
<p class="description-inline notice-building">
<?php _e("Almost finished...", $this->plugin_slug); ?>
</p>
<p class="description-inline notice-stalled">
<?php _e("<strong>Caching paused: </strong> attempting to resume...", $this->plugin_slug); ?>
</p>
<p class="description-inline notice-building notice-alert">
<?php _e("Search results will only contain posts when caching has completed.", $this->plugin_slug); ?>
</p>
</div>
<div class="cache-metabox status-error"<?php echo $cache_view['error']['style']; ?>>
<p class="description-inline notice-error">
<?php _e("<strong>Error: </strong>Unable to cache posts.", $this->plugin_slug); ?>
</p>
<p class="description-inline notice-alert">
<?php _e("Something prevented the caching process from running, you can try again by selecting <strong>Rebuild Cache</strong>.<br /><a href='https://searchandfilter.com/documentation/troubleshooting/#the-cache-won8217t-complete' target='_blank'>More info</a>", $this->plugin_slug); ?>
</p>
</div>
<div class="cache-metabox status-finished"<?php echo $cache_view['finished']['style']; ?>>
<p class="description-inline">
<?php _e("Cache up to date, all systems go.", $this->plugin_slug); ?>
</p>
</div>
<div class="cache-metabox status-restart"<?php echo $cache_view['finished']['style']; ?>>
<p class="description-inline">
<strong><?php _e("Restarting...", $this->plugin_slug); ?> </strong>
</p>
<p class="description-inline">
<?php _e("Changes have been made which require the cache to be rebuilt.", $this->plugin_slug); ?>
</p>
<p class="description-inline notice-building notice-please-wait" style="display:none;">
<?php _e("Please wait a moment...", $this->plugin_slug); ?>
</p>
</div>
<div class="cache-metabox status-ready"<?php echo $cache_view['finished']['style']; ?>>
<p class="description-inline">
<strong><?php _e("Ready, waiting for some posts to cache...", $this->plugin_slug); ?> </strong>
</p>
<p class="description-inline">
<?php _e("There is no data to cache yet.", $this->plugin_slug); ?>
</p>
</div>
<p class="description-inline" style="text-align:right;">
<!--<a class="submitdelete deletion" href="#">Rebuild Cache</a>-->
<span class="spinner rebuild-cache-spinner"></span>
<span class="button button-large rebuild-cache" data-sfid="<?php echo $post->ID; ?>"><?php _e("Rebuild Cache", $this->plugin_slug); ?></span>
</p>
</div>

View File

@@ -0,0 +1,40 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php wp_nonce_field( 'search_form_nonce', $this->plugin_slug.'_nonce', true, true ); ?>
<div id="search-form">
<p class="description"><?php _e( 'Build your Search Form here by dragging Available Fields in to this area.', $this->plugin_slug ); ?></p>
<?php
$widgets = (get_post_meta( $object->ID, '_search-filter-fields', true ));
if(isset($widgets))
{
if($widgets!="")
{
foreach ($widgets as $widget)
{
if(isset($widget['type']))
{
$this->display_meta_box_field($widget['type'], $widget, $object);
}
}
}
}
?>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="shortcode-info" class="widgets-search-filter-draggables ui-search-filter-sortable setup" data-allow-expand="0">
<?php
global $post;
?>
<br /><strong><?php _e("Search Form Shortcode:", $this->plugin_slug ); ?></strong><br /><small><?php _e("You can also use a widget to place the search form.", $this->plugin_slug); ?></small>
<p class="description-inline">
<label for="{0}[{1}][enable_auto_count]">
<input class="" name="form_shortcode" type="text" size="21" value="<?php echo esc_attr('[searchandfilter id="'.$post->ID.'"]'); ?>">
</label>
</p>
<div class="results-shortcode" style="display:none;">
<br /><strong><?php _e("Results Shortcode:", $this->plugin_slug ); ?></strong><br /><small><?php _e("This must be used on a page where your search form can be found - otherwise S&amp;F won't know where to load the results.", $this->plugin_slug); ?></small>
<p class="description-inline">
<input class="" name="results_shortcode" type="text" size="21" value="<?php echo esc_attr('[searchandfilter id="'.$post->ID.'" show="results"]'); ?>">
</p>
</div>
<div class="edd-shortcode" style="display:none;">
<br /><strong><?php _e("EDD Shortcode:", $this->plugin_slug ); ?></strong><br /><small><?php _e("Place this directly before your EDD [downloads] shortcode", $this->plugin_slug); ?></small>
<p class="description-inline">
<input class="" name="results_shortcode" type="text" size="21" value="<?php echo esc_attr('[searchandfilter id="'.$post->ID.'" action="prep_query"]'); ?>">
</p>
</div>
<br /><strong><?php _e("Use slug instead of ID:", $this->plugin_slug ); ?></strong><br /><small><?php _e("You can also use the slug instead of ID in your shortcodes.", $this->plugin_slug); ?></small>
<p class="description-inline">
<label for="{0}[{1}][enable_auto_count]">
<input class="" name="form_shortcode" type="text" size="21" value="<?php echo esc_attr('[searchandfilter slug="'.$post->post_name.'"]'); ?>">
</label>
</p>
<br />
</div>

View File

@@ -0,0 +1,223 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<?php _e('Global settings are applied to all search forms', $this->plugin_slug); ?>
<h3><?php _e('Cache', $this->plugin_slug); ?></h3>
<form method="post" action="options.php">
<?php settings_fields('search_filter_settings'); ?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Caching Speed', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<select name="search_filter_cache_speed">
<option value="slow"<?php $this->set_selected($cache_speed, "slow"); ?>><?php _e('Slow', $this->plugin_slug); ?></option>
<option value="medium"<?php $this->set_selected($cache_speed, "medium"); ?>><?php _e('Medium', $this->plugin_slug); ?></option>
<option value="fast"<?php $this->set_selected($cache_speed, "fast"); ?>><?php _e('Fast', $this->plugin_slug); ?></option>
</select>
<?php _e('This controls the speed at which the Cache is built when first indexing all the posts on your site or when it is required to be rebuilt.', $this->plugin_slug); ?>
<br /><br />
<div style="padding:10px;background-color: #EAEAEA;border: 1px solid #ddd;">
<p><?php _e('A faster setting means more posts will be cached in each process, however this is generally considered to be more resource intensive.', $this->plugin_slug); ?></p>
<p><?php _e('Using a high setting when your server cannot support it may result in internal server errors and resource limits being reached.', $this->plugin_slug); ?></p>
</div>
</label>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Use Background Processes', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<input id="search_filter_cache_use_manual" name="search_filter_cache_use_background_processes" type="checkbox" value="1"<?php $this->set_checked($cache_use_background_processes); ?> />
<?php _e('Build the cache in the background using `wp_remote_get()` - this is generally a good thing.', $this->plugin_slug); ?>
<br /><br />
<div style="padding:10px;background-color: #EAEAEA;border: 1px solid #ddd;">
<p><?php _e('Disable this if you are having issues with resources in your environement and you have already tried lowering the caching speed above.', $this->plugin_slug); ?></p>
<p><?php _e('If disabled, you must then goto any <strong>Add/Edit Search Form</strong> screen to allow the caching processes to complete via Ajax.', $this->plugin_slug); ?></p>
</div>
</label>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Use Transients', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<input id="search_filter_cache_use_transients" name="search_filter_cache_use_transients" type="checkbox" value="1"<?php $this->set_checked($cache_use_transients); ?> />
<?php _e('Frequently accessed query data will be stored in transients - this sometimes helps on sites with larger numbers of posts and filters/options. ', $this->plugin_slug); ?>
<br /><br />
<div style="padding:10px;background-color: #EAEAEA;border: 1px solid #ddd;">
<p><?php _e('This does not need to be enabled unless you are experiencing performance issues.', $this->plugin_slug); ?></p>
<p><?php _e('* This feature is currently not compatible with translation plugins.', $this->plugin_slug); ?></p>
</div>
</label>
</td>
</tr>
<!--<tr valign="top">
<th scope="row" valign="top">
<?php _e('Use Manual Caching', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<input id="search_filter_cache_use_manual" name="search_filter_cache_use_manual" type="checkbox" value="1"<?php $this->set_checked($cache_use_manual); ?> />
<?php _e('Manually rebuild the cache via the UI', $this->plugin_slug); ?>
<br /><br />
<div style="padding:10px;background-color: #EAEAEA;border: 1px solid #ddd;">
<?php _e('This only applies when initially building the cache or rebuilding the entire cache. Once the cache has been built once, it is automatically maintained regardless of this setting.', $this->plugin_slug); ?>
</div>
</label>
</td>
</tr>-->
</tbody>
</table>
<br />
<h3><?php _e('JavaScript & CSS', $this->plugin_slug); ?></h3>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Load JavaScript & CSS files', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<input id="search_filter_load_js_css" name="search_filter_load_js_css" type="checkbox" class="" value="1"<?php $this->set_checked($load_js_css); ?> />
<?php _e('<strong>Do not turn this setting off</strong>, S&amp;F will not work unless you plan to manually copy all JS &amp; CSS into your theme.', $this->plugin_slug); ?>
</label>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Lazy Load JavaScript', $this->plugin_slug); ?>
</th>
<td>
<label>
<input id="search_filter_lazy_load_js" name="search_filter_lazy_load_js" type="checkbox" class="" value="1"<?php $this->set_checked($lazy_load_js); ?> />
<?php _e('Not all themes support lazy loading - enabling this option ensures that Search &amp; Filter JavaScript files are only loaded on the pages that contain search forms - speeding up the other pages on your site.', $this->plugin_slug); ?>
</label>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Combobox Script', $this->plugin_slug); ?>
</th>
<td>
<label>
<select name="search_filter_combobox_script" id="search_filter_combobox_script">
<option value="select2"<?php $this->set_selected($combobox_script, "select2"); ?>><?php _e('Select2', $this->plugin_slug); ?></option>
<option value="chosen"<?php $this->set_selected($combobox_script, "chosen"); ?>><?php _e('Chosen', $this->plugin_slug); ?></option>
</select>
</label>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Load jQuery UI i18n files', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<input id="search_filter_load_jquery_i18n" name="search_filter_load_jquery_i18n" type="checkbox" class="" value="1"<?php $this->set_checked($load_jquery_i18n); ?> />
<?php _e('This loads the jQuery i18n files - which allows the date picker to be translated automatically using the jQuery translation files.', $this->plugin_slug); ?>
</label>
</td>
</tr>
</tbody>
</table>
<br />
<br />
<h3><?php _e('Miscellaneous', $this->plugin_slug); ?></h3>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Remove all data when deleting Search & Filter', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<input id="search_filter_remove_all_data" name="search_filter_remove_all_data" type="checkbox" class="" value="1"<?php $this->set_checked($remove_all_data); ?> />
<?php _e('Enable this setting to remove all data when uninstalling Search & Filter via the `plugins` page.', $this->plugin_slug); ?>
<br /><br />
<div style="padding:10px;background-color: #EAEAEA;border: 1px solid #ddd;">
<p>
<?php _e('Leaving this option disabled allows you to delete and re-install later, preserving your saved search forms and cache.', $this->plugin_slug); ?>
</p>
<p>
<?php _e('If you have modified any posts while the plugin is disabled / removed, you will likely need to rebuild the cache when activating Search & Filter again. ', $this->plugin_slug); ?>
</p>
</div>
</label>
</td>
</tr>
<tr valign="top">
<th scope="row" valign="top">
<?php _e('Use text input for meta keys', $this->plugin_slug); ?><br />
</th>
<td>
<label>
<input id="search_filter_meta_key_text_input" name="search_filter_meta_key_text_input" type="checkbox" class="" value="1"<?php $this->set_checked($meta_key_text_input); ?> />
<?php _e('Enabling this option allows you to directly enter your meta keys and can significantly improve performance in the admin UI when you have a large number of meta keys', $this->plugin_slug); ?>
</label>
</td>
</tr>
</table>
<?php submit_button(); ?>
</form>
</div>

View File

@@ -0,0 +1,719 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php
$current_tab = ! empty( $_REQUEST['tab'] ) ? sanitize_title( $_REQUEST['tab'] ) : 'status';
?>
<div class="wrap woocommerce">
<div class="icon32 icon32-woocommerce-status" id="icon-woocommerce"><br /></div><h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
<?php
$tabs = array(
'status' => __( 'System Status', 'search-filter-pro' ),
'search-forms' => __( 'Search Forms', 'search-filter-pro' )
);
foreach ( $tabs as $name => $label ) {
echo '<a href="' . admin_url( 'edit.php?post_type=search-filter-widget&page=search-filter-system-status&tab=' . $name ) . '" class="nav-tab ';
if ( $current_tab == $name ) echo 'nav-tab-active';
echo '">' . $label . '</a>';
}
?>
</h2>
<?php
if ( $current_tab == "status") {
?>
<?php /*<div class="updated woocommerce-message">
<p><?php _e( 'Please copy and paste this information in your ticket when contacting support:', 'search-filter-pro' ); ?> </p>
<p class="submit"><a href="#" class="button-primary debug-report"><?php _e( 'Get System Report', 'search-filter-pro' ); ?></a>
<a class="button-secondary docs" href="#" target="_blank"><?php _e( 'Understanding the Status Report', 'search-filter-pro' ); ?></a></p>
<div id="debug-report">
<textarea readonly="readonly"></textarea>
<p class="submit"><button id="copy-for-support" class="button-primary" href="#" data-tip="<?php esc_attr_e( 'Copied!', 'search-filter-pro' ); ?>"><?php _e( 'Copy for Support', 'search-filter-pro' ); ?></button></p>
<p class="copy-error hidden"><?php _e( 'Copying to clipboard failed. Please press Ctrl/Cmd+C to copy.', 'search-filter-pro' ); ?></p>
</div>
</div>*/ ?>
<table class="widefat" cellspacing="0" id="status">
<thead>
<tr>
<th colspan="3" data-export-label="WordPress Environment"><?php _e( 'WordPress Environment', 'search-filter-pro' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td data-export-label="Home URL"><?php _e( 'Home URL', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The URL of your site\'s homepage.', 'search-filter-pro' ) ); ?></td>
<td><?php form_option( 'home' ); ?></td>
</tr>
<tr>
<td data-export-label="Site URL"><?php _e( 'Site URL', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The root URL of your site.', 'search-filter-pro' ) ); ?></td>
<td><?php form_option( 'siteurl' ); ?></td>
</tr>
<tr>
<td data-export-label="WC Version"><?php _e( 'Search & Filter Pro Version', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The version of Search & Filter Pro installed on your site.', 'search-filter-pro' ) ); ?></td>
<td><?php echo esc_html( Search_Filter_Admin::VERSION ); ?></td>
</tr>
<?php /*<!--<tr>
<td data-export-label="Log Directory Writable"><?php _e( 'Log Directory Writable', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'Several WooCommerce extensions can write logs which makes debugging problems easier. The directory must be writable for this to happen.', 'search-filter-pro' ) ); ?></td>
<td><?php
if ( @fopen( WC_LOG_DIR . 'test-log.log', 'a' ) ) {
echo '<mark class="yes">&#10004; <code class="private">' . WC_LOG_DIR . '</code></mark> ';
} else {
printf( '<mark class="error">&#10005; ' . __( 'To allow logging, make <code>%s</code> writable or define a custom <code>WC_LOG_DIR</code>.', 'search-filter-pro' ) . '</mark>', WC_LOG_DIR );
}
?></td>
</tr>--> */ ?>
<tr>
<td data-export-label="WP Version"><?php _e( 'WP Version', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The version of WordPress installed on your site.', 'search-filter-pro' ) ); ?></td>
<td><?php bloginfo('version'); ?></td>
</tr>
<tr>
<td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'Whether or not you have WordPress Multisite enabled.', 'search-filter-pro' ) ); ?></td>
<td><?php if ( is_multisite() ) echo '&#10004;'; else echo '&ndash;'; ?></td>
</tr>
<tr>
<td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'search-filter-pro' ) ); ?></td>
<td><?php
$memory = $this->sf_let_to_num( WP_MEMORY_LIMIT );
if ( function_exists( 'memory_get_usage' ) ) {
$system_memory = $this->sf_let_to_num( @ini_get( 'memory_limit' ) );
$memory = max( $memory, $system_memory );
}
if ( $memory < 67108864 ) {
//echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: %s', 'search-filter-pro' ), size_format( $memory ), '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'search-filter-pro' ) . '</a>' ) . '</mark>';
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB.', 'search-filter-pro' ), size_format( $memory ) ) . '</mark>';
} else {
echo '<mark class="yes">' . size_format( $memory ) . '</mark>';
}
?></td>
</tr>
<tr>
<td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'Displays whether or not WordPress is in Debug Mode.', 'search-filter-pro' ) ); ?></td>
<td><?php if ( defined('WP_DEBUG') && WP_DEBUG ) echo '<mark class="yes">&#10004;</mark>'; else echo '<mark class="no">&ndash;</mark>'; ?></td>
</tr>
<tr>
<td data-export-label="Language"><?php _e( 'Language', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The current language used by WordPress. Default = English', 'search-filter-pro' ) ); ?></td>
<td><?php echo get_locale() ?></td>
</tr>
</tbody>
</table>
<table class="widefat" cellspacing="0">
<thead>
<tr>
<th colspan="3" data-export-label="Server Environment"><?php _e( 'Server Environment', 'search-filter-pro' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td data-export-label="Server Info"><?php _e( 'Server Info', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'Information about the web server that is currently hosting your site.', 'search-filter-pro' ) ); ?></td>
<td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td>
</tr>
<tr>
<td data-export-label="PHP Version"><?php _e( 'PHP Version', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The version of PHP installed on your hosting server.', 'search-filter-pro' ) ); ?></td>
<td><?php
// Check if phpversion function exists.
if ( function_exists( 'phpversion' ) ) {
$php_version = phpversion();
//if ( version_compare( $php_version, '5.4', '<' ) ) {
// echo '<mark class="error">' . sprintf( __( '%s - We recommend a minimum PHP version of 5.4. See: %s', 'search-filter-pro' ), esc_html( $php_version ), '<a href="#" target="_blank">' . __( 'How to update your PHP version', 'search-filter-pro' ) . '</a>' ) . '</mark>';
//} else {
//echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>';
echo '' . esc_html( $php_version ) . '';
//}
} else {
_e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'search-filter-pro' );
}
?></td>
</tr>
<?php if ( function_exists( 'ini_get' ) ) : ?>
<tr>
<td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The largest filesize that can be contained in one post.', 'search-filter-pro' ) ); ?></td>
<td><?php echo size_format( $this->sf_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td>
</tr>
<tr>
<td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups)', 'search-filter-pro' ) ); ?></td>
<td><?php echo ini_get( 'max_execution_time' ); ?></td>
</tr>
<tr>
<td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'search-filter-pro' ) ); ?></td>
<td><?php echo ini_get( 'max_input_vars' ); ?></td>
</tr>
<tr>
<td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'search-filter-pro' ) ); ?></td>
<td><?php echo extension_loaded( 'suhosin' ) ? '&#10004;' : '&ndash;'; ?></td>
</tr>
<?php endif; ?>
<tr>
<td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The version of MySQL installed on your hosting server.', 'search-filter-pro' ) ); ?></td>
<td>
<?php
/** @global wpdb $wpdb */
global $wpdb;
echo $wpdb->db_version();
?>
</td>
</tr>
<tr>
<td data-export-label="Max Upload Size"><?php _e( 'Max Upload Size', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'search-filter-pro' ) ); ?></td>
<td><?php echo size_format( wp_max_upload_size() ); ?></td>
</tr>
<?php /*<tr>
<td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The default timezone for your server.', 'search-filter-pro' ) ); ?></td>
<td><?php
$default_timezone = date_default_timezone_get();
if ( 'UTC' !== $default_timezone ) {
echo '<mark class="error">&#10005; ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'search-filter-pro' ), $default_timezone ) . '</mark>';
} else {
echo '<mark class="yes">&#10004;</mark>';
} ?>
</td>
</tr>*/ ?>
<?php
$posting = array();
// fsockopen/cURL.
$posting['fsockopen_curl']['name'] = 'fsockopen/cURL';
$posting['fsockopen_curl']['help'] = ( __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'search-filter-pro' ) );
if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) {
$posting['fsockopen_curl']['success'] = true;
} else {
$posting['fsockopen_curl']['success'] = false;
$posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'search-filter-pro' );
}
// SOAP.
/*$posting['soap_client']['name'] = 'SoapClient';
$posting['soap_client']['help'] = ( __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'search-filter-pro' ) );
if ( class_exists( 'SoapClient' ) ) {
$posting['soap_client']['success'] = true;
} else {
$posting['soap_client']['success'] = false;
$posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'search-filter-pro' ), '<a href="http://php.net/manual/en/class.soapclient.php">SoapClient</a>' );
}*/
// DOMDocument.
/*$posting['dom_document']['name'] = 'DOMDocument';
$posting['dom_document']['help'] = ( __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'search-filter-pro' ) );
if ( class_exists( 'DOMDocument' ) ) {
$posting['dom_document']['success'] = true;
} else {
$posting['dom_document']['success'] = false;
$posting['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'search-filter-pro' ), '<a href="http://php.net/manual/en/class.domdocument.php">DOMDocument</a>' );
}*/
// GZIP.
/*$posting['gzip']['name'] = 'GZip';
$posting['gzip']['help'] = ( __( 'GZip (gzopen) is used to open the GEOIP database from MaxMind.', 'search-filter-pro' ) );
if ( is_callable( 'gzopen' ) ) {
$posting['gzip']['success'] = true;
} else {
$posting['gzip']['success'] = false;
$posting['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind. The API fallback will be used instead for geolocation.', 'search-filter-pro' ), '<a href="http://php.net/manual/en/zlib.installation.php">gzopen</a>' );
}*/
// Multibyte String.
$posting['mbstring']['name'] = 'Multibyte String';
$posting['mbstring']['help'] = ( __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'search-filter-pro' ) );
if ( extension_loaded( 'mbstring' ) ) {
$posting['mbstring']['success'] = true;
} else {
$posting['mbstring']['success'] = false;
$posting['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'search-filter-pro' ), '<a href="http://php.net/manual/en/mbstring.installation.php">mbstring</a>' );
}
// WP Remote Post Check.
/*$posting['wp_remote_post']['name'] = __( 'Remote Post', 'search-filter-pro');
$posting['wp_remote_post']['help'] = ( __( 'PayPal uses this method of communicating when sending back transaction information.', 'search-filter-pro' ) );
$response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array(
'timeout' => 60,
'user-agent' => 'Search_Filter/' . Search_Filter_Admin::VERSION,
'body' => array(
'cmd' => '_notify-validate'
)
) );
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
$posting['wp_remote_post']['success'] = true;
} else {
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'search-filter-pro' );
if ( is_wp_error( $response ) ) {
$posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'search-filter-pro' ), wc_clean( $response->get_error_message() ) );
} else {
$posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'search-filter-pro' ), wc_clean( $response['response']['code'] ) );
}
$posting['wp_remote_post']['success'] = false;
}
// WP Remote Get Check.
$posting['wp_remote_get']['name'] = __( 'Remote Get', 'search-filter-pro');
$posting['wp_remote_get']['help'] = ( __( 'Search & Filter uses this method for building the cache in the background.', 'search-filter-pro' ) );
$response = wp_safe_remote_get( 'searchandfilterurl' . ( is_multisite() ? '1' : '0' ) );
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
$posting['wp_remote_get']['success'] = true;
} else {
$posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The Search & Filter plugin updater won\'t work with your server. Contact your hosting provider.', 'search-filter-pro' );
if ( is_wp_error( $response ) ) {
$posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'search-filter-pro' ), wc_clean( $response->get_error_message() ) );
} else {
$posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'search-filter-pro' ), wc_clean( $response['response']['code'] ) );
}
$posting['wp_remote_get']['success'] = false;
}
$posting = apply_filters( 'woocommerce_debug_posting', $posting );
*/
foreach ( $posting as $post ) {
$mark = ! empty( $post['success'] ) ? 'yes' : 'error';
?>
<tr>
<td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td>
<td class="help"><?php echo isset( $post['help'] ) ? $post['help'] : ''; ?></td>
<td>
<mark class="<?php echo $mark; ?>">
<?php echo ! empty( $post['success'] ) ? '&#10004' : '&#10005'; ?> <?php echo ! empty( $post['note'] ) ? wp_kses_data( $post['note'] ) : ''; ?>
</mark>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<table class="widefat" cellspacing="0" id="status">
<thead>
<tr>
<th colspan="3" data-export-label="WordPress Environment"><?php _e( 'Database', 'search-filter-pro' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td data-export-label="Home URL"><?php echo sprintf( _x( 'Table `%s` Exists', 'search-filter-pro' ), $this->cache_table_name); ?>:</td>
<td class="help"><?php echo ( __( 'The URL of your site\'s homepage.', 'search-filter-pro' ) ); ?></td>
<td><?php
if($wpdb->get_var("SHOW TABLES LIKE '$this->cache_table_name'") != $this->cache_table_name) {
//table is not created. you may create the table here.
$table_error = true;
echo '<mark class="error">' . __('Table Not Found', 'search-filter-pro') . '</mark>';
}
else
{//table exists, grab number of rows
$row_count = $wpdb->get_results(
"
SELECT COUNT(*) FROM $this->cache_table_name
"
);
$number_of_rows = $row_count[0]->{"COUNT(*)"};
echo '<mark class="yes">&#10004; ' . $number_of_rows . " " . __('Rows Found', 'search-filter-pro') . '</mark>';
}
?></td>
</tr>
<tr>
<td data-export-label="Home URL"><?php echo sprintf( _x( 'Table `%s` Exists', 'search-filter-pro' ), $this->term_results_table_name); ?>:</td>
<td class="help"><?php echo ( __( 'The URL of your site\'s homepage.', 'search-filter-pro' ) ); ?></td>
<td><?php
if($wpdb->get_var("SHOW TABLES LIKE '$this->term_results_table_name'") != $this->term_results_table_name) {
//table is not created. you may create the table here.
$table_error = true;
echo '<mark class="error">' . __('Table Not Found', 'search-filter-pro') . '</mark>';
}
else
{//table exists, grab number of rows
$row_count = $wpdb->get_results(
"
SELECT COUNT(*) FROM $this->term_results_table_name
"
);
$number_of_rows = $row_count[0]->{"COUNT(*)"};
echo '<mark class="yes">&#10004; ' . esc_attr( $number_of_rows ) . " " . __('Rows Found', 'search-filter-pro') . '</mark>';
}
?></td>
</tr>
<tr>
<td data-export-label="Home URL"><?php _e( 'Total Number of Fields Cached', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The URL of your site\'s homepage.', 'search-filter-pro' ) ); ?></td>
<td>
<?php
$field_results = $wpdb->get_results(
"
SELECT field_name, field_value, result_ids
FROM $this->term_results_table_name
GROUP BY field_name
"
);
$number_of_fields = count($field_results);
if($number_of_fields==0)
{
echo '<mark class="error">' . esc_html( $number_of_fields ) . '</mark>';
}
else
{
echo '<mark class="yes">' . esc_html( $number_of_fields ) . '</mark>';
}
?>
</td>
</tr>
<tr>
<td data-export-label="Fields in Cache"><?php _e( 'Fields in Cache', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The URL of your site\'s homepage.', 'search-filter-pro' ) ); ?></td>
<td>
<?php
$fields_in_cache = array();
foreach($field_results as $field_result)
{
array_push($fields_in_cache, $field_result->field_name);
}
echo implode(", " , $fields_in_cache);
?>
</td>
</tr>
</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0">
<thead>
<tr>
<th colspan="3" data-export-label="Active Plugins (<?php echo count( (array) get_option( 'active_plugins' ) ); ?>)"><?php _e( 'Active Plugins', 'search-filter-pro' ); ?> (<?php echo count( (array) get_option( 'active_plugins' ) ); ?>)</th>
</tr>
</thead>
<tbody>
<?php
$active_plugins = (array) get_option( 'active_plugins', array() );
if ( is_multisite() ) {
$network_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
$active_plugins = array_merge( $active_plugins, $network_activated_plugins );
}
foreach ( $active_plugins as $plugin ) {
$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$dirname = dirname( $plugin );
$version_string = '';
$network_string = '';
if ( ! empty( $plugin_data['Name'] ) ) {
// Link the plugin name to the plugin url if available.
$plugin_name = esc_html( $plugin_data['Name'] );
if ( ! empty( $plugin_data['PluginURI'] ) ) {
$plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'search-filter-pro' ) . '" target="_blank">' . $plugin_name . '</a>';
}
?>
<tr>
<td><?php echo $plugin_name; ?></td>
<td class="help">&nbsp;</td>
<td><?php echo sprintf( _x( 'by %s', 'by author', 'search-filter-pro' ), $plugin_data['Author'] ) . ' &ndash; ' . esc_html( $plugin_data['Version'] ) . $version_string . $network_string; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0">
<thead>
<tr>
<th colspan="3" data-export-label="Theme"><?php _e( 'Theme', 'search-filter-pro' ); ?></th>
</tr>
</thead>
<?php
include_once( ABSPATH . 'wp-admin/includes/theme-install.php' );
$active_theme = wp_get_theme();
$theme_version = $active_theme->Version;
//$update_theme_version = WC_Admin_Status::get_latest_theme_version( $active_theme );
?>
<tbody>
<tr>
<td data-export-label="Name"><?php _e( 'Name', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The name of the current active theme.', 'search-filter-pro' ) ); ?></td>
<td><?php echo esc_html( $active_theme->Name ); ?></td>
</tr>
<tr>
<td data-export-label="Version"><?php _e( 'Version', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The installed version of the current active theme.', 'search-filter-pro' ) ); ?></td>
<td><?php
echo esc_html( $theme_version );
/*if ( version_compare( $theme_version, $update_theme_version, '<' ) ) {
echo ' &ndash; <strong style="color:red;">' . sprintf( __( '%s is available', 'search-filter-pro' ), esc_html( $update_theme_version ) ) . '</strong>';
}*/
?></td>
</tr>
<tr>
<td data-export-label="Author URL"><?php _e( 'Author URL', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The theme developers URL.', 'search-filter-pro' ) ); ?></td>
<td><?php echo $active_theme->{'Author URI'}; ?></td>
</tr>
<tr>
<td data-export-label="Child Theme"><?php _e( 'Child Theme', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'Displays whether or not the current theme is a child theme.', 'search-filter-pro' ) ); ?></td>
<td><?php
//echo is_child_theme() ? '<mark class="yes">&#10004;</mark>' : '&#10005; &ndash; ' . sprintf( __( 'If you\'re modifying Search & Filter on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to create a child theme</a>', 'search-filter-pro' ), 'http://codex.wordpress.org/Child_Themes' );
echo is_child_theme() ? '<mark class="yes">&#10004;</mark>' : '&#10005;';
?></td>
</tr>
<?php
if( is_child_theme() ) :
$parent_theme = wp_get_theme( $active_theme->Template );
//$update_theme_version = WC_Admin_Status::get_latest_theme_version( $parent_theme );
?>
<tr>
<td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The name of the parent theme.', 'search-filter-pro' ) ); ?></td>
<td><?php echo esc_html( $parent_theme->Name ); ?></td>
</tr>
<tr>
<td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The installed version of the parent theme.', 'search-filter-pro' ) ); ?></td>
<td><?php
echo esc_html( $parent_theme->Version );
/*if ( version_compare( $parent_theme->Version, $update_theme_version, '<' ) ) {
echo ' &ndash; <strong style="color:red;">' . sprintf( __( '%s is available', 'search-filter-pro' ), esc_html( $update_theme_version ) ) . '</strong>';
}*/
?></td>
</tr>
<tr>
<td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The parent theme developers URL.', 'search-filter-pro' ) ); ?></td>
<td><?php echo $parent_theme->{'Author URI'}; ?></td>
</tr>
<?php endif ?>
</tbody>
</table>
<?php
}
else if ( $current_tab == "search-forms")
{
$search_form_query = new WP_Query('post_type=search-filter-widget&post_status=publish,draft&posts_per_page=-1&suppress_filters=1');
$search_forms = $search_form_query->get_posts();
foreach($search_forms as $search_form)
{
?>
<table class="widefat" cellspacing="0">
<thead>
<tr>
<th colspan="3" data-export-label="<?php echo esc_attr($search_form->post_title); ?>"><a href="<?php echo admin_url( 'post.php?post='.$search_form->ID.'&action=edit' ); ?>" target="_blank"><?php echo $search_form->post_title; ?> - <?php echo $search_form->ID; ?></a></th>
</tr>
</thead>
<tbody>
<tr>
<td data-export-label="Fields"><?php _e( 'Fields', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The list of fields in your search form.', 'search-filter-pro' ) ); ?></td>
<td>
<?php
//as we only want to update "enabled", then load all settings and update only this key
$search_form_fields = Search_Filter_Helper::get_fields_meta($search_form->ID);
if ( is_array( $search_form_fields ) ) {
$filters = array();
foreach($search_form_fields as $key => $field)
{
$valid_filter_types = array("tag", "category", "taxonomy", "post_meta");
if(in_array($field['type'], $valid_filter_types))
{
if(($field['type']=="tag")||($field['type']=="category")||($field['type']=="taxonomy"))
{
array_push($filters, "_sft_".$field['taxonomy_name']);
}
else if($field['type']=="post_meta")
{
if($field['meta_type']=="choice")
{
array_push($filters, "_sfm_".$field['meta_key']);
}
}
}
else
{
array_push($filters, $field['type']);
}
}
echo implode(", " , $filters);
}
?>
</td>
</tr>
<tr>
<td data-export-label="Display Results Method"><?php _e( 'Display Results Method', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'The method your search form uses to display results.', 'search-filter-pro' ) ); ?></td>
<td>
<?php
//as we only want to update "enabled", then load all settings and update only this key
$search_form_settings = Search_Filter_Helper::get_settings_meta($search_form->ID);
if(is_array($search_form_settings))
{
$display_results_as = "";
$results_label = "";
if(isset($search_form_settings['display_results_as']))
{
$display_results_as = $search_form_settings['display_results_as'];
}
if($display_results_as=="archive")
{
$results_label = __("As an Archive", $this->plugin_slug);
}
else if($display_results_as=="post_type_archive")
{
$post_type = "";
if(isset($search_form_settings['post_types']))
{
if(count($search_form_settings['post_types'])==1)
{
$post_types = array_keys($search_form_settings['post_types']);
$post_type_object = get_post_type_object( $post_types[0] );
if(isset($post_type_object->label))
{
$post_type = $post_type_object->label;
}
}
}
$results_label = sprintf(__("Post Type Archive: <strong>%s</strong>", $this->plugin_slug), $post_type);
}
else if($display_results_as=="shortcode")
{
$results_label = __("Using a Shortcode", $this->plugin_slug);
}
else if($display_results_as=="custom")
{
$results_label = __("Custom", $this->plugin_slug);
}
else if($display_results_as=="custom_woocommerce_store")
{
$results_label = __("WooCommerce Shop", $this->plugin_slug);
}
else if($display_results_as=="custom_edd_store")
{
$results_label = __("EDD Downloads Shortcode", $this->plugin_slug);
}
echo $results_label;
}
?>
</td>
</tr>
<tr>
<td data-export-label="Potential Issues"><?php _e( 'Potential Issues', 'search-filter-pro' ); ?>:</td>
<td class="help"><?php echo ( __( 'A list of potential issues', 'search-filter-pro' ) ); ?></td>
<td><?php
$this->admin_notices->set_post_notices($search_form->ID);
$post_notice_log = $this->admin_notices->get_post_notices();
$this->admin_notices->clear_post_notices();
$error_count = count($post_notice_log);
$error_messages = array();
if($error_count>0)
{
foreach($post_notice_log as $post_message)
{
$message_level = __("Error: ", $this->plugin_slug);
if($post_message['type']=="sf-notice")
{
$message_level = __("Notice:", $this->plugin_slug);
}
array_push($error_messages, '<mark class="error"><!-- &#10005; -->'.$message_level.$post_message['message'].'</mark>');
}
//echo '<mark class="yes">&#10004; ' . __('None Reported', 'search-filter-pro') . '</mark>';
echo implode("<br />", $error_messages);
}
else
{
echo '<mark class="yes">&#10004; ' . __('None Reported', 'search-filter-pro') . '</mark>';
}
?></td>
</tr>
</tbody>
</table>
<?php
}
?>
<?php
}
?>
</div>

View File

@@ -0,0 +1,190 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<div class="widgets-holder-wrap">
<div id="available-fields" class="widgets-search-filter-draggables ui-search-filter-sortable" data-allow-expand="0">
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br></div>
<h3>Available Fields <span class="spinner"></span></h3>
</div>
<div class="sidebar-description"><p class="description">Drag any of these Available Fields in to the Search Form UI to start building your Search Form.</p></div>
<!--<div class="widget-placeholder"></div>-->
<div class="widget">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-action hide-if-no-js" href="#available-widgets"></a>
<a class="widget-control-edit hide-if-js" href="/wpsearchandfilter/wp-admin/widgets.php?editwidget=search-2&amp;sidebar=sidebar-1&amp;key=0">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Search</span>
</a>
</div>
<div class="widget-title"><h4>Search<span class="in-widget-title"></span></h4></div>
</div>
<div class="widget-inside">
<form action="" method="post">
<div class="widget-content">
<p><label for="widget-search-2-title">Title: <input class="widefat" id="widget-search-2-title" name="widget-search[2][title]" type="text" value=""></label></p>
<p><label for="widget-recent-posts-2-number">Number of posts to show:</label>
<input id="widget-recent-posts-2-number" name="widget-recent-posts[2][number]" type="text" value="5" size="3"></p>
<p><input class="checkbox" type="checkbox" id="widget-recent-posts-2-show_date" name="widget-recent-posts[2][show_date]">
<label for="widget-recent-posts-2-show_date">Display post date?</label></p>
</div>
<input type="hidden" name="widget-id" class="widget-id" value="search-2">
<input type="hidden" name="id_base" class="id_base" value="search">
<input type="hidden" name="widget-width" class="widget-width" value="250">
<input type="hidden" name="widget-height" class="widget-height" value="200">
<input type="hidden" name="widget_number" class="widget_number" value="2">
<input type="hidden" name="multi_number" class="multi_number" value="">
<input type="hidden" name="add_new" class="add_new" value="">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove">Delete</a> |
<a class="widget-control-close" href="#close">Close</a>
</div>
<div class="alignright">
<input type="submit" name="savewidget" id="widget-search-2-savewidget" class="button button-primary widget-control-save right" value="Save"> <span class="spinner"></span>
</div>
<br class="clear">
</div>
</form>
</div>
<div class="widget-description">
A search form for your site.
</div>
</div>
<div class="widget">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-action hide-if-no-js" href="#available-widgets"></a>
<a class="widget-control-edit hide-if-js" href="/wpsearchandfilter/wp-admin/widgets.php?editwidget=search-2&amp;sidebar=sidebar-1&amp;key=0">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Search</span>
</a>
</div>
<div class="widget-title"><h4>Taxonomy<span class="in-widget-title"></span></h4></div>
</div>
<div class="widget-inside">
<form action="" method="post">
<div class="widget-content">
<p><label for="widget-search-2-title">Title: <input class="widefat" id="widget-search-2-title" name="widget-search[2][title]" type="text" value=""></label></p>
<p><label for="widget-recent-posts-2-number">Number of posts to show:</label>
<input id="widget-recent-posts-2-number" name="widget-recent-posts[2][number]" type="text" value="5" size="3"></p>
<p><input class="checkbox" type="checkbox" id="widget-recent-posts-2-show_date" name="widget-recent-posts[2][show_date]">
<label for="widget-recent-posts-2-show_date">Display post date?</label></p>
</div>
<input type="hidden" name="widget-id" class="widget-id" value="search-2">
<input type="hidden" name="id_base" class="id_base" value="search">
<input type="hidden" name="widget-width" class="widget-width" value="250">
<input type="hidden" name="widget-height" class="widget-height" value="200">
<input type="hidden" name="widget_number" class="widget_number" value="2">
<input type="hidden" name="multi_number" class="multi_number" value="">
<input type="hidden" name="add_new" class="add_new" value="">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove">Delete</a> |
<a class="widget-control-close" href="#close">Close</a>
</div>
<div class="alignright">
<input type="submit" name="savewidget" id="widget-search-2-savewidget" class="button button-primary widget-control-save right" value="Save"> <span class="spinner"></span>
</div>
<br class="clear">
</div>
</form>
</div>
<div class="widget-description">
A search form for your site.
</div>
</div>
<div class="widget">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-action hide-if-no-js" href="#available-widgets"></a>
<a class="widget-control-edit hide-if-js" href="/wpsearchandfilter/wp-admin/widgets.php?editwidget=search-2&amp;sidebar=sidebar-1&amp;key=0">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Search</span>
</a>
</div>
<div class="widget-title"><h4>Meta<span class="in-widget-title"></span></h4></div>
</div>
<div class="widget-inside">
<form action="" method="post">
<div class="widget-content">
<p><label for="widget-search-2-title">Title: <input class="widefat" id="widget-search-2-title" name="widget-search[2][title]" type="text" value=""></label></p>
<p><label for="widget-recent-posts-2-number">Number of posts to show:</label>
<input id="widget-recent-posts-2-number" name="widget-recent-posts[2][number]" type="text" value="5" size="3"></p>
<p><input class="checkbox" type="checkbox" id="widget-recent-posts-2-show_date" name="widget-recent-posts[2][show_date]">
<label for="widget-recent-posts-2-show_date">Display post date?</label></p>
</div>
<input type="hidden" name="widget-id" class="widget-id" value="search-2">
<input type="hidden" name="id_base" class="id_base" value="search">
<input type="hidden" name="widget-width" class="widget-width" value="250">
<input type="hidden" name="widget-height" class="widget-height" value="200">
<input type="hidden" name="widget_number" class="widget_number" value="2">
<input type="hidden" name="multi_number" class="multi_number" value="">
<input type="hidden" name="add_new" class="add_new" value="">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove">Delete</a> |
<a class="widget-control-close" href="#close">Close</a>
</div>
<div class="alignright">
<input type="submit" name="savewidget" id="widget-search-2-savewidget" class="button button-primary widget-control-save right" value="Save"> <span class="spinner"></span>
</div>
<br class="clear">
</div>
</form>
</div>
<div class="widget-description">
A search form for your site.
</div>
</div>
</div>
</div>
<div class="widgets-holder-wrap">
<div id="sidebar-1" class="widgets-search-filter-sortables ui-search-filter-sortable">
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br></div>
<h3>Search Form UI <span class="spinner"></span></h3>
</div>
<div class="sidebar-description"><p class="description">Build your Search Form here.</p></div>
</div>
</div>
</div>

View File

@@ -0,0 +1,71 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="available-fields" class="widgets-search-filter-draggables ui-search-filter-sortable" data-allow-expand="0">
<p class="description">Drag any of these Available Fields in to the <strong>Search Form UI</strong> to start building your Search Form.</p>
<div class="widget woocommerce-field">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-action hide-if-no-js" href="#"></a>
</div>
<div class="widget-title-action-move">
<a class="widget-action hide-if-no-js" href="#"></a>
</div>
<div class="widget-title"><h4>Product Attribute<span class="in-widget-title"></span></h4></div>
</div>
<div class="widget-inside">
<form action="" method="post">
<div class="widget-content">
<p><label for="widget-search-2-title">Title: <input class="widefat" id="widget-search-2-title" name="widget-search[2][title]" type="text" value=""></label></p>
<p><label for="widget-recent-posts-2-number">Number of posts to show:</label>
<input id="widget-recent-posts-2-number" name="widget-recent-posts[2][number]" type="text" value="5" size="3"></p>
<p><input class="checkbox" type="checkbox" id="widget-recent-posts-2-show_date" name="widget-recent-posts[2][show_date]">
<label for="widget-recent-posts-2-show_date">Display post date?</label></p>
</div>
<input type="hidden" name="widget-id" class="widget-id" value="search-2">
<input type="hidden" name="id_base" class="id_base" value="search">
<input type="hidden" name="widget-width" class="widget-width" value="250">
<input type="hidden" name="widget-height" class="widget-height" value="200">
<input type="hidden" name="widget_number" class="widget_number" value="2">
<input type="hidden" name="multi_number" class="multi_number" value="">
<input type="hidden" name="add_new" class="add_new" value="">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove">Delete</a> |
<a class="widget-control-close" href="#close">Close</a>
</div>
<div class="alignright">
<input type="submit" name="savewidget" id="widget-search-2-savewidget" class="button button-primary widget-control-save right" value="Save"> <span class="spinner"></span>
</div>
<br class="clear">
</div>
</form>
</div>
<div class="widget-description">
A search form for your site.
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<!-- @TODO: Provide markup for your options page here. -->
</div>

View File

@@ -0,0 +1,149 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="<?php echo $values['type']; ?>">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Author Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Author", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content" style="position:relative;">
<a class="widget-control-advanced" href="#remove"><?php _e("Advanced settings", $this->plugin_slug); ?></a>
<fieldset class="item-container">
<p class="sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<option value="select"<?php $this->set_selected($values['input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="checkbox"<?php $this->set_selected($values['input_type'], "checkbox"); ?>><?php _e("Checkbox", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
<option value="multiselect"<?php $this->set_selected($values['input_type'], "multiselect"); ?>><?php _e("Multi-select", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p>
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_all_items_label">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;All Authors&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label]" data-field-template-name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
<!--<p class="sf_operator">
<label for="{0}[{1}][operator]"><?php _e("Search Operator", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("AND - posts must be in each category, OR - posts must be in any category", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select data-field-template-name="{0}[{1}][operator]" data-field-template-id="{0}[{1}][operator]">
<option value="and"<?php $this->set_selected($values['operator'], "and"); ?>><?php _e("AND", $this->plugin_slug); ?></option>
<option value="or"<?php $this->set_selected($values['operator'], "or"); ?>><?php _e("OR", $this->plugin_slug); ?></option>
</select>
</label>
</p>-->
</fieldset>
<fieldset class="item-container">
<br />
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][optioncount]" data-field-template-name="{0}[{1}][optioncount]"<?php $this->set_checked($values['optioncount']); ?>>
<label for="{0}[{1}][optioncount]"><?php _e("Display count?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("display the number of posts for each author", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][hide_empty]" data-field-template-name="{0}[{1}][hide_empty]"<?php $this->set_checked($values['hide_empty']); ?>>
<label for="{0}[{1}][hide_empty]"><?php _e("Hide empty authors?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("hide authors with no posts", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_exclude_admin">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][exclude_admin]" data-field-template-name="{0}[{1}][exclude_admin]"<?php $this->set_checked($values['exclude_admin']); ?>>
<label for="{0}[{1}][exclude_admin]"><?php _e("Exclude Admin?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("exclude authors that are also admins", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_show_fullname">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][show_fullname]" data-field-template-name="{0}[{1}][show_fullname]"<?php $this->set_checked($values['show_fullname']); ?>>
<label for="{0}[{1}][show_fullname]"><?php _e("Show Full Name?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("use the authors full name instead of their display name", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_make_combobox" style="vertical-align: top;">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][combo_box]" data-field-template-name="{0}[{1}][combo_box]"<?php $this->set_checked($values['combo_box']); ?> style="vertical-align: top;margin-top:2px;">
<label for="{0}[{1}][combo_box]" style="display:inline-block;">
<?php _e("Make Combobox?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Allow for text input to find values, with autocomplete and dropdown suggest", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
<br />
<span class="sf_combobox_message" style="padding-top:10px; display:inline-block;">
<input class="" data-field-template-id="{0}[{1}][no_results_message]" data-field-template-name="{0}[{1}][no_results_message]" type="text" value="<?php echo esc_attr($values['no_results_message']); ?>">
<br /><em><?php _e("No Matches message", $this->plugin_slug); ?></em>
<span class="hint--top hint--info" data-hint="<?php _e("This message is usually displayed when there are no matches in the list - leave blank for default", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</span>
</label>
</p>
</fieldset>
<div class="clear"></div>
<fieldset class="advanced-settings">
<hr />
<p class="item-container">
<label for="{0}[{1}][order_by]"><?php _e("Order authors by: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][order_by]" data-field-template-id="{0}[{1}][order_by]">
<option value="default"<?php $this->set_selected($values['order_by'], "default"); ?>><?php _e("Default", $this->plugin_slug); ?></option>
<option value="id"<?php $this->set_selected($values['order_by'], "id"); ?>><?php _e("ID", $this->plugin_slug); ?></option>
<option value="name"<?php $this->set_selected($values['order_by'], "name"); ?>><?php _e("Name", $this->plugin_slug); ?></option>
<option value="email"<?php $this->set_selected($values['order_by'], "email"); ?>><?php _e("User Email", $this->plugin_slug); ?></option>
<option value="url"<?php $this->set_selected($values['order_by'], "url"); ?>><?php _e("User URL", $this->plugin_slug); ?></option>
<option value="registered"<?php $this->set_selected($values['order_by'], "registered"); ?>><?php _e("Registered Date", $this->plugin_slug); ?></option>
<option value="user_login"<?php $this->set_selected($values['order_by'], "user_login"); ?>><?php _e("User Login", $this->plugin_slug); ?></option>
<option value="post_count"<?php $this->set_selected($values['order_by'], "post_count"); ?>><?php _e("Post Count", $this->plugin_slug); ?></option>
</select>
<select data-field-template-name="{0}[{1}][order_dir]" data-field-template-id="{0}[{1}][order_dir]">
<option value="asc"<?php $this->set_selected($values['order_dir'], "asc"); ?>><?php _e("ASC", $this->plugin_slug); ?></option>
<option value="desc"<?php $this->set_selected($values['order_dir'], "desc"); ?>><?php _e("DESC", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container">
<label for="{0}[{1}][exclude]"><?php _e("Exclude IDs (only WP 3.9 and above)", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("comma separated list of author IDs to exclude", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][exclude]" data-field-template-name="{0}[{1}][exclude]" type="text" value="<?php echo $values['exclude']; ?>"></label>
</p>
</fieldset>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" data-field-template-id="hidden_type" value="<?php echo $values['type']; ?>">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add an Author Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,162 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="category">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Category Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Category", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<!--<form action="" method="post">-->
<div class="widget-content" style="position:relative;">
<a class="widget-control-advanced" href="#remove"><?php _e("Advanced settings", $this->plugin_slug); ?></a>
<fieldset class="item-container">
<input type="hidden" name="{0}[{1}][taxonomy_name]" class="" id="{0}[{1}][taxonomy_name]" value="category" />
<p class="sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select name="{0}[{1}][input_type]" class="" id="{0}[{1}][input_type]">
<!--<option value="list"<?php $this->set_selected($values['input_type'], "list"); ?>><?php _e("List", $this->plugin_slug); ?></option>-->
<option value="select"<?php $this->set_selected($values['input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="checkbox"<?php $this->set_selected($values['input_type'], "checkbox"); ?>><?php _e("Checkbox", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
<option value="multiselect"<?php $this->set_selected($values['input_type'], "multiselect"); ?>><?php _e("Multi-select", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p>
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" id="{0}[{1}][heading]" name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_all_items_label">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;All Categories&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" id="{0}[{1}][all_items_label]" name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" id="{0}[{1}][accessibility_label]" name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
<p class="sf_operator">
<label for="{0}[{1}][operator]"><?php _e("Search Operator", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("AND - posts must be in each category, OR - posts must be in any category", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select name="{0}[{1}][operator]" id="{0}[{1}][operator]">
<option value="and"<?php $this->set_selected($values['operator'], "and"); ?>><?php _e("AND", $this->plugin_slug); ?></option>
<option value="or"<?php $this->set_selected($values['operator'], "or"); ?>><?php _e("OR", $this->plugin_slug); ?></option>
</select>
</label>
</p>
</fieldset>
<fieldset class="item-container">
<br />
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][show_count]" data-field-template-name="{0}[{1}][show_count]"<?php $this->set_checked($values['show_count']); ?>>
<label for="{0}[{1}][show_count]"><?php _e("Display count?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("display the number of posts in each category", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][hide_empty]" data-field-template-name="{0}[{1}][hide_empty]"<?php $this->set_checked($values['hide_empty']); ?>>
<label for="{0}[{1}][hide_empty]"><?php _e("Hide empty terms?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("hide categories with no posts/items", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][hierarchical]" data-field-template-name="{0}[{1}][hierarchical]"<?php $this->set_checked($values['hierarchical']); ?>>
<label for="{0}[{1}][hierarchical]"><?php _e("Hierarchical?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("show child categories underneath their parents", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_include_children">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][include_children]" data-field-template-name="{0}[{1}][include_children]"<?php $this->set_checked($values['include_children']); ?>>
<label for="{0}[{1}][include_children]"><?php _e("Include Children in Parents?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("results in child categories will also be returned when a user searches its parent", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_make_combobox" style="vertical-align: top;">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][combo_box]" data-field-template-name="{0}[{1}][combo_box]"<?php $this->set_checked($values['combo_box']); ?> style="vertical-align: top;margin-top:2px;">
<label for="{0}[{1}][combo_box]" style="display:inline-block;">
<?php _e("Make Combobox?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Allow for text input to find values, with autocomplete and dropdown suggest", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
<br />
<span class="sf_combobox_message" style="padding-top:10px; display:inline-block;">
<input class="" data-field-template-id="{0}[{1}][no_results_message]" data-field-template-name="{0}[{1}][no_results_message]" type="text" value="<?php echo esc_attr($values['no_results_message']); ?>">
<br /><em><?php _e("No Matches message", $this->plugin_slug); ?></em>
<span class="hint--top hint--info" data-hint="<?php _e("This message is usually displayed when there are no matches in the list - leave blank for default", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</span>
</label>
</p>
<!--<p class="sf_drill_down">
<input class="checkbox" type="checkbox" id="{0}[{1}][drill_down]" name="{0}[{1}][drill_down]"<?php $this->set_checked($values['drill_down']); ?>>
<label for="{0}[{1}][drill_down]"><?php _e("Make drill down?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("child categories will only be revealed once a parent has been selected", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>-->
</fieldset>
<div class="clear"></div>
<fieldset class="advanced-settings">
<hr />
<p class="item-container">
<label for="{0}[{1}][order_by]"><?php _e("Order terms by: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][order_by]" data-field-template-id="{0}[{1}][order_by]">
<option value="default"<?php $this->set_selected($values['order_by'], "default"); ?>><?php _e("Default", $this->plugin_slug); ?></option>
<option value="id"<?php $this->set_selected($values['order_by'], "id"); ?>><?php _e("ID", $this->plugin_slug); ?></option>
<option value="name"<?php $this->set_selected($values['order_by'], "name"); ?>><?php _e("Name", $this->plugin_slug); ?></option>
<option value="slug"<?php $this->set_selected($values['order_by'], "slug"); ?>><?php _e("Slug", $this->plugin_slug); ?></option>
<option value="count"<?php $this->set_selected($values['order_by'], "count"); ?>><?php _e("Count", $this->plugin_slug); ?></option>
<option value="term_group"<?php $this->set_selected($values['order_by'], "term_group"); ?>><?php _e("Term Group", $this->plugin_slug); ?></option>
</select>
<select data-field-template-name="{0}[{1}][order_dir]" data-field-template-id="{0}[{1}][order_dir]">
<option value="asc"<?php $this->set_selected($values['order_dir'], "asc"); ?>><?php _e("ASC", $this->plugin_slug); ?></option>
<option value="desc"<?php $this->set_selected($values['order_dir'], "desc"); ?>><?php _e("DESC", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container">
<label for="{0}[{1}][exclude_ids]"><?php _e("Exclude IDs", $this->plugin_slug); ?>
<span class="hint--top hint--info" data-hint="<?php _e("comma separated list of category IDs to exclude", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="exclude_ids settings_exclude_ids" data-field-template-id="{0}[{1}][exclude_ids]" data-field-template-name="{0}[{1}][exclude_ids]" type="text" value="<?php echo esc_attr($values['exclude_ids']); ?>">
<input class="exclude_ids_hidden" data-field-template-id="{0}[{1}][exclude_ids_hidden]" data-field-template-name="{0}[{1}][exclude_ids]" type="hidden" value="<?php echo esc_attr($values['exclude_ids']); ?>" disabled="disabled">
</label>
<?php
$tax_obj = get_taxonomy('category');
?>
<a href="#" class="dashicons-search search-tax-button button-secondary sfmodal" data-taxonomy-name="<?php echo esc_attr($tax_obj->name); ?>" data-taxonomy-label="<?php echo esc_attr($tax_obj->label); ?>"></a>
<br />
<input class="checkbox sync_include_exclude" type="checkbox" data-field-template-id="{0}[{1}][sync_include_exclude]" data-field-template-name="{0}[{1}][sync_include_exclude]"<?php $this->set_checked($values['sync_include_exclude']); ?>>
<label for="{0}[{1}][sync_include_exclude]"><?php _e("Sync with Settings?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("This will show / hide categories for this field based upon the settings from the &quot;Settings &amp; Defaults&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
</fieldset>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="category">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
<!--</form>-->
</div>
<div class="widget-description">
<?php _e("Add a Category Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,33 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<li class='meta-option-item<?php echo $class; ?>'>
<fieldset>
<p class='item-container slimmove' style="width:20px">
<img src="<?php echo plugins_url( 'admin/assets/img/move-ico.svg', SEARCH_FILTER_PRO_BASE_PATH); ?>" />
</p>
<p class='item-container slim'>
<label for="{0}[{1}][meta_options][{2}][option_value]">
<span><?php _e("Option Value", $this->plugin_slug); ?><br /></span>
<input type='text' name='{0}[{1}][meta_options][{2}][option_value]' data-field-template-id='{0}[{1}][meta_options][{2}][option_value]' value='<?php echo esc_attr($values['option_value']); ?>' />
</label>
</p>
<p class='item-container slim'>
<label for="{0}[{1}][meta_options][{2}][option_label]">
<span><?php _e("Option Label", $this->plugin_slug); ?><br /></span>
<input type='text' name='{0}[{1}][meta_options][{2}][option_label]' data-field-template-id='{0}[{1}][meta_options][{2}][option_label]' value='<?php echo esc_attr($values['option_label']); ?>' />
</label>
</p>
<div class="clear"></div>
</fieldset>
<div class="clear"></div>
<p class="meta-option-controls">
<a href="#" class="widget-control-option-remove"><?php _e("Remove", $this->plugin_slug); ?></a>
</p>
<div class="clear"></div>
</li>

View File

@@ -0,0 +1,150 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="<?php echo esc_attr($values['type']); ?>">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Post Date Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Post Date", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content" style="position:relative;">
<fieldset class="item-container">
<p class="sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<option value="date"<?php $this->set_selected($values['input_type'], "date"); ?>><?php _e("Date", $this->plugin_slug); ?></option>
<option value="daterange"<?php $this->set_selected($values['input_type'], "daterange"); ?>><?php _e("Date Range", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p>
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
</fieldset>
<fieldset class="item-container">
<p>
<?php _e("Date Format", $this->plugin_slug); ?>
</p>
<p>
<?php
$format = array();
$format[0] = "d/m/Y";
$format[1] = "m/d/Y";
$format[2] = "Y/m/d";
$formati = 0;
foreach($format as $aformat)
{
if($values['date_format'] == $aformat)
{
echo '<input type="hidden" disabled="disabled" class="date_format_hidden" value="'.$formati.'" data-field-template-id="{0}[{1}][date_format_hidden]" data-field-template-name="{0}[{1}][date_format_hidden]" />';
}
$formati++;
}
?>
<label for="{0}[{1}][date_format][0]"><input class="date_format_radio" data-field-template-id="{0}[{1}][date_format][0]" data-field-template-name="{0}[{1}][date_format]" type="radio" value="<?php echo $format[0] ?>"<?php echo $this->set_radio($values['date_format'], $format[0]); ?>><?php echo date($format[0]) ?></label><br />
<label for="{0}[{1}][date_format][1]"><input class="date_format_radio" data-field-template-id="{0}[{1}][date_format][1]" data-field-template-name="{0}[{1}][date_format]" type="radio" value="<?php echo $format[1] ?>"<?php echo $this->set_radio($values['date_format'], $format[1]); ?>><?php echo date($format[1]) ?></label><br />
<label for="{0}[{1}][date_format][2]"><input class="date_format_radio" data-field-template-id="{0}[{1}][date_format][2]" data-field-template-name="{0}[{1}][date_format]" type="radio" value="<?php echo $format[2] ?>"<?php echo $this->set_radio($values['date_format'], $format[2]); ?>><?php echo date($format[2]) ?></label><br />
<!--<label for="{0}[{1}][date_format]"><input class="" id="{0}[{1}][date_format]" name="{0}[{1}][date_format]" type="radio"> Custom: <input type="text" size="10" /></label>-->
</p>
</fieldset>
<div class="clear"></div>
<hr />
<p style="margin-bottom:0;"><strong><?php _e("UI Options", $this->plugin_slug); ?></strong> <span class="hint--top hint--info" data-hint="<?php _e("choose a meta key for this field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></p>
<fieldset class="item-container child-columns">
<p class="sf_range_min">
<label for="{0}[{1}][date_from_prefix]">
<?php _e("From Prefix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear before the From field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_from_prefix]" data-field-template-name="{0}[{1}][date_from_prefix]" type="text" size="7" value="<?php echo $values['date_from_prefix']; ?>">
</label>
</p>
<p class="sf_range_max">
<label for="{0}[{1}][date_from_postfix]">
<?php _e("From Postfix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear after the From field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_from_postfix]" data-field-template-name="{0}[{1}][date_from_postfix]" type="text" size="7" value="<?php echo $values['date_from_postfix']; ?>">
</label>
</p>
<p class="sf_range_step">
<label for="{0}[{1}][date_from_placeholder]">
<?php _e("From Placeholder", $this->plugin_slug); ?><br />
<input class="" data-field-template-id="{0}[{1}][date_from_placeholder]" data-field-template-name="{0}[{1}][date_from_placeholder]" type="text" size="7" value="<?php echo $values['date_from_placeholder']; ?>">
</label>
</p>
</fieldset>
<fieldset class="item-container child-columns sf_date_end_meta_key">
<p class="sf_range_min">
<label for="{0}[{1}][date_to_prefix]">
<?php _e("To Prefix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear before the To field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_to_prefix]" data-field-template-name="{0}[{1}][date_to_prefix]" type="text" size="7" value="<?php echo $values['date_to_prefix']; ?>">
</label>
</p>
<p class="sf_range_max">
<label for="{0}[{1}][date_to_postfix]">
<?php _e("To Postfix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear after the To field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_to_postfix]" data-field-template-name="{0}[{1}][date_to_postfix]" type="text" size="7" value="<?php echo $values['date_to_postfix']; ?>">
</label>
</p>
<p class="sf_range_step">
<label for="{0}[{1}][date_to_placeholder]">
<?php _e("To Placeholder", $this->plugin_slug); ?><br />
<input class="" data-field-template-id="{0}[{1}][date_to_placeholder]" data-field-template-name="{0}[{1}][date_to_placeholder]" type="text" size="7" value="<?php echo $values['date_to_placeholder']; ?>">
</label>
</p>
</fieldset>
<br class="clear" />
<p class="item-container" style="">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][date_use_dropdown_year]" data-field-template-name="{0}[{1}][date_use_dropdown_year]"<?php $this->set_checked($values['date_use_dropdown_year']); ?>>
<label for="{0}[{1}][date_use_dropdown_year]"><?php _e("Use dropdown for Year", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Add dropdown for Year", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label><br />
<input class="checkbox " type="checkbox" data-field-template-id="{0}[{1}][date_use_dropdown_month]" data-field-template-name="{0}[{1}][date_use_dropdown_month]"<?php $this->set_checked($values['date_use_dropdown_month']); ?>>
<label for="{0}[{1}][date_use_dropdown_month]"><?php _e("Use dropdown for month", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Add dropdown for month", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<br class="clear" />
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo esc_attr($values['type']); ?>" />
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add a Post Date Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,72 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="<?php echo $values['type']; ?>">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Post Meta Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Post Meta", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content" style="position:relative;">
<p><?php _e("Choose from displaying the field as numerical data, choice input or date picker.", $this->plugin_slug); ?><br /></p>
<div class="tab-header sf_meta_type">
<label for="{0}[{1}][meta_type][0]" class="active"><input data-radio-checked="<?php echo ($values['meta_type']=="number") ? 1 : 0 ?>" class="meta_type_radio" data-field-template-id="{0}[{1}][meta_type][0]" data-field-template-name="{0}[{1}][meta_type]" type="radio" value="number"<?php $this->set_radio($values['meta_type'], 'number'); ?>><?php _e("Number", $this->plugin_slug); ?></label>
<label for="{0}[{1}][meta_type][1]"><input data-radio-checked="<?php echo ($values['meta_type']=="choice") ? 1 : 0 ?>" class="meta_type_radio" data-field-template-id="{0}[{1}][meta_type][1]" data-field-template-name="{0}[{1}][meta_type]" type="radio" value="choice"<?php $this->set_radio($values['meta_type'], 'choice'); ?>><?php _e("Choice", $this->plugin_slug); ?></label>
<label for="{0}[{1}][meta_type][2]"><input data-radio-checked="<?php echo ($values['meta_type']=="date") ? 1 : 0 ?>" class="meta_type_radio" data-field-template-id="{0}[{1}][meta_type][2]" data-field-template-name="{0}[{1}][meta_type]" type="radio" value="date"<?php $this->set_radio($values['meta_type'], 'date'); ?>><?php _e("Date", $this->plugin_slug); ?></label>
</div>
<br class="clear">
<div class="sf_field_data sf_number" data-number-is-range="">
<?php //echo plugin_dir_path( dirname( __FILE__ ) ) ;
include( ( plugin_dir_path( dirname( __FILE__ ) ) ) . 'fields/post-meta/number.php' ); ?>
</div>
<div class="sf_field_data sf_choice">
<?php include( ( plugin_dir_path( dirname( __FILE__ ) ) ) . 'fields/post-meta/choice.php' ); ?>
</div>
<div class="sf_field_data sf_date">
<?php include( ( plugin_dir_path( dirname( __FILE__ ) ) ) . 'fields/post-meta/date.php' ); ?>
</div>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo esc_attr($values['type']); ?>" />
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add a Post Meta Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,179 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$meta_key_text_input = Search_Filter_Helper::get_option( 'meta_key_text_input' );
?>
<p class="item-container sf_input_type">
<label for="{0}[{1}][choice_input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][choice_input_type]" class="" data-field-template-id="{0}[{1}][choice_input_type]">
<option value="select"<?php $this->set_selected($values['choice_input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="checkbox"<?php $this->set_selected($values['choice_input_type'], "checkbox"); ?>><?php _e("Checkbox", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['choice_input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
<option value="multiselect"<?php $this->set_selected($values['choice_input_type'], "multiselect"); ?>><?php _e("Multi-select", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container" style="padding-right:0;">
<label for="{0}[{1}][choice_heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][choice_heading]" data-field-template-name="{0}[{1}][choice_heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<div class="clear"></div>
<p class="sf_all_items_label item-container">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;All Items&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label]" data-field-template-name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][choice_accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][choice_accessibility_label]" data-field-template-name="{0}[{1}][choice_accessibility_label]" type="text" value="<?php echo esc_attr($values['choice_accessibility_label']); ?>"></label>
</p>
<p class="sf_operator item-container">
<label for="{0}[{1}][operator]"><?php _e("Search Operator", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("AND - posts must have each option selected, OR - posts must have any of the options selected", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select data-field-template-name="{0}[{1}][operator]" data-field-template-id="{0}[{1}][operator]">
<option value="and"<?php $this->set_selected($values['operator'], "and"); ?>><?php _e("AND", $this->plugin_slug); ?></option>
<option value="or"<?php $this->set_selected($values['operator'], "or"); ?>><?php _e("OR", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container" style="">
<span class="sf_make_combobox">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][combo_box]" data-field-template-name="{0}[{1}][combo_box]"<?php $this->set_checked($values['combo_box']); ?>>
<label for="{0}[{1}][combo_box]"><?php _e("Make Combobox?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Allow for text input to find values, with autocomplete and dropdown suggest", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label><br />
</span>
<input class="checkbox " type="checkbox" data-field-template-id="{0}[{1}][show_count]" data-field-template-name="{0}[{1}][show_count]"<?php $this->set_checked($values['show_count']); ?>>
<label for="{0}[{1}][show_count]"><?php _e("Display count?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("display the number of posts for each option - only available if Auto Count is enabled", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label><br />
<input class="checkbox " type="checkbox" data-field-template-id="{0}[{1}][hide_empty]" data-field-template-name="{0}[{1}][hide_empty]"<?php $this->set_checked($values['hide_empty']); ?>>
<label for="{0}[{1}][hide_empty]"><?php _e("Hide Empty?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("hide values with no results - only available if Auto Count is enabled", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="item-container" style="padding-right:0;">
<span class="sf_combobox_message">
<label for="{0}[{1}][no_results_message]"><?php _e("Combobox No Results message", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][no_results_message]" data-field-template-name="{0}[{1}][no_results_message]" type="text" value="<?php echo esc_attr($values['no_results_message']); ?>"></label>
</span>
</p>
<div class="clear"></div>
<hr />
<p style="margin-bottom:0;"><strong><?php _e("Meta Key", $this->plugin_slug); ?></strong> <span class="hint--top hint--info" data-hint="<?php _e("choose a meta key for this field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></p>
<!--<p style="padding-bottom:0;margin-bottom:0;">
<em><?php _e("Choose the min / max key names to be used for comparison.", $this->plugin_slug); ?></em>
</p>-->
<p class="item-container sf_meta_keys">
<label for="{0}[{1}][choice_meta_key]">
<?php
if($meta_key_text_input == 1 ) {
?>
<input type="text" placeholder="<?php echo esc_attr__( 'Enter a meta key', 'search-filter' ); ?>" style="width: 100%" class="meta_key choice_meta_key" data-field-template-name="{0}[{1}][choice_meta_key]" data-field-template-id="{0}[{1}][choice_meta_key]" value="<?php echo esc_attr($values['choice_meta_key']); ?>" />
<?php
} else {
$all_meta_keys = $this->get_all_post_meta_keys();
echo '<select data-field-template-name="{0}[{1}][choice_meta_key]" class="meta_key choice_meta_key" data-field-template-id="{0}[{1}][choice_meta_key]">';
foreach($all_meta_keys as $v){
//$data[] = $v->meta_key;
echo '<option value="'.$v.'"'.$this->set_selected($values['choice_meta_key'], $v, false).'>'.$v."</option>";
}
echo '</select>';
}
?>
<input type="hidden" data-field-template-name="{0}[{1}][choice_meta_key_hidden]" data-field-template-id="{0}[{1}][choice_meta_key_hidden]" class="meta_key_hidden" value="<?php echo esc_attr($values['choice_meta_key']); ?>" disabled="disabled" />
</label>
</p>
<br class="clear" />
<hr class="clear" />
<p style="margin-bottom:0;"><strong><?php _e("Options", $this->plugin_slug); ?></strong></p>
<!--<p>
<?php _e("Choose how the options for this field are fetched:", $this->plugin_slug); ?>
</p>-->
<p class="item-container sf_choice_get_options">
<label for="{0}[{1}][choice_get_option_mode]"><?php _e("Get Options: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][choice_get_option_mode]" class="" data-field-template-id="{0}[{1}][choice_get_option_mode]">
<option value="auto"<?php $this->set_selected($values['choice_get_option_mode'], "auto"); ?>><?php _e("Automatically", $this->plugin_slug); ?></option>
<option value="manual"<?php $this->set_selected($values['choice_get_option_mode'], "manual"); ?>><?php _e("Manual Entry", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container sf_choice_order_options" style="padding-right:0;">
<label for="{0}[{1}][choice_order_option_by]"><?php _e("Order Options by: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][choice_order_option_by]" class="sf_choice_order_option_by" data-field-template-id="{0}[{1}][choice_order_option_by]">
<option value="value"<?php $this->set_selected($values['choice_order_option_by'], "value"); ?>><?php _e("Value", $this->plugin_slug); ?></option>
<option value="label"<?php $this->set_selected($values['choice_order_option_by'], "label"); ?>><?php _e("Label", $this->plugin_slug); ?></option>
<option value="none"<?php $this->set_selected($values['choice_order_option_by'], "none"); ?>><?php _e("None", $this->plugin_slug); ?></option>
</select>
</label>
<select data-field-template-name="{0}[{1}][choice_order_option_dir]" class="sf_choice_order_option_dir" data-field-template-id="{0}[{1}][choice_order_option_dir]">
<option value="asc"<?php $this->set_selected($values['choice_order_option_dir'], "asc"); ?>><?php _e("ASC", $this->plugin_slug); ?></option>
<option value="desc"<?php $this->set_selected($values['choice_order_option_dir'], "desc"); ?>><?php _e("DESC", $this->plugin_slug); ?></option>
</select>
<select data-field-template-name='{0}[{1}][choice_order_option_type]' class="sf_choice_order_option_type" data-field-template-id="{0}[{1}][choice_order_option_type]">
<option value="numeric"<?php $this->set_selected($values['choice_order_option_type'], "numeric"); ?>><?php _e("Numerical", $this->plugin_slug); ?></option>
<option value="alphabetic"<?php $this->set_selected($values['choice_order_option_type'], "alphabetic"); ?>><?php _e("Alphabetical", $this->plugin_slug); ?></option>
</select>
</p>
<p class="item-container choice_is_acf">
<input class="checkbox " type="checkbox" data-field-template-id="{0}[{1}][choice_is_acf]" data-field-template-name="{0}[{1}][choice_is_acf]"<?php $this->set_checked($values['choice_is_acf']); ?>>
<label for="{0}[{1}][choice_is_acf]"><?php _e("Is ACF Field?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("if this is an 'Advanced Custom Fields' field enable here to sync labels & options with ACF directly", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<div class="clear"></div>
<div class="sf_manual_meta_options">
<p>
<?php _e("Add the options that will be available to this field, each option must have a value and a label.", $this->plugin_slug); ?>
</p>
<p class="item-container slimheadings1">
<strong><?php _e("Value", $this->plugin_slug); ?> <span class="hint--top hint--info" data-hint="<?php _e("the internal meta value - this value will be used to search your meta data", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></strong>
</p>
<p class="item-container slimheadings2">
<strong><?php _e("Label", $this->plugin_slug); ?> <span class="hint--top hint--info" data-hint="<?php _e("text that is visible to a user when selecting this option in the Search Form", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></strong>
</p>
<!--<p>
<a href="#" class="button-secondary sort-options-button"><?php _e("Sort By Value", $this->plugin_slug); ?></a>
<a href="#" class="button-secondary sort-options-button"><?php _e("Sort By Label", $this->plugin_slug); ?></a>
</p>-->
<br class="clear"></span>
<p class="no_sort_label"><?php _e("<strong>There are no options</strong>.", $this->plugin_slug); ?></p>
<ul class="meta_options_list">
<?php
$i = 0;
$this->display_meta_option( array(), ' meta-option-template ignore-template-init');
if(isset($values['meta_options']))
{
foreach ($values['meta_options'] as $sort_option)
{
$this->display_meta_option($sort_option);
$i++;
}
}
?>
</ul>
<p>
<a href="#" class="dashicons-plus add-option-button button-secondary"><?php _e("Add Option", $this->plugin_slug); ?></a>
<a href="#" class="dashicons-search detect-option-button button-secondary sfmodal"><?php _e("Browse Values", $this->plugin_slug); ?><!--<span class="hint--top hint--info" data-hint="<?php _e("*experimental - suggest possible values based on a search of existing values for the meta key", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>--></a>
<a href="#" class="clear-option-button button-secondary"><?php _e("Clear All Options", $this->plugin_slug); ?></a>
</p>
</div>

View File

@@ -0,0 +1,210 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<p class="item-container sf_date_input">
<label for="{0}[{1}][date_input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][date_input_type]" class="" data-field-template-id="{0}[{1}][date_input_type]">
<option value="date"<?php $this->set_selected($values['date_input_type'], "date"); ?>><?php _e("Date", $this->plugin_slug); ?></option>
<option value="daterange"<?php $this->set_selected($values['date_input_type'], "daterange"); ?>><?php _e("Date Range", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container" style="padding-right:0;">
<label for="{0}[{1}][date_heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][date_heading]" data-field-template-name="{0}[{1}][date_heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][date_accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_accessibility_label]" data-field-template-name="{0}[{1}][date_accessibility_label]" type="text" value="<?php echo esc_attr($values['date_accessibility_label']); ?>"></label>
</p>
<div class="clear"></div>
<hr />
<div class="clear"></div>
<p><strong><?php _e("Meta Key", $this->plugin_slug); ?></strong></p>
<p style="padding-bottom:0;margin-bottom:0;">
<em><?php _e("Choose the min / max key names to be used for comparison.", $this->plugin_slug); ?></em>
</p>
<p class="item-container sf_meta_keys">
<label for="{0}[{1}][date_start_meta_key]">
<?php _e("Start Meta Key", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("choose a meta key for this field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<?php
$meta_key_text_input = Search_Filter_Helper::get_option( 'meta_key_text_input' );
if($meta_key_text_input == 1 ) {
?>
<input type="text" placeholder="<?php echo esc_attr__( 'Enter a meta key', 'search-filter' ); ?>" style="width: 100%" data-field-template-name="{0}[{1}][date_start_meta_key]" class="meta_key start_meta_key" data-field-template-id="{0}[{1}][date_start_meta_key]" value="<?php echo esc_attr($values['date_start_meta_key']); ?>" />
<?php
} else {
$all_meta_keys = $this->get_all_post_meta_keys();
echo '<select data-field-template-name="{0}[{1}][date_start_meta_key]" class="meta_key start_meta_key" data-field-template-id="{0}[{1}][date_start_meta_key]">';
foreach($all_meta_keys as $v){
//$data[] = $v->meta_key;
echo '<option value="'.$v.'"'.$this->set_selected($values['date_start_meta_key'], $v, false).'>'.$v."</option>";
}
echo '</select>';
}
?>
<input type="hidden" data-field-template-name="{0}[{1}][date_start_meta_key_hidden]" data-field-template-id="{0}[{1}][date_start_meta_key_hidden]" class="meta_key_hidden" value="<?php echo esc_attr($values['date_start_meta_key']); ?>" disabled="disabled" />
</label>
</p>
<p class="item-container sf_meta_keys sf_date_end_meta_key" style="padding-right:0;">
<label for="{0}[{1}][date_use_same_toggle]">
<input class="checkbox use_same_toggle date_use_same_toggle" type="checkbox" data-field-template-id="{0}[{1}][date_use_same_toggle]" data-field-template-name="{0}[{1}][date_use_same_toggle]"<?php $this->set_checked($values['date_use_same_toggle']); ?>>
<?php _e("Use same for End Key?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("if your meta key is not listed or not yet created enter here", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
</label>
<label for="{0}[{1}][date_end_meta_key]">
<?php
if($meta_key_text_input == 1 ) {
?>
<input type="text" placeholder="<?php echo esc_attr__( 'Enter a meta key', 'search-filter' ); ?>" style="width: 100%" data-field-template-name="{0}[{1}][date_end_meta_key]" class="meta_key end_meta_key" data-field-template-id="{0}[{1}][date_end_meta_key]" value="<?php echo esc_attr($values['date_end_meta_key']); ?>" />
<?php
} else {
$all_meta_keys = $this->get_all_post_meta_keys();
echo '<select data-field-template-name="{0}[{1}][date_end_meta_key]" class="meta_key end_meta_key" data-field-template-id="{0}[{1}][date_end_meta_key]">';
foreach($all_meta_keys as $v){
//$data[] = $v->meta_key;
echo '<option value="'.$v.'"'.$this->set_selected($values['date_end_meta_key'], $v, false).'>'.$v."</option>";
}
echo '</select>';
}
?>
<input type="hidden" data-field-template-name="{0}[{1}][date_end_meta_key_hidden]" data-field-template-id="{0}[{1}][date_end_meta_key_hidden]" class="meta_key_hidden" value="<?php echo esc_attr($values['date_end_meta_key']); ?>" disabled="disabled" />
</label>
</p><div class="clear"></div>
<p class="sf_compare_mode">
<label for="{0}[{1}][date_compare_mode]"><?php _e("Compare Mode ", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the format the date is saved in the database", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select data-field-template-name="{0}[{1}][date_compare_mode]" class="" data-field-template-id="{0}[{1}][date_compare_mode]">
<option value="userrange"<?php $this->set_selected($values['date_compare_mode'], "userrange"); ?>><?php _e("Post Meta must be within input range", $this->plugin_slug); ?></option>
<option value="metarange"<?php $this->set_selected($values['date_compare_mode'], "metarange"); ?>><?php _e("Input must be within the Post Meta range", $this->plugin_slug); ?></option>
<option value="overlap"<?php $this->set_selected($values['date_compare_mode'], "overlap"); ?>><?php _e("Input overlaps any of the Post Meta range", $this->plugin_slug); ?></option>
</select>
</label>
</p><div class="clear"></div>
<hr />
<div class="clear"></div>
<div class="item-container">
<p>
<label for="{0}[{1}][date_input_format]"><?php _e("Date Input Format ", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the format the date is saved in the database", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select data-field-template-name="{0}[{1}][date_input_format]" class="" data-field-template-id="{0}[{1}][date_input_format]">
<option value="timestamp"<?php $this->set_selected($values['date_input_format'], "timestamp"); ?>><?php _e("Timestamp", $this->plugin_slug); ?></option>
<option value="yyyymmdd"<?php $this->set_selected($values['date_input_format'], "yyyymmdd"); ?>><?php _e("YYYYMMDD (ACF)", $this->plugin_slug); ?></option>
<option value="yyyy-mm-dd"<?php $this->set_selected($values['date_input_format'], "yyyy-mm-dd"); ?>><?php _e("YYYY-MM-DD (PODS)", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<!--<p>
<label for="{0}[{1}][placeholder]"><?php _e("Placeholder text", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text that appears in the date field before a selection has been made", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br /><input class="" data-field-template-id="{0}[{1}][placeholder]" data-field-template-name="{0}[{1}][placeholder]" type="text" value="<?php /* echo esc_attr($values['placeholder']);*/ ?>"></label>
</p>-->
</div>
<div class="item-container" style="padding-right:0;">
<p>
<?php _e("Date Display Format", $this->plugin_slug); ?>
</p>
<p>
<?php
$format = array();
$format[0] = "d/m/Y";
$format[1] = "m/d/Y";
$format[2] = "Y/m/d";
$formati = 0;
?>
<label for="{0}[{1}][date_output_format][0]"><input data-radio-checked="<?php echo ($values['date_output_format']==$format[0]) ? 1 : 0 ?>" class="date_format_radio" data-field-template-id="{0}[{1}][date_output_format][0]" data-field-template-name="{0}[{1}][date_output_format]" type="radio" value="<?php echo $format[0] ?>"<?php echo $this->set_radio($values['date_output_format'], $format[0]); ?>><?php echo date($format[0]) ?></label><br />
<label for="{0}[{1}][date_output_format][1]"><input data-radio-checked="<?php echo ($values['date_output_format']==$format[1]) ? 1 : 0 ?>" class="date_format_radio" data-field-template-id="{0}[{1}][date_output_format][1]" data-field-template-name="{0}[{1}][date_output_format]" type="radio" value="<?php echo $format[1] ?>"<?php echo $this->set_radio($values['date_output_format'], $format[1]); ?>><?php echo date($format[1]) ?></label><br />
<label for="{0}[{1}][date_output_format][2]"><input data-radio-checked="<?php echo ($values['date_output_format']==$format[2]) ? 1 : 0 ?>" class="date_format_radio" data-field-template-id="{0}[{1}][date_output_format][2]" data-field-template-name="{0}[{1}][date_output_format]" type="radio" value="<?php echo $format[2] ?>"<?php echo $this->set_radio($values['date_output_format'], $format[2]); ?>><?php echo date($format[2]) ?></label><br />
<!--<label for="{0}[{1}][date_output_format]"><input class="" data-field-template-id="{0}[{1}][date_output_format]" data-field-template-name="{0}[{1}][date_output_format]" type="radio"> Custom: <input type="text" size="10" /></label>-->
</p>
</div>
<div class="clear"></div>
<hr />
<p style="margin-bottom:0;"><strong><?php _e("UI Options", $this->plugin_slug); ?></strong>
<fieldset class="item-container child-columns">
<p class="sf_range_min">
<label for="{0}[{1}][date_from_prefix]">
<?php _e("From Prefix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear before the From field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_from_prefix]" data-field-template-name="{0}[{1}][date_from_prefix]" type="text" size="7" value="<?php echo esc_attr($values['date_from_prefix']); ?>">
</label>
</p>
<p class="sf_range_max">
<label for="{0}[{1}][date_from_postfix]">
<?php _e("From Postfix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear after the From field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_from_postfix]" data-field-template-name="{0}[{1}][date_from_postfix]" type="text" size="7" value="<?php echo esc_attr($values['date_from_postfix']); ?>">
</label>
</p>
<p class="sf_range_step">
<label for="{0}[{1}][date_from_placeholder]">
<?php _e("From Placeholder", $this->plugin_slug); ?><br />
<input class="" data-field-template-id="{0}[{1}][date_from_placeholder]" data-field-template-name="{0}[{1}][date_from_placeholder]" type="text" size="7" value="<?php echo esc_attr($values['date_from_placeholder']); ?>">
</label>
</p>
</fieldset>
<fieldset class="item-container child-columns sf_date_end_meta_key">
<p class="sf_range_min">
<label for="{0}[{1}][date_to_prefix]">
<?php _e("To Prefix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear before the To field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_to_prefix]" data-field-template-name="{0}[{1}][date_to_prefix]" type="text" size="7" value="<?php echo esc_attr($values['date_to_prefix']); ?>">
</label>
</p>
<p class="sf_range_max">
<label for="{0}[{1}][date_to_postfix]">
<?php _e("To Postfix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear after the To field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][date_to_postfix]" data-field-template-name="{0}[{1}][date_to_postfix]" type="text" size="7" value="<?php echo esc_attr($values['date_to_postfix']); ?>">
</label>
</p>
<p class="sf_range_step">
<label for="{0}[{1}][date_to_placeholder]">
<?php _e("To Placeholder", $this->plugin_slug); ?><br />
<input class="" data-field-template-id="{0}[{1}][date_to_placeholder]" data-field-template-name="{0}[{1}][date_to_placeholder]" type="text" size="7" value="<?php echo esc_attr($values['date_to_placeholder']); ?>">
</label>
</p>
</fieldset>
<br class="clear" />
<p class="item-container" style="">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][date_use_dropdown_year]" data-field-template-name="{0}[{1}][date_use_dropdown_year]"<?php $this->set_checked($values['date_use_dropdown_year']); ?>>
<label for="{0}[{1}][date_use_dropdown_year]"><?php _e("Use dropdown for Year", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Add dropdown for Year", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label><br />
<input class="checkbox " type="checkbox" data-field-template-id="{0}[{1}][date_use_dropdown_month]" data-field-template-name="{0}[{1}][date_use_dropdown_month]"<?php $this->set_checked($values['date_use_dropdown_month']); ?>>
<label for="{0}[{1}][date_use_dropdown_month]"><?php _e("Use dropdown for month", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Add dropdown for month", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<!--<p class="item-container" style="padding-right:0;">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][combo_box]" data-field-template-name="{0}[{1}][combo_box]"<?php $this->set_checked($values['combo_box']); ?>>
<label for="{0}[{1}][combo_box]"><?php _e("Use dropdown for Year", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Add dropdown for Year", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label><br />
<input class="checkbox " type="checkbox" data-field-template-id="{0}[{1}][show_count]" data-field-template-name="{0}[{1}][show_count]"<?php $this->set_checked($values['show_count']); ?>>
<label for="{0}[{1}][show_count]"><?php _e("Use dropdown for month", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Add dropdown for month", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>-->
<br class="clear" />
<div class="clear"></div>

View File

@@ -0,0 +1,254 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<p class="item-container sf_number_input_type">
<label for="{0}[{1}][number_input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][number_input_type]" class="" data-field-template-id="{0}[{1}][number_input_type]">
<!--<option value="number-slider"<?php $this->set_selected($values['number_input_type'], "number-slider"); ?>><?php _e("Slider", $this->plugin_slug); ?></option>
<option value="number-number"<?php $this->set_selected($values['number_input_type'], "number-number"); ?>><?php _e("Number", $this->plugin_slug); ?></option>
<option value="number-select"<?php $this->set_selected($values['number_input_type'], "number-select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="number-checkbox"<?php $this->set_selected($values['number_input_type'], "number-checkbox"); ?>><?php _e("Checkbox", $this->plugin_slug); ?></option>
<option value="number-radio"<?php $this->set_selected($values['number_input_type'], "number-radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>-->
<option value="range-slider"<?php $this->set_selected($values['number_input_type'], "range-slider"); ?>><?php _e("Range - Slider", $this->plugin_slug); ?></option>
<option value="range-number"<?php $this->set_selected($values['number_input_type'], "range-number"); ?>><?php _e("Range - Number", $this->plugin_slug); ?></option>
<option value="range-select"<?php $this->set_selected($values['number_input_type'], "range-select"); ?>><?php _e("Range - Dropdown", $this->plugin_slug); ?></option>
<option value="range-radio"<?php $this->set_selected($values['number_input_type'], "range-radio"); ?>><?php _e("Range - Radio", $this->plugin_slug); ?></option>
<!--<option value="range-checkbox"<?php $this->set_selected($values['number_input_type'], "range-checkbox"); ?>><?php _e("Range - Checkbox", $this->plugin_slug); ?></option>-->
</select>
</label>
</p>
<p class="item-container" style="padding-right:0;">
<label for="{0}[{1}][number_heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][number_heading]" data-field-template-name="{0}[{1}][number_heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<div class="clear"></div>
<div class="item-container">
<p class="sf_display_input_as">
<label for="{0}[{1}][number_display_input_as]"><?php _e("Display input as", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][number_display_input_as]" class="" data-field-template-id="{0}[{1}][number_display_input_as]">
<option value="singlefield"<?php $this->set_selected($values['number_display_input_as'], "singlefield"); ?>><?php _e("Single Field", $this->plugin_slug); ?></option>
<option value="fromtofields"<?php $this->set_selected($values['number_display_input_as'], "fromtofields"); ?>><?php _e("From / To Fields", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="sf_display_values_as">
<label for="{0}[{1}][number_display_values_as]"><?php _e("Display values as", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][number_display_values_as]" class="" data-field-template-id="{0}[{1}][number_display_values_as]">
<option value="textinput"<?php $this->set_selected($values['number_display_values_as'], "textinput"); ?>><?php _e("Input Field", $this->plugin_slug); ?></option>
<!--<option value="select"<?php $this->set_selected($values['number_display_values_as'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>-->
<option value="text"<?php $this->set_selected($values['number_display_values_as'], "text"); ?>><?php _e("Plain Text", $this->plugin_slug); ?></option>
</select>
</label>
</p>
</div>
<p class="sf_all_items_label_number item-container" style="padding-right:0;">
<label for="{0}[{1}][all_items_label_number]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;All Items&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label_number]" data-field-template-name="{0}[{1}][all_items_label_number]" type="text" value="<?php echo esc_attr($values['all_items_label_number']); ?>"></label>
</p>
<p class="sf_accessibility_label item-container">
<label for="{0}[{1}][number_accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][number_accessibility_label]" data-field-template-name="{0}[{1}][number_accessibility_label]" type="text" value="<?php echo esc_attr($values['number_accessibility_label']); ?>"></label>
</p>
<div class="clear"></div>
<hr />
<p><strong><?php _e("Meta Key", $this->plugin_slug); ?></strong></p>
<p style="padding-bottom:0;margin-bottom:0;">
<em><?php _e("Choose the min / max key names to be used for comparison.", $this->plugin_slug); ?></em>
</p>
<p class="item-container sf_meta_keys">
<label for="{0}[{1}][number_start_meta_key]">
<?php _e("Start Meta Key", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("choose a meta key for this field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<?php
$meta_key_text_input = Search_Filter_Helper::get_option( 'meta_key_text_input' );
if($meta_key_text_input == 1 ) {
?>
<input type="text" placeholder="<?php echo esc_attr__( 'Enter a meta key', 'search-filter' ); ?>" style="width: 100%" data-field-template-name="{0}[{1}][number_start_meta_key]" class="meta_key start_meta_key" data-field-template-id="{0}[{1}][number_start_meta_key]" value="<?php echo esc_attr($values['number_start_meta_key']); ?>" />
<?php
} else {
$all_meta_keys = $this->get_all_post_meta_keys();
echo '<select data-field-template-name="{0}[{1}][number_start_meta_key]" class="meta_key start_meta_key" data-field-template-id="{0}[{1}][number_start_meta_key]">';
foreach($all_meta_keys as $v){
//$data[] = $v->meta_key;
echo '<option value="'.$v.'"'.$this->set_selected($values['number_start_meta_key'], $v, false).'>'.$v."</option>";
}
echo '</select>';
}
?>
<input type="hidden" data-field-template-name="{0}[{1}][number_start_meta_key_hidden]" data-field-template-id="{0}[{1}][number_start_meta_key_hidden]" class="meta_key_hidden" value="<?php echo esc_attr($values['number_start_meta_key']); ?>" disabled="disabled" />
</label>
</p>
<p class="item-container sf_meta_keys sf_end_meta_key" style="padding-right:0;">
<label for="{0}[{1}][number_use_same_toggle]">
<input class="checkbox use_same_toggle number_use_same_toggle" type="checkbox" data-field-template-id="{0}[{1}][number_use_same_toggle]" data-field-template-name="{0}[{1}][number_use_same_toggle]"<?php $this->set_checked($values['number_use_same_toggle']); ?>>
<?php _e("Use same for End Key?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Tick this box to use the same option from the Start Meta Key", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
</label>
<label for="{0}[{1}][number_end_meta_key]">
<?php
if($meta_key_text_input == 1 ) {
?>
<input type="text" placeholder="<?php echo esc_attr__( 'Enter a meta key', 'search-filter' ); ?>" style="width: 100%" data-field-template-name="{0}[{1}][number_end_meta_key]" class="meta_key end_meta_key" data-field-template-id="{0}[{1}][number_end_meta_key]" value="<?php echo esc_attr($values['number_end_meta_key']); ?>" />
<?php
} else {
$all_meta_keys = $this->get_all_post_meta_keys();
echo '<select data-field-template-name="{0}[{1}][number_end_meta_key]" class="meta_key end_meta_key" data-field-template-id="{0}[{1}][number_end_meta_key]">';
foreach($all_meta_keys as $v){
//$data[] = $v->meta_key;
echo '<option value="'.$v.'"'.$this->set_selected($values['number_end_meta_key'], $v, false).'>'.$v."</option>";
}
echo '</select>';
}
?>
<input type="hidden" data-field-template-name="{0}[{1}][number_end_meta_key_hidden]" data-field-template-id="{0}[{1}][number_end_meta_key_hidden]" class="meta_key_hidden" value="<?php echo esc_attr($values['meta_key']); ?>" disabled="disabled" />
</label>
</p><div class="clear"></div>
<p class="sf_compare_mode">
<label for="{0}[{1}][number_compare_mode]"><?php _e("Compare Mode ", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the format the date is saved in the database", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select data-field-template-name="{0}[{1}][number_compare_mode]" class="" data-field-template-id="{0}[{1}][number_compare_mode]">
<option value="userrange"<?php $this->set_selected($values['number_compare_mode'], "userrange"); ?>><?php _e("Post Meta must be within input range", $this->plugin_slug); ?></option>
<option value="metarange"<?php $this->set_selected($values['number_compare_mode'], "metarange"); ?>><?php _e("Input must be within the Post Meta range", $this->plugin_slug); ?></option>
<option value="overlap"<?php $this->set_selected($values['number_compare_mode'], "overlap"); ?>><?php _e("Input overlaps any of the Post Meta range", $this->plugin_slug); ?></option>
</select>
</label>
</p><div class="clear"></div>
<p>
<input class="checkbox number_is_decimal" type="checkbox" data-field-template-id="{0}[{1}][number_is_decimal]" data-field-template-name="{0}[{1}][number_is_decimal]"<?php $this->set_checked($values['number_is_decimal']); ?>>
<label for="{0}[{1}][number_is_decimal]"><?php _e("Data is decimal?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("use this option if you are filtering things like currencies", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
<br />
<label for="{0}[{1}][number_decimal_places]">
<input class="number_decimal_places" data-field-template-id="{0}[{1}][number_decimal_places]" data-field-template-name="{0}[{1}][number_decimal_places]" type="text" size="7" value="<?php echo esc_attr($values['number_decimal_places']); ?>"> <?php _e("Decimal Places - this is used internally to perform accurate database queries", $this->plugin_slug); ?></label>
</label>
</p>
<div class="clear"></div>
<hr />
<div class="clear"></div>
<p style="margin-bottom:0;"><strong><?php _e("UI Options", $this->plugin_slug); ?></strong>
<fieldset class="item-container child-columns-w">
<p class="sf_range_min">
<label for="{0}[{1}][range_min]">
<?php _e("Min Value", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the lowest value that a user can select", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<?php
$range_min = "";
if($values['range_min_detect']!=1)
{
$range_min = $values['range_min'];
}
?>
<input class="range_min" data-field-template-id="{0}[{1}][range_min]" data-field-template-name="{0}[{1}][range_min]" type="text" size="7" value="<?php echo $range_min; ?>">
</label>
<br />
<input class="checkbox range_min_detect" type="checkbox" data-field-template-id="{0}[{1}][range_min_detect]" data-field-template-name="{0}[{1}][range_min_detect]"<?php $this->set_checked($values['range_min_detect']); ?>>
<label for="{0}[{1}][range_min_detect]"><?php _e("Auto Detect?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("set the min based on the lowest value in the database", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_range_max">
<label for="{0}[{1}][range_max]">
<?php _e("Max Value", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the highest value that a user can select", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<?php
$range_max = "";
if($values['range_max_detect']!=1)
{
$range_max = $values['range_max'];
}
?>
<input class="range_max" data-field-template-id="{0}[{1}][range_max]" data-field-template-name="{0}[{1}][range_max]" type="text" size="7" value="<?php echo $range_max; ?>">
</label>
<br />
<input class="checkbox range_max_detect" type="checkbox" data-field-template-id="{0}[{1}][range_max_detect]" data-field-template-name="{0}[{1}][range_max_detect]"<?php $this->set_checked($values['range_max_detect']); ?>>
<label for="{0}[{1}][range_max_detect]"><?php _e("Auto Detect?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("set the max based on the highest value in the database", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
</fieldset>
<fieldset class="item-container child-columns-w">
<p class="sf_range_step">
<label for="{0}[{1}][range_step]">
<?php _e("Step", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the increment amount", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][range_step]" data-field-template-name="{0}[{1}][range_step]" type="text" size="7" value="<?php echo esc_attr($values['range_step']); ?>">
</label>
</p>
</fieldset>
<div class="clear"></div>
<fieldset class="item-container child-columns-w">
<p class="sf_range_value_prefix">
<label for="{0}[{1}][range_value_prefix]">
<?php _e("Value Prefix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear before a value - such as a currency symbol - &dollar;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][range_value_prefix]" data-field-template-name="{0}[{1}][range_value_prefix]" type="text" size="7" value="<?php echo esc_attr($values['range_value_prefix']); ?>">
</label>
</p>
<p class="sf_range_value_postfix">
<label for="{0}[{1}][range_value_postfix]">
<?php _e("Value Postfix", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text to appear after a value - such as a currency symbol - &euro;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][range_value_postfix]" data-field-template-name="{0}[{1}][range_value_postfix]" type="text" size="7" value="<?php echo esc_attr($values['range_value_postfix']); ?>">
</label>
</p>
</fieldset>
<fieldset class="item-container child-columns-w">
<p class="">
<label for="{0}[{1}][number_values_seperator]">
<?php _e("Values Seperator", $this->plugin_slug); ?>
<input class="" data-field-template-id="{0}[{1}][number_values_seperator]" data-field-template-name="{0}[{1}][number_values_seperator]" type="text" size="7" value="<?php echo esc_attr($values['number_values_seperator']); ?>">
</label>
</p>
</fieldset>
<div class="clear"></div>
<fieldset class="item-container child-columns-w sf_number_formatting">
<p class="">
<label for="{0}[{1}][decimal_places]">
<?php _e("Decimal Places", $this->plugin_slug); ?>
<input class="" data-field-template-id="{0}[{1}][decimal_places]" data-field-template-name="{0}[{1}][decimal_places]" type="text" size="7" value="<?php echo esc_attr($values['decimal_places']); ?>">
</label>
</p>
<p class="">
<label for="{0}[{1}][thousand_seperator]">
<?php _e("Thousands Seperator", $this->plugin_slug); ?>
<input class="" data-field-template-id="{0}[{1}][thousand_seperator]" data-field-template-name="{0}[{1}][thousand_seperator]" type="text" size="7" value="<?php echo esc_attr($values['thousand_seperator']); ?>">
</label>
</p>
<p class="">
</p>
</fieldset>
<fieldset class="item-container child-columns-w sf_number_formatting">
<p class="">
<label for="{0}[{1}][decimal_seperator]">
<?php _e("Decimal Seperator", $this->plugin_slug); ?>
<input class="" data-field-template-id="{0}[{1}][decimal_seperator]" data-field-template-name="{0}[{1}][decimal_seperator]" type="text" size="7" value="<?php echo esc_attr($values['decimal_seperator']); ?>">
</label>
</p>
</fieldset>
<br class="clear" />

View File

@@ -0,0 +1,136 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="<?php echo $values['type']; ?>">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Post Type Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Post Type", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<!--<form action="" method="post">-->
<div class="widget-content" style="position:relative;">
<!--<a class="widget-control-advanced" href="#remove"><?php _e("Advanced settings", $this->plugin_slug); ?></a>-->
<fieldset class="">
<p class="sf_post_types">
<?php _e("Post Types:", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("post types available to this field", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<?php _e("Any post types made available here must also be made available to the search form under <strong>Settings</strong> before a user will see them as options.", $this->plugin_slug); ?>
<br /><br />
<?php
$args = array(
'public' => true
);
$post_types = get_post_types( $args, 'objects' );
$is_default = false;
if(!is_array($values['post_types']))
{
$is_default = true;
$values['post_types'] = array();
}
foreach ( $post_types as $post_type )
{
//if($post_type->name!="attachment")
//{
if($is_default)
{
$values['post_types'][$post_type->name] = "1";
}
else if(!isset($values['post_types'][$post_type->name]))
{
$values['post_types'][$post_type->name] = "";
}
?>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][post_types][<?php echo $post_type->name; ?>]" data-field-template-name="{0}[{1}][post_types][<?php echo $post_type->name; ?>]"<?php $this->set_checked($values['post_types'][$post_type->name]); ?>>
<label for="{0}[{1}][post_types][<?php echo $post_type->name; ?>]"><?php _e($post_type->labels->name, $this->plugin_slug); ?></label>
<?php
//}
}
?>
</p>
</fieldset>
<br class="clear" />
<hr />
<fieldset class="item-container">
<p class="sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<option value="select"<?php $this->set_selected($values['input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="checkbox"<?php $this->set_selected($values['input_type'], "checkbox"); ?>><?php _e("Checkbox", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
<option value="multiselect"<?php $this->set_selected($values['input_type'], "multiselect"); ?>><?php _e("Multi-select", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p>
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_all_items_label">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;All Post Types&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label]" data-field-template-name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
</fieldset>
<fieldset class="item-container">
<br /><br />
<p class="sf_make_combobox" style="vertical-align: top;">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][combo_box]" data-field-template-name="{0}[{1}][combo_box]"<?php $this->set_checked($values['combo_box']); ?> style="vertical-align: top;margin-top:2px;">
<label for="{0}[{1}][combo_box]" style="display:inline-block;">
<?php _e("Make Combobox?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Allow for text input to find values, with autocomplete and dropdown suggest", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
<br />
<span class="sf_combobox_message" style="padding-top:10px; display:inline-block;">
<input class="" data-field-template-id="{0}[{1}][no_results_message]" data-field-template-name="{0}[{1}][no_results_message]" type="text" value="<?php echo esc_attr($values['no_results_message']); ?>">
<br /><em><?php _e("No Matches message", $this->plugin_slug); ?></em>
<span class="hint--top hint--info" data-hint="<?php _e("This message is usually displayed when there are no matches in the list - leave blank for default", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</span>
</label>
</p>
</fieldset>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo esc_attr($values['type']); ?>" />
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
<!--</form>-->
</div>
<div class="widget-description">
<?php _e("Add a Post Type Field your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,102 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="<?php echo $values['type']; ?>">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Posts Per Page Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Posts Per Page", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content" style="position:relative;">
<p>
<em><?php _e("Add a field allowing your users to change how many results are displayed per page.", $this->plugin_slug); ?></em>
</p>
<fieldset class="item-container">
<p class="sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<option value="select"<?php $this->set_selected($values['input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;Sort Results By&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label]" data-field-template-name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
</fieldset>
<fieldset class="item-container">
<p class="">
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
</fieldset>
<div class="clear"></div>
<hr />
<fieldset class="item-container child-columns-w">
<p class="sf_range_min">
<label for="{0}[{1}][ppp_min]">
<?php _e("Min Value", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the lowest value that a user can select", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="ppp_min" data-field-template-id="{0}[{1}][ppp_min]" data-field-template-name="{0}[{1}][ppp_min]" type="text" size="7" value="<?php echo esc_attr($values['ppp_min']); ?>">
</label>
</p>
<p class="sf_range_max">
<label for="{0}[{1}][ppp_max]">
<?php _e("Max Value", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the highest value that a user can select", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="ppp_max" data-field-template-id="{0}[{1}][ppp_max]" data-field-template-name="{0}[{1}][ppp_max]" type="text" size="7" value="<?php echo esc_attr($values['ppp_max']); ?>">
</label>
</p>
</fieldset>
<fieldset class="item-container child-columns-w">
<p class="sf_range_step">
<label for="{0}[{1}][ppp_step]">
<?php _e("Step", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("the increment amount", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][ppp_step]" data-field-template-name="{0}[{1}][ppp_step]" type="text" size="7" value="<?php echo esc_attr($values['ppp_step']); ?>">
</label>
</p>
</fieldset>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo $values['type']; ?>">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add a Sort Order Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,65 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Reset Button</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Reset Button", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content">
<p class="item-container">
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="item-container">
<label for="{0}[{1}][label]"><?php _e("Reset label", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Text that appears on the button", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br /><input class="" data-field-template-id="{0}[{1}][label]" data-field-template-name="{0}[{1}][label]" type="text" value="<?php echo esc_attr($values['label']); ?>"></label>
</p>
<p class="item-container">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<option value="link"<?php $this->set_selected($values['input_type'], "link"); ?>><?php _e("Link", $this->plugin_slug); ?></option>
<option value="button"<?php $this->set_selected($values['input_type'], "button"); ?>><?php _e("Button", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container">
<label for="{0}[{1}][submit_form]"><?php _e("Submit Form: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][submit_form]" class="" data-field-template-id="{0}[{1}][submit_form]">
<option value="always"<?php $this->set_selected($values['submit_form'], "always"); ?>><?php _e("Always", $this->plugin_slug); ?></option>
<option value="never"<?php $this->set_selected($values['submit_form'], "never"); ?>><?php _e("Never", $this->plugin_slug); ?></option>
<option value="auto"<?php $this->set_selected($values['submit_form'], "auto"); ?>><?php _e("Only when auto submit is enabled", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<div class="clear"></div>
</div>
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo $values['type']; ?>">
<br class="clear" />
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add a Reset Button to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,53 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Search Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Search", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content">
<p class="item-container">
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="item-container">
<label for="{0}[{1}][placeholder]"><?php _e("Placeholder text", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("text that appears in the search box before the use starts typing", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br /><input class="" data-field-template-id="{0}[{1}][placeholder]" data-field-template-name="{0}[{1}][placeholder]" type="text" value="<?php echo esc_attr($values['placeholder']); ?>"></label>
</p>
<p class="item-container sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
<div class="clear"></div>
</div>
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo $values['type']; ?>">
<br class="clear" />
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add a Search Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,105 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<li class='sort-option-item<?php echo $class; ?>'>
<fieldset class="sitem">
<p class='item-container slimmove'>
<img src="<?php echo plugins_url( 'admin/assets/img/move-ico.svg', SEARCH_FILTER_PRO_BASE_PATH); ?>" />
</p>
<p class='item-container xslim'>
<label for="{0}[{1}][sort_options][{2}][sort_by]">
<span><?php _e("Sort By", $this->plugin_slug); ?><br /></span>
<select name="{0}[{1}][sort_options][{2}][sort_by]" class="sort_by_option" id="{0}[{1}][sort_options][{2}][sort_by]">
<option value="ID"<?php $this->set_selected($values['sort_by'], "ID"); ?>><?php _e("Post ID", $this->plugin_slug); ?></option>
<option value="author"<?php $this->set_selected($values['sort_by'], "author"); ?>><?php _e("Author", $this->plugin_slug); ?></option>
<option value="title"<?php $this->set_selected($values['sort_by'], "title"); ?>><?php _e("Title", $this->plugin_slug); ?></option>
<option value="name"<?php $this->set_selected($values['sort_by'], "name"); ?>><?php _e("Name (Post Slug)", $this->plugin_slug); ?></option>
<option value="type"<?php $this->set_selected($values['sort_by'], "type"); ?>><?php _e("Type (Post Type)", $this->plugin_slug); ?></option>
<option value="date"<?php $this->set_selected($values['sort_by'], "date"); ?>><?php _e("Date", $this->plugin_slug); ?></option>
<option value="modified"<?php $this->set_selected($values['sort_by'], "modified"); ?>><?php _e("Last Modified Date", $this->plugin_slug); ?></option>
<option value="parent"<?php $this->set_selected($values['sort_by'], "parent"); ?>><?php _e("Parent ID", $this->plugin_slug); ?></option>
<option value="rand"<?php $this->set_selected($values['sort_by'], "rand"); ?>><?php _e("Random Order", $this->plugin_slug); ?></option>
<option value="comment_count"<?php $this->set_selected($values['sort_by'], "comment_count"); ?>><?php _e("Comment Count", $this->plugin_slug); ?></option>
<option value="relevance"<?php $this->set_selected($values['sort_by'], "relevance"); ?>><?php _e("Relevance", $this->plugin_slug); ?></option>
<option value="menu_order"<?php $this->set_selected($values['sort_by'], "menu_order"); ?>><?php _e("Menu Order", $this->plugin_slug); ?></option>
<option value="meta_value"<?php $this->set_selected($values['sort_by'], "meta_value"); ?>><?php _e("Meta Value", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class='item-container xslim'>
<label for="{0}[{1}][sort_options][{2}][sort_dir]">
<span><?php _e("Direction", $this->plugin_slug); ?><br /></span>
<select name="{0}[{1}][sort_options][{2}][sort_dir]" class="meta_key" id="{0}[{1}][sort_options][{2}][sort_dir]">
<option value="desc"<?php $this->set_selected($values['sort_dir'], "desc"); ?>><?php _e("Descending", $this->plugin_slug); ?></option>
<option value="asc"<?php $this->set_selected($values['sort_dir'], "asc"); ?>><?php _e("Ascending", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class='item-container slim'>
<label for="{0}[{1}][sort_options][{2}][sort_label]">
<span><?php _e("Label", $this->plugin_slug); ?><br /></span>
<input type="text" name="{0}[{1}][sort_options][{2}][sort_label]" class="meta_key" id="{0}[{1}][sort_options][{2}][sort_label]" value="<?php echo esc_attr($values['sort_label']); ?>" />
</label>
</p>
<div class="clear"></div>
<p class="meta-option-controls">
<!--<a href="#" class="widget-control-option-advanced"><?php _e("Advanced", $this->plugin_slug); ?></a> | --><a href="#" class="widget-control-option-remove"><?php _e("Remove", $this->plugin_slug); ?></a>
</p>
</fieldset>
<div class="clear"></div>
<fieldset class='sort-options-advanced'>
<p class='item-container slimmove'>
</p>
<p class='item-container slimx2'>
<label for="{0}[{1}][meta_key]">
<?php _e("Meta Key: ", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("choose a meta key to sort by", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
<?php
$meta_key_text_input = Search_Filter_Helper::get_option( 'meta_key_text_input' );
if($meta_key_text_input == 1 ) {
?>
<input type="text" placeholder="<?php echo esc_attr__( 'Enter a meta key', 'search-filter' ); ?> " style="width: 100%" name="{0}[{1}][sort_options][{2}][meta_key]" class="meta_key" id="{0}[{1}][sort_options][{2}][meta_key]" value="<?php echo esc_attr($values['meta_key']); ?>" />
<?php
} else {
$all_meta_keys = $this->get_all_post_meta_keys();
echo '<select name="{0}[{1}][sort_options][{2}][meta_key]" class="meta_key" id="{0}[{1}][sort_options][{2}][meta_key]">';
foreach($all_meta_keys as $v)
{
echo '<option value="'.$v.'"'.$this->set_selected($values['meta_key'], $v, false).'>'.$v."</option>";
}
echo '</select>';
}
?>
</label>
</p>
<p class='item-container slim'>
<label for="{0}[{1}][sort_options][{2}][sort_type]">
<?php _e("Sort Type: ", $this->plugin_slug); ?> <br />
<select name='{0}[{1}][sort_options][{2}][sort_type]' data-field-template-id='{0}[{1}][sort_options][{2}][sort_type]'>
<option value="numeric"<?php $this->set_selected($values['sort_type'], "numeric"); ?>><?php _e("Numeric", $this->plugin_slug); ?></option>
<option value="alphabetic"<?php $this->set_selected($values['sort_type'], "alphabetic"); ?>><?php _e("Alphabetic", $this->plugin_slug); ?></option>
<option value="date"<?php $this->set_selected($values['sort_type'], "date"); ?>><?php _e("Date", $this->plugin_slug); ?></option>
<option value="datetime"<?php $this->set_selected($values['sort_type'], "datetime"); ?>><?php _e("Datetime", $this->plugin_slug); ?></option>
</select>
</label>
</p>
</fieldset>
</li>

View File

@@ -0,0 +1,117 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="<?php echo $values['type']; ?>">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Sort Order Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Sort Order", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content" style="position:relative;">
<p>
<em><?php _e("Add a field allowing your users to sort results.", $this->plugin_slug); ?></em>
</p>
<p class="item-container sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<option value="select"<?php $this->set_selected($values['input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container">
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="item-container">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;Sort Results By&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label]" data-field-template-name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
<p class="item-container sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
<br class="clear" />
<hr class="clear" />
<p><strong><?php _e("Sort Options", $this->plugin_slug); ?></strong></p>
<p>
<?php _e("Add the sort options that will be available to this field.", $this->plugin_slug); ?>
</p>
<p class="item-container slimheadings1-sort">
<strong><?php _e("Sort By", $this->plugin_slug); ?> <span class="hint--top hint--info" data-hint="<?php _e("sorting option", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></strong>
</p>
<p class="item-container slimheadings2-sort">
<strong><?php _e("Direction", $this->plugin_slug); ?> <span class="hint--top hint--info" data-hint="<?php _e("choose a direction for sorting", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></strong>
</p>
<p class="item-container slimheadings2-sort">
<strong><?php _e("Label", $this->plugin_slug); ?> <span class="hint--top hint--info" data-hint="<?php _e("the text label a uses sees when selecting this option", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></strong>
</p>
<br class="clear"></span>
<p class="no_sort_label"><?php _e("<strong>There are no sort options</strong>.", $this->plugin_slug); ?></p>
<ul class="sort_options_list">
<?php
$i = 0;
$this->display_sort_option( array(), ' sort-option-template ignore-template-init');
if(isset($values['sort_options']))
{
foreach ($values['sort_options'] as $sort_option)
{
$this->display_sort_option($sort_option);
$i++;
}
}
?>
</ul>
<p>
<a href="#" class="dashicons-plus add-sort-button button-secondary"><?php _e("Add Option", $this->plugin_slug); ?></a>
<a href="#" class="clear-option-button button-secondary"><?php _e("Clear All Options", $this->plugin_slug); ?></a>
</p>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo $values['type']; ?>">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add a Sort Order Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,48 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Submit Button</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Submit Button", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<div class="widget-content">
<p class="item-container">
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="item-container">
<label for="{0}[{1}][label]"><?php _e("Submit label", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Text that appears on the button", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br /><input class="" data-field-template-id="{0}[{1}][label]" data-field-template-name="{0}[{1}][label]" type="text" value="<?php echo esc_attr($values['label']); ?>"></label>
</p>
<div class="clear"></div>
</div>
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="<?php echo $values['type']; ?>">
<br class="clear" />
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
</div>
<div class="widget-description">
<?php _e("Add a Submit Button to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,160 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="tag">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Tag Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Tag", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<!--<form action="" method="post">-->
<div class="widget-content" style="position:relative;">
<a class="widget-control-advanced" href="#remove"><?php _e("Advanced settings", $this->plugin_slug); ?></a>
<fieldset class="item-container">
<input type="hidden" data-field-template-name="{0}[{1}][taxonomy_name]" class="" data-field-template-id="{0}[{1}][taxonomy_name]" value="post_tag" />
<p class="sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<!--<option value="list"<?php $this->set_selected($values['input_type'], "list"); ?>><?php _e("List", $this->plugin_slug); ?></option>-->
<option value="select"<?php $this->set_selected($values['input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="checkbox"<?php $this->set_selected($values['input_type'], "checkbox"); ?>><?php _e("Checkbox", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
<option value="multiselect"<?php $this->set_selected($values['input_type'], "multiselect"); ?>><?php _e("Multi-select", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p>
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_all_items_label">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;All Tags&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label]" data-field-template-name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
<p class="sf_operator">
<label for="{0}[{1}][operator]"><?php _e("Search Operator", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("AND - posts must be in each tag, OR - posts must be in any tag", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select data-field-template-name="{0}[{1}][operator]" data-field-template-id="{0}[{1}][operator]">
<option value="and"<?php $this->set_selected($values['operator'], "and"); ?>><?php _e("AND", $this->plugin_slug); ?></option>
<option value="or"<?php $this->set_selected($values['operator'], "or"); ?>><?php _e("OR", $this->plugin_slug); ?></option>
</select>
</label>
</p>
</fieldset>
<fieldset class="item-container">
<br />
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][show_count]" data-field-template-name="{0}[{1}][show_count]"<?php $this->set_checked($values['show_count']); ?>>
<label for="{0}[{1}][show_count]"><?php _e("Display count?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("display the number of posts in each tag", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][hide_empty]" data-field-template-name="{0}[{1}][hide_empty]"<?php $this->set_checked($values['hide_empty']); ?>>
<label for="{0}[{1}][hide_empty]"><?php _e("Hide empty terms?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("hide tags with no posts/items", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_make_combobox" style="vertical-align: top;">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][combo_box]" data-field-template-name="{0}[{1}][combo_box]"<?php $this->set_checked($values['combo_box']); ?> style="vertical-align: top;margin-top:2px;">
<label for="{0}[{1}][combo_box]" style="display:inline-block;">
<?php _e("Make Combobox?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Allow for text input to find values, with autocomplete and dropdown suggest", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
<br />
<span class="sf_combobox_message" style="padding-top:10px; display:inline-block;">
<input class="" data-field-template-id="{0}[{1}][no_results_message]" data-field-template-name="{0}[{1}][no_results_message]" type="text" value="<?php echo esc_attr($values['no_results_message']); ?>">
<br /><em><?php _e("No Matches message", $this->plugin_slug); ?></em>
<span class="hint--top hint--info" data-hint="<?php _e("This message is usually displayed when there are no matches in the list - leave blank for default", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</span>
</label>
</p>
<!--<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][hierarchical]" data-field-template-name="{0}[{1}][hierarchical]"<?php $this->set_checked($values['hierarchical']); ?>>
<label for="{0}[{1}][hierarchical]"><?php _e("Hierarchical?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("show child tags underneath their parents", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>-->
<!--<p class="sf_drill_down">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][drill_down]" data-field-template-name="{0}[{1}][drill_down]"<?php $this->set_checked($values['drill_down']); ?>>
<label for="{0}[{1}][drill_down]"><?php _e("Make drill down?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("child tags will only be revealed once a parent has been selected", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>-->
</fieldset>
<div class="clear"></div>
<fieldset class="advanced-settings">
<hr />
<p class="item-container">
<label for="{0}[{1}][order_by]"><?php _e("Order terms by: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][order_by]" data-field-template-id="{0}[{1}][order_by]">
<option value="default"<?php $this->set_selected($values['order_by'], "default"); ?>><?php _e("Default", $this->plugin_slug); ?></option>
<option value="id"<?php $this->set_selected($values['order_by'], "id"); ?>><?php _e("ID", $this->plugin_slug); ?></option>
<option value="name"<?php $this->set_selected($values['order_by'], "name"); ?>><?php _e("Name", $this->plugin_slug); ?></option>
<option value="slug"<?php $this->set_selected($values['order_by'], "slug"); ?>><?php _e("Slug", $this->plugin_slug); ?></option>
<option value="count"<?php $this->set_selected($values['order_by'], "count"); ?>><?php _e("Count", $this->plugin_slug); ?></option>
<option value="term_group"<?php $this->set_selected($values['order_by'], "term_group"); ?>><?php _e("Term Group", $this->plugin_slug); ?></option>
</select>
<select data-field-template-name="{0}[{1}][order_dir]" data-field-template-id="{0}[{1}][order_dir]">
<option value="asc"<?php $this->set_selected($values['order_dir'], "asc"); ?>><?php _e("ASC", $this->plugin_slug); ?></option>
<option value="desc"<?php $this->set_selected($values['order_dir'], "desc"); ?>><?php _e("DESC", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container">
<label for="{0}[{1}][exclude_ids]"><?php _e("Exclude IDs", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("comma separated list of tag IDs to exclude", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="exclude_ids settings_exclude_ids" data-field-template-id="{0}[{1}][exclude_ids]" data-field-template-name="{0}[{1}][exclude_ids]" type="text" value="<?php echo esc_attr($values['exclude_ids']); ?>">
<input class="exclude_ids_hidden" data-field-template-id="{0}[{1}][exclude_ids_hidden]" data-field-template-name="{0}[{1}][exclude_ids]" type="hidden" value="<?php echo esc_attr($values['exclude_ids']); ?>" disabled="disabled">
</label>
<?php
$tax_obj = get_taxonomy('post_tag');
?>
<a href="#" class="dashicons-search search-tax-button button-secondary sfmodal" data-taxonomy-name="<?php echo esc_attr($tax_obj->name); ?>" data-taxonomy-label="<?php echo esc_attr($tax_obj->label); ?>"></a>
<br />
<input class="checkbox sync_include_exclude" type="checkbox" data-field-template-id="{0}[{1}][sync_include_exclude]" data-field-template-name="{0}[{1}][sync_include_exclude]"<?php $this->set_checked($values['sync_include_exclude']); ?>>
<label for="{0}[{1}][sync_include_exclude]"><?php _e("Sync with Settings?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("This will show / hide tags for this field based upon the settings from the &quot;Settings &amp; Defaults&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
</fieldset>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="tag">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
<!--</form>-->
</div>
<div class="widget-description">
<?php _e("Add a Tag Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1,224 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="widget" data-field-type="taxonomy">
<div class="widget-top">
<div class="widget-title-action">
<a class="widget-control-edit hide-if-js">
<span class="edit">Edit</span>
<span class="add">Add</span>
<span class="screen-reader-text">Taxonomy Field</span>
</a>
</div>
<div class="widget-title">
<h4><?php _e("Taxonomy", $this->plugin_slug); ?><span class="in-widget-title"></span></h4>
</div>
</div>
<div class="widget-inside">
<!--<form action="" method="post">-->
<div class="widget-content" style="position:relative;">
<a class="widget-control-advanced" href="#remove"><?php _e("Advanced settings", $this->plugin_slug); ?></a>
<fieldset class="item-container">
<p class="sf_taxonomy_name">
<label for="{0}[{1}][taxonomy_name]"><?php _e("Taxonomy: ", $this->plugin_slug); ?><br />
<?php
$args = array(
//'public' => true
);
$output = 'object';
$taxonomies = get_taxonomies( $args, $output );
//check if hierarchical, if not, do not show drill down option [this taxonomy is not hierarchical so cannot be used as a drill down widget
if(isset($taxonomies['category']))
{
unset($taxonomies['category']);
}
if(isset($taxonomies['post_tag']))
{
unset($taxonomies['post_tag']);
}
if(isset($taxonomies['nav_menu']))
{
unset($taxonomies['nav_menu']);
}
if(isset($taxonomies['link_category']))
{
unset($taxonomies['link_category']);
}
//first taxonomy
$first_tax_name = "";
$first_tax_label = "";
if(count($taxonomies)>0)
{
$i = 0;
echo '<select data-field-template-name="{0}[{1}][taxonomy_name]" class="" data-field-template-id="{0}[{1}][taxonomy_name]">';
foreach ($taxonomies as $taxonomy)
{
if($i==0)
{
$first_tax_name = $taxonomy->name;
$first_tax_label = $taxonomy->label;
}
echo '<option value="'.$taxonomy->name.'"'.$this->set_selected($values['taxonomy_name'], $taxonomy->name, false).'>'.$taxonomy->label." (".$taxonomy->name.")</option>";
$i++;
}
echo '</select>';
}
?>
</label>
</p>
<p class="sf_input_type">
<label for="{0}[{1}][input_type]"><?php _e("Input type: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][input_type]" class="" data-field-template-id="{0}[{1}][input_type]">
<!--<option value="list"<?php $this->set_selected($values['input_type'], "list"); ?>><?php _e("List", $this->plugin_slug); ?></option>-->
<option value="select"<?php $this->set_selected($values['input_type'], "select"); ?>><?php _e("Dropdown", $this->plugin_slug); ?></option>
<option value="checkbox"<?php $this->set_selected($values['input_type'], "checkbox"); ?>><?php _e("Checkbox", $this->plugin_slug); ?></option>
<option value="radio"<?php $this->set_selected($values['input_type'], "radio"); ?>><?php _e("Radio", $this->plugin_slug); ?></option>
<option value="multiselect"<?php $this->set_selected($values['input_type'], "multiselect"); ?>><?php _e("Multi-select", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p>
<label for="{0}[{1}][heading]"><?php _e("Add a heading?", $this->plugin_slug); ?><br /><input class="" data-field-template-id="{0}[{1}][heading]" data-field-template-name="{0}[{1}][heading]" type="text" value="<?php echo esc_attr($values['heading']); ?>"></label>
</p>
<p class="sf_all_items_label">
<label for="{0}[{1}][all_items_label]"><?php _e("Change All Items Label?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("override the default - e.g. &quot;All Colours&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][all_items_label]" data-field-template-name="{0}[{1}][all_items_label]" type="text" value="<?php echo esc_attr($values['all_items_label']); ?>"></label>
</p>
<p class="sf_operator">
<label for="{0}[{1}][operator]"><?php _e("Search Operator", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("AND - posts must be in each category, OR - posts must be in any category", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<select data-field-template-name="{0}[{1}][operator]" data-field-template-id="{0}[{1}][operator]">
<option value="and"<?php $this->set_selected($values['operator'], "and"); ?>><?php _e("AND", $this->plugin_slug); ?></option>
<option value="or"<?php $this->set_selected($values['operator'], "or"); ?>><?php _e("OR", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="sf_accessibility_label">
<label for="{0}[{1}][accessibility_label]"><?php _e("Add screen reader text?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("adds hidden text that will be read by screen readers - complies with WCAG 2.0", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="" data-field-template-id="{0}[{1}][accessibility_label]" data-field-template-name="{0}[{1}][accessibility_label]" type="text" value="<?php echo esc_attr($values['accessibility_label']); ?>"></label>
</p>
</fieldset>
<fieldset class="item-container">
<br />
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][show_count]" data-field-template-name="{0}[{1}][show_count]"<?php $this->set_checked($values['show_count']); ?>>
<label for="{0}[{1}][show_count]"><?php _e("Display count?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("display the number of posts in each taxonomy term", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][hide_empty]" data-field-template-name="{0}[{1}][hide_empty]"<?php $this->set_checked($values['hide_empty']); ?>>
<label for="{0}[{1}][hide_empty]"><?php _e("Hide empty terms?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("hide taxonomy terms with no posts/items", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p>
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][hierarchical]" data-field-template-name="{0}[{1}][hierarchical]"<?php $this->set_checked($values['hierarchical']); ?>>
<label for="{0}[{1}][hierarchical]"><?php _e("Hierarchical?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("show child taxonomy terms underneath their parents", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
<p class="sf_include_children">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][include_children]" data-field-template-name="{0}[{1}][include_children]"<?php $this->set_checked($values['include_children']); ?>>
<label for="{0}[{1}][include_children]"><?php _e("Include Children in Parents?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("results in child terms will also be returned when a user searches its parent", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</label>
</p>
<p class="sf_make_combobox" style="vertical-align: top;">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][combo_box]" data-field-template-name="{0}[{1}][combo_box]"<?php $this->set_checked($values['combo_box']); ?> style="vertical-align: top;margin-top:2px;">
<label for="{0}[{1}][combo_box]" style="display:inline-block;">
<?php _e("Make Combobox?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("Allow for text input to find values, with autocomplete and dropdown suggest", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
<br />
<span class="sf_combobox_message" style="padding-top:10px; display:inline-block;">
<input class="" data-field-template-id="{0}[{1}][no_results_message]" data-field-template-name="{0}[{1}][no_results_message]" type="text" value="<?php echo esc_attr($values['no_results_message']); ?>">
<br /><em><?php _e("No Matches message", $this->plugin_slug); ?></em>
<span class="hint--top hint--info" data-hint="<?php _e("This message is usually displayed when there are no matches in the list - leave blank for default", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</span>
</label>
</p>
<!--<p class="sf_drill_down">
<input class="checkbox" type="checkbox" data-field-template-id="{0}[{1}][drill_down]" data-field-template-name="{0}[{1}][drill_down]"<?php $this->set_checked($values['drill_down']); ?>>
<label for="{0}[{1}][drill_down]"><?php _e("Make drill down?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("child taxonomy terms will only be revealed once a parent has been selected", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>-->
</fieldset>
<div class="clear"></div>
<fieldset class="advanced-settings">
<hr />
<p class="item-container">
<label for="{0}[{1}][order_by]"><?php _e("Order terms by: ", $this->plugin_slug); ?><br />
<select data-field-template-name="{0}[{1}][order_by]" data-field-template-id="{0}[{1}][order_by]">
<option value="default"<?php $this->set_selected($values['order_by'], "default"); ?>><?php _e("Default", $this->plugin_slug); ?></option>
<option value="id"<?php $this->set_selected($values['order_by'], "id"); ?>><?php _e("ID", $this->plugin_slug); ?></option>
<option value="name"<?php $this->set_selected($values['order_by'], "name"); ?>><?php _e("Name", $this->plugin_slug); ?></option>
<option value="slug"<?php $this->set_selected($values['order_by'], "slug"); ?>><?php _e("Slug", $this->plugin_slug); ?></option>
<option value="count"<?php $this->set_selected($values['order_by'], "count"); ?>><?php _e("Count", $this->plugin_slug); ?></option>
<option value="term_group"<?php $this->set_selected($values['order_by'], "term_group"); ?>><?php _e("Term Group", $this->plugin_slug); ?></option>
</select>
<select data-field-template-name="{0}[{1}][order_dir]" data-field-template-id="{0}[{1}][order_dir]">
<option value="asc"<?php $this->set_selected($values['order_dir'], "asc"); ?>><?php _e("ASC", $this->plugin_slug); ?></option>
<option value="desc"<?php $this->set_selected($values['order_dir'], "desc"); ?>><?php _e("DESC", $this->plugin_slug); ?></option>
</select>
</label>
</p>
<p class="item-container">
<label for="{0}[{1}][exclude_ids]"><?php _e("Exclude IDs", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("comma separated list of category IDs to exclude", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span><br />
<input class="exclude_ids settings_exclude_ids" data-field-template-id="{0}[{1}][exclude_ids]" data-field-template-name="{0}[{1}][exclude_ids]" type="text" value="<?php echo esc_attr($values['exclude_ids']); ?>">
<input class="exclude_ids_hidden" data-field-template-id="{0}[{1}][exclude_ids_hidden]" data-field-template-name="{0}[{1}][exclude_ids]" type="hidden" value="<?php echo esc_attr($values['exclude_ids']); ?>" disabled="disabled">
</label>
<a href="#" class="dashicons-search search-tax-button button-secondary sfmodal" data-taxonomy-name="<?php echo esc_attr($first_tax_name); ?>" data-taxonomy-label="<?php echo esc_attr($first_tax_label); ?>"></a>
<br />
<input class="checkbox sync_include_exclude" type="checkbox" data-field-template-id="{0}[{1}][sync_include_exclude]" data-field-template-name="{0}[{1}][sync_include_exclude]"<?php $this->set_checked($values['sync_include_exclude']); ?>>
<label for="{0}[{1}][sync_include_exclude]"><?php _e("Sync with Settings?", $this->plugin_slug); ?><span class="hint--top hint--info" data-hint="<?php _e("This will show / hide terms for this field based upon the settings from the &quot;Settings &amp; Defaults&quot;", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span></label>
</p>
</fieldset>
<div class="clear"></div>
</div>
<br class="clear" />
<input type="hidden" data-field-template-name="{0}[{1}][type]" class="widget-id" value="taxonomy">
<div class="widget-control-actions">
<div class="alignleft">
<a class="widget-control-remove" href="#remove"><?php _e("Delete", $this->plugin_slug); ?></a> |
<a class="widget-control-close" href="#close"><?php _e("Close", $this->plugin_slug); ?></a>
</div>
<br class="clear">
</div>
<!--</form>-->
</div>
<div class="widget-description">
<?php _e("Add a Taxonomy Field to your form", $this->plugin_slug); ?>
</div>
</div>

View File

@@ -0,0 +1 @@
<?php // Silence is golden

View File

@@ -0,0 +1,120 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<li class="<?php echo $class; ?>">
<table class="settings_post_meta">
<tr>
<td>
<label for="settings_post_meta[{0}][meta_key]">
<?php
$meta_key_text_input = Search_Filter_Helper::get_option( 'meta_key_text_input' );
if($meta_key_text_input == 1 ) {
?>
<input type="text" placeholder="<?php echo esc_attr__( 'Enter a meta key', 'search-filter' ); ?>" style="width: 100%" class="meta_key" data-field-template-id="settings_post_meta[{0}][meta_key]" data-field-template-name="settings_post_meta[{0}][meta_key]" value="<?php echo esc_attr($values['meta_key']); ?>" />
<?php
} else {
$all_meta_keys = $this->get_all_post_meta_keys();
echo '<select class="meta_key" data-field-template-id="settings_post_meta[{0}][meta_key]" data-field-template-name="settings_post_meta[{0}][meta_key]">';
foreach($all_meta_keys as $v){
//$data[] = $v->meta_key;
echo '<option value="'.$v.'"'.$this->set_selected($values['meta_key'], $v, false).'>'.$v."</option>";
}
echo '</select>';
}
?>
<input type="hidden" class="meta_key_hidden" value="<?php echo $values['meta_key']; ?>" disabled="disabled" data-field-template-id="settings_post_meta[{0}][meta_key]" data-field-template-name="settings_post_meta[{0}][meta_key]" />
</label>
</td>
<td>
<label for="settings_post_meta[{0}][meta_type]">
<?php
echo '<select class="meta_type" data-field-template-id="settings_post_meta[{0}][meta_type]" data-field-template-name="settings_post_meta[{0}][meta_type]">';
echo '<option value="CHAR"'.$this->set_selected($values['meta_type'], "CHAR", false).'>char</option>';
echo '<option value="NUMERIC"'.$this->set_selected($values['meta_type'], "NUMERIC", false).'>numeric</option>';
//echo '<option value="BINARY"'.$this->set_selected($values['meta_type'], "BINARY", false).'>binary</option>';
echo '<option value="DATE"'.$this->set_selected($values['meta_type'], "DATE", false).'>date</option>';
//echo '<option value="TIME"'.$this->set_selected($values['meta_type'], "TIME", false).'>time</option>';
echo '<option value="DATETIME"'.$this->set_selected($values['meta_type'], "DATETIME", false).'>datetime</option>';
echo '<option value="TIMESTAMP"'.$this->set_selected($values['meta_type'], "TIMESTAMP", false).'>timestamp</option>';
echo '<option value="DECIMAL"'.$this->set_selected($values['meta_type'], "DECIMAL", false).'>decimal</option>';
//echo '<option value="SIGNED"'.$this->set_selected($values['meta_type'], "SIGNED", false).'>signed</option>';
//echo '<option value="UNSIGNED"'.$this->set_selected($values['meta_type'], "UNSIGNED", false).'>unsigned</option>';
echo '</select>';
?>
<input type="hidden" class="meta_type" value="<?php echo $values['meta_type']; ?>" disabled="disabled" data-field-template-id="settings_post_meta[{0}][meta_type]" data-field-template-name="settings_post_meta[{0}][meta_type]" />
</label>
</td>
<td>
<label for="{0}[{1}][meta_compare]">
<?php
echo '<select class="meta_compare" data-field-template-id="settings_post_meta[{0}][meta_compare]" data-field-template-name="settings_post_meta[{0}][meta_compare]">';
echo '<option value="e"'.$this->set_selected($values['meta_compare'], "e", false).' class="date-format-supported">= &nbsp;&nbsp;(equals)</option>';
echo '<option value="ne"'.$this->set_selected($values['meta_compare'], "ne", false).' class="date-format-supported">!= &nbsp;(not equals)</option>';
echo '<option value="lt"'.$this->set_selected($values['meta_compare'], "lt", false).' class="date-format-supported">&lt; &nbsp;&nbsp;(less than)</option>';
echo '<option value="gt"'.$this->set_selected($values['meta_compare'], "gt", false).' class="date-format-supported">&gt; &nbsp;&nbsp;(greater than)</option>';
echo '<option value="lte"'.$this->set_selected($values['meta_compare'], "lte", false).' class="date-format-supported">&lt;= &nbsp;&nbsp;(less than or equal)</option>';
echo '<option value="gte"'.$this->set_selected($values['meta_compare'], "gte", false).' class="date-format-supported">&gt;= &nbsp;&nbsp;(greater than or equal)</option>';
echo '<option value="LIKE"'.$this->set_selected($values['meta_compare'], "LIKE", false).'>like</option>';
echo '<option value="NOT LIKE"'.$this->set_selected($values['meta_compare'], "NOT LIKE", false).'>not like</option>';
//echo '<option value="IN"'.$this->set_selected($values['meta_compare'], "IN", false).'>in</option>';
//echo '<option value="NOT IN"'.$this->set_selected($values['meta_compare'], "NOT IN", false).'>not in</option>';
/* echo '<option value="BETWEEN"'.$this->set_selected($values['meta_compare'], "BETWEEN", false).'>between</option>'; */
/* echo '<option value="NOT BETWEEN"'.$this->set_selected($values['meta_compare'], "NOT BETWEEN", false).'>not between</option>'; */
echo '<option value="EXISTS"'.$this->set_selected($values['meta_compare'], "EXISTS", false).'>exists</option>';
echo '<option value="NOT EXISTS"'.$this->set_selected($values['meta_compare'], "NOT EXISTS", false).'>not exists</option>';
echo '</select>';
?>
<input type="hidden" name="settings_post_meta[{0}][meta_compare]" class="meta_compare" value="<?php echo $values['meta_compare']; ?>" disabled="disabled" data-field-template-name="settings_post_meta[{0}][meta_compare]" />
</label>
</td>
<td width="170">
<div class="meta_value_c">
<input type="text" class="meta_value" value="<?php echo $values['meta_value']; ?>" data-field-template-id="settings_post_meta[{0}][meta_value]" data-field-template-name="settings_post_meta[{0}][meta_value]" />
</div>
<div class="meta_value_date_c">
<input type="text" maxlength="8" placeholder="YYYYMMDD" class="meta_date_value_date" value="<?php echo $values['meta_date_value_date']; ?>" data-field-template-id="settings_post_meta[{0}][meta_date_value_date]" data-field-template-name="settings_post_meta[{0}][meta_date_value_date]" />
<br />
<label for="settings_post_meta[{0}][meta_date_value_current_date]">
<input type="checkbox" class="meta_date_value_current_date" data-field-template-id="settings_post_meta[{0}][meta_date_value_current_date]" data-field-template-name="settings_post_meta[{0}][meta_date_value_current_date]" <?php $this->set_checked($values['meta_date_value_current_date']); ?>>
<?php echo __('Current Date', $this->plugin_slug); ?>
<span class="hint--top hint--info" data-hint="<?php _e("this meta query is always performed against the current date", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</label>
</div>
<div class="meta_value_timestamp_c">
<input type="text" placeholder="" class="meta_date_value_timestamp" value="<?php echo $values['meta_date_value_timestamp']; ?>" data-field-template-id="settings_post_meta[{0}][meta_date_value_timestamp]" data-field-template-name="settings_post_meta[{0}][meta_date_value_timestamp]" />
<br />
<label for="settings_post_meta[{0}][meta_date_value_current_timestamp]">
<input type="checkbox" class="meta_date_value_current_timestamp" data-field-template-id="settings_post_meta[{0}][meta_date_value_current_timestamp]" data-field-template-name="settings_post_meta[{0}][meta_date_value_current_timestamp]" <?php $this->set_checked($values['meta_date_value_current_timestamp']); ?>>
<?php echo __('Current Time', $this->plugin_slug); ?>
<span class="hint--top hint--info" data-hint="<?php _e("this meta query is always performed against the current time (NOW)", $this->plugin_slug); ?>"><i class="dashicons dashicons-info"></i></span>
</label>
</div>
</td>
<td>
<a href="#" class="option-remove">Remove</a>
</td>
</tr>
</table>
</li>

View File

@@ -0,0 +1,108 @@
<?php
/**
* Fired during plugin activation
*
* @link https://searchandfilter.com
* @since 1.0.0
*
* @package
* @subpackage
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Activator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'wp_initialize_site', array( $this, 'init_new_site_dbs' ) );
}
public function init_new_site_dbs( $new_site ) {
if ( is_a( $new_site, 'WP_Site' ) ) {
if ( is_plugin_active_for_network( 'search-filter-pro/search-filter-pro.php' ) ) {
switch_to_blog( $new_site->blog_id );
$this->db_install();
restore_current_blog();
}
}
}
public function activate( $network_wide ) {
global $wpdb;
if ( is_multisite() && $network_wide ) {
// store the current blog id
$current_blog = $wpdb->blogid;
// Get all blogs in the network and activate plugin on each one
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
$this->db_install();
restore_current_blog();
}
} else {
// check for existence of caching database, if not install it
$this->db_install();
}
}
function db_install() {
global $wpdb;
$table_name = $wpdb->prefix . 'search_filter_cache';
$charset_collate = '';
if ( $wpdb->has_cap( 'collation' ) ) {
$charset_collate = $wpdb->get_charset_collate();
}
$sql = "CREATE TABLE $table_name (
id bigint(20) NOT NULL AUTO_INCREMENT,
post_id bigint(20) NOT NULL,
post_parent_id bigint(20) NOT NULL,
field_name varchar(255) NOT NULL,
field_value varchar(255) NOT NULL,
field_value_num bigint(20) NULL,
field_parent_num bigint(20) NULL,
term_parent_id bigint(20) NULL,
PRIMARY KEY (id),
KEY sf_c_field_name_index (field_name(32)),
KEY sf_c_field_value_index (field_value(32)),
KEY sf_c_field_value_num_index (field_value_num)
) $charset_collate;";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta( $sql );
$table_name = $wpdb->prefix . 'search_filter_term_results';
$sql = "CREATE TABLE $table_name (
id bigint(20) NOT NULL AUTO_INCREMENT,
field_name varchar(255) NOT NULL,
field_value varchar(255) NOT NULL,
field_value_num bigint(20) NULL,
result_ids mediumtext NOT NULL,
PRIMARY KEY (id),
KEY sf_tr_field_name_index (field_name(32)),
KEY sf_tr_field_value_index (field_value(32)),
KEY sf_tr_field_value_num_index (field_value_num)
) $charset_collate;";
dbDelta( $sql );
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Fired during plugin deactivation
*
* @link https://searchandfilter.com
* @since 1.0.0
*
* @package
* @subpackage
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Deactivator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function deactivate() {
}
}

View File

@@ -0,0 +1,289 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Helper {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static $log_time_start = array();
public static $log_time_finish = array();
public static $log_time_total = array();
public static $log_time_running = array();
public static $has_wpml_checked = false;
public static $has_wpml = false;
public static $extensions = array();
public function __construct() {
}
public static function start_log( $name = '' ) {
self::$log_time_start[ $name ] = microtime( true );
}
public static function log( $str = '' ) {
/*
echo "<pre>";
echo $str;
echo "</pre>";
echo "<hr />";*/
// <br />********************************<br />";
}
public static function finish_log( $name = '', $display = true, $important = false ) {
self::$log_time_finish[ $name ] = microtime( true );
self::$log_time_total[ $name ] = self::$log_time_finish[ $name ] - self::$log_time_start[ $name ];
if ( $display ) {
self::print_log( $name, false, $important );
} else {
return self::$log_time_total[ $name ];
}
}
public static function add_time_running( $name = '', $name_to_add = '', $display = false ) {
if ( ! isset( self::$log_time_running[ $name ] ) ) {
self::$log_time_running[ $name ] = 0;
}
self::$log_time_running[ $name ] += self::$log_time_total[ $name_to_add ];
if ( $display ) {
self::print_log( $name, true, $important );
}
}
public static function get_time_running( $name = '', $display = true, $important = false ) {
if ( ! isset( self::$log_time_running[ $name ] ) ) {
self::$log_time_running[ $name ] = 0;
}
if ( $display ) {
self::print_log( $name, true, $important );
}
}
public static function print_log( $name = '', $running = false, $important = false ) {
if ( $important ) {
echo '<strong>';
}
if ( ! $running ) {
$time_var = self::$log_time_total[ $name ];
} else {
$time_var = self::$log_time_running[ $name ];
}
echo "SFLOG | $name: " . round( $time_var, 3 ) . ' seconds
<br />********************************<br />';
if ( $important ) {
echo '</strong>';
}
}
// Search_Filter_Helper::json_encode()
public static function json_encode( $obj ) {
if ( function_exists( 'wp_json_encode' ) ) {// introduced WP 4.1
return wp_json_encode( $obj );
} else {
return json_encode( $obj );
}
/*
else
{
return false;
}*/
}
public static function has_wpml() {
// filter is for WPML v 3.5 and over
// keep icl_object as a check for older WPML and also other plugins which declare the same functions for compatibility
if ( ! self::$has_wpml_checked ) {
self::$has_wpml_checked = true;
/*
if(self::has_polylang())
{
self::$has_wpml = true;
}
else {*/
if ( ( has_filter( 'wpml_object_id' ) || ( function_exists( 'icl_object_id' ) ) ) ) {
self::$has_wpml = true;
}
// }
}
return self::$has_wpml;
}
public static function wpml_current_language() {
if ( ! self::has_wpml() ) {
return false;
}
$current_language_code = apply_filters( 'wpml_current_language', null );
return $current_language_code;
}
public static function has_polylang() {
// global $polylang;
if ( defined( 'POLYLANG_VERSION' ) ) {
// if(isset($polylang)) {
return true;
}
return false;
}
public static function has_woocommerce() {
if ( class_exists( 'woocommerce' ) ) {
return true;
} else {
return false;
}
}
public static function has_custom_layouts() {
if ( class_exists( 'Custom_Layouts' ) ) {
return true;
} else {
return false;
}
}
public static function has_dynamic_ooo() {
if ( defined( 'DCE_VERSION' ) ) {
if ( version_compare( DCE_VERSION, '1.9.6.7.2', '>=' ) ) {
return true;
}
}
return false;
}
public static function wc_get_page_id( $page_name = '' ) {
if ( function_exists( 'wc_get_page_id' ) ) {
return wc_get_page_id( $page_name );
} elseif ( function_exists( 'woocommerce_get_page_id' ) ) {
return woocommerce_get_page_id( $page_name );
}
return false;
}
public static function wpml_object_id( $id = 0, $type = '', $return_original = '', $lang_code = '' ) {
$lang_id = 0;
if ( has_filter( 'wpml_object_id' ) ) {
if ( $lang_code != '' ) {
$lang_id = apply_filters( 'wpml_object_id', $id, $type, $return_original, $lang_code );
} else {
$lang_id = apply_filters( 'wpml_object_id', $id, $type, $return_original );
}
} elseif ( function_exists( 'icl_object_id' ) ) {
if ( $lang_code != '' ) {
$lang_id = icl_object_id( $id, $type, $return_original, $lang_code );
} else {
$lang_id = icl_object_id( $id, $type, $return_original );
}
}
return $lang_id;
}
public static function wpml_post_language_details( $post_id = 0 ) {
$lang_details = array();
if ( has_filter( 'wpml_post_language_details' ) ) {
$lang_details = apply_filters( 'wpml_post_language_details', '', $post_id );
} elseif ( function_exists( 'wpml_get_language_information' ) ) {
$lang_details = wpml_get_language_information( $post_id );
}
return $lang_details;
}
public static function wpml_post_language_code( $post_id ) {
// if its actually polylang use their function instead
if ( ( self::has_polylang() ) && ( function_exists( 'pll_get_post_language' ) ) ) {
return pll_get_post_language( $post_id );
}
$lang_details = self::wpml_post_language_details( $post_id );
if ( $lang_details ) {
return $lang_details['language_code'];
} else {
return '';
}
}
public static function get_settings_meta( $sfid ) {
$settings = get_post_meta( $sfid, '_search-filter-settings', true );
if ( ! is_array( $settings ) ) {
$settings = array();
}
if ( ! isset( $settings['results_url'] ) ) {
$settings['results_url'] = '';
$results_url = get_post_meta( $sfid, '_search-filter-results-url', true );
if ( ! empty( $results_url ) ) {
$settings['results_url'] = $results_url;
}
}
if ( ! isset( $settings['enable_taxonomy_archives'] ) ) {
$settings['enable_taxonomy_archives'] = 0;
}
return $settings;
}
public static function get_fields_meta( $sfid ) {
$fields = get_post_meta( $sfid, '_search-filter-fields', true );
return $fields;
}
public static function get_option( $option_name ) {
$option = get_option( 'search_filter_' . $option_name );
if ( $option === false ) {
// this means its not been set yet
// then init with a default
$option = '';
$defaults = array(
'cache_speed' => 'slow',
'cache_use_manual' => 0,
'cache_use_background_processes' => 1,
'cache_use_transients ' => 0,
'load_jquery_i18n' => 0,
'lazy_load_js' => 0,
'load_js_css' => 1,
'combobox_script' => 'chosen',
'remove_all_data' => 0,
'meta_key_text_input' => 0,
);
if ( isset( $defaults[ $option_name ] ) ) {
$option = $defaults[ $option_name ];
}
}
return $option;
}
public static function get_table_name( $table_name = '' ) {
global $wpdb;
return $wpdb->prefix . $table_name;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,125 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter_Widget
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Register_Widget extends WP_Widget {
/*
public function __construct()
{
$plugin = Search_Filter::get_instance();
$this->plugin_slug = $plugin->get_plugin_slug();
//register_widget('search_filter_widget');
}*/
public function __construct() {
// Instantiate the parent object
parent::__construct( false, 'Search & Filter Form' );
// $plugin = Search_Filter::get_instance();
$this->plugin_slug = 'search-filter';
}
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
echo $before_widget; // Widget starts to print information
// Check if title is set
if ( $title ) {
echo $before_title . $title . $after_title;
}
$formid = apply_filters( 'widget_title', $instance['formid'] );
echo do_shortcode( '[searchandfilter id="' . $formid . '"]' );
echo $after_widget; // Widget ends printing information
// do_shortcode('[searchandfilter id="11"]');
}
function update( $new_instance, $old_instance ) {
// Save widget options
$instance = $old_instance;
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
$instance['formid'] = ( ! empty( $new_instance['formid'] ) ) ? strip_tags( $new_instance['formid'] ) : '';
return $instance;
}
function form( $instance ) {
if ( ( isset( $instance['title'] ) ) && ( isset( $instance['formid'] ) ) ) {
$title = __( esc_attr( $instance['title'] ), $this->plugin_slug );
$formid = esc_attr( $instance['formid'] );
} else {
$title = __( '', $this->plugin_slug );
$formid = __( '', $this->plugin_slug );
}
?>
<div class="sf-widget-content">
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<p>
<label for="<?php echo $this->get_field_id( 'formid' ); ?>">Choose a Search Form:
<select class="widefat" name="<?php echo $this->get_field_name( 'formid' ); ?>" id="<?php echo $this->get_field_id( 'formid' ); ?>">
<option value="0"><?php _e( 'Please choose' ); ?></option>
<?php
$custom_posts = new WP_Query( 'post_type=search-filter-widget&post_status=publish&posts_per_page=-1' );
if ( Search_Filter_Helper::has_wpml() ) {
$current_lang = Search_Filter_Helper::wpml_current_language();
if ( $current_lang ) {
$formid = Search_Filter_Helper::wpml_object_id( $formid, 'search-filter-widget', true, $current_lang );
}
}
if ( $custom_posts->post_count > 0 ) {
foreach ( $custom_posts->posts as $post ) {
?>
<option value="<?php echo $post->ID; ?>"
<?php
if ( $formid == $post->ID ) {
echo ' selected="selected"'; }
?>
><?php echo esc_html( $post->post_title ); ?></option>
<?php
}
}
/*
while ($custom_posts->have_posts()) : $custom_posts->the_post();
?>
<option value="<?php the_ID(); ?>" <?php if($formid==get_the_ID()){ echo ' selected="selected"'; } ?>><?php the_title(); ?></option>
<?php endwhile; ?>
<?php wp_reset_postdata();*/
?>
</select>
</label>
</p>
<!--<p class="sf-widget-text-last">
<?php _e( 'Don\'t see a Search Form you want to use? <a href="' . admin_url( 'post-new.php?post_type=search-filter-widget' ) . '">Create a new Search Form</a>.' ); ?>
</p>-->
</div>
<?php
}
}

View File

@@ -0,0 +1,152 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter_Post_Cache
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Shared {
private $plugin_slug = 'search-filter';
public function __construct() {
global $wpdb;
add_action( 'init', array( $this, 'create_custom_post_types' ) );
add_action( 'widgets_init', array( $this, 'init_widget' ) );
add_filter( 'rewrite_rules_array', array( $this, 'sf_rewrite_rules' ) );
// Load plugin text domain
add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
}
public function create_custom_post_types() {
$labels = array(
'name' => __( 'Search &amp; Filter', $this->plugin_slug ),
'singular_name' => __( 'Search Form', $this->plugin_slug ),
'add_new' => __( 'Add New Search Form', $this->plugin_slug ),
'add_new_item' => __( 'Add New Search Form', $this->plugin_slug ),
'edit_item' => __( 'Edit Search Form', $this->plugin_slug ),
'new_item' => __( 'New Search Form', $this->plugin_slug ),
'view_item' => __( 'View Search Form', $this->plugin_slug ),
'search_items' => __( 'Search \'Search Forms\'', $this->plugin_slug ),
'not_found' => __( 'No Search Forms found', $this->plugin_slug ),
'not_found_in_trash' => __( 'No Search Forms found in Trash', $this->plugin_slug ),
);
register_post_type(
$this->plugin_slug . '-widget',
array(
'labels' => $labels,
'public' => false,
'show_ui' => true,
'_builtin' => false,
'capability_type' => 'page',
'hierarchical' => true,
'rewrite' => false,
'supports' => array( 'title' ),
'show_in_menu' => false,
/*'has_archive' => true,*/
)
);
}
public function init_widget() {
register_widget( 'Search_Filter_Register_Widget' );
}
function sf_rewrite_rules( $rules ) {
global $searchandfilter;
$newrules = array();
$args = array(
'posts_per_page' => -1,
'post_type' => $this->plugin_slug . '-widget',
'post_status' => 'publish',
);
if ( has_filter( 'sf_rewrite_query_args' ) ) {
$args = apply_filters( 'sf_rewrite_query_args', $args );
}
$all_search_forms = get_posts( $args );
foreach ( $all_search_forms as $search_form ) {
$settings = Search_Filter_Helper::get_settings_meta( $search_form->ID );
if ( isset( $settings['page_slug'] ) ) {
if ( $settings['page_slug'] != '' ) {
$base_id = $search_form->ID;
// $newrules[$settings['page_slug'].'/page/([0-9]+)/([0-9]+)$'] = 'index.php?&sfid='.$base_id.'&paged=$matches[2]&lang=$matches[1]'; //pagination & lang rule
// $newrules[$settings['page_slug'].'/page/([0-9]+)$'] = 'index.php?&sfid='.$base_id.'&paged=$matches[1]'; //pagination rule
// $newrules[$settings['page_slug'].'/page/([0-9]+)$'] = 'index.php?&sfid='.$base_id.'&paged=$matches[1]'; //pagination rule
$use_rewrite = true;
if ( isset( $settings['display_results_as'] ) ) {
if ( $settings['display_results_as'] != 'archive' ) {
$use_rewrite = false;
}
}
if ( $use_rewrite == true ) {
$newrules[ $settings['page_slug'] . '$' ] = 'index.php?&sfid=' . $base_id; // regular plain slug
if ( has_filter( 'sf_archive_slug_rewrite' ) ) {
$newrules = apply_filters( 'sf_archive_slug_rewrite', $newrules, $base_id, $settings['page_slug'] );
}
}
}
}
}
return $newrules + $rules;
}
/**
* Load the plugin text domain for translation.
*
* @since 1.0.0
*/
public function load_plugin_textdomain() {
$domain = $this->plugin_slug;
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
load_plugin_textdomain( $domain, false, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
}
/**
*
* @since 1.0.0
*
* @param int $blog_id ID of the new blog.
*/
/*
public function activate_new_site( $blog_id ) {
if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
return;
}
switch_to_blog( $blog_id );
self::single_activate();
restore_current_blog();
}*/
}

View File

@@ -0,0 +1,746 @@
<?php
/**
* Search & Filter Pro
*
* @package Search_Filter_Third_Party
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Third_Party {
private $plugin_slug = '';
private $form_data = '';
private $count_table;
private $cache;
private $relevanssi_result_ids = array();
private $query;
private $custom_layouts_query_id = 0;
private $polylang_post_types = array();
private $sfid = 0;
public $cache_table_name;
public function __construct() {
global $wpdb;
$this->cache_table_name = Search_Filter_Helper::get_table_name( 'search_filter_cache' );
$this->woocommerce = new Search_Filter_Third_Party_Woocommerce();
// frontend only, or ajax
if ( ( ! is_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// beaverbuilder themer plugin
// removes paged = 1 from pagination when its the first page, otherwise themer kicks in a scroll on page load
add_filter( 'sf_main_query_pre_get_posts', array( $this, 'sf_beaver_themer_pre_get_posts' ), 11, 2 );
// -- relevanssi
add_filter( 'sf_edit_query_args_after_custom_filter', array( $this, 'relevanssi_filter_query_args' ), 12, 2 );
add_filter( 'sf_apply_custom_filter', array( $this, 'relevanssi_add_custom_filter' ), 10, 3 );
// -- polylang
add_filter( 'sf_archive_results_url', array( $this, 'pll_sf_archive_results_url' ), 10, 3 );
add_filter( 'sf_ajax_results_url', array( $this, 'pll_sf_ajax_results_url' ), 10, 2 );
add_filter( 'sf_ajax_form_url', array( $this, 'pll_sf_form_url' ), 10, 3 );
// -- ACF + WPML - looks like WPML fixed this
// add_filter('sf_input_object_acf_field', array($this, 'acf_translate_field'), 10, 3);
if ( class_exists( 'Easy_Digital_Downloads' ) ) {
add_filter( 'shortcode_atts_downloads', array( $this, 'edd_filter_downloads_shortcode' ), 1000, 3 );
add_filter( 'do_shortcode_tag', array( $this, 'edd_filter_downloads_shortcode_output' ), 1000, 3 );
add_filter( 'search_filter_form_attributes', array( $this, 'edd_search_filter_form_attributes' ), 10, 2 );
}
if ( class_exists( 'Easy_Digital_Downloads' ) ) {
add_filter( 'shortcode_atts_downloads', array( $this, 'edd_filter_downloads_shortcode' ), 1000, 3 );
add_filter( 'do_shortcode_tag', array( $this, 'edd_filter_downloads_shortcode_output' ), 1000, 3 );
add_filter( 'search_filter_form_attributes', array( $this, 'edd_search_filter_form_attributes' ), 10, 2 );
}
// -- custom layouts
add_filter( 'shortcode_atts_custom-layout', array( $this, 'custom_layouts_shortcode_attributes' ), 1000, 3 );
add_filter( 'search_filter_form_attributes', array( $this, 'custom_layouts_search_filter_form_attributes' ), 10, 2 );
}
// -- polylang
add_filter( 'sf_edit_query_args', array( $this, 'sf_poly_query_args' ), 11, 2 );
add_filter( 'pll_get_post_types', array( $this, 'pll_sf_add_translations' ), 10, 2 );
add_filter( 'pll_get_post_types', array( $this, 'pll_sf_get_translations' ), 100000, 2 ); // try to set this as late as possible
add_filter( 'sf_edit_cache_query_args', array( $this, 'poly_lang_sf_edit_cache_query_args' ), 10, 2 );
add_filter( 'sf_edit_search_forms_query_args', array( $this, 'poly_lang_sf_edit_cache_query_args' ), 10, 2 ); // set the language when fetching our built in search forms (suppress filters no longer works)
add_filter( 'sf_archive_slug_rewrite', array( $this, 'pll_sf_archive_slug_rewrite' ), 10, 3 );
add_filter( 'sf_rewrite_query_args', array( $this, 'pll_sf_rewrite_args' ), 10, 3 );
add_filter( 'sf_pre_get_posts_admin_cache', array( $this, 'sf_pre_get_posts_admin_cache' ), 10, 3 );
add_action( 'search_filter_pre_update_post_cache', array( $this, 'sf_wpml_update_post_cache' ), 10, 2 );
if ( Search_Filter_Helper::has_dynamic_ooo() ) {
add_filter( 'search_filter_admin_option_display_results', array( $this, 'dce_filter_display_results_options' ), 10, 2 );
add_filter( 'search_filter_form_attributes', array( $this, 'dce_search_filter_form_attributes' ), 10, 2 );
}
$this->init();
}
public function acf_translate_field( $field, $field_name, $sfid ) {
if ( ! Search_Filter_Helper::has_wpml() ) {
return $field;
}
if ( ! function_exists( 'acf_get_field' ) ) {
return $field;
}
if ( $field ) {
$field_key = $field['key'];
$field_ID = $field['ID'];
// now try to find the translated versino
$field_group_id = wp_get_post_parent_id( $field_ID );
if ( $field_group_id ) {
$translated_group_id = Search_Filter_Helper::wpml_object_id( $field_group_id, 'acf-field-group', true );
if ( $translated_group_id ) {
global $wpdb;
$result = $wpdb->get_row(
$wpdb->prepare( "SELECT ID FROM {$wpdb->prefix}posts WHERE post_excerpt='%s' AND post_parent='%d'", $field_name, $translated_group_id )
);
if ( $result ) {
$translated_field = acf_get_field( $result->ID );
if ( $translated_field ) {
$field = $translated_field;
}
}
}
}
}
return $field;
}
public function custom_layouts_shortcode_attributes( $out, $pairs, $atts ) {
if ( ! isset( $atts['search_filter_id'] ) ) {
return $out;
}
$this->custom_layouts_query_id = absint( $atts['search_filter_id'] );
add_filter( 'custom-layouts\layout\query_args', array( $this, 'custom_layouts_add_sf_query' ) );
remove_filter( 'shortcode_atts_custom-layouts', array( $this, 'custom_layouts_shortcode_attributes' ), 1000, 3 );
$out['cache'] = 'no'; // disable query caching and handle within S&F
return $out;
}
public function custom_layouts_add_sf_query( $query_args ) {
if ( $this->custom_layouts_query_id !== 0 ) {
$query_args['search_filter_id'] = $this->custom_layouts_query_id;
$this->custom_layouts_query_id = 0;
}
remove_filter( 'custom-layouts\layout\query_args', array( $this, 'custom_layouts_add_sf_query' ) );
return $query_args;
}
public function init() {
}
/* EDD integration */
public function edd_filter_downloads_shortcode( $out, $pairs, $atts ) {
if ( ! isset( $atts['search_filter_id'] ) ) {
return $out;
}
$search_filter_id = intval( $atts['search_filter_id'] );
do_shortcode( "[searchandfilter id='$search_filter_id' action='filter_next_query']" );
// do_action("search_filter_setup_pagination", $search_filter_id);
global $searchandfilter;
$sf_inst = $searchandfilter->get( $search_filter_id );
$sf_inst->query->prep_query();
return $out;
}
public function edd_filter_downloads_shortcode_output( $output, $tag, $atts ) {
if ( ! isset( $atts['search_filter_id'] ) ) {
return $output;
}
if ( $tag !== 'downloads' ) {
return $output;
}
global $searchandfilter;
$search_filter_id = intval( $atts['search_filter_id'] );
$sf_inst = $searchandfilter->get( $search_filter_id );
// make sure this search form is tyring to use EDD
if ( $sf_inst->settings( 'display_results_as' ) == 'custom_edd_store' ) {
// wrap both pagination + results in 1 container for ajax
$output = '<div class="search-filter-results search-filter-results-' . $search_filter_id . '">' . $output . '</div>';
}
return $output;
}
public function edd_search_filter_form_attributes( $attributes, $sfid ) {
if ( isset( $attributes['data-display-result-method'] ) ) {
if ( $attributes['data-display-result-method'] == 'custom_edd_store' ) {
$attributes['data-ajax-target'] = '.search-filter-results-' . $sfid;
// for fixing pagination issue when there are multiple instance of the S&F.
$attributes['data-ajax-links-selector'] = '.search-filter-results-' . $sfid . ' .edd_pagination a';
}
}
return $attributes;
}
public function custom_layouts_search_filter_form_attributes( $attributes, $sfid ) {
if ( isset( $attributes['data-display-result-method'] ) ) {
if ( $attributes['data-display-result-method'] == 'custom_layouts' ) {
$attributes['data-ajax-target'] = '.search-filter-results-' . $sfid;
if ( defined( 'CUSTOM_LAYOUTS_VERSION' ) && version_compare( CUSTOM_LAYOUTS_VERSION, '1.3.2-beta', '<' ) ) {
$attributes['data-ajax-target'] = '.cl-layout-container';
}
// for fixing pagination issue when there are multiple instance of the S&F.
$attributes['data-ajax-links-selector'] = '.search-filter-results-' . $sfid . ' .cl-pagination a';
}
}
return $attributes;
}
public function dce_search_filter_form_attributes( $attributes, $sfid ) {
if ( isset( $attributes['data-display-result-method'] ) ) {
$search_filter_results_class = '.search-filter-results-' . absint( $sfid );
if ( $attributes['data-display-result-method'] == 'custom_dce_posts' ) {
$attributes['data-ajax-target'] = '.elementor-widget-dce-dynamicposts-v2' . $search_filter_results_class;
if ( defined( 'DCE_VERSION' ) && version_compare( DCE_VERSION, '1.13.0', '<' ) ) {
$attributes['data-ajax-target'] = '.dce-posts-container';
}
// for fixing pagination issue when there are multiple instance of the S&F.
$attributes['data-ajax-links-selector'] = '.elementor-widget-dce-dynamicposts-v2' . $search_filter_results_class . ' .dce-pagination a';
if ( isset( $attributes['data-infinite-scroll-result-class'] ) ) {
unset( $attributes['data-infinite-scroll-result-class'] );
}
if ( isset( $attributes['data-ajax-pagination-type'] ) ) {
unset( $attributes['data-ajax-pagination-type'] );
}
if ( isset( $attributes['data-infinite-scroll-container'] ) ) {
unset( $attributes['data-infinite-scroll-container'] );
}
} elseif ( $attributes['data-display-result-method'] == 'custom_dce_google_maps' ) {
$attributes['data-ajax-target'] = '.elementor-widget-dyncontel-acf-google-maps' . $search_filter_results_class;
// for fixing pagination issue when there are multiple instance of the S&F.
$attributes['data-ajax-links-selector'] = '.elementor-widget-dyncontel-acf-google-maps' . $search_filter_results_class . ' .dce-pagination a';
if ( isset( $attributes['data-infinite-scroll-result-class'] ) ) {
unset( $attributes['data-infinite-scroll-result-class'] );
}
if ( isset( $attributes['data-ajax-pagination-type'] ) ) {
unset( $attributes['data-ajax-pagination-type'] );
}
if ( isset( $attributes['data-infinite-scroll-container'] ) ) {
unset( $attributes['data-infinite-scroll-container'] );
}
} elseif ( $attributes['data-display-result-method'] == 'custom_dce_google_maps_posts' ) {
$attributes['data-ajax-target'] = '.elementor-widget-dyncontel-acf-google-maps' . $search_filter_results_class;
// for fixing pagination issue when there are multiple instance of the S&F.
$attributes['data-ajax-links-selector'] = '.elementor-widget-dyncontel-acf-google-maps' . $search_filter_results_class . ' .dce-pagination a';
// we want additional areas to be udpated with ajax:
$attributes['data-ajax-update-sections'] = wp_json_encode(
array(
'.elementor-widget-dce-dynamicposts-v2' . $search_filter_results_class,
)
);
if ( isset( $attributes['data-infinite-scroll-result-class'] ) ) {
unset( $attributes['data-infinite-scroll-result-class'] );
}
if ( isset( $attributes['data-ajax-pagination-type'] ) ) {
unset( $attributes['data-ajax-pagination-type'] );
}
if ( isset( $attributes['data-infinite-scroll-container'] ) ) {
unset( $attributes['data-infinite-scroll-container'] );
}
}
}
return $attributes;
}
public function dce_filter_display_results_options( $display_results_methods ) {
$display_results_methods['custom_dce_posts'] = array(
'label' => __( 'Dynamic.ooo: Posts' ),
'description' =>
'<p>' . __( 'Use the powerful Dynamic Posts v2 widget for Elementor to create any kind of layout you can imagine.', $this->plugin_slug ) . '</p>' .
'<p><a href="https://searchandfilter.com/documentation/3rd-party/dynamic-content-elementor/" target="_blank">' . __( 'View the setup instructions', $this->plugin_slug ) . '</a></p>',
'base' => 'shortcode',
);
if ( version_compare( DCE_VERSION, '1.13.0', '>=' ) ) {
$display_results_methods['custom_dce_google_maps'] = array(
'label' => __( 'Dynamic.ooo: Google Maps' ),
'description' =>
'<p>' . __( 'Use the powerful Dynamic Google Maps widget for Elementor to create advanced searches that work with your maps!', $this->plugin_slug ) . '</p>' .
'<p><a href="https://searchandfilter.com/documentation/3rd-party/dynamic-content-elementor/" target="_blank">' . __( 'View the setup instructions', $this->plugin_slug ) . '</a></p>',
'base' => 'shortcode',
);
}
if ( version_compare( DCE_VERSION, '1.13.0', '>=' ) ) {
$display_results_methods['custom_dce_google_maps_posts'] = array(
'label' => __( 'Dynamic.ooo: Posts + Google Maps' ),
'description' =>
'<p>' . __( 'Use the powerful Dynamic Google Maps widget combined with a Dynamic Posts widget to create advanced searches that work with your maps + posts at the same time!', $this->plugin_slug ) . '</p>' .
'<p><a href="https://searchandfilter.com/documentation/3rd-party/dynamic-content-elementor/" target="_blank">' . __( 'View the setup instructions', $this->plugin_slug ) . '</a></p>',
'base' => 'shortcode',
);
}
return $display_results_methods;
}
// update all the translations too (in case they were auto updated / synced by )
// the advanced tranlsation editor
public function sf_wpml_update_post_cache( $post ) {
if ( ! Search_Filter_Helper::has_wpml() ) {
return;
}
// $post_lang_code = Search_Filter_Helper::wpml_post_language_code($post_id);
$element_type = 'post_' . $post->post_type;
$translation_group_id = apply_filters( 'wpml_element_trid', null, $post->ID, $element_type );
$translations = apply_filters( 'wpml_get_element_translations', null, $translation_group_id, $element_type );
// $lang_details = apply_filters( 'wpml_post_language_details', "", $post->ID );
$current_lang_code = strtolower( Search_Filter_Helper::wpml_post_language_code( $post->ID ) );
if ( is_array( $translations ) ) {
foreach ( $translations as $translation ) {
$translation_lang = strtolower( $translation->language_code );
// don't update the current post, because we're already doing it
if ( $translation_lang !== $current_lang_code ) {
if ( ( $current_lang_code !== '' ) && ( ! empty( $current_lang_code ) ) ) {
do_action( 'wpml_switch_language', $translation_lang );
// don't infinite loop...
remove_action( 'search_filter_pre_update_post_cache', array( $this, 'sf_wpml_update_post_cache' ), 10, 2 );
do_action( 'search_filter_update_post_cache', $translation->element_id );
add_action( 'search_filter_pre_update_post_cache', array( $this, 'sf_wpml_update_post_cache' ), 10, 2 ); }
}
}
}
do_action( 'wpml_switch_language', $current_lang_code );
}
// this is the last stage to modify the query, it doesn't modify anything relating to auto count or hte cache, only
// the main query which is holding the actual results
public function sf_beaver_themer_pre_get_posts( $query, $sfid ) {
if ( ! class_exists( 'FLThemeBuilderLoader' ) ) {
return $query;
}
if ( ! $query->is_main_query() ) {
return $query;
}
if ( isset( $query->query_vars['search_filter_id'] ) ) {
if ( $query->get( 'paged' ) == 1 ) {
$query->set( 'paged', 0 );
}
}
return $query;
}
// public function sf_edd_fes_field_save_frontend($field, $save_id, $value, $user_id)
public function sf_edd_fes_field_save_frontend( $field, $save_id, $value ) {
// FES has an issue where the same filter is used but with 3 args or 4 args
// if the field is a digit, then actually this is the ID
$post_id = 0;
if ( ctype_digit( $field ) ) {
$post_id = $field;
} elseif ( ctype_digit( $save_id ) ) {
$post_id = $save_id;
}
// do_action('search_filter_update_post_cache', $save_id);
}
public function sf_edd_fes_submission_form_published( $post_id ) {
do_action( 'search_filter_update_post_cache', $post_id );
}
/* EDD integration */
public function edd_prep_downloads_sf_query( $query, $atts ) {
return $query;
}
// polylang integration
// tells polylang that the post type `search-filter-widget` should be translatable
public function pll_sf_add_translations( $types, $hide ) {
$types['search-filter-widget'] = 'search-filter-widget';
return $types;
}
public function pll_sf_get_translations( $types, $hide ) {
$this->polylang_post_types = $types;
return $types;
}
public function sf_poly_query_args( $query_args, $sfid ) {
global $searchandfilter;
$sf_inst = $searchandfilter->get( $sfid );
if ( Search_Filter_Helper::has_polylang() ) {
// manually set language of our query, based on the lang of the S&F post (this is because ajax requests don't get a lang set, which only occurs on this display method
// if($sf_inst->settings("display_results_as")=="shortcode") {
$terms = wp_get_post_terms( $sfid, 'language', array( 'fields' => 'all' ) );
$terms_arr = array(); // this shold only ever have 1 value, as a post can only be in 1 lang at a time
// but lets support it anyway
foreach ( $terms as $term ) {
array_push( $terms_arr, $term->slug );
}
// check to see if hte language we are searching, is being handles by polylang
$post_types_arr = $sf_inst->settings( 'post_types' );
$post_types = array();
if ( is_array( $post_types_arr ) ) {
$post_types = array_keys( $post_types_arr );
}
$polylang_post_types = array_keys( $this->polylang_post_types );
$intersect = array_intersect( $post_types, $polylang_post_types );
if ( count( $intersect ) > 0 ) {
$query_args['lang'] = implode( ',', $terms_arr );
}
// otherwise, don't set the lang of course, because the posts certainly won't have a lang attribute (yet)
// there will be problems however, if a user is searching multiple post types, some of which are handles by polylang
// some not, in this case, all language must be set to be handled by polylang for consistency
// }
}
return $query_args;
}
public function poly_lang_sf_edit_cache_query_args( $query_args, $sfid ) {
if ( Search_Filter_Helper::has_polylang() ) {
/*
$langs = array();
global $polylang;
foreach ($polylang->model->get_languages_list() as $term)
{
array_push($langs, $term->slug);
}
//$query_args["lang"] = $langs;
//$query_args["lang"] = implode(",", $langs);
*/
// this sets a query for all languages (seems to changes quite often, the above was the old method of include all languages)
$query_args['lang'] = '';
}
return $query_args;
}
public function sf_pre_get_posts_admin_cache( $query, $sfid ) {
if ( Search_Filter_Helper::has_polylang() ) {
$query->set( 'lang', 'all' );
}
return $query;
}
public function add_url_args( $url, $str ) {
$query_arg = '?';
if ( strpos( $url, '?' ) !== false ) {
// url has a question mark
$query_arg = '&';
}
return $url . $query_arg . $str;
}
public function pll_sf_rewrite_args( $args ) {
// if((function_exists('pll_home_url'))&&(function_exists('pll_current_language')))
if ( Search_Filter_Helper::has_polylang() ) {
$args['lang'] = '';
}
return $args;
}
public function pll_sf_archive_slug_rewrite( $newrules, $sfid, $page_slug ) {
// if((function_exists('pll_home_url'))&&(function_exists('pll_current_language')))
if ( Search_Filter_Helper::has_polylang() ) {
// takes into account language prefix
// $newrules = array();
$newrules[ '([a-zA-Z0-9_-]+)/' . $page_slug . '$' ] = 'index.php?&sfid=' . $sfid; // regular plain slug
}
return $newrules;
}
public function pll_sf_ajax_results_url( $ajax_url, $sfid ) {
if ( ( function_exists( 'pll_home_url' ) ) && ( function_exists( 'pll_current_language' ) ) ) {
global $searchandfilter;
$sf_inst = $searchandfilter->get( $sfid );
// these are the display results methods that use the current url for ajax
// we want to do it this way, to allow other display methods (like VC / ajax integration) to carry on working
// $retain_results_methods = array("archive", "post_type_archive", "custom", "custom_woocommerce_store", "custom_edd_store", "bb_posts_module", "divi_post_module", "divi_shop_module", "elementor_posts_element","custom_layouts","custom_dce_posts");
// todo - need to add extensions via external plugin
if ( $sf_inst->settings( 'display_results_as' ) !== 'shortcode' ) {
// so don't modify the ajax url, it will have the lang in there
return $ajax_url;
} else {
// if we are doing an ajax request, make sure we are including the proper home url, with lang `/en`
// allow sf_data to remain the same value
$sf_data = 'all';
$url_parts = parse_url( $ajax_url );
if ( isset( $url_parts['query'] ) ) {
parse_str( $url_parts['query'], $url_vars );
if ( isset( $url_vars['sf_data'] ) ) {
$sf_data = $url_vars['sf_data'];
}
}
// if ( $sf_inst->settings( "display_results_as" ) == "shortcode" ) {
if ( get_option( 'permalink_structure' ) ) {
$home_url = trailingslashit( pll_home_url() );
$ajax_url = $this->add_url_args( $home_url, "sfid=$sfid&sf_action=get_data&sf_data=$sf_data" );
} else {
$ajax_url = $this->add_url_args( pll_home_url(), "sfid=$sfid&sf_action=get_data&sf_data=$sf_data" );
}
}
}
return $ajax_url;
}
public function pll_sf_archive_results_url( $results_url, $sfid, $page_slug = '' ) {
if ( ( function_exists( 'pll_home_url' ) ) && ( function_exists( 'pll_current_language' ) ) ) {
$results_url = pll_home_url( pll_current_language() );
if ( get_option( 'permalink_structure' ) ) {
if ( $page_slug != '' ) {
$results_url = trailingslashit( trailingslashit( $results_url ) . $page_slug );
} else {
$results_url = trailingslashit( $results_url );
$results_url = $this->add_url_args( $results_url, "sfid=$sfid" );
}
} else {
if ( strpos( $results_url, '?' ) !== false ) {
$param = '&';
} else {
$param = '?';
}
$results_url .= $param . 'sfid=' . $sfid;
}
}
return $results_url;
}
public function pll_sf_form_url( $results_url, $sfid, $page_slug = '' ) {
if ( ( function_exists( 'pll_home_url' ) ) && ( function_exists( 'pll_current_language' ) ) ) {
$results_url = pll_home_url( pll_current_language() );
if ( get_option( 'permalink_structure' ) ) {
$results_url = trailingslashit( $results_url );
$results_url = $this->add_url_args( $results_url, "sfid=$sfid" );
$results_url = $this->add_url_args( $results_url, 'sf_action=get_data' );
$results_url = $this->add_url_args( $results_url, 'sf_data=form' );
} else {
$results_url = $this->add_url_args( $results_url, "sfid=$sfid" );
$results_url = $this->add_url_args( $results_url, 'sf_action=get_data' );
$results_url = $this->add_url_args( $results_url, 'sf_data=form' );
// $results_url .= "&sfid=".$sfid;
}
}
return $results_url;
}
/* Relevanssi integration */
public function remove_relevanssi_defaults() {
// relevanssi free + older premium
remove_filter( 'the_posts', 'relevanssi_query' );
remove_filter( 'posts_request', 'relevanssi_prevent_default_request', 9 );
remove_filter( 'posts_request', 'relevanssi_prevent_default_request' );
// new premium
remove_filter( 'the_posts', 'relevanssi_query', 99 );
remove_filter( 'posts_request', 'relevanssi_prevent_default_request', 10 );
remove_filter( 'query_vars', 'relevanssi_query_vars' );
}
public function relevanssi_filter_query_args( $query_args, $sfid ) {
// always remove normal relevanssi behaviour
$this->remove_relevanssi_defaults();
global $searchandfilter;
$sf_inst = $searchandfilter->get( $sfid );
if ( $sf_inst->settings( 'use_relevanssi' ) == 1 ) {// ensure it is enabled in the admin
if ( isset( $query_args['s'] ) ) {// only run if a search term has actually been set
if ( trim( $query_args['s'] ) != '' ) {
$search_term = $query_args['s'];
$query_args['s'] = '';
}
}
}
return $query_args;
}
public function relevanssi_sort_result_ids( $result_ids, $query_args, $sfid ) {
global $searchandfilter;
$sf_inst = $searchandfilter->get( $sfid );
if ( count( $result_ids ) == 1 ) {
if ( isset( $result_ids[0] ) ) {
if ( $result_ids[0] == 0 ) {
return $result_ids;
}
}
}
if ( ( $sf_inst->settings( 'use_relevanssi' ) == 1 ) && ( $sf_inst->settings( 'use_relevanssi_sort' ) == 1 ) ) {// ensure it is enabled in the admin
if ( isset( $this->relevanssi_result_ids[ 'sf-' . $sfid ] ) ) {
$return_ids_ordered = array();
$ordering_array = $this->relevanssi_result_ids[ 'sf-' . $sfid ];
$ordering_array = array_flip( $ordering_array );
foreach ( $result_ids as $result_id ) {
$return_ids_ordered[ $ordering_array[ $result_id ] ] = $result_id;
}
ksort( $return_ids_ordered );
return $return_ids_ordered;
}
}
return $result_ids;
}
public function relevanssi_add_custom_filter( $ids_array, $query_args, $sfid ) {
global $searchandfilter;
$sf_inst = $searchandfilter->get( $sfid );
$this->remove_relevanssi_defaults();
if ( $sf_inst->settings( 'use_relevanssi' ) == 1 ) {// ensure it is enabled in the admin
if ( isset( $query_args['s'] ) ) {// only run if a search term has actually been set
if ( trim( $query_args['s'] ) != '' ) {
// $search_term = $query_args['s'];
if ( function_exists( 'relevanssi_do_query' ) ) {
$expand_args = array(
'posts_per_page' => -1,
'paged' => 1,
'fields' => 'ids', // relevanssi only implemented support for this in 3.5 - before this, it would return the whole post object
// 'orderby' => "", //remove sorting
'meta_key' => '',
// 'order' => "asc",
/* speed improvements */
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
);
$query_args = array_merge( $query_args, $expand_args );
// $query_args['orderby'] = "relevance";
// $query_args['order'] = "asc";
unset( $query_args['order'] );
unset( $query_args['orderby'] );
// The Query
$query_arr = new WP_Query( $query_args );
relevanssi_do_query( $query_arr );
$ids_array = array();
if ( $query_arr->have_posts() ) {
foreach ( $query_arr->posts as $post ) {
$post_id = 0;
if ( is_numeric( $post ) ) {
$post_id = $post;
} elseif ( is_object( $post ) ) {
if ( isset( $post->ID ) ) {
$post_id = $post->ID;
}
}
if ( $post_id != 0 ) {
array_push( $ids_array, $post_id );
}
}
}
if ( $sf_inst->settings( 'use_relevanssi_sort' ) == 1 ) {
// keep a copy for ordering the results later
$this->relevanssi_result_ids[ 'sf-' . $sfid ] = $ids_array;
// now add the filter
add_filter( 'sf_apply_filter_sort_post__in', array( $this, 'relevanssi_sort_result_ids' ), 10, 3 );
}
return $ids_array;
}
}
}
}
return array( false ); // this tells S&F to ignore this custom filter
}
}
require_once plugin_dir_path( __FILE__ ) . 'third-party/class-search-filter-woocommerce.php';

View File

@@ -0,0 +1,133 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Wp_Cache {
public static $wp_tax_terms = array();
public static $transient_keys = array();
public static $transient_keys_key = 'search_filter_transient_keys';
public static $cache_options = array();
public static $cache_option_name = 'search-filter-cache';
public static $use_transients = -1;
public static function set_transient( $transient_key, $data, $lifespan = null ) {
self::update_transient_keys( $transient_key );
if ( self::$use_transients !== 1 ) {
return;
}
// only set transients if the cache has completed..
$update_transient = false;
if ( empty( self::$cache_options ) ) {
self::$cache_options = get_option( self::$cache_option_name );
}
if ( isset( self::$cache_options['status'] ) ) {
if ( self::$cache_options['status'] == 'finished' ) {
$update_transient = true;
}
}
if ( $update_transient ) {
if ( $lifespan === null ) {
$lifespan = self::get_transient_lifespan();
}
return set_transient( self::create_transient_key( $transient_key ), $data, $lifespan );
}
return false;
}
public static function get_transient( $transient_key ) {
self::update_transient_keys( $transient_key );
if ( self::$use_transients !== 1 ) {
return;
}
return get_transient( self::create_transient_key( $transient_key ) );
}
public static function delete_transient( $transient_key ) {
self::update_transient_keys( $transient_key, true );
return delete_transient( self::create_transient_key( $transient_key ) );
}
public static function purge_all_transients() {
self::init_transient_keys( true );
// For each key, delete that transient.
foreach ( self::$transient_keys as $t ) {
delete_transient( $t );
}
// Reset our DB value.
update_option( self::$transient_keys_key, array() );
}
public static function get_transient_lifespan() {
$ten_mins = ( DAY_IN_SECONDS / 24 / 60 ) * 10;
$one_week = DAY_IN_SECONDS * 7;
/*
if( is_super_admin() && WP_DEBUG ) {
return 1;
} else {
return $one_week;
}*/
return $one_week;
}
public static function create_transient_key( $transient_key ) {
return 'sf_ca_' . md5( $transient_key );
}
public static function init_transient_keys( $override = false ) {
if ( self::$use_transients === -1 ) {
self::$use_transients = (int) Search_Filter_Helper::get_option( 'cache_use_transients' );
}
if ( ( self::$use_transients === 1 ) || ( $override == true ) ) {
if ( empty( self::$transient_keys ) ) {
$transient_keys = get_option( self::$transient_keys_key );
if ( ! empty( $transient_keys ) ) {
self::$transient_keys = $transient_keys;
}
}
}
}
public static function update_transient_keys( $transient_key, $delete = false ) {
self::init_transient_keys();
if ( self::$use_transients !== 1 ) {
return;
}
$real_tranient_key = self::create_transient_key( $transient_key );
if ( ! in_array( $real_tranient_key, self::$transient_keys ) ) {
array_push( self::$transient_keys, $real_tranient_key );
update_option( self::$transient_keys_key, self::$transient_keys );
} elseif ( $delete == true ) {
// if delete is true try to find it and remove it
$search_index = array_search( $real_tranient_key, self::$transient_keys );
if ( $search_index !== false ) {
unset( self::$transient_keys[ $search_index ] );
update_option( self::$transient_keys_key, self::$transient_keys );
}
}
}
}

View File

@@ -0,0 +1,217 @@
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Search_Filter_Wp_Data {
public static $wp_tax_terms = array();
public static $wp_tax_terms_found_all = array();
public static $wp_transients_loaded = array();
public static $wp_tax_terms_cache_key = 'wp_tax_terms_';
public static $use_transients = -1;
public static $post_types = array();
public static $is_taxonomy_archive = -1;
public static function setup( $taxonomy_name ) {
if ( ! isset( self::$wp_tax_terms_found_all[ $taxonomy_name ] ) ) {
self::$wp_tax_terms_found_all[ $taxonomy_name ] = false;
}
if ( ! isset( self::$wp_transients_loaded[ $taxonomy_name ] ) ) {
self::$wp_transients_loaded[ $taxonomy_name ] = false;
}
// check to see if we have this data already in the transient
if ( self::$use_transients === -1 ) {
self::$use_transients = (int) get_option( 'search_filter_cache_use_transients' );
}
// self::$use_transients = 0;
if ( self::$use_transients == 1 ) {
if ( ( self::$wp_tax_terms_found_all[ $taxonomy_name ] == false ) && ( self::$wp_transients_loaded[ $taxonomy_name ] == false ) ) {
self::$wp_transients_loaded[ $taxonomy_name ] = true; // never do `get_transient` more than once
$wp_tax_terms = Search_Filter_Wp_Cache::get_transient( self::$wp_tax_terms_cache_key . $taxonomy_name );
if ( ! empty( $wp_tax_terms ) ) {
foreach ( $wp_tax_terms as $taxonomy_term ) {
self::$wp_tax_terms[ $taxonomy_name ]['id'][ $taxonomy_term->term_id ] = $taxonomy_term;
self::$wp_tax_terms[ $taxonomy_name ]['slug'][ $taxonomy_term->slug ] = $taxonomy_term;
}
self::$wp_tax_terms_found_all[ $taxonomy_name ] = true;
}
}
}
}
public static function get_taxonomy_terms( $taxonomy_name ) {
self::setup( $taxonomy_name );
if ( ( isset( self::$wp_tax_terms[ $taxonomy_name ] ) ) && ( isset( self::$wp_tax_terms_found_all[ $taxonomy_name ] ) ) ) {
if ( self::$wp_tax_terms_found_all[ $taxonomy_name ] == true ) {
return self::$wp_tax_terms[ $taxonomy_name ]['id'];
}
}
self::$wp_tax_terms_found_all[ $taxonomy_name ] = true;
self::$wp_tax_terms[ $taxonomy_name ] = array();
self::$wp_tax_terms[ $taxonomy_name ]['id'] = array();
self::$wp_tax_terms[ $taxonomy_name ]['slug'] = array();
self::$wp_tax_terms[ $taxonomy_name ] = array();
$t_taxonomy_terms = get_terms(
$taxonomy_name,
array(
'hide_empty' => false,
)
);
if ( ! empty( $t_taxonomy_terms ) ) {
foreach ( $t_taxonomy_terms as $taxonomy_term ) {
$tax_term_basic = new stdClass();
$tax_term_basic->term_id = $taxonomy_term->term_id;
$tax_term_basic->slug = $taxonomy_term->slug;
self::$wp_tax_terms[ $taxonomy_name ]['id'][ $taxonomy_term->term_id ] = $tax_term_basic;
self::$wp_tax_terms[ $taxonomy_name ]['slug'][ $taxonomy_term->slug ] = $tax_term_basic;
// self::$wp_tax_terms[$taxonomy_name]['id'][$t_taxonomy_terms[$ti]->term_id] = $t_taxonomy_terms[$ti];
// self::$wp_tax_terms[$taxonomy_name]['slug'][$t_taxonomy_terms[$ti]->slug] = $t_taxonomy_terms[$ti];
}
if ( self::$use_transients == 1 ) {
Search_Filter_Wp_Cache::set_transient( self::$wp_tax_terms_cache_key . $taxonomy_name, array_values( self::$wp_tax_terms[ $taxonomy_name ]['id'] ) );
}
}
/*
for ($ti = 0; $ti < count($t_taxonomy_terms); $ti++) {
self::$wp_tax_terms[$taxonomy_name]['id'][$t_taxonomy_terms[$ti]->term_id] = $t_taxonomy_terms[$ti];
self::$wp_tax_terms[$taxonomy_name]['slug'][$t_taxonomy_terms[$ti]->slug] = $t_taxonomy_terms[$ti];
}*/
if ( empty( self::$wp_tax_terms[ $taxonomy_name ] ) ) {
return array();
}
return self::$wp_tax_terms[ $taxonomy_name ]['id'];
}
public static function get_taxonomy_term_by( $by, $term_name, $taxonomy_name ) {
self::setup( $taxonomy_name );
if ( ! isset( self::$wp_tax_terms[ $taxonomy_name ] ) ) {
self::$wp_tax_terms[ $taxonomy_name ] = array();
self::$wp_tax_terms[ $taxonomy_name ]['id'] = array();
self::$wp_tax_terms[ $taxonomy_name ]['slug'] = array();
}
if ( isset( self::$wp_tax_terms[ $taxonomy_name ][ $by ][ $term_name ] ) ) {
return self::$wp_tax_terms[ $taxonomy_name ][ $by ][ $term_name ];
}
// else, term name does not exist, so fetch it
$term = get_term_by( $by, $term_name, $taxonomy_name );
// if ( !is_wp_error( $term ) ) {
if ( $term ) {
self::$wp_tax_terms[ $taxonomy_name ]['id'][ $term->term_id ] = $term;
self::$wp_tax_terms[ $taxonomy_name ]['slug'][ $term->slug ] = $term;
if ( isset( self::$wp_tax_terms[ $taxonomy_name ][ $by ][ $term_name ] ) ) {
return self::$wp_tax_terms[ $taxonomy_name ][ $by ][ $term_name ];
} else {
return array();
}
}
return false;
}
public static function get_post_type_taxonomies( $post_type ) {
}
public static function is_taxonomy_archive( $query = '' ) {
if ( $query == '' ) {
if ( self::$is_taxonomy_archive === -1 ) {
self::$is_taxonomy_archive = false;
if ( ( is_tax() || is_category() || is_tag() ) && ( is_archive() ) ) {
self::$is_taxonomy_archive = true;
}
}
return self::$is_taxonomy_archive;
} else {
if ( ( $query->is_tax() || $query->is_category() || $query->is_tag() ) && ( $query->is_archive() ) ) {
return true;
}
return false;
}
}
public static function get_post_types_by_taxonomy( $tax = 'category' ) {
$out = array();
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
if ( ! isset( self::$post_types[ $post_type ] ) ) {
self::$post_types[ $post_type ] = array();
}
if ( ! isset( self::$post_types[ $post_type ]['taxonomies'] ) ) {
self::$post_types[ $post_type ]['taxonomies'] = get_object_taxonomies( $post_type );
}
$taxonomies = self::$post_types[ $post_type ]['taxonomies'];
if ( in_array( $tax, $taxonomies ) ) {
$out[] = $post_type;
}
}
return $out;
}
public static function is_taxonomy_archive_of_post_type( $post_type, $single = true ) {
if ( ! self::is_taxonomy_archive() ) {
return false;
}
if ( ! isset( self::$post_types[ $post_type ] ) ) {
self::$post_types[ $post_type ] = array();
}
if ( ! isset( self::$post_types[ $post_type ]['taxonomies'] ) ) {
self::$post_types[ $post_type ]['taxonomies'] = get_object_taxonomies( $post_type );
}
global $searchandfilter;
$term = $searchandfilter->get_queried_object();
$is_taxonomy_archive = false;
if ( isset( $term->taxonomy ) ) {
$taxonomy_name = $term->taxonomy;
$tax_post_types = self::get_post_types_by_taxonomy( $taxonomy_name );
// make sure this tax is not shared unless single is false(we need for woocommerce, because all taxes are shared betweeen 2 post types - variations and products
if ( ( ( 1 === count( $tax_post_types ) ) && ( $single ) ) || ( ! $single ) ) {
$is_taxonomy_archive = in_array( $taxonomy_name, self::$post_types[ $post_type ]['taxonomies'] );
}
}
return $is_taxonomy_archive;
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
<?php // Silence is golden

View File

@@ -0,0 +1 @@
<?php // Silence is golden

View File

@@ -0,0 +1,31 @@
# Copyright (C) 2013 TODO
# This file is distributed under the same license as the TODO package.
msgid ""
msgstr ""
"Project-Id-Version: TODO 1.0.0\n"
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/plugin-name\n"
"POT-Creation-Date: 2013-05-10 11:23:19+00:00\n"
"PO-Revision-Date: 2013-05-10 10:37-0500\n"
"Last-Translator: FULL NAME <email@example.com>\n"
"Language-Team: LANGUAGE <translations@example.com >\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.5.7\n"
"X-Poedit-KeywordsList: __;_e;_n;_x;esc_html_e;esc_html__;esc_attr_e;"
"esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:1,2c;_n:1,2\n"
"X-Poedit-Basepath: ../\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-SearchPath-0: .\n"
#: class-plugin-name-admin.php:170
msgid "Page Title"
msgstr ""
#: class-plugin-name-admin.php:171
msgid "Menu Text"
msgstr ""
#: class-plugin-name-admin.php:197
msgid "Settings"
msgstr ""

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 B

View File

@@ -0,0 +1 @@
<?php // Silence is golden

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -0,0 +1 @@
<?php // Silence is golden

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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,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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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{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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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"La carga falló"},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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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{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(){}}}),{define:e.define,require:e.require}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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{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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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%100>9&&e%100<21||e%10===0?e%10>1?n:r:t}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"ių","ius","į"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"ių","ius","į"),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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

View File

@@ -0,0 +1,3 @@
/*! Select2 4.0.2 | 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}})();

Some files were not shown because too many files have changed in this diff Show More