~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-includes/general-template.php

  • Committer: Andrew Glen-Young
  • Date: 2011-03-08 14:47:51 UTC
  • Revision ID: andrew.glen-young@canonical.com-20110308144751-1n6spqgayztf9h77
[AGY] import 3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
function get_search_form($echo = true) {
152
152
        do_action( 'get_search_form' );
153
153
 
154
 
        $search_form_template = locate_template(array('searchform.php'));
 
154
        $search_form_template = locate_template('searchform.php');
155
155
        if ( '' != $search_form_template ) {
156
156
                require($search_form_template);
157
157
                return;
199
199
 *
200
200
 * Returns the URL that allows the user to log out of the site
201
201
 *
202
 
 * @since 2.7
 
202
 * @since 2.7.0
203
203
 * @uses wp_nonce_url() To protect against CSRF
204
204
 * @uses site_url() To generate the log in URL
205
205
 * @uses apply_filters() calls 'logout_url' hook on final logout url
223
223
 *
224
224
 * Returns the URL that allows the user to log in to the site
225
225
 *
226
 
 * @since 2.7
 
226
 * @since 2.7.0
227
227
 * @uses site_url() To generate the log in URL
228
228
 * @uses apply_filters() calls 'login_url' hook on final login url
229
229
 *
271
271
 
272
272
        $form = '
273
273
                <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . site_url( 'wp-login.php', 'login' ) . '" method="post">
274
 
                        ' . apply_filters( 'login_form_top', '' ) . '
 
274
                        ' . apply_filters( 'login_form_top', '', $args ) . '
275
275
                        <p class="login-username">
276
276
                                <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
277
277
                                <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" tabindex="10" />
280
280
                                <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
281
281
                                <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" tabindex="20" />
282
282
                        </p>
283
 
                        ' . apply_filters( 'login_form_middle', '' ) . '
 
283
                        ' . apply_filters( 'login_form_middle', '', $args ) . '
284
284
                        ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever" tabindex="90"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . '
285
285
                        <p class="login-submit">
286
286
                                <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" tabindex="100" />
287
287
                                <input type="hidden" name="redirect_to" value="' . esc_attr( $args['redirect'] ) . '" />
288
288
                        </p>
289
 
                        ' . apply_filters( 'login_form_bottom', '' ) . '
 
289
                        ' . apply_filters( 'login_form_bottom', '', $args ) . '
290
290
                </form>';
291
291
 
292
292
        if ( $args['echo'] )
381
381
 *
382
382
 * The possible values for the 'show' parameter are listed below.
383
383
 * <ol>
384
 
 * <li><strong>url<strong> - Blog URI to homepage.</li>
 
384
 * <li><strong>url</strong> - Blog URI to homepage.</li>
385
385
 * <li><strong>wpurl</strong> - Blog URI path to WordPress.</li>
386
386
 * <li><strong>description</strong> - Secondary title</li>
387
387
 * </ol>
492
492
}
493
493
 
494
494
/**
 
495
 * Retrieve the current blog id
 
496
 *
 
497
 * @since 3.1.0
 
498
 *
 
499
 * @return int Blog id
 
500
 */
 
501
function get_current_blog_id() {
 
502
        global $blog_id;
 
503
        return absint($blog_id);
 
504
}
 
505
 
 
506
/**
495
507
 * Display or retrieve page title for all areas of blog.
496
508
 *
497
509
 * By default, the page title will display the separator before the page title,
514
526
 * @return string|null String on retrieve, null when displaying.
515
527
 */
516
528
function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
517
 
        global $wpdb, $wp_locale, $wp_query;
 
529
        global $wpdb, $wp_locale;
518
530
 
519
 
        $cat = get_query_var('cat');
520
 
        $tag = get_query_var('tag_id');
521
 
        $category_name = get_query_var('category_name');
522
 
        $author = get_query_var('author');
523
 
        $author_name = get_query_var('author_name');
524
531
        $m = get_query_var('m');
525
532
        $year = get_query_var('year');
526
533
        $monthnum = get_query_var('monthnum');
530
537
 
531
538
        $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
532
539
 
533
 
        // If there's a category
534
 
        if ( !empty($cat) ) {
535
 
                        // category exclusion
536
 
                        if ( !stristr($cat,'-') )
537
 
                                $title = apply_filters('single_cat_title', get_the_category_by_ID($cat));
538
 
        } elseif ( !empty($category_name) ) {
539
 
                if ( stristr($category_name,'/') ) {
540
 
                                $category_name = explode('/',$category_name);
541
 
                                if ( $category_name[count($category_name)-1] )
542
 
                                        $category_name = $category_name[count($category_name)-1]; // no trailing slash
543
 
                                else
544
 
                                        $category_name = $category_name[count($category_name)-2]; // there was a trailling slash
545
 
                }
546
 
                $cat = get_term_by('slug', $category_name, 'category', OBJECT, 'display');
547
 
                if ( $cat )
548
 
                        $title = apply_filters('single_cat_title', $cat->name);
549
 
        }
550
 
 
551
 
        if ( !empty($tag) ) {
552
 
                $tag = get_term($tag, 'post_tag', OBJECT, 'display');
553
 
                if ( is_wp_error( $tag ) )
554
 
                        return $tag;
555
 
                if ( ! empty($tag->name) )
556
 
                        $title = apply_filters('single_tag_title', $tag->name);
 
540
        // If there is a post
 
541
        if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
 
542
                $title = single_post_title( '', false );
 
543
        }
 
544
 
 
545
        // If there's a category or tag
 
546
        if ( is_category() || is_tag() ) {
 
547
                $title = single_term_title( '', false );
 
548
        }
 
549
 
 
550
        // If there's a taxonomy
 
551
        if ( is_tax() ) {
 
552
                $term = get_queried_object();
 
553
                $tax = get_taxonomy( $term->taxonomy );
 
554
                $title = single_term_title( $tax->labels->name . $t_sep, false );
557
555
        }
558
556
 
559
557
        // If there's an author
560
 
        if ( !empty($author) ) {
561
 
                $title = get_userdata($author);
562
 
                $title = $title->display_name;
563
 
        }
564
 
        if ( !empty($author_name) ) {
565
 
                // We do a direct query here because we don't cache by nicename.
566
 
                $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name));
