171 * {@see 'pre_get_search_form'}. This can be useful for outputting JavaScript that the |
184 * {@see 'pre_get_search_form'}. This can be useful for outputting JavaScript that the |
172 * search relies on or various formatting that applies to the beginning of the |
185 * search relies on or various formatting that applies to the beginning of the |
173 * search. To give a few examples of what it can be used for. |
186 * search. To give a few examples of what it can be used for. |
174 * |
187 * |
175 * @since 2.7.0 |
188 * @since 2.7.0 |
176 * |
189 * @since 5.2.0 The $args array parameter was added in place of an $echo boolean flag. |
177 * @param bool $echo Default to echo and not return the form. |
190 * |
178 * @return string|void String when $echo is false. |
191 * @param array $args { |
179 */ |
192 * Optional. Array of display arguments. |
180 function get_search_form( $echo = true ) { |
193 * |
|
194 * @type bool $echo Whether to echo or return the form. Default true. |
|
195 * @type string $aria_label ARIA label for the search form. Useful to distinguish |
|
196 * multiple search forms on the same page and improve |
|
197 * accessibility. Default empty. |
|
198 * } |
|
199 * @return string|void String when the $echo param is false. |
|
200 */ |
|
201 function get_search_form( $args = array() ) { |
181 /** |
202 /** |
182 * Fires before the search form is retrieved, at the start of get_search_form(). |
203 * Fires before the search form is retrieved, at the start of get_search_form(). |
183 * |
204 * |
184 * @since 2.7.0 as 'get_search_form' action. |
205 * @since 2.7.0 as 'get_search_form' action. |
185 * @since 3.6.0 |
206 * @since 3.6.0 |
186 * |
207 * |
187 * @link https://core.trac.wordpress.org/ticket/19321 |
208 * @link https://core.trac.wordpress.org/ticket/19321 |
188 */ |
209 */ |
189 do_action( 'pre_get_search_form' ); |
210 do_action( 'pre_get_search_form' ); |
|
211 |
|
212 $echo = true; |
|
213 |
|
214 if ( ! is_array( $args ) ) { |
|
215 /* |
|
216 * Back compat: to ensure previous uses of get_search_form() continue to |
|
217 * function as expected, we handle a value for the boolean $echo param removed |
|
218 * in 5.2.0. Then we deal with the $args array and cast its defaults. |
|
219 */ |
|
220 $echo = (bool) $args; |
|
221 |
|
222 // Set an empty array and allow default arguments to take over. |
|
223 $args = array(); |
|
224 } |
|
225 |
|
226 // Defaults are to echo and to output no custom label on the form. |
|
227 $defaults = array( |
|
228 'echo' => $echo, |
|
229 'aria_label' => '', |
|
230 ); |
|
231 |
|
232 $args = wp_parse_args( $args, $defaults ); |
|
233 |
|
234 /** |
|
235 * Filters the array of arguments used when generating the search form. |
|
236 * |
|
237 * @since 5.2.0 |
|
238 * |
|
239 * @param array $args The array of arguments for building the search form. |
|
240 */ |
|
241 $args = apply_filters( 'search_form_args', $args ); |
190 |
242 |
191 $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml'; |
243 $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml'; |
192 |
244 |
193 /** |
245 /** |
194 * Filters the HTML format of the search form. |
246 * Filters the HTML format of the search form. |
204 if ( '' != $search_form_template ) { |
256 if ( '' != $search_form_template ) { |
205 ob_start(); |
257 ob_start(); |
206 require( $search_form_template ); |
258 require( $search_form_template ); |
207 $form = ob_get_clean(); |
259 $form = ob_get_clean(); |
208 } else { |
260 } else { |
|
261 // Build a string containing an aria-label to use for the search form. |
|
262 if ( isset( $args['aria_label'] ) && $args['aria_label'] ) { |
|
263 $aria_label = 'aria-label="' . esc_attr( $args['aria_label'] ) . '" '; |
|
264 } else { |
|
265 /* |
|
266 * If there's no custom aria-label, we can set a default here. At the |
|
267 * moment it's empty as there's uncertainty about what the default should be. |
|
268 */ |
|
269 $aria_label = ''; |
|
270 } |
209 if ( 'html5' == $format ) { |
271 if ( 'html5' == $format ) { |
210 $form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '"> |
272 $form = '<form role="search" ' . $aria_label . 'method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '"> |
211 <label> |
273 <label> |
212 <span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span> |
274 <span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span> |
213 <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" /> |
275 <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" /> |
214 </label> |
276 </label> |
215 <input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" /> |
277 <input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" /> |
216 </form>'; |
278 </form>'; |
217 } else { |
279 } else { |
218 $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '"> |
280 $form = '<form role="search" ' . $aria_label . 'method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '"> |
219 <div> |
281 <div> |
220 <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label> |
282 <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label> |
221 <input type="text" value="' . get_search_query() . '" name="s" id="s" /> |
283 <input type="text" value="' . get_search_query() . '" name="s" id="s" /> |
222 <input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" /> |
284 <input type="submit" id="searchsubmit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" /> |
223 </div> |
285 </div> |
224 </form>'; |
286 </form>'; |
225 } |
287 } |
226 } |
288 } |
227 |
289 |
387 * } |
454 * } |
388 * @return string|void String when retrieving. |
455 * @return string|void String when retrieving. |
389 */ |
456 */ |
390 function wp_login_form( $args = array() ) { |
457 function wp_login_form( $args = array() ) { |
391 $defaults = array( |
458 $defaults = array( |
392 'echo' => true, |
459 'echo' => true, |
393 // Default 'redirect' value takes the user back to the request URI. |
460 // Default 'redirect' value takes the user back to the request URI. |
394 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], |
461 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], |
395 'form_id' => 'loginform', |
462 'form_id' => 'loginform', |
396 'label_username' => __( 'Username or Email Address' ), |
463 'label_username' => __( 'Username or Email Address' ), |
397 'label_password' => __( 'Password' ), |
464 'label_password' => __( 'Password' ), |
398 'label_remember' => __( 'Remember Me' ), |
465 'label_remember' => __( 'Remember Me' ), |
399 'label_log_in' => __( 'Log In' ), |
466 'label_log_in' => __( 'Log In' ), |
400 'id_username' => 'user_login', |
467 'id_username' => 'user_login', |
401 'id_password' => 'user_pass', |
468 'id_password' => 'user_pass', |
402 'id_remember' => 'rememberme', |
469 'id_remember' => 'rememberme', |
403 'id_submit' => 'wp-submit', |
470 'id_submit' => 'wp-submit', |
404 'remember' => true, |
471 'remember' => true, |
405 'value_username' => '', |
472 'value_username' => '', |
406 // Set 'value_remember' to true to default the "Remember me" checkbox to checked. |
473 // Set 'value_remember' to true to default the "Remember me" checkbox to checked. |
407 'value_remember' => false, |
474 'value_remember' => false, |
408 ); |
475 ); |
409 |
476 |
630 * @param string $show Optional. Site info to retrieve. Default empty (site name). |
699 * @param string $show Optional. Site info to retrieve. Default empty (site name). |
631 * @param string $filter Optional. How to filter what is retrieved. Default 'raw'. |
700 * @param string $filter Optional. How to filter what is retrieved. Default 'raw'. |
632 * @return string Mostly string values, might be empty. |
701 * @return string Mostly string values, might be empty. |
633 */ |
702 */ |
634 function get_bloginfo( $show = '', $filter = 'raw' ) { |
703 function get_bloginfo( $show = '', $filter = 'raw' ) { |
635 switch( $show ) { |
704 switch ( $show ) { |
636 case 'home' : // DEPRECATED |
705 case 'home': // DEPRECATED |
637 case 'siteurl' : // DEPRECATED |
706 case 'siteurl': // DEPRECATED |
638 _deprecated_argument( __FUNCTION__, '2.2.0', sprintf( |
707 _deprecated_argument( |
639 /* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */ |
708 __FUNCTION__, |
640 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ), |
709 '2.2.0', |
641 '<code>' . $show . '</code>', |
710 sprintf( |
642 '<code>bloginfo()</code>', |
711 /* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */ |
643 '<code>url</code>' |
712 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ), |
644 ) ); |
713 '<code>' . $show . '</code>', |
645 case 'url' : |
714 '<code>bloginfo()</code>', |
|
715 '<code>url</code>' |
|
716 ) |
|
717 ); |
|
718 // Intentional fall-through to be handled by the 'url' case. |
|
719 case 'url': |
646 $output = home_url(); |
720 $output = home_url(); |
647 break; |
721 break; |
648 case 'wpurl' : |
722 case 'wpurl': |
649 $output = site_url(); |
723 $output = site_url(); |
650 break; |
724 break; |
651 case 'description': |
725 case 'description': |
652 $output = get_option('blogdescription'); |
726 $output = get_option( 'blogdescription' ); |
653 break; |
727 break; |
654 case 'rdf_url': |
728 case 'rdf_url': |
655 $output = get_feed_link('rdf'); |
729 $output = get_feed_link( 'rdf' ); |
656 break; |
730 break; |
657 case 'rss_url': |
731 case 'rss_url': |
658 $output = get_feed_link('rss'); |
732 $output = get_feed_link( 'rss' ); |
659 break; |
733 break; |
660 case 'rss2_url': |
734 case 'rss2_url': |
661 $output = get_feed_link('rss2'); |
735 $output = get_feed_link( 'rss2' ); |
662 break; |
736 break; |
663 case 'atom_url': |
737 case 'atom_url': |
664 $output = get_feed_link('atom'); |
738 $output = get_feed_link( 'atom' ); |
665 break; |
739 break; |
666 case 'comments_atom_url': |
740 case 'comments_atom_url': |
667 $output = get_feed_link('comments_atom'); |
741 $output = get_feed_link( 'comments_atom' ); |
668 break; |
742 break; |
669 case 'comments_rss2_url': |
743 case 'comments_rss2_url': |
670 $output = get_feed_link('comments_rss2'); |
744 $output = get_feed_link( 'comments_rss2' ); |
671 break; |
745 break; |
672 case 'pingback_url': |
746 case 'pingback_url': |
673 $output = site_url( 'xmlrpc.php' ); |
747 $output = site_url( 'xmlrpc.php' ); |
674 break; |
748 break; |
675 case 'stylesheet_url': |
749 case 'stylesheet_url': |
701 * see https://www.w3.org/International/articles/language-tags/ for reference. |
777 * see https://www.w3.org/International/articles/language-tags/ for reference. |
702 * Do not translate into your own language. |
778 * Do not translate into your own language. |
703 */ |
779 */ |
704 $output = __( 'html_lang_attribute' ); |
780 $output = __( 'html_lang_attribute' ); |
705 if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) { |
781 if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) { |
706 $output = is_admin() ? get_user_locale() : get_locale(); |
782 $output = determine_locale(); |
707 $output = str_replace( '_', '-', $output ); |
783 $output = str_replace( '_', '-', $output ); |
708 } |
784 } |
709 break; |
785 break; |
710 case 'text_direction': |
786 case 'text_direction': |
711 _deprecated_argument( __FUNCTION__, '2.2.0', sprintf( |
787 _deprecated_argument( |
712 /* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */ |
788 __FUNCTION__, |
713 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ), |
789 '2.2.0', |
714 '<code>' . $show . '</code>', |
790 sprintf( |
715 '<code>bloginfo()</code>', |
791 /* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */ |
716 '<code>is_rtl()</code>' |
792 __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ), |
717 ) ); |
793 '<code>' . $show . '</code>', |
|
794 '<code>bloginfo()</code>', |
|
795 '<code>is_rtl()</code>' |
|
796 ) |
|
797 ); |
718 if ( function_exists( 'is_rtl' ) ) { |
798 if ( function_exists( 'is_rtl' ) ) { |
719 $output = is_rtl() ? 'rtl' : 'ltr'; |
799 $output = is_rtl() ? 'rtl' : 'ltr'; |
720 } else { |
800 } else { |
721 $output = 'ltr'; |
801 $output = 'ltr'; |
722 } |
802 } |
723 break; |
803 break; |
724 case 'name': |
804 case 'name': |
725 default: |
805 default: |
726 $output = get_option('blogname'); |
806 $output = get_option( 'blogname' ); |
727 break; |
807 break; |
728 } |
808 } |
729 |
809 |
730 $url = true; |
810 $url = true; |
731 if (strpos($show, 'url') === false && |
811 if ( strpos( $show, 'url' ) === false && |
732 strpos($show, 'directory') === false && |
812 strpos( $show, 'directory' ) === false && |
733 strpos($show, 'home') === false) |
813 strpos( $show, 'home' ) === false ) { |
734 $url = false; |
814 $url = false; |
|
815 } |
735 |
816 |
736 if ( 'display' == $filter ) { |
817 if ( 'display' == $filter ) { |
737 if ( $url ) { |
818 if ( $url ) { |
738 /** |
819 /** |
739 * Filters the URL returned by get_bloginfo(). |
820 * Filters the URL returned by get_bloginfo(). |
969 |
1049 |
970 // If it's a 404 page, use a "Page not found" title. |
1050 // If it's a 404 page, use a "Page not found" title. |
971 if ( is_404() ) { |
1051 if ( is_404() ) { |
972 $title['title'] = __( 'Page not found' ); |
1052 $title['title'] = __( 'Page not found' ); |
973 |
1053 |
974 // If it's a search, use a dynamic search results title. |
1054 // If it's a search, use a dynamic search results title. |
975 } elseif ( is_search() ) { |
1055 } elseif ( is_search() ) { |
976 /* translators: %s: search phrase */ |
1056 /* translators: %s: search phrase */ |
977 $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); |
1057 $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); |
978 |
1058 |
979 // If on the front page, use the site title. |
1059 // If on the front page, use the site title. |
980 } elseif ( is_front_page() ) { |
1060 } elseif ( is_front_page() ) { |
981 $title['title'] = get_bloginfo( 'name', 'display' ); |
1061 $title['title'] = get_bloginfo( 'name', 'display' ); |
982 |
1062 |
983 // If on a post type archive, use the post type archive title. |
1063 // If on a post type archive, use the post type archive title. |
984 } elseif ( is_post_type_archive() ) { |
1064 } elseif ( is_post_type_archive() ) { |
985 $title['title'] = post_type_archive_title( '', false ); |
1065 $title['title'] = post_type_archive_title( '', false ); |
986 |
1066 |
987 // If on a taxonomy archive, use the term title. |
1067 // If on a taxonomy archive, use the term title. |
988 } elseif ( is_tax() ) { |
1068 } elseif ( is_tax() ) { |
989 $title['title'] = single_term_title( '', false ); |
1069 $title['title'] = single_term_title( '', false ); |
990 |
1070 |
991 /* |
1071 /* |
992 * If we're on the blog page that is not the homepage or |
1072 * If we're on the blog page that is not the homepage or |
993 * a single post of any post type, use the post title. |
1073 * a single post of any post type, use the post title. |
994 */ |
1074 */ |
995 } elseif ( is_home() || is_singular() ) { |
1075 } elseif ( is_home() || is_singular() ) { |
996 $title['title'] = single_post_title( '', false ); |
1076 $title['title'] = single_post_title( '', false ); |
997 |
1077 |
998 // If on a category or tag archive, use the term title. |
1078 // If on a category or tag archive, use the term title. |
999 } elseif ( is_category() || is_tag() ) { |
1079 } elseif ( is_category() || is_tag() ) { |
1000 $title['title'] = single_term_title( '', false ); |
1080 $title['title'] = single_term_title( '', false ); |
1001 |
1081 |
1002 // If on an author archive, use the author's display name. |
1082 // If on an author archive, use the author's display name. |
1003 } elseif ( is_author() && $author = get_queried_object() ) { |
1083 } elseif ( is_author() && $author = get_queried_object() ) { |
1004 $title['title'] = $author->display_name; |
1084 $title['title'] = $author->display_name; |
1005 |
1085 |
1006 // If it's a date archive, use the date as the title. |
1086 // If it's a date archive, use the date as the title. |
1007 } elseif ( is_year() ) { |
1087 } elseif ( is_year() ) { |
1008 $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) ); |
1088 $title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) ); |
1009 |
1089 |
1010 } elseif ( is_month() ) { |
1090 } elseif ( is_month() ) { |
1011 $title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); |
1091 $title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); |
1462 * |
1552 * |
1463 * @return string Archive title. |
1553 * @return string Archive title. |
1464 */ |
1554 */ |
1465 function get_the_archive_title() { |
1555 function get_the_archive_title() { |
1466 if ( is_category() ) { |
1556 if ( is_category() ) { |
1467 /* translators: Category archive title. 1: Category name */ |
1557 /* translators: Category archive title. %s: Category name */ |
1468 $title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) ); |
1558 $title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) ); |
1469 } elseif ( is_tag() ) { |
1559 } elseif ( is_tag() ) { |
1470 /* translators: Tag archive title. 1: Tag name */ |
1560 /* translators: Tag archive title. %s: Tag name */ |
1471 $title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) ); |
1561 $title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) ); |
1472 } elseif ( is_author() ) { |
1562 } elseif ( is_author() ) { |
1473 /* translators: Author archive title. 1: Author name */ |
1563 /* translators: Author archive title. %s: Author name */ |
1474 $title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' ); |
1564 $title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' ); |
1475 } elseif ( is_year() ) { |
1565 } elseif ( is_year() ) { |
1476 /* translators: Yearly archive title. 1: Year */ |
1566 /* translators: Yearly archive title. %s: Year */ |
1477 $title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) ); |
1567 $title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) ); |
1478 } elseif ( is_month() ) { |
1568 } elseif ( is_month() ) { |
1479 /* translators: Monthly archive title. 1: Month name and year */ |
1569 /* translators: Monthly archive title. %s: Month name and year */ |
1480 $title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) ); |
1570 $title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) ); |
1481 } elseif ( is_day() ) { |
1571 } elseif ( is_day() ) { |
1482 /* translators: Daily archive title. 1: Date */ |
1572 /* translators: Daily archive title. %s: Date */ |
1483 $title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) ); |
1573 $title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) ); |
1484 } elseif ( is_tax( 'post_format' ) ) { |
1574 } elseif ( is_tax( 'post_format' ) ) { |
1485 if ( is_tax( 'post_format', 'post-format-aside' ) ) { |
1575 if ( is_tax( 'post_format', 'post-format-aside' ) ) { |
1486 $title = _x( 'Asides', 'post format archive title' ); |
1576 $title = _x( 'Asides', 'post format archive title' ); |
1487 } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { |
1577 } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { |
1626 * The custom format uses the before parameter before the link ('a' HTML |
1716 * The custom format uses the before parameter before the link ('a' HTML |
1627 * element) and the after parameter after the closing link tag. If the above |
1717 * element) and the after parameter after the closing link tag. If the above |
1628 * three values for the format are not used, then custom format is assumed. |
1718 * three values for the format are not used, then custom format is assumed. |
1629 * |
1719 * |
1630 * @since 1.0.0 |
1720 * @since 1.0.0 |
1631 * |
1721 * @since 5.2.0 Added the `$selected` parameter. |
1632 * @param string $url URL to archive. |
1722 * |
1633 * @param string $text Archive text description. |
1723 * @param string $url URL to archive. |
1634 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom. |
1724 * @param string $text Archive text description. |
1635 * @param string $before Optional. Content to prepend to the description. Default empty. |
1725 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom. |
1636 * @param string $after Optional. Content to append to the description. Default empty. |
1726 * @param string $before Optional. Content to prepend to the description. Default empty. |
|
1727 * @param string $after Optional. Content to append to the description. Default empty. |
|
1728 * @param bool $selected Optional. Set to true if the current page is the selected archive page. |
1637 * @return string HTML link content for archive. |
1729 * @return string HTML link content for archive. |
1638 */ |
1730 */ |
1639 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') { |
1731 function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '', $selected = false ) { |
1640 $text = wptexturize($text); |
1732 $text = wptexturize( $text ); |
1641 $url = esc_url($url); |
1733 $url = esc_url( $url ); |
1642 |
1734 |
1643 if ('link' == $format) |
1735 if ( 'link' == $format ) { |
1644 $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; |
1736 $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; |
1645 elseif ('option' == $format) |
1737 } elseif ( 'option' == $format ) { |
1646 $link_html = "\t<option value='$url'>$before $text $after</option>\n"; |
1738 $selected_attr = $selected ? " selected='selected'" : ''; |
1647 elseif ('html' == $format) |
1739 $link_html = "\t<option value='$url'$selected_attr>$before $text $after</option>\n"; |
|
1740 } elseif ( 'html' == $format ) { |
1648 $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; |
1741 $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; |
1649 else // custom |
1742 } else { // custom |
1650 $link_html = "\t$before<a href='$url'>$text</a>$after\n"; |
1743 $link_html = "\t$before<a href='$url'>$text</a>$after\n"; |
|
1744 } |
1651 |
1745 |
1652 /** |
1746 /** |
1653 * Filters the archive link content. |
1747 * Filters the archive link content. |
1654 * |
1748 * |
1655 * @since 2.6.0 |
1749 * @since 2.6.0 |
1656 * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters. |
1750 * @since 4.5.0 Added the `$url`, `$text`, `$format`, `$before`, and `$after` parameters. |
|
1751 * @since 5.2.0 Added the `$selected` parameter. |
1657 * |
1752 * |
1658 * @param string $link_html The archive HTML link content. |
1753 * @param string $link_html The archive HTML link content. |
1659 * @param string $url URL to archive. |
1754 * @param string $url URL to archive. |
1660 * @param string $text Archive text description. |
1755 * @param string $text Archive text description. |
1661 * @param string $format Link format. Can be 'link', 'option', 'html', or custom. |
1756 * @param string $format Link format. Can be 'link', 'option', 'html', or custom. |
1662 * @param string $before Content to prepend to the description. |
1757 * @param string $before Content to prepend to the description. |
1663 * @param string $after Content to append to the description. |
1758 * @param string $after Content to append to the description. |
1664 */ |
1759 * @param bool $selected True if the current page is the selected archive. |
1665 return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after ); |
1760 */ |
|
1761 return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after, $selected ); |
1666 } |
1762 } |
1667 |
1763 |
1668 /** |
1764 /** |
1669 * Display archive links based on type and format. |
1765 * Display archive links based on type and format. |
1670 * |
1766 * |
1671 * @since 1.2.0 |
1767 * @since 1.2.0 |
1672 * @since 4.4.0 $post_type arg was added. |
1768 * @since 4.4.0 The `$post_type` argument was added. |
|
1769 * @since 5.2.0 The `$year`, `$monthnum`, `$day`, and `$w` arguments were added. |
1673 * |
1770 * |
1674 * @see get_archives_link() |
1771 * @see get_archives_link() |
1675 * |
1772 * |
1676 * @global wpdb $wpdb |
1773 * @global wpdb $wpdb |
1677 * @global WP_Locale $wp_locale |
1774 * @global WP_Locale $wp_locale |
1695 * @type bool $show_post_count Whether to display the post count alongside the link. Default false. |
1792 * @type bool $show_post_count Whether to display the post count alongside the link. Default false. |
1696 * @type bool|int $echo Whether to echo or return the links list. Default 1|true to echo. |
1793 * @type bool|int $echo Whether to echo or return the links list. Default 1|true to echo. |
1697 * @type string $order Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'. |
1794 * @type string $order Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'. |
1698 * Default 'DESC'. |
1795 * Default 'DESC'. |
1699 * @type string $post_type Post type. Default 'post'. |
1796 * @type string $post_type Post type. Default 'post'. |
|
1797 * @type string $year Year. Default current year. |
|
1798 * @type string $monthnum Month number. Default current month number. |
|
1799 * @type string $day Day. Default current day. |
|
1800 * @type string $w Week. Default current week. |
1700 * } |
1801 * } |
1701 * @return string|void String when retrieving. |
1802 * @return string|void String when retrieving. |
1702 */ |
1803 */ |
1703 function wp_get_archives( $args = '' ) { |
1804 function wp_get_archives( $args = '' ) { |
1704 global $wpdb, $wp_locale; |
1805 global $wpdb, $wp_locale; |
1705 |
1806 |
1706 $defaults = array( |
1807 $defaults = array( |
1707 'type' => 'monthly', 'limit' => '', |
1808 'type' => 'monthly', |
1708 'format' => 'html', 'before' => '', |
1809 'limit' => '', |
1709 'after' => '', 'show_post_count' => false, |
1810 'format' => 'html', |
1710 'echo' => 1, 'order' => 'DESC', |
1811 'before' => '', |
1711 'post_type' => 'post' |
1812 'after' => '', |
|
1813 'show_post_count' => false, |
|
1814 'echo' => 1, |
|
1815 'order' => 'DESC', |
|
1816 'post_type' => 'post', |
|
1817 'year' => get_query_var( 'year' ), |
|
1818 'monthnum' => get_query_var( 'monthnum' ), |
|
1819 'day' => get_query_var( 'day' ), |
|
1820 'w' => get_query_var( 'w' ), |
1712 ); |
1821 ); |
1713 |
1822 |
1714 $r = wp_parse_args( $args, $defaults ); |
1823 $r = wp_parse_args( $args, $defaults ); |
1715 |
1824 |
1716 $post_type_object = get_post_type_object( $r['post_type'] ); |
1825 $post_type_object = get_post_type_object( $r['post_type'] ); |
1782 /* translators: 1: month name, 2: 4-digit year */ |
1891 /* translators: 1: month name, 2: 4-digit year */ |
1783 $text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year ); |
1892 $text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year ); |
1784 if ( $r['show_post_count'] ) { |
1893 if ( $r['show_post_count'] ) { |
1785 $r['after'] = ' (' . $result->posts . ')' . $after; |
1894 $r['after'] = ' (' . $result->posts . ')' . $after; |
1786 } |
1895 } |
1787 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
1896 $selected = is_archive() && (string) $r['year'] === $result->year && (string) $r['monthnum'] === $result->month; |
|
1897 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
1788 } |
1898 } |
1789 } |
1899 } |
1790 } elseif ( 'yearly' == $r['type'] ) { |
1900 } elseif ( 'yearly' == $r['type'] ) { |
1791 $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"; |
1901 $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 ); |
1902 $key = md5( $query ); |
1793 $key = "wp_get_archives:$key:$last_changed"; |
1903 $key = "wp_get_archives:$key:$last_changed"; |
1794 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1904 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1795 $results = $wpdb->get_results( $query ); |
1905 $results = $wpdb->get_results( $query ); |
1796 wp_cache_set( $key, $results, 'posts' ); |
1906 wp_cache_set( $key, $results, 'posts' ); |
1797 } |
1907 } |
1798 if ( $results ) { |
1908 if ( $results ) { |
1799 $after = $r['after']; |
1909 $after = $r['after']; |
1800 foreach ( (array) $results as $result) { |
1910 foreach ( (array) $results as $result ) { |
1801 $url = get_year_link( $result->year ); |
1911 $url = get_year_link( $result->year ); |
1802 if ( 'post' !== $r['post_type'] ) { |
1912 if ( 'post' !== $r['post_type'] ) { |
1803 $url = add_query_arg( 'post_type', $r['post_type'], $url ); |
1913 $url = add_query_arg( 'post_type', $r['post_type'], $url ); |
1804 } |
1914 } |
1805 $text = sprintf( '%d', $result->year ); |
1915 $text = sprintf( '%d', $result->year ); |
1806 if ( $r['show_post_count'] ) { |
1916 if ( $r['show_post_count'] ) { |
1807 $r['after'] = ' (' . $result->posts . ')' . $after; |
1917 $r['after'] = ' (' . $result->posts . ')' . $after; |
1808 } |
1918 } |
1809 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
1919 $selected = is_archive() && (string) $r['year'] === $result->year; |
|
1920 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
1810 } |
1921 } |
1811 } |
1922 } |
1812 } elseif ( 'daily' == $r['type'] ) { |
1923 } elseif ( 'daily' == $r['type'] ) { |
1813 $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"; |
1924 $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 ); |
1925 $key = md5( $query ); |
1815 $key = "wp_get_archives:$key:$last_changed"; |
1926 $key = "wp_get_archives:$key:$last_changed"; |
1816 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1927 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1817 $results = $wpdb->get_results( $query ); |
1928 $results = $wpdb->get_results( $query ); |
1818 wp_cache_set( $key, $results, 'posts' ); |
1929 wp_cache_set( $key, $results, 'posts' ); |
1819 } |
1930 } |
1820 if ( $results ) { |
1931 if ( $results ) { |
1821 $after = $r['after']; |
1932 $after = $r['after']; |
1822 foreach ( (array) $results as $result ) { |
1933 foreach ( (array) $results as $result ) { |
1823 $url = get_day_link( $result->year, $result->month, $result->dayofmonth ); |
1934 $url = get_day_link( $result->year, $result->month, $result->dayofmonth ); |
1824 if ( 'post' !== $r['post_type'] ) { |
1935 if ( 'post' !== $r['post_type'] ) { |
1825 $url = add_query_arg( 'post_type', $r['post_type'], $url ); |
1936 $url = add_query_arg( 'post_type', $r['post_type'], $url ); |
1826 } |
1937 } |
1827 $date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth ); |
1938 $date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth ); |
1828 $text = mysql2date( get_option( 'date_format' ), $date ); |
1939 $text = mysql2date( get_option( 'date_format' ), $date ); |
1829 if ( $r['show_post_count'] ) { |
1940 if ( $r['show_post_count'] ) { |
1830 $r['after'] = ' (' . $result->posts . ')' . $after; |
1941 $r['after'] = ' (' . $result->posts . ')' . $after; |
1831 } |
1942 } |
1832 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
1943 $selected = is_archive() && (string) $r['year'] === $result->year && (string) $r['monthnum'] === $result->month && (string) $r['day'] === $result->dayofmonth; |
|
1944 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
1833 } |
1945 } |
1834 } |
1946 } |
1835 } elseif ( 'weekly' == $r['type'] ) { |
1947 } elseif ( 'weekly' == $r['type'] ) { |
1836 $week = _wp_mysql_week( '`post_date`' ); |
1948 $week = _wp_mysql_week( '`post_date`' ); |
1837 $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"; |
1949 $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 ); |
1950 $key = md5( $query ); |
1839 $key = "wp_get_archives:$key:$last_changed"; |
1951 $key = "wp_get_archives:$key:$last_changed"; |
1840 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1952 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1841 $results = $wpdb->get_results( $query ); |
1953 $results = $wpdb->get_results( $query ); |
1842 wp_cache_set( $key, $results, 'posts' ); |
1954 wp_cache_set( $key, $results, 'posts' ); |
1843 } |
1955 } |
1844 $arc_w_last = ''; |
1956 $arc_w_last = ''; |
1849 $arc_year = $result->yr; |
1961 $arc_year = $result->yr; |
1850 $arc_w_last = $result->week; |
1962 $arc_w_last = $result->week; |
1851 $arc_week = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) ); |
1963 $arc_week = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) ); |
1852 $arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] ); |
1964 $arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] ); |
1853 $arc_week_end = date_i18n( get_option( 'date_format' ), $arc_week['end'] ); |
1965 $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( '/' ) ); |
1966 $url = add_query_arg( |
|
1967 array( |
|
1968 'm' => $arc_year, |
|
1969 'w' => $result->week, |
|
1970 ), |
|
1971 home_url( '/' ) |
|
1972 ); |
1855 if ( 'post' !== $r['post_type'] ) { |
1973 if ( 'post' !== $r['post_type'] ) { |
1856 $url = add_query_arg( 'post_type', $r['post_type'], $url ); |
1974 $url = add_query_arg( 'post_type', $r['post_type'], $url ); |
1857 } |
1975 } |
1858 $text = $arc_week_start . $archive_week_separator . $arc_week_end; |
1976 $text = $arc_week_start . $archive_week_separator . $arc_week_end; |
1859 if ( $r['show_post_count'] ) { |
1977 if ( $r['show_post_count'] ) { |
1860 $r['after'] = ' (' . $result->posts . ')' . $after; |
1978 $r['after'] = ' (' . $result->posts . ')' . $after; |
1861 } |
1979 } |
1862 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
1980 $selected = is_archive() && (string) $r['year'] === $result->yr && (string) $r['w'] === $result->week; |
|
1981 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected ); |
1863 } |
1982 } |
1864 } |
1983 } |
1865 } |
1984 } |
1866 } elseif ( ( 'postbypost' == $r['type'] ) || ('alpha' == $r['type'] ) ) { |
1985 } elseif ( ( 'postbypost' == $r['type'] ) || ( 'alpha' == $r['type'] ) ) { |
1867 $orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC '; |
1986 $orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC '; |
1868 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; |
1987 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; |
1869 $key = md5( $query ); |
1988 $key = md5( $query ); |
1870 $key = "wp_get_archives:$key:$last_changed"; |
1989 $key = "wp_get_archives:$key:$last_changed"; |
1871 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1990 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
1872 $results = $wpdb->get_results( $query ); |
1991 $results = $wpdb->get_results( $query ); |
1873 wp_cache_set( $key, $results, 'posts' ); |
1992 wp_cache_set( $key, $results, 'posts' ); |
1874 } |
1993 } |
1875 if ( $results ) { |
1994 if ( $results ) { |
1961 if ( isset( $_GET['w'] ) ) { |
2081 if ( isset( $_GET['w'] ) ) { |
1962 $w = (int) $_GET['w']; |
2082 $w = (int) $_GET['w']; |
1963 } |
2083 } |
1964 // week_begins = 0 stands for Sunday |
2084 // week_begins = 0 stands for Sunday |
1965 $week_begins = (int) get_option( 'start_of_week' ); |
2085 $week_begins = (int) get_option( 'start_of_week' ); |
1966 $ts = current_time( 'timestamp' ); |
|
1967 |
2086 |
1968 // Let's figure out when we are |
2087 // Let's figure out when we are |
1969 if ( ! empty( $monthnum ) && ! empty( $year ) ) { |
2088 if ( ! empty( $monthnum ) && ! empty( $year ) ) { |
1970 $thismonth = zeroise( intval( $monthnum ), 2 ); |
2089 $thismonth = zeroise( intval( $monthnum ), 2 ); |
1971 $thisyear = (int) $year; |
2090 $thisyear = (int) $year; |
1972 } elseif ( ! empty( $w ) ) { |
2091 } elseif ( ! empty( $w ) ) { |
1973 // We need to get the month from MySQL |
2092 // We need to get the month from MySQL |
1974 $thisyear = (int) substr( $m, 0, 4 ); |
2093 $thisyear = (int) substr( $m, 0, 4 ); |
1975 //it seems MySQL's weeks disagree with PHP's |
2094 //it seems MySQL's weeks disagree with PHP's |
1976 $d = ( ( $w - 1 ) * 7 ) + 6; |
2095 $d = ( ( $w - 1 ) * 7 ) + 6; |
1977 $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')"); |
2096 $thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" ); |
1978 } elseif ( ! empty( $m ) ) { |
2097 } elseif ( ! empty( $m ) ) { |
1979 $thisyear = (int) substr( $m, 0, 4 ); |
2098 $thisyear = (int) substr( $m, 0, 4 ); |
1980 if ( strlen( $m ) < 6 ) { |
2099 if ( strlen( $m ) < 6 ) { |
1981 $thismonth = '01'; |
2100 $thismonth = '01'; |
1982 } else { |
2101 } else { |
1983 $thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 ); |
2102 $thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 ); |
1984 } |
2103 } |
1985 } else { |
2104 } else { |
1986 $thisyear = gmdate( 'Y', $ts ); |
2105 $thisyear = current_time( 'Y' ); |
1987 $thismonth = gmdate( 'm', $ts ); |
2106 $thismonth = current_time( 'm' ); |
1988 } |
2107 } |
1989 |
2108 |
1990 $unixmonth = mktime( 0, 0 , 0, $thismonth, 1, $thisyear ); |
2109 $unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear ); |
1991 $last_day = date( 't', $unixmonth ); |
2110 $last_day = date( 't', $unixmonth ); |
1992 |
2111 |
1993 // Get the next and previous month and year with at least one post |
2112 // 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 |
2113 $previous = $wpdb->get_row( |
|
2114 "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year |
1995 FROM $wpdb->posts |
2115 FROM $wpdb->posts |
1996 WHERE post_date < '$thisyear-$thismonth-01' |
2116 WHERE post_date < '$thisyear-$thismonth-01' |
1997 AND post_type = 'post' AND post_status = 'publish' |
2117 AND post_type = 'post' AND post_status = 'publish' |
1998 ORDER BY post_date DESC |
2118 ORDER BY post_date DESC |
1999 LIMIT 1"); |
2119 LIMIT 1" |
2000 $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year |
2120 ); |
|
2121 $next = $wpdb->get_row( |
|
2122 "SELECT MONTH(post_date) AS month, YEAR(post_date) AS year |
2001 FROM $wpdb->posts |
2123 FROM $wpdb->posts |
2002 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' |
2124 WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59' |
2003 AND post_type = 'post' AND post_status = 'publish' |
2125 AND post_type = 'post' AND post_status = 'publish' |
2004 ORDER BY post_date ASC |
2126 ORDER BY post_date ASC |
2005 LIMIT 1"); |
2127 LIMIT 1" |
|
2128 ); |
2006 |
2129 |
2007 /* translators: Calendar caption: 1: month name, 2: 4-digit year */ |
2130 /* translators: Calendar caption: 1: month name, 2: 4-digit year */ |
2008 $calendar_caption = _x('%1$s %2$s', 'calendar caption'); |
2131 $calendar_caption = _x( '%1$s %2$s', 'calendar caption' ); |
2009 $calendar_output = '<table id="wp-calendar"> |
2132 $calendar_output = '<table id="wp-calendar"> |
2010 <caption>' . sprintf( |
2133 <caption>' . sprintf( |
2011 $calendar_caption, |
2134 $calendar_caption, |
2012 $wp_locale->get_month( $thismonth ), |
2135 $wp_locale->get_month( $thismonth ), |
2013 date( 'Y', $unixmonth ) |
2136 date( 'Y', $unixmonth ) |
2014 ) . '</caption> |
2137 ) . '</caption> |
2060 <tr>'; |
2183 <tr>'; |
2061 |
2184 |
2062 $daywithpost = array(); |
2185 $daywithpost = array(); |
2063 |
2186 |
2064 // Get days with posts |
2187 // Get days with posts |
2065 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) |
2188 $dayswithposts = $wpdb->get_results( |
|
2189 "SELECT DISTINCT DAYOFMONTH(post_date) |
2066 FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' |
2190 FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' |
2067 AND post_type = 'post' AND post_status = 'publish' |
2191 AND post_type = 'post' AND post_status = 'publish' |
2068 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N); |
2192 AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", |
|
2193 ARRAY_N |
|
2194 ); |
2069 if ( $dayswithposts ) { |
2195 if ( $dayswithposts ) { |
2070 foreach ( (array) $dayswithposts as $daywith ) { |
2196 foreach ( (array) $dayswithposts as $daywith ) { |
2071 $daywithpost[] = $daywith[0]; |
2197 $daywithpost[] = $daywith[0]; |
2072 } |
2198 } |
2073 } |
2199 } |
2074 |
2200 |
2075 // See how much we should pad in the beginning |
2201 // See how much we should pad in the beginning |
2076 $pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins ); |
2202 $pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins ); |
2077 if ( 0 != $pad ) { |
2203 if ( 0 != $pad ) { |
2078 $calendar_output .= "\n\t\t".'<td colspan="'. esc_attr( $pad ) .'" class="pad"> </td>'; |
2204 $calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr( $pad ) . '" class="pad"> </td>'; |
2079 } |
2205 } |
2080 |
2206 |
2081 $newrow = false; |
2207 $newrow = false; |
2082 $daysinmonth = (int) date( 't', $unixmonth ); |
2208 $daysinmonth = (int) date( 't', $unixmonth ); |
2083 |
2209 |
2084 for ( $day = 1; $day <= $daysinmonth; ++$day ) { |
2210 for ( $day = 1; $day <= $daysinmonth; ++$day ) { |
2085 if ( isset($newrow) && $newrow ) { |
2211 if ( isset( $newrow ) && $newrow ) { |
2086 $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t"; |
2212 $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t"; |
2087 } |
2213 } |
2088 $newrow = false; |
2214 $newrow = false; |
2089 |
2215 |
2090 if ( $day == gmdate( 'j', $ts ) && |
2216 if ( $day == current_time( 'j' ) && |
2091 $thismonth == gmdate( 'm', $ts ) && |
2217 $thismonth == current_time( 'm' ) && |
2092 $thisyear == gmdate( 'Y', $ts ) ) { |
2218 $thisyear == current_time( 'Y' ) ) { |
2093 $calendar_output .= '<td id="today">'; |
2219 $calendar_output .= '<td id="today">'; |
2094 } else { |
2220 } else { |
2095 $calendar_output .= '<td>'; |
2221 $calendar_output .= '<td>'; |
2096 } |
2222 } |
2097 |
2223 |
2098 if ( in_array( $day, $daywithpost ) ) { |
2224 if ( in_array( $day, $daywithpost ) ) { |
2099 // any posts today? |
2225 // any posts today? |
2100 $date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); |
2226 $date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); |
2101 /* translators: Post calendar label. 1: Date */ |
2227 /* translators: Post calendar label. %s: Date */ |
2102 $label = sprintf( __( 'Posts published on %s' ), $date_format ); |
2228 $label = sprintf( __( 'Posts published on %s' ), $date_format ); |
2103 $calendar_output .= sprintf( |
2229 $calendar_output .= sprintf( |
2104 '<a href="%s" aria-label="%s">%s</a>', |
2230 '<a href="%s" aria-label="%s">%s</a>', |
2105 get_day_link( $thisyear, $thismonth, $day ), |
2231 get_day_link( $thisyear, $thismonth, $day ), |
2106 esc_attr( $label ), |
2232 esc_attr( $label ), |
2107 $day |
2233 $day |
2683 * @param array $args Optional arguments. |
2831 * @param array $args Optional arguments. |
2684 */ |
2832 */ |
2685 function feed_links_extra( $args = array() ) { |
2833 function feed_links_extra( $args = array() ) { |
2686 $defaults = array( |
2834 $defaults = array( |
2687 /* translators: Separator between blog name and feed type in feed links */ |
2835 /* translators: Separator between blog name and feed type in feed links */ |
2688 'separator' => _x('»', 'feed link'), |
2836 'separator' => _x( '»', 'feed link' ), |
2689 /* translators: 1: blog name, 2: separator(raquo), 3: post title */ |
2837 /* translators: 1: blog name, 2: separator(raquo), 3: post title */ |
2690 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), |
2838 'singletitle' => __( '%1$s %2$s %3$s Comments Feed' ), |
2691 /* translators: 1: blog name, 2: separator(raquo), 3: category name */ |
2839 /* translators: 1: blog name, 2: separator(raquo), 3: category name */ |
2692 'cattitle' => __('%1$s %2$s %3$s Category Feed'), |
2840 'cattitle' => __( '%1$s %2$s %3$s Category Feed' ), |
2693 /* translators: 1: blog name, 2: separator(raquo), 3: tag name */ |
2841 /* translators: 1: blog name, 2: separator(raquo), 3: tag name */ |
2694 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), |
2842 'tagtitle' => __( '%1$s %2$s %3$s Tag Feed' ), |
2695 /* translators: 1: blog name, 2: separator(raquo), 3: term name, 4: taxonomy singular name */ |
2843 /* 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'), |
2844 'taxtitle' => __( '%1$s %2$s %3$s %4$s Feed' ), |
2697 /* translators: 1: blog name, 2: separator(raquo), 3: author name */ |
2845 /* translators: 1: blog name, 2: separator(raquo), 3: author name */ |
2698 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), |
2846 'authortitle' => __( '%1$s %2$s Posts by %3$s Feed' ), |
2699 /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */ |
2847 /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */ |
2700 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), |
2848 'searchtitle' => __( '%1$s %2$s Search Results for “%3$s” Feed' ), |
2701 /* translators: 1: blog name, 2: separator(raquo), 3: post type name */ |
2849 /* translators: 1: blog name, 2: separator(raquo), 3: post type name */ |
2702 'posttypetitle' => __('%1$s %2$s %3$s Feed'), |
2850 'posttypetitle' => __( '%1$s %2$s %3$s Feed' ), |
2703 ); |
2851 ); |
2704 |
2852 |
2705 $args = wp_parse_args( $args, $defaults ); |
2853 $args = wp_parse_args( $args, $defaults ); |
2706 |
2854 |
2707 if ( is_singular() ) { |
2855 if ( is_singular() ) { |
2708 $id = 0; |
2856 $id = 0; |
2709 $post = get_post( $id ); |
2857 $post = get_post( $id ); |
2710 |
2858 |
2711 if ( comments_open() || pings_open() || $post->comment_count > 0 ) { |
2859 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 ) ) ); |
2860 $title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) ); |
2713 $href = get_post_comments_feed_link( $post->ID ); |
2861 $href = get_post_comments_feed_link( $post->ID ); |
2714 } |
2862 } |
2715 } elseif ( is_post_type_archive() ) { |
2863 } elseif ( is_post_type_archive() ) { |
2716 $post_type = get_query_var( 'post_type' ); |
2864 $post_type = get_query_var( 'post_type' ); |
2717 if ( is_array( $post_type ) ) |
2865 if ( is_array( $post_type ) ) { |
2718 $post_type = reset( $post_type ); |
2866 $post_type = reset( $post_type ); |
|
2867 } |
2719 |
2868 |
2720 $post_type_obj = get_post_type_object( $post_type ); |
2869 $post_type_obj = get_post_type_object( $post_type ); |
2721 $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name ); |
2870 $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 ); |
2871 $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
2723 } elseif ( is_category() ) { |
2872 } elseif ( is_category() ) { |
2724 $term = get_queried_object(); |
2873 $term = get_queried_object(); |
2725 |
2874 |
2726 if ( $term ) { |
2875 if ( $term ) { |
2727 $title = sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name ); |
2876 $title = sprintf( $args['cattitle'], get_bloginfo( 'name' ), $args['separator'], $term->name ); |
2728 $href = get_category_feed_link( $term->term_id ); |
2877 $href = get_category_feed_link( $term->term_id ); |
2729 } |
2878 } |
2730 } elseif ( is_tag() ) { |
2879 } elseif ( is_tag() ) { |
2731 $term = get_queried_object(); |
2880 $term = get_queried_object(); |
2732 |
2881 |
2733 if ( $term ) { |
2882 if ( $term ) { |
2734 $title = sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name ); |
2883 $title = sprintf( $args['tagtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name ); |
2735 $href = get_tag_feed_link( $term->term_id ); |
2884 $href = get_tag_feed_link( $term->term_id ); |
2736 } |
2885 } |
2737 } elseif ( is_tax() ) { |
2886 } elseif ( is_tax() ) { |
2738 $term = get_queried_object(); |
2887 $term = get_queried_object(); |
2739 $tax = get_taxonomy( $term->taxonomy ); |
2888 $tax = get_taxonomy( $term->taxonomy ); |
2740 $title = sprintf( $args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name ); |
2889 $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 ); |
2890 $href = get_term_feed_link( $term->term_id, $term->taxonomy ); |
2742 } elseif ( is_author() ) { |
2891 } elseif ( is_author() ) { |
2743 $author_id = intval( get_query_var('author') ); |
2892 $author_id = intval( get_query_var( 'author' ) ); |
2744 |
2893 |
2745 $title = sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
2894 $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 ); |
2895 $href = get_author_feed_link( $author_id ); |
2747 } elseif ( is_search() ) { |
2896 } elseif ( is_search() ) { |
2748 $title = sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) ); |
2897 $title = sprintf( $args['searchtitle'], get_bloginfo( 'name' ), $args['separator'], get_search_query( false ) ); |
2749 $href = get_search_feed_link(); |
2898 $href = get_search_feed_link(); |
2750 } elseif ( is_post_type_archive() ) { |
2899 } elseif ( is_post_type_archive() ) { |
2751 $title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) ); |
2900 $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], post_type_archive_title( '', false ) ); |
2752 $post_type_obj = get_queried_object(); |
2901 $post_type_obj = get_queried_object(); |
2753 if ( $post_type_obj ) |
2902 if ( $post_type_obj ) { |
2754 $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
2903 $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
2755 } |
2904 } |
2756 |
2905 } |
2757 if ( isset($title) && isset($href) ) |
2906 |
|
2907 if ( isset( $title ) && isset( $href ) ) { |
2758 echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; |
2908 echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; |
|
2909 } |
2759 } |
2910 } |
2760 |
2911 |
2761 /** |
2912 /** |
2762 * Display the link to the Really Simple Discovery service endpoint. |
2913 * Display the link to the Really Simple Discovery service endpoint. |
2763 * |
2914 * |
3132 * @type array $codemirror Additional CodeMirror setting overrides. |
3305 * @type array $codemirror Additional CodeMirror setting overrides. |
3133 * @type array $csslint CSSLint rule overrides. |
3306 * @type array $csslint CSSLint rule overrides. |
3134 * @type array $jshint JSHint rule overrides. |
3307 * @type array $jshint JSHint rule overrides. |
3135 * @type array $htmlhint JSHint rule overrides. |
3308 * @type array $htmlhint JSHint rule overrides. |
3136 * } |
3309 * } |
3137 * @returns array|false Settings for the enqueued code editor, or false if the editor was not enqueued . |
3310 * @return array|false Settings for the enqueued code editor, or false if the editor was not enqueued. |
3138 */ |
3311 */ |
3139 function wp_enqueue_code_editor( $args ) { |
3312 function wp_enqueue_code_editor( $args ) { |
3140 if ( is_user_logged_in() && 'false' === wp_get_current_user()->syntax_highlighting ) { |
3313 if ( is_user_logged_in() && 'false' === wp_get_current_user()->syntax_highlighting ) { |
3141 return false; |
3314 return false; |
3142 } |
3315 } |
3143 |
3316 |
|
3317 $settings = wp_get_code_editor_settings( $args ); |
|
3318 |
|
3319 if ( empty( $settings ) || empty( $settings['codemirror'] ) ) { |
|
3320 return false; |
|
3321 } |
|
3322 |
|
3323 wp_enqueue_script( 'code-editor' ); |
|
3324 wp_enqueue_style( 'code-editor' ); |
|
3325 |
|
3326 if ( isset( $settings['codemirror']['mode'] ) ) { |
|
3327 $mode = $settings['codemirror']['mode']; |
|
3328 if ( is_string( $mode ) ) { |
|
3329 $mode = array( |
|
3330 'name' => $mode, |
|
3331 ); |
|
3332 } |
|
3333 |
|
3334 if ( ! empty( $settings['codemirror']['lint'] ) ) { |
|
3335 switch ( $mode['name'] ) { |
|
3336 case 'css': |
|
3337 case 'text/css': |
|
3338 case 'text/x-scss': |
|
3339 case 'text/x-less': |
|
3340 wp_enqueue_script( 'csslint' ); |
|
3341 break; |
|
3342 case 'htmlmixed': |
|
3343 case 'text/html': |
|
3344 case 'php': |
|
3345 case 'application/x-httpd-php': |
|
3346 case 'text/x-php': |
|
3347 wp_enqueue_script( 'htmlhint' ); |
|
3348 wp_enqueue_script( 'csslint' ); |
|
3349 wp_enqueue_script( 'jshint' ); |
|
3350 if ( ! current_user_can( 'unfiltered_html' ) ) { |
|
3351 wp_enqueue_script( 'htmlhint-kses' ); |
|
3352 } |
|
3353 break; |
|
3354 case 'javascript': |
|
3355 case 'application/ecmascript': |
|
3356 case 'application/json': |
|
3357 case 'application/javascript': |
|
3358 case 'application/ld+json': |
|
3359 case 'text/typescript': |
|
3360 case 'application/typescript': |
|
3361 wp_enqueue_script( 'jshint' ); |
|
3362 wp_enqueue_script( 'jsonlint' ); |
|
3363 break; |
|
3364 } |
|
3365 } |
|
3366 } |
|
3367 |
|
3368 wp_add_inline_script( 'code-editor', sprintf( 'jQuery.extend( wp.codeEditor.defaultSettings, %s );', wp_json_encode( $settings ) ) ); |
|
3369 |
|
3370 /** |
|
3371 * Fires when scripts and styles are enqueued for the code editor. |
|
3372 * |
|
3373 * @since 4.9.0 |
|
3374 * |
|
3375 * @param array $settings Settings for the enqueued code editor. |
|
3376 */ |
|
3377 do_action( 'wp_enqueue_code_editor', $settings ); |
|
3378 |
|
3379 return $settings; |
|
3380 } |
|
3381 |
|
3382 /** |
|
3383 * Generate and return code editor settings. |
|
3384 * |
|
3385 * @since 5.0.0 |
|
3386 * |
|
3387 * @see wp_enqueue_code_editor() |
|
3388 * |
|
3389 * @param array $args { |
|
3390 * Args. |
|
3391 * |
|
3392 * @type string $type The MIME type of the file to be edited. |
|
3393 * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. |
|
3394 * @type WP_Theme $theme Theme being edited when on theme editor. |
|
3395 * @type string $plugin Plugin being edited when on plugin editor. |
|
3396 * @type array $codemirror Additional CodeMirror setting overrides. |
|
3397 * @type array $csslint CSSLint rule overrides. |
|
3398 * @type array $jshint JSHint rule overrides. |
|
3399 * @type array $htmlhint JSHint rule overrides. |
|
3400 * } |
|
3401 * @return array|false Settings for the code editor. |
|
3402 */ |
|
3403 function wp_get_code_editor_settings( $args ) { |
3144 $settings = array( |
3404 $settings = array( |
3145 'codemirror' => array( |
3405 'codemirror' => array( |
3146 'indentUnit' => 4, |
3406 'indentUnit' => 4, |
3147 'indentWithTabs' => true, |
3407 'indentWithTabs' => true, |
3148 'inputStyle' => 'contenteditable', |
3408 'inputStyle' => 'contenteditable', |
3149 'lineNumbers' => true, |
3409 'lineNumbers' => true, |
3150 'lineWrapping' => true, |
3410 'lineWrapping' => true, |
3151 'styleActiveLine' => true, |
3411 'styleActiveLine' => true, |
3152 'continueComments' => true, |
3412 'continueComments' => true, |
3153 'extraKeys' => array( |
3413 'extraKeys' => array( |
3154 'Ctrl-Space' => 'autocomplete', |
3414 'Ctrl-Space' => 'autocomplete', |
3155 'Ctrl-/' => 'toggleComment', |
3415 'Ctrl-/' => 'toggleComment', |
3156 'Cmd-/' => 'toggleComment', |
3416 'Cmd-/' => 'toggleComment', |
3157 'Alt-F' => 'findPersistent', |
3417 'Alt-F' => 'findPersistent', |
3158 'Ctrl-F' => 'findPersistent', |
3418 'Ctrl-F' => 'findPersistent', |
3159 'Cmd-F' => 'findPersistent', |
3419 'Cmd-F' => 'findPersistent', |
3160 ), |
3420 ), |
3161 'direction' => 'ltr', // Code is shown in LTR even in RTL languages. |
3421 'direction' => 'ltr', // Code is shown in LTR even in RTL languages. |
3162 'gutters' => array(), |
3422 'gutters' => array(), |
3163 ), |
3423 ), |
3164 'csslint' => array( |
3424 'csslint' => array( |
3165 'errors' => true, // Parsing errors. |
3425 'errors' => true, // Parsing errors. |
3166 'box-model' => true, |
3426 'box-model' => true, |
3167 'display-property-grouping' => true, |
3427 'display-property-grouping' => true, |
3168 'duplicate-properties' => true, |
3428 'duplicate-properties' => true, |
3169 'known-properties' => true, |
3429 'known-properties' => true, |
3170 'outline-none' => true, |
3430 'outline-none' => true, |
3171 ), |
3431 ), |
3172 'jshint' => array( |
3432 'jshint' => array( |
3173 // The following are copied from <https://github.com/WordPress/wordpress-develop/blob/4.8.1/.jshintrc>. |
3433 // The following are copied from <https://github.com/WordPress/wordpress-develop/blob/4.8.1/.jshintrc>. |
3174 'boss' => true, |
3434 'boss' => true, |
3175 'curly' => true, |
3435 'curly' => true, |
3176 'eqeqeq' => true, |
3436 'eqeqeq' => true, |
3177 'eqnull' => true, |
3437 'eqnull' => true, |
3178 'es3' => true, |
3438 'es3' => true, |
3179 'expr' => true, |
3439 'expr' => true, |
3180 'immed' => true, |
3440 'immed' => true, |
3181 'noarg' => true, |
3441 'noarg' => true, |
3182 'nonbsp' => true, |
3442 'nonbsp' => true, |
3183 'onevar' => true, |
3443 'onevar' => true, |
3184 'quotmark' => 'single', |
3444 'quotmark' => 'single', |
3185 'trailing' => true, |
3445 'trailing' => true, |
3186 'undef' => true, |
3446 'undef' => true, |
3187 'unused' => true, |
3447 'unused' => true, |
3188 |
3448 |
3189 'browser' => true, |
3449 'browser' => true, |
3190 |
3450 |
3191 'globals' => array( |
3451 'globals' => array( |
3192 '_' => false, |
3452 '_' => false, |
3193 'Backbone' => false, |
3453 'Backbone' => false, |
3194 'jQuery' => false, |
3454 'jQuery' => false, |
3195 'JSON' => false, |
3455 'JSON' => false, |
3196 'wp' => false, |
3456 'wp' => false, |
3197 ), |
3457 ), |
3198 ), |
3458 ), |
3199 'htmlhint' => array( |
3459 'htmlhint' => array( |
3200 'tagname-lowercase' => true, |
3460 'tagname-lowercase' => true, |
3201 'attr-lowercase' => true, |
3461 'attr-lowercase' => true, |
3202 'attr-value-double-quotes' => false, |
3462 'attr-value-double-quotes' => false, |
3203 'doctype-first' => false, |
3463 'doctype-first' => false, |
3204 'tag-pair' => true, |
3464 'tag-pair' => true, |
3205 'spec-char-escape' => true, |
3465 'spec-char-escape' => true, |
3206 'id-unique' => true, |
3466 'id-unique' => true, |
3207 'src-not-empty' => true, |
3467 'src-not-empty' => true, |
3208 'attr-no-duplication' => true, |
3468 'attr-no-duplication' => true, |
3209 'alt-require' => true, |
3469 'alt-require' => true, |
3210 'space-tab-mixed-disabled' => 'tab', |
3470 'space-tab-mixed-disabled' => 'tab', |
3211 'attr-unsafe-chars' => true, |
3471 'attr-unsafe-chars' => true, |
3212 ), |
3472 ), |
3213 ); |
3473 ); |
3214 |
3474 |
3215 $type = ''; |
3475 $type = ''; |
3216 if ( isset( $args['type'] ) ) { |
3476 if ( isset( $args['type'] ) ) { |
3303 } |
3563 } |
3304 } |
3564 } |
3305 } |
3565 } |
3306 |
3566 |
3307 if ( 'text/css' === $type ) { |
3567 if ( 'text/css' === $type ) { |
3308 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3568 $settings['codemirror'] = array_merge( |
3309 'mode' => 'css', |
3569 $settings['codemirror'], |
3310 'lint' => true, |
3570 array( |
3311 'autoCloseBrackets' => true, |
3571 'mode' => 'css', |
3312 'matchBrackets' => true, |
3572 'lint' => true, |
3313 ) ); |
3573 'autoCloseBrackets' => true, |
|
3574 'matchBrackets' => true, |
|
3575 ) |
|
3576 ); |
3314 } elseif ( 'text/x-scss' === $type || 'text/x-less' === $type || 'text/x-sass' === $type ) { |
3577 } elseif ( 'text/x-scss' === $type || 'text/x-less' === $type || 'text/x-sass' === $type ) { |
3315 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3578 $settings['codemirror'] = array_merge( |
3316 'mode' => $type, |
3579 $settings['codemirror'], |
3317 'lint' => false, |
3580 array( |
3318 'autoCloseBrackets' => true, |
3581 'mode' => $type, |
3319 'matchBrackets' => true, |
3582 'lint' => false, |
3320 ) ); |
3583 'autoCloseBrackets' => true, |
|
3584 'matchBrackets' => true, |
|
3585 ) |
|
3586 ); |
3321 } elseif ( 'text/x-diff' === $type ) { |
3587 } elseif ( 'text/x-diff' === $type ) { |
3322 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3588 $settings['codemirror'] = array_merge( |
3323 'mode' => 'diff', |
3589 $settings['codemirror'], |
3324 ) ); |
3590 array( |
|
3591 'mode' => 'diff', |
|
3592 ) |
|
3593 ); |
3325 } elseif ( 'text/html' === $type ) { |
3594 } elseif ( 'text/html' === $type ) { |
3326 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3595 $settings['codemirror'] = array_merge( |
3327 'mode' => 'htmlmixed', |
3596 $settings['codemirror'], |
3328 'lint' => true, |
3597 array( |
3329 'autoCloseBrackets' => true, |
3598 'mode' => 'htmlmixed', |
3330 'autoCloseTags' => true, |
3599 'lint' => true, |
3331 'matchTags' => array( |
3600 'autoCloseBrackets' => true, |
3332 'bothTags' => true, |
3601 'autoCloseTags' => true, |
3333 ), |
3602 'matchTags' => array( |
3334 ) ); |
3603 'bothTags' => true, |
|
3604 ), |
|
3605 ) |
|
3606 ); |
3335 |
3607 |
3336 if ( ! current_user_can( 'unfiltered_html' ) ) { |
3608 if ( ! current_user_can( 'unfiltered_html' ) ) { |
3337 $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' ); |
3609 $settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' ); |
3338 } |
3610 } |
3339 } elseif ( 'text/x-gfm' === $type ) { |
3611 } elseif ( 'text/x-gfm' === $type ) { |
3340 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3612 $settings['codemirror'] = array_merge( |
3341 'mode' => 'gfm', |
3613 $settings['codemirror'], |
3342 'highlightFormatting' => true, |
3614 array( |
3343 ) ); |
3615 'mode' => 'gfm', |
|
3616 'highlightFormatting' => true, |
|
3617 ) |
|
3618 ); |
3344 } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) { |
3619 } elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) { |
3345 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3620 $settings['codemirror'] = array_merge( |
3346 'mode' => 'javascript', |
3621 $settings['codemirror'], |
3347 'lint' => true, |
3622 array( |
3348 'autoCloseBrackets' => true, |
3623 'mode' => 'javascript', |
3349 'matchBrackets' => true, |
3624 'lint' => true, |
3350 ) ); |
3625 'autoCloseBrackets' => true, |
|
3626 'matchBrackets' => true, |
|
3627 ) |
|
3628 ); |
3351 } elseif ( false !== strpos( $type, 'json' ) ) { |
3629 } elseif ( false !== strpos( $type, 'json' ) ) { |
3352 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3630 $settings['codemirror'] = array_merge( |
3353 'mode' => array( |
3631 $settings['codemirror'], |
3354 'name' => 'javascript', |
3632 array( |
3355 ), |
3633 'mode' => array( |
3356 'lint' => true, |
3634 'name' => 'javascript', |
3357 'autoCloseBrackets' => true, |
3635 ), |
3358 'matchBrackets' => true, |
3636 'lint' => true, |
3359 ) ); |
3637 'autoCloseBrackets' => true, |
|
3638 'matchBrackets' => true, |
|
3639 ) |
|
3640 ); |
3360 if ( 'application/ld+json' === $type ) { |
3641 if ( 'application/ld+json' === $type ) { |
3361 $settings['codemirror']['mode']['jsonld'] = true; |
3642 $settings['codemirror']['mode']['jsonld'] = true; |
3362 } else { |
3643 } else { |
3363 $settings['codemirror']['mode']['json'] = true; |
3644 $settings['codemirror']['mode']['json'] = true; |
3364 } |
3645 } |
3365 } elseif ( false !== strpos( $type, 'jsx' ) ) { |
3646 } elseif ( false !== strpos( $type, 'jsx' ) ) { |
3366 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3647 $settings['codemirror'] = array_merge( |
3367 'mode' => 'jsx', |
3648 $settings['codemirror'], |
3368 'autoCloseBrackets' => true, |
3649 array( |
3369 'matchBrackets' => true, |
3650 'mode' => 'jsx', |
3370 ) ); |
3651 'autoCloseBrackets' => true, |
|
3652 'matchBrackets' => true, |
|
3653 ) |
|
3654 ); |
3371 } elseif ( 'text/x-markdown' === $type ) { |
3655 } elseif ( 'text/x-markdown' === $type ) { |
3372 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3656 $settings['codemirror'] = array_merge( |
3373 'mode' => 'markdown', |
3657 $settings['codemirror'], |
3374 'highlightFormatting' => true, |
3658 array( |
3375 ) ); |
3659 'mode' => 'markdown', |
|
3660 'highlightFormatting' => true, |
|
3661 ) |
|
3662 ); |
3376 } elseif ( 'text/nginx' === $type ) { |
3663 } elseif ( 'text/nginx' === $type ) { |
3377 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3664 $settings['codemirror'] = array_merge( |
3378 'mode' => 'nginx', |
3665 $settings['codemirror'], |
3379 ) ); |
3666 array( |
|
3667 'mode' => 'nginx', |
|
3668 ) |
|
3669 ); |
3380 } elseif ( 'application/x-httpd-php' === $type ) { |
3670 } elseif ( 'application/x-httpd-php' === $type ) { |
3381 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3671 $settings['codemirror'] = array_merge( |
3382 'mode' => 'php', |
3672 $settings['codemirror'], |
3383 'autoCloseBrackets' => true, |
3673 array( |
3384 'autoCloseTags' => true, |
3674 'mode' => 'php', |
3385 'matchBrackets' => true, |
3675 'autoCloseBrackets' => true, |
3386 'matchTags' => array( |
3676 'autoCloseTags' => true, |
3387 'bothTags' => true, |
3677 'matchBrackets' => true, |
3388 ), |
3678 'matchTags' => array( |
3389 ) ); |
3679 'bothTags' => true, |
|
3680 ), |
|
3681 ) |
|
3682 ); |
3390 } elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) { |
3683 } elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) { |
3391 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3684 $settings['codemirror'] = array_merge( |
3392 'mode' => 'sql', |
3685 $settings['codemirror'], |
3393 'autoCloseBrackets' => true, |
3686 array( |
3394 'matchBrackets' => true, |
3687 'mode' => 'sql', |
3395 ) ); |
3688 'autoCloseBrackets' => true, |
|
3689 'matchBrackets' => true, |
|
3690 ) |
|
3691 ); |
3396 } elseif ( false !== strpos( $type, 'xml' ) ) { |
3692 } elseif ( false !== strpos( $type, 'xml' ) ) { |
3397 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3693 $settings['codemirror'] = array_merge( |
3398 'mode' => 'xml', |
3694 $settings['codemirror'], |
3399 'autoCloseBrackets' => true, |
3695 array( |
3400 'autoCloseTags' => true, |
3696 'mode' => 'xml', |
3401 'matchTags' => array( |
3697 'autoCloseBrackets' => true, |
3402 'bothTags' => true, |
3698 'autoCloseTags' => true, |
3403 ), |
3699 'matchTags' => array( |
3404 ) ); |
3700 'bothTags' => true, |
|
3701 ), |
|
3702 ) |
|
3703 ); |
3405 } elseif ( 'text/x-yaml' === $type ) { |
3704 } elseif ( 'text/x-yaml' === $type ) { |
3406 $settings['codemirror'] = array_merge( $settings['codemirror'], array( |
3705 $settings['codemirror'] = array_merge( |
3407 'mode' => 'yaml', |
3706 $settings['codemirror'], |
3408 ) ); |
3707 array( |
|
3708 'mode' => 'yaml', |
|
3709 ) |
|
3710 ); |
3409 } else { |
3711 } else { |
3410 $settings['codemirror']['mode'] = $type; |
3712 $settings['codemirror']['mode'] = $type; |
3411 } |
3713 } |
3412 |
3714 |
3413 if ( ! empty( $settings['codemirror']['lint'] ) ) { |
3715 if ( ! empty( $settings['codemirror']['lint'] ) ) { |
3441 * @type array $csslint CSSLint rule overrides. |
3743 * @type array $csslint CSSLint rule overrides. |
3442 * @type array $jshint JSHint rule overrides. |
3744 * @type array $jshint JSHint rule overrides. |
3443 * @type array $htmlhint JSHint rule overrides. |
3745 * @type array $htmlhint JSHint rule overrides. |
3444 * } |
3746 * } |
3445 */ |
3747 */ |
3446 $settings = apply_filters( 'wp_code_editor_settings', $settings, $args ); |
3748 return apply_filters( 'wp_code_editor_settings', $settings, $args ); |
3447 |
|
3448 if ( empty( $settings ) || empty( $settings['codemirror'] ) ) { |
|
3449 return false; |
|
3450 } |
|
3451 |
|
3452 wp_enqueue_script( 'code-editor' ); |
|
3453 wp_enqueue_style( 'code-editor' ); |
|
3454 |
|
3455 if ( isset( $settings['codemirror']['mode'] ) ) { |
|
3456 $mode = $settings['codemirror']['mode']; |
|
3457 if ( is_string( $mode ) ) { |
|
3458 $mode = array( |
|
3459 'name' => $mode, |
|
3460 ); |
|
3461 } |
|
3462 |
|
3463 if ( ! empty( $settings['codemirror']['lint'] ) ) { |
|
3464 switch ( $mode['name'] ) { |
|
3465 case 'css': |
|
3466 case 'text/css': |
|
3467 case 'text/x-scss': |
|
3468 case 'text/x-less': |
|
3469 wp_enqueue_script( 'csslint' ); |
|
3470 break; |
|
3471 case 'htmlmixed': |
|
3472 case 'text/html': |
|
3473 case 'php': |
|
3474 case 'application/x-httpd-php': |
|
3475 case 'text/x-php': |
|
3476 wp_enqueue_script( 'htmlhint' ); |
|
3477 wp_enqueue_script( 'csslint' ); |
|
3478 wp_enqueue_script( 'jshint' ); |
|
3479 if ( ! current_user_can( 'unfiltered_html' ) ) { |
|
3480 wp_enqueue_script( 'htmlhint-kses' ); |
|
3481 } |
|
3482 break; |
|
3483 case 'javascript': |
|
3484 case 'application/ecmascript': |
|
3485 case 'application/json': |
|
3486 case 'application/javascript': |
|
3487 case 'application/ld+json': |
|
3488 case 'text/typescript': |
|
3489 case 'application/typescript': |
|
3490 wp_enqueue_script( 'jshint' ); |
|
3491 wp_enqueue_script( 'jsonlint' ); |
|
3492 break; |
|
3493 } |
|
3494 } |
|
3495 } |
|
3496 |
|
3497 wp_add_inline_script( 'code-editor', sprintf( 'jQuery.extend( wp.codeEditor.defaultSettings, %s );', wp_json_encode( $settings ) ) ); |
|
3498 |
|
3499 /** |
|
3500 * Fires when scripts and styles are enqueued for the code editor. |
|
3501 * |
|
3502 * @since 4.9.0 |
|
3503 * |
|
3504 * @param array $settings Settings for the enqueued code editor. |
|
3505 */ |
|
3506 do_action( 'wp_enqueue_code_editor', $settings ); |
|
3507 |
|
3508 return $settings; |
|
3509 } |
3749 } |
3510 |
3750 |
3511 /** |
3751 /** |
3512 * Retrieves the contents of the search WordPress query variable. |
3752 * Retrieves the contents of the search WordPress query variable. |
3513 * |
3753 * |
3783 */ |
4026 */ |
3784 $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; |
4027 $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; |
3785 endif; |
4028 endif; |
3786 for ( $n = 1; $n <= $total; $n++ ) : |
4029 for ( $n = 1; $n <= $total; $n++ ) : |
3787 if ( $n == $current ) : |
4030 if ( $n == $current ) : |
3788 $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>"; |
4031 $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>'; |
3789 $dots = true; |
4032 $dots = true; |
3790 else : |
4033 else : |
3791 if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : |
4034 if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : |
3792 $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
4035 $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
3793 $link = str_replace( '%#%', $n, $link ); |
4036 $link = str_replace( '%#%', $n, $link ); |
3794 if ( $add_args ) |
4037 if ( $add_args ) { |
3795 $link = add_query_arg( $add_args, $link ); |
4038 $link = add_query_arg( $add_args, $link ); |
|
4039 } |
3796 $link .= $args['add_fragment']; |
4040 $link .= $args['add_fragment']; |
3797 |
4041 |
3798 /** This filter is documented in wp-includes/general-template.php */ |
4042 /** This filter is documented in wp-includes/general-template.php */ |
3799 $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>"; |
4043 $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>'; |
3800 $dots = true; |
4044 $dots = true; |
3801 elseif ( $dots && ! $args['show_all'] ) : |
4045 elseif ( $dots && ! $args['show_all'] ) : |
3802 $page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>'; |
4046 $page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>'; |
3803 $dots = false; |
4047 $dots = false; |
3804 endif; |
4048 endif; |
3805 endif; |
4049 endif; |
3806 endfor; |
4050 endfor; |
3807 if ( $args['prev_next'] && $current && $current < $total ) : |
4051 if ( $args['prev_next'] && $current && $current < $total ) : |
3808 $link = str_replace( '%_%', $args['format'], $args['base'] ); |
4052 $link = str_replace( '%_%', $args['format'], $args['base'] ); |
3809 $link = str_replace( '%#%', $current + 1, $link ); |
4053 $link = str_replace( '%#%', $current + 1, $link ); |
3810 if ( $add_args ) |
4054 if ( $add_args ) { |
3811 $link = add_query_arg( $add_args, $link ); |
4055 $link = add_query_arg( $add_args, $link ); |
|
4056 } |
3812 $link .= $args['add_fragment']; |
4057 $link .= $args['add_fragment']; |
3813 |
4058 |
3814 /** This filter is documented in wp-includes/general-template.php */ |
4059 /** This filter is documented in wp-includes/general-template.php */ |
3815 $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>'; |
4060 $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>'; |
3816 endif; |
4061 endif; |
3817 switch ( $args['type'] ) { |
4062 switch ( $args['type'] ) { |
3818 case 'array' : |
4063 case 'array': |
3819 return $page_links; |
4064 return $page_links; |
3820 |
4065 |
3821 case 'list' : |
4066 case 'list': |
3822 $r .= "<ul class='page-numbers'>\n\t<li>"; |
4067 $r .= "<ul class='page-numbers'>\n\t<li>"; |
3823 $r .= join("</li>\n\t<li>", $page_links); |
4068 $r .= join( "</li>\n\t<li>", $page_links ); |
3824 $r .= "</li>\n</ul>\n"; |
4069 $r .= "</li>\n</ul>\n"; |
3825 break; |
4070 break; |
3826 |
4071 |
3827 default : |
4072 default: |
3828 $r = join("\n", $page_links); |
4073 $r = join( "\n", $page_links ); |
3829 break; |
4074 break; |
3830 } |
4075 } |
3831 return $r; |
4076 return $r; |
3832 } |
4077 } |
3833 |
4078 |
3834 /** |
4079 /** |
3835 * Registers an admin colour scheme css file. |
4080 * Registers an admin color scheme css file. |
3836 * |
4081 * |
3837 * Allows a plugin to register a new admin colour scheme. For example: |
4082 * Allows a plugin to register a new admin color scheme. For example: |
3838 * |
4083 * |
3839 * wp_admin_css_color( 'classic', __( 'Classic' ), admin_url( "css/colors-classic.css" ), array( |
4084 * wp_admin_css_color( 'classic', __( 'Classic' ), admin_url( "css/colors-classic.css" ), array( |
3840 * '#07273E', '#14568A', '#D54E21', '#2683AE' |
4085 * '#07273E', '#14568A', '#D54E21', '#2683AE' |
3841 * ) ); |
4086 * ) ); |
3842 * |
4087 * |
3858 * } |
4103 * } |
3859 */ |
4104 */ |
3860 function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { |
4105 function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { |
3861 global $_wp_admin_css_colors; |
4106 global $_wp_admin_css_colors; |
3862 |
4107 |
3863 if ( !isset($_wp_admin_css_colors) ) |
4108 if ( ! isset( $_wp_admin_css_colors ) ) { |
3864 $_wp_admin_css_colors = array(); |
4109 $_wp_admin_css_colors = array(); |
3865 |
4110 } |
3866 $_wp_admin_css_colors[$key] = (object) array( |
4111 |
3867 'name' => $name, |
4112 $_wp_admin_css_colors[ $key ] = (object) array( |
3868 'url' => $url, |
4113 'name' => $name, |
3869 'colors' => $colors, |
4114 'url' => $url, |
|
4115 'colors' => $colors, |
3870 'icon_colors' => $icons, |
4116 'icon_colors' => $icons, |
3871 ); |
4117 ); |
3872 } |
4118 } |
3873 |
4119 |
3874 /** |
4120 /** |
3875 * Registers the default Admin color schemes |
4121 * Registers the default admin color schemes. |
|
4122 * |
|
4123 * Registers the initial set of eight color schemes in the Profile section |
|
4124 * of the dashboard which allows for styling the admin menu and toolbar. |
|
4125 * |
|
4126 * @see wp_admin_css_color() |
3876 * |
4127 * |
3877 * @since 3.0.0 |
4128 * @since 3.0.0 |
3878 */ |
4129 */ |
3879 function register_admin_color_schemes() { |
4130 function register_admin_color_schemes() { |
3880 $suffix = is_rtl() ? '-rtl' : ''; |
4131 $suffix = is_rtl() ? '-rtl' : ''; |
3881 $suffix .= SCRIPT_DEBUG ? '' : '.min'; |
4132 $suffix .= SCRIPT_DEBUG ? '' : '.min'; |
3882 |
4133 |
3883 wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ), |
4134 wp_admin_css_color( |
|
4135 'fresh', |
|
4136 _x( 'Default', 'admin color scheme' ), |
3884 false, |
4137 false, |
3885 array( '#222', '#333', '#0073aa', '#00a0d2' ), |
4138 array( '#222', '#333', '#0073aa', '#00a0d2' ), |
3886 array( 'base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff' ) |
4139 array( |
|
4140 'base' => '#a0a5aa', |
|
4141 'focus' => '#00a0d2', |
|
4142 'current' => '#fff', |
|
4143 ) |
3887 ); |
4144 ); |
3888 |
4145 |
3889 // Other color schemes are not available when running out of src |
4146 // Other color schemes are not available when running out of src |
3890 if ( false !== strpos( get_bloginfo( 'version' ), '-src' ) ) { |
4147 if ( false !== strpos( get_bloginfo( 'version' ), '-src' ) ) { |
3891 return; |
4148 return; |
3892 } |
4149 } |
3893 |
4150 |
3894 wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ), |
4151 wp_admin_css_color( |
|
4152 'light', |
|
4153 _x( 'Light', 'admin color scheme' ), |
3895 admin_url( "css/colors/light/colors$suffix.css" ), |
4154 admin_url( "css/colors/light/colors$suffix.css" ), |
3896 array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ), |
4155 array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ), |
3897 array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc' ) |
4156 array( |
|
4157 'base' => '#999', |
|
4158 'focus' => '#ccc', |
|
4159 'current' => '#ccc', |
|
4160 ) |
3898 ); |
4161 ); |
3899 |
4162 |
3900 wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ), |
4163 wp_admin_css_color( |
|
4164 'blue', |
|
4165 _x( 'Blue', 'admin color scheme' ), |
3901 admin_url( "css/colors/blue/colors$suffix.css" ), |
4166 admin_url( "css/colors/blue/colors$suffix.css" ), |
3902 array( '#096484', '#4796b3', '#52accc', '#74B6CE' ), |
4167 array( '#096484', '#4796b3', '#52accc', '#74B6CE' ), |
3903 array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' ) |
4168 array( |
|
4169 'base' => '#e5f8ff', |
|
4170 'focus' => '#fff', |
|
4171 'current' => '#fff', |
|
4172 ) |
3904 ); |
4173 ); |
3905 |
4174 |
3906 wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ), |
4175 wp_admin_css_color( |
|
4176 'midnight', |
|
4177 _x( 'Midnight', 'admin color scheme' ), |
3907 admin_url( "css/colors/midnight/colors$suffix.css" ), |
4178 admin_url( "css/colors/midnight/colors$suffix.css" ), |
3908 array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ), |
4179 array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ), |
3909 array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' ) |
4180 array( |
|
4181 'base' => '#f1f2f3', |
|
4182 'focus' => '#fff', |
|
4183 'current' => '#fff', |
|
4184 ) |
3910 ); |
4185 ); |
3911 |
4186 |
3912 wp_admin_css_color( 'sunrise', _x( 'Sunrise', 'admin color scheme' ), |
4187 wp_admin_css_color( |
|
4188 'sunrise', |
|
4189 _x( 'Sunrise', 'admin color scheme' ), |
3913 admin_url( "css/colors/sunrise/colors$suffix.css" ), |
4190 admin_url( "css/colors/sunrise/colors$suffix.css" ), |
3914 array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ), |
4191 array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ), |
3915 array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff' ) |
4192 array( |
|
4193 'base' => '#f3f1f1', |
|
4194 'focus' => '#fff', |
|
4195 'current' => '#fff', |
|
4196 ) |
3916 ); |
4197 ); |
3917 |
4198 |
3918 wp_admin_css_color( 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ), |
4199 wp_admin_css_color( |
|
4200 'ectoplasm', |
|
4201 _x( 'Ectoplasm', 'admin color scheme' ), |
3919 admin_url( "css/colors/ectoplasm/colors$suffix.css" ), |
4202 admin_url( "css/colors/ectoplasm/colors$suffix.css" ), |
3920 array( '#413256', '#523f6d', '#a3b745', '#d46f15' ), |
4203 array( '#413256', '#523f6d', '#a3b745', '#d46f15' ), |
3921 array( 'base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff' ) |
4204 array( |
|
4205 'base' => '#ece6f6', |
|
4206 'focus' => '#fff', |
|
4207 'current' => '#fff', |
|
4208 ) |
3922 ); |
4209 ); |
3923 |
4210 |
3924 wp_admin_css_color( 'ocean', _x( 'Ocean', 'admin color scheme' ), |
4211 wp_admin_css_color( |
|
4212 'ocean', |
|
4213 _x( 'Ocean', 'admin color scheme' ), |
3925 admin_url( "css/colors/ocean/colors$suffix.css" ), |
4214 admin_url( "css/colors/ocean/colors$suffix.css" ), |
3926 array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ), |
4215 array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ), |
3927 array( 'base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff' ) |
4216 array( |
|
4217 'base' => '#f2fcff', |
|
4218 'focus' => '#fff', |
|
4219 'current' => '#fff', |
|
4220 ) |
3928 ); |
4221 ); |
3929 |
4222 |
3930 wp_admin_css_color( 'coffee', _x( 'Coffee', 'admin color scheme' ), |
4223 wp_admin_css_color( |
|
4224 'coffee', |
|
4225 _x( 'Coffee', 'admin color scheme' ), |
3931 admin_url( "css/colors/coffee/colors$suffix.css" ), |
4226 admin_url( "css/colors/coffee/colors$suffix.css" ), |
3932 array( '#46403c', '#59524c', '#c7a589', '#9ea476' ), |
4227 array( '#46403c', '#59524c', '#c7a589', '#9ea476' ), |
3933 array( 'base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff' ) |
4228 array( |
|
4229 'base' => '#f3f2f1', |
|
4230 'focus' => '#fff', |
|
4231 'current' => '#fff', |
|
4232 ) |
3934 ); |
4233 ); |
3935 |
4234 |
3936 } |
4235 } |
3937 |
4236 |
3938 /** |
4237 /** |