]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/options-reading.php
WordPress 4.1.3-scripts
[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( dirname( __FILE__ ) . '/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 At a Glance 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="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
73 );
74
75 include( ABSPATH . 'wp-admin/admin-header.php' );
76 ?>
77
78 <div class="wrap">
79 <h2><?php echo esc_html( $title ); ?></h2>
80
81 <form method="post" action="options.php">
82 <?php
83 settings_fields( 'reading' );
84
85 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
86         add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
87 ?>
88
89 <?php if ( ! get_pages() ) : ?>
90 <input name="show_on_front" type="hidden" value="posts" />
91 <table class="form-table">
92 <?php
93         if ( 'posts' != get_option( 'show_on_front' ) ) :
94                 update_option( 'show_on_front', 'posts' );
95         endif;
96
97 else :
98         if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
99                 update_option( 'show_on_front', 'posts' );
100 ?>
101 <table class="form-table">
102 <tr>
103 <th scope="row"><?php _e( 'Front page displays' ); ?></th>
104 <td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend>
105         <p><label>
106                 <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
107                 <?php _e( 'Your latest posts' ); ?>
108         </label>
109         </p>
110         <p><label>
111                 <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
112                 <?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
113         </label>
114         </p>
115 <ul>
116         <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>
117         <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>
118 </ul>
119 <?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
120 <div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
121 <?php endif; ?>
122 </fieldset></td>
123 </tr>
124 <?php endif; ?>
125 <tr>
126 <th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
127 <td>
128 <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' ); ?>
129 </td>
130 </tr>
131 <tr>
132 <th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th>
133 <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>
134 </tr>
135 <tr>
136 <th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th>
137 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend>
138 <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 />
139 <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p>
140 </fieldset></td>
141 </tr>
142
143 <tr class="option-site-visibility">
144 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </th>
145 <td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
146 <?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
147         <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
148         <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
149         <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
150         <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
151         <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>
152         <?php
153         /**
154          * Enable the legacy 'Site Visibility' privacy options.
155          *
156          * By default the privacy options form displays a single checkbox to 'discourage' search
157          * engines from indexing the site. Hooking to this action serves a dual purpose:
158          * 1. Disable the single checkbox in favor of a multiple-choice list of radio buttons.
159          * 2. Open the door to adding additional radio button choices to the list.
160          *
161          * Hooking to this action also converts the 'Search Engine Visibility' heading to the more
162          * open-ended 'Site Visibility' heading.
163          *
164          * @since 2.1.0
165          */
166         do_action( 'blog_privacy_selector' );
167         ?>
168 <?php else : ?>
169         <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
170         <?php _e( 'Discourage search engines from indexing this site' ); ?></label>
171         <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
172 <?php endif; ?>
173 </fieldset></td>
174 </tr>
175
176 <?php do_settings_fields( 'reading', 'default' ); ?>
177 </table>
178
179 <?php do_settings_sections( 'reading' ); ?>
180
181 <?php submit_button(); ?>
182 </form>
183 </div>
184 <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>