567
 
        }
 
558
        if ( is_author() ) {
 
559
                $author = get_queried_object();
 
560
                $title = $author->display_name;
 
561
        }
 
562
 
 
563
        // If there's a post type archive
 
564
        if ( is_post_type_archive() )
 
565
                $title = post_type_archive_title( '', false );
568
566
 
569
567
        // If there's a month
570
 
        if ( !empty($m) ) {
 
568
        if ( is_archive() && !empty($m) ) {
571
569
                $my_year = substr($m, 0, 4);
572
570
                $my_month = $wp_locale->get_month(substr($m, 4, 2));
573
571
                $my_day = intval(substr($m, 6, 2));
574
572
                $title = $my_year . ($my_month ? $t_sep . $my_month : "") . ($my_day ? $t_sep . $my_day : "");
575
573
        }
576
574
 
577
 
        if ( !empty($year) ) {
 
575
        // If there's a year
 
576
        if ( is_archive() && !empty($year) ) {
578
577
                $title = $year;
579
578
                if ( !empty($monthnum) )
580
579
                        $title .= $t_sep . $wp_locale->get_month($monthnum);
582
581
                        $title .= $t_sep . zeroise($day, 2);
583
582
        }
584
583
 
585
 
        // If there is a post
586
 
        if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
587
 
                $post = $wp_query->get_queried_object();
588
 
                $title = apply_filters( 'single_post_title', $post->post_title );
589
 
        }
590
 
 
591
 
        // If there's a taxonomy
592
 
        if ( is_tax() ) {
593
 
                $taxonomy = get_query_var( 'taxonomy' );
594
 
                $tax = get_taxonomy( $taxonomy );
595
 
                $term = $wp_query->get_queried_object();
596
 
                $term = $term->name;
597
 
                $title = $tax->labels->name . $t_sep . $term;
598
 
        }
599
 
 
600
 
        //If it's a search
 
584
        // If it's a search
601
585
        if ( is_search() ) {
602
586
                /* translators: 1: separator, 2: search phrase */
603
587
                $title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search));
