]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/options-reading.php
WordPress 3.5.1
[autoinstalls/wordpress.git] / wp-admin / options-reading.php
1 <?php
2 /**
3  * Reading settings administration panel.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /** WordPress Administration Bootstrap */
10 require_once( './admin.php' );
11
12 if ( ! current_user_can( 'manage_options' ) )
13         wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
14
15 $title = __( 'Reading Settings' );
16 $parent_file = 'options-general.php';
17
18 /**
19  * Display JavaScript on the page.
20  *
21  * @since 3.5.0
22  */
23 function options_reading_add_js() {
24 ?>
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);
36         });
37 //]]>
38 </script>
39 <?php
40 }
41 add_action('admin_head', 'options_reading_add_js');
42
43 /**
44  * Render the blog charset setting.
45  *
46  * @since 3.5.0
47  */
48 function options_reading_blog_charset() {
49         echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
50         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>';
51 }
52
53 get_current_screen()->add_help_tab( array(
54         'id'      => 'overview',
55         'title'   => __('Overview'),
56         'content' => '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
57                 '<p>' . sprintf(__('You can choose what&#8217;s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' .
58                 '<p>' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display and whether to show full text or a summary.') . '</p>' .
59                 '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
60 ) );
61
62 get_current_screen()->add_help_tab( array(
63         'id'      => 'site-visibility',
64         'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ),
65         'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' .
66                 '<p>' . __( 'When this setting is in effect, a reminder is shown in the Right Now box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.' ) . '</p>',
67 ) );
68
69 get_current_screen()->set_help_sidebar(
70         '<p><strong>' . __('For more information:') . '</strong></p>' .
71         '<p>' . __('<a href="http://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>') . '</p>' .
72         '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
73 );
74
75 include( './admin-header.php' );
76 ?>
77
78 <div class="wrap">
79 <?php screen_icon(); ?>
80 <h2><?php echo esc_html( $title ); ?></h2>
81
82 <form method="post" action="options.php">
83 <?php
84 settings_fields( 'reading' );
85
86 if ( ! 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' ) );
88 ?>
89
90 <?php if ( ! get_pages() ) : ?>
91 <input name="show_on_front" type="hidden" value="posts" />
92 <table class="form-table">
93 <?php
94         if ( 'posts' != get_option( 'show_on_front' ) ) :
95                 update_option( 'show_on_front', 'posts' );
96         endif;
97
98 else :
99         if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
100                 update_option( 'show_on_front', 'posts' );
101 ?>
102 <table class="form-table">
103 <tr valign="top">
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>
110         </p>
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>
115         </p>
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>
124 </tr>
125 <?php endif; ?>
126 <tr valign="top">
127 <th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
128 <td>
129 <input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" /> <?php _e( 'posts' ); ?>
130 </td>
131 </tr>
132 <tr valign="top">
133 <th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th>
134 <td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
135 </tr>
136 <tr valign="top">
137 <th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th>
138 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend>
139 <p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?>  /> <?php _e( 'Full text' ); ?></label><br />
140 <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p>
141 </fieldset></td>
142 </tr>
143
144 <tr valign="top" class="option-site-visibility">
145 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </th>
146 <td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
147 <?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
148         <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
149         <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
150         <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
151         <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
152         <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
153         <?php do_action('blog_privacy_selector'); ?>
154 <?php else : ?>
155         <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
156         <?php _e( 'Discourage search engines from indexing this site' ); ?></label>
157         <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
158 <?php endif; ?>
159 </fieldset></td>
160 </tr>
161
162 <?php do_settings_fields( 'reading', 'default' ); ?>
163 </table>
164
165 <?php do_settings_sections( 'reading' ); ?>
166
167 <?php submit_button(); ?>
168 </form>
169 </div>
170 <?php include( './admin-footer.php' ); ?>