WordPress.org

Make WordPress Core

Changeset 21539


Ignore:
Timestamp:
08/17/2012 04:46:47 PM (8 years ago)
Author:
nacin
Message:

Output a hidden input of blog_charset when we are hiding the option. props SergeyBiryukov. see #21507.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-reading.php

    r21467 r21539  
    6565
    6666<form name="form1" method="post" action="options.php">
    67 <?php settings_fields( 'reading' ); ?>
     67<?php
     68settings_fields( 'reading' );
     69
     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?>
    6880
    6981<?php if ( ! get_pages() ) : ?>
     
    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
Note: See TracChangeset for help on using the changeset viewer.