604
588
        }
605
589
 
 
590
        // If it's a 404 page
606
591
        if ( is_404() ) {
607
592
                $title = __('Page not found');
608
593
        }
635
620
 * Display or retrieve page title for post.
636
621
 *
637
622
 * This is optimized for single.php template file for displaying the post title.
638
 
 * Only useful for posts, does not support pages for example.
639
623
 *
640
624
 * It does not support placing the separator after the title, but by leaving the
641
625
 * prefix parameter empty, you can set the title separator manually. The prefix
643
627
 * be a space, the parameter value will need to have it at the end.
644
628
 *
645
629
 * @since 0.71
646
 
 * @uses $wpdb
647
630
 *
648
631
 * @param string $prefix Optional. What to display before the title.
649
632
 * @param bool $display Optional, default is true. Whether to display or retrieve title.
650
633
 * @return string|null Title when retrieving, null when displaying or failure.
651
634
 */
652
635
function single_post_title($prefix = '', $display = true) {
653
 
        global $wp_query, $post;
654
 
 
655
 
        if ( ! $post )
656
 
                $_post = $wp_query->get_queried_object();
657
 
        else
658
 
                $_post = $post;
 
636
        $_post = get_queried_object();
659
637
 
660
638
        if ( !isset($_post->post_title) )
661
639
                return;
668
646
}
669
647
 
670
648
/**
 
649
 * Display or retrieve title for a post type archive.
 
650
 *
 
651
 * This is optimized for archive.php and archive-{$post_type}.php template files
 
652
 * for displaying the title of the post type.
 
653
 *
 
654
 * @since 3.1.0
 
655
 *
 
656
 * @param string $prefix Optional. What to display before the title.
 
657
 * @param bool $display Optional, default is true. Whether to display or retrieve title.
 
658
 * @return string|null Title when retrieving, null when displaying or failure.
 
659
 */
 
660
function post_type_archive_title( $prefix = '', $display = true ) {
 
661
        if ( ! is_post_type_archive() )
 
662
                return;
 
663
 
 
664
        $post_type_obj = get_queried_object();
 
665
        $title = apply_filters('post_type_archive_title', $post_type_obj->labels->name );
 
666
 
 
667
        if ( $display )
 
668
                echo $prefix . $title;
 
669
        else
 
670
                return $title;
 
671
}
 
672
 
 
673
/**
671
674
 * Display or retrieve page title for category archive.
672
675
 *
673
676
 * This is useful for category template file or files, because it is optimized
684
687
 * @param bool $display Optional, default is true. Whether to display or retrieve title.
685
688
 * @return string|null Title when retrieving, null when displaying or failure.
686
689
 */
687
 
