From 0ffdaa60f69e1d0c887f396fa431aaeb4ef959c7 Mon Sep 17 00:00:00 2001 From: denisbaranov Date: Tue, 9 Oct 2018 12:45:18 +0300 Subject: [PATCH 01/22] Add functionality for the "Image Upload Maximum Width (px)" setting. --- includes/core/class-uploader.php | 109 ++++++++++++++++++------------- 1 file changed, 63 insertions(+), 46 deletions(-) diff --git a/includes/core/class-uploader.php b/includes/core/class-uploader.php index 8d3c54c8..c9618154 100644 --- a/includes/core/class-uploader.php +++ b/includes/core/class-uploader.php @@ -95,7 +95,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $this->core_upload_dir = DIRECTORY_SEPARATOR . "ultimatemember" . DIRECTORY_SEPARATOR; $this->core_upload_url = "/ultimatemember/"; $this->upload_image_type = 'stream_photo'; - $this->wp_upload_dir = wp_upload_dir(); + $this->wp_upload_dir = wp_upload_dir(); $this->temp_upload_dir = "temp"; add_filter( "upload_dir", array( $this, "set_upload_directory" ), 10, 1 ); @@ -120,7 +120,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Get core temporary directory path * - * @since 2.0.22 + * @since 2.0.22 * @return string */ public function get_core_temp_dir() { @@ -131,7 +131,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Get core temporary directory URL * - * @since 2.0.22 + * @since 2.0.22 * @return string */ public function get_core_temp_url() { @@ -142,7 +142,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Get core upload directory * - * @since 2.0.22 + * @since 2.0.22 * @return string */ public function get_core_upload_dir() { @@ -153,7 +153,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Get core upload base url * - * @since 2.0.22 + * @since 2.0.22 * @return string */ public function get_upload_base_url() { @@ -168,7 +168,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Get core upload base directory * - * @since 2.0.22 + * @since 2.0.22 * @return string */ public function get_upload_base_dir() { @@ -198,7 +198,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $this->upload_user_basedir = $this->get_upload_base_dir() . $this->user_id; if ( $create_dir ) { - wp_mkdir_p( $this->upload_user_basedir ); + wp_mkdir_p( $this->upload_user_basedir ); } return $this->upload_user_basedir; @@ -207,9 +207,9 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Get user upload base url - * + * * @param integer $user_id - * @since 2.0.22 + * @since 2.0.22 * @return string */ public function get_upload_user_base_url( $user_id = null ) { @@ -222,10 +222,10 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { return $this->upload_user_baseurl; } - + /** * Validate file size - * @param array $file + * @param array $file * @return array */ public function validate_upload( $file ) { @@ -312,7 +312,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { if ( in_array( $field_key, array( 'profile_photo','cover_photo' ) ) ) { $this->upload_image_type = $field_key; - } + } $field_data = UM()->fields()->get_field( $field_key ); @@ -326,7 +326,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { foreach ( $field_allowed_file_types as $a ) { $atype = wp_check_filetype( "test.{$a}" ); - $allowed_image_mimes[ $atype['ext'] ] = $atype['type']; + $allowed_image_mimes[ $atype['ext'] ] = $atype['type']; } $image_compression = UM()->options()->get('image_compression'); @@ -352,9 +352,9 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $movefile['url'] = set_url_scheme( $movefile['url'] ); $movefile['file_info']['basename'] = wp_basename( $movefile['file'] ); - + $file_type = wp_check_filetype( $movefile['file_info']['basename'] ); - + $movefile['file_info']['name'] = $movefile['url']; $movefile['file_info']['original_name'] = $uploadedfile['name']; $movefile['file_info']['ext'] = $file_type['ext']; @@ -497,7 +497,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { foreach ( $field_allowed_file_types as $a ) { $atype = wp_check_filetype( "test.{$a}" ); - $allowed_file_mimes[ $atype['ext'] ] = $atype['type']; + $allowed_file_mimes[ $atype['ext'] ] = $atype['type']; } $upload_overrides = array( @@ -529,7 +529,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $movefile['file_info']['type'] = $file_type['type']; $movefile['file_info']['size'] = filesize( $movefile['file'] ); $movefile['file_info']['size_format'] = size_format( $movefile['file_info']['size'] ); - + /** * UM hook @@ -854,12 +854,12 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Make unique filename - * @param string $filename - * @param string $ext - * @param string $dir + * @param string $filename + * @param string $ext + * @param string $dir * @return string $filename * - * @since 2.0.22 + * @since 2.0.22 */ public function unique_filename( $filename, $ext, $dir ) { $image_type = wp_check_filetype( $ext ); @@ -897,10 +897,10 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Delete file - * @param string $filename - * @param string $ext - * @param string $dir - * + * @param string $filename + * @param string $ext + * @param string $dir + * * @since 2.0.22 */ public function delete_existing_file( $filename, $ext = '', $dir = '' ) { @@ -912,11 +912,11 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Profile photo image process - * @param string $src - * @param integer $user_id - * @param string $coord - * @param array $crop - * + * @param string $src + * @param integer $user_id + * @param string $coord + * @param array $crop + * * @since 2.0.22 */ public function profile_photo( $image_path, $src, $key, $user_id, $coord, $crop ) { @@ -934,6 +934,11 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $image->crop( $src_x, $src_y, $src_w, $src_h ); + $max_w = UM()->options()->get('image_max_width'); + if ( $src_w > $max_w ) { + $image->resize( $max_w ); + } + $image->save( $image_path ); $image->set_quality( $quality ); @@ -956,11 +961,11 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Cover photo image process - * @param string $src - * @param integer $user_id - * @param string $coord - * @param array $crop - * + * @param string $src + * @param integer $user_id + * @param string $coord + * @param array $crop + * * @since 2.0.22 */ public function cover_photo( $image_path, $src, $key, $user_id, $coord, $crop ){ @@ -980,8 +985,13 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $image->crop( $src_x, $src_y, $src_w, $src_h ); + $max_w = UM()->options()->get('image_max_width'); + if ( $src_w > $max_w ) { + $image->resize( $max_w ); + } + $image->save( $image_path ); - + $image->set_quality( $quality ); $sizes_array = array(); @@ -1000,15 +1010,15 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Stream photo image process - * @param string $src - * @param integer $user_id - * @param string $coord - * @param array $crop - * + * @param string $src + * @param integer $user_id + * @param string $coord + * @param array $crop + * * @since 2.0.22 */ public function stream_photo( $image_path, $src, $key, $user_id, $coord, $crop ){ - + $image = wp_get_image_editor( $image_path ); // Return an implementation that extends WP_Image_Editor $quality = UM()->options()->get( 'image_compression' ); @@ -1026,10 +1036,15 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $src_h = $crop[3]; $image->crop( $src_x, $src_y, $src_w, $src_h ); + + $max_w = UM()->options()->get('image_max_width'); + if ( $src_w > $max_w ) { + $image->resize( $max_w ); + } } $image->save( $image_path ); - + $image->set_quality( $quality ); } else { @@ -1040,9 +1055,9 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { /** * Set stream photo default settings - * @param array $args - * @return array - * + * @param array $args + * @return array + * * @since 2.0.22 */ public function stream_photo_data( $args ) { @@ -1069,6 +1084,8 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $crop = explode( ',', $coord ); $crop = array_map( 'intval', $crop ); + error_log(__METHOD__ . " key=$key"); + do_action("um_upload_image_process__{$key}", $image_path, $src, $key, $user_id, $coord, $crop ); if ( ! in_array( $key, array('profile_photo','cover_photo') ) ) { From 73ba2681fe672890fa1d8ec90f5756914d6816be Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Thu, 11 Oct 2018 12:47:32 +0300 Subject: [PATCH 02/22] - fixed translations for email notifications --- includes/core/class-external-integrations.php | 4 ++-- includes/core/class-uploader.php | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/includes/core/class-external-integrations.php b/includes/core/class-external-integrations.php index 91763115..914f2e9f 100644 --- a/includes/core/class-external-integrations.php +++ b/includes/core/class-external-integrations.php @@ -286,8 +286,8 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) { $language_codes = $this->get_languages_codes(); $lang = ''; - if ( $language_codes['default'] != $language_codes['current'] && - UM()->config()->email_notifications[ $template_name ]['recipient'] != 'admin' ) { + if ( $language_codes['default'] != $language_codes['current'] /*&& + UM()->config()->email_notifications[ $template_name ]['recipient'] != 'admin'*/ ) { $lang = $language_codes['current'] . '/'; } diff --git a/includes/core/class-uploader.php b/includes/core/class-uploader.php index c9618154..91ad5721 100644 --- a/includes/core/class-uploader.php +++ b/includes/core/class-uploader.php @@ -1084,8 +1084,6 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $crop = explode( ',', $coord ); $crop = array_map( 'intval', $crop ); - error_log(__METHOD__ . " key=$key"); - do_action("um_upload_image_process__{$key}", $image_path, $src, $key, $user_id, $coord, $crop ); if ( ! in_array( $key, array('profile_photo','cover_photo') ) ) { From e86f9c53dd06a994f5f1b0242cfe22199b0226e9 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Sun, 14 Oct 2018 01:01:02 +0300 Subject: [PATCH 03/22] - additional filter for translations and compatibility; --- includes/core/class-fields.php | 47 ++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index bcfc29f6..6e3415f4 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -1128,13 +1128,40 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @return string */ function get_label( $key ) { - $fields = UM()->builtin()->all_user_fields; - if ( isset( $fields[$key]['label'] ) ) - return stripslashes( $fields[$key]['label'] ); - if ( isset( $fields[$key]['title'] ) ) - return stripslashes( $fields[$key]['title'] ); + $label = ''; - return ''; + $fields = UM()->builtin()->all_user_fields; + if ( isset( $fields[ $key ]['label'] ) ) { + $label = stripslashes( $fields[ $key ]['label'] ); + } + + if ( isset( $fields[ $key ]['title'] ) ) { + $label = stripslashes( $fields[ $key ]['title'] ); + } + + /** + * UM hook + * + * @type filter + * @title um_change_field_label + * @description Change Field Label + * @input_vars + * [{"var":"$label","type":"string","desc":"Field Label"}, + * {"var":"$key","type":"string","desc":"Field Key"}] + * @change_log + * ["Since: 2.0.30"] + * @usage add_filter( 'um_change_field_label', 'function_name', 10, 2 ); + * @example + * + */ + $label = apply_filters( 'um_change_field_label', $label, $key ); + return $label; } @@ -2268,8 +2295,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $output .= '
' . $button_text . '
'; $output .= ''; @@ -2365,8 +2392,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $output .= '
' . $button_text . '
'; $output .= ''; From 2a6f8e6531f615b9c3e60b811c3683cf648a7bf0 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Mon, 15 Oct 2018 10:46:50 +0300 Subject: [PATCH 04/22] - fixed image resize; - added few scripts dependencies; --- includes/core/class-enqueue.php | 12 +++++------- includes/core/class-shortcodes.php | 2 +- includes/core/class-uploader.php | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/includes/core/class-enqueue.php b/includes/core/class-enqueue.php index 61b40f75..11e9ed7d 100644 --- a/includes/core/class-enqueue.php +++ b/includes/core/class-enqueue.php @@ -396,14 +396,12 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { /** * Load rating */ - function load_raty(){ - - wp_register_script('um_raty', um_url . 'assets/js/um-raty' . $this->suffix . '.js' ); + function load_raty() { + wp_register_script('um_raty', um_url . 'assets/js/um-raty' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_enqueue_script('um_raty'); - wp_register_style('um_raty', um_url . 'assets/css/um-raty.css' ); + wp_register_style('um_raty', um_url . 'assets/css/um-raty.css', array(), ultimatemember_version ); wp_enqueue_style('um_raty'); - } @@ -426,10 +424,10 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { */ function load_tipsy(){ - wp_register_script('um_tipsy', um_url . 'assets/js/um-tipsy' . $this->suffix . '.js' ); + wp_register_script('um_tipsy', um_url . 'assets/js/um-tipsy' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_enqueue_script('um_tipsy'); - wp_register_style('um_tipsy', um_url . 'assets/css/um-tipsy.css' ); + wp_register_style('um_tipsy', um_url . 'assets/css/um-tipsy.css', array(), ultimatemember_version ); wp_enqueue_style('um_tipsy'); } diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php index 0a0c01b3..6457dfe0 100644 --- a/includes/core/class-shortcodes.php +++ b/includes/core/class-shortcodes.php @@ -260,7 +260,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { if ( isset( $this->set_args ) && is_array( $this->set_args ) ) { $args = $this->set_args; - + unset( $args['file'] ); unset( $args['theme_file'] ); unset( $args['tpl'] ); diff --git a/includes/core/class-uploader.php b/includes/core/class-uploader.php index 91ad5721..9eeacc17 100644 --- a/includes/core/class-uploader.php +++ b/includes/core/class-uploader.php @@ -936,7 +936,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $max_w = UM()->options()->get('image_max_width'); if ( $src_w > $max_w ) { - $image->resize( $max_w ); + $image->resize( $max_w, $src_h ); } $image->save( $image_path ); @@ -987,7 +987,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $max_w = UM()->options()->get('image_max_width'); if ( $src_w > $max_w ) { - $image->resize( $max_w ); + $image->resize( $max_w, $src_h ); } $image->save( $image_path ); @@ -1039,7 +1039,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $max_w = UM()->options()->get('image_max_width'); if ( $src_w > $max_w ) { - $image->resize( $max_w ); + $image->resize( $max_w, $src_h ); } } From 8cc4be56d6243f0c0a11abc611897043ef4902a6 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Mon, 15 Oct 2018 21:36:34 +0300 Subject: [PATCH 05/22] - fixed profile page permalinks; --- includes/class-dependencies.php | 1 + includes/core/class-enqueue.php | 4 +--- includes/core/class-permalinks.php | 4 ++-- readme.txt | 8 +++++++- ultimate-member.php | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/includes/class-dependencies.php b/includes/class-dependencies.php index 4d31beef..dcbc25c0 100644 --- a/includes/class-dependencies.php +++ b/includes/class-dependencies.php @@ -59,6 +59,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) { 'beaver-builder' => '2.0', 'user-photos' => '2.0.1', 'user-exporter' => '1.0.0', + 'bookmark' => '2.0', ); diff --git a/includes/core/class-enqueue.php b/includes/core/class-enqueue.php index 11e9ed7d..9ed34f88 100644 --- a/includes/core/class-enqueue.php +++ b/includes/core/class-enqueue.php @@ -22,7 +22,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Enqueue constructor. */ function __construct() { - + $this->suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'UM_SCRIPT_DEBUG' ) ) ? '' : '.min'; /** * UM hook @@ -73,8 +73,6 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { function wp_enqueue_scripts() { global $post; - $this->suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'UM_SCRIPT_DEBUG' ) ) ? '' : '.min'; - if ( ! is_admin() ) { $c_url = UM()->permalinks()->get_current_url( get_option( 'permalink_structure' ) ); diff --git a/includes/core/class-permalinks.php b/includes/core/class-permalinks.php index d88200e9..7f2408cf 100644 --- a/includes/core/class-permalinks.php +++ b/includes/core/class-permalinks.php @@ -373,11 +373,11 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) { } else { - $profile_url = add_query_arg( 'um_user', $slug, $profile_url ); + $profile_url = add_query_arg( 'um_user', strtolower( $slug ), $profile_url ); } - return ! empty( $profile_url ) ? strtolower( $profile_url ) : ''; + return ! empty( $profile_url ) ? $profile_url : ''; } diff --git a/readme.txt b/readme.txt index 4a3feed2..279364f2 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Donate link: Tags: community, member, membership, user-profile, user-registration Requires at least: 4.7 Tested up to: 4.9 -Stable tag: 2.0.29 +Stable tag: 2.0.30 License: GNU Version 2 or Any Later Version License URI: http://www.gnu.org/licenses/gpl-3.0.txt @@ -133,6 +133,12 @@ The plugin works with popular caching plugins by automatically excluding Ultimat = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin = += 2.0.30: October 8, 2018 = + +* Bugfixes: + - Fixed uppercase symbols using at profile page slug + - Added bookmarks compatibility + = 2.0.29: October 8, 2018 = * Bugfixes: diff --git a/ultimate-member.php b/ultimate-member.php index ddb8020d..6fb8cc17 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.0.29 +Version: 2.0.30 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member From 8fdd9d3f242e15beb007097f6eff4694cc8b0a34 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Tue, 16 Oct 2018 10:11:44 +0300 Subject: [PATCH 06/22] - edded new enqueue logic; --- includes/core/class-enqueue.php | 69 ++++++++++++++++++++++++--------- readme.txt | 4 +- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/includes/core/class-enqueue.php b/includes/core/class-enqueue.php index 9ed34f88..f8031bb0 100644 --- a/includes/core/class-enqueue.php +++ b/includes/core/class-enqueue.php @@ -13,17 +13,34 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { */ class Enqueue { + /** * @var string */ var $suffix = ''; + + /** + * @var string + */ + var $js_baseurl = ''; + + + /** + * @var string + */ + var $css_baseurl = ''; + + /** * Enqueue constructor. */ function __construct() { $this->suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'UM_SCRIPT_DEBUG' ) ) ? '' : '.min'; + $this->js_baseurl = um_url . 'assets/js/'; + $this->css_baseurl = um_url . 'assets/css/'; + /** * UM hook * @@ -49,28 +66,44 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { } - /** - * Minify css string - * - * @param $css - * - * @return mixed - */ - function minify( $css ) { - $css = str_replace(array("\r", "\n"), '', $css); - $css = str_replace(' {','{', $css ); - $css = str_replace('{ ','{', $css ); - $css = str_replace('; ',';', $css ); - $css = str_replace(';}','}', $css ); - $css = str_replace(': ',':', $css ); - return $css; - } - - /** * Enqueue scripts and styles */ function wp_enqueue_scripts() { + + wp_register_script( 'um_scrollto', $this->js_baseurl . 'um-scrollto' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_scrollbar', $this->js_baseurl . 'um-scrollbar' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + + wp_register_script( 'um_jquery_form', $this->js_baseurl . 'um-jquery-form' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_fileupload', $this->js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + + wp_register_script( 'um_datetime', $this->js_baseurl . 'pickadate/picker.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_date', $this->js_baseurl . 'pickadate/picker.date.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_time', $this->js_baseurl . 'pickadate/picker.time.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_legacy', $this->js_baseurl . 'pickadate/legacy.js', array( 'jquery' ), ultimatemember_version, true ); + + wp_register_script( 'select2', $this->js_baseurl . 'select2/select2.full.min.js', array( 'jquery', 'jquery-masonry' ), ultimatemember_version, true ); + wp_register_script( 'um_tipsy', $this->js_baseurl . 'um-tipsy' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_raty', $this->js_baseurl . 'um-raty' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_crop', $this->js_baseurl . 'um-crop' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + + + //FontAwesome and FontIcons styles + wp_register_style( 'um_fonticons_ii', $this->css_baseurl . 'um-fonticons-ii.css', array(), ultimatemember_version ); + wp_register_style( 'um_fonticons_fa', $this->css_baseurl . 'um-fonticons-fa.css', array(), ultimatemember_version ); + wp_register_style( 'um_crop', $this->css_baseurl . 'um-crop.css', array(), ultimatemember_version ); + wp_register_style( 'um_tipsy', $this->css_baseurl . 'um-tipsy.css', array(), ultimatemember_version ); + wp_register_style( 'um_raty', $this->css_baseurl . 'um-raty.css', array(), ultimatemember_version ); + wp_register_style( 'select2', $this->css_baseurl . 'select2/select2.min.css', array(), ultimatemember_version ); + wp_register_style( 'um_fileupload', $this->css_baseurl . 'um-fileupload.css', array(), ultimatemember_version ); + wp_register_style( 'um_datetime', $this->css_baseurl . 'pickadate/default.css', array(), ultimatemember_version ); + wp_register_style( 'um_datetime_date', $this->css_baseurl . 'pickadate/default.date.css', array( 'um-datetime' ), ultimatemember_version ); + wp_register_style( 'um_datetime_time', $this->css_baseurl . 'pickadate/default.time.css', array( 'um-datetime' ), ultimatemember_version ); + wp_register_style( 'um_scrollbar', $this->css_baseurl . 'um-scrollbar.css', array(), ultimatemember_version ); + //ui slider for filters + //wp_enqueue_script( 'jquery-ui-slider' ); + + global $post; if ( ! is_admin() ) { diff --git a/readme.txt b/readme.txt index 279364f2..cb13cb8f 100644 --- a/readme.txt +++ b/readme.txt @@ -133,9 +133,11 @@ The plugin works with popular caching plugins by automatically excluding Ultimat = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin = -= 2.0.30: October 8, 2018 = += 2.0.30: October 17, 2018 = * Bugfixes: + - Fixed crop settings of the big images + - Fixed WPML integration with email notifications - Fixed uppercase symbols using at profile page slug - Added bookmarks compatibility From 17fdaaefea5601b9bd07c80d59e1b2d72f697508 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Wed, 17 Oct 2018 10:47:03 +0300 Subject: [PATCH 07/22] - fields translations; --- includes/core/class-fields.php | 2 + languages/ultimate-member-en_US.po | 67 ++++++++++++++++-------------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 6e3415f4..56dbe7b8 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -1161,6 +1161,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * ?> */ $label = apply_filters( 'um_change_field_label', $label, $key ); + + $label = sprintf( __( '%s', 'ultimate-member' ), $label ); return $label; } diff --git a/languages/ultimate-member-en_US.po b/languages/ultimate-member-en_US.po index 48622378..05091603 100644 --- a/languages/ultimate-member-en_US.po +++ b/languages/ultimate-member-en_US.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Ultimate Member\n" -"POT-Creation-Date: 2018-10-08 23:32+0300\n" -"PO-Revision-Date: 2018-10-08 23:32+0300\n" +"POT-Creation-Date: 2018-10-17 10:44+0300\n" +"PO-Revision-Date: 2018-10-17 10:44+0300\n" "Last-Translator: \n" "Language-Team: \n" "Language: en_US\n" @@ -115,7 +115,7 @@ msgstr "" #: includes/admin/core/class-admin-builder.php:609 #: includes/admin/core/class-admin-builder.php:763 -#: includes/core/class-fields.php:4033 +#: includes/core/class-fields.php:4062 msgid "Please login as administrator" msgstr "" @@ -2482,7 +2482,7 @@ msgid "UM Action" msgstr "" #: includes/admin/core/class-admin-users.php:116 -#: includes/core/class-fields.php:2271 +#: includes/core/class-fields.php:2300 msgid "Apply" msgstr "" @@ -3526,7 +3526,7 @@ msgstr "" #: includes/admin/templates/modal/dynamic_new_group.php:14 #: includes/admin/templates/modal/fonticons.php:11 #: includes/admin/templates/role/publish.php:24 -#: includes/core/class-fields.php:2272 includes/core/class-fields.php:2369 +#: includes/core/class-fields.php:2301 includes/core/class-fields.php:2398 #: includes/core/um-actions-profile.php:554 #: includes/core/um-actions-profile.php:693 #: includes/core/um-actions-profile.php:726 @@ -4019,36 +4019,36 @@ msgid "" "account data from the site. To delete your account enter your password below" msgstr "" -#: includes/class-dependencies.php:160 +#: includes/class-dependencies.php:161 #, php-format msgid "" "This version of \"%s\" requires the core %s plugin to be %s or higher." msgstr "" -#: includes/class-dependencies.php:162 +#: includes/class-dependencies.php:163 #, php-format msgid "Please update %s to the latest version." msgstr "" -#: includes/class-dependencies.php:164 +#: includes/class-dependencies.php:165 #, php-format msgid "" "Sorry, but this version of %s does not work with extension " "\"%s\" %s version." msgstr "" -#: includes/class-dependencies.php:166 +#: includes/class-dependencies.php:167 #, php-format msgid "Please update extension \"%s\" to the latest version." msgstr "" -#: includes/class-dependencies.php:175 +#: includes/class-dependencies.php:176 #, php-format msgid "Please check \"%s\" %s extension's folder name." msgstr "" -#: includes/class-dependencies.php:177 +#: includes/class-dependencies.php:178 #, php-format msgid "Correct folder name is \"%s\"" msgstr "" @@ -6244,84 +6244,89 @@ msgstr "" msgid "Add translation to %s" msgstr "" -#: includes/core/class-fields.php:1155 +#: includes/core/class-fields.php:1165 +#, php-format +msgid "%s" +msgstr "" + +#: includes/core/class-fields.php:1184 msgid "Custom Field" msgstr "" -#: includes/core/class-fields.php:1452 +#: includes/core/class-fields.php:1481 msgid "Please upload a valid image!" msgstr "" -#: includes/core/class-fields.php:1459 includes/core/class-fields.php:1480 +#: includes/core/class-fields.php:1488 includes/core/class-fields.php:1509 msgid "Upload" msgstr "" -#: includes/core/class-fields.php:1460 +#: includes/core/class-fields.php:1489 msgid "Sorry this is not a valid image." msgstr "" -#: includes/core/class-fields.php:1461 +#: includes/core/class-fields.php:1490 msgid "This image is too large!" msgstr "" -#: includes/core/class-fields.php:1462 +#: includes/core/class-fields.php:1491 msgid "This image is too small!" msgstr "" -#: includes/core/class-fields.php:1463 +#: includes/core/class-fields.php:1492 msgid "You can only upload one image" msgstr "" -#: includes/core/class-fields.php:1930 +#: includes/core/class-fields.php:1959 msgid "Current Password" msgstr "" -#: includes/core/class-fields.php:1959 +#: includes/core/class-fields.php:1988 msgid "New Password" msgstr "" -#: includes/core/class-fields.php:1991 +#: includes/core/class-fields.php:2020 #, php-format msgid "Confirm %s" msgstr "" -#: includes/core/class-fields.php:2226 +#: includes/core/class-fields.php:2255 msgid "Upload Photo" msgstr "" -#: includes/core/class-fields.php:2247 includes/core/class-fields.php:2271 +#: includes/core/class-fields.php:2276 includes/core/class-fields.php:2300 #: includes/core/um-actions-profile.php:724 msgid "Change photo" msgstr "" -#: includes/core/class-fields.php:2271 includes/core/class-fields.php:2368 +#: includes/core/class-fields.php:2300 includes/core/class-fields.php:2397 msgid "Processing..." msgstr "" -#: includes/core/class-fields.php:2293 +#: includes/core/class-fields.php:2322 msgid "Upload File" msgstr "" -#: includes/core/class-fields.php:2335 includes/core/um-filters-fields.php:243 +#: includes/core/class-fields.php:2364 includes/core/um-filters-fields.php:243 msgid "This file has been removed." msgstr "" -#: includes/core/class-fields.php:2338 includes/core/class-fields.php:2368 +#: includes/core/class-fields.php:2367 includes/core/class-fields.php:2397 msgid "Change file" msgstr "" -#: includes/core/class-fields.php:2368 +#: includes/core/class-fields.php:2397 msgid "Save" msgstr "" -#: includes/core/class-fields.php:3791 +#: includes/core/class-fields.php:3820 #, php-format msgid "" "Your profile is looking a little empty. Why not add some " "information!" msgstr "" -#: includes/core/class-fields.php:3793 +#: includes/core/class-fields.php:3822 msgid "This user has not added any information to their profile yet." msgstr "" @@ -6548,7 +6553,7 @@ msgstr "" msgid "This file type is not recognized." msgstr "" -#: includes/core/class-uploader.php:1050 +#: includes/core/class-uploader.php:1065 #, php-format msgid "Maximum file size allowed: %s" msgstr "" From 4409ecebd164a5f63b314913eb6c025c642fce1e Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Thu, 18 Oct 2018 10:09:29 +0300 Subject: [PATCH 08/22] - fixed small notice; - fixed issue with download files with opened PHP buffers; --- includes/core/class-files.php | 12 ++++++++++++ includes/core/class-gdpr.php | 5 ++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/includes/core/class-files.php b/includes/core/class-files.php index 6d01a50c..81cbe18a 100644 --- a/includes/core/class-files.php +++ b/includes/core/class-files.php @@ -183,6 +183,12 @@ if ( ! class_exists( 'um\core\Files' ) ) { header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . $size); + + $levels = ob_get_level(); + for ( $i = 0; $i < $levels; $i++ ) { + @ob_end_clean(); + } + readfile( $file_path ); exit; } @@ -217,6 +223,12 @@ if ( ! class_exists( 'um\core\Files' ) ) { header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . $size); + + $levels = ob_get_level(); + for ( $i = 0; $i < $levels; $i++ ) { + @ob_end_clean(); + } + readfile( $file_path ); exit; } diff --git a/includes/core/class-gdpr.php b/includes/core/class-gdpr.php index 82ec76e7..3b48c326 100644 --- a/includes/core/class-gdpr.php +++ b/includes/core/class-gdpr.php @@ -70,10 +70,9 @@ if ( ! class_exists( 'um\core\GDPR' ) ) { * @return mixed */ function email_registration_data( $submitted ) { - - $timestamp = ! empty( $submitted['timestamp'] ) ? $submitted['timestamp'] : $submitted['use_gdpr_agreement']; - if ( ! empty( $submitted['use_gdpr_agreement'] ) ) { + $timestamp = ! empty( $submitted['timestamp'] ) ? $submitted['timestamp'] : $submitted['use_gdpr_agreement']; + $submitted['GDPR Applied'] = date( "d M Y H:i", $timestamp ); unset( $submitted['use_gdpr_agreement'] ); } From 0718803da11067b942c4faedc72e297669bbcb7a Mon Sep 17 00:00:00 2001 From: denisbaranov Date: Thu, 18 Oct 2018 19:11:26 +0300 Subject: [PATCH 09/22] fix bug: Profile Image pulls from Gravatar --- includes/core/um-filters-avatars.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/includes/core/um-filters-avatars.php b/includes/core/um-filters-avatars.php index 12aec65c..b420230e 100644 --- a/includes/core/um-filters-avatars.php +++ b/includes/core/um-filters-avatars.php @@ -42,4 +42,30 @@ function um_get_avatar( $avatar = '', $id_or_email='', $size = '96', $avatar_cla return $avatar; } -add_filter( 'get_avatar', 'um_get_avatar', 99999, 5 ); \ No newline at end of file +add_filter( 'get_avatar', 'um_get_avatar', 99999, 5 ); + + +/** + * Replace Gravatar image URL to Ultimate member profile image URL if setting "Use Gravatars?" disabled + * @param string $url + * @param int $id_or_email + * @param array $args + * @return string + */ +if ( !function_exists( 'um_filter_get_avatar_url' ) ) { + + function um_filter_get_avatar_url( $url, $id_or_email, $args ) { + + if ( is_numeric( $id_or_email ) && !UM()->options()->get( 'use_gravatars' ) && preg_match( '/gravatar/i', $url ) ) { + $data = um_get_user_avatar_data( $id_or_email, $args['size'] ); + if ( !empty( $data['url'] ) ) { + $url = $data['url']; + } + } + + return $url; + } + + // hooked in the get_avatar_data function + add_filter( 'get_avatar_url', 'um_filter_get_avatar_url', 20, 3 ); +} \ No newline at end of file From 9e6cea911a4399c7a0d459eede405609e0f513e0 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Mon, 22 Oct 2018 21:53:43 +0300 Subject: [PATCH 10/22] - base default shortcodes; --- .../admin/assets/css/um-admin-columns.css | 1 + includes/admin/core/class-admin-columns.php | 16 ++- includes/admin/core/class-admin-metabox.php | 14 +- includes/admin/core/class-admin-notices.php | 6 +- includes/admin/templates/form/shortcode.php | 21 +++ includes/core/class-shortcodes.php | 131 +++++++++++++++++- templates/message.php | 2 +- templates/profile.php | 5 +- 8 files changed, 181 insertions(+), 15 deletions(-) diff --git a/includes/admin/assets/css/um-admin-columns.css b/includes/admin/assets/css/um-admin-columns.css index 5f8730dc..34b41462 100644 --- a/includes/admin/assets/css/um-admin-columns.css +++ b/includes/admin/assets/css/um-admin-columns.css @@ -5,6 +5,7 @@ .um-admin.post-type-um_form .manage-column.column-id {width: 60px} .um-admin.post-type-um_form .manage-column.column-mode {width: 100px} +.um-admin.post-type-um_form .manage-column.column-is_default {width: 60px} .um-admin.post-type-um_form .manage-column.column-title {width: 200px} .um-admin.post-type-um_form .manage-column.column-shortcode {width: 200px} .um-admin.post-type-um_form .manage-column.column-impressions {width: 100px} diff --git a/includes/admin/core/class-admin-columns.php b/includes/admin/core/class-admin-columns.php index 6d83e024..91644f75 100644 --- a/includes/admin/core/class-admin-columns.php +++ b/includes/admin/core/class-admin-columns.php @@ -90,11 +90,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) { */ function manage_edit_um_form_columns( $columns ) { $new_columns['cb'] = ''; - $new_columns['title'] = __( 'Title', 'ulitmatemember' ); - $new_columns['id'] = __('ID', 'ulitmatemember' ); - $new_columns['mode'] = __( 'Type', 'ulitmatemember' ); - $new_columns['shortcode'] = __( 'Shortcode', 'ulitmatemember' ); - $new_columns['date'] = __( 'Date', 'ulitmatemember' ); + $new_columns['title'] = __( 'Title', 'ulitmate-member' ); + $new_columns['id'] = __('ID', 'ulitmate-member' ); + $new_columns['mode'] = __( 'Type', 'ulitmate-member' ); + $new_columns['is_default'] = __( 'Default', 'ulitmate-member' ); + $new_columns['shortcode'] = __( 'Shortcode', 'ulitmate-member' ); + $new_columns['date'] = __( 'Date', 'ulitmate-member' ); return $new_columns; } @@ -134,6 +135,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) { echo UM()->shortcodes()->get_shortcode( $id ); break; + case 'is_default': + $is_default = UM()->query()->get_attr( 'is_default', $id ); + echo empty( $is_default ) ? __( 'No', 'ultimate-member' ) : __( 'Yes', 'ultimate-member' ); + break; + case 'mode': $mode = UM()->query()->get_attr( 'mode', $id ); echo UM()->form()->display_form_type( $mode, $id ); diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 86171059..0474ebd3 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -1121,8 +1121,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { // save delete_post_meta( $post_id, '_um_profile_metafields' ); foreach ( $_POST['form'] as $k => $v ) { - if ( strstr( $k, '_um_' ) ){ - update_post_meta( $post_id, $k, $v); + if ( strstr( $k, '_um_' ) ) { + if ( $k === '_um_is_default' ) { + $mode = UM()->query()->get_attr( 'mode', $post_id ); + if ( ! empty( $mode ) ) { + $posts = $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_um_mode' AND meta_value = %s", $mode ) ); + foreach ( $posts as $p_id ) { + delete_post_meta( $p_id, '_um_is_default' ); + } + } + } + + update_post_meta( $post_id, $k, $v ); } } diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 24850135..05a032b6 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -298,11 +298,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { ob_start(); ?>

- %s > Settings to re-assign your missing pages.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name ); ?> +

- +  

@@ -531,7 +531,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { ob_start(); ?>

- %s! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions. If you subscribe to our mailing list we will send you a 20%% discount code for our extensions bundle.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?> + %s! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions. If you subscribe to our mailing list we will send you a 20%% discount code for our extensions bundle.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>

diff --git a/includes/admin/templates/form/shortcode.php b/includes/admin/templates/form/shortcode.php index 35124f74..fd71748c 100644 --- a/includes/admin/templates/form/shortcode.php +++ b/includes/admin/templates/form/shortcode.php @@ -1,3 +1,24 @@

+ admin_forms( array( + 'class' => 'um-form-shortcode um-top-label', + 'prefix_id' => 'form', + 'fields' => array( + array( + 'id' => '_um_is_default', + 'type' => 'select', + 'label' => __( 'Default Form', 'ultimate-member' ), + 'tooltip' => sprintf( __( 'If you set this form as default you will have an ability to use %s shortcode for the displaying form at the page. Otherwise you will have to use %s', 'ultimate-member' ), UM()->shortcodes()->get_default_shortcode( get_the_ID() ), UM()->shortcodes()->get_shortcode( get_the_ID() ) ), + 'value' => UM()->query()->get_meta_value( '_um_is_default' ), + 'options' => array( + 0 => __( 'No', 'ultimate-member' ), + 1 => __( 'Yes', 'ultimate-member' ), + ), + ), + ) + ) )->render_form(); ?> + +
+

shortcodes()->get_shortcode( get_the_ID() ); ?>

+

shortcodes()->get_default_shortcode( get_the_ID() ); ?>

\ No newline at end of file diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php index 6457dfe0..ac667267 100644 --- a/includes/core/class-shortcodes.php +++ b/includes/core/class-shortcodes.php @@ -26,6 +26,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { add_shortcode( 'ultimatemember', array( &$this, 'ultimatemember' ) ); + add_shortcode( 'ultimatemember_login', array( &$this, 'ultimatemember_login' ) ); + add_shortcode( 'ultimatemember_register', array( &$this, 'ultimatemember_register' ) ); + add_shortcode( 'ultimatemember_profile', array( &$this, 'ultimatemember_profile' ) ); + add_shortcode( 'ultimatemember_directory', array( &$this, 'ultimatemember_directory' ) ); + add_shortcode( 'um_loggedin', array( &$this, 'um_loggedin' ) ); add_shortcode( 'um_loggedout', array( &$this, 'um_loggedout' ) ); add_shortcode( 'um_show_content', array( &$this, 'um_shortcode_show_content_for_role' ) ); @@ -375,8 +380,14 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { return $output; } - /*** - *** @Logged-out only content + + /** + * Logged-out only content + * + * @param array $args + * @param string $content + * + * @return string */ function um_loggedout($args = array(), $content = "") { ob_start(); @@ -393,6 +404,94 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { } + /** + * @param array $args + * + * @return string + */ + function ultimatemember_login( $args = array() ) { + global $wpdb; + + $args = ! empty( $args ) ? $args : array(); + + $default_login = $wpdb->get_var( + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm + LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'login' AND + pm2.meta_value = '1'" + ); + + $args['form_id'] = $default_login; + $shortcode_attrs = ''; + foreach ( $args as $key => $value ) { + $shortcode_attrs .= " {$key}=\"{$value}\""; + } + + return do_shortcode( "[ultimatemember {$shortcode_attrs} /]" ); + } + + + /** + * @param array $args + * + * @return string + */ + function ultimatemember_register( $args = array() ) { + global $wpdb; + + $args = ! empty( $args ) ? $args : array(); + + $default_register = $wpdb->get_var( + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm + LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'register' AND + pm2.meta_value = '1'" + ); + + $args['form_id'] = $default_register; + $shortcode_attrs = ''; + foreach ( $args as $key => $value ) { + $shortcode_attrs .= " {$key}=\"{$value}\""; + } + + return do_shortcode( "[ultimatemember {$shortcode_attrs} /]" ); + } + + + /** + * @param array $args + * + * @return string + */ + function ultimatemember_profile( $args = array() ) { + global $wpdb; + + $args = ! empty( $args ) ? $args : array(); + + $default_profile = $wpdb->get_var( + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm + LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'profile' AND + pm2.meta_value = '1'" + ); + + $args['form_id'] = $default_profile; + + $shortcode_attrs = ''; + foreach ( $args as $key => $value ) { + $shortcode_attrs .= " {$key}=\"{$value}\""; + } + + return do_shortcode( "[ultimatemember {$shortcode_attrs} /]" ); + } + + /** * Shortcode * @@ -813,7 +912,33 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { * @return string */ function get_shortcode( $post_id ) { - $shortcode = '[ultimatemember form_id=' . $post_id . ']'; + $shortcode = '[ultimatemember form_id="' . $post_id . '"]'; + return $shortcode; + } + + + /** + * Get Shortcode for given form ID + * + * @param $post_id + * + * @return string + */ + function get_default_shortcode( $post_id ) { + $mode = UM()->query()->get_attr( 'mode', $post_id ); + + switch ( $mode ) { + case 'login': + $shortcode = '[ultimatemember_login]'; + break; + case 'profile': + $shortcode = '[ultimatemember_profile]'; + break; + case 'register': + $shortcode = '[ultimatemember_register]'; + break; + } + return $shortcode; } diff --git a/templates/message.php b/templates/message.php index e0ee773e..2b9bb7bd 100644 --- a/templates/message.php +++ b/templates/message.php @@ -2,7 +2,7 @@
- custom_message; ?> + custom_message ); ?>
diff --git a/templates/profile.php b/templates/profile.php index 82129b90..8694ce19 100644 --- a/templates/profile.php +++ b/templates/profile.php @@ -192,6 +192,9 @@ if ( um_is_on_edit_profile() ) { ?> - + \ No newline at end of file From be5dc07f6365a2359b5f912af7bf6794792723e3 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Tue, 23 Oct 2018 00:36:27 +0300 Subject: [PATCH 11/22] - default shortcodes; - enqueue dependencies; --- .../admin/assets/css/um-admin-columns.css | 1 + includes/admin/core/class-admin-columns.php | 24 ++++++- includes/admin/core/class-admin-metabox.php | 23 +++++- .../admin/templates/directory/shortcode.php | 21 ++++++ includes/core/class-enqueue.php | 71 +++---------------- includes/core/class-shortcodes.php | 33 +++++++++ 6 files changed, 108 insertions(+), 65 deletions(-) diff --git a/includes/admin/assets/css/um-admin-columns.css b/includes/admin/assets/css/um-admin-columns.css index 34b41462..25ff9e7a 100644 --- a/includes/admin/assets/css/um-admin-columns.css +++ b/includes/admin/assets/css/um-admin-columns.css @@ -13,6 +13,7 @@ .um-admin.post-type-um_directory .manage-column.column-id {width: 60px} .um-admin.post-type-um_directory .manage-column.column-title {width: 250px} +.um-admin.post-type-um_directory .manage-column.column-is_default {width: 60px} .um-admin.post-type-um_role .manage-column.column-title {width: 200px} .um-admin.post-type-um_role .manage-column.column-count {width: 150px} diff --git a/includes/admin/core/class-admin-columns.php b/includes/admin/core/class-admin-columns.php index 91644f75..c5d85ba0 100644 --- a/includes/admin/core/class-admin-columns.php +++ b/includes/admin/core/class-admin-columns.php @@ -112,6 +112,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) { $new_columns['cb'] = ''; $new_columns['title'] = __( 'Title', 'ultimate-member' ); $new_columns['id'] = __( 'ID', 'ultimate-member' ); + $new_columns['is_default'] = __( 'Default', 'ulitmate-member' ); $new_columns['shortcode'] = __( 'Shortcode', 'ultimate-member' ); $new_columns['date'] = __( 'Date', 'ultimate-member' ); @@ -132,7 +133,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) { break; case 'shortcode': - echo UM()->shortcodes()->get_shortcode( $id ); + $is_default = UM()->query()->get_attr( 'is_default', $id ); + + if ( $is_default ) { + echo UM()->shortcodes()->get_default_shortcode( $id ); + } else { + echo UM()->shortcodes()->get_shortcode( $id ); + } + break; case 'is_default': @@ -149,7 +157,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) { /** - * Display cusom columns for Directory + * Display custom columns for Directory * * @param string $column_name * @param int $id @@ -160,7 +168,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) { echo ''.$id.''; break; case 'shortcode': - echo UM()->shortcodes()->get_shortcode( $id ); + $is_default = UM()->query()->get_attr( 'is_default', $id ); + + if ( $is_default ) { + echo UM()->shortcodes()->get_default_shortcode( $id ); + } else { + echo UM()->shortcodes()->get_shortcode( $id ); + } + break; + case 'is_default': + $is_default = UM()->query()->get_attr( 'is_default', $id ); + echo empty( $is_default ) ? __( 'No', 'ultimate-member' ) : __( 'Yes', 'ultimate-member' ); break; } } diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 0474ebd3..5aabaee3 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -1087,6 +1087,21 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { $v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY ); } if ( strstr( $k, '_um_' ) ) { + if ( $k === '_um_is_default' ) { + $mode = UM()->query()->get_attr( 'mode', $post_id ); + if ( ! empty( $mode ) ) { + $posts = $wpdb->get_col( + "SELECT post_id + FROM {$wpdb->postmeta} + WHERE meta_key = '_um_mode' AND + meta_value = 'directory'" + ); + foreach ( $posts as $p_id ) { + delete_post_meta( $p_id, '_um_is_default' ); + } + } + } + update_post_meta( $post_id, $k, $v ); } } @@ -1125,7 +1140,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { if ( $k === '_um_is_default' ) { $mode = UM()->query()->get_attr( 'mode', $post_id ); if ( ! empty( $mode ) ) { - $posts = $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_um_mode' AND meta_value = %s", $mode ) ); + $posts = $wpdb->get_col( $wpdb->prepare( + "SELECT post_id + FROM {$wpdb->postmeta} + WHERE meta_key = '_um_mode' AND + meta_value = %s", + $mode + ) ); foreach ( $posts as $p_id ) { delete_post_meta( $p_id, '_um_is_default' ); } diff --git a/includes/admin/templates/directory/shortcode.php b/includes/admin/templates/directory/shortcode.php index 35124f74..f26a7139 100644 --- a/includes/admin/templates/directory/shortcode.php +++ b/includes/admin/templates/directory/shortcode.php @@ -1,3 +1,24 @@
+ admin_forms( array( + 'class' => 'um-member-directory-shortcode um-top-label', + 'prefix_id' => 'um_metadata', + 'fields' => array( + array( + 'id' => '_um_is_default', + 'type' => 'select', + 'label' => __( 'Default Member Directory', 'ultimate-member' ), + 'tooltip' => sprintf( __( 'If you set this member directory as default you will have an ability to use %s shortcode for the displaying directory at the page. Otherwise you will have to use %s', 'ultimate-member' ), UM()->shortcodes()->get_default_shortcode( get_the_ID() ), UM()->shortcodes()->get_shortcode( get_the_ID() ) ), + 'value' => UM()->query()->get_meta_value( '_um_is_default' ), + 'options' => array( + 0 => __( 'No', 'ultimate-member' ), + 1 => __( 'Yes', 'ultimate-member' ), + ), + ), + ) + ) )->render_form(); ?> + +
+

shortcodes()->get_shortcode( get_the_ID() ); ?>

+

shortcodes()->get_default_shortcode( get_the_ID() ); ?>

\ No newline at end of file diff --git a/includes/core/class-enqueue.php b/includes/core/class-enqueue.php index f8031bb0..80700341 100644 --- a/includes/core/class-enqueue.php +++ b/includes/core/class-enqueue.php @@ -71,6 +71,16 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { */ function wp_enqueue_scripts() { + $dequeue_select2 = apply_filters( 'um_dequeue_select2_scripts', false ); + + if ( class_exists( 'WooCommerce' ) || $dequeue_select2 ) { + wp_dequeue_style( 'select2' ); + wp_deregister_style( 'select2' ); + + wp_dequeue_script( 'select2'); + wp_deregister_script('select2'); + } + wp_register_script( 'um_scrollto', $this->js_baseurl . 'um-scrollto' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_scrollbar', $this->js_baseurl . 'um-scrollbar' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); @@ -259,20 +269,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { */ function load_selectjs() { - $dequeue_select2 = apply_filters( 'um_dequeue_select2_scripts', false ); - - if ( class_exists( 'WooCommerce' ) || $dequeue_select2 ) { - wp_dequeue_style( 'select2' ); - wp_deregister_style( 'select2' ); - - wp_dequeue_script( 'select2'); - wp_deregister_script('select2'); - } - - wp_register_script('select2', um_url . 'assets/js/select2/select2.full.min.js', array('jquery', 'jquery-masonry') ); wp_enqueue_script('select2'); - - wp_register_style('select2', um_url . 'assets/css/select2/select2.min.css' ); wp_enqueue_style('select2'); } @@ -282,13 +279,8 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load Fonticons */ function load_fonticons(){ - - wp_register_style('um_fonticons_ii', um_url . 'assets/css/um-fonticons-ii.css' ); wp_enqueue_style('um_fonticons_ii'); - - wp_register_style('um_fonticons_fa', um_url . 'assets/css/um-fonticons-fa.css' ); wp_enqueue_style('um_fonticons_fa'); - } @@ -296,16 +288,9 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load fileupload JS */ function load_fileupload() { - - wp_register_script('um_jquery_form', um_url . 'assets/js/um-jquery-form' . $this->suffix . '.js' ); wp_enqueue_script('um_jquery_form'); - - wp_register_script('um_fileupload', um_url . 'assets/js/um-fileupload' . $this->suffix . '.js' ); wp_enqueue_script('um_fileupload'); - - wp_register_style('um_fileupload', um_url . 'assets/css/um-fileupload.css' ); wp_enqueue_style('um_fileupload'); - } @@ -374,28 +359,13 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load date & time picker */ function load_datetimepicker() { - - wp_register_script('um_datetime', um_url . 'assets/js/pickadate/picker.js' ); wp_enqueue_script('um_datetime'); - - wp_register_script('um_datetime_date', um_url . 'assets/js/pickadate/picker.date.js' ); wp_enqueue_script('um_datetime_date'); - - wp_register_script('um_datetime_time', um_url . 'assets/js/pickadate/picker.time.js' ); wp_enqueue_script('um_datetime_time'); - - wp_register_script('um_datetime_legacy', um_url . 'assets/js/pickadate/legacy.js' ); wp_enqueue_script('um_datetime_legacy'); - - wp_register_style('um_datetime', um_url . 'assets/css/pickadate/default.css' ); wp_enqueue_style('um_datetime'); - - wp_register_style('um_datetime_date', um_url . 'assets/css/pickadate/default.date.css' ); wp_enqueue_style('um_datetime_date'); - - wp_register_style('um_datetime_time', um_url . 'assets/css/pickadate/default.time.css' ); wp_enqueue_style('um_datetime_time'); - } @@ -403,10 +373,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load scrollto */ function load_scrollto(){ - - wp_register_script('um_scrollto', um_url . 'assets/js/um-scrollto' . $this->suffix . '.js' ); wp_enqueue_script('um_scrollto'); - } @@ -414,13 +381,8 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load scrollbar */ function load_scrollbar(){ - - wp_register_script('um_scrollbar', um_url . 'assets/js/um-scrollbar' . $this->suffix . '.js' ); wp_enqueue_script('um_scrollbar'); - - wp_register_style('um_scrollbar', um_url . 'assets/css/um-scrollbar.css' ); wp_enqueue_style('um_scrollbar'); - } @@ -428,10 +390,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load rating */ function load_raty() { - wp_register_script('um_raty', um_url . 'assets/js/um-raty' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_enqueue_script('um_raty'); - - wp_register_style('um_raty', um_url . 'assets/css/um-raty.css', array(), ultimatemember_version ); wp_enqueue_style('um_raty'); } @@ -440,13 +399,8 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load crop script */ function load_imagecrop(){ - - wp_register_script('um_crop', um_url . 'assets/js/um-crop' . $this->suffix . '.js' ); wp_enqueue_script('um_crop'); - - wp_register_style('um_crop', um_url . 'assets/css/um-crop.css' ); wp_enqueue_style('um_crop'); - } @@ -454,13 +408,8 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { * Load tipsy */ function load_tipsy(){ - - wp_register_script('um_tipsy', um_url . 'assets/js/um-tipsy' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_enqueue_script('um_tipsy'); - - wp_register_style('um_tipsy', um_url . 'assets/css/um-tipsy.css', array(), ultimatemember_version ); wp_enqueue_style('um_tipsy'); - } diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php index ac667267..6df7c214 100644 --- a/includes/core/class-shortcodes.php +++ b/includes/core/class-shortcodes.php @@ -492,6 +492,36 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { } + /** + * @param array $args + * + * @return string + */ + function ultimatemember_directory( $args = array() ) { + global $wpdb; + + $args = ! empty( $args ) ? $args : array(); + + $default_directory = $wpdb->get_var( + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm + LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'directory' AND + pm2.meta_value = '1'" + ); + + $args['form_id'] = $default_directory; + + $shortcode_attrs = ''; + foreach ( $args as $key => $value ) { + $shortcode_attrs .= " {$key}=\"{$value}\""; + } + + return do_shortcode( "[ultimatemember {$shortcode_attrs} /]" ); + } + + /** * Shortcode * @@ -937,6 +967,9 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { case 'register': $shortcode = '[ultimatemember_register]'; break; + case 'directory': + $shortcode = '[ultimatemember_directory]'; + break; } return $shortcode; From 3f9d0b71eb954bc362daf80d000f2f349cc41bc1 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Tue, 23 Oct 2018 10:48:55 +0300 Subject: [PATCH 12/22] - fixed files download for sites with cache; - changes in scripts enqueue; --- assets/js/um-scrollto.js | 210 --------------------------- assets/js/um-scrollto.min.js | 1 - assets/js/um-select.js | 22 --- assets/js/um-select.min.js | 1 - includes/core/class-enqueue.php | 21 +-- includes/core/class-files.php | 6 +- includes/core/class-uploader.php | 8 +- includes/core/um-actions-profile.php | 12 +- 8 files changed, 21 insertions(+), 260 deletions(-) delete mode 100644 assets/js/um-scrollto.js delete mode 100644 assets/js/um-scrollto.min.js delete mode 100644 assets/js/um-select.js delete mode 100644 assets/js/um-select.min.js diff --git a/assets/js/um-scrollto.js b/assets/js/um-scrollto.js deleted file mode 100644 index 0087f27e..00000000 --- a/assets/js/um-scrollto.js +++ /dev/null @@ -1,210 +0,0 @@ -/*! - * jQuery.scrollTo - * Copyright (c) 2007-2015 Ariel Flesler - afleslergmailcom | http://flesler.blogspot.com - * Licensed under MIT - * http://flesler.blogspot.com/2007/10/jqueryscrollto.html - * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery - * @author Ariel Flesler - * @version 2.1.1 - */ -;(function(factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - // AMD - define(['jquery'], factory); - } else if (typeof module !== 'undefined' && module.exports) { - // CommonJS - module.exports = factory(require('jquery')); - } else { - // Global - factory(jQuery); - } -})(function($) { - 'use strict'; - - var $scrollTo = $.scrollTo = function(target, duration, settings) { - return $(window).scrollTo(target, duration, settings); - }; - - $scrollTo.defaults = { - axis:'xy', - duration: 0, - limit:true - }; - - function isWin(elem) { - return !elem.nodeName || - $.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1; - } - - $.fn.scrollTo = function(target, duration, settings) { - if (typeof duration === 'object') { - settings = duration; - duration = 0; - } - if (typeof settings === 'function') { - settings = { onAfter:settings }; - } - if (target === 'max') { - target = 9e9; - } - - settings = $.extend({}, $scrollTo.defaults, settings); - // Speed is still recognized for backwards compatibility - duration = duration || settings.duration; - // Make sure the settings are given right - var queue = settings.queue && settings.axis.length > 1; - if (queue) { - // Let's keep the overall duration - duration /= 2; - } - settings.offset = both(settings.offset); - settings.over = both(settings.over); - - return this.each(function() { - // Null target yields nothing, just like jQuery does - if (target === null) return; - - var win = isWin(this), - elem = win ? this.contentWindow || window : this, - $elem = $(elem), - targ = target, - attr = {}, - toff; - - switch (typeof targ) { - // A number will pass the regex - case 'number': - case 'string': - if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) { - targ = both(targ); - // We are done - break; - } - // Relative/Absolute selector - targ = win ? $(targ) : $(targ, elem); - if (!targ.length) return; - /* falls through */ - case 'object': - // DOMElement / jQuery - if (targ.is || targ.style) { - // Get the real position of the target - toff = (targ = $(targ)).offset(); - } - } - - var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset; - - $.each(settings.axis.split(''), function(i, axis) { - var Pos = axis === 'x' ? 'Left' : 'Top', - pos = Pos.toLowerCase(), - key = 'scroll' + Pos, - prev = $elem[key](), - max = $scrollTo.max(elem, axis); - - if (toff) {// jQuery / DOMElement - attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]); - - // If it's a dom element, reduce the margin - if (settings.margin) { - attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0; - attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0; - } - - attr[key] += offset[pos] || 0; - - if (settings.over[pos]) { - // Scroll to a fraction of its width/height - attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos]; - } - } else { - var val = targ[pos]; - // Handle percentage values - attr[key] = val.slice && val.slice(-1) === '%' ? - parseFloat(val) / 100 * max - : val; - } - - // Number or 'number' - if (settings.limit && /^\d+$/.test(attr[key])) { - // Check the limits - attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max); - } - - // Don't waste time animating, if there's no need. - if (!i && settings.axis.length > 1) { - if (prev === attr[key]) { - // No animation needed - attr = {}; - } else if (queue) { - // Intermediate animation - animate(settings.onAfterFirst); - // Don't animate this axis again in the next iteration. - attr = {}; - } - } - }); - - animate(settings.onAfter); - - function animate(callback) { - var opts = $.extend({}, settings, { - // The queue setting conflicts with animate() - // Force it to always be true - queue: true, - duration: duration, - complete: callback && function() { - callback.call(elem, targ, settings); - } - }); - $elem.animate(attr, opts); - } - }); - }; - - // Max scrolling position, works on quirks mode - // It only fails (not too badly) on IE, quirks mode. - $scrollTo.max = function(elem, axis) { - var Dim = axis === 'x' ? 'Width' : 'Height', - scroll = 'scroll'+Dim; - - if (!isWin(elem)) - return elem[scroll] - $(elem)[Dim.toLowerCase()](); - - var size = 'client' + Dim, - doc = elem.ownerDocument || elem.document, - html = doc.documentElement, - body = doc.body; - - return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]); - }; - - function both(val) { - return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val }; - } - - // Add special hooks so that window scroll properties can be animated - $.Tween.propHooks.scrollLeft = - $.Tween.propHooks.scrollTop = { - get: function(t) { - return $(t.elem)[t.prop](); - }, - set: function(t) { - var curr = this.get(t); - // If interrupt is true and user scrolled, stop animating - if (t.options.interrupt && t._last && t._last !== curr) { - return $(t.elem).stop(); - } - var next = Math.round(t.now); - // Don't waste CPU - // Browsers don't render floating point scroll - if (curr !== next) { - $(t.elem)[t.prop](next); - t._last = this.get(t); - } - } - }; - - // AMD requirement - return $scrollTo; -}); diff --git a/assets/js/um-scrollto.min.js b/assets/js/um-scrollto.min.js deleted file mode 100644 index 5c694d1b..00000000 --- a/assets/js/um-scrollto.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(w){"use strict";var y=w.scrollTo=function(e,t,o){return w(window).scrollTo(e,t,o)};function g(e){return!e.nodeName||-1!==w.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])}function t(e){return w.isFunction(e)||w.isPlainObject(e)?e:{top:e,left:e}}return y.defaults={axis:"xy",duration:0,limit:!0},w.fn.scrollTo=function(e,o,x){"object"==typeof o&&(x=o,o=0),"function"==typeof x&&(x={onAfter:x}),"max"===e&&(e=9e9),x=w.extend({},y.defaults,x),o=o||x.duration;var v=x.queue&&1c;c+=1)if(r(a,b[c]))return c;return-1}function q(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function r(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function s(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function t(a){return a.outerWidth(!1)-a.width()}function u(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function v(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function w(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function x(a,b){var c=w(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){p(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus();var e=b.offsetWidth>0||b.offsetHeight>0;e&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=o(a.toUpperCase()).indexOf(o(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push(""),c.push(d(a.substring(e,e+f))),c.push(""),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page);i.callback(b)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function K(b){if(a.isFunction(b)){var c=Array.prototype.slice.call(arguments,1);return b.apply(null,c)}return b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(r(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(){var a=this;Array.prototype.forEach.call(arguments,function(b){a[b].remove(),a[b]=null})}function O(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="
",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z"};j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=O(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,f=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a("",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a("body"),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss)),this.container.addClass(K(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),v(this.results),this.dropdown.on("mousemove-filtered",f,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",f,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",f,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",f,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),u(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.nextSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||q(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show()),N.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:r(a.attr("locked"),"locked")||r(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,h,i=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a ","
"," ","
    ","
","
"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"selection","focusser")},initContainer:function(){var b,h,d=this.container,e=this.dropdown,f=g();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=d.find(".select2-choice"),this.focusser=d.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+f),this.focusser.attr("aria-labelledby","select2-chosen-"+f),this.results.attr("id","select2-results-"+f),this.search.attr("aria-owns","select2-results-"+f),this.focusser.attr("id","s2id_autogen"+f),h=a("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(h.text()).attr("for",this.focusser.attr("id"));var i=this.opts.element.attr("title");this.opts.element.attr("title",i||h.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)return A(a),void 0;switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case c.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.ESC){if(this.opts.openOnEnter===!1&&a.which===c.ENTER)return A(a),void 0;if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==c.DELETE||a.which==c.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),u(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection.focus())})),b.on("mousedown touchstart",this.bind(function(c){n(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(c)})),e.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder(),c.nextSearchTerm=c.opts.nextSearchTerm(a,c.search.val()))})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()===b?!1:(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=r(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return r(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),r(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),f=O(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["
    ","
  • "," "," ","
  • ","
","
","
    ","
","
"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=s(c.val(),b.separator),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return r(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){p(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,c){this.triggerSelect(a)&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),c&&c.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("
  • "),f=a("
  • "),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith("
    "+j+"
    "),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),A(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){var f=a.Event("select2-removing");if(f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented())return!1;for(;(e=p(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));p(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("
  • "+K(g.opts.formatNoMatches,g.search.val())+"
  • ")},getMaxSearchWidth:function(){return this.selection.width()-t(this.search)},resizeSearch:function(){var a,b,c,d,e,f=t(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),s(a,this.opts.separator))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){p(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,e,f,g,h,c=Array.prototype.slice.call(arguments,0),i=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],j=["opened","isFocused","container","dropdown"],k=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?h=d.element.prop("multiple"):(h=d.multiple||!1,"tags"in d&&(d.multiple=h=!0)),e=h?new window.Select2["class"].multi:new window.Select2["class"].single,e.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(p(c[0],i)<0)throw"Unknown method: "+c[0];if(g=b,e=a(this).data("select2"),e===b)return;if(f=c[0],"container"===f?g=e.container:"dropdown"===f?g=e.dropdown:(l[f]&&(f=l[f]),g=e[f].apply(e,c.slice(1))),p(c[0],j)>=0||p(c[0],k)>=0&&1==c.length)return!1}}),g===b?this:g},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(a.text,c.term,e,d),e.join("")},formatSelection:function(a,c,d){return a?d(a.text):b},sortResults:function(a){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(){return b},formatMatches:function(a){return a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results\u2026"},formatSearching:function(){return"Searching\u2026"},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},matcher:function(a,b){return o(""+b).toUpperCase().indexOf(o(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return b?a.opts.minimumResultsForSearch<0?!1:!0:!0}},a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":d,single:e,multi:f}}}}(jQuery); \ No newline at end of file diff --git a/assets/js/um-select.min.js b/assets/js/um-select.min.js deleted file mode 100644 index e0259f03..00000000 --- a/assets/js/um-select.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(n){void 0===n.fn.each2&&n.extend(n.fn,{each2:function(e){for(var t=n([0]),s=-1,i=this.length;++s"),s.push(i(e.substring(n,n+o))),s.push(""),void s.push(i(e.substring(n+o,e.length))))}function e(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function i(a){var e,r=null,t=a.quietMillis||100,c=a.url,l=this;return function(o){window.clearTimeout(e),e=window.setTimeout(function(){var e=a.data,t=c,s=a.transport||S.fn.select2.ajaxDefaults.transport,i={type:a.type||"GET",cache:a.cache||!1,jsonpCallback:a.jsonpCallback||b,dataType:a.dataType||"json"},n=S.extend({},S.fn.select2.ajaxDefaults.params,i);e=e?e.call(l,o.term,o.page,o.context):null,t="function"==typeof t?t.call(l,o.term,o.page,o.context):t,r&&"function"==typeof r.abort&&r.abort(),a.params&&(S.isFunction(a.params)?S.extend(n,a.params.call(l)):S.extend(n,a.params)),S.extend(n,{url:t,dataType:a.dataType,data:e,success:function(e){var t=a.results(e,o.page);o.callback(t)}}),r=s.call(l,n)},t)}}function g(e){var t,s,i=e,r=function(e){return""+e.text};S.isArray(i)&&(i={results:s=i}),!1===S.isFunction(i)&&(s=i,i=function(){return s});var n=i();return n.text&&(r=n.text,S.isFunction(r)||(t=n.text,r=function(e){return e[t]})),function(n){var o,a=n.term,s={results:[]};return""===a?void n.callback(i()):(o=function(e,t){var s,i;if((e=e[0]).children){for(i in s={},e)e.hasOwnProperty(i)&&(s[i]=e[i]);s.children=[],S(e.children).each2(function(e,t){o(t,s.children)}),(s.children.length||n.matcher(a,r(s),e))&&t.push(s)}else n.matcher(a,r(e),e)&&t.push(e)},S(i().results).each2(function(e,t){o(t,s.results)}),void n.callback(s))}}function m(t){var o=S.isFunction(t);return function(s){var i=s.term,n={results:[]},e=o?t(s):t;S.isArray(e)&&(S(e).each(function(){var e=this.text!==b,t=e?this.text:this;(""===i||s.matcher(i,t))&&n.results.push(e?this:{id:this,text:this})}),s.callback(n))}}function v(e,t){if(S.isFunction(e))return!0;if(!e)return!1;if("string"==typeof e)return!0;throw new Error(t+" must be a string, function, or falsy value")}function y(e){if(S.isFunction(e)){var t=Array.prototype.slice.call(arguments,1);return e.apply(null,t)}return e}function s(){var t=this;Array.prototype.forEach.call(arguments,function(e){t[e].remove(),t[e]=null})}function t(e,t){var s=function(){};return((s.prototype=new e).constructor=s).prototype.parent=e.prototype,s.prototype=S.extend(s.prototype,t),s}if(window.Select2===b){var w,C,E,x,T,O,P,I={x:0,y:0},k={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(e){switch(e.which){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return 112<=(e=e.which?e.which:e)&&e<=123}},A={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};O=S(document),R=1,x=function(){return R++},O.on("mousemove",function(e){I.x=e.pageX,I.y=e.pageY}),C=t(w=t(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(e){var o,t,s,i,n,a=".select2-results";this.opts=e=this.prepareOpts(e),this.id=e.id,e.element.data("select2")!==b&&null!==e.element.data("select2")&&e.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=S("",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(e.element.attr("id")||"autogen"+x()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",e.element.attr("title")),this.body=S("body"),f(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",e.element.attr("style")),this.container.css(y(e.containerCss)),this.container.addClass(y(e.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",u),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),f(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(y(e.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",u),this.results=o=this.container.find(a),this.search=t=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",u),this.results.on("mousemove",function(e){var t=I;(t===b||t.x!==e.pageX||t.y!==e.pageY)&&S(e.target).trigger("mousemove-filtered",e)}),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),s=80,i=this.results,n=d(s,function(e){i.trigger("scroll-debounced",e)}),i.on("scroll",function(e){0<=h(e.target,i.get())&&n(e)}),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),S(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),S(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),S.fn.mousewheel&&o.mousewheel(function(e,t,s,i){var n=o.scrollTop();0");e.appendTo("body");var t={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),t}(),this.autofocus=e.element.prop("autofocus"),e.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",e.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,t=e.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),t!==b&&(t.container.remove(),t.liveRegion.remove(),t.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),s.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:p(e.attr("locked"),"locked")||p(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(v){var a,e,t,s,w=this;if("select"===(a=v.element).get(0).tagName.toLowerCase()&&(this.select=e=v.element),e&&S.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in v)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a ","
    "," ","
      ","
    ","
    "].join(""))},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var e,t,s;0<=this.opts.minimumResultsForSearch&&this.showSearch(!0),this.parent.opening.apply(this,arguments),!1!==this.showSearchInput&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),(e=this.search.get(0)).createTextRange?((t=e.createTextRange()).collapse(!1),t.select()):e.setSelectionRange&&(s=this.search.val().length,e.setSelectionRange(s,s))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(S.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){S("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),s.call(this,"selection","focusser")},initContainer:function(){var t,e,s=this.container,i=this.dropdown,n=x();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=s.find(".select2-choice"),this.focusser=s.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+n),this.focusser.attr("aria-labelledby","select2-chosen-"+n),this.results.attr("id","select2-results-"+n),this.search.attr("aria-owns","select2-results-"+n),this.focusser.attr("id","s2id_autogen"+n),e=S("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(e.text()).attr("for",this.focusser.attr("id"));var o=this.opts.element.attr("title");this.opts.element.attr("title",o||e.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(S("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){if(e.which===k.PAGE_UP||e.which===k.PAGE_DOWN)return void u(e);switch(e.which){case k.UP:case k.DOWN:return this.moveHighlight(e.which===k.UP?-1:1),void u(e);case k.ENTER:return this.selectHighlighted(),void u(e);case k.TAB:return void this.selectHighlighted({noFocus:!0});case k.ESC:return this.cancel(e),void u(e)}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&e.which!==k.TAB&&!k.isControl(e)&&!k.isFunctionKey(e)&&e.which!==k.ESC){if(!1===this.opts.openOnEnter&&e.which===k.ENTER)return void u(e);if(e.which==k.DOWN||e.which==k.UP||e.which==k.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void u(e)}return e.which==k.DELETE||e.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),void u(e)):void 0}})),l(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(0<=this.opts.minimumResultsForSearch){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){var t;this.isInterfaceEnabled()&&(this.clear(),(t=e).preventDefault(),t.stopImmediatePropagation(),this.close(),this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(e){a(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),u(e)})),i.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){u(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(S.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(e){var t=this.selection.data("select2-data");if(t){var s=S.Event("select2-clearing");if(this.opts.element.trigger(s),s.isDefaultPrevented())return;var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),!1!==e&&(this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var t=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==b&&null!==e&&(t.updateSelection(e),t.close(),t.setPlaceholder(),t.nextSearchTerm=t.opts.nextSearchTerm(e,t.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()!==b&&((e=this.getPlaceholderOption())!==b&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val())},prepareOpts:function(){var a=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===a.element.get(0).tagName.toLowerCase()?a.initSelection=function(e,t){var s=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(s))}:"data"in a&&(a.initSelection=a.initSelection||function(e,t){var n=e.val(),o=null;a.query({matcher:function(e,t,s){var i=p(n,a.id(s));return i&&(o=s),i},callback:S.isFunction(t)?function(){t(o)}:S.noop})}),a},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,s){var i=0,n=this;if(this.findHighlightableChoices().each2(function(e,t){return p(n.id(t.data("select2-data")),n.opts.element.val())?(i=e,!1):void 0}),!1!==s&&(!0===t&&0<=i?this.highlight(i):this.highlight(0)),!0===t){var o=this.opts.minimumResultsForSearch;0<=o&&this.showSearch(function s(e){var i=0;return S.each(e,function(e,t){t.children?i+=s(t.children):i++}),i}(e.results)>=o)}},showSearch:function(e){this.showSearchInput!==e&&(this.showSearchInput=e,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!e),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!e),S(this.dropdown,this.container).toggleClass("select2-with-searchbox",e))},onSelect:function(e,t){if(this.triggerSelect(e)){var s=this.opts.element.val(),i=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.close(),t&&t.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),p(s,this.id(e))||this.triggerChange({added:e,removed:i})}},updateSelection:function(e){var t,s,i=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),i.empty(),null!==e&&(t=this.opts.formatSelection(e,i,this.opts.escapeMarkup)),t!==b&&i.append(t),(s=this.opts.formatSelectionCssClass(e,i))!==b&&i.addClass(s),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var e,t=!1,s=null,i=this,n=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],1","
  • "," "," ","
  • ","","
    ","
      ","
    ","
    "].join(""))},prepareOpts:function(){var c=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===c.element.get(0).tagName.toLowerCase()?c.initSelection=function(e,t){var s=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){s.push(i.optionToData(t))}),t(s)}:"data"in c&&(c.initSelection=c.initSelection||function(e,o){var a=n(e.val(),c.separator),r=[];c.query({matcher:function(e,t,s){var i=S.grep(a,function(e){return p(e,c.id(s))}).length;return i&&r.push(s),i},callback:S.isFunction(o)?function(){for(var e=[],t=0;t=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),t&&t.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(e){var t,s,i=!e.locked,n=S("
  • "),o=S("
  • "),a=i?n:o,r=this.id(e),c=this.getVal();(t=this.opts.formatSelection(e,a.find("div"),this.opts.escapeMarkup))!=b&&a.find("div").replaceWith("
    "+t+"
    "),(s=this.opts.formatSelectionCssClass(e,a.find("div")))!=b&&a.addClass(s),i&&a.find(".select2-search-choice-close").on("mousedown",u).on("click dblclick",this.bind(function(e){this.isInterfaceEnabled()&&(this.unselect(S(e.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),u(e),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),a.data("select2-data",e),a.insertBefore(this.searchContainer),c.push(r),this.setVal(c)},unselect:function(e){var t,s,i=this.getVal();if(0===(e=e.closest(".select2-search-choice")).length)throw"Invalid argument: "+e+". Must be .select2-search-choice";if(t=e.data("select2-data")){var n=S.Event("select2-removing");if(n.val=this.id(t),n.choice=t,this.opts.element.trigger(n),n.isDefaultPrevented())return!1;for(;0<=(s=h(this.id(t),i));)i.splice(s,1),this.setVal(i),this.select&&this.postprocessResults();return e.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}),!0}},postprocessResults:function(e,t,s){var i=this.getVal(),n=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),a=this;n.each2(function(e,t){0<=h(a.id(t.data("select2-data")),i)&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),-1==this.highlight()&&!1!==s&&a.highlight(0),!this.opts.createSearchChoice&&0"+y(a.opts.formatNoMatches,a.search.val())+"")},getMaxSearchWidth:function(){return this.selection.width()-o(this.search)},resizeSearch:function(){var e,t,s,i,n=o(this.search);e=function(e){if(!T){var t=e[0].currentStyle||window.getComputedStyle(e[0],null);(T=S(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,textTransform:t.textTransform,whiteSpace:"nowrap"})).attr("class","select2-sizer"),S("body").append(T)}return T.text(e.val()),T.width()}(this.search)+10,t=this.search.offset().left,(i=(s=this.selection.width())-(t-this.selection.offset().left)-n). Attach to instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var e=[],t=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){e.push(t.opts.id(S(this).data("select2-data")))}),this.setVal(e),this.triggerChange()},data:function(e,t){var s,i,n=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return S(this).data("select2-data")}).get():(i=this.data(),e||(e=[]),s=S.map(e,function(e){return n.opts.id(e)}),this.setVal(s),this.updateSelection(e),this.clearSearch(),void(t&&this.triggerChange(this.buildChangeDetails(i,this.data()))))}}),S.fn.select2=function(){var e,t,s,i,n,o=Array.prototype.slice.call(arguments,0),a=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],r=["opened","isFocused","container","dropdown"],c=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===o.length||"object"==typeof o[0])(e=0===o.length?{}:S.extend({},o[0])).element=S(this),"select"===e.element.get(0).tagName.toLowerCase()?n=e.element.prop("multiple"):(n=e.multiple||!1,"tags"in e&&(e.multiple=n=!0)),(t=n?new window.Select2.class.multi:new window.Select2.class.single).init(e);else{if("string"!=typeof o[0])throw"Invalid arguments to select2 plugin: "+o;if(h(o[0],a)<0)throw"Unknown method: "+o[0];if(i=b,(t=S(this).data("select2"))===b)return;if("container"===(s=o[0])?i=t.container:"dropdown"===s?i=t.dropdown:(l[s]&&(s=l[s]),i=t[s].apply(t,o.slice(1))),0<=h(o[0],r)||0<=h(o[0],c)&&1==o.length)return!1}}),i===b?this:i},S.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,s,i){var n=[];return c(e.text,s.term,n,i),n.join("")},formatSelection:function(e,t,s){return e?s(e.text):b},sortResults:function(e){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(){return b},formatMatches:function(e){return e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(e,t){var s=t-e.length;return"Please enter "+s+" or more character"+(1==s?"":"s")},formatInputTooLong:function(e,t){var s=e.length-t;return"Please delete "+s+" character"+(1==s?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(){return"Loading more results…"},formatSearching:function(){return"Searching…"},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==b?null:e.id},matcher:function(e,t){return 0<=r(""+t).toUpperCase().indexOf(r(""+e).toUpperCase())},separator:",",tokenSeparators:[],tokenizer:function(e,t,s,i){var n,o,a,r,c,l=e,h=!1;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return b;for(;;){for(o=-1,a=0,r=i.tokenSeparators.length;ajs_baseurl . 'select2/select2.full.min.js', array( 'jquery', 'jquery-masonry' ), ultimatemember_version, true ); + - wp_register_script( 'um_scrollto', $this->js_baseurl . 'um-scrollto' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_scrollbar', $this->js_baseurl . 'um-scrollbar' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_jquery_form', $this->js_baseurl . 'um-jquery-form' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); - wp_register_script( 'um_fileupload', $this->js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_fileupload', $this->js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery', 'um_jquery_form' ), ultimatemember_version, true ); wp_register_script( 'um_datetime', $this->js_baseurl . 'pickadate/picker.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_datetime_date', $this->js_baseurl . 'pickadate/picker.date.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_datetime_time', $this->js_baseurl . 'pickadate/picker.time.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_datetime_legacy', $this->js_baseurl . 'pickadate/legacy.js', array( 'jquery' ), ultimatemember_version, true ); - wp_register_script( 'select2', $this->js_baseurl . 'select2/select2.full.min.js', array( 'jquery', 'jquery-masonry' ), ultimatemember_version, true ); + wp_register_script( 'um_tipsy', $this->js_baseurl . 'um-tipsy' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_raty', $this->js_baseurl . 'um-raty' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_crop', $this->js_baseurl . 'um-crop' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); @@ -213,7 +213,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { $this->load_raty(); - $this->load_scrollto(); + //$this->load_scrollto(); $this->load_scrollbar(); @@ -299,7 +299,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { */ function load_functions() { - wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry', 'wp-util') ); + wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry', 'wp-util', 'um_scrollbar') ); wp_enqueue_script('um_functions'); wp_enqueue_script( 'um-gdpr', um_url . 'assets/js/um-gdpr' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, false ); @@ -369,19 +369,10 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { } - /** - * Load scrollto - */ - function load_scrollto(){ - wp_enqueue_script('um_scrollto'); - } - - /** * Load scrollbar */ function load_scrollbar(){ - wp_enqueue_script('um_scrollbar'); wp_enqueue_style('um_scrollbar'); } diff --git a/includes/core/class-files.php b/includes/core/class-files.php index 81cbe18a..6f0edf47 100644 --- a/includes/core/class-files.php +++ b/includes/core/class-files.php @@ -83,12 +83,14 @@ if ( ! class_exists( 'um\core\Files' ) ) { if ( UM()->is_permalinks ) { $url = get_site_url( get_current_blog_id() ); $nonce = wp_create_nonce( $user_id . $form_id . 'um-download-nonce' ); - return $url . "/um-download/{$form_id}/{$field_key}/{$user_id}/{$nonce}"; + $url = $url . "/um-download/{$form_id}/{$field_key}/{$user_id}/{$nonce}"; } else { $url = get_site_url( get_current_blog_id() ); $nonce = wp_create_nonce( $user_id . $form_id . 'um-download-nonce' ); - return add_query_arg( array( 'um_action' => 'download', 'um_form' => $form_id, 'um_field' => $field_key, 'um_user' => $user_id, 'um_verify' => $nonce ), $url ); + $url = add_query_arg( array( 'um_action' => 'download', 'um_form' => $form_id, 'um_field' => $field_key, 'um_user' => $user_id, 'um_verify' => $nonce ), $url ); } + + return add_query_arg( array( 't' => time() ), $url ); } diff --git a/includes/core/class-uploader.php b/includes/core/class-uploader.php index 9eeacc17..b8897285 100644 --- a/includes/core/class-uploader.php +++ b/includes/core/class-uploader.php @@ -1186,9 +1186,11 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $user_meta_keys = UM()->user()->profile; $_array = array(); - foreach ( UM()->builtin()->custom_fields as $_field ) { - if ( $_field['type'] == 'file' && ! empty( $user_meta_keys[ $_field['metakey'] ] ) ) { - $_array[ $_field['metakey'] ] = $user_meta_keys[ $_field['metakey'] ]; + if ( ! empty( UM()->builtin()->custom_fields ) ) { + foreach ( UM()->builtin()->custom_fields as $_field ) { + if ( $_field['type'] == 'file' && ! empty( $user_meta_keys[ $_field['metakey'] ] ) ) { + $_array[ $_field['metakey'] ] = $user_meta_keys[ $_field['metakey'] ]; + } } } $_array = array_merge( $_array, $new_files ); diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 51f05672..1a0042b0 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -177,7 +177,7 @@ add_action( 'um_profile_content_main', 'um_profile_content_main' ); */ function um_user_edit_profile( $args ) { $to_update = null; - $files = null; + $files = array(); if ( isset( $args['user_id'] ) ) { if ( UM()->roles()->um_current_user_can( 'edit', $args['user_id'] ) ) { @@ -218,18 +218,18 @@ function um_user_edit_profile( $args ) { // loop through fields if ( ! empty( $fields ) ) { - foreach ( $fields as $key => $array ) { - if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] ) + if ( ! um_can_edit_field( $array ) && isset( $array['editable'] ) && ! $array['editable'] ) { continue; + } - if ( $fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && ! isset( $args['submitted'][ $key ] ) ) { + if ( $array['type'] == 'multiselect' || $array['type'] == 'checkbox' && ! isset( $args['submitted'][ $key ] ) ) { delete_user_meta( um_user( 'ID' ), $key ); } if ( isset( $args['submitted'][ $key ] ) ) { - if ( isset( $fields[ $key ]['type'] ) && in_array( $fields[ $key ]['type'], array( 'image', 'file' ) ) && + if ( isset( $array['type'] ) && in_array( $array['type'], array( 'image', 'file' ) ) && ( /*um_is_file_owner( UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . '/' . $args['submitted'][ $key ], um_user( 'ID' ) ) ||*/ um_is_temp_file( $args['submitted'][ $key ] ) || $args['submitted'][ $key ] == 'empty_file' ) ) { @@ -366,7 +366,7 @@ function um_user_edit_profile( $args ) { */ $files = apply_filters( 'um_user_pre_updating_files_array', $files ); - if ( is_array( $files ) ) { + if ( ! empty( $files ) && is_array( $files ) ) { UM()->uploader()->move_temporary_files( um_user( 'ID' ), $files ); } From 80b8838c6ca7433246181b577a748cbd4ff545a8 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Thu, 25 Oct 2018 11:46:06 +0300 Subject: [PATCH 13/22] - fixed image download with cache; --- includes/core/class-files.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/core/class-files.php b/includes/core/class-files.php index 6f0edf47..e5dd73c8 100644 --- a/includes/core/class-files.php +++ b/includes/core/class-files.php @@ -90,6 +90,7 @@ if ( ! class_exists( 'um\core\Files' ) ) { $url = add_query_arg( array( 'um_action' => 'download', 'um_form' => $form_id, 'um_field' => $field_key, 'um_user' => $user_id, 'um_verify' => $nonce ), $url ); } + //add time to query args for sites with the cache return add_query_arg( array( 't' => time() ), $url ); } From 23a158d423d31c032c28a17a83e56aad80a83df0 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 26 Oct 2018 10:18:25 +0300 Subject: [PATCH 14/22] - changed enqueue; --- includes/core/class-enqueue.php | 29 +++++++++++++++++++---------- includes/core/class-uploader.php | 8 +++++--- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/includes/core/class-enqueue.php b/includes/core/class-enqueue.php index 2404c9ba..d35eb286 100644 --- a/includes/core/class-enqueue.php +++ b/includes/core/class-enqueue.php @@ -87,7 +87,15 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { wp_register_script( 'um_jquery_form', $this->js_baseurl . 'um-jquery-form' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_fileupload', $this->js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery', 'um_jquery_form' ), ultimatemember_version, true ); - wp_register_script( 'um_datetime', $this->js_baseurl . 'pickadate/picker.js', array( 'jquery' ), ultimatemember_version, true ); + + $datetime_deps = array( 'jquery' ); + // load a localized version for date/time + $locale = get_locale(); + if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) { + wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery' ), ultimatemember_version, true ); + $datetime_deps[] = 'um_datetime_locale'; + } + wp_register_script( 'um_datetime', $this->js_baseurl . 'pickadate/picker.js', $datetime_deps, ultimatemember_version, true ); wp_register_script( 'um_datetime_date', $this->js_baseurl . 'pickadate/picker.date.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_datetime_time', $this->js_baseurl . 'pickadate/picker.time.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_datetime_legacy', $this->js_baseurl . 'pickadate/legacy.js', array( 'jquery' ), ultimatemember_version, true ); @@ -160,25 +168,26 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) { // rtl style if ( is_rtl() ) { - wp_register_style('um_rtl', um_url . 'assets/css/um.rtl.css', '', ultimatemember_version, 'all' ); + wp_register_style('um_rtl', um_url . 'assets/css/um.rtl.css', array(), ultimatemember_version ); wp_enqueue_style('um_rtl'); } - // load a localized version for date/time - $locale = get_locale(); - if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) { - wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', '', ultimatemember_version, true ); - wp_enqueue_script('um_datetime_locale'); - } - if(is_object($post) && has_shortcode($post->post_content,'ultimate-member')) { wp_dequeue_script('jquery-form'); } //old settings before UM 2.0 CSS - wp_register_style('um_default_css', um_url . 'assets/css/um-old-default.css', '', ultimatemember_version, 'all' ); + wp_register_style('um_default_css', um_url . 'assets/css/um-old-default.css', array(), ultimatemember_version ); wp_enqueue_style('um_default_css'); + $this->old_css_settings(); + } + + + /** + * + */ + function old_css_settings() { $uploads = wp_upload_dir(); $upload_dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . 'ultimatemember' . DIRECTORY_SEPARATOR; if ( file_exists( $upload_dir . 'um_old_settings.css' ) ) { diff --git a/includes/core/class-uploader.php b/includes/core/class-uploader.php index b8897285..65c3c9cf 100644 --- a/includes/core/class-uploader.php +++ b/includes/core/class-uploader.php @@ -1160,10 +1160,12 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $new_files[ $key ] = $new_filename; if ( rename( $temp_file_path, $file ) ) { - $file_info = get_transient("um_{$filename}"); update_user_meta( $user_id, $key, $new_filename ); - update_user_meta( $user_id, "{$key}_metadata", $file_info ); - delete_transient("um_{$filename}"); + $file_info = get_transient("um_{$filename}"); + if ( $file_info ) { + update_user_meta( $user_id, "{$key}_metadata", $file_info ); + delete_transient("um_{$filename}"); + } } } } From 40eeeba2c13526f049f575871c730416e2ae38c4 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 26 Oct 2018 14:06:45 +0300 Subject: [PATCH 15/22] - 2.0.30 release; --- includes/admin/class-admin.php | 30 +++++++++----- .../admin/core/class-admin-ajax-hooks.php | 33 +++++++++++++++ includes/admin/core/class-admin-enqueue.php | 17 -------- includes/class-init.php | 26 ++++++++++++ includes/core/class-templates.php | 41 +++++++++++++++++++ templates/searchform.php | 10 ++--- 6 files changed, 125 insertions(+), 32 deletions(-) create mode 100644 includes/admin/core/class-admin-ajax-hooks.php create mode 100644 includes/core/class-templates.php diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 8858efff..e8368818 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -45,22 +45,32 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) ); + add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 ); + add_action( 'parent_file', array( &$this, 'parent_file' ), 9 ); add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 ); add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) ); - - - - add_action( 'wp_ajax_um_dynamic_modal_content', array( UM()->builder(), 'dynamic_modal_content' ) ); - add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) ); - add_action( 'wp_ajax_um_update_field', array( UM()->builder(), 'update_field' ) ); - add_action( 'wp_ajax_um_do_ajax_action', array( UM()->fields(), 'do_ajax_action' ) ); - add_action( 'wp_ajax_um_update_builder', array( UM()->builder(), 'update_builder' ) ); - add_action( 'wp_ajax_um_update_order', array( UM()->dragdrop(), 'update_order' ) ); - add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) ); } + /** + * Adds class to our admin pages + * + * @param $classes + * + * @return string + */ + function admin_body_class( $classes ) { + if ( $this->is_um_screen() ) { + return "$classes um-admin"; + } + return $classes; + } + + + /** + * + */ function manual_upgrades_request() { if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) { die(); diff --git a/includes/admin/core/class-admin-ajax-hooks.php b/includes/admin/core/class-admin-ajax-hooks.php new file mode 100644 index 00000000..692f43e9 --- /dev/null +++ b/includes/admin/core/class-admin-ajax-hooks.php @@ -0,0 +1,33 @@ +fields(), 'do_ajax_action' ) ); + add_action( 'wp_ajax_um_update_builder', array( UM()->builder(), 'update_builder' ) ); + add_action( 'wp_ajax_um_update_order', array( UM()->dragdrop(), 'update_order' ) ); + add_action( 'wp_ajax_um_update_field', array( UM()->builder(), 'update_field' ) ); + add_action( 'wp_ajax_um_dynamic_modal_content', array( UM()->builder(), 'dynamic_modal_content' ) ); + add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) ); + add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) ); + } + + } +} \ No newline at end of file diff --git a/includes/admin/core/class-admin-enqueue.php b/includes/admin/core/class-admin-enqueue.php index 127154b0..46ca9f81 100644 --- a/includes/admin/core/class-admin-enqueue.php +++ b/includes/admin/core/class-admin-enqueue.php @@ -39,8 +39,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) ); - add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 ); - add_filter( 'enter_title_here', array( &$this, 'enter_title_here' ) ); add_action( 'load-user-new.php', array( &$this, 'enqueue_role_wrapper' ) ); @@ -344,21 +342,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { } - /** - * Adds class to our admin pages - * - * @param $classes - * - * @return string - */ - function admin_body_class( $classes ) { - if ( UM()->admin()->is_um_screen() ) { - return "$classes um-admin"; - } - return $classes; - } - - /** * Enqueue scripts and styles */ diff --git a/includes/class-init.php b/includes/class-init.php index 28aba1b7..61449315 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -525,6 +525,7 @@ if ( ! class_exists( 'UM' ) ) { if ( $this->is_request( 'ajax' ) ) { $this->admin(); $this->ajax_init(); + $this->admin_ajax_hooks(); $this->metabox(); $this->admin_upgrade()->init_packages_ajax_handlers(); $this->admin_gdpr(); @@ -638,6 +639,17 @@ if ( ! class_exists( 'UM' ) ) { } + /** + * @since 2.0.30 + */ + function admin_ajax_hooks() { + if ( empty( $this->classes['admin_ajax_hooks'] ) ) { + $this->classes['admin_ajax_hooks'] = new um\admin\core\Admin_Ajax_Hooks(); + } + return $this->classes['admin_ajax_hooks']; + } + + /** * @since 2.0 * @@ -1313,6 +1325,20 @@ if ( ! class_exists( 'UM' ) ) { } + /** + * @since 2.0 + * + * @return um\core\Templates + */ + function templates() { + if ( empty( $this->classes['templates'] ) ) { + $this->classes['templates'] = new um\core\Templates(); + } + + return $this->classes['templates']; + } + + /** * @since 2.0 * diff --git a/includes/core/class-templates.php b/includes/core/class-templates.php new file mode 100644 index 00000000..b92c3510 --- /dev/null +++ b/includes/core/class-templates.php @@ -0,0 +1,41 @@ +"> -
    - - - -
    +
    + + + +
    From 40aba719be0b21c15416a20980bc85e73546c6c6 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 26 Oct 2018 14:42:03 +0300 Subject: [PATCH 16/22] - remove not finished view; --- includes/admin/templates/directory/shortcode.php | 8 ++++---- includes/admin/templates/form/shortcode.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/admin/templates/directory/shortcode.php b/includes/admin/templates/directory/shortcode.php index f26a7139..4769146c 100644 --- a/includes/admin/templates/directory/shortcode.php +++ b/includes/admin/templates/directory/shortcode.php @@ -1,5 +1,5 @@
    - admin_forms( array( + admin_forms( array( 'class' => 'um-member-directory-shortcode um-top-label', 'prefix_id' => 'um_metadata', 'fields' => array( @@ -15,10 +15,10 @@ ), ), ) - ) )->render_form(); ?> + ) )->render_form();*/ ?> -
    +

    shortcodes()->get_shortcode( get_the_ID() ); ?>

    -

    shortcodes()->get_default_shortcode( get_the_ID() ); ?>

    +shortcodes()->get_default_shortcode( get_the_ID() ); ?>
    \ No newline at end of file diff --git a/includes/admin/templates/form/shortcode.php b/includes/admin/templates/form/shortcode.php index fd71748c..6c0a7550 100644 --- a/includes/admin/templates/form/shortcode.php +++ b/includes/admin/templates/form/shortcode.php @@ -1,5 +1,5 @@
    - admin_forms( array( + admin_forms( array( 'class' => 'um-form-shortcode um-top-label', 'prefix_id' => 'form', 'fields' => array( @@ -15,10 +15,10 @@ ), ), ) - ) )->render_form(); ?> + ) )->render_form();*/ ?> -
    +

    shortcodes()->get_shortcode( get_the_ID() ); ?>

    -

    shortcodes()->get_default_shortcode( get_the_ID() ); ?>

    +shortcodes()->get_default_shortcode( get_the_ID() ); ?>
    \ No newline at end of file From 24bf00035df67b2d0ed1104d2dd70cc46b5a47df Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 26 Oct 2018 14:47:07 +0300 Subject: [PATCH 17/22] - upgrade translate; --- languages/ultimate-member-en_US.po | 362 +++++++++++++++-------------- 1 file changed, 184 insertions(+), 178 deletions(-) diff --git a/languages/ultimate-member-en_US.po b/languages/ultimate-member-en_US.po index 05091603..a642f814 100644 --- a/languages/ultimate-member-en_US.po +++ b/languages/ultimate-member-en_US.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Ultimate Member\n" -"POT-Creation-Date: 2018-10-17 10:44+0300\n" -"PO-Revision-Date: 2018-10-17 10:44+0300\n" +"POT-Creation-Date: 2018-10-26 14:45+0300\n" +"PO-Revision-Date: 2018-10-26 14:46+0300\n" "Last-Translator: \n" "Language-Team: \n" "Language: en_US\n" @@ -21,53 +21,53 @@ msgstr "" "X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPathExcluded-0: *.js\n" -#: includes/admin/class-admin.php:172 +#: includes/admin/class-admin.php:182 #, php-format msgid "Duplicate of %s" msgstr "" -#: includes/admin/class-admin.php:321 +#: includes/admin/class-admin.php:331 msgid "Docs" msgstr "" -#: includes/admin/class-admin.php:322 +#: includes/admin/class-admin.php:332 #: includes/admin/core/class-admin-settings.php:1119 msgid "Settings" msgstr "" -#: includes/admin/class-admin.php:393 includes/admin/class-admin.php:396 +#: includes/admin/class-admin.php:403 includes/admin/class-admin.php:406 msgid "Form updated." msgstr "" -#: includes/admin/class-admin.php:394 +#: includes/admin/class-admin.php:404 msgid "Custom field updated." msgstr "" -#: includes/admin/class-admin.php:395 +#: includes/admin/class-admin.php:405 msgid "Custom field deleted." msgstr "" -#: includes/admin/class-admin.php:397 +#: includes/admin/class-admin.php:407 msgid "Form restored to revision." msgstr "" -#: includes/admin/class-admin.php:398 +#: includes/admin/class-admin.php:408 msgid "Form created." msgstr "" -#: includes/admin/class-admin.php:399 +#: includes/admin/class-admin.php:409 msgid "Form saved." msgstr "" -#: includes/admin/class-admin.php:400 +#: includes/admin/class-admin.php:410 msgid "Form submitted." msgstr "" -#: includes/admin/class-admin.php:401 +#: includes/admin/class-admin.php:411 msgid "Form scheduled." msgstr "" -#: includes/admin/class-admin.php:402 +#: includes/admin/class-admin.php:412 msgid "Form draft updated." msgstr "" @@ -160,13 +160,13 @@ msgid "Duplicate" msgstr "" #: includes/admin/core/class-admin-columns.php:93 -#: includes/admin/core/class-admin-columns.php:112 +#: includes/admin/core/class-admin-columns.php:113 #: includes/admin/templates/role/role-edit.php:171 msgid "Title" msgstr "" #: includes/admin/core/class-admin-columns.php:94 -#: includes/admin/core/class-admin-columns.php:113 +#: includes/admin/core/class-admin-columns.php:114 msgid "ID" msgstr "" @@ -175,19 +175,75 @@ msgid "Type" msgstr "" #: includes/admin/core/class-admin-columns.php:96 -#: includes/admin/core/class-admin-columns.php:114 +#: includes/admin/core/class-admin-columns.php:115 +#: includes/admin/core/class-admin-settings.php:310 +#: includes/admin/templates/form/login_settings.php:13 +#: includes/admin/templates/form/register_customize.php:3 +#: includes/admin/templates/form/register_customize.php:29 +msgid "Default" +msgstr "" + +#: includes/admin/core/class-admin-columns.php:97 +#: includes/admin/core/class-admin-columns.php:116 #: includes/admin/core/class-admin-metabox.php:818 #: includes/admin/core/class-admin-metabox.php:979 msgid "Shortcode" msgstr "" -#: includes/admin/core/class-admin-columns.php:97 -#: includes/admin/core/class-admin-columns.php:115 +#: includes/admin/core/class-admin-columns.php:98 +#: includes/admin/core/class-admin-columns.php:117 msgid "Date" msgstr "" -#: includes/admin/core/class-admin-enqueue.php:127 -#: includes/admin/core/class-admin-enqueue.php:161 +#: includes/admin/core/class-admin-columns.php:148 +#: includes/admin/core/class-admin-columns.php:181 +#: includes/admin/core/list-tables/roles-list-table.php:367 +#: includes/admin/core/list-tables/roles-list-table.php:375 +#: includes/admin/templates/form/login_customize.php:13 +#: includes/admin/templates/form/login_customize.php:61 +#: includes/admin/templates/form/login_customize.php:80 +#: includes/admin/templates/form/login_customize.php:91 +#: includes/admin/templates/form/profile_customize.php:22 +#: includes/admin/templates/form/profile_customize.php:88 +#: includes/admin/templates/form/profile_customize.php:107 +#: includes/admin/templates/form/profile_customize.php:140 +#: includes/admin/templates/form/profile_customize.php:151 +#: includes/admin/templates/form/profile_customize.php:162 +#: includes/admin/templates/form/profile_customize.php:173 +#: includes/admin/templates/form/register_customize.php:20 +#: includes/admin/templates/form/register_customize.php:76 +#: includes/admin/templates/form/register_gdpr.php:23 +#: includes/core/class-builtin.php:1130 includes/core/class-builtin.php:1144 +#: includes/core/class-builtin.php:1145 +#: includes/core/um-actions-account.php:251 +msgid "No" +msgstr "" + +#: includes/admin/core/class-admin-columns.php:148 +#: includes/admin/core/class-admin-columns.php:181 +#: includes/admin/core/list-tables/roles-list-table.php:367 +#: includes/admin/core/list-tables/roles-list-table.php:375 +#: includes/admin/templates/form/login_customize.php:14 +#: includes/admin/templates/form/login_customize.php:62 +#: includes/admin/templates/form/login_customize.php:81 +#: includes/admin/templates/form/login_customize.php:92 +#: includes/admin/templates/form/profile_customize.php:23 +#: includes/admin/templates/form/profile_customize.php:89 +#: includes/admin/templates/form/profile_customize.php:108 +#: includes/admin/templates/form/profile_customize.php:141 +#: includes/admin/templates/form/profile_customize.php:152 +#: includes/admin/templates/form/profile_customize.php:163 +#: includes/admin/templates/form/profile_customize.php:174 +#: includes/admin/templates/form/register_customize.php:21 +#: includes/admin/templates/form/register_customize.php:77 +#: includes/admin/templates/form/register_gdpr.php:24 +#: includes/core/class-builtin.php:1130 includes/core/class-builtin.php:1145 +#: includes/core/um-filters-members.php:68 +msgid "Yes" +msgstr "" + +#: includes/admin/core/class-admin-enqueue.php:125 +#: includes/admin/core/class-admin-enqueue.php:159 #: includes/admin/core/class-admin-forms.php:813 #: includes/admin/core/class-admin-forms.php:827 #: includes/admin/core/class-admin-forms.php:932 @@ -197,13 +253,13 @@ msgstr "" msgid "Remove" msgstr "" -#: includes/admin/core/class-admin-enqueue.php:128 -#: includes/admin/core/class-admin-enqueue.php:162 +#: includes/admin/core/class-admin-enqueue.php:126 +#: includes/admin/core/class-admin-enqueue.php:160 #: includes/admin/core/class-admin-forms.php:1009 msgid "Select" msgstr "" -#: includes/admin/core/class-admin-enqueue.php:159 +#: includes/admin/core/class-admin-enqueue.php:157 msgid "Are sure, maybe some settings not saved" msgstr "" @@ -633,306 +689,306 @@ msgstr "" msgid "Options" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1205 +#: includes/admin/core/class-admin-metabox.php:1236 msgid "" "Select where this field should appear. This option should only be changed on " "the profile form and allows you to show a field in one mode only (edit or " "view) or in both modes." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1239 +#: includes/admin/core/class-admin-metabox.php:1270 msgid "If" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1316 +#: includes/admin/core/class-admin-metabox.php:1347 msgid "Value" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1325 +#: includes/admin/core/class-admin-metabox.php:1356 msgid "Does this field require a special validation" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1370 +#: includes/admin/core/class-admin-metabox.php:1401 msgid "" "If you want to apply your custom validation, you can use action hooks to add " "custom validation. Please refer to documentation for further details." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1384 -#: includes/admin/core/class-admin-metabox.php:1412 +#: includes/admin/core/class-admin-metabox.php:1415 +#: includes/admin/core/class-admin-metabox.php:1443 msgid "" "Select an icon to appear in the field. Leave blank if you do not want an " "icon to show in the field." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1439 +#: includes/admin/core/class-admin-metabox.php:1470 msgid "Specify a custom CSS class to be applied to this element" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1449 +#: includes/admin/core/class-admin-metabox.php:1480 msgid "This is the width in pixels, e.g. 4 or 2, etc" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1459 +#: includes/admin/core/class-admin-metabox.php:1490 msgid "Optional text to include with the divider" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1469 +#: includes/admin/core/class-admin-metabox.php:1500 msgid "Set padding for this section" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1479 +#: includes/admin/core/class-admin-metabox.php:1510 msgid "Set margin for this section" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1489 +#: includes/admin/core/class-admin-metabox.php:1520 msgid "Set border for this section" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1499 +#: includes/admin/core/class-admin-metabox.php:1530 msgid "Choose the border style" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1514 +#: includes/admin/core/class-admin-metabox.php:1545 msgid "Rounded corners can be applied by setting a pixels value here. e.g. 5px" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1524 +#: includes/admin/core/class-admin-metabox.php:1555 msgid "Give a color to this border" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1534 +#: includes/admin/core/class-admin-metabox.php:1565 msgid "Enable Row Heading" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1534 +#: includes/admin/core/class-admin-metabox.php:1565 msgid "Whether to enable a heading for this row" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1544 +#: includes/admin/core/class-admin-metabox.php:1575 msgid "Enter the row heading text here" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1554 +#: includes/admin/core/class-admin-metabox.php:1585 msgid "This will be the background of entire section" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1564 +#: includes/admin/core/class-admin-metabox.php:1595 msgid "This will be the background of the heading section" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1574 +#: includes/admin/core/class-admin-metabox.php:1605 msgid "This will be the text color of heading part only" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1584 +#: includes/admin/core/class-admin-metabox.php:1615 msgid "This will be the text color of entire section" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1594 +#: includes/admin/core/class-admin-metabox.php:1625 msgid "" "This will be the color of selected icon. By default It will be the same " "color as heading text color" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1604 +#: includes/admin/core/class-admin-metabox.php:1635 msgid "Select a color for this divider" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1614 +#: includes/admin/core/class-admin-metabox.php:1645 msgid "Entering custom text here will replace the url with a text link" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1624 +#: includes/admin/core/class-admin-metabox.php:1655 msgid "Choose whether to open this link in same window or in a new window" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1637 +#: includes/admin/core/class-admin-metabox.php:1668 msgid "Whether to follow or nofollow this link by search engines" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1650 +#: includes/admin/core/class-admin-metabox.php:1681 msgid "" "Turn on to force users to create a strong password (A combination of one " "lowercase letter, one uppercase letter, and one number). If turned on this " "option is only applied to register forms and not to login forms." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1660 +#: includes/admin/core/class-admin-metabox.php:1691 msgid "" "Turn on to add a confirm password field. If turned on the confirm password " "field will only show on register forms and not on login forms." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1670 +#: includes/admin/core/class-admin-metabox.php:1701 msgid "This is the line-style of divider" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1686 +#: includes/admin/core/class-admin-metabox.php:1717 msgid "Choose the minutes interval between each time in the time picker." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1699 +#: includes/admin/core/class-admin-metabox.php:1730 msgid "The display format of the date which is visible to user." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1710 +#: includes/admin/core/class-admin-metabox.php:1741 msgid "Choose the displayed time-format for this field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1725 +#: includes/admin/core/class-admin-metabox.php:1756 msgid "" "Whether you wish to show the date in full or only show the years e.g. 25 " "Years" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1744 +#: includes/admin/core/class-admin-metabox.php:1775 msgid "" "Disable specific week days from being available for selection in this date " "picker" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1762 +#: includes/admin/core/class-admin-metabox.php:1793 msgid "" "Number of years available for the date selection. Default to last 50 years" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1772 +#: includes/admin/core/class-admin-metabox.php:1803 msgid "This decides which years should be shown relative to today date" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1786 +#: includes/admin/core/class-admin-metabox.php:1817 msgid "Set the minimum date/day in range in the format YYYY/MM/DD" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1796 +#: includes/admin/core/class-admin-metabox.php:1827 msgid "Set the maximum date/day in range in the format YYYY/MM/DD" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1806 +#: includes/admin/core/class-admin-metabox.php:1837 msgid "" "Whether to show a specific number of years or specify a date range to be " "available for the date picker." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1822 +#: includes/admin/core/class-admin-metabox.php:1853 msgid "" "Enter the shortcode in the following textarea and it will be displayed on " "the fields" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1832 +#: includes/admin/core/class-admin-metabox.php:1863 msgid "Edit the content of this field here" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1845 +#: includes/admin/core/class-admin-metabox.php:1876 msgid "Enable/disable crop feature for this image upload and define ratio" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1867 -#: includes/admin/core/class-admin-metabox.php:1887 +#: includes/admin/core/class-admin-metabox.php:1898 +#: includes/admin/core/class-admin-metabox.php:1918 msgid "" "Select the image types that you want to allow to be uploaded via this field." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1908 +#: includes/admin/core/class-admin-metabox.php:1939 msgid "This is the headline that appears in the upload box for this field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1918 +#: includes/admin/core/class-admin-metabox.php:1949 msgid "" "If you need to add information or secondary line below the headline of " "upload box, enter it here" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1928 +#: includes/admin/core/class-admin-metabox.php:1959 msgid "The text that appears on the button. e.g. Upload" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1938 +#: includes/admin/core/class-admin-metabox.php:1969 msgid "" "The maximum size for image that can be uploaded through this field. Leave " "empty for unlimited size." msgstr "" -#: includes/admin/core/class-admin-metabox.php:1948 +#: includes/admin/core/class-admin-metabox.php:1979 msgid "The height of textarea in pixels. Default is 100 pixels" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1958 +#: includes/admin/core/class-admin-metabox.php:1989 msgid "This is the required spacing in pixels. e.g. 20px" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1968 +#: includes/admin/core/class-admin-metabox.php:1999 msgid "Enable/disable multiple selections for this field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1978 +#: includes/admin/core/class-admin-metabox.php:2009 msgid "" "Enter a number here to force a maximum number of selections by user for this " "field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1988 +#: includes/admin/core/class-admin-metabox.php:2019 msgid "" "Enter a number here to force a minimum number of selections by user for this " "field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:1998 +#: includes/admin/core/class-admin-metabox.php:2029 msgid "This is the max number of entries the user can add via field group." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2008 +#: includes/admin/core/class-admin-metabox.php:2039 msgid "" "If you want to enable a maximum number of words to be input in this " "textarea. Leave empty to disable this setting" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2018 +#: includes/admin/core/class-admin-metabox.php:2049 msgid "Minimum number that can be entered in this field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2028 +#: includes/admin/core/class-admin-metabox.php:2059 msgid "Maximum number that can be entered in this field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2038 +#: includes/admin/core/class-admin-metabox.php:2069 msgid "" "If you want to enable a minimum number of characters to be input in this " "field. Leave empty to disable this setting" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2048 +#: includes/admin/core/class-admin-metabox.php:2079 msgid "" "If you want to enable a maximum number of characters to be input in this " "field. Leave empty to disable this setting" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2058 +#: includes/admin/core/class-admin-metabox.php:2089 msgid "Turn on/off HTML tags for this textarea" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2077 +#: includes/admin/core/class-admin-metabox.php:2108 msgid "" "Enter one choice per line. This will represent the available choices or " "selections available for user." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2087 +#: includes/admin/core/class-admin-metabox.php:2118 msgid "" "This is the title of the field for your reference in the backend. The title " "will not appear on the front-end of your website." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2112 +#: includes/admin/core/class-admin-metabox.php:2143 msgid "" "The meta key cannot be changed for duplicated fields or when editing an " "existing field. If you require a different meta key please create a new " "field." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2118 +#: includes/admin/core/class-admin-metabox.php:2149 msgid "" "A meta key is required to store the entered info in this field in the " "database. The meta key should be unique to this field and be written in " @@ -940,7 +996,7 @@ msgid "" "job_title" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2131 +#: includes/admin/core/class-admin-metabox.php:2162 msgid "" "This is the text that appears in a tooltip when a user hovers over the info " "icon. Help text is useful for providing users with more information about " @@ -948,73 +1004,73 @@ msgid "" "for field." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2143 +#: includes/admin/core/class-admin-metabox.php:2174 msgid "Text to display by default in this field" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2149 +#: includes/admin/core/class-admin-metabox.php:2180 msgid "" "If you wish the rating field to be prefilled with a number of stars, enter " "it here." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2155 +#: includes/admin/core/class-admin-metabox.php:2186 msgid "" "This option allows you to pre-fill the field with a default value prior to " "the user entering a value in the field. Leave blank to have no default value" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2167 +#: includes/admin/core/class-admin-metabox.php:2198 msgid "" "The field label is the text that appears above the field on your front-end " "form. Leave blank to not show a label above field." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2177 +#: includes/admin/core/class-admin-metabox.php:2208 msgid "" "This is the text that appears within the field e.g please enter your email " "address. Leave blank to not show any placeholder text." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2187 +#: includes/admin/core/class-admin-metabox.php:2218 msgid "" "Field privacy allows you to select who can view this field on the front-end. " "The site admin can view all fields regardless of the option set here." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2210 +#: includes/admin/core/class-admin-metabox.php:2241 msgid "Select the member roles that can view this field on the front-end." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2236 +#: includes/admin/core/class-admin-metabox.php:2267 msgid "" "This option allows you to set whether the field must be filled in before the " "form can be processed." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2250 +#: includes/admin/core/class-admin-metabox.php:2281 msgid "" "This option allows you to set whether or not the user can edit the " "information in this field." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2263 +#: includes/admin/core/class-admin-metabox.php:2294 msgid "Choose whether you want a 5-stars or 10-stars ratings based here." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2276 +#: includes/admin/core/class-admin-metabox.php:2307 msgid "Add a callback source to retrieve choices." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2287 +#: includes/admin/core/class-admin-metabox.php:2318 msgid "Parent Option" msgstr "" -#: includes/admin/core/class-admin-metabox.php:2287 +#: includes/admin/core/class-admin-metabox.php:2318 msgid "Dynamically populates the option based from selected parent option." msgstr "" -#: includes/admin/core/class-admin-metabox.php:2289 +#: includes/admin/core/class-admin-metabox.php:2320 msgid "No Selected" msgstr "" @@ -1057,12 +1113,12 @@ msgstr "" #: includes/admin/core/class-admin-notices.php:301 #, php-format msgid "" -"One or more of your %s pages are not correctly setup. Please visit " -"%s > Settings to re-assign your missing pages." +"%s needs to create several pages (User Profiles, Account, Registration, " +"Login, Password Reset, Logout, Member Directory) to function correctly." msgstr "" #: includes/admin/core/class-admin-notices.php:305 -msgid "Setup Pages" +msgid "Create Pages" msgstr "" #: includes/admin/core/class-admin-notices.php:307 @@ -1170,7 +1226,7 @@ msgstr "" #: includes/admin/core/class-admin-notices.php:534 #, php-format msgid "" -"Thanks for installing %s! We hope you like the plugin. To " +"Thanks for installing %s! We hope you like the plugin. To " "fund full-time development and support of the plugin we also sell " "extensions. If you subscribe to our mailing list we will send you a 20%% " "discount code for our extensions bundle." @@ -1478,13 +1534,6 @@ msgid "" "Gravatar has a number of built in options which you can also use as defaults" msgstr "" -#: includes/admin/core/class-admin-settings.php:310 -#: includes/admin/templates/form/login_settings.php:13 -#: includes/admin/templates/form/register_customize.php:3 -#: includes/admin/templates/form/register_customize.php:29 -msgid "Default" -msgstr "" - #: includes/admin/core/class-admin-settings.php:311 msgid "404 ( File Not Found response )" msgstr "" @@ -2609,49 +2658,6 @@ msgstr "" msgid "Reset UM Role meta" msgstr "" -#: includes/admin/core/list-tables/roles-list-table.php:367 -#: includes/admin/core/list-tables/roles-list-table.php:375 -#: includes/admin/templates/form/login_customize.php:14 -#: includes/admin/templates/form/login_customize.php:62 -#: includes/admin/templates/form/login_customize.php:81 -#: includes/admin/templates/form/login_customize.php:92 -#: includes/admin/templates/form/profile_customize.php:23 -#: includes/admin/templates/form/profile_customize.php:89 -#: includes/admin/templates/form/profile_customize.php:108 -#: includes/admin/templates/form/profile_customize.php:141 -#: includes/admin/templates/form/profile_customize.php:152 -#: includes/admin/templates/form/profile_customize.php:163 -#: includes/admin/templates/form/profile_customize.php:174 -#: includes/admin/templates/form/register_customize.php:21 -#: includes/admin/templates/form/register_customize.php:77 -#: includes/admin/templates/form/register_gdpr.php:24 -#: includes/core/class-builtin.php:1130 includes/core/class-builtin.php:1145 -#: includes/core/um-filters-members.php:68 -msgid "Yes" -msgstr "" - -#: includes/admin/core/list-tables/roles-list-table.php:367 -#: includes/admin/core/list-tables/roles-list-table.php:375 -#: includes/admin/templates/form/login_customize.php:13 -#: includes/admin/templates/form/login_customize.php:61 -#: includes/admin/templates/form/login_customize.php:80 -#: includes/admin/templates/form/login_customize.php:91 -#: includes/admin/templates/form/profile_customize.php:22 -#: includes/admin/templates/form/profile_customize.php:88 -#: includes/admin/templates/form/profile_customize.php:107 -#: includes/admin/templates/form/profile_customize.php:140 -#: includes/admin/templates/form/profile_customize.php:151 -#: includes/admin/templates/form/profile_customize.php:162 -#: includes/admin/templates/form/profile_customize.php:173 -#: includes/admin/templates/form/register_customize.php:20 -#: includes/admin/templates/form/register_customize.php:76 -#: includes/admin/templates/form/register_gdpr.php:23 -#: includes/core/class-builtin.php:1130 includes/core/class-builtin.php:1144 -#: includes/core/class-builtin.php:1145 -#: includes/core/um-actions-account.php:251 -msgid "No" -msgstr "" - #: includes/admin/core/list-tables/roles-list-table.php:397 msgid "Role" msgstr "" @@ -3178,25 +3184,25 @@ msgstr "" msgid "We are sorry. We cannot find any users who match your search criteria." msgstr "" -#: includes/admin/templates/extensions.php:155 +#: includes/admin/templates/extensions.php:169 msgid "View our Extensions Bundle" msgstr "" -#: includes/admin/templates/extensions.php:164 +#: includes/admin/templates/extensions.php:178 msgid "Premium" msgstr "" -#: includes/admin/templates/extensions.php:169 +#: includes/admin/templates/extensions.php:183 msgid "Free" msgstr "" -#: includes/admin/templates/extensions.php:195 -#: includes/admin/templates/extensions.php:229 +#: includes/admin/templates/extensions.php:209 +#: includes/admin/templates/extensions.php:243 msgid "Get this Add on" msgstr "" -#: includes/admin/templates/extensions.php:200 -#: includes/admin/templates/extensions.php:234 +#: includes/admin/templates/extensions.php:214 +#: includes/admin/templates/extensions.php:248 msgid "More Details" msgstr "" @@ -6244,7 +6250,7 @@ msgstr "" msgid "Add translation to %s" msgstr "" -#: includes/core/class-fields.php:1165 +#: includes/core/class-fields.php:1165 templates/message.php:5 #, php-format msgid "%s" msgstr "" @@ -6330,35 +6336,35 @@ msgstr "" msgid "This user has not added any information to their profile yet." msgstr "" -#: includes/core/class-files.php:256 +#: includes/core/class-files.php:271 msgid "Invalid parameters" msgstr "" -#: includes/core/class-files.php:261 +#: includes/core/class-files.php:276 msgid "Invalid coordinates" msgstr "" -#: includes/core/class-files.php:266 +#: includes/core/class-files.php:281 msgid "Invalid file ownership" msgstr "" -#: includes/core/class-files.php:319 +#: includes/core/class-files.php:334 msgid "Invalid nonce" msgstr "" -#: includes/core/class-files.php:339 includes/core/class-files.php:424 +#: includes/core/class-files.php:354 includes/core/class-files.php:439 msgid "A theme or plugin compatibility issue" msgstr "" -#: includes/core/class-files.php:967 +#: includes/core/class-files.php:982 msgid "Ultimate Member: Not a valid temp file" msgstr "" -#: includes/core/class-files.php:1095 +#: includes/core/class-files.php:1110 msgid "Invalid user ID: " msgstr "" -#: includes/core/class-files.php:1104 includes/core/class-files.php:1132 +#: includes/core/class-files.php:1119 includes/core/class-files.php:1147 msgid "Unauthorized to do this attempt." msgstr "" @@ -6518,17 +6524,17 @@ msgstr "" msgid "Wrong nonce" msgstr "" -#: includes/core/class-shortcodes.php:355 +#: includes/core/class-shortcodes.php:360 msgid "" "This content has been restricted to logged in users only. Please login to view this content." msgstr "" -#: includes/core/class-shortcodes.php:515 +#: includes/core/class-shortcodes.php:644 msgid "You are already registered" msgstr "" -#: includes/core/class-shortcodes.php:757 +#: includes/core/class-shortcodes.php:886 msgid "Default Template" msgstr "" From c3319a37f8a8c62f741d0a91df27ac080c5e8aaf Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 26 Oct 2018 14:49:10 +0300 Subject: [PATCH 18/22] - changed readme; --- README.md | 4 ++-- readme.txt | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 87dccf71..c65e6b13 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Ultimate Member is the #1 user profile & membership plugin for WordPress. The pl | Latest Version |Requires at least|Stable Tag| | :------------: |:------------:|:------------:| -| 2.0.29 | WordPress 4.9 or higher| 2.0.29 | +| 2.0.30 | WordPress 4.9 or higher| 2.0.30 | Features of the plugin include: @@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version Releases ==================== -[Official Release Version: 2.0.29](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.29). +[Official Release Version: 2.0.30](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.30). Changelog ==================== diff --git a/readme.txt b/readme.txt index 26d3bbc9..61aed26b 100644 --- a/readme.txt +++ b/readme.txt @@ -137,12 +137,14 @@ The plugin works with popular caching plugins by automatically excluding Ultimat = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin = -= 2.0.30: October 17, 2018 = += 2.0.30: October 29, 2018 = * Bugfixes: - Fixed crop settings of the big images - Fixed WPML integration with email notifications - Fixed uppercase symbols using at profile page slug + - Fixed download files/images with cache + - Fixed download files/images with not closed buffers - Added bookmarks compatibility = 2.0.29: October 8, 2018 = From 280ee1d58e2b5c20819fcb727b5c03c884a1ecd2 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 26 Oct 2018 15:52:22 +0300 Subject: [PATCH 19/22] - code review; --- includes/core/um-filters-avatars.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/includes/core/um-filters-avatars.php b/includes/core/um-filters-avatars.php index b420230e..509ab9ad 100644 --- a/includes/core/um-filters-avatars.php +++ b/includes/core/um-filters-avatars.php @@ -38,27 +38,28 @@ function um_get_avatar( $avatar = '', $id_or_email='', $size = '96', $avatar_cla um_fetch_user( $user_id ); - $avatar = um_user('profile_photo', $size); + $avatar = um_user( 'profile_photo', $size ); return $avatar; } add_filter( 'get_avatar', 'um_get_avatar', 99999, 5 ); -/** - * Replace Gravatar image URL to Ultimate member profile image URL if setting "Use Gravatars?" disabled - * @param string $url - * @param int $id_or_email - * @param array $args - * @return string - */ -if ( !function_exists( 'um_filter_get_avatar_url' ) ) { +if ( ! function_exists( 'um_filter_get_avatar_url' ) ) { + /** + * Replace Gravatar image URL to Ultimate member profile image URL if setting "Use Gravatars?" disabled + * + * @param string $url + * @param int $id_or_email + * @param array $args + * @return string + */ function um_filter_get_avatar_url( $url, $id_or_email, $args ) { - if ( is_numeric( $id_or_email ) && !UM()->options()->get( 'use_gravatars' ) && preg_match( '/gravatar/i', $url ) ) { + if ( is_numeric( $id_or_email ) && ! UM()->options()->get( 'use_gravatars' ) && preg_match( '/gravatar/i', $url ) ) { $data = um_get_user_avatar_data( $id_or_email, $args['size'] ); - if ( !empty( $data['url'] ) ) { + if ( ! empty( $data['url'] ) ) { $url = $data['url']; } } From a75be3b0be50ff1e02b01be2c323af0f0f2dac08 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Fri, 26 Oct 2018 16:03:20 +0300 Subject: [PATCH 20/22] - fixed issue with upload image/file is transient options are disabled; --- includes/core/class-uploader.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/includes/core/class-uploader.php b/includes/core/class-uploader.php index 65c3c9cf..298f05fe 100644 --- a/includes/core/class-uploader.php +++ b/includes/core/class-uploader.php @@ -454,7 +454,10 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $filename = wp_basename( $movefile['url'] ); - set_transient( "um_{$filename}", $movefile['file_info'], 2 * HOUR_IN_SECONDS ); + $transient = set_transient( "um_{$filename}", $movefile['file_info'], 2 * HOUR_IN_SECONDS ); + if ( empty( $transient ) ) { + update_user_meta( $this->user_id, "{$field_key}_metadata_temp", $movefile['file_info'] ); + } } $response['handle_upload'] = $movefile; @@ -619,7 +622,10 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { $filename = wp_basename( $movefile['url'] ); - set_transient( "um_{$filename}", $movefile['file_info'], 2 * HOUR_IN_SECONDS ); + $transient = set_transient( "um_{$filename}", $movefile['file_info'], 2 * HOUR_IN_SECONDS ); + if ( empty( $transient ) ) { + update_user_meta( $this->user_id, "{$field_key}_metadata_temp", $movefile['file_info'] ); + } } $response['handle_upload'] = $movefile; @@ -1161,10 +1167,16 @@ if ( ! class_exists( 'um\core\Uploader' ) ) { if ( rename( $temp_file_path, $file ) ) { update_user_meta( $user_id, $key, $new_filename ); - $file_info = get_transient("um_{$filename}"); + + $file_info = get_transient( "um_{$filename}" ); + if ( ! $file_info ) { + $file_info = get_user_meta( $user_id, "{$key}_metadata_temp", true ); + delete_user_meta( $user_id, "{$key}_metadata_temp" ); + } + if ( $file_info ) { update_user_meta( $user_id, "{$key}_metadata", $file_info ); - delete_transient("um_{$filename}"); + delete_transient( "um_{$filename}" ); } } } From 6f961926050e6b48659842332c37e716911a7405 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Wed, 31 Oct 2018 11:03:36 +0200 Subject: [PATCH 21/22] - remove looping in case if set 'display_name' as custom fields for display name setting; --- includes/core/class-shortcodes.php | 3 ++- includes/um-short-functions.php | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php index 6df7c214..070b27c5 100644 --- a/includes/core/class-shortcodes.php +++ b/includes/core/class-shortcodes.php @@ -363,12 +363,13 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { $args = wp_parse_args( $args, $defaults ); - $args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] ); + if ( ! is_user_logged_in() ) { if ( $args['show_lock'] == 'no' ) { echo ''; } else { + $args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] ); $this->set_args = $args; $this->load_template( 'login-to-view' ); } diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index 18da3bdb..cd0c416e 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -2179,17 +2179,16 @@ function um_user( $data, $attrs = null ) { } - if ($op == 'field' && UM()->options()->get( 'display_name_field' ) != '') { + if ( $op == 'field' && UM()->options()->get( 'display_name_field' ) != '' ) { $fields = array_filter( preg_split( '/[,\s]+/', UM()->options()->get( 'display_name_field' ) ) ); $name = ''; - foreach ($fields as $field) { - if (um_profile( $field )) { + foreach ( $fields as $field ) { + if ( um_profile( $field ) ) { $name .= um_profile( $field ) . ' '; - } else if (um_user( $field )) { + } elseif ( um_user( $field ) && $field != 'display_name' ) { $name .= um_user( $field ) . ' '; } - } } From 7098ef0f5899806758f5c493fb4db139d796c4c4 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Thu, 1 Nov 2018 12:15:33 +0200 Subject: [PATCH 22/22] - fixed cover photo size; --- includes/um-short-functions.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index cd0c416e..7dfb0d46 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -1671,6 +1671,9 @@ function um_get_cover_uri( $image, $attrs ) { $uri_common = false; $ext = '.' . pathinfo( $image, PATHINFO_EXTENSION ); + $ratio = str_replace(':1','',UM()->options()->get( 'profile_cover_ratio' ) ); + $height = round( $attrs / $ratio ); + if ( is_multisite() ) { //multisite fix for old customers $multisite_fix_dir = UM()->uploader()->get_upload_base_dir(); @@ -1682,8 +1685,8 @@ function um_get_cover_uri( $image, $attrs ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/cover_photo{$ext}?" . current_time( 'timestamp' ); } - if ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "cover_photo-{$attrs}x{$attrs}{$ext}" ) ) { - $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/cover_photo-{$attrs}x{$attrs}{$ext}?". current_time( 'timestamp' ); + if ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "cover_photo-{$attrs}x{$height}{$ext}" ) ) { + $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/cover_photo-{$attrs}x{$height}{$ext}?". current_time( 'timestamp' ); } elseif ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "cover_photo-{$attrs}{$ext}" ) ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/cover_photo-{$attrs}{$ext}?" . current_time( 'timestamp' ); } @@ -1693,8 +1696,8 @@ function um_get_cover_uri( $image, $attrs ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/cover_photo{$ext}?" . current_time( 'timestamp' ); } - if ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "cover_photo-{$attrs}x{$attrs}{$ext}" ) ) { - $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/cover_photo-{$attrs}x{$attrs}{$ext}?". current_time( 'timestamp' ); + if ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "cover_photo-{$attrs}x{$height}{$ext}" ) ) { + $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/cover_photo-{$attrs}x{$height}{$ext}?". current_time( 'timestamp' ); } elseif ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "cover_photo-{$attrs}{$ext}" ) ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/cover_photo-{$attrs}{$ext}?" . current_time( 'timestamp' ); }