145 * search relies on or various formatting that applies to the beginning of the |
145 * search relies on or various formatting that applies to the beginning of the |
146 * search. To give a few examples of what it can be used for. |
146 * search. To give a few examples of what it can be used for. |
147 * |
147 * |
148 * @since 2.7.0 |
148 * @since 2.7.0 |
149 * @param boolean $echo Default to echo and not return the form. |
149 * @param boolean $echo Default to echo and not return the form. |
|
150 * @return string|null String when retrieving, null when displaying or if searchform.php exists. |
150 */ |
151 */ |
151 function get_search_form($echo = true) { |
152 function get_search_form($echo = true) { |
152 do_action( 'get_search_form' ); |
153 do_action( 'get_search_form' ); |
153 |
154 |
154 $search_form_template = locate_template('searchform.php'); |
155 $search_form_template = locate_template('searchform.php'); |
179 * @since 1.5.0 |
180 * @since 1.5.0 |
180 * @uses apply_filters() Calls 'loginout' hook on HTML link content. |
181 * @uses apply_filters() Calls 'loginout' hook on HTML link content. |
181 * |
182 * |
182 * @param string $redirect Optional path to redirect to on login/logout. |
183 * @param string $redirect Optional path to redirect to on login/logout. |
183 * @param boolean $echo Default to echo and not return the link. |
184 * @param boolean $echo Default to echo and not return the link. |
|
185 * @return string|null String when retrieving, null when displaying. |
184 */ |
186 */ |
185 function wp_loginout($redirect = '', $echo = true) { |
187 function wp_loginout($redirect = '', $echo = true) { |
186 if ( ! is_user_logged_in() ) |
188 if ( ! is_user_logged_in() ) |
187 $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>'; |
189 $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>'; |
188 else |
190 else |
203 * @uses wp_nonce_url() To protect against CSRF |
205 * @uses wp_nonce_url() To protect against CSRF |
204 * @uses site_url() To generate the log in URL |
206 * @uses site_url() To generate the log in URL |
205 * @uses apply_filters() calls 'logout_url' hook on final logout url |
207 * @uses apply_filters() calls 'logout_url' hook on final logout url |
206 * |
208 * |
207 * @param string $redirect Path to redirect to on logout. |
209 * @param string $redirect Path to redirect to on logout. |
|
210 * @return string A log out URL. |
208 */ |
211 */ |
209 function wp_logout_url($redirect = '') { |
212 function wp_logout_url($redirect = '') { |
210 $args = array( 'action' => 'logout' ); |
213 $args = array( 'action' => 'logout' ); |
211 if ( !empty($redirect) ) { |
214 if ( !empty($redirect) ) { |
212 $args['redirect_to'] = urlencode( $redirect ); |
215 $args['redirect_to'] = urlencode( $redirect ); |
227 * @uses site_url() To generate the log in URL |
230 * @uses site_url() To generate the log in URL |
228 * @uses apply_filters() calls 'login_url' hook on final login url |
231 * @uses apply_filters() calls 'login_url' hook on final login url |
229 * |
232 * |
230 * @param string $redirect Path to redirect to on login. |
233 * @param string $redirect Path to redirect to on login. |
231 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false. |
234 * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. Default is false. |
232 * @return string A log in url |
235 * @return string A log in URL. |
233 */ |
236 */ |
234 function wp_login_url($redirect = '', $force_reauth = false) { |
237 function wp_login_url($redirect = '', $force_reauth = false) { |
235 $login_url = site_url('wp-login.php', 'login'); |
238 $login_url = site_url('wp-login.php', 'login'); |
236 |
239 |
237 if ( !empty($redirect) ) |
240 if ( !empty($redirect) ) |
246 /** |
249 /** |
247 * Provides a simple login form for use anywhere within WordPress. By default, it echoes |
250 * Provides a simple login form for use anywhere within WordPress. By default, it echoes |
248 * the HTML immediately. Pass array('echo'=>false) to return the string instead. |
251 * the HTML immediately. Pass array('echo'=>false) to return the string instead. |
249 * |
252 * |
250 * @since 3.0.0 |
253 * @since 3.0.0 |
251 * @param array $args Configuration options to modify the form output |
254 * @param array $args Configuration options to modify the form output. |
252 * @return Void, or string containing the form |
255 * @return string|null String when retrieving, null when displaying. |
253 */ |
256 */ |
254 function wp_login_form( $args = array() ) { |
257 function wp_login_form( $args = array() ) { |
255 $defaults = array( 'echo' => true, |
258 $defaults = array( 'echo' => true, |
256 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], // Default redirect is back to the current page |
259 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], // Default redirect is back to the current page |
257 'form_id' => 'loginform', |
260 'form_id' => 'loginform', |
272 $form = ' |
275 $form = ' |
273 <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post"> |
276 <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post"> |
274 ' . apply_filters( 'login_form_top', '', $args ) . ' |
277 ' . apply_filters( 'login_form_top', '', $args ) . ' |
275 <p class="login-username"> |
278 <p class="login-username"> |
276 <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label> |
279 <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label> |
277 <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" tabindex="10" /> |
280 <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" /> |
278 </p> |
281 </p> |
279 <p class="login-password"> |
282 <p class="login-password"> |
280 <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label> |
283 <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label> |
281 <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" tabindex="20" /> |
284 <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" /> |
282 </p> |
285 </p> |
283 ' . apply_filters( 'login_form_middle', '', $args ) . ' |
286 ' . apply_filters( 'login_form_middle', '', $args ) . ' |
284 ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever" tabindex="90"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . ' |
287 ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . ' |
285 <p class="login-submit"> |
288 <p class="login-submit"> |
286 <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" tabindex="100" /> |
289 <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" /> |
287 <input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" /> |
290 <input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" /> |
288 </p> |
291 </p> |
289 ' . apply_filters( 'login_form_bottom', '', $args ) . ' |
292 ' . apply_filters( 'login_form_bottom', '', $args ) . ' |
290 </form>'; |
293 </form>'; |
291 |
294 |
303 * @since 2.8.0 |
306 * @since 2.8.0 |
304 * @uses site_url() To generate the lost password URL |
307 * @uses site_url() To generate the lost password URL |
305 * @uses apply_filters() calls 'lostpassword_url' hook on the lostpassword url |
308 * @uses apply_filters() calls 'lostpassword_url' hook on the lostpassword url |
306 * |
309 * |
307 * @param string $redirect Path to redirect to on login. |
310 * @param string $redirect Path to redirect to on login. |
|
311 * @return string Lost password URL. |
308 */ |
312 */ |
309 function wp_lostpassword_url( $redirect = '' ) { |
313 function wp_lostpassword_url( $redirect = '' ) { |
310 $args = array( 'action' => 'lostpassword' ); |
314 $args = array( 'action' => 'lostpassword' ); |
311 if ( !empty($redirect) ) { |
315 if ( !empty($redirect) ) { |
312 $args['redirect_to'] = $redirect; |
316 $args['redirect_to'] = $redirect; |
326 * @uses apply_filters() Calls 'register' hook on register / admin link content. |
330 * @uses apply_filters() Calls 'register' hook on register / admin link content. |
327 * |
331 * |
328 * @param string $before Text to output before the link (defaults to <li>). |
332 * @param string $before Text to output before the link (defaults to <li>). |
329 * @param string $after Text to output after the link (defaults to </li>). |
333 * @param string $after Text to output after the link (defaults to </li>). |
330 * @param boolean $echo Default to echo and not return the link. |
334 * @param boolean $echo Default to echo and not return the link. |
|
335 * @return string|null String when retrieving, null when displaying. |
331 */ |
336 */ |
332 function wp_register( $before = '<li>', $after = '</li>', $echo = true ) { |
337 function wp_register( $before = '<li>', $after = '</li>', $echo = true ) { |
333 |
338 |
334 if ( ! is_user_logged_in() ) { |
339 if ( ! is_user_logged_in() ) { |
335 if ( get_option('users_can_register') ) |
340 if ( get_option('users_can_register') ) |
871 * function. |
864 * function. |
872 * |
865 * |
873 * @since 1.2.0 |
866 * @since 1.2.0 |
874 * |
867 * |
875 * @param string|array $args Optional. Override defaults. |
868 * @param string|array $args Optional. Override defaults. |
|
869 * @return string|null String when retrieving, null when displaying. |
876 */ |
870 */ |
877 function wp_get_archives($args = '') { |
871 function wp_get_archives($args = '') { |
878 global $wpdb, $wp_locale; |
872 global $wpdb, $wp_locale; |
879 |
873 |
880 $defaults = array( |
874 $defaults = array( |
881 'type' => 'monthly', 'limit' => '', |
875 'type' => 'monthly', 'limit' => '', |
882 'format' => 'html', 'before' => '', |
876 'format' => 'html', 'before' => '', |
883 'after' => '', 'show_post_count' => false, |
877 'after' => '', 'show_post_count' => false, |
884 'echo' => 1 |
878 'echo' => 1, 'order' => 'DESC', |
885 ); |
879 ); |
886 |
880 |
887 $r = wp_parse_args( $args, $defaults ); |
881 $r = wp_parse_args( $args, $defaults ); |
888 extract( $r, EXTR_SKIP ); |
882 extract( $r, EXTR_SKIP ); |
889 |
883 |
892 |
886 |
893 if ( '' != $limit ) { |
887 if ( '' != $limit ) { |
894 $limit = absint($limit); |
888 $limit = absint($limit); |
895 $limit = ' LIMIT '.$limit; |
889 $limit = ' LIMIT '.$limit; |
896 } |
890 } |
|
891 |
|
892 $order = strtoupper( $order ); |
|
893 if ( $order !== 'ASC' ) |
|
894 $order = 'DESC'; |
897 |
895 |
898 // this is what will separate dates on weekly archive links |
896 // this is what will separate dates on weekly archive links |
899 $archive_week_separator = '–'; |
897 $archive_week_separator = '–'; |
900 |
898 |
901 // over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride |
899 // over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride |
919 $join = apply_filters( 'getarchives_join', '', $r ); |
917 $join = apply_filters( 'getarchives_join', '', $r ); |
920 |
918 |
921 $output = ''; |
919 $output = ''; |
922 |
920 |
923 if ( 'monthly' == $type ) { |
921 if ( 'monthly' == $type ) { |
924 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit"; |
922 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit"; |
925 $key = md5($query); |
923 $key = md5($query); |
926 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
924 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
927 if ( !isset( $cache[ $key ] ) ) { |
925 if ( !isset( $cache[ $key ] ) ) { |
928 $arcresults = $wpdb->get_results($query); |
926 $arcresults = $wpdb->get_results($query); |
929 $cache[ $key ] = $arcresults; |
927 $cache[ $key ] = $arcresults; |
941 $after = ' ('.$arcresult->posts.')' . $afterafter; |
939 $after = ' ('.$arcresult->posts.')' . $afterafter; |
942 $output .= get_archives_link($url, $text, $format, $before, $after); |
940 $output .= get_archives_link($url, $text, $format, $before, $after); |
943 } |
941 } |
944 } |
942 } |
945 } elseif ('yearly' == $type) { |
943 } elseif ('yearly' == $type) { |
946 $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC $limit"; |
944 $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit"; |
947 $key = md5($query); |
945 $key = md5($query); |
948 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
946 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
949 if ( !isset( $cache[ $key ] ) ) { |
947 if ( !isset( $cache[ $key ] ) ) { |
950 $arcresults = $wpdb->get_results($query); |
948 $arcresults = $wpdb->get_results($query); |
951 $cache[ $key ] = $arcresults; |
949 $cache[ $key ] = $arcresults; |
962 $after = ' ('.$arcresult->posts.')' . $afterafter; |
960 $after = ' ('.$arcresult->posts.')' . $afterafter; |
963 $output .= get_archives_link($url, $text, $format, $before, $after); |
961 $output .= get_archives_link($url, $text, $format, $before, $after); |
964 } |
962 } |
965 } |
963 } |
966 } elseif ( 'daily' == $type ) { |
964 } elseif ( 'daily' == $type ) { |
967 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC $limit"; |
965 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit"; |
968 $key = md5($query); |
966 $key = md5($query); |
969 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
967 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
970 if ( !isset( $cache[ $key ] ) ) { |
968 if ( !isset( $cache[ $key ] ) ) { |
971 $arcresults = $wpdb->get_results($query); |
969 $arcresults = $wpdb->get_results($query); |
972 $cache[ $key ] = $arcresults; |
970 $cache[ $key ] = $arcresults; |
985 $output .= get_archives_link($url, $text, $format, $before, $after); |
983 $output .= get_archives_link($url, $text, $format, $before, $after); |
986 } |
984 } |
987 } |
985 } |
988 } elseif ( 'weekly' == $type ) { |
986 } elseif ( 'weekly' == $type ) { |
989 $week = _wp_mysql_week( '`post_date`' ); |
987 $week = _wp_mysql_week( '`post_date`' ); |
990 $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` DESC $limit"; |
988 $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit"; |
991 $key = md5($query); |
989 $key = md5($query); |
992 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
990 $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
993 if ( !isset( $cache[ $key ] ) ) { |
991 if ( !isset( $cache[ $key ] ) ) { |
994 $arcresults = $wpdb->get_results($query); |
992 $arcresults = $wpdb->get_results($query); |
995 $cache[ $key ] = $arcresults; |
993 $cache[ $key ] = $arcresults; |
1065 * |
1062 * |
1066 * The calendar is cached, which will be retrieved, if it exists. If there are |
1063 * The calendar is cached, which will be retrieved, if it exists. If there are |
1067 * no posts for the month, then it will not be displayed. |
1064 * no posts for the month, then it will not be displayed. |
1068 * |
1065 * |
1069 * @since 1.0.0 |
1066 * @since 1.0.0 |
|
1067 * @uses calendar_week_mod() |
1070 * |
1068 * |
1071 * @param bool $initial Optional, default is true. Use initial calendar names. |
1069 * @param bool $initial Optional, default is true. Use initial calendar names. |
1072 * @param bool $echo Optional, default is true. Set to false for return. |
1070 * @param bool $echo Optional, default is true. Set to false for return. |
|
1071 * @return string|null String when retrieving, null when displaying. |
1073 */ |
1072 */ |
1074 function get_calendar($initial = true, $echo = true) { |
1073 function get_calendar($initial = true, $echo = true) { |
1075 global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; |
1074 global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; |
1076 |
1075 |
1077 $cache = array(); |
1076 $cache = array(); |
1317 * Outputs the date in iso8601 format for xml files. |
1316 * Outputs the date in iso8601 format for xml files. |
1318 * |
1317 * |
1319 * @since 1.0.0 |
1318 * @since 1.0.0 |
1320 */ |
1319 */ |
1321 function the_date_xml() { |
1320 function the_date_xml() { |
1322 global $post; |
1321 echo mysql2date( 'Y-m-d', get_post()->post_date, false ); |
1323 echo mysql2date('Y-m-d', $post->post_date, false); |
|
1324 } |
1322 } |
1325 |
1323 |
1326 /** |
1324 /** |
1327 * Display or Retrieve the date the current $post was written (once per date) |
1325 * Display or Retrieve the date the current $post was written (once per date) |
1328 * |
1326 * |
1373 * |
1371 * |
1374 * @param string $d Optional. PHP date format defaults to the date_format option if not specified. |
1372 * @param string $d Optional. PHP date format defaults to the date_format option if not specified. |
1375 * @return string|null Null if displaying, string if retrieving. |
1373 * @return string|null Null if displaying, string if retrieving. |
1376 */ |
1374 */ |
1377 function get_the_date( $d = '' ) { |
1375 function get_the_date( $d = '' ) { |
1378 global $post; |
1376 $post = get_post(); |
1379 $the_date = ''; |
1377 $the_date = ''; |
1380 |
1378 |
1381 if ( '' == $d ) |
1379 if ( '' == $d ) |
1382 $the_date .= mysql2date(get_option('date_format'), $post->post_date); |
1380 $the_date .= mysql2date(get_option('date_format'), $post->post_date); |
1383 else |
1381 else |
1534 * @since 0.71 |
1532 * @since 0.71 |
1535 * @uses $wp_locale |
1533 * @uses $wp_locale |
1536 * @uses $post |
1534 * @uses $post |
1537 */ |
1535 */ |
1538 function the_weekday() { |
1536 function the_weekday() { |
1539 global $wp_locale, $post; |
1537 global $wp_locale; |
1540 $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date, false)); |
1538 $the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) ); |
1541 $the_weekday = apply_filters('the_weekday', $the_weekday); |
1539 $the_weekday = apply_filters('the_weekday', $the_weekday); |
1542 echo $the_weekday; |
1540 echo $the_weekday; |
1543 } |
1541 } |
1544 |
1542 |
1545 /** |
1543 /** |
1552 * |
1550 * |
1553 * @param string $before Optional Output before the date. |
1551 * @param string $before Optional Output before the date. |
1554 * @param string $after Optional Output after the date. |
1552 * @param string $after Optional Output after the date. |
1555 */ |
1553 */ |
1556 function the_weekday_date($before='',$after='') { |
1554 function the_weekday_date($before='',$after='') { |
1557 global $wp_locale, $post, $day, $previousweekday; |
1555 global $wp_locale, $day, $previousweekday; |
1558 $the_weekday_date = ''; |
1556 $the_weekday_date = ''; |
1559 if ( $currentday != $previousweekday ) { |
1557 if ( $currentday != $previousweekday ) { |
1560 $the_weekday_date .= $before; |
1558 $the_weekday_date .= $before; |
1561 $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false)); |
1559 $the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) ); |
1562 $the_weekday_date .= $after; |
1560 $the_weekday_date .= $after; |
1563 $previousweekday = $currentday; |
1561 $previousweekday = $currentday; |
1564 } |
1562 } |
1565 $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after); |
1563 $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after); |
1566 echo $the_weekday_date; |
1564 echo $the_weekday_date; |
1631 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), |
1629 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), |
1632 /* translators: 1: blog name, 2: separator(raquo), 3: author name */ |
1630 /* translators: 1: blog name, 2: separator(raquo), 3: author name */ |
1633 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), |
1631 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), |
1634 /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */ |
1632 /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */ |
1635 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), |
1633 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), |
|
1634 /* translators: 1: blog name, 2: separator(raquo), 3: post type name */ |
|
1635 'posttypetitle' => __('%1$s %2$s %3$s Feed'), |
1636 ); |
1636 ); |
1637 |
1637 |
1638 $args = wp_parse_args( $args, $defaults ); |
1638 $args = wp_parse_args( $args, $defaults ); |
1639 |
1639 |
1640 if ( is_single() || is_page() ) { |
1640 if ( is_single() || is_page() ) { |
1641 $id = 0; |
1641 $id = 0; |
1642 $post = &get_post( $id ); |
1642 $post = get_post( $id ); |
1643 |
1643 |
1644 if ( comments_open() || pings_open() || $post->comment_count > 0 ) { |
1644 if ( comments_open() || pings_open() || $post->comment_count > 0 ) { |
1645 $title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ); |
1645 $title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ); |
1646 $href = get_post_comments_feed_link( $post->ID ); |
1646 $href = get_post_comments_feed_link( $post->ID ); |
1647 } |
1647 } |
1661 $title = sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
1661 $title = sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
1662 $href = get_author_feed_link( $author_id ); |
1662 $href = get_author_feed_link( $author_id ); |
1663 } elseif ( is_search() ) { |
1663 } elseif ( is_search() ) { |
1664 $title = sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) ); |
1664 $title = sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) ); |
1665 $href = get_search_feed_link(); |
1665 $href = get_search_feed_link(); |
|
1666 } elseif ( is_post_type_archive() ) { |
|
1667 $title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) ); |
|
1668 $href = get_post_type_archive_feed_link( get_queried_object()->name ); |
1666 } |
1669 } |
1667 |
1670 |
1668 if ( isset($title) && isset($href) ) |
1671 if ( isset($title) && isset($href) ) |
1669 echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; |
1672 echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; |
1670 } |
1673 } |
1752 $wp_rich_edit = false; |
1755 $wp_rich_edit = false; |
1753 |
1756 |
1754 if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users |
1757 if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users |
1755 if ( $is_safari ) { |
1758 if ( $is_safari ) { |
1756 $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 ); |
1759 $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 ); |
1757 } elseif ( $is_gecko || $is_opera || $is_chrome || $is_IE ) { |
1760 } elseif ( $is_gecko || $is_chrome || $is_IE || ( $is_opera && !wp_is_mobile() ) ) { |
1758 $wp_rich_edit = true; |
1761 $wp_rich_edit = true; |
1759 } |
1762 } |
1760 } |
1763 } |
1761 } |
1764 } |
1762 |
1765 |
1853 */ |
1856 */ |
1854 function language_attributes($doctype = 'html') { |
1857 function language_attributes($doctype = 'html') { |
1855 $attributes = array(); |
1858 $attributes = array(); |
1856 $output = ''; |
1859 $output = ''; |
1857 |
1860 |
1858 if ( function_exists( 'is_rtl' ) ) |
1861 if ( function_exists( 'is_rtl' ) && is_rtl() ) |
1859 $attributes[] = 'dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"'; |
1862 $attributes[] = 'dir="rtl"'; |
1860 |
1863 |
1861 if ( $lang = get_bloginfo('language') ) { |
1864 if ( $lang = get_bloginfo('language') ) { |
1862 if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) |
1865 if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) |
1863 $attributes[] = "lang=\"$lang\""; |
1866 $attributes[] = "lang=\"$lang\""; |
1864 |
1867 |
2030 * Registers the default Admin color schemes |
2033 * Registers the default Admin color schemes |
2031 * |
2034 * |
2032 * @since 3.0.0 |
2035 * @since 3.0.0 |
2033 */ |
2036 */ |
2034 function register_admin_color_schemes() { |
2037 function register_admin_color_schemes() { |
2035 wp_admin_css_color( 'classic', _x( 'Blue', 'admin color scheme' ), admin_url( 'css/colors-classic.css' ), |
2038 wp_admin_css_color( 'classic', _x( 'Blue', 'admin color scheme' ), admin_url( 'css/colors-classic.min.css' ), |
2036 array( '#5589aa', '#cfdfe9', '#d1e5ee', '#eff8ff' ) ); |
2039 array( '#5589aa', '#cfdfe9', '#d1e5ee', '#eff8ff' ) ); |
2037 wp_admin_css_color( 'fresh', _x( 'Gray', 'admin color scheme' ), admin_url( 'css/colors-fresh.css' ), |
2040 wp_admin_css_color( 'fresh', _x( 'Gray', 'admin color scheme' ), admin_url( 'css/colors-fresh.min.css' ), |
2038 array( '#555', '#a0a0a0', '#ccc', '#f1f1f1' ) ); |
2041 array( '#555', '#a0a0a0', '#ccc', '#f1f1f1' ) ); |
2039 } |
2042 } |
2040 |
2043 |
2041 /** |
2044 /** |
2042 * Display the URL of a WordPress admin CSS file. |
2045 * Display the URL of a WordPress admin CSS file. |
2262 * Compares the first two arguments and if identical marks as $type |
2265 * Compares the first two arguments and if identical marks as $type |
2263 * |
2266 * |
2264 * @since 2.8.0 |
2267 * @since 2.8.0 |
2265 * @access private |
2268 * @access private |
2266 * |
2269 * |
2267 * @param any $helper One of the values to compare |
2270 * @param mixed $helper One of the values to compare |
2268 * @param any $current (true) The other value to compare if not just true |
2271 * @param mixed $current (true) The other value to compare if not just true |
2269 * @param bool $echo Whether to echo or just return the string |
2272 * @param bool $echo Whether to echo or just return the string |
2270 * @param string $type The type of checked|selected|disabled we are doing |
2273 * @param string $type The type of checked|selected|disabled we are doing |
2271 * @return string html attribute or empty string |
2274 * @return string html attribute or empty string |
2272 */ |
2275 */ |
2273 function __checked_selected_helper( $helper, $current, $echo, $type ) { |
2276 function __checked_selected_helper( $helper, $current, $echo, $type ) { |