WordPress.org

Make WordPress Core

Ticket #21507: 21507.patch

File 21507.patch, 2.0 KB (added by SergeyBiryukov, 3 years ago)
  • wp-admin/options-reading.php

     
    6464<h2><?php echo esc_html( $title ); ?></h2> 
    6565 
    6666<form name="form1" method="post" action="options.php"> 
    67 <?php settings_fields( 'reading' ); ?> 
     67<?php 
     68settings_fields( 'reading' ); 
    6869 
     70function options_reading_blog_charset() { 
     71        echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />'; 
     72        echo '<p class="description">' . __( 'The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>'; 
     73} 
     74 
     75if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) 
     76        add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading' ); 
     77else 
     78        echo '<input name="blog_charset" type="hidden" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" />'; 
     79?> 
     80 
    6981<?php if ( ! get_pages() ) : ?> 
    7082<input name="show_on_front" type="hidden" value="posts" /> 
    7183<table class="form-table"> 
     
    120132</fieldset></td> 
    121133</tr> 
    122134 
    123 <?php 
    124 function options_reading_blog_charset() { 
    125         echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />'; 
    126         echo '<p class="description">' . __( 'The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)' ) 
    127                 . '</p>'; 
    128 } 
    129  
    130 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) 
    131         add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading' ); 
    132  
    133 do_settings_fields( 'reading', 'default' ); ?> 
     135<?php do_settings_fields( 'reading', 'default' ); ?> 
    134136</table> 
    135137 
    136138<?php do_settings_sections( 'reading' ); ?>