mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-14 04:06:36 +09:00
Merge branch 'master' of https://github.com/ultimatemember/ultimatemember
This commit is contained in:
@@ -82,6 +82,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Hide Woocommerce Shop page restrict content metabox
|
||||
* @param $hide
|
||||
*
|
||||
* @return bool
|
||||
|
||||
@@ -77,6 +77,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
||||
add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function for major updates
|
||||
*
|
||||
@@ -134,17 +135,31 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function get_extension_upgrades() {
|
||||
$extensions = UM()->extensions()->get_list();
|
||||
if ( empty( $extensions ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$upgrades = array();
|
||||
foreach ( $extensions as $extension ) {
|
||||
$upgrades[ $extension ] = UM()->extensions()->get_packages( $extension );
|
||||
}
|
||||
|
||||
return $upgrades;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get array of necessary upgrade packages
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function need_run_upgrades() {
|
||||
$um_last_version_upgrade = get_option( 'um_last_version_upgrade' );
|
||||
//first install
|
||||
if ( ! $um_last_version_upgrade ) {
|
||||
$um_last_version_upgrade = '1.3.88';
|
||||
}
|
||||
$um_last_version_upgrade = get_option( 'um_last_version_upgrade', '1.3.88' );
|
||||
|
||||
$diff_packages = array();
|
||||
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
namespace um;
|
||||
|
||||
// Exit if executed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
if ( ! class_exists( 'um\Extensions' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Extensions
|
||||
*
|
||||
* @package um
|
||||
*
|
||||
* @method void bbpress_activation()
|
||||
*/
|
||||
class Extensions {
|
||||
|
||||
|
||||
/**
|
||||
* Extensions list
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $list = array();
|
||||
|
||||
|
||||
/**
|
||||
* Extensions data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $plugin_data = array();
|
||||
|
||||
|
||||
/**
|
||||
* Extensions constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function check_dependencies() {
|
||||
$extensions = $this->get_list();
|
||||
|
||||
foreach ( $extensions as $slug ) {
|
||||
$extension = $this->get_info( $slug );
|
||||
|
||||
list( $run, $slug, $message ) = apply_filters_ref_array( 'um_extension_custom_dependencies', array( true, $slug, '' ) );
|
||||
|
||||
if ( $run ) {
|
||||
$compare_version_result = UM()->dependencies()->compare_versions( $extension['min_core_version'], $extension['version'], $slug, $extension['title'] );
|
||||
|
||||
if ( true !== $compare_version_result ) {
|
||||
UM()->notices()->add_notice( "{$slug}_dependencies", array(
|
||||
'class' => 'error',
|
||||
'message' => '<p>' . $compare_version_result . '</p>',
|
||||
), 1 );
|
||||
}
|
||||
} elseif ( ! $run && ! empty( $message ) ) {
|
||||
UM()->notices()->add_notice( "{$slug}_dependencies", array(
|
||||
'class' => 'error',
|
||||
'message' => $message,
|
||||
), 1 );
|
||||
}
|
||||
|
||||
if ( $run ) {
|
||||
UM()->call_class( "um_ext\um_{$slug}\Init" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $settings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function license_options( $settings ) {
|
||||
|
||||
$extensions = $this->get_list();
|
||||
|
||||
if ( empty( $extensions ) ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
foreach ( $extensions as $slug ) {
|
||||
$extension = $this->get_info( $slug );
|
||||
|
||||
if ( isset( $extension['plan'] ) && $extension['plan'] == 'free' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$settings['licenses']['fields'][] = array(
|
||||
'id' => "um_{$slug}_license_key",
|
||||
'label' => sprintf( __( '%s License Key', 'ultimate-member' ), $extension['title'] ),
|
||||
'item_name' => $extension['item_name'],
|
||||
'author' => 'Ultimate Member',
|
||||
'version' => $extension['version'],
|
||||
);
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading Extensions localizations
|
||||
*/
|
||||
function localization() {
|
||||
$extensions = $this->get_list();
|
||||
|
||||
foreach ( $extensions as $slug ) {
|
||||
$extension = $this->get_info( $slug );
|
||||
|
||||
$locale = ( get_locale() != '' ) ? get_locale() : 'en_US';
|
||||
load_textdomain( $extension['textdomain'], WP_LANG_DIR . '/plugins/' . $extension['textdomain'] . '-' . $locale . '.mo');
|
||||
load_plugin_textdomain( $extension['textdomain'], false, dirname( $extension['plugin'] ) . '/languages/' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_version( $slug ) {
|
||||
|
||||
$version = '';
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $slug
|
||||
* @param bool $field
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
function get_info( $slug, $field = false ) {
|
||||
if ( ! $field ) {
|
||||
return ! empty( $this->plugin_data[ $slug ] ) ? $this->plugin_data[ $slug ] : array();
|
||||
} else {
|
||||
return ! empty( $this->plugin_data[ $slug ][ $field ] ) ? $this->plugin_data[ $slug ][ $field ] : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $slug
|
||||
* @param array $plugin_data
|
||||
*/
|
||||
function add( $slug, $plugin_data ) {
|
||||
$this->list[] = $slug;
|
||||
$this->plugin_data[ $slug ] = $plugin_data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Activate Extension Process
|
||||
* Common functions in activation
|
||||
*
|
||||
* @param $slug
|
||||
*/
|
||||
function activate( $slug ) {
|
||||
$plugin_data = $this->get_info( $slug );
|
||||
|
||||
//if extension wasn't inited, init it firstly via "um_{$slug}_add" function
|
||||
//"um_{$slug}_add" must be in the preset structure of UM extension
|
||||
if ( empty( $plugin_data ) && function_exists( "um_{$slug}_add" ) ) {
|
||||
call_user_func( "um_{$slug}_add" );
|
||||
$plugin_data = $this->get_info( $slug );
|
||||
}
|
||||
|
||||
//first install
|
||||
$version = get_option( "um_{$slug}_version" );
|
||||
if ( ! $version ) {
|
||||
update_option( "um_{$slug}_last_version_upgrade", $plugin_data['version'] );
|
||||
}
|
||||
|
||||
if ( $version != $plugin_data['version'] ) {
|
||||
update_option( "um_{$slug}_version", $plugin_data['version'] );
|
||||
}
|
||||
|
||||
|
||||
//start setup
|
||||
UM()->extension( $slug )->setup()->start();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function get_list() {
|
||||
return $this->list;
|
||||
}
|
||||
|
||||
|
||||
function get_packages( $slug ) {
|
||||
$plugin_info = $this->get_info( $slug );
|
||||
$packages_dir = $plugin_info['path'] . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'packages';
|
||||
|
||||
$update_versions = array();
|
||||
$handle = opendir( $packages_dir );
|
||||
if ( $handle ) {
|
||||
while ( false !== ( $filename = readdir( $handle ) ) ) {
|
||||
if ( $filename != '.' && $filename != '..' ) {
|
||||
if ( is_dir( $packages_dir . DIRECTORY_SEPARATOR . $filename ) ) {
|
||||
$update_versions[] = $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( $handle );
|
||||
|
||||
usort( $update_versions, array( UM()->admin_upgrade(), 'version_compare_sort' ) );
|
||||
}
|
||||
|
||||
return $update_versions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
|
||||
|
||||
@@ -54,43 +55,6 @@ if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get ajax routed URL
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $method
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_ajax_route( $route, $method ) {
|
||||
|
||||
$route = str_replace( array( '\\', '/' ), '!', $route );
|
||||
$ip = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '';
|
||||
$nonce = wp_create_nonce( $ip . get_current_user_id() . $route . $method );
|
||||
|
||||
if ( is_admin() ) {
|
||||
$url = add_query_arg( array(
|
||||
'action' => 'um_router',
|
||||
'um_action' => 'route',
|
||||
'um_resource' => $route,
|
||||
'um_method' => $method,
|
||||
'um_verify' => $nonce
|
||||
), get_admin_url( null, 'admin-ajax.php' ) );
|
||||
} else if ( get_option( 'permalink_structure' ) ) {
|
||||
$url = get_home_url( null, 'um-api/route/' . $route . '/' . $method . '/' . $nonce );
|
||||
} else {
|
||||
$url = add_query_arg( array(
|
||||
'um_page' => 'api',
|
||||
'um_action' => 'route',
|
||||
'um_resource' => $route,
|
||||
'um_method' => $method,
|
||||
'um_verify' => $nonce
|
||||
), get_home_url() );
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Help Tip displaying
|
||||
*
|
||||
@@ -364,6 +328,5 @@ if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
$cpt = apply_filters( 'um_cpt_list', array( 'um_form', 'um_directory' ) );
|
||||
return $cpt;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+62
-2
@@ -198,6 +198,8 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
|
||||
// include hook files
|
||||
add_action( 'plugins_loaded', array( &$this, 'init' ), 0 );
|
||||
//run hook for extensions init
|
||||
add_action( 'plugins_loaded', array( &$this, 'extensions_init' ), -19 );
|
||||
|
||||
add_action( 'init', array( &$this, 'old_update_patch' ), 0 );
|
||||
|
||||
@@ -478,6 +480,14 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function extensions_init() {
|
||||
do_action( 'um_core_loaded' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Include required core files used in admin and on the frontend.
|
||||
*
|
||||
@@ -541,8 +551,45 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->mobile();
|
||||
$this->external_integrations();
|
||||
$this->gdpr();
|
||||
//$this->uploader();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get extension API
|
||||
*
|
||||
* @since 2.0.34
|
||||
*
|
||||
* @param $slug
|
||||
*
|
||||
* @return um_ext\um_bbpress\Init
|
||||
*/
|
||||
function extension( $slug ) {
|
||||
if ( empty( $this->classes[ $slug ] ) ) {
|
||||
$class = "um_ext\um_{$slug}\Init";
|
||||
|
||||
/**
|
||||
* @var $class um_ext\um_bbpress\Init
|
||||
*/
|
||||
$this->classes[ $slug ] = $class::instance();
|
||||
}
|
||||
|
||||
return $this->classes[ $slug ];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $class
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function call_class( $class ) {
|
||||
$key = strtolower( $class );
|
||||
|
||||
if ( empty( $this->classes[ $key ] ) ) {
|
||||
$this->classes[ $key ] = new $class;
|
||||
}
|
||||
|
||||
return $this->classes[ $key ];
|
||||
}
|
||||
|
||||
|
||||
@@ -844,6 +891,19 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0.34
|
||||
*
|
||||
* @return um\Extensions
|
||||
*/
|
||||
function extensions() {
|
||||
if ( empty( $this->classes['extensions'] ) ) {
|
||||
$this->classes['extensions'] = new um\Extensions();
|
||||
}
|
||||
|
||||
return $this->classes['extensions'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
|
||||
@@ -20,7 +20,6 @@ if ( ! class_exists( 'um\core\AJAX_Common' ) ) {
|
||||
function __construct() {
|
||||
// UM_EVENT => nopriv
|
||||
$ajax_actions = array(
|
||||
'router' => false
|
||||
);
|
||||
|
||||
foreach ( $ajax_actions as $action => $nopriv ) {
|
||||
@@ -54,24 +53,6 @@ if ( ! class_exists( 'um\core\AJAX_Common' ) ) {
|
||||
|
||||
add_action( 'wp_ajax_nopriv_um_resize_image', array( UM()->files(), 'ajax_resize_image' ) );
|
||||
add_action( 'wp_ajax_um_resize_image', array( UM()->files(), 'ajax_resize_image' ) );
|
||||
|
||||
|
||||
/**
|
||||
* Fallback for ajax urls
|
||||
* @uses action hooks: wp_head, admin_head
|
||||
*/
|
||||
//add_action( 'wp_head', array( $this, 'ultimatemember_ajax_urls' ) );
|
||||
//add_action( 'admin_head', array( $this, 'ultimatemember_ajax_urls' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Router method
|
||||
*/
|
||||
function router() {
|
||||
$router = new Router();
|
||||
$router->backend_requests();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,6 @@ if ( ! class_exists( 'um\core\Common' ) ) {
|
||||
function __construct() {
|
||||
add_action( 'init', array( &$this, 'create_post_types' ), 1 );
|
||||
|
||||
add_filter( 'posts_request', array( &$this, 'um_query_pages' ) );
|
||||
|
||||
add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000, 1 );
|
||||
}
|
||||
|
||||
@@ -110,33 +108,6 @@ if ( ! class_exists( 'um\core\Common' ) ) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check query string on 'posts_request' for our pages
|
||||
*
|
||||
* @param string $q
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function um_query_pages( $q ) {
|
||||
global $wp_query;
|
||||
|
||||
//We need main query
|
||||
if ( isset( $wp_query->request ) && $q == $wp_query->request ) {
|
||||
|
||||
if ( ! empty( $wp_query->query_vars['um_page'] ) ) {
|
||||
|
||||
if ( 'api' == $wp_query->query_vars['um_page'] ) {
|
||||
$router = new Router();
|
||||
$router->frontend_requests();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $q;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,10 +32,46 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
||||
add_filter( 'um_localize_permalink_filter', array( &$this, 'um_localize_permalink_filter' ), 10, 2 );
|
||||
add_filter( 'icl_ls_languages', array( &$this, 'um_core_page_wpml_permalink' ), 10, 1 );
|
||||
|
||||
/**
|
||||
* @todo Customize this form metadata
|
||||
*/
|
||||
//add_filter( 'um_pre_args_setup', array( &$this, 'shortcode_pre_args_setup' ), 20, 1 );
|
||||
|
||||
$this->plugins_loaded();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM filter - Restore original arguments on translated page
|
||||
*
|
||||
* @description Restore original arguments on load shortcode if they are missed in the WPML translation
|
||||
* @hook um_pre_args_setup
|
||||
*
|
||||
* @global \SitePress $sitepress
|
||||
* @param array $args
|
||||
* @return array
|
||||
*/
|
||||
function shortcode_pre_args_setup( $args ) {
|
||||
if ( UM()->external_integrations()->is_wpml_active() ) {
|
||||
global $sitepress;
|
||||
|
||||
$original_form_id = $sitepress->get_object_id( $args['form_id'], 'post', true, $sitepress->get_default_language() );
|
||||
|
||||
if ( $original_form_id != $args['form_id'] ) {
|
||||
$original_post_data = UM()->query()->post_data( $original_form_id );
|
||||
|
||||
foreach ( $original_post_data as $key => $value ) {
|
||||
if ( ! isset( $args[ $key ] ) ) {
|
||||
$args[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gravity forms role capabilities compatibility
|
||||
*/
|
||||
|
||||
@@ -481,8 +481,11 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
$global_role = $um_global_role; // Form Global settings
|
||||
}
|
||||
|
||||
|
||||
$mode = $this->form_type( $post_id );
|
||||
|
||||
/**
|
||||
* @todo WPML integration to get role from original if it's empty
|
||||
*/
|
||||
$use_custom = get_post_meta( $post_id, "_um_{$mode}_use_custom_settings", true );
|
||||
if ( $use_custom ) { // Custom Form settings
|
||||
$role = get_post_meta( $post_id, "_um_{$mode}_role", true );
|
||||
|
||||
@@ -46,8 +46,6 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
$public_query_vars[] = 'um_action';
|
||||
$public_query_vars[] = 'um_field';
|
||||
$public_query_vars[] = 'um_form';
|
||||
$public_query_vars[] = 'um_resource';
|
||||
$public_query_vars[] = 'um_method';
|
||||
$public_query_vars[] = 'um_verify';
|
||||
|
||||
return $public_query_vars;
|
||||
@@ -64,7 +62,6 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
function _add_rewrite_rules( $rules ) {
|
||||
$newrules = array();
|
||||
|
||||
$newrules['um-api/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?um_page=api&um_action=$matches[1]&um_resource=$matches[2]&um_method=$matches[3]&um_verify=$matches[4]';
|
||||
$newrules['um-download/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?um_action=download&um_form=$matches[1]&um_field=$matches[2]&um_user=$matches[3]&um_verify=$matches[4]';
|
||||
|
||||
if ( isset( UM()->config()->permalinks['user'] ) ) {
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'um\core\Router' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Router
|
||||
* @package um\core
|
||||
*/
|
||||
class Router {
|
||||
|
||||
|
||||
/**
|
||||
* Run backend process
|
||||
*/
|
||||
function backend_requests() {
|
||||
$ip = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '';
|
||||
$user_id = get_current_user_id();
|
||||
|
||||
if ( empty( $_REQUEST['um_action'] ) )
|
||||
exit( __( 'Wrong action', 'ultimate-member' ) );
|
||||
|
||||
if ( empty( $_REQUEST['um_resource'] ) )
|
||||
exit( __( 'Wrong resource', 'ultimate-member' ) );
|
||||
|
||||
if ( $_REQUEST['um_action'] == 'route' )
|
||||
$verify = wp_verify_nonce( $_REQUEST['um_verify'], $ip . $user_id . $_REQUEST['um_resource'] . $_REQUEST['um_method'] );
|
||||
else
|
||||
$verify = wp_verify_nonce( $_REQUEST['um_verify'], $ip . $user_id . $_REQUEST['um_action'] . $_REQUEST['um_resource'] );
|
||||
|
||||
if ( empty( $verify ) )
|
||||
exit( __( 'Wrong nonce', 'ultimate-member' ) );
|
||||
|
||||
$this->request_process( array(
|
||||
'route' => $_REQUEST['um_resource'],
|
||||
'method' => $_REQUEST['um_method']
|
||||
) );
|
||||
|
||||
/*if ($_REQUEST['um_action'] == 'download' || $_REQUEST['um_action'] == 'view') {
|
||||
WO()->downloader()->set_type( $_REQUEST['um_action'] )->process( array(
|
||||
'id' => $_REQUEST['um_id'],
|
||||
'resource' => $_REQUEST['um_resource'],
|
||||
'action' => $_REQUEST['um_action']
|
||||
) );
|
||||
} else if ($_REQUEST['um_action'] == 'route') {
|
||||
$this->request_process( array(
|
||||
'route' => $_REQUEST['um_resource'],
|
||||
'method' => $_REQUEST['um_method']
|
||||
) );
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Request process
|
||||
*
|
||||
* @param $params array
|
||||
* @return bool
|
||||
*/
|
||||
function request_process( $params ) {
|
||||
if ( empty( $params['route'] ) || empty( $params['method'] ) )
|
||||
return false;
|
||||
|
||||
$route = str_replace( array( '!', '/' ), '\\', $params['route'] );
|
||||
|
||||
if ( ! class_exists( $route ) )
|
||||
return false;
|
||||
|
||||
if ( method_exists( $route, 'instance' ) )
|
||||
$object = $route::instance();
|
||||
else
|
||||
$object = new $route();
|
||||
|
||||
if ( ! method_exists( $object, $params['method'] ) )
|
||||
return false;
|
||||
|
||||
|
||||
call_user_func( array( &$object, $params['method'] ) );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run frontend process
|
||||
*/
|
||||
function frontend_requests() {
|
||||
$ip = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '';
|
||||
$user_id = get_current_user_id();
|
||||
if ( ! get_query_var( 'um_action' ) )
|
||||
exit( __( 'Wrong action', 'ultimate-member' ) );
|
||||
|
||||
if ( ! get_query_var( 'um_resource' ) )
|
||||
exit( __( 'Wrong resource', 'ultimate-member' ) );
|
||||
|
||||
$verify = false;
|
||||
if ( get_query_var( 'um_action' ) == 'route' )
|
||||
$verify = wp_verify_nonce( get_query_var( 'um_verify' ), $ip . $user_id . get_query_var( 'um_resource' ) . get_query_var( 'um_method' ) );
|
||||
|
||||
if ( $verify ) {
|
||||
if ( get_query_var( 'um_action' ) == 'route' ) {
|
||||
$this->request_process( array(
|
||||
'route' => get_query_var( 'um_resource' ),
|
||||
'method' => get_query_var( 'um_method' )
|
||||
) );
|
||||
}
|
||||
} else {
|
||||
exit( __( 'Wrong nonce', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -558,7 +558,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
}
|
||||
|
||||
// get data into one global array
|
||||
$post_data = UM()->query()->post_data($this->form_id);
|
||||
$post_data = UM()->query()->post_data( $this->form_id );
|
||||
|
||||
ob_start();
|
||||
|
||||
@@ -589,23 +589,22 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
$args['template'] = '';
|
||||
}
|
||||
|
||||
if (isset($post_data['template']) && $post_data['template'] != $args['template']) {
|
||||
if ( isset( $post_data['template'] ) && $post_data['template'] != $args['template'] ) {
|
||||
$args['template'] = $post_data['template'];
|
||||
}
|
||||
|
||||
if (!$this->template_exists($args['template'])) {
|
||||
if ( ! $this->template_exists( $args['template'] ) ) {
|
||||
$args['template'] = $post_data['mode'];
|
||||
}
|
||||
|
||||
if (!isset($post_data['template'])) {
|
||||
if ( ! isset( $post_data['template'] ) ) {
|
||||
$post_data['template'] = $post_data['mode'];
|
||||
}
|
||||
|
||||
if( 'directory' != $args['mode'] ) {
|
||||
|
||||
if ( 'directory' != $args['mode'] ) {
|
||||
$args = array_merge( $post_data, $args );
|
||||
|
||||
if (empty( $args['use_custom_settings'] )) {
|
||||
if ( empty( $args['use_custom_settings'] ) ) {
|
||||
$args = array_merge( $args, $this->get_css_args( $args ) );
|
||||
} else {
|
||||
$args = array_merge( $this->get_css_args( $args ), $args );
|
||||
@@ -648,8 +647,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
|
||||
|
||||
// for profiles only
|
||||
if ( $mode == 'profile' && um_profile_id() ) {
|
||||
$use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true );
|
||||
if ( $use_custom ) { // Custom Form settings
|
||||
if ( ! empty( $args['use_custom_settings'] ) ) { // Custom Form settings
|
||||
$current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
|
||||
|
||||
//backward compatibility between single/multi role form's setting
|
||||
|
||||
@@ -1540,7 +1540,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
function is_private_profile( $user_id ) {
|
||||
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
|
||||
if ( $privacy == __('Only me','ultimate-member') ) {
|
||||
if ( $privacy == __('Only me','ultimate-member') || $privacy == 'Only me' ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -452,51 +452,6 @@ function um_submit_form_register( $args ) {
|
||||
add_action( 'um_submit_form_register', 'um_submit_form_register', 10 );
|
||||
|
||||
|
||||
/**
|
||||
* Register user with predefined role in options
|
||||
*
|
||||
* @param $args
|
||||
*/
|
||||
function um_add_user_role( $args ) {
|
||||
|
||||
if ( isset( $args['custom_fields']['role_select'] ) || isset( $args['custom_fields']['role_radio'] ) ) return;
|
||||
|
||||
$use_custom_settings = get_post_meta( $args['form_id'], '_um_register_use_custom_settings', true );
|
||||
|
||||
$role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args );
|
||||
|
||||
if ( empty( $use_custom_settings ) || empty( $role ) ) return;
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_register_hidden_role_field
|
||||
* @description Display hidden role field
|
||||
* @input_vars
|
||||
* [{"var":"$role","type":"string","desc":"Hidden user role"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_register_hidden_role_field', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_register_hidden_role_field', 'my_register_hidden_role_field', 10, 1 );
|
||||
* function my_register_hidden_role_field( $role ) {
|
||||
* // your code here
|
||||
* return $role;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$role = apply_filters( 'um_register_hidden_role_field', $role );
|
||||
if ( $role ) {
|
||||
echo '<input type="hidden" name="role" id="role" value="' . $role . '" />';
|
||||
}
|
||||
|
||||
}
|
||||
//add_action( 'um_after_register_fields', 'um_add_user_role', 10, 1 );
|
||||
|
||||
|
||||
/**
|
||||
* Show the submit button
|
||||
*
|
||||
|
||||
@@ -207,7 +207,7 @@ function um_profile_field_filter_hook__date( $value, $data ) {
|
||||
if ( $data['pretty_format'] == 1 ) {
|
||||
$value = UM()->datetime()->get_age( $value );
|
||||
} else {
|
||||
$value = UM()->datetime()->format( $value, $data['format'] );
|
||||
$value = date_i18n( $data['format'], strtotime( $value ) );
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
@@ -42,25 +42,25 @@ add_filter('pre_get_document_title', 'um_dynamic_user_profile_pagetitle', 100000
|
||||
* @return string
|
||||
*/
|
||||
function um_dynamic_user_profile_title( $title, $id = '' ) {
|
||||
|
||||
if( is_admin() ){
|
||||
if ( is_admin() ) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
if ( $id == UM()->config()->permalinks['user'] && in_the_loop() ) {
|
||||
if ( um_is_core_page('user') && um_get_requested_user() ) {
|
||||
$title = um_get_display_name( um_get_requested_user() );
|
||||
} else if ( um_is_core_page('user') && is_user_logged_in() ) {
|
||||
$title = um_get_display_name( get_current_user_id() );
|
||||
if ( um_is_core_page('user') ) {
|
||||
if ( $id == UM()->config()->permalinks['user'] && in_the_loop() ) {
|
||||
if ( um_get_requested_user() ) {
|
||||
$title = um_get_display_name( um_get_requested_user() );
|
||||
} elseif ( is_user_logged_in() ) {
|
||||
$title = um_get_display_name( get_current_user_id() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( ! function_exists('utf8_decode') ){
|
||||
if ( ! function_exists( 'utf8_decode' ) ) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
return (strlen($title)!==strlen(utf8_decode($title))) ? $title : utf8_encode($title);
|
||||
return ( strlen( $title ) !== strlen( utf8_decode( $title ) ) ) ? $title : utf8_encode( $title );
|
||||
}
|
||||
add_filter( 'the_title', 'um_dynamic_user_profile_title', 100000, 2 );
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Ultimate Member\n"
|
||||
"POT-Creation-Date: 2018-11-21 11:52+0200\n"
|
||||
"PO-Revision-Date: 2018-11-21 11:52+0200\n"
|
||||
"POT-Creation-Date: 2018-11-22 14:19+0200\n"
|
||||
"PO-Revision-Date: 2018-11-22 14:19+0200\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: en_US\n"
|
||||
|
||||
+10
-2
@@ -6,7 +6,7 @@ Donate link:
|
||||
Tags: community, member, membership, user-profile, user-registration
|
||||
Requires at least: 4.7
|
||||
Tested up to: 4.9
|
||||
Stable tag: 2.0.33
|
||||
Stable tag: 2.0.34
|
||||
License: GNU Version 2 or Any Later Version
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
@@ -137,7 +137,15 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
|
||||
= Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
|
||||
|
||||
= 2.0.33: November 21, 2018 =
|
||||
= 2.0.34: December , 2018 =
|
||||
|
||||
* Bugfixes:
|
||||
|
||||
* Deprecated:
|
||||
- removed "UM_TEXTDOMAIN" constant;
|
||||
- removed function UM()->get_ajax_route();
|
||||
|
||||
= 2.0.33: November 22, 2018 =
|
||||
|
||||
* Bugfixes:
|
||||
- Fixed AJAX vulnerabilities
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
*/
|
||||
do_action( "um_profile_content_{$nav}_{$subnav}", $args );
|
||||
|
||||
print "</div>";
|
||||
print "<div class=\"clear\"></div></div>";
|
||||
|
||||
if ( um_is_on_edit_profile() ) { ?>
|
||||
</form>
|
||||
|
||||
+1
-8
@@ -3,7 +3,7 @@
|
||||
Plugin Name: Ultimate Member
|
||||
Plugin URI: http://ultimatemember.com/
|
||||
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
|
||||
Version: 2.0.33
|
||||
Version: 2.0.34
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
Text Domain: ultimate-member
|
||||
@@ -15,13 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
||||
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
$plugin_data = get_plugin_data( __FILE__ );
|
||||
|
||||
/**
|
||||
* Textdomain constant backward compatibility will be removed in future releases
|
||||
*
|
||||
* @todo remove in future releases
|
||||
*/
|
||||
define( 'UM_TEXTDOMAIN', 'ultimate-member' );
|
||||
|
||||
define( 'um_url', plugin_dir_url( __FILE__ ) );
|
||||
define( 'um_path', plugin_dir_path( __FILE__ ) );
|
||||
define( 'um_plugin', plugin_basename( __FILE__ ) );
|
||||
|
||||
Reference in New Issue
Block a user