WordPress.org

Plugin Directory

Changeset 632456


Ignore:
Timestamp:
11/30/12 22:16:56 (17 months ago)
Author:
miqrogroove
Message:

Rough work on a login page contrast solution.

Location:
fix-admin-contrast/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fix-admin-contrast/trunk/admin-contrast.php

    r632128 r632456  
    1111 * 
    1212 * @author: Robert Chapin (miqrogroove) 
    13  * @version: 1.4.1 
     13 * @version: 1.5 alpha 
    1414 * @copyright Copyright © 2010-2012 by Robert Chapin 
    1515 * @license GPL 
     
    3636} 
    3737add_action('admin_init', 'miqro_contrast_hook', 10, 0); 
     38add_action('login_head', 'miqro_contrast_login', 10, 0); 
    3839 
    3940 
     
    4142 
    4243/** 
    43  * Hooks one of the following output functions based on WP version. 
     44 * Hooks up the administration logic. 
    4445 */ 
    4546function miqro_contrast_hook() { 
     47    $callback = miqro_contrast_get_callback(); 
     48    if (!empty($callback)) add_action('admin_head', $callback, 10, 0); 
     49} 
     50 
     51/** 
     52 * Login page logic. 
     53 * 
     54 * @since 1.5 
     55 */ 
     56function miqro_contrast_login() { 
     57    $oldest = 33; 
     58    $callback = miqro_contrast_get_callback($oldest); 
     59    if (!empty($callback)) call_user_func($callback); 
     60} 
     61 
     62/** 
     63 * Selects one of the following output functions based on WP version. 
     64 * 
     65 * @since 1.5 
     66 * 
     67 * @param int $oldest Optional.  The oldest WP version supported. 
     68 * @return callback 
     69 */ 
     70function miqro_contrast_get_callback($oldest = 27) { 
     71    $newest = 35; 
     72 
    4673    $wpversion = get_bloginfo('version'); 
    4774    if (strlen($wpversion) < 3) return; 
    48     $wpversion = intval($wpversion[0].$wpversion[2]); 
    49     if ($wpversion < 27) return; 
    50     if ($wpversion > 35) $wpversion = 35; 
    51     elseif ($wpversion > 29 and $wpversion < 34) $wpversion = 29; 
    52     $callback = "miqro_fix_admin_contrast_$wpversion"; 
    53  
    54     add_action('admin_head', $callback, 10, 0); 
     75    $wpversion = min($newest, intval($wpversion[0].$wpversion[2])); 
     76    if ($wpversion < $oldest) return; 
     77    if ($wpversion > 29 and $wpversion < 34) $wpversion = 29; 
     78 
     79    return "miqro_fix_admin_contrast_$wpversion"; 
    5580} 
    5681 
     
    5883 * Tested and working on 3.5 RC2. 
    5984 * Corrects the styles found in: 
    60  *  wp-admin\css\colors-classic.css 
    61  *  wp-admin\css\colors-fresh.css 
    62  *  wp-admin\css\wp-admin.css 
    63  *  wp-includes\css\buttons.css 
    64  *  wp-includes\css\media-views.css 
     85 *  wp-admin/css/colors-classic.css 
     86 *  wp-admin/css/colors-fresh.css 
     87 *  wp-admin/css/wp-admin.css 
     88 *  wp-includes/css/buttons.css 
     89 *  wp-includes/css/media-views.css 
    6590 */ 
    6691function miqro_fix_admin_contrast_35() { 
     
    179204    border-color: #BBB; 
    180205} 
     206input.button-primary { 
     207    border-color: #298cba; 
     208} 
    181209</style> 
    182210<?php 
  • fix-admin-contrast/trunk/readme.txt

    r632128 r632456  
    3232== Changelog == 
    3333 
     34= 1.5 = 
     35* Updated ... 
     36* Fixed contrast on the login page for WordPress 3.3+ 
     37 
    3438= 1.4.1 = 
    3539* Updated for WordPress 3.5, released 30 November 2012. 
Note: See TracChangeset for help on using the changeset viewer.