mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-18 22:23:37 +09:00
- fixed dynamically declared variables inside the classes;
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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'"
|
||||
);
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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'] ) &&
|
||||
|
||||
Reference in New Issue
Block a user