Plugin Directory

Changeset 328493


Ignore:
Timestamp:
01/04/2011 02:07:19 AM (15 years ago)
Author:
kahi
Message:

0.9

Location:
kahis-wp-lite
Files:
4 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • kahis-wp-lite/trunk/admin-page.php

    r215377 r328493  
    77    <div class="wrap" id="<?php echo self::$abbr; ?>">
    88
    9         <h2><?php echo self::$short_name; ?></h2>
     9        <h2><?php echo self::$full_name; ?></h2>
    1010
    11         <p><?php _e('Check what you want to hide.') ?></p>
     11        <p>✔ <?php _e('Check to hide.') ?></p>
    1212
    1313        <form method="post" action="options.php">
    1414
     15<nav role="navigation" class="tabs">
     16    <a href="#col_menu_items" class="active">Menu items</a>
     17    <?php
     18    $i = 0;
     19    foreach (self::$selectors as $s_group_name => $s_group_data) {
     20        $i++;
     21        if (empty($s_group_data)) continue;
     22        echo '<a href="#col_'.$i.'">'.$s_group_name.'</a>';
     23    } ?>
     24   
     25    <a href="#col_custom_css">Custom CSS</a>
     26    <div style="clear:both"></div>
     27</nav>
     28
    1529<?php
    16 // ==============================================================================================
    17 // ======= Menu
     30// ============================================================
     31// Menu
    1832?>
    1933
    20         <div class="col">
     34        <div class="col" id="col_menu_items">
    2135        <h3>Menu items</h3>
    2236        <ul class="col-content tall">
     
    2842        $submenu = self::$remember['submenu'];
    2943
    30         foreach ($menu as $menuitem) {
     44        foreach ($menu as $menuitem) { 
    3145
    32             ?>
     46            // url
     47            if (false !== strpos($menuitem[2], '/'))
     48                $url = get_bloginfo('wpurl').'/wp-admin/admin.php?page='.$menuitem[2];
     49            else
     50                $url = $menuitem[2]; ?>
    3351
    3452            <li><label>
     
    3654                <?php if (isset(self::$settings['menuitems']['1'.md5($menuitem[2])])) echo 'checked="checked"'; ?> />
    3755
    38                 <strong><?php if ($menuitem[0]) echo $menuitem[0]; else echo '— <em>separator</em> —' ?></strong>
     56                <strong><?php
     57                    if ($menuitem[0])
     58                        echo $menuitem[0] . '&nbsp;<a href="'. $url . '">&rarr;</a>';
     59                    else
     60                        echo '— <em>separator</em> —' ?></strong>
    3961            </label>
    4062
     
    4466                echo '<ul>';
    4567                foreach ($submenu[$menuitem[2]] as $menuitem) {
    46                     ?>
    47 
     68                   
     69                    // url
     70                    if (false !== strpos($menuitem[2], '/'))
     71                        $url = get_bloginfo('wpurl').'/wp-admin/admin.php?page='.$menuitem[2];
     72                    else
     73                        $url = $menuitem[2]; ?>
    4874
    4975            <li><label>
    5076                <input type="checkbox" name="<?php echo self::$abbr . '_menuitems[2'.md5($menuitem[2]).']'; ?>"
    5177                <?php if (isset(self::$settings['menuitems']['2'.md5($menuitem[2])])) echo 'checked="checked"'; ?> />
    52 
    53                 <?php echo $menuitem[0] ?>
     78                <?php echo $menuitem[0] ?>&nbsp;<a href="<?php echo $url ?>">&rarr;</a>
    5479            </label>
    55 
    5680
    5781                    <?php
     
    6791
    6892<?php
    69 // ==============================================================================================
    70 // ======= Selector-based lists
     93// ============================================================
     94// Selector-based lists
    7195// go trough self::$settings[elements_to_hide] and echo identifiers from self::$selectors[...][...]
    7296
    7397$vars_to_save[] = 'elements_to_hide';
     98$i = 0;
    7499foreach (self::$selectors as $s_group_name => $s_group_data) {
     100    $i++;
    75101    if (empty($s_group_data)) continue; ?>
    76102
    77     <div class="col <?php echo $s_group_name ?>">
     103    <div class="col <?php echo $s_group_name ?>" id="col_<?php echo $i ?>">
    78104    <h3><?php echo $s_group_name ?></h3>
    79105    <ul class="col-content">
     
    104130
    105131<?php
    106 } ?>
     132}
    107133
     134// ============================================================
     135// Custom CSS ?>
    108136
    109     <div class="col">
    110         <h3>Custom CSS</h3>
    111         <div class="col-content">
    112             <?php $vars_to_save[] = 'custom_css'; ?>
    113             <p>Will be applied on administration only. Example content: <code>#whatever {display:none;}</code></p>
    114             <p><textarea name="<?php echo self::$abbr; ?>_custom_css" cols="30" rows="15"><?php echo htmlspecialchars(self::$settings['custom_css']); ?></textarea></p>
     137        <div class="col" id="col_custom_css">
     138            <h3>Custom CSS</h3>
     139            <div class="col-content">
     140                <?php $vars_to_save[] = 'custom_css'; ?>
     141                <p>Will be applied on administration only. Example content: <code>#whatever {display:none;}</code></p>
     142                <p><textarea name="<?php echo self::$abbr; ?>_custom_css" cols="70" rows="13"><?php echo htmlspecialchars(self::$settings['custom_css']); ?></textarea></p>
     143                <p><small><strong>BTW:</strong> You may also use selectors like <code>body.level_lt_10</code> or <code>.level_2</code> to modify look only for some user-groups</small></p>
     144            </div>
    115145        </div>
    116     </div>
    117146
    118147        <div class="cleaner"></div>
     
    120149        <h3>User level</h3>
    121150        <?php $vars_to_save[] = 'userlevel'; ?>
    122         <p>Apply settings only for users on level &lt;  <input type="text" name="<?php echo self::$abbr ?>_userlevel" value="<?php echo @self::$settings['userlevel'] ?>" size="3" /> (leave empty to apply settings to all user-levels)
     151        <p>Apply settings only for users on level &lt;  <input type="number" min="0" max="11" size="4" name="<?php echo self::$abbr ?>_userlevel" value="<?php echo @self::$settings['userlevel'] ?>" /> (leave empty to apply settings to all user-levels)
    123152            <br />Help: <a href="http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table">Levels vs. Roles</a></p>
    124 
    125153
    126154        <p class="submit">
  • kahis-wp-lite/trunk/kwplite.php

    r215377 r328493  
    55Description: Make WordPress look thin.
    66Author: Peter Kahoun
    7 Version: 0.8.2
     7Version: 0.9
    88Author URI: http://kahi.cz
    99*/
    10 
    11 // @todo next: other selector-boxes [20]
    12 
    1310class kwplite {
    1411    const DEV = false;
     
    4845     **/
    4946    static $selectors = array(
     47
     48
     49'General' => array(
     50
     51    'header-logo' => array('#header-logo', 'Header: WordPress logo'),
     52    'site-visit-button' => array('#site-visit-button', 'Header: Visit site button'), // not since 3.1
     53    'favorite-actions' => array('#favorite-actions', 'Header: Favourite actions'),
     54    'turbo' => array('.turbo-nag', 'Header: Turbo link'), // not since 3.1
     55    'plugins-number' => array('#adminmenu .update-plugins', 'Menu: Plugins number'),
     56    'separator1' => '',
     57    'tab-settings' => array('#show-settings-link', 'Tab: Settings'),
     58    'tab-help' => array('#contextual-help-link-wrap', 'Tab: Help'),
     59    'update-nag' => array('#update-nag, .update-nag', 'Update possibility message'),
     60    'separator2' => '',
     61    'footer' => array('#footer', 'Footer'),
     62    'footer-by' => array('#footer-left', 'Footer: links (left part)'),
     63    'footer-version' => array('#footer-upgrade', 'Footer: version info (right part)'),
     64),
     65
     66'Dashboard' => array(
     67    'right-now' => array('#dashboard_right_now,label[for="dashboard_right_now-hide"]', 'Right now'),
     68    'right-now-comments' => array('#dashboard_right_now .table_discussion', 'Right now: Discussion'),
     69    'right-now-theme' => array('.versions > p', 'Right now: Theme info'),
     70    'right-now-version' => array('#wp-version-message', 'Right now: Version info'),
     71    'recent-comments' => array('#dashboard_recent_comments,label[for="dashboard_recent_comments-hide"]', 'Recent comments'),
     72    'incoming-links' => array('#dashboard_incoming_links,label[for="dashboard_incoming_links-hide"]', 'Incoming links'),
     73    'plugins' => array('#dashboard_plugins,label[for="dashboard_plugins-hide"]', 'Recommended plugins'),
     74    'quickpress' => array('#dashboard_quick_press,label[for="dashboard_quick_press-hide"]', 'QuickPress'),
     75    'drafts' => array('#dashboard_recent_drafts,label[for="dashboard_recent_drafts-hide"]', 'Recent drafts'),
     76    'news1' => array('#dashboard_primary,label[for="dashboard_primary-hide"]', 'WordPress development blog'),
     77    'news2' => array('#dashboard_secondary,label[for="dashboard_secondary-hide"]', 'WordPress other news'),
     78),
     79       
    5080'Post' => array(
    5181    'slug' => array('#edit-slug-box,label[for="slugdiv-hide"]', 'Slug (URL)'),
     
    5888    'separator1' => '',
    5989    'content'  => array('#postdivrich', 'Content'),
    60     'content-tabs' => array('#editor-toolbar', 'Content: Visual/HTML tabs'),
     90    'content-tabs' => array('#editor-toolbar > a', 'Content: Visual/HTML tabs'),
    6191    'content-footer1' => array('tr.mceLast', 'Content: Visual editor footer 1 ("Path")'),
    6292    'content-footer2' => array('table#post-status-info', 'Content: Visual editor footer 2'),
     
    6999    'box-trackbacks' => array('#trackbacksdiv,label[for="trackbacksdiv-hide"]', 'Trackbacks'),
    70100    'box-customfields' => array('#postcustom,label[for="postcustom-hide"]', 'Custom fields'),
     101    'box-formatdiv'  => array('#formatdiv,label[for="formatdiv-hide"]', 'Format'),
    71102    'box-categories'  => array('#categorydiv,label[for="categorydiv-hide"]', 'Categories'),
    72103    'box-tags' => array('#tagsdiv-post_tag,label[for="tagsdiv-post_tag-hide"]', 'Tags'),
    73     'box-author' => array('#authordiv', 'Author'),
     104    'box-author' => array('#authordiv,label[for="authordiv-hide"],#pageauthordiv,label[for="pageauthordiv-hide"]', 'Author'),
    74105    'box-revisions' => array('#revisionsdiv', 'Revisions'),
    75106    'box-postimage' => array('#postimagediv', 'Post image'),
     
    80111    'pageparentdiv' => array('#pageparentdiv', 'Page details (parent page, template and order)'),
    81112),
    82 // @todo add boxes added by plugins - see More Fields plugin - search $wp_meta_boxes in more-fields-manage-pages.php
     113// @maybe todo add boxes added by plugins - see More Fields plugin - search $wp_meta_boxes in more-fields-manage-pages.php
    83114// @todo remember - add selectors for quickedit
    84115// @maybe submit patch to wp core - add ids for sub-fields in #pageparentdiv
    85116
    86 'Dashboard' => array(
    87     'right-now' => array('#dashboard_right_now,label[for="dashboard_right_now-hide"]', 'Right now'),
    88     'right-now-theme' => array('.versions > p', 'Right now: Theme info'),
    89     'right-now-version' => array('#wp-version-message', 'Right now: Version info'),
    90     'recent-comments' => array('#dashboard_recent_comments,label[for="dashboard_recent_comments-hide"]', 'Recent comments'),
    91     'incoming-links' => array('#dashboard_incoming_links,label[for="dashboard_incoming_links-hide"]', 'Incoming links'),
    92     'plugins' => array('#dashboard_plugins,label[for="dashboard_plugins-hide"]', 'Recommended plugins'),
    93     'quickpress' => array('#dashboard_quick_press,label[for="dashboard_quick_press-hide"]', 'QuickPress'),
    94     'drafts' => array('#dashboard_recent_drafts,label[for="dashboard_recent_drafts-hide"]', 'Recent drafts'),
    95     'news1' => array('#dashboard_primary,label[for="dashboard_primary-hide"]', 'WordPress development blog'),
    96     'news2' => array('#dashboard_secondary,label[for="dashboard_secondary-hide"]', 'WordPress other news'),
    97 ),
    98 // @maybe right-now subfields: comments (8 cells), category, tags, pages, posts (per 2 cells)
    99 
    100 'General' => array(
    101 
    102     'header-logo' => array('#header-logo', 'Header: WordPress logo'),
    103     'site-visit-button' => array('#site-visit-button', 'Header: Visit site button'),
    104     'favorite-actions' => array('#favorite-actions', 'Header: Favourite actions'),
    105     'turbo' => array('.turbo-nag', 'Header: Turbo link'),
    106     'plugins-number' => array('#adminmenu .update-plugins', 'Menu: Plugins number'),
    107     'separator1' => '',
    108     'tab-settings' => array('#show-settings-link', 'Tab: Settings'),
    109     'tab-help' => array('#contextual-help-link-wrap', 'Tab: Help'),
    110     'update-nag' => array('#update-nag', 'Update possibility message'),
    111     'separator2' => '',
    112     'footer' => array('#footer', 'Footer'),
    113     'footer-by' => array('#footer-left', 'Footer: version info (left part)'),
    114     'footer-version' => array('#footer-upgrade', 'Footer: links (right part)'),
    115 ),
    116117
    117118'Links' => array(
     
    131132),
    132133
    133 'Other' => array(
     134'Media, images & galleries' => array(
     135    // @todo test !!!
     136    'media_tab-type' => array('#media-upload #tab-type', 'Tab 1: upload'),
     137    'media_tab-type_url' => array('#media-upload #tab-type_url', 'Tab 2: insert from URL'),
     138    'media_tab-gallery' => array('#media-upload #tab-gallery', 'Tab 3: post\'s attachments'),
     139    'media_tab-library' => array('#media-upload #tab-library', 'Media tab 4: media library'),
     140    'separator1' => '',
     141    'media_item_post_title' => array('#media-upload .post_title', 'Title'),
     142    'media_item_image_alt' => array('#media-upload .image_alt, #media-single-form .image_alt', 'Alternate Text'),
     143    'media_item_post_excerpt' => array('#media-upload .post_excerpt, #media-single-form .post_excerpt', 'Caption'),
     144    'media_item_post_content' => array('#media-upload .post_content, #media-single-form .post_content', 'Description'),
     145    'media_item_url' => array('#media-upload .url', 'Link URL'),
     146    'media_item_url_button_urlpost' => array('#media-upload .button.urlpost', 'Link URL: "Post URL" button'),
     147    'media_item_url_help' => array('#media-upload .url .help', 'Link URL: Help note'),
     148    'media_item_align' => array('#media-upload .align', 'Alignment'),
     149    'media_item_image-size' => array('#media-upload .image-size', 'Size'),
     150
     151    'separator2' => '',
     152   
     153    'media_gallery' => array('#media-upload #gallery-settings,  #gallery-settings > *,', 'Media: Gallery'),
     154
     155   
     156   
     157    'separator3' => '',
     158
     159#sort-buttons
     160
     161    'media_search'  => array('#media-upload form#filter', 'Media search'),
     162   
     163   
     164   
     165   
     166   
    134167    // @todo Edit Comments (spam marking and folder)
    135168    // @todo Edit Media (Alternate text, Description, Caption)
     
    139172
    140173
    141 
    142     // Descr: initialization. filling main variables, preparing, hooking
    143     // Descr: constructor replacement (this class is designed to be used as static). calling the initialization: see the end.
     174    /**
     175     * Initialization - filling main variables, preparing data, hooking into WP. Constructor replacement.
     176     *
     177     * @uses apply_filters('kwplite_selectors_init')
     178     */
    144179    public static function Init () {
    145180        if (self::DEV) error_reporting(E_ALL);
     
    162197        add_action('admin_head', array (self::$abbr, 'admin_head'));
    163198        add_action('admin_menu', array (self::$abbr, 'admin_menu'));
     199        add_filter ('admin_body_class', array(__CLASS__,'admin_body_class'));
     200        // hookable. $selectors array is modifyable
     201        self::$selectors = apply_filters('kwplite_selectors_init', self::$selectors);
    164202    }
    165203
     
    193231            return;
    194232
    195 
    196233        // remove hidden items from $menu
    197234        foreach ($menu as $key => $menuitem) {
     235           
    198236            // if (array_key_exists('1'.md5($menuitem[2]), (self::$settings['menuitems'])) {
    199237            if (isset(self::$settings['menuitems']['1'.md5($menuitem[2])])) {
     
    249287    /* options-page interface */
    250288
     289    #kwplite h3 {
     290        font-family: Georgia, serif; font-size: 20px; font-weight: normal;
     291    }
     292
    251293    #kwplite div.col {
    252         float:left; margin-right:20px;
    253         min-width:200px; max-width:350px; padding-top:20px;
     294        padding:20px;
     295        border: 1px solid #ccc;
     296        -moz-border-radius:    7px;
     297        -webkit-border-radius: 7px;
     298        border-radius:         7px;
     299    }
     300   
     301    #kwplite div.col .col-content.tall {
     302        -moz-column-count: 3;
     303        -moz-column-gap: 20px;
     304        -webkit-column-count: 3;
     305        -webkit-column-gap: 20px;
     306        column-count: 3;
     307        column-gap: 20px;
    254308    }
    255309
    256310        #kwplite div.col .col-content {
    257             height:380px; padding-right:2em; overflow-y:scroll;
    258         }
    259 
    260         #kwplite div.col .col-content.tall {
    261             height:780px;
     311            overflow-y: auto;
     312            max-height: 520px;
    262313        }
    263314
     
    283334    }
    284335
     336    /* tabs */
     337
     338    #kwplite nav.tabs {
     339        display: block; margin: 0 14px;
     340    }
     341   
     342    #kwplite nav.tabs a {
     343        float: left; margin-right: 3px; position: relative; top: 0px;
     344        padding: 5px 15px;
     345        border: 1px solid #ccc; border-bottom-color: #f7f7f7;
     346        -moz-border-radius:    7px 7px 0 0;
     347        -webkit-border-radius: 7px 7px 0 0;
     348        border-radius:         7px 7px 0 0;
     349        background-color: #f4f4f4;
     350        text-decoration: none;
     351    }
     352   
     353    #kwplite nav.tabs a.active {
     354        top: 1px;
     355        background-color: transparent;
     356        color: #333;
     357    }
     358    #kwplite nav.tabs a:hover {
     359        color: #333;
     360    }
    285361
    286362    /* post-editing elements hiding xxx */
     
    317393</style>
    318394
     395<script type="text/javascript">
     396jQuery(document).ready(function(){
     397
     398    // #reusable #tabs 2010.12.12
     399    jQuery('#kwplite nav.tabs a')
     400    .each(function(i){
     401       
     402        if (i > 0)
     403            jQuery(jQuery(this).attr('href')).hide();
     404       
     405    })
     406    .click(function(){
     407       
     408        // clicked = active
     409        if (jQuery(this).is('.active'))
     410            return false;
     411       
     412        // show content
     413        jQuery(jQuery(this).parents('nav').find('.active').attr('href')).hide();
     414        jQuery(jQuery(this).attr('href')).hide().removeClass('hidden').fadeIn('fast');
     415       
     416        // mark tab
     417        jQuery(this).parents('nav').find('.active').removeClass('active');
     418        jQuery(this).addClass('active');
     419
     420        return false;
     421    });
     422   
     423});
     424       
     425</script>
    319426<?php
    320427    }
    321428
     429
     430    /**
     431     * WP Hook: admin_body_class
     432     * Modifies body class by adding class-names reflecting currently logged user's level. Usage: Custom CSS rules applied only on specific user-groups.
     433     **/
     434    public function admin_body_class ($in) {
     435        $current_user = wp_get_current_user();
     436       
     437        for ($i = 1; $i<11; $i++)
     438            if ($i < $current_user->user_level)
     439                $in .= ' level_gt_'.$i;
     440            elseif ($i == $current_user->user_level)
     441                $in .= ' level_'.$i;
     442            elseif ($i > $current_user->user_level)
     443                $in .= ' level_lt_'.$i;
     444           
     445        return $in;
     446    }
    322447
    323448    // ====================  WP administration pages  ====================
  • kahis-wp-lite/trunk/readme.txt

    r215377 r328493  
    44Tags: lite, wplite, usability, admin, administration, minimal, light, lightweight, hide, customization
    55Requires at least: 2.7
    6 Tested up to: 2.9.2
     6Tested up to: 3.1
    77Stable tag: trunk
    88
    9 Hide from your administration functions you don't need!
     9To hide unused functions from the administration. Make it clear.
    1010
    1111== Description ==
    1212
    13 There are always parts in your Wordpress administration you don't currently need. This plugin makes it easy to them - unnecessary menu items or any of the boxes on the posting screen (like custom fields or trackback box). Unclutter the administration and work faster.
     13There are always parts in the WP administration you don't currently need. This plugin makes it easy to hide them - like unnecessary menu items or any of the boxes on the posting screen (like custom fields or trackback box). Unclutter the administration and work faster.
    1414
    1515You can also input your own CSS code to modify the look of administration.
    1616
    1717For more information, support, giving feedback, reporting problems (thank you for that!) or anything else - see the [official plugin's page](http://kahi.cz/wordpress/wp-lite-plugin/).
    18 
    19 = Requirements =
    20 
    21 **PHP 5** on your server is necessary to run this plugin.
    2218
    2319== Screenshots ==
     
    2622
    2723== Changelog ==
     24
     25= 0.9 =
     26* ADD: Some of the details brought by WP 3.1
     27* MOD: Interface improvements
     28
     29= 0.8.3 =
     30* FIX: Various small fixes
     31* ADD: Media/Gallery screens items switching
    2832
    2933= 0.8.2 =
Note: See TracChangeset for help on using the changeset viewer.