Reformat code to wordpress name conventions
This commit is contained in:
parent
721c0bd720
commit
7ddee71da0
|
@ -3,16 +3,13 @@
|
|||
namespace Tainacan;
|
||||
|
||||
|
||||
|
||||
class Admin {
|
||||
|
||||
private $menu_slug = 'tainacan_admin';
|
||||
private static $instance = null;
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if(!isset(self::$instance))
|
||||
{
|
||||
public static function getInstance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
|
@ -46,9 +43,10 @@ class Admin {
|
|||
}
|
||||
|
||||
function login_styles_reset( $style ) {
|
||||
if ( strpos( $style, 'wp-admin-css') !== FALSE ) {
|
||||
$style = NULL;
|
||||
if ( strpos( $style, 'wp-admin-css' ) !== false ) {
|
||||
$style = null;
|
||||
}
|
||||
|
||||
return $style;
|
||||
}
|
||||
|
||||
|
@ -57,11 +55,36 @@ class Admin {
|
|||
|
||||
wp_enqueue_style( 'tainacan-admin-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-admin.css' );
|
||||
|
||||
$undesired_wp_styles = [ 'admin-menu', 'admin-bar', 'code-editor', 'color-picker',
|
||||
'customize-controls', 'customize-nav-menus', 'customize-widgets', 'dashboard',
|
||||
'dashicons', 'deprecated-media', 'edit', 'wp-pointer', 'farbtastic', 'forms', 'common',
|
||||
'install', 'wp-auth-check', 'site-icon', 'buttons', 'l10n', 'list-tables','login',
|
||||
'media', 'nav-menus', 'revisions', 'themes', 'widgets', 'wp-admin'];
|
||||
$undesired_wp_styles = [
|
||||
'admin-menu',
|
||||
'admin-bar',
|
||||
'code-editor',
|
||||
'color-picker',
|
||||
'customize-controls',
|
||||
'customize-nav-menus',
|
||||
'customize-widgets',
|
||||
'dashboard',
|
||||
'dashicons',
|
||||
'deprecated-media',
|
||||
'edit',
|
||||
'wp-pointer',
|
||||
'farbtastic',
|
||||
'forms',
|
||||
'common',
|
||||
'install',
|
||||
'wp-auth-check',
|
||||
'site-icon',
|
||||
'buttons',
|
||||
'l10n',
|
||||
'list-tables',
|
||||
'login',
|
||||
'media',
|
||||
'nav-menus',
|
||||
'revisions',
|
||||
'themes',
|
||||
'widgets',
|
||||
'wp-admin'
|
||||
];
|
||||
|
||||
wp_dequeue_style( $undesired_wp_styles );
|
||||
wp_deregister_style( $undesired_wp_styles );
|
||||
|
@ -73,6 +96,7 @@ class Admin {
|
|||
if ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] == $this->menu_slug ) {
|
||||
$classes .= ' tainacan-admin-page';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
|
@ -109,10 +133,12 @@ class Admin {
|
|||
$prefs = array();
|
||||
if ( $cur_user instanceof \WP_User ) {
|
||||
if ( is_array( $cur_user->allcaps ) ) {
|
||||
foreach ($cur_user->allcaps as $cap => $bool)
|
||||
if ($bool === true)
|
||||
foreach ( $cur_user->allcaps as $cap => $bool ) {
|
||||
if ( $bool === true ) {
|
||||
$user_caps[] = $cap;
|
||||
}
|
||||
}
|
||||
}
|
||||
$prefs = get_user_meta( $cur_user->ID, 'tainacan_prefs', true );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue