Make WordPress Core

Ticket #16379: 16379.revert.patch

File 16379.revert.patch, 28.8 KB (added by SergeyBiryukov, 12 years ago)
  • wp-admin/css/wp-admin-rtl.css

     
    971971        border-bottom-right-radius: 3px;
    972972}
    973973
    974 #front-static-pages .sub-option,
     974#front-page-warning,
     975#front-static-pages ul,
    975976ul.export-filters,
    976977.inline-editor ul.cat-checklist ul,
    977978.categorydiv ul.categorychecklist ul,
  • wp-admin/css/wp-admin.css

     
    30223022        font-size: 11px;
    30233023}
    30243024
    3025 #front-static-pages #edit-slug-box {
    3026         padding: 0;
    3027 }
    3028 
    30293025#editable-post-name-full {
    30303026        display: none;
    30313027}
     
    35123508        margin: 0;
    35133509}
    35143510
    3515 #front-static-pages .sub-option,
     3511#front-page-warning,
     3512#front-static-pages ul,
    35163513ul.export-filters,
    35173514.inline-editor ul.cat-checklist ul,
    35183515.categorydiv ul.categorychecklist ul,
     
    50725069        margin: -3px 3px;
    50735070}
    50745071
    5075 .js.options-reading-php .if-page-on-front,
    5076 .js.options-reading-php .if-page-for-posts,
    5077 .options-reading-php .if-new-front-page {
    5078         display: none;
    5079 }
    5080 .options-reading-php .page-on-front .if-page-on-front,
    5081 .options-reading-php .page-for-posts .if-page-for-posts {
    5082         display: block;
    5083 }
    5084 .options-reading-php .new-front-page .if-new-front-page {
    5085         display: inline;
    5086 }
    5087 
    50885072/*------------------------------------------------------------------------------
    50895073  21.0 - Admin Footer
    50905074------------------------------------------------------------------------------*/
  • wp-admin/includes/ajax-actions.php

     
    12981298        $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
    12991299        $title = isset($_POST['new_title'])? $_POST['new_title'] : '';
    13001300        $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null;
    1301         $screen = isset( $_POST['screen'] ) ? $_POST['screen'] : 'post';
    1302         wp_die( get_sample_permalink_html( $post_id, $title, $slug, $screen ) );
     1301        wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
    13031302}
    13041303
    13051304function wp_ajax_inline_save() {
  • wp-admin/includes/post.php

     
    10481048}
    10491049
    10501050/**
    1051  * Returns the HTML of the sample permalink slug editor.
     1051 * sample permalink html
    10521052 *
     1053 * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
     1054 *
    10531055 * @since 2.5.0
    10541056 *
    10551057 * @param int|object $id Post ID or post object.
    1056  * @param string $new_title Optional. New title.
    1057  * @param string $new_slug Optional. New slug.
    1058  * @param string|WP_Screen $screen Optional. Screen where the editor is being shown.
    1059  * @return string The HTML of the sample permalink slug editor.
     1058 * @param string $new_title (optional) New title
     1059 * @param string $new_slug (optional) New slug
     1060 * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
    10601061 */
    1061 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null, $screen = null ) {
     1062function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
    10621063        global $wpdb;
    10631064        $post = get_post($id);
    10641065
    10651066        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    10661067
    1067         if ( isset( $screen ) )
    1068                 $screen = convert_to_screen( $screen );
    1069         else
    1070                 $screen = get_current_screen();
    1071 
    10721068        if ( 'publish' == get_post_status( $post ) ) {
    10731069                $ptype = get_post_type_object($post->post_type);
    10741070                $view_post = $ptype->labels->view_item;
     
    10781074        }
    10791075
    10801076        if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
    1081                 if ( 'options-reading' == $screen->id )
    1082                         return '';
    10831077                $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
    10841078                if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) )
    10851079                        $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
     
    11081102        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    11091103        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
    11101104        $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
    1111         $return  = ( 'options-reading' == $screen->id ) ? __( 'Located at' ) . "\n" : '<strong>' . __( 'Permalink:' ) . "</strong>\n";
     1105        $return =  '<strong>' . __('Permalink:') . "</strong>\n";
    11121106        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    11131107        $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
    11141108        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
    11151109        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    1116         if ( isset( $view_post ) && 'options-reading' != $screen->id )
     1110        if ( isset($view_post) )
    11171111                $return .= "<span id='view-post-btn'><a href='$view_link' class='button button-small'>$view_post</a></span>\n";
    11181112
    11191113        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
     
    13291323
    13301324        return $url;
    13311325}
    1332 
    1333 /**
    1334  * Creates new pages to be set as a front page or a page for posts in Reading Settings.
    1335  *
    1336  * @todo Make sure we are doing adequate sanitization on success, and cleanup/reset on failure.
    1337  *
    1338  * @since 3.5.0
    1339  * @access private
    1340  */
    1341 function _show_on_front_reading_settings( $show_on_front_value ) {
    1342         // If we're not saving the Reading Settings screen, don't intercept.
    1343         if ( ! $_POST || ! strpos( wp_get_referer(), 'options-reading.php' ) )
    1344                 return $show_on_front_value;
    1345 
    1346         if ( 'posts' == $show_on_front_value ) {
    1347                 update_option( 'page_on_front', 0 );
    1348                 update_option( 'page_for_posts', 0 );
    1349                 return $show_on_front_value;
    1350         }
    1351 
    1352         // If a new front page was meant to be created, go forth and create it.
    1353         if ( 'new' == $_POST['page_on_front'] ) {
    1354 
    1355                 // If the user can't create pages, revert.
    1356                 if ( ! current_user_can( 'create_posts', 'page' ) ) {
    1357                         // If an existing page is set, keep things as is, rather than reverting to showing posts.
    1358                         if ( get_option( 'page_on_front' ) ) {
    1359                                 $show_on_front_value = 'page';
    1360                         } else {
    1361                                 $show_on_front_value = 'posts';
    1362                                 update_option( 'page_on_front', 0 );
    1363                                 update_option( 'page_for_posts', 0 );
    1364                         }
    1365                         add_settings_error( 'page_on_front', 'create_pages', __( 'You are not allowed to create pages on this site.' ) );
    1366                         return $show_on_front_value;
    1367                 }
    1368 
    1369                 $existing_page = get_page_by_title( stripslashes( $_POST['page_on_front_title'] ) );
    1370 
    1371                 // If page already exists and it's public, there's no need to create a new page.
    1372                 if ( $existing_page && 'publish' == $existing_page->post_status ) {
    1373                         $page_id = $existing_page->ID;
    1374                 } else {
    1375                         $page_id = wp_insert_post( array(
    1376                                 'post_title' => $_POST['page_on_front_title'],
    1377                                 'post_type' => 'page',
    1378                                 'post_status' => 'publish',
    1379                                 'comment_status' => 'closed',
    1380                                 'ping_status' => 'closed',
    1381                                 // @todo Create some sort of a 'context' in postmeta so we know we created a page through these means.
    1382                                 //       Consider then showing that context in the list table as a good-first-step.
    1383                         ) );
    1384                 }
    1385 
    1386                 if ( $page_id ) {
    1387                         update_option( 'page_on_front', $page_id );
    1388                 // If we can't save it, revert.
    1389                 } elseif ( get_option( 'page_on_front' ) ) {
    1390                         // If an existing page is set, keep things as is, rather than reverting to showing posts.
    1391                         $show_on_front_value = 'page';
    1392                 } else {
    1393                         $show_on_front_value = 'posts';
    1394                         update_option( 'page_on_front', 0 );
    1395                         update_option( 'page_for_posts', 0 );
    1396                         return $show_on_front_value;
    1397                 }
    1398         } elseif ( $_POST['page_on_front'] ) {
    1399                 update_option( 'page_on_front', $_POST['page_on_front'] );
    1400         } else {
    1401                 // They didn't select a page at all. Sad face.
    1402                 $show_on_front_value = 'posts';
    1403                 update_option( 'page_on_front', 0 );
    1404                 update_option( 'page_for_posts', 0 );
    1405                 add_settings_error( 'page_on_front', 'no_page_selected', __( 'You must select a page to set a static front page.' ) );
    1406                 return $show_on_front_value;
    1407         }
    1408 
    1409         // If a page for posts was meant to be specified, update/create it.
    1410         if ( ! isset( $_POST['page_for_posts'] ) ) {
    1411                 update_option( 'page_for_posts', 0 );
    1412                 return $show_on_front_value;
    1413         }
    1414 
    1415         $page_for_posts = (int) $_POST['page_for_posts'];
    1416 
    1417         if ( ! $page_for_posts || ! $page = get_post( $page_for_posts, ARRAY_A ) ) {
    1418                 update_option( 'page_for_posts', 0 );
    1419                 return $show_on_front_value;
    1420         }
    1421 
    1422         if ( 'page' != $page['post_type'] || ! current_user_can( 'edit_post', $page_for_posts ) ) {
    1423                 update_option( 'page_for_posts', 0 );
    1424                 return $show_on_front_value;
    1425         }
    1426 
    1427         if ( 'publish' != $page['post_status'] && ! current_user_can( 'publish_post', $page_for_posts ) ) {
    1428                 update_option( 'page_for_posts', 0 );
    1429                 return $show_on_front_value;
    1430         }
    1431 
    1432         $args = add_magic_quotes( $page );
    1433         $args['post_title']  = $_POST['page_for_posts_title'];
    1434         $args['post_name']   = $_POST['post_name'];
    1435         $args['post_status'] = 'publish';
    1436         if ( 'auto-draft' == $page['post_status'] ) {
    1437                 $args['comment_status'] = 'closed';
    1438                 $args['ping_status'] = 'closed';
    1439         }
    1440 
    1441         $page_id = wp_insert_post( $args );
    1442         update_option( 'page_for_posts', $page_id );
    1443 
    1444         return $show_on_front_value;
    1445 }
    1446 add_filter( 'sanitize_option_show_on_front', '_show_on_front_reading_settings' );
  • wp-admin/js/post.js

     
    572572                });
    573573        } // end submitdiv
    574574
     575        // permalink
     576        if ( $('#edit-slug-box').length ) {
     577                editPermalink = function(post_id) {
     578                        var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.val(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html();
     579
     580                        $('#view-post-btn').hide();
     581                        b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
     582                        b.children('.save').click(function() {
     583                                var new_slug = e.children('input').val();
     584                                if ( new_slug == $('#editable-post-name-full').text() ) {
     585                                        return $('.cancel', '#edit-slug-buttons').click();
     586                                }
     587                                $.post(ajaxurl, {
     588                                        action: 'sample-permalink',
     589                                        post_id: post_id,
     590                                        new_slug: new_slug,
     591                                        new_title: $('#title').val(),
     592                                        samplepermalinknonce: $('#samplepermalinknonce').val()
     593                                }, function(data) {
     594                                        $('#edit-slug-box').html(data);
     595                                        b.html(revert_b);
     596                                        real_slug.val(new_slug);
     597                                        makeSlugeditClickable();
     598                                        $('#view-post-btn').show();
     599                                });
     600                                return false;
     601                        });
     602
     603                        $('.cancel', '#edit-slug-buttons').click(function() {
     604                                $('#view-post-btn').show();
     605                                e.html(revert_e);
     606                                b.html(revert_b);
     607                                real_slug.val(revert_slug);
     608                                return false;
     609                        });
     610
     611                        for ( i = 0; i < full.length; ++i ) {
     612                                if ( '%' == full.charAt(i) )
     613                                        c++;
     614                        }
     615
     616                        slug_value = ( c > full.length / 4 ) ? '' : full;
     617                        e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
     618                                var key = e.keyCode || 0;
     619                                // on enter, just save the new slug, don't save the post
     620                                if ( 13 == key ) {
     621                                        b.children('.save').click();
     622                                        return false;
     623                                }
     624                                if ( 27 == key ) {
     625                                        b.children('.cancel').click();
     626                                        return false;
     627                                }
     628                                real_slug.val(this.value);
     629                        }).focus();
     630                }
     631
     632                makeSlugeditClickable = function() {
     633                        $('#editable-post-name').click(function() {
     634                                $('#edit-slug-buttons').children('.edit-slug').click();
     635                        });
     636                }
     637                makeSlugeditClickable();
     638        }
     639
    575640        // word count
    576641        if ( typeof(wpWordCount) != 'undefined' ) {
    577642                $(document).triggerHandler('wpcountwords', [ co.val() ]);
  • wp-admin/js/sample-permalink.js

     
    1 var editPermalink, makeSlugeditClickable;
    2 
    3 (function($){
    4         if ( ! $('#edit-slug-box').length )
    5                 return;
    6         editPermalink = function(post_id) {
    7                 var i, c = 0,
    8                         e = $('#editable-post-name'),
    9                         revert_e = e.html(),
    10                         real_slug = $('#post_name'),
    11                         revert_slug = real_slug.val(),
    12                         b = $('#edit-slug-buttons'),
    13                         revert_b = b.html(),
    14                         full = $('#editable-post-name-full').html();
    15 
    16                 $('#view-post-btn').hide();
    17                 b.html('<a href="#" class="save button button-small">'+samplePermalinkL10n.ok+'</a> <a class="cancel" href="#">'+samplePermalinkL10n.cancel+'</a>');
    18                 b.children('.save').click(function() {
    19                         var new_slug = e.children('input').val();
    20                         if ( new_slug == $('#editable-post-name-full').text() ) {
    21                                 return $('.cancel', '#edit-slug-buttons').click();
    22                         }
    23                         $.post(ajaxurl, {
    24                                 action: 'sample-permalink',
    25                                 post_id: post_id,
    26                                 new_slug: new_slug,
    27                                 new_title: $('#title').val(),
    28                                 screen: pagenow,
    29                                 samplepermalinknonce: $('#samplepermalinknonce').val()
    30                         }, function(data) {
    31                                 $('#edit-slug-box').html(data);
    32                                 b.html(revert_b);
    33                                 real_slug.val(new_slug);
    34                                 makeSlugeditClickable();
    35                                 $('#view-post-btn').show();
    36                         });
    37                         return false;
    38                 });
    39 
    40                 $('.cancel', '#edit-slug-buttons').click(function() {
    41                         $('#view-post-btn').show();
    42                         e.html(revert_e);
    43                         b.html(revert_b);
    44                         real_slug.val(revert_slug);
    45                         return false;
    46                 });
    47 
    48                 for ( i = 0; i < full.length; ++i ) {
    49                         if ( '%' == full.charAt(i) )
    50                                 c++;
    51                 }
    52 
    53                 slug_value = ( c > full.length / 4 ) ? '' : full;
    54                 e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
    55                         var key = e.keyCode || 0;
    56                         // on enter, just save the new slug, don't save the post
    57                         if ( 13 == key ) {
    58                                 b.children('.save').click();
    59                                 return false;
    60                         }
    61                         if ( 27 == key ) {
    62                                 b.children('.cancel').click();
    63                                 return false;
    64                         }
    65                         real_slug.val(this.value);
    66                 }).focus();
    67         }
    68 
    69         makeSlugeditClickable = function() {
    70                 $('#editable-post-name').click(function() {
    71                         $('#edit-slug-buttons').children('.edit-slug').click();
    72                 });
    73         }
    74         makeSlugeditClickable();
    75 })(jQuery);
    76  No newline at end of file
  • wp-admin/js/sample-permalink.min.js

     
    1 var editPermalink,makeSlugeditClickable;(function(a){if(!a("#edit-slug-box").length){return}editPermalink=function(d){var f,j=0,h=a("#editable-post-name"),k=h.html(),n=a("#post_name"),o=n.val(),l=a("#edit-slug-buttons"),m=l.html(),g=a("#editable-post-name-full").html();a("#view-post-btn").hide();l.html('<a href="#" class="save button button-small">'+samplePermalinkL10n.ok+'</a> <a class="cancel" href="#">'+samplePermalinkL10n.cancel+"</a>");l.children(".save").click(function(){var b=h.children("input").val();if(b==a("#editable-post-name-full").text()){return a(".cancel","#edit-slug-buttons").click()}a.post(ajaxurl,{action:"sample-permalink",post_id:d,new_slug:b,new_title:a("#title").val(),screen:pagenow,samplepermalinknonce:a("#samplepermalinknonce").val()},function(c){a("#edit-slug-box").html(c);l.html(m);n.val(b);makeSlugeditClickable();a("#view-post-btn").show()});return false});a(".cancel","#edit-slug-buttons").click(function(){a("#view-post-btn").show();h.html(k);l.html(m);n.val(o);return false});for(f=0;f<g.length;++f){if("%"==g.charAt(f)){j++}}slug_value=(j>g.length/4)?"":g;h.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(c){var b=c.keyCode||0;if(13==b){l.children(".save").click();return false}if(27==b){l.children(".cancel").click();return false}n.val(this.value)}).focus()};makeSlugeditClickable=function(){a("#editable-post-name").click(function(){a("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()})(jQuery);
    2  No newline at end of file
  • wp-admin/options-reading.php

     
    1515$title = __( 'Reading Settings' );
    1616$parent_file = 'options-general.php';
    1717
    18 wp_enqueue_script( 'sample-permalink' );
    19 
    2018/**
    2119 * Display JavaScript on the page.
    2220 *
     
    2422 */
    2523function options_reading_add_js() {
    2624?>
    27 <script>
    28 jQuery(document).ready( function($) {
    29         var section = $('#front-static-pages');
    30         $('#show_on_front').change( function() {
    31                 var checked = $(this).prop('checked');
    32                 section.toggleClass('page-on-front', checked);
    33                 if ( checked )
    34                         $('#page_for_posts').prop('checked', true).change();
    35                 else
    36                         section.removeClass('page-for-posts');
     25<script type="text/javascript">
     26//<![CDATA[
     27        jQuery(document).ready(function($){
     28                var section = $('#front-static-pages'),
     29                        staticPage = section.find('input:radio[value="page"]'),
     30                        selects = section.find('select'),
     31                        check_disabled = function(){
     32                                selects.prop( 'disabled', ! staticPage.prop('checked') );
     33                        };
     34                check_disabled();
     35                section.find('input:radio').change(check_disabled);
    3736        });
    38         $('#page_for_posts').change( function() {
    39                 section.toggleClass('page-for-posts', $(this).prop('checked'));
    40         });
    41         $('#page_on_front').change( function() {
    42                 section.toggleClass('new-front-page', 'new' === $(this).val());
    43         });
    44 });
     37//]]>
    4538</script>
    4639<?php
    4740}
    48 add_action( 'admin_head', 'options_reading_add_js' );
     41add_action('admin_head', 'options_reading_add_js');
    4942
    5043/**
    5144 * Render the blog charset setting.
     
    8982<form method="post" action="options.php">
    9083<?php
    9184settings_fields( 'reading' );
    92 wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
     85
     86if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
     87        add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
    9388?>
     89
     90<?php if ( ! get_pages() ) : ?>
     91<input name="show_on_front" type="hidden" value="posts" />
    9492<table class="form-table">
    9593<?php
    96 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
    97         add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
     94        if ( 'posts' != get_option( 'show_on_front' ) ) :
     95                update_option( 'show_on_front', 'posts' );
     96        endif;
    9897
    99 $classes = '';
    100 if ( 'page' == get_option( 'show_on_front' ) ) {
    101         if ( ! get_pages() || ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) {
     98else :
     99        if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
    102100                update_option( 'show_on_front', 'posts' );
    103         } else {
    104                 $classes = 'page-on-front';
    105                 if ( get_option( 'page_for_posts' ) )
    106                         $classes .= ' page-for-posts';
    107         }
    108 }
    109 
    110 $all_pages = get_pages();
    111 $new_front_page_only = ! get_option( 'page_on_front' ) && ( ! $all_pages || ( 1 == count( $all_pages ) && __( 'sample-page' ) == $all_pages[0]->post_name ) );
    112 
    113 if ( current_user_can( 'create_posts', 'page' ) && ! ( get_option( 'page_for_posts' ) && $page_for_posts = get_post( get_option( 'page_for_posts' ) ) ) ) {
    114         $title = _x( 'Blog', 'default page for posts title' );
    115         // @todo What if the found page is post_type = attachment or post_status != publish?
    116         //       We could go ahead and create a new one, but we would not be able to take over
    117         //       the slug from another page. (We could for an attachment.)
    118         //       We must also check that the user can edit this page and publish a page.
    119         //       Otherwise, we must assume they cannot create pages (throughout), and thus
    120         //       should fall back to the dropdown.
    121         $page_for_posts = get_page_by_path( sanitize_title( $title ) );
    122         if ( ! $page_for_posts || $page_for_posts->ID == get_option( 'page_on_front' ) ) {
    123                 $page_for_posts = get_default_post_to_edit( 'page', true );
    124                 $page_for_posts->post_title = $title;
    125                 $page_for_posts->post_name = sanitize_title( $title );
    126         }
    127 }
    128 
    129 if ( ! $new_front_page_only || current_user_can( 'create_posts', 'page' ) ) : ?>
     101?>
     102<table class="form-table">
    130103<tr valign="top">
    131 <th scope="row"><?php _e( 'Enable a static front page' ); ?></th>
    132 <td id="front-static-pages" class="<?php echo $classes; ?>">
    133         <fieldset><legend class="screen-reader-text"><span><?php _e( 'Enable a static front page' ); ?></span></legend>
    134         <p><label for="show_on_front">
    135                 <input id="show_on_front" name="show_on_front" type="checkbox" value="page" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
    136                 <?php printf( __( 'Show a <a href="%s">page</a> instead of your latest posts' ), 'edit.php?post_type=page' ); ?>
    137         </label></p>
    138         <p class="if-page-on-front sub-option">
    139         <?php if ( $new_front_page_only ) : // If no pages, or only sample page, only allow a new page to be added ?>
    140                 <label for="page_on_front_title"><?php _e( 'Add new page titled:' ); ?>
    141         <?php else : ?>
    142                 <label for="page_on_front">
    143                         <select name="page_on_front" id="page_on_front">
    144                                 <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
    145                                 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?>
    146                                 <option value="new" id="new-page"><?php _e( '&mdash; Add new page &mdash;' ); ?></option>
    147                                 <?php endif; ?>
    148                                 <?php echo walk_page_dropdown_tree( $all_pages, 0, array( 'selected' => get_option( 'page_on_front' ) ) ); ?>
    149                         </select>
    150                 </label>
    151                 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?>
    152                 <label for="page_on_front_title" class="if-new-front-page"><?php _e( 'titled:' ); ?>
    153                 <?php endif; ?>
    154         <?php endif; ?>
    155         <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?>
    156                         <input name="page_on_front_title" type="text" id="page_on_front_title" value="<?php echo esc_attr_x( 'Home', 'default page on front title' ); ?>" />
    157                 </label>
    158         <?php endif; ?>
     104<th scope="row"><?php _e( 'Front page displays' ); ?></th>
     105<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend>
     106        <p><label>
     107                <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
     108                <?php _e( 'Your latest posts' ); ?>
     109        </label>
    159110        </p>
    160         <p class="if-page-on-front"><label for="page_for_posts">
    161                 <input id="page_for_posts" name="page_for_posts" type="checkbox" value="<?php echo $page_for_posts->ID; ?>" <?php checked( (bool) get_option( 'page_for_posts' ) ); ?> />
    162                 <?php _e( 'Show latest posts on a separate page' ); ?>
    163         </label></p>
    164         <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?>
    165         <p class="if-page-for-posts sub-option"><label for="page_for_posts_title"><?php _e( 'Page title:' ); ?>
    166                 <input name="page_for_posts_title" type="text" id="page_for_posts_title" value="<?php echo esc_attr( htmlspecialchars( $page_for_posts->post_title ) ); ?>" />
    167         </label></p>
    168         <p class="if-page-for-posts sub-option" id="edit-slug-box">
    169                 <?php echo get_sample_permalink_html( $page_for_posts->ID, $page_for_posts->post_title, $page_for_posts->post_name ); ?>
     111        <p><label>
     112                <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
     113                <?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
     114        </label>
    170115        </p>
    171         <input name="post_name" type="hidden" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $page_for_posts->post_name ) ); ?>" />
    172         <?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
    173         <div class="error inline"><p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'These pages should not be the same!' ); ?></p></div>
    174         <?php endif; ?>
    175         </fieldset>
    176         <?php else : // cannot create pages, so fall back to a selector of existing pages ?>
    177         <p class="if-page-for-posts sub-option"><label for="page_for_posts">
    178                 <?php wp_dropdown_pages( array(
    179                         'name' => 'page_for_posts', 'show_option_none' => __( '&mdash; Select &mdash;' ),
    180                         'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' )
    181                 ) ); ?>
    182         <?php endif; // create pages ?>
    183 </td>
     116<ul>
     117        <li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ); ?></label></li>
     118        <li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li>
     119</ul>
     120<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
     121<div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
     122<?php endif; ?>
     123</fieldset></td>
    184124</tr>
    185 <?php endif; // if no pages to choose from and can't create pages ?>
    186 
     125<?php endif; ?>
    187126<tr valign="top">
    188127<th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
    189128<td>
  • wp-admin/options.php

     
    6262        'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ),
    6363        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
    6464        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
    65         'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'blog_public' ),
     65        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
    6666        'writing' => array( 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format' )
    6767);
    6868$whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array();
  • wp-includes/formatting.php

     
    27862786                        $value = absint( $value );
    27872787                        break;
    27882788
    2789                 case 'show_on_front' :
    2790                         if ( ! $value )
    2791                                 $value = 'posts';
    2792                         break;
    2793 
    27942789                case 'posts_per_page':
    27952790                case 'posts_per_rss':
    27962791                        $value = (int) $value;
  • wp-includes/script-loader.php

     
    357357
    358358                $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
    359359
    360                 $scripts->add( 'sample-permalink', "/wp-admin/js/sample-permalink$suffix.js", array(), false, 1 );
    361                 did_action( 'init' ) && $scripts->localize( 'sample-permalink', 'samplePermalinkL10n', array(
     360                $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), false, 1 );
     361                did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
    362362                        'ok' => __('OK'),
    363363                        'cancel' => __('Cancel'),
    364                 ) );
    365 
    366                 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'sample-permalink' ), false, 1 );
    367                 did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
    368364                        'publishOn' => __('Publish on:'),
    369365                        'publishOnFuture' =>  __('Schedule for:'),
    370366                        'publishOnPast' => __('Published on:'),