| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/public_html/old-website/wp-content/plugins/members/admin/ |
Upload File : |
<?php
/**
* General admin functionality.
*
* @package Members
* @subpackage Admin
* @author Justin Tadlock <justintadlock@gmail.com>
* @copyright Copyright (c) 2009 - 2018, Justin Tadlock
* @link https://themehybrid.com/plugins/members
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
# Register scripts/styles.
add_action( 'admin_enqueue_scripts', 'members_admin_register_scripts', 0 );
add_action( 'admin_enqueue_scripts', 'members_admin_register_styles', 0 );
/**
* Get an Underscore JS template.
*
* @since 1.0.0
* @access public
* @param string $name
* @return bool
*/
function members_get_underscore_template( $name ) {
require_once( members_plugin()->dir . "admin/tmpl/{$name}.php" );
}
/**
* Registers custom plugin scripts.
*
* @since 1.0.0
* @access public
* @return void
*/
function members_admin_register_scripts() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_register_script( 'members-settings', members_plugin()->uri . "js/settings{$min}.js", array( 'jquery' ), '', true );
wp_register_script( 'members-edit-post', members_plugin()->uri . "js/edit-post{$min}.js", array( 'jquery' ), '', true );
wp_register_script( 'members-edit-role', members_plugin()->uri . "js/edit-role{$min}.js", array( 'postbox', 'wp-util' ), '', true );
// Localize our script with some text we want to pass in.
$i18n = array(
'button_role_edit' => esc_html__( 'Edit', 'members' ),
'button_role_ok' => esc_html__( 'OK', 'members' ),
'label_grant_cap' => esc_html__( 'Grant %s capability', 'members' ),
'label_deny_cap' => esc_html__( 'Deny %s capability', 'members' ),
'ays_delete_role' => esc_html__( 'Are you sure you want to delete this role? This is a permanent action and cannot be undone.', 'members' ),
'hidden_caps' => members_get_hidden_caps()
);
wp_localize_script( 'members-edit-role', 'members_i18n', $i18n );
}
/**
* Registers custom plugin scripts.
*
* @since 1.0.0
* @access public
* @return void
*/
function members_admin_register_styles() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_register_style( 'members-admin', members_plugin()->uri . "css/admin{$min}.css" );
}
/**
* Function for safely deleting a role and transferring the deleted role's users to the default
* role. Note that this function can be extremely intensive. Whenever a role is deleted, it's
* best for the site admin to assign the user's of the role to a different role beforehand.
*
* @since 0.2.0
* @access public
* @param string $role
* @return void
*/
function members_delete_role( $role ) {
// Get the default role.
$default_role = get_option( 'default_role' );
// Don't delete the default role. Site admins should change the default before attempting to delete the role.
if ( $role == $default_role )
return;
// Get all users with the role to be deleted.
$users = get_users( array( 'role' => $role ) );
// Check if there are any users with the role we're deleting.
if ( is_array( $users ) ) {
// If users are found, loop through them.
foreach ( $users as $user ) {
// If the user has the role and no other roles, set their role to the default.
if ( $user->has_cap( $role ) && 1 >= count( $user->roles ) )
$user->set_role( $default_role );
// Else, remove the role.
else if ( $user->has_cap( $role ) )
$user->remove_role( $role );
}
}
// Remove the role.
remove_role( $role );
// Remove the role from the role factory.
members_unregister_role( $role );
}
/**
* Returns an array of all the user meta keys in the $wpdb->usermeta table.
*
* @since 0.2.0
* @access public
* @global object $wpdb
* @return array
*/
function members_get_user_meta_keys() {
global $wpdb;
return $wpdb->get_col( "SELECT meta_key FROM $wpdb->usermeta GROUP BY meta_key ORDER BY meta_key" );
}