Changeset 42343 for trunk/src/wp-includes/general-template.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/general-template.php (modified) (102 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r42259 r42343 32 32 33 33 $templates = array(); 34 $name = (string) $name;34 $name = (string) $name; 35 35 if ( '' !== $name ) { 36 36 $templates[] = "header-{$name}.php"; … … 67 67 68 68 $templates = array(); 69 $name = (string) $name;69 $name = (string) $name; 70 70 if ( '' !== $name ) { 71 71 $templates[] = "footer-{$name}.php"; 72 72 } 73 73 74 $templates[] = 'footer.php';74 $templates[] = 'footer.php'; 75 75 76 76 locate_template( $templates, true ); … … 102 102 103 103 $templates = array(); 104 $name = (string) $name;105 if ( '' !== $name ) 104 $name = (string) $name; 105 if ( '' !== $name ) { 106 106 $templates[] = "sidebar-{$name}.php"; 107 } 107 108 108 109 $templates[] = 'sidebar.php'; … … 147 148 148 149 $templates = array(); 149 $name = (string) $name;150 if ( '' !== $name ) 150 $name = (string) $name; 151 if ( '' !== $name ) { 151 152 $templates[] = "{$slug}-{$name}.php"; 153 } 152 154 153 155 $templates[] = "{$slug}.php"; 154 156 155 locate_template( $templates, true, false);157 locate_template( $templates, true, false ); 156 158 } 157 159 … … 213 215 <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" /> 214 216 </label> 215 <input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button' ) .'" />217 <input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" /> 216 218 </form>'; 217 219 } else { … … 220 222 <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label> 221 223 <input type="text" value="' . get_search_query() . '" name="s" id="s" /> 222 <input type="submit" id="searchsubmit" value="' . esc_attr_x( 'Search', 'submit button' ) .'" />224 <input type="submit" id="searchsubmit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" /> 223 225 </div> 224 226 </form>'; … … 235 237 $result = apply_filters( 'get_search_form', $form ); 236 238 237 if ( null === $result ) 239 if ( null === $result ) { 238 240 $result = $form; 239 240 if ( $echo ) 241 } 242 243 if ( $echo ) { 241 244 echo $result; 242 else245 } else { 243 246 return $result; 247 } 244 248 } 245 249 … … 256 260 * @return string|void String when retrieving. 257 261 */ 258 function wp_loginout($redirect = '', $echo = true) { 259 if ( ! is_user_logged_in() ) 260 $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>'; 261 else 262 $link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>'; 262 function wp_loginout( $redirect = '', $echo = true ) { 263 if ( ! is_user_logged_in() ) { 264 $link = '<a href="' . esc_url( wp_login_url( $redirect ) ) . '">' . __( 'Log in' ) . '</a>'; 265 } else { 266 $link = '<a href="' . esc_url( wp_logout_url( $redirect ) ) . '">' . __( 'Log out' ) . '</a>'; 267 } 263 268 264 269 if ( $echo ) { … … 287 292 * @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url(). 288 293 */ 289 function wp_logout_url( $redirect = '') {294 function wp_logout_url( $redirect = '' ) { 290 295 $args = array( 'action' => 'logout' ); 291 if ( ! empty($redirect) ) {296 if ( ! empty( $redirect ) ) { 292 297 $args['redirect_to'] = urlencode( $redirect ); 293 298 } 294 299 295 $logout_url = add_query_arg( $args, site_url('wp-login.php', 'login'));300 $logout_url = add_query_arg( $args, site_url( 'wp-login.php', 'login' ) ); 296 301 $logout_url = wp_nonce_url( $logout_url, 'log-out' ); 297 302 … … 317 322 * @return string The login URL. Not HTML-encoded. 318 323 */ 319 function wp_login_url($redirect = '', $force_reauth = false) { 320 $login_url = site_url('wp-login.php', 'login'); 321 322 if ( !empty($redirect) ) 323 $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url); 324 325 if ( $force_reauth ) 326 $login_url = add_query_arg('reauth', '1', $login_url); 324 function wp_login_url( $redirect = '', $force_reauth = false ) { 325 $login_url = site_url( 'wp-login.php', 'login' ); 326 327 if ( ! empty( $redirect ) ) { 328 $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url ); 329 } 330 331 if ( $force_reauth ) { 332 $login_url = add_query_arg( 'reauth', '1', $login_url ); 333 } 327 334 328 335 /** … … 390 397 function wp_login_form( $args = array() ) { 391 398 $defaults = array( 392 'echo' => true,399 'echo' => true, 393 400 // Default 'redirect' value takes the user back to the request URI. 394 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],395 'form_id' => 'loginform',401 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 402 'form_id' => 'loginform', 396 403 'label_username' => __( 'Username or Email Address' ), 397 404 'label_password' => __( 'Password' ), 398 405 'label_remember' => __( 'Remember Me' ), 399 'label_log_in' => __( 'Log In' ),400 'id_username' => 'user_login',401 'id_password' => 'user_pass',402 'id_remember' => 'rememberme',403 'id_submit' => 'wp-submit',404 'remember' => true,406 'label_log_in' => __( 'Log In' ), 407 'id_username' => 'user_login', 408 'id_password' => 'user_pass', 409 'id_remember' => 'rememberme', 410 'id_submit' => 'wp-submit', 411 'remember' => true, 405 412 'value_username' => '', 406 413 // Set 'value_remember' to true to default the "Remember me" checkbox to checked. … … 476 483 </form>'; 477 484 478 if ( $args['echo'] ) 485 if ( $args['echo'] ) { 479 486 echo $form; 480 else487 } else { 481 488 return $form; 489 } 482 490 } 483 491 … … 492 500 function wp_lostpassword_url( $redirect = '' ) { 493 501 $args = array( 'action' => 'lostpassword' ); 494 if ( ! empty($redirect) ) {502 if ( ! empty( $redirect ) ) { 495 503 $args['redirect_to'] = urlencode( $redirect ); 496 504 } 497 505 498 $lostpassword_url = add_query_arg( $args, network_site_url( 'wp-login.php', 'login') );506 $lostpassword_url = add_query_arg( $args, network_site_url( 'wp-login.php', 'login' ) ); 499 507 500 508 /** … … 524 532 function wp_register( $before = '<li>', $after = '</li>', $echo = true ) { 525 533 if ( ! is_user_logged_in() ) { 526 if ( get_option( 'users_can_register') )527 $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __( 'Register') . '</a>' . $after;528 else534 if ( get_option( 'users_can_register' ) ) { 535 $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __( 'Register' ) . '</a>' . $after; 536 } else { 529 537 $link = ''; 538 } 530 539 } elseif ( current_user_can( 'read' ) ) { 531 $link = $before . '<a href="' . admin_url() . '">' . __( 'Site Admin') . '</a>' . $after;540 $link = $before . '<a href="' . admin_url() . '">' . __( 'Site Admin' ) . '</a>' . $after; 532 541 } else { 533 542 $link = ''; … … 633 642 */ 634 643 function get_bloginfo( $show = '', $filter = 'raw' ) { 635 switch( $show ) { 636 case 'home' : // DEPRECATED 637 case 'siteurl' : // DEPRECATED 638 _deprecated_argument( __FUNCTION__, '2.2.0', sprintf( 639 /* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */ 640 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ), 641 '<code>' . $show . '</code>', 642 '<code>bloginfo()</code>', 643 '<code>url</code>' 644 ) ); 645 case 'url' : 644 switch ( $show ) { 645 case 'home': // DEPRECATED 646 case 'siteurl': // DEPRECATED 647 _deprecated_argument( 648 __FUNCTION__, '2.2.0', sprintf( 649 /* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */ 650 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ), 651 '<code>' . $show . '</code>', 652 '<code>bloginfo()</code>', 653 '<code>url</code>' 654 ) 655 ); 656 case 'url': 646 657 $output = home_url(); 647 658 break; 648 case 'wpurl' :659 case 'wpurl': 649 660 $output = site_url(); 650 661 break; 651 662 case 'description': 652 $output = get_option( 'blogdescription');663 $output = get_option( 'blogdescription' ); 653 664 break; 654 665 case 'rdf_url': 655 $output = get_feed_link( 'rdf');666 $output = get_feed_link( 'rdf' ); 656 667 break; 657 668 case 'rss_url': 658 $output = get_feed_link( 'rss');669 $output = get_feed_link( 'rss' ); 659 670 break; 660 671 case 'rss2_url': 661 $output = get_feed_link( 'rss2');672 $output = get_feed_link( 'rss2' ); 662 673 break; 663 674 case 'atom_url': 664 $output = get_feed_link( 'atom');675 $output = get_feed_link( 'atom' ); 665 676 break; 666 677 case 'comments_atom_url': 667 $output = get_feed_link( 'comments_atom');678 $output = get_feed_link( 'comments_atom' ); 668 679 break; 669 680 case 'comments_rss2_url': 670 $output = get_feed_link( 'comments_rss2');681 $output = get_feed_link( 'comments_rss2' ); 671 682 break; 672 683 case 'pingback_url': … … 684 695 break; 685 696 case 'admin_email': 686 $output = get_option( 'admin_email');697 $output = get_option( 'admin_email' ); 687 698 break; 688 699 case 'charset': 689 $output = get_option('blog_charset'); 690 if ('' == $output) $output = 'UTF-8'; 700 $output = get_option( 'blog_charset' ); 701 if ( '' == $output ) { 702 $output = 'UTF-8'; 703 } 691 704 break; 692 case 'html_type' :693 $output = get_option( 'html_type');705 case 'html_type': 706 $output = get_option( 'html_type' ); 694 707 break; 695 708 case 'version': … … 709 722 break; 710 723 case 'text_direction': 711 _deprecated_argument( __FUNCTION__, '2.2.0', sprintf( 712 /* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */ 713 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ), 714 '<code>' . $show . '</code>', 715 '<code>bloginfo()</code>', 716 '<code>is_rtl()</code>' 717 ) ); 724 _deprecated_argument( 725 __FUNCTION__, '2.2.0', sprintf( 726 /* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */ 727 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ), 728 '<code>' . $show . '</code>', 729 '<code>bloginfo()</code>', 730 '<code>is_rtl()</code>' 731 ) 732 ); 718 733 if ( function_exists( 'is_rtl' ) ) { 719 734 $output = is_rtl() ? 'rtl' : 'ltr'; … … 724 739 case 'name': 725 740 default: 726 $output = get_option( 'blogname');741 $output = get_option( 'blogname' ); 727 742 break; 728 743 } 729 744 730 745 $url = true; 731 if ( strpos($show, 'url') === false &&732 strpos( $show, 'directory') === false &&733 strpos( $show, 'home') === false)746 if ( strpos( $show, 'url' ) === false && 747 strpos( $show, 'directory' ) === false && 748 strpos( $show, 'home' ) === false ) { 734 749 $url = false; 750 } 735 751 736 752 if ( 'display' == $filter ) { … … 865 881 */ 866 882 function get_custom_logo( $blog_id = 0 ) { 867 $html = '';883 $html = ''; 868 884 $switched_blog = false; 869 885 … … 895 911 * it because wp_get_attachment_image() already adds the alt attribute. 896 912 */ 897 $html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>', 913 $html = sprintf( 914 '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>', 898 915 esc_url( home_url( '/' ) ), 899 916 wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr ) 900 917 ); 901 } 902 903 // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). 918 } // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). 904 919 elseif ( is_customize_preview() ) { 905 $html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo"/></a>', 920 $html = sprintf( 921 '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo"/></a>', 906 922 esc_url( home_url( '/' ) ) 907 923 ); … … 972 988 $title['title'] = __( 'Page not found' ); 973 989 974 // If it's a search, use a dynamic search results title.990 // If it's a search, use a dynamic search results title. 975 991 } elseif ( is_search() ) { 976 992 /* translators: %s: search phrase */ 977 993 $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); 978 994 979 // If on the front page, use the site title.995 // If on the front page, use the site title. 980 996 } elseif ( is_front_page() ) { 981 997 $title['title'] = get_bloginfo( 'name', 'display' ); 982 998 983 // If on a post type archive, use the post type archive title.999 // If on a post type archive, use the post type archive title. 984 1000 } elseif ( is_post_type_archive() ) { 985 1001 $title['title'] = post_type_archive_title( '', false ); 986 1002 987 // If on a taxonomy archive, use the term title.1003 // If on a taxonomy archive, use the term title. 988 1004 } elseif ( is_tax() ) { 989 1005 $title['title'] = single_term_title( '', false ); 990 1006 991 /*992 * If we're on the blog page that is not the homepage or993 * a single post of any post type, use the post title.994 */1007 /* 1008 * If we're on the blog page that is not the homepage or 1009 * a single post of any post type, use the post title. 1010 */ 995 1011 } elseif ( is_home() || is_singular() ) { 996 1012 $title['title'] = single_post_title( '', false ); 997 1013 998 // If on a category or tag archive, use the term title.1014 // If on a category or tag archive, use the term title. 999 1015 } elseif ( is_category() || is_tag() ) { 1000 1016 $title['title'] = single_term_title( '', false ); 1001 1017 1002 // If on an author archive, use the author's display name.1018 // If on an author archive, use the author's display name. 1003 1019 } elseif ( is_author() && $author = get_queried_object() ) { 1004 1020 $title['title'] = $author->display_name; 1005 1021 1006 // If it's a date archive, use the date as the title.1022 // If it's a date archive, use the date as the title. 1007 1023 } elseif ( is_year() ) { 1008 1024 $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) ); … … 1248 1264 $_post = get_queried_object(); 1249 1265 1250 if ( ! isset($_post->post_title) )1266 if ( ! isset( $_post->post_title ) ) { 1251 1267 return; 1268 } 1252 1269 1253 1270 /** … … 1260 1277 */ 1261 1278 $title = apply_filters( 'single_post_title', $_post->post_title, $_post ); 1262 if ( $display ) 1279 if ( $display ) { 1263 1280 echo $prefix . $title; 1264 else1281 } else { 1265 1282 return $prefix . $title; 1283 } 1266 1284 } 1267 1285 … … 1279 1297 */ 1280 1298 function post_type_archive_title( $prefix = '', $display = true ) { 1281 if ( ! is_post_type_archive() ) 1299 if ( ! is_post_type_archive() ) { 1282 1300 return; 1301 } 1283 1302 1284 1303 $post_type = get_query_var( 'post_type' ); 1285 if ( is_array( $post_type ) ) 1304 if ( is_array( $post_type ) ) { 1286 1305 $post_type = reset( $post_type ); 1306 } 1287 1307 1288 1308 $post_type_obj = get_post_type_object( $post_type ); … … 1298 1318 $title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type ); 1299 1319 1300 if ( $display ) 1320 if ( $display ) { 1301 1321 echo $prefix . $title; 1302 else1322 } else { 1303 1323 return $prefix . $title; 1324 } 1304 1325 } 1305 1326 … … 1354 1375 $term = get_queried_object(); 1355 1376 1356 if ( ! $term )1377 if ( ! $term ) { 1357 1378 return; 1379 } 1358 1380 1359 1381 if ( is_category() ) { … … 1388 1410 } 1389 1411 1390 if ( empty( $term_name ) ) 1412 if ( empty( $term_name ) ) { 1391 1413 return; 1392 1393 if ( $display ) 1414 } 1415 1416 if ( $display ) { 1394 1417 echo $prefix . $term_name; 1395 else1418 } else { 1396 1419 return $prefix . $term_name; 1420 } 1397 1421 } 1398 1422 … … 1413 1437 * @return string|void Title when retrieving. 1414 1438 */ 1415 function single_month_title( $prefix = '', $display = true ) {1439 function single_month_title( $prefix = '', $display = true ) { 1416 1440 global $wp_locale; 1417 1441 1418 $m = get_query_var('m');1419 $year = get_query_var('year');1420 $monthnum = get_query_var( 'monthnum');1421 1422 if ( ! empty($monthnum) && !empty($year) ) {1423 $my_year = $year;1424 $my_month = $wp_locale->get_month( $monthnum);1425 } elseif ( ! empty($m) ) {1426 $my_year = substr($m, 0, 4);1427 $my_month = $wp_locale->get_month( substr($m, 4, 2));1428 } 1429 1430 if ( empty( $my_month) )1442 $m = get_query_var( 'm' ); 1443 $year = get_query_var( 'year' ); 1444 $monthnum = get_query_var( 'monthnum' ); 1445 1446 if ( ! empty( $monthnum ) && ! empty( $year ) ) { 1447 $my_year = $year; 1448 $my_month = $wp_locale->get_month( $monthnum ); 1449 } elseif ( ! empty( $m ) ) { 1450 $my_year = substr( $m, 0, 4 ); 1451 $my_month = $wp_locale->get_month( substr( $m, 4, 2 ) ); 1452 } 1453 1454 if ( empty( $my_month ) ) { 1431 1455 return false; 1456 } 1432 1457 1433 1458 $result = $prefix . $my_month . $prefix . $my_year; 1434 1459 1435 if ( ! $display )1460 if ( ! $display ) { 1436 1461 return $result; 1462 } 1437 1463 echo $result; 1438 1464 } … … 1637 1663 * @return string HTML link content for archive. 1638 1664 */ 1639 function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '') {1640 $text = wptexturize( $text);1641 $url = esc_url($url);1642 1643 if ( 'link' == $format)1665 function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '' ) { 1666 $text = wptexturize( $text ); 1667 $url = esc_url( $url ); 1668 1669 if ( 'link' == $format ) { 1644 1670 $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; 1645 elseif ('option' == $format)1671 } elseif ( 'option' == $format ) { 1646 1672 $link_html = "\t<option value='$url'>$before $text $after</option>\n"; 1647 elseif ('html' == $format)1673 } elseif ( 'html' == $format ) { 1648 1674 $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; 1649 else// custom1675 } else { // custom 1650 1676 $link_html = "\t$before<a href='$url'>$text</a>$after\n"; 1677 } 1651 1678 1652 1679 /** … … 1705 1732 1706 1733 $defaults = array( 1707 'type' => 'monthly', 'limit' => '', 1708 'format' => 'html', 'before' => '', 1709 'after' => '', 'show_post_count' => false, 1710 'echo' => 1, 'order' => 'DESC', 1711 'post_type' => 'post' 1734 'type' => 'monthly', 1735 'limit' => '', 1736 'format' => 'html', 1737 'before' => '', 1738 'after' => '', 1739 'show_post_count' => false, 1740 'echo' => 1, 1741 'order' => 'DESC', 1742 'post_type' => 'post', 1712 1743 ); 1713 1744 … … 1767 1798 if ( 'monthly' == $r['type'] ) { 1768 1799 $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"; 1769 $key = md5( $query );1770 $key = "wp_get_archives:$key:$last_changed";1800 $key = md5( $query ); 1801 $key = "wp_get_archives:$key:$last_changed"; 1771 1802 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1772 1803 $results = $wpdb->get_results( $query ); … … 1790 1821 } elseif ( 'yearly' == $r['type'] ) { 1791 1822 $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"; 1792 $key = md5( $query );1793 $key = "wp_get_archives:$key:$last_changed";1823 $key = md5( $query ); 1824 $key = "wp_get_archives:$key:$last_changed"; 1794 1825 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1795 1826 $results = $wpdb->get_results( $query ); … … 1798 1829 if ( $results ) { 1799 1830 $after = $r['after']; 1800 foreach ( (array) $results as $result ) {1831 foreach ( (array) $results as $result ) { 1801 1832 $url = get_year_link( $result->year ); 1802 1833 if ( 'post' !== $r['post_type'] ) { … … 1812 1843 } elseif ( 'daily' == $r['type'] ) { 1813 1844 $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"; 1814 $key = md5( $query );1815 $key = "wp_get_archives:$key:$last_changed";1845 $key = md5( $query ); 1846 $key = "wp_get_archives:$key:$last_changed"; 1816 1847 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1817 1848 $results = $wpdb->get_results( $query ); … … 1821 1852 $after = $r['after']; 1822 1853 foreach ( (array) $results as $result ) { 1823 $url = get_day_link( $result->year, $result->month, $result->dayofmonth );1854 $url = get_day_link( $result->year, $result->month, $result->dayofmonth ); 1824 1855 if ( 'post' !== $r['post_type'] ) { 1825 1856 $url = add_query_arg( 'post_type', $r['post_type'], $url ); … … 1834 1865 } 1835 1866 } elseif ( 'weekly' == $r['type'] ) { 1836 $week = _wp_mysql_week( '`post_date`' );1867 $week = _wp_mysql_week( '`post_date`' ); 1837 1868 $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"; 1838 $key = md5( $query );1839 $key = "wp_get_archives:$key:$last_changed";1869 $key = md5( $query ); 1870 $key = "wp_get_archives:$key:$last_changed"; 1840 1871 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1841 1872 $results = $wpdb->get_results( $query ); … … 1852 1883 $arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] ); 1853 1884 $arc_week_end = date_i18n( get_option( 'date_format' ), $arc_week['end'] ); 1854 $url = add_query_arg( array( 'm' => $arc_year, 'w' => $result->week, ), home_url( '/' ) ); 1885 $url = add_query_arg( 1886 array( 1887 'm' => $arc_year, 1888 'w' => $result->week, 1889 ), home_url( '/' ) 1890 ); 1855 1891 if ( 'post' !== $r['post_type'] ) { 1856 1892 $url = add_query_arg( 'post_type', $r['post_type'], $url ); 1857 1893 } 1858 $text = $arc_week_start . $archive_week_separator . $arc_week_end;1894 $text = $arc_week_start . $archive_week_separator . $arc_week_end; 1859 1895 if ( $r['show_post_count'] ) { 1860 1896 $r['after'] = ' (' . $result->posts . ')' . $after; … … 1864 1900 } 1865 1901 } 1866 } elseif ( ( 'postbypost' == $r['type'] ) || ( 'alpha' == $r['type'] ) ) {1902 } elseif ( ( 'postbypost' == $r['type'] ) || ( 'alpha' == $r['type'] ) ) { 1867 1903 $orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC '; 1868 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";1869 $key = md5( $query );1870 $key = "wp_get_archives:$key:$last_changed";1904 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; 1905 $key = md5( $query ); 1906 $key = "wp_get_archives:$key:$last_changed"; 1871 1907 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1872 1908 $results = $wpdb->get_results( $query ); … … 1903 1939 * @return float Days since the start of the week. 1904 1940 */ 1905 function calendar_week_mod( $num) {1941 function calendar_week_mod( $num ) { 1906 1942 $base = 7; 1907 return ( $num - $base*floor($num/$base));1943 return ( $num - $base * floor( $num / $base ) ); 1908 1944 } 1909 1945 … … 1930 1966 global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; 1931 1967 1932 $key = md5( $m . $monthnum . $year );1968 $key = md5( $m . $monthnum . $year ); 1933 1969 $cache = wp_cache_get( 'get_calendar', 'calendar' ); 1934 1970 … … 1951 1987 // Quick check. If we have no posts at all, abort! 1952 1988 if ( ! $posts ) { 1953 $gotsome = $wpdb->get_var( "SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");1989 $gotsome = $wpdb->get_var( "SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" ); 1954 1990 if ( ! $gotsome ) { 1955 1991 $cache[ $key ] = ''; … … 1964 2000 // week_begins = 0 stands for Sunday 1965 2001 $week_begins = (int) get_option( 'start_of_week' ); 1966 $ts = current_time( 'timestamp' );2002 $ts = current_time( 'timestamp' ); 1967 2003 1968 2004 // Let's figure out when we are 1969 2005 if ( ! empty( $monthnum ) && ! empty( $year ) ) { 1970 2006 $thismonth = zeroise( intval( $monthnum ), 2 ); 1971 $thisyear = (int) $year;2007 $thisyear = (int) $year; 1972 2008 } elseif ( ! empty( $w ) ) { 1973 2009 // We need to get the month from MySQL 1974 2010 $thisyear = (int) substr( $m, 0, 4 ); 1975 2011 //it seems MySQL's weeks disagree with PHP's 1976 $d = ( ( $w - 1 ) * 7 ) + 6;1977 $thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");2012 $d = ( ( $w - 1 ) * 7 ) + 6; 2013 $thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" ); 1978 2014 } elseif ( ! empty( $m ) ) { 1979 2015 $thisyear = (int) substr( $m, 0, 4 ); … … 1984 2020 } 1985 2021 } else { 1986 $thisyear = gmdate( 'Y', $ts );2022 $thisyear = gmdate( 'Y', $ts ); 1987 2023 $thismonth = gmdate( 'm', $ts ); 1988 2024 } 1989 2025 1990 $unixmonth = mktime( 0, 0 , 0, $thismonth, 1, $thisyear );1991 $last_day = date( 't', $unixmonth );2026 $unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear ); 2027 $last_day = date( 't', $unixmonth ); 1992 2028 1993 2029 // Get the next and previous month and year with at least one post 1994 $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 2030 $previous = $wpdb->get_row( 2031 "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 1995 2032 FROM $wpdb->posts 1996 2033 WHERE post_date < '$thisyear-$thismonth-01' 1997 2034 AND post_type = 'post' AND post_status = 'publish' 1998 2035 ORDER BY post_date DESC 1999 LIMIT 1"); 2000 $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 2036 LIMIT 1" 2037 ); 2038 $next = $wpdb->get_row( 2039 "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year 2001 2040 FROM $wpdb->posts 2002 2041 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' 2003 2042 AND post_type = 'post' AND post_status = 'publish' 2004 2043 ORDER BY post_date ASC 2005 LIMIT 1"); 2044 LIMIT 1" 2045 ); 2006 2046 2007 2047 /* translators: Calendar caption: 1: month name, 2: 4-digit year */ 2008 $calendar_caption = _x( '%1$s %2$s', 'calendar caption');2009 $calendar_output = '<table id="wp-calendar">2048 $calendar_caption = _x( '%1$s %2$s', 'calendar caption' ); 2049 $calendar_output = '<table id="wp-calendar"> 2010 2050 <caption>' . sprintf( 2011 2051 $calendar_caption, … … 2023 2063 2024 2064 foreach ( $myweek as $wd ) { 2025 $day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );2026 $wd = esc_attr( $wd );2065 $day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd ); 2066 $wd = esc_attr( $wd ); 2027 2067 $calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>"; 2028 2068 } … … 2036 2076 2037 2077 if ( $previous ) { 2038 $calendar_output .= "\n\t\t" .'<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">« ' .2078 $calendar_output .= "\n\t\t" . '<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">« ' . 2039 2079 $wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) . 2040 2080 '</a></td>'; 2041 2081 } else { 2042 $calendar_output .= "\n\t\t" .'<td colspan="3" id="prev" class="pad"> </td>';2043 } 2044 2045 $calendar_output .= "\n\t\t" .'<td class="pad"> </td>';2082 $calendar_output .= "\n\t\t" . '<td colspan="3" id="prev" class="pad"> </td>'; 2083 } 2084 2085 $calendar_output .= "\n\t\t" . '<td class="pad"> </td>'; 2046 2086 2047 2087 if ( $next ) { 2048 $calendar_output .= "\n\t\t" .'<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .2088 $calendar_output .= "\n\t\t" . '<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' . 2049 2089 $wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) . 2050 2090 ' »</a></td>'; 2051 2091 } else { 2052 $calendar_output .= "\n\t\t" .'<td colspan="3" id="next" class="pad"> </td>';2092 $calendar_output .= "\n\t\t" . '<td colspan="3" id="next" class="pad"> </td>'; 2053 2093 } 2054 2094 … … 2063 2103 2064 2104 // Get days with posts 2065 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 2105 $dayswithposts = $wpdb->get_results( 2106 "SELECT DISTINCT DAYOFMONTH(post_date) 2066 2107 FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' 2067 2108 AND post_type = 'post' AND post_status = 'publish' 2068 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N); 2109 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N 2110 ); 2069 2111 if ( $dayswithposts ) { 2070 2112 foreach ( (array) $dayswithposts as $daywith ) { … … 2076 2118 $pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins ); 2077 2119 if ( 0 != $pad ) { 2078 $calendar_output .= "\n\t\t" .'<td colspan="'. esc_attr( $pad ) .'" class="pad"> </td>';2079 } 2080 2081 $newrow = false;2120 $calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr( $pad ) . '" class="pad"> </td>'; 2121 } 2122 2123 $newrow = false; 2082 2124 $daysinmonth = (int) date( 't', $unixmonth ); 2083 2125 2084 2126 for ( $day = 1; $day <= $daysinmonth; ++$day ) { 2085 if ( isset( $newrow) && $newrow ) {2127 if ( isset( $newrow ) && $newrow ) { 2086 2128 $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t"; 2087 2129 } … … 2100 2142 $date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); 2101 2143 /* translators: Post calendar label. 1: Date */ 2102 $label = sprintf( __( 'Posts published on %s' ), $date_format );2144 $label = sprintf( __( 'Posts published on %s' ), $date_format ); 2103 2145 $calendar_output .= sprintf( 2104 2146 '<a href="%s" aria-label="%s">%s</a>', … … 2112 2154 $calendar_output .= '</td>'; 2113 2155 2114 if ( 6 == calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {2156 if ( 6 == calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) { 2115 2157 $newrow = true; 2116 2158 } 2117 2159 } 2118 2160 2119 $pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins );2161 $pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); 2120 2162 if ( $pad != 0 && $pad != 7 ) { 2121 $calendar_output .= "\n\t\t" .'<td class="pad" colspan="'. esc_attr( $pad ) .'"> </td>';2163 $calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '"> </td>'; 2122 2164 } 2123 2165 $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>"; … … 2167 2209 $allowed = ''; 2168 2210 foreach ( (array) $allowedtags as $tag => $attributes ) { 2169 $allowed .= '<' .$tag;2170 if ( 0 < count( $attributes) ) {2211 $allowed .= '<' . $tag; 2212 if ( 0 < count( $attributes ) ) { 2171 2213 foreach ( $attributes as $attribute => $limits ) { 2172 $allowed .= ' ' .$attribute.'=""';2214 $allowed .= ' ' . $attribute . '=""'; 2173 2215 } 2174 2216 } … … 2178 2220 } 2179 2221 2180 /***** Date/Time tags * ****/2222 /***** Date/Time tags */ 2181 2223 2182 2224 /** … … 2216 2258 2217 2259 if ( is_new_day() ) { 2218 $the_date = $before . get_the_date( $d ) . $after;2260 $the_date = $before . get_the_date( $d ) . $after; 2219 2261 $previousday = $currentday; 2220 2262 … … 2232 2274 $the_date = apply_filters( 'the_date', $the_date, $d, $before, $after ); 2233 2275 2234 if ( $echo ) 2276 if ( $echo ) { 2235 2277 echo $the_date; 2236 else2278 } else { 2237 2279 return $the_date; 2280 } 2238 2281 } 2239 2282 } … … 2289 2332 */ 2290 2333 function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) { 2291 $the_modified_date = $before . get_the_modified_date( $d) . $after;2334 $the_modified_date = $before . get_the_modified_date( $d ) . $after; 2292 2335 2293 2336 /** … … 2304 2347 $the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after ); 2305 2348 2306 if ( $echo ) 2349 if ( $echo ) { 2307 2350 echo $the_modified_date; 2308 else2351 } else { 2309 2352 return $the_modified_date; 2353 } 2310 2354 2311 2355 } … … 2379 2423 */ 2380 2424 function get_the_time( $d = '', $post = null ) { 2381 $post = get_post( $post);2425 $post = get_post( $post ); 2382 2426 2383 2427 if ( ! $post ) { … … 2385 2429 } 2386 2430 2387 if ( '' == $d ) 2388 $the_time = get_post_time(get_option('time_format'), false, $post, true); 2389 else 2390 $the_time = get_post_time($d, false, $post, true); 2431 if ( '' == $d ) { 2432 $the_time = get_post_time( get_option( 'time_format' ), false, $post, true ); 2433 } else { 2434 $the_time = get_post_time( $d, false, $post, true ); 2435 } 2391 2436 2392 2437 /** … … 2417 2462 */ 2418 2463 function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { 2419 $post = get_post( $post);2464 $post = get_post( $post ); 2420 2465 2421 2466 if ( ! $post ) { … … 2423 2468 } 2424 2469 2425 if ( $gmt ) 2470 if ( $gmt ) { 2426 2471 $time = $post->post_date_gmt; 2427 else2472 } else { 2428 2473 $time = $post->post_date; 2429 2430 $time = mysql2date($d, $time, $translate); 2474 } 2475 2476 $time = mysql2date( $d, $time, $translate ); 2431 2477 2432 2478 /** … … 2450 2496 * @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option. 2451 2497 */ 2452 function the_modified_time( $d = '') {2498 function the_modified_time( $d = '' ) { 2453 2499 /** 2454 2500 * Filters the localized time a post was last modified, for display. … … 2461 2507 * specified in 'time_format' option. 2462 2508 */ 2463 echo apply_filters( 'the_modified_time', get_the_modified_time( $d), $d );2509 echo apply_filters( 'the_modified_time', get_the_modified_time( $d ), $d ); 2464 2510 } 2465 2511 … … 2516 2562 */ 2517 2563 function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { 2518 $post = get_post( $post);2564 $post = get_post( $post ); 2519 2565 2520 2566 if ( ! $post ) { … … 2522 2568 } 2523 2569 2524 if ( $gmt ) 2570 if ( $gmt ) { 2525 2571 $time = $post->post_modified_gmt; 2526 else2572 } else { 2527 2573 $time = $post->post_modified; 2528 $time = mysql2date($d, $time, $translate); 2574 } 2575 $time = mysql2date( $d, $time, $translate ); 2529 2576 2530 2577 /** … … 2576 2623 * @param string $after Optional Output after the date. 2577 2624 */ 2578 function the_weekday_date( $before='',$after='') {2625 function the_weekday_date( $before = '', $after = '' ) { 2579 2626 global $wp_locale, $currentday, $previousweekday; 2580 2627 $the_weekday_date = ''; … … 2583 2630 $the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) ); 2584 2631 $the_weekday_date .= $after; 2585 $previousweekday = $currentday;2632 $previousweekday = $currentday; 2586 2633 } 2587 2634 … … 2639 2686 */ 2640 2687 function feed_links( $args = array() ) { 2641 if ( ! current_theme_supports('automatic-feed-links') )2688 if ( ! current_theme_supports( 'automatic-feed-links' ) ) { 2642 2689 return; 2690 } 2643 2691 2644 2692 $defaults = array( 2645 2693 /* translators: Separator between blog name and feed type in feed links */ 2646 'separator' => _x('»', 'feed link'),2694 'separator' => _x( '»', 'feed link' ), 2647 2695 /* translators: 1: blog title, 2: separator (raquo) */ 2648 'feedtitle' => __('%1$s %2$s Feed'),2696 'feedtitle' => __( '%1$s %2$s Feed' ), 2649 2697 /* translators: 1: blog title, 2: separator (raquo) */ 2650 'comstitle' => __('%1$s %2$s Comments Feed'),2698 'comstitle' => __( '%1$s %2$s Comments Feed' ), 2651 2699 ); 2652 2700 … … 2686 2734 $defaults = array( 2687 2735 /* translators: Separator between blog name and feed type in feed links */ 2688 'separator' => _x('»', 'feed link'),2736 'separator' => _x( '»', 'feed link' ), 2689 2737 /* translators: 1: blog name, 2: separator(raquo), 3: post title */ 2690 'singletitle' => __('%1$s %2$s %3$s Comments Feed'),2738 'singletitle' => __( '%1$s %2$s %3$s Comments Feed' ), 2691 2739 /* translators: 1: blog name, 2: separator(raquo), 3: category name */ 2692 'cattitle' => __('%1$s %2$s %3$s Category Feed'),2740 'cattitle' => __( '%1$s %2$s %3$s Category Feed' ), 2693 2741 /* translators: 1: blog name, 2: separator(raquo), 3: tag name */ 2694 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'),2742 'tagtitle' => __( '%1$s %2$s %3$s Tag Feed' ), 2695 2743 /* translators: 1: blog name, 2: separator(raquo), 3: term name, 4: taxonomy singular name */ 2696 'taxtitle' => __('%1$s %2$s %3$s %4$s Feed'),2744 'taxtitle' => __( '%1$s %2$s %3$s %4$s Feed' ), 2697 2745 /* translators: 1: blog name, 2: separator(raquo), 3: author name */ 2698 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),2746 'authortitle' => __( '%1$s %2$s Posts by %3$s Feed' ), 2699 2747 /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */ 2700 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'),2748 'searchtitle' => __( '%1$s %2$s Search Results for “%3$s” Feed' ), 2701 2749 /* translators: 1: blog name, 2: separator(raquo), 3: post type name */ 2702 'posttypetitle' => __( '%1$s %2$s %3$s Feed'),2750 'posttypetitle' => __( '%1$s %2$s %3$s Feed' ), 2703 2751 ); 2704 2752 … … 2706 2754 2707 2755 if ( is_singular() ) { 2708 $id = 0;2756 $id = 0; 2709 2757 $post = get_post( $id ); 2710 2758 2711 2759 if ( comments_open() || pings_open() || $post->comment_count > 0 ) { 2712 $title = sprintf( $args['singletitle'], get_bloginfo( 'name'), $args['separator'], the_title_attribute( array( 'echo' => false ) ) );2713 $href = get_post_comments_feed_link( $post->ID );2760 $title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) ); 2761 $href = get_post_comments_feed_link( $post->ID ); 2714 2762 } 2715 2763 } elseif ( is_post_type_archive() ) { 2716 2764 $post_type = get_query_var( 'post_type' ); 2717 if ( is_array( $post_type ) ) 2765 if ( is_array( $post_type ) ) { 2718 2766 $post_type = reset( $post_type ); 2767 } 2719 2768 2720 2769 $post_type_obj = get_post_type_object( $post_type ); 2721 $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name );2722 $href = get_post_type_archive_feed_link( $post_type_obj->name );2770 $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name ); 2771 $href = get_post_type_archive_feed_link( $post_type_obj->name ); 2723 2772 } elseif ( is_category() ) { 2724 2773 $term = get_queried_object(); 2725 2774 2726 2775 if ( $term ) { 2727 $title = sprintf( $args['cattitle'], get_bloginfo( 'name'), $args['separator'], $term->name );2728 $href = get_category_feed_link( $term->term_id );2776 $title = sprintf( $args['cattitle'], get_bloginfo( 'name' ), $args['separator'], $term->name ); 2777 $href = get_category_feed_link( $term->term_id ); 2729 2778 } 2730 2779 } elseif ( is_tag() ) { … … 2732 2781 2733 2782 if ( $term ) { 2734 $title = sprintf( $args['tagtitle'], get_bloginfo( 'name'), $args['separator'], $term->name );2735 $href = get_tag_feed_link( $term->term_id );2783 $title = sprintf( $args['tagtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name ); 2784 $href = get_tag_feed_link( $term->term_id ); 2736 2785 } 2737 2786 } elseif ( is_tax() ) { 2738 $term= get_queried_object();2739 $tax= get_taxonomy( $term->taxonomy );2740 $title = sprintf( $args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name );2741 $href= get_term_feed_link( $term->term_id, $term->taxonomy );2787 $term = get_queried_object(); 2788 $tax = get_taxonomy( $term->taxonomy ); 2789 $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name ); 2790 $href = get_term_feed_link( $term->term_id, $term->taxonomy ); 2742 2791 } elseif ( is_author() ) { 2743 $author_id = intval( get_query_var( 'author') );2744 2745 $title = sprintf( $args['authortitle'], get_bloginfo( 'name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) );2746 $href = get_author_feed_link( $author_id );2792 $author_id = intval( get_query_var( 'author' ) ); 2793 2794 $title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); 2795 $href = get_author_feed_link( $author_id ); 2747 2796 } elseif ( is_search() ) { 2748 $title = sprintf( $args['searchtitle'], get_bloginfo( 'name'), $args['separator'], get_search_query( false ) );2749 $href = get_search_feed_link();2797 $title = sprintf( $args['searchtitle'], get_bloginfo( 'name' ), $args['separator'], get_search_query( false ) ); 2798 $href = get_search_feed_link(); 2750 2799 } elseif ( is_post_type_archive() ) { 2751 $title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) );2800 $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], post_type_archive_title( '', false ) ); 2752 2801 $post_type_obj = get_queried_object(); 2753 if ( $post_type_obj ) 2802 if ( $post_type_obj ) { 2754 2803 $href = get_post_type_archive_feed_link( $post_type_obj->name ); 2755 } 2756 2757 if ( isset($title) && isset($href) ) 2804 } 2805 } 2806 2807 if ( isset( $title ) && isset( $href ) ) { 2758 2808 echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; 2809 } 2759 2810 } 2760 2811 … … 2797 2848 function noindex() { 2798 2849 // If the blog is not public, tell robots to go away. 2799 if ( '0' == get_option( 'blog_public') )2850 if ( '0' == get_option( 'blog_public' ) ) { 2800 2851 wp_no_robots(); 2852 } 2801 2853 } 2802 2854 … … 2826 2878 2827 2879 $meta_tags = array(); 2828 $icon_32 = get_site_icon_url( 32 );2880 $icon_32 = get_site_icon_url( 32 ); 2829 2881 if ( empty( $icon_32 ) && is_customize_preview() ) { 2830 2882 $icon_32 = '/favicon.ico'; // Serve default favicon URL in customizer so element can be updated for preview. … … 2938 2990 } 2939 2991 2940 $atts['rel'] = $relation_type;2992 $atts['rel'] = $relation_type; 2941 2993 $atts['href'] = $url; 2942 2994 … … 2949 3001 foreach ( $atts as $attr => $value ) { 2950 3002 if ( ! is_scalar( $value ) || 2951 ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ) ) ) {3003 ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ) ) ) { 2952 3004 2953 3005 continue; … … 3023 3075 global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge; 3024 3076 3025 if ( ! isset($wp_rich_edit) ) {3077 if ( ! isset( $wp_rich_edit ) ) { 3026 3078 $wp_rich_edit = false; 3027 3079 … … 3031 3083 } elseif ( $is_IE ) { 3032 3084 $wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE ' ) === false ); 3033 } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) {3085 } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) { 3034 3086 $wp_rich_edit = true; 3035 3087 } … … 3060 3112 $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults 3061 3113 if ( wp_get_current_user() ) { // look for cookie 3062 $ed = get_user_setting( 'editor', 'tinymce');3063 $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;3114 $ed = get_user_setting( 'editor', 'tinymce' ); 3115 $r = ( in_array( $ed, array( 'tinymce', 'html', 'test' ) ) ) ? $ed : $r; 3064 3116 } 3065 3117 … … 3094 3146 */ 3095 3147 function wp_editor( $content, $editor_id, $settings = array() ) { 3096 if ( ! class_exists( '_WP_Editors', false ) ) 3148 if ( ! class_exists( '_WP_Editors', false ) ) { 3097 3149 require( ABSPATH . WPINC . '/class-wp-editor.php' ); 3098 _WP_Editors::editor($content, $editor_id, $settings); 3150 } 3151 _WP_Editors::editor( $content, $editor_id, $settings ); 3099 3152 } 3100 3153 … … 3144 3197 $settings = array( 3145 3198 'codemirror' => array( 3146 'indentUnit' => 4,3147 'indentWithTabs' => true,3148 'inputStyle' => 'contenteditable',3149 'lineNumbers' => true,3150 'lineWrapping' => true,3151 'styleActiveLine' => true,3199 'indentUnit' => 4, 3200 'indentWithTabs' => true, 3201 'inputStyle' => 'contenteditable', 3202 'lineNumbers' => true, 3203 'lineWrapping' => true, 3204 'styleActiveLine' => true, 3152 3205 'continueComments' => true, 3153 'extraKeys' => array(3206 'extraKeys' => array( 3154 3207 'Ctrl-Space' => 'autocomplete', 3155 'Ctrl-/' => 'toggleComment',3156 'Cmd-/' => 'toggleComment',3157 'Alt-F' => 'findPersistent',3208 'Ctrl-/' => 'toggleComment', 3209 'Cmd-/' => 'toggleComment', 3210 'Alt-F' => 'findPersistent', 3158 3211 ), 3159 'direction' => 'ltr', // Code is shown in LTR even in RTL languages.3160 'gutters' => array(),3212 'direction' => 'ltr', // Code is shown in LTR even in RTL languages. 3213 'gutters' => array(), 3161 3214 ), 3162 'csslint' => array(3163 'errors' => true, // Parsing errors.3164 'box-model' => true,3215 'csslint' => array( 3216 'errors' => true, // Parsing errors. 3217 'box-model' => true, 3165 3218 'display-property-grouping' => true, 3166 'duplicate-properties' => true,3167 'known-properties' => true,3168 'outline-none' => true,3219 'duplicate-properties' => true, 3220 'known-properties' => true, 3221 'outline-none' => true, 3169 3222 ), 3170 'jshint' => array(3223 'jshint' => array( 3171 3224 // The following are copied from <https://github.com/WordPress/wordpress-develop/blob/4.8.1/.jshintrc>. 3172 'boss' => true,3173 'curly' => true,3174 'eqeqeq' => true,3175 'eqnull' => true,3176 'es3' => true,3177 'expr' => true,3178 'immed' => true,3179 'noarg' => true,3180 'nonbsp' => true,3181 'onevar' => true,3225 'boss' => true, 3226 'curly' => true, 3227 'eqeqeq' => true, 3228 'eqnull' => true, 3229 'es3' => true, 3230 'expr' => true, 3231 'immed' => true, 3232 'noarg' => true, 3233 'nonbsp' => true, 3234 'onevar' => true, 3182 3235 'quotmark' => 'single', 3183 3236 'trailing' => true, 3184 'undef' => true,3185 'unused' => true,3186 3187 'browser' => true,3188 3189 'globals' => array(3190 '_' => false,3237 'undef' => true, 3238 'unused' => true, 3239 3240 'browser' => true, 3241 3242 'globals' => array( 3243 '_' => false, 3191 3244 'Backbone' => false, 3192 'jQuery' => false,3193 'JSON' => false,3194 'wp' => false,3245 'jQuery' => false, 3246 'JSON' => false, 3247 'wp' => false, 3195 3248 ), 3196 3249 ), 3197 'htmlhint' => array(3198 'tagname-lowercase' => true,3199 'attr-lowercase' => true,3250 'htmlhint' => array( 3251 'tagname-lowercase' => true, 3252 'attr-lowercase' => true, 3200 3253 'attr-value-double-quotes' => true, 3201 'doctype-first' => false,3202 'tag-pair' => true,3203 'spec-char-escape' => true,3204 'id-unique' => true,3205 'src-not-empty' => true,3206 'attr-no-duplication' => true,3207 'alt-require' => true,3254 'doctype-first' => false, 3255 'tag-pair' => true, 3256 'spec-char-escape' => true, 3257 'id-unique' => true, 3258 'src-not-empty' => true, 3259 'attr-no-duplication' => true, 3260 'alt-require' => true, 3208 3261 'space-tab-mixed-disabled' => 'tab', 3209 'attr-unsafe-chars' => true,3262 'attr-unsafe-chars' => true, 3210 3263 ), 3211 3264 ); … … 3304 3357 3305 3358 if ( 'text/css' === $type ) { 3306 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3307 'mode' => 'css', 3308 'lint' => true, 3309 'autoCloseBrackets' => true, 3310 'matchBrackets' => true, 3311 ) ); 3359 $settings['codemirror'] = array_merge( 3360 $settings['codemirror'], array( 3361 'mode' => 'css', 3362 'lint' => true, 3363 'autoCloseBrackets' => true, 3364 'matchBrackets' => true, 3365 ) 3366 ); 3312 3367 } elseif ( 'text/x-scss' === $type || 'text/x-less' === $type || 'text/x-sass' === $type ) { 3313 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3314 'mode' => $type, 3315 'lint' => false, 3316 'autoCloseBrackets' => true, 3317 'matchBrackets' => true, 3318 ) ); 3368 $settings['codemirror'] = array_merge( 3369 $settings['codemirror'], array( 3370 'mode' => $type, 3371 'lint' => false, 3372 'autoCloseBrackets' => true, 3373 'matchBrackets' => true, 3374 ) 3375 ); 3319 3376 } elseif ( 'text/x-diff' === $type ) { 3320 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3321 'mode' => 'diff', 3322 ) ); 3377 $settings['codemirror'] = array_merge( 3378 $settings['codemirror'], array( 3379 'mode' => 'diff', 3380 ) 3381 ); 3323 3382 } elseif ( 'text/html' === $type ) { 3324 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3325 'mode' => 'htmlmixed', 3326 'lint' => true, 3327 'autoCloseBrackets' => true, 3328 'autoCloseTags' => true, 3329 'matchTags' => array( 3330 'bothTags' => true, 3331 ), 3332 ) ); 3383 $settings['codemirror'] = array_merge( 3384 $settings['codemirror'], array( 3385 'mode' => 'htmlmixed', 3386 'lint' => true, 3387 'autoCloseBrackets' => true, 3388 'autoCloseTags' => true, 3389 'matchTags' => array( 3390 'bothTags' => true, 3391 ), 3392 ) 3393 ); 3333 3394 3334 3395 if ( ! current_user_can( 'unfiltered_html' ) ) { … … 3336 3397 } 3337 3398 } elseif ( 'text/x-gfm' === $type ) { 3338 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3339 'mode' => 'gfm', 3340 'highlightFormatting' => true, 3341 ) ); 3399 $settings['codemirror'] = array_merge( 3400 $settings['codemirror'], array( 3401 'mode' => 'gfm', 3402 'highlightFormatting' => true, 3403 ) 3404 ); 3342 3405 } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) { 3343 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3344 'mode' => 'javascript', 3345 'lint' => true, 3346 'autoCloseBrackets' => true, 3347 'matchBrackets' => true, 3348 ) ); 3406 $settings['codemirror'] = array_merge( 3407 $settings['codemirror'], array( 3408 'mode' => 'javascript', 3409 'lint' => true, 3410 'autoCloseBrackets' => true, 3411 'matchBrackets' => true, 3412 ) 3413 ); 3349 3414 } elseif ( false !== strpos( $type, 'json' ) ) { 3350 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3351 'mode' => array( 3352 'name' => 'javascript', 3353 ), 3354 'lint' => true, 3355 'autoCloseBrackets' => true, 3356 'matchBrackets' => true, 3357 ) ); 3415 $settings['codemirror'] = array_merge( 3416 $settings['codemirror'], array( 3417 'mode' => array( 3418 'name' => 'javascript', 3419 ), 3420 'lint' => true, 3421 'autoCloseBrackets' => true, 3422 'matchBrackets' => true, 3423 ) 3424 ); 3358 3425 if ( 'application/ld+json' === $type ) { 3359 3426 $settings['codemirror']['mode']['jsonld'] = true; … … 3362 3429 } 3363 3430 } elseif ( false !== strpos( $type, 'jsx' ) ) { 3364 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3365 'mode' => 'jsx', 3366 'autoCloseBrackets' => true, 3367 'matchBrackets' => true, 3368 ) ); 3431 $settings['codemirror'] = array_merge( 3432 $settings['codemirror'], array( 3433 'mode' => 'jsx', 3434 'autoCloseBrackets' => true, 3435 'matchBrackets' => true, 3436 ) 3437 ); 3369 3438 } elseif ( 'text/x-markdown' === $type ) { 3370 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3371 'mode' => 'markdown', 3372 'highlightFormatting' => true, 3373 ) ); 3439 $settings['codemirror'] = array_merge( 3440 $settings['codemirror'], array( 3441 'mode' => 'markdown', 3442 'highlightFormatting' => true, 3443 ) 3444 ); 3374 3445 } elseif ( 'text/nginx' === $type ) { 3375 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3376 'mode' => 'nginx', 3377 ) ); 3446 $settings['codemirror'] = array_merge( 3447 $settings['codemirror'], array( 3448 'mode' => 'nginx', 3449 ) 3450 ); 3378 3451 } elseif ( 'application/x-httpd-php' === $type ) { 3379 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3380 'mode' => 'php', 3381 'autoCloseBrackets' => true, 3382 'autoCloseTags' => true, 3383 'matchBrackets' => true, 3384 'matchTags' => array( 3385 'bothTags' => true, 3386 ), 3387 ) ); 3452 $settings['codemirror'] = array_merge( 3453 $settings['codemirror'], array( 3454 'mode' => 'php', 3455 'autoCloseBrackets' => true, 3456 'autoCloseTags' => true, 3457 'matchBrackets' => true, 3458 'matchTags' => array( 3459 'bothTags' => true, 3460 ), 3461 ) 3462 ); 3388 3463 } elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) { 3389 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3390 'mode' => 'sql', 3391 'autoCloseBrackets' => true, 3392 'matchBrackets' => true, 3393 ) ); 3464 $settings['codemirror'] = array_merge( 3465 $settings['codemirror'], array( 3466 'mode' => 'sql', 3467 'autoCloseBrackets' => true, 3468 'matchBrackets' => true, 3469 ) 3470 ); 3394 3471 } elseif ( false !== strpos( $type, 'xml' ) ) { 3395 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3396 'mode' => 'xml', 3397 'autoCloseBrackets' => true, 3398 'autoCloseTags' => true, 3399 'matchTags' => array( 3400 'bothTags' => true, 3401 ), 3402 ) ); 3472 $settings['codemirror'] = array_merge( 3473 $settings['codemirror'], array( 3474 'mode' => 'xml', 3475 'autoCloseBrackets' => true, 3476 'autoCloseTags' => true, 3477 'matchTags' => array( 3478 'bothTags' => true, 3479 ), 3480 ) 3481 ); 3403 3482 } elseif ( 'text/x-yaml' === $type ) { 3404 $settings['codemirror'] = array_merge( $settings['codemirror'], array( 3405 'mode' => 'yaml', 3406 ) ); 3483 $settings['codemirror'] = array_merge( 3484 $settings['codemirror'], array( 3485 'mode' => 'yaml', 3486 ) 3487 ); 3407 3488 } else { 3408 3489 $settings['codemirror']['mode'] = $type; … … 3516 3597 * 3517 3598 * @param bool $escaped Whether the result is escaped. Default true. 3518 * Only use when you are later escaping it. Do not use unescaped.3599 * Only use when you are later escaping it. Do not use unescaped. 3519 3600 * @return string 3520 3601 */ … … 3529 3610 $query = apply_filters( 'get_search_query', get_query_var( 's' ) ); 3530 3611 3531 if ( $escaped ) 3612 if ( $escaped ) { 3532 3613 $query = esc_attr( $query ); 3614 } 3533 3615 return $query; 3534 3616 } … … 3566 3648 $attributes = array(); 3567 3649 3568 if ( function_exists( 'is_rtl' ) && is_rtl() ) 3650 if ( function_exists( 'is_rtl' ) && is_rtl() ) { 3569 3651 $attributes[] = 'dir="rtl"'; 3652 } 3570 3653 3571 3654 if ( $lang = get_bloginfo( 'language' ) ) { … … 3579 3662 } 3580 3663 3581 $output = implode( ' ', $attributes);3664 $output = implode( ' ', $attributes ); 3582 3665 3583 3666 /** … … 3732 3815 if ( isset( $url_parts[1] ) ) { 3733 3816 // Find the format argument. 3734 $format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) );3817 $format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) ); 3735 3818 $format_query = isset( $format[1] ) ? $format[1] : ''; 3736 3819 wp_parse_str( $format_query, $format_args ); … … 3761 3844 $mid_size = 2; 3762 3845 } 3763 $add_args = $args['add_args'];3764 $r = '';3846 $add_args = $args['add_args']; 3847 $r = ''; 3765 3848 $page_links = array(); 3766 $dots = false;3849 $dots = false; 3767 3850 3768 3851 if ( $args['prev_next'] && $current && 1 < $current ) : 3769 3852 $link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] ); 3770 3853 $link = str_replace( '%#%', $current - 1, $link ); 3771 if ( $add_args ) 3854 if ( $add_args ) { 3772 3855 $link = add_query_arg( $add_args, $link ); 3856 } 3773 3857 $link .= $args['add_fragment']; 3774 3858 … … 3784 3868 for ( $n = 1; $n <= $total; $n++ ) : 3785 3869 if ( $n == $current ) : 3786 $page_links[] = "<span aria-current='" . esc_attr( $args['aria_current'] ) . "' class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>";3787 $dots = true;3870 $page_links[] = "<span aria-current='" . esc_attr( $args['aria_current'] ) . "' class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . '</span>'; 3871 $dots = true; 3788 3872 else : 3789 3873 if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : 3790 3874 $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); 3791 3875 $link = str_replace( '%#%', $n, $link ); 3792 if ( $add_args ) 3876 if ( $add_args ) { 3793 3877 $link = add_query_arg( $add_args, $link ); 3878 } 3794 3879 $link .= $args['add_fragment']; 3795 3880 3796 3881 /** This filter is documented in wp-includes/general-template.php */ 3797 $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</a>";3798 $dots = true;3882 $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . '</a>'; 3883 $dots = true; 3799 3884 elseif ( $dots && ! $args['show_all'] ) : 3800 3885 $page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>'; 3801 $dots = false;3886 $dots = false; 3802 3887 endif; 3803 3888 endif; … … 3806 3891 $link = str_replace( '%_%', $args['format'], $args['base'] ); 3807 3892 $link = str_replace( '%#%', $current + 1, $link ); 3808 if ( $add_args ) 3893 if ( $add_args ) { 3809 3894 $link = add_query_arg( $add_args, $link ); 3895 } 3810 3896 $link .= $args['add_fragment']; 3811 3897 … … 3814 3900 endif; 3815 3901 switch ( $args['type'] ) { 3816 case 'array' :3902 case 'array': 3817 3903 return $page_links; 3818 3904 3819 case 'list' :3905 case 'list': 3820 3906 $r .= "<ul class='page-numbers'>\n\t<li>"; 3821 $r .= join( "</li>\n\t<li>", $page_links);3907 $r .= join( "</li>\n\t<li>", $page_links ); 3822 3908 $r .= "</li>\n</ul>\n"; 3823 3909 break; 3824 3910 3825 default :3826 $r = join( "\n", $page_links);3911 default: 3912 $r = join( "\n", $page_links ); 3827 3913 break; 3828 3914 } … … 3859 3945 global $_wp_admin_css_colors; 3860 3946 3861 if ( ! isset($_wp_admin_css_colors) )3947 if ( ! isset( $_wp_admin_css_colors ) ) { 3862 3948 $_wp_admin_css_colors = array(); 3863 3864 $_wp_admin_css_colors[$key] = (object) array( 3865 'name' => $name, 3866 'url' => $url, 3867 'colors' => $colors, 3949 } 3950 3951 $_wp_admin_css_colors[ $key ] = (object) array( 3952 'name' => $name, 3953 'url' => $url, 3954 'colors' => $colors, 3868 3955 'icon_colors' => $icons, 3869 3956 ); … … 3876 3963 */ 3877 3964 function register_admin_color_schemes() { 3878 $suffix = is_rtl() ? '-rtl' : '';3965 $suffix = is_rtl() ? '-rtl' : ''; 3879 3966 $suffix .= SCRIPT_DEBUG ? '' : '.min'; 3880 3967 3881 wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ), 3968 wp_admin_css_color( 3969 'fresh', _x( 'Default', 'admin color scheme' ), 3882 3970 false, 3883 3971 array( '#222', '#333', '#0073aa', '#00a0d2' ), 3884 array( 'base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff' ) 3972 array( 3973 'base' => '#82878c', 3974 'focus' => '#00a0d2', 3975 'current' => '#fff', 3976 ) 3885 3977 ); 3886 3978 … … 3890 3982 } 3891 3983 3892 wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ), 3984 wp_admin_css_color( 3985 'light', _x( 'Light', 'admin color scheme' ), 3893 3986 admin_url( "css/colors/light/colors$suffix.css" ), 3894 3987 array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ), 3895 array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc' ) 3988 array( 3989 'base' => '#999', 3990 'focus' => '#ccc', 3991 'current' => '#ccc', 3992 ) 3896 3993 ); 3897 3994 3898 wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ), 3995 wp_admin_css_color( 3996 'blue', _x( 'Blue', 'admin color scheme' ), 3899 3997 admin_url( "css/colors/blue/colors$suffix.css" ), 3900 3998 array( '#096484', '#4796b3', '#52accc', '#74B6CE' ), 3901 array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' ) 3999 array( 4000 'base' => '#e5f8ff', 4001 'focus' => '#fff', 4002 'current' => '#fff', 4003 ) 3902 4004 ); 3903 4005 3904 wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ), 4006 wp_admin_css_color( 4007 'midnight', _x( 'Midnight', 'admin color scheme' ), 3905 4008 admin_url( "css/colors/midnight/colors$suffix.css" ), 3906 4009 array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ), 3907 array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' ) 4010 array( 4011 'base' => '#f1f2f3', 4012 'focus' => '#fff', 4013 'current' => '#fff', 4014 ) 3908 4015 ); 3909 4016 3910 wp_admin_css_color( 'sunrise', _x( 'Sunrise', 'admin color scheme' ), 4017 wp_admin_css_color( 4018 'sunrise', _x( 'Sunrise', 'admin color scheme' ), 3911 4019 admin_url( "css/colors/sunrise/colors$suffix.css" ), 3912 4020 array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ), 3913 array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff' ) 4021 array( 4022 'base' => '#f3f1f1', 4023 'focus' => '#fff', 4024 'current' => '#fff', 4025 ) 3914 4026 ); 3915 4027 3916 wp_admin_css_color( 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ), 4028 wp_admin_css_color( 4029 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ), 3917 4030 admin_url( "css/colors/ectoplasm/colors$suffix.css" ), 3918 4031 array( '#413256', '#523f6d', '#a3b745', '#d46f15' ), 3919 array( 'base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff' ) 4032 array( 4033 'base' => '#ece6f6', 4034 'focus' => '#fff', 4035 'current' => '#fff', 4036 ) 3920 4037 ); 3921 4038 3922 wp_admin_css_color( 'ocean', _x( 'Ocean', 'admin color scheme' ), 4039 wp_admin_css_color( 4040 'ocean', _x( 'Ocean', 'admin color scheme' ), 3923 4041 admin_url( "css/colors/ocean/colors$suffix.css" ), 3924 4042 array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ), 3925 array( 'base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff' ) 4043 array( 4044 'base' => '#f2fcff', 4045 'focus' => '#fff', 4046 'current' => '#fff', 4047 ) 3926 4048 ); 3927 4049 3928 wp_admin_css_color( 'coffee', _x( 'Coffee', 'admin color scheme' ), 4050 wp_admin_css_color( 4051 'coffee', _x( 'Coffee', 'admin color scheme' ), 3929 4052 admin_url( "css/colors/coffee/colors$suffix.css" ), 3930 4053 array( '#46403c', '#59524c', '#c7a589', '#9ea476' ), 3931 array( 'base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff' ) 4054 array( 4055 'base' => '#f3f2f1', 4056 'focus' => '#fff', 4057 'current' => '#fff', 4058 ) 3932 4059 ); 3933 4060 … … 3945 4072 */ 3946 4073 function wp_admin_css_uri( $file = 'wp-admin' ) { 3947 if ( defined( 'WP_INSTALLING') ) {4074 if ( defined( 'WP_INSTALLING' ) ) { 3948 4075 $_file = "./$file.css"; 3949 4076 } else { 3950 $_file = admin_url( "$file.css");3951 } 3952 $_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file );4077 $_file = admin_url( "$file.css" ); 4078 } 4079 $_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file ); 3953 4080 3954 4081 /** … … 3980 4107 * 3981 4108 * @param string $file Optional. Style handle name or file name (without ".css" extension) relative 3982 * to wp-admin/. Defaults to 'wp-admin'.4109 * to wp-admin/. Defaults to 'wp-admin'. 3983 4110 * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued. 3984 4111 */ … … 3988 4115 3989 4116 if ( wp_styles()->query( $handle ) ) { 3990 if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately4117 if ( $force_echo || did_action( 'wp_print_styles' ) ) { // we already printed the style queue. Print this one immediately 3991 4118 wp_print_styles( $handle ); 3992 else// Add to style queue4119 } else { // Add to style queue 3993 4120 wp_enqueue_style( $handle ); 4121 } 3994 4122 return; 3995 4123 } … … 4027 4155 wp_enqueue_style( 'thickbox' ); 4028 4156 4029 if ( is_network_admin() ) 4157 if ( is_network_admin() ) { 4030 4158 add_action( 'admin_head', '_thickbox_path_admin_subfolder' ); 4159 } 4031 4160 } 4032 4161 … … 4069 4198 * 'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'. 4070 4199 */ 4071 echo apply_filters( 'the_generator', get_the_generator( $type), $type ) . "\n";4200 echo apply_filters( 'the_generator', get_the_generator( $type ), $type ) . "\n"; 4072 4201 } 4073 4202 … … 4088 4217 4089 4218 $current_filter = current_filter(); 4090 if ( empty( $current_filter ) ) 4219 if ( empty( $current_filter ) ) { 4091 4220 return; 4221 } 4092 4222 4093 4223 switch ( $current_filter ) { 4094 case 'rss2_head' :4095 case 'commentsrss2_head' :4224 case 'rss2_head': 4225 case 'commentsrss2_head': 4096 4226 $type = 'rss2'; 4097 4227 break; 4098 case 'rss_head' :4099 case 'opml_head' :4228 case 'rss_head': 4229 case 'opml_head': 4100 4230 $type = 'comment'; 4101 4231 break; 4102 case 'rdf_header' :4232 case 'rdf_header': 4103 4233 $type = 'rdf'; 4104 4234 break; 4105 case 'atom_head' :4106 case 'comments_atom_head' :4107 case 'app_head' :4235 case 'atom_head': 4236 case 'comments_atom_head': 4237 case 'app_head': 4108 4238 $type = 'atom'; 4109 4239 break; … … 4131 4261 break; 4132 4262 case 'export': 4133 $gen = '<!-- generator="WordPress/' . get_bloginfo_rss( 'version') . '" created="'. date('Y-m-d H:i') . '" -->';4263 $gen = '<!-- generator="WordPress/' . get_bloginfo_rss( 'version' ) . '" created="' . date( 'Y-m-d H:i' ) . '" -->'; 4134 4264 break; 4135 4265 } … … 4228 4358 */ 4229 4359 function __checked_selected_helper( $helper, $current, $echo, $type ) { 4230 if ( (string) $helper === (string) $current ) 4360 if ( (string) $helper === (string) $current ) { 4231 4361 $result = " $type='$type'"; 4232 else4362 } else { 4233 4363 $result = ''; 4234 4235 if ( $echo ) 4364 } 4365 4366 if ( $echo ) { 4236 4367 echo $result; 4368 } 4237 4369 4238 4370 return $result; … … 4250 4382 */ 4251 4383 function wp_heartbeat_settings( $settings ) { 4252 if ( ! is_admin() ) 4384 if ( ! is_admin() ) { 4253 4385 $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); 4254 4255 if ( is_user_logged_in() ) 4386 } 4387 4388 if ( is_user_logged_in() ) { 4256 4389 $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); 4390 } 4257 4391 4258 4392 return $settings;
Note: See TracChangeset
for help on using the changeset viewer.