Changeset 6761
- Timestamp:
- 02/08/2008 07:57:50 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r6739 r6761 514 514 break; 515 515 case 'closed-postboxes' : 516 check_ajax_referer( $action ); 517 $closed = explode(',', $_POST['closed']); 516 check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' ); 517 $closed = isset( $_POST['closed'] )? $_POST['closed'] : ''; 518 $closed = explode( ',', $_POST['closed'] ); 519 $page = isset( $_POST['page'] )? $_POST['page'] : ''; 520 if ( !preg_match( '/^[a-z-]+$/', $page ) ) { 521 die(-1); 522 } 518 523 if (!is_array($closed)) break; 519 524 $current_user = wp_get_current_user(); 520 update_usermeta($current_user->ID, 'closedpostboxes ', $closed);525 update_usermeta($current_user->ID, 'closedpostboxes_'.$page, $closed); 521 526 break; 522 527 case 'sample-permalink': -
trunk/wp-admin/edit-form-advanced.php
r6758 r6761 90 90 <?php the_editor($post->post_content); ?> 91 91 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> 92 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 92 93 </div> 93 94 … … 176 177 ?>" /></p> 177 178 178 <div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv' ); ?>">179 <div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>"> 179 180 <h3><?php _e('Tags'); ?></h3> 180 181 <div class="inside"> … … 184 185 </div> 185 186 186 <div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv' ); ?>">187 <div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>"> 187 188 <h3><?php _e('Categories') ?></h3> 188 189 <div class="inside"> … … 235 236 <h2><?php _e('Advanced Options'); ?></h2> 236 237 237 <div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt' ); ?>">238 <div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt', 'post'); ?>"> 238 239 <h3><?php _e('Optional Excerpt') ?></h3> 239 240 <div class="inside"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div> 240 241 </div> 241 242 242 <div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv' ); ?>">243 <div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv', 'post'); ?>"> 243 244 <h3><?php _e('Trackbacks') ?></h3> 244 245 <div class="inside"> … … 251 252 </div> 252 253 253 <div id="postcustom" class="postbox <?php echo postbox_classes('postcustom' ); ?>">254 <div id="postcustom" class="postbox <?php echo postbox_classes('postcustom', 'post'); ?>"> 254 255 <h3><?php _e('Custom Fields') ?></h3> 255 256 <div class="inside"> … … 272 273 <?php do_action('dbx_post_advanced'); ?> 273 274 274 <div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv' ); ?>">275 <div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv', 'post'); ?>"> 275 276 <h3><?php _e('Discussion') ?></h3> 276 277 <div class="inside"> … … 283 284 </div> 284 285 285 <div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv' ); ?>">286 <div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv', 'post'); ?>"> 286 287 <h3><?php _e('Post Password') ?></h3> 287 288 <div class="inside"> … … 290 291 </div> 291 292 292 <div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv' ); ?>">293 <div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv', 'post'); ?>"> 293 294 <h3><?php _e('Post Slug') ?></h3> 294 295 <div class="inside"> … … 298 299 299 300 <?php if ( current_user_can('edit_posts') ) : ?> 300 <div id="posttimestampdiv" class="postbox <?php echo postbox_classes('posttimestampdiv' ); ?>">301 <div id="posttimestampdiv" class="postbox <?php echo postbox_classes('posttimestampdiv', 'post'); ?>"> 301 302 <h3><?php _e('Post Timestamp'); ?></h3> 302 303 <div class="inside"><?php touch_time(($action == 'edit')); ?></div> … … 310 311 if ( $authors && count( $authors ) > 1 ) : 311 312 ?> 312 <div id="authordiv" class="postbox <?php echo postbox_classes('authordiv' ); ?>">313 <div id="authordiv" class="postbox <?php echo postbox_classes('authordiv', 'post'); ?>"> 313 314 <h3><?php _e('Post Author'); ?></h3> 314 315 <div class="inside"> -
trunk/wp-admin/edit-link-form.php
r6713 r6761 33 33 <?php echo $form ?> 34 34 <?php wp_nonce_field($nonce_action); ?> 35 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 35 36 36 37 <div class="wrap"> … … 65 66 </div> 66 67 67 <div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv' ); ?>">68 <div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv', 'link'); ?>"> 68 69 <h3><?php _e('Categories') ?></h3> 69 70 <div class="inside"> … … 101 102 <h2><?php _e('Advanced Options'); ?></h2> 102 103 103 <div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv' ); ?>">104 <div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv', 'link'); ?>"> 104 105 <h3><?php _e('Target') ?></h3> 105 106 <div class="inside"> … … 116 117 </div> 117 118 118 <div id="linkvisiblediv" class="postbox <?php echo postbox_classes('linkvisiblediv' ); ?>">119 <div id="linkvisiblediv" class="postbox <?php echo postbox_classes('linkvisiblediv', 'link'); ?>"> 119 120 <h3><?php _e('Visible') ?></h3> 120 121 <div class="inside"> … … 128 129 </div> 129 130 130 <div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv' ); ?>">131 <div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv', 'link'); ?>"> 131 132 <h3><?php _e('Link Relationship (XFN)') ?></h3> 132 133 <div class="inside"> … … 241 242 </div> 242 243 243 <div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv' ); ?>">244 <div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>"> 244 245 <h3><?php _e('Advanced') ?></h3> 245 246 <div class="inside"> -
trunk/wp-admin/edit-page-form.php
r6739 r6761 58 58 <?php the_editor($post->post_content); ?> 59 59 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> 60 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 60 61 </div> 61 62 … … 137 138 <h2><?php _e('Advanced Options'); ?></h2> 138 139 139 <div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom' ); ?>">140 <div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>"> 140 141 <h3><?php _e('Custom Fields') ?></h3> 141 142 <div class="inside"> … … 156 157 </div> 157 158 158 <div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv' ); ?>">159 <div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>"> 159 160 <h3><?php _e('Discussion') ?></h3> 160 161 <div class="inside"> … … 167 168 </div> 168 169 169 <div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv' ); ?>">170 <div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv', 'page'); ?>"> 170 171 <h3><?php _e('Page Password') ?></h3> 171 172 <div class="inside"> … … 174 175 </div> 175 176 176 <div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv' ); ?>">177 <div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv', 'page'); ?>"> 177 178 <h3><?php _e('Page Slug') ?></h3> 178 179 <div class="inside"> … … 181 182 </div> 182 183 183 <div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv' ); ?>">184 <div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>"> 184 185 <h3><?php _e('Page Parent') ?></h3> 185 186 <div class="inside"> … … 192 193 193 194 <?php if ( 0 != count( get_page_templates() ) ) { ?> 194 <div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv' ); ?>">195 <div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv', 'page'); ?>"> 195 196 <h3><?php _e('Page Template') ?></h3> 196 197 <div class="inside"> … … 203 204 <?php } ?> 204 205 205 <div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv' ); ?>">206 <div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>"> 206 207 <h3><?php _e('Page Order') ?></h3> 207 208 <div class="inside"> … … 216 217 if ( $authors && count( $authors ) > 1 ) : 217 218 ?> 218 <div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv' ); ?>">219 <div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>"> 219 220 <h3><?php _e('Post Author'); ?></h3> 220 221 <div class="inside"> -
trunk/wp-admin/includes/post.php
r6733 r6761 518 518 } 519 519 520 function postbox_classes( $id ) {520 function postbox_classes( $id, $page ) { 521 521 $current_user = wp_get_current_user(); 522 if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes ') ) {522 if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) { 523 523 if ( !is_array( $closed ) ) return ''; 524 524 return in_array( $id, $closed )? 'closed' : ''; -
trunk/wp-admin/js/link.js
r6713 r6761 1 1 addLoadEvent( function() { 2 2 // postboxes 3 add_postbox_toggles( );3 add_postbox_toggles('link'); 4 4 5 5 // category tabs -
trunk/wp-admin/js/post.js
r6694 r6761 53 53 } 54 54 55 function edit_permalink(post_id) {56 var i, c = 0;57 var e = jQuery('#editable-post-name');58 var revert_e = e.html();59 var real_slug = jQuery('#post_name');60 var b = jQuery('#edit-slug-buttons');61 var revert_b = b.html();62 var old_slug = e.children('span').html();63 64 b.html('<a href="" class="save">'+postL10n.save+'</a> <a class="cancel" href="">'+postL10n.cancel+'</a>');65 b.children('.save').click(function() {66 var new_slug = e.children('input').attr('value');67 jQuery.post(postL10n.requestFile, {68 action: 'sample-permalink',69 post_id: post_id,70 new_slug: new_slug,71 cookie: document.cookie}, function(data) {72 jQuery('#sample-permalink').html(data);73 b.html(revert_b);74 real_slug.attr('value', new_slug);75 make_slugedit_clickable();76 });77 return false;78 });79 jQuery('#edit-slug-buttons .cancel').click(function() {80 e.html(revert_e);81 b.html(revert_b);82 real_slug.attr('value', revert_e);83 return false;84 });85 for(i=0; i < revert_e.length; ++i) {86 if ('%' == revert_e.charAt(i)) c++;87 }88 slug_value = (c > revert_e.length/4)? '' : revert_e;89 e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){90 var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;91 // on enter, just save the new slug, don't save the post92 if (13 == key) {b.children('.save').click();return false;}93 if (27 == key) {b.children('.cancel').click();return false;}94 real_slug.attr('value', this.value)}).focus();95 }96 97 function make_slugedit_clickable() {98 jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});99 }100 101 55 addLoadEvent( function() { 102 56 // postboxes 103 add_postbox_toggles( );57 add_postbox_toggles('post'); 104 58 105 59 // If no tags on the page, skip the tag and category stuff. -
trunk/wp-admin/js/postbox.js
r6713 r6761 1 function add_postbox_toggles( ) {1 function add_postbox_toggles(page) { 2 2 jQuery('.postbox h3').prepend('<a class="togbox">+</a> '); 3 jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); save_postboxes_state( ); } );3 jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } ); 4 4 } 5 5 6 function save_postboxes_state( ) {6 function save_postboxes_state(page) { 7 7 var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','); 8 8 jQuery.post(postboxL10n.requestFile, { 9 9 action: 'closed-postboxes', 10 10 closed: closed, 11 cookie: document.cookie}); 11 closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), 12 page: page 13 }); 12 14 } -
trunk/wp-admin/page-new.php
r6712 r6761 5 5 $editing = true; 6 6 wp_enqueue_script('autosave'); 7 wp_enqueue_script('p ost');7 wp_enqueue_script('page'); 8 8 wp_enqueue_script('thickbox'); 9 9 wp_enqueue_script('media-upload'); -
trunk/wp-admin/page.php
r6665 r6761 53 53 } 54 54 55 wp_enqueue_script('p ost');55 wp_enqueue_script('page'); 56 56 wp_enqueue_script('thickbox'); 57 57 wp_enqueue_script('media-upload'); -
trunk/wp-includes/script-loader.php
r6757 r6761 136 136 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 137 137 ) ); 138 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox'), '20080128' ); 138 $this->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20080208' ); 139 $this->localize( 'slug', 'slugL10n', array( 140 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 141 'save' => __('Save'), 142 'cancel' => __('Cancel'), 143 ) ); 144 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080128' ); 139 145 $this->localize( 'post', 'postL10n', array( 140 146 'tagsUsed' => __('Tags used on this post:'), … … 142 148 'addTag' => attribute_escape(__('Add new tag')), 143 149 'separate' => __('Separate tags with commas'), 144 'save' => __('Save'), 145 'cancel' => __('Cancel'), 146 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 147 ) ); 150 ) ); 151 $this->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080208' ); 148 152 $this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' ); 149 153 $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
Note: See TracChangeset
for help on using the changeset viewer.