Plugin Directory

Changeset 660262

Timestamp:
01/28/2013 06:42:12 PM (12 years ago)
Author:
japh
Message:

Release 2.0

Location:
wp-butler/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-butler/trunk/readme.txt

    r659251 r660262  
    66Requires at least: 3.1 
    77Tested up to: 3.5 
    8 Stable tag: 1.9
     8Stable tag:
    99
    1010Provides a text field in the WP Admin allowing you to jump to common WP Actions.
     
    4444
    4545== Changelog ==
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
    4656
    4757= 1.9 =
  • wp-butler/trunk/wp-butler.php

    r659251 r660262  
    44Plugin URI:  http://wpbutler.com
    55Description: WP Butler brings you what you need in the Wordpress Admin. An autocomplete menu to let you jump to all the common tasks you may need to perform, just hit <code>shift+alt+b</code>!
    6 Version:     1.9
     6Version:     
    77Author:      Japh
    88Author URI:  http://japh.com.au
     
    2626*/
    2727
    28 // Check to See if the Class already exists!
     28/**
     29 * WP Butler
     30 *
     31 * WP Butler brings you what you need in the Wordpress Admin. An autocomplete
     32 * menu to let you jump to all the common tasks you may need to perform, just
     33 * hit `shift+alt+b`!
     34 *
     35 * @author Japh <wordpress@japh.com.au>
     36 * @version 2.0
     37 * @package WP-Butler
     38 * @license http://opensource.org/licenses/gpl-2.0.php GPL2
     39 */
     40
     41// Check to see if the class already exists!
    2942if ( ! class_exists( 'Japh_Butler' ) ) {
    3043
    3144    /**
     45
     46
    3247     * @package WP-Butler
    33      * @version 1.9
     48     * @version 2.0
     49     * @since 1.2
    3450     */
    3551
    3652    class Japh_Butler {
    3753
    38         public $version = '1.9';
     54        /**
     55         * Version number for WP Butler
     56         *
     57         * This is for internal reference, should it be needed.
     58         *
     59         * @since 1.2
     60         */
     61        public $version = '2.0';
     62        /**
     63         * Array of available post types
     64         * @since 1.4
     65         */
    3966        public $post_types = array();
     67
     68
     69
     70
    4071        public $taxonomies = array();
    4172
     73
     74
     75
     76
     77
    4278        function __construct() {
    4379
    4480            if ( ! is_admin() )
    4581                return NULL;
    46            
     82
    4783            load_plugin_textdomain( 'wp-butler', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    48            
     84
    4985            $this->post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects', 'and' );
    5086            $this->taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects', 'and' );
    51            
     87
    5288            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
    5389            add_action( 'admin_footer', array( $this, 'footer' ) );
    5490            add_action( 'wp_ajax_wp_butler_actions', array( $this, 'actions' ) );
    5591            add_action( 'admin_bar_menu', array( $this, 'enhance_admin_bar' ), 9999 );
    56         }
    57 
     92
     93        }
     94
     95        /**
     96         * Footer HTML output
     97         *
     98         * This is the HTML for the WP Butler dialog.
     99         *
     100         * @since 1.2
     101         */
    58102        function footer() {
    59103            echo '<div id="wp-butler-dialog" title="' . __( "What would you like to do?", "wp-butler" ) . '">';
     
    64108        }
    65109
     110
     111
     112
     113
     114
     115
     116
    66117        function enqueue() {
    67118            // Enqueue styles
     
    111162        }
    112163
    113         // Action methods
     164        /**
     165         * Generic action methods
     166         *
     167         * @since 1.4
     168         *
     169         * @param Array $actions Array of current actions for WP Butler
     170         */
    114171        function generate_generic_actions( $actions ) {
    115172            array_push( $actions, array( "label" => __( "Dashboard" ), "url" => "index.php" ) );
     
    145202        }
    146203
     204
     205
     206
     207
     208
     209
     210
    147211        function generate_site_actions( $actions ) {
    148212            if ( current_user_can( 'upload_files' ) ) {
     
    179243        }
    180244
     245
     246
     247
     248
     249
     250
     251
    181252        function generate_multisite_actions( $actions ) {
    182253            if ( current_user_can( 'manage_sites' ) ) {
     
    195266        }
    196267
     268
     269
     270
     271
     272
     273
     274
    197275        function generate_post_type_actions( $actions ) {
    198276            foreach ( $this->post_types as $post_type => $post_type_object ) {
     
    212290        }
    213291
     292
     293
     294
     295
     296
     297
     298
    214299        function generate_taxonomy_actions( $actions ) {
    215300            foreach ( $this->taxonomies as $taxonomy => $taxonomy_object ) {
     
    229314        }
    230315
    231         // Keyword methods
     316        /**
     317         * Keyword methods
     318         *
     319         * @since 1.7
     320         *
     321         * @param String $term Term for search keyword
     322         * @param Array $actions Array of current actions for WP Butler
     323         */
    232324        function search_keyword( $term, $actions ) {
    233325            $term_words = explode( ' ', $_REQUEST['term'] );
     
    270362        }
    271363
     364
     365
     366
     367
     368
     369
     370
     371
    272372        function activate_plugin_keyword( $term, $actions ) {
    273373            $term_words = explode( ' ', $_REQUEST['term'] );
     
    309409        }
    310410
     411
     412
     413
     414
     415
     416
     417
     418
    311419        function user_search_keyword( $term, $actions ) {
    312420            $term_words = explode( ' ', $_REQUEST['term'] );
     
    335443        }
    336444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
    337486        function actions() {
    338487            require_once( ABSPATH . '/wp-includes/l10n.php' );
     
    367516                        list( $term, $butler_actions ) = $this->user_search_keyword( $term, $butler_actions );
    368517                        list( $term, $butler_actions ) = $this->activate_plugin_keyword( $term, $butler_actions );
     518
    369519
    370520                        list( $term, $butler_actions ) = apply_filters( 'wp_butler_ajax_keyword_actions', array( $term, $butler_actions ) );
    371521
    372                         $random_action_url = $butler_actions[mt_rand( 0, count( $butler_actions ) ) - 1]['url'];
    373                         array_push( $butler_actions, array( "label" => __( "Surprise me!", "wp-butler" ), "url" => $random_action_url ) );
     522                        if ( ! empty( $butler_actions ) ) {
     523                            $random_action_url = $butler_actions[mt_rand( 0, count( $butler_actions ) - 1 )]['url'];
     524                            array_push( $butler_actions, array( "label" => __( "Surprise me!", "wp-butler" ), "url" => $random_action_url ) );
     525                        }
    374526                }
    375527
     
    390542         * Enhance the admin bar
    391543         *
    392          * @param  $wp_admin_bar  Array
     544         * @param 
    393545         * @return void
    394546         * @author bueltge
     
    396548         */
    397549        public function enhance_admin_bar( $wp_admin_bar ) {
    398            
     550            global $wp_admin_bar;
     551
    399552            if ( ! is_super_admin() || ! is_admin_bar_showing() )
    400553                return NULL;
    401            
     554
    402555            $classes = apply_filters( 'wp_butler_admin_bar_classes', array() );
    403556            $classes = implode( ' ', $classes );
    404            
    405             $wp_admin_bar->add_menu(
    406                 array(
    407                     'id'        => 'wp-butler',
    408                     'parent'    => 'top-secondary',
    409                     'secondary' => FALSE,
    410                     'title'     => apply_filters( 'wp_butler_admin_bar_title', __( 'WP Butler', 'wp-butler' ) ),
    411                     'meta'      => array( 'class' => $classes )
    412                 )
     557
     558            $args = array(
     559                'id'        => 'wp-butler',
     560                'parent'    => 'top-secondary',
     561                'secondary' => FALSE,
     562                'title'     => apply_filters( 'wp_butler_admin_bar_title', __( 'WP Butler', 'wp-butler' ) ),
     563                'meta'      => array( 'class' => $classes )
    413564            );
     565
     566
    414567        }
    415568
     
    418571}
    419572
     573
     574
     575
     576
     577
     578
     579
     580
    420581function execute_wp_butler() {
    421582    $japh_butler = new Japh_Butler();
  • wp-butler/trunk/wpbutler.css

    r659251 r660262  
    11#wp-butler-dialog {
    2     display: none;
    3     min-height: inherit !important;
    4 }
     2  display: none;
     3  min-height: inherit !important; }
    54
    65/* Admin Bar item */
    76#wp-admin-bar-wp-butler:hover {
    8     cursor: pointer;
    9 }
     7  cursor: pointer; }
     8
     9/* Namespaced Butler Widget */
     10.butler-ui-widget {
     11  padding: 1em;
     12  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.3), 0 0 5px rgba(0, 0, 0, 0.6); }
     13  .butler-ui-widget .ui-dialog-titlebar {
     14    background: none;
     15    border: none;
     16    padding: 0; }
     17  .butler-ui-widget .ui-dialog-content {
     18    padding: 0; }
     19  .butler-ui-widget p {
     20    display: none;
     21    margin: 0; }
     22  .butler-ui-widget #wp-butler-field {
     23    line-height: 1.2;
     24    display: block;
     25    width: 100%;
     26    -webkit-box-sizing: border-box;
     27    -moz-box-sizing: border-box;
     28    box-sizing: border-box;
     29    margin: 0.5em 0;
     30    padding: 0.5em;
     31    font-size: 2em; }
  • wp-butler/trunk/wpbutler.js

    r659251 r660262  
    66        $( "#wp-butler-dialog" ).dialog({
    77            modal: true,
    8             closeOnEscape: true
    9         });
     8            closeOnEscape: true,
     9            width: 420
     10        }).parent().addClass('butler-ui-widget');
    1011   
    1112        $( "#wp-butler-field" ).focus();
     
    1617        $( "#wp-butler-dialog" ).dialog( {
    1718            modal: true,
    18             closeOnEscape: true
    19         });
     19            closeOnEscape: true,
     20            width: 420
     21        }).parent().addClass('butler-ui-widget');
    2022       
    2123        $( "#wp-butler-field" ).focus();
Note: See TracChangeset for help on using the changeset viewer.