bradvin / wp-admin-color-scheme-generator

A plugin to generate WordPress admin color schemes
http://themergency.com/generators/admin-color-scheme-generator/
10 stars 3 forks source link

Plugin could not be activated because it triggered a fatal error #3

Open lisaleague opened 9 years ago

lisaleague commented 9 years ago

Parse error: syntax error, unexpected T_LOGICAL_AND in /nas/wp/www/cluster-10479/agirlandamac/wp-content/plugins/a-girl-and-a-mac-admin-color-scheme/a-girl-and-a-mac-admin-color-scheme.php on line 56

download

Using WordPress 4.1.1 and Drone Genesis child theme - http://demo.zigzagpress.com/drone/

bradvin commented 9 years ago

can you paste the contents of your a-girl-and-a-mac-admin-color-scheme.php?

lisaleague commented 9 years ago

<?php /**

class a_girl_and_a_mac_Admin_Color_Scheme {

function __construct() {
    add_action( 'admin_enqueue_scripts', array( $this, 'load_default_css') );
    add_action( 'admin_init', array( $this, 'add_color_scheme') );
}

/**
 * Register the custom admin color scheme
 *
 * @TODO Implement RTL stylesheets
 * @TODO Implement Icon colors
 */
function add_color_scheme() {
    wp_admin_css_color(
        'a-girl-and-a-mac',
        __( 'a girl and a mac', 'a-girl-and-a-mac-color-scheme' ),
        plugins_url( 'a-girl-and-a-mac.css', __FILE__ ),
        array( '#4fc1e9', '#2e90b3', '#d43d39', '#d43d39' )
        //array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' )
    );
}

/**
 * Make sure core's default `colors.css` gets enqueued, since we can't
 * @import it from a plugin stylesheet. Also force-load the default colors
 * on the profile screens, so the JS preview isn't broken-looking.
 *
 * Copied from Admin Color Schemes - http://wordpress.org/plugins/admin-color-schemes/
 */
function load_default_css() {

    global $wp_styles;

    $color_scheme = get_user_option( 'admin_color' );

    if ( 'a-girl-and-a-mac' === $color_scheme || in_array( get_current_screen()->base, array( 'profile', 'profile-network' ) ) ) {
        $wp_styles->registered[ 'colors' ]->deps[] = 'colors-fresh';
    }

}

}

new a-girl-and-a-mac_Admin_Color_Scheme();

bradvin commented 9 years ago

ok cool I can see the problem, the very last line should be:

new a_girl_and_a_mac_Admin_Color_Scheme();

lisaleague commented 9 years ago

I edited that, and get the same fatal error:

Plugin could not be activated because it triggered a fatal error. Fatal error: Call to undefined function a_girl_and_a_mac_Admin_Color_Scheme() in /nas/wp/www/cluster-10479/agirlandamac/wp-content/plugins/a-girl-and-a-mac-admin-color-scheme/a-girl-and-a-mac-admin-color-scheme.php on line 56

<?php /**

class a_girl_and_a_mac_Admin_Color_Scheme {

function __construct() {
    add_action( 'admin_enqueue_scripts', array( $this, 'load_default_css') );
    add_action( 'admin_init', array( $this, 'add_color_scheme') );
}

/**
 * Register the custom admin color scheme
 *
 * @TODO Implement RTL stylesheets
 * @TODO Implement Icon colors
 */
function add_color_scheme() {
    wp_admin_css_color(
        'a-girl-and-a-mac',
        __( 'a girl and a mac', 'a-girl-and-a-mac-color-scheme' ),
        plugins_url( 'a-girl-and-a-mac.css', __FILE__ ),
        array( '#4fc1e9', '#2e90b3', '#d43d39', '#d43d39' )
        //array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' )
    );
}

/**
 * Make sure core's default `colors.css` gets enqueued, since we can't
 * @import it from a plugin stylesheet. Also force-load the default colors
 * on the profile screens, so the JS preview isn't broken-looking.
 *
 * Copied from Admin Color Schemes - http://wordpress.org/plugins/admin-color-schemes/
 */
function load_default_css() {

    global $wp_styles;

    $color_scheme = get_user_option( 'admin_color' );

    if ( 'a-girl-and-a-mac' === $color_scheme || in_array( get_current_screen()->base, array( 'profile', 'profile-network' ) ) ) {
        $wp_styles->registered[ 'colors' ]->deps[] = 'colors-fresh';
    }

}

}

a_girl_and_a_mac_Admin_Color_Scheme();