* Filter the login URL.
*
* @since 2.8.0
+ * @since 4.2.0 The `$force_reauth` parameter was added.
*
- * @param string $login_url The login URL.
- * @param string $redirect The path to redirect to on login, if supplied.
+ * @param string $login_url The login URL.
+ * @param string $redirect The path to redirect to on login, if supplied.
+ * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present.
*/
- return apply_filters( 'login_url', $login_url, $redirect );
+ return apply_filters( 'login_url', $login_url, $redirect, $force_reauth );
}
/**
switch( $show ) {
case 'home' : // DEPRECATED
case 'siteurl' : // DEPRECATED
- _deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> option instead.' ), 'url' ) );
+ _deprecated_argument( __FUNCTION__, '2.2', sprintf(
+ /* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */
+ __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ),
+ '<code>' . $show . '</code>',
+ '<code>bloginfo()</code>',
+ '<code>url</code>'
+ ) );
case 'url' :
$output = home_url();
break;
$output = str_replace('_', '-', $output);
break;
case 'text_direction':
- //_deprecated_argument( __FUNCTION__, '2.2', sprintf( __('The <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> function instead.' ), 'is_rtl()' ) );
+ _deprecated_argument( __FUNCTION__, '2.2', sprintf(
+ /* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */
+ __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ),
+ '<code>' . $show . '</code>',
+ '<code>bloginfo()</code>',
+ '<code>is_rtl()</code>'
+ ) );
if ( function_exists( 'is_rtl' ) ) {
$output = is_rtl() ? 'rtl' : 'ltr';
} else {
/**
* Display title tag with contents.
*
+ * @ignore
* @since 4.1.0
* @access private
- * @internal
*
* @see wp_title()
*/
* @type string $before Markup to prepend to the beginning of each link. Default empty.
* @type string $after Markup to append to the end of each link. Default empty.
* @type bool $show_post_count Whether to display the post count alongside the link. Default false.
- * @type bool $echo Whether to echo or return the links list. Default 1|true to echo.
+ * @type bool|int $echo Whether to echo or return the links list. Default 1|true to echo.
* @type string $order Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'.
* Default 'DESC'.
* }
$key = "wp_get_archives:$key:$last_changed";
if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
$results = $wpdb->get_results( $query );
- $cache[ $key ] = $results;
wp_cache_set( $key, $results, 'posts' );
}
if ( $results ) {
}
}
} elseif ( ( 'postbypost' == $r['type'] ) || ('alpha' == $r['type'] ) ) {
- $orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC ';
+ $orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
<tbody>
<tr>';
+ $daywithpost = array();
+
// Get days with posts
$dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
foreach ( (array) $dayswithposts as $daywith ) {
$daywithpost[] = $daywith[0];
}
- } else {
- $daywithpost = array();
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false)
function delete_get_calendar_cache() {
wp_cache_delete( 'get_calendar', 'calendar' );
}
-add_action( 'save_post', 'delete_get_calendar_cache' );
-add_action( 'delete_post', 'delete_get_calendar_cache' );
-add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
-add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
/**
* Display all of the allowed tags in HTML format with attributes.
*
* @since 2.1.0
*
- * @param string|array $args Optional. Override defaults.
+ * @param string|array $args {
+ * Optional. Array or string of arguments for generating paginated links for archives.
+ *
+ * @type string $base Base of the paginated url. Default empty.
+ * @type string $format Format for the pagination structure. Default empty.
+ * @type int $total The total amount of pages. Default is the value WP_Query's
+ * `max_num_pages` or 1.
+ * @type int $current The current page number. Default is 'paged' query var or 1.
+ * @type bool $show_all Whether to show all pages. Default false.
+ * @type int $end_size How many numbers on either the start and the end list edges.
+ * Default 1.
+ * @type int $mid_size How many numbers to either side of the current pages. Default 2.
+ * @type bool $prev_next Whether to include the previous and next links in the list. Default true.
+ * @type bool $prev_text The previous page text. Default '« Previous'.
+ * @type bool $next_text The next page text. Default '« Previous'.
+ * @type string $type Controls format of the returned value. Possible values are 'plain',
+ * 'array' and 'list'. Default is 'plain'.
+ * @type array $add_args An array of query args to add. Default false.
+ * @type string $add_fragment A string to append to each link. Default empty.
+ * @type string $before_page_number A string to appear before the page number. Default empty.
+ * @type string $after_page_number A string to append after the page number. Default empty.
+ * }
* @return array|string String of page links or array of page links.
*/
function paginate_links( $args = '' ) {
global $wp_query, $wp_rewrite;
- $total = ( isset( $wp_query->max_num_pages ) ) ? $wp_query->max_num_pages : 1;
- $current = ( get_query_var( 'paged' ) ) ? intval( get_query_var( 'paged' ) ) : 1;
+ // Setting up default values based on the current URL.
$pagenum_link = html_entity_decode( get_pagenum_link() );
- $query_args = array();
$url_parts = explode( '?', $pagenum_link );
- if ( isset( $url_parts[1] ) ) {
- wp_parse_str( $url_parts[1], $query_args );
- $query_args = urlencode_deep( $query_args );
- }
+ // Get max pages and current page out of the current query, if available.
+ $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
+ $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
- $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
- $pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
+ // Append the format placeholder to the base URL.
+ $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
+ // URL base depends on permalink settings.
$format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
'end_size' => 1,
'mid_size' => 2,
'type' => 'plain',
- 'add_args' => $query_args, // array of query args to add
+ 'add_args' => array(), // array of query args to add
'add_fragment' => '',
'before_page_number' => '',
'after_page_number' => ''
$args = wp_parse_args( $args, $defaults );
+ if ( ! is_array( $args['add_args'] ) ) {
+ $args['add_args'] = array();
+ }
+
+ // Merge additional query vars found in the original URL into 'add_args' array.
+ if ( isset( $url_parts[1] ) ) {
+ // Find the format argument.
+ $format_query = parse_url( str_replace( '%_%', $args['format'], $args['base'] ), PHP_URL_QUERY );
+ wp_parse_str( $format_query, $format_arg );
+
+ // Remove the format argument from the array of query arguments, to avoid overwriting custom format.
+ wp_parse_str( remove_query_arg( array_keys( $format_arg ), $url_parts[1] ), $query_args );
+ $args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $query_args ) );
+ }
+
// Who knows what else people pass in $args
$total = (int) $args['total'];
if ( $total < 2 ) {
if ( $mid_size < 0 ) {
$mid_size = 2;
}
- $add_args = is_array( $args['add_args'] ) ? $args['add_args'] : false;
+ $add_args = $args['add_args'];
$r = '';
$page_links = array();
$dots = false;
wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ),
false,
- array( '#222', '#333', '#0074a2', '#2ea2cc' ),
- array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' )
+ array( '#222', '#333', '#0073aa', '#00a0d2' ),
+ array( 'base' => '#999', 'focus' => '#00a0d2', 'current' => '#fff' )
);
// Other color schemes are not available when running out of src
*/
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
global $wp_styles;
- if ( !is_a($wp_styles, 'WP_Styles') )
+ if ( ! ( $wp_styles instanceof WP_Styles ) ) {
$wp_styles = new WP_Styles();
+ }
// For backward compatibility
$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;