Changeset 1267552
- Timestamp:
- 10/16/2015 05:51:32 PM (10 years ago)
- Location:
- improved-save-button
- Files:
-
- 47 added
- 1 deleted
- 21 edited
-
assets/banner-1544x500.png (modified) (previous)
-
assets/banner-772x250.png (modified) (previous)
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
assets/screenshot-3.png (modified) (previous)
-
tags/1.1 (added)
-
tags/1.1/COPYING.txt (added)
-
tags/1.1/actions (added)
-
tags/1.1/actions/class-lb-save-and-then-action-list.php (added)
-
tags/1.1/actions/class-lb-save-and-then-action-new.php (added)
-
tags/1.1/actions/class-lb-save-and-then-action-next.php (added)
-
tags/1.1/actions/class-lb-save-and-then-action-previous.php (added)
-
tags/1.1/actions/class-lb-save-and-then-action-view-popup.php (added)
-
tags/1.1/actions/class-lb-save-and-then-action-view.php (added)
-
tags/1.1/css (added)
-
tags/1.1/css/post-edit-rtl.css (added)
-
tags/1.1/css/post-edit.css (added)
-
tags/1.1/improved-save-button.php (added)
-
tags/1.1/js (added)
-
tags/1.1/js/backward-compatibility (added)
-
tags/1.1/js/backward-compatibility/post-edit.pre-4.2.js (added)
-
tags/1.1/js/backward-compatibility/post-edit.pre-4.2.min.js (added)
-
tags/1.1/js/post-edit.js (added)
-
tags/1.1/js/post-edit.min.js (added)
-
tags/1.1/js/settings-page.js (added)
-
tags/1.1/js/settings-page.min.js (added)
-
tags/1.1/languages (added)
-
tags/1.1/languages/lb-save-and-then-fr_FR.mo (added)
-
tags/1.1/languages/lb-save-and-then-fr_FR.po (added)
-
tags/1.1/languages/lb-save-and-then.pot (added)
-
tags/1.1/lib (added)
-
tags/1.1/lib/class-lb-save-and-then-action.php (added)
-
tags/1.1/lib/class-lb-save-and-then-actions.php (added)
-
tags/1.1/lib/class-lb-save-and-then-messages.php (added)
-
tags/1.1/lib/class-lb-save-and-then-post-edit.php (added)
-
tags/1.1/lib/class-lb-save-and-then-post-save.php (added)
-
tags/1.1/lib/class-lb-save-and-then-settings.php (added)
-
tags/1.1/lib/class-lb-save-and-then-utils.php (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/scss (added)
-
tags/1.1/scss/post-edit.scss (added)
-
tags/1.1/uninstall.php (added)
-
trunk/actions (added)
-
trunk/actions/class-lb-save-and-then-action-list.php (added)
-
trunk/actions/class-lb-save-and-then-action-new.php (added)
-
trunk/actions/class-lb-save-and-then-action-next.php (added)
-
trunk/actions/class-lb-save-and-then-action-previous.php (added)
-
trunk/actions/class-lb-save-and-then-action-view-popup.php (added)
-
trunk/actions/class-lb-save-and-then-action-view.php (added)
-
trunk/css/post-edit-rtl.css (modified) (1 diff)
-
trunk/css/post-edit.css (modified) (1 diff)
-
trunk/improved-save-button.php (modified) (6 diffs)
-
trunk/js/post-edit.js (modified) (11 diffs)
-
trunk/js/post-edit.min.js (modified) (1 diff)
-
trunk/js/settings-page.js (modified) (1 diff)
-
trunk/js/settings-page.min.js (modified) (1 diff)
-
trunk/languages/lb-save-and-then-fr_FR.mo (modified) (previous)
-
trunk/languages/lb-save-and-then-fr_FR.po (modified) (6 diffs)
-
trunk/languages/lb-save-and-then.pot (modified) (6 diffs)
-
trunk/lib/class-lb-save-and-then-action.php (added)
-
trunk/lib/class-lb-save-and-then-actions.php (added)
-
trunk/lib/class-lb-save-and-then-messages.php (modified) (2 diffs)
-
trunk/lib/class-lb-save-and-then-post-edit.php (modified) (6 diffs)
-
trunk/lib/class-lb-save-and-then-post-save.php (added)
-
trunk/lib/class-lb-save-and-then-redirect.php (deleted)
-
trunk/lib/class-lb-save-and-then-settings.php (modified) (9 diffs)
-
trunk/lib/class-lb-save-and-then-utils.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/scss/post-edit.scss (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
improved-save-button/trunk/css/post-edit-rtl.css
r1220393 r1267552 1 1 /* 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 1 1 /* 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 2 2 /* 3 3 Plugin 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 editpage.4 Description: 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. 5 5 Author: Label Blanc 6 Version: 1. 0.26 Version: 1.1 7 7 Author URI: http://www.labelblanc.ca 8 8 Domain Path: /languages/ … … 31 31 */ 32 32 33 /** 34 * All the PHP files of the plugin 35 * @var array 36 */ 33 37 $lib_files_to_include = array( 34 38 'class-lb-save-and-then-utils.php', 35 39 'class-lb-save-and-then-settings.php', 36 40 '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', 38 42 'class-lb-save-and-then-messages.php', 43 'class-lb-save-and-then-actions.php', 44 'class-lb-save-and-then-action.php', 39 45 ); 40 46 47 // Include all the PHP files of the plugin 41 48 foreach ( $lib_files_to_include as $file_name ) { 42 49 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 66 foreach ( $actions_files_to_include as $file_name ) { 67 require_once( plugin_dir_path( __FILE__ ) . 'actions' . DIRECTORY_SEPARATOR . $file_name ); 43 68 } 44 69 … … 52 77 53 78 /** 54 * Id of the 'use last' action55 */56 const ACTION_LAST = '_last';57 58 /**59 79 * Main entry point of the plugin. Calls the setup function 60 80 * of the other classes. … … 63 83 LB_Save_And_Then_Settings::setup(); 64 84 LB_Save_And_Then_Post_Edit::setup(); 65 LB_Save_And_Then_ Redirect::setup();85 LB_Save_And_Then_Post_Save::setup(); 66 86 LB_Save_And_Then_Messages::setup(); 87 LB_Save_And_Then_Actions::setup(); 67 88 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' ) ); 69 93 } 70 94 … … 79 103 80 104 /** 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 /** 81 126 * Loads the language file for the admin. Must be called in the 82 127 * 'admin_init' hook, since it uses get_plugin_data() and this … … 88 133 $path .= $plugin_data['DomainPath']; 89 134 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 name100 * when the action is selected. %s is replaced101 * with the publish button label (ex: 'Update')>,102 * 'description' => <Displayed in the settings page>103 * )104 * )105 * @return array All the available actions106 */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 );130 135 } 131 136 -
improved-save-button/trunk/js/post-edit.js
r1150608 r1267552 56 56 this.$form = $form; 57 57 this.config = config; 58 this.action = null; 58 59 59 60 /** … … 69 70 * enabled (ex : only the "Save and previous", but there is no 70 71 * 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). 72 74 */ 73 75 if( config.actions.length === 1 && ! config.actions[0].enabled ) { … … 170 172 171 173 /** 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 /**183 174 * Updates the look of the original publish button, depending 184 175 * if the new publish button must be displayed as the default … … 201 192 */ 202 193 setAction : function( newAction ) { 194 this.action = newAction; 203 195 wpCookies.set( SAT.PostEditForm.LAST_USED_COOKIE_NAME, newAction.id, 365*24*3600 ); 204 196 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 }); 205 263 }, 206 264 … … 234 292 235 293 // 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 ) { 237 295 var cookieVal = wpCookies.get( SAT.PostEditForm.LAST_USED_COOKIE_NAME ); 238 296 … … 281 339 setupWordpressListeners : function() { 282 340 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 }); 283 370 284 371 // Disable button while auto saving … … 350 437 */ 351 438 createMainButton : function() { 352 var $mainButton = $('<input type="button" />'); 439 // A non-submitting button 440 var $mainButton = $('<button type="button"/>'); 353 441 354 442 $mainButton.attr('class', 'button button-large lb-sat-main-button' ); … … 462 550 return; 463 551 } 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(); 469 554 }); 470 555 }, … … 497 582 return; 498 583 } 584 499 585 self.setAction( $(this).data('lbSatActionData') ); 500 586 self.$mainButton.click(); … … 535 621 536 622 /** 623 * Returns the action 624 * @return {object} The action 625 */ 626 getAction : function() { 627 return this.action; 628 }, 629 630 /** 537 631 * Updates the label of the main menu and the dropdown menu elements 538 632 * based on the currently set action and the value of the original 539 * button. 633 * button. Also updates the title attribute. 540 634 */ 541 635 updateLabels : function() { 542 636 var self = this; 543 637 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 546 645 $.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 ) ); 549 648 }); 550 649 }, … … 571 670 this.$dropdownButton.toggleClass( 'disabled', disabled ); 572 671 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); 579 676 } 580 677 }; -
improved-save-button/trunk/js/post-edit.min.js
r1150608 r1267552 1 1 /* 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="" />');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);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,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="" />');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 70 70 var $action = $(elem), 71 71 action = $action.data('lbSatSettingsValue'), 72 $default = $defaultOptions.filter('[value= ' + action + ']');72 $default = $defaultOptions.filter('[value="' + action + '"]'); 73 73 74 74 if( ! $action.prop('checked') && $default.prop('checked') ) { 75 $defaultOptions.filter('[value= _last]').prop('checked', true);75 $defaultOptions.filter('[value="_last"]').prop('checked', true); 76 76 } 77 77 -
improved-save-button/trunk/js/settings-page.min.js
r1094802 r1267552 1 1 /* 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 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Improved Save Button 1.0. 1\n"5 "Project-Id-Version: Improved Save Button 1.0.2\n" 6 6 "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/improved-save-" 7 7 "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" 10 10 "Last-Translator: Xavier Frenette <xavier@xavierfrenette.com>\n" 11 11 "Language-Team: LANGUAGE <LL@li.org>\n" 12 12 "Language: en\n" 13 13 "MIME-Version: 1.0\n" 14 "Content-Type: text/plain; charset= utf-8\n"14 "Content-Type: text/plain; charset=UTF-8\n" 15 15 "Content-Transfer-Encoding: 8bit\n" 16 16 "X-Generator: Poedit 1.6.4\n" … … 20 20 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 21 "X-Poedit-SourceCharset: UTF-8\n" 22 "X-Poedit-Basepath: .. /\n"22 "X-Poedit-Basepath: ..\n" 23 23 "X-Textdomain-Support: yes\n" 24 24 "X-Poedit-SearchPath-0: .\n" 25 25 26 #: improved-save-button.php:110 26 #: actions/class-lb-save-and-then-action-list.php:70 27 msgid "Save and List" 28 msgstr "Enregistrer puis lister" 29 30 #: actions/class-lb-save-and-then-action-list.php:84 31 msgid "Shows the <strong>posts list</strong> after save." 32 msgstr "Affiche <strong>la liste des articles</strong> après l'enregistrement" 33 34 #: actions/class-lb-save-and-then-action-list.php:91 35 msgid "%s and List" 36 msgstr "%s et lister" 37 38 #: actions/class-lb-save-and-then-action-new.php:34 27 39 msgid "Save and New" 28 40 msgstr "Enregistrer puis créer nouveau" 29 41 30 #: improved-save-button.php:111 42 #: actions/class-lb-save-and-then-action-new.php:48 43 msgid "Shows the <strong>new post</strong> form after save." 44 msgstr "" 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 31 48 msgid "%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 49 msgstr "%s et nouveau" 50 51 #: actions/class-lb-save-and-then-action-next.php:36 52 52 msgid "Save and Next" 53 53 msgstr "Enregistrer puis suivant" 54 54 55 #: improved-save-button.php:121 55 #: actions/class-lb-save-and-then-action-next.php:50 56 msgid "Shows the <strong>next post</strong> edit form after save." 57 msgstr "Affiche <strong>le prochain article</strong> après l'enregistrement" 58 59 #: actions/class-lb-save-and-then-action-next.php:57 56 60 msgid "%s and Next" 57 61 msgstr "%s et suivant" 58 62 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 64 msgid "You are at the last post" 65 msgstr "Vous êtes au dernier article" 66 67 #: actions/class-lb-save-and-then-action-next.php:86 68 msgid "Next post is \"%s\"" 69 msgstr "Le prochain article est \"%s\"" 70 71 #: actions/class-lb-save-and-then-action-previous.php:36 64 72 msgid "Save and Previous" 65 73 msgstr "Enregistrer puis précédent" 66 74 67 #: improved-save-button.php:126 75 #: actions/class-lb-save-and-then-action-previous.php:50 76 msgid "Shows the <strong>previous post</strong> edit form after save." 77 msgstr "Affiche <strong>l'article précédent</strong> après l'enregistrement" 78 79 #: actions/class-lb-save-and-then-action-previous.php:57 68 80 msgid "%s and Previous" 69 81 msgstr "%s et précédent" 70 82 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 84 msgid "You are at the first post" 85 msgstr "Vous êtes au premier article" 86 87 #: actions/class-lb-save-and-then-action-previous.php:86 88 msgid "Previous post is \"%s\"" 89 msgstr "L'article précédent est \"%s\"" 90 91 #: actions/class-lb-save-and-then-action-view-popup.php:105 92 msgid "" 93 "Please wait while the post is being saved. This window will refresh " 94 "automatically." 95 msgstr "" 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 100 msgid "Save and View %s (new window)" 101 msgstr "Enregistrer puis afficher %s (nouvelle fenêtre)" 102 103 #: actions/class-lb-save-and-then-action-view-popup.php:135 104 msgid "Shows the <strong>post itself in a new window</strong> after save." 105 msgstr "" 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 110 msgid "%%s and View %s" 111 msgstr "%%s et afficher %s" 112 113 #: actions/class-lb-save-and-then-action-view-popup.php:154 114 msgid "Post will be shown in a new window" 115 msgstr "L'article s'affichera dans une nouvelle fenêtre" 116 117 #: actions/class-lb-save-and-then-action-view.php:34 118 msgid "Save and View" 119 msgstr "Enregistrer puis afficher" 120 121 #: actions/class-lb-save-and-then-action-view.php:48 122 msgid "" 123 "Shows the <strong>post itself</strong> after save. The same window is used." 124 msgstr "" 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 129 msgid "%s and View" 130 msgstr "%s et afficher" 131 132 #: actions/class-lb-save-and-then-action-view.php:66 133 msgid "Post will be shown in this window" 134 msgstr "L'article s'affichera dans cette fenêtre" 135 136 #: lib/class-lb-save-and-then-messages.php:155 137 msgid "Post updated. <a href=\"%s\">View post</a>" 138 msgstr "" 74 139 75 140 #: lib/class-lb-save-and-then-messages.php:156 76 msgid "Post updated. <a href=\"%s\">View post</a>"141 msgid "Post updated." 77 142 msgstr "" 78 143 79 144 #: lib/class-lb-save-and-then-messages.php:157 80 msgid "Post updated."145 msgid "Post published. <a href=\"%s\">View post</a>" 81 146 msgstr "" 82 147 83 148 #: 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:15988 149 msgid "Post submitted. <a target=\"_blank\" href=\"%s\">Preview post</a>" 89 150 msgstr "" 90 151 91 #: lib/class-lb-save-and-then-messages.php:16 1152 #: lib/class-lb-save-and-then-messages.php:160 92 153 msgid "" 93 154 "Post scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s" … … 95 156 msgstr "" 96 157 97 #: lib/class-lb-save-and-then-messages.php:16 298 #: lib/class-lb-save-and-then-messages.php:17 4158 #: lib/class-lb-save-and-then-messages.php:161 159 #: lib/class-lb-save-and-then-messages.php:173 99 160 msgid "M j, Y @ G:i" 100 161 msgstr "" 101 162 102 #: lib/class-lb-save-and-then-messages.php:16 4163 #: lib/class-lb-save-and-then-messages.php:163 103 164 msgid "Post draft updated. <a target=\"_blank\" href=\"%s\">Preview post</a>" 104 165 msgstr "" 105 166 167 #: lib/class-lb-save-and-then-messages.php:167 168 msgid "Page updated. <a href=\"%s\">View page</a>" 169 msgstr "" 170 106 171 #: lib/class-lb-save-and-then-messages.php:168 107 msgid "Page updated. <a href=\"%s\">View page</a>"172 msgid "Page updated." 108 173 msgstr "" 109 174 110 175 #: lib/class-lb-save-and-then-messages.php:169 111 msgid "Page updated."176 msgid "Page published. <a href=\"%s\">View page</a>" 112 177 msgstr "" 113 178 114 179 #: 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:171119 180 msgid "Page submitted. <a target=\"_blank\" href=\"%s\">Preview page</a>" 120 181 msgstr "" 121 182 122 #: lib/class-lb-save-and-then-messages.php:17 3183 #: lib/class-lb-save-and-then-messages.php:172 123 184 msgid "" 124 185 "Page scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s" … … 126 187 msgstr "" 127 188 128 #: lib/class-lb-save-and-then-messages.php:17 6189 #: lib/class-lb-save-and-then-messages.php:175 129 190 msgid "Page draft updated. <a target=\"_blank\" href=\"%s\">Preview page</a>" 130 191 msgstr "" 131 192 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 141 194 msgid "Display button as default" 142 195 msgstr "Mettre le button par défaut" 143 196 144 #: lib/class-lb-save-and-then-settings.php:1 09197 #: lib/class-lb-save-and-then-settings.php:120 145 198 msgid "Actions to show" 146 199 msgstr "Actions à afficher" 147 200 148 #: lib/class-lb-save-and-then-settings.php:1 18201 #: lib/class-lb-save-and-then-settings.php:129 149 202 msgid "Default action" 150 203 msgstr "Action par défaut" 151 204 152 #: lib/class-lb-save-and-then-settings.php:1 32205 #: lib/class-lb-save-and-then-settings.php:143 153 206 msgid "%s Settings" 154 207 msgstr "Réglages de %s" … … 158 211 msgstr "" 159 212 160 #: lib/class-lb-save-and-then-settings.php:1 45213 #: lib/class-lb-save-and-then-settings.php:156 161 214 msgid "You do not have sufficient permissions to access this page." 162 215 msgstr "" 163 216 164 #: lib/class-lb-save-and-then-settings.php:1 49217 #: lib/class-lb-save-and-then-settings.php:160 165 218 msgid "<em>%s</em> Settings" 166 219 msgstr "Réglages de <em>%s</em>" 167 220 168 #: lib/class-lb-save-and-then-settings.php:1 53221 #: lib/class-lb-save-and-then-settings.php:164 169 222 msgid "Save Changes" 170 223 msgstr "" 171 224 172 #: lib/class-lb-save-and-then-settings.php:1 81225 #: lib/class-lb-save-and-then-settings.php:190 173 226 msgid "Display the new save button as the default one" 174 227 msgstr "Afficher le nouveau bouton en tant que bouton par défaut" 175 228 176 #: lib/class-lb-save-and-then-settings.php:2 08177 msgid " <em>Last used</em>"178 msgstr " <em>Dernière utilisée</em>"179 180 #: lib/class-lb-save-and-then-settings.php:2 09229 #: lib/class-lb-save-and-then-settings.php:227 230 msgid "Last used" 231 msgstr "Dernière utilisée" 232 233 #: lib/class-lb-save-and-then-settings.php:228 181 234 msgid "The last action that was used" 182 235 msgstr "La dernière action utilisée" 183 236 184 #: lib/class-lb-save-and-then-settings.php:2 40237 #: lib/class-lb-save-and-then-settings.php:265 185 238 msgid "Settings" 186 239 msgstr "" … … 188 241 #. Description of the plugin/theme 189 242 msgid "" 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." 247 msgstr "" 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." 196 253 197 254 #. Author of the plugin/theme -
improved-save-button/trunk/languages/lb-save-and-then.pot
r1150608 r1267552 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Improved Save Button 1. 0.1\n"5 "Project-Id-Version: Improved Save Button 1.1\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "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" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=utf-8\n" … … 26 26 "X-Textdomain-Support: yes\n" 27 27 28 #: improved-save-button.php:110 28 #: actions/class-lb-save-and-then-action-list.php:70 29 msgid "Save and List" 30 msgstr "" 31 32 #: actions/class-lb-save-and-then-action-list.php:84 33 msgid "Shows the <strong>posts list</strong> after save." 34 msgstr "" 35 36 #: actions/class-lb-save-and-then-action-list.php:91 37 msgid "%s and List" 38 msgstr "" 39 40 #: actions/class-lb-save-and-then-action-new.php:34 29 41 msgid "Save and New" 30 42 msgstr "" 31 43 32 #: improved-save-button.php:111 44 #: actions/class-lb-save-and-then-action-new.php:48 45 msgid "Shows the <strong>new post</strong> form after save." 46 msgstr "" 47 48 #: actions/class-lb-save-and-then-action-new.php:55 33 49 msgid "%s and New" 34 50 msgstr "" 35 51 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 53 53 msgid "Save and Next" 54 54 msgstr "" 55 55 56 #: improved-save-button.php:121 56 #: actions/class-lb-save-and-then-action-next.php:50 57 msgid "Shows the <strong>next post</strong> edit form after save." 58 msgstr "" 59 60 #: actions/class-lb-save-and-then-action-next.php:57 57 61 msgid "%s and Next" 58 62 msgstr "" 59 63 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 65 msgid "You are at the last post" 66 msgstr "" 67 68 #: actions/class-lb-save-and-then-action-next.php:86 69 msgid "Next post is \"%s\"" 70 msgstr "" 71 72 #: actions/class-lb-save-and-then-action-previous.php:36 65 73 msgid "Save and Previous" 66 74 msgstr "" 67 75 68 #: improved-save-button.php:126 76 #: actions/class-lb-save-and-then-action-previous.php:50 77 msgid "Shows the <strong>previous post</strong> edit form after save." 78 msgstr "" 79 80 #: actions/class-lb-save-and-then-action-previous.php:57 69 81 msgid "%s and Previous" 70 82 msgstr "" 71 83 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 85 msgid "You are at the first post" 86 msgstr "" 87 88 #: actions/class-lb-save-and-then-action-previous.php:86 89 msgid "Previous post is \"%s\"" 90 msgstr "" 91 92 #: actions/class-lb-save-and-then-action-view-popup.php:105 93 msgid "" 94 "Please wait while the post is being saved. This window will refresh " 95 "automatically." 96 msgstr "" 97 98 #: actions/class-lb-save-and-then-action-view-popup.php:121 99 msgid "Save and View %s (new window)" 100 msgstr "" 101 102 #: actions/class-lb-save-and-then-action-view-popup.php:135 103 msgid "Shows the <strong>post itself in a new window</strong> after save." 104 msgstr "" 105 106 #: actions/class-lb-save-and-then-action-view-popup.php:143 107 msgid "%%s and View %s" 108 msgstr "" 109 110 #: actions/class-lb-save-and-then-action-view-popup.php:154 111 msgid "Post will be shown in a new window" 112 msgstr "" 113 114 #: actions/class-lb-save-and-then-action-view.php:34 115 msgid "Save and View" 116 msgstr "" 117 118 #: actions/class-lb-save-and-then-action-view.php:48 119 msgid "Shows the <strong>post itself</strong> after save. The same window is used." 120 msgstr "" 121 122 #: actions/class-lb-save-and-then-action-view.php:55 123 msgid "%s and View" 124 msgstr "" 125 126 #: actions/class-lb-save-and-then-action-view.php:66 127 msgid "Post will be shown in this window" 128 msgstr "" 129 130 #: lib/class-lb-save-and-then-messages.php:155 131 msgid "Post updated. <a href=\"%s\">View post</a>" 74 132 msgstr "" 75 133 76 134 #: lib/class-lb-save-and-then-messages.php:156 77 msgid "Post updated. <a href=\"%s\">View post</a>"135 msgid "Post updated." 78 136 msgstr "" 79 137 80 138 #: lib/class-lb-save-and-then-messages.php:157 81 msgid "Post updated."139 msgid "Post published. <a href=\"%s\">View post</a>" 82 140 msgstr "" 83 141 84 142 #: 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:15989 143 msgid "Post submitted. <a target=\"_blank\" href=\"%s\">Preview post</a>" 90 144 msgstr "" 91 145 92 #: lib/class-lb-save-and-then-messages.php:16 1146 #: lib/class-lb-save-and-then-messages.php:160 93 147 msgid "" 94 148 "Post scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" " … … 96 150 msgstr "" 97 151 98 #: lib/class-lb-save-and-then-messages.php:16 299 #: lib/class-lb-save-and-then-messages.php:17 4152 #: lib/class-lb-save-and-then-messages.php:161 153 #: lib/class-lb-save-and-then-messages.php:173 100 154 msgid "M j, Y @ G:i" 101 155 msgstr "" 102 156 103 #: lib/class-lb-save-and-then-messages.php:16 4157 #: lib/class-lb-save-and-then-messages.php:163 104 158 msgid "Post draft updated. <a target=\"_blank\" href=\"%s\">Preview post</a>" 105 159 msgstr "" 106 160 161 #: lib/class-lb-save-and-then-messages.php:167 162 msgid "Page updated. <a href=\"%s\">View page</a>" 163 msgstr "" 164 107 165 #: lib/class-lb-save-and-then-messages.php:168 108 msgid "Page updated. <a href=\"%s\">View page</a>"166 msgid "Page updated." 109 167 msgstr "" 110 168 111 169 #: lib/class-lb-save-and-then-messages.php:169 112 msgid "Page updated."170 msgid "Page published. <a href=\"%s\">View page</a>" 113 171 msgstr "" 114 172 115 173 #: 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:171120 174 msgid "Page submitted. <a target=\"_blank\" href=\"%s\">Preview page</a>" 121 175 msgstr "" 122 176 123 #: lib/class-lb-save-and-then-messages.php:17 3177 #: lib/class-lb-save-and-then-messages.php:172 124 178 msgid "" 125 179 "Page scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" " … … 127 181 msgstr "" 128 182 129 #: lib/class-lb-save-and-then-messages.php:17 6183 #: lib/class-lb-save-and-then-messages.php:175 130 184 msgid "Page draft updated. <a target=\"_blank\" href=\"%s\">Preview page</a>" 131 185 msgstr "" 132 186 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 142 188 msgid "Display button as default" 143 189 msgstr "" 144 190 145 #: lib/class-lb-save-and-then-settings.php:1 09191 #: lib/class-lb-save-and-then-settings.php:120 146 192 msgid "Actions to show" 147 193 msgstr "" 148 194 149 #: lib/class-lb-save-and-then-settings.php:1 18195 #: lib/class-lb-save-and-then-settings.php:129 150 196 msgid "Default action" 151 197 msgstr "" 152 198 153 #: lib/class-lb-save-and-then-settings.php:1 32199 #: lib/class-lb-save-and-then-settings.php:143 154 200 msgid "%s Settings" 155 201 msgstr "" … … 159 205 msgstr "" 160 206 161 #: lib/class-lb-save-and-then-settings.php:1 45207 #: lib/class-lb-save-and-then-settings.php:156 162 208 msgid "You do not have sufficient permissions to access this page." 163 209 msgstr "" 164 210 165 #: lib/class-lb-save-and-then-settings.php:1 49211 #: lib/class-lb-save-and-then-settings.php:160 166 212 msgid "<em>%s</em> Settings" 167 213 msgstr "" 168 214 169 #: lib/class-lb-save-and-then-settings.php:1 53215 #: lib/class-lb-save-and-then-settings.php:164 170 216 msgid "Save Changes" 171 217 msgstr "" 172 218 173 #: lib/class-lb-save-and-then-settings.php:1 81219 #: lib/class-lb-save-and-then-settings.php:190 174 220 msgid "Display the new save button as the default one" 175 221 msgstr "" 176 222 177 #: lib/class-lb-save-and-then-settings.php:2 08178 msgid " <em>Last used</em>"179 msgstr "" 180 181 #: lib/class-lb-save-and-then-settings.php:2 09223 #: lib/class-lb-save-and-then-settings.php:227 224 msgid "Last used" 225 msgstr "" 226 227 #: lib/class-lb-save-and-then-settings.php:228 182 228 msgid "The last action that was used" 183 229 msgstr "" 184 230 185 #: lib/class-lb-save-and-then-settings.php:2 40231 #: lib/class-lb-save-and-then-settings.php:265 186 232 msgid "Settings" 187 233 msgstr "" … … 189 235 #. Description of the plugin/theme 190 236 msgid "" 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." 194 241 msgstr "" 195 242 -
improved-save-button/trunk/lib/class-lb-save-and-then-messages.php
r1150608 r1267552 53 53 static function removable_query_args( $removable_query_args ) { 54 54 $removable_query_args[] = self::HTTP_PARAM_UPDATED_POST_ID; 55 56 55 return $removable_query_args; 57 56 } … … 137 136 * ) 138 137 * 139 * @see Wordpress' edit-form-advanced.php: 63for usage138 * @see Wordpress' edit-form-advanced.php:79 for usage 140 139 * @param string $post_ID Id of the post that was modified 141 140 * @return array Messages per post type -
improved-save-button/trunk/lib/class-lb-save-and-then-post-edit.php
r1150608 r1267552 56 56 57 57 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; 58 58 59 // Adds post-edit.js 59 60 wp_enqueue_script( 60 61 'lb-save-and-then-post-edit', … … 79 80 } 80 81 82 // Adds post-edit.css 81 83 wp_enqueue_style( 82 84 'lb-save-and-then-post-edit', … … 85 87 '1.0' 86 88 ); 89 90 // Adds rtl for post-edit.css 87 91 if( function_exists('wp_style_add_data') ) { 88 92 wp_style_add_data( 'lb-save-and-then-post-edit', 'rtl', 'replace' ); … … 104 108 $options = LB_Save_And_Then_Settings::get_options(); 105 109 $enabled_actions = LB_Save_And_Then_Settings::get_enabled_actions(); 110 $current_post = get_post(); 106 111 107 // If the user didn't selectany action, we quit here112 // If the user didn't enable any action, we quit here 108 113 if( ! count( $enabled_actions ) ) 109 114 return; … … 123 128 // We add to $js_object all the actions and some data 124 129 // 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 below130 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 ), 130 135 ); 131 136 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; 149 140 } 150 141 151 $js_object['actions'][] = $ action_info;142 $js_object['actions'][] = $new_js_action; 152 143 } 153 144 … … 156 147 echo 'window.LabelBlanc = window.LabelBlanc || {};'; 157 148 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 . '";'; 159 150 echo 'window.LabelBlanc.SaveAndThen.HTTP_PARAM_ACTION = "' . self::HTTP_PARAM_ACTION . '";'; 160 151 echo 'window.LabelBlanc.SaveAndThen.config = ' . json_encode( $js_object ); 161 152 echo '</script>'; 162 163 // Output of the referer in a hidden field164 echo '<input type="hidden" name="' . LB_Save_And_Then_Redirect::HTTP_PARAM_REFERER . '" value="' . wp_get_referer() . '" />';165 153 } 166 154 } // end class -
improved-save-button/trunk/lib/class-lb-save-and-then-settings.php
r1220393 r1267552 37 37 const MAIN_SETTING_NAME = 'lb-save-and-then-options'; 38 38 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; 39 49 40 50 /** … … 42 52 */ 43 53 static function setup() { 54 add_action( 'plugins_loaded', array( get_called_class(), 'check_settings_version' ) ); 44 55 add_action( 'admin_init', array( get_called_class(), 'setup_settings' ) ); 45 56 add_action( 'admin_init', array( get_called_class(), 'setup_settings_fields' ) ); … … 79 90 self::OPTION_GROUP, 80 91 self::MAIN_SETTING_NAME, 81 array( get_called_class(), 'validate_setting ' )92 array( get_called_class(), 'validate_settings' ) 82 93 ); 83 94 } … … 164 175 */ 165 176 static function create_setting_field( $args ) { 177 // The values of all the settings 166 178 $options = self::get_options(); 167 $actions = LB_Save_And_Then ::get_actions();179 $actions = LB_Save_And_Then_Actions::get_actions(); 168 180 $option_field_name = self::MAIN_SETTING_NAME . '[' . $args['option_name'] . ']'; 181 // The setting value for this field 169 182 $option_value = $options[ $args['option_name'] ]; 170 183 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 175 184 $html = ''; 176 185 177 switch ( $args['option_name'] ) {186 switch ( $args['option_name'] ) { 178 187 179 188 case 'set-as-default': … … 185 194 $html .= '<fieldset>'; 186 195 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>'; 193 204 } 194 205 195 if( $last_action_key != $action_key ) { 206 $html .= '</label>'; 207 208 if( $action_index != count( $actions ) - 1 ) { 196 209 $html .= '<br />'; 197 210 } … … 204 217 $html .= '<fieldset>'; 205 218 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 217 232 $html .= '<br />'; 233 234 $action = $actions[ $action_index ]; 235 $action_id = $action->get_id(); 236 $action_name = $action->get_name(); 237 $action_description = ''; 218 238 } 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_d ata['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>'; 226 246 } 227 } 247 248 $html .= '</label>'; 249 250 $action_index++; 251 252 } while( $action_index < count( $actions ) ); 228 253 229 254 $html .= '</fieldset>'; … … 245 270 /** 246 271 * 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()). 249 276 * 250 277 * @param array $input Parameters received in the request 251 278 * @return array Cleaned settings array 252 279 */ 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(); 263 282 264 283 if( ! $input ) 265 284 $input = array(); 266 285 286 $sanitized_input = self::sanitize_options( $input ); 287 267 288 // 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'] ); 279 411 } 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; 338 424 } 339 425 … … 342 428 * settings page. The keys are the action id and the values are the 343 429 * action data array as returned by LB_Save_And_Then::get_actions(). 344 * 430 * 345 431 * @return array The enabled types 346 432 */ 347 433 static function get_enabled_actions() { 348 434 $options = self::get_options(); 349 $all_actions = LB_Save_And_Then::get_actions();350 351 435 $active_actions = array(); 352 436 353 437 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; 357 442 } 358 443 } … … 361 446 return $active_actions; 362 447 } 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 363 536 } // end class 364 537 -
improved-save-button/trunk/lib/class-lb-save-and-then-utils.php
r1094802 r1267552 31 31 32 32 /** 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 /** 33 42 * Returns the full URL to a file in this plugins folder. 34 43 * … … 41 50 */ 42 51 static function plugins_url( $file ) { 43 44 52 return plugins_url( $file, dirname( __FILE__ ) ); 45 53 } … … 78 86 */ 79 87 static function get_adjacent_post( $post, $dir = 'next' ) { 88 global $wpdb; 89 $cache_id = $post->ID . '-' . $dir; 80 90 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 = ''; 82 96 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 ) ); 87 100 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 ); 91 115 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 } 109 121 } 110 122 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 ); 112 168 } 113 169 } // end class -
improved-save-button/trunk/readme.txt
r1220393 r1267552 1 1 === Improved Save Button === 2 2 Contributors: 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, post3 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, save and view, previous post, admin, administration, editor, multisite, custom post type, page, post 4 4 Requires at least: 3.5 5 5 Tested up to: 4.3 6 Stable tag: 1. 0.26 Stable tag: 1.1 7 7 License: GPLv3 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html 9 9 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.10 Adds 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. 11 11 12 12 == Description == 13 13 14 Save a lot of time with this plugin if you have multiple posts, pages or custom posts to create or modify! 14 This 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: 15 15 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). 17 20 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. 21 This plugin saves you a lot of time when you have multiple posts, pages or custom posts to create or modify! 24 22 25 23 Works with pages, posts and custom post types! 26 24 27 25 Through the plugin's settings page, choose which actions are available and which one to use as the buttons' default action. 26 27 Detail 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. 28 34 29 35 == Installation == … … 44 50 == Changelog == 45 51 52 = 1.1 = 53 Release 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 46 60 = 1.0.2 = 47 61 Release Date: August 13, 2015 -
improved-save-button/trunk/scss/post-edit.scss
r1150608 r1267552 1 1 /** 2 * Copyright 201 4Label Blanc (http://www.labelblanc.ca/)2 * Copyright 2015 Label Blanc (http://www.labelblanc.ca/) 3 3 * 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" 5 5 * Wordpress plugin. 6 6 * 7 * The " Save then create new, show list, or more..." Wordpress plugin7 * The "Improved Save Button" Wordpress plugin 8 8 * is free software: you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by … … 90 90 padding-right: 8px; 91 91 } 92 } 93 94 // Icon alignment 95 .dashicons { 96 vertical-align: text-bottom; 92 97 } 93 98 }
Note: See TracChangeset
for help on using the changeset viewer.