Skip to content

Commit

Permalink
Change enqueue of the script to solid style
Browse files Browse the repository at this point in the history
  • Loading branch information
bueltge committed Nov 14, 2019
1 parent 8b6e1e3 commit 32b0c2c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 27 deletions.
8 changes: 5 additions & 3 deletions inc/autoload/class-add-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class Enqueue_Column_Style {
* Init function to register all used hooks.
*/
public function __construct() {
add_action( 'admin_head-themes.php', array( $this, 'enqueue_style' ) );
add_action( 'admin_head-plugins.php', array( $this, 'enqueue_style' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ) );
}

/**
Expand All @@ -45,7 +44,10 @@ public static function init() {
/**
* Enqueue column style.
*/
public function enqueue_style() {
public function enqueue_style( $hook ) {
if ( is_admin() && ! in_array( $hook, array( 'themes.php', 'plugins.php' ), true ) ) {
return;
}
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

wp_register_style(
Expand Down
22 changes: 6 additions & 16 deletions inc/autoload/class-add-theme-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ public function __construct() {
* Initialize the class.
*/
public static function init() {

$class = __CLASS__;
if ( empty( $GLOBALS[ $class ] ) ) {
$GLOBALS[ $class ] = new $class;
$GLOBALS[ $class ] = new $class();
}
}

Expand All @@ -113,13 +112,12 @@ public static function init() {
* @since 2016-10-23
*/
public function notice_about_clear_cache() {

$class = 'notice notice-info';
$message = esc_attr__(
$message = __(
'Multisite Enhancements: Theme usage information is not cached while WP_DEBUG is true.',
'multisite-enhancements'
'multisite-enhancements'
);
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, esc_attr( $message ) );
}

/**
Expand Down Expand Up @@ -251,13 +249,11 @@ public function manage_themes_custom_column( $column_name, $theme_key, \WP_Theme
* @return array
*/
public function is_theme_active_on_blogs( $theme_key ) {

$blogs_themes = $this->get_blogs_themes();

$active_in_themes = array();

foreach ( $blogs_themes as $blog_id => $data ) {

if ( $data['stylesheet'] === $theme_key ) {
$active_in_themes[ $blog_id ] = array(
'name' => $data['blogname'],
Expand Down Expand Up @@ -331,7 +327,6 @@ public function get_blogs_themes() {
* @return bool
*/
public function development_helper() {

if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
return false;
}
Expand All @@ -348,19 +343,17 @@ public function development_helper() {
* @since 2015-02-21
*/
public function clear_themes_site_transient() {

delete_site_transient( self::$site_transient_blogs_themes );
}

/**
* Check, the current theme have a parent value and is a child theme.
*
* @param array|\WP_Theme $theme_data An array of theme data.
* @param array|WP_Theme $theme_data An array of theme data.
*
* @return bool
*/
public function is_child( \WP_Theme $theme_data ) {

public function is_child( WP_Theme $theme_data ) {
return (bool) $theme_data->parent();
}

Expand All @@ -375,7 +368,6 @@ public function is_child( \WP_Theme $theme_data ) {
* @return array
*/
public function is_parent( $theme_key ) {

$blogs_themes = $this->get_blogs_themes();
$parent_of = array();

Expand All @@ -385,7 +377,6 @@ public function is_parent( $theme_key ) {
* @var array $data
*/
foreach ( $blogs_themes as $blog_id => $data ) {

$template = false;
if ( array_key_exists( 'template', $data ) ) {
$template = $data['template'];
Expand All @@ -408,7 +399,6 @@ public function is_parent( $theme_key ) {
* @return bool
*/
public function is_archived( $site_id ) {

$site_id = (int) $site_id;

return (bool) get_blog_details( $site_id )->archived;
Expand Down
7 changes: 1 addition & 6 deletions inc/autoload/class-admin-bar-tweaks.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ class Multisite_Admin_Bar_Tweaks {
* Initialize this class.
*/
public static function init() {

$class = __CLASS__;
if ( empty( $GLOBALS[ $class ] ) ) {
$GLOBALS[ $class ] = new $class;
$GLOBALS[ $class ] = new $class();
}
}

Expand All @@ -31,7 +30,6 @@ public static function init() {
* @since 0.0.1
*/
public function __construct() {

add_action( 'wp_before_admin_bar_render', array( $this, 'enhance_network_admin_bar' ) );
add_action( 'wp_before_admin_bar_render', array( $this, 'enhance_network_blog_admin_bar' ) );
}
Expand All @@ -42,7 +40,6 @@ public function __construct() {
* @since 0.0.1
*/
public function enhance_network_admin_bar() {

global $wp_admin_bar;

// Show only when the user has at least one site, or they're a super admin.
Expand Down Expand Up @@ -95,13 +92,11 @@ public function enhance_network_blog_admin_bar() {
}

foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {

switch_to_blog( $blog->userblog_id );

$menu_id = 'blog-' . $blog->userblog_id;

if ( current_user_can( 'edit_posts' ) ) {

$wp_admin_bar->remove_node( $menu_id . '-c' );

$awaiting_mod = wp_count_comments();
Expand Down
3 changes: 1 addition & 2 deletions inc/autoload/class-change-footer-text.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ class Multisite_Change_Footer_Text {
* Initialize the class.
*/
public static function init() {

$class = __CLASS__;
if ( empty( $GLOBALS[ $class ] ) ) {
$GLOBALS[ $class ] = new $class;
$GLOBALS[ $class ] = new $class();
}
}

Expand Down

0 comments on commit 32b0c2c

Please sign in to comment.