Version Description
Download this release
Release Info
Developer | champsupertramp |
Plugin | Ultimate Member – User Profile & Membership Plugin |
Version | 1.3.47 |
Comparing to | |
See all releases |
Code changes from version 1.3.44 to 1.3.47
- admin/assets/js/um-admin-scripts.js +6 -4
- admin/core/um-admin-dragdrop.php +7 -5
- admin/templates/directory/general.php +27 -26
- admin/templates/form/profile_customize.php +9 -1
- assets/css/um-styles.css +15 -0
- assets/js/um-scripts.js +4 -0
- assets/js/um.min.js +1 -1
- core/lib/upload/um-image-upload.php +1 -1
- core/um-actions-form.php +22 -1
- core/um-actions-login.php +82 -53
- core/um-actions-password.php +62 -60
- core/um-actions-profile.php +8 -1
- core/um-builtin.php +10 -0
- core/um-fields.php +14 -5
- core/um-files.php +147 -65
- core/um-filters-avatars.php +9 -2
- core/um-filters-fields.php +78 -52
- core/um-filters-language.php +36 -0
- core/um-filters-members.php +21 -4
- core/um-filters-user.php +115 -4
- core/um-form.php +19 -5
- core/um-mail.php +1 -1
- core/um-members.php +5 -1
- core/um-permalinks.php +113 -29
- core/um-profile.php +89 -22
- core/um-query.php +10 -6
- core/um-rewrite.php +2 -0
- core/um-short-functions.php +121 -43
- core/um-shortcodes.php +38 -17
- core/um-user.php +15 -3
- core/widgets/um-search-widget.php +71 -0
- index.php +2 -1
- readme.txt +32 -1
- templates/searchform.php +8 -0
- um-config.php +74 -16
- um-init.php +12 -1
admin/assets/js/um-admin-scripts.js
CHANGED
@@ -85,10 +85,12 @@ jQuery(document).ready(function() {
|
|
85 |
Tooltips
|
86 |
**/
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
92 |
|
93 |
/**
|
94 |
Conditional fields
|
85 |
Tooltips
|
86 |
**/
|
87 |
|
88 |
+
if( typeof tipsy !== 'undefined' ){
|
89 |
+
jQuery('.um-admin-tipsy-n,#redux-share a').tipsy({gravity: 'n', opacity: 1, live: 'a.live' });
|
90 |
+
jQuery('.um-admin-tipsy-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live' });
|
91 |
+
jQuery('.um-admin-tipsy-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live' });
|
92 |
+
jQuery('.um-admin-tipsy-s').tipsy({gravity: 's', opacity: 1, live: 'a.live' });
|
93 |
+
}
|
94 |
|
95 |
/**
|
96 |
Conditional fields
|
admin/core/um-admin-dragdrop.php
CHANGED
@@ -26,13 +26,15 @@ class UM_Admin_DragDrop {
|
|
26 |
|
27 |
$this->row_data = get_option('um_form_rowdata_'. $form_id );
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
$
|
32 |
-
|
|
|
|
|
33 |
}
|
34 |
}
|
35 |
-
|
36 |
foreach( $_POST as $key => $value ) {
|
37 |
|
38 |
// adding rows
|
26 |
|
27 |
$this->row_data = get_option('um_form_rowdata_'. $form_id );
|
28 |
|
29 |
+
if( isset( $fields ) ){
|
30 |
+
foreach( $fields as $key => $array ) {
|
31 |
+
if ( $array['type'] == 'row' ) {
|
32 |
+
$this->row_data[$key] = $array;
|
33 |
+
unset( $fields[$key] );
|
34 |
+
}
|
35 |
}
|
36 |
}
|
37 |
+
|
38 |
foreach( $_POST as $key => $value ) {
|
39 |
|
40 |
// adding rows
|
admin/templates/directory/general.php
CHANGED
@@ -6,55 +6,55 @@
|
|
6 |
//print "'$k' => '" . $v[0] . "',<br />";
|
7 |
}
|
8 |
}
|
9 |
-
|
10 |
$show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
|
11 |
if ( $show_these_users ) {
|
12 |
$show_these_users = implode("\n", str_replace("\r", "", $show_these_users));
|
13 |
}
|
14 |
-
|
15 |
?>
|
16 |
|
17 |
<div class="um-admin-metabox">
|
18 |
|
19 |
<div class="">
|
20 |
-
|
21 |
<input type="hidden" name="_um_mode" id="_um_mode" value="directory" />
|
22 |
-
|
23 |
<p>
|
24 |
<label class="um-admin-half"><?php _e('User Roles to Display','ultimatemember'); ?> <?php $this->tooltip('If you do not want to show all members, select only user roles to appear in this directory'); ?></label>
|
25 |
<span class="um-admin-half">
|
26 |
-
|
27 |
<select multiple="multiple" name="_um_roles[]" id="_um_roles" class="umaf-selectjs" style="width: 300px">
|
28 |
<?php foreach($ultimatemember->query->get_roles() as $key => $value) { ?>
|
29 |
<option value="<?php echo $key; ?>" <?php selected($key, $ultimatemember->query->get_meta_value('_um_roles', $key ) ); ?>><?php echo $value; ?></option>
|
30 |
-
<?php } ?>
|
31 |
</select>
|
32 |
-
|
33 |
</span>
|
34 |
</p><div class="um-admin-clear"></div>
|
35 |
-
|
36 |
<p>
|
37 |
<label class="um-admin-half"><?php _e('Only show members who have uploaded a profile photo','ultimatemember'); ?><?php $this->tooltip('If \'Use Gravatars\' as profile photo is enabled, this option is ignored'); ?></label>
|
38 |
<span class="um-admin-half">
|
39 |
-
|
40 |
<?php $this->ui_on_off('_um_has_profile_photo'); ?>
|
41 |
-
|
42 |
</span>
|
43 |
</p><div class="um-admin-clear"></div>
|
44 |
|
45 |
<p>
|
46 |
<label class="um-admin-half"><?php _e('Only show members who have uploaded a cover photo','ultimatemember'); ?></label>
|
47 |
<span class="um-admin-half">
|
48 |
-
|
49 |
<?php $this->ui_on_off('_um_has_cover_photo'); ?>
|
50 |
-
|
51 |
</span>
|
52 |
</p><div class="um-admin-clear"></div>
|
53 |
-
|
54 |
<p>
|
55 |
<label class="um-admin-half"><?php _e('Sort users by','ultimatemember'); ?> <?php $this->tooltip('Sort users by a specific parameter in the directory'); ?></label>
|
56 |
<span class="um-admin-half">
|
57 |
-
|
58 |
<select name="_um_sortby" id="_um_sortby" class="umaf-selectjs um-adm-conditional" style="width: 300px" data-cond1='other' data-cond1-show='custom-field'>
|
59 |
<option value="user_registered_desc" <?php selected('user_registered_desc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('New users first','ultimatemember'); ?></option>
|
60 |
<option value="user_registered_asc" <?php selected('user_registered_asc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Old users first','ultimatemember'); ?></option>
|
@@ -62,35 +62,36 @@
|
|
62 |
<option value="display_name" <?php selected('display_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Display Name','ultimatemember'); ?></option>
|
63 |
<option value="first_name" <?php selected('first_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('First Name','ultimatemember'); ?></option>
|
64 |
<option value="last_name" <?php selected('last_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Last Name','ultimatemember'); ?></option>
|
|
|
65 |
<option value="other" <?php selected('other', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Other (custom field)','ultimatemember'); ?></option>
|
66 |
<?php do_action('um_admin_directory_sort_users_select', '_um_sortby'); ?>
|
67 |
</select>
|
68 |
-
|
69 |
</span>
|
70 |
</p><div class="um-admin-clear"></div>
|
71 |
-
|
72 |
<p class="custom-field">
|
73 |
<label class="um-admin-half"><?php _e('Meta key','ultimatemember'); ?> <?php $this->tooltip('To sort by a custom field, enter the meta key of field here'); ?></label>
|
74 |
<span class="um-admin-half">
|
75 |
-
|
76 |
<input type="text" name="_um_sortby_custom" id="_um_sortby_custom" value="<?php echo $ultimatemember->query->get_meta_value('_um_sortby_custom', null, 'na' ); ?>" />
|
77 |
-
|
78 |
</span>
|
79 |
</p><div class="um-admin-clear"></div>
|
80 |
-
|
81 |
<p>
|
82 |
<label class="um-admin-half"><?php _e('Only show specific users (Enter one username per line)','ultimatemember'); ?></label>
|
83 |
<span class="um-admin-half">
|
84 |
-
|
85 |
<textarea name="_um_show_these_users" id="_um_show_these_users"><?php echo $show_these_users; ?></textarea>
|
86 |
-
|
87 |
</span>
|
88 |
</p><div class="um-admin-clear"></div>
|
89 |
-
|
90 |
<?php do_action('um_admin_extend_directory_options_general', $this); ?>
|
91 |
-
|
92 |
</div>
|
93 |
-
|
94 |
<div class="um-admin-clear"></div>
|
95 |
-
|
96 |
-
</div>
|
6 |
//print "'$k' => '" . $v[0] . "',<br />";
|
7 |
}
|
8 |
}
|
9 |
+
|
10 |
$show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
|
11 |
if ( $show_these_users ) {
|
12 |
$show_these_users = implode("\n", str_replace("\r", "", $show_these_users));
|
13 |
}
|
14 |
+
|
15 |
?>
|
16 |
|
17 |
<div class="um-admin-metabox">
|
18 |
|
19 |
<div class="">
|
20 |
+
|
21 |
<input type="hidden" name="_um_mode" id="_um_mode" value="directory" />
|
22 |
+
|
23 |
<p>
|
24 |
<label class="um-admin-half"><?php _e('User Roles to Display','ultimatemember'); ?> <?php $this->tooltip('If you do not want to show all members, select only user roles to appear in this directory'); ?></label>
|
25 |
<span class="um-admin-half">
|
26 |
+
|
27 |
<select multiple="multiple" name="_um_roles[]" id="_um_roles" class="umaf-selectjs" style="width: 300px">
|
28 |
<?php foreach($ultimatemember->query->get_roles() as $key => $value) { ?>
|
29 |
<option value="<?php echo $key; ?>" <?php selected($key, $ultimatemember->query->get_meta_value('_um_roles', $key ) ); ?>><?php echo $value; ?></option>
|
30 |
+
<?php } ?>
|
31 |
</select>
|
32 |
+
|
33 |
</span>
|
34 |
</p><div class="um-admin-clear"></div>
|
35 |
+
|
36 |
<p>
|
37 |
<label class="um-admin-half"><?php _e('Only show members who have uploaded a profile photo','ultimatemember'); ?><?php $this->tooltip('If \'Use Gravatars\' as profile photo is enabled, this option is ignored'); ?></label>
|
38 |
<span class="um-admin-half">
|
39 |
+
|
40 |
<?php $this->ui_on_off('_um_has_profile_photo'); ?>
|
41 |
+
|
42 |
</span>
|
43 |
</p><div class="um-admin-clear"></div>
|
44 |
|
45 |
<p>
|
46 |
<label class="um-admin-half"><?php _e('Only show members who have uploaded a cover photo','ultimatemember'); ?></label>
|
47 |
<span class="um-admin-half">
|
48 |
+
|
49 |
<?php $this->ui_on_off('_um_has_cover_photo'); ?>
|
50 |
+
|
51 |
</span>
|
52 |
</p><div class="um-admin-clear"></div>
|
53 |
+
|
54 |
<p>
|
55 |
<label class="um-admin-half"><?php _e('Sort users by','ultimatemember'); ?> <?php $this->tooltip('Sort users by a specific parameter in the directory'); ?></label>
|
56 |
<span class="um-admin-half">
|
57 |
+
|
58 |
<select name="_um_sortby" id="_um_sortby" class="umaf-selectjs um-adm-conditional" style="width: 300px" data-cond1='other' data-cond1-show='custom-field'>
|
59 |
<option value="user_registered_desc" <?php selected('user_registered_desc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('New users first','ultimatemember'); ?></option>
|
60 |
<option value="user_registered_asc" <?php selected('user_registered_asc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Old users first','ultimatemember'); ?></option>
|
62 |
<option value="display_name" <?php selected('display_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Display Name','ultimatemember'); ?></option>
|
63 |
<option value="first_name" <?php selected('first_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('First Name','ultimatemember'); ?></option>
|
64 |
<option value="last_name" <?php selected('last_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Last Name','ultimatemember'); ?></option>
|
65 |
+
<option value="random" <?php selected('random', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Random','ultimatemember'); ?></option>
|
66 |
<option value="other" <?php selected('other', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Other (custom field)','ultimatemember'); ?></option>
|
67 |
<?php do_action('um_admin_directory_sort_users_select', '_um_sortby'); ?>
|
68 |
</select>
|
69 |
+
|
70 |
</span>
|
71 |
</p><div class="um-admin-clear"></div>
|
72 |
+
|
73 |
<p class="custom-field">
|
74 |
<label class="um-admin-half"><?php _e('Meta key','ultimatemember'); ?> <?php $this->tooltip('To sort by a custom field, enter the meta key of field here'); ?></label>
|
75 |
<span class="um-admin-half">
|
76 |
+
|
77 |
<input type="text" name="_um_sortby_custom" id="_um_sortby_custom" value="<?php echo $ultimatemember->query->get_meta_value('_um_sortby_custom', null, 'na' ); ?>" />
|
78 |
+
|
79 |
</span>
|
80 |
</p><div class="um-admin-clear"></div>
|
81 |
+
|
82 |
<p>
|
83 |
<label class="um-admin-half"><?php _e('Only show specific users (Enter one username per line)','ultimatemember'); ?></label>
|
84 |
<span class="um-admin-half">
|
85 |
+
|
86 |
<textarea name="_um_show_these_users" id="_um_show_these_users"><?php echo $show_these_users; ?></textarea>
|
87 |
+
|
88 |
</span>
|
89 |
</p><div class="um-admin-clear"></div>
|
90 |
+
|
91 |
<?php do_action('um_admin_extend_directory_options_general', $this); ?>
|
92 |
+
|
93 |
</div>
|
94 |
+
|
95 |
<div class="um-admin-clear"></div>
|
96 |
+
|
97 |
+
</div>
|
admin/templates/form/profile_customize.php
CHANGED
@@ -139,7 +139,15 @@
|
|
139 |
|
140 |
</select>
|
141 |
</p>
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
<p><label for="_um_profile_header_bg"><?php _e('Header Background Color','ultimatemember'); ?></label>
|
144 |
<input type="text" value="<?php echo $ultimatemember->query->get_meta_value('_um_profile_header_bg', null, um_get_option('profile_header_bg') ); ?>" class="um-admin-colorpicker" name="_um_profile_header_bg" id="_um_profile_header_bg" data-default-color="<?php echo um_get_option('profile_header_bg'); ?>" />
|
145 |
</p>
|
139 |
|
140 |
</select>
|
141 |
</p>
|
142 |
+
|
143 |
+
<p><label for="_um_profile_photo_required"><?php _e('Make Profile Photo Required','ultimatemember'); ?><?php $this->tooltip('Require user to update a profile photo when updating their profile', 'e'); ?></label>
|
144 |
+
<span>
|
145 |
+
|
146 |
+
<?php $this->ui_on_off('_um_profile_photo_required'); ?>
|
147 |
+
|
148 |
+
</span>
|
149 |
+
</p>
|
150 |
+
|
151 |
<p><label for="_um_profile_header_bg"><?php _e('Header Background Color','ultimatemember'); ?></label>
|
152 |
<input type="text" value="<?php echo $ultimatemember->query->get_meta_value('_um_profile_header_bg', null, um_get_option('profile_header_bg') ); ?>" class="um-admin-colorpicker" name="_um_profile_header_bg" id="_um_profile_header_bg" data-default-color="<?php echo um_get_option('profile_header_bg'); ?>" />
|
153 |
</p>
|
assets/css/um-styles.css
CHANGED
@@ -765,3 +765,18 @@ small.um-max-filesize span{
|
|
765 |
background-repeat: no-repeat;
|
766 |
background-size: 24px 24px;
|
767 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
765 |
background-repeat: no-repeat;
|
766 |
background-size: 24px 24px;
|
767 |
}
|
768 |
+
|
769 |
+
.um-search-area {
|
770 |
+
position: relative;
|
771 |
+
max-width: 300px;
|
772 |
+
}
|
773 |
+
|
774 |
+
.um-search-area .um-search-field {
|
775 |
+
width: 100%;
|
776 |
+
}
|
777 |
+
|
778 |
+
.um-search-area .um-search-icon {
|
779 |
+
position: absolute;
|
780 |
+
top: 7px;
|
781 |
+
right: 10px;
|
782 |
+
}
|
assets/js/um-scripts.js
CHANGED
@@ -288,4 +288,8 @@ jQuery(document).ready(function() {
|
|
288 |
return false;
|
289 |
});
|
290 |
|
|
|
|
|
|
|
|
|
291 |
});
|
288 |
return false;
|
289 |
});
|
290 |
|
291 |
+
jQuery(document).on('click', '#um-search-button', function() {
|
292 |
+
jQuery(this).parents('form').submit();
|
293 |
+
});
|
294 |
+
|
295 |
});
|
assets/js/um.min.js
CHANGED
@@ -4,4 +4,4 @@ var a=this;this.selection.on("click",".select2-search-choice:not(.select2-locked
|
|
4 |
var i=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();i.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var i=this.type;if("checkbox"==i||"radio"==i)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),function(e){void 0==e.fn.ajaxForm;var t={};t.fileapi=void 0!==e("<input type='file'/>").get(0).files,t.formdata=void 0!==window.FormData,e.fn.uploadFile=function(i){function a(){h.afterUploadAll&&!g&&(g=!0,function e(){0!=f.sCounter&&f.sCounter+f.fCounter==f.tCounter?(h.afterUploadAll(f),g=!1):window.setTimeout(e,100)}())}function n(t,i,a){a.on("dragenter",function(t){t.stopPropagation(),t.preventDefault(),e(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(a){e(this).css("border","2px dashed #ddd"),a.preventDefault(),t.errorLog.html("");var n=a.originalEvent.dataTransfer.files;return!i.multiple&&n.length>1?void(i.showError&&e("<div class='um-error-block'>"+i.multiDragErrorStr+"</div>").appendTo(t.errorLog)):void(0!=i.onSelect(n)&&o(i,t,n))}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),e(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}function r(t){var i=[];i="string"==jQuery.type(t)?t.split("&"):e.param(t).split("&");var a,n,r=i.length,o=[];for(a=0;r>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),o.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return o}function o(t,i,a){for(var n=0;n<a.length;n++)if(s(i,t,a[n].name))if(-1!=t.maxFileSize&&a[n].size>t.maxFileSize)t.showError&&e("<div class='um-error-block'>"+t.sizeErrorStr+"</div>").appendTo(i.errorLog);else if(-1!=t.maxFileCount&&i.selectedFiles>=t.maxFileCount)t.showError&&e("<div class='um-error-block'>"+t.maxFileCountErrorStr+"</div>").appendTo(i.errorLog);else{i.selectedFiles++;var o=t,l=new FormData,c=t.fileName.replace("[]","");l.append(c,a[n]);var h=t.formData;if(h)for(var p=r(h),f=0;f<p.length;f++)p[f]&&l.append(p[f][0],p[f][1]);o.fileData=l;var m=new u(i,t),g="";g=t.showFileCounter?i.fileCounter+t.fileCounterStyle+a[n].name:a[n].name,m.filename.html(g);var v=e("<form style='display:block; position:absolute;left: 150px;' class='"+i.formGroup+"' method='"+t.method+"' action='"+t.url+"' enctype='"+t.enctype+"'></form>");v.appendTo("body");var y=[];y.push(a[n].name),d(v,o,m,y,i),i.fileCounter++}else t.showError&&e("<div class='um-error-block'>"+t.extErrorStr+"</div>").appendTo(i.errorLog)}function s(e,t,i){var a=t.allowedTypes.toLowerCase().split(","),n=i.split(".").pop().toLowerCase();return"*"!=t.allowedTypes&&jQuery.inArray(n,a)<0?!1:!0}function l(t,i){if(t.showFileCounter){var a=e(".upload-filename").length;i.fileCounter=a+1,e(".upload-filename").each(function(i,n){var r=e(this).html().split(t.fileCounterStyle),o=(parseInt(r[0])-1,a+t.fileCounterStyle+r[1]);e(this).html(o),a--})}}function c(i,a,n,r){var h="ajax-upload-id-"+(new Date).getTime(),p=e("<form method='"+n.method+"' action='"+n.url+"' enctype='"+n.enctype+"'></form>"),f="<input type='file' id='"+h+"' name='"+n.fileName+"'/>";n.multiple&&(n.fileName.indexOf("[]")!=n.fileName.length-2&&(n.fileName+="[]"),f="<input type='file' id='"+h+"' name='"+n.fileName+"' multiple/>");var m=e(f).appendTo(p);m.change(function(){i.errorLog.html("");var h=(n.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(y=0;y<this.files.length;y++)h.push(this.files[y].name);if(0==n.onSelect(this.files))return}else{var f=e(this).val(),m=[];if(h.push(f),!s(i,n,f))return void(n.showError&&e("<div class='um-error-block'>"+n.extErrorStr+"</div>").appendTo(i.errorLog));if(m.push({name:f,size:"NA"}),0==n.onSelect(m))return}if(l(n,i),r.unbind("click"),p.hide(),c(i,a,n,r),p.addClass(a),t.fileapi&&t.formdata){p.removeClass(a);var g=this.files;o(n,i,g)}else{for(var v="",y=0;y<h.length;y++)v+=n.showFileCounter?i.fileCounter+n.fileCounterStyle+h[y]+"<br>":h[y]+"<br>",i.fileCounter++;if(-1!=n.maxFileCount&&i.selectedFiles+h.length>n.maxFileCount)return void(n.showError&&e("<div class='um-error-block'>"+n.maxFileCountErrorStr+"</div>").appendTo(i.errorLog));i.selectedFiles+=h.length;var b=new u(i,n);b.filename.html(v),d(p,n,b,h,i)}}),p.css({margin:0,padding:0});var g=e(r).width()+10;10==g&&(g=120);var v=r.height()+10;10==v&&(v=35),r.css({position:"relative",overflow:"hidden",cursor:"default"}),m.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),p.appendTo(r)}function u(t,i){return this.statusbar=e("<div class='upload-statusbar'></div>"),this.filename=e("<div class='upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='upload-bar "+t.formGroup+"'></div>").appendTo(this.progressDiv),this.abort=e("<div class='upload-red "+t.formGroup+"'>"+i.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div class='upload-red'>"+i.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div class='upload-green'>"+i.doneStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div class='upload-red'>"+i.deletelStr+"</div>").appendTo(this.statusbar).hide(),t.errorLog.after(this.statusbar),this}function d(e,i,n,o,s){var c={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:i.formData,formData:i.fileData,dataType:i.returnType,beforeSubmit:function(t,l,c){if(0!=i.onSubmit.call(this,o)){var u=i.dynamicFormData();if(u){var d=r(u);if(d)for(var h=0;h<d.length;h++)d[h]&&(void 0!=i.fileData?c.formData.append(d[h][0],d[h][1]):c.data[d[h][0]]=d[h][1])}return s.tCounter+=o.length,a(),!0}return n.statusbar.append("<div class='um-error-block'>"+i.uploadErrorStr+"</div>"),n.cancel.show(),e.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,a){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),i.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),s.selectedFiles-=o.length})),t.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,t,a,r){r>98&&(r=98);var o=r+"%";r>1&&n.progressbar.width(o),i.showProgress&&(n.progressbar.html(o),n.progressbar.css("text-align","center"))},success:function(t,a,r){s.responses.push(t),n.progressbar.width("100%"),i.showProgress&&(n.progressbar.html("100%"),n.progressbar.css("text-align","center")),n.abort.hide(),i.onSuccess.call(this,o,t,r),i.showStatusAfterSuccess?(i.showDone?(n.done.show(),n.done.click(function(){n.statusbar.hide("slow"),n.statusbar.remove()})):n.done.hide(),i.showDelete?(n.del.show(),n.del.click(function(){n.statusbar.hide().remove(),i.deleteCallback&&i.deleteCallback.call(this,t,n),s.selectedFiles-=o.length,l(i,s)})):n.del.hide()):(n.statusbar.hide("slow"),n.statusbar.remove()),e.remove(),s.sCounter+=o.length},error:function(t,a,r){n.abort.hide(),"abort"==t.statusText?(n.statusbar.hide("slow").remove(),l(i,s)):(i.onError.call(this,o,a,r),i.showStatusAfterError?(n.progressDiv.hide(),n.statusbar.append("<span class='um-error-block'>ERROR: "+r+"</span>")):(n.statusbar.hide(),n.statusbar.remove()),s.selectedFiles-=o.length),e.remove(),s.fCounter+=o.length}};i.autoSubmit?e.ajaxSubmit(c):(i.showCancel&&(n.cancel.show(),n.cancel.click(function(){e.remove(),n.statusbar.remove(),s.selectedFiles-=o.length,l(i,s)})),e.ajaxForm(c))}var h=e.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,t){},onSuccess:function(e,t,i){},onError:function(e,t,i){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},i);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var p="upload-"+(new Date).getTime();this.formGroup=p,this.hide(),this.errorLog=e("<div></div>"),this.after(this.errorLog),this.responses=[],t.formdata||(h.dragDrop=!1),t.formdata||(h.multiple=!1);var f=this,m=e("<div>"+e(this).html()+"</div>");e(m).addClass(h.uploadButtonClass),function v(){if(e.fn.ajaxForm){if(h.dragDrop){var t=e('<div class="ajax-upload-dragdrop" style="vertical-align:top;"></div>');e(f).before(t),e(t).append(m),e(t).prepend(e(h.dragDropStr)),n(f,h,t)}else e(f).before(m);c(f,p,h,m)}else window.setTimeout(v,10)}(),this.startUpload=function(){e("."+this.formGroup).each(function(t,i){e(this).is("form")&&e(this).submit()})},this.stopUpload=function(){e(".upload-red").each(function(t,i){e(this).hasClass(f.formGroup)&&e(this).click()})},this.getResponses=function(){return this.responses};var g=!1;return this}}(jQuery),function(e){"function"==typeof define&&define.amd?define("picker",["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):this.Picker=e(jQuery)}(function(e){function t(r,o,l,h){function p(){return t._.node("div",t._.node("div",t._.node("div",t._.node("div",Q.component.nodes(_.open),S.box),S.wrap),S.frame),S.holder,'tabindex="-1"')}function f(){j.data(o,Q).addClass(S.input).val(j.data("value")?Q.get("select",C.format):r.value),C.editable||j.on("focus."+_.id+" click."+_.id,function(e){e.preventDefault(),Q.open()}).on("keydown."+_.id,w),n(r,{haspopup:!0,expanded:!1,readonly:!1,owns:r.id+"_root"})}function m(){n(Q.$root[0],"hidden",!0)}function g(){Q.$holder.on({keydown:w,"focus.toOpen":b,blur:function(){j.removeClass(S.target)},focusin:function(e){Q.$root.removeClass(S.focused),e.stopPropagation()},"mousedown click":function(t){var i=t.target;i!=Q.$holder[0]&&(t.stopPropagation(),"mousedown"!=t.type||e(i).is("input, select, textarea, button, option")||(t.preventDefault(),Q.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var t=e(this),i=t.data(),a=t.hasClass(S.navDisabled)||t.hasClass(S.disabled),n=s();n=n&&(n.type||n.href),(a||n&&!e.contains(Q.$root[0],n))&&Q.$holder[0].focus(),!a&&i.nav?Q.set("highlight",Q.component.item.highlight,{nav:i.nav}):!a&&"pick"in i?(Q.set("select",i.pick),C.closeOnSelect&&Q.close(!0)):i.clear?(Q.clear(),C.closeOnClear&&Q.close(!0)):i.close&&Q.close(!0)})}function v(){var t;C.hiddenName===!0?(t=r.name,r.name=""):(t=["string"==typeof C.hiddenPrefix?C.hiddenPrefix:"","string"==typeof C.hiddenSuffix?C.hiddenSuffix:"_submit"],t=t[0]+r.name+t[1]),Q._hidden=e('<input type=hidden name="'+t+'"'+(j.data("value")||r.value?' value="'+Q.get("select",C.formatSubmit)+'"':"")+">")[0],j.on("change."+_.id,function(){Q._hidden.value=r.value?Q.get("select",C.formatSubmit):""})}function y(){x&&d?Q.$holder.find("."+S.frame).one("transitionend",function(){Q.$holder[0].focus()}):Q.$holder[0].focus()}function b(e){e.stopPropagation(),j.addClass(S.target),Q.$root.addClass(S.focused),Q.open()}function w(e){var t=e.keyCode,i=/^(8|46)$/.test(t);return 27==t?(Q.close(!0),!1):void((32==t||i||!_.open&&Q.component.key[t])&&(e.preventDefault(),e.stopPropagation(),i?Q.clear().close():Q.open()))}if(!r)return t;var x=!1,_={id:r.id||"P"+Math.abs(~~(Math.random()*new Date))},C=l?e.extend(!0,{},l.defaults,h):h||{},S=e.extend({},t.klasses(),C.klass),j=e(r),k=function(){return this.start()},Q=k.prototype={constructor:k,$node:j,start:function(){return _&&_.start?Q:(_.methods={},_.start=!0,_.open=!1,_.type=r.type,r.autofocus=r==s(),r.readOnly=!C.editable,r.id=r.id||_.id,"text"!=r.type&&(r.type="text"),Q.component=new l(Q,C),Q.$root=e('<div class="'+S.picker+'" id="'+r.id+'_root" />'),m(),Q.$holder=e(p()).appendTo(Q.$root),g(),C.formatSubmit&&v(),f(),C.containerHidden?e(C.containerHidden).append(Q._hidden):j.after(Q._hidden),C.container?e(C.container).append(Q.$root):j.after(Q.$root),Q.on({start:Q.component.onStart,render:Q.component.onRender,stop:Q.component.onStop,open:Q.component.onOpen,close:Q.component.onClose,set:Q.component.onSet}).on({start:C.onStart,render:C.onRender,stop:C.onStop,open:C.onOpen,close:C.onClose,set:C.onSet}),x=i(Q.$holder[0]),r.autofocus&&Q.open(),Q.trigger("start").trigger("render"))},render:function(t){return t?(Q.$holder=e(p()),g(),Q.$root.html(Q.$holder)):Q.$root.find("."+S.box).html(Q.component.nodes(_.open)),Q.trigger("render")},stop:function(){return _.start?(Q.close(),Q._hidden&&Q._hidden.parentNode.removeChild(Q._hidden),Q.$root.remove(),j.removeClass(S.input).removeData(o),setTimeout(function(){j.off("."+_.id)},0),r.type=_.type,r.readOnly=!1,Q.trigger("stop"),_.methods={},_.start=!1,Q):Q},open:function(i){return _.open?Q:(j.addClass(S.active),n(r,"expanded",!0),setTimeout(function(){Q.$root.addClass(S.opened),n(Q.$root[0],"hidden",!1)},0),i!==!1&&(_.open=!0,x&&u.css("overflow","hidden").css("padding-right","+="+a()),y(),c.on("click."+_.id+" focusin."+_.id,function(e){var t=e.target;t!=r&&t!=document&&3!=e.which&&Q.close(t===Q.$holder[0])}).on("keydown."+_.id,function(i){var a=i.keyCode,n=Q.component.key[a],r=i.target;27==a?Q.close(!0):r!=Q.$holder[0]||!n&&13!=a?e.contains(Q.$root[0],r)&&13==a&&(i.preventDefault(),r.click()):(i.preventDefault(),n?t._.trigger(Q.component.key.go,Q,[t._.trigger(n)]):Q.$root.find("."+S.highlighted).hasClass(S.disabled)||(Q.set("select",Q.component.item.highlight),C.closeOnSelect&&Q.close(!0)))})),Q.trigger("open"))},close:function(e){return e&&(C.editable?r.focus():(Q.$holder.off("focus.toOpen").focus(),setTimeout(function(){Q.$holder.on("focus.toOpen",b)},0))),j.removeClass(S.active),n(r,"expanded",!1),setTimeout(function(){Q.$root.removeClass(S.opened+" "+S.focused),n(Q.$root[0],"hidden",!0)},0),_.open?(_.open=!1,x&&u.css("overflow","").css("padding-right","-="+a()),c.off("."+_.id),Q.trigger("close")):Q},clear:function(e){return Q.set("clear",null,e)},set:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(a=o&&e.isPlainObject(i)?i:a||{},t){o||(s[t]=i);for(n in s)r=s[n],n in Q.component.item&&(void 0===r&&(r=null),Q.component.set(n,r,a)),("select"==n||"clear"==n)&&j.val("clear"==n?"":Q.get(n,C.format)).trigger("change");Q.render()}return a.muted?Q:Q.trigger("set",s)},get:function(e,i){if(e=e||"value",null!=_[e])return _[e];if("valueSubmit"==e){if(Q._hidden)return Q._hidden.value;e="value"}if("value"==e)return r.value;if(e in Q.component.item){if("string"==typeof i){var a=Q.component.get(e);return a?t._.trigger(Q.component.formats.toString,Q.component,[i,a]):""}return Q.component.get(e)}},on:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(t){o||(s[t]=i);for(n in s)r=s[n],a&&(n="_"+n),_.methods[n]=_.methods[n]||[],_.methods[n].push(r)}return Q},off:function(){var e,t,i=arguments;for(e=0,namesCount=i.length;e<namesCount;e+=1)t=i[e],t in _.methods&&delete _.methods[t];return Q},trigger:function(e,i){var a=function(e){var a=_.methods[e];a&&a.map(function(e){t._.trigger(e,Q,[i])})};return a("_"+e),a(e),Q}};return new k}function i(e){var t,i="position";return e.currentStyle?t=e.currentStyle[i]:window.getComputedStyle&&(t=getComputedStyle(e)[i]),"fixed"==t}function a(){if(u.height()<=l.height())return 0;var t=e('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=t[0].offsetWidth;t.css("overflow","scroll");var a=e('<div style="width:100%" />').appendTo(t),n=a[0].offsetWidth;return t.remove(),i-n}function n(t,i,a){if(e.isPlainObject(i))for(var n in i)r(t,n,i[n]);else r(t,i,a)}function r(e,t,i){e.setAttribute(("role"==t?"":"aria-")+t,i)}function o(t,i){e.isPlainObject(t)||(t={attribute:i}),i="";for(var a in t){var n=("role"==a?"":"aria-")+a,r=t[a];i+=null==r?"":n+'="'+t[a]+'"'}return i}function s(){try{return document.activeElement}catch(e){}}var l=e(window),c=e(document),u=e(document.documentElement),d=null!=document.documentElement.style.transition;return t.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",target:e+"__input--target",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},t._={group:function(e){for(var i,a="",n=t._.trigger(e.min,e);n<=t._.trigger(e.max,e,[n]);n+=e.i)i=t._.trigger(e.item,e,[n]),a+=t._.node(e.node,i[0],i[1],i[2]);return a},node:function(t,i,a,n){return i?(i=e.isArray(i)?i.join(""):i,a=a?' class="'+a+'"':"",n=n?" "+n:"","<"+t+a+n+">"+i+"</"+t+">"):""},lead:function(e){return(10>e?"0":"")+e},trigger:function(e,t,i){return"function"==typeof e?e.apply(t,i||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0},ariaAttr:o},t.extend=function(i,a){e.fn[i]=function(n,r){var o=this.data(i);return"picker"==n?o:o&&"string"==typeof n?t._.trigger(o[n],o,[r]):this.each(function(){var r=e(this);r.data(i)||new t(this,i,a,n)})},e.fn[i].defaults=a.defaults},t}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0],n=a.value,r=e.$node.data("value"),o=r||n,s=r?t.formatSubmit:t.format,l=function(){return a.currentStyle?"rtl"==a.currentStyle.direction:"rtl"==getComputedStyle(e.$root[0]).direction};i.settings=t,i.$node=e.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),o?i.set("select",o,{format:s,defaultValue:!0}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(e){var t=i.item.highlight,a=new Date(t.year,t.month,t.date+e);i.set("highlight",a,{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){var i=this.value;i&&(e.set("highlight",[e.get("view").year,i,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).trigger("focus"))}),e.$root.find("."+t.klass.selectYear).on("change",function(){var i=this.value;i&&(e.set("highlight",[i,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).trigger("focus"))})},1).on("open",function(){var a="";i.disabled(i.get("now"))&&(a=":not(."+t.klass.buttonToday+")"),e.$root.find("button"+a+", select").attr("disabled",!1)},1).on("close",function(){e.$root.find("button, select").attr("disabled",!0)},1)}var a=7,n=6,r=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",n.select,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",n.highlight,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,a){var n,o=this;return i=void 0===i?e:i,i==-(1/0)||i==1/0?n=i:t.isPlainObject(i)&&r.isInteger(i.pick)?i=i.obj:t.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=r.isDate(i)?i:o.create().obj):i=r.isInteger(i)||r.isDate(i)?o.normalize(new Date(i),a):o.now(e,i,a),{year:n||i.getFullYear(),month:n||i.getMonth(),date:n||i.getDate(),day:n||i.getDay(),obj:n||i,pick:n||i.getTime()}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||r.isDate(e)?a.create(e):e};return r.isInteger(e)||(e=n(e)),r.isInteger(i)||(i=n(i)),r.isInteger(e)&&t.isPlainObject(i)?e=[i.year,i.month,i.date+e]:r.isInteger(i)&&t.isPlainObject(e)&&(i=[e.year,e.month,e.date+i]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t,i){return t=new Date,i&&i.rel&&t.setDate(t.getDate()+i.rel),this.normalize(t,i)},i.prototype.navigate=function(e,i,a){var n,r,o,s,l=t.isArray(i),c=t.isPlainObject(i),u=this.item.view;if(l||c){for(c?(r=i.year,o=i.month,s=i.date):(r=+i[0],o=+i[1],s=+i[2]),a&&a.nav&&u&&u.month!==o&&(r=u.year,o=u.month),n=new Date(r,o+(a&&a.nav?a.nav:0),1),r=n.getFullYear(),o=n.getMonth();new Date(r,o,s).getMonth()!==o;)s-=1;i=[r,o,s]}return i},i.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},i.prototype.measure=function(e,t){var i=this;return t?"string"==typeof t?t=i.parse(e,t):r.isInteger(t)&&(t=i.now(e,t,{rel:t})):t="min"==e?-(1/0):1/0,t},i.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},i.prototype.validate=function(e,i,a){var n,o,s,l,c=this,u=i,d=a&&a.interval?a.interval:1,h=-1===c.item.enable,p=c.item.min,f=c.item.max,m=h&&c.item.disable.filter(function(e){if(t.isArray(e)){var a=c.create(e).pick;a<i.pick?n=!0:a>i.pick&&(o=!0)}return r.isInteger(e)}).length;if((!a||!a.nav&&!a.defaultValue)&&(!h&&c.disabled(i)||h&&c.disabled(i)&&(m||n||o)||!h&&(i.pick<=p.pick||i.pick>=f.pick)))for(h&&!m&&(!o&&d>0||!n&&0>d)&&(d*=-1);c.disabled(i)&&(Math.abs(d)>1&&(i.month<u.month||i.month>u.month)&&(i=u,d=d>0?1:-1),i.pick<=p.pick?(s=!0,d=1,i=c.create([p.year,p.month,p.date+(i.pick===p.pick?0:-1)])):i.pick>=f.pick&&(l=!0,d=-1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return r.isInteger(a)?e.day===(i.settings.firstDay?a:a-1)%7:t.isArray(a)||r.isDate(a)?e.pick===i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[3]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.parse=function(e,t,i){var a=this,n={};return t&&"string"==typeof t?(i&&i.format||(i=i||{},i.format=a.settings.format),a.formats.toArray(i.format).map(function(e){var i=a.formats[e],o=i?r.trigger(i,a,[t,n]):e.replace(/^!/,"").length;i&&(n[e]=t.substr(0,o)),t=t.substr(o)}),[n.yyyy||n.yy,+(n.mm||n.m)-1,n.dd||n.d]):t},i.prototype.formats=function(){function e(e,t,i){var a=e.match(/[^\x00-\x7F]+|\w+/)[0];return i.mm||i.m||(i.m=t.indexOf(a)+1),a.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?r.digits(e):t.date},dd:function(e,t){return e?2:r.lead(t.date)},ddd:function(e,i){return e?t(e):this.settings.weekdaysShort[i.day]},dddd:function(e,i){return e?t(e):this.settings.weekdaysFull[i.day]},m:function(e,t){return e?r.digits(e):t.month+1},mm:function(e,t){return e?2:r.lead(t.month+1)},mmm:function(t,i){var a=this.settings.monthsShort;return t?e(t,a,i):a[i.month]},mmmm:function(t,i){var a=this.settings.monthsFull;return t?e(t,a,i):a[i.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return r.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(e,i){var a=this;return r.isInteger(e)&&r.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(r.isDate(e)||t.isArray(e))&&(r.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isDateExact(e.from,i.from)&&a.isDateExact(e.to,i.to):!1},i.prototype.isDateOverlap=function(e,i){var a=this,n=a.settings.firstDay?1:0;return r.isInteger(e)&&(r.isDate(i)||t.isArray(i))?(e=e%7+n,e===a.create(i).day+1):r.isInteger(i)&&(r.isDate(e)||t.isArray(e))?(i=i%7+n,i===a.create(e).day+1):t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,o=0;o<n.length;o+=1)if(a.isDateExact(e,n[o])){i=!0;break}i||(r.isInteger(e)||r.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,o=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,s,l,c;for(l=0;o>l;l+=1){if(s=n[l],a.isDateExact(s,e)){i=n[l]=null,c=!0;break}if(a.isDateOverlap(s,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[3]||i.push("inverted")):r.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;o>l;l+=1)if(a.isDateExact(n[l],e)){n[l]=null;break}if(c)for(l=0;o>l;l+=1)if(a.isDateOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.nodes=function(e){var t=this,i=t.settings,o=t.item,s=o.now,l=o.select,c=o.highlight,u=o.view,d=o.disable,h=o.min,p=o.max,f=function(e,t){return i.firstDay&&(e.push(e.shift()),t.push(t.shift())),r.node("thead",r.node("tr",r.group({min:0,max:a-1,i:1,node:"th",item:function(a){return[e[a],i.klass.weekdays,'scope=col title="'+t[a]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0),i.weekdaysFull.slice(0)),m=function(e){return r.node("div"," ",i.klass["nav"+(e?"Next":"Prev")]+(e&&u.year>=p.year&&u.month>=p.month||!e&&u.year<=h.year&&u.month<=h.month?" "+i.klass.navDisabled:""),"data-nav="+(e||-1)+" "+r.ariaAttr({role:"button",controls:t.$node[0].id+"_table"})+' title="'+(e?i.labelMonthNext:i.labelMonthPrev)+'"')},g=function(){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return i.selectMonths?r.node("select",r.group({min:0,max:11,i:1,node:"option",item:function(e){return[a[e],0,"value="+e+(u.month==e?" selected":"")+(u.year==h.year&&e<h.month||u.year==p.year&&e>p.month?" disabled":"")]}}),i.klass.selectMonth,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):r.node("div",a[u.month],i.klass.month)},v=function(){var a=u.year,n=i.selectYears===!0?5:~~(i.selectYears/2);if(n){var o=h.year,s=p.year,l=a-n,c=a+n;if(o>l&&(c+=o-l,l=o),c>s){var d=l-o,f=c-s;l-=d>f?f:d,c=s}return r.node("select",r.group({min:l,max:c,i:1,node:"option",item:function(e){return[e,0,"value="+e+(a==e?" selected":"")]}}),i.klass.selectYear,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return r.node("div",a,i.klass.year)};return r.node("div",(i.selectYears?v()+g():g()+v())+m()+m(1),i.klass.header)+r.node("table",f+r.node("tbody",r.group({min:0,max:n-1,i:1,node:"tr",item:function(e){var n=i.firstDay&&0===t.create([u.year,u.month,1]).day?-7:0;return[r.group({min:a*e-u.day+n+1,max:function(){return this.min+a-1},i:1,node:"td",item:function(e){e=t.create([u.year,u.month,e+(i.firstDay?1:0)]);var a=l&&l.pick==e.pick,n=c&&c.pick==e.pick,o=d&&t.disabled(e)||e.pick<h.pick||e.pick>p.pick,f=r.trigger(t.formats.toString,t,[i.format,e]);return[r.node("div",e.date,function(t){return t.push(u.month==e.month?i.klass.infocus:i.klass.outfocus),s.pick==e.pick&&t.push(i.klass.now),a&&t.push(i.klass.selected),n&&t.push(i.klass.highlighted),o&&t.push(i.klass.disabled),t.join(" ")}([i.klass.day]),"data-pick="+e.pick+" "+r.ariaAttr({role:"gridcell",label:f,selected:a&&t.$node.val()===f?!0:null,activedescendant:n?!0:null,disabled:o?!0:null})),"",r.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+t.$node[0].id+'_table" '+r.ariaAttr({role:"grid",controls:t.$node[0].id,readonly:!0}))+r.node("div",r.node("button",i.today,i.klass.buttonToday,"type=button data-pick="+s.pick+(e&&!t.disabled(s)?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.close,i.klass.buttonClose,"type=button data-close=true "+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id})),i.klass.footer)},i.defaults=function(e){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today",buttonClose:e+"button--close"}}}(e.klasses().picker+"__"),e.extend("pickadate",i)}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0].value,n=e.$node.data("value"),r=n||a,o=n?t.formatSubmit:t.format;i.settings=t,i.$node=e.$node,i.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.interval=t.interval||30,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),r?i.set("select",r,{format:o}):i.set("select",null).set("highlight",i.item.now),i.key={40:1,38:-1,39:1,37:-1,go:function(e){i.set("highlight",i.item.highlight.pick+e*i.item.interval,{interval:e*i.item.interval}),this.render()}},e.on("render",function(){var i=e.$root.children(),a=i.find("."+t.klass.viewset),n=function(e){return["webkit","moz","ms","o",""].map(function(t){
|
5 |
return(t?"-"+t+"-":"")+e})},r=function(e,t){n("transform").map(function(i){e.css(i,t)}),n("transition").map(function(i){e.css(i,t)})};a.length&&(r(i,"none"),i[0].scrollTop=~~a.position().top-2*a[0].clientHeight,r(i,""))},1).on("open",function(){e.$root.find("button").attr("disabled",!1)},1).on("close",function(){e.$root.find("button").attr("disabled",!0)},1)}var a=24,n=60,r=12,o=a*n,s=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):"interval"==e?a.set("min",n.min,i).set("max",n.max,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",t,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",t,i),"min"==e&&a.set("max",n.max,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,r){var l=this;return i=void 0===i?e:i,s.isDate(i)&&(i=[i.getHours(),i.getMinutes()]),t.isPlainObject(i)&&s.isInteger(i.pick)?i=i.pick:t.isArray(i)?i=+i[0]*n+ +i[1]:s.isInteger(i)||(i=l.now(e,i,r)),"max"==e&&i<l.item.min.pick&&(i+=o),"min"!=e&&"max"!=e&&(i-l.item.min.pick)%l.item.interval!==0&&(i+=l.item.interval),i=l.normalize(e,i,r),{hour:~~(a+i/n)%a,mins:(n+i%n)%n,time:(o+i)%o,pick:i%o}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||s.isDate(e)?a.create(e):e};return s.isInteger(e)||(e=n(e)),s.isInteger(i)||(i=n(i)),s.isInteger(e)&&t.isPlainObject(i)?e=[i.hour,i.mins+e*a.settings.interval]:s.isInteger(i)&&t.isPlainObject(e)&&(i=[e.hour,e.mins+i*a.settings.interval]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t){var i,a=this.item.interval,r=new Date,o=r.getHours()*n+r.getMinutes(),l=s.isInteger(t);return o-=o%a,i=0>t&&-a>=a*t+o,o+="min"==e&&i?0:a,l&&(o+=a*(i&&"max"!=e?t+1:t)),o},i.prototype.normalize=function(e,t){var i=this.item.interval,a=this.item.min&&this.item.min.pick||0;return t-="min"==e?0:(t-a)%i},i.prototype.measure=function(e,i,r){var o=this;return i||(i="min"==e?[0,0]:[a-1,n-1]),"string"==typeof i?i=o.parse(e,i):i===!0||s.isInteger(i)?i=o.now(e,i,r):t.isPlainObject(i)&&s.isInteger(i.pick)&&(i=o.normalize(e,i.pick,r)),i},i.prototype.validate=function(e,t,i){var a=this,n=i&&i.interval?i.interval:a.item.interval;return a.disabled(t)&&(t=a.shift(t,n)),t=a.scope(t),a.disabled(t)&&(t=a.shift(t,-1*n)),t},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return s.isInteger(a)?e.hour==a:t.isArray(a)||s.isDate(a)?e.pick==i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[2]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.shift=function(e,t){var i=this,a=i.item.min.pick,n=i.item.max.pick;for(t=t||i.item.interval;i.disabled(e)&&(e=i.create(e.pick+=t),!(e.pick<=a||e.pick>=n)););return e},i.prototype.scope=function(e){var t=this.item.min.pick,i=this.item.max.pick;return this.create(e.pick>i?i:e.pick<t?t:e)},i.prototype.parse=function(e,t,i){var a,r,o,l,c,u=this,d={};if(!t||"string"!=typeof t)return t;i&&i.format||(i=i||{},i.format=u.settings.format),u.formats.toArray(i.format).map(function(e){var i,a=u.formats[e],n=a?s.trigger(a,u,[t,d]):e.replace(/^!/,"").length;a&&(i=t.substr(0,n),d[e]=i.match(/^\d+$/)?+i:i),t=t.substr(n)});for(l in d)c=d[l],s.isInteger(c)?l.match(/^(h|hh)$/i)?(a=c,("h"==l||"hh"==l)&&(a%=12)):"i"==l&&(r=c):l.match(/^a$/i)&&c.match(/^p/i)&&("h"in d||"hh"in d)&&(o=!0);return(o?a+12:a)*n+r},i.prototype.formats={h:function(e,t){return e?s.digits(e):t.hour%r||r},hh:function(e,t){return e?2:s.lead(t.hour%r||r)},H:function(e,t){return e?s.digits(e):""+t.hour%24},HH:function(e,t){return e?s.digits(e):s.lead(t.hour%24)},i:function(e,t){return e?2:s.lead(t.mins)},a:function(e,t){return e?4:o/2>t.time%o?"a.m.":"p.m."},A:function(e,t){return e?2:o/2>t.time%o?"AM":"PM"},toArray:function(e){return e.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return s.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}},i.prototype.isTimeExact=function(e,i){var a=this;return s.isInteger(e)&&s.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(s.isDate(e)||t.isArray(e))&&(s.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isTimeExact(e.from,i.from)&&a.isTimeExact(e.to,i.to):!1},i.prototype.isTimeOverlap=function(e,i){var a=this;return s.isInteger(e)&&(s.isDate(i)||t.isArray(i))?e===a.create(i).hour:s.isInteger(i)&&(s.isDate(e)||t.isArray(e))?i===a.create(e).hour:t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,r=0;r<n.length;r+=1)if(a.isTimeExact(e,n[r])){i=!0;break}i||(s.isInteger(e)||s.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,r=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,o,l,c;for(l=0;r>l;l+=1){if(o=n[l],a.isTimeExact(o,e)){i=n[l]=null,c=!0;break}if(a.isTimeOverlap(o,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[2]||i.push("inverted")):s.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;r>l;l+=1)if(a.isTimeExact(n[l],e)){n[l]=null;break}if(c)for(l=0;r>l;l+=1)if(a.isTimeOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.i=function(e,t){return s.isInteger(t)&&t>0?t:this.item.interval},i.prototype.nodes=function(e){var t=this,i=t.settings,a=t.item.select,n=t.item.highlight,r=t.item.view,o=t.item.disable;return s.node("ul",s.group({min:t.item.min.pick,max:t.item.max.pick,i:t.item.interval,node:"li",item:function(e){e=t.create(e);var l=e.pick,c=a&&a.pick==l,u=n&&n.pick==l,d=o&&t.disabled(e),h=s.trigger(t.formats.toString,t,[i.format,e]);return[s.trigger(t.formats.toString,t,[s.trigger(i.formatLabel,t,[e])||i.format,e]),function(e){return c&&e.push(i.klass.selected),u&&e.push(i.klass.highlighted),r&&r.pick==l&&e.push(i.klass.viewset),d&&e.push(i.klass.disabled),e.join(" ")}([i.klass.listItem]),"data-pick="+e.pick+" "+s.ariaAttr({role:"option",label:h,selected:c&&t.$node.val()===h?!0:null,activedescendant:u?!0:null,disabled:d?!0:null})]}})+s.node("li",s.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+s.ariaAttr({controls:t.$node[0].id})),"",s.ariaAttr({role:"presentation"})),i.klass.list,s.ariaAttr({role:"listbox",controls:t.$node[0].id}))},i.defaults=function(e){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:e+" "+e+"--time",holder:e+"__holder",list:e+"__list",listItem:e+"__list-item",disabled:e+"__list-item--disabled",selected:e+"__list-item--selected",highlighted:e+"__list-item--highlighted",viewset:e+"__list-item--viewset",now:e+"__list-item--now",buttonClear:e+"__button--clear"}}}(e.klasses().picker),e.extend("pickatime",i)}),[].map||(Array.prototype.map=function(e,t){for(var i=this,a=i.length,n=new Array(a),r=0;a>r;r++)r in i&&(n[r]=e.call(t,i[r],r,i));return n}),[].filter||(Array.prototype.filter=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var a=[],n=arguments[1],r=0;i>r;r++)if(r in t){var o=t[r];e.call(n,o,r,t)&&a.push(o)}return a}),[].indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if(0===i)return-1;var a=0;if(arguments.length>1&&(a=Number(arguments[1]),a!=a?a=0:0!==a&&a!=1/0&&a!=-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a)))),a>=i)return-1;for(var n=a>=0?a:Math.max(i-Math.abs(a),0);i>n;n++)if(n in t&&t[n]===e)return n;return-1});var nativeSplit=String.prototype.split,compliantExecNpcg=void 0===/()??/.exec("")[1];String.prototype.split=function(e,t){var i=this;if("[object RegExp]"!==Object.prototype.toString.call(e))return nativeSplit.call(i,e,t);var a,n,r,o,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),c=0;for(e=new RegExp(e.source,l+"g"),i+="",compliantExecNpcg||(a=new RegExp("^"+e.source+"$(?!\\s)",l)),t=void 0===t?-1>>>0:t>>>0;(n=e.exec(i))&&(r=n.index+n[0].length,!(r>c&&(s.push(i.slice(c,n.index)),!compliantExecNpcg&&n.length>1&&n[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(n[e]=void 0)}),n.length>1&&n.index<i.length&&Array.prototype.push.apply(s,n.slice(1)),o=n[0].length,c=r,s.length>=t)));)e.lastIndex===n.index&&e.lastIndex++;return c===i.length?(o||!e.test(""))&&s.push(""):s.push(i.slice(c)),s.length>t?s.slice(0,t):s},function(e){"use strict";var t={init:function(i){return this.each(function(){this.self=e(this),t.destroy.call(this.self),this.opt=e.extend(!0,{},e.fn.raty.defaults,i),t._adjustCallback.call(this),t._adjustNumber.call(this),"img"!==this.opt.starType&&t._adjustStarType.call(this),t._adjustPath.call(this),t._createStars.call(this),this.opt.cancel&&t._createCancel.call(this),this.opt.precision&&t._adjustPrecision.call(this),t._createScore.call(this),t._apply.call(this,this.opt.score),t._target.call(this,this.opt.score),this.opt.readOnly?t._lock.call(this):(this.style.cursor="pointer",t._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var e=["number","readOnly","score","scoreName","target"],t=0;t<e.length;t++)"function"==typeof this.opt[e[t]]&&(this.opt[e[t]]=this.opt[e[t]].call(this))},_adjustNumber:function(){this.opt.number=t._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var e=["cancelOff","cancelOn","starHalf","starOff","starOn"],t=0;t<e.length;t++)this.opt[e[t]]=this.opt[e[t]].replace(".","-")},_apply:function(e){t._fill.call(this,e),e&&(e>0&&this.score.val(t._between(e,0,this.opt.number)),t._roundStars.call(this,e))},_between:function(e,t,i){return Math.min(Math.max(parseFloat(e),t),i)},_binds:function(){this.cancel&&(t._bindOverCancel.call(this),t._bindClickCancel.call(this),t._bindOutCancel.call(this)),t._bindOver.call(this),t._bindClick.call(this),t._bindOut.call(this)},_bindClick:function(){var t=this;t.stars.on("click.raty",function(i){var a=e(this);t.score.val(t.opt.half||t.opt.precision?t.self.data("score"):this.alt||a.data("alt")),t.opt.click&&t.opt.click.call(t,+t.score.val(),i)})},_bindClickCancel:function(){var e=this;e.cancel.on("click.raty",function(t){e.score.removeAttr("value"),e.opt.click&&e.opt.click.call(e,null,t)})},_bindOut:function(){var e=this;e.self.on("mouseleave.raty",function(i){var a=+e.score.val()||void 0;t._apply.call(e,a),t._target.call(e,a,i),e.opt.mouseout&&e.opt.mouseout.call(e,a,i)})},_bindOutCancel:function(){var e=this;e.cancel.on("mouseleave.raty",function(i){var a=e.opt.cancelOff;if("img"!==e.opt.starType&&(a=e.opt.cancelClass+" "+a),t._setIcon.call(e,this,a),e.opt.mouseout){var n=+e.score.val()||void 0;e.opt.mouseout.call(e,n,i)}})},_bindOver:function(){var e=this,i=e.opt.half?"mousemove.raty":"mouseover.raty";e.stars.on(i,function(i){var a=t._getScoreByPosition.call(e,i,this);t._fill.call(e,a),e.opt.half&&(t._roundStars.call(e,a),e.self.data("score",a)),t._target.call(e,a,i),e.opt.mouseover&&e.opt.mouseover.call(e,a,i)})},_bindOverCancel:function(){var e=this;e.cancel.on("mouseover.raty",function(i){var a=e.opt.path+e.opt.starOff,n=e.opt.cancelOn;"img"===e.opt.starType?e.stars.attr("src",a):(n=e.opt.cancelClass+" "+n,e.stars.attr("class",a)),t._setIcon.call(e,this,n),t._target.call(e,null,i),e.opt.mouseover&&e.opt.mouseover.call(e,null)})},_buildScoreField:function(){return e("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,i=e("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":this.opt.cancelClass});"img"===this.opt.starType?i.attr({src:t,alt:"x"}):i.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(i):this.self.append(" ").append(i),this.cancel=i},_createScore:function(){var i=e(this.opt.targetScore);this.score=i.length?i:t._buildScoreField.call(this)},_createStars:function(){for(var i=1;i<=this.opt.number;i++){var a=t._nameForIndex.call(this,i),n={alt:i,src:this.opt.path+this.opt[a]};"img"!==this.opt.starType&&(n={"data-alt":i,"class":n.src}),n.title=t._getHint.call(this,i),e("<"+this.opt.starType+" />",n).appendTo(this),this.opt.space&&this.self.append(i<this.opt.number?" ":"")}this.stars=this.self.children(this.opt.starType)},_error:function(t){e(this).text(t),e.error(t)},_fill:function(e){for(var i=0,a=1;a<=this.stars.length;a++){var n,r=this.stars[a-1],o=t._turnOn.call(this,a,e);if(this.opt.iconRange&&this.opt.iconRange.length>i){var s=this.opt.iconRange[i];n=t._getRangeIcon.call(this,s,o),a<=s.range&&t._setIcon.call(this,r,n),a===s.range&&i++}else n=this.opt[o?"starOn":"starOff"],t._setIcon.call(this,r,n)}},_getRangeIcon:function(e,t){return t?e.on||this.opt.starOn:e.off||this.opt.starOff},_getScoreByPosition:function(i,a){var n=parseInt(a.alt||a.getAttribute("data-alt"),10);if(this.opt.half){var r=t._getSize.call(this),o=parseFloat((i.pageX-e(a).offset().left)/r);n=this.opt.precision?n-1+o:n-1+(o>.5?1:.5)}return n},_getSize:function(){var e;return e="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),e||t._error.call(this,"Could not be possible get the icon size!"),e},_turnOn:function(e,t){return this.opt.single?e===t:t>=e},_getHint:function(e){var t=this.opt.hints[e-1];return""===t?"":t||e},_lock:function(){var e=parseInt(this.score.val(),10),i=e?t._getHint.call(this,e):this.opt.noRatedMsg;this.style.cursor="",this.title=i,this.score.prop("readonly",!0),this.stars.prop("title",i),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_nameForIndex:function(e){return this.opt.score&&this.opt.score>=e?"starOn":"starOff"},_roundStars:function(e){var i=(e%1).toFixed(2);if(i>this.opt.round.down){var a="starOn";this.opt.halfShow&&i<this.opt.round.up?a="starHalf":i<this.opt.round.full&&(a="starOff");var n=this.opt[a],r=this.stars[Math.ceil(e)-1];t._setIcon.call(this,r,n)}},_setIcon:function(e,t){e["img"===this.opt.starType?"src":"className"]=this.opt.path+t},_setTarget:function(e,t){t&&(t=this.opt.targetFormat.toString().replace("{score}",t)),e.is(":input")?e.val(t):e.html(t)},_target:function(i,a){if(this.opt.target){var n=e(this.opt.target);n.length||t._error.call(this,"Target selector invalid or missing!");var r=a&&"mouseover"===a.type;if(void 0===i)i=this.opt.targetText;else if(null===i)i=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?i=t._getHint.call(this,Math.ceil(i)):this.opt.precision&&(i=parseFloat(i).toFixed(1));var o=a&&"mousemove"===a.type;r||o||this.opt.targetKeep||(i=this.opt.targetText)}t._setTarget.call(this,n,i)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var e=0;e<this.opt.number;e++)this.stars[e].title=t._getHint.call(this,e+1);this.cancel&&this.cancel.css("display","")},cancel:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==!0&&(t[i?"click":"score"].call(a,null),this.score.removeAttr("value"))})},click:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),this.opt.click&&this.opt.click.call(this,i,e.Event("click")),t._target.call(this,i))})},destroy:function(){return this.each(function(){var t=e(this),i=t.data("raw");i?t.off(".raty").empty().css({cursor:i.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var e,t=[];return this.each(function(){e=this.score.val(),t.push(e?+e:void 0)}),t.length>1?t:t[0]},move:function(i){return this.each(function(){var a=parseInt(i,10),n=e(this).data("options"),r=(+i).toFixed(1).split(".")[1];a>=n.number&&(a=n.number-1,r=10);var o=t._getSize.call(this),s=o/10,l=e(this.stars[a]),c=l.offset().left+s*parseInt(r,10),u=e.Event("mousemove",{pageX:c});l.trigger(u)})},readOnly:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==i&&(i?(a.off(".raty").children("img").off(".raty"),t._lock.call(this)):(t._binds.call(this),t._unlock.call(this)),a.data("readonly",i))})},reload:function(){return t.set.call(this,{})},score:function(){var i=e(this);return arguments.length?t.setScore.apply(i,arguments):t.getScore.call(i)},set:function(t){return this.each(function(){var i=e(this),a=i.data("options"),n=e.extend({},a,t);i.raty(n)})},setScore:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),t._target.call(this,i))})}};e.fn.raty=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void e.error("Method "+i+" does not exist!"):t.init.apply(this,arguments)},e.fn.raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),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(e){"use strict";function t(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function i(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}var a=e.scrollTo=function(t,i,a){return e(window).scrollTo(t,i,a)};return a.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(n,r,o){"object"==typeof r&&(o=r,r=0),"function"==typeof o&&(o={onAfter:o}),"max"===n&&(n=9e9),o=e.extend({},a.defaults,o),r=r||o.duration;var s=o.queue&&o.axis.length>1;return s&&(r/=2),o.offset=i(o.offset),o.over=i(o.over),this.each(function(){function l(t){var i=e.extend({},o,{queue:!0,duration:r,complete:t&&function(){t.call(d,p,o)}});h.animate(f,i)}if(null!==n){var c,u=t(this),d=u?this.contentWindow||window:this,h=e(d),p=n,f={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(p)){p=i(p);break}if(p=u?e(p):e(p,d),!p.length)return;case"object":(p.is||p.style)&&(c=(p=e(p)).offset())}var m=e.isFunction(o.offset)&&o.offset(d,p)||o.offset;e.each(o.axis.split(""),function(e,t){var i="x"===t?"Left":"Top",n=i.toLowerCase(),r="scroll"+i,g=h[r](),v=a.max(d,t);if(c)f[r]=c[n]+(u?0:g-h.offset()[n]),o.margin&&(f[r]-=parseInt(p.css("margin"+i),10)||0,f[r]-=parseInt(p.css("border"+i+"Width"),10)||0),f[r]+=m[n]||0,o.over[n]&&(f[r]+=p["x"===t?"width":"height"]()*o.over[n]);else{var y=p[n];f[r]=y.slice&&"%"===y.slice(-1)?parseFloat(y)/100*v:y}o.limit&&/^\d+$/.test(f[r])&&(f[r]=f[r]<=0?0:Math.min(f[r],v)),!e&&o.axis.length>1&&(g===f[r]?f={}:s&&(l(o.onAfterFirst),f={}))}),l(o.onAfter)}})},a.max=function(i,a){var n="x"===a?"Width":"Height",r="scroll"+n;if(!t(i))return i[r]-e(i)[n.toLowerCase()]();var o="client"+n,s=i.ownerDocument||i.document,l=s.documentElement,c=s.body;return Math.max(l[r],c[r])-Math.min(l[o],c[o])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var i=this.get(t);if(t.options.interrupt&&t._last&&t._last!==i)return e(t.elem).stop();var a=Math.round(t.now);i!==a&&(e(t.elem)[t.prop](a),t._last=this.get(t))}},a}),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=l.call(arguments,1),c=0,d=0,h=0,p=0,f=0,m=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(h=-1*o.detail),"wheelDelta"in o&&(h=o.wheelDelta),"wheelDeltaY"in o&&(h=o.wheelDeltaY),"wheelDeltaX"in o&&(d=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(d=-1*h,h=0),c=0===h?d:h,"deltaY"in o&&(h=-1*o.deltaY,c=h),"deltaX"in o&&(d=o.deltaX,0===h&&(c=-1*d)),0!==h||0!==d){if(1===o.deltaMode){var g=e.data(this,"mousewheel-line-height");c*=g,h*=g,d*=g}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");c*=v,h*=v,d*=v}if(p=Math.max(Math.abs(h),Math.abs(d)),(!r||r>p)&&(r=p,a(o,p)&&(r/=40)),a(o,p)&&(c/=40,d/=40,h/=40),c=Math[c>=1?"floor":"ceil"](c/r),d=Math[d>=1?"floor":"ceil"](d/r),h=Math[h>=1?"floor":"ceil"](h/r),u.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();f=t.clientX-y.left,m=t.clientY-y.top}return t.deltaX=d,t.deltaY=h,t.deltaFactor=r,t.offsetX=f,t.offsetY=m,t.deltaMode=0,s.unshift(t,c,d,h),n&&clearTimeout(n),n=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){r=null}function a(e,t){return u.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var n,r,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var c=o.length;c;)e.event.fixHooks[o[--c]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=s.length;i;)this.removeEventListener(s[--i],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),a=i["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e){"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var i="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",r="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";i||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+r+"%3E%3C/script%3E"))),t()}(function(){var t,i="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",r={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:!0},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},o=0,s={},l=window.attachEvent&&!window.addEventListener?1:0,c=!1,u=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],d={init:function(t){var t=e.extend(!0,{},r,t),i=h.call(this);if(t.live){var l=t.liveSelector||this.selector||n,c=e(l);if("off"===t.live)return void f(l);s[l]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&f(l)},500)}else f(l);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":m(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),p(t),e(i).each(function(){var i=e(this);if(!i.data(a)){i.data(a,{idx:++o,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:i.css("direction"),cbOffsets:null,trigger:null});var n=i.data(a),r=n.opt,s=i.data("mcs-axis"),l=i.data("mcs-scrollbar-position"),c=i.data("mcs-theme");s&&(r.axis=s),l&&(r.scrollbarPosition=l),c&&(r.theme=c,p(r)),v.call(this),e("#mCSB_"+n.idx+"_container img:not(."+u[2]+")").addClass(u[2]),d.update.call(null,i)}})},update:function(t,i){var n=t||h.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!o.length)return;n.tweenRunning&&Y(t),t.hasClass(u[3])&&t.removeClass(u[3]),t.hasClass(u[4])&&t.removeClass(u[4]),x.call(this),b.call(this),"y"===r.axis||r.advanced.autoExpandHorizontalScroll||o.css("width",y(o.children())),n.overflowed=j.call(this),D.call(this),r.autoDraggerLength&&_.call(this),C.call(this),Q.call(this);var l=[Math.abs(o[0].offsetTop),Math.abs(o[0].offsetLeft)];"x"!==r.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?k.call(this):(X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(k.call(this),"y"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[1]&&X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==r.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?k.call(this):(X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(k.call(this),"x"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[0]&&X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),i&&n&&(2===i&&r.callbacks.onImageLoad&&"function"==typeof r.callbacks.onImageLoad?r.callbacks.onImageLoad.call(this):3===i&&r.callbacks.onSelectorChange&&"function"==typeof r.callbacks.onSelectorChange?r.callbacks.onSelectorChange.call(this):r.callbacks.onUpdate&&"function"==typeof r.callbacks.onUpdate&&r.callbacks.onUpdate.call(this)),U.call(this)}})},scrollTo:function(t,i){if("undefined"!=typeof t&&null!=t){var n=h.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},l=e.extend(!0,{},s,i),c=z.call(this,t),u=l.scrollInertia>0&&l.scrollInertia<17?17:l.scrollInertia;c[0]=N.call(this,c[0],"y"),c[1]=N.call(this,c[1],"x"),l.moveDragger&&(c[0]*=r.scrollRatio.y,c[1]*=r.scrollRatio.x),l.dur=u,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==o.axis&&r.overflowed[0]&&(l.dir="y",l.overwrite="all",X(n,c[0].toString(),l)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==o.axis&&r.overflowed[1]&&(l.dir="x",l.overwrite="none",X(n,c[1].toString(),l))},l.timeout)}})}},stop:function(){var t=h.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Y(t)})},disable:function(t){var i=h.call(this);return e(i).each(function(){var i=e(this);i.data(a)&&(i.data(a),U.call(this,"remove"),T.call(this),t&&k.call(this),D.call(this,!0),i.addClass(u[3]))})},destroy:function(){var t=h.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx),l=e("#mCSB_"+r.idx+"_container"),c=e(".mCSB_"+r.idx+"_scrollbar");o.live&&f(o.liveSelector||e(t).selector),U.call(this,"remove"),T.call(this),k.call(this),n.removeData(a),Z(this,"mcs"),c.remove(),l.find("img."+u[2]).removeClass(u[2]),s.replaceWith(l.contents()),n.removeClass(i+" _"+a+"_"+r.idx+" "+u[6]+" "+u[7]+" "+u[5]+" "+u[3]).addClass(u[4])}})}},h=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},p=function(t){var i=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],r=["minimal","minimal-dark"],o=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,i)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,r)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,o)>-1?"outside":t.scrollbarPosition},f=function(e){s[e]&&(clearTimeout(s[e]),Z(s,e))},m=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),r=n.opt,o=r.autoExpandScrollbar?" "+u[1]+"_expand":"",s=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_vertical"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_horizontal"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],l="yx"===r.axis?"mCSB_vertical_horizontal":"x"===r.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===r.axis?s[0]+s[1]:"x"===r.axis?s[1]:s[0],d="yx"===r.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",h=r.autoHideScrollbar?" "+u[6]:"",p="x"!==r.axis&&"rtl"===n.langDir?" "+u[7]:"";r.setWidth&&t.css("width",r.setWidth),r.setHeight&&t.css("height",r.setHeight),r.setLeft="y"!==r.axis&&"rtl"===n.langDir?"989999px":r.setLeft,t.addClass(i+" _"+a+"_"+n.idx+h+p).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+r.theme+" "+l+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+r.setTop+"; left:"+r.setLeft+";' dir="+n.langDir+" /></div>");
|
6 |
var f=e("#mCSB_"+n.idx),m=e("#mCSB_"+n.idx+"_container");"y"===r.axis||r.advanced.autoExpandHorizontalScroll||m.css("width",y(m.children())),"outside"===r.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),f.addClass("mCSB_outside").after(c)):(f.addClass("mCSB_inside").append(c),m.wrap(d)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},y=function(t){return Math.max.apply(Math,t.map(function(){return e(this).outerWidth(!0)}).get())},b=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx+"_container");n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(r[0].getBoundingClientRect().right+.4)-Math.floor(r[0].getBoundingClientRect().left),position:"relative"}).unwrap()},w=function(){var t=e(this),i=t.data(a),n=i.opt,r=e(".mCSB_"+i.idx+"_scrollbar:first"),o=te(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",s=["<a href='#' class='"+u[13]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[14]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[15]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[16]+"' oncontextmenu='return false;' "+o+" />"],l=["x"===n.axis?s[2]:s[0],"x"===n.axis?s[3]:s[1],s[2],s[3]];n.scrollButtons.enable&&r.prepend(l[0]).append(l[1]).next(".mCSB_scrollTools").prepend(l[2]).append(l[3])},x=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=t.css("max-height")||"none",o=-1!==r.indexOf("%"),s=t.css("box-sizing");if("none"!==r){var l=o?t.parent().height()*parseInt(r)/100:parseInt(r);"border-box"===s&&(l-=t.innerHeight()-t.height()+(t.outerHeight()-t.innerHeight())),n.css("max-height",Math.round(l))}},_=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[n.height()/r.outerHeight(!1),n.width()/r.outerWidth(!1)],c=[parseInt(o[0].css("min-height")),Math.round(s[0]*o[0].parent().height()),parseInt(o[1].css("min-width")),Math.round(s[1]*o[1].parent().width())],u=l&&c[1]<c[0]?c[0]:c[1],d=l&&c[3]<c[2]?c[2]:c[3];o[0].css({height:u,"max-height":o[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),o[1].css({width:d,"max-width":o[1].parent().width()-10})},C=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[r.outerHeight(!1)-n.height(),r.outerWidth(!1)-n.width()],l=[s[0]/(o[0].parent().height()-o[0].height()),s[1]/(o[1].parent().width()-o[1].width())];i.scrollRatio={y:l[0],x:l[1]}},S=function(e,t,i){var a=i?u[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(u[0]+" "+a),n.toggleClass(u[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(u[0]),n.removeClass(u[1])):(e.addClass(u[0]),n.addClass(u[1])))},j=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=null==i.overflowed?r.height():r.outerHeight(!1),s=null==i.overflowed?r.width():r.outerWidth(!1);return[o>n.height(),s>n.width()]},k=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx),o=e("#mCSB_"+i.idx+"_container"),s=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")];if(Y(t),("x"!==n.axis&&!i.overflowed[0]||"y"===n.axis&&i.overflowed[0])&&(s[0].add(o).css("top",0),X(t,"_resetY")),"y"!==n.axis&&!i.overflowed[1]||"x"===n.axis&&i.overflowed[1]){var l=dx=0;"rtl"===i.langDir&&(l=r.width()-o.outerWidth(!1),dx=Math.abs(l/i.scrollRatio.x)),o.css("left",l),s[1].css("left",dx),X(t,"_resetX")}},Q=function(){function t(){o=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(o),A.call(i[0])):t()},100)}var i=e(this),n=i.data(a),r=n.opt;if(!n.bindEvents){if(E.call(this),r.contentTouchScroll&&I.call(this),M.call(this),r.mouseWheel.enable){var o;t()}H.call(this),L.call(this),r.advanced.autoScrollOnFocus&&F.call(this),r.scrollButtons.enable&&B.call(this),r.keyboard.enable&&W.call(this),n.bindEvents=!0}},T=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=".mCSB_"+i.idx+"_scrollbar",s=e("#mCSB_"+i.idx+",#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,"+o+" ."+u[12]+",#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal,"+o+">a"),l=e("#mCSB_"+i.idx+"_container");n.advanced.releaseDraggableSelectors&&s.add(e(n.advanced.releaseDraggableSelectors)),i.bindEvents&&(e(document).unbind("."+r),s.each(function(){e(this).unbind("."+r)}),clearTimeout(t[0]._focusTimeout),Z(t[0],"_focusTimeout"),clearTimeout(i.sequential.step),Z(i.sequential,"step"),clearTimeout(l[0].onCompleteTimeout),Z(l[0],"onCompleteTimeout"),i.bindEvents=!1)},D=function(t){var i=e(this),n=i.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container_wrapper"),s=o.length?o:e("#mCSB_"+n.idx+"_container"),l=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[l[0].find(".mCSB_dragger"),l[1].find(".mCSB_dragger")];"x"!==r.axis&&(n.overflowed[0]&&!t?(l[0].add(c[0]).add(l[0].children("a")).css("display","block"),s.removeClass(u[8]+" "+u[10])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[0].css("display","none"),s.removeClass(u[10])):(l[0].css("display","none"),s.addClass(u[10])),s.addClass(u[8]))),"y"!==r.axis&&(n.overflowed[1]&&!t?(l[1].add(c[1]).add(l[1].children("a")).css("display","block"),s.removeClass(u[9]+" "+u[11])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[1].css("display","none"),s.removeClass(u[11])):(l[1].css("display","none"),s.addClass(u[11])),s.addClass(u[9]))),n.overflowed[0]||n.overflowed[1]?i.removeClass(u[5]):i.addClass(u[5])},O=function(e){var t=e.type;switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return e.target.ownerDocument!==document?[e.originalEvent.screenY,e.originalEvent.screenX,!1]:[e.originalEvent.pageY,e.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[i.screenY,i.screenX,a>1]:[i.pageY,i.pageX,a>1];default:return[e.pageY,e.pageX,!1]}},E=function(){function t(e){var t=f.find("iframe");if(t.length){var i=e?"auto":"none";t.css("pointer-events",i)}}function i(e,t,i,a){if(f[0].idleTimer=d.scrollInertia<233?250:0,n.attr("id")===p[1])var r="x",o=(n[0].offsetLeft-t+a)*u.scrollRatio.x;else var r="y",o=(n[0].offsetTop-e+i)*u.scrollRatio.y;X(s,o.toString(),{dir:r,drag:!0})}var n,r,o,s=e(this),u=s.data(a),d=u.opt,h=a+"_"+u.idx,p=["mCSB_"+u.idx+"_dragger_vertical","mCSB_"+u.idx+"_dragger_horizontal"],f=e("#mCSB_"+u.idx+"_container"),m=e("#"+p[0]+",#"+p[1]),g=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m;m.bind("mousedown."+h+" touchstart."+h+" pointerdown."+h+" MSPointerDown."+h,function(i){if(i.stopImmediatePropagation(),i.preventDefault(),J(i)){c=!0,l&&(document.onselectstart=function(){return!1}),t(!1),Y(s),n=e(this);var a=n.offset(),u=O(i)[0]-a.top,h=O(i)[1]-a.left,p=n.height()+a.top,f=n.width()+a.left;p>u&&u>0&&f>h&&h>0&&(r=u,o=h),S(n,"active",d.autoExpandScrollbar)}}).bind("touchmove."+h,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;i(r,o,a,s)}),e(document).bind("mousemove."+h+" pointermove."+h+" MSPointerMove."+h,function(e){if(n){var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;if(r===a)return;i(r,o,a,s)}}).add(g).bind("mouseup."+h+" touchend."+h+" pointerup."+h+" MSPointerUp."+h,function(){n&&(S(n,"active",d.autoExpandScrollbar),n=null),c=!1,l&&(document.onselectstart=null),t(!0)})},I=function(){function i(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,x=0,_=0;var i=T.offset();u=O(e)[0]-i.top,d=O(e)[1]-i.left,R=[O(e)[0],O(e)[1]]}function n(e){if(ee(e)&&!c&&!O(e)[2]&&(e.stopImmediatePropagation(),!_||x)){m=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(i),I.push(a),R[2]=Math.abs(O(e)[0]-R[0]),R[3]=Math.abs(O(e)[1]-R[1]),S.overflowed[0])var r=D[0].parent().height()-D[0].height(),o=u-i>0&&i-u>-(r*S.scrollRatio.y)&&(2*R[3]<R[2]||"yx"===j.axis);if(S.overflowed[1])var s=D[1].parent().width()-D[1].width(),h=d-a>0&&a-d>-(s*S.scrollRatio.x)&&(2*R[2]<R[3]||"yx"===j.axis);o||h?(e.preventDefault(),x=1):_=1,b="yx"===j.axis?[u-i,d-a]:"x"===j.axis?[null,d-a]:[u-i,null],T[0].idleTimer=250,S.overflowed[0]&&l(b[0],M,n,"y","all",!0),S.overflowed[1]&&l(b[1],M,n,"x",A,!0)}}function r(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Y(C),f=G();var i=Q.offset();h=O(e)[0]-i.top,p=O(e)[1]-i.left,E=[],I=[]}function o(e){if(ee(e)&&!c&&!O(e)[2]){e.stopImmediatePropagation(),x=0,_=0,g=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(g-m>30)){y=1e3/(g-f);var n="mcsEaseOut",r=2.5>y,o=r?[E[E.length-2],I[I.length-2]]:[0,0];v=r?[i-o[0],a-o[1]]:[i-h,a-p];var u=[Math.abs(v[0]),Math.abs(v[1])];y=r?[Math.abs(v[0]/4),Math.abs(v[1]/4)]:[y,y];var d=[Math.abs(T[0].offsetTop)-v[0]*s(u[0]/y[0],y[0]),Math.abs(T[0].offsetLeft)-v[1]*s(u[1]/y[1],y[1])];b="yx"===j.axis?[d[0],d[1]]:"x"===j.axis?[null,d[1]]:[d[0],null],w=[4*u[0]+j.scrollInertia,4*u[1]+j.scrollInertia];var C=parseInt(j.contentTouchScroll)||0;b[0]=u[0]>C?b[0]:0,b[1]=u[1]>C?b[1]:0,S.overflowed[0]&&l(b[0],w[0],n,"y",A,!1),S.overflowed[1]&&l(b[1],w[1],n,"x",A,!1)}}}function s(e,t){var i=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?i[0]:i[3]:e>60?t>3?i[3]:i[2]:e>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function l(e,t,i,a,n,r){e&&X(C,e.toString(),{dur:t,scrollEasing:i,dir:a,overwrite:n,drag:r})}var u,d,h,p,f,m,g,v,y,b,w,x,_,C=e(this),S=C.data(a),j=S.opt,k=a+"_"+S.idx,Q=e("#mCSB_"+S.idx),T=e("#mCSB_"+S.idx+"_container"),D=[e("#mCSB_"+S.idx+"_dragger_vertical"),e("#mCSB_"+S.idx+"_dragger_horizontal")],E=[],I=[],M=0,A="yx"===j.axis?"none":"all",R=[],H=T.find("iframe"),F=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k];T.bind(F[0],function(e){i(e)}).bind(F[1],function(e){n(e)}),Q.bind(F[0],function(e){r(e)}).bind(F[2],function(e){o(e)}),H.length&&H.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(F[0],function(e){i(e),r(e)}).bind(F[1],function(e){n(e)}).bind(F[2],function(e){o(e)})})})},M=function(){function i(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,i){u.type=i&&r?"stepped":"stepless",u.scrollAmount=10,$(o,e,t,"mcsLinearOut",i?60:null)}var r,o=e(this),s=o.data(a),l=s.opt,u=s.sequential,d=a+"_"+s.idx,h=e("#mCSB_"+s.idx+"_container"),p=h.parent();h.bind("mousedown."+d,function(){t||r||(r=1,c=!0)}).add(document).bind("mousemove."+d,function(e){if(!t&&r&&i()){var a=h.offset(),o=O(e)[0]-a.top+h[0].offsetTop,c=O(e)[1]-a.left+h[0].offsetLeft;o>0&&o<p.height()&&c>0&&c<p.width()?u.step&&n("off",null,"stepped"):("x"!==l.axis&&s.overflowed[0]&&(0>o?n("on",38):o>p.height()&&n("on",40)),"y"!==l.axis&&s.overflowed[1]&&(0>c?n("on",37):c>p.width()&&n("on",39)))}}).bind("mouseup."+d,function(){t||(r&&(r=0,n("off",null)),c=!1)})},A=function(){function t(t,a){if(Y(i),!R(i,t.target)){var o="auto"!==r.mouseWheel.deltaFactor?parseInt(r.mouseWheel.deltaFactor):l&&t.deltaFactor<100?100:t.deltaFactor||100;if("x"===r.axis||"x"===r.mouseWheel.axis)var u="x",d=[Math.round(o*n.scrollRatio.x),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.width()?.9*s.width():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),f=c[1][0].offsetLeft,m=c[1].parent().width()-c[1].width(),g=t.deltaX||t.deltaY||a;else var u="y",d=[Math.round(o*n.scrollRatio.y),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.height()?.9*s.height():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),f=c[0][0].offsetTop,m=c[0].parent().height()-c[0].height(),g=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||(r.mouseWheel.invert&&(g=-g),r.mouseWheel.normalizeDelta&&(g=0>g?-1:1),(g>0&&0!==f||0>g&&f!==m||r.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),X(i,(p-g*h).toString(),{dir:u}))}}var i=e(this),n=i.data(a),r=n.opt,o=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],u=e("#mCSB_"+n.idx+"_container").find("iframe");n&&(u.length&&u.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+o,function(e,i){t(e,i)})})}),s.bind("mousewheel."+o,function(e,i){t(e,i)}))},P=function(e){var t=null;try{var i=e.contentDocument||e.contentWindow.document;t=i.body.innerHTML}catch(a){}return null!==t},R=function(t,i){var n=i.nodeName.toLowerCase(),r=t.data(a).opt.mouseWheel.disableOver,o=["select","textarea"];return e.inArray(n,r)>-1&&!(e.inArray(n,o)>-1&&!e(i).is(":focus"))},H=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container"),o=r.parent(),s=e(".mCSB_"+i.idx+"_scrollbar ."+u[12]);s.bind("touchstart."+n+" pointerdown."+n+" MSPointerDown."+n,function(){c=!0}).bind("touchend."+n+" pointerup."+n+" MSPointerUp."+n,function(){c=!1}).bind("click."+n,function(a){if(e(a.target).hasClass(u[12])||e(a.target).hasClass("mCSB_draggerRail")){Y(t);var n=e(this),s=n.find(".mCSB_dragger");if(n.parent(".mCSB_scrollTools_horizontal").length>0){if(!i.overflowed[1])return;var l="x",c=a.pageX>s.offset().left?-1:1,d=Math.abs(r[0].offsetLeft)-.9*c*o.width()}else{if(!i.overflowed[0])return;var l="y",c=a.pageY>s.offset().top?-1:1,d=Math.abs(r[0].offsetTop)-.9*c*o.height()}X(t,d.toString(),{dir:l,scrollEasing:"mcsEaseInOut"})}})},F=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=e("#mCSB_"+i.idx+"_container"),s=o.parent();o.bind("focusin."+r,function(){var i=e(document.activeElement),a=o.find(".mCustomScrollBox").length,r=0;i.is(n.advanced.autoScrollOnFocus)&&(Y(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(r+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ie(i)[0],ie(i)[1]],a=[o[0].offsetTop,o[0].offsetLeft],l=[a[0]+e[0]>=0&&a[0]+e[0]<s.height()-i.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<s.width()-i.outerWidth(!1)],c="yx"!==n.axis||l[0]||l[1]?"all":"none";"x"===n.axis||l[0]||X(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r}),"y"===n.axis||l[1]||X(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r})},t[0]._focusTimer))})},L=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container").parent();r.bind("scroll."+n,function(){(0!==r.scrollTop()||0!==r.scrollLeft())&&e(".mCSB_"+i.idx+"_scrollbar").css("visibility","hidden")})},B=function(){var t=e(this),i=t.data(a),n=i.opt,r=i.sequential,o=a+"_"+i.idx,s=".mCSB_"+i.idx+"_scrollbar",l=e(s+">a");l.bind("mousedown."+o+" touchstart."+o+" pointerdown."+o+" MSPointerDown."+o+" mouseup."+o+" touchend."+o+" pointerup."+o+" MSPointerUp."+o+" mouseout."+o+" pointerout."+o+" MSPointerOut."+o+" click."+o,function(a){function o(e,i){r.scrollAmount=n.snapAmount||n.scrollButtons.scrollAmount,$(t,e,i)}if(a.preventDefault(),J(a)){var s=e(this).attr("class");switch(r.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;c=!0,i.tweenRunning=!1,o("on",s);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;c=!1,r.dir&&o("off",s);break;case"click":if("stepped"!==r.type||i.tweenRunning)return;o("on",s)}}})},W=function(){function t(t){function a(e,t){o.type=r.keyboard.scrollType,o.scrollAmount=r.snapAmount||r.keyboard.scrollAmount,"stepped"===o.type&&n.tweenRunning||$(i,e,t)}switch(t.type){case"blur":n.tweenRunning&&o.dir&&a("off",null);break;case"keydown":case"keyup":var s=t.keyCode?t.keyCode:t.which,l="on";if("x"!==r.axis&&(38===s||40===s)||"y"!==r.axis&&(37===s||39===s)){if((38===s||40===s)&&!n.overflowed[0]||(37===s||39===s)&&!n.overflowed[1])return;"keyup"===t.type&&(l="off"),e(document.activeElement).is(d)||(t.preventDefault(),t.stopImmediatePropagation(),a(l,s))}else if(33===s||34===s){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Y(i);var h=34===s?-1:1;if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=Math.abs(c[0].offsetLeft)-.9*h*u.width();else var p="y",f=Math.abs(c[0].offsetTop)-.9*h*u.height();X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}else if((35===s||36===s)&&!e(document.activeElement).is(d)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=35===s?Math.abs(u.width()-c.outerWidth(!1)):0;else var p="y",f=35===s?Math.abs(u.height()-c.outerHeight(!1)):0;X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}}var i=e(this),n=i.data(a),r=n.opt,o=n.sequential,s=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),u=c.parent(),d="input,textarea,select,datalist,keygen,[contenteditable='true']",h=c.find("iframe"),p=["blur."+s+" keydown."+s+" keyup."+s];h.length&&h.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(p[0],function(e){t(e)})})}),l.attr("tabindex","0").bind(p[0],function(e){t(e)})},$=function(t,i,n,r,o){function s(e){var i="stepped"!==h.type,a=o?o:e?i?m/1.5:g:1e3/60,n=e?i?7.5:40:2.5,l=[Math.abs(p[0].offsetTop),Math.abs(p[0].offsetLeft)],u=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],d="x"===h.dir[0]?l[1]+h.dir[1]*u[1]*n:l[0]+h.dir[1]*u[0]*n,f="x"===h.dir[0]?l[1]+h.dir[1]*parseInt(h.scrollAmount):l[0]+h.dir[1]*parseInt(h.scrollAmount),v="auto"!==h.scrollAmount?f:d,y=r?r:e?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",b=e?!0:!1;return e&&17>a&&(v="x"===h.dir[0]?l[1]:l[0]),X(t,v.toString(),{dir:h.dir[0],scrollEasing:y,dur:a,onComplete:b}),e?void(h.dir=!1):(clearTimeout(h.step),void(h.step=setTimeout(function(){s()},a)))}function l(){clearTimeout(h.step),Z(h,"step"),Y(t)}var c=t.data(a),d=c.opt,h=c.sequential,p=e("#mCSB_"+c.idx+"_container"),f="stepped"===h.type?!0:!1,m=d.scrollInertia<26?26:d.scrollInertia,g=d.scrollInertia<1?17:d.scrollInertia;switch(i){case"on":if(h.dir=[n===u[16]||n===u[15]||39===n||37===n?"x":"y",n===u[13]||n===u[15]||38===n||37===n?-1:1],Y(t),te(n)&&"stepped"===h.type)return;s(f);break;case"off":l(),(f||c.tweenRunning&&h.dir)&&s(!0)}},z=function(t){var i=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===i.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===i.axis?null:t,n[1]=t.x?t.x:t.y||"y"===i.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},N=function(t,i){if(null!=t&&"undefined"!=typeof t){var n=e(this),r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx+"_container"),l=s.parent(),c=typeof t;i||(i="x"===o.axis?"x":"y");var u="x"===i?s.outerWidth(!1):s.outerHeight(!1),h="x"===i?s[0].offsetLeft:s[0].offsetTop,p="x"===i?"left":"top";switch(c){case"function":return t();case"object":var f=t.jquery?t:e(t);if(!f.length)return;return"x"===i?ie(f)[1]:ie(f)[0];case"string":case"number":if(te(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(u*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(h-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var m=h+parseInt(t.split("+=")[1]);return m>=0?0:Math.abs(m)}if(-1!==t.indexOf("px")&&te(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(l.height()-s.outerHeight(!1));if("right"===t)return Math.abs(l.width()-s.outerWidth(!1));if("first"===t||"last"===t){var f=s.find(":"+t);return"x"===i?ie(f)[1]:ie(f)[0]}return e(t).length?"x"===i?ie(e(t))[1]:ie(e(t))[0]:(s.css(p,t),void d.update.call(null,n[0]))}}},U=function(t){function i(){clearTimeout(p[0].autoUpdate),p[0].autoUpdate=setTimeout(function(){return h.advanced.updateOnSelectorChange&&(f=o(),f!==w)?(s(3),void(w=f)):(h.advanced.updateOnContentResize&&(m=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],(m[0]!==x[0]||m[1]!==x[1]||m[2]!==x[2]||m[3]!==x[3]||m[4]!==x[4]||m[5]!==x[5])&&(s(m[0]!==x[0]||m[1]!==x[1]),x=m)),h.advanced.updateOnImageLoad&&(g=n(),g!==_&&(p.find("img").each(function(){r(this)}),_=g)),void((h.advanced.updateOnSelectorChange||h.advanced.updateOnContentResize||h.advanced.updateOnImageLoad)&&i()))},60)}function n(){var e=0;return h.advanced.updateOnImageLoad&&(e=p.find("img").length),e}function r(t){function i(e,t){return function(){return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(u[2]),s(2)}if(e(t).hasClass(u[2]))return void s();var n=new Image;n.onload=i(n,a),n.src=t.src}function o(){h.advanced.updateOnSelectorChange===!0&&(h.advanced.updateOnSelectorChange="*");var t=0,i=p.find(h.advanced.updateOnSelectorChange);return h.advanced.updateOnSelectorChange&&i.length>0&&i.each(function(){t+=e(this).height()+e(this).width()}),t}function s(e){clearTimeout(p[0].autoUpdate),d.update.call(null,l[0],e)}var l=e(this),c=l.data(a),h=c.opt,p=e("#mCSB_"+c.idx+"_container");if(t)return clearTimeout(p[0].autoUpdate),void Z(p[0],"autoUpdate");var f,m,g,v=p.parent(),y=[e("#mCSB_"+c.idx+"_scrollbar_vertical"),e("#mCSB_"+c.idx+"_scrollbar_horizontal")],b=function(){return[y[0].is(":visible")?y[0].outerHeight(!0):0,y[1].is(":visible")?y[1].outerWidth(!0):0]},w=o(),x=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],_=n();i()},q=function(e,t,i){return Math.round(e/t)*t-i},Y=function(t){var i=t.data(a),n=e("#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal");n.each(function(){K.call(this)})},X=function(t,i,n){function r(e){return l&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function o(){return[c.callbacks.alwaysTriggerOffsets||b>=w[0]+_,c.callbacks.alwaysTriggerOffsets||-C>=b]}function s(){var e=[p[0].offsetTop,p[0].offsetLeft],i=[v[0].offsetTop,v[0].offsetLeft],a=[p.outerHeight(!1),p.outerWidth(!1)],r=[h.height(),h.width()];t[0].mcs={content:p,top:e[0],left:e[1],draggerTop:i[0],draggerLeft:i[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-r[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-r[1])),direction:n.dir}}var l=t.data(a),c=l.opt,u={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(u,n),d=[n.dur,n.drag?0:n.dur],h=e("#mCSB_"+l.idx),p=e("#mCSB_"+l.idx+"_container"),f=p.parent(),m=c.callbacks.onTotalScrollOffset?z.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?z.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(l.trigger=n.trigger,(0!==f.scrollTop()||0!==f.scrollLeft())&&(e(".mCSB_"+l.idx+"_scrollbar").css("visibility","visible"),f.scrollTop(0).scrollLeft(0)),"_resetY"!==i||l.contentReset.y||(r("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),l.contentReset.y=1),"_resetX"!==i||l.contentReset.x||(r("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),l.contentReset.x=1),"_resetY"!==i&&"_resetX"!==i){switch(!l.contentReset.y&&t[0].mcs||!l.overflowed[0]||(r("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),l.contentReset.x=null),!l.contentReset.x&&t[0].mcs||!l.overflowed[1]||(r("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),l.contentReset.x=null),c.snapAmount&&(i=q(i,c.snapAmount,c.snapOffset)),n.dir){case"x":var v=e("#mCSB_"+l.idx+"_dragger_horizontal"),y="left",b=p[0].offsetLeft,w=[h.width()-p.outerWidth(!1),v.parent().width()-v.width()],x=[i,0===i?0:i/l.scrollRatio.x],_=m[1],C=g[1],j=_>0?_/l.scrollRatio.x:0,k=C>0?C/l.scrollRatio.x:0;break;case"y":var v=e("#mCSB_"+l.idx+"_dragger_vertical"),y="top",b=p[0].offsetTop,w=[h.height()-p.outerHeight(!1),v.parent().height()-v.height()],x=[i,0===i?0:i/l.scrollRatio.y],_=m[0],C=g[0],j=_>0?_/l.scrollRatio.y:0,k=C>0?C/l.scrollRatio.y:0}x[1]<0||0===x[0]&&0===x[1]?x=[0,0]:x[1]>=w[1]?x=[w[0],w[1]]:x[0]=-x[0],t[0].mcs||(s(),r("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(p[0].onCompleteTimeout),(l.tweenRunning||!(0===b&&x[0]>=0||b===w[0]&&x[0]<=w[0]))&&(V(v[0],y,Math.round(x[1]),d[1],n.scrollEasing),V(p[0],y,Math.round(x[0]),d[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!l.tweenRunning&&(r("onScrollStart")&&(s(),c.callbacks.onScrollStart.call(t[0])),l.tweenRunning=!0,S(v),l.cbOffsets=o())},onUpdate:function(){n.callbacks&&n.onUpdate&&r("whileScrolling")&&(s(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(p[0].onCompleteTimeout);var e=p[0].idleTimer||0;p[0].onCompleteTimeout=setTimeout(function(){r("onScroll")&&(s(),c.callbacks.onScroll.call(t[0])),r("onTotalScroll")&&x[1]>=w[1]-j&&l.cbOffsets[0]&&(s(),c.callbacks.onTotalScroll.call(t[0])),r("onTotalScrollBack")&&x[1]<=k&&l.cbOffsets[1]&&(s(),c.callbacks.onTotalScrollBack.call(t[0])),l.tweenRunning=!1,p[0].idleTimer=0,S(v,"hide")},e)}}}))}},V=function(e,t,i,a,n,r,o){function s(){x.stop||(y||f.call(),y=G()-v,l(),y>=x.time&&(x.time=y>x.time?y+h-(y-x.time):y+h-1,x.time<y+1&&(x.time=y+1)),x.time<a?x.id=p(s):g.call())}function l(){a>0?(x.currVal=d(x.time,b,_,a,n),w[t]=Math.round(x.currVal)+"px"):w[t]=i+"px",m.call()}function c(){h=1e3/60,x.time=y+h,p=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return l(),setTimeout(e,.01)},x.id=p(s)}function u(){null!=x.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(x.id):clearTimeout(x.id),x.id=null)}function d(e,t,i,a,n){switch(n){case"linear":case"mcsLinear":return i*e/a+t;case"mcsLinearOut":return e/=a,e--,i*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?i/2*Math.pow(2,10*(e-1))+t:(e--,i/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?i/2*e*e*e+t:(e-=2,i/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-i*(e*e*e*e-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var r=(e/=a)*e,o=r*e;return t+i*(.499999999999997*o*r+-2.5*r*r+5.5*o+-6.5*r+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var h,p,o=o||{},f=o.onStart||function(){},m=o.onUpdate||function(){},g=o.onComplete||function(){},v=G(),y=0,b=e.offsetTop,w=e.style,x=e._mTween[t];"left"===t&&(b=e.offsetLeft);var _=i-b;x.stop=0,"none"!==r&&u(),c()},G=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},K=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],i=0;i<t.length;i++){var a=t[i];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},Z=function(e,t){try{delete e[t]}catch(i){e[t]=null}},J=function(e){return!(e.which&&1!==e.which)},ee=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},te=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ie=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]};e.fn[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i].defaults=r,window[i]=!0,e(window).load(function(){e(n)[i](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var i,a,n=e(t),r=n.parents(".mCSB_container");return r.length?(i=r.parent(),a=[r[0].offsetTop,r[0].offsetLeft],a[0]+ie(n)[0]>=0&&a[0]+ie(n)[0]<i.height()-n.outerHeight(!1)&&a[1]+ie(n)[1]>=0&&a[1]+ie(n)[1]<i.width()-n.outerWidth(!1)):void 0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var i=e(t).data(a);return i?i.overflowed[0]||i.overflowed[1]:void 0}})})})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";var t=e(window),i=e(document),a=window.location,n=!0,r=!1,o=null,s=NaN,l=1/0,c="undefined",u="directive",d=".cropper",h=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,p=/^(x|y|width|height)$/,f=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,m="cropper-modal",g="cropper-hidden",v="cropper-invisible",y="cropper-move",b="cropper-crop",w="cropper-disabled",x="mousedown touchstart",_="mousemove touchmove",C="mouseup mouseleave touchend touchleave touchcancel",S="wheel mousewheel DOMMouseScroll",j="resize"+d,k="dblclick",Q="build"+d,T="built"+d,D="dragstart"+d,O="dragmove"+d,E="dragend"+d,I=function(e){return"number"==typeof e},M=function(e,t){var i=[];return"number"==typeof t&&i.push(t),i.slice.apply(e,i)},A=function(e,t){var i=M(arguments,2);return function(){return e.apply(t,i.concat(M(arguments)))}},P=function(t,i){this.element=t,this.$element=e(t),this.defaults=e.extend({},P.DEFAULTS,e.isPlainObject(i)?i:{}),this.$original=o,this.ready=r,this.built=r,this.cropped=r,this.rotated=r,this.disabled=r,this.replaced=r,this.init()},R=Math.sqrt,H=Math.min,F=Math.max,L=Math.abs,B=Math.sin,W=Math.cos,$=parseFloat;P.prototype={constructor:P,support:{canvas:e.isFunction(e("<canvas>")[0].getContext)},init:function(){var t=this.defaults;e.each(t,function(e,i){switch(e){case"aspectRatio":t[e]=L($(i))||s;break;case"autoCropArea":t[e]=L($(i))||.8;break;case"minWidth":case"minHeight":t[e]=L($(i))||0;break;case"maxWidth":case"maxHeight":t[e]=L($(i))||l}}),this.image={rotate:0},this.load()},load:function(){var t,i,a=this,r=this.$element,o=this.element,s=this.image,l="";r.is("img")?i=r.prop("src"):r.is("canvas")&&this.support.canvas&&(i=o.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(r.prop("crossOrigin")||this.isCrossOriginURL(i))&&(l=" crossOrigin"),this.$clone=t=e("<img"+l+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,a.url=i,a.ready=n,a.build()}),t.addClass(v).prependTo("body"))},isCrossOriginURL:function(e){var t=e.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===a.protocol&&t[2]===a.hostname&&t[3]===a.port?r:n},build:function(){var t,i,a=this.$element,o=this.defaults;this.ready&&(this.built&&this.unbuild(),a.one(Q,o.build),t=e.Event(Q),a.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=e(P.TEMPLATE),a.addClass(g),this.$clone.removeClass(v).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(g).prependTo(this.$cropper),this.originalImage=e.extend({},this.image)),this.$container=a.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),o.autoCrop?this.cropped=n:this.$dragger.addClass(g),o.dragCrop&&this.setDragMode("crop"),o.modal&&this.$canvas.addClass(m),!o.dashed&&this.$dragger.find(".cropper-dashed").addClass(g),!o.movable&&this.$dragger.find(".cropper-face").data(u,"move"),!o.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(g),
|
7 |
-
this.addListeners(),this.initPreview(),this.built=n,this.update(),this.replaced=r,a.one(T,o.built),a.trigger(T)))},unbuild:function(){this.built&&(this.built=r,this.removeListeners(),this.$preview.empty(),this.$preview=o,this.$dragger=o,this.$canvas=o,this.$container=o,this.$cropper.remove(),this.$cropper=o)},update:function(e){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),e?(this.setData(e,n),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(e.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,i=this.dragger,a=t.width,n=t.height,r=i.left-t.left,o=i.top-t.top;this.$viewer.find("img").css({width:a,height:n,marginLeft:-r,marginTop:-o}),this.$preview.each(function(){var t=e(this),s=t.width()/i.width;t.find("img").css({width:a*s,height:n*s,marginLeft:-r*s,marginTop:-o*s})})},addListeners:function(){var a=this.defaults;this.$element.on(D,a.dragstart).on(O,a.dragmove).on(E,a.dragend),this.$cropper.on(x,e.proxy(this.dragstart,this)).on(k,e.proxy(this.dblclick,this)),a.zoomable&&this.$cropper.on(S,e.proxy(this.wheel,this)),a.multiple?this.$cropper.on(_,e.proxy(this.dragmove,this)).on(C,e.proxy(this.dragend,this)):i.on(_,this._dragmove=A(this.dragmove,this)).on(C,this._dragend=A(this.dragend,this)),t.on(j,this._resize=A(this.resize,this))},removeListeners:function(){var e=this.defaults;this.$element.off(D,e.dragstart).off(O,e.dragmove).off(E,e.dragend),this.$cropper.off(x,this.dragstart).off(k,this.dblclick),e.zoomable&&this.$cropper.off(S,this.wheel),e.multiple?this.$cropper.off(_,this.dragmove).off(C,this.dragend):i.off(_,this._dragmove).off(C,this._dragend),t.off(j,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=e(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var e=this.$container;e!==o&&(this.container={width:F(e.width(),300),height:F(e.height(),150)})},initCropper:function(){var e,t=this.container,i=this.image;i.naturalWidth*t.height/i.naturalHeight-t.width>=0?(e={width:t.width,height:t.width/i.aspectRatio,left:0},e.top=(t.height-e.height)/2):(e={width:t.height*i.aspectRatio,height:t.height,top:0},e.left=(t.width-e.width)/2),this.$cropper.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.cropper=e},initImage:function(){var t=this.image,i=this.cropper,a={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=e.extend({},t,a),t._width!==i.width||t._height!==i.height?e.extend(t,a):(t=e.extend({},a,t),this.replaced&&(t.ratio=a.ratio)),this.image=t,this.renderImage()},renderImage:function(e){var t=this.image;"zoom"===e&&(t.left-=(t.width-t.oldWidth)/2,t.top-=(t.height-t.oldHeight)/2),t.left=H(F(t.left,t._width-t.width),0),t.top=H(F(t.top,t._height-t.height),0),this.$clone.css({width:t.width,height:t.height,marginLeft:t.left,marginTop:t.top}),e&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,a=this.cropper,n=i.aspectRatio||this.image.aspectRatio,r=this.image.ratio;t=a.height*n-a.width>=0?{height:a.width/n,width:a.width,left:0,top:(a.height-a.width/n)/2,maxWidth:a.width,maxHeight:a.width/n}:{height:a.height,width:a.height*n,left:(a.width-a.height*n)/2,top:0,maxWidth:a.height*n,maxHeight:a.height},t.minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=t.maxWidth/n):isFinite(i.maxHeight)&&(t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.maxWidth=t.maxHeight*n),i.minWidth>0?(t.minWidth=F(0,i.minWidth*r),t.minHeight=t.minWidth/n):i.minHeight>0&&(t.minHeight=F(0,i.minHeight*r),t.minWidth=t.minHeight*n)):(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.minWidth=F(0,i.minWidth*r),t.minHeight=F(0,i.minHeight*r)),t.minWidth=H(t.maxWidth,t.minWidth),t.minHeight=H(t.maxHeight,t.minHeight),t.height*=i.autoCropArea,t.width*=i.autoCropArea,t.left=(a.width-t.width)/2,t.top=(a.height-t.height)/2,t.oldLeft=t.left,t.oldTop=t.top,this.defaultDragger=t,this.dragger=e.extend({},t)},renderDragger:function(){var e=this.dragger,t=this.cropper;e.width>e.maxWidth?(e.width=e.maxWidth,e.left=e.oldLeft):e.width<e.minWidth&&(e.width=e.minWidth,e.left=e.oldLeft),e.height>e.maxHeight?(e.height=e.maxHeight,e.top=e.oldTop):e.height<e.minHeight&&(e.height=e.minHeight,e.top=e.oldTop),e.left=H(F(e.left,0),t.width-e.width),e.top=H(F(e.top,0),t.height-e.height),e.oldLeft=e.left,e.oldTop=e.top,this.dragger=e,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=e.extend({},this.defaultImage),this.renderImage(),this.dragger=e.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=r,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(m),this.$dragger.addClass(g))},destroy:function(){var e=this.$element;this.ready&&(this.unbuild(),e.removeClass(g).removeData("cropper"),this.rotated&&e.attr("src",this.$original.attr("src")))},replace:function(t,i){var a,o=this,s=this.$element,l=this.element;t&&t!==this.url&&t!==s.attr("src")&&(i||(this.rotated=r,this.replaced=n),s.is("img")?(s.attr("src",t),this.load()):s.is("canvas")&&this.support.canvas&&(a=l.getContext("2d"),e('<img src="'+t+'">').one("load",function(){l.width=this.width,l.height=this.height,a.clearRect(0,0,l.width,l.height),a.drawImage(this,0,0),o.load()})))},setData:function(t,i){var a=this.cropper,n=this.dragger,r=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!==c&&((t===o||e.isEmptyObject(t))&&(n=e.extend({},this.defaultDragger)),e.isPlainObject(t)&&!e.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),I(t.x)&&t.x<=a.width-r.left&&(n.left=t.x+r.left),I(t.y)&&t.y<=a.height-r.top&&(n.top=t.y+r.top),s?I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth?(n.width=t.width,n.height=n.width/s):I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height,n.width=n.height*s):(I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth&&(n.width=t.width),I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height))),this.dragger=n,this.renderDragger())},getData:function(e){var t=this.dragger,i=this.image,a={};return this.built&&(a={x:t.left-i.left,y:t.top-i.top,width:t.width,height:t.height},a=this.transformData(a,n,e)),a},transformData:function(t,i,a){var n=this.image.ratio,r={};return e.each(t,function(e,t){t=$(t),p.test(e)&&!isNaN(t)&&(r[e]=i?a?Math.round(t/n):t/n:t*n)}),r},setAspectRatio:function(e){var t="auto"===e;e=$(e),(t||!isNaN(e)&&e>0)&&(this.defaults.aspectRatio=t?s:e,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var t={};return this.ready&&e.each(this.image,function(e,i){f.test(e)&&(t[e]=i)}),t},getDataURL:function(t,i,a){var n,r=e("<canvas>")[0],o=this.getData(),s="";return e.isPlainObject(t)||(a=i,i=t,t={}),t=e.extend({width:o.width,height:o.height},t),this.cropped&&this.support.canvas&&(r.width=t.width,r.height=t.height,n=r.getContext("2d"),"image/jpeg"===i&&(n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height)),n.drawImage(this.$clone[0],o.x,o.y,o.width,o.height,0,0,t.width,t.height),s=r.toDataURL(i,a)),s},setDragMode:function(e){var t=this.$canvas,i=this.defaults,a=r,o=r;if(this.built&&!this.disabled){switch(e){case"crop":i.dragCrop&&(a=n,t.data(u,e));break;case"move":o=n,t.data(u,e);break;default:t.removeData(u)}t.toggleClass(b,a).toggleClass(y,o)}},enable:function(){this.built&&(this.disabled=r,this.$cropper.removeClass(w))},disable:function(){this.built&&(this.disabled=n,this.$cropper.addClass(w))},rotate:function(e){var t=this.image;e=$(e)||0,this.built&&0!==e&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=n,e=t.rotate=(t.rotate+e)%360,this.replace(this.getRotatedDataURL(e),!0))},getRotatedDataURL:function(t){var i=e("<canvas>")[0],a=i.getContext("2d"),n=t*Math.PI/180,r=L(t)%180,o=r>90?180-r:r,s=o*Math.PI/180,l=this.originalImage,c=l.naturalWidth,u=l.naturalHeight,d=L(c*W(s)+u*B(s)),h=L(c*B(s)+u*W(s));return i.width=d,i.height=h,a.save(),a.translate(d/2,h/2),a.rotate(n),a.drawImage(this.$original[0],-c/2,-u/2,c,u),a.restore(),i.toDataURL()},zoom:function(e){var t,i,a,n=this.image;e=$(e),this.built&&e&&!this.disabled&&this.defaults.zoomable&&(t=n.width*(1+e),i=n.height*(1+e),a=t/n._width,a>10||(1>a&&(t=n._width,i=n._height),1>=a?this.setDragMode("crop"):this.setDragMode("move"),n.oldWidth=n.width,n.oldHeight=n.height,n.width=t,n.height=i,n.ratio=n.width/n.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(b)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(e){var t,i=e.originalEvent,a=117.25,n=5,r=166.66665649414062,o=.1;this.disabled||(e.preventDefault(),i.deltaY?(t=i.deltaY,t=t%n===0?t/n:t%a===0?t/a:t/r):t=i.wheelDelta?-i.wheelDelta/120:i.detail?i.detail/3:0,this.zoom(t*o))},dragstart:function(t){var i,a,o,s=t.originalEvent.touches,l=t;if(!this.disabled){if(s){if(o=s.length,o>1){if(!this.defaults.zoomable||2!==o)return;l=s[1],this.startX2=l.pageX,this.startY2=l.pageY,i="zoom"}l=s[0]}if(i=i||e(l.target).data(u),h.test(i)){if(t.preventDefault(),a=e.Event(D),this.$element.trigger(a),a.isDefaultPrevented())return;this.directive=i,this.cropping=r,this.startX=l.pageX,this.startY=l.pageY,"crop"===i&&(this.cropping=n,this.$canvas.addClass(m))}}},dragmove:function(t){var i,a,n=t.originalEvent.touches,r=t;if(!this.disabled){if(n){if(a=n.length,a>1){if(!this.defaults.zoomable||2!==a)return;r=n[1],this.endX2=r.pageX,this.endY2=r.pageY}r=n[0]}if(this.directive){if(t.preventDefault(),i=e.Event(O),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=r.pageX,this.endY=r.pageY,this.dragging()}}},dragend:function(t){var i;if(!this.disabled&&this.directive){if(t.preventDefault(),i=e.Event(E),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=r,this.$canvas.toggleClass(m,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var e,t=this.directive,i=this.image,a=this.cropper,o=a.width,s=a.height,l=this.dragger,c=l.width,u=l.height,d=l.left,h=l.top,p=d+c,f=h+u,m=n,v=this.defaults,y=v.aspectRatio,b={x:this.endX-this.startX,y:this.endY-this.startY};switch(y&&(b.X=b.y*y,b.Y=b.x/y),t){case"all":d+=b.x,h+=b.y;break;case"e":if(b.x>=0&&(p>=o||y&&(0>=h||f>=s))){m=r;break}c+=b.x,y&&(u=c/y,h-=b.Y/2),0>c&&(t="w",c=0);break;case"n":if(b.y<=0&&(0>=h||y&&(0>=d||p>=o))){m=r;break}u-=b.y,h+=b.y,y&&(c=u*y,d+=b.X/2),0>u&&(t="s",u=0);break;case"w":if(b.x<=0&&(0>=d||y&&(0>=h||f>=s))){m=r;break}c-=b.x,d+=b.x,y&&(u=c/y,h+=b.Y/2),0>c&&(t="e",c=0);break;case"s":if(b.y>=0&&(f>=s||y&&(0>=d||p>=o))){m=r;break}u+=b.y,y&&(c=u*y,d-=b.X/2),0>u&&(t="n",u=0);break;case"ne":if(y){if(b.y<=0&&(0>=h||p>=o)){m=r;break}u-=b.y,h+=b.y,c=u*y}else b.x>=0?o>p?c+=b.x:b.y<=0&&0>=h&&(m=r):c+=b.x,b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="sw",u=0,c=0);break;case"nw":if(y){if(b.y<=0&&(0>=h||0>=d)){m=r;break}u-=b.y,h+=b.y,c=u*y,d+=b.X}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y<=0&&0>=h&&(m=r):(c-=b.x,d+=b.x),b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="se",u=0,c=0);break;case"sw":if(y){if(b.x<=0&&(0>=d||f>=s)){m=r;break}c-=b.x,d+=b.x,u=c/y}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y>=0&&f>=s&&(m=r):(c-=b.x,d+=b.x),b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="ne",u=0,c=0);break;case"se":if(y){if(b.x>=0&&(p>=o||f>=s)){m=r;break}c+=b.x,u=c/y}else b.x>=0?o>p?c+=b.x:b.y>=0&&f>=s&&(m=r):c+=b.x,b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="nw",u=0,c=0);break;case"move":i.left+=b.x,i.top+=b.y,this.renderImage("move"),m=r;break;case"zoom":v.zoomable&&(this.zoom(function(e,t,i,a,n,r){return(R(n*n+r*r)-R(i*i+a*a))/R(e*e+t*t)}(i.width,i.height,L(this.startX-this.startX2),L(this.startY-this.startY2),L(this.endX-this.endX2),L(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":b.x&&b.y&&(e=this.$cropper.offset(),d=this.startX-e.left,h=this.startY-e.top,c=l.minWidth,u=l.minHeight,b.x>0?b.y>0?t="se":(t="ne",h-=u):b.y>0?(t="sw",d-=c):(t="nw",d-=c,h-=u),this.cropped||(this.cropped=n,this.$dragger.removeClass(g)))}m&&(l.width=c,l.height=u,l.left=d,l.top=h,this.directive=t,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},P.TEMPLATE=function(e,t){return t=t.split(","),e.replace(/\d+/g,function(e){return t[e]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),P.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:e.noop,preview:"",multiple:r,autoCrop:n,dragCrop:n,dashed:n,modal:n,movable:n,resizable:n,zoomable:n,rotatable:n,checkImageOrigin:n,minWidth:0,minHeight:0,maxWidth:l,maxHeight:l,build:o,built:o,dragstart:o,dragmove:o,dragend:o},P.setDefaults=function(t){e.extend(P.DEFAULTS,t)},P.other=e.fn.cropper,e.fn.cropper=function(t){var i,a=M(arguments,1);return this.each(function(){var n,r=e(this),o=r.data("cropper");o||r.data("cropper",o=new P(this,t)),"string"==typeof t&&e.isFunction(n=o[t])&&(i=n.apply(o,a))}),typeof i!==c?i:this},e.fn.cropper.Constructor=P,e.fn.cropper.setDefaults=P.setDefaults,e.fn.cropper.noConflict=function(){return e.fn.cropper=P.other,this}}),function(e){function t(e,t){return"function"==typeof e?e.call(t):e}function i(e){for(;e=e.parentNode;)if(e==document)return!0;return!1}function a(t,i){this.$element=e(t),this.options=i,this.enabled=!0,this.fixTitle()}a.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var a=this.tip();a.find(".tipsy-inner")[this.options.html?"html":"text"](i),a[0].className="tipsy",a.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,r=e.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),o=a[0].offsetWidth,s=a[0].offsetHeight,l=t(this.options.gravity,this.$element[0]);switch(l.charAt(0)){case"n":n={top:r.top+r.height+this.options.offset,left:r.left+r.width/2-o/2};break;case"s":n={top:r.top-s-this.options.offset,left:r.left+r.width/2-o/2};break;case"e":n={top:r.top+r.height/2-s/2,left:r.left-o-this.options.offset};break;case"w":extra_gap=0,e("body").css("position").length>0&&"relative"==e("body").css("position")&&e("#wpadminbar").length&&(extra_gap=e("#wpadminbar").height()),n={top:r.top+r.height/2-s/2-extra_gap,left:r.left+r.width+this.options.offset}}2==l.length&&("w"==l.charAt(1)?n.left=r.left+r.width/2-15:n.left=r.left+r.width/2-o+15),a.css(n).addClass("tipsy-"+l),a.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+l.charAt(0),this.options.className&&a.addClass(t(this.options.className,this.$element[0])),this.options.fade?a.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):a.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){e(this).remove()}):this.tip().remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("original-title"))&&e.attr("original-title",e.attr("title")||"").removeAttr("title")},getTitle:function(){var e,t=this.$element,i=this.options;this.fixTitle();var e,i=this.options;return"string"==typeof i.title?e=t.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(e=i.title.call(t[0])),e=(""+e).replace(/(^\s*|\s*$)/,""),e||i.fallback},tip:function(){return this.$tip||(this.$tip=e('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},e.fn.tipsy=function(t){function i(i){var n=e.data(i,"tipsy");return n||(n=new a(i,e.fn.tipsy.elementOptions(i,t)),e.data(i,"tipsy",n)),n}function n(){var e=i(this);e.hoverState="in",0==t.delayIn?e.show():(e.fixTitle(),setTimeout(function(){"in"==e.hoverState&&e.show()},t.delayIn))}function r(){var e=i(this);e.hoverState="out",0==t.delayOut?e.hide():setTimeout(function(){"out"==e.hoverState&&e.hide()},t.delayOut)}if(t===!0)return this.data("tipsy");if("string"==typeof t){var o=this.data("tipsy");return o&&o[t](),this}if(t=e.extend({},e.fn.tipsy.defaults,t),t.live||this.each(function(){i(this)}),"manual"!=t.trigger){var s="hover"==t.trigger?"mouseenter":"focus",l="hover"==t.trigger?"mouseleave":"blur";t.live?e(document).on(s,this.selector,n).on(l,this.selector,r):this.bind(s,n).bind(l,r)}return this},e.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},e.fn.tipsy.revalidate=function(){e(".tipsy").each(function(){var t=e.data(this,"tipsy-pointee");t&&i(t)||e(this).remove()})},e.fn.tipsy.elementOptions=function(t,i){return e.metadata?e.extend({},i,e(t).metadata()):i},e.fn.tipsy.autoNS=function(){return e(this).offset().top>e(document).scrollTop()+e(window).height()/2?"s":"n"},e.fn.tipsy.autoWE=function(){return e(this).offset().left>e(document).scrollLeft()+e(window).width()/2?"e":"w"},e.fn.tipsy.autoBounds=function(t,i){return function(){var a={ns:i[0],ew:i.length>1?i[1]:!1},n=e(document).scrollTop()+t,r=e(document).scrollLeft()+t,o=e(this);return o.offset().top<n&&(a.ns="n"),o.offset().left<r&&(a.ew="w"),e(window).width()+e(document).scrollLeft()-o.offset().left<t&&(a.ew="e"),e(window).height()+e(document).scrollTop()-o.offset().top<t&&(a.ns="s"),a.ns+(a.ew?a.ew:"")}}}(jQuery);var live_field,live_value,xhrValidateUsername=!1;jQuery(document).ready(function(){2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()}),jQuery(function(){jQuery(".um-search form *").keypress(function(e){return 13==e.which?(jQuery(".um-search form").submit(),!1):void 0}),jQuery(document).on("touchend",function(){jQuery(".select2-search, .select2-focusser").remove()})}),jQuery(window).load(function(){um_responsive(),um_modal_responsive()}),jQuery(window).resize(function(){responsive_Modal(),jQuery("img.cropper-hidden").cropper("destroy"),um_responsive(),um_modal_responsive()}),jQuery(document).ready(function(){jQuery(document).on("input change",".um-field input[type=text]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),um_conditional()}),jQuery(".um-field input[type=text]").trigger("input"),jQuery(document).on("change",".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),jQuery(this).is(":checkbox")&&(jQuery(this).parents(".um-field").find("input:checked").length>1?(live_value="",jQuery(this).parents(".um-field").find("input:checked").each(function(){live_value=live_value+jQuery(this).val()+" "})):live_value=jQuery(this).parents(".um-field").find("input:checked").val()),jQuery(this).is(":radio")&&(live_value=jQuery(this).parents(".um-field").find("input[type=radio]:checked").val()),um_conditional()}),jQuery(".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]").trigger("change")}),jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeClass().addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeClass().addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){var e=(jQuery(this).parents(".um-field-area"),jQuery(this).parents("label"));e.hasClass("active")?(e.removeClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else var e=!1;var t=elem.attr("data-years"),i=elem.attr("data-date_min"),a=elem.attr("data-date_max"),n=i.split(","),r=a.split(","),o=n.length?new Date(n):null,s=n.length?new Date(r):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var l=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(l))}if(s&&"Invalid Date"==s.toString()&&3==r.length){var c=r[1]+"/"+r[2]+"/"+r[0];s=new Date(Date.parse(c))}elem.pickadate({selectYears:t,min:o,max:s,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_conditional()}}),jQuery(".um-rating-readonly").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(".um-s1").select2({allowClear:!0,minimumResultsForSearch:10}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),t>0&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),i=t.data("max_entries");return t.find(".um-field-group-body").length>1?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),i>0&&t.find(".um-field-group-body").length<i&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this).parent();t.addClass("loading");var i=jQuery(this).data("args"),a=jQuery(this).data("hook"),n=jQuery(this).parents(".um").find(".um-ajax-items");return jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_ajax_paginate",hook:a,args:i},complete:function(){t.removeClass("loading")},success:function(e){t.remove(),n.append(e)}}),!1}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),i=jQuery(this).data("user_id"),a=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_muted_action",hook:t,user_id:i,arguments:a},success:function(e){}}),!1})}),jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-more").hide(),t.find(".um-member-meta").slideDown(function(){UM_Member_Grid(i)}),t.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(i)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-less").hide(),t.find(".um-member-meta").slideUp(function(){t.find(".um-member-more").fadeIn(),UM_Member_Grid(i)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").submit(),!1})}),jQuery(document).ready(function(){function e(){if("undefined"!=typeof jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit"),t=e-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(t),5>t?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_profile_photo",metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_cover_photo",metakey:metakey,user_id:user_id}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e)}),jQuery(document).ready(function(){var e=jQuery(".um-account-main").attr("data-current_tab");e&&jQuery(".um-account-tab[data-tab="+e+"]").show(),jQuery(document).on("click",".um-account-side li a",function(e){e.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var i=jQuery(this).attr("href"),a=jQuery(this).attr("data-tab");return window.history.pushState("","",i),jQuery(".um-account-tab").hide(),jQuery(".um-account-tab[data-tab="+a+"]").fadeIn(),jQuery(".um-account-nav a").removeClass("current"),jQuery(".um-account-nav a[data-tab="+a+"]").addClass("current"),!1}),jQuery(document).on("click",".um-account-nav a",function(e){e.preventDefault();var t=jQuery(this).attr("data-tab"),i=jQuery(this).parents("div"),a=jQuery(this);return jQuery(".um-account-tab").hide(),a.hasClass("current")?(i.next(".um-account-tab").slideUp(),a.removeClass("current")):(i.next(".um-account-tab").slideDown(),a.parents("div").find("a").removeClass("current"),a.addClass("current")),jQuery(".um-account-side li a").removeClass("current"),jQuery(".um-account-side li a[data-tab="+t+"]").addClass("current"),!1})});
|
4 |
var i=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();i.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var i=this.type;if("checkbox"==i||"radio"==i)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),function(e){void 0==e.fn.ajaxForm;var t={};t.fileapi=void 0!==e("<input type='file'/>").get(0).files,t.formdata=void 0!==window.FormData,e.fn.uploadFile=function(i){function a(){h.afterUploadAll&&!g&&(g=!0,function e(){0!=f.sCounter&&f.sCounter+f.fCounter==f.tCounter?(h.afterUploadAll(f),g=!1):window.setTimeout(e,100)}())}function n(t,i,a){a.on("dragenter",function(t){t.stopPropagation(),t.preventDefault(),e(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(a){e(this).css("border","2px dashed #ddd"),a.preventDefault(),t.errorLog.html("");var n=a.originalEvent.dataTransfer.files;return!i.multiple&&n.length>1?void(i.showError&&e("<div class='um-error-block'>"+i.multiDragErrorStr+"</div>").appendTo(t.errorLog)):void(0!=i.onSelect(n)&&o(i,t,n))}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),e(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}function r(t){var i=[];i="string"==jQuery.type(t)?t.split("&"):e.param(t).split("&");var a,n,r=i.length,o=[];for(a=0;r>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),o.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return o}function o(t,i,a){for(var n=0;n<a.length;n++)if(s(i,t,a[n].name))if(-1!=t.maxFileSize&&a[n].size>t.maxFileSize)t.showError&&e("<div class='um-error-block'>"+t.sizeErrorStr+"</div>").appendTo(i.errorLog);else if(-1!=t.maxFileCount&&i.selectedFiles>=t.maxFileCount)t.showError&&e("<div class='um-error-block'>"+t.maxFileCountErrorStr+"</div>").appendTo(i.errorLog);else{i.selectedFiles++;var o=t,l=new FormData,c=t.fileName.replace("[]","");l.append(c,a[n]);var h=t.formData;if(h)for(var p=r(h),f=0;f<p.length;f++)p[f]&&l.append(p[f][0],p[f][1]);o.fileData=l;var m=new u(i,t),g="";g=t.showFileCounter?i.fileCounter+t.fileCounterStyle+a[n].name:a[n].name,m.filename.html(g);var v=e("<form style='display:block; position:absolute;left: 150px;' class='"+i.formGroup+"' method='"+t.method+"' action='"+t.url+"' enctype='"+t.enctype+"'></form>");v.appendTo("body");var y=[];y.push(a[n].name),d(v,o,m,y,i),i.fileCounter++}else t.showError&&e("<div class='um-error-block'>"+t.extErrorStr+"</div>").appendTo(i.errorLog)}function s(e,t,i){var a=t.allowedTypes.toLowerCase().split(","),n=i.split(".").pop().toLowerCase();return"*"!=t.allowedTypes&&jQuery.inArray(n,a)<0?!1:!0}function l(t,i){if(t.showFileCounter){var a=e(".upload-filename").length;i.fileCounter=a+1,e(".upload-filename").each(function(i,n){var r=e(this).html().split(t.fileCounterStyle),o=(parseInt(r[0])-1,a+t.fileCounterStyle+r[1]);e(this).html(o),a--})}}function c(i,a,n,r){var h="ajax-upload-id-"+(new Date).getTime(),p=e("<form method='"+n.method+"' action='"+n.url+"' enctype='"+n.enctype+"'></form>"),f="<input type='file' id='"+h+"' name='"+n.fileName+"'/>";n.multiple&&(n.fileName.indexOf("[]")!=n.fileName.length-2&&(n.fileName+="[]"),f="<input type='file' id='"+h+"' name='"+n.fileName+"' multiple/>");var m=e(f).appendTo(p);m.change(function(){i.errorLog.html("");var h=(n.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(y=0;y<this.files.length;y++)h.push(this.files[y].name);if(0==n.onSelect(this.files))return}else{var f=e(this).val(),m=[];if(h.push(f),!s(i,n,f))return void(n.showError&&e("<div class='um-error-block'>"+n.extErrorStr+"</div>").appendTo(i.errorLog));if(m.push({name:f,size:"NA"}),0==n.onSelect(m))return}if(l(n,i),r.unbind("click"),p.hide(),c(i,a,n,r),p.addClass(a),t.fileapi&&t.formdata){p.removeClass(a);var g=this.files;o(n,i,g)}else{for(var v="",y=0;y<h.length;y++)v+=n.showFileCounter?i.fileCounter+n.fileCounterStyle+h[y]+"<br>":h[y]+"<br>",i.fileCounter++;if(-1!=n.maxFileCount&&i.selectedFiles+h.length>n.maxFileCount)return void(n.showError&&e("<div class='um-error-block'>"+n.maxFileCountErrorStr+"</div>").appendTo(i.errorLog));i.selectedFiles+=h.length;var b=new u(i,n);b.filename.html(v),d(p,n,b,h,i)}}),p.css({margin:0,padding:0});var g=e(r).width()+10;10==g&&(g=120);var v=r.height()+10;10==v&&(v=35),r.css({position:"relative",overflow:"hidden",cursor:"default"}),m.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),p.appendTo(r)}function u(t,i){return this.statusbar=e("<div class='upload-statusbar'></div>"),this.filename=e("<div class='upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='upload-bar "+t.formGroup+"'></div>").appendTo(this.progressDiv),this.abort=e("<div class='upload-red "+t.formGroup+"'>"+i.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div class='upload-red'>"+i.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div class='upload-green'>"+i.doneStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div class='upload-red'>"+i.deletelStr+"</div>").appendTo(this.statusbar).hide(),t.errorLog.after(this.statusbar),this}function d(e,i,n,o,s){var c={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:i.formData,formData:i.fileData,dataType:i.returnType,beforeSubmit:function(t,l,c){if(0!=i.onSubmit.call(this,o)){var u=i.dynamicFormData();if(u){var d=r(u);if(d)for(var h=0;h<d.length;h++)d[h]&&(void 0!=i.fileData?c.formData.append(d[h][0],d[h][1]):c.data[d[h][0]]=d[h][1])}return s.tCounter+=o.length,a(),!0}return n.statusbar.append("<div class='um-error-block'>"+i.uploadErrorStr+"</div>"),n.cancel.show(),e.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,a){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),i.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),s.selectedFiles-=o.length})),t.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,t,a,r){r>98&&(r=98);var o=r+"%";r>1&&n.progressbar.width(o),i.showProgress&&(n.progressbar.html(o),n.progressbar.css("text-align","center"))},success:function(t,a,r){s.responses.push(t),n.progressbar.width("100%"),i.showProgress&&(n.progressbar.html("100%"),n.progressbar.css("text-align","center")),n.abort.hide(),i.onSuccess.call(this,o,t,r),i.showStatusAfterSuccess?(i.showDone?(n.done.show(),n.done.click(function(){n.statusbar.hide("slow"),n.statusbar.remove()})):n.done.hide(),i.showDelete?(n.del.show(),n.del.click(function(){n.statusbar.hide().remove(),i.deleteCallback&&i.deleteCallback.call(this,t,n),s.selectedFiles-=o.length,l(i,s)})):n.del.hide()):(n.statusbar.hide("slow"),n.statusbar.remove()),e.remove(),s.sCounter+=o.length},error:function(t,a,r){n.abort.hide(),"abort"==t.statusText?(n.statusbar.hide("slow").remove(),l(i,s)):(i.onError.call(this,o,a,r),i.showStatusAfterError?(n.progressDiv.hide(),n.statusbar.append("<span class='um-error-block'>ERROR: "+r+"</span>")):(n.statusbar.hide(),n.statusbar.remove()),s.selectedFiles-=o.length),e.remove(),s.fCounter+=o.length}};i.autoSubmit?e.ajaxSubmit(c):(i.showCancel&&(n.cancel.show(),n.cancel.click(function(){e.remove(),n.statusbar.remove(),s.selectedFiles-=o.length,l(i,s)})),e.ajaxForm(c))}var h=e.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,t){},onSuccess:function(e,t,i){},onError:function(e,t,i){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},i);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var p="upload-"+(new Date).getTime();this.formGroup=p,this.hide(),this.errorLog=e("<div></div>"),this.after(this.errorLog),this.responses=[],t.formdata||(h.dragDrop=!1),t.formdata||(h.multiple=!1);var f=this,m=e("<div>"+e(this).html()+"</div>");e(m).addClass(h.uploadButtonClass),function v(){if(e.fn.ajaxForm){if(h.dragDrop){var t=e('<div class="ajax-upload-dragdrop" style="vertical-align:top;"></div>');e(f).before(t),e(t).append(m),e(t).prepend(e(h.dragDropStr)),n(f,h,t)}else e(f).before(m);c(f,p,h,m)}else window.setTimeout(v,10)}(),this.startUpload=function(){e("."+this.formGroup).each(function(t,i){e(this).is("form")&&e(this).submit()})},this.stopUpload=function(){e(".upload-red").each(function(t,i){e(this).hasClass(f.formGroup)&&e(this).click()})},this.getResponses=function(){return this.responses};var g=!1;return this}}(jQuery),function(e){"function"==typeof define&&define.amd?define("picker",["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):this.Picker=e(jQuery)}(function(e){function t(r,o,l,h){function p(){return t._.node("div",t._.node("div",t._.node("div",t._.node("div",Q.component.nodes(_.open),S.box),S.wrap),S.frame),S.holder,'tabindex="-1"')}function f(){j.data(o,Q).addClass(S.input).val(j.data("value")?Q.get("select",C.format):r.value),C.editable||j.on("focus."+_.id+" click."+_.id,function(e){e.preventDefault(),Q.open()}).on("keydown."+_.id,w),n(r,{haspopup:!0,expanded:!1,readonly:!1,owns:r.id+"_root"})}function m(){n(Q.$root[0],"hidden",!0)}function g(){Q.$holder.on({keydown:w,"focus.toOpen":b,blur:function(){j.removeClass(S.target)},focusin:function(e){Q.$root.removeClass(S.focused),e.stopPropagation()},"mousedown click":function(t){var i=t.target;i!=Q.$holder[0]&&(t.stopPropagation(),"mousedown"!=t.type||e(i).is("input, select, textarea, button, option")||(t.preventDefault(),Q.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var t=e(this),i=t.data(),a=t.hasClass(S.navDisabled)||t.hasClass(S.disabled),n=s();n=n&&(n.type||n.href),(a||n&&!e.contains(Q.$root[0],n))&&Q.$holder[0].focus(),!a&&i.nav?Q.set("highlight",Q.component.item.highlight,{nav:i.nav}):!a&&"pick"in i?(Q.set("select",i.pick),C.closeOnSelect&&Q.close(!0)):i.clear?(Q.clear(),C.closeOnClear&&Q.close(!0)):i.close&&Q.close(!0)})}function v(){var t;C.hiddenName===!0?(t=r.name,r.name=""):(t=["string"==typeof C.hiddenPrefix?C.hiddenPrefix:"","string"==typeof C.hiddenSuffix?C.hiddenSuffix:"_submit"],t=t[0]+r.name+t[1]),Q._hidden=e('<input type=hidden name="'+t+'"'+(j.data("value")||r.value?' value="'+Q.get("select",C.formatSubmit)+'"':"")+">")[0],j.on("change."+_.id,function(){Q._hidden.value=r.value?Q.get("select",C.formatSubmit):""})}function y(){x&&d?Q.$holder.find("."+S.frame).one("transitionend",function(){Q.$holder[0].focus()}):Q.$holder[0].focus()}function b(e){e.stopPropagation(),j.addClass(S.target),Q.$root.addClass(S.focused),Q.open()}function w(e){var t=e.keyCode,i=/^(8|46)$/.test(t);return 27==t?(Q.close(!0),!1):void((32==t||i||!_.open&&Q.component.key[t])&&(e.preventDefault(),e.stopPropagation(),i?Q.clear().close():Q.open()))}if(!r)return t;var x=!1,_={id:r.id||"P"+Math.abs(~~(Math.random()*new Date))},C=l?e.extend(!0,{},l.defaults,h):h||{},S=e.extend({},t.klasses(),C.klass),j=e(r),k=function(){return this.start()},Q=k.prototype={constructor:k,$node:j,start:function(){return _&&_.start?Q:(_.methods={},_.start=!0,_.open=!1,_.type=r.type,r.autofocus=r==s(),r.readOnly=!C.editable,r.id=r.id||_.id,"text"!=r.type&&(r.type="text"),Q.component=new l(Q,C),Q.$root=e('<div class="'+S.picker+'" id="'+r.id+'_root" />'),m(),Q.$holder=e(p()).appendTo(Q.$root),g(),C.formatSubmit&&v(),f(),C.containerHidden?e(C.containerHidden).append(Q._hidden):j.after(Q._hidden),C.container?e(C.container).append(Q.$root):j.after(Q.$root),Q.on({start:Q.component.onStart,render:Q.component.onRender,stop:Q.component.onStop,open:Q.component.onOpen,close:Q.component.onClose,set:Q.component.onSet}).on({start:C.onStart,render:C.onRender,stop:C.onStop,open:C.onOpen,close:C.onClose,set:C.onSet}),x=i(Q.$holder[0]),r.autofocus&&Q.open(),Q.trigger("start").trigger("render"))},render:function(t){return t?(Q.$holder=e(p()),g(),Q.$root.html(Q.$holder)):Q.$root.find("."+S.box).html(Q.component.nodes(_.open)),Q.trigger("render")},stop:function(){return _.start?(Q.close(),Q._hidden&&Q._hidden.parentNode.removeChild(Q._hidden),Q.$root.remove(),j.removeClass(S.input).removeData(o),setTimeout(function(){j.off("."+_.id)},0),r.type=_.type,r.readOnly=!1,Q.trigger("stop"),_.methods={},_.start=!1,Q):Q},open:function(i){return _.open?Q:(j.addClass(S.active),n(r,"expanded",!0),setTimeout(function(){Q.$root.addClass(S.opened),n(Q.$root[0],"hidden",!1)},0),i!==!1&&(_.open=!0,x&&u.css("overflow","hidden").css("padding-right","+="+a()),y(),c.on("click."+_.id+" focusin."+_.id,function(e){var t=e.target;t!=r&&t!=document&&3!=e.which&&Q.close(t===Q.$holder[0])}).on("keydown."+_.id,function(i){var a=i.keyCode,n=Q.component.key[a],r=i.target;27==a?Q.close(!0):r!=Q.$holder[0]||!n&&13!=a?e.contains(Q.$root[0],r)&&13==a&&(i.preventDefault(),r.click()):(i.preventDefault(),n?t._.trigger(Q.component.key.go,Q,[t._.trigger(n)]):Q.$root.find("."+S.highlighted).hasClass(S.disabled)||(Q.set("select",Q.component.item.highlight),C.closeOnSelect&&Q.close(!0)))})),Q.trigger("open"))},close:function(e){return e&&(C.editable?r.focus():(Q.$holder.off("focus.toOpen").focus(),setTimeout(function(){Q.$holder.on("focus.toOpen",b)},0))),j.removeClass(S.active),n(r,"expanded",!1),setTimeout(function(){Q.$root.removeClass(S.opened+" "+S.focused),n(Q.$root[0],"hidden",!0)},0),_.open?(_.open=!1,x&&u.css("overflow","").css("padding-right","-="+a()),c.off("."+_.id),Q.trigger("close")):Q},clear:function(e){return Q.set("clear",null,e)},set:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(a=o&&e.isPlainObject(i)?i:a||{},t){o||(s[t]=i);for(n in s)r=s[n],n in Q.component.item&&(void 0===r&&(r=null),Q.component.set(n,r,a)),("select"==n||"clear"==n)&&j.val("clear"==n?"":Q.get(n,C.format)).trigger("change");Q.render()}return a.muted?Q:Q.trigger("set",s)},get:function(e,i){if(e=e||"value",null!=_[e])return _[e];if("valueSubmit"==e){if(Q._hidden)return Q._hidden.value;e="value"}if("value"==e)return r.value;if(e in Q.component.item){if("string"==typeof i){var a=Q.component.get(e);return a?t._.trigger(Q.component.formats.toString,Q.component,[i,a]):""}return Q.component.get(e)}},on:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(t){o||(s[t]=i);for(n in s)r=s[n],a&&(n="_"+n),_.methods[n]=_.methods[n]||[],_.methods[n].push(r)}return Q},off:function(){var e,t,i=arguments;for(e=0,namesCount=i.length;e<namesCount;e+=1)t=i[e],t in _.methods&&delete _.methods[t];return Q},trigger:function(e,i){var a=function(e){var a=_.methods[e];a&&a.map(function(e){t._.trigger(e,Q,[i])})};return a("_"+e),a(e),Q}};return new k}function i(e){var t,i="position";return e.currentStyle?t=e.currentStyle[i]:window.getComputedStyle&&(t=getComputedStyle(e)[i]),"fixed"==t}function a(){if(u.height()<=l.height())return 0;var t=e('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=t[0].offsetWidth;t.css("overflow","scroll");var a=e('<div style="width:100%" />').appendTo(t),n=a[0].offsetWidth;return t.remove(),i-n}function n(t,i,a){if(e.isPlainObject(i))for(var n in i)r(t,n,i[n]);else r(t,i,a)}function r(e,t,i){e.setAttribute(("role"==t?"":"aria-")+t,i)}function o(t,i){e.isPlainObject(t)||(t={attribute:i}),i="";for(var a in t){var n=("role"==a?"":"aria-")+a,r=t[a];i+=null==r?"":n+'="'+t[a]+'"'}return i}function s(){try{return document.activeElement}catch(e){}}var l=e(window),c=e(document),u=e(document.documentElement),d=null!=document.documentElement.style.transition;return t.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",target:e+"__input--target",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},t._={group:function(e){for(var i,a="",n=t._.trigger(e.min,e);n<=t._.trigger(e.max,e,[n]);n+=e.i)i=t._.trigger(e.item,e,[n]),a+=t._.node(e.node,i[0],i[1],i[2]);return a},node:function(t,i,a,n){return i?(i=e.isArray(i)?i.join(""):i,a=a?' class="'+a+'"':"",n=n?" "+n:"","<"+t+a+n+">"+i+"</"+t+">"):""},lead:function(e){return(10>e?"0":"")+e},trigger:function(e,t,i){return"function"==typeof e?e.apply(t,i||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0},ariaAttr:o},t.extend=function(i,a){e.fn[i]=function(n,r){var o=this.data(i);return"picker"==n?o:o&&"string"==typeof n?t._.trigger(o[n],o,[r]):this.each(function(){var r=e(this);r.data(i)||new t(this,i,a,n)})},e.fn[i].defaults=a.defaults},t}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0],n=a.value,r=e.$node.data("value"),o=r||n,s=r?t.formatSubmit:t.format,l=function(){return a.currentStyle?"rtl"==a.currentStyle.direction:"rtl"==getComputedStyle(e.$root[0]).direction};i.settings=t,i.$node=e.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),o?i.set("select",o,{format:s,defaultValue:!0}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(e){var t=i.item.highlight,a=new Date(t.year,t.month,t.date+e);i.set("highlight",a,{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){var i=this.value;i&&(e.set("highlight",[e.get("view").year,i,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).trigger("focus"))}),e.$root.find("."+t.klass.selectYear).on("change",function(){var i=this.value;i&&(e.set("highlight",[i,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).trigger("focus"))})},1).on("open",function(){var a="";i.disabled(i.get("now"))&&(a=":not(."+t.klass.buttonToday+")"),e.$root.find("button"+a+", select").attr("disabled",!1)},1).on("close",function(){e.$root.find("button, select").attr("disabled",!0)},1)}var a=7,n=6,r=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",n.select,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",n.highlight,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,a){var n,o=this;return i=void 0===i?e:i,i==-(1/0)||i==1/0?n=i:t.isPlainObject(i)&&r.isInteger(i.pick)?i=i.obj:t.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=r.isDate(i)?i:o.create().obj):i=r.isInteger(i)||r.isDate(i)?o.normalize(new Date(i),a):o.now(e,i,a),{year:n||i.getFullYear(),month:n||i.getMonth(),date:n||i.getDate(),day:n||i.getDay(),obj:n||i,pick:n||i.getTime()}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||r.isDate(e)?a.create(e):e};return r.isInteger(e)||(e=n(e)),r.isInteger(i)||(i=n(i)),r.isInteger(e)&&t.isPlainObject(i)?e=[i.year,i.month,i.date+e]:r.isInteger(i)&&t.isPlainObject(e)&&(i=[e.year,e.month,e.date+i]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t,i){return t=new Date,i&&i.rel&&t.setDate(t.getDate()+i.rel),this.normalize(t,i)},i.prototype.navigate=function(e,i,a){var n,r,o,s,l=t.isArray(i),c=t.isPlainObject(i),u=this.item.view;if(l||c){for(c?(r=i.year,o=i.month,s=i.date):(r=+i[0],o=+i[1],s=+i[2]),a&&a.nav&&u&&u.month!==o&&(r=u.year,o=u.month),n=new Date(r,o+(a&&a.nav?a.nav:0),1),r=n.getFullYear(),o=n.getMonth();new Date(r,o,s).getMonth()!==o;)s-=1;i=[r,o,s]}return i},i.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},i.prototype.measure=function(e,t){var i=this;return t?"string"==typeof t?t=i.parse(e,t):r.isInteger(t)&&(t=i.now(e,t,{rel:t})):t="min"==e?-(1/0):1/0,t},i.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},i.prototype.validate=function(e,i,a){var n,o,s,l,c=this,u=i,d=a&&a.interval?a.interval:1,h=-1===c.item.enable,p=c.item.min,f=c.item.max,m=h&&c.item.disable.filter(function(e){if(t.isArray(e)){var a=c.create(e).pick;a<i.pick?n=!0:a>i.pick&&(o=!0)}return r.isInteger(e)}).length;if((!a||!a.nav&&!a.defaultValue)&&(!h&&c.disabled(i)||h&&c.disabled(i)&&(m||n||o)||!h&&(i.pick<=p.pick||i.pick>=f.pick)))for(h&&!m&&(!o&&d>0||!n&&0>d)&&(d*=-1);c.disabled(i)&&(Math.abs(d)>1&&(i.month<u.month||i.month>u.month)&&(i=u,d=d>0?1:-1),i.pick<=p.pick?(s=!0,d=1,i=c.create([p.year,p.month,p.date+(i.pick===p.pick?0:-1)])):i.pick>=f.pick&&(l=!0,d=-1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return r.isInteger(a)?e.day===(i.settings.firstDay?a:a-1)%7:t.isArray(a)||r.isDate(a)?e.pick===i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[3]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.parse=function(e,t,i){var a=this,n={};return t&&"string"==typeof t?(i&&i.format||(i=i||{},i.format=a.settings.format),a.formats.toArray(i.format).map(function(e){var i=a.formats[e],o=i?r.trigger(i,a,[t,n]):e.replace(/^!/,"").length;i&&(n[e]=t.substr(0,o)),t=t.substr(o)}),[n.yyyy||n.yy,+(n.mm||n.m)-1,n.dd||n.d]):t},i.prototype.formats=function(){function e(e,t,i){var a=e.match(/[^\x00-\x7F]+|\w+/)[0];return i.mm||i.m||(i.m=t.indexOf(a)+1),a.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?r.digits(e):t.date},dd:function(e,t){return e?2:r.lead(t.date)},ddd:function(e,i){return e?t(e):this.settings.weekdaysShort[i.day]},dddd:function(e,i){return e?t(e):this.settings.weekdaysFull[i.day]},m:function(e,t){return e?r.digits(e):t.month+1},mm:function(e,t){return e?2:r.lead(t.month+1)},mmm:function(t,i){var a=this.settings.monthsShort;return t?e(t,a,i):a[i.month]},mmmm:function(t,i){var a=this.settings.monthsFull;return t?e(t,a,i):a[i.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return r.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(e,i){var a=this;return r.isInteger(e)&&r.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(r.isDate(e)||t.isArray(e))&&(r.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isDateExact(e.from,i.from)&&a.isDateExact(e.to,i.to):!1},i.prototype.isDateOverlap=function(e,i){var a=this,n=a.settings.firstDay?1:0;return r.isInteger(e)&&(r.isDate(i)||t.isArray(i))?(e=e%7+n,e===a.create(i).day+1):r.isInteger(i)&&(r.isDate(e)||t.isArray(e))?(i=i%7+n,i===a.create(e).day+1):t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,o=0;o<n.length;o+=1)if(a.isDateExact(e,n[o])){i=!0;break}i||(r.isInteger(e)||r.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,o=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,s,l,c;for(l=0;o>l;l+=1){if(s=n[l],a.isDateExact(s,e)){i=n[l]=null,c=!0;break}if(a.isDateOverlap(s,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[3]||i.push("inverted")):r.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;o>l;l+=1)if(a.isDateExact(n[l],e)){n[l]=null;break}if(c)for(l=0;o>l;l+=1)if(a.isDateOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.nodes=function(e){var t=this,i=t.settings,o=t.item,s=o.now,l=o.select,c=o.highlight,u=o.view,d=o.disable,h=o.min,p=o.max,f=function(e,t){return i.firstDay&&(e.push(e.shift()),t.push(t.shift())),r.node("thead",r.node("tr",r.group({min:0,max:a-1,i:1,node:"th",item:function(a){return[e[a],i.klass.weekdays,'scope=col title="'+t[a]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0),i.weekdaysFull.slice(0)),m=function(e){return r.node("div"," ",i.klass["nav"+(e?"Next":"Prev")]+(e&&u.year>=p.year&&u.month>=p.month||!e&&u.year<=h.year&&u.month<=h.month?" "+i.klass.navDisabled:""),"data-nav="+(e||-1)+" "+r.ariaAttr({role:"button",controls:t.$node[0].id+"_table"})+' title="'+(e?i.labelMonthNext:i.labelMonthPrev)+'"')},g=function(){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return i.selectMonths?r.node("select",r.group({min:0,max:11,i:1,node:"option",item:function(e){return[a[e],0,"value="+e+(u.month==e?" selected":"")+(u.year==h.year&&e<h.month||u.year==p.year&&e>p.month?" disabled":"")]}}),i.klass.selectMonth,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):r.node("div",a[u.month],i.klass.month)},v=function(){var a=u.year,n=i.selectYears===!0?5:~~(i.selectYears/2);if(n){var o=h.year,s=p.year,l=a-n,c=a+n;if(o>l&&(c+=o-l,l=o),c>s){var d=l-o,f=c-s;l-=d>f?f:d,c=s}return r.node("select",r.group({min:l,max:c,i:1,node:"option",item:function(e){return[e,0,"value="+e+(a==e?" selected":"")]}}),i.klass.selectYear,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return r.node("div",a,i.klass.year)};return r.node("div",(i.selectYears?v()+g():g()+v())+m()+m(1),i.klass.header)+r.node("table",f+r.node("tbody",r.group({min:0,max:n-1,i:1,node:"tr",item:function(e){var n=i.firstDay&&0===t.create([u.year,u.month,1]).day?-7:0;return[r.group({min:a*e-u.day+n+1,max:function(){return this.min+a-1},i:1,node:"td",item:function(e){e=t.create([u.year,u.month,e+(i.firstDay?1:0)]);var a=l&&l.pick==e.pick,n=c&&c.pick==e.pick,o=d&&t.disabled(e)||e.pick<h.pick||e.pick>p.pick,f=r.trigger(t.formats.toString,t,[i.format,e]);return[r.node("div",e.date,function(t){return t.push(u.month==e.month?i.klass.infocus:i.klass.outfocus),s.pick==e.pick&&t.push(i.klass.now),a&&t.push(i.klass.selected),n&&t.push(i.klass.highlighted),o&&t.push(i.klass.disabled),t.join(" ")}([i.klass.day]),"data-pick="+e.pick+" "+r.ariaAttr({role:"gridcell",label:f,selected:a&&t.$node.val()===f?!0:null,activedescendant:n?!0:null,disabled:o?!0:null})),"",r.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+t.$node[0].id+'_table" '+r.ariaAttr({role:"grid",controls:t.$node[0].id,readonly:!0}))+r.node("div",r.node("button",i.today,i.klass.buttonToday,"type=button data-pick="+s.pick+(e&&!t.disabled(s)?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.close,i.klass.buttonClose,"type=button data-close=true "+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id})),i.klass.footer)},i.defaults=function(e){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today",buttonClose:e+"button--close"}}}(e.klasses().picker+"__"),e.extend("pickadate",i)}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0].value,n=e.$node.data("value"),r=n||a,o=n?t.formatSubmit:t.format;i.settings=t,i.$node=e.$node,i.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.interval=t.interval||30,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),r?i.set("select",r,{format:o}):i.set("select",null).set("highlight",i.item.now),i.key={40:1,38:-1,39:1,37:-1,go:function(e){i.set("highlight",i.item.highlight.pick+e*i.item.interval,{interval:e*i.item.interval}),this.render()}},e.on("render",function(){var i=e.$root.children(),a=i.find("."+t.klass.viewset),n=function(e){return["webkit","moz","ms","o",""].map(function(t){
|
5 |
return(t?"-"+t+"-":"")+e})},r=function(e,t){n("transform").map(function(i){e.css(i,t)}),n("transition").map(function(i){e.css(i,t)})};a.length&&(r(i,"none"),i[0].scrollTop=~~a.position().top-2*a[0].clientHeight,r(i,""))},1).on("open",function(){e.$root.find("button").attr("disabled",!1)},1).on("close",function(){e.$root.find("button").attr("disabled",!0)},1)}var a=24,n=60,r=12,o=a*n,s=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):"interval"==e?a.set("min",n.min,i).set("max",n.max,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",t,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",t,i),"min"==e&&a.set("max",n.max,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,r){var l=this;return i=void 0===i?e:i,s.isDate(i)&&(i=[i.getHours(),i.getMinutes()]),t.isPlainObject(i)&&s.isInteger(i.pick)?i=i.pick:t.isArray(i)?i=+i[0]*n+ +i[1]:s.isInteger(i)||(i=l.now(e,i,r)),"max"==e&&i<l.item.min.pick&&(i+=o),"min"!=e&&"max"!=e&&(i-l.item.min.pick)%l.item.interval!==0&&(i+=l.item.interval),i=l.normalize(e,i,r),{hour:~~(a+i/n)%a,mins:(n+i%n)%n,time:(o+i)%o,pick:i%o}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||s.isDate(e)?a.create(e):e};return s.isInteger(e)||(e=n(e)),s.isInteger(i)||(i=n(i)),s.isInteger(e)&&t.isPlainObject(i)?e=[i.hour,i.mins+e*a.settings.interval]:s.isInteger(i)&&t.isPlainObject(e)&&(i=[e.hour,e.mins+i*a.settings.interval]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t){var i,a=this.item.interval,r=new Date,o=r.getHours()*n+r.getMinutes(),l=s.isInteger(t);return o-=o%a,i=0>t&&-a>=a*t+o,o+="min"==e&&i?0:a,l&&(o+=a*(i&&"max"!=e?t+1:t)),o},i.prototype.normalize=function(e,t){var i=this.item.interval,a=this.item.min&&this.item.min.pick||0;return t-="min"==e?0:(t-a)%i},i.prototype.measure=function(e,i,r){var o=this;return i||(i="min"==e?[0,0]:[a-1,n-1]),"string"==typeof i?i=o.parse(e,i):i===!0||s.isInteger(i)?i=o.now(e,i,r):t.isPlainObject(i)&&s.isInteger(i.pick)&&(i=o.normalize(e,i.pick,r)),i},i.prototype.validate=function(e,t,i){var a=this,n=i&&i.interval?i.interval:a.item.interval;return a.disabled(t)&&(t=a.shift(t,n)),t=a.scope(t),a.disabled(t)&&(t=a.shift(t,-1*n)),t},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return s.isInteger(a)?e.hour==a:t.isArray(a)||s.isDate(a)?e.pick==i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[2]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.shift=function(e,t){var i=this,a=i.item.min.pick,n=i.item.max.pick;for(t=t||i.item.interval;i.disabled(e)&&(e=i.create(e.pick+=t),!(e.pick<=a||e.pick>=n)););return e},i.prototype.scope=function(e){var t=this.item.min.pick,i=this.item.max.pick;return this.create(e.pick>i?i:e.pick<t?t:e)},i.prototype.parse=function(e,t,i){var a,r,o,l,c,u=this,d={};if(!t||"string"!=typeof t)return t;i&&i.format||(i=i||{},i.format=u.settings.format),u.formats.toArray(i.format).map(function(e){var i,a=u.formats[e],n=a?s.trigger(a,u,[t,d]):e.replace(/^!/,"").length;a&&(i=t.substr(0,n),d[e]=i.match(/^\d+$/)?+i:i),t=t.substr(n)});for(l in d)c=d[l],s.isInteger(c)?l.match(/^(h|hh)$/i)?(a=c,("h"==l||"hh"==l)&&(a%=12)):"i"==l&&(r=c):l.match(/^a$/i)&&c.match(/^p/i)&&("h"in d||"hh"in d)&&(o=!0);return(o?a+12:a)*n+r},i.prototype.formats={h:function(e,t){return e?s.digits(e):t.hour%r||r},hh:function(e,t){return e?2:s.lead(t.hour%r||r)},H:function(e,t){return e?s.digits(e):""+t.hour%24},HH:function(e,t){return e?s.digits(e):s.lead(t.hour%24)},i:function(e,t){return e?2:s.lead(t.mins)},a:function(e,t){return e?4:o/2>t.time%o?"a.m.":"p.m."},A:function(e,t){return e?2:o/2>t.time%o?"AM":"PM"},toArray:function(e){return e.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return s.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}},i.prototype.isTimeExact=function(e,i){var a=this;return s.isInteger(e)&&s.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(s.isDate(e)||t.isArray(e))&&(s.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isTimeExact(e.from,i.from)&&a.isTimeExact(e.to,i.to):!1},i.prototype.isTimeOverlap=function(e,i){var a=this;return s.isInteger(e)&&(s.isDate(i)||t.isArray(i))?e===a.create(i).hour:s.isInteger(i)&&(s.isDate(e)||t.isArray(e))?i===a.create(e).hour:t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,r=0;r<n.length;r+=1)if(a.isTimeExact(e,n[r])){i=!0;break}i||(s.isInteger(e)||s.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,r=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,o,l,c;for(l=0;r>l;l+=1){if(o=n[l],a.isTimeExact(o,e)){i=n[l]=null,c=!0;break}if(a.isTimeOverlap(o,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[2]||i.push("inverted")):s.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;r>l;l+=1)if(a.isTimeExact(n[l],e)){n[l]=null;break}if(c)for(l=0;r>l;l+=1)if(a.isTimeOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.i=function(e,t){return s.isInteger(t)&&t>0?t:this.item.interval},i.prototype.nodes=function(e){var t=this,i=t.settings,a=t.item.select,n=t.item.highlight,r=t.item.view,o=t.item.disable;return s.node("ul",s.group({min:t.item.min.pick,max:t.item.max.pick,i:t.item.interval,node:"li",item:function(e){e=t.create(e);var l=e.pick,c=a&&a.pick==l,u=n&&n.pick==l,d=o&&t.disabled(e),h=s.trigger(t.formats.toString,t,[i.format,e]);return[s.trigger(t.formats.toString,t,[s.trigger(i.formatLabel,t,[e])||i.format,e]),function(e){return c&&e.push(i.klass.selected),u&&e.push(i.klass.highlighted),r&&r.pick==l&&e.push(i.klass.viewset),d&&e.push(i.klass.disabled),e.join(" ")}([i.klass.listItem]),"data-pick="+e.pick+" "+s.ariaAttr({role:"option",label:h,selected:c&&t.$node.val()===h?!0:null,activedescendant:u?!0:null,disabled:d?!0:null})]}})+s.node("li",s.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+s.ariaAttr({controls:t.$node[0].id})),"",s.ariaAttr({role:"presentation"})),i.klass.list,s.ariaAttr({role:"listbox",controls:t.$node[0].id}))},i.defaults=function(e){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:e+" "+e+"--time",holder:e+"__holder",list:e+"__list",listItem:e+"__list-item",disabled:e+"__list-item--disabled",selected:e+"__list-item--selected",highlighted:e+"__list-item--highlighted",viewset:e+"__list-item--viewset",now:e+"__list-item--now",buttonClear:e+"__button--clear"}}}(e.klasses().picker),e.extend("pickatime",i)}),[].map||(Array.prototype.map=function(e,t){for(var i=this,a=i.length,n=new Array(a),r=0;a>r;r++)r in i&&(n[r]=e.call(t,i[r],r,i));return n}),[].filter||(Array.prototype.filter=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var a=[],n=arguments[1],r=0;i>r;r++)if(r in t){var o=t[r];e.call(n,o,r,t)&&a.push(o)}return a}),[].indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if(0===i)return-1;var a=0;if(arguments.length>1&&(a=Number(arguments[1]),a!=a?a=0:0!==a&&a!=1/0&&a!=-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a)))),a>=i)return-1;for(var n=a>=0?a:Math.max(i-Math.abs(a),0);i>n;n++)if(n in t&&t[n]===e)return n;return-1});var nativeSplit=String.prototype.split,compliantExecNpcg=void 0===/()??/.exec("")[1];String.prototype.split=function(e,t){var i=this;if("[object RegExp]"!==Object.prototype.toString.call(e))return nativeSplit.call(i,e,t);var a,n,r,o,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),c=0;for(e=new RegExp(e.source,l+"g"),i+="",compliantExecNpcg||(a=new RegExp("^"+e.source+"$(?!\\s)",l)),t=void 0===t?-1>>>0:t>>>0;(n=e.exec(i))&&(r=n.index+n[0].length,!(r>c&&(s.push(i.slice(c,n.index)),!compliantExecNpcg&&n.length>1&&n[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(n[e]=void 0)}),n.length>1&&n.index<i.length&&Array.prototype.push.apply(s,n.slice(1)),o=n[0].length,c=r,s.length>=t)));)e.lastIndex===n.index&&e.lastIndex++;return c===i.length?(o||!e.test(""))&&s.push(""):s.push(i.slice(c)),s.length>t?s.slice(0,t):s},function(e){"use strict";var t={init:function(i){return this.each(function(){this.self=e(this),t.destroy.call(this.self),this.opt=e.extend(!0,{},e.fn.raty.defaults,i),t._adjustCallback.call(this),t._adjustNumber.call(this),"img"!==this.opt.starType&&t._adjustStarType.call(this),t._adjustPath.call(this),t._createStars.call(this),this.opt.cancel&&t._createCancel.call(this),this.opt.precision&&t._adjustPrecision.call(this),t._createScore.call(this),t._apply.call(this,this.opt.score),t._target.call(this,this.opt.score),this.opt.readOnly?t._lock.call(this):(this.style.cursor="pointer",t._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var e=["number","readOnly","score","scoreName","target"],t=0;t<e.length;t++)"function"==typeof this.opt[e[t]]&&(this.opt[e[t]]=this.opt[e[t]].call(this))},_adjustNumber:function(){this.opt.number=t._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var e=["cancelOff","cancelOn","starHalf","starOff","starOn"],t=0;t<e.length;t++)this.opt[e[t]]=this.opt[e[t]].replace(".","-")},_apply:function(e){t._fill.call(this,e),e&&(e>0&&this.score.val(t._between(e,0,this.opt.number)),t._roundStars.call(this,e))},_between:function(e,t,i){return Math.min(Math.max(parseFloat(e),t),i)},_binds:function(){this.cancel&&(t._bindOverCancel.call(this),t._bindClickCancel.call(this),t._bindOutCancel.call(this)),t._bindOver.call(this),t._bindClick.call(this),t._bindOut.call(this)},_bindClick:function(){var t=this;t.stars.on("click.raty",function(i){var a=e(this);t.score.val(t.opt.half||t.opt.precision?t.self.data("score"):this.alt||a.data("alt")),t.opt.click&&t.opt.click.call(t,+t.score.val(),i)})},_bindClickCancel:function(){var e=this;e.cancel.on("click.raty",function(t){e.score.removeAttr("value"),e.opt.click&&e.opt.click.call(e,null,t)})},_bindOut:function(){var e=this;e.self.on("mouseleave.raty",function(i){var a=+e.score.val()||void 0;t._apply.call(e,a),t._target.call(e,a,i),e.opt.mouseout&&e.opt.mouseout.call(e,a,i)})},_bindOutCancel:function(){var e=this;e.cancel.on("mouseleave.raty",function(i){var a=e.opt.cancelOff;if("img"!==e.opt.starType&&(a=e.opt.cancelClass+" "+a),t._setIcon.call(e,this,a),e.opt.mouseout){var n=+e.score.val()||void 0;e.opt.mouseout.call(e,n,i)}})},_bindOver:function(){var e=this,i=e.opt.half?"mousemove.raty":"mouseover.raty";e.stars.on(i,function(i){var a=t._getScoreByPosition.call(e,i,this);t._fill.call(e,a),e.opt.half&&(t._roundStars.call(e,a),e.self.data("score",a)),t._target.call(e,a,i),e.opt.mouseover&&e.opt.mouseover.call(e,a,i)})},_bindOverCancel:function(){var e=this;e.cancel.on("mouseover.raty",function(i){var a=e.opt.path+e.opt.starOff,n=e.opt.cancelOn;"img"===e.opt.starType?e.stars.attr("src",a):(n=e.opt.cancelClass+" "+n,e.stars.attr("class",a)),t._setIcon.call(e,this,n),t._target.call(e,null,i),e.opt.mouseover&&e.opt.mouseover.call(e,null)})},_buildScoreField:function(){return e("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,i=e("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":this.opt.cancelClass});"img"===this.opt.starType?i.attr({src:t,alt:"x"}):i.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(i):this.self.append(" ").append(i),this.cancel=i},_createScore:function(){var i=e(this.opt.targetScore);this.score=i.length?i:t._buildScoreField.call(this)},_createStars:function(){for(var i=1;i<=this.opt.number;i++){var a=t._nameForIndex.call(this,i),n={alt:i,src:this.opt.path+this.opt[a]};"img"!==this.opt.starType&&(n={"data-alt":i,"class":n.src}),n.title=t._getHint.call(this,i),e("<"+this.opt.starType+" />",n).appendTo(this),this.opt.space&&this.self.append(i<this.opt.number?" ":"")}this.stars=this.self.children(this.opt.starType)},_error:function(t){e(this).text(t),e.error(t)},_fill:function(e){for(var i=0,a=1;a<=this.stars.length;a++){var n,r=this.stars[a-1],o=t._turnOn.call(this,a,e);if(this.opt.iconRange&&this.opt.iconRange.length>i){var s=this.opt.iconRange[i];n=t._getRangeIcon.call(this,s,o),a<=s.range&&t._setIcon.call(this,r,n),a===s.range&&i++}else n=this.opt[o?"starOn":"starOff"],t._setIcon.call(this,r,n)}},_getRangeIcon:function(e,t){return t?e.on||this.opt.starOn:e.off||this.opt.starOff},_getScoreByPosition:function(i,a){var n=parseInt(a.alt||a.getAttribute("data-alt"),10);if(this.opt.half){var r=t._getSize.call(this),o=parseFloat((i.pageX-e(a).offset().left)/r);n=this.opt.precision?n-1+o:n-1+(o>.5?1:.5)}return n},_getSize:function(){var e;return e="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),e||t._error.call(this,"Could not be possible get the icon size!"),e},_turnOn:function(e,t){return this.opt.single?e===t:t>=e},_getHint:function(e){var t=this.opt.hints[e-1];return""===t?"":t||e},_lock:function(){var e=parseInt(this.score.val(),10),i=e?t._getHint.call(this,e):this.opt.noRatedMsg;this.style.cursor="",this.title=i,this.score.prop("readonly",!0),this.stars.prop("title",i),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_nameForIndex:function(e){return this.opt.score&&this.opt.score>=e?"starOn":"starOff"},_roundStars:function(e){var i=(e%1).toFixed(2);if(i>this.opt.round.down){var a="starOn";this.opt.halfShow&&i<this.opt.round.up?a="starHalf":i<this.opt.round.full&&(a="starOff");var n=this.opt[a],r=this.stars[Math.ceil(e)-1];t._setIcon.call(this,r,n)}},_setIcon:function(e,t){e["img"===this.opt.starType?"src":"className"]=this.opt.path+t},_setTarget:function(e,t){t&&(t=this.opt.targetFormat.toString().replace("{score}",t)),e.is(":input")?e.val(t):e.html(t)},_target:function(i,a){if(this.opt.target){var n=e(this.opt.target);n.length||t._error.call(this,"Target selector invalid or missing!");var r=a&&"mouseover"===a.type;if(void 0===i)i=this.opt.targetText;else if(null===i)i=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?i=t._getHint.call(this,Math.ceil(i)):this.opt.precision&&(i=parseFloat(i).toFixed(1));var o=a&&"mousemove"===a.type;r||o||this.opt.targetKeep||(i=this.opt.targetText)}t._setTarget.call(this,n,i)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var e=0;e<this.opt.number;e++)this.stars[e].title=t._getHint.call(this,e+1);this.cancel&&this.cancel.css("display","")},cancel:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==!0&&(t[i?"click":"score"].call(a,null),this.score.removeAttr("value"))})},click:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),this.opt.click&&this.opt.click.call(this,i,e.Event("click")),t._target.call(this,i))})},destroy:function(){return this.each(function(){var t=e(this),i=t.data("raw");i?t.off(".raty").empty().css({cursor:i.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var e,t=[];return this.each(function(){e=this.score.val(),t.push(e?+e:void 0)}),t.length>1?t:t[0]},move:function(i){return this.each(function(){var a=parseInt(i,10),n=e(this).data("options"),r=(+i).toFixed(1).split(".")[1];a>=n.number&&(a=n.number-1,r=10);var o=t._getSize.call(this),s=o/10,l=e(this.stars[a]),c=l.offset().left+s*parseInt(r,10),u=e.Event("mousemove",{pageX:c});l.trigger(u)})},readOnly:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==i&&(i?(a.off(".raty").children("img").off(".raty"),t._lock.call(this)):(t._binds.call(this),t._unlock.call(this)),a.data("readonly",i))})},reload:function(){return t.set.call(this,{})},score:function(){var i=e(this);return arguments.length?t.setScore.apply(i,arguments):t.getScore.call(i)},set:function(t){return this.each(function(){var i=e(this),a=i.data("options"),n=e.extend({},a,t);i.raty(n)})},setScore:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),t._target.call(this,i))})}};e.fn.raty=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void e.error("Method "+i+" does not exist!"):t.init.apply(this,arguments)},e.fn.raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),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(e){"use strict";function t(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function i(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}var a=e.scrollTo=function(t,i,a){return e(window).scrollTo(t,i,a)};return a.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(n,r,o){"object"==typeof r&&(o=r,r=0),"function"==typeof o&&(o={onAfter:o}),"max"===n&&(n=9e9),o=e.extend({},a.defaults,o),r=r||o.duration;var s=o.queue&&o.axis.length>1;return s&&(r/=2),o.offset=i(o.offset),o.over=i(o.over),this.each(function(){function l(t){var i=e.extend({},o,{queue:!0,duration:r,complete:t&&function(){t.call(d,p,o)}});h.animate(f,i)}if(null!==n){var c,u=t(this),d=u?this.contentWindow||window:this,h=e(d),p=n,f={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(p)){p=i(p);break}if(p=u?e(p):e(p,d),!p.length)return;case"object":(p.is||p.style)&&(c=(p=e(p)).offset())}var m=e.isFunction(o.offset)&&o.offset(d,p)||o.offset;e.each(o.axis.split(""),function(e,t){var i="x"===t?"Left":"Top",n=i.toLowerCase(),r="scroll"+i,g=h[r](),v=a.max(d,t);if(c)f[r]=c[n]+(u?0:g-h.offset()[n]),o.margin&&(f[r]-=parseInt(p.css("margin"+i),10)||0,f[r]-=parseInt(p.css("border"+i+"Width"),10)||0),f[r]+=m[n]||0,o.over[n]&&(f[r]+=p["x"===t?"width":"height"]()*o.over[n]);else{var y=p[n];f[r]=y.slice&&"%"===y.slice(-1)?parseFloat(y)/100*v:y}o.limit&&/^\d+$/.test(f[r])&&(f[r]=f[r]<=0?0:Math.min(f[r],v)),!e&&o.axis.length>1&&(g===f[r]?f={}:s&&(l(o.onAfterFirst),f={}))}),l(o.onAfter)}})},a.max=function(i,a){var n="x"===a?"Width":"Height",r="scroll"+n;if(!t(i))return i[r]-e(i)[n.toLowerCase()]();var o="client"+n,s=i.ownerDocument||i.document,l=s.documentElement,c=s.body;return Math.max(l[r],c[r])-Math.min(l[o],c[o])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var i=this.get(t);if(t.options.interrupt&&t._last&&t._last!==i)return e(t.elem).stop();var a=Math.round(t.now);i!==a&&(e(t.elem)[t.prop](a),t._last=this.get(t))}},a}),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=l.call(arguments,1),c=0,d=0,h=0,p=0,f=0,m=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(h=-1*o.detail),"wheelDelta"in o&&(h=o.wheelDelta),"wheelDeltaY"in o&&(h=o.wheelDeltaY),"wheelDeltaX"in o&&(d=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(d=-1*h,h=0),c=0===h?d:h,"deltaY"in o&&(h=-1*o.deltaY,c=h),"deltaX"in o&&(d=o.deltaX,0===h&&(c=-1*d)),0!==h||0!==d){if(1===o.deltaMode){var g=e.data(this,"mousewheel-line-height");c*=g,h*=g,d*=g}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");c*=v,h*=v,d*=v}if(p=Math.max(Math.abs(h),Math.abs(d)),(!r||r>p)&&(r=p,a(o,p)&&(r/=40)),a(o,p)&&(c/=40,d/=40,h/=40),c=Math[c>=1?"floor":"ceil"](c/r),d=Math[d>=1?"floor":"ceil"](d/r),h=Math[h>=1?"floor":"ceil"](h/r),u.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();f=t.clientX-y.left,m=t.clientY-y.top}return t.deltaX=d,t.deltaY=h,t.deltaFactor=r,t.offsetX=f,t.offsetY=m,t.deltaMode=0,s.unshift(t,c,d,h),n&&clearTimeout(n),n=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){r=null}function a(e,t){return u.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var n,r,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var c=o.length;c;)e.event.fixHooks[o[--c]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=s.length;i;)this.removeEventListener(s[--i],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),a=i["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e){"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var i="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",r="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";i||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+r+"%3E%3C/script%3E"))),t()}(function(){var t,i="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",r={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:!0},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},o=0,s={},l=window.attachEvent&&!window.addEventListener?1:0,c=!1,u=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],d={init:function(t){var t=e.extend(!0,{},r,t),i=h.call(this);if(t.live){var l=t.liveSelector||this.selector||n,c=e(l);if("off"===t.live)return void f(l);s[l]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&f(l)},500)}else f(l);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":m(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),p(t),e(i).each(function(){var i=e(this);if(!i.data(a)){i.data(a,{idx:++o,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:i.css("direction"),cbOffsets:null,trigger:null});var n=i.data(a),r=n.opt,s=i.data("mcs-axis"),l=i.data("mcs-scrollbar-position"),c=i.data("mcs-theme");s&&(r.axis=s),l&&(r.scrollbarPosition=l),c&&(r.theme=c,p(r)),v.call(this),e("#mCSB_"+n.idx+"_container img:not(."+u[2]+")").addClass(u[2]),d.update.call(null,i)}})},update:function(t,i){var n=t||h.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!o.length)return;n.tweenRunning&&Y(t),t.hasClass(u[3])&&t.removeClass(u[3]),t.hasClass(u[4])&&t.removeClass(u[4]),x.call(this),b.call(this),"y"===r.axis||r.advanced.autoExpandHorizontalScroll||o.css("width",y(o.children())),n.overflowed=j.call(this),D.call(this),r.autoDraggerLength&&_.call(this),C.call(this),Q.call(this);var l=[Math.abs(o[0].offsetTop),Math.abs(o[0].offsetLeft)];"x"!==r.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?k.call(this):(X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(k.call(this),"y"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[1]&&X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==r.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?k.call(this):(X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(k.call(this),"x"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[0]&&X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),i&&n&&(2===i&&r.callbacks.onImageLoad&&"function"==typeof r.callbacks.onImageLoad?r.callbacks.onImageLoad.call(this):3===i&&r.callbacks.onSelectorChange&&"function"==typeof r.callbacks.onSelectorChange?r.callbacks.onSelectorChange.call(this):r.callbacks.onUpdate&&"function"==typeof r.callbacks.onUpdate&&r.callbacks.onUpdate.call(this)),U.call(this)}})},scrollTo:function(t,i){if("undefined"!=typeof t&&null!=t){var n=h.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},l=e.extend(!0,{},s,i),c=z.call(this,t),u=l.scrollInertia>0&&l.scrollInertia<17?17:l.scrollInertia;c[0]=N.call(this,c[0],"y"),c[1]=N.call(this,c[1],"x"),l.moveDragger&&(c[0]*=r.scrollRatio.y,c[1]*=r.scrollRatio.x),l.dur=u,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==o.axis&&r.overflowed[0]&&(l.dir="y",l.overwrite="all",X(n,c[0].toString(),l)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==o.axis&&r.overflowed[1]&&(l.dir="x",l.overwrite="none",X(n,c[1].toString(),l))},l.timeout)}})}},stop:function(){var t=h.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Y(t)})},disable:function(t){var i=h.call(this);return e(i).each(function(){var i=e(this);i.data(a)&&(i.data(a),U.call(this,"remove"),T.call(this),t&&k.call(this),D.call(this,!0),i.addClass(u[3]))})},destroy:function(){var t=h.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx),l=e("#mCSB_"+r.idx+"_container"),c=e(".mCSB_"+r.idx+"_scrollbar");o.live&&f(o.liveSelector||e(t).selector),U.call(this,"remove"),T.call(this),k.call(this),n.removeData(a),Z(this,"mcs"),c.remove(),l.find("img."+u[2]).removeClass(u[2]),s.replaceWith(l.contents()),n.removeClass(i+" _"+a+"_"+r.idx+" "+u[6]+" "+u[7]+" "+u[5]+" "+u[3]).addClass(u[4])}})}},h=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},p=function(t){var i=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],r=["minimal","minimal-dark"],o=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,i)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,r)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,o)>-1?"outside":t.scrollbarPosition},f=function(e){s[e]&&(clearTimeout(s[e]),Z(s,e))},m=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),r=n.opt,o=r.autoExpandScrollbar?" "+u[1]+"_expand":"",s=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_vertical"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_horizontal"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],l="yx"===r.axis?"mCSB_vertical_horizontal":"x"===r.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===r.axis?s[0]+s[1]:"x"===r.axis?s[1]:s[0],d="yx"===r.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",h=r.autoHideScrollbar?" "+u[6]:"",p="x"!==r.axis&&"rtl"===n.langDir?" "+u[7]:"";r.setWidth&&t.css("width",r.setWidth),r.setHeight&&t.css("height",r.setHeight),r.setLeft="y"!==r.axis&&"rtl"===n.langDir?"989999px":r.setLeft,t.addClass(i+" _"+a+"_"+n.idx+h+p).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+r.theme+" "+l+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+r.setTop+"; left:"+r.setLeft+";' dir="+n.langDir+" /></div>");
|
6 |
var f=e("#mCSB_"+n.idx),m=e("#mCSB_"+n.idx+"_container");"y"===r.axis||r.advanced.autoExpandHorizontalScroll||m.css("width",y(m.children())),"outside"===r.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),f.addClass("mCSB_outside").after(c)):(f.addClass("mCSB_inside").append(c),m.wrap(d)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},y=function(t){return Math.max.apply(Math,t.map(function(){return e(this).outerWidth(!0)}).get())},b=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx+"_container");n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(r[0].getBoundingClientRect().right+.4)-Math.floor(r[0].getBoundingClientRect().left),position:"relative"}).unwrap()},w=function(){var t=e(this),i=t.data(a),n=i.opt,r=e(".mCSB_"+i.idx+"_scrollbar:first"),o=te(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",s=["<a href='#' class='"+u[13]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[14]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[15]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[16]+"' oncontextmenu='return false;' "+o+" />"],l=["x"===n.axis?s[2]:s[0],"x"===n.axis?s[3]:s[1],s[2],s[3]];n.scrollButtons.enable&&r.prepend(l[0]).append(l[1]).next(".mCSB_scrollTools").prepend(l[2]).append(l[3])},x=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=t.css("max-height")||"none",o=-1!==r.indexOf("%"),s=t.css("box-sizing");if("none"!==r){var l=o?t.parent().height()*parseInt(r)/100:parseInt(r);"border-box"===s&&(l-=t.innerHeight()-t.height()+(t.outerHeight()-t.innerHeight())),n.css("max-height",Math.round(l))}},_=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[n.height()/r.outerHeight(!1),n.width()/r.outerWidth(!1)],c=[parseInt(o[0].css("min-height")),Math.round(s[0]*o[0].parent().height()),parseInt(o[1].css("min-width")),Math.round(s[1]*o[1].parent().width())],u=l&&c[1]<c[0]?c[0]:c[1],d=l&&c[3]<c[2]?c[2]:c[3];o[0].css({height:u,"max-height":o[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),o[1].css({width:d,"max-width":o[1].parent().width()-10})},C=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[r.outerHeight(!1)-n.height(),r.outerWidth(!1)-n.width()],l=[s[0]/(o[0].parent().height()-o[0].height()),s[1]/(o[1].parent().width()-o[1].width())];i.scrollRatio={y:l[0],x:l[1]}},S=function(e,t,i){var a=i?u[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(u[0]+" "+a),n.toggleClass(u[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(u[0]),n.removeClass(u[1])):(e.addClass(u[0]),n.addClass(u[1])))},j=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=null==i.overflowed?r.height():r.outerHeight(!1),s=null==i.overflowed?r.width():r.outerWidth(!1);return[o>n.height(),s>n.width()]},k=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx),o=e("#mCSB_"+i.idx+"_container"),s=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")];if(Y(t),("x"!==n.axis&&!i.overflowed[0]||"y"===n.axis&&i.overflowed[0])&&(s[0].add(o).css("top",0),X(t,"_resetY")),"y"!==n.axis&&!i.overflowed[1]||"x"===n.axis&&i.overflowed[1]){var l=dx=0;"rtl"===i.langDir&&(l=r.width()-o.outerWidth(!1),dx=Math.abs(l/i.scrollRatio.x)),o.css("left",l),s[1].css("left",dx),X(t,"_resetX")}},Q=function(){function t(){o=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(o),A.call(i[0])):t()},100)}var i=e(this),n=i.data(a),r=n.opt;if(!n.bindEvents){if(E.call(this),r.contentTouchScroll&&I.call(this),M.call(this),r.mouseWheel.enable){var o;t()}H.call(this),L.call(this),r.advanced.autoScrollOnFocus&&F.call(this),r.scrollButtons.enable&&B.call(this),r.keyboard.enable&&W.call(this),n.bindEvents=!0}},T=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=".mCSB_"+i.idx+"_scrollbar",s=e("#mCSB_"+i.idx+",#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,"+o+" ."+u[12]+",#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal,"+o+">a"),l=e("#mCSB_"+i.idx+"_container");n.advanced.releaseDraggableSelectors&&s.add(e(n.advanced.releaseDraggableSelectors)),i.bindEvents&&(e(document).unbind("."+r),s.each(function(){e(this).unbind("."+r)}),clearTimeout(t[0]._focusTimeout),Z(t[0],"_focusTimeout"),clearTimeout(i.sequential.step),Z(i.sequential,"step"),clearTimeout(l[0].onCompleteTimeout),Z(l[0],"onCompleteTimeout"),i.bindEvents=!1)},D=function(t){var i=e(this),n=i.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container_wrapper"),s=o.length?o:e("#mCSB_"+n.idx+"_container"),l=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[l[0].find(".mCSB_dragger"),l[1].find(".mCSB_dragger")];"x"!==r.axis&&(n.overflowed[0]&&!t?(l[0].add(c[0]).add(l[0].children("a")).css("display","block"),s.removeClass(u[8]+" "+u[10])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[0].css("display","none"),s.removeClass(u[10])):(l[0].css("display","none"),s.addClass(u[10])),s.addClass(u[8]))),"y"!==r.axis&&(n.overflowed[1]&&!t?(l[1].add(c[1]).add(l[1].children("a")).css("display","block"),s.removeClass(u[9]+" "+u[11])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[1].css("display","none"),s.removeClass(u[11])):(l[1].css("display","none"),s.addClass(u[11])),s.addClass(u[9]))),n.overflowed[0]||n.overflowed[1]?i.removeClass(u[5]):i.addClass(u[5])},O=function(e){var t=e.type;switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return e.target.ownerDocument!==document?[e.originalEvent.screenY,e.originalEvent.screenX,!1]:[e.originalEvent.pageY,e.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[i.screenY,i.screenX,a>1]:[i.pageY,i.pageX,a>1];default:return[e.pageY,e.pageX,!1]}},E=function(){function t(e){var t=f.find("iframe");if(t.length){var i=e?"auto":"none";t.css("pointer-events",i)}}function i(e,t,i,a){if(f[0].idleTimer=d.scrollInertia<233?250:0,n.attr("id")===p[1])var r="x",o=(n[0].offsetLeft-t+a)*u.scrollRatio.x;else var r="y",o=(n[0].offsetTop-e+i)*u.scrollRatio.y;X(s,o.toString(),{dir:r,drag:!0})}var n,r,o,s=e(this),u=s.data(a),d=u.opt,h=a+"_"+u.idx,p=["mCSB_"+u.idx+"_dragger_vertical","mCSB_"+u.idx+"_dragger_horizontal"],f=e("#mCSB_"+u.idx+"_container"),m=e("#"+p[0]+",#"+p[1]),g=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m;m.bind("mousedown."+h+" touchstart."+h+" pointerdown."+h+" MSPointerDown."+h,function(i){if(i.stopImmediatePropagation(),i.preventDefault(),J(i)){c=!0,l&&(document.onselectstart=function(){return!1}),t(!1),Y(s),n=e(this);var a=n.offset(),u=O(i)[0]-a.top,h=O(i)[1]-a.left,p=n.height()+a.top,f=n.width()+a.left;p>u&&u>0&&f>h&&h>0&&(r=u,o=h),S(n,"active",d.autoExpandScrollbar)}}).bind("touchmove."+h,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;i(r,o,a,s)}),e(document).bind("mousemove."+h+" pointermove."+h+" MSPointerMove."+h,function(e){if(n){var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;if(r===a)return;i(r,o,a,s)}}).add(g).bind("mouseup."+h+" touchend."+h+" pointerup."+h+" MSPointerUp."+h,function(){n&&(S(n,"active",d.autoExpandScrollbar),n=null),c=!1,l&&(document.onselectstart=null),t(!0)})},I=function(){function i(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,x=0,_=0;var i=T.offset();u=O(e)[0]-i.top,d=O(e)[1]-i.left,R=[O(e)[0],O(e)[1]]}function n(e){if(ee(e)&&!c&&!O(e)[2]&&(e.stopImmediatePropagation(),!_||x)){m=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(i),I.push(a),R[2]=Math.abs(O(e)[0]-R[0]),R[3]=Math.abs(O(e)[1]-R[1]),S.overflowed[0])var r=D[0].parent().height()-D[0].height(),o=u-i>0&&i-u>-(r*S.scrollRatio.y)&&(2*R[3]<R[2]||"yx"===j.axis);if(S.overflowed[1])var s=D[1].parent().width()-D[1].width(),h=d-a>0&&a-d>-(s*S.scrollRatio.x)&&(2*R[2]<R[3]||"yx"===j.axis);o||h?(e.preventDefault(),x=1):_=1,b="yx"===j.axis?[u-i,d-a]:"x"===j.axis?[null,d-a]:[u-i,null],T[0].idleTimer=250,S.overflowed[0]&&l(b[0],M,n,"y","all",!0),S.overflowed[1]&&l(b[1],M,n,"x",A,!0)}}function r(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Y(C),f=G();var i=Q.offset();h=O(e)[0]-i.top,p=O(e)[1]-i.left,E=[],I=[]}function o(e){if(ee(e)&&!c&&!O(e)[2]){e.stopImmediatePropagation(),x=0,_=0,g=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(g-m>30)){y=1e3/(g-f);var n="mcsEaseOut",r=2.5>y,o=r?[E[E.length-2],I[I.length-2]]:[0,0];v=r?[i-o[0],a-o[1]]:[i-h,a-p];var u=[Math.abs(v[0]),Math.abs(v[1])];y=r?[Math.abs(v[0]/4),Math.abs(v[1]/4)]:[y,y];var d=[Math.abs(T[0].offsetTop)-v[0]*s(u[0]/y[0],y[0]),Math.abs(T[0].offsetLeft)-v[1]*s(u[1]/y[1],y[1])];b="yx"===j.axis?[d[0],d[1]]:"x"===j.axis?[null,d[1]]:[d[0],null],w=[4*u[0]+j.scrollInertia,4*u[1]+j.scrollInertia];var C=parseInt(j.contentTouchScroll)||0;b[0]=u[0]>C?b[0]:0,b[1]=u[1]>C?b[1]:0,S.overflowed[0]&&l(b[0],w[0],n,"y",A,!1),S.overflowed[1]&&l(b[1],w[1],n,"x",A,!1)}}}function s(e,t){var i=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?i[0]:i[3]:e>60?t>3?i[3]:i[2]:e>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function l(e,t,i,a,n,r){e&&X(C,e.toString(),{dur:t,scrollEasing:i,dir:a,overwrite:n,drag:r})}var u,d,h,p,f,m,g,v,y,b,w,x,_,C=e(this),S=C.data(a),j=S.opt,k=a+"_"+S.idx,Q=e("#mCSB_"+S.idx),T=e("#mCSB_"+S.idx+"_container"),D=[e("#mCSB_"+S.idx+"_dragger_vertical"),e("#mCSB_"+S.idx+"_dragger_horizontal")],E=[],I=[],M=0,A="yx"===j.axis?"none":"all",R=[],H=T.find("iframe"),F=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k];T.bind(F[0],function(e){i(e)}).bind(F[1],function(e){n(e)}),Q.bind(F[0],function(e){r(e)}).bind(F[2],function(e){o(e)}),H.length&&H.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(F[0],function(e){i(e),r(e)}).bind(F[1],function(e){n(e)}).bind(F[2],function(e){o(e)})})})},M=function(){function i(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,i){u.type=i&&r?"stepped":"stepless",u.scrollAmount=10,$(o,e,t,"mcsLinearOut",i?60:null)}var r,o=e(this),s=o.data(a),l=s.opt,u=s.sequential,d=a+"_"+s.idx,h=e("#mCSB_"+s.idx+"_container"),p=h.parent();h.bind("mousedown."+d,function(){t||r||(r=1,c=!0)}).add(document).bind("mousemove."+d,function(e){if(!t&&r&&i()){var a=h.offset(),o=O(e)[0]-a.top+h[0].offsetTop,c=O(e)[1]-a.left+h[0].offsetLeft;o>0&&o<p.height()&&c>0&&c<p.width()?u.step&&n("off",null,"stepped"):("x"!==l.axis&&s.overflowed[0]&&(0>o?n("on",38):o>p.height()&&n("on",40)),"y"!==l.axis&&s.overflowed[1]&&(0>c?n("on",37):c>p.width()&&n("on",39)))}}).bind("mouseup."+d,function(){t||(r&&(r=0,n("off",null)),c=!1)})},A=function(){function t(t,a){if(Y(i),!R(i,t.target)){var o="auto"!==r.mouseWheel.deltaFactor?parseInt(r.mouseWheel.deltaFactor):l&&t.deltaFactor<100?100:t.deltaFactor||100;if("x"===r.axis||"x"===r.mouseWheel.axis)var u="x",d=[Math.round(o*n.scrollRatio.x),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.width()?.9*s.width():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),f=c[1][0].offsetLeft,m=c[1].parent().width()-c[1].width(),g=t.deltaX||t.deltaY||a;else var u="y",d=[Math.round(o*n.scrollRatio.y),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.height()?.9*s.height():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),f=c[0][0].offsetTop,m=c[0].parent().height()-c[0].height(),g=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||(r.mouseWheel.invert&&(g=-g),r.mouseWheel.normalizeDelta&&(g=0>g?-1:1),(g>0&&0!==f||0>g&&f!==m||r.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),X(i,(p-g*h).toString(),{dir:u}))}}var i=e(this),n=i.data(a),r=n.opt,o=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],u=e("#mCSB_"+n.idx+"_container").find("iframe");n&&(u.length&&u.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+o,function(e,i){t(e,i)})})}),s.bind("mousewheel."+o,function(e,i){t(e,i)}))},P=function(e){var t=null;try{var i=e.contentDocument||e.contentWindow.document;t=i.body.innerHTML}catch(a){}return null!==t},R=function(t,i){var n=i.nodeName.toLowerCase(),r=t.data(a).opt.mouseWheel.disableOver,o=["select","textarea"];return e.inArray(n,r)>-1&&!(e.inArray(n,o)>-1&&!e(i).is(":focus"))},H=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container"),o=r.parent(),s=e(".mCSB_"+i.idx+"_scrollbar ."+u[12]);s.bind("touchstart."+n+" pointerdown."+n+" MSPointerDown."+n,function(){c=!0}).bind("touchend."+n+" pointerup."+n+" MSPointerUp."+n,function(){c=!1}).bind("click."+n,function(a){if(e(a.target).hasClass(u[12])||e(a.target).hasClass("mCSB_draggerRail")){Y(t);var n=e(this),s=n.find(".mCSB_dragger");if(n.parent(".mCSB_scrollTools_horizontal").length>0){if(!i.overflowed[1])return;var l="x",c=a.pageX>s.offset().left?-1:1,d=Math.abs(r[0].offsetLeft)-.9*c*o.width()}else{if(!i.overflowed[0])return;var l="y",c=a.pageY>s.offset().top?-1:1,d=Math.abs(r[0].offsetTop)-.9*c*o.height()}X(t,d.toString(),{dir:l,scrollEasing:"mcsEaseInOut"})}})},F=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=e("#mCSB_"+i.idx+"_container"),s=o.parent();o.bind("focusin."+r,function(){var i=e(document.activeElement),a=o.find(".mCustomScrollBox").length,r=0;i.is(n.advanced.autoScrollOnFocus)&&(Y(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(r+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ie(i)[0],ie(i)[1]],a=[o[0].offsetTop,o[0].offsetLeft],l=[a[0]+e[0]>=0&&a[0]+e[0]<s.height()-i.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<s.width()-i.outerWidth(!1)],c="yx"!==n.axis||l[0]||l[1]?"all":"none";"x"===n.axis||l[0]||X(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r}),"y"===n.axis||l[1]||X(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r})},t[0]._focusTimer))})},L=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container").parent();r.bind("scroll."+n,function(){(0!==r.scrollTop()||0!==r.scrollLeft())&&e(".mCSB_"+i.idx+"_scrollbar").css("visibility","hidden")})},B=function(){var t=e(this),i=t.data(a),n=i.opt,r=i.sequential,o=a+"_"+i.idx,s=".mCSB_"+i.idx+"_scrollbar",l=e(s+">a");l.bind("mousedown."+o+" touchstart."+o+" pointerdown."+o+" MSPointerDown."+o+" mouseup."+o+" touchend."+o+" pointerup."+o+" MSPointerUp."+o+" mouseout."+o+" pointerout."+o+" MSPointerOut."+o+" click."+o,function(a){function o(e,i){r.scrollAmount=n.snapAmount||n.scrollButtons.scrollAmount,$(t,e,i)}if(a.preventDefault(),J(a)){var s=e(this).attr("class");switch(r.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;c=!0,i.tweenRunning=!1,o("on",s);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;c=!1,r.dir&&o("off",s);break;case"click":if("stepped"!==r.type||i.tweenRunning)return;o("on",s)}}})},W=function(){function t(t){function a(e,t){o.type=r.keyboard.scrollType,o.scrollAmount=r.snapAmount||r.keyboard.scrollAmount,"stepped"===o.type&&n.tweenRunning||$(i,e,t)}switch(t.type){case"blur":n.tweenRunning&&o.dir&&a("off",null);break;case"keydown":case"keyup":var s=t.keyCode?t.keyCode:t.which,l="on";if("x"!==r.axis&&(38===s||40===s)||"y"!==r.axis&&(37===s||39===s)){if((38===s||40===s)&&!n.overflowed[0]||(37===s||39===s)&&!n.overflowed[1])return;"keyup"===t.type&&(l="off"),e(document.activeElement).is(d)||(t.preventDefault(),t.stopImmediatePropagation(),a(l,s))}else if(33===s||34===s){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Y(i);var h=34===s?-1:1;if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=Math.abs(c[0].offsetLeft)-.9*h*u.width();else var p="y",f=Math.abs(c[0].offsetTop)-.9*h*u.height();X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}else if((35===s||36===s)&&!e(document.activeElement).is(d)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=35===s?Math.abs(u.width()-c.outerWidth(!1)):0;else var p="y",f=35===s?Math.abs(u.height()-c.outerHeight(!1)):0;X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}}var i=e(this),n=i.data(a),r=n.opt,o=n.sequential,s=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),u=c.parent(),d="input,textarea,select,datalist,keygen,[contenteditable='true']",h=c.find("iframe"),p=["blur."+s+" keydown."+s+" keyup."+s];h.length&&h.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(p[0],function(e){t(e)})})}),l.attr("tabindex","0").bind(p[0],function(e){t(e)})},$=function(t,i,n,r,o){function s(e){var i="stepped"!==h.type,a=o?o:e?i?m/1.5:g:1e3/60,n=e?i?7.5:40:2.5,l=[Math.abs(p[0].offsetTop),Math.abs(p[0].offsetLeft)],u=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],d="x"===h.dir[0]?l[1]+h.dir[1]*u[1]*n:l[0]+h.dir[1]*u[0]*n,f="x"===h.dir[0]?l[1]+h.dir[1]*parseInt(h.scrollAmount):l[0]+h.dir[1]*parseInt(h.scrollAmount),v="auto"!==h.scrollAmount?f:d,y=r?r:e?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",b=e?!0:!1;return e&&17>a&&(v="x"===h.dir[0]?l[1]:l[0]),X(t,v.toString(),{dir:h.dir[0],scrollEasing:y,dur:a,onComplete:b}),e?void(h.dir=!1):(clearTimeout(h.step),void(h.step=setTimeout(function(){s()},a)))}function l(){clearTimeout(h.step),Z(h,"step"),Y(t)}var c=t.data(a),d=c.opt,h=c.sequential,p=e("#mCSB_"+c.idx+"_container"),f="stepped"===h.type?!0:!1,m=d.scrollInertia<26?26:d.scrollInertia,g=d.scrollInertia<1?17:d.scrollInertia;switch(i){case"on":if(h.dir=[n===u[16]||n===u[15]||39===n||37===n?"x":"y",n===u[13]||n===u[15]||38===n||37===n?-1:1],Y(t),te(n)&&"stepped"===h.type)return;s(f);break;case"off":l(),(f||c.tweenRunning&&h.dir)&&s(!0)}},z=function(t){var i=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===i.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===i.axis?null:t,n[1]=t.x?t.x:t.y||"y"===i.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},N=function(t,i){if(null!=t&&"undefined"!=typeof t){var n=e(this),r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx+"_container"),l=s.parent(),c=typeof t;i||(i="x"===o.axis?"x":"y");var u="x"===i?s.outerWidth(!1):s.outerHeight(!1),h="x"===i?s[0].offsetLeft:s[0].offsetTop,p="x"===i?"left":"top";switch(c){case"function":return t();case"object":var f=t.jquery?t:e(t);if(!f.length)return;return"x"===i?ie(f)[1]:ie(f)[0];case"string":case"number":if(te(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(u*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(h-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var m=h+parseInt(t.split("+=")[1]);return m>=0?0:Math.abs(m)}if(-1!==t.indexOf("px")&&te(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(l.height()-s.outerHeight(!1));if("right"===t)return Math.abs(l.width()-s.outerWidth(!1));if("first"===t||"last"===t){var f=s.find(":"+t);return"x"===i?ie(f)[1]:ie(f)[0]}return e(t).length?"x"===i?ie(e(t))[1]:ie(e(t))[0]:(s.css(p,t),void d.update.call(null,n[0]))}}},U=function(t){function i(){clearTimeout(p[0].autoUpdate),p[0].autoUpdate=setTimeout(function(){return h.advanced.updateOnSelectorChange&&(f=o(),f!==w)?(s(3),void(w=f)):(h.advanced.updateOnContentResize&&(m=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],(m[0]!==x[0]||m[1]!==x[1]||m[2]!==x[2]||m[3]!==x[3]||m[4]!==x[4]||m[5]!==x[5])&&(s(m[0]!==x[0]||m[1]!==x[1]),x=m)),h.advanced.updateOnImageLoad&&(g=n(),g!==_&&(p.find("img").each(function(){r(this)}),_=g)),void((h.advanced.updateOnSelectorChange||h.advanced.updateOnContentResize||h.advanced.updateOnImageLoad)&&i()))},60)}function n(){var e=0;return h.advanced.updateOnImageLoad&&(e=p.find("img").length),e}function r(t){function i(e,t){return function(){return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(u[2]),s(2)}if(e(t).hasClass(u[2]))return void s();var n=new Image;n.onload=i(n,a),n.src=t.src}function o(){h.advanced.updateOnSelectorChange===!0&&(h.advanced.updateOnSelectorChange="*");var t=0,i=p.find(h.advanced.updateOnSelectorChange);return h.advanced.updateOnSelectorChange&&i.length>0&&i.each(function(){t+=e(this).height()+e(this).width()}),t}function s(e){clearTimeout(p[0].autoUpdate),d.update.call(null,l[0],e)}var l=e(this),c=l.data(a),h=c.opt,p=e("#mCSB_"+c.idx+"_container");if(t)return clearTimeout(p[0].autoUpdate),void Z(p[0],"autoUpdate");var f,m,g,v=p.parent(),y=[e("#mCSB_"+c.idx+"_scrollbar_vertical"),e("#mCSB_"+c.idx+"_scrollbar_horizontal")],b=function(){return[y[0].is(":visible")?y[0].outerHeight(!0):0,y[1].is(":visible")?y[1].outerWidth(!0):0]},w=o(),x=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],_=n();i()},q=function(e,t,i){return Math.round(e/t)*t-i},Y=function(t){var i=t.data(a),n=e("#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal");n.each(function(){K.call(this)})},X=function(t,i,n){function r(e){return l&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function o(){return[c.callbacks.alwaysTriggerOffsets||b>=w[0]+_,c.callbacks.alwaysTriggerOffsets||-C>=b]}function s(){var e=[p[0].offsetTop,p[0].offsetLeft],i=[v[0].offsetTop,v[0].offsetLeft],a=[p.outerHeight(!1),p.outerWidth(!1)],r=[h.height(),h.width()];t[0].mcs={content:p,top:e[0],left:e[1],draggerTop:i[0],draggerLeft:i[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-r[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-r[1])),direction:n.dir}}var l=t.data(a),c=l.opt,u={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(u,n),d=[n.dur,n.drag?0:n.dur],h=e("#mCSB_"+l.idx),p=e("#mCSB_"+l.idx+"_container"),f=p.parent(),m=c.callbacks.onTotalScrollOffset?z.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?z.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(l.trigger=n.trigger,(0!==f.scrollTop()||0!==f.scrollLeft())&&(e(".mCSB_"+l.idx+"_scrollbar").css("visibility","visible"),f.scrollTop(0).scrollLeft(0)),"_resetY"!==i||l.contentReset.y||(r("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),l.contentReset.y=1),"_resetX"!==i||l.contentReset.x||(r("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),l.contentReset.x=1),"_resetY"!==i&&"_resetX"!==i){switch(!l.contentReset.y&&t[0].mcs||!l.overflowed[0]||(r("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),l.contentReset.x=null),!l.contentReset.x&&t[0].mcs||!l.overflowed[1]||(r("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),l.contentReset.x=null),c.snapAmount&&(i=q(i,c.snapAmount,c.snapOffset)),n.dir){case"x":var v=e("#mCSB_"+l.idx+"_dragger_horizontal"),y="left",b=p[0].offsetLeft,w=[h.width()-p.outerWidth(!1),v.parent().width()-v.width()],x=[i,0===i?0:i/l.scrollRatio.x],_=m[1],C=g[1],j=_>0?_/l.scrollRatio.x:0,k=C>0?C/l.scrollRatio.x:0;break;case"y":var v=e("#mCSB_"+l.idx+"_dragger_vertical"),y="top",b=p[0].offsetTop,w=[h.height()-p.outerHeight(!1),v.parent().height()-v.height()],x=[i,0===i?0:i/l.scrollRatio.y],_=m[0],C=g[0],j=_>0?_/l.scrollRatio.y:0,k=C>0?C/l.scrollRatio.y:0}x[1]<0||0===x[0]&&0===x[1]?x=[0,0]:x[1]>=w[1]?x=[w[0],w[1]]:x[0]=-x[0],t[0].mcs||(s(),r("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(p[0].onCompleteTimeout),(l.tweenRunning||!(0===b&&x[0]>=0||b===w[0]&&x[0]<=w[0]))&&(V(v[0],y,Math.round(x[1]),d[1],n.scrollEasing),V(p[0],y,Math.round(x[0]),d[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!l.tweenRunning&&(r("onScrollStart")&&(s(),c.callbacks.onScrollStart.call(t[0])),l.tweenRunning=!0,S(v),l.cbOffsets=o())},onUpdate:function(){n.callbacks&&n.onUpdate&&r("whileScrolling")&&(s(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(p[0].onCompleteTimeout);var e=p[0].idleTimer||0;p[0].onCompleteTimeout=setTimeout(function(){r("onScroll")&&(s(),c.callbacks.onScroll.call(t[0])),r("onTotalScroll")&&x[1]>=w[1]-j&&l.cbOffsets[0]&&(s(),c.callbacks.onTotalScroll.call(t[0])),r("onTotalScrollBack")&&x[1]<=k&&l.cbOffsets[1]&&(s(),c.callbacks.onTotalScrollBack.call(t[0])),l.tweenRunning=!1,p[0].idleTimer=0,S(v,"hide")},e)}}}))}},V=function(e,t,i,a,n,r,o){function s(){x.stop||(y||f.call(),y=G()-v,l(),y>=x.time&&(x.time=y>x.time?y+h-(y-x.time):y+h-1,x.time<y+1&&(x.time=y+1)),x.time<a?x.id=p(s):g.call())}function l(){a>0?(x.currVal=d(x.time,b,_,a,n),w[t]=Math.round(x.currVal)+"px"):w[t]=i+"px",m.call()}function c(){h=1e3/60,x.time=y+h,p=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return l(),setTimeout(e,.01)},x.id=p(s)}function u(){null!=x.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(x.id):clearTimeout(x.id),x.id=null)}function d(e,t,i,a,n){switch(n){case"linear":case"mcsLinear":return i*e/a+t;case"mcsLinearOut":return e/=a,e--,i*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?i/2*Math.pow(2,10*(e-1))+t:(e--,i/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?i/2*e*e*e+t:(e-=2,i/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-i*(e*e*e*e-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var r=(e/=a)*e,o=r*e;return t+i*(.499999999999997*o*r+-2.5*r*r+5.5*o+-6.5*r+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var h,p,o=o||{},f=o.onStart||function(){},m=o.onUpdate||function(){},g=o.onComplete||function(){},v=G(),y=0,b=e.offsetTop,w=e.style,x=e._mTween[t];"left"===t&&(b=e.offsetLeft);var _=i-b;x.stop=0,"none"!==r&&u(),c()},G=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},K=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],i=0;i<t.length;i++){var a=t[i];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},Z=function(e,t){try{delete e[t]}catch(i){e[t]=null}},J=function(e){return!(e.which&&1!==e.which)},ee=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},te=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ie=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]};e.fn[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i].defaults=r,window[i]=!0,e(window).load(function(){e(n)[i](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var i,a,n=e(t),r=n.parents(".mCSB_container");return r.length?(i=r.parent(),a=[r[0].offsetTop,r[0].offsetLeft],a[0]+ie(n)[0]>=0&&a[0]+ie(n)[0]<i.height()-n.outerHeight(!1)&&a[1]+ie(n)[1]>=0&&a[1]+ie(n)[1]<i.width()-n.outerWidth(!1)):void 0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var i=e(t).data(a);return i?i.overflowed[0]||i.overflowed[1]:void 0}})})})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";var t=e(window),i=e(document),a=window.location,n=!0,r=!1,o=null,s=NaN,l=1/0,c="undefined",u="directive",d=".cropper",h=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,p=/^(x|y|width|height)$/,f=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,m="cropper-modal",g="cropper-hidden",v="cropper-invisible",y="cropper-move",b="cropper-crop",w="cropper-disabled",x="mousedown touchstart",_="mousemove touchmove",C="mouseup mouseleave touchend touchleave touchcancel",S="wheel mousewheel DOMMouseScroll",j="resize"+d,k="dblclick",Q="build"+d,T="built"+d,D="dragstart"+d,O="dragmove"+d,E="dragend"+d,I=function(e){return"number"==typeof e},M=function(e,t){var i=[];return"number"==typeof t&&i.push(t),i.slice.apply(e,i)},A=function(e,t){var i=M(arguments,2);return function(){return e.apply(t,i.concat(M(arguments)))}},P=function(t,i){this.element=t,this.$element=e(t),this.defaults=e.extend({},P.DEFAULTS,e.isPlainObject(i)?i:{}),this.$original=o,this.ready=r,this.built=r,this.cropped=r,this.rotated=r,this.disabled=r,this.replaced=r,this.init()},R=Math.sqrt,H=Math.min,F=Math.max,L=Math.abs,B=Math.sin,W=Math.cos,$=parseFloat;P.prototype={constructor:P,support:{canvas:e.isFunction(e("<canvas>")[0].getContext)},init:function(){var t=this.defaults;e.each(t,function(e,i){switch(e){case"aspectRatio":t[e]=L($(i))||s;break;case"autoCropArea":t[e]=L($(i))||.8;break;case"minWidth":case"minHeight":t[e]=L($(i))||0;break;case"maxWidth":case"maxHeight":t[e]=L($(i))||l}}),this.image={rotate:0},this.load()},load:function(){var t,i,a=this,r=this.$element,o=this.element,s=this.image,l="";r.is("img")?i=r.prop("src"):r.is("canvas")&&this.support.canvas&&(i=o.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(r.prop("crossOrigin")||this.isCrossOriginURL(i))&&(l=" crossOrigin"),this.$clone=t=e("<img"+l+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,a.url=i,a.ready=n,a.build()}),t.addClass(v).prependTo("body"))},isCrossOriginURL:function(e){var t=e.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===a.protocol&&t[2]===a.hostname&&t[3]===a.port?r:n},build:function(){var t,i,a=this.$element,o=this.defaults;this.ready&&(this.built&&this.unbuild(),a.one(Q,o.build),t=e.Event(Q),a.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=e(P.TEMPLATE),a.addClass(g),this.$clone.removeClass(v).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(g).prependTo(this.$cropper),this.originalImage=e.extend({},this.image)),this.$container=a.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),o.autoCrop?this.cropped=n:this.$dragger.addClass(g),o.dragCrop&&this.setDragMode("crop"),o.modal&&this.$canvas.addClass(m),!o.dashed&&this.$dragger.find(".cropper-dashed").addClass(g),!o.movable&&this.$dragger.find(".cropper-face").data(u,"move"),!o.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(g),
|
7 |
+
this.addListeners(),this.initPreview(),this.built=n,this.update(),this.replaced=r,a.one(T,o.built),a.trigger(T)))},unbuild:function(){this.built&&(this.built=r,this.removeListeners(),this.$preview.empty(),this.$preview=o,this.$dragger=o,this.$canvas=o,this.$container=o,this.$cropper.remove(),this.$cropper=o)},update:function(e){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),e?(this.setData(e,n),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(e.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,i=this.dragger,a=t.width,n=t.height,r=i.left-t.left,o=i.top-t.top;this.$viewer.find("img").css({width:a,height:n,marginLeft:-r,marginTop:-o}),this.$preview.each(function(){var t=e(this),s=t.width()/i.width;t.find("img").css({width:a*s,height:n*s,marginLeft:-r*s,marginTop:-o*s})})},addListeners:function(){var a=this.defaults;this.$element.on(D,a.dragstart).on(O,a.dragmove).on(E,a.dragend),this.$cropper.on(x,e.proxy(this.dragstart,this)).on(k,e.proxy(this.dblclick,this)),a.zoomable&&this.$cropper.on(S,e.proxy(this.wheel,this)),a.multiple?this.$cropper.on(_,e.proxy(this.dragmove,this)).on(C,e.proxy(this.dragend,this)):i.on(_,this._dragmove=A(this.dragmove,this)).on(C,this._dragend=A(this.dragend,this)),t.on(j,this._resize=A(this.resize,this))},removeListeners:function(){var e=this.defaults;this.$element.off(D,e.dragstart).off(O,e.dragmove).off(E,e.dragend),this.$cropper.off(x,this.dragstart).off(k,this.dblclick),e.zoomable&&this.$cropper.off(S,this.wheel),e.multiple?this.$cropper.off(_,this.dragmove).off(C,this.dragend):i.off(_,this._dragmove).off(C,this._dragend),t.off(j,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=e(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var e=this.$container;e!==o&&(this.container={width:F(e.width(),300),height:F(e.height(),150)})},initCropper:function(){var e,t=this.container,i=this.image;i.naturalWidth*t.height/i.naturalHeight-t.width>=0?(e={width:t.width,height:t.width/i.aspectRatio,left:0},e.top=(t.height-e.height)/2):(e={width:t.height*i.aspectRatio,height:t.height,top:0},e.left=(t.width-e.width)/2),this.$cropper.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.cropper=e},initImage:function(){var t=this.image,i=this.cropper,a={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=e.extend({},t,a),t._width!==i.width||t._height!==i.height?e.extend(t,a):(t=e.extend({},a,t),this.replaced&&(t.ratio=a.ratio)),this.image=t,this.renderImage()},renderImage:function(e){var t=this.image;"zoom"===e&&(t.left-=(t.width-t.oldWidth)/2,t.top-=(t.height-t.oldHeight)/2),t.left=H(F(t.left,t._width-t.width),0),t.top=H(F(t.top,t._height-t.height),0),this.$clone.css({width:t.width,height:t.height,marginLeft:t.left,marginTop:t.top}),e&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,a=this.cropper,n=i.aspectRatio||this.image.aspectRatio,r=this.image.ratio;t=a.height*n-a.width>=0?{height:a.width/n,width:a.width,left:0,top:(a.height-a.width/n)/2,maxWidth:a.width,maxHeight:a.width/n}:{height:a.height,width:a.height*n,left:(a.width-a.height*n)/2,top:0,maxWidth:a.height*n,maxHeight:a.height},t.minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=t.maxWidth/n):isFinite(i.maxHeight)&&(t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.maxWidth=t.maxHeight*n),i.minWidth>0?(t.minWidth=F(0,i.minWidth*r),t.minHeight=t.minWidth/n):i.minHeight>0&&(t.minHeight=F(0,i.minHeight*r),t.minWidth=t.minHeight*n)):(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.minWidth=F(0,i.minWidth*r),t.minHeight=F(0,i.minHeight*r)),t.minWidth=H(t.maxWidth,t.minWidth),t.minHeight=H(t.maxHeight,t.minHeight),t.height*=i.autoCropArea,t.width*=i.autoCropArea,t.left=(a.width-t.width)/2,t.top=(a.height-t.height)/2,t.oldLeft=t.left,t.oldTop=t.top,this.defaultDragger=t,this.dragger=e.extend({},t)},renderDragger:function(){var e=this.dragger,t=this.cropper;e.width>e.maxWidth?(e.width=e.maxWidth,e.left=e.oldLeft):e.width<e.minWidth&&(e.width=e.minWidth,e.left=e.oldLeft),e.height>e.maxHeight?(e.height=e.maxHeight,e.top=e.oldTop):e.height<e.minHeight&&(e.height=e.minHeight,e.top=e.oldTop),e.left=H(F(e.left,0),t.width-e.width),e.top=H(F(e.top,0),t.height-e.height),e.oldLeft=e.left,e.oldTop=e.top,this.dragger=e,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=e.extend({},this.defaultImage),this.renderImage(),this.dragger=e.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=r,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(m),this.$dragger.addClass(g))},destroy:function(){var e=this.$element;this.ready&&(this.unbuild(),e.removeClass(g).removeData("cropper"),this.rotated&&e.attr("src",this.$original.attr("src")))},replace:function(t,i){var a,o=this,s=this.$element,l=this.element;t&&t!==this.url&&t!==s.attr("src")&&(i||(this.rotated=r,this.replaced=n),s.is("img")?(s.attr("src",t),this.load()):s.is("canvas")&&this.support.canvas&&(a=l.getContext("2d"),e('<img src="'+t+'">').one("load",function(){l.width=this.width,l.height=this.height,a.clearRect(0,0,l.width,l.height),a.drawImage(this,0,0),o.load()})))},setData:function(t,i){var a=this.cropper,n=this.dragger,r=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!==c&&((t===o||e.isEmptyObject(t))&&(n=e.extend({},this.defaultDragger)),e.isPlainObject(t)&&!e.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),I(t.x)&&t.x<=a.width-r.left&&(n.left=t.x+r.left),I(t.y)&&t.y<=a.height-r.top&&(n.top=t.y+r.top),s?I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth?(n.width=t.width,n.height=n.width/s):I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height,n.width=n.height*s):(I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth&&(n.width=t.width),I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height))),this.dragger=n,this.renderDragger())},getData:function(e){var t=this.dragger,i=this.image,a={};return this.built&&(a={x:t.left-i.left,y:t.top-i.top,width:t.width,height:t.height},a=this.transformData(a,n,e)),a},transformData:function(t,i,a){var n=this.image.ratio,r={};return e.each(t,function(e,t){t=$(t),p.test(e)&&!isNaN(t)&&(r[e]=i?a?Math.round(t/n):t/n:t*n)}),r},setAspectRatio:function(e){var t="auto"===e;e=$(e),(t||!isNaN(e)&&e>0)&&(this.defaults.aspectRatio=t?s:e,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var t={};return this.ready&&e.each(this.image,function(e,i){f.test(e)&&(t[e]=i)}),t},getDataURL:function(t,i,a){var n,r=e("<canvas>")[0],o=this.getData(),s="";return e.isPlainObject(t)||(a=i,i=t,t={}),t=e.extend({width:o.width,height:o.height},t),this.cropped&&this.support.canvas&&(r.width=t.width,r.height=t.height,n=r.getContext("2d"),"image/jpeg"===i&&(n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height)),n.drawImage(this.$clone[0],o.x,o.y,o.width,o.height,0,0,t.width,t.height),s=r.toDataURL(i,a)),s},setDragMode:function(e){var t=this.$canvas,i=this.defaults,a=r,o=r;if(this.built&&!this.disabled){switch(e){case"crop":i.dragCrop&&(a=n,t.data(u,e));break;case"move":o=n,t.data(u,e);break;default:t.removeData(u)}t.toggleClass(b,a).toggleClass(y,o)}},enable:function(){this.built&&(this.disabled=r,this.$cropper.removeClass(w))},disable:function(){this.built&&(this.disabled=n,this.$cropper.addClass(w))},rotate:function(e){var t=this.image;e=$(e)||0,this.built&&0!==e&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=n,e=t.rotate=(t.rotate+e)%360,this.replace(this.getRotatedDataURL(e),!0))},getRotatedDataURL:function(t){var i=e("<canvas>")[0],a=i.getContext("2d"),n=t*Math.PI/180,r=L(t)%180,o=r>90?180-r:r,s=o*Math.PI/180,l=this.originalImage,c=l.naturalWidth,u=l.naturalHeight,d=L(c*W(s)+u*B(s)),h=L(c*B(s)+u*W(s));return i.width=d,i.height=h,a.save(),a.translate(d/2,h/2),a.rotate(n),a.drawImage(this.$original[0],-c/2,-u/2,c,u),a.restore(),i.toDataURL()},zoom:function(e){var t,i,a,n=this.image;e=$(e),this.built&&e&&!this.disabled&&this.defaults.zoomable&&(t=n.width*(1+e),i=n.height*(1+e),a=t/n._width,a>10||(1>a&&(t=n._width,i=n._height),1>=a?this.setDragMode("crop"):this.setDragMode("move"),n.oldWidth=n.width,n.oldHeight=n.height,n.width=t,n.height=i,n.ratio=n.width/n.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(b)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(e){var t,i=e.originalEvent,a=117.25,n=5,r=166.66665649414062,o=.1;this.disabled||(e.preventDefault(),i.deltaY?(t=i.deltaY,t=t%n===0?t/n:t%a===0?t/a:t/r):t=i.wheelDelta?-i.wheelDelta/120:i.detail?i.detail/3:0,this.zoom(t*o))},dragstart:function(t){var i,a,o,s=t.originalEvent.touches,l=t;if(!this.disabled){if(s){if(o=s.length,o>1){if(!this.defaults.zoomable||2!==o)return;l=s[1],this.startX2=l.pageX,this.startY2=l.pageY,i="zoom"}l=s[0]}if(i=i||e(l.target).data(u),h.test(i)){if(t.preventDefault(),a=e.Event(D),this.$element.trigger(a),a.isDefaultPrevented())return;this.directive=i,this.cropping=r,this.startX=l.pageX,this.startY=l.pageY,"crop"===i&&(this.cropping=n,this.$canvas.addClass(m))}}},dragmove:function(t){var i,a,n=t.originalEvent.touches,r=t;if(!this.disabled){if(n){if(a=n.length,a>1){if(!this.defaults.zoomable||2!==a)return;r=n[1],this.endX2=r.pageX,this.endY2=r.pageY}r=n[0]}if(this.directive){if(t.preventDefault(),i=e.Event(O),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=r.pageX,this.endY=r.pageY,this.dragging()}}},dragend:function(t){var i;if(!this.disabled&&this.directive){if(t.preventDefault(),i=e.Event(E),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=r,this.$canvas.toggleClass(m,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var e,t=this.directive,i=this.image,a=this.cropper,o=a.width,s=a.height,l=this.dragger,c=l.width,u=l.height,d=l.left,h=l.top,p=d+c,f=h+u,m=n,v=this.defaults,y=v.aspectRatio,b={x:this.endX-this.startX,y:this.endY-this.startY};switch(y&&(b.X=b.y*y,b.Y=b.x/y),t){case"all":d+=b.x,h+=b.y;break;case"e":if(b.x>=0&&(p>=o||y&&(0>=h||f>=s))){m=r;break}c+=b.x,y&&(u=c/y,h-=b.Y/2),0>c&&(t="w",c=0);break;case"n":if(b.y<=0&&(0>=h||y&&(0>=d||p>=o))){m=r;break}u-=b.y,h+=b.y,y&&(c=u*y,d+=b.X/2),0>u&&(t="s",u=0);break;case"w":if(b.x<=0&&(0>=d||y&&(0>=h||f>=s))){m=r;break}c-=b.x,d+=b.x,y&&(u=c/y,h+=b.Y/2),0>c&&(t="e",c=0);break;case"s":if(b.y>=0&&(f>=s||y&&(0>=d||p>=o))){m=r;break}u+=b.y,y&&(c=u*y,d-=b.X/2),0>u&&(t="n",u=0);break;case"ne":if(y){if(b.y<=0&&(0>=h||p>=o)){m=r;break}u-=b.y,h+=b.y,c=u*y}else b.x>=0?o>p?c+=b.x:b.y<=0&&0>=h&&(m=r):c+=b.x,b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="sw",u=0,c=0);break;case"nw":if(y){if(b.y<=0&&(0>=h||0>=d)){m=r;break}u-=b.y,h+=b.y,c=u*y,d+=b.X}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y<=0&&0>=h&&(m=r):(c-=b.x,d+=b.x),b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="se",u=0,c=0);break;case"sw":if(y){if(b.x<=0&&(0>=d||f>=s)){m=r;break}c-=b.x,d+=b.x,u=c/y}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y>=0&&f>=s&&(m=r):(c-=b.x,d+=b.x),b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="ne",u=0,c=0);break;case"se":if(y){if(b.x>=0&&(p>=o||f>=s)){m=r;break}c+=b.x,u=c/y}else b.x>=0?o>p?c+=b.x:b.y>=0&&f>=s&&(m=r):c+=b.x,b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="nw",u=0,c=0);break;case"move":i.left+=b.x,i.top+=b.y,this.renderImage("move"),m=r;break;case"zoom":v.zoomable&&(this.zoom(function(e,t,i,a,n,r){return(R(n*n+r*r)-R(i*i+a*a))/R(e*e+t*t)}(i.width,i.height,L(this.startX-this.startX2),L(this.startY-this.startY2),L(this.endX-this.endX2),L(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":b.x&&b.y&&(e=this.$cropper.offset(),d=this.startX-e.left,h=this.startY-e.top,c=l.minWidth,u=l.minHeight,b.x>0?b.y>0?t="se":(t="ne",h-=u):b.y>0?(t="sw",d-=c):(t="nw",d-=c,h-=u),this.cropped||(this.cropped=n,this.$dragger.removeClass(g)))}m&&(l.width=c,l.height=u,l.left=d,l.top=h,this.directive=t,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},P.TEMPLATE=function(e,t){return t=t.split(","),e.replace(/\d+/g,function(e){return t[e]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),P.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:e.noop,preview:"",multiple:r,autoCrop:n,dragCrop:n,dashed:n,modal:n,movable:n,resizable:n,zoomable:n,rotatable:n,checkImageOrigin:n,minWidth:0,minHeight:0,maxWidth:l,maxHeight:l,build:o,built:o,dragstart:o,dragmove:o,dragend:o},P.setDefaults=function(t){e.extend(P.DEFAULTS,t)},P.other=e.fn.cropper,e.fn.cropper=function(t){var i,a=M(arguments,1);return this.each(function(){var n,r=e(this),o=r.data("cropper");o||r.data("cropper",o=new P(this,t)),"string"==typeof t&&e.isFunction(n=o[t])&&(i=n.apply(o,a))}),typeof i!==c?i:this},e.fn.cropper.Constructor=P,e.fn.cropper.setDefaults=P.setDefaults,e.fn.cropper.noConflict=function(){return e.fn.cropper=P.other,this}}),function(e){function t(e,t){return"function"==typeof e?e.call(t):e}function i(e){for(;e=e.parentNode;)if(e==document)return!0;return!1}function a(t,i){this.$element=e(t),this.options=i,this.enabled=!0,this.fixTitle()}a.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var a=this.tip();a.find(".tipsy-inner")[this.options.html?"html":"text"](i),a[0].className="tipsy",a.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,r=e.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),o=a[0].offsetWidth,s=a[0].offsetHeight,l=t(this.options.gravity,this.$element[0]);switch(l.charAt(0)){case"n":n={top:r.top+r.height+this.options.offset,left:r.left+r.width/2-o/2};break;case"s":n={top:r.top-s-this.options.offset,left:r.left+r.width/2-o/2};break;case"e":n={top:r.top+r.height/2-s/2,left:r.left-o-this.options.offset};break;case"w":extra_gap=0,e("body").css("position").length>0&&"relative"==e("body").css("position")&&e("#wpadminbar").length&&(extra_gap=e("#wpadminbar").height()),n={top:r.top+r.height/2-s/2-extra_gap,left:r.left+r.width+this.options.offset}}2==l.length&&("w"==l.charAt(1)?n.left=r.left+r.width/2-15:n.left=r.left+r.width/2-o+15),a.css(n).addClass("tipsy-"+l),a.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+l.charAt(0),this.options.className&&a.addClass(t(this.options.className,this.$element[0])),this.options.fade?a.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):a.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){e(this).remove()}):this.tip().remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("original-title"))&&e.attr("original-title",e.attr("title")||"").removeAttr("title")},getTitle:function(){var e,t=this.$element,i=this.options;this.fixTitle();var e,i=this.options;return"string"==typeof i.title?e=t.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(e=i.title.call(t[0])),e=(""+e).replace(/(^\s*|\s*$)/,""),e||i.fallback},tip:function(){return this.$tip||(this.$tip=e('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},e.fn.tipsy=function(t){function i(i){var n=e.data(i,"tipsy");return n||(n=new a(i,e.fn.tipsy.elementOptions(i,t)),e.data(i,"tipsy",n)),n}function n(){var e=i(this);e.hoverState="in",0==t.delayIn?e.show():(e.fixTitle(),setTimeout(function(){"in"==e.hoverState&&e.show()},t.delayIn))}function r(){var e=i(this);e.hoverState="out",0==t.delayOut?e.hide():setTimeout(function(){"out"==e.hoverState&&e.hide()},t.delayOut)}if(t===!0)return this.data("tipsy");if("string"==typeof t){var o=this.data("tipsy");return o&&o[t](),this}if(t=e.extend({},e.fn.tipsy.defaults,t),t.live||this.each(function(){i(this)}),"manual"!=t.trigger){var s="hover"==t.trigger?"mouseenter":"focus",l="hover"==t.trigger?"mouseleave":"blur";t.live?e(document).on(s,this.selector,n).on(l,this.selector,r):this.bind(s,n).bind(l,r)}return this},e.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},e.fn.tipsy.revalidate=function(){e(".tipsy").each(function(){var t=e.data(this,"tipsy-pointee");t&&i(t)||e(this).remove()})},e.fn.tipsy.elementOptions=function(t,i){return e.metadata?e.extend({},i,e(t).metadata()):i},e.fn.tipsy.autoNS=function(){return e(this).offset().top>e(document).scrollTop()+e(window).height()/2?"s":"n"},e.fn.tipsy.autoWE=function(){return e(this).offset().left>e(document).scrollLeft()+e(window).width()/2?"e":"w"},e.fn.tipsy.autoBounds=function(t,i){return function(){var a={ns:i[0],ew:i.length>1?i[1]:!1},n=e(document).scrollTop()+t,r=e(document).scrollLeft()+t,o=e(this);return o.offset().top<n&&(a.ns="n"),o.offset().left<r&&(a.ew="w"),e(window).width()+e(document).scrollLeft()-o.offset().left<t&&(a.ew="e"),e(window).height()+e(document).scrollTop()-o.offset().top<t&&(a.ns="s"),a.ns+(a.ew?a.ew:"")}}}(jQuery);var live_field,live_value,xhrValidateUsername=!1;jQuery(document).ready(function(){2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()}),jQuery(function(){jQuery(".um-search form *").keypress(function(e){return 13==e.which?(jQuery(".um-search form").submit(),!1):void 0}),jQuery(document).on("touchend",function(){jQuery(".select2-search, .select2-focusser").remove()})}),jQuery(window).load(function(){um_responsive(),um_modal_responsive()}),jQuery(window).resize(function(){responsive_Modal(),jQuery("img.cropper-hidden").cropper("destroy"),um_responsive(),um_modal_responsive()}),jQuery(document).ready(function(){jQuery(document).on("input change",".um-field input[type=text]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),um_conditional()}),jQuery(".um-field input[type=text]").trigger("input"),jQuery(document).on("change",".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),jQuery(this).is(":checkbox")&&(jQuery(this).parents(".um-field").find("input:checked").length>1?(live_value="",jQuery(this).parents(".um-field").find("input:checked").each(function(){live_value=live_value+jQuery(this).val()+" "})):live_value=jQuery(this).parents(".um-field").find("input:checked").val()),jQuery(this).is(":radio")&&(live_value=jQuery(this).parents(".um-field").find("input[type=radio]:checked").val()),um_conditional()}),jQuery(".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]").trigger("change")}),jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeClass().addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeClass().addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){var e=(jQuery(this).parents(".um-field-area"),jQuery(this).parents("label"));e.hasClass("active")?(e.removeClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else var e=!1;var t=elem.attr("data-years"),i=elem.attr("data-date_min"),a=elem.attr("data-date_max"),n=i.split(","),r=a.split(","),o=n.length?new Date(n):null,s=n.length?new Date(r):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var l=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(l))}if(s&&"Invalid Date"==s.toString()&&3==r.length){var c=r[1]+"/"+r[2]+"/"+r[0];s=new Date(Date.parse(c))}elem.pickadate({selectYears:t,min:o,max:s,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_conditional()}}),jQuery(".um-rating-readonly").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(".um-s1").select2({allowClear:!0,minimumResultsForSearch:10}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),t>0&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),i=t.data("max_entries");return t.find(".um-field-group-body").length>1?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),i>0&&t.find(".um-field-group-body").length<i&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this).parent();t.addClass("loading");var i=jQuery(this).data("args"),a=jQuery(this).data("hook"),n=jQuery(this).parents(".um").find(".um-ajax-items");return jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_ajax_paginate",hook:a,args:i},complete:function(){t.removeClass("loading")},success:function(e){t.remove(),n.append(e)}}),!1}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),i=jQuery(this).data("user_id"),a=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_muted_action",hook:t,user_id:i,arguments:a},success:function(e){}}),!1}),jQuery(document).on("click","#um-search-button",function(){jQuery(this).parents("form").submit()})}),jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-more").hide(),t.find(".um-member-meta").slideDown(function(){UM_Member_Grid(i)}),t.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(i)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-less").hide(),t.find(".um-member-meta").slideUp(function(){t.find(".um-member-more").fadeIn(),UM_Member_Grid(i)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").submit(),!1})}),jQuery(document).ready(function(){function e(){if("undefined"!=typeof jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit"),t=e-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(t),5>t?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_profile_photo",metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_cover_photo",metakey:metakey,user_id:user_id}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e)}),jQuery(document).ready(function(){var e=jQuery(".um-account-main").attr("data-current_tab");e&&jQuery(".um-account-tab[data-tab="+e+"]").show(),jQuery(document).on("click",".um-account-side li a",function(e){e.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var i=jQuery(this).attr("href"),a=jQuery(this).attr("data-tab");return window.history.pushState("","",i),jQuery(".um-account-tab").hide(),jQuery(".um-account-tab[data-tab="+a+"]").fadeIn(),jQuery(".um-account-nav a").removeClass("current"),jQuery(".um-account-nav a[data-tab="+a+"]").addClass("current"),!1}),jQuery(document).on("click",".um-account-nav a",function(e){e.preventDefault();var t=jQuery(this).attr("data-tab"),i=jQuery(this).parents("div"),a=jQuery(this);return jQuery(".um-account-tab").hide(),a.hasClass("current")?(i.next(".um-account-tab").slideUp(),a.removeClass("current")):(i.next(".um-account-tab").slideDown(),a.parents("div").find("a").removeClass("current"),a.addClass("current")),jQuery(".um-account-side li a").removeClass("current"),jQuery(".um-account-side li a[data-tab="+t+"]").addClass("current"),!1})});
|
core/lib/upload/um-image-upload.php
CHANGED
@@ -33,7 +33,7 @@ if(isset($_FILES[$id]['name'])) {
|
|
33 |
|
34 |
} else {
|
35 |
$file = "stream_photo_".md5($file)."_".uniqid().".".$ext;
|
36 |
-
$ret[] = $ultimatemember->files->new_image_upload_temp( $temp, $file, um_get_option('image_compression') );
|
37 |
|
38 |
}
|
39 |
|
33 |
|
34 |
} else {
|
35 |
$file = "stream_photo_".md5($file)."_".uniqid().".".$ext;
|
36 |
+
$ret[ ] = $ultimatemember->files->new_image_upload_temp( $temp, $file, um_get_option('image_compression') );
|
37 |
|
38 |
}
|
39 |
|
core/um-actions-form.php
CHANGED
@@ -152,6 +152,10 @@
|
|
152 |
$form_id = $args['form_id'];
|
153 |
$mode = $args['mode'];
|
154 |
$fields = unserialize( $args['custom_fields'] );
|
|
|
|
|
|
|
|
|
155 |
|
156 |
if( isset( $fields ) && ! empty( $fields ) ){
|
157 |
foreach( $fields as $key => $array ) {
|
@@ -162,6 +166,10 @@
|
|
162 |
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
163 |
}
|
164 |
|
|
|
|
|
|
|
|
|
165 |
if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) {
|
166 |
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
167 |
}
|
@@ -350,7 +358,9 @@
|
|
350 |
|
351 |
if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
|
352 |
$ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
|
353 |
-
} else if ( $mode
|
|
|
|
|
354 |
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
355 |
} else if ( !is_email( $args[$key] ) ) {
|
356 |
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
@@ -364,6 +374,17 @@
|
|
364 |
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
365 |
} else if ( $args[$key] != '' && email_exists( $args[$key] ) ) {
|
366 |
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
368 |
|
369 |
}
|
152 |
$form_id = $args['form_id'];
|
153 |
$mode = $args['mode'];
|
154 |
$fields = unserialize( $args['custom_fields'] );
|
155 |
+
|
156 |
+
if ( get_post_meta( $form_id, '_um_profile_photo_required', true ) && empty( $args['profile_photo'] ) ) {
|
157 |
+
$ultimatemember->form->add_error('profile_photo', sprintf(__('%s is required.','ultimatemember'), 'Profile Photo' ) );
|
158 |
+
}
|
159 |
|
160 |
if( isset( $fields ) && ! empty( $fields ) ){
|
161 |
foreach( $fields as $key => $array ) {
|
166 |
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
167 |
}
|
168 |
|
169 |
+
if ( isset( $array['type'] ) && $array['type'] == 'user_tags' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) ) {
|
170 |
+
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
171 |
+
}
|
172 |
+
|
173 |
if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) {
|
174 |
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
|
175 |
}
|
358 |
|
359 |
if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
|
360 |
$ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
|
361 |
+
} else if ( in_array( $mode, array('register') ) && email_exists( $args[$key] ) ) {
|
362 |
+
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
363 |
+
} else if ( in_array( $mode, array('profile') ) && email_exists( $args[$key] ) != $args['user_id'] ) {
|
364 |
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
365 |
} else if ( !is_email( $args[$key] ) ) {
|
366 |
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
374 |
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
375 |
} else if ( $args[$key] != '' && email_exists( $args[$key] ) ) {
|
376 |
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
377 |
+
} else if ( $args[$key] != '' ) {
|
378 |
+
|
379 |
+
$users = get_users('meta_value='.$args[ $key ]);
|
380 |
+
|
381 |
+
foreach ( $users as $user ) {
|
382 |
+
if( $user->ID != $args['user_id'] ){
|
383 |
+
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
|
388 |
}
|
389 |
|
390 |
}
|
core/um-actions-login.php
CHANGED
@@ -6,24 +6,24 @@
|
|
6 |
add_action('um_submit_form_errors_hook_login', 'um_submit_form_errors_hook_login', 10);
|
7 |
function um_submit_form_errors_hook_login( $args ){
|
8 |
global $ultimatemember;
|
9 |
-
|
10 |
$is_email = false;
|
11 |
-
|
12 |
$form_id = $args['form_id'];
|
13 |
$mode = $args['mode'];
|
14 |
|
15 |
if ( isset( $args['username'] ) && $args['username'] == '' ) {
|
16 |
$ultimatemember->form->add_error( 'username', __('Please enter your username or email','ultimatemember') );
|
17 |
}
|
18 |
-
|
19 |
if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) {
|
20 |
$ultimatemember->form->add_error( 'user_login', __('Please enter your username','ultimatemember') );
|
21 |
}
|
22 |
-
|
23 |
if ( isset( $args['user_email'] ) && $args['user_email'] == '' ) {
|
24 |
$ultimatemember->form->add_error( 'user_email', __('Please enter your email','ultimatemember') );
|
25 |
}
|
26 |
-
|
27 |
if ( isset( $args['username'] ) ) {
|
28 |
$field = 'username';
|
29 |
if ( is_email( $args['username'] ) ) {
|
@@ -42,7 +42,7 @@
|
|
42 |
$field = 'user_login';
|
43 |
$user_name = $args['user_login'];
|
44 |
}
|
45 |
-
|
46 |
if ( !username_exists( $user_name ) ) {
|
47 |
if ( $is_email ) {
|
48 |
$ultimatemember->form->add_error( $field, __(' Sorry, we can\'t find an account with that email address','ultimatemember') );
|
@@ -54,23 +54,52 @@
|
|
54 |
$ultimatemember->form->add_error( 'user_password', __('Please enter your password','ultimatemember') );
|
55 |
}
|
56 |
}
|
57 |
-
|
58 |
$user = get_user_by( 'login', $user_name );
|
59 |
if ( $user && wp_check_password( $args['user_password'], $user->data->user_pass, $user->ID) ) {
|
60 |
$ultimatemember->login->auth_id = username_exists( $user_name );
|
61 |
} else {
|
62 |
$ultimatemember->form->add_error( 'user_password', __('Password is incorrect. Please try again.','ultimatemember') );
|
63 |
}
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
/***
|
68 |
*** @login checks thru the frontend login
|
69 |
***/
|
70 |
add_action('um_submit_form_errors_hook_logincheck', 'um_submit_form_errors_hook_logincheck', 9999 );
|
71 |
function um_submit_form_errors_hook_logincheck($args){
|
72 |
global $ultimatemember;
|
73 |
-
|
74 |
// Logout if logged in
|
75 |
if ( is_user_logged_in() ) {
|
76 |
wp_logout();
|
@@ -78,10 +107,10 @@
|
|
78 |
|
79 |
$user_id = ( isset( $ultimatemember->login->auth_id ) ) ? $ultimatemember->login->auth_id : '';
|
80 |
um_fetch_user( $user_id );
|
81 |
-
|
82 |
$status = um_user('account_status'); // account status
|
83 |
switch( $status ) {
|
84 |
-
|
85 |
// If user can't login to site...
|
86 |
case 'inactive':
|
87 |
case 'awaiting_admin_review':
|
@@ -90,15 +119,15 @@
|
|
90 |
um_reset_user();
|
91 |
exit( wp_redirect( add_query_arg( 'err', esc_attr( $status ), $ultimatemember->permalinks->get_current_url() ) ) );
|
92 |
break;
|
93 |
-
|
94 |
}
|
95 |
-
|
96 |
if ( isset( $args['form_id'] ) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors && !isset( $_POST[ $ultimatemember->honeypot ] ) ) {
|
97 |
exit( wp_redirect( um_get_core_page('login') ) );
|
98 |
}
|
99 |
-
|
100 |
}
|
101 |
-
|
102 |
/***
|
103 |
*** @store last login timestamp
|
104 |
***/
|
@@ -107,7 +136,7 @@
|
|
107 |
delete_user_meta( $user_id, '_um_last_login' );
|
108 |
update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
|
109 |
}
|
110 |
-
|
111 |
add_action( 'wp_login', 'um_store_lastlogin_timestamp_' );
|
112 |
function um_store_lastlogin_timestamp_( $login ) {
|
113 |
$user = get_user_by('login',$login);
|
@@ -115,7 +144,7 @@
|
|
115 |
delete_user_meta( $user_id, '_um_last_login' );
|
116 |
update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
|
117 |
}
|
118 |
-
|
119 |
/***
|
120 |
*** @login user
|
121 |
***/
|
@@ -125,57 +154,57 @@
|
|
125 |
extract( $args );
|
126 |
|
127 |
$rememberme = ( isset($args['rememberme']) ) ? 1 : 0;
|
128 |
-
|
129 |
if ( um_get_option('deny_admin_frontend_login') && strstr( um_user('wp_roles' ), 'administrator' ) )
|
130 |
wp_die( __('This action has been prevented for security measures.','ultimatemember') );
|
131 |
-
|
132 |
$ultimatemember->user->auto_login( um_user('ID'), $rememberme );
|
133 |
-
|
134 |
// Hook that runs after successful login and before user is redirected
|
135 |
do_action('um_on_login_before_redirect', um_user('ID') );
|
136 |
-
|
137 |
// Priority redirect
|
138 |
if ( isset( $args['redirect_to'] ) && ! empty( $args['redirect_to'] ) ) {
|
139 |
exit( wp_redirect( urldecode( $args['redirect_to'] ) ) );
|
140 |
}
|
141 |
-
|
142 |
// Role redirect
|
143 |
$after = um_user('after_login');
|
144 |
switch( $after ) {
|
145 |
-
|
146 |
case 'redirect_admin':
|
147 |
exit( wp_redirect( admin_url() ) );
|
148 |
break;
|
149 |
-
|
150 |
case 'redirect_profile':
|
151 |
exit( wp_redirect( um_user_profile_url() ) );
|
152 |
break;
|
153 |
-
|
154 |
case 'redirect_url':
|
155 |
exit( wp_redirect( um_user('login_redirect_url') ) );
|
156 |
break;
|
157 |
-
|
158 |
case 'refresh':
|
159 |
exit( wp_redirect( $ultimatemember->permalinks->get_current_url() ) );
|
160 |
break;
|
161 |
-
|
162 |
}
|
163 |
-
|
164 |
}
|
165 |
-
|
166 |
/***
|
167 |
*** @form processing
|
168 |
***/
|
169 |
add_action('um_submit_form_login', 'um_submit_form_login', 10);
|
170 |
function um_submit_form_login($args){
|
171 |
global $ultimatemember;
|
172 |
-
|
173 |
if ( !isset($ultimatemember->form->errors) ) {
|
174 |
do_action( 'um_user_login', $args );
|
175 |
}
|
176 |
-
|
177 |
do_action('um_user_login_extra_hook', $args );
|
178 |
-
|
179 |
}
|
180 |
|
181 |
/***
|
@@ -187,18 +216,18 @@
|
|
187 |
|
188 |
// DO NOT add when reviewing user's details
|
189 |
if ( $ultimatemember->user->preview == true && is_admin() ) return;
|
190 |
-
|
191 |
$primary_btn_word = $args['primary_btn_word'];
|
192 |
$primary_btn_word = apply_filters('um_login_form_button_one', $primary_btn_word, $args );
|
193 |
-
|
194 |
$secondary_btn_word = $args['secondary_btn_word'];
|
195 |
$secondary_btn_word = apply_filters('um_login_form_button_two', $secondary_btn_word, $args );
|
196 |
-
|
197 |
$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('register');
|
198 |
$secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url, $args );
|
199 |
-
|
200 |
?>
|
201 |
-
|
202 |
<div class="um-col-alt">
|
203 |
|
204 |
<?php if ( isset( $args['show_rememberme'] ) && $args['show_rememberme'] ) {
|
@@ -207,20 +236,20 @@
|
|
207 |
} ?>
|
208 |
|
209 |
<?php if ( isset($args['secondary_btn']) && $args['secondary_btn'] != 0 ) { ?>
|
210 |
-
|
211 |
<div class="um-left um-half"><input type="submit" value="<?php echo $primary_btn_word; ?>" class="um-button" /></div>
|
212 |
<div class="um-right um-half"><a href="<?php echo $secondary_btn_url; ?>" class="um-button um-alt"><?php echo $secondary_btn_word; ?></a></div>
|
213 |
-
|
214 |
<?php } else { ?>
|
215 |
-
|
216 |
<div class="um-center"><input type="submit" value="<?php echo $args['primary_btn_word']; ?>" class="um-button" /></div>
|
217 |
-
|
218 |
<?php } ?>
|
219 |
-
|
220 |
<div class="um-clear"></div>
|
221 |
-
|
222 |
</div>
|
223 |
-
|
224 |
<?php
|
225 |
}
|
226 |
|
@@ -228,27 +257,27 @@
|
|
228 |
*** @Display a forgot password link
|
229 |
***/
|
230 |
add_action('um_after_login_fields', 'um_after_login_submit', 1001);
|
231 |
-
function um_after_login_submit( $args ){
|
232 |
global $ultimatemember;
|
233 |
|
234 |
if ( $args['forgot_pass_link'] == 0 ) return;
|
235 |
-
|
236 |
?>
|
237 |
-
|
238 |
<div class="um-col-alt-b">
|
239 |
<a href="<?php echo um_get_core_page('password-reset'); ?>" class="um-link-alt"><?php _e('Forgot your password?','ultimatemember'); ?></a>
|
240 |
</div>
|
241 |
-
|
242 |
<?php
|
243 |
}
|
244 |
-
|
245 |
/***
|
246 |
*** @Show Fields
|
247 |
***/
|
248 |
add_action('um_main_login_fields', 'um_add_login_fields', 100);
|
249 |
function um_add_login_fields($args){
|
250 |
global $ultimatemember;
|
251 |
-
|
252 |
echo $ultimatemember->fields->display( 'login', $args );
|
253 |
-
|
254 |
-
}
|
6 |
add_action('um_submit_form_errors_hook_login', 'um_submit_form_errors_hook_login', 10);
|
7 |
function um_submit_form_errors_hook_login( $args ){
|
8 |
global $ultimatemember;
|
9 |
+
|
10 |
$is_email = false;
|
11 |
+
|
12 |
$form_id = $args['form_id'];
|
13 |
$mode = $args['mode'];
|
14 |
|
15 |
if ( isset( $args['username'] ) && $args['username'] == '' ) {
|
16 |
$ultimatemember->form->add_error( 'username', __('Please enter your username or email','ultimatemember') );
|
17 |
}
|
18 |
+
|
19 |
if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) {
|
20 |
$ultimatemember->form->add_error( 'user_login', __('Please enter your username','ultimatemember') );
|
21 |
}
|
22 |
+
|
23 |
if ( isset( $args['user_email'] ) && $args['user_email'] == '' ) {
|
24 |
$ultimatemember->form->add_error( 'user_email', __('Please enter your email','ultimatemember') );
|
25 |
}
|
26 |
+
|
27 |
if ( isset( $args['username'] ) ) {
|
28 |
$field = 'username';
|
29 |
if ( is_email( $args['username'] ) ) {
|
42 |
$field = 'user_login';
|
43 |
$user_name = $args['user_login'];
|
44 |
}
|
45 |
+
|
46 |
if ( !username_exists( $user_name ) ) {
|
47 |
if ( $is_email ) {
|
48 |
$ultimatemember->form->add_error( $field, __(' Sorry, we can\'t find an account with that email address','ultimatemember') );
|
54 |
$ultimatemember->form->add_error( 'user_password', __('Please enter your password','ultimatemember') );
|
55 |
}
|
56 |
}
|
57 |
+
|
58 |
$user = get_user_by( 'login', $user_name );
|
59 |
if ( $user && wp_check_password( $args['user_password'], $user->data->user_pass, $user->ID) ) {
|
60 |
$ultimatemember->login->auth_id = username_exists( $user_name );
|
61 |
} else {
|
62 |
$ultimatemember->form->add_error( 'user_password', __('Password is incorrect. Please try again.','ultimatemember') );
|
63 |
}
|
64 |
+
|
65 |
+
// add a way for other plugins like wp limit login
|
66 |
+
// to limit the login attempts
|
67 |
+
$user = apply_filters( 'authenticate', null, $user_name, $args['user_password'] );
|
68 |
+
|
69 |
+
// if there is an error notify wp
|
70 |
+
if( $ultimatemember->form->has_error( $field ) || $ultimatemember->form->has_error( $user_password ) ) {
|
71 |
+
do_action( 'wp_login_failed', $user_name );
|
72 |
+
}
|
73 |
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Display the login errors from other plugins
|
77 |
+
*/
|
78 |
+
add_action( 'um_before_login_fields', 'um_display_login_errors' );
|
79 |
+
function um_display_login_errors( $args ) {
|
80 |
+
global $ultimatemember;
|
81 |
+
|
82 |
+
if( $ultimatemember->form->count_errors() > 0 ) {
|
83 |
+
$error = array_values( $ultimatemember->form->errors );
|
84 |
+
$error = array_shift( $error );
|
85 |
+
}
|
86 |
+
|
87 |
+
// hook for other plugins to display error
|
88 |
+
$errors = trim( apply_filters( 'login_errors', $error ) );
|
89 |
+
|
90 |
+
if( trim( $errors ) )
|
91 |
+
{
|
92 |
+
echo '<p class="um-notice err"><i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i>' . $errors . '</p>';
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
/***
|
97 |
*** @login checks thru the frontend login
|
98 |
***/
|
99 |
add_action('um_submit_form_errors_hook_logincheck', 'um_submit_form_errors_hook_logincheck', 9999 );
|
100 |
function um_submit_form_errors_hook_logincheck($args){
|
101 |
global $ultimatemember;
|
102 |
+
|
103 |
// Logout if logged in
|
104 |
if ( is_user_logged_in() ) {
|
105 |
wp_logout();
|
107 |
|
108 |
$user_id = ( isset( $ultimatemember->login->auth_id ) ) ? $ultimatemember->login->auth_id : '';
|
109 |
um_fetch_user( $user_id );
|
110 |
+
|
111 |
$status = um_user('account_status'); // account status
|
112 |
switch( $status ) {
|
113 |
+
|
114 |
// If user can't login to site...
|
115 |
case 'inactive':
|
116 |
case 'awaiting_admin_review':
|
119 |
um_reset_user();
|
120 |
exit( wp_redirect( add_query_arg( 'err', esc_attr( $status ), $ultimatemember->permalinks->get_current_url() ) ) );
|
121 |
break;
|
122 |
+
|
123 |
}
|
124 |
+
|
125 |
if ( isset( $args['form_id'] ) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors && !isset( $_POST[ $ultimatemember->honeypot ] ) ) {
|
126 |
exit( wp_redirect( um_get_core_page('login') ) );
|
127 |
}
|
128 |
+
|
129 |
}
|
130 |
+
|
131 |
/***
|
132 |
*** @store last login timestamp
|
133 |
***/
|
136 |
delete_user_meta( $user_id, '_um_last_login' );
|
137 |
update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
|
138 |
}
|
139 |
+
|
140 |
add_action( 'wp_login', 'um_store_lastlogin_timestamp_' );
|
141 |
function um_store_lastlogin_timestamp_( $login ) {
|
142 |
$user = get_user_by('login',$login);
|
144 |
delete_user_meta( $user_id, '_um_last_login' );
|
145 |
update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
|
146 |
}
|
147 |
+
|
148 |
/***
|
149 |
*** @login user
|
150 |
***/
|
154 |
extract( $args );
|
155 |
|
156 |
$rememberme = ( isset($args['rememberme']) ) ? 1 : 0;
|
157 |
+
|
158 |
if ( um_get_option('deny_admin_frontend_login') && strstr( um_user('wp_roles' ), 'administrator' ) )
|
159 |
wp_die( __('This action has been prevented for security measures.','ultimatemember') );
|
160 |
+
|
161 |
$ultimatemember->user->auto_login( um_user('ID'), $rememberme );
|
162 |
+
|
163 |
// Hook that runs after successful login and before user is redirected
|
164 |
do_action('um_on_login_before_redirect', um_user('ID') );
|
165 |
+
|
166 |
// Priority redirect
|
167 |
if ( isset( $args['redirect_to'] ) && ! empty( $args['redirect_to'] ) ) {
|
168 |
exit( wp_redirect( urldecode( $args['redirect_to'] ) ) );
|
169 |
}
|
170 |
+
|
171 |
// Role redirect
|
172 |
$after = um_user('after_login');
|
173 |
switch( $after ) {
|
174 |
+
|
175 |
case 'redirect_admin':
|
176 |
exit( wp_redirect( admin_url() ) );
|
177 |
break;
|
178 |
+
|
179 |
case 'redirect_profile':
|
180 |
exit( wp_redirect( um_user_profile_url() ) );
|
181 |
break;
|
182 |
+
|
183 |
case 'redirect_url':
|
184 |
exit( wp_redirect( um_user('login_redirect_url') ) );
|
185 |
break;
|
186 |
+
|
187 |
case 'refresh':
|
188 |
exit( wp_redirect( $ultimatemember->permalinks->get_current_url() ) );
|
189 |
break;
|
190 |
+
|
191 |
}
|
192 |
+
|
193 |
}
|
194 |
+
|
195 |
/***
|
196 |
*** @form processing
|
197 |
***/
|
198 |
add_action('um_submit_form_login', 'um_submit_form_login', 10);
|
199 |
function um_submit_form_login($args){
|
200 |
global $ultimatemember;
|
201 |
+
|
202 |
if ( !isset($ultimatemember->form->errors) ) {
|
203 |
do_action( 'um_user_login', $args );
|
204 |
}
|
205 |
+
|
206 |
do_action('um_user_login_extra_hook', $args );
|
207 |
+
|
208 |
}
|
209 |
|
210 |
/***
|
216 |
|
217 |
// DO NOT add when reviewing user's details
|
218 |
if ( $ultimatemember->user->preview == true && is_admin() ) return;
|
219 |
+
|
220 |
$primary_btn_word = $args['primary_btn_word'];
|
221 |
$primary_btn_word = apply_filters('um_login_form_button_one', $primary_btn_word, $args );
|
222 |
+
|
223 |
$secondary_btn_word = $args['secondary_btn_word'];
|
224 |
$secondary_btn_word = apply_filters('um_login_form_button_two', $secondary_btn_word, $args );
|
225 |
+
|
226 |
$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('register');
|
227 |
$secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url, $args );
|
228 |
+
|
229 |
?>
|
230 |
+
|
231 |
<div class="um-col-alt">
|
232 |
|
233 |
<?php if ( isset( $args['show_rememberme'] ) && $args['show_rememberme'] ) {
|
236 |
} ?>
|
237 |
|
238 |
<?php if ( isset($args['secondary_btn']) && $args['secondary_btn'] != 0 ) { ?>
|
239 |
+
|
240 |
<div class="um-left um-half"><input type="submit" value="<?php echo $primary_btn_word; ?>" class="um-button" /></div>
|
241 |
<div class="um-right um-half"><a href="<?php echo $secondary_btn_url; ?>" class="um-button um-alt"><?php echo $secondary_btn_word; ?></a></div>
|
242 |
+
|
243 |
<?php } else { ?>
|
244 |
+
|
245 |
<div class="um-center"><input type="submit" value="<?php echo $args['primary_btn_word']; ?>" class="um-button" /></div>
|
246 |
+
|
247 |
<?php } ?>
|
248 |
+
|
249 |
<div class="um-clear"></div>
|
250 |
+
|
251 |
</div>
|
252 |
+
|
253 |
<?php
|
254 |
}
|
255 |
|
257 |
*** @Display a forgot password link
|
258 |
***/
|
259 |
add_action('um_after_login_fields', 'um_after_login_submit', 1001);
|
260 |
+
function um_after_login_submit( $args ){
|
261 |
global $ultimatemember;
|
262 |
|
263 |
if ( $args['forgot_pass_link'] == 0 ) return;
|
264 |
+
|
265 |
?>
|
266 |
+
|
267 |
<div class="um-col-alt-b">
|
268 |
<a href="<?php echo um_get_core_page('password-reset'); ?>" class="um-link-alt"><?php _e('Forgot your password?','ultimatemember'); ?></a>
|
269 |
</div>
|
270 |
+
|
271 |
<?php
|
272 |
}
|
273 |
+
|
274 |
/***
|
275 |
*** @Show Fields
|
276 |
***/
|
277 |
add_action('um_main_login_fields', 'um_add_login_fields', 100);
|
278 |
function um_add_login_fields($args){
|
279 |
global $ultimatemember;
|
280 |
+
|
281 |
echo $ultimatemember->fields->display( 'login', $args );
|
282 |
+
|
283 |
+
}
|
core/um-actions-password.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/***
|
4 |
*** @process a new request
|
5 |
***/
|
@@ -8,7 +8,7 @@
|
|
8 |
global $ultimatemember;
|
9 |
|
10 |
$user = $_POST['username_b'];
|
11 |
-
|
12 |
if ( !is_email( $user ) ) {
|
13 |
$data = get_user_by( 'login', $user );
|
14 |
$user_email = $data->user_email;
|
@@ -19,15 +19,15 @@
|
|
19 |
|
20 |
$ultimatemember->password->reset_request['user_id'] = $data->ID;
|
21 |
$ultimatemember->password->reset_request['user_email'] = $user_email;
|
22 |
-
|
23 |
um_fetch_user( $data->ID );
|
24 |
-
|
25 |
$ultimatemember->user->password_reset();
|
26 |
|
27 |
um_reset_user();
|
28 |
-
|
29 |
}
|
30 |
-
|
31 |
/***
|
32 |
*** @process a change request
|
33 |
***/
|
@@ -37,32 +37,32 @@
|
|
37 |
extract( $args );
|
38 |
|
39 |
wp_set_password( $args['user_password'], $args['user_id'] );
|
40 |
-
|
41 |
delete_user_meta( $args['user_id'], 'reset_pass_hash');
|
42 |
delete_user_meta( $args['user_id'], 'reset_pass_hash_token');
|
43 |
delete_user_meta( $args['user_id'], 'password_rst_attempts');
|
44 |
|
45 |
do_action('um_after_changing_user_password', $args['user_id'] );
|
46 |
-
|
47 |
-
|
48 |
if ( is_user_logged_in() ) {
|
49 |
wp_logout();
|
50 |
}
|
51 |
-
|
52 |
exit( wp_redirect( um_get_core_page('login', 'password_changed') ) );
|
53 |
-
|
54 |
}
|
55 |
-
|
56 |
/**
|
57 |
* Overrides password changed notification
|
58 |
-
*
|
59 |
*/
|
60 |
function um_send_password_change_email( $args ){
|
61 |
|
62 |
global $ultimatemember;
|
63 |
|
64 |
um_fetch_user( $user_id );
|
65 |
-
|
66 |
$ultimatemember->user->password_changed();
|
67 |
|
68 |
um_reset_user();
|
@@ -70,7 +70,7 @@
|
|
70 |
|
71 |
return false;
|
72 |
}
|
73 |
-
|
74 |
/***
|
75 |
*** @This is executed after changing password
|
76 |
***/
|
@@ -79,20 +79,20 @@
|
|
79 |
global $ultimatemember;
|
80 |
|
81 |
}
|
82 |
-
|
83 |
/***
|
84 |
*** @Error handler: reset password
|
85 |
***/
|
86 |
add_action('um_reset_password_errors_hook','um_reset_password_errors_hook');
|
87 |
function um_reset_password_errors_hook( $args ) {
|
88 |
global $ultimatemember;
|
89 |
-
|
90 |
if ( $_POST[ $ultimatemember->honeypot ] != '' )
|
91 |
wp_die('Hello, spam bot!');
|
92 |
|
93 |
$form_timestamp = trim($_POST['timestamp']);
|
94 |
$live_timestamp = current_time( 'timestamp' );
|
95 |
-
|
96 |
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
|
97 |
wp_die( __('Hello, spam bot!') );
|
98 |
|
@@ -102,9 +102,9 @@
|
|
102 |
if ( strlen(trim( $_POST['username_b'] ) ) == 0 ) {
|
103 |
$ultimatemember->form->add_error('username_b', __('Please provide your username or email','ultimatemember') );
|
104 |
}
|
105 |
-
|
106 |
$user = $_POST['username_b'];
|
107 |
-
|
108 |
if ( ( !is_email( $user ) && !username_exists( $user ) ) || ( is_email( $user ) && !email_exists( $user ) ) ) {
|
109 |
$ultimatemember->form->add_error('username_b', __('We can\'t find an account registered with that address or username','ultimatemember') );
|
110 |
} else {
|
@@ -120,38 +120,38 @@
|
|
120 |
update_user_meta( $user_id, 'password_rst_attempts', $attempts + 1 );
|
121 |
}
|
122 |
}
|
123 |
-
|
124 |
}
|
125 |
-
|
126 |
/***
|
127 |
*** @Error handler: changing password
|
128 |
***/
|
129 |
add_action('um_change_password_errors_hook','um_change_password_errors_hook');
|
130 |
function um_change_password_errors_hook( $args ) {
|
131 |
global $ultimatemember;
|
132 |
-
|
133 |
if ( $_POST[ $ultimatemember->honeypot ] != '' )
|
134 |
wp_die('Hello, spam bot!');
|
135 |
|
136 |
$form_timestamp = trim($_POST['timestamp']);
|
137 |
$live_timestamp = current_time( 'timestamp' );
|
138 |
-
|
139 |
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
|
140 |
wp_die( __('Hello, spam bot!') );
|
141 |
|
142 |
if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 )
|
143 |
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
|
144 |
-
|
145 |
if ( !$args['user_password'] ) {
|
146 |
$ultimatemember->form->add_error('user_password', __('You must enter a new password','ultimatemember') );
|
147 |
}
|
148 |
|
149 |
if ( um_get_option('reset_require_strongpass') ) {
|
150 |
-
|
151 |
if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) {
|
152 |
$ultimatemember->form->add_error('user_password', __('Your password must contain at least 8 characters','ultimatemember') );
|
153 |
}
|
154 |
-
|
155 |
if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) {
|
156 |
$ultimatemember->form->add_error('user_password', __('Your password must contain less than 30 characters','ultimatemember') );
|
157 |
}
|
@@ -159,99 +159,101 @@
|
|
159 |
if ( !$ultimatemember->validation->strong_pass( $args['user_password'] ) ) {
|
160 |
$ultimatemember->form->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimatemember') );
|
161 |
}
|
162 |
-
|
163 |
}
|
164 |
|
165 |
if ( !$args['confirm_user_password'] ) {
|
166 |
$ultimatemember->form->add_error('confirm_user_password', __('You must confirm your new password','ultimatemember') );
|
167 |
}
|
168 |
-
|
169 |
if ( $args['user_password'] != $args['confirm_user_password'] ) {
|
170 |
$ultimatemember->form->add_error('confirm_user_password', __('Your passwords do not match','ultimatemember') );
|
171 |
}
|
172 |
|
173 |
}
|
174 |
-
|
175 |
/***
|
176 |
*** @hidden fields
|
177 |
***/
|
178 |
add_action('um_change_password_page_hidden_fields','um_change_password_page_hidden_fields');
|
179 |
function um_change_password_page_hidden_fields( $args ) {
|
180 |
-
|
181 |
?>
|
182 |
-
|
183 |
<input type="hidden" name="_um_password_change" id="_um_password_change" value="1" />
|
184 |
-
|
185 |
<input type="hidden" name="user_id" id="user_id" value="<?php echo $args['user_id']; ?>" />
|
186 |
-
|
187 |
<?php
|
188 |
-
|
189 |
}
|
190 |
-
|
191 |
/***
|
192 |
*** @hidden fields
|
193 |
***/
|
194 |
add_action('um_reset_password_page_hidden_fields','um_reset_password_page_hidden_fields');
|
195 |
function um_reset_password_page_hidden_fields( $args ) {
|
196 |
-
|
197 |
?>
|
198 |
-
|
199 |
<input type="hidden" name="_um_password_reset" id="_um_password_reset" value="1" />
|
200 |
-
|
201 |
<?php
|
202 |
-
|
203 |
}
|
204 |
-
|
205 |
/***
|
206 |
*** @form content
|
207 |
***/
|
208 |
add_action('um_reset_password_form', 'um_reset_password_form');
|
209 |
-
function um_reset_password_form() {
|
210 |
-
|
211 |
global $ultimatemember;
|
212 |
|
213 |
$fields = $ultimatemember->builtin->get_specific_fields('password_reset_text,username_b'); ?>
|
214 |
-
|
215 |
<?php $output = null;
|
216 |
foreach( $fields as $key => $data ) {
|
217 |
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
218 |
}echo $output; ?>
|
219 |
-
|
|
|
|
|
220 |
<div class="um-col-alt um-col-alt-b">
|
221 |
-
|
222 |
<div class="um-center"><input type="submit" value="<?php _e('Reset my password','ultimatemember'); ?>" class="um-button" /></div>
|
223 |
-
|
224 |
<div class="um-clear"></div>
|
225 |
-
|
226 |
</div>
|
227 |
-
|
228 |
<?php
|
229 |
-
|
230 |
}
|
231 |
-
|
232 |
/***
|
233 |
*** @change password form
|
234 |
***/
|
235 |
add_action('um_change_password_form', 'um_change_password_form');
|
236 |
function um_change_password_form() {
|
237 |
-
|
238 |
global $ultimatemember;
|
239 |
|
240 |
$fields = $ultimatemember->builtin->get_specific_fields('user_password'); ?>
|
241 |
-
|
242 |
<?php $output = null;
|
243 |
foreach( $fields as $key => $data ) {
|
244 |
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
245 |
}echo $output; ?>
|
246 |
-
|
247 |
<div class="um-col-alt um-col-alt-b">
|
248 |
-
|
249 |
<div class="um-center"><input type="submit" value="<?php _e('Change my password','ultimatemember'); ?>" class="um-button" /></div>
|
250 |
-
|
251 |
<div class="um-clear"></div>
|
252 |
-
|
253 |
</div>
|
254 |
-
|
255 |
<?php
|
256 |
-
|
257 |
-
}
|
1 |
<?php
|
2 |
+
|
3 |
/***
|
4 |
*** @process a new request
|
5 |
***/
|
8 |
global $ultimatemember;
|
9 |
|
10 |
$user = $_POST['username_b'];
|
11 |
+
|
12 |
if ( !is_email( $user ) ) {
|
13 |
$data = get_user_by( 'login', $user );
|
14 |
$user_email = $data->user_email;
|
19 |
|
20 |
$ultimatemember->password->reset_request['user_id'] = $data->ID;
|
21 |
$ultimatemember->password->reset_request['user_email'] = $user_email;
|
22 |
+
|
23 |
um_fetch_user( $data->ID );
|
24 |
+
|
25 |
$ultimatemember->user->password_reset();
|
26 |
|
27 |
um_reset_user();
|
28 |
+
|
29 |
}
|
30 |
+
|
31 |
/***
|
32 |
*** @process a change request
|
33 |
***/
|
37 |
extract( $args );
|
38 |
|
39 |
wp_set_password( $args['user_password'], $args['user_id'] );
|
40 |
+
|
41 |
delete_user_meta( $args['user_id'], 'reset_pass_hash');
|
42 |
delete_user_meta( $args['user_id'], 'reset_pass_hash_token');
|
43 |
delete_user_meta( $args['user_id'], 'password_rst_attempts');
|
44 |
|
45 |
do_action('um_after_changing_user_password', $args['user_id'] );
|
46 |
+
|
47 |
+
|
48 |
if ( is_user_logged_in() ) {
|
49 |
wp_logout();
|
50 |
}
|
51 |
+
|
52 |
exit( wp_redirect( um_get_core_page('login', 'password_changed') ) );
|
53 |
+
|
54 |
}
|
55 |
+
|
56 |
/**
|
57 |
* Overrides password changed notification
|
58 |
+
*
|
59 |
*/
|
60 |
function um_send_password_change_email( $args ){
|
61 |
|
62 |
global $ultimatemember;
|
63 |
|
64 |
um_fetch_user( $user_id );
|
65 |
+
|
66 |
$ultimatemember->user->password_changed();
|
67 |
|
68 |
um_reset_user();
|
70 |
|
71 |
return false;
|
72 |
}
|
73 |
+
|
74 |
/***
|
75 |
*** @This is executed after changing password
|
76 |
***/
|
79 |
global $ultimatemember;
|
80 |
|
81 |
}
|
82 |
+
|
83 |
/***
|
84 |
*** @Error handler: reset password
|
85 |
***/
|
86 |
add_action('um_reset_password_errors_hook','um_reset_password_errors_hook');
|
87 |
function um_reset_password_errors_hook( $args ) {
|
88 |
global $ultimatemember;
|
89 |
+
|
90 |
if ( $_POST[ $ultimatemember->honeypot ] != '' )
|
91 |
wp_die('Hello, spam bot!');
|
92 |
|
93 |
$form_timestamp = trim($_POST['timestamp']);
|
94 |
$live_timestamp = current_time( 'timestamp' );
|
95 |
+
|
96 |
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
|
97 |
wp_die( __('Hello, spam bot!') );
|
98 |
|
102 |
if ( strlen(trim( $_POST['username_b'] ) ) == 0 ) {
|
103 |
$ultimatemember->form->add_error('username_b', __('Please provide your username or email','ultimatemember') );
|
104 |
}
|
105 |
+
|
106 |
$user = $_POST['username_b'];
|
107 |
+
|
108 |
if ( ( !is_email( $user ) && !username_exists( $user ) ) || ( is_email( $user ) && !email_exists( $user ) ) ) {
|
109 |
$ultimatemember->form->add_error('username_b', __('We can\'t find an account registered with that address or username','ultimatemember') );
|
110 |
} else {
|
120 |
update_user_meta( $user_id, 'password_rst_attempts', $attempts + 1 );
|
121 |
}
|
122 |
}
|
123 |
+
|
124 |
}
|
125 |
+
|
126 |
/***
|
127 |
*** @Error handler: changing password
|
128 |
***/
|
129 |
add_action('um_change_password_errors_hook','um_change_password_errors_hook');
|
130 |
function um_change_password_errors_hook( $args ) {
|
131 |
global $ultimatemember;
|
132 |
+
|
133 |
if ( $_POST[ $ultimatemember->honeypot ] != '' )
|
134 |
wp_die('Hello, spam bot!');
|
135 |
|
136 |
$form_timestamp = trim($_POST['timestamp']);
|
137 |
$live_timestamp = current_time( 'timestamp' );
|
138 |
+
|
139 |
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
|
140 |
wp_die( __('Hello, spam bot!') );
|
141 |
|
142 |
if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 )
|
143 |
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
|
144 |
+
|
145 |
if ( !$args['user_password'] ) {
|
146 |
$ultimatemember->form->add_error('user_password', __('You must enter a new password','ultimatemember') );
|
147 |
}
|
148 |
|
149 |
if ( um_get_option('reset_require_strongpass') ) {
|
150 |
+
|
151 |
if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) {
|
152 |
$ultimatemember->form->add_error('user_password', __('Your password must contain at least 8 characters','ultimatemember') );
|
153 |
}
|
154 |
+
|
155 |
if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) {
|
156 |
$ultimatemember->form->add_error('user_password', __('Your password must contain less than 30 characters','ultimatemember') );
|
157 |
}
|
159 |
if ( !$ultimatemember->validation->strong_pass( $args['user_password'] ) ) {
|
160 |
$ultimatemember->form->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimatemember') );
|
161 |
}
|
162 |
+
|
163 |
}
|
164 |
|
165 |
if ( !$args['confirm_user_password'] ) {
|
166 |
$ultimatemember->form->add_error('confirm_user_password', __('You must confirm your new password','ultimatemember') );
|
167 |
}
|
168 |
+
|
169 |
if ( $args['user_password'] != $args['confirm_user_password'] ) {
|
170 |
$ultimatemember->form->add_error('confirm_user_password', __('Your passwords do not match','ultimatemember') );
|
171 |
}
|
172 |
|
173 |
}
|
174 |
+
|
175 |
/***
|
176 |
*** @hidden fields
|
177 |
***/
|
178 |
add_action('um_change_password_page_hidden_fields','um_change_password_page_hidden_fields');
|
179 |
function um_change_password_page_hidden_fields( $args ) {
|
180 |
+
|
181 |
?>
|
182 |
+
|
183 |
<input type="hidden" name="_um_password_change" id="_um_password_change" value="1" />
|
184 |
+
|
185 |
<input type="hidden" name="user_id" id="user_id" value="<?php echo $args['user_id']; ?>" />
|
186 |
+
|
187 |
<?php
|
188 |
+
|
189 |
}
|
190 |
+
|
191 |
/***
|
192 |
*** @hidden fields
|
193 |
***/
|
194 |
add_action('um_reset_password_page_hidden_fields','um_reset_password_page_hidden_fields');
|
195 |
function um_reset_password_page_hidden_fields( $args ) {
|
196 |
+
|
197 |
?>
|
198 |
+
|
199 |
<input type="hidden" name="_um_password_reset" id="_um_password_reset" value="1" />
|
200 |
+
|
201 |
<?php
|
202 |
+
|
203 |
}
|
204 |
+
|
205 |
/***
|
206 |
*** @form content
|
207 |
***/
|
208 |
add_action('um_reset_password_form', 'um_reset_password_form');
|
209 |
+
function um_reset_password_form($args) {
|
210 |
+
|
211 |
global $ultimatemember;
|
212 |
|
213 |
$fields = $ultimatemember->builtin->get_specific_fields('password_reset_text,username_b'); ?>
|
214 |
+
|
215 |
<?php $output = null;
|
216 |
foreach( $fields as $key => $data ) {
|
217 |
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
218 |
}echo $output; ?>
|
219 |
+
|
220 |
+
<?php do_action( 'um_after_password_reset_fields', $args ); ?>
|
221 |
+
|
222 |
<div class="um-col-alt um-col-alt-b">
|
223 |
+
|
224 |
<div class="um-center"><input type="submit" value="<?php _e('Reset my password','ultimatemember'); ?>" class="um-button" /></div>
|
225 |
+
|
226 |
<div class="um-clear"></div>
|
227 |
+
|
228 |
</div>
|
229 |
+
|
230 |
<?php
|
231 |
+
|
232 |
}
|
233 |
+
|
234 |
/***
|
235 |
*** @change password form
|
236 |
***/
|
237 |
add_action('um_change_password_form', 'um_change_password_form');
|
238 |
function um_change_password_form() {
|
239 |
+
|
240 |
global $ultimatemember;
|
241 |
|
242 |
$fields = $ultimatemember->builtin->get_specific_fields('user_password'); ?>
|
243 |
+
|
244 |
<?php $output = null;
|
245 |
foreach( $fields as $key => $data ) {
|
246 |
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
247 |
}echo $output; ?>
|
248 |
+
|
249 |
<div class="um-col-alt um-col-alt-b">
|
250 |
+
|
251 |
<div class="um-center"><input type="submit" value="<?php _e('Change my password','ultimatemember'); ?>" class="um-button" /></div>
|
252 |
+
|
253 |
<div class="um-clear"></div>
|
254 |
+
|
255 |
</div>
|
256 |
+
|
257 |
<?php
|
258 |
+
|
259 |
+
}
|
core/um-actions-profile.php
CHANGED
@@ -120,7 +120,8 @@
|
|
120 |
do_action('um_user_after_updating_profile', $to_update );
|
121 |
|
122 |
if ( !isset( $args['is_signup'] ) ) {
|
123 |
-
|
|
|
124 |
}
|
125 |
|
126 |
}
|
@@ -406,6 +407,12 @@
|
|
406 |
<?php do_action('um_after_header_meta', um_user('ID'), $args ); ?>
|
407 |
|
408 |
</div><div class="um-clear"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
<?php do_action('um_after_header_info', um_user('ID'), $args); ?>
|
411 |
|
120 |
do_action('um_user_after_updating_profile', $to_update );
|
121 |
|
122 |
if ( !isset( $args['is_signup'] ) ) {
|
123 |
+
$url = $ultimatemember->permalinks->profile_url();
|
124 |
+
exit( wp_redirect( um_edit_my_profile_cancel_uri( $url ) ) );
|
125 |
}
|
126 |
|
127 |
}
|
407 |
<?php do_action('um_after_header_meta', um_user('ID'), $args ); ?>
|
408 |
|
409 |
</div><div class="um-clear"></div>
|
410 |
+
|
411 |
+
<?php
|
412 |
+
if ( $ultimatemember->fields->is_error( 'profile_photo' ) ) {
|
413 |
+
echo $ultimatemember->fields->field_error( $ultimatemember->fields->show_error('profile_photo'), 'force_show' );
|
414 |
+
}
|
415 |
+
?>
|
416 |
|
417 |
<?php do_action('um_after_header_info', um_user('ID'), $args); ?>
|
418 |
|
core/um-builtin.php
CHANGED
@@ -649,6 +649,16 @@ class UM_Builtin {
|
|
649 |
'label' => __('E-mail Address','ultimatemember'),
|
650 |
'required' => 0,
|
651 |
'public' => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
'editable' => 1,
|
653 |
'validate' => 'unique_email',
|
654 |
),
|
649 |
'label' => __('E-mail Address','ultimatemember'),
|
650 |
'required' => 0,
|
651 |
'public' => 1,
|
652 |
+
'validate' => 'unique_email',
|
653 |
+
),
|
654 |
+
|
655 |
+
'secondary_user_email' => array(
|
656 |
+
'title' => __('Secondary E-mail Address','ultimatemember'),
|
657 |
+
'metakey' => 'secondary_user_email',
|
658 |
+
'type' => 'text',
|
659 |
+
'label' => __('Secondary E-mail Address','ultimatemember'),
|
660 |
+
'required' => 0,
|
661 |
+
'public' => 1,
|
662 |
'editable' => 1,
|
663 |
'validate' => 'unique_email',
|
664 |
),
|
core/um-fields.php
CHANGED
@@ -298,18 +298,18 @@ class UM_Fields {
|
|
298 |
$label = apply_filters("um_edit_label_all_fields", $label, $data );
|
299 |
}
|
300 |
|
301 |
-
$output .= '<label for="'.$key.$ultimatemember->form->form_suffix.'">'
|
302 |
|
303 |
if ( isset( $data['help'] ) && !empty( $data['help'] ) && $this->viewing == false && !strstr($key, 'confirm_user_pass') ) {
|
304 |
|
305 |
if ( !$ultimatemember->mobile->isMobile() ) {
|
306 |
if ( !isset( $this->disable_tooltips ) ) {
|
307 |
-
$output .= '<span class="um-tip um-tip-w" title="'
|
308 |
}
|
309 |
}
|
310 |
|
311 |
if ( $ultimatemember->mobile->isMobile() || isset( $this->disable_tooltips ) ) {
|
312 |
-
$output .= '<span class="um-tip-text">'. $data['help'] . '</span>';
|
313 |
}
|
314 |
|
315 |
}
|
@@ -909,7 +909,13 @@ class UM_Fields {
|
|
909 |
if ( !um_can_edit_field( $data ) ) return;
|
910 |
|
911 |
// fields that need to be disabled in edit mode (profile)
|
912 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
return;
|
914 |
}
|
915 |
|
@@ -1573,8 +1579,11 @@ class UM_Fields {
|
|
1573 |
if ( isset( $options_pair ) ) {
|
1574 |
$option_value = $k;
|
1575 |
}
|
|
|
|
|
|
|
1576 |
|
1577 |
-
$output .= '<option value="' .
|
1578 |
if ( $this->is_selected($form_key, $option_value, $data) ) {
|
1579 |
$output.= 'selected';
|
1580 |
}
|
298 |
$label = apply_filters("um_edit_label_all_fields", $label, $data );
|
299 |
}
|
300 |
|
301 |
+
$output .= '<label for="'.$key.$ultimatemember->form->form_suffix.'">'.__( $label, UM_TEXTDOMAIN ).'</label>';
|
302 |
|
303 |
if ( isset( $data['help'] ) && !empty( $data['help'] ) && $this->viewing == false && !strstr($key, 'confirm_user_pass') ) {
|
304 |
|
305 |
if ( !$ultimatemember->mobile->isMobile() ) {
|
306 |
if ( !isset( $this->disable_tooltips ) ) {
|
307 |
+
$output .= '<span class="um-tip um-tip-w" title="'.__( $data['help'], UM_TEXTDOMAIN ).'"><i class="um-icon-help-circled"></i></span>';
|
308 |
}
|
309 |
}
|
310 |
|
311 |
if ( $ultimatemember->mobile->isMobile() || isset( $this->disable_tooltips ) ) {
|
312 |
+
$output .= '<span class="um-tip-text">'.__( $data['help'], UM_TEXTDOMAIN ). '</span>';
|
313 |
}
|
314 |
|
315 |
}
|
909 |
if ( !um_can_edit_field( $data ) ) return;
|
910 |
|
911 |
// fields that need to be disabled in edit mode (profile)
|
912 |
+
$arr_restricted_fields = array('user_email','username','user_login','user_password');
|
913 |
+
|
914 |
+
if( um_get_option('editable_primary_email_in_profile') == 1 ){
|
915 |
+
unset( $arr_restricted_fields[0] ); // remove user_email
|
916 |
+
}
|
917 |
+
|
918 |
+
if ( in_array( $key, $arr_restricted_fields ) && $this->editing == true && $this->set_mode == 'profile' ) {
|
919 |
return;
|
920 |
}
|
921 |
|
1579 |
if ( isset( $options_pair ) ) {
|
1580 |
$option_value = $k;
|
1581 |
}
|
1582 |
+
|
1583 |
+
$option_value = htmlentities($option_value);
|
1584 |
+
$option_value = apply_filters('um_select_dropdown_dynamic_option_value', $option_value);
|
1585 |
|
1586 |
+
$output .= '<option value="' . $option_value . '" ';
|
1587 |
if ( $this->is_selected($form_key, $option_value, $data) ) {
|
1588 |
$output.= 'selected';
|
1589 |
}
|
core/um-files.php
CHANGED
@@ -192,15 +192,15 @@ class UM_Files {
|
|
192 |
|
193 |
if ($info['mime'] == 'image/jpeg'){
|
194 |
|
195 |
-
$image = imagecreatefromjpeg($source);
|
196 |
|
197 |
} else if ($info['mime'] == 'image/gif'){
|
198 |
|
199 |
-
$image = imagecreatefromgif($source);
|
200 |
|
201 |
} else if ($info['mime'] == 'image/png'){
|
202 |
|
203 |
-
$image = imagecreatefrompng($source);
|
204 |
|
205 |
}
|
206 |
|
@@ -211,41 +211,75 @@ class UM_Files {
|
|
211 |
$new_w = um_get_option('image_max_width');
|
212 |
$new_h = round( $new_w / $ratio, 2 );
|
213 |
|
214 |
-
|
215 |
-
imagecopyresampled( $image_p, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h );
|
216 |
-
$image_p = $this->fix_image_orientation($image_p, $source);
|
217 |
-
imagejpeg( $image_p, $destination, $quality);
|
218 |
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
-
$
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
/***
|
229 |
*** @Process a file
|
230 |
***/
|
231 |
-
function upload_temp_file($source, $destination) {
|
232 |
|
233 |
-
move_uploaded_file($source, $destination);
|
234 |
|
235 |
}
|
236 |
|
237 |
/***
|
238 |
*** @Process a temp upload
|
239 |
***/
|
240 |
-
function new_image_upload_temp($source, $destination, $quality = 100){
|
241 |
|
242 |
$unique_dir = $this->unique_dir();
|
243 |
|
244 |
$this->make_dir( $unique_dir['dir'] );
|
245 |
|
246 |
-
$this->create_and_copy_image($source, $unique_dir['dir'] . $destination, $quality);
|
247 |
|
248 |
-
$url = $unique_dir['url'] . $destination;
|
249 |
|
250 |
return $url;
|
251 |
|
@@ -254,13 +288,13 @@ class UM_Files {
|
|
254 |
/***
|
255 |
*** @Process a temp upload for files
|
256 |
***/
|
257 |
-
function new_file_upload_temp($source, $destination ){
|
258 |
|
259 |
$unique_dir = $this->unique_dir();
|
260 |
|
261 |
$this->make_dir( $unique_dir['dir'] );
|
262 |
|
263 |
-
$this->upload_temp_file($source, $unique_dir['dir'] . $destination);
|
264 |
|
265 |
$url = $unique_dir['url'] . $destination;
|
266 |
|
@@ -275,24 +309,24 @@ class UM_Files {
|
|
275 |
|
276 |
$old = umask(0);
|
277 |
@mkdir( $dir, 0755, true);
|
278 |
-
umask($old);
|
279 |
|
280 |
}
|
281 |
|
282 |
/***
|
283 |
*** @Get extension by mime type
|
284 |
***/
|
285 |
-
function get_extension_by_mime_type($mime){
|
286 |
-
$split = explode('/'
|
287 |
return $split[1];
|
288 |
}
|
289 |
|
290 |
/***
|
291 |
*** @Get file data
|
292 |
***/
|
293 |
-
function get_file_data($file){
|
294 |
|
295 |
-
$array['size'] = filesize($file);
|
296 |
|
297 |
return $array;
|
298 |
}
|
@@ -300,17 +334,17 @@ class UM_Files {
|
|
300 |
/***
|
301 |
*** @Get image data
|
302 |
***/
|
303 |
-
function get_image_data($file){
|
304 |
|
305 |
-
$array['size'] = filesize($file);
|
306 |
|
307 |
-
$array['image'] = @getimagesize($file);
|
308 |
|
309 |
if ( $array['image'] > 0 ) {
|
310 |
|
311 |
$array['invalid_image'] = false;
|
312 |
|
313 |
-
list($width, $height, $type, $attr) = @getimagesize($file);
|
314 |
|
315 |
$array['width'] = $width;
|
316 |
$array['height'] = $height;
|
@@ -330,12 +364,12 @@ class UM_Files {
|
|
330 |
/***
|
331 |
*** @Check image upload and handle errors
|
332 |
***/
|
333 |
-
function check_image_upload($file, $field) {
|
334 |
global $ultimatemember;
|
335 |
$error = null;
|
336 |
|
337 |
-
$fileinfo = $this->get_image_data($file);
|
338 |
-
$data = $ultimatemember->fields->get_field($field);
|
339 |
|
340 |
if ( $data == null ) {
|
341 |
$data = apply_filters("um_custom_image_handle_{$field}", '' );
|
@@ -362,12 +396,12 @@ class UM_Files {
|
|
362 |
/***
|
363 |
*** @Check file upload and handle errors
|
364 |
***/
|
365 |
-
function check_file_upload($file, $extension, $field) {
|
366 |
global $ultimatemember;
|
367 |
$error = null;
|
368 |
|
369 |
-
$fileinfo = $this->get_file_data($file);
|
370 |
-
$data = $ultimatemember->fields->get_field($field);
|
371 |
|
372 |
if ( !$this->in_array( $extension, $data['allowed_types'] ) ) {
|
373 |
$error = ( isset( $data['extension_error'] ) && !empty( $data['extension_error'] ) ) ? $data['extension_error'] : 'not allowed';
|
@@ -381,9 +415,12 @@ class UM_Files {
|
|
381 |
/***
|
382 |
*** @If a value exists in comma seperated list
|
383 |
***/
|
384 |
-
function in_array($value, $array){
|
385 |
-
|
|
|
386 |
return true;
|
|
|
|
|
387 |
return false;
|
388 |
}
|
389 |
|
@@ -402,8 +439,8 @@ class UM_Files {
|
|
402 |
unlink( $is_temp );
|
403 |
rmdir( dirname( $is_temp ) );
|
404 |
} else {
|
405 |
-
|
406 |
-
}
|
407 |
}
|
408 |
|
409 |
/***
|
@@ -442,13 +479,35 @@ class UM_Files {
|
|
442 |
$targ_x2 = $crop[2];
|
443 |
$targ_y2 = $crop[3];
|
444 |
|
445 |
-
|
446 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
|
448 |
-
|
449 |
-
imagejpeg( $dst_r, $this->path_only( $file ) . basename( $file ), 100);
|
450 |
|
451 |
-
$split = explode('/ultimatemember/temp/', $file);
|
452 |
return $this->upload_temp_url . $split[1];
|
453 |
|
454 |
}
|
@@ -480,19 +539,8 @@ class UM_Files {
|
|
480 |
wp_die( __('Unauthorized to do this attempt.','ultimatemember') );
|
481 |
}
|
482 |
|
483 |
-
|
484 |
-
$
|
485 |
-
|
486 |
-
if ( $key == 'profile_photo' ) {
|
487 |
-
$source_name = 'profile_photo.jpg';
|
488 |
-
}
|
489 |
-
|
490 |
-
if ( $key == 'cover_photo' ) {
|
491 |
-
$source_name = 'cover_photo.jpg';
|
492 |
-
}
|
493 |
-
|
494 |
-
$ext = '.' . pathinfo($source_name, PATHINFO_EXTENSION);
|
495 |
-
$name = str_replace( $ext, '', $source_name );
|
496 |
$filename = $name . $ext;
|
497 |
|
498 |
// copy & overwrite file
|
@@ -501,25 +549,46 @@ class UM_Files {
|
|
501 |
}
|
502 |
copy( $source, $this->upload_basedir . $user_id . '/' . $filename );
|
503 |
|
|
|
|
|
504 |
// thumbs
|
505 |
if ( $key == 'profile_photo' ) {
|
506 |
|
507 |
list($w, $h) = @getimagesize( $source );
|
|
|
508 |
|
509 |
$sizes = um_get_option('photo_thumb_sizes');
|
510 |
foreach( $sizes as $size ) {
|
|
|
|
|
|
|
511 |
|
512 |
if ( file_exists( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext ) ) {
|
513 |
unlink( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
|
514 |
}
|
515 |
|
516 |
if ( $size < $w ) {
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
}
|
524 |
|
525 |
}
|
@@ -545,11 +614,24 @@ class UM_Files {
|
|
545 |
|
546 |
if ( $size < $w ) {
|
547 |
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
}
|
554 |
|
555 |
}
|
192 |
|
193 |
if ($info['mime'] == 'image/jpeg'){
|
194 |
|
195 |
+
$image = imagecreatefromjpeg( $source );
|
196 |
|
197 |
} else if ($info['mime'] == 'image/gif'){
|
198 |
|
199 |
+
$image = imagecreatefromgif( $source );
|
200 |
|
201 |
} else if ($info['mime'] == 'image/png'){
|
202 |
|
203 |
+
$image = imagecreatefrompng( $source );
|
204 |
|
205 |
}
|
206 |
|
211 |
$new_w = um_get_option('image_max_width');
|
212 |
$new_h = round( $new_w / $ratio, 2 );
|
213 |
|
214 |
+
if ( $info['mime'] == 'image/jpeg' || $info['mime'] == 'image/gif' ){
|
|
|
|
|
|
|
215 |
|
216 |
+
$image_p = imagecreatetruecolor( $new_w, $new_h );
|
217 |
+
imagecopyresampled( $image_p, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h );
|
218 |
+
$image_p = $this->fix_image_orientation( $image_p, $source );
|
219 |
+
|
220 |
+
}else if( $info['mime'] == 'image/png' ){
|
221 |
+
|
222 |
+
$srcImage = $image;
|
223 |
+
$targetImage = imagecreatetruecolor( $new_w, $new_h );
|
224 |
+
imagealphablending( $targetImage, false );
|
225 |
+
imagesavealpha( $targetImage, true );
|
226 |
+
imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, $new_w, $new_h, $w, $h );
|
227 |
+
|
228 |
+
}
|
229 |
|
230 |
+
if ( $info['mime'] == 'image/jpeg' ){
|
231 |
+
$has_copied = imagejpeg( $image_p, $destination, $quality );
|
232 |
+
}else if ( $info['mime'] == 'image/gif' ){
|
233 |
+
$has_copied = imagegif( $image_p, $destination );
|
234 |
+
}else if ( $info['mime'] == 'image/png' ){
|
235 |
+
$has_copied = imagepng( $targetImage, $destination, 0 ,PNG_ALL_FILTERS);
|
236 |
+
}
|
237 |
+
|
238 |
+
$info['um_has_max_width'] = 'custom';
|
239 |
+
$info['um_has_copied'] = $has_copied ? 'yes':'no';
|
240 |
+
|
241 |
+
} else {
|
242 |
|
243 |
+
$image = $this->fix_image_orientation( $image, $source );
|
244 |
+
|
245 |
+
if ( $info['mime'] == 'image/jpeg' ){
|
246 |
+
$has_copied = imagejpeg( $image, $destination, $quality );
|
247 |
+
}else if ( $info['mime'] == 'image/gif' ){
|
248 |
+
$has_copied = imagegif( $image, $destination );
|
249 |
+
}else if ( $info['mime'] == 'image/png' ){
|
250 |
+
$has_copied = imagepng( $image , $destination , 0 ,PNG_ALL_FILTERS);
|
251 |
+
}
|
252 |
+
|
253 |
+
$info['um_has_max_width'] = 'default';
|
254 |
+
$info['um_has_copied'] = $has_copied ? 'yes':'no';
|
255 |
}
|
256 |
|
257 |
+
|
258 |
+
|
259 |
+
return $info;
|
260 |
}
|
261 |
|
262 |
/***
|
263 |
*** @Process a file
|
264 |
***/
|
265 |
+
function upload_temp_file( $source, $destination ) {
|
266 |
|
267 |
+
move_uploaded_file( $source, $destination );
|
268 |
|
269 |
}
|
270 |
|
271 |
/***
|
272 |
*** @Process a temp upload
|
273 |
***/
|
274 |
+
function new_image_upload_temp( $source, $destination, $quality = 100 ){
|
275 |
|
276 |
$unique_dir = $this->unique_dir();
|
277 |
|
278 |
$this->make_dir( $unique_dir['dir'] );
|
279 |
|
280 |
+
$info = $this->create_and_copy_image( $source, $unique_dir['dir'] . $destination, $quality );
|
281 |
|
282 |
+
$url = $unique_dir['url'] . $destination ;
|
283 |
|
284 |
return $url;
|
285 |
|
288 |
/***
|
289 |
*** @Process a temp upload for files
|
290 |
***/
|
291 |
+
function new_file_upload_temp( $source, $destination ){
|
292 |
|
293 |
$unique_dir = $this->unique_dir();
|
294 |
|
295 |
$this->make_dir( $unique_dir['dir'] );
|
296 |
|
297 |
+
$this->upload_temp_file( $source, $unique_dir['dir'] . $destination );
|
298 |
|
299 |
$url = $unique_dir['url'] . $destination;
|
300 |
|
309 |
|
310 |
$old = umask(0);
|
311 |
@mkdir( $dir, 0755, true);
|
312 |
+
umask( $old );
|
313 |
|
314 |
}
|
315 |
|
316 |
/***
|
317 |
*** @Get extension by mime type
|
318 |
***/
|
319 |
+
function get_extension_by_mime_type( $mime ){
|
320 |
+
$split = explode('/', $mime );
|
321 |
return $split[1];
|
322 |
}
|
323 |
|
324 |
/***
|
325 |
*** @Get file data
|
326 |
***/
|
327 |
+
function get_file_data( $file ){
|
328 |
|
329 |
+
$array['size'] = filesize( $file );
|
330 |
|
331 |
return $array;
|
332 |
}
|
334 |
/***
|
335 |
*** @Get image data
|
336 |
***/
|
337 |
+
function get_image_data( $file ){
|
338 |
|
339 |
+
$array['size'] = filesize( $file );
|
340 |
|
341 |
+
$array['image'] = @getimagesize( $file );
|
342 |
|
343 |
if ( $array['image'] > 0 ) {
|
344 |
|
345 |
$array['invalid_image'] = false;
|
346 |
|
347 |
+
list($width, $height, $type, $attr) = @getimagesize( $file );
|
348 |
|
349 |
$array['width'] = $width;
|
350 |
$array['height'] = $height;
|
364 |
/***
|
365 |
*** @Check image upload and handle errors
|
366 |
***/
|
367 |
+
function check_image_upload( $file, $field ) {
|
368 |
global $ultimatemember;
|
369 |
$error = null;
|
370 |
|
371 |
+
$fileinfo = $this->get_image_data( $file );
|
372 |
+
$data = $ultimatemember->fields->get_field( $field );
|
373 |
|
374 |
if ( $data == null ) {
|
375 |
$data = apply_filters("um_custom_image_handle_{$field}", '' );
|
396 |
/***
|
397 |
*** @Check file upload and handle errors
|
398 |
***/
|
399 |
+
function check_file_upload( $file, $extension, $field ) {
|
400 |
global $ultimatemember;
|
401 |
$error = null;
|
402 |
|
403 |
+
$fileinfo = $this->get_file_data( $file );
|
404 |
+
$data = $ultimatemember->fields->get_field( $field );
|
405 |
|
406 |
if ( !$this->in_array( $extension, $data['allowed_types'] ) ) {
|
407 |
$error = ( isset( $data['extension_error'] ) && !empty( $data['extension_error'] ) ) ? $data['extension_error'] : 'not allowed';
|
415 |
/***
|
416 |
*** @If a value exists in comma seperated list
|
417 |
***/
|
418 |
+
function in_array( $value, $array ){
|
419 |
+
|
420 |
+
if ( in_array( $value, explode(',', $array ) ) ){
|
421 |
return true;
|
422 |
+
}
|
423 |
+
|
424 |
return false;
|
425 |
}
|
426 |
|
439 |
unlink( $is_temp );
|
440 |
rmdir( dirname( $is_temp ) );
|
441 |
} else {
|
442 |
+
wp_die( __('Ultimate Member: Not a valid temp file','ultimatemember') );
|
443 |
+
}
|
444 |
}
|
445 |
|
446 |
/***
|
479 |
$targ_x2 = $crop[2];
|
480 |
$targ_y2 = $crop[3];
|
481 |
|
482 |
+
|
483 |
+
$info = @getimagesize( $file );
|
484 |
+
|
485 |
+
if ( $info['mime'] == 'image/gif' ){
|
486 |
+
|
487 |
+
$img_r = imagecreatefromgif( $file );
|
488 |
+
$dst_r = imagecreatetruecolor( $targ_x2, $targ_y2 );
|
489 |
+
imagecopy( $dst_r, $img_r, 0, 0, $targ_x1, $targ_y1, $targ_x2, $targ_y2 );
|
490 |
+
imagegif( $dst_r, $this->path_only( $file ) . basename( $file ) );
|
491 |
+
|
492 |
+
} else if ( $info['mime'] == 'image/png' ){
|
493 |
+
|
494 |
+
$img_r = imagecreatefrompng( $file );
|
495 |
+
$dst_r = imagecreatetruecolor( $targ_x2, $targ_y2 );
|
496 |
+
imagealphablending( $dst_r, false);
|
497 |
+
imagesavealpha( $dst_r, true);
|
498 |
+
imagecopy( $dst_r, $img_r, 0, 0, $targ_x1, $targ_y1, $targ_x2, $targ_y2 );
|
499 |
+
imagepng( $dst_r, $this->path_only( $file ) . basename( $file ) );
|
500 |
+
|
501 |
+
}else{
|
502 |
+
|
503 |
+
$img_r = imagecreatefromjpeg( $file );
|
504 |
+
$dst_r = imagecreatetruecolor( $targ_x2, $targ_y2 );
|
505 |
+
imagecopy( $dst_r, $img_r, 0, 0, $targ_x1, $targ_y1, $targ_x2, $targ_y2 );
|
506 |
+
imagejpeg( $dst_r, $this->path_only( $file ) . basename( $file ), 100 );
|
507 |
|
508 |
+
}
|
|
|
509 |
|
510 |
+
$split = explode('/ultimatemember/temp/', $file );
|
511 |
return $this->upload_temp_url . $split[1];
|
512 |
|
513 |
}
|
539 |
wp_die( __('Unauthorized to do this attempt.','ultimatemember') );
|
540 |
}
|
541 |
|
542 |
+
$ext = '.' . pathinfo($source, PATHINFO_EXTENSION);
|
543 |
+
$name = $key;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
$filename = $name . $ext;
|
545 |
|
546 |
// copy & overwrite file
|
549 |
}
|
550 |
copy( $source, $this->upload_basedir . $user_id . '/' . $filename );
|
551 |
|
552 |
+
$info = @getimagesize( $source );
|
553 |
+
|
554 |
// thumbs
|
555 |
if ( $key == 'profile_photo' ) {
|
556 |
|
557 |
list($w, $h) = @getimagesize( $source );
|
558 |
+
|
559 |
|
560 |
$sizes = um_get_option('photo_thumb_sizes');
|
561 |
foreach( $sizes as $size ) {
|
562 |
+
|
563 |
+
$ratio = round( $w / $h, 2 );
|
564 |
+
$height = round( $size / $ratio, 2 );
|
565 |
|
566 |
if ( file_exists( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext ) ) {
|
567 |
unlink( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
|
568 |
}
|
569 |
|
570 |
if ( $size < $w ) {
|
571 |
+
|
572 |
+
if ( $info['mime'] == 'image/jpeg' ){
|
573 |
+
$thumb_s = imagecreatefromjpeg( $source );
|
574 |
+
$thumb = imagecreatetruecolor( $size, $size );
|
575 |
+
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h );
|
576 |
+
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
|
577 |
+
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . $ext, 100);
|
578 |
+
}else if ( $info['mime'] == 'image/png' ){
|
579 |
+
$thumb_s = imagecreatefrompng( $source );
|
580 |
+
$thumb = imagecreatetruecolor( $size, $size );
|
581 |
+
imagealphablending( $thumb, false);
|
582 |
+
imagesavealpha( $thumb, true);
|
583 |
+
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h );
|
584 |
+
imagepng( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
|
585 |
+
}else if ( $info['mime'] == 'image/gif' ){
|
586 |
+
$thumb_s = imagecreatefromgif( $source );
|
587 |
+
$thumb = imagecreatetruecolor( $size, $size );
|
588 |
+
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h );
|
589 |
+
imagegif( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext);
|
590 |
+
imagegif( $thumb, $this->upload_basedir . $user_id . '/' . $name . $ext);
|
591 |
+
}
|
592 |
}
|
593 |
|
594 |
}
|
614 |
|
615 |
if ( $size < $w ) {
|
616 |
|
617 |
+
if ( $info['mime'] == 'image/jpeg' ){
|
618 |
+
$thumb = imagecreatetruecolor( $size, $height );
|
619 |
+
$thumb_s = imagecreatefromjpeg( $source );
|
620 |
+
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
|
621 |
+
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
|
622 |
+
}else if ( $info['mime'] == 'image/png' ){
|
623 |
+
$thumb_s = imagecreatefrompng( $source );
|
624 |
+
$thumb = imagecreatetruecolor( $size, $height );
|
625 |
+
imagealphablending( $thumb, false);
|
626 |
+
imagesavealpha( $thumb, true);
|
627 |
+
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
|
628 |
+
imagepng( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
|
629 |
+
}else if ( $info['mime'] == 'image/gif' ){
|
630 |
+
$thumb = imagecreatetruecolor( $size, $height );
|
631 |
+
$thumb_s = imagecreatefromgif( $source );
|
632 |
+
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
|
633 |
+
imagegif( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext);
|
634 |
+
}
|
635 |
}
|
636 |
|
637 |
}
|
core/um-filters-avatars.php
CHANGED
@@ -43,9 +43,16 @@
|
|
43 |
if( um_get_option('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
|
44 |
$avatar_url = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
|
45 |
$avatar_url = add_query_arg('s',400, $avatar_url);
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
|
|
49 |
}
|
50 |
|
51 |
$avatar = '<img src="' .$avatar_url .'?d='. $default . '&s=' . $size . $rating .'" class="func-um_get_avatar gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
|
43 |
if( um_get_option('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
|
44 |
$avatar_url = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
|
45 |
$avatar_url = add_query_arg('s',400, $avatar_url);
|
46 |
+
$gravatar_type = um_get_option('use_um_gravatar_default_builtin_image');
|
47 |
+
|
48 |
+
if( $gravatar_type == 'default' ){
|
49 |
+
if( um_get_option('use_um_gravatar_default_image') ){
|
50 |
+
$avatar_url = add_query_arg('d', um_get_default_avatar_uri(), $avatar_url );
|
51 |
+
}
|
52 |
+
}else{
|
53 |
+
$avatar_url = add_query_arg('d', $gravatar_type, $avatar_url );
|
54 |
}
|
55 |
+
|
56 |
}
|
57 |
|
58 |
$avatar = '<img src="' .$avatar_url .'?d='. $default . '&s=' . $size . $rating .'" class="func-um_get_avatar gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
|
core/um-filters-fields.php
CHANGED
@@ -5,14 +5,14 @@
|
|
5 |
***/
|
6 |
add_filter('um_edit_label_all_fields', 'um_edit_label_all_fields', 10, 2);
|
7 |
function um_edit_label_all_fields( $label, $data ) {
|
8 |
-
|
9 |
$asterisk = um_get_option('form_asterisk');
|
10 |
if ( $asterisk && isset( $data['required'] ) && $data['required'] == 1 )
|
11 |
$label = $label . '<span class="um-req" title="'.__('Required','ultimatemember').'">*</span>';
|
12 |
-
|
13 |
return $label;
|
14 |
}
|
15 |
-
|
16 |
/***
|
17 |
*** @change birth date label in view
|
18 |
***/
|
@@ -21,24 +21,24 @@
|
|
21 |
$label = __('Age','ultimatemember');
|
22 |
return $label;
|
23 |
}
|
24 |
-
|
25 |
/***
|
26 |
*** @outputs a soundcloud track
|
27 |
***/
|
28 |
add_filter('um_profile_field_filter_hook__soundcloud_track', 'um_profile_field_filter_hook__soundcloud_track', 99, 2);
|
29 |
function um_profile_field_filter_hook__soundcloud_track( $value, $data ) {
|
30 |
-
|
31 |
if ( !is_numeric( $value ) ) {
|
32 |
return __('Invalid soundcloud track ID','ultimatemember');
|
33 |
}
|
34 |
-
|
35 |
$value = '<div class="um-soundcloud">
|
36 |
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/' . $value . '&color=ff6600&auto_play=false&show_artwork=true"></iframe>
|
37 |
</div>';
|
38 |
-
|
39 |
return $value;
|
40 |
}
|
41 |
-
|
42 |
/***
|
43 |
*** @outputs a youtube video
|
44 |
***/
|
@@ -50,7 +50,7 @@
|
|
50 |
</div>';
|
51 |
return $value;
|
52 |
}
|
53 |
-
|
54 |
/***
|
55 |
*** @outputs a vimeo video
|
56 |
***/
|
@@ -62,7 +62,7 @@
|
|
62 |
</div>';
|
63 |
return $value;
|
64 |
}
|
65 |
-
|
66 |
/***
|
67 |
*** @outputs a google map
|
68 |
***/
|
@@ -73,7 +73,7 @@
|
|
73 |
</div>';
|
74 |
return $value;
|
75 |
}
|
76 |
-
|
77 |
/***
|
78 |
*** @user's registration date
|
79 |
***/
|
@@ -83,7 +83,7 @@
|
|
83 |
$value = sprintf(__('Joined %s','ultimatemember'), date_i18n('F d, Y', $value) );
|
84 |
return $value;
|
85 |
}
|
86 |
-
|
87 |
/***
|
88 |
*** @last login date
|
89 |
***/
|
@@ -92,7 +92,7 @@
|
|
92 |
$value = sprintf( __('Last login: %s','ultimatemember'), um_user_last_login( um_user('ID') ) );
|
93 |
return $value;
|
94 |
}
|
95 |
-
|
96 |
/***
|
97 |
*** @urls in description
|
98 |
***/
|
@@ -100,17 +100,17 @@
|
|
100 |
add_filter('um_profile_field_filter_hook__textarea', 'um_profile_field_filter_hook__description', 99, 2);
|
101 |
function um_profile_field_filter_hook__description( $value, $data ) {
|
102 |
global $ultimatemember;
|
103 |
-
|
104 |
if ( isset( $data ) && isset( $data['html'] ) && $data['html'] == 1 )
|
105 |
return $value;
|
106 |
-
|
107 |
$value = preg_replace('$(https?://[a-z0-9_./?=&#-]+)(?![^<>]*>)$i', ' <a href="$1" target="_blank">$1</a> ', $value." ");
|
108 |
$value = preg_replace('$(www\.[a-z0-9_./?=&#-]+)(?![^<>]*>)$i', '<a target="_blank" href="http://$1">$1</a> ', $value." ");
|
109 |
$value = wpautop($value);
|
110 |
|
111 |
return $value;
|
112 |
}
|
113 |
-
|
114 |
/***
|
115 |
*** @time
|
116 |
***/
|
@@ -123,7 +123,7 @@
|
|
123 |
$value = str_replace('pm', 'p.m.', $value );
|
124 |
return $value;
|
125 |
}
|
126 |
-
|
127 |
/***
|
128 |
*** @date
|
129 |
***/
|
@@ -136,17 +136,17 @@
|
|
136 |
} else {
|
137 |
$value = $ultimatemember->datetime->format( $value, $data['format'] );
|
138 |
}
|
139 |
-
|
140 |
return $value;
|
141 |
}
|
142 |
-
|
143 |
/***
|
144 |
*** @file
|
145 |
***/
|
146 |
add_filter('um_profile_field_filter_hook__file', 'um_profile_field_filter_hook__file', 99, 2);
|
147 |
function um_profile_field_filter_hook__file( $value, $data ) {
|
148 |
global $ultimatemember;
|
149 |
-
|
150 |
$uri = um_user_uploads_uri() . $value;
|
151 |
$extension = pathinfo( $uri, PATHINFO_EXTENSION);
|
152 |
|
@@ -162,28 +162,31 @@
|
|
162 |
</div>
|
163 |
</div>';
|
164 |
}
|
165 |
-
|
166 |
return $value;
|
167 |
}
|
168 |
-
|
169 |
/***
|
170 |
*** @image
|
171 |
***/
|
172 |
add_filter('um_profile_field_filter_hook__image', 'um_profile_field_filter_hook__image', 99, 2);
|
173 |
function um_profile_field_filter_hook__image( $value, $data ) {
|
174 |
-
|
175 |
$uri = um_user_uploads_uri() . $value;
|
176 |
$title = ( isset( $data['title'] ) ) ? $data['title'] : __('Untitled photo');
|
177 |
-
|
178 |
-
if
|
|
|
|
|
|
|
|
|
179 |
$value = '<div class="um-photo"><a href="#" class="um-photo-modal" data-src="'.$uri.'"><img src="'. $uri .'" alt="'.$title.'" title="'.$title.'" class="" /></a></div>';
|
180 |
} else {
|
181 |
$value = '';
|
182 |
}
|
183 |
-
|
184 |
return $value;
|
185 |
}
|
186 |
-
|
187 |
/***
|
188 |
*** @global
|
189 |
***/
|
@@ -197,8 +200,8 @@
|
|
197 |
$url_rel = ( isset( $data['url_rel'] ) ) ? 'rel="nofollow"' : '';
|
198 |
if( !strstr( $value, 'http' )
|
199 |
&& !strstr( $value, '://' )
|
200 |
-
&& !strstr( $value, 'www.' )
|
201 |
-
&& !strstr( $value, '.com' )
|
202 |
&& !strstr( $value, '.net' )
|
203 |
&& !strstr( $value, '.org' )
|
204 |
) {
|
@@ -209,58 +212,58 @@
|
|
209 |
if ( $data['validate'] == 'linkedin_url' ) $value = 'https://linkedin.com/' . $value;
|
210 |
if ( $data['validate'] == 'skype' ) $value = $value;
|
211 |
if ( $data['validate'] == 'googleplus_url' ) $value = 'https://plus.google.com/' . $value;
|
212 |
-
if ( $data['validate'] == 'instagram_url' ) $value = 'https://instagram.com/' . $value;
|
213 |
}
|
214 |
-
|
215 |
if ( isset( $data['validate'] ) && $data['validate'] == 'skype' ) {
|
216 |
-
|
217 |
$value = $value;
|
218 |
-
|
219 |
} else {
|
220 |
-
|
221 |
if ( strpos($value, 'http://') !== 0 ) {
|
222 |
$value = 'http://' . $value;
|
223 |
}
|
224 |
$data['url_target'] = ( isset( $data['url_target'] ) ) ? $data['url_target'] : '_blank';
|
225 |
$value = '<a href="'. $value .'" title="'.$alt.'" target="'.$data['url_target'].'" ' . $url_rel . '>'.$alt.'</a>';
|
226 |
-
|
227 |
}
|
228 |
-
|
229 |
}
|
230 |
-
|
231 |
if ( !is_array( $value ) ) {
|
232 |
if ( is_email( $value ) )
|
233 |
$value = '<a href="mailto:'. $value.'" title="'.$value.'">'.$value.'</a>';
|
234 |
} else {
|
235 |
$value = implode(', ', $value);
|
236 |
}
|
237 |
-
|
238 |
$value = str_replace('https://https://','https://',$value);
|
239 |
$value = str_replace('http://https://','https://',$value);
|
240 |
$value = $ultimatemember->shortcodes->emotize( $value );
|
241 |
return $value;
|
242 |
|
243 |
}
|
244 |
-
|
245 |
/***
|
246 |
*** @get form fields
|
247 |
***/
|
248 |
add_filter('um_get_form_fields', 'um_get_form_fields', 99);
|
249 |
function um_get_form_fields( $array ) {
|
250 |
-
|
251 |
global $ultimatemember;
|
252 |
-
|
253 |
$form_id = (isset ( $ultimatemember->fields->set_id ) ) ? $ultimatemember->fields->set_id : null;
|
254 |
$mode = (isset( $ultimatemember->fields->set_mode ) ) ? $ultimatemember->fields->set_mode : null;
|
255 |
-
|
256 |
if ( $form_id && $mode ) {
|
257 |
$array = $ultimatemember->query->get_attr('custom_fields', $form_id );
|
258 |
} else {
|
259 |
$array = '';
|
260 |
}
|
261 |
-
|
262 |
return $array;
|
263 |
-
|
264 |
}
|
265 |
|
266 |
/***
|
@@ -269,14 +272,14 @@
|
|
269 |
add_filter('um_get_custom_field_array', 'um_get_custom_field_array',99,2);
|
270 |
|
271 |
function um_get_custom_field_array( $array, $fields ){
|
272 |
-
|
273 |
if( isset( $array['conditions'] ) ){
|
274 |
$found = 0;
|
275 |
for( $a = 0; $a < count( $array['conditions'] ); $a++ ){
|
276 |
if( isset( $array['conditional_value'] ) || isset( $array['conditional_value'.$a] ) ){
|
277 |
-
|
278 |
if( isset( $array['conditions'] ) && ! empty( $array['conditions'] ) ){
|
279 |
-
|
280 |
$arr_conditions = array();
|
281 |
|
282 |
foreach ($array['conditions'] as $key => $value) {
|
@@ -312,8 +315,8 @@
|
|
312 |
*/
|
313 |
add_filter('um_profile_field_filter_hook__','um_force_utf8_fields',1,10);
|
314 |
function um_force_utf8_fields( $value ){
|
315 |
-
|
316 |
-
if( ! um_get_option('um_force_utf8_strings') )
|
317 |
return $value;
|
318 |
|
319 |
$value = um_force_utf8_string( $value );
|
@@ -329,13 +332,36 @@
|
|
329 |
* @uses hook filter: um_is_selected_filter_value
|
330 |
*/
|
331 |
add_filter('um_is_selected_filter_value','um_is_selected_filter_value',1,9);
|
|
|
332 |
function um_is_selected_filter_value( $value ){
|
333 |
global $ultimatemember;
|
334 |
|
335 |
-
if( ! um_get_option('um_force_utf8_strings') )
|
336 |
return $value;
|
337 |
|
338 |
$value = um_force_utf8_string( $value );
|
339 |
-
|
340 |
return $value;
|
341 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
***/
|
6 |
add_filter('um_edit_label_all_fields', 'um_edit_label_all_fields', 10, 2);
|
7 |
function um_edit_label_all_fields( $label, $data ) {
|
8 |
+
|
9 |
$asterisk = um_get_option('form_asterisk');
|
10 |
if ( $asterisk && isset( $data['required'] ) && $data['required'] == 1 )
|
11 |
$label = $label . '<span class="um-req" title="'.__('Required','ultimatemember').'">*</span>';
|
12 |
+
|
13 |
return $label;
|
14 |
}
|
15 |
+
|
16 |
/***
|
17 |
*** @change birth date label in view
|
18 |
***/
|
21 |
$label = __('Age','ultimatemember');
|
22 |
return $label;
|
23 |
}
|
24 |
+
|
25 |
/***
|
26 |
*** @outputs a soundcloud track
|
27 |
***/
|
28 |
add_filter('um_profile_field_filter_hook__soundcloud_track', 'um_profile_field_filter_hook__soundcloud_track', 99, 2);
|
29 |
function um_profile_field_filter_hook__soundcloud_track( $value, $data ) {
|
30 |
+
|
31 |
if ( !is_numeric( $value ) ) {
|
32 |
return __('Invalid soundcloud track ID','ultimatemember');
|
33 |
}
|
34 |
+
|
35 |
$value = '<div class="um-soundcloud">
|
36 |
<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/' . $value . '&color=ff6600&auto_play=false&show_artwork=true"></iframe>
|
37 |
</div>';
|
38 |
+
|
39 |
return $value;
|
40 |
}
|
41 |
+
|
42 |
/***
|
43 |
*** @outputs a youtube video
|
44 |
***/
|
50 |
</div>';
|
51 |
return $value;
|
52 |
}
|
53 |
+
|
54 |
/***
|
55 |
*** @outputs a vimeo video
|
56 |
***/
|
62 |
</div>';
|
63 |
return $value;
|
64 |
}
|
65 |
+
|
66 |
/***
|
67 |
*** @outputs a google map
|
68 |
***/
|
73 |
</div>';
|
74 |
return $value;
|
75 |
}
|
76 |
+
|
77 |
/***
|
78 |
*** @user's registration date
|
79 |
***/
|
83 |
$value = sprintf(__('Joined %s','ultimatemember'), date_i18n('F d, Y', $value) );
|
84 |
return $value;
|
85 |
}
|
86 |
+
|
87 |
/***
|
88 |
*** @last login date
|
89 |
***/
|
92 |
$value = sprintf( __('Last login: %s','ultimatemember'), um_user_last_login( um_user('ID') ) );
|
93 |
return $value;
|
94 |
}
|
95 |
+
|
96 |
/***
|
97 |
*** @urls in description
|
98 |
***/
|
100 |
add_filter('um_profile_field_filter_hook__textarea', 'um_profile_field_filter_hook__description', 99, 2);
|
101 |
function um_profile_field_filter_hook__description( $value, $data ) {
|
102 |
global $ultimatemember;
|
103 |
+
|
104 |
if ( isset( $data ) && isset( $data['html'] ) && $data['html'] == 1 )
|
105 |
return $value;
|
106 |
+
|
107 |
$value = preg_replace('$(https?://[a-z0-9_./?=&#-]+)(?![^<>]*>)$i', ' <a href="$1" target="_blank">$1</a> ', $value." ");
|
108 |
$value = preg_replace('$(www\.[a-z0-9_./?=&#-]+)(?![^<>]*>)$i', '<a target="_blank" href="http://$1">$1</a> ', $value." ");
|
109 |
$value = wpautop($value);
|
110 |
|
111 |
return $value;
|
112 |
}
|
113 |
+
|
114 |
/***
|
115 |
*** @time
|
116 |
***/
|
123 |
$value = str_replace('pm', 'p.m.', $value );
|
124 |
return $value;
|
125 |
}
|
126 |
+
|
127 |
/***
|
128 |
*** @date
|
129 |
***/
|
136 |
} else {
|
137 |
$value = $ultimatemember->datetime->format( $value, $data['format'] );
|
138 |
}
|
139 |
+
|
140 |
return $value;
|
141 |
}
|
142 |
+
|
143 |
/***
|
144 |
*** @file
|
145 |
***/
|
146 |
add_filter('um_profile_field_filter_hook__file', 'um_profile_field_filter_hook__file', 99, 2);
|
147 |
function um_profile_field_filter_hook__file( $value, $data ) {
|
148 |
global $ultimatemember;
|
149 |
+
|
150 |
$uri = um_user_uploads_uri() . $value;
|
151 |
$extension = pathinfo( $uri, PATHINFO_EXTENSION);
|
152 |
|
162 |
</div>
|
163 |
</div>';
|
164 |
}
|
165 |
+
|
166 |
return $value;
|
167 |
}
|
168 |
+
|
169 |
/***
|
170 |
*** @image
|
171 |
***/
|
172 |
add_filter('um_profile_field_filter_hook__image', 'um_profile_field_filter_hook__image', 99, 2);
|
173 |
function um_profile_field_filter_hook__image( $value, $data ) {
|
|
|
174 |
$uri = um_user_uploads_uri() . $value;
|
175 |
$title = ( isset( $data['title'] ) ) ? $data['title'] : __('Untitled photo');
|
176 |
+
|
177 |
+
// if value is an image tag
|
178 |
+
if( preg_match( '/\<img.*src=\"([^"]+).*/', $value, $matches ) ) {
|
179 |
+
$uri = $matches[1];
|
180 |
+
$value = '<div class="um-photo"><a href="#" class="um-photo-modal" data-src="'.$uri.'"><img src="'. $uri .'" alt="'.$title.'" title="'.$title.'" class="" /></a></div>';
|
181 |
+
} else if ( file_exists( um_user_uploads_dir() . $value ) ) {
|
182 |
$value = '<div class="um-photo"><a href="#" class="um-photo-modal" data-src="'.$uri.'"><img src="'. $uri .'" alt="'.$title.'" title="'.$title.'" class="" /></a></div>';
|
183 |
} else {
|
184 |
$value = '';
|
185 |
}
|
186 |
+
|
187 |
return $value;
|
188 |
}
|
189 |
+
|
190 |
/***
|
191 |
*** @global
|
192 |
***/
|
200 |
$url_rel = ( isset( $data['url_rel'] ) ) ? 'rel="nofollow"' : '';
|
201 |
if( !strstr( $value, 'http' )
|
202 |
&& !strstr( $value, '://' )
|
203 |
+
&& !strstr( $value, 'www.' )
|
204 |
+
&& !strstr( $value, '.com' )
|
205 |
&& !strstr( $value, '.net' )
|
206 |
&& !strstr( $value, '.org' )
|
207 |
) {
|
212 |
if ( $data['validate'] == 'linkedin_url' ) $value = 'https://linkedin.com/' . $value;
|
213 |
if ( $data['validate'] == 'skype' ) $value = $value;
|
214 |
if ( $data['validate'] == 'googleplus_url' ) $value = 'https://plus.google.com/' . $value;
|
215 |
+
if ( $data['validate'] == 'instagram_url' ) $value = 'https://instagram.com/' . $value;
|
216 |
}
|
217 |
+
|
218 |
if ( isset( $data['validate'] ) && $data['validate'] == 'skype' ) {
|
219 |
+
|
220 |
$value = $value;
|
221 |
+
|
222 |
} else {
|
223 |
+
|
224 |
if ( strpos($value, 'http://') !== 0 ) {
|
225 |
$value = 'http://' . $value;
|
226 |
}
|
227 |
$data['url_target'] = ( isset( $data['url_target'] ) ) ? $data['url_target'] : '_blank';
|
228 |
$value = '<a href="'. $value .'" title="'.$alt.'" target="'.$data['url_target'].'" ' . $url_rel . '>'.$alt.'</a>';
|
229 |
+
|
230 |
}
|
231 |
+
|
232 |
}
|
233 |
+
|
234 |
if ( !is_array( $value ) ) {
|
235 |
if ( is_email( $value ) )
|
236 |
$value = '<a href="mailto:'. $value.'" title="'.$value.'">'.$value.'</a>';
|
237 |
} else {
|
238 |
$value = implode(', ', $value);
|
239 |
}
|
240 |
+
|
241 |
$value = str_replace('https://https://','https://',$value);
|
242 |
$value = str_replace('http://https://','https://',$value);
|
243 |
$value = $ultimatemember->shortcodes->emotize( $value );
|
244 |
return $value;
|
245 |
|
246 |
}
|
247 |
+
|
248 |
/***
|
249 |
*** @get form fields
|
250 |
***/
|
251 |
add_filter('um_get_form_fields', 'um_get_form_fields', 99);
|
252 |
function um_get_form_fields( $array ) {
|
253 |
+
|
254 |
global $ultimatemember;
|
255 |
+
|
256 |
$form_id = (isset ( $ultimatemember->fields->set_id ) ) ? $ultimatemember->fields->set_id : null;
|
257 |
$mode = (isset( $ultimatemember->fields->set_mode ) ) ? $ultimatemember->fields->set_mode : null;
|
258 |
+
|
259 |
if ( $form_id && $mode ) {
|
260 |
$array = $ultimatemember->query->get_attr('custom_fields', $form_id );
|
261 |
} else {
|
262 |
$array = '';
|
263 |
}
|
264 |
+
|
265 |
return $array;
|
266 |
+
|
267 |
}
|
268 |
|
269 |
/***
|
272 |
add_filter('um_get_custom_field_array', 'um_get_custom_field_array',99,2);
|
273 |
|
274 |
function um_get_custom_field_array( $array, $fields ){
|
275 |
+
|
276 |
if( isset( $array['conditions'] ) ){
|
277 |
$found = 0;
|
278 |
for( $a = 0; $a < count( $array['conditions'] ); $a++ ){
|
279 |
if( isset( $array['conditional_value'] ) || isset( $array['conditional_value'.$a] ) ){
|
280 |
+
|
281 |
if( isset( $array['conditions'] ) && ! empty( $array['conditions'] ) ){
|
282 |
+
|
283 |
$arr_conditions = array();
|
284 |
|
285 |
foreach ($array['conditions'] as $key => $value) {
|
315 |
*/
|
316 |
add_filter('um_profile_field_filter_hook__','um_force_utf8_fields',1,10);
|
317 |
function um_force_utf8_fields( $value ){
|
318 |
+
|
319 |
+
if( ! um_get_option('um_force_utf8_strings') )
|
320 |
return $value;
|
321 |
|
322 |
$value = um_force_utf8_string( $value );
|
332 |
* @uses hook filter: um_is_selected_filter_value
|
333 |
*/
|
334 |
add_filter('um_is_selected_filter_value','um_is_selected_filter_value',1,9);
|
335 |
+
add_filter('um_select_dropdown_dynamic_option_value','um_is_selected_filter_value',1,10);
|
336 |
function um_is_selected_filter_value( $value ){
|
337 |
global $ultimatemember;
|
338 |
|
339 |
+
if( ! um_get_option('um_force_utf8_strings') )
|
340 |
return $value;
|
341 |
|
342 |
$value = um_force_utf8_string( $value );
|
343 |
+
|
344 |
return $value;
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Filter select dropdown to use UTF-8 encoding
|
349 |
+
* @param array $options
|
350 |
+
* @param array $data
|
351 |
+
* @return $options
|
352 |
+
* @uses hook filter: um_select_dropdown_dynamic_options
|
353 |
+
*/
|
354 |
+
add_filter('um_select_dropdown_dynamic_options','um_select_dropdown_dynamic_options_to_utf8',2,10);
|
355 |
+
function um_select_dropdown_dynamic_options_to_utf8( $options, $data ){
|
356 |
+
global $ultimatemember;
|
357 |
+
|
358 |
+
if( ! um_get_option('um_force_utf8_strings') )
|
359 |
+
return $options;
|
360 |
+
|
361 |
+
foreach ( $options as $key => $value ) {
|
362 |
+
$options[ $key ] = um_force_utf8_string( $value );
|
363 |
+
|
364 |
+
}
|
365 |
+
|
366 |
+
return $options;
|
367 |
+
}
|
core/um-filters-language.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter("um_localize_permalink_filter","um_localize_permalink_filter",10,3);
|
4 |
+
function um_localize_permalink_filter( $core_pages, $page_id, $profile_url ){
|
5 |
+
global $ultimatemember;
|
6 |
+
|
7 |
+
if ( function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language() ) {
|
8 |
+
if ( get_the_ID() > 0 && get_post_meta( get_the_ID(), '_um_wpml_user', true ) == 1 ) {
|
9 |
+
$profile_url = get_permalink( get_the_ID() );
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
// WPML compatibility
|
14 |
+
if ( function_exists('icl_object_id') ) {
|
15 |
+
$language_code = ICL_LANGUAGE_CODE;
|
16 |
+
$lang_post_id = icl_object_id( $page_id , 'page', true, $language_code );
|
17 |
+
|
18 |
+
if($lang_post_id != 0) {
|
19 |
+
$profile_url = get_permalink( $lang_post_id );
|
20 |
+
}else {
|
21 |
+
// No page found, it's most likely the homepage
|
22 |
+
global $sitepress;
|
23 |
+
$profile_url = $sitepress->language_url( $language_code );
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
return $profile_url;
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
add_filter('um_core_page_id_filter','um_core_page_id_filter');
|
33 |
+
function um_core_page_id_filter( $page_id ){
|
34 |
+
|
35 |
+
return $page_id;
|
36 |
+
}
|
core/um-filters-members.php
CHANGED
@@ -16,14 +16,14 @@
|
|
16 |
extract( $args );
|
17 |
|
18 |
$query = $ultimatemember->permalinks->get_query_array();
|
19 |
-
|
20 |
foreach( $ultimatemember->members->core_search_fields as $key ) {
|
21 |
-
|
22 |
if ( isset( $query[$key] ) && ! empty( $query[$key] ) ) {
|
23 |
$query_args['search'] = '*' . trim($query[$key]) . '*';
|
24 |
}
|
25 |
}
|
26 |
-
|
27 |
return $query_args;
|
28 |
}
|
29 |
|
@@ -66,6 +66,12 @@
|
|
66 |
|
67 |
$query = $ultimatemember->permalinks->get_query_array();
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
if ( $query && is_array( $query ) ) {
|
70 |
foreach( $query as $field => $value ) {
|
71 |
|
@@ -147,7 +153,7 @@
|
|
147 |
'value' => '',
|
148 |
'compare' => '!='
|
149 |
)
|
150 |
-
|
151 |
);
|
152 |
}
|
153 |
|
@@ -229,6 +235,17 @@
|
|
229 |
return $query_args;
|
230 |
}
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
/***
|
233 |
*** @hook in the member results array
|
234 |
***/
|
16 |
extract( $args );
|
17 |
|
18 |
$query = $ultimatemember->permalinks->get_query_array();
|
19 |
+
|
20 |
foreach( $ultimatemember->members->core_search_fields as $key ) {
|
21 |
+
|
22 |
if ( isset( $query[$key] ) && ! empty( $query[$key] ) ) {
|
23 |
$query_args['search'] = '*' . trim($query[$key]) . '*';
|
24 |
}
|
25 |
}
|
26 |
+
|
27 |
return $query_args;
|
28 |
}
|
29 |
|
66 |
|
67 |
$query = $ultimatemember->permalinks->get_query_array();
|
68 |
|
69 |
+
// if searching
|
70 |
+
if( isset( $query['search'] ) ) {
|
71 |
+
$query_args['search'] = '*' . um_filter_search( $query['search'] ) . '*';
|
72 |
+
unset( $query['search'] );
|
73 |
+
}
|
74 |
+
|
75 |
if ( $query && is_array( $query ) ) {
|
76 |
foreach( $query as $field => $value ) {
|
77 |
|
153 |
'value' => '',
|
154 |
'compare' => '!='
|
155 |
)
|
156 |
+
|
157 |
);
|
158 |
}
|
159 |
|
235 |
return $query_args;
|
236 |
}
|
237 |
|
238 |
+
/***
|
239 |
+
*** @sorting random
|
240 |
+
***/
|
241 |
+
add_filter('pre_user_query', function($query) {
|
242 |
+
if($query->query_vars["orderby"] == 'random') {
|
243 |
+
$query->query_orderby = 'ORDER by RAND()';
|
244 |
+
}
|
245 |
+
|
246 |
+
return $query;
|
247 |
+
});
|
248 |
+
|
249 |
/***
|
250 |
*** @hook in the member results array
|
251 |
***/
|
core/um-filters-user.php
CHANGED
@@ -80,13 +80,124 @@
|
|
80 |
*/
|
81 |
add_filter('um_clean_user_basename_filter','um_clean_user_basename_filter',2,10);
|
82 |
function um_clean_user_basename_filter( $value, $raw ){
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
|
89 |
return $value;
|
90 |
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
*/
|
81 |
add_filter('um_clean_user_basename_filter','um_clean_user_basename_filter',2,10);
|
82 |
function um_clean_user_basename_filter( $value, $raw ){
|
83 |
+
global $wpdb;
|
84 |
+
|
85 |
+
$permalink_base = um_get_option('permalink_base');
|
86 |
+
$user_query = new WP_User_Query(
|
87 |
+
array(
|
88 |
+
'meta_query' => array(
|
89 |
+
'relation' => 'AND',
|
90 |
+
array(
|
91 |
+
'key' => 'um_user_profile_url_slug_name_'.$raw,
|
92 |
+
),
|
93 |
+
array(
|
94 |
+
'key' => 'account_status',
|
95 |
+
'value' => 'awaiting_admin_review',
|
96 |
+
'compare' => '!='
|
97 |
+
)
|
98 |
+
)
|
99 |
+
)
|
100 |
+
|
101 |
+
);
|
102 |
+
$result = current( $user_query->get_results() );
|
103 |
+
$slugname = '';
|
104 |
+
|
105 |
+
if( isset( $result->data->ID ) ){
|
106 |
+
$slugname = get_user_meta( $result->data->ID, 'um_user_profile_url_slug_name_'.$raw, true );
|
107 |
+
$value = $slugname;
|
108 |
+
}
|
109 |
+
|
110 |
+
$value = apply_filters("um_permalink_base_before_filter", $value );
|
111 |
+
$raw_value = $value;
|
112 |
+
|
113 |
+
switch( $permalink_base ){
|
114 |
+
case 'name':
|
115 |
+
|
116 |
+
|
117 |
+
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
118 |
+
$value = str_replace( '_', '. ', $value );
|
119 |
+
}
|
120 |
+
|
121 |
+
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
122 |
+
$value = str_replace( '_', '-', $value );
|
123 |
+
}
|
124 |
+
|
125 |
+
if( ! empty( $value ) && strrpos( $value ,".") > -1 && strrpos( $raw_value ,"_" ) <= -1 ){
|
126 |
+
$value = str_replace( '.', ' ', $value );
|
127 |
+
}
|
128 |
+
|
129 |
+
$value = apply_filters("um_permalink_base_after_filter_name", $value, $raw_value );
|
130 |
+
|
131 |
+
break;
|
132 |
+
|
133 |
+
case 'name_dash':
|
134 |
+
|
135 |
+
if( ! empty( $value ) && strrpos( $value ,"-") > -1 ){
|
136 |
+
$value = str_replace( '-', ' ', $value );
|
137 |
+
}
|
138 |
+
|
139 |
+
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
140 |
+
$value = str_replace( '_', '-', $value );
|
141 |
+
}
|
142 |
+
|
143 |
+
// Checks if last name has a dash
|
144 |
+
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
145 |
+
$value = str_replace( '_', '-', $value );
|
146 |
+
}
|
147 |
+
|
148 |
+
$value = apply_filters("um_permalink_base_after_filter_name_dash", $value, $raw_value );
|
149 |
+
|
150 |
+
break;
|
151 |
+
|
152 |
+
|
153 |
+
case 'name_plus':
|
154 |
+
|
155 |
+
if( ! empty( $value ) && strrpos( $value ,"+") > -1 ){
|
156 |
+
$value = str_replace( '+', ' ', $value );
|
157 |
+
}
|
158 |
+
|
159 |
+
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
160 |
+
$value = str_replace( '_', '+', $value );
|
161 |
+
}
|
162 |
+
|
163 |
+
$value = apply_filters("um_permalink_base_after_filter_name_plus", $value, $raw_value );
|
164 |
+
|
165 |
+
break;
|
166 |
+
|
167 |
+
default:
|
168 |
+
|
169 |
+
// Checks if last name has a dash
|
170 |
+
if( ! empty( $value ) && strrpos( $value ,"_") > -1 && substr( $value , "_") == 1 ){
|
171 |
+
$value = str_replace( '_', '-', $value );
|
172 |
+
}
|
173 |
+
|
174 |
+
$value = apply_filters("um_permalink_base_after_filter", $value, $raw_value );
|
175 |
+
|
176 |
+
break;
|
177 |
}
|
178 |
|
179 |
return $value;
|
180 |
|
181 |
}
|
182 |
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Filter before update profile to force utf8 strings
|
186 |
+
* @param mixed $value
|
187 |
+
* @return mixed
|
188 |
+
* @uses hook filter: um_is_selected_filter_value
|
189 |
+
*/
|
190 |
+
add_filter('um_before_update_profile','um_before_update_profile',2,10);
|
191 |
+
function um_before_update_profile( $changes, $user_id ){
|
192 |
+
global $ultimatemember;
|
193 |
+
|
194 |
+
if( ! um_get_option('um_force_utf8_strings') )
|
195 |
+
return $changes;
|
196 |
+
|
197 |
+
foreach( $changes as $key => $value ) {
|
198 |
+
$changes[ $key ] = um_force_utf8_string( $value );
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
return $changes;
|
203 |
+
}
|
core/um-form.php
CHANGED
@@ -20,6 +20,20 @@ class UM_Form {
|
|
20 |
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/***
|
24 |
*** @add errors
|
25 |
***/
|
@@ -67,7 +81,7 @@ class UM_Form {
|
|
67 |
|
68 |
$this->form_id = $_POST['form_id'];
|
69 |
$this->form_status = get_post_status( $this->form_id );
|
70 |
-
|
71 |
|
72 |
if ( $this->form_status == 'publish' ) {
|
73 |
|
@@ -77,11 +91,11 @@ class UM_Form {
|
|
77 |
$this->post_form = $this->beautify( $this->post_form );
|
78 |
|
79 |
$this->form_data = $ultimatemember->query->post_data( $this->form_id );
|
80 |
-
|
81 |
$this->post_form['submitted'] = $this->post_form;
|
82 |
|
83 |
$this->post_form = array_merge( $this->form_data, $this->post_form );
|
84 |
-
|
85 |
$role = $this->assigned_role( $this->form_id );
|
86 |
|
87 |
if( $role && isset( $this->form_data['custom_fields'] ) && ! strstr( $this->form_data['custom_fields'], 'role_' ) ){ // has assigned role. Validate non-global forms
|
@@ -114,7 +128,7 @@ class UM_Form {
|
|
114 |
}
|
115 |
|
116 |
/* Continue based on form mode - pre-validation */
|
117 |
-
|
118 |
do_action('um_submit_form_errors_hook', $this->post_form );
|
119 |
|
120 |
do_action("um_submit_form_{$this->post_form['mode']}", $this->post_form );
|
@@ -171,7 +185,7 @@ class UM_Form {
|
|
171 |
function assigned_role( $post_id ){
|
172 |
|
173 |
$register_use_globals = get_post_meta( $post_id, '_um_register_use_globals', true);
|
174 |
-
|
175 |
if( $register_use_globals == 1 ){
|
176 |
$role = um_get_option('default_role');
|
177 |
}else if( $register_use_globals == 0 ){
|
20 |
|
21 |
}
|
22 |
|
23 |
+
/**
|
24 |
+
* Count the form errors.
|
25 |
+
* @return integer
|
26 |
+
*/
|
27 |
+
function count_errors() {
|
28 |
+
$errors = $this->errors;
|
29 |
+
|
30 |
+
if( $errors && is_array( $errors ) ) {
|
31 |
+
return count( $errors );
|
32 |
+
}
|
33 |
+
|
34 |
+
return 0;
|
35 |
+
}
|
36 |
+
|
37 |
/***
|
38 |
*** @add errors
|
39 |
***/
|
81 |
|
82 |
$this->form_id = $_POST['form_id'];
|
83 |
$this->form_status = get_post_status( $this->form_id );
|
84 |
+
|
85 |
|
86 |
if ( $this->form_status == 'publish' ) {
|
87 |
|
91 |
$this->post_form = $this->beautify( $this->post_form );
|
92 |
|
93 |
$this->form_data = $ultimatemember->query->post_data( $this->form_id );
|
94 |
+
|
95 |
$this->post_form['submitted'] = $this->post_form;
|
96 |
|
97 |
$this->post_form = array_merge( $this->form_data, $this->post_form );
|
98 |
+
|
99 |
$role = $this->assigned_role( $this->form_id );
|
100 |
|
101 |
if( $role && isset( $this->form_data['custom_fields'] ) && ! strstr( $this->form_data['custom_fields'], 'role_' ) ){ // has assigned role. Validate non-global forms
|
128 |
}
|
129 |
|
130 |
/* Continue based on form mode - pre-validation */
|
131 |
+
|
132 |
do_action('um_submit_form_errors_hook', $this->post_form );
|
133 |
|
134 |
do_action("um_submit_form_{$this->post_form['mode']}", $this->post_form );
|
185 |
function assigned_role( $post_id ){
|
186 |
|
187 |
$register_use_globals = get_post_meta( $post_id, '_um_register_use_globals', true);
|
188 |
+
|
189 |
if( $register_use_globals == 1 ){
|
190 |
$role = um_get_option('default_role');
|
191 |
}else if( $register_use_globals == 0 ){
|
core/um-mail.php
CHANGED
@@ -40,7 +40,7 @@ class UM_Mail {
|
|
40 |
$lang = get_locale();
|
41 |
$arr_english_lang = array('en','en_US','en_NZ','en_ZA','en_AU','en_GB');
|
42 |
|
43 |
-
if( in_array( $lang, $arr_english_lang ) || strpos( $lang , 'en_' ) > -1 ){
|
44 |
$lang = '';
|
45 |
} else {
|
46 |
$lang .= '/';
|
40 |
$lang = get_locale();
|
41 |
$arr_english_lang = array('en','en_US','en_NZ','en_ZA','en_AU','en_GB');
|
42 |
|
43 |
+
if( in_array( $lang, $arr_english_lang ) || strpos( $lang , 'en_' ) > -1 || empty( $lang ) || $lang == 0 ){
|
44 |
$lang = '';
|
45 |
} else {
|
46 |
$lang .= '/';
|
core/um-members.php
CHANGED
@@ -78,11 +78,15 @@ class UM_Members {
|
|
78 |
$type = 'select';
|
79 |
} else if ( 'user_tags' == $attrs['type'] ) {
|
80 |
$attrs['options'] = apply_filters('um_multiselect_options_user_tags', array(), $attrs);
|
|
|
81 |
$type = 'select';
|
82 |
} else {
|
83 |
$type = 'text';
|
84 |
}
|
85 |
|
|
|
|
|
|
|
86 |
switch( $type ) {
|
87 |
|
88 |
case 'select':
|
@@ -143,7 +147,7 @@ class UM_Members {
|
|
143 |
$query_args = array();
|
144 |
$query_args = apply_filters( 'um_prepare_user_query_args', $query_args, $args );
|
145 |
$users = new WP_User_Query( $query_args );
|
146 |
-
|
147 |
// number of profiles for mobile
|
148 |
if ( $ultimatemember->mobile->isMobile() && isset( $profiles_per_page_mobile ) )
|
149 |
$profiles_per_page = $profiles_per_page_mobile;
|
78 |
$type = 'select';
|
79 |
} else if ( 'user_tags' == $attrs['type'] ) {
|
80 |
$attrs['options'] = apply_filters('um_multiselect_options_user_tags', array(), $attrs);
|
81 |
+
$attrs['custom'] = 1;
|
82 |
$type = 'select';
|
83 |
} else {
|
84 |
$type = 'text';
|
85 |
}
|
86 |
|
87 |
+
// filter all search fields
|
88 |
+
$attrs = apply_filters( 'um_search_fields', $attrs );
|
89 |
+
|
90 |
switch( $type ) {
|
91 |
|
92 |
case 'select':
|
147 |
$query_args = array();
|
148 |
$query_args = apply_filters( 'um_prepare_user_query_args', $query_args, $args );
|
149 |
$users = new WP_User_Query( $query_args );
|
150 |
+
|
151 |
// number of profiles for mobile
|
152 |
if ( $ultimatemember->mobile->isMobile() && isset( $profiles_per_page_mobile ) )
|
153 |
$profiles_per_page = $profiles_per_page_mobile;
|
core/um-permalinks.php
CHANGED
@@ -191,27 +191,9 @@ class UM_Permalinks {
|
|
191 |
$page_id = $this->core['user'];
|
192 |
$profile_url = get_permalink( $page_id );
|
193 |
|
194 |
-
if ( function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language() ) {
|
195 |
-
if ( get_the_ID() > 0 && get_post_meta( get_the_ID(), '_um_wpml_user', true ) == 1 ) {
|
196 |
-
$profile_url = get_permalink( get_the_ID() );
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
// WPML compatibility
|
201 |
-
if ( function_exists('icl_object_id') ) {
|
202 |
|
|
|
203 |
|
204 |
-
$language_code = ICL_LANGUAGE_CODE;
|
205 |
-
$lang_post_id = icl_object_id( $page_id , 'page', true, $language_code );
|
206 |
-
|
207 |
-
if($lang_post_id != 0) {
|
208 |
-
$profile_url = get_permalink( $lang_post_id );
|
209 |
-
}else {
|
210 |
-
// No page found, it's most likely the homepage
|
211 |
-
global $sitepress;
|
212 |
-
$profile_url = $sitepress->language_url( $language );
|
213 |
-
}
|
214 |
-
}
|
215 |
|
216 |
if ( um_get_option('permalink_base') == 'user_login' ) {
|
217 |
$user_in_url = um_user('user_login');
|
@@ -239,11 +221,10 @@ class UM_Permalinks {
|
|
239 |
{
|
240 |
$full_name = um_user( 'full_name' );
|
241 |
$last_name = um_user( 'last_name' );
|
242 |
-
$
|
|
|
|
|
243 |
|
244 |
-
if( strpos( $last_name, '-') > -1 && strpos( $full_name, '-' ) > -1 ){
|
245 |
-
$full_name = str_replace('-', '_', $full_name );
|
246 |
-
}
|
247 |
|
248 |
if( $count > 1 )
|
249 |
{
|
@@ -252,16 +233,119 @@ class UM_Permalinks {
|
|
252 |
|
253 |
switch( um_get_option('permalink_base') )
|
254 |
{
|
255 |
-
case 'name':
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
break;
|
258 |
-
|
259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
break;
|
261 |
-
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
break;
|
264 |
}
|
|
|
|
|
265 |
}
|
266 |
|
267 |
if ( get_option('permalink_structure') ) {
|
191 |
$page_id = $this->core['user'];
|
192 |
$profile_url = get_permalink( $page_id );
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
+
$profile_url = apply_filters('um_localize_permalink_filter', $this->core, $page_id, $profile_url );
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
if ( um_get_option('permalink_base') == 'user_login' ) {
|
199 |
$user_in_url = um_user('user_login');
|
221 |
{
|
222 |
$full_name = um_user( 'full_name' );
|
223 |
$last_name = um_user( 'last_name' );
|
224 |
+
$first_name = um_user( 'first_name' );
|
225 |
+
|
226 |
+
$count = intval( um_is_meta_value_exists( 'full_name', $full_name ) );
|
227 |
|
|
|
|
|
|
|
228 |
|
229 |
if( $count > 1 )
|
230 |
{
|
233 |
|
234 |
switch( um_get_option('permalink_base') )
|
235 |
{
|
236 |
+
case 'name': // dotted
|
237 |
+
|
238 |
+
$full_name_slug = $full_name;
|
239 |
+
$difficulties = 0;
|
240 |
+
|
241 |
+
|
242 |
+
if( strpos( $full_name, '.' ) > -1 ){
|
243 |
+
$full_name = str_replace(".", "_", $full_name );
|
244 |
+
$difficulties++;
|
245 |
+
}
|
246 |
+
|
247 |
+
$full_name = strtolower( str_replace( " ", ".", $full_name ) );
|
248 |
+
|
249 |
+
if( strpos( $full_name, '_.' ) > -1 ){
|
250 |
+
$full_name = str_replace('_.', '_', $full_name );
|
251 |
+
$difficulties++;
|
252 |
+
}
|
253 |
+
|
254 |
+
$full_name_slug = str_replace( '-' , '.', $full_name_slug );
|
255 |
+
$full_name_slug = str_replace( ' ' , '.', $full_name_slug );
|
256 |
+
$full_name_slug = str_replace( '..' , '.', $full_name_slug );
|
257 |
+
|
258 |
+
if( strpos( $full_name, '.' ) > -1 ){
|
259 |
+
$full_name = str_replace('.', ' ', $full_name );
|
260 |
+
$difficulties++;
|
261 |
+
}
|
262 |
+
|
263 |
+
|
264 |
+
if( $difficulties > 0 ){
|
265 |
+
update_user_meta( um_user('ID'), 'um_user_profile_url_slug_name_'.$full_name_slug, $full_name );
|
266 |
+
}
|
267 |
+
|
268 |
+
|
269 |
+
$user_in_url = rawurlencode( $full_name_slug );
|
270 |
+
|
271 |
break;
|
272 |
+
|
273 |
+
case 'name_dash': // dashed
|
274 |
+
|
275 |
+
$difficulties = 0;
|
276 |
+
|
277 |
+
$full_name_slug = strtolower( $full_name );
|
278 |
+
|
279 |
+
// if last name has dashed replace with underscore
|
280 |
+
if( strpos( $last_name, '-') > -1 && strpos( $full_name, '-' ) > -1 ){
|
281 |
+
$difficulties++;
|
282 |
+
$full_name = str_replace('-', '_', $full_name );
|
283 |
+
}
|
284 |
+
// if first name has dashed replace with underscore
|
285 |
+
if( strpos( $first_name, '-') > -1 && strpos( $full_name, '-' ) > -1 ){
|
286 |
+
$difficulties++;
|
287 |
+
$full_name = str_replace('-', '_', $full_name );
|
288 |
+
}
|
289 |
+
// if name has space, replace with dash
|
290 |
+
$full_name_slug = str_replace( ' ' , '-', $full_name_slug );
|
291 |
+
|
292 |
+
// if name has period
|
293 |
+
if( strpos( $last_name, '.') > -1 && strpos( $full_name, '.' ) > -1 ){
|
294 |
+
$difficulties++;
|
295 |
+
}
|
296 |
+
|
297 |
+
$full_name_slug = str_replace( '.' , '-', $full_name_slug );
|
298 |
+
$full_name_slug = str_replace( '--' , '-', $full_name_slug );
|
299 |
+
|
300 |
+
if( $difficulties > 0 ){
|
301 |
+
update_user_meta( um_user('ID'), 'um_user_profile_url_slug_name_'.$full_name_slug, $full_name );
|
302 |
+
}
|
303 |
+
|
304 |
+
$user_in_url = rawurlencode( $full_name_slug );
|
305 |
+
|
306 |
break;
|
307 |
+
|
308 |
+
case 'name_plus': // plus
|
309 |
+
|
310 |
+
$difficulties = 0;
|
311 |
+
|
312 |
+
$full_name_slug = strtolower( $full_name );
|
313 |
+
|
314 |
+
// if last name has dashed replace with underscore
|
315 |
+
if( strpos( $last_name, '+') > -1 && strpos( $full_name, '+' ) > -1 ){
|
316 |
+
$difficulties++;
|
317 |
+
$full_name = str_replace('-', '_', $full_name );
|
318 |
+
}
|
319 |
+
// if first name has dashed replace with underscore
|
320 |
+
if( strpos( $first_name, '+') > -1 && strpos( $full_name, '+' ) > -1 ){
|
321 |
+
$difficulties++;
|
322 |
+
$full_name = str_replace('-', '_', $full_name );
|
323 |
+
}
|
324 |
+
if( strpos( $last_name, '-') > -1 || strpos( $first_name, '-') > -1 || strpos( $full_name, '-') > -1 ){
|
325 |
+
$difficulties++;
|
326 |
+
}
|
327 |
+
// if name has space, replace with dash
|
328 |
+
$full_name_slug = str_replace( ' ' , '+', $full_name_slug );
|
329 |
+
$full_name_slug = str_replace( '-' , '+', $full_name_slug );
|
330 |
+
|
331 |
+
// if name has period
|
332 |
+
if( strpos( $last_name, '.') > -1 && strpos( $full_name, '.' ) > -1 ){
|
333 |
+
$difficulties++;
|
334 |
+
}
|
335 |
+
|
336 |
+
$full_name_slug = str_replace( '.' , '+', $full_name_slug );
|
337 |
+
$full_name_slug = str_replace( '++' , '+', $full_name_slug );
|
338 |
+
|
339 |
+
if( $difficulties > 0 ){
|
340 |
+
update_user_meta( um_user('ID'), 'um_user_profile_url_slug_name_'.$full_name_slug, $full_name );
|
341 |
+
}
|
342 |
+
|
343 |
+
$user_in_url = $full_name_slug;
|
344 |
+
|
345 |
break;
|
346 |
}
|
347 |
+
|
348 |
+
|
349 |
}
|
350 |
|
351 |
if ( get_option('permalink_structure') ) {
|
core/um-profile.php
CHANGED
@@ -3,19 +3,30 @@
|
|
3 |
class UM_Profile {
|
4 |
|
5 |
function __construct() {
|
6 |
-
|
7 |
add_action('template_redirect', array(&$this, 'active_tab'), 10002);
|
8 |
add_action('template_redirect', array(&$this, 'active_subnav'), 10002);
|
9 |
-
|
10 |
}
|
11 |
-
|
12 |
/***
|
13 |
*** @all tab data
|
14 |
***/
|
15 |
function tabs(){
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
-
|
19 |
/***
|
20 |
*** @tabs that are active
|
21 |
***/
|
@@ -27,7 +38,7 @@ class UM_Profile {
|
|
27 |
}
|
28 |
return $tabs;
|
29 |
}
|
30 |
-
|
31 |
/***
|
32 |
*** @primary tabs only
|
33 |
***/
|
@@ -40,7 +51,7 @@ class UM_Profile {
|
|
40 |
}
|
41 |
return $primary;
|
42 |
}
|
43 |
-
|
44 |
/***
|
45 |
*** @Activated tabs in backend
|
46 |
***/
|
@@ -55,7 +66,63 @@ class UM_Profile {
|
|
55 |
}
|
56 |
return ( isset( $primary ) ) ? $primary : '';
|
57 |
}
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/***
|
60 |
*** @Get active_tab
|
61 |
***/
|
@@ -66,53 +133,53 @@ class UM_Profile {
|
|
66 |
if ( get_query_var('profiletab') ) {
|
67 |
$this->active_tab = get_query_var('profiletab');
|
68 |
}
|
69 |
-
|
70 |
$this->active_tab = apply_filters( 'um_profile_active_tab', $this->active_tab );
|
71 |
|
72 |
return $this->active_tab;
|
73 |
}
|
74 |
-
|
75 |
/***
|
76 |
*** @Get active active_subnav
|
77 |
***/
|
78 |
function active_subnav() {
|
79 |
-
|
80 |
$this->active_subnav = null;
|
81 |
-
|
82 |
if ( get_query_var('subnav') ) {
|
83 |
$this->active_subnav = get_query_var('subnav');
|
84 |
}
|
85 |
-
|
86 |
return $this->active_subnav;
|
87 |
}
|
88 |
-
|
89 |
/***
|
90 |
*** @Show meta in profile
|
91 |
***/
|
92 |
function show_meta( $array ) {
|
93 |
global $ultimatemember;
|
94 |
$output = '';
|
95 |
-
|
96 |
foreach( $array as $key ) {
|
97 |
$data = '';
|
98 |
if ( $key && um_filtered_value( $key ) ) {
|
99 |
-
|
100 |
if ( isset( $ultimatemember->builtin->all_user_fields[$key]['icon'] ) ) {
|
101 |
$icon = $ultimatemember->builtin->all_user_fields[$key]['icon'];
|
102 |
} else {
|
103 |
$icon = '';
|
104 |
}
|
105 |
-
|
106 |
$icon = ( isset( $icon ) && !empty( $icon ) ) ? '<i class="'.$icon.'"></i>' : '';
|
107 |
-
|
108 |
if ( !um_get_option('profile_show_metaicon') )
|
109 |
$icon = '';
|
110 |
-
|
111 |
$value = um_filtered_value( $key );
|
112 |
-
|
113 |
$items[] = '<span>' . $icon . $value . '</span>';
|
114 |
$items[] = '<span class="b">•</span>';
|
115 |
-
|
116 |
}
|
117 |
}
|
118 |
|
@@ -126,4 +193,4 @@ class UM_Profile {
|
|
126 |
return $output;
|
127 |
}
|
128 |
|
129 |
-
}
|
3 |
class UM_Profile {
|
4 |
|
5 |
function __construct() {
|
6 |
+
|
7 |
add_action('template_redirect', array(&$this, 'active_tab'), 10002);
|
8 |
add_action('template_redirect', array(&$this, 'active_subnav'), 10002);
|
9 |
+
|
10 |
}
|
11 |
+
|
12 |
/***
|
13 |
*** @all tab data
|
14 |
***/
|
15 |
function tabs(){
|
16 |
+
$tabs = apply_filters('um_profile_tabs', $tabs = array() );
|
17 |
+
|
18 |
+
// disable private tabs
|
19 |
+
if( !is_admin() ) {
|
20 |
+
foreach( $tabs as $id => $tab ) {
|
21 |
+
if( !$this->can_view_tab( $id ) ) {
|
22 |
+
unset( $tabs[$id] );
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
return $tabs;
|
28 |
}
|
29 |
+
|
30 |
/***
|
31 |
*** @tabs that are active
|
32 |
***/
|
38 |
}
|
39 |
return $tabs;
|
40 |
}
|
41 |
+
|
42 |
/***
|
43 |
*** @primary tabs only
|
44 |
***/
|
51 |
}
|
52 |
return $primary;
|
53 |
}
|
54 |
+
|
55 |
/***
|
56 |
*** @Activated tabs in backend
|
57 |
***/
|
66 |
}
|
67 |
return ( isset( $primary ) ) ? $primary : '';
|
68 |
}
|
69 |
+
|
70 |
+
/***
|
71 |
+
*** @Privacy options
|
72 |
+
***/
|
73 |
+
function tabs_privacy() {
|
74 |
+
$privacy = array(
|
75 |
+
0 => 'Anyone',
|
76 |
+
1 => 'Guests only',
|
77 |
+
2 => 'Members only',
|
78 |
+
3 => 'Only the owner',
|
79 |
+
4 => 'Specific roles'
|
80 |
+
);
|
81 |
+
|
82 |
+
return $privacy;
|
83 |
+
}
|
84 |
+
|
85 |
+
/***
|
86 |
+
*** @Check if the user can view the current tab
|
87 |
+
***/
|
88 |
+
function can_view_tab( $tab ) {
|
89 |
+
global $ultimatemember;
|
90 |
+
|
91 |
+
$privacy = intval( um_get_option( 'profile_tab_' . $tab . '_privacy' ) );
|
92 |
+
$can_view = false;
|
93 |
+
|
94 |
+
switch( $privacy ) {
|
95 |
+
case 1:
|
96 |
+
$can_view = is_user_logged_in() ? false : true;
|
97 |
+
break;
|
98 |
+
|
99 |
+
case 2:
|
100 |
+
$can_view = is_user_logged_in() ? true : false;
|
101 |
+
break;
|
102 |
+
|
103 |
+
case 3:
|
104 |
+
$can_view = get_current_user_id() == um_user( 'ID' ) ? true : false;
|
105 |
+
break;
|
106 |
+
|
107 |
+
case 4:
|
108 |
+
$can_view = false;
|
109 |
+
if( is_user_logged_in() ) {
|
110 |
+
$roles = um_get_option( 'profile_tab_' . $tab . '_roles' );
|
111 |
+
if( is_array( $roles )
|
112 |
+
&& in_array( $ultimatemember->user->get_role(), $roles ) ) {
|
113 |
+
$can_view = true;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
break;
|
117 |
+
|
118 |
+
default:
|
119 |
+
$can_view = true;
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
|
123 |
+
return $can_view;
|
124 |
+
}
|
125 |
+
|
126 |
/***
|
127 |
*** @Get active_tab
|
128 |
***/
|
133 |
if ( get_query_var('profiletab') ) {
|
134 |
$this->active_tab = get_query_var('profiletab');
|
135 |
}
|
136 |
+
|
137 |
$this->active_tab = apply_filters( 'um_profile_active_tab', $this->active_tab );
|
138 |
|
139 |
return $this->active_tab;
|
140 |
}
|
141 |
+
|
142 |
/***
|
143 |
*** @Get active active_subnav
|
144 |
***/
|
145 |
function active_subnav() {
|
146 |
+
|
147 |
$this->active_subnav = null;
|
148 |
+
|
149 |
if ( get_query_var('subnav') ) {
|
150 |
$this->active_subnav = get_query_var('subnav');
|
151 |
}
|
152 |
+
|
153 |
return $this->active_subnav;
|
154 |
}
|
155 |
+
|
156 |
/***
|
157 |
*** @Show meta in profile
|
158 |
***/
|
159 |
function show_meta( $array ) {
|
160 |
global $ultimatemember;
|
161 |
$output = '';
|
162 |
+
|
163 |
foreach( $array as $key ) {
|
164 |
$data = '';
|
165 |
if ( $key && um_filtered_value( $key ) ) {
|
166 |
+
|
167 |
if ( isset( $ultimatemember->builtin->all_user_fields[$key]['icon'] ) ) {
|
168 |
$icon = $ultimatemember->builtin->all_user_fields[$key]['icon'];
|
169 |
} else {
|
170 |
$icon = '';
|
171 |
}
|
172 |
+
|
173 |
$icon = ( isset( $icon ) && !empty( $icon ) ) ? '<i class="'.$icon.'"></i>' : '';
|
174 |
+
|
175 |
if ( !um_get_option('profile_show_metaicon') )
|
176 |
$icon = '';
|
177 |
+
|
178 |
$value = um_filtered_value( $key );
|
179 |
+
|
180 |
$items[] = '<span>' . $icon . $value . '</span>';
|
181 |
$items[] = '<span class="b">•</span>';
|
182 |
+
|
183 |
}
|
184 |
}
|
185 |
|
193 |
return $output;
|
194 |
}
|
195 |
|
196 |
+
}
|
core/um-query.php
CHANGED
@@ -12,16 +12,20 @@ class UM_Query {
|
|
12 |
*** @get wp pages
|
13 |
***/
|
14 |
function wp_pages() {
|
15 |
-
$
|
|
|
|
|
16 |
|
17 |
-
if ( $count_pages
|
18 |
-
return;
|
19 |
|
20 |
-
$pages = get_pages();
|
21 |
$array = '';
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
}
|
|
|
25 |
return $array;
|
26 |
}
|
27 |
|
12 |
*** @get wp pages
|
13 |
***/
|
14 |
function wp_pages() {
|
15 |
+
global $wpdb;
|
16 |
+
$pages = $wpdb->get_results('SELECT * FROM '.$wpdb->posts.' WHERE post_type = "page" AND post_status = "publish" ', OBJECT);
|
17 |
+
$count_pages = $wpdb->num_rows;
|
18 |
|
19 |
+
if ( $count_pages > 300 )
|
20 |
+
return 'reached_maximum_limit';
|
21 |
|
|
|
22 |
$array = '';
|
23 |
+
if( $wpdb->num_rows > 0 ){
|
24 |
+
foreach ($pages as $page_data) {
|
25 |
+
$array[ $page_data->ID ] = $page_data->post_title;
|
26 |
+
}
|
27 |
}
|
28 |
+
|
29 |
return $array;
|
30 |
}
|
31 |
|
core/um-rewrite.php
CHANGED
@@ -165,6 +165,8 @@ class UM_Rewrite {
|
|
165 |
}
|
166 |
|
167 |
exit( wp_redirect( $url ) );
|
|
|
|
|
168 |
}
|
169 |
|
170 |
}
|
165 |
}
|
166 |
|
167 |
exit( wp_redirect( $url ) );
|
168 |
+
}else{
|
169 |
+
exit( wp_redirect( home_url() ) );
|
170 |
}
|
171 |
|
172 |
}
|
core/um-short-functions.php
CHANGED
@@ -54,11 +54,11 @@
|
|
54 |
*** @Get where user should be headed after logging
|
55 |
***/
|
56 |
function um_dynamic_login_page_redirect( $redirect_to = '' ) {
|
57 |
-
|
58 |
global $ultimatemember;
|
59 |
-
|
60 |
$uri = um_get_core_page( 'login' );
|
61 |
-
|
62 |
if ( ! $redirect_to ) {
|
63 |
$redirect_to = $ultimatemember->permalinks->get_current_url();
|
64 |
}
|
@@ -72,11 +72,11 @@
|
|
72 |
|
73 |
/**
|
74 |
* Set redirect key
|
75 |
-
* @param string $url
|
76 |
* @return string $redirect_key
|
77 |
*/
|
78 |
function um_set_redirect_url( $url ){
|
79 |
-
|
80 |
if( um_is_session_started() === FALSE ){
|
81 |
session_start();
|
82 |
}
|
@@ -90,17 +90,17 @@
|
|
90 |
|
91 |
/**
|
92 |
* Set redirect key
|
93 |
-
* @param string $url
|
94 |
* @return string $redirect_key
|
95 |
*/
|
96 |
function um_get_redirect_url( $key ){
|
97 |
-
|
98 |
if( um_is_session_started() === FALSE ){
|
99 |
session_start();
|
100 |
}
|
101 |
|
102 |
if( isset( $_SESSION['um_redirect_key'][ $key ] ) ){
|
103 |
-
|
104 |
$url = $_SESSION['um_redirect_key'][ $key ];
|
105 |
|
106 |
return $url;
|
@@ -126,7 +126,7 @@
|
|
126 |
* @return bool
|
127 |
*/
|
128 |
function um_is_session_started(){
|
129 |
-
|
130 |
if ( php_sapi_name() !== 'cli' ) {
|
131 |
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
|
132 |
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
|
@@ -134,7 +134,7 @@
|
|
134 |
return session_id() === '' ? FALSE : TRUE;
|
135 |
}
|
136 |
}
|
137 |
-
|
138 |
return FALSE;
|
139 |
}
|
140 |
|
@@ -145,16 +145,12 @@
|
|
145 |
function um_clean_user_basename( $value ) {
|
146 |
|
147 |
$raw_value = $value;
|
148 |
-
$value = str_replace('<hon>', '', $value);
|
149 |
-
$value = preg_replace('/^([a-z]{2,3})\./', '$1<hon>', $value);
|
150 |
-
$value = preg_replace('/([a-z]{2,3})\.$/', '$1<hon>', $value);
|
151 |
$value = str_replace('.', ' ', $value);
|
152 |
$value = str_replace('-', ' ', $value);
|
153 |
$value = str_replace('+', ' ', $value);
|
154 |
-
$value = str_replace('<hon>', '.', $value);
|
155 |
|
156 |
$value = apply_filters('um_clean_user_basename_filter', $value, $raw_value );
|
157 |
-
|
158 |
return $value;
|
159 |
}
|
160 |
/***
|
@@ -807,10 +803,15 @@ function um_reset_user() {
|
|
807 |
/***
|
808 |
*** @remove edit profile args from url
|
809 |
***/
|
810 |
-
function um_edit_my_profile_cancel_uri() {
|
811 |
-
$
|
812 |
-
|
813 |
-
|
|
|
|
|
|
|
|
|
|
|
814 |
return $url;
|
815 |
}
|
816 |
|
@@ -1191,11 +1192,12 @@ function um_fetch_user( $user_id ) {
|
|
1191 |
function um_get_cover_uri( $image, $attrs ) {
|
1192 |
global $ultimatemember;
|
1193 |
$uri = false;
|
1194 |
-
|
1195 |
-
|
|
|
1196 |
}
|
1197 |
-
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo-'
|
1198 |
-
$uri = um_user_uploads_uri() . 'cover_photo-'.$attrs.'
|
1199 |
}
|
1200 |
return $uri;
|
1201 |
}
|
@@ -1215,28 +1217,28 @@ function um_fetch_user( $user_id ) {
|
|
1215 |
global $ultimatemember;
|
1216 |
$uri = false;
|
1217 |
$find = false;
|
|
|
|
|
1218 |
|
1219 |
-
|
1220 |
-
|
1221 |
-
$uri = um_user_uploads_uri() . 'profile_photo-'.$attrs.'.jpg?' . current_time( 'timestamp' );
|
1222 |
|
1223 |
} else {
|
1224 |
|
1225 |
$sizes = um_get_option('photo_thumb_sizes');
|
1226 |
if ( is_array( $sizes ) ) $find = um_closest_num( $sizes, $attrs );
|
1227 |
|
1228 |
-
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $find
|
1229 |
|
1230 |
-
$uri = um_user_uploads_uri() . 'profile_photo-'.$find.'
|
1231 |
|
1232 |
-
} else if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo
|
1233 |
|
1234 |
-
$uri = um_user_uploads_uri() . 'profile_photo.
|
1235 |
|
1236 |
}
|
1237 |
|
1238 |
if ( $attrs == 'original' ) {
|
1239 |
-
$uri = um_user_uploads_uri() . 'profile_photo.
|
1240 |
}
|
1241 |
|
1242 |
}
|
@@ -1433,9 +1435,16 @@ function um_fetch_user( $user_id ) {
|
|
1433 |
if( um_get_option('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
|
1434 |
$avatar_uri = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
|
1435 |
$avatar_uri = add_query_arg('s',400, $avatar_uri);
|
1436 |
-
|
1437 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1438 |
}
|
|
|
1439 |
}
|
1440 |
|
1441 |
return '<img src="' . $avatar_uri . '" class="func-um_user gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
|
@@ -1482,19 +1491,30 @@ function um_fetch_user( $user_id ) {
|
|
1482 |
/**
|
1483 |
* Check if meta_value exists
|
1484 |
* @param string $key
|
1485 |
-
* @param mixed $value
|
1486 |
* @return integer
|
1487 |
*/
|
1488 |
-
function um_is_meta_value_exists( $key, $value ){
|
1489 |
global $wpdb;
|
1490 |
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1496 |
|
1497 |
-
return $count;
|
1498 |
}
|
1499 |
|
1500 |
/**
|
@@ -1509,7 +1529,7 @@ function um_fetch_user( $user_id ) {
|
|
1509 |
foreach ($value as $key => $value) {
|
1510 |
$utf8_decoded_value = utf8_decode( $value );
|
1511 |
|
1512 |
-
if( mb_check_encoding( $utf8_decoded_value, 'UTF-8') ){
|
1513 |
array_push( $arr_value, $utf8_decoded_value );
|
1514 |
}else{
|
1515 |
array_push( $arr_value, $value );
|
@@ -1521,7 +1541,7 @@ function um_fetch_user( $user_id ) {
|
|
1521 |
|
1522 |
$utf8_decoded_value = utf8_decode($value);
|
1523 |
|
1524 |
-
if( mb_check_encoding( $utf8_decoded_value, 'UTF-8') ){
|
1525 |
return $utf8_decoded_value;
|
1526 |
}
|
1527 |
}
|
@@ -1529,3 +1549,61 @@ function um_fetch_user( $user_id ) {
|
|
1529 |
return $value;
|
1530 |
|
1531 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
*** @Get where user should be headed after logging
|
55 |
***/
|
56 |
function um_dynamic_login_page_redirect( $redirect_to = '' ) {
|
57 |
+
|
58 |
global $ultimatemember;
|
59 |
+
|
60 |
$uri = um_get_core_page( 'login' );
|
61 |
+
|
62 |
if ( ! $redirect_to ) {
|
63 |
$redirect_to = $ultimatemember->permalinks->get_current_url();
|
64 |
}
|
72 |
|
73 |
/**
|
74 |
* Set redirect key
|
75 |
+
* @param string $url
|
76 |
* @return string $redirect_key
|
77 |
*/
|
78 |
function um_set_redirect_url( $url ){
|
79 |
+
|
80 |
if( um_is_session_started() === FALSE ){
|
81 |
session_start();
|
82 |
}
|
90 |
|
91 |
/**
|
92 |
* Set redirect key
|
93 |
+
* @param string $url
|
94 |
* @return string $redirect_key
|
95 |
*/
|
96 |
function um_get_redirect_url( $key ){
|
97 |
+
|
98 |
if( um_is_session_started() === FALSE ){
|
99 |
session_start();
|
100 |
}
|
101 |
|
102 |
if( isset( $_SESSION['um_redirect_key'][ $key ] ) ){
|
103 |
+
|
104 |
$url = $_SESSION['um_redirect_key'][ $key ];
|
105 |
|
106 |
return $url;
|
126 |
* @return bool
|
127 |
*/
|
128 |
function um_is_session_started(){
|
129 |
+
|
130 |
if ( php_sapi_name() !== 'cli' ) {
|
131 |
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
|
132 |
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
|
134 |
return session_id() === '' ? FALSE : TRUE;
|
135 |
}
|
136 |
}
|
137 |
+
|
138 |
return FALSE;
|
139 |
}
|
140 |
|
145 |
function um_clean_user_basename( $value ) {
|
146 |
|
147 |
$raw_value = $value;
|
|
|
|
|
|
|
148 |
$value = str_replace('.', ' ', $value);
|
149 |
$value = str_replace('-', ' ', $value);
|
150 |
$value = str_replace('+', ' ', $value);
|
|
|
151 |
|
152 |
$value = apply_filters('um_clean_user_basename_filter', $value, $raw_value );
|
153 |
+
|
154 |
return $value;
|
155 |
}
|
156 |
/***
|
803 |
/***
|
804 |
*** @remove edit profile args from url
|
805 |
***/
|
806 |
+
function um_edit_my_profile_cancel_uri( $url = '' ) {
|
807 |
+
global $ultimatemember;
|
808 |
+
|
809 |
+
if( empty( $url ) ){
|
810 |
+
$url = remove_query_arg( 'um_action' );
|
811 |
+
$url = remove_query_arg( 'profiletab', $url );
|
812 |
+
$url = add_query_arg('profiletab', 'main', $url );
|
813 |
+
}
|
814 |
+
|
815 |
return $url;
|
816 |
}
|
817 |
|
1192 |
function um_get_cover_uri( $image, $attrs ) {
|
1193 |
global $ultimatemember;
|
1194 |
$uri = false;
|
1195 |
+
$ext = '.' . pathinfo($image, PATHINFO_EXTENSION);
|
1196 |
+
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo'.$ext ) ) {
|
1197 |
+
$uri = um_user_uploads_uri() . 'cover_photo'.$ext.'?' . current_time( 'timestamp' );
|
1198 |
}
|
1199 |
+
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo-' .$attrs.$ext ) ){
|
1200 |
+
$uri = um_user_uploads_uri() . 'cover_photo-'.$attrs.$ext.'?' . current_time( 'timestamp' );
|
1201 |
}
|
1202 |
return $uri;
|
1203 |
}
|
1217 |
global $ultimatemember;
|
1218 |
$uri = false;
|
1219 |
$find = false;
|
1220 |
+
$ext = '.' . pathinfo($image, PATHINFO_EXTENSION);
|
1221 |
+
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $attrs. $ext ) ) {
|
1222 |
|
1223 |
+
$uri = um_user_uploads_uri() . 'profile_photo-'.$attrs.$ext.'?' . current_time( 'timestamp' );
|
|
|
|
|
1224 |
|
1225 |
} else {
|
1226 |
|
1227 |
$sizes = um_get_option('photo_thumb_sizes');
|
1228 |
if ( is_array( $sizes ) ) $find = um_closest_num( $sizes, $attrs );
|
1229 |
|
1230 |
+
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $find.$ext ) ) {
|
1231 |
|
1232 |
+
$uri = um_user_uploads_uri() . 'profile_photo-'.$find.$ext.'?' . current_time( 'timestamp' );
|
1233 |
|
1234 |
+
} else if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo'.$ext ) ) {
|
1235 |
|
1236 |
+
$uri = um_user_uploads_uri() . 'profile_photo'.$ext.'?' . current_time( 'timestamp' );
|
1237 |
|
1238 |
}
|
1239 |
|
1240 |
if ( $attrs == 'original' ) {
|
1241 |
+
$uri = um_user_uploads_uri() . 'profile_photo'.$ext.'?' . current_time( 'timestamp' );
|
1242 |
}
|
1243 |
|
1244 |
}
|
1435 |
if( um_get_option('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
|
1436 |
$avatar_uri = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
|
1437 |
$avatar_uri = add_query_arg('s',400, $avatar_uri);
|
1438 |
+
$gravatar_type = um_get_option('use_um_gravatar_default_builtin_image');
|
1439 |
+
|
1440 |
+
if( $gravatar_type == 'default' ){
|
1441 |
+
if( um_get_option('use_um_gravatar_default_image') ){
|
1442 |
+
$avatar_uri = add_query_arg('d', um_get_default_avatar_uri(), $avatar_uri );
|
1443 |
+
}
|
1444 |
+
}else{
|
1445 |
+
$avatar_uri = add_query_arg('d', $gravatar_type, $avatar_uri );
|
1446 |
}
|
1447 |
+
|
1448 |
}
|
1449 |
|
1450 |
return '<img src="' . $avatar_uri . '" class="func-um_user gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
|
1491 |
/**
|
1492 |
* Check if meta_value exists
|
1493 |
* @param string $key
|
1494 |
+
* @param mixed $value
|
1495 |
* @return integer
|
1496 |
*/
|
1497 |
+
function um_is_meta_value_exists( $key, $value, $return_user_id = false ){
|
1498 |
global $wpdb;
|
1499 |
|
1500 |
+
if( ! $return_user_id ){
|
1501 |
+
$count = $wpdb->get_var( $wpdb->prepare(
|
1502 |
+
"SELECT COUNT(*) as count FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value = %s ",
|
1503 |
+
$key,
|
1504 |
+
$value
|
1505 |
+
) );
|
1506 |
+
|
1507 |
+
return $count;
|
1508 |
+
}
|
1509 |
+
|
1510 |
+
$user_id = $wpdb->get_var( $wpdb->prepare(
|
1511 |
+
"SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value = %s ",
|
1512 |
+
$key,
|
1513 |
+
$value
|
1514 |
+
) );
|
1515 |
+
|
1516 |
+
return $user_id;
|
1517 |
|
|
|
1518 |
}
|
1519 |
|
1520 |
/**
|
1529 |
foreach ($value as $key => $value) {
|
1530 |
$utf8_decoded_value = utf8_decode( $value );
|
1531 |
|
1532 |
+
if( mb_check_encoding( $utf8_decoded_value, 'UTF-8') ){
|
1533 |
array_push( $arr_value, $utf8_decoded_value );
|
1534 |
}else{
|
1535 |
array_push( $arr_value, $value );
|
1541 |
|
1542 |
$utf8_decoded_value = utf8_decode($value);
|
1543 |
|
1544 |
+
if( mb_check_encoding( $utf8_decoded_value, 'UTF-8') ){
|
1545 |
return $utf8_decoded_value;
|
1546 |
}
|
1547 |
}
|
1549 |
return $value;
|
1550 |
|
1551 |
}
|
1552 |
+
|
1553 |
+
/**
|
1554 |
+
* Filters the search query.
|
1555 |
+
*
|
1556 |
+
* @param string $search
|
1557 |
+
* @return string
|
1558 |
+
*/
|
1559 |
+
function um_filter_search($search) {
|
1560 |
+
$search = trim( strip_tags( $search ) );
|
1561 |
+
$search = preg_replace('/[^a-z \.\@\_\-]+/i', '', $search);
|
1562 |
+
|
1563 |
+
return $search;
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
/**
|
1567 |
+
* Returns the user search query
|
1568 |
+
* @return string
|
1569 |
+
*/
|
1570 |
+
function um_get_search_query() {
|
1571 |
+
global $ultimatemember;
|
1572 |
+
|
1573 |
+
$query = $ultimatemember->permalinks->get_query_array();
|
1574 |
+
$search = isset( $query['search'] ) ? $query['search'] : '';
|
1575 |
+
|
1576 |
+
return um_filter_search($search);
|
1577 |
+
}
|
1578 |
+
|
1579 |
+
/**
|
1580 |
+
* Returns the ultimate member search form
|
1581 |
+
* @return string
|
1582 |
+
*/
|
1583 |
+
function um_get_search_form() {
|
1584 |
+
return do_shortcode( '[ultimatemember_searchform]' );
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
/**
|
1588 |
+
* Display the search form.
|
1589 |
+
*
|
1590 |
+
* @return string
|
1591 |
+
*/
|
1592 |
+
function um_search_form() {
|
1593 |
+
echo um_get_search_form();
|
1594 |
+
}
|
1595 |
+
|
1596 |
+
/**
|
1597 |
+
* Get localization
|
1598 |
+
* @return string
|
1599 |
+
*/
|
1600 |
+
function um_get_locale(){
|
1601 |
+
|
1602 |
+
$lang_code = get_locale();
|
1603 |
+
|
1604 |
+
if( strpos( $lang_code , 'en_' ) > -1 || empty( $lang_code ) || $lang_code == 0 ){
|
1605 |
+
return 'en';
|
1606 |
+
}
|
1607 |
+
|
1608 |
+
return $lang_code;
|
1609 |
+
}
|
core/um-shortcodes.php
CHANGED
@@ -13,6 +13,7 @@ class UM_Shortcodes {
|
|
13 |
add_shortcode('um_loggedin', array(&$this, 'um_loggedin'));
|
14 |
add_shortcode('um_loggedout', array(&$this, 'um_loggedout'));
|
15 |
add_shortcode('um_show_content', array(&$this, 'um_shortcode_show_content_for_role') );
|
|
|
16 |
|
17 |
|
18 |
add_filter('body_class', array(&$this, 'body_class'), 0);
|
@@ -415,33 +416,37 @@ class UM_Shortcodes {
|
|
415 |
$paths[] = glob(get_stylesheet_directory() . '/ultimate-member/templates/' . '*.php');
|
416 |
}
|
417 |
|
418 |
-
|
|
|
|
|
419 |
|
420 |
-
|
421 |
|
422 |
-
|
423 |
|
424 |
-
|
425 |
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
|
|
438 |
}
|
|
|
439 |
}
|
440 |
|
441 |
}
|
442 |
|
443 |
}
|
444 |
-
|
445 |
}
|
446 |
|
447 |
return $array;
|
@@ -570,4 +575,20 @@ class UM_Shortcodes {
|
|
570 |
return '';
|
571 |
}
|
572 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
}
|
13 |
add_shortcode('um_loggedin', array(&$this, 'um_loggedin'));
|
14 |
add_shortcode('um_loggedout', array(&$this, 'um_loggedout'));
|
15 |
add_shortcode('um_show_content', array(&$this, 'um_shortcode_show_content_for_role') );
|
16 |
+
add_shortcode('ultimatemember_searchform', array(&$this, 'ultimatemember_searchform') );
|
17 |
|
18 |
|
19 |
add_filter('body_class', array(&$this, 'body_class'), 0);
|
416 |
$paths[] = glob(get_stylesheet_directory() . '/ultimate-member/templates/' . '*.php');
|
417 |
}
|
418 |
|
419 |
+
if( isset( $paths ) && ! empty( $paths ) ){
|
420 |
+
|
421 |
+
foreach ($paths as $k => $files) {
|
422 |
|
423 |
+
foreach ($files as $file) {
|
424 |
|
425 |
+
$clean_filename = $this->get_template_name($file);
|
426 |
|
427 |
+
if (0 === strpos($clean_filename, $excluded)) {
|
428 |
|
429 |
+
$source = file_get_contents($file);
|
430 |
+
$tokens = token_get_all($source);
|
431 |
+
$comment = array(
|
432 |
+
T_COMMENT, // All comments since PHP5
|
433 |
+
T_DOC_COMMENT, // PHPDoc comments
|
434 |
+
);
|
435 |
+
foreach ($tokens as $token) {
|
436 |
+
if (in_array($token[0], $comment) && strstr($token[1], '/* Template:') && $clean_filename != $excluded) {
|
437 |
+
$txt = $token[1];
|
438 |
+
$txt = str_replace('/* Template: ', '', $txt);
|
439 |
+
$txt = str_replace(' */', '', $txt);
|
440 |
+
$array[$clean_filename] = $txt;
|
441 |
+
}
|
442 |
}
|
443 |
+
|
444 |
}
|
445 |
|
446 |
}
|
447 |
|
448 |
}
|
449 |
+
|
450 |
}
|
451 |
|
452 |
return $array;
|
575 |
return '';
|
576 |
}
|
577 |
|
578 |
+
public function ultimatemember_searchform($args = array(), $content = "") {
|
579 |
+
// turn off buffer
|
580 |
+
ob_start();
|
581 |
+
|
582 |
+
// load template
|
583 |
+
$this->load_template( 'searchform' );
|
584 |
+
|
585 |
+
// get the buffer
|
586 |
+
$template = ob_get_contents();
|
587 |
+
|
588 |
+
// clear the buffer
|
589 |
+
ob_end_clean();
|
590 |
+
|
591 |
+
return $template;
|
592 |
+
}
|
593 |
+
|
594 |
}
|
core/um-user.php
CHANGED
@@ -829,6 +829,8 @@ class UM_User {
|
|
829 |
|
830 |
$args['ID'] = $this->id;
|
831 |
|
|
|
|
|
832 |
// save or update profile meta
|
833 |
foreach( $changes as $key => $value ) {
|
834 |
|
@@ -891,10 +893,20 @@ class UM_User {
|
|
891 |
{
|
892 |
return $matches[0];
|
893 |
}
|
894 |
-
|
895 |
$ids = get_users(array( 'fields' => 'ID', 'meta_key' => 'full_name','meta_value' => $value ,'meta_compare' => '=') );
|
896 |
-
if ( isset( $ids[0] ) )
|
897 |
return $ids[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
898 |
return false;
|
899 |
}
|
900 |
|
@@ -925,7 +937,7 @@ class UM_User {
|
|
925 |
*
|
926 |
*/
|
927 |
function user_exists_by_id( $user_id ) {
|
928 |
-
$aux = get_userdata( $user_id );
|
929 |
if($aux==false){
|
930 |
return false;
|
931 |
} else {
|
829 |
|
830 |
$args['ID'] = $this->id;
|
831 |
|
832 |
+
$changes = apply_filters('um_before_update_profile', $changes, $this->id);
|
833 |
+
|
834 |
// save or update profile meta
|
835 |
foreach( $changes as $key => $value ) {
|
836 |
|
893 |
{
|
894 |
return $matches[0];
|
895 |
}
|
896 |
+
|
897 |
$ids = get_users(array( 'fields' => 'ID', 'meta_key' => 'full_name','meta_value' => $value ,'meta_compare' => '=') );
|
898 |
+
if ( isset( $ids[0] ) && ! empty( $ids[0] ) ){
|
899 |
return $ids[0];
|
900 |
+
}
|
901 |
+
|
902 |
+
$value = str_replace(".", "_", $value );
|
903 |
+
$value = str_replace(" ", "", $value );
|
904 |
+
|
905 |
+
$user = get_user_by( 'login', $value );
|
906 |
+
if ( isset( $user->ID ) && $user->ID > 0 ){
|
907 |
+
return $user->ID;
|
908 |
+
}
|
909 |
+
|
910 |
return false;
|
911 |
}
|
912 |
|
937 |
*
|
938 |
*/
|
939 |
function user_exists_by_id( $user_id ) {
|
940 |
+
$aux = get_userdata( intval( $user_id ) );
|
941 |
if($aux==false){
|
942 |
return false;
|
943 |
} else {
|
core/widgets/um-search-widget.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class um_search_widget extends WP_Widget {
|
4 |
+
|
5 |
+
function __construct() {
|
6 |
+
|
7 |
+
parent::__construct(
|
8 |
+
|
9 |
+
// Base ID of your widget
|
10 |
+
'um_search_widget',
|
11 |
+
|
12 |
+
// Widget name will appear in UI
|
13 |
+
__('Ultimate Member - Search', 'ultimatemember'),
|
14 |
+
|
15 |
+
// Widget description
|
16 |
+
array( 'description' => __( 'Shows users they follow in a widget.', 'ultimatemember' ), )
|
17 |
+
);
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
// Creating widget front-end
|
22 |
+
public function widget( $args, $instance ) {
|
23 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
24 |
+
|
25 |
+
// before and after widget arguments are defined by themes
|
26 |
+
echo $args['before_widget'];
|
27 |
+
if ( ! empty( $title ) ) {
|
28 |
+
echo $args['before_title'] . $title . $args['after_title'];
|
29 |
+
}
|
30 |
+
|
31 |
+
// display the search form
|
32 |
+
um_search_form();
|
33 |
+
|
34 |
+
echo $args['after_widget'];
|
35 |
+
}
|
36 |
+
|
37 |
+
// Widget Backend
|
38 |
+
public function form( $instance ) {
|
39 |
+
global $ultimatemember;
|
40 |
+
|
41 |
+
if ( isset( $instance[ 'title' ] ) ) {
|
42 |
+
$title = $instance[ 'title' ];
|
43 |
+
} else {
|
44 |
+
$title = __( 'Search Users', 'ultimatemember' );
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( isset( $instance[ 'max' ] ) ) {
|
48 |
+
$max = $instance[ 'max' ];
|
49 |
+
} else {
|
50 |
+
$max = 11;
|
51 |
+
}
|
52 |
+
|
53 |
+
// Widget admin form
|
54 |
+
?>
|
55 |
+
|
56 |
+
<p>
|
57 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
58 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
59 |
+
</p>
|
60 |
+
|
61 |
+
<?php
|
62 |
+
}
|
63 |
+
|
64 |
+
// Updating widget replacing old instances with new
|
65 |
+
public function update( $new_instance, $old_instance ) {
|
66 |
+
$instance = array();
|
67 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
68 |
+
return $instance;
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Ultimate Member
|
4 |
Plugin URI: http://ultimatemember.com/
|
5 |
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
6 |
-
Version: 1.3.
|
7 |
Author: Ultimate Member
|
8 |
Author URI: http://ultimatemember.com/
|
9 |
*/
|
@@ -15,6 +15,7 @@ Author URI: http://ultimatemember.com/
|
|
15 |
define('um_url',plugin_dir_url(__FILE__ ));
|
16 |
define('um_path',plugin_dir_path(__FILE__ ));
|
17 |
define('um_plugin', plugin_basename( __FILE__ ) );
|
|
|
18 |
|
19 |
define('ultimatemember_version', $plugin_data['Version'] );
|
20 |
|
3 |
Plugin Name: Ultimate Member
|
4 |
Plugin URI: http://ultimatemember.com/
|
5 |
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
6 |
+
Version: 1.3.47
|
7 |
Author: Ultimate Member
|
8 |
Author URI: http://ultimatemember.com/
|
9 |
*/
|
15 |
define('um_url',plugin_dir_url(__FILE__ ));
|
16 |
define('um_path',plugin_dir_path(__FILE__ ));
|
17 |
define('um_plugin', plugin_basename( __FILE__ ) );
|
18 |
+
define('UM_TEXTDOMAIN', 'ultimatemember');
|
19 |
|
20 |
define('ultimatemember_version', $plugin_data['Version'] );
|
21 |
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
|
|
7 |
Requires at least: 4.1
|
8 |
Tested up to: 4.4
|
9 |
|
10 |
-
Stable Tag: 1.3.
|
11 |
|
12 |
License: GNU Version 2 or Any Later Version
|
13 |
|
@@ -149,6 +149,37 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
|
149 |
|
150 |
== Changelog ==
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
= 1.3.44: March 11, 2016 =
|
153 |
* New: an option to force Strings to use UTF-8 encoding
|
154 |
* New: an option to change Gravatar default image
|
7 |
Requires at least: 4.1
|
8 |
Tested up to: 4.4
|
9 |
|
10 |
+
Stable Tag: 1.3.46
|
11 |
|
12 |
License: GNU Version 2 or Any Later Version
|
13 |
|
149 |
|
150 |
== Changelog ==
|
151 |
|
152 |
+
= 1.3.47: April 6, 2016 =
|
153 |
+
* Fixed: Fatal errors with language filter file
|
154 |
+
|
155 |
+
= 1.3.46: April 6, 2016 =
|
156 |
+
* Fixed: Search widget fatal error
|
157 |
+
* Fixed: image jpeg upload sizes
|
158 |
+
|
159 |
+
= 1.3.45: April 6, 2016 =
|
160 |
+
* New: support for wordfence and limit login
|
161 |
+
* New: search widget
|
162 |
+
* New: secondary email address
|
163 |
+
* Added: hook to password reset form fields
|
164 |
+
* Added: privacy options for profile menu tabs
|
165 |
+
* Added: option to allow primary email editable in profile view
|
166 |
+
* Added: member directory sort randomly
|
167 |
+
* Fixed: user page redirection
|
168 |
+
* Fixed: admin script error
|
169 |
+
* Fixed: invalid image path
|
170 |
+
* Fixed: upload image png with transparency
|
171 |
+
* Fixed: permalink basename fallback
|
172 |
+
* Fixed: casting variable and add new filter
|
173 |
+
* Fixed: remove notices
|
174 |
+
* Fixed: search users by tag
|
175 |
+
* Fixed: force UT8 encoding option
|
176 |
+
* Fixed: email content type
|
177 |
+
* Fixed: WPML compatibility
|
178 |
+
* Fixed: permalink base name format and redirect loop in profile page
|
179 |
+
* Fixed: form labels textdomain
|
180 |
+
* Fixed: edit profile redirect
|
181 |
+
* Tweak: accept period in profile url
|
182 |
+
|
183 |
= 1.3.44: March 11, 2016 =
|
184 |
* New: an option to force Strings to use UTF-8 encoding
|
185 |
* New: an option to change Gravatar default image
|
templates/searchform.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form role="search" method="get" class="search-form um-search-form" action="<?php echo esc_url( um_get_core_page( 'members' ) ); ?>">
|
2 |
+
<input type="hidden" name="um_search" value="1">
|
3 |
+
<div class="um-search-area">
|
4 |
+
<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ); ?></span>
|
5 |
+
<input type="search" class="um-search-field search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ); ?>" value="<?php echo um_get_search_query(); ?>" name="search" title="<?php echo esc_attr_x( 'Search for:', 'label' ); ?>" />
|
6 |
+
<a href="javascript: void(0);" id="um-search-button" class="um-search-icon um-faicon um-faicon-search"></a>
|
7 |
+
</div>
|
8 |
+
</form>
|
um-config.php
CHANGED
@@ -23,27 +23,31 @@ foreach( $core_pages as $page_s => $page ) {
|
|
23 |
|
24 |
$have_pages = $ultimatemember->query->wp_pages();
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
'default' => ( isset( $ultimatemember->permalinks->core[ $page_s ] ) ) ? $ultimatemember->permalinks->core[ $page_s ] : '' ,
|
33 |
-
'options' => $ultimatemember->query->wp_pages(),
|
34 |
-
'placeholder' => __('Choose a page...','ultimatemember'),
|
35 |
-
'compiler' => true,
|
36 |
-
);
|
37 |
-
}else{
|
38 |
-
$page_setup[] = array(
|
39 |
-
'id' => 'core_' . $page_s,
|
40 |
'type' => 'text',
|
41 |
'title' => $page,
|
42 |
'placeholder' => __('Add page ID','ultimatemember'),
|
43 |
-
'default' => ( isset( $ultimatemember->permalinks->core[ $
|
44 |
'compiler' => true,
|
45 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
|
|
47 |
}
|
48 |
|
49 |
$this->sections[] = array(
|
@@ -177,6 +181,26 @@ $this->sections[] = array(
|
|
177 |
'off' => __('No','ultimatemember'),
|
178 |
),
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
array(
|
181 |
'id' => 'use_um_gravatar_default_image',
|
182 |
'type' => 'switch',
|
@@ -185,7 +209,7 @@ $this->sections[] = array(
|
|
185 |
'desc' => __('Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)','ultimatemember'),
|
186 |
'on' => __('Yes','ultimatemember'),
|
187 |
'off' => __('No','ultimatemember'),
|
188 |
-
'required' => array( '
|
189 |
),
|
190 |
|
191 |
array(
|
@@ -198,6 +222,16 @@ $this->sections[] = array(
|
|
198 |
'off' => __('Off','ultimatemember'),
|
199 |
),
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
)
|
202 |
|
203 |
);
|
@@ -1594,6 +1628,30 @@ foreach( $tabs as $id => $tab ) {
|
|
1594 |
'off' => __('Off','ultimatemember'),
|
1595 |
);
|
1596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1597 |
}
|
1598 |
|
1599 |
$tab_options[] = array(
|
23 |
|
24 |
$have_pages = $ultimatemember->query->wp_pages();
|
25 |
|
26 |
+
$page_id = 'core_' . $page_s;
|
27 |
+
$page_id = apply_filters('um_core_page_id_filter', $page_id );
|
28 |
+
|
29 |
+
if( 'reached_maximum_limit' == $have_pages ){
|
30 |
+
$page_setup[] = array(
|
31 |
+
'id' => $page_id,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
'type' => 'text',
|
33 |
'title' => $page,
|
34 |
'placeholder' => __('Add page ID','ultimatemember'),
|
35 |
+
'default' => ( isset( $ultimatemember->permalinks->core[ $page_id ] ) ) ? $ultimatemember->permalinks->core[ $page_id ] : '',
|
36 |
'compiler' => true,
|
37 |
);
|
38 |
+
}else{
|
39 |
+
$page_setup[] = array(
|
40 |
+
'id' => $page_id,
|
41 |
+
'type' => 'select',
|
42 |
+
'select2' => array( 'allowClear' => 0, 'minimumResultsForSearch' => -1 ),
|
43 |
+
'title' => $page,
|
44 |
+
'default' => ( isset( $ultimatemember->permalinks->core[ $page_id ] ) ) ? $ultimatemember->permalinks->core[ $page_id ] : '' ,
|
45 |
+
'options' => $ultimatemember->query->wp_pages(),
|
46 |
+
'placeholder' => __('Choose a page...','ultimatemember'),
|
47 |
+
'compiler' => true,
|
48 |
+
);
|
49 |
}
|
50 |
+
|
51 |
}
|
52 |
|
53 |
$this->sections[] = array(
|
181 |
'off' => __('No','ultimatemember'),
|
182 |
),
|
183 |
|
184 |
+
array(
|
185 |
+
'id' => 'use_um_gravatar_default_builtin_image',
|
186 |
+
'type' => 'select',
|
187 |
+
'title' => __( 'Use Gravatar builtin image','ultimatemember' ),
|
188 |
+
'desc' => __( 'Gravatar has a number of built in options which you can also use as defaults','ultimatemember' ),
|
189 |
+
'default' => 'default',
|
190 |
+
'options' => array(
|
191 |
+
'default' => __('Default','ultimatemember'),
|
192 |
+
'404' => __('404 ( File Not Found response )','ultimatemember'),
|
193 |
+
'mm' => __('Mystery Man','ultimatemember'),
|
194 |
+
'identicon' => __('Identicon','ultimatemember'),
|
195 |
+
'monsterid' => __('Monsterid','ultimatemember'),
|
196 |
+
'wavatar' => __('Wavatar','ultimatemember'),
|
197 |
+
'retro' => __('Retro','ultimatemember'),
|
198 |
+
'blank' => __('Blank ( a transparent PNG image )','ultimatemember'),
|
199 |
+
|
200 |
+
),
|
201 |
+
'required' => array( 'use_gravatars', '=', 1 ),
|
202 |
+
'select2' => array( 'allowClear' => 0, 'minimumResultsForSearch' => -1 ),
|
203 |
+
),
|
204 |
array(
|
205 |
'id' => 'use_um_gravatar_default_image',
|
206 |
'type' => 'switch',
|
209 |
'desc' => __('Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)','ultimatemember'),
|
210 |
'on' => __('Yes','ultimatemember'),
|
211 |
'off' => __('No','ultimatemember'),
|
212 |
+
'required' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ),
|
213 |
),
|
214 |
|
215 |
array(
|
222 |
'off' => __('Off','ultimatemember'),
|
223 |
),
|
224 |
|
225 |
+
array(
|
226 |
+
'id' => 'editable_primary_email_in_profile',
|
227 |
+
'type' => 'switch',
|
228 |
+
'title' => __( 'Editable primary email field in profile view','ultimatemember' ),
|
229 |
+
'default' => 0,
|
230 |
+
'desc' => __('Allow users to edit their primary emails in profile view ( when email address field is added only )','ultimatemember'),
|
231 |
+
'on' => __('On','ultimatemember'),
|
232 |
+
'off' => __('Off','ultimatemember'),
|
233 |
+
),
|
234 |
+
|
235 |
)
|
236 |
|
237 |
);
|
1628 |
'off' => __('Off','ultimatemember'),
|
1629 |
);
|
1630 |
|
1631 |
+
$tab_options[] = array(
|
1632 |
+
'id' => 'profile_tab_' . $id . '_privacy',
|
1633 |
+
'type' => 'select',
|
1634 |
+
'select2' => array( 'allowClear' => 0, 'minimumResultsForSearch' => -1 ),
|
1635 |
+
'title' => sprintf( __( 'Who can see %s Tab?','ultimatemember' ), $tab ),
|
1636 |
+
'desc' => __( 'Select which users can view this tab.','ultimatemember' ),
|
1637 |
+
'default' => 0,
|
1638 |
+
'options' => $ultimatemember->profile->tabs_privacy(),
|
1639 |
+
'required' => array( 'profile_tab_' . $id, '=', 1 ),
|
1640 |
+
);
|
1641 |
+
|
1642 |
+
$tab_options[] = array(
|
1643 |
+
'id' => 'profile_tab_' . $id . '_roles',
|
1644 |
+
'type' => 'select',
|
1645 |
+
'multi' => true,
|
1646 |
+
'select2' => array( 'allowClear' => 1, 'minimumResultsForSearch' => -1 ),
|
1647 |
+
'title' => __( 'Allowed roles','ultimatemember' ),
|
1648 |
+
'desc' => __( 'Select the the user roles allowed to view this tab.','ultimatemember' ),
|
1649 |
+
'default' => '',
|
1650 |
+
'options' => $ultimatemember->query->get_roles(),
|
1651 |
+
'placeholder' => __( 'Choose user roles...','ultimatemember' ),
|
1652 |
+
'required' => array( 'profile_tab_' . $id . '_privacy', '=', 4 ),
|
1653 |
+
);
|
1654 |
+
|
1655 |
}
|
1656 |
|
1657 |
$tab_options[] = array(
|
um-init.php
CHANGED
@@ -58,6 +58,12 @@ class UM_API {
|
|
58 |
__('This add-on enables you to link gravatar photos to user accounts with their email address.', 'ultimatemember'),
|
59 |
);
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
/***
|
@@ -136,6 +142,7 @@ class UM_API {
|
|
136 |
require_once um_path . 'core/um-actions-modal.php';
|
137 |
require_once um_path . 'core/um-actions-misc.php';
|
138 |
|
|
|
139 |
require_once um_path . 'core/um-filters-login.php';
|
140 |
require_once um_path . 'core/um-filters-fields.php';
|
141 |
require_once um_path . 'core/um-filters-files.php';
|
@@ -198,6 +205,10 @@ class UM_API {
|
|
198 |
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
|
203 |
-
$ultimatemember = new UM_API();
|
58 |
__('This add-on enables you to link gravatar photos to user accounts with their email address.', 'ultimatemember'),
|
59 |
);
|
60 |
|
61 |
+
// include widgets
|
62 |
+
require_once um_path . 'core/widgets/um-search-widget.php';
|
63 |
+
|
64 |
+
// init widgets
|
65 |
+
add_action( 'widgets_init', array(&$this, 'widgets_init' ) );
|
66 |
+
|
67 |
}
|
68 |
|
69 |
/***
|
142 |
require_once um_path . 'core/um-actions-modal.php';
|
143 |
require_once um_path . 'core/um-actions-misc.php';
|
144 |
|
145 |
+
require_once um_path . 'core/um-filters-language.php';
|
146 |
require_once um_path . 'core/um-filters-login.php';
|
147 |
require_once um_path . 'core/um-filters-fields.php';
|
148 |
require_once um_path . 'core/um-filters-files.php';
|
205 |
|
206 |
}
|
207 |
|
208 |
+
function widgets_init() {
|
209 |
+
register_widget( 'um_search_widget' );
|
210 |
+
}
|
211 |
+
|
212 |
}
|
213 |
|
214 |
+
$ultimatemember = new UM_API();
|