Plugin Directory

Changeset 1267552


Ignore:
Timestamp:
10/16/2015 05:51:32 PM (10 years ago)
Author:
LabelBlanc
Message:

Version 1.1

  • New "Save and View" action
  • Major rewrite of the actions logic
  • Some bug fixes
Location:
improved-save-button
Files:
47 added
1 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • improved-save-button/trunk/css/post-edit-rtl.css

    r1220393 r1267552  
    11/* Generated from SASS source files. Do not modify directly. */
    2 .lb-sat-separator{height:10px}@media screen and (max-width: 782px){.lb-sat-separator{height:0}}#publishing-action .lb-sat-spinner{visibility:hidden;display:inline-block;float:none}#publishing-action .lb-sat-spinner.is-active{visibility:visible}.lb-sat-container{position:relative;white-space:nowrap;display:inline-block}.lb-sat-container.lb-sat-dropdown-menu-shown .lb-sat-dropdown-menu{display:block}.lb-sat-main-button{vertical-align:top}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;border-left-style:none}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button.button-large{padding-left:8px}.wp-core-ui .lb-sat-dropdown-button.button{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-webkit-border-top-right-radius:0;border-top-right-radius:0;border-right-style:none;font:400 18px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding:0 4px 0 6px}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding-top:6px;padding-bottom:6px}}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button{font-size:19px}}.wp-core-ui .lb-sat-dropdown-menu-shown .lb-sat-dropdown-button.button{background-color:#EEE;border-color:#999;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5)}.wp-core-ui .lb-sat-dropdown-menu-shown.lb-sat-set-as-default .lb-sat-dropdown-button.button{background-color:#1B7AA6;border-color:#005684;-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(0,0,0,0.1)}.lb-sat-dropdown-menu{position:absolute;display:none;left:0;top:100%;border:1px solid #DDD;z-index:2;background-color:white;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);text-align:right;margin:3px 0 0;min-width:100%}.lb-sat-dropdown-menu li{cursor:pointer;margin:0;padding:4px 12px;white-space:nowrap}.lb-sat-dropdown-menu li.disabled{opacity:0.5;cursor:default}.lb-sat-dropdown-menu li.disabled:hover{color:inherit;background-color:transparent}.lb-sat-dropdown-menu li:hover{color:white;background-color:#1E8CBE}
     2.lb-sat-separator{height:10px}@media screen and (max-width: 782px){.lb-sat-separator{height:0}}#publishing-action .lb-sat-spinner{visibility:hidden;display:inline-block;float:none}#publishing-action .lb-sat-spinner.is-active{visibility:visible}.lb-sat-container{position:relative;white-space:nowrap;display:inline-block}.lb-sat-container.lb-sat-dropdown-menu-shown .lb-sat-dropdown-menu{display:block}.lb-sat-main-button{vertical-align:top}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;border-left-style:none}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button.button-large{padding-left:8px}.lb-sat-main-button .dashicons{vertical-align:text-bottom}.wp-core-ui .lb-sat-dropdown-button.button{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-webkit-border-top-right-radius:0;border-top-right-radius:0;border-right-style:none;font:400 18px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding:0 4px 0 6px}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding-top:6px;padding-bottom:6px}}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button{font-size:19px}}.wp-core-ui .lb-sat-dropdown-menu-shown .lb-sat-dropdown-button.button{background-color:#EEE;border-color:#999;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5)}.wp-core-ui .lb-sat-dropdown-menu-shown.lb-sat-set-as-default .lb-sat-dropdown-button.button{background-color:#1B7AA6;border-color:#005684;-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(0,0,0,0.1)}.lb-sat-dropdown-menu{position:absolute;display:none;left:0;top:100%;border:1px solid #DDD;z-index:2;background-color:white;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);text-align:right;margin:3px 0 0;min-width:100%}.lb-sat-dropdown-menu li{cursor:pointer;margin:0;padding:4px 12px;white-space:nowrap}.lb-sat-dropdown-menu li.disabled{opacity:0.5;cursor:default}.lb-sat-dropdown-menu li.disabled:hover{color:inherit;background-color:transparent}.lb-sat-dropdown-menu li:hover{color:white;background-color:#1E8CBE}
  • improved-save-button/trunk/css/post-edit.css

    r1220393 r1267552  
    11/* Generated from SASS source files. Do not modify directly. */
    2 .lb-sat-separator{height:10px}@media screen and (max-width: 782px){.lb-sat-separator{height:0}}#publishing-action .lb-sat-spinner{visibility:hidden;display:inline-block;float:none}#publishing-action .lb-sat-spinner.is-active{visibility:visible}.lb-sat-container{position:relative;white-space:nowrap;display:inline-block}.lb-sat-container.lb-sat-dropdown-menu-shown .lb-sat-dropdown-menu{display:block}.lb-sat-main-button{vertical-align:top}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-webkit-border-top-right-radius:0;border-top-right-radius:0;border-right-style:none}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button.button-large{padding-right:8px}.wp-core-ui .lb-sat-dropdown-button.button{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;border-left-style:none;font:400 18px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding:0 6px 0 4px}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding-top:6px;padding-bottom:6px}}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button{font-size:19px}}.wp-core-ui .lb-sat-dropdown-menu-shown .lb-sat-dropdown-button.button{background-color:#EEE;border-color:#999;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5)}.wp-core-ui .lb-sat-dropdown-menu-shown.lb-sat-set-as-default .lb-sat-dropdown-button.button{background-color:#1B7AA6;border-color:#005684;-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(0,0,0,0.1)}.lb-sat-dropdown-menu{position:absolute;display:none;right:0;top:100%;border:1px solid #DDD;z-index:2;background-color:white;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);text-align:left;margin:3px 0 0;min-width:100%}.lb-sat-dropdown-menu li{cursor:pointer;margin:0;padding:4px 12px;white-space:nowrap}.lb-sat-dropdown-menu li.disabled{opacity:0.5;cursor:default}.lb-sat-dropdown-menu li.disabled:hover{color:inherit;background-color:transparent}.lb-sat-dropdown-menu li:hover{color:white;background-color:#1E8CBE}
     2.lb-sat-separator{height:10px}@media screen and (max-width: 782px){.lb-sat-separator{height:0}}#publishing-action .lb-sat-spinner{visibility:hidden;display:inline-block;float:none}#publishing-action .lb-sat-spinner.is-active{visibility:visible}.lb-sat-container{position:relative;white-space:nowrap;display:inline-block}.lb-sat-container.lb-sat-dropdown-menu-shown .lb-sat-dropdown-menu{display:block}.lb-sat-main-button{vertical-align:top}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-webkit-border-top-right-radius:0;border-top-right-radius:0;border-right-style:none}.wp-core-ui .lb-sat-with-dropdown .lb-sat-main-button.button.button-large{padding-right:8px}.lb-sat-main-button .dashicons{vertical-align:text-bottom}.wp-core-ui .lb-sat-dropdown-button.button{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;border-left-style:none;font:400 18px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding:0 6px 0 4px}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button.button-large{padding-top:6px;padding-bottom:6px}}@media screen and (max-width: 782px){.wp-core-ui .lb-sat-dropdown-button.button{font-size:19px}}.wp-core-ui .lb-sat-dropdown-menu-shown .lb-sat-dropdown-button.button{background-color:#EEE;border-color:#999;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,0.5)}.wp-core-ui .lb-sat-dropdown-menu-shown.lb-sat-set-as-default .lb-sat-dropdown-button.button{background-color:#1B7AA6;border-color:#005684;-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(0,0,0,0.1)}.lb-sat-dropdown-menu{position:absolute;display:none;right:0;top:100%;border:1px solid #DDD;z-index:2;background-color:white;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);text-align:left;margin:3px 0 0;min-width:100%}.lb-sat-dropdown-menu li{cursor:pointer;margin:0;padding:4px 12px;white-space:nowrap}.lb-sat-dropdown-menu li.disabled{opacity:0.5;cursor:default}.lb-sat-dropdown-menu li.disabled:hover{color:inherit;background-color:transparent}.lb-sat-dropdown-menu li:hover{color:white;background-color:#1E8CBE}
  • improved-save-button/trunk/improved-save-button.php

    r1228200 r1267552  
    22/*
    33Plugin Name: Improved Save Button
    4 Description: Adds a "Save" button to the post edit screen that saves the post and immediately redirect to one of the common page: the post listing, the new post form or the previous or next post edit page.
     4Description: Adds a new "Save" button to the Post Edit screen that saves the post and immediately redirects to one of the common screens: the Posts List, the New Post screen, the previous or next post's Edit screen or the post's frontend page.
    55Author: Label Blanc
    6 Version: 1.0.2
     6Version: 1.1
    77Author URI: http://www.labelblanc.ca
    88Domain Path: /languages/
     
    3131 */
    3232
     33/**
     34 * All the PHP files of the plugin
     35 * @var array
     36 */
    3337$lib_files_to_include = array(
    3438    'class-lb-save-and-then-utils.php',
    3539    'class-lb-save-and-then-settings.php',
    3640    'class-lb-save-and-then-post-edit.php',
    37     'class-lb-save-and-then-redirect.php',
     41    'class-lb-save-and-then-post-save.php',
    3842    'class-lb-save-and-then-messages.php',
     43    'class-lb-save-and-then-actions.php',
     44    'class-lb-save-and-then-action.php',
    3945);
    4046
     47// Include all the PHP files of the plugin
    4148foreach ( $lib_files_to_include as $file_name ) {
    4249    require_once( plugin_dir_path( __FILE__ ) . 'lib' . DIRECTORY_SEPARATOR . $file_name );
     50}
     51
     52/**
     53 * PHP files of the actions that come with the plugin
     54 * @var array
     55 */
     56$actions_files_to_include = array(
     57    'class-lb-save-and-then-action-new.php',
     58    'class-lb-save-and-then-action-list.php',
     59    'class-lb-save-and-then-action-view.php',
     60    'class-lb-save-and-then-action-view-popup.php',
     61    'class-lb-save-and-then-action-next.php',
     62    'class-lb-save-and-then-action-previous.php',
     63);
     64
     65// Include all the actions php files
     66foreach ( $actions_files_to_include as $file_name ) {
     67    require_once( plugin_dir_path( __FILE__ ) . 'actions' . DIRECTORY_SEPARATOR . $file_name );
    4368}
    4469
     
    5277
    5378    /**
    54      * Id of the 'use last' action
    55      */
    56     const ACTION_LAST = '_last';
    57 
    58     /**
    5979     * Main entry point of the plugin. Calls the setup function
    6080     * of the other classes.
     
    6383        LB_Save_And_Then_Settings::setup();
    6484        LB_Save_And_Then_Post_Edit::setup();
    65         LB_Save_And_Then_Redirect::setup();
     85        LB_Save_And_Then_Post_Save::setup();
    6686        LB_Save_And_Then_Messages::setup();
     87        LB_Save_And_Then_Actions::setup();
    6788
    68         add_action( 'admin_init', array( get_called_class(), 'load_languages' ) );
     89        // Priority 1, because the settings page is also on admin_init
     90        // and uses translations
     91        add_action( 'admin_init', array( get_called_class(), 'load_languages' ), 1 );
     92        add_action( 'lbsat_load_actions', array( get_called_class(), 'load_default_actions' ) );
    6993    }
    7094
     
    79103
    80104    /**
     105     * Called by the lbsat_load_actions filter. Loads all the
     106     * actions that come by default with the plugin.
     107     */
     108    static function load_default_actions( $actions ) {
     109        $default_actions_classes = array(
     110            'LB_Save_And_Then_Action_New',
     111            'LB_Save_And_Then_Action_List',
     112            'LB_Save_And_Then_Action_Next',
     113            'LB_Save_And_Then_Action_Previous',
     114            'LB_Save_And_Then_Action_View',
     115            'LB_Save_And_Then_Action_View_Popup',
     116        );
     117
     118        foreach ( $default_actions_classes as $class_name ) {
     119            $actions[] = new $class_name();
     120        }
     121
     122        return $actions;
     123    }
     124
     125    /**
    81126     * Loads the language file for the admin. Must be called in the
    82127     * 'admin_init' hook, since it uses get_plugin_data() and this
     
    88133        $path .= $plugin_data['DomainPath'];
    89134        load_plugin_textdomain( $plugin_data['TextDomain'], false, $path );
    90     }
    91 
    92     /**
    93      * Returns all the possible actions.
    94      *
    95      * Array structure :
    96      * array(
    97      *   <action id> => array(
    98      *     'name' => <Name, displayed in the settings page>,
    99      *     'button_label_pattern' => <Pattern to generate the button name
    100      *                                when the action is selected. %s is replaced
    101      *                                with the publish button label (ex: 'Update')>,
    102      *     'description' => <Displayed in the settings page>
    103      *   )
    104      * )
    105      * @return array All the available actions
    106      */
    107     static function get_actions() {
    108         return array(
    109             'new'      => array(
    110                 'name' => __('Save and New', 'lb-save-and-then'),
    111                 'button_label_pattern' =>__('%s and New', 'lb-save-and-then'),
    112                 'description' => __('Shows the <strong>new post</strong> form after save.', 'lb-save-and-then'),
    113             ),
    114             'list'     => array(
    115                 'name' => __('Save and List', 'lb-save-and-then'),
    116                 'button_label_pattern' =>__('%s and List', 'lb-save-and-then'),
    117                 'description' => __('Shows the <strong>posts list</strong> after save.', 'lb-save-and-then'),
    118             ),
    119             'next'     => array(
    120                 'name' => __('Save and Next', 'lb-save-and-then'),
    121                 'button_label_pattern' =>__('%s and Next', 'lb-save-and-then'),
    122                 'description' => __('Shows the <strong>next post</strong> edit form after save.', 'lb-save-and-then'),
    123             ),
    124             'previous' => array(
    125                 'name' => __('Save and Previous', 'lb-save-and-then'),
    126                 'button_label_pattern' =>__('%s and Previous', 'lb-save-and-then'),
    127                 'description' => __('Shows the <strong>previous post</strong> edit form after save.', 'lb-save-and-then'),
    128             ),
    129         );
    130135    }
    131136
  • improved-save-button/trunk/js/post-edit.js

    r1150608 r1267552  
    5656        this.$form = $form;
    5757        this.config = config;
     58        this.action = null;
    5859
    5960        /**
     
    6970         * enabled (ex : only the "Save and previous", but there is no
    7071         * previous post), we save in the configuration that the
    71          * button set is "dummy".
     72         * button set is "dummy" (i.e. we show it, but it won't do
     73         * anything).
    7274         */
    7375        if( config.actions.length === 1 && ! config.actions[0].enabled ) {
     
    170172
    171173        /**
    172          * Setups listeners on form submit.
    173          */
    174         setupFormListeners : function() {
    175             var self = this;
    176 
    177             this.$form.on('submit', function() {
    178                 self.newPublishButtonSet.disable( true );
    179             });
    180         },
    181 
    182         /**
    183174         * Updates the look of the original publish button, depending
    184175         * if the new publish button must be displayed as the default
     
    201192         */
    202193        setAction : function( newAction ) {
     194            this.action = newAction;
    203195            wpCookies.set( SAT.PostEditForm.LAST_USED_COOKIE_NAME, newAction.id, 365*24*3600 );
    204196            this.$actionInput.val( newAction.id );
     197        },
     198
     199        /**
     200         * Returns the action that was set by setAction
     201         * @return {object} The action
     202         */
     203        getAction : function() {
     204            return this.action;
     205        },
     206
     207        /**
     208         * Submits the form through the use of the action button.
     209         */
     210        submit : function() {
     211            // We set the action to the one currently in the button
     212            this.setAction( this.newPublishButtonSet.getAction() );
     213
     214            // We trigger the custom event
     215            var customSubmitEvent = $.Event('lb-save-and-then:submit');
     216
     217            /*
     218             * The 'lb-save-and-then:submit' event will be triggered
     219             * on the $form. A listening method can prevent the
     220             * form submition by calling preventDefault() on the event.
     221             */
     222            this.$form.trigger( customSubmitEvent, this );
     223
     224            if( customSubmitEvent.isDefaultPrevented() ) {
     225                return;
     226            }
     227
     228            // Save in the form that it was submitted by
     229            // the save-and-then button and submits it
     230            this.$form.data('lbsat-button-submitted', true);
     231
     232            // We trigger a click on the original button, so
     233            // its name is correctly sent in the HTTP request
     234            this.getOriginalPublishButton().click();
     235        },
     236
     237        /**
     238         * Setups listeners on the form submit (no matter which
     239         * button/trigger submitted it).
     240         */
     241        setupFormListeners: function() {
     242            var self = this;
     243
     244            this.$form.on('submit.lbsat-post-edit', function( event ) {
     245                // Will be true if the form was submitted by the action button
     246                var isSATSubmitted = self.$form.data('lbsat-button-submitted');
     247
     248                self.$form.removeData('lbsat-button-submitted');
     249
     250                if( event.isDefaultPrevented() ) {
     251                    return;
     252                }
     253
     254                // If it was submitted through the use of the action
     255                if( isSATSubmitted === true ) {
     256                    // When the form is effectively submitted, we move the
     257                    // spinner just before the new button container
     258                    self.newPublishButtonSet.$container.before( self.$spinner );
     259
     260                    // Browser form submission process continues ...
     261                }
     262            });
    205263        },
    206264
     
    234292
    235293            // If it is '_last', we get it from the cookie. If no cookie : fallback
    236             if( SAT.ACTION_LAST === defaultActionId ) {
     294            if( SAT.ACTION_LAST_ID === defaultActionId ) {
    237295                var cookieVal = wpCookies.get( SAT.PostEditForm.LAST_USED_COOKIE_NAME );
    238296
     
    281339        setupWordpressListeners : function() {
    282340            var self = this;
     341
     342            // When the form is submitted (no matter which button or
     343            // technique was used to submit it), we disable the button.
     344            // But some submit buttons must not disable the button
     345            // (like the preview button). We thus listen to clicks
     346            // on all submit buttons and disable only on specific cases
     347            // @see wordpress/wp-admin/js/post.js:245
     348            this.$form.on( 'click.lbsat-post-edit', ':submit, a.submitdelete, #post-preview', function( event ) {
     349                var $button = $(this);
     350
     351                if ( $button.hasClass('disabled') ) {
     352                    return;
     353                }
     354
     355                if ( $button.hasClass('submitdelete') || $button.is( '#post-preview' ) ) {
     356                    return;
     357                }
     358
     359                // Since it is possible to have a click on a submit button
     360                // but no actual form submit (ex: browser validation), we listen
     361                // to an actual form submition
     362                self.$form.one('submit.lbsat-post-edit', function( event ) {
     363                    if ( event.isDefaultPrevented() ) {
     364                        return;
     365                    }
     366
     367                    self.newPublishButtonSet.disable( true );
     368                });
     369            });
    283370
    284371            // Disable button while auto saving
     
    350437         */
    351438        createMainButton : function() {
    352             var $mainButton = $('<input type="button" />');
     439            // A non-submitting button
     440            var $mainButton = $('<button type="button"/>');
    353441
    354442            $mainButton.attr('class', 'button button-large lb-sat-main-button' );
     
    462550                    return;
    463551                }
    464                 // We move the spinner just before the new button container
    465                 self.$container.before( self.postEditForm.$spinner );
    466 
    467                 self.postEditForm.setAction( self.action );
    468                 self.postEditForm.$originalPublishButton.trigger('click');
     552
     553                self.postEditForm.submit();
    469554            });
    470555        },
     
    497582                    return;
    498583                }
     584
    499585                self.setAction( $(this).data('lbSatActionData') );
    500586                self.$mainButton.click();
     
    535621
    536622        /**
     623         * Returns the action
     624         * @return {object} The action
     625         */
     626        getAction : function() {
     627            return this.action;
     628        },
     629
     630        /**
    537631         * Updates the label of the main menu and the dropdown menu elements
    538632         * based on the currently set action and the value of the original
    539          * button.
     633         * button. Also updates the title attribute.
    540634         */
    541635        updateLabels : function() {
    542636            var self = this;
    543637
    544             this.$mainButton.val( this.generateButtonLabel( this.action.buttonLabelPattern ) );
    545 
     638            // Set the button value
     639            this.$mainButton.html( this.generateButtonLabel( this.action.buttonLabelPattern ) );
     640
     641            // Set the button title
     642            this.$mainButton.attr('title', this.action.title ? this.action.title : '' );
     643
     644            // Update the actions in the dropdown
    546645            $.each( this.config.actions, function( i, actionData ) {
    547                 var $li = self.$dropdownMenu.find('[data-lb-sat-value=' + actionData.id + ']');
    548                 $li.text( self.generateButtonLabel( actionData.buttonLabelPattern ) );
     646                var $li = self.$dropdownMenu.find('[data-lb-sat-value="' + actionData.id + '"]');
     647                $li.html( self.generateButtonLabel( actionData.buttonLabelPattern ) );
    549648            });
    550649        },
     
    571670            this.$dropdownButton.toggleClass( 'disabled', disabled );
    572671
    573             if( disabled ) {
    574                 this.hideMenu();
    575                 this.$mainButton.prop( 'disabled', true );
    576             } else {
    577                 this.$mainButton.prop( 'disabled', false );
    578             }
     672            // Since Wordpress and some plugins (ACF, for example)
     673            // do not use or expect the 'disabled' property, we
     674            // do not use it either, using only the .disabled class
     675            // i.e.: this.$mainButton.prop('disabled', disabled);
    579676        }
    580677    };
  • improved-save-button/trunk/js/post-edit.min.js

    r1150608 r1267552  
    11/* Generated from JavaScript source files. Do not modify directly. */
    2 window.LabelBlanc=window.LabelBlanc||{},window.LabelBlanc.SaveAndThen=window.LabelBlanc.SaveAndThen||{},function(a){var b=window.LabelBlanc.SaveAndThen;a(function(){var c=b.config,d=a("#post");c&&d.length&&new b.PostEditForm(d,c)}),b.PostEditForm=function(a,c){if(c.actions&&0!==c.actions.length){this.$form=a,this.config=c;var d=this.getDefaultAction();1!==c.actions.length||c.actions[0].enabled||(this.config.newButtonSetIsDummy=!0,d=c.actions[0]),this.$actionInput=this.createActionInput(),this.$originalPublishButton=this.getOriginalPublishButton(),this.newPublishButtonSet=new b.PublishButtonSet(this),this.$spinner=this.$form.find("#publishing-action .spinner"),this.setupForm(),this.setupOriginalPublishButton(),this.newPublishButtonSet.setAction(d),this.setupFormListeners(),this.setupWordpressListeners(),this.newPublishButtonSet.hideMenu(),this.insertNewPublishButtonSet(),this.setupSpinner(),this.config.newButtonSetIsDummy&&this.newPublishButtonSet.disable(!0)}},b.PostEditForm.LAST_USED_COOKIE_NAME="lb-sat-last-used-action",b.PostEditForm.prototype={getOriginalPublishButton:function(){return this.$form.find("#publish")},setupSpinner:function(){this.$spinner.addClass("lb-sat-spinner"),this.$originalPublishButton.before(this.$spinner)},insertNewPublishButtonSet:function(){var b=this.newPublishButtonSet.$container,c=a('<div class="lb-sat-separator"></div>');this.config.setAsDefault?this.$originalPublishButton.after(b).after(c):this.$originalPublishButton.before(b).before(c)},createActionInput:function(){return a('<input type="hidden" name="'+b.HTTP_PARAM_ACTION+'" />')},setupForm:function(){this.$form.prepend(this.$actionInput)},setupFormListeners:function(){var a=this;this.$form.on("submit",function(){a.newPublishButtonSet.disable(!0)})},setupOriginalPublishButton:function(){this.config.setAsDefault&&!this.config.newButtonSetIsDummy&&this.$originalPublishButton.removeClass("button-primary").removeAttr("accesskey")},setAction:function(a){wpCookies.set(b.PostEditForm.LAST_USED_COOKIE_NAME,a.id,31536e3),this.$actionInput.val(a.id)},getDefaultAction:function(){var c,d=this.config.defaultActionId,e=null;if(a.each(this.config.actions,function(a,b){return b.enabled?(c=b,!1):void 0}),!d)return c;if(b.ACTION_LAST===d){var f=wpCookies.get(b.PostEditForm.LAST_USED_COOKIE_NAME);if(!f)return c;d=f}return e=this.getActionFromId(d),e&&e.enabled||(e=c),e},getActionFromId:function(b){var c=null;return a.each(this.config.actions,function(a,d){return d.id===b?(c=d,!1):void 0}),c},setupWordpressListeners:function(){var b=this;a(document).on("autosave-disable-buttons.edit-post",function(){b.newPublishButtonSet.disable(!0)}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||b.config.newButtonSetIsDummy||b.newPublishButtonSet.disable(!1)}),this.$form.on("click","#post-visibility-select .cancel-post-visibility,#post-visibility-select .save-post-visibility,#timestampdiv .cancel-timestamp,#timestampdiv .save-timestamp,#post-status-select .save-post-status,#post-status-select .cancel-post-status",function(){b.newPublishButtonSet.updateLabels()})}},b.PublishButtonSet=function(a){this.postEditForm=a,this.config=this.postEditForm.config,this.action=null,this.$mainButton=this.createMainButton(),this.$dropdownButton=this.createDropdownButton(),this.$dropdownMenu=this.createDropdownMenu(),this.$container=this.createContainer(),this.setupDocumentClickListener(),this.setupMainButtonListeners(),this.setupDropdownButtonListeners(),this.setupDropdownMenuListeners()},b.PublishButtonSet.prototype={createMainButton:function(){var b=a('<input type="button" />');return b.attr("class","button button-large lb-sat-main-button"),this.config.setAsDefault&&!this.config.newButtonSetIsDummy?b.addClass("button-primary"):b.removeAttr("accesskey"),b},createDropdownButton:function(){var b=a('<input type="button" value="&#xf140;" />');return b.attr("class",this.$mainButton.attr("class")),b.removeClass("lb-sat-main-button").addClass("lb-sat-dropdown-button"),b},createDropdownMenu:function(){var b=a('<ul class="lb-sat-dropdown-menu"></ul>'),c=this;return a.each(this.config.actions,function(d,e){var f=a('<li data-lb-sat-value="'+e.id+'">'+c.generateButtonLabel(e.buttonLabelPattern)+"</li>");e.title&&f.attr("title",e.title),e.enabled?f.data("lbSatActionData",e):f.addClass("disabled"),b.append(f)}),b},createContainer:function(){var b=a('<span class="lb-sat-container"></span>');return b.append(this.$mainButton),this.config.actions.length>1&&b.addClass("lb-sat-with-dropdown").append(this.$dropdownButton).append(this.$dropdownMenu),this.config.setAsDefault&&b.addClass("lb-sat-set-as-default"),b},setupDocumentClickListener:function(){var b=this;a(document).click(function(){b.menuShown()&&b.hideMenu()})},setupMainButtonListeners:function(){var b=this;this.$mainButton.click(function(){a(this).hasClass("disabled")||b.config.newButtonSetIsDummy||(b.$container.before(b.postEditForm.$spinner),b.postEditForm.setAction(b.action),b.postEditForm.$originalPublishButton.trigger("click"))})},setupDropdownButtonListeners:function(){var a=this;this.$dropdownButton.click(function(b){a.menuShown()||(a.showMenu(),b.stopPropagation())})},setupDropdownMenuListeners:function(){var b=this;this.$dropdownMenu.on("click","li",function(){a(this).hasClass("disabled")||b.config.newButtonSetIsDummy||(b.setAction(a(this).data("lbSatActionData")),b.$mainButton.click())})},menuShown:function(){return this.$container.hasClass("lb-sat-dropdown-menu-shown")},showMenu:function(){this.$container.addClass("lb-sat-dropdown-menu-shown")},hideMenu:function(){this.$container.removeClass("lb-sat-dropdown-menu-shown")},setAction:function(a){this.action=a,this.updateLabels()},updateLabels:function(){var b=this;this.$mainButton.val(this.generateButtonLabel(this.action.buttonLabelPattern)),a.each(this.config.actions,function(a,c){var d=b.$dropdownMenu.find("[data-lb-sat-value="+c.id+"]");d.text(b.generateButtonLabel(c.buttonLabelPattern))})},generateButtonLabel:function(a){return a.replace("%s",this.postEditForm.$originalPublishButton.val())},disable:function(a){this.$mainButton.toggleClass("disabled",a),this.$dropdownButton.toggleClass("disabled",a),a?(this.hideMenu(),this.$mainButton.prop("disabled",!0)):this.$mainButton.prop("disabled",!1)}}}(jQuery);
     2window.LabelBlanc=window.LabelBlanc||{},window.LabelBlanc.SaveAndThen=window.LabelBlanc.SaveAndThen||{},function(a){var b=window.LabelBlanc.SaveAndThen;a(function(){var c=b.config,d=a("#post");c&&d.length&&new b.PostEditForm(d,c)}),b.PostEditForm=function(a,c){if(c.actions&&0!==c.actions.length){this.$form=a,this.config=c,this.action=null;var d=this.getDefaultAction();1!==c.actions.length||c.actions[0].enabled||(this.config.newButtonSetIsDummy=!0,d=c.actions[0]),this.$actionInput=this.createActionInput(),this.$originalPublishButton=this.getOriginalPublishButton(),this.newPublishButtonSet=new b.PublishButtonSet(this),this.$spinner=this.$form.find("#publishing-action .spinner"),this.setupForm(),this.setupOriginalPublishButton(),this.newPublishButtonSet.setAction(d),this.setupFormListeners(),this.setupWordpressListeners(),this.newPublishButtonSet.hideMenu(),this.insertNewPublishButtonSet(),this.setupSpinner(),this.config.newButtonSetIsDummy&&this.newPublishButtonSet.disable(!0)}},b.PostEditForm.LAST_USED_COOKIE_NAME="lb-sat-last-used-action",b.PostEditForm.prototype={getOriginalPublishButton:function(){return this.$form.find("#publish")},setupSpinner:function(){this.$spinner.addClass("lb-sat-spinner"),this.$originalPublishButton.before(this.$spinner)},insertNewPublishButtonSet:function(){var b=this.newPublishButtonSet.$container,c=a('<div class="lb-sat-separator"></div>');this.config.setAsDefault?this.$originalPublishButton.after(b).after(c):this.$originalPublishButton.before(b).before(c)},createActionInput:function(){return a('<input type="hidden" name="'+b.HTTP_PARAM_ACTION+'" />')},setupForm:function(){this.$form.prepend(this.$actionInput)},setupOriginalPublishButton:function(){this.config.setAsDefault&&!this.config.newButtonSetIsDummy&&this.$originalPublishButton.removeClass("button-primary").removeAttr("accesskey")},setAction:function(a){this.action=a,wpCookies.set(b.PostEditForm.LAST_USED_COOKIE_NAME,a.id,31536e3),this.$actionInput.val(a.id)},getAction:function(){return this.action},submit:function(){this.setAction(this.newPublishButtonSet.getAction());var b=a.Event("lb-save-and-then:submit");this.$form.trigger(b,this),b.isDefaultPrevented()||(this.$form.data("lbsat-button-submitted",!0),this.getOriginalPublishButton().click())},setupFormListeners:function(){var a=this;this.$form.on("submit.lbsat-post-edit",function(b){var c=a.$form.data("lbsat-button-submitted");a.$form.removeData("lbsat-button-submitted"),b.isDefaultPrevented()||c===!0&&a.newPublishButtonSet.$container.before(a.$spinner)})},getDefaultAction:function(){var c,d=this.config.defaultActionId,e=null;if(a.each(this.config.actions,function(a,b){return b.enabled?(c=b,!1):void 0}),!d)return c;if(b.ACTION_LAST_ID===d){var f=wpCookies.get(b.PostEditForm.LAST_USED_COOKIE_NAME);if(!f)return c;d=f}return e=this.getActionFromId(d),e&&e.enabled||(e=c),e},getActionFromId:function(b){var c=null;return a.each(this.config.actions,function(a,d){return d.id===b?(c=d,!1):void 0}),c},setupWordpressListeners:function(){var b=this;this.$form.on("click.lbsat-post-edit",":submit, a.submitdelete, #post-preview",function(){var c=a(this);c.hasClass("disabled")||c.hasClass("submitdelete")||c.is("#post-preview")||b.$form.one("submit.lbsat-post-edit",function(a){a.isDefaultPrevented()||b.newPublishButtonSet.disable(!0)})}),a(document).on("autosave-disable-buttons.edit-post",function(){b.newPublishButtonSet.disable(!0)}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||b.config.newButtonSetIsDummy||b.newPublishButtonSet.disable(!1)}),this.$form.on("click","#post-visibility-select .cancel-post-visibility,#post-visibility-select .save-post-visibility,#timestampdiv .cancel-timestamp,#timestampdiv .save-timestamp,#post-status-select .save-post-status,#post-status-select .cancel-post-status",function(){b.newPublishButtonSet.updateLabels()})}},b.PublishButtonSet=function(a){this.postEditForm=a,this.config=this.postEditForm.config,this.action=null,this.$mainButton=this.createMainButton(),this.$dropdownButton=this.createDropdownButton(),this.$dropdownMenu=this.createDropdownMenu(),this.$container=this.createContainer(),this.setupDocumentClickListener(),this.setupMainButtonListeners(),this.setupDropdownButtonListeners(),this.setupDropdownMenuListeners()},b.PublishButtonSet.prototype={createMainButton:function(){var b=a('<button type="button"/>');return b.attr("class","button button-large lb-sat-main-button"),this.config.setAsDefault&&!this.config.newButtonSetIsDummy?b.addClass("button-primary"):b.removeAttr("accesskey"),b},createDropdownButton:function(){var b=a('<input type="button" value="&#xf140;" />');return b.attr("class",this.$mainButton.attr("class")),b.removeClass("lb-sat-main-button").addClass("lb-sat-dropdown-button"),b},createDropdownMenu:function(){var b=a('<ul class="lb-sat-dropdown-menu"></ul>'),c=this;return a.each(this.config.actions,function(d,e){var f=a('<li data-lb-sat-value="'+e.id+'">'+c.generateButtonLabel(e.buttonLabelPattern)+"</li>");e.title&&f.attr("title",e.title),e.enabled?f.data("lbSatActionData",e):f.addClass("disabled"),b.append(f)}),b},createContainer:function(){var b=a('<span class="lb-sat-container"></span>');return b.append(this.$mainButton),this.config.actions.length>1&&b.addClass("lb-sat-with-dropdown").append(this.$dropdownButton).append(this.$dropdownMenu),this.config.setAsDefault&&b.addClass("lb-sat-set-as-default"),b},setupDocumentClickListener:function(){var b=this;a(document).click(function(){b.menuShown()&&b.hideMenu()})},setupMainButtonListeners:function(){var b=this;this.$mainButton.click(function(){a(this).hasClass("disabled")||b.config.newButtonSetIsDummy||b.postEditForm.submit()})},setupDropdownButtonListeners:function(){var a=this;this.$dropdownButton.click(function(b){a.menuShown()||(a.showMenu(),b.stopPropagation())})},setupDropdownMenuListeners:function(){var b=this;this.$dropdownMenu.on("click","li",function(){a(this).hasClass("disabled")||b.config.newButtonSetIsDummy||(b.setAction(a(this).data("lbSatActionData")),b.$mainButton.click())})},menuShown:function(){return this.$container.hasClass("lb-sat-dropdown-menu-shown")},showMenu:function(){this.$container.addClass("lb-sat-dropdown-menu-shown")},hideMenu:function(){this.$container.removeClass("lb-sat-dropdown-menu-shown")},setAction:function(a){this.action=a,this.updateLabels()},getAction:function(){return this.action},updateLabels:function(){var b=this;this.$mainButton.html(this.generateButtonLabel(this.action.buttonLabelPattern)),this.$mainButton.attr("title",this.action.title?this.action.title:""),a.each(this.config.actions,function(a,c){var d=b.$dropdownMenu.find('[data-lb-sat-value="'+c.id+'"]');d.html(b.generateButtonLabel(c.buttonLabelPattern))})},generateButtonLabel:function(a){return a.replace("%s",this.postEditForm.$originalPublishButton.val())},disable:function(a){this.$mainButton.toggleClass("disabled",a),this.$dropdownButton.toggleClass("disabled",a)}}}(jQuery);
  • improved-save-button/trunk/js/settings-page.js

    r1094802 r1267552  
    7070            var $action = $(elem),
    7171                action = $action.data('lbSatSettingsValue'),
    72                 $default = $defaultOptions.filter('[value=' + action + ']');
     72                $default = $defaultOptions.filter('[value="' + action + '"]');
    7373
    7474            if( ! $action.prop('checked') && $default.prop('checked') ) {
    75                 $defaultOptions.filter('[value=_last]').prop('checked', true);
     75                $defaultOptions.filter('[value="_last"]').prop('checked', true);
    7676            }
    7777
  • improved-save-button/trunk/js/settings-page.min.js

    r1094802 r1267552  
    11/* Generated from JavaScript source files. Do not modify directly. */
    2 !function(a){function b(b,c){c.each(function(c,d){var e=a(d),f=e.data("lbSatSettingsValue"),g=b.filter("[value="+f+"]");!e.prop("checked")&&g.prop("checked")&&b.filter("[value=_last]").prop("checked",!0),g.prop("disabled",!e.prop("checked"))})}a(function(){var c=a("form[data-lb-sat-settings=form]"),d=c.find("[data-lb-sat-settings=action]"),e=c.find("[data-lb-sat-settings=default]");d.change(function(){b(e,d)}).change()})}(jQuery);
     2!function(a){function b(b,c){c.each(function(c,d){var e=a(d),f=e.data("lbSatSettingsValue"),g=b.filter('[value="'+f+'"]');!e.prop("checked")&&g.prop("checked")&&b.filter('[value="_last"]').prop("checked",!0),g.prop("disabled",!e.prop("checked"))})}a(function(){var c=a("form[data-lb-sat-settings=form]"),d=c.find("[data-lb-sat-settings=action]"),e=c.find("[data-lb-sat-settings=default]");d.change(function(){b(e,d)}).change()})}(jQuery);
  • improved-save-button/trunk/languages/lb-save-and-then-fr_FR.po

    r1150608 r1267552  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Improved Save Button 1.0.1\n"
     5"Project-Id-Version: Improved Save Button 1.0.2\n"
    66"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/improved-save-"
    77"button\n"
    8 "POT-Creation-Date: 2015-04-30 22:05:31+00:00\n"
    9 "PO-Revision-Date: 2015-04-30 18:10-0500\n"
     8"POT-Creation-Date: 2015-10-16 17:33:01+00:00\n"
     9"PO-Revision-Date: 2015-10-16 13:36-0500\n"
    1010"Last-Translator: Xavier Frenette <xavier@xavierfrenette.com>\n"
    1111"Language-Team: LANGUAGE <LL@li.org>\n"
    1212"Language: en\n"
    1313"MIME-Version: 1.0\n"
    14 "Content-Type: text/plain; charset=utf-8\n"
     14"Content-Type: text/plain; charset=UTF-8\n"
    1515"Content-Transfer-Encoding: 8bit\n"
    1616"X-Generator: Poedit 1.6.4\n"
     
    2020"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    2121"X-Poedit-SourceCharset: UTF-8\n"
    22 "X-Poedit-Basepath: ../\n"
     22"X-Poedit-Basepath: ..\n"
    2323"X-Textdomain-Support: yes\n"
    2424"X-Poedit-SearchPath-0: .\n"
    2525
    26 #: improved-save-button.php:110
     26#: actions/class-lb-save-and-then-action-list.php:70
     27msgid "Save and List"
     28msgstr "Enregistrer puis lister"
     29
     30#: actions/class-lb-save-and-then-action-list.php:84
     31msgid "Shows the <strong>posts list</strong> after save."
     32msgstr "Affiche <strong>la liste des articles</strong> après l'enregistrement"
     33
     34#: actions/class-lb-save-and-then-action-list.php:91
     35msgid "%s and List"
     36msgstr "%s et lister"
     37
     38#: actions/class-lb-save-and-then-action-new.php:34
    2739msgid "Save and New"
    2840msgstr "Enregistrer puis créer nouveau"
    2941
    30 #: improved-save-button.php:111
     42#: actions/class-lb-save-and-then-action-new.php:48
     43msgid "Shows the <strong>new post</strong> form after save."
     44msgstr ""
     45"Affiche la <strong>page de nouvel article</strong> après l'enregistrement"
     46
     47#: actions/class-lb-save-and-then-action-new.php:55
    3148msgid "%s and New"
    32 msgstr "%s et  nouveau"
    33 
    34 #: improved-save-button.php:112
    35 msgid "Shows the <strong>new post</strong> form after save."
    36 msgstr ""
    37 "Affiche la <strong>page de nouvel article</strong> après l'enregistrement"
    38 
    39 #: improved-save-button.php:115
    40 msgid "Save and List"
    41 msgstr "Enregistrer puis lister"
    42 
    43 #: improved-save-button.php:116
    44 msgid "%s and List"
    45 msgstr "%s et lister"
    46 
    47 #: improved-save-button.php:117
    48 msgid "Shows the <strong>posts list</strong> after save."
    49 msgstr "Affiche <strong>la liste des articles</strong> après l'enregistrement"
    50 
    51 #: improved-save-button.php:120
     49msgstr "%s et nouveau"
     50
     51#: actions/class-lb-save-and-then-action-next.php:36
    5252msgid "Save and Next"
    5353msgstr "Enregistrer puis suivant"
    5454
    55 #: improved-save-button.php:121
     55#: actions/class-lb-save-and-then-action-next.php:50
     56msgid "Shows the <strong>next post</strong> edit form after save."
     57msgstr "Affiche <strong>le prochain article</strong> après l'enregistrement"
     58
     59#: actions/class-lb-save-and-then-action-next.php:57
    5660msgid "%s and Next"
    5761msgstr "%s et suivant"
    5862
    59 #: improved-save-button.php:122
    60 msgid "Shows the <strong>next post</strong> edit form after save."
    61 msgstr "Affiche <strong>le prochain article</strong> après l'enregistrement"
    62 
    63 #: improved-save-button.php:125
     63#: actions/class-lb-save-and-then-action-next.php:83
     64msgid "You are at the last post"
     65msgstr "Vous êtes au dernier article"
     66
     67#: actions/class-lb-save-and-then-action-next.php:86
     68msgid "Next post is \"%s\""
     69msgstr "Le prochain article est \"%s\""
     70
     71#: actions/class-lb-save-and-then-action-previous.php:36
    6472msgid "Save and Previous"
    6573msgstr "Enregistrer puis précédent"
    6674
    67 #: improved-save-button.php:126
     75#: actions/class-lb-save-and-then-action-previous.php:50
     76msgid "Shows the <strong>previous post</strong> edit form after save."
     77msgstr "Affiche <strong>l'article précédent</strong> après l'enregistrement"
     78
     79#: actions/class-lb-save-and-then-action-previous.php:57
    6880msgid "%s and Previous"
    6981msgstr "%s et précédent"
    7082
    71 #: improved-save-button.php:127
    72 msgid "Shows the <strong>previous post</strong> edit form after save."
    73 msgstr "Affiche <strong>l'article précédent</strong> après l'enregistrement"
     83#: actions/class-lb-save-and-then-action-previous.php:83
     84msgid "You are at the first post"
     85msgstr "Vous êtes au premier article"
     86
     87#: actions/class-lb-save-and-then-action-previous.php:86
     88msgid "Previous post is \"%s\""
     89msgstr "L'article précédent est \"%s\""
     90
     91#: actions/class-lb-save-and-then-action-view-popup.php:105
     92msgid ""
     93"Please wait while the post is being saved. This window will refresh "
     94"automatically."
     95msgstr ""
     96"Veuillez attendre que l'article soit sauvegardé. Cette fenêtre se "
     97"rafraîchira automatiquement."
     98
     99#: actions/class-lb-save-and-then-action-view-popup.php:121
     100msgid "Save and View %s (new window)"
     101msgstr "Enregistrer puis afficher %s (nouvelle fenêtre)"
     102
     103#: actions/class-lb-save-and-then-action-view-popup.php:135
     104msgid "Shows the <strong>post itself in a new window</strong> after save."
     105msgstr ""
     106"Affiche <strong>l'article dans une nouvelle fenêtre</strong> après "
     107"l'enregistrement"
     108
     109#: actions/class-lb-save-and-then-action-view-popup.php:143
     110msgid "%%s and View %s"
     111msgstr "%%s et afficher %s"
     112
     113#: actions/class-lb-save-and-then-action-view-popup.php:154
     114msgid "Post will be shown in a new window"
     115msgstr "L'article s'affichera dans une nouvelle fenêtre"
     116
     117#: actions/class-lb-save-and-then-action-view.php:34
     118msgid "Save and View"
     119msgstr "Enregistrer puis afficher"
     120
     121#: actions/class-lb-save-and-then-action-view.php:48
     122msgid ""
     123"Shows the <strong>post itself</strong> after save. The same window is used."
     124msgstr ""
     125"Affiche <strong>l'article</strong> après l'enregistrement. Utilise la même "
     126"fenêtre"
     127
     128#: actions/class-lb-save-and-then-action-view.php:55
     129msgid "%s and View"
     130msgstr "%s et afficher"
     131
     132#: actions/class-lb-save-and-then-action-view.php:66
     133msgid "Post will be shown in this window"
     134msgstr "L'article s'affichera dans cette fenêtre"
     135
     136#: lib/class-lb-save-and-then-messages.php:155
     137msgid "Post updated. <a href=\"%s\">View post</a>"
     138msgstr ""
    74139
    75140#: lib/class-lb-save-and-then-messages.php:156
    76 msgid "Post updated. <a href=\"%s\">View post</a>"
     141msgid "Post updated."
    77142msgstr ""
    78143
    79144#: lib/class-lb-save-and-then-messages.php:157
    80 msgid "Post updated."
     145msgid "Post published. <a href=\"%s\">View post</a>"
    81146msgstr ""
    82147
    83148#: lib/class-lb-save-and-then-messages.php:158
    84 msgid "Post published. <a href=\"%s\">View post</a>"
    85 msgstr ""
    86 
    87 #: lib/class-lb-save-and-then-messages.php:159
    88149msgid "Post submitted. <a target=\"_blank\" href=\"%s\">Preview post</a>"
    89150msgstr ""
    90151
    91 #: lib/class-lb-save-and-then-messages.php:161
     152#: lib/class-lb-save-and-then-messages.php:160
    92153msgid ""
    93154"Post scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s"
     
    95156msgstr ""
    96157
    97 #: lib/class-lb-save-and-then-messages.php:162
    98 #: lib/class-lb-save-and-then-messages.php:174
     158#: lib/class-lb-save-and-then-messages.php:161
     159#: lib/class-lb-save-and-then-messages.php:173
    99160msgid "M j, Y @ G:i"
    100161msgstr ""
    101162
    102 #: lib/class-lb-save-and-then-messages.php:164
     163#: lib/class-lb-save-and-then-messages.php:163
    103164msgid "Post draft updated. <a target=\"_blank\" href=\"%s\">Preview post</a>"
    104165msgstr ""
    105166
     167#: lib/class-lb-save-and-then-messages.php:167
     168msgid "Page updated. <a href=\"%s\">View page</a>"
     169msgstr ""
     170
    106171#: lib/class-lb-save-and-then-messages.php:168
    107 msgid "Page updated. <a href=\"%s\">View page</a>"
     172msgid "Page updated."
    108173msgstr ""
    109174
    110175#: lib/class-lb-save-and-then-messages.php:169
    111 msgid "Page updated."
     176msgid "Page published. <a href=\"%s\">View page</a>"
    112177msgstr ""
    113178
    114179#: lib/class-lb-save-and-then-messages.php:170
    115 msgid "Page published. <a href=\"%s\">View page</a>"
    116 msgstr ""
    117 
    118 #: lib/class-lb-save-and-then-messages.php:171
    119180msgid "Page submitted. <a target=\"_blank\" href=\"%s\">Preview page</a>"
    120181msgstr ""
    121182
    122 #: lib/class-lb-save-and-then-messages.php:173
     183#: lib/class-lb-save-and-then-messages.php:172
    123184msgid ""
    124185"Page scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s"
     
    126187msgstr ""
    127188
    128 #: lib/class-lb-save-and-then-messages.php:176
     189#: lib/class-lb-save-and-then-messages.php:175
    129190msgid "Page draft updated. <a target=\"_blank\" href=\"%s\">Preview page</a>"
    130191msgstr ""
    131192
    132 #: lib/class-lb-save-and-then-post-edit.php:142
    133 msgid "You are at the last post"
    134 msgstr "Vous êtes au dernier article"
    135 
    136 #: lib/class-lb-save-and-then-post-edit.php:146
    137 msgid "You are at the first post"
    138 msgstr "Vous êtes au premier article"
    139 
    140 #: lib/class-lb-save-and-then-settings.php:100
     193#: lib/class-lb-save-and-then-settings.php:111
    141194msgid "Display button as default"
    142195msgstr "Mettre le button par défaut"
    143196
    144 #: lib/class-lb-save-and-then-settings.php:109
     197#: lib/class-lb-save-and-then-settings.php:120
    145198msgid "Actions to show"
    146199msgstr "Actions à afficher"
    147200
    148 #: lib/class-lb-save-and-then-settings.php:118
     201#: lib/class-lb-save-and-then-settings.php:129
    149202msgid "Default action"
    150203msgstr "Action par défaut"
    151204
    152 #: lib/class-lb-save-and-then-settings.php:132
     205#: lib/class-lb-save-and-then-settings.php:143
    153206msgid "%s Settings"
    154207msgstr "Réglages de %s"
     
    158211msgstr ""
    159212
    160 #: lib/class-lb-save-and-then-settings.php:145
     213#: lib/class-lb-save-and-then-settings.php:156
    161214msgid "You do not have sufficient permissions to access this page."
    162215msgstr ""
    163216
    164 #: lib/class-lb-save-and-then-settings.php:149
     217#: lib/class-lb-save-and-then-settings.php:160
    165218msgid "<em>%s</em> Settings"
    166219msgstr "Réglages de <em>%s</em>"
    167220
    168 #: lib/class-lb-save-and-then-settings.php:153
     221#: lib/class-lb-save-and-then-settings.php:164
    169222msgid "Save Changes"
    170223msgstr ""
    171224
    172 #: lib/class-lb-save-and-then-settings.php:181
     225#: lib/class-lb-save-and-then-settings.php:190
    173226msgid "Display the new save button as the default one"
    174227msgstr "Afficher le nouveau bouton en tant que bouton par défaut"
    175228
    176 #: lib/class-lb-save-and-then-settings.php:208
    177 msgid "<em>Last used</em>"
    178 msgstr "<em>Dernière utilisée</em>"
    179 
    180 #: lib/class-lb-save-and-then-settings.php:209
     229#: lib/class-lb-save-and-then-settings.php:227
     230msgid "Last used"
     231msgstr "Dernière utilisée"
     232
     233#: lib/class-lb-save-and-then-settings.php:228
    181234msgid "The last action that was used"
    182235msgstr "La dernière action utilisée"
    183236
    184 #: lib/class-lb-save-and-then-settings.php:240
     237#: lib/class-lb-save-and-then-settings.php:265
    185238msgid "Settings"
    186239msgstr ""
     
    188241#. Description of the plugin/theme
    189242msgid ""
    190 "Adds a \"Save\" button to the post edit screen that saves the post and "
    191 "immediately redirect to one of the common page: the post listing, the new "
    192 "post form or the previous or next post edit page."
    193 msgstr ""
    194 "Bouton qui, d'un seul clic, enregistre l'article et redirige à la liste des "
    195 "articles, à la page de création d'article ou à un article adjacent."
     243"Adds a new \"Save\" button to the Post Edit screen that saves the post and "
     244"immediately redirects to one of the common screens: the Posts List, the New "
     245"Post screen, the previous or next post's Edit screen or the post's frontend "
     246"page."
     247msgstr ""
     248"Rajoute un nouveau bouton d'enregistrement dans l'écran d'édition d'un "
     249"article qui enregistre l'article et immédiatement redirige vers l'une des "
     250"pages les plus utilisées: la liste des articles, la page de création d'un "
     251"nouvel article, la page d'édition de l'article suivant ou précédent, ou la "
     252"page publique de l'article lui-même."
    196253
    197254#. Author of the plugin/theme
  • improved-save-button/trunk/languages/lb-save-and-then.pot

    r1150608 r1267552  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Improved Save Button 1.0.1\n"
     5"Project-Id-Version: Improved Save Button 1.1\n"
    66"Report-Msgid-Bugs-To: "
    77"http://wordpress.org/support/plugin/improved-save-button\n"
    8 "POT-Creation-Date: 2015-04-30 22:13:27+00:00\n"
     8"POT-Creation-Date: 2015-10-16 17:33:01+00:00\n"
    99"MIME-Version: 1.0\n"
    1010"Content-Type: text/plain; charset=utf-8\n"
     
    2626"X-Textdomain-Support: yes\n"
    2727
    28 #: improved-save-button.php:110
     28#: actions/class-lb-save-and-then-action-list.php:70
     29msgid "Save and List"
     30msgstr ""
     31
     32#: actions/class-lb-save-and-then-action-list.php:84
     33msgid "Shows the <strong>posts list</strong> after save."
     34msgstr ""
     35
     36#: actions/class-lb-save-and-then-action-list.php:91
     37msgid "%s and List"
     38msgstr ""
     39
     40#: actions/class-lb-save-and-then-action-new.php:34
    2941msgid "Save and New"
    3042msgstr ""
    3143
    32 #: improved-save-button.php:111
     44#: actions/class-lb-save-and-then-action-new.php:48
     45msgid "Shows the <strong>new post</strong> form after save."
     46msgstr ""
     47
     48#: actions/class-lb-save-and-then-action-new.php:55
    3349msgid "%s and New"
    3450msgstr ""
    3551
    36 #: improved-save-button.php:112
    37 msgid "Shows the <strong>new post</strong> form after save."
    38 msgstr ""
    39 
    40 #: improved-save-button.php:115
    41 msgid "Save and List"
    42 msgstr ""
    43 
    44 #: improved-save-button.php:116
    45 msgid "%s and List"
    46 msgstr ""
    47 
    48 #: improved-save-button.php:117
    49 msgid "Shows the <strong>posts list</strong> after save."
    50 msgstr ""
    51 
    52 #: improved-save-button.php:120
     52#: actions/class-lb-save-and-then-action-next.php:36
    5353msgid "Save and Next"
    5454msgstr ""
    5555
    56 #: improved-save-button.php:121
     56#: actions/class-lb-save-and-then-action-next.php:50
     57msgid "Shows the <strong>next post</strong> edit form after save."
     58msgstr ""
     59
     60#: actions/class-lb-save-and-then-action-next.php:57
    5761msgid "%s and Next"
    5862msgstr ""
    5963
    60 #: improved-save-button.php:122
    61 msgid "Shows the <strong>next post</strong> edit form after save."
    62 msgstr ""
    63 
    64 #: improved-save-button.php:125
     64#: actions/class-lb-save-and-then-action-next.php:83
     65msgid "You are at the last post"
     66msgstr ""
     67
     68#: actions/class-lb-save-and-then-action-next.php:86
     69msgid "Next post is \"%s\""
     70msgstr ""
     71
     72#: actions/class-lb-save-and-then-action-previous.php:36
    6573msgid "Save and Previous"
    6674msgstr ""
    6775
    68 #: improved-save-button.php:126
     76#: actions/class-lb-save-and-then-action-previous.php:50
     77msgid "Shows the <strong>previous post</strong> edit form after save."
     78msgstr ""
     79
     80#: actions/class-lb-save-and-then-action-previous.php:57
    6981msgid "%s and Previous"
    7082msgstr ""
    7183
    72 #: improved-save-button.php:127
    73 msgid "Shows the <strong>previous post</strong> edit form after save."
     84#: actions/class-lb-save-and-then-action-previous.php:83
     85msgid "You are at the first post"
     86msgstr ""
     87
     88#: actions/class-lb-save-and-then-action-previous.php:86
     89msgid "Previous post is \"%s\""
     90msgstr ""
     91
     92#: actions/class-lb-save-and-then-action-view-popup.php:105
     93msgid ""
     94"Please wait while the post is being saved. This window will refresh "
     95"automatically."
     96msgstr ""
     97
     98#: actions/class-lb-save-and-then-action-view-popup.php:121
     99msgid "Save and View %s (new window)"
     100msgstr ""
     101
     102#: actions/class-lb-save-and-then-action-view-popup.php:135
     103msgid "Shows the <strong>post itself in a new window</strong> after save."
     104msgstr ""
     105
     106#: actions/class-lb-save-and-then-action-view-popup.php:143
     107msgid "%%s and View %s"
     108msgstr ""
     109
     110#: actions/class-lb-save-and-then-action-view-popup.php:154
     111msgid "Post will be shown in a new window"
     112msgstr ""
     113
     114#: actions/class-lb-save-and-then-action-view.php:34
     115msgid "Save and View"
     116msgstr ""
     117
     118#: actions/class-lb-save-and-then-action-view.php:48
     119msgid "Shows the <strong>post itself</strong> after save. The same window is used."
     120msgstr ""
     121
     122#: actions/class-lb-save-and-then-action-view.php:55
     123msgid "%s and View"
     124msgstr ""
     125
     126#: actions/class-lb-save-and-then-action-view.php:66
     127msgid "Post will be shown in this window"
     128msgstr ""
     129
     130#: lib/class-lb-save-and-then-messages.php:155
     131msgid "Post updated. <a href=\"%s\">View post</a>"
    74132msgstr ""
    75133
    76134#: lib/class-lb-save-and-then-messages.php:156
    77 msgid "Post updated. <a href=\"%s\">View post</a>"
     135msgid "Post updated."
    78136msgstr ""
    79137
    80138#: lib/class-lb-save-and-then-messages.php:157
    81 msgid "Post updated."
     139msgid "Post published. <a href=\"%s\">View post</a>"
    82140msgstr ""
    83141
    84142#: lib/class-lb-save-and-then-messages.php:158
    85 msgid "Post published. <a href=\"%s\">View post</a>"
    86 msgstr ""
    87 
    88 #: lib/class-lb-save-and-then-messages.php:159
    89143msgid "Post submitted. <a target=\"_blank\" href=\"%s\">Preview post</a>"
    90144msgstr ""
    91145
    92 #: lib/class-lb-save-and-then-messages.php:161
     146#: lib/class-lb-save-and-then-messages.php:160
    93147msgid ""
    94148"Post scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" "
     
    96150msgstr ""
    97151
    98 #: lib/class-lb-save-and-then-messages.php:162
    99 #: lib/class-lb-save-and-then-messages.php:174
     152#: lib/class-lb-save-and-then-messages.php:161
     153#: lib/class-lb-save-and-then-messages.php:173
    100154msgid "M j, Y @ G:i"
    101155msgstr ""
    102156
    103 #: lib/class-lb-save-and-then-messages.php:164
     157#: lib/class-lb-save-and-then-messages.php:163
    104158msgid "Post draft updated. <a target=\"_blank\" href=\"%s\">Preview post</a>"
    105159msgstr ""
    106160
     161#: lib/class-lb-save-and-then-messages.php:167
     162msgid "Page updated. <a href=\"%s\">View page</a>"
     163msgstr ""
     164
    107165#: lib/class-lb-save-and-then-messages.php:168
    108 msgid "Page updated. <a href=\"%s\">View page</a>"
     166msgid "Page updated."
    109167msgstr ""
    110168
    111169#: lib/class-lb-save-and-then-messages.php:169
    112 msgid "Page updated."
     170msgid "Page published. <a href=\"%s\">View page</a>"
    113171msgstr ""
    114172
    115173#: lib/class-lb-save-and-then-messages.php:170
    116 msgid "Page published. <a href=\"%s\">View page</a>"
    117 msgstr ""
    118 
    119 #: lib/class-lb-save-and-then-messages.php:171
    120174msgid "Page submitted. <a target=\"_blank\" href=\"%s\">Preview page</a>"
    121175msgstr ""
    122176
    123 #: lib/class-lb-save-and-then-messages.php:173
     177#: lib/class-lb-save-and-then-messages.php:172
    124178msgid ""
    125179"Page scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" "
     
    127181msgstr ""
    128182
    129 #: lib/class-lb-save-and-then-messages.php:176
     183#: lib/class-lb-save-and-then-messages.php:175
    130184msgid "Page draft updated. <a target=\"_blank\" href=\"%s\">Preview page</a>"
    131185msgstr ""
    132186
    133 #: lib/class-lb-save-and-then-post-edit.php:142
    134 msgid "You are at the last post"
    135 msgstr ""
    136 
    137 #: lib/class-lb-save-and-then-post-edit.php:146
    138 msgid "You are at the first post"
    139 msgstr ""
    140 
    141 #: lib/class-lb-save-and-then-settings.php:100
     187#: lib/class-lb-save-and-then-settings.php:111
    142188msgid "Display button as default"
    143189msgstr ""
    144190
    145 #: lib/class-lb-save-and-then-settings.php:109
     191#: lib/class-lb-save-and-then-settings.php:120
    146192msgid "Actions to show"
    147193msgstr ""
    148194
    149 #: lib/class-lb-save-and-then-settings.php:118
     195#: lib/class-lb-save-and-then-settings.php:129
    150196msgid "Default action"
    151197msgstr ""
    152198
    153 #: lib/class-lb-save-and-then-settings.php:132
     199#: lib/class-lb-save-and-then-settings.php:143
    154200msgid "%s Settings"
    155201msgstr ""
     
    159205msgstr ""
    160206
    161 #: lib/class-lb-save-and-then-settings.php:145
     207#: lib/class-lb-save-and-then-settings.php:156
    162208msgid "You do not have sufficient permissions to access this page."
    163209msgstr ""
    164210
    165 #: lib/class-lb-save-and-then-settings.php:149
     211#: lib/class-lb-save-and-then-settings.php:160
    166212msgid "<em>%s</em> Settings"
    167213msgstr ""
    168214
    169 #: lib/class-lb-save-and-then-settings.php:153
     215#: lib/class-lb-save-and-then-settings.php:164
    170216msgid "Save Changes"
    171217msgstr ""
    172218
    173 #: lib/class-lb-save-and-then-settings.php:181
     219#: lib/class-lb-save-and-then-settings.php:190
    174220msgid "Display the new save button as the default one"
    175221msgstr ""
    176222
    177 #: lib/class-lb-save-and-then-settings.php:208
    178 msgid "<em>Last used</em>"
    179 msgstr ""
    180 
    181 #: lib/class-lb-save-and-then-settings.php:209
     223#: lib/class-lb-save-and-then-settings.php:227
     224msgid "Last used"
     225msgstr ""
     226
     227#: lib/class-lb-save-and-then-settings.php:228
    182228msgid "The last action that was used"
    183229msgstr ""
    184230
    185 #: lib/class-lb-save-and-then-settings.php:240
     231#: lib/class-lb-save-and-then-settings.php:265
    186232msgid "Settings"
    187233msgstr ""
     
    189235#. Description of the plugin/theme
    190236msgid ""
    191 "Adds a \"Save\" button to the post edit screen that saves the post and "
    192 "immediately redirect to one of the common page: the post listing, the new "
    193 "post form or the previous or next post edit page."
     237"Adds a new \"Save\" button to the Post Edit screen that saves the post and "
     238"immediately redirects to one of the common screens: the Posts List, the New "
     239"Post screen, the previous or next post's Edit screen or the post's frontend "
     240"page."
    194241msgstr ""
    195242
  • improved-save-button/trunk/lib/class-lb-save-and-then-messages.php

    r1150608 r1267552  
    5353    static function removable_query_args( $removable_query_args ) {
    5454        $removable_query_args[] = self::HTTP_PARAM_UPDATED_POST_ID;
    55 
    5655        return $removable_query_args;
    5756    }
     
    137136     * )
    138137     *
    139      * @see            Wordpress' edit-form-advanced.php:63 for usage
     138     * @see            Wordpress' edit-form-advanced.php:79 for usage
    140139     * @param  string  $post_ID Id of the post that was modified
    141140     * @return array   Messages per post type
  • improved-save-button/trunk/lib/class-lb-save-and-then-post-edit.php

    r1150608 r1267552  
    5656
    5757        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    58        
     58   
     59        // Adds post-edit.js   
    5960        wp_enqueue_script(
    6061            'lb-save-and-then-post-edit',
     
    7980        }
    8081
     82        // Adds post-edit.css
    8183        wp_enqueue_style(
    8284            'lb-save-and-then-post-edit',
     
    8587            '1.0'
    8688        );
     89
     90        // Adds rtl for post-edit.css
    8791        if( function_exists('wp_style_add_data') ) {
    8892            wp_style_add_data( 'lb-save-and-then-post-edit', 'rtl', 'replace' );
     
    104108        $options = LB_Save_And_Then_Settings::get_options();
    105109        $enabled_actions = LB_Save_And_Then_Settings::get_enabled_actions();
     110        $current_post = get_post();
    106111
    107         // If the user didn't select any action, we quit here
     112        // If the user didn't enable any action, we quit here
    108113        if( ! count( $enabled_actions ) )
    109114            return;
     
    123128        // We add to $js_object all the actions and some data
    124129        // about them.
    125         foreach ( $enabled_actions as $action_key => $action_data ) {
    126             $action_info = array(
    127                 'id' => $action_key,
    128                 'buttonLabelPattern' => $action_data['button_label_pattern'],
    129                 'enabled' => true // may be set to false below
     130        foreach ( $enabled_actions as $action ) {
     131            $new_js_action = array(
     132                'id' => $action->get_id(),
     133                'buttonLabelPattern' => $action->get_button_label_pattern( $current_post ),
     134                'enabled' => $action->is_enabled( $current_post ),
    130135            );
    131136
    132             // If action is 'next', we check if we have a next post (same
    133             // logic with 'previous'). If we don't have one, we disable
    134             // the action and set a special title.
    135             if( 'next' == $action_key || 'previous' == $action_key ) {
    136                 $adjacent_post = LB_Save_And_Then_Utils::get_adjacent_post( get_post(), $action_key );
    137                
    138                 if( ! $adjacent_post ) {
    139                     $action_info['enabled'] = false;
    140 
    141                     if( 'next' == $action_key ) {
    142                         $action_info['title'] = __('You are at the last post', 'lb-save-and-then');
    143                     }
    144 
    145                     if( 'previous' == $action_key ) {
    146                         $action_info['title'] = __('You are at the first post', 'lb-save-and-then');
    147                     }
    148                 }
     137            // If the action has a title attribute to add
     138            if( $button_title = $action->get_button_title( $current_post ) ) {
     139                $new_js_action['title'] = $button_title;
    149140            }
    150141
    151             $js_object['actions'][] = $action_info;
     142            $js_object['actions'][] = $new_js_action;
    152143        }
    153144
     
    156147        echo 'window.LabelBlanc = window.LabelBlanc || {};';
    157148        echo 'window.LabelBlanc.SaveAndThen = window.LabelBlanc.SaveAndThen || {};';
    158         echo 'window.LabelBlanc.SaveAndThen.ACTION_LAST = "' . LB_Save_And_Then::ACTION_LAST . '";';
     149        echo 'window.LabelBlanc.SaveAndThen.ACTION_LAST_ID = "' . LB_Save_And_Then_Actions::ACTION_LAST . '";';
    159150        echo 'window.LabelBlanc.SaveAndThen.HTTP_PARAM_ACTION = "' . self::HTTP_PARAM_ACTION . '";';
    160151        echo 'window.LabelBlanc.SaveAndThen.config = ' . json_encode( $js_object );
    161152        echo '</script>';
    162 
    163         // Output of the referer in a hidden field
    164         echo '<input type="hidden" name="' . LB_Save_And_Then_Redirect::HTTP_PARAM_REFERER . '" value="' . wp_get_referer() . '" />';
    165153    }
    166154} // end class
  • improved-save-button/trunk/lib/class-lb-save-and-then-settings.php

    r1220393 r1267552  
    3737    const MAIN_SETTING_NAME = 'lb-save-and-then-options';
    3838    const MENU_SLUG = 'save-and-then';
     39    /**
     40     * Version of settings this plugin's version uses. Note that
     41     * it is independent of the plugin's version number, since
     42     * multiple versions of the plugin may use the same settings
     43     * format.
     44     */
     45    const SETTINGS_VERSION = '1.1';
     46
     47    static protected $cached_options;
     48    static protected $cached_default_options;
    3949
    4050    /**
     
    4252     */
    4353    static function setup() {
     54        add_action( 'plugins_loaded', array( get_called_class(), 'check_settings_version' ) );
    4455        add_action( 'admin_init', array( get_called_class(), 'setup_settings' ) );
    4556        add_action( 'admin_init', array( get_called_class(), 'setup_settings_fields' ) );
     
    7990            self::OPTION_GROUP,
    8091            self::MAIN_SETTING_NAME,
    81             array( get_called_class(), 'validate_setting' )
     92            array( get_called_class(), 'validate_settings' )
    8293        );
    8394    }
     
    164175     */
    165176    static function create_setting_field( $args ) {
     177        // The values of all the settings
    166178        $options = self::get_options();
    167         $actions = LB_Save_And_Then::get_actions();
     179        $actions = LB_Save_And_Then_Actions::get_actions();
    168180        $option_field_name = self::MAIN_SETTING_NAME . '[' . $args['option_name'] . ']';
     181        // The setting value for this field
    169182        $option_value = $options[ $args['option_name'] ];
    170183
    171         // The key of the last action (so we don't display a line break after it).
    172         end( $actions );
    173         $last_action_key = key( $actions );
    174 
    175184        $html = '';
    176185
    177         switch( $args['option_name'] ) {
     186        switch ( $args['option_name'] ) {
    178187
    179188            case 'set-as-default':
     
    185194                $html .= '<fieldset>';
    186195
    187                 foreach ( $actions as $action_key => $action_data ) {
    188                     $html .= '<label><input type="checkbox" name="' . $option_field_name . '['. $action_key .']" value="1" data-lb-sat-settings="action" data-lb-sat-settings-value="'. $action_key .'" ' . checked( 1, $option_value[ $action_key ], false ) . '/>';
    189                     $html .= '<span>' . $action_data['name'] . '</span></label>';
    190 
    191                     if( $action_data['description'] ) {
    192                         $html .= ' <span class="description"> — ' . $action_data['description'] . '</span>';
     196                foreach ( $actions as $action_index => $action ) {
     197                    $action_id = $action->get_id();
     198
     199                    $html .= '<label><input type="checkbox" name="' . $option_field_name . '['. $action_id .']" value="1" data-lb-sat-settings="action" data-lb-sat-settings-value="'. $action_id .'" ' . checked( 1, $option_value[ $action_id ], false ) . '/>';
     200                    $html .= '<span>' . $action->get_name() . '</span>';
     201
     202                    if( $action->get_description() ) {
     203                        $html .= ' <span class="description"> — ' . $action->get_description() . '</span>';
    193204                    }
    194205
    195                     if( $last_action_key != $action_key ) {
     206                    $html .= '</label>';
     207
     208                    if( $action_index != count( $actions ) - 1 ) {
    196209                        $html .= '<br />';
    197210                    }
     
    204217                $html .= '<fieldset>';
    205218
    206                 $option_last_action = array(
    207                     LB_Save_And_Then::ACTION_LAST => array(
    208                         'name' => __('<em>Last used</em>', 'lb-save-and-then'),
    209                         'description' => __('The last action that was used', 'lb-save-and-then')
    210                     )
    211                 );
    212 
    213                 $first_element = true;
    214 
    215                 foreach ( $option_last_action + $actions as $action_key => $action_data ) {
    216                     if( ! $first_element ) {
     219                $action_index = -1;
     220
     221                do {
     222
     223                    // Special case : we show the "use last" action as first element
     224                    if ( -1 == $action_index ) {
     225
     226                        $action_id = LB_Save_And_Then_Actions::ACTION_LAST;
     227                        $action_name = '<em>' . __('Last used', 'lb-save-and-then') . '</em>';
     228                        $action_description = __('The last action that was used', 'lb-save-and-then');
     229
     230                    } else {
     231
    217232                        $html .= '<br />';
     233
     234                        $action = $actions[ $action_index ];
     235                        $action_id = $action->get_id();
     236                        $action_name = $action->get_name();
     237                        $action_description = '';
    218238                    }
    219                     $first_element = false;
    220 
    221                     $html .= '<label><input type="radio" name="' . $option_field_name . '" value="'. $action_key .'" data-lb-sat-settings="default"' . checked( $action_key, $option_value, false ) . '/>';
    222                     $html .= '<span>' . $action_data['name'] . '</span></label>';
    223 
    224                     if( $action_key == LB_Save_And_Then::ACTION_LAST && $action_data['description'] ) {
    225                         $html .= ' <span class="description"> — ' . $action_data['description'] . '</span>';
     239
     240                    $html .= '<label><input type="radio" name="' . $option_field_name . '" value="'. $action_id .'" data-lb-sat-settings="default"' . checked( $action_id, $option_value, false ) . '/>';
     241                   
     242                    $html .= '<span>' . $action_name . '</span>';
     243
     244                    if( $action_description ) {
     245                        $html .= ' <span class="description"> — ' . $action_description . '</span>';
    226246                    }
    227                 }
     247
     248                    $html .= '</label>';
     249
     250                    $action_index++;
     251
     252                } while( $action_index < count( $actions ) );
    228253
    229254                $html .= '</fieldset>';
     
    245270    /**
    246271     * Analyses the arguments received from the request, builds
    247      * a new 'clean' settings array (with default if required)
    248      * and returns it.
     272     * a new 'clean' settings array and returns it.
     273     * If a setting is missing, it will be set with a logical value
     274     * (which may be different than the ones provided by
     275     * self::get_default_options()).
    249276     *
    250277     * @param  array  $input  Parameters received in the request
    251278     * @return array          Cleaned settings array
    252279     */
    253     static function validate_setting( $input ) {
    254         $defaults = self::get_default_values();
    255         $actions = LB_Save_And_Then::get_actions();
    256 
    257         // Defaults, if none set
    258         $sanitized_input = array(
    259             'set-as-default' => false, // Default
    260             'default-action' => $defaults['default-action'],
    261             'actions' => array()
    262         );
     280    static function validate_settings( $input ) {
     281        $actions = LB_Save_And_Then_Actions::get_actions();
    263282
    264283        if( ! $input )
    265284            $input = array();
    266285
     286        $sanitized_input = self::sanitize_options( $input );
     287
    267288        // set-as-default
    268         if( isset( $input['set-as-default'] ) && '1' == $input['set-as-default'] ) {
    269             $sanitized_input['set-as-default'] = true;
    270         }
    271 
    272         // actions
    273         if( ! isset( $input['actions'] ) )
    274             $input['actions'] = array();
    275 
    276         foreach ( $actions as $action_key => $action_value) {
    277             if( isset( $input['actions'][$action_key] ) && '1' == $input['actions'][$action_key] ) {
    278                 $sanitized_input['actions'][$action_key] = true;
     289        if ( ! isset( $sanitized_input['set-as-default'] ) ) {
     290            $sanitized_input['set-as-default'] = false;
     291        }
     292
     293        /*
     294         * If an action is missing, we set it as disabled
     295         */
     296        if ( ! isset( $sanitized_input['actions'] ) ) {
     297            $sanitized_input['actions'] = array();
     298        }
     299
     300        foreach ( $actions as $action ) {
     301            if( ! array_key_exists( $action->get_id(), $sanitized_input['actions'] ) ) {
     302                $sanitized_input['actions'][ $action->get_id() ] = false;
     303            }
     304        }
     305
     306        /*
     307         * Determine the default action.
     308         * - If none is set, we use the 'use last' action
     309         * - If one is set and it is disabled, we change it to the 'use last' action
     310         */
     311        if ( ! isset( $sanitized_input['default-action'] ) ) {
     312            $sanitized_input['default-action'] = LB_Save_And_Then_Actions::ACTION_LAST;
     313        }
     314   
     315        if ( $sanitized_input['default-action'] != LB_Save_And_Then_Actions::ACTION_LAST ) {
     316            // If the default-action is a disabled action, we change it to the default value
     317            if ( true != $sanitized_input['actions'][ $sanitized_input['default-action'] ] ) {
     318                $sanitized_input['default-action'] = LB_Save_And_Then_Actions::ACTION_LAST;
     319            }
     320        }
     321
     322        return $sanitized_input;
     323    }
     324
     325    /**
     326     * Returns the default options values. Used when getting the
     327     * settings. Not used when saving the settings.
     328     *
     329     * @return array Associative array of options
     330     */
     331    static function get_default_options() {
     332        if ( ! isset( self::$cached_default_options ) ) {
     333            $defaults = array(
     334                'set-as-default' => true,
     335                'actions' => array(),
     336                'default-action' => '' // Set below
     337            );
     338
     339            // By default, all the available actions are enabled by default
     340            $actions = LB_Save_And_Then_Actions::get_actions();
     341
     342            foreach ( $actions as $action ) {
     343                $defaults['actions'][ $action->get_id() ] = true;
     344            }
     345
     346            // The default action is the '_last' one.
     347            $defaults['default-action'] = LB_Save_And_Then_Actions::ACTION_LAST;
     348
     349            self::$cached_default_options = $defaults;
     350        }
     351
     352        return self::$cached_default_options;
     353    }
     354
     355    /**
     356     * Returns an array of all the option values saved in the database,
     357     * where non-defined options are set with the defaults provided
     358     * by self::get_default_options()
     359     *
     360     * @return array Associative array of options
     361     */
     362    static function get_options() {
     363        if ( ! isset( self::$cached_options ) ) {
     364            $options = get_option( self::MAIN_SETTING_NAME );
     365
     366            if( ! $options )
     367                $options = array();
     368
     369            // Sanitizing any invalid value in the database
     370            $options = self::sanitize_options( $options );
     371
     372            self::$cached_options = self::merge_options_with_default( $options );
     373        }
     374
     375        return self::$cached_options;
     376    }
     377
     378    /**
     379     * Returns an options array with the defaults values overwritten
     380     * by the ones in the supplied array.
     381     *
     382     * @param  array  $options Overwrites to the defaults
     383     * @return array
     384     */
     385    static function merge_options_with_default( $options = array() ) {
     386        return array_replace_recursive( self::get_default_options(), $options );
     387    }
     388
     389    /**
     390     * Receives an options array and sanitize its value to ensure
     391     * it has correct types and existing actions. Removes any invalid
     392     * action.
     393     */
     394    static function sanitize_options( $options = array() ) {
     395        // 'set-as-default' action must be boolean
     396        if ( isset( $options['set-as-default'] ) ) {
     397            $options['set-as-default'] = (bool) $options['set-as-default']; // Ensures boolean
     398        }
     399
     400        // 'default-action' must be an existing action
     401        if ( isset( $options['default-action'] ) ) {
     402            if ( ! LB_Save_And_Then_Actions::action_exists( $options['default-action'] ) ) {
     403                unset( $options['default-action'] );
     404            }
     405        }
     406
     407        // Each action must exist
     408        if ( isset( $options['actions'] ) ) {
     409            if ( ! is_array( $options['actions'] ) ) {
     410                unset( $options['actions'] );
    279411            } else {
    280                 $sanitized_input['actions'][$action_key] = false;
    281             }
    282         }
    283 
    284         // default action
    285         if(
    286             $input['default-action'] == LB_Save_And_Then::ACTION_LAST
    287             || array_key_exists( $input['default-action'], $sanitized_input['actions'] )
    288                 && $sanitized_input['actions'][$input['default-action']] === true
    289         ) {
    290             $sanitized_input['default-action'] = $input['default-action'];
    291         } else {
    292             // We should not get here normally (but possible with a modified request),
    293             // so, just in case, we use the '_last' type.
    294             $sanitized_input['default-action'] = LB_Save_And_Then::ACTION_LAST;
    295         }
    296 
    297         return $sanitized_input;
    298     }
    299 
    300     /**
    301      * Generates an options array with default values.
    302      *
    303      * @return array Associative array of options
    304      */
    305     static function get_default_values() {
    306         $defaults = array(
    307             'set-as-default' => true,
    308             'actions' => array(),
    309             'default-action' => '' // Set below
    310         );
    311 
    312         // We select all the available actions
    313         $actions = LB_Save_And_Then::get_actions();
    314 
    315         foreach ( $actions as $action_key => $action_value) {
    316             $defaults['actions'][$action_key] = true;
    317         }
    318 
    319         // The default action is the '_last' one.
    320         $defaults['default-action'] = LB_Save_And_Then::ACTION_LAST;
    321 
    322         return $defaults;
    323     }
    324 
    325     /**
    326      * Returns an array of all the option values saved in the database,
    327      * where non-defined options are set with the defaults.
    328      *
    329      * @return array Associative array of options
    330      */
    331     static function get_options() {
    332         $options = get_option( self::MAIN_SETTING_NAME );
    333 
    334         if( ! $options )
    335             $options = array();
    336 
    337         return array_replace_recursive( self::get_default_values(), $options );
     412                foreach ( $options['actions'] as $action_id => $action_enabled ) {
     413                    if ( ! LB_Save_And_Then_Actions::action_exists( $action_id ) ) {
     414                        unset( $options['actions'][$action_id] );
     415                        continue;
     416                    }
     417
     418                    $options['actions'][$action_id] = (bool) $options['actions'][$action_id];
     419                }
     420            }
     421        }
     422       
     423        return $options;
    338424    }
    339425
     
    342428     * settings page. The keys are the action id and the values are the
    343429     * action data array as returned by LB_Save_And_Then::get_actions().
    344      * 
     430     *
    345431     * @return array The enabled types
    346432     */
    347433    static function get_enabled_actions() {
    348434        $options = self::get_options();
    349         $all_actions = LB_Save_And_Then::get_actions();
    350 
    351435        $active_actions = array();
    352436
    353437        if( isset( $options['actions'] ) ) {
    354             foreach ( $options['actions'] as $action_key => $action_value ) {
    355                 if( $action_value ) {
    356                     $active_actions[ $action_key ] = $all_actions[ $action_key ];
     438            foreach ( $options['actions'] as $action_id => $action_enabled ) {
     439                $action = LB_Save_And_Then_Actions::get_action( $action_id );
     440                if( ! is_null( $action ) && $action_enabled ) {
     441                    $active_actions[ $action_id ] = $action;
    357442                }
    358443            }
     
    361446        return $active_actions;
    362447    }
     448
     449    /**
     450     * Checks if the settings need an update. If so, update them.
     451     * Called by the plugins_loaded hook
     452     */
     453    static function check_settings_version() {
     454        if( self::do_settings_need_update() ) {
     455            self::update_settings();
     456        }
     457    }
     458
     459    /**
     460     * Returns true if the settings in the database need
     461     * an update (because of plugin update) by checking the
     462     * settings version number.
     463     *
     464     * @return boolean
     465     */
     466    static function do_settings_need_update() {
     467        $options = get_option( self::MAIN_SETTING_NAME );
     468
     469        if( ! $options ) {
     470            return false;
     471        }
     472
     473        $old_options_version = self::get_settings_version();
     474
     475        return version_compare( $old_options_version, self::SETTINGS_VERSION ) === -1;
     476    }
     477
     478    /**
     479     * Updates the settings from an older version of the plugin
     480     * to the ones used in this version.
     481     */
     482    static function update_settings() {
     483        $options = get_option( self::MAIN_SETTING_NAME );
     484
     485        if( ! $options ) {
     486            return;
     487        }
     488
     489        $options['version'] = self::SETTINGS_VERSION;
     490        $v1_0_actions_id_translations = array(
     491            'new' => 'labelblanc.new',
     492            'list' => 'labelblanc.list',
     493            'next' => 'labelblanc.next',
     494            'previous' => 'labelblanc.previous',
     495        );
     496
     497        // In v1.0, we used other action names, we update those
     498        if( isset( $options['actions'] ) && is_array( $options['actions'] ) ) {
     499            foreach ( $options['actions'] as $action_id => $action_enabled ) {
     500                if( array_key_exists( $action_id, $v1_0_actions_id_translations ) ) {
     501                    $new_action_id = $v1_0_actions_id_translations[ $action_id ];
     502                    $options['actions'][$new_action_id] = $action_enabled;
     503                    unset( $options['actions'][$action_id] );
     504                }
     505            }
     506        }
     507
     508        // Update of the default-action name
     509        if( isset( $options['default-action'] ) ) {
     510            if( array_key_exists( $options['default-action'], $v1_0_actions_id_translations ) ) {
     511                $options['default-action'] = $v1_0_actions_id_translations[ $options['default-action'] ];
     512            }
     513        }
     514
     515        update_option( self::MAIN_SETTING_NAME, $options );
     516    }
     517
     518    /**
     519     * Returns the settings' format version number. Note that this number
     520     * is independent of the plugin's number since multiple plugin's
     521     * versions may use the same settings format. Returns false if the
     522     * settings do not exist yet.
     523     *
     524     * @return string|false
     525     */
     526    static function get_settings_version() {
     527        $options = get_option( self::MAIN_SETTING_NAME );
     528
     529        if( ! $options ) {
     530            return false;
     531        }
     532
     533        return isset( $options['version'] ) ? $options['version'] : '1.0';
     534    }
     535
    363536} // end class
    364537
  • improved-save-button/trunk/lib/class-lb-save-and-then-utils.php

    r1094802 r1267552  
    3131
    3232    /**
     33     * Internal cache variable to hold the adjacents post
     34     * The keys are in the format [post-id]-[next|previous],
     35     * the values are the post object.
     36     *
     37     * @var array
     38     */
     39    static protected $adjacent_post_cache = array();
     40
     41    /**
    3342     * Returns the full URL to a file in this plugins folder.
    3443     *
     
    4150     */
    4251    static function plugins_url( $file ) {
    43        
    4452        return plugins_url( $file, dirname( __FILE__ ) );
    4553    }
     
    7886     */
    7987    static function get_adjacent_post( $post, $dir = 'next' ) {
     88        global $wpdb;
     89        $cache_id = $post->ID . '-' . $dir;
    8090
    81         global $wpdb;
     91        if( ! array_key_exists( $cache_id, self::$adjacent_post_cache ) ) {
     92            $op = $dir == 'next' ? '>' : '<';
     93            $order = $dir == 'next' ? 'ASC' : 'DESC';
     94            $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) );
     95            $additionnal_where = '';
    8296
    83         $op = $dir == 'next' ? '>' : '<';
    84         $order = $dir == 'next' ? 'ASC' : 'DESC';
    85         $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) );
    86         $additionnal_where = '';
     97            // If the current user cannot edit others posts, we add a WHERE clause
     98            // where only the user's post are returned
     99            $post_type_object = get_post_type_object( get_post_type( $post ) );
    87100
    88         // If the current user cannot edit others posts, we add a WHERE clause
    89         // where only the user's post are returned
    90         $post_type_object = get_post_type_object( get_post_type( $post ) );
     101            if ( ! current_user_can( $post_type_object->cap->edit_others_posts ) ) {
     102                $additionnal_where .= ' AND post_author = \'' . get_current_user_id() . '\'';
     103            }
     104           
     105            $query = $wpdb->prepare("
     106                    SELECT p.ID FROM $wpdb->posts AS p
     107                    WHERE p.post_date $op %s AND p.post_type = %s
     108                    AND (p.post_status NOT IN ('" . implode( "','", $exclude_states ) . "'))
     109                    $additionnal_where
     110                    ORDER BY p.post_date $order LIMIT 1
     111                ",
     112                 $post->post_date, $post->post_type
     113            );
     114            $found_post_id = $wpdb->get_var( $query );
    91115
    92         if ( ! current_user_can( $post_type_object->cap->edit_others_posts ) ) {
    93             $additionnal_where .= ' AND post_author = \'' . get_current_user_id() . '\'';
    94         }
    95        
    96         $query = $wpdb->prepare("
    97                 SELECT p.ID FROM $wpdb->posts AS p
    98                 WHERE p.post_date $op %s AND p.post_type = %s
    99                 AND (p.post_status NOT IN ('" . implode( "','", $exclude_states ) . "'))
    100                 $additionnal_where
    101                 ORDER BY p.post_date $order LIMIT 1
    102             ",
    103              $post->post_date, $post->post_type
    104         );
    105         $found_post_id = $wpdb->get_var( $query );
    106 
    107         if( $found_post_id ) {
    108             return get_post( $found_post_id );
     116            if( $found_post_id ) {
     117                self::$adjacent_post_cache[ $cache_id ] = get_post( $found_post_id );
     118            } else {
     119                self::$adjacent_post_cache[ $cache_id ] = null;
     120            }
    109121        }
    110122
    111         return null;
     123        return self::$adjacent_post_cache[ $cache_id ];
     124    }
     125
     126    /**
     127     * Returns true if the $url is the listing page of $post_type.
     128     *
     129     * @param  string  $url       The url to check
     130     * @param  string  $post_type The post type. Defaults to 'post'
     131     * @return boolean
     132     */
     133    static function url_is_posts_list( $url, $post_type = 'post' ) {
     134        $url_parts = self::parse_url( $url );
     135        $url_params = $url_parts['query'];
     136        $posts_list_url_base = admin_url( 'edit.php' );
     137
     138        // If no post type is set in the URL, defaults to 'post'
     139        $url_post_type = isset( $url_params['post_type'] ) ? $url_params['post_type'] : 'post';
     140
     141        // True if the url is edit.php and the post type is the same
     142        // @todo may need to check if the path is exactly the same
     143        //       (with domain and everything)
     144        return (
     145            strpos( $url, $posts_list_url_base ) === 0
     146            &&
     147            $url_post_type == $post_type
     148        );
     149    }
     150
     151    /**
     152     * from a url string, returns the address parts
     153     * and the query params as an associative array
     154     * @param  [type] $url [description]
     155     * @return [type] [description]
     156     */
     157    static function parse_url( $url ) {
     158        $url_parts = parse_url( $url );
     159        $query = array();
     160        wp_parse_str( $url_parts['query'], $query );
     161        $url_parts['query'] = $query;
     162        return $url_parts;
     163    }
     164
     165    static function admin_url( $relative_url, $params = array() ) {
     166        $url = admin_url( $relative_url );
     167        return add_query_arg( $params, $url );
    112168    }
    113169} // end class
  • improved-save-button/trunk/readme.txt

    r1220393 r1267552  
    11=== Improved Save Button ===
    22Contributors: LabelBlanc
    3 Tags: publish, save, close, list, edit, editing, return to list, close post, posts list, update, save and new, save and return, save and list, save and next, next post, save and previous, previous post, admin, administration, editor, multisite, custom post type, page, post
     3Tags: publish, save, close, list, edit, editing, return to list, close post, posts list, update, save and new, save and return, save and list, save and next, next post, save and previous, save and view, previous post, admin, administration, editor, multisite, custom post type, page, post
    44Requires at least: 3.5
    55Tested up to: 4.3
    6 Stable tag: 1.0.2
     6Stable tag: 1.1
    77License: GPLv3 or later
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
    99
    10 Adds a button to the Edit Post screen which, in one click, saves the post and redirects you to the posts list, the New Post form or an adjacent post.
     10Adds a button to the Edit Post screen which, in one click, saves the post then redirects you to the posts list, the New Post form, an adjacent post or the post's frontend page.
    1111
    1212== Description ==
    1313
    14 Save a lot of time with this plugin if you have multiple posts, pages or custom posts to create or modify!
     14This plugin adds a new and improved "Save" button to the Post Edit screen that, in a single click, saves the current post and immediately redirects you to either:
    1515
    16 This plugin adds a new "Save" button to the Post Edit screen that, in one click, saves the current post and immediately redirects you to either the posts list, the New Post screen or the Post Edit screen of the previous or next post.
     16* The posts list (Save and List, a.k.a. "Save and Close"),
     17* The New Post screen (Save and New),
     18* The Post Edit screen of the previous or next post (Save and Previous/Next)
     19* The post's page on the frontend (Save and View).
    1720
    18 The new button adds the following possibilities:
    19 
    20 * **Save and List** (a.k.a. Save and Close): in one click, save the current post and go back to the posts list.
    21 * **Save and New**: in one click, save the current post and go to the New Post screen.
    22 * **Save and Previous**: in one click, save the current post and go to the previous post's Edit screen.
    23 * **Save and Next**: in one click, save the current post and go to the next post's Edit screen.
     21This plugin saves you a lot of time when you have multiple posts, pages or custom posts to create or modify!
    2422
    2523Works with pages, posts and custom post types!
    2624
    2725Through the plugin's settings page, choose which actions are available and which one to use as the buttons' default action.
     26
     27Detail of the actions this new button allows:
     28
     29* **Save and List** (a.k.a. Save and Close): in a single click, save the current post and go back to the posts list.
     30* **Save and New**: save the current post and go to the New Post screen.
     31* **Save and Previous**: save the current post and go to the previous post's Edit screen.
     32* **Save and Next**: save the current post and go to the next post's Edit screen.
     33* **Save and View** (same or new window): save the current post and show the post's page on the frontend. Can show the post in the same window or in a new one.
    2834
    2935== Installation ==
     
    4450== Changelog ==
    4551
     52= 1.1 =
     53Release Date: October 17, 2015
     54
     55* New action: As requested, a "Save and View" action was added! This action shows the post's frontend page after the save. Two behaviors are available: show in the same window or show in a new window.
     56* Enhancement: A title attribute on the 'Save and next/previous' action now shows the name of the next/previous post.
     57* Enhancement: A big part of the code was rewritten to ease the addition of future new actions (no documentation yet, but you can develop plugins that add new actions, look in the code if interested!).
     58* Some bug fixes, including one with required fields of ACF.
     59
    4660= 1.0.2 =
    4761Release Date: August 13, 2015
  • improved-save-button/trunk/scss/post-edit.scss

    r1150608 r1267552  
    11/**
    2  * Copyright 2014 Label Blanc (http://www.labelblanc.ca/)
     2 * Copyright 2015 Label Blanc (http://www.labelblanc.ca/)
    33 *
    4  * This file is part of the "Save then create new, show list, or more..."
     4 * This file is part of the "Improved Save Button"
    55 * Wordpress plugin.
    66 *
    7  * The "Save then create new, show list, or more..." Wordpress plugin
     7 * The "Improved Save Button" Wordpress plugin
    88 * is free software: you can redistribute it and/or modify
    99 * it under the terms of the GNU General Public License as published by
     
    9090            padding-right: 8px;
    9191        }
     92    }
     93
     94    // Icon alignment
     95    .dashicons {
     96        vertical-align: text-bottom;
    9297    }
    9398}
Note: See TracChangeset for help on using the changeset viewer.