function single_cat_title($prefix = '', $display = true ) {
688
 
        global $wp_query;
689
 
 
690
 
        if ( is_tag() )
691
 
                return single_tag_title($prefix, $display);
692
 
 
693
 
        if ( !is_category() )
694
 
                return;
695
 
 
696
 
        $cat = $wp_query->get_queried_object();
697
 
        $my_cat_name = apply_filters('single_cat_title', $cat->name);
698
 
        if ( !empty($my_cat_name) ) {
699
 
                if ( $display )
700
 
                        echo $prefix . $my_cat_name;
701
 
                else
702
 
                        return $my_cat_name;
703
 
        }
 
690
function single_cat_title( $prefix = '', $display = true ) {
 
691
        return single_term_title( $prefix, $display );
704
692
}
705
693
 
706
694
/**
720
708
 * @param bool $display Optional, default is true. Whether to display or retrieve title.
721
709
 * @return string|null Title when retrieving, null when displaying or failure.
722
710
 */
723
 
function single_tag_title($prefix = '', $display = true ) {
724
 
        global $wp_query;
725
 
        if ( !is_tag() )
726
 
                return;
727
 
 
728
 
        $tag = $wp_query->get_queried_object();
729
 
 
730
 
        if ( ! $tag )
731
 
                return;
732
 
 
733
 
        $my_tag_name = apply_filters('single_tag_title', $tag->name);
734
 
        if ( !empty($my_tag_name) ) {
735
 
                if ( $display )
736
 
                        echo $prefix . $my_tag_name;
737
 
                else
738
 
                        return $my_tag_name;
739
 
        }
 
711
function single_tag_title( $prefix = '', $display = true ) {
 
712
        return single_term_title( $prefix, $display );
 
713
}
 
714
 
 
715
/**
 
716
 * Display or retrieve page title for taxonomy term archive.
 
717
 *
 
718
 * Useful for taxonomy term template files for displaying the taxonomy term page title.
 
719
 * It has less overhead than {@link wp_title()}, because of its limited implementation.
 
720
 *
 
721
 * It does not support placing the separator after the title, but by leaving the
 
722
 * prefix parameter empty, you can set the title separator manually. The prefix
 
723
 * does not automatically place a space between the prefix, so if there should
 
724
 * be a space, the parameter value will need to have it at the end.
 
725
 *
 
726
 * @since 3.1.0
 
727
 *
 
728
 * @param string $prefix Optional. What to display before the title.
 
729
 * @param bool $display Optional, default is true. Whether to display or retrieve title.
 
730
 * @return string|null Title when retrieving, null when displaying or failure.
 
731
 */
 
732
function single_term_title( $prefix = '', $display = true ) {
 
733
        $term = get_queried_object();
 
734
 
 
735
        if ( !$term )
 
736
                return;
 
737
 
 
738
        if ( is_category() )
 
739
                $term_name = apply_filters( 'single_cat_title', $term->name );
 
740
        elseif ( is_tag() )
 
741
                $term_name = apply_filters( 'single_tag_title', $term->name );
 
742
        elseif ( is_tax() )
 
743
                $term_name = apply_filters( 'single_term_title', $term->name );
 
744
        else
 
745
                return;
 
746
 
 
747
        if ( empty( $term_name ) )
 
748
                return;
 
749
 
 
750
        if ( $display )
 
751
                echo $prefix . $term_name;
 
752
        else
 
753
                return $term_name;
740
754
}
741
755
 
742
756
/**
1101
1115
                // We need to get the month from MySQL
1102
1116
                $thisyear = ''.intval(substr($m, 0, 4));
1103
1117
                $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
1104
 
                $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
 
1118
                $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
1105
1119
        } elseif ( !empty($m) ) {
1106
1120
                $thisyear = ''.intval(substr($m, 0, 4));
1107
1121
                if ( strlen($m) < 6 )
1114
1128
        }
1115
1129
 
1116
1130
        $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
 
1131
        $last_day = date('t', $unixmonth);
1117
1132
 
1118
1133
        // Get the next and previous month and year with at least one post
1119
 
        $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
 
1134
        $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
1120
1135
                FROM $wpdb->posts
1121
1136
                WHERE post_date < '$thisyear-$thismonth-01'
1122
1137
                AND post_type = 'post' AND post_status = 'publish'
1123
1138
                        ORDER BY post_date DESC
1124
1139
                        LIMIT 1");
1125
 
        $next = $wpdb->get_row("SELECT  DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
 
1140
        $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
1126
1141
                FROM $wpdb->posts
1127
 
                WHERE post_date >       '$thisyear-$thismonth-01'
1128
 
                AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
 
1142
                WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59'
1129
1143
                AND post_type = 'post' AND post_status = 'publish'
1130
 
                        ORDER   BY post_date ASC
 
1144
                        ORDER BY post_date ASC
1131
1145
                        LIMIT 1");
1132
1146
 
1133
1147
        /* translators: Calendar caption: 1: month name, 2: 4-digit year */
1157
1171
        <tr>';
1158
1172
 
1159
1173
        if ( $previous ) {
1160
 
                $calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
 
1174
                $calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link($previous->year, $previous->month) . '" title="' . esc_attr( sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
1161
1175
        } else {
1162
1176
                $calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
1163
1177
        }
1179
1193
 
1180
1194
        // Get days with posts
1181
1195
        $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
1182
 
                FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth'
1183
 
                AND YEAR(post_date) = '$thisyear'
 
1196
                FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
1184
1197
                AND post_type = 'post' AND post_status = 'publish'
1185
 
                AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
 
1198
                AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
1186
1199
        if ( $dayswithposts ) {
1187
1200
                foreach ( (array) $dayswithposts as $daywith ) {
1188
1201
                        $daywithpost[] = $daywith[0];
1199
1212
        $ak_titles_for_day = array();
1200
1213
        $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom "
1201
1214
                ."FROM $wpdb->posts "
1202
 
                ."WHERE YEAR(post_date) = '$thisyear' "
1203
 
                ."AND MONTH(post_date) = '$thismonth' "
1204
 
                ."AND post_date < '".current_time('mysql')."' "
 
1215
                ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
 
1216
                ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
1205
1217
                ."AND post_type = 'post' AND post_status = 'publish'"
1206
1218
        );
1207
1219
        if ( $ak_post_titles ) {
1318
1330
 *
1319
1331
 * Will only output the date if the current post's date is different from the
1320
1332
 * previous one output.
1321
 
 
 
1333
 *
1322
1334
 * i.e. Only one date listing will show per day worth of posts shown in the loop, even if the
1323
1335
 * function is called several times for each post.
1324
1336
 *
1334
1346
 * @return string|null Null if displaying, string if retrieving.
1335
1347
 */
1336
1348
function the_date( $d = '', $before = '', $after = '', $echo = true ) {
1337
 
        global $day, $previousday;
 
1349
        global $currentday, $previousday;
1338
1350
        $the_date = '';
1339
 
        if ( $day != $previousday ) {
 
1351
        if ( $currentday != $previousday ) {
1340
1352
                $the_date .= $before;
1341
1353
                $the_date .= get_the_date( $d );
1342
1354
                $the_date .= $after;
1343
 
                $previousday = $day;
 
1355
                $previousday = $currentday;
1344
1356
 
1345
1357
                $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
1346
1358
 
1542
1554
 *
1543
1555
 * @param string $before Optional Output before the date.
1544
1556
 * @param string $after Optional Output after the date.
1545
 
  */
 
1557
 */
1546
1558
function the_weekday_date($before='',$after='') {
1547
1559
        global $wp_locale, $post, $day, $previousweekday;
1548
1560
        $the_weekday_date = '';
1549
 
        if ( $day != $previousweekday ) {
 
1561
        if ( $currentday != $previousweekday ) {
1550
1562
                $the_weekday_date .= $before;
1551
1563
                $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
1552
1564
                $the_weekday_date .= $after;
1553
 
                $previousweekday = $day;
 
1565
                $previousweekday = $currentday;
1554
1566
        }
1555
1567
        $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after);
1556
1568
        echo $the_weekday_date;
1635
1647
                        $href = get_post_comments_feed_link( $post->ID );
1636
1648
                }
1637
1649
        } elseif ( is_category() ) {
1638
 
                $cat_id = intval( get_query_var('cat') );
 
1650
                $term = get_queried_object();
1639
1651
 
1640
 
                $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name( $cat_id ) ));
1641
 
                $href = get_category_feed_link( $cat_id );
 
1652
                $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name ));
 
1653
                $href = get_category_feed_link( $term->term_id );
1642
1654
        } elseif ( is_tag() ) {
1643
 
                $tag_id = intval( get_query_var('tag_id') );
1644
 
                $tag = get_tag( $tag_id );
 
1655
                $term = get_queried_object();
1645
1656
 
1646
 
                $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name ));
1647
 
                $href = get_tag_feed_link( $tag_id );
 
1657
                $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name ));
 
