function raindrops_status_bar() { global $raindrops_status_bar, $post; /** * * Show Raindrops status bar at browser bottom * * shows true hide false * @since 1.211 */ if (!isset($raindrops_status_bar)) { $customizer_modify_value = raindrops_warehouse_clone('raindrops_status_bar'); if ('show' !== $customizer_modify_value) { $raindrops_status_bar = false; } else { $raindrops_status_bar = true; } } if ($raindrops_status_bar == false) { return; } ?> <div id="raindrops_status_bar"> <?php do_action('raindrops_status_bar_before'); $link_to_top = '<p class="move-to-top"><a href="#top">top</a></p>'; echo apply_filters('raindrops_status_bar_top', $link_to_top); if ('posts' == get_option('show_on_front')) { if (is_month()) { raindrops_monthly_archive_prev_next_navigation(); } } ?> <div class="raindrops-next-prev-links"> <?php raindrops_next_prev_links('nav-status-bar'); ?> </div> <div class="raindrops_prev_next_post"> <?php if (is_single()) { raindrops_prev_next_post('nav-status-bar'); } ?> </div> <?php if (is_page()) { ?> <div class="child-pages"> <?php $args = array('post_type' => 'page', 'post_status' => 'publish', 'numberposts' => -1, 'order' => 'ASC', 'orderby' => 'post_title', 'post_parent' => $post->ID); $html = '<a href="%1$s">%2$s</a>'; $child_pages = query_posts($args); if (!empty($child_pages) && is_array($child_pages)) { $number = count($child_pages); ?> <span class="status-bar-page-title"><?php echo _nx('Child Page : ', 'Child Pages : ', $number, '', 'raindrops'); ?> </span> <?php foreach ($child_pages as $child) { $permalink = apply_filters('the_permalink', get_permalink($child->ID)); $title = apply_filters('the_title', $child->post_title); printf($html, $permalink, $title); if (end($child_pages) !== $child) { echo ' , '; } } } wp_reset_query(); ?> </div> </div> <?php } //is_page() ?> <?php do_action('raindrops_status_bar_after'); ?> </div> <?php }
} elseif (is_month()) { $one_month = query_posts("posts_per_page=-1&year={$ye}&monthnum={$mo}"); $output = raindrops_month_list($one_month, $ye, $mo); wp_reset_query(); esc_html_e('Monthly Archives', 'raindrops'); } elseif (is_day()) { $one_day = query_posts("posts_per_page=-1&year={$ye}&monthnum={$mo}&day={$da}"); $output = raindrops_get_day($one_day, $ye, $mo, $da); wp_reset_query(); esc_html_e('Daily Archives', 'raindrops'); } ?> </h2> <?php if (is_month()) { raindrops_monthly_archive_prev_next_navigation(); } ?> <div class="datetable"> <?php echo $output; ?> </div> <?php if (is_month()) { ?> <div class="monthly-archives-pagenate"> <?php echo paginate_links($pagination) . ''; ?> </div>
public function widget($args, $instance) { global $wp_locale; extract($args); echo $before_widget; if (isset($instance['title'])) { $title = $instance['title']; } else { $title = esc_html__("Archives", 'raindrops'); } if (!empty($title)) { $result_html = $before_title; $result_html .= apply_filters('widget_title', $title); $result_html .= $after_title; } if (isset($instance['archives_start_year']) && is_numeric($instance['archives_start_year'])) { $archives_start_year = absint($instance['archives_start_year']); } else { /* year of WordPress born */ $archives_start_year = 2003; } if (isset($instance['group_year_month']) && ($instance['group_year_month'] == 'year' || $instance['group_year_month'] == 'month')) { $group_year_month = esc_attr($instance['group_year_month']); } else { $group_year_month = 'year'; } if (isset($instance['show_post_count']) && ($instance['show_post_count'] == 'yes' || $instance['show_post_count'] == 'no')) { if ($instance['show_post_count'] == 'yes') { $show_post_count = true; } if ($instance['show_post_count'] == 'no') { $show_post_count = false; } } else { $show_post_count = false; } $archive_strings = wp_get_archives(apply_filters('widget_archives_args', array('type' => 'monthly', 'show_post_count' => $show_post_count, 'echo' => false, 'format' => 'custom', 'before' => ','))); $archives_array = explode(',', $archive_strings); foreach ($archives_array as $key => $each_links) { if (preg_match('!([0-9]{4})!', $each_links, $regs) && $regs[1] < $archives_start_year) { unset($archives_array[$key]); } } $result = array(); $groups = $group_year_month; $display_start_year = $archives_start_year; $display_end_year = apply_filters('raindrops_extend_archive_widget_end_year', date('Y')); if ($groups == 'year') { for ($i = $display_start_year; $i < $display_end_year + 1; $i++) { foreach ($archives_array as $key => $val) { if (preg_match('!([0-9]{4})!', $val, $regs) && $regs[1] == $i) { $result[$i][$key] = $val; } } } krsort($result); } if ($groups == 'month') { for ($i = 1; $i < 13; $i++) { foreach ($archives_array as $key => $val) { $month_name = $wp_locale->get_month($i); if (preg_match('![^0-9]' . $month_name . '!', $val)) { $result[$i][$key] = $val; } } } } $result_html .= '<div class="eco-archive extent-archives by-' . esc_attr($groups) . '">'; $result_html .= raindrops_monthly_archive_prev_next_navigation(false, true); if ($groups == 'year') { foreach ($result as $key => $val) { $year_link = get_year_link(absint($key)); $year_label = apply_filters('raindrops_archive_year_label', esc_html($key)); $result_html .= sprintf('<h3 class="year year-%2$s"><a href="%1$s">%3$s</a></h3><ul class="item year-%2$s">', $year_link, absint($key), $year_label); $month_name_before = array('January', 'February', 'March', 'April', 'MayJune', 'July', 'August', 'September', 'October', 'November', 'December'); $month_name_after = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); foreach ($val as $k => $v) { preg_match('!>.*[^0-9]([0-9]{1,2})[^0-9].*<!', $v, $regs); if (isset($regs[1])) { $class = 'month month-' . $regs[1]; $v = str_replace($regs[0], '>' . $wp_locale->get_month($regs[1]) . '<', $v); } else { $class = trim(strtolower(wp_kses($v, array()))); $class = trim(str_replace(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ' ', '(', ')', ' '), array('', '', '', '', '', '', '', '', '', '', '-', '', '', ''), $class), '-'); $class = esc_attr('month month-' . $class); $v = preg_replace('![^/=][0-9]{4}!', '', $v); } $v = str_replace($month_name_before, $month_name_after, $v); $result_html .= sprintf('<li class="%2$s">%1$s<span class="screen-reader-text">%3$s</span></li>', $v, esc_attr($class), esc_html($year_label)); } $result_html .= '</ul>'; } $result_html .= '</div>'; echo $result_html; } if ($groups == 'month') { foreach ($result as $key => $val) { $month_name = $wp_locale->get_month($key); $result_html .= sprintf('<h3 class="month month-%2$s">%1$s</h3><ul>', $month_name, esc_attr($key)); foreach ($val as $v) { $result_html .= sprintf('<li class="item item-%2$s">%1$s<span class="screen-reader-text">%3$s</span></li>', str_replace($month_name, '', $v), esc_attr($key), esc_html($month_name)); } $result_html .= '</ul>'; } echo $result_html; } echo $after_widget; }