summaryrefslogtreecommitdiffstats
path: root/wp-includes/general-template.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-10-05 17:45:26 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-10-05 17:45:26 +0000
commit767c3538b9f4aa2684429a7efea8f7728034c754 (patch)
tree8cc7b4bc82bfc8e5cc2179b7a8aa7b4f9a2be193 /wp-includes/general-template.php
parent23c0a299ada091cdeece968ad5cd3bdd20f5ef3c (diff)
downloadwordpress-mu-767c3538b9f4aa2684429a7efea8f7728034c754.tar.gz
wordpress-mu-767c3538b9f4aa2684429a7efea8f7728034c754.tar.xz
wordpress-mu-767c3538b9f4aa2684429a7efea8f7728034c754.zip
WP Merge to rev 4347
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@789 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/general-template.php')
-rw-r--r--wp-includes/general-template.php102
1 files changed, 95 insertions, 7 deletions
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 2cb5c02..ab68a5d 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -40,7 +40,7 @@ function wp_register( $before = '<li>', $after = '</li>' ) {
if ( ! is_user_logged_in() ) {
if ( get_option('users_can_register') )
- $link = $before . '<a href="' . get_option('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after;
+ $link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
else
$link = '';
} else {
@@ -154,6 +154,7 @@ function wp_title($sep = '&raquo;', $display = true) {
$category_name = get_query_var('category_name');
$author = get_query_var('author');
$author_name = get_query_var('author_name');
+ $title = '';
// If there's a category
if ( !empty($cat) ) {
@@ -259,13 +260,17 @@ function single_month_title($prefix = '', $display = true ) {
$my_month = $wp_locale->get_month($monthnum);
} elseif ( !empty($m) ) {
$my_year = substr($m, 0, 4);
- $my_month = $wp_locale->get_month($m);
+ $my_month = $wp_locale->get_month(substr($m, 4, 2));
}
- if ( !empty($my_month) && $display )
- echo $prefix . $my_month . $prefix . $my_year;
- else
- return $monthnum;
+ if ( empty($my_month) )
+ return false;
+
+ $result = $prefix . $my_month . $prefix . $my_year;
+
+ if ( !$display )
+ return $result;
+ echo $result;
}
@@ -772,7 +777,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
</style>
<div id='edButtons' style='display:none;'>
<div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div>
- <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' />
+ <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Editor'); ?>' />
<input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('HTML'); ?>' onclick='switchEditors("<?php echo $id; ?>")' />
</div>
<script type="text/javascript">
@@ -878,4 +883,87 @@ function language_attributes() {
echo $output;
}
+
+function paginate_links( $arg = '' ) {
+ if ( is_array($arg) )
+ $a = &$arg;
+ else
+ parse_str($arg, $a);
+
+ // Defaults
+ $base = '%_%'; // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
+ $format = '?page=%#%'; // ?page=%#% : %#% is replaced by the page number
+ $total = 1;
+ $current = 0;
+ $show_all = false;
+ $prev_next = true;
+ $prev_text = __('&laquo; Previous');
+ $next_text = __('Next &raquo;');
+ $end_size = 1; // How many numbers on either end including the end
+ $mid_size = 2; // How many numbers to either side of current not including current
+ $type = 'plain';
+ $add_args = false; // array of query args to aadd
+
+ extract($a);
+
+ // Who knows what else people pass in $args
+ $total = (int) $total;
+ if ( $total < 2 )
+ return;
+ $current = (int) $current;
+ $end_size = 0 < (int) $end_size ? (int) $end_size : 1; // Out of bounds? Make it the default.
+ $mid_size = 0 <= (int) $mid_size ? (int) $mid_size : 2;
+ $add_args = is_array($add_args) ? $add_args : false;
+ $r = '';
+ $page_links = array();
+ $n = 0;
+ $dots = false;
+
+ if ( $prev_next && $current && 1 < $current ) :
+ $link = str_replace('%_%', 2 == $current ? '' : $format, $base);
+ $link = str_replace('%#%', $current - 1, $link);
+ if ( $add_args )
+ $link = add_query_arg( $add_args, $link );
+ $page_links[] = "<a class='prev page-numbers' href='" . wp_specialchars( $link, 1 ) . "'>$prev_text</a>";
+ endif;
+ for ( $n = 1; $n <= $total; $n++ ) :
+ if ( $n == $current ) :
+ $page_links[] = "<span class='page-numbers current'>$n</span>";
+ $dots = true;
+ else :
+ if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
+ $link = str_replace('%_%', 1 == $n ? '' : $format, $base);
+ $link = str_replace('%#%', $n, $link);
+ if ( $add_args )
+ $link = add_query_arg( $add_args, $link );
+ $page_links[] = "<a class='page-numbers' href='" . wp_specialchars( $link, 1 ) . "'>$n</a>";
+ $dots = true;
+ elseif ( $dots && !$show_all ) :
+ $page_links[] = "<span class='page-numbers dots'>...</span>";
+ $dots = false;
+ endif;
+ endif;
+ endfor;
+ if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) :
+ $link = str_replace('%_%', $format, $base);
+ $link = str_replace('%#%', $current + 1, $link);
+ if ( $add_args )
+ $link = add_query_arg( $add_args, $link );
+ $page_links[] = "<a class='next page-numbers' href='" . wp_specialchars( $link, 1 ) . "'>$next_text</a>";
+ endif;
+ switch ( $type ) :
+ case 'array' :
+ return $page_links;
+ break;
+ case 'list' :
+ $r .= "<ul class='page-numbers'>\n\t<li>";
+ $r .= join("</li>\n\t<li>", $page_links);
+ $r .= "</li>\n</ul>\n";
+ break;
+ default :
+ $r = join("\n", $page_links);
+ break;
+ endswitch;
+ return $r;
+}
?>