1658
                $href = get_tag_feed_link( $term->term_id );
1648
1659
        } elseif ( is_author() ) {
1649
1660
                $author_id = intval( get_query_var('author') );
1650
1661
 
2039
2050
 * @param string $key The unique key for this theme.
2040
2051
 * @param string $name The name of the theme.
2041
2052
 * @param string $url The url of the css file containing the colour scheme.
2042
 
 * @param array @colors Optional An array of CSS color definitions which are used to give the user a feel for the theme.
 
2053
 * @param array $colors Optional An array of CSS color definitions which are used to give the user a feel for the theme.
2043
2054
 */
2044
2055
function wp_admin_css_color($key, $name, $url, $colors = array()) {
2045
2056
        global $_wp_admin_css_colors;
2056
2067
 * @since 3.0.0
2057
2068
 */
2058
2069
function register_admin_color_schemes() {
2059
 
        wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
2060
 
        wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));}
 
2070
        wp_admin_css_color( 'classic', __( 'Blue' ), admin_url( 'css/colors-classic.css' ),
 
2071
                array( '#5589aa', '#cfdfe9', '#d1e5ee', '#eff8ff' ) );
 
2072
        wp_admin_css_color( 'fresh', __( 'Gray' ), admin_url( 'css/colors-fresh.css' ),
 
2073
                array( '#7c7976', '#c6c6c6', '#e0e0e0', '#f1f1f1' ) );
 
