2017-07-26 14:57:52 +03:00
|
|
|
<?php
|
|
|
|
|
namespace um\admin;
|
|
|
|
|
|
|
|
|
|
// Exit if accessed directly.
|
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) exit;
|
|
|
|
|
|
2018-03-26 01:27:46 +03:00
|
|
|
if ( ! class_exists( 'um\admin\Admin' ) ) {
|
2017-07-26 14:57:52 +03:00
|
|
|
|
2018-03-19 16:31:49 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class Admin
|
|
|
|
|
* @package um\admin
|
|
|
|
|
*/
|
2018-04-03 15:04:14 +03:00
|
|
|
class Admin extends Admin_Functions {
|
2018-03-19 16:31:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2017-12-11 09:53:38 +02:00
|
|
|
var $templates_path;
|
2017-07-26 14:57:52 +03:00
|
|
|
|
2018-03-19 16:31:49 +02:00
|
|
|
|
2017-12-11 09:53:38 +02:00
|
|
|
/**
|
|
|
|
|
* Admin constructor.
|
|
|
|
|
*/
|
|
|
|
|
function __construct() {
|
2018-04-03 15:04:14 +03:00
|
|
|
parent::__construct();
|
|
|
|
|
|
2017-12-11 09:53:38 +02:00
|
|
|
$this->templates_path = um_path . 'includes/admin/templates/';
|
2017-07-26 14:57:52 +03:00
|
|
|
|
2017-12-11 09:53:38 +02:00
|
|
|
add_action( 'admin_init', array( &$this, 'admin_init' ), 0 );
|
2018-04-03 11:46:30 +03:00
|
|
|
|
2018-04-03 12:53:41 +03:00
|
|
|
$prefix = is_network_admin() ? 'network_admin_' : '';
|
|
|
|
|
add_filter( "{$prefix}plugin_action_links_" . um_plugin, array( &$this, 'plugin_links' ) );
|
|
|
|
|
|
|
|
|
|
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
|
|
|
|
|
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
|
2018-05-24 16:55:06 +03:00
|
|
|
add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
|
2018-04-03 12:53:41 +03:00
|
|
|
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
|
|
|
|
|
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
|
|
|
|
|
add_action( 'um_admin_do_action__um_can_register_notice', array( &$this, 'um_hide_notice' ) );
|
|
|
|
|
add_action( 'um_admin_do_action__um_hide_exif_notice', array( &$this, 'um_hide_notice' ) );
|
|
|
|
|
add_action( 'um_admin_do_action__user_action', array( &$this, 'user_action' ) );
|
2018-04-03 15:04:14 +03:00
|
|
|
|
2018-09-17 10:03:31 +03:00
|
|
|
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
|
|
|
|
|
|
2018-10-26 14:06:45 +03:00
|
|
|
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 );
|
|
|
|
|
|
2018-04-03 15:04:14 +03:00
|
|
|
add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
|
|
|
|
|
add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
|
|
|
|
|
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) );
|
2018-10-26 14:06:45 +03:00
|
|
|
}
|
2018-08-15 13:24:22 +03:00
|
|
|
|
|
|
|
|
|
2018-10-26 14:06:45 +03:00
|
|
|
/**
|
|
|
|
|
* Adds class to our admin pages
|
|
|
|
|
*
|
|
|
|
|
* @param $classes
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function admin_body_class( $classes ) {
|
|
|
|
|
if ( $this->is_um_screen() ) {
|
|
|
|
|
return "$classes um-admin";
|
|
|
|
|
}
|
|
|
|
|
return $classes;
|
2018-04-03 12:53:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-26 14:06:45 +03:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
2018-05-24 16:55:06 +03:00
|
|
|
function manual_upgrades_request() {
|
|
|
|
|
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$last_request = get_option( 'um_last_manual_upgrades_request', false );
|
|
|
|
|
|
|
|
|
|
if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) {
|
2018-05-25 10:34:53 +03:00
|
|
|
|
2018-12-07 18:00:43 +02:00
|
|
|
if ( is_multisite() ) {
|
|
|
|
|
$blogs_ids = get_sites();
|
|
|
|
|
foreach( $blogs_ids as $b ) {
|
|
|
|
|
switch_to_blog( $b->blog_id );
|
|
|
|
|
wp_clean_update_cache();
|
2018-05-25 10:34:53 +03:00
|
|
|
|
2018-12-07 18:00:43 +02:00
|
|
|
UM()->plugin_updater()->um_checklicenses();
|
2018-05-24 16:55:06 +03:00
|
|
|
|
2018-12-07 18:00:43 +02:00
|
|
|
update_option( 'um_last_manual_upgrades_request', time() );
|
|
|
|
|
restore_current_blog();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
wp_clean_update_cache();
|
|
|
|
|
|
|
|
|
|
UM()->plugin_updater()->um_checklicenses();
|
|
|
|
|
|
|
|
|
|
update_option( 'um_last_manual_upgrades_request', time() );
|
|
|
|
|
}
|
2018-05-24 16:55:06 +03:00
|
|
|
|
|
|
|
|
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'got_updates' ), admin_url( 'admin.php' ) );
|
|
|
|
|
} else {
|
|
|
|
|
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'often_updates' ), admin_url( 'admin.php' ) );
|
|
|
|
|
}
|
|
|
|
|
exit( wp_redirect( $url ) );
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-03 12:53:41 +03:00
|
|
|
|
2018-09-17 10:03:31 +03:00
|
|
|
/**
|
|
|
|
|
* Core pages installation
|
|
|
|
|
*/
|
|
|
|
|
function install_core_pages() {
|
|
|
|
|
if ( ! is_admin() ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UM()->setup()->install_default_pages();
|
|
|
|
|
|
|
|
|
|
//check empty pages in settings
|
|
|
|
|
$empty_pages = array();
|
|
|
|
|
|
|
|
|
|
$pages = UM()->config()->permalinks;
|
|
|
|
|
if ( $pages && is_array( $pages ) ) {
|
|
|
|
|
foreach ( $pages as $slug => $page_id ) {
|
|
|
|
|
$page = get_post( $page_id );
|
|
|
|
|
|
|
|
|
|
if ( ! isset( $page->ID ) && in_array( $slug, array_keys( UM()->config()->core_pages ) ) ) {
|
|
|
|
|
$empty_pages[] = $slug;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if there aren't empty pages - then hide pages notice
|
|
|
|
|
if ( empty( $empty_pages ) ) {
|
|
|
|
|
$hidden_notices = get_option( 'um_hidden_admin_notices', array() );
|
|
|
|
|
$hidden_notices[] = 'wrong_pages';
|
|
|
|
|
|
|
|
|
|
update_option( 'um_hidden_admin_notices', $hidden_notices );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) );
|
|
|
|
|
exit( wp_redirect( $url ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-03 12:53:41 +03:00
|
|
|
/**
|
|
|
|
|
* Clear all users cache
|
|
|
|
|
*
|
|
|
|
|
* @param $action
|
|
|
|
|
*/
|
|
|
|
|
function user_cache( $action ) {
|
|
|
|
|
global $wpdb;
|
|
|
|
|
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'um_cache_userdata_%'" );
|
|
|
|
|
|
|
|
|
|
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'cleared_cache' ), admin_url( 'admin.php' ) );
|
|
|
|
|
exit( wp_redirect( $url ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Purge temp uploads dir
|
|
|
|
|
* @param $action
|
|
|
|
|
*/
|
|
|
|
|
function purge_temp( $action ) {
|
|
|
|
|
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UM()->files()->remove_dir( UM()->files()->upload_temp );
|
|
|
|
|
|
|
|
|
|
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'purged_temp' ), admin_url( 'admin.php' ) );
|
|
|
|
|
exit( wp_redirect( $url ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Duplicate form
|
|
|
|
|
*
|
|
|
|
|
* @param $action
|
|
|
|
|
*/
|
|
|
|
|
function duplicate_form( $action ) {
|
2020-02-28 15:51:45 +02:00
|
|
|
if ( ! is_admin() || ! current_user_can('manage_options') ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
if ( ! isset( $_REQUEST['post_id'] ) || ! is_numeric( $_REQUEST['post_id'] ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
2018-04-03 12:53:41 +03:00
|
|
|
|
2020-02-28 15:51:45 +02:00
|
|
|
$post_id = absint( $_REQUEST['post_id'] );
|
2018-04-03 12:53:41 +03:00
|
|
|
|
|
|
|
|
$n = array(
|
2020-02-28 15:51:45 +02:00
|
|
|
'post_type' => 'um_form',
|
|
|
|
|
'post_title' => sprintf( __( 'Duplicate of %s', 'ultimate-member' ), get_the_title( $post_id ) ),
|
|
|
|
|
'post_status' => 'publish',
|
|
|
|
|
'post_author' => get_current_user_id(),
|
2018-04-03 12:53:41 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$n_id = wp_insert_post( $n );
|
|
|
|
|
|
|
|
|
|
$n_fields = get_post_custom( $post_id );
|
|
|
|
|
foreach ( $n_fields as $key => $value ) {
|
|
|
|
|
|
|
|
|
|
if ( $key == '_um_custom_fields' ) {
|
|
|
|
|
$the_value = unserialize( $value[0] );
|
|
|
|
|
} else {
|
|
|
|
|
$the_value = $value[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update_post_meta( $n_id, $key, $the_value );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-28 15:51:45 +02:00
|
|
|
delete_post_meta( $n_id, '_um_core' );
|
2018-04-03 12:53:41 +03:00
|
|
|
|
2020-02-28 15:51:45 +02:00
|
|
|
$url = admin_url( 'edit.php?post_type=um_form' );
|
|
|
|
|
$url = add_query_arg( 'update', 'form_duplicated', $url );
|
2018-04-03 12:53:41 +03:00
|
|
|
|
|
|
|
|
exit( wp_redirect( $url ) );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Action to hide notices in admin
|
|
|
|
|
*
|
|
|
|
|
* @param $action
|
|
|
|
|
*/
|
|
|
|
|
function um_hide_notice( $action ) {
|
|
|
|
|
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update_option( $action, 1 );
|
|
|
|
|
exit( wp_redirect( remove_query_arg( 'um_adm_action' ) ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Various user actions
|
|
|
|
|
*
|
|
|
|
|
* @param $action
|
|
|
|
|
*/
|
|
|
|
|
function user_action( $action ) {
|
2020-02-28 15:51:45 +02:00
|
|
|
if ( ! is_admin() || ! current_user_can( 'edit_users' ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
if ( ! isset( $_REQUEST['sub'] ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
if ( ! isset( $_REQUEST['user_id'] ) ) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
2018-04-03 12:53:41 +03:00
|
|
|
|
2020-02-28 15:51:45 +02:00
|
|
|
um_fetch_user( absint( $_REQUEST['user_id'] ) );
|
2018-04-03 12:53:41 +03:00
|
|
|
|
2020-02-28 15:51:45 +02:00
|
|
|
$subaction = sanitize_key( $_REQUEST['sub'] );
|
2018-04-03 12:53:41 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* UM hook
|
|
|
|
|
*
|
|
|
|
|
* @type action
|
|
|
|
|
* @title um_admin_user_action_hook
|
|
|
|
|
* @description Action on bulk user subaction
|
|
|
|
|
* @input_vars
|
|
|
|
|
* [{"var":"$subaction","type":"string","desc":"Bulk Subaction"}]
|
|
|
|
|
* @change_log
|
|
|
|
|
* ["Since: 2.0"]
|
|
|
|
|
* @usage add_action( 'um_admin_user_action_hook', 'function_name', 10, 1 );
|
|
|
|
|
* @example
|
|
|
|
|
* <?php
|
|
|
|
|
* add_action( 'um_admin_user_action_hook', 'my_admin_user_action', 10, 1 );
|
|
|
|
|
* function my_admin_user_action( $subaction ) {
|
|
|
|
|
* // your code here
|
|
|
|
|
* }
|
|
|
|
|
* ?>
|
|
|
|
|
*/
|
2020-02-28 15:51:45 +02:00
|
|
|
do_action( 'um_admin_user_action_hook', $subaction );
|
2018-04-03 12:53:41 +03:00
|
|
|
/**
|
|
|
|
|
* UM hook
|
|
|
|
|
*
|
|
|
|
|
* @type action
|
|
|
|
|
* @title um_admin_user_action_{$subaction}_hook
|
|
|
|
|
* @description Action on bulk user subaction
|
|
|
|
|
* @change_log
|
|
|
|
|
* ["Since: 2.0"]
|
|
|
|
|
* @usage add_action( 'um_admin_user_action_{$subaction}_hook', 'function_name', 10 );
|
|
|
|
|
* @example
|
|
|
|
|
* <?php
|
|
|
|
|
* add_action( 'um_admin_user_action_{$subaction}_hook', 'my_admin_user_action', 10 );
|
|
|
|
|
* function my_admin_user_action() {
|
|
|
|
|
* // your code here
|
|
|
|
|
* }
|
|
|
|
|
* ?>
|
|
|
|
|
*/
|
|
|
|
|
do_action( "um_admin_user_action_{$subaction}_hook" );
|
|
|
|
|
|
|
|
|
|
um_reset_user();
|
|
|
|
|
|
2020-02-28 15:51:45 +02:00
|
|
|
wp_redirect( add_query_arg( 'update', 'user_updated', admin_url( '?page=ultimatemember' ) ) );
|
2018-04-03 12:53:41 +03:00
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add any custom links to plugin page
|
|
|
|
|
*
|
|
|
|
|
* @param array $links
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
function plugin_links( $links ) {
|
|
|
|
|
$more_links[] = '<a href="http://docs.ultimatemember.com/">' . __( 'Docs', 'ultimate-member' ) . '</a>';
|
|
|
|
|
$more_links[] = '<a href="'.admin_url().'admin.php?page=um_options">' . __( 'Settings', 'ultimate-member' ) . '</a>';
|
|
|
|
|
|
|
|
|
|
$links = $more_links + $links;
|
|
|
|
|
return $links;
|
2017-12-11 09:53:38 +02:00
|
|
|
}
|
2017-10-18 15:45:59 +03:00
|
|
|
|
2017-07-26 14:57:52 +03:00
|
|
|
|
2017-12-11 09:53:38 +02:00
|
|
|
/**
|
|
|
|
|
* Init admin action/filters + request handlers
|
|
|
|
|
*/
|
|
|
|
|
function admin_init() {
|
2018-03-05 16:35:51 +02:00
|
|
|
if ( is_admin() && current_user_can( 'manage_options' ) && ! empty( $_REQUEST['um_adm_action'] ) ) {
|
2020-02-28 15:51:45 +02:00
|
|
|
$action = sanitize_key( $_REQUEST['um_adm_action'] );
|
|
|
|
|
|
2018-03-05 16:35:51 +02:00
|
|
|
/**
|
|
|
|
|
* UM hook
|
|
|
|
|
*
|
|
|
|
|
* @type action
|
|
|
|
|
* @title um_admin_do_action__
|
|
|
|
|
* @description Make some action on custom admin action
|
|
|
|
|
* @input_vars
|
|
|
|
|
* [{"var":"$action","type":"string","desc":"Admin Action"}]
|
|
|
|
|
* @change_log
|
|
|
|
|
* ["Since: 2.0"]
|
|
|
|
|
* @usage add_action( 'um_admin_do_action__', 'function_name', 10, 1 );
|
|
|
|
|
* @example
|
|
|
|
|
* <?php
|
|
|
|
|
* add_action( 'um_admin_do_action__', 'my_admin_do_action', 10, 1 );
|
|
|
|
|
* function my_admin_do_action( $action ) {
|
|
|
|
|
* // your code here
|
|
|
|
|
* }
|
|
|
|
|
* ?>
|
|
|
|
|
*/
|
2020-02-28 15:51:45 +02:00
|
|
|
do_action( 'um_admin_do_action__', $action );
|
2018-03-05 16:35:51 +02:00
|
|
|
/**
|
|
|
|
|
* UM hook
|
|
|
|
|
*
|
|
|
|
|
* @type action
|
|
|
|
|
* @title um_admin_do_action__{$action}
|
|
|
|
|
* @description Make some action on custom admin $action
|
|
|
|
|
* @input_vars
|
|
|
|
|
* [{"var":"$action","type":"string","desc":"Admin Action"}]
|
|
|
|
|
* @change_log
|
|
|
|
|
* ["Since: 2.0"]
|
|
|
|
|
* @usage add_action( 'um_admin_do_action__{$action}', 'function_name', 10, 1 );
|
|
|
|
|
* @example
|
|
|
|
|
* <?php
|
|
|
|
|
* add_action( 'um_admin_do_action__{$action}', 'my_admin_do_action', 10, 1 );
|
|
|
|
|
* function my_admin_do_action( $action ) {
|
|
|
|
|
* // your code here
|
|
|
|
|
* }
|
|
|
|
|
* ?>
|
|
|
|
|
*/
|
2020-02-28 15:51:45 +02:00
|
|
|
do_action( "um_admin_do_action__{$action}", $action );
|
2017-12-11 09:53:38 +02:00
|
|
|
}
|
|
|
|
|
}
|
2017-07-26 14:57:52 +03:00
|
|
|
|
2018-04-03 15:04:14 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Updated post messages
|
|
|
|
|
*
|
|
|
|
|
* @param array $messages
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
function post_updated_messages( $messages ) {
|
|
|
|
|
global $post_ID;
|
|
|
|
|
|
|
|
|
|
$post_type = get_post_type( $post_ID );
|
|
|
|
|
|
|
|
|
|
if ( $post_type == 'um_form' ) {
|
|
|
|
|
$messages['um_form'] = array(
|
|
|
|
|
0 => '',
|
|
|
|
|
1 => __( 'Form updated.', 'ultimate-member' ),
|
|
|
|
|
2 => __( 'Custom field updated.', 'ultimate-member' ),
|
|
|
|
|
3 => __( 'Custom field deleted.', 'ultimate-member' ),
|
|
|
|
|
4 => __( 'Form updated.', 'ultimate-member' ),
|
|
|
|
|
5 => isset( $_GET['revision'] ) ? __( 'Form restored to revision.', 'ultimate-member' ) : false,
|
|
|
|
|
6 => __( 'Form created.', 'ultimate-member' ),
|
|
|
|
|
7 => __( 'Form saved.', 'ultimate-member' ),
|
|
|
|
|
8 => __( 'Form submitted.', 'ultimate-member' ),
|
|
|
|
|
9 => __( 'Form scheduled.', 'ultimate-member' ),
|
|
|
|
|
10 => __( 'Form draft updated.', 'ultimate-member' ),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $messages;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gettext filters
|
|
|
|
|
*
|
|
|
|
|
* @param $translation
|
|
|
|
|
* @param $text
|
|
|
|
|
* @param $domain
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function gettext( $translation, $text, $domain ) {
|
|
|
|
|
global $post;
|
|
|
|
|
if ( isset( $post->post_type ) && $this->is_plugin_post_type() ) {
|
|
|
|
|
$translations = get_translations_for_domain( $domain );
|
|
|
|
|
if ( $text == 'Publish' ) {
|
|
|
|
|
return $translations->translate( 'Create' );
|
|
|
|
|
} elseif ( $text == 'Move to Trash' ) {
|
|
|
|
|
return $translations->translate( 'Delete' );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $translation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fix parent file for correct highlighting
|
|
|
|
|
*
|
|
|
|
|
* @param $parent_file
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function parent_file( $parent_file ) {
|
|
|
|
|
global $current_screen;
|
|
|
|
|
$screen_id = $current_screen->id;
|
|
|
|
|
if ( strstr( $screen_id, 'um_' ) ) {
|
|
|
|
|
$parent_file = 'ultimatemember';
|
|
|
|
|
}
|
|
|
|
|
return $parent_file;
|
|
|
|
|
}
|
2019-10-07 00:48:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 2.0
|
|
|
|
|
*
|
|
|
|
|
* @return core\Admin_Notices()
|
|
|
|
|
*/
|
|
|
|
|
function notices() {
|
|
|
|
|
if ( empty( UM()->classes['admin_notices'] ) ) {
|
|
|
|
|
UM()->classes['admin_notices'] = new core\Admin_Notices();
|
|
|
|
|
}
|
|
|
|
|
return UM()->classes['admin_notices'];
|
|
|
|
|
}
|
2017-12-11 09:53:38 +02:00
|
|
|
}
|
2017-07-26 14:57:52 +03:00
|
|
|
}
|