- fixed dynamically declared variables inside the classes;

This commit is contained in:
Mykyta Synelnikov
2023-04-17 20:16:15 +03:00
parent 1a219ebb24
commit 034d9e8b43
22 changed files with 275 additions and 147 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
!function(){"use strict";jQuery(document).on("click","a.um-toggle-gdpr",function(e){let t=jQuery(e.currentTarget),g=t.closest(".um-field-area"),o=g.find(".um-gdpr-content");o.is(":visible")?(g.find("a.um-toggle-gdpr").text(t.data("toggle-show")),o.hide().find("a.um-toggle-gdpr").remove(),t.length&&t.get(0).scrollIntoView()):(g.find("a.um-toggle-gdpr").text(t.data("toggle-hide")),o.show().prepend(t.clone()))})}();
!function(){"use strict";jQuery(document).on("click","a.um-toggle-gdpr",function(e){var e=jQuery(e.currentTarget),t=e.closest(".um-field-area"),g=t.find(".um-gdpr-content");g.is(":visible")?(t.find("a.um-toggle-gdpr").text(e.data("toggle-show")),g.hide().find("a.um-toggle-gdpr").remove(),e.length&&e.get(0).scrollIntoView()):(t.find("a.um-toggle-gdpr").text(e.data("toggle-hide")),g.show().prepend(e.clone()))})}();
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
!function(a){function l(t,e){return"function"==typeof t?t.call(e):t}function h(t,e){this.$element=a(t),this.options=e,this.enabled=!0,this.fixTitle()}h.prototype={show:function(){var t=this.getTitle();if(t&&this.enabled){var e,i=this.tip(),s=(i.find(".tipsy-inner")[this.options.html?"html":"text"](t),i[0].className="tipsy",i.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body),a.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})),n=i[0].offsetWidth,o=i[0].offsetHeight,t=l(this.options.gravity,this.$element[0]);switch(t.charAt(0)){case"n":e={top:s.top+s.height+this.options.offset,left:s.left+s.width/2-n/2};break;case"s":e={top:s.top-o-this.options.offset,left:s.left+s.width/2-n/2};break;case"e":e={top:s.top+s.height/2-o/2,left:s.left-n-this.options.offset};break;case"w":(extra_gap=0)<a("body").css("position").length&&"relative"==a("body").css("position")&&a("#wpadminbar").length&&(extra_gap=a("#wpadminbar").height()),e={top:s.top+s.height/2-o/2-extra_gap,left:s.left+s.width+this.options.offset}}2==t.length&&("w"==t.charAt(1)?e.left=s.left+s.width/2-15:e.left=s.left+s.width/2-n+15),i.css(e).addClass("tipsy-"+t),i.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+t.charAt(0),this.options.className&&i.addClass(l(this.options.className,this.$element[0])),this.options.fade?i.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):i.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){a(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;!t.attr("title")&&"string"==typeof t.attr("original-title")||t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,e=this.$element,i=this.options;return this.fixTitle(),"string"==typeof(i=this.options).title?t=e.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(t=i.title.call(e[0])),(t=(""+t).replace(/(^\s*|\s*$)/,""))||i.fallback},tip:function(){return this.$tip||(this.$tip=a('<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}},a.fn.tipsy=function(i){return!0===i?this.data("tipsy"):("string"==typeof i?(t=this.data("tipsy"))&&t[i]():((i=a.extend({},a.fn.tipsy.defaults,i)).on||this.each(function(){s(this)}),"manual"!=i.trigger&&(t="hover"==i.trigger?"mouseenter":"focus",e="hover"==i.trigger?"mouseleave":"blur",i.on?a(document).on(t,this.selector,n).on(e,this.selector,o):this.on(t,n).on(e,o))),this);var t,e;function s(t){var e=a.data(t,"tipsy");return e||(e=new h(t,a.fn.tipsy.elementOptions(t,i)),a.data(t,"tipsy",e)),e}function n(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function o(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}},a.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"},a.fn.tipsy.revalidate=function(){a(".tipsy").each(function(){var t=a.data(this,"tipsy-pointee");t&&function(t){for(;t=t.parentNode;)if(t==document)return 1}(t)||a(this).remove()})},a.fn.tipsy.elementOptions=function(t,e){return a.metadata?a.extend({},e,a(t).metadata()):e},a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"},a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"},a.fn.tipsy.autoBounds=function(n,o){return function(){var t={ns:o[0],ew:1<o.length&&o[1]},e=a(document).scrollTop()+n,i=a(document).scrollLeft()+n,s=a(this);return s.offset().top<e&&(t.ns="n"),s.offset().left<i&&(t.ew="w"),a(window).width()+a(document).scrollLeft()-s.offset().left<n&&(t.ew="e"),a(window).height()+a(document).scrollTop()-s.offset().top<n&&(t.ns="s"),t.ns+(t.ew||"")}}}(jQuery);
!function(a){function l(t,e){return"function"==typeof t?t.call(e):t}function h(t,e){this.$element=a(t),this.options=e,this.enabled=!0,this.fixTitle()}h.prototype={show:function(){var t=this.getTitle();if(t&&this.enabled){var e,i=this.tip(),s=(i.find(".tipsy-inner")[this.options.html?"html":"text"](t),i[0].className="tipsy",i.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body),a.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})),n=i[0].offsetWidth,o=i[0].offsetHeight,t=l(this.options.gravity,this.$element[0]);switch(t.charAt(0)){case"n":e={top:s.top+s.height+this.options.offset,left:s.left+s.width/2-n/2};break;case"s":e={top:s.top-o-this.options.offset,left:s.left+s.width/2-n/2};break;case"e":e={top:s.top+s.height/2-o/2,left:s.left-n-this.options.offset};break;case"w":(extra_gap=0)<a("body").css("position").length&&"relative"==a("body").css("position")&&a("#wpadminbar").length&&(extra_gap=a("#wpadminbar").height()),e={top:s.top+s.height/2-o/2-extra_gap,left:s.left+s.width+this.options.offset}}2==t.length&&("w"==t.charAt(1)?e.left=s.left+s.width/2-15:e.left=s.left+s.width/2-n+15),i.css(e).addClass("tipsy-"+t),i.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+t.charAt(0),this.options.className&&i.addClass(l(this.options.className,this.$element[0])),this.options.fade?i.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):i.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){a(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;!t.attr("title")&&"string"==typeof t.attr("original-title")||t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,e=this.$element,i=this.options;return this.fixTitle(),"string"==typeof(i=this.options).title?t=e.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(t=i.title.call(e[0])),(t=(""+t).replace(/(^\s*|\s*$)/,""))||i.fallback},tip:function(){return this.$tip||(this.$tip=a('<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}},a.fn.tipsy=function(i){var t,e;return!0===i?this.data("tipsy"):("string"==typeof i?(t=this.data("tipsy"))&&t[i]():((i=a.extend({},a.fn.tipsy.defaults,i)).on||this.each(function(){s(this)}),"manual"!=i.trigger&&(t="hover"==i.trigger?"mouseenter":"focus",e="hover"==i.trigger?"mouseleave":"blur",i.on?a(document).on(t,this.selector,n).on(e,this.selector,o):this.on(t,n).on(e,o))),this);function s(t){var e=a.data(t,"tipsy");return e||(e=new h(t,a.fn.tipsy.elementOptions(t,i)),a.data(t,"tipsy",e)),e}function n(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function o(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}},a.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"},a.fn.tipsy.revalidate=function(){a(".tipsy").each(function(){var t=a.data(this,"tipsy-pointee");t&&function(t){for(;t=t.parentNode;)if(t==document)return 1}(t)||a(this).remove()})},a.fn.tipsy.elementOptions=function(t,e){return a.metadata?a.extend({},e,a(t).metadata()):e},a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"},a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"},a.fn.tipsy.autoBounds=function(n,o){return function(){var t={ns:o[0],ew:1<o.length&&o[1]},e=a(document).scrollTop()+n,i=a(document).scrollLeft()+n,s=a(this);return s.offset().top<e&&(t.ns="n"),s.offset().left<i&&(t.ew="w"),a(window).width()+a(document).scrollLeft()-s.offset().left<n&&(t.ew="e"),a(window).height()+a(document).scrollTop()-s.offset().top<n&&(t.ns="s"),t.ns+(t.ew||"")}}}(jQuery);
+27 -7
View File
@@ -34,18 +34,38 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
private $custom_nonce_added = false;
var $init_icon = false;
public $init_icon = false;
/**
* @var bool
*/
public $in_edit = false;
/**
* @var null
*/
public $edit_mode_value = null;
/**
* @var array
*/
public $edit_array = array();
/**
* @var array
*/
public $postmeta = array();
/**
* @var bool
*/
public $is_loaded = false;
/**
* Admin_Metabox constructor.
*/
function __construct() {
$this->in_edit = false;
$this->edit_mode_value = null;
$this->edit_array = [];
add_action( 'admin_head', array( &$this, 'admin_head' ), 9);
public function __construct() {
add_action( 'admin_head', array( &$this, 'admin_head' ), 9 );
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9 );
add_action( 'load-post.php', array( &$this, 'add_metabox' ), 9 );
+6 -5
View File
@@ -14,14 +14,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
*/
class Admin_Users {
/**
* @var string
*/
public $custom_role = 'um_role';
/**
* Admin_Users constructor.
*/
function __construct() {
$this->custom_role = 'um_role';
public function __construct() {
add_action( 'restrict_manage_users', array( &$this, 'restrict_manage_users' ) );
add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 );
@@ -273,7 +274,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
$submitted = get_user_meta( $user_id, 'submitted', true );
if ( ! empty( $submitted ) ) {
$actions['view_info'] = '<a href="javascript:void(0);" data-modal="UM_preview_registration" data-modal-size="smaller"
$actions['view_info'] = '<a href="javascript:void(0);" data-modal="UM_preview_registration" data-modal-size="smaller"
data-dynamic-content="um_admin_review_registration" data-arg1="' . esc_attr( $user_id ) . '" data-arg2="edit_registration">' . __( 'Info', 'ultimate-member' ) . '</a>';
}
+20 -28
View File
@@ -17,83 +17,75 @@ if ( ! class_exists( 'um\Config' ) ) {
*/
class Config {
/**
* @var array
*/
public $core_forms;
/**
* @var array
*/
var $core_forms;
/**
* @var array
*/
var $core_directories;
public $core_directories;
/**
* @var mixed|void
*/
var $core_pages;
public $core_pages;
/**
* @var array
*/
var $core_directory_meta = array();
public $core_directory_meta = array();
/**
* @var array
*/
var $core_global_meta_all;
public $core_global_meta_all;
/**
* @var mixed|void
*/
var $core_form_meta_all;
public $core_form_meta_all;
/**
* @var array
*/
var $core_form_meta = array();
public $core_form_meta = array();
/**
* @var
*/
var $perms;
public $perms;
/**
* @var
*/
var $nonadmin_perms;
public $nonadmin_perms;
/**
* @var mixed|void
*/
var $email_notifications;
public $email_notifications;
/**
* @var mixed|void
*/
var $settings_defaults;
public $settings_defaults;
/**
* @var array
*/
var $permalinks;
public $permalinks;
/**
* @var array|array[]
*/
public $default_roles_metadata = array();
/**
* Config constructor.
*/
function __construct() {
public function __construct() {
$this->core_forms = array(
'register',
'login',
+5 -1
View File
@@ -71,6 +71,10 @@ if ( ! class_exists( 'UM' ) ) {
*/
public $is_permalinks;
/**
* @var null|string
*/
public $honeypot = null;
/**
* Main UM Instance
@@ -82,7 +86,7 @@ if ( ! class_exists( 'UM' ) ) {
* @see UM()
* @return UM - Main instance
*/
static public function instance() {
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
self::$instance->_um_construct();
+16 -5
View File
@@ -13,29 +13,40 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
*/
class Builtin {
/**
* @var array
*/
public $predefined_fields = array();
/**
* @var array
*/
public $all_user_fields = array();
/**
* @var array
*/
var $all_user_fields = array();
public $core_fields = array();
/**
* @var array
*/
var $core_fields = array();
public $saved_fields = array();
/**
* @var array
*/
public $custom_fields = array();
/**
* @var array
*/
public $fields_dropdown = array();
/**
* Builtin constructor.
*/
function __construct() {
public function __construct() {
add_action( 'init', array( &$this, 'set_core_fields' ), 1 );
add_action( 'init', array( &$this, 'set_predefined_fields' ), 1 );
add_action( 'init', array( &$this, 'set_custom_fields' ), 1 );
+16 -5
View File
@@ -18,7 +18,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
/**
* @var string
*/
var $set_mode = '';
public $set_mode = '';
/**
@@ -26,17 +26,28 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*/
public $set_id = null;
/**
* @var bool
*/
public $editing = false;
/**
* @var bool
*/
public $viewing = false;
/**
* @var int
*/
public $timestamp = null;
/**
* Fields constructor.
*/
function __construct() {
$this->editing = false;
$this->viewing = false;
public function __construct() {
$this->timestamp = current_time( 'timestamp' );
}
/**
* Standard checkbox field
*
+23 -10
View File
@@ -13,30 +13,45 @@ if ( ! class_exists( 'um\core\Files' ) ) {
*/
class Files {
/**
* @var
*/
public $upload_temp;
/**
* @var
*/
var $upload_temp;
public $upload_baseurl;
/**
* @var
*/
var $upload_baseurl;
public $upload_basedir;
/**
* @var
* @var array|array[]
*/
var $upload_basedir;
public $fonticon = array();
/**
* @var null|string
*/
public $upload_dir = null;
/**
* @var null
*/
public $upload_temp_url = null;
/**
* @var string
*/
public $default_file_fonticon = 'um-faicon-file-o';
/**
* Files constructor.
*/
function __construct() {
public function __construct() {
$this->setup_paths();
add_action( 'template_redirect', array( &$this, 'download_routing' ), 1 );
@@ -63,8 +78,6 @@ if ( ! class_exists( 'um\core\Files' ) ) {
'tif' => array('icon' => 'um-icon-image' ),
'tiff' => array('icon' => 'um-icon-image' ),
);
$this->default_file_fonticon = 'um-faicon-file-o';
}
+21 -17
View File
@@ -13,43 +13,47 @@ if ( ! class_exists( 'um\core\Form' ) ) {
*/
class Form {
/**
* @var null
*/
public $form_suffix;
public $form_suffix = null;
/**
* @var
*/
var $form_id;
public $form_id;
/**
* @var null
*/
var $post_form = null;
public $post_form = null;
/**
* @var null
*/
public $nonce = null;
var $nonce = null;
/**
* @var null
*/
public $errors = null;
/**
* @var null
*/
public $processing = null;
/**
* @var array
*/
public $all_fields = array();
/**
* Form constructor.
*/
function __construct() {
$this->form_suffix = null;
$this->errors = null;
$this->processing = null;
public function __construct() {
add_action( 'template_redirect', array( &$this, 'form_init' ), 2 );
add_action( 'init', array( &$this, 'field_declare' ), 10 );
}
+41 -26
View File
@@ -13,18 +13,35 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
*/
class Shortcodes {
var $profile_role = '';
/**
* @var string
*/
public $profile_role = '';
/**
* @var bool
*/
public $message_mode = false;
/**
* @var string
*/
public $custom_message = '';
/**
* @var array
*/
public $loop = array();
/**
* @var array
*/
public $emoji = array();
/**
* Shortcodes constructor.
*/
function __construct() {
$this->message_mode = false;
$this->custom_message = '';
$this->loop = array();
public function __construct() {
add_shortcode( 'ultimatemember', array( &$this, 'ultimatemember' ) );
add_shortcode( 'ultimatemember_login', array( &$this, 'ultimatemember_login' ) );
@@ -123,10 +140,8 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$this->emoji[':innocent:'] = $base_uri . '72x72/1f607.png';
$this->emoji[':smirk:'] = $base_uri . '72x72/1f60f.png';
$this->emoji[':expressionless:'] = $base_uri . '72x72/1f611.png';
}
/**
* Conditional logout form
*
@@ -430,11 +445,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$args = ! empty( $args ) ? $args : array();
$default_login = $wpdb->get_var(
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' )
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'login' AND
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'login' AND
pm2.meta_value = '1'"
);
@@ -463,11 +478,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$args = ! empty( $args ) ? $args : array();
$default_register = $wpdb->get_var(
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' )
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'register' AND
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'register' AND
pm2.meta_value = '1'"
);
@@ -496,11 +511,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$args = ! empty( $args ) ? $args : array();
$default_profile = $wpdb->get_var(
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' )
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'profile' AND
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'profile' AND
pm2.meta_value = '1'"
);
@@ -530,11 +545,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$args = ! empty( $args ) ? $args : array();
$default_directory = $wpdb->get_var(
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
"SELECT pm.post_id
FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' )
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'directory' AND
WHERE pm.meta_key = '_um_mode' AND
pm.meta_value = 'directory' AND
pm2.meta_value = '1'"
);
+72 -24
View File
@@ -22,35 +22,86 @@ if ( ! class_exists( 'um\core\User' ) ) {
*/
public $previous_data = null;
/**
* @var int
*/
public $id = 0;
/**
* @var null
*/
public $usermeta = null;
/**
* @var null
*/
public $data = null;
/**
* @var null
*/
public $profile = null;
/**
* @var null
*/
public $cannot_edit = null;
/**
* @var null
*/
public $deleted_user_id = null;
/**
* @var array|string[]
*/
public $banned_keys = array();
/**
* @var bool
*/
public $preview = false;
/**
* @var bool
*/
public $send_mail_on_delete = true;
/**
* A list of keys that should never be in wp_usermeta.
* @var array|string[]
*/
public $update_user_keys = array();
/**
* @var null
*/
public $target_id = null;
/**
* User constructor.
*/
function __construct() {
$this->id = 0;
$this->usermeta = null;
$this->data = null;
$this->profile = null;
$this->cannot_edit = null;
$this->deleted_user_id = null;
public function __construct() {
global $wpdb;
$this->banned_keys = array(
'metabox','postbox','meta-box',
'dismissed_wp_pointers', 'session_tokens',
'screen_layout', 'wp_user-', 'dismissed',
'cap_key', $wpdb->get_blog_prefix(). 'capabilities',
'managenav', 'nav_menu', 'user_activation_key',
'level_', $wpdb->get_blog_prefix() . 'user_level'
'metabox',
'postbox',
'meta-box',
'dismissed_wp_pointers',
'session_tokens',
'screen_layout',
'wp_user-',
'dismissed',
'cap_key',
$wpdb->get_blog_prefix() . 'capabilities',
'managenav',
'nav_menu',
'user_activation_key',
'level_',
$wpdb->get_blog_prefix() . 'user_level',
);
add_action( 'init', array( &$this, 'set' ), 1 );
$this->preview = false;
$this->send_mail_on_delete = true;
// a list of keys that should never be in wp_usermeta
$this->update_user_keys = array(
'user_email',
@@ -61,7 +112,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
'role',
);
$this->target_id = null;
add_action( 'init', array( &$this, 'set' ), 1 );
// When the cache should be cleared
add_action( 'um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
@@ -88,7 +139,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'user_register', array( &$this, 'user_register_via_admin' ), 10, 1 );
add_action( 'user_register', array( &$this, 'set_gravatar' ), 11, 1 );
if ( is_multisite() ) {
add_action( 'added_existing_user', array( &$this, 'add_um_role_existing_user' ), 10, 2 );
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
@@ -102,13 +152,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
}
add_action( 'updated_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 );
add_action( 'added_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 );
add_action( 'deleted_user_meta', array( &$this, 'on_delete_usermeta' ), 10, 4 );
add_action( 'update_user_meta', array( &$this, 'flush_um_count_users_transient_update' ), 10, 4 );
add_action( 'added_user_meta', array( &$this, 'flush_um_count_users_transient_add' ), 10, 4 );
add_action( 'delete_user_meta', array( &$this, 'flush_um_count_users_transient_delete' ), 10, 4 );
+17 -8
View File
@@ -13,16 +13,25 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
*/
class Validation {
/**
* @var string
*/
public $regex_safe = '/\A[\w\-\.]+\z/';
/**
* @var string
*/
public $regex_username_safe = '|[^a-z0-9 _.\-@]|i';
/**
* @var string
*/
public $regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
/**
* Validation constructor.
*/
function __construct() {
$this->regex_safe = '/\A[\w\-\.]+\z/';
$this->regex_username_safe = '|[^a-z0-9 _.\-@]|i';
$this->regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/';
public function __construct() {
add_filter( 'um_user_pre_updating_files_array', array( $this, 'validate_files' ), 10, 1 );
add_filter( 'um_before_save_filter_submitted', array( $this, 'validate_fields_values' ), 10, 2 );
}
@@ -91,7 +100,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
}
// Dropdown options source from callback function
if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) &&
if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) &&
isset( $fields[ $key ]['custom_dropdown_options_source'] ) &&
! empty( $fields[ $key ]['custom_dropdown_options_source'] ) &&
function_exists( $fields[ $key ]['custom_dropdown_options_source'] ) ) {
@@ -100,7 +109,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
$fields[ $key ]['options'] = array_keys( $arr_options );
}
}
// Unset changed value that doesn't match the option list
if ( in_array( $fields[ $key ]['type'], array( 'select' ) ) &&
! empty( $stripslashes ) && ! empty( $fields[ $key ]['options'] ) &&