2074
}
2061
2075
 
2062
2076
/**
2063
2077
 * Display the URL of a WordPress admin CSS file.
2097
2111
 * @since 2.3.0
2098
2112
 * @uses $wp_styles WordPress Styles Object
2099
2113
 *
2100
 
 * @param string $file Style handle name or file name (without ".css" extension) relative to wp-admin/
 
2114
 * @param string $file Optional. Style handle name or file name (without ".css" extension) relative
 
2115
 *       to wp-admin/. Defaults to 'wp-admin'.
2101
2116
 * @param bool $force_echo Optional.  Force the stylesheet link to be printed rather than enqueued.
2102
2117
 */
2103
2118
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
2133
2148
function add_thickbox() {
2134
2149
        wp_enqueue_script( 'thickbox' );
2135
2150
        wp_enqueue_style( 'thickbox' );
 
2151
 
 
2152
        if ( is_network_admin() )
 
2153
                add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
2136
2154
}
2137
2155
 
2138
2156
/**
2219
2237
                        $gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
2220
2238
                        break;
2221
2239
                case 'export':
2222
 
                        $gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '"-->';
 
2240
                        $gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->';
2223
2241
                        break;
2224
2242
        }
2225
2243
        return apply_filters( "get_the_generator_{$type}", $gen, $type );
2230
2248
 *
2231
2249
 * Compares the first two arguments and if identical marks as checked
2232
2250
 *
2233
 
 * @since 1.0
 
2251
 * @since 1.0.0
2234
2252
 *
2235
2253
 * @param mixed $checked One of the values to compare
2236
2254
 * @param mixed $current (true) The other value to compare if not just true
2246
2264
 *
2247
2265
 * Compares the first two arguments and if identical marks as selected
2248
2266
 *
2249
 
 * @since 1.0
 
2267
 * @since 1.0.0
2250
2268
 *
2251
 
 * @param mixed selected One of the values to compare
 
2269
 * @param mixed $selected One of the values to compare
2252
2270
 * @param mixed $current (true) The other value to compare if not just true
2253
2271
 * @param bool $echo Whether to echo or just return the string
2254
2272
 * @return string html attribute or empty string
2278
2296
 *
2279
2297
 * Compares the first two arguments and if identical marks as $type
2280
2298
 *
2281
 
 * @since 2.8
 
2299
 * @since 2.8.0
2282
2300
 * @access private
2283
2301
 *
2284
2302
 * @param any $helper One of the values to compare