function archive_header(&$post, $before = '', $after = '') { static $previous = ''; if (test_param('orderby')) { $orderby = explode(' ', get_param('orderby')); $orderby = $orderby[0]; } else { $orderby = ''; } switch ($orderby) { case 'title': if (_LANGCODE == 'ja') { $thisletter = ucfirst(mb_substring($post->yomi, 0, 1, $GLOBALS['blog_charset'])); if ($thisletter > "¤ó") { $thisletter = "´Á»ú"; } } else { $thisletter = ucfirst(substr($post->yomi, 0, 1)); } if ($thisletter == "") { $thisletter = _WP_POST_NOTITLE; } if ($previous === '' || $thisletter !== $previous) { $output = "<br/>" . $thisletter; } $previous = $thisletter; break; case 'category': $thiscategory = $post->cat_ID; if ($thiscategory != $previous) { $output = '<br/><strong><a href="' . get_category_link(false, $thiscategory) . '">' . get_catname($thiscategory) . '</a></strong>'; } $previous = $thiscategory; break; case 'author': $thisauthor = $post->post_author; if ($thisauthor != $previous) { $output = '<br/><strong><a href="' . get_author_link(false, $thisauthor) . '">' . the_author('', false) . '</a></strong>'; } $previous = $thisauthor; break; case 'date': case '': $thismonth = mysql2date('m', $post->post_date); $thisyear = mysql2date('Y', $post->post_date); $thisdate = $thisyear . $thismonth; if ($thisdate != $previous) { $monthstr = format_month(sprintf("%d", $thisyear), $GLOBALS['month'][zeroise($thismonth, 2)]); $output = '<strong><br/><a href="' . get_month_link($thisyear, $thismonth) . '">' . $monthstr . '</a></strong>'; } $previous = $thisdate; break; } if (!empty($output)) { $output = $before . $output . $after . "\n"; echo $output; } }
printf(__('Permalink to %s', 'rawdata'), the_title_attribute('echo=0')); ?> " rel="bookmark"><?php the_title(); ?> </a> </h2> <div class="entry-meta"> <span class="meta-prep meta-prep-author"><?php _e('By ', 'rawdata'); ?> </span> <span class="author vcard"><a class="url fn n" href="<?php echo get_author_link(false, $authordata->ID, $authordata->user_nicename); ?> " title="<?php printf(__('View all posts by %s', 'rawdata'), $authordata->display_name); ?> "><?php the_author(); ?> </a> </span> <span class="meta-sep"> | </span> <span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'rawdata'); ?> </span> <span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\\TH:i:sO');
/** * Flushes post cache * * @param integer $post_id * @return boolean */ function flush_post($post_id = null) { if (!$post_id) { $post_id = $this->_detect_post_id(); } if ($post_id) { $uris = array(); $domain_url = w3_get_domain_url(); $feeds = $this->_config->get_array('pgcache.purge.feed.types'); if ($this->_config->get_boolean('pgcache.purge.terms') || $this->_config->get_boolean('pgcache.purge.feed.terms')) { $taxonomies = get_post_taxonomies($post_id); $terms = nxt_get_post_terms($post_id, $taxonomies); } switch (true) { case $this->_config->get_boolean('pgcache.purge.author'): case $this->_config->get_boolean('pgcache.purge.archive.daily'): case $this->_config->get_boolean('pgcache.purge.archive.monthly'): case $this->_config->get_boolean('pgcache.purge.archive.yearly'): case $this->_config->get_boolean('pgcache.purge.feed.author'): $post = get_post($post_id); } /** * Home URL */ if ($this->_config->get_boolean('pgcache.purge.home')) { $home_path = w3_get_home_path(); $site_path = w3_get_site_path(); $uris[] = $home_path; if ($site_path != $home_path) { $uris[] = $site_path; } } /** * Post URL */ if ($this->_config->get_boolean('pgcache.purge.post')) { $post_link = post_permalink($post_id); $post_uri = str_replace($domain_url, '', $post_link); $uris[] = $post_uri; } /** * Post comments URLs */ if ($this->_config->get_boolean('pgcache.purge.comments') && function_exists('get_comments_pagenum_link')) { $comments_number = get_comments_number($post_id); $comments_per_page = get_option('comments_per_page'); $comments_pages_number = @ceil($comments_number / $comments_per_page); for ($pagenum = 1; $pagenum <= $comments_pages_number; $pagenum++) { $comments_pagenum_link = $this->_get_comments_pagenum_link($post_id, $pagenum); $comments_pagenum_uri = str_replace($domain_url, '', $comments_pagenum_link); $uris[] = $comments_pagenum_uri; } } /** * Post author URLs */ if ($this->_config->get_boolean('pgcache.purge.author') && $post) { $posts_number = count_user_posts($post->post_author); $posts_per_page = get_option('posts_per_page'); $posts_pages_number = @ceil($posts_number / $posts_per_page); $author_link = get_author_link(false, $post->post_author); $author_uri = str_replace($domain_url, '', $author_link); for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) { $author_pagenum_link = $this->_get_pagenum_link($author_uri, $pagenum); $author_pagenum_uri = str_replace($domain_url, '', $author_pagenum_link); $uris[] = $author_pagenum_uri; } } /** * Post terms URLs */ if ($this->_config->get_boolean('pgcache.purge.terms')) { $posts_per_page = get_option('posts_per_page'); foreach ($terms as $term) { $term_link = get_term_link($term, $term->taxonomy); $term_uri = str_replace($domain_url, '', $term_link); $posts_pages_number = @ceil($term->count / $posts_per_page); for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) { $term_pagenum_link = $this->_get_pagenum_link($term_uri, $pagenum); $term_pagenum_uri = str_replace($domain_url, '', $term_pagenum_link); $uris[] = $term_pagenum_uri; } } } /** * Daily archive URLs */ if ($this->_config->get_boolean('pgcache.purge.archive.daily') && $post) { $post_date = strtotime($post->post_date); $post_year = gmdate('Y', $post_date); $post_month = gmdate('m', $post_date); $post_day = gmdate('d', $post_date); $posts_per_page = get_option('posts_per_page'); $posts_number = $this->_get_archive_posts_count($post_year, $post_month, $post_day); $posts_pages_number = @ceil($posts_number / $posts_per_page); $day_link = get_day_link($post_year, $post_month, $post_day); $day_uri = str_replace($domain_url, '', $day_link); for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) { $day_pagenum_link = $this->_get_pagenum_link($day_uri, $pagenum); $day_pagenum_uri = str_replace($domain_url, '', $day_pagenum_link); $uris[] = $day_pagenum_uri; } } /** * Monthly archive URLs */ if ($this->_config->get_boolean('pgcache.purge.archive.monthly') && $post) { $post_date = strtotime($post->post_date); $post_year = gmdate('Y', $post_date); $post_month = gmdate('m', $post_date); $posts_per_page = get_option('posts_per_page'); $posts_number = $this->_get_archive_posts_count($post_year, $post_month); $posts_pages_number = @ceil($posts_number / $posts_per_page); $month_link = get_month_link($post_year, $post_month); $month_uri = str_replace($domain_url, '', $month_link); for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) { $month_pagenum_link = $this->_get_pagenum_link($month_uri, $pagenum); $month_pagenum_uri = str_replace($domain_url, '', $month_pagenum_link); $uris[] = $month_pagenum_uri; } } /** * Yearly archive URLs */ if ($this->_config->get_boolean('pgcache.purge.archive.yearly') && $post) { $post_date = strtotime($post->post_date); $post_year = gmdate('Y', $post_date); $posts_per_page = get_option('posts_per_page'); $posts_number = $this->_get_archive_posts_count($post_year); $posts_pages_number = @ceil($posts_number / $posts_per_page); $year_link = get_year_link($post_year); $year_uri = str_replace($domain_url, '', $year_link); for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) { $year_pagenum_link = $this->_get_pagenum_link($year_uri, $pagenum); $year_pagenum_uri = str_replace($domain_url, '', $year_pagenum_link); $uris[] = $year_pagenum_uri; } } /** * Feed URLs */ if ($this->_config->get_boolean('pgcache.purge.feed.blog')) { foreach ($feeds as $feed) { $feed_link = get_feed_link($feed); $feed_uri = str_replace($domain_url, '', $feed_link); $uris[] = $feed_uri; } } if ($this->_config->get_boolean('pgcache.purge.feed.comments')) { foreach ($feeds as $feed) { $post_comments_feed_link = get_post_comments_feed_link($post_id, $feed); $post_comments_feed_uri = str_replace($domain_url, '', $post_comments_feed_link); $uris[] = $post_comments_feed_uri; } } if ($this->_config->get_boolean('pgcache.purge.feed.author') && $post) { foreach ($feeds as $feed) { $author_feed_link = get_author_feed_link($post->post_author, $feed); $author_feed_uri = str_replace($domain_url, '', $author_feed_link); $uris[] = $author_feed_uri; } } if ($this->_config->get_boolean('pgcache.purge.feed.terms')) { foreach ($terms as $term) { foreach ($feeds as $feed) { $term_feed_link = get_term_feed_link($term->term_id, $term->taxonomy, $feed); $term_feed_uri = str_replace($domain_url, '', $term_feed_link); $uris[] = $term_feed_uri; } } } /** * Flush cache */ if (count($uris)) { $cache =& $this->_get_cache(); $mobile_groups = $this->_get_mobile_groups(); $referrer_groups = $this->_get_referrer_groups(); $encryptions = $this->_get_encryptions(); $compressions = $this->_get_compressions(); foreach ($uris as $uri) { foreach ($mobile_groups as $mobile_group) { foreach ($referrer_groups as $referrer_group) { foreach ($encryptions as $encryption) { foreach ($compressions as $compression) { $page_key = $this->_get_page_key($uri, $mobile_group, $referrer_group, $encryption, $compression); $cache->delete($page_key); } } } } } /** * Purge varnish servers */ if ($this->_config->get_boolean('varnish.enabled')) { $varnish =& w3_instance('W3_Varnish'); foreach ($uris as $uri) { $varnish->purge($uri); } } } return true; } return false; }
function aiosp_mrt_get_url($query) { global $aioseop_options; if ($query->is_404 || $query->is_search) { return false; } $haspost = count($query->posts) > 0; $has_ut = function_exists('user_trailingslashit'); if (get_query_var('m')) { $m = preg_replace('/[^0-9]/', '', get_query_var('m')); switch (strlen($m)) { case 4: $link = get_year_link($m); break; case 6: $link = get_month_link(substr($m, 0, 4), substr($m, 4, 2)); break; case 8: $link = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2)); break; default: return false; } } elseif (($query->is_single || $query->is_page) && $haspost) { $post = $query->posts[0]; $link = get_permalink($post->ID); $link = $this->yoast_get_paged($link); /* if ($page && $page > 1) { $link = trailingslashit($link) . "page/". "$page"; if ($has_ut) { $link = user_trailingslashit($link, 'paged'); } else { $link .= '/'; } } if ($query->is_page && ('page' == get_option('show_on_front')) && $post->ID == get_option('page_on_front')) { $link = trailingslashit($link); }*/ } elseif ($query->is_author && $haspost) { global $wp_version; if ($wp_version >= '2') { $author = get_userdata(get_query_var('author')); if ($author === false) { return false; } $link = get_author_link(false, $author->ID, $author->user_nicename); } else { global $cache_userdata; $userid = get_query_var('author'); $link = get_author_link(false, $userid, $cache_userdata[$userid]->user_nicename); } } elseif ($query->is_category && $haspost) { $link = get_category_link(get_query_var('cat')); $link = $this->yoast_get_paged($link); } else { if ($query->is_tag && $haspost) { $tag = get_term_by('slug', get_query_var('tag'), 'post_tag'); if (!empty($tag->term_id)) { $link = get_tag_link($tag->term_id); } $link = $this->yoast_get_paged($link); } elseif ($query->is_day && $haspost) { $link = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')); } elseif ($query->is_month && $haspost) { $link = get_month_link(get_query_var('year'), get_query_var('monthnum')); } elseif ($query->is_year && $haspost) { $link = get_year_link(get_query_var('year')); } elseif ($query->is_home) { if (get_option('show_on_front') == 'page' && ($pageid = get_option('page_for_posts'))) { $link = get_permalink($pageid); $link = $this->yoast_get_paged($link); $link = trailingslashit($link); } else { $link = get_option('home'); $link = $this->yoast_get_paged($link); $link = trailingslashit($link); } } else { return false; } } return $link; }
function guess_permalink($query) { $haspost = count($query->posts) > 0; $has_ut = function_exists('user_trailingslashit'); if (get_query_var('m')) { // Handling special case with '?m=yyyymmddHHMMSS' // Since there is no code for producing the archive links for // is_time, we will give up and not trying any redirection. $m = preg_replace('/[^0-9]/', '', get_query_var('m')); switch (strlen($m)) { case 4: // Yearly $link = get_year_link($m); break; case 6: // Monthly $link = get_month_link(substr($m, 0, 4), substr($m, 4, 2)); break; case 8: // Daily $link = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2)); break; default: return false; } } elseif (($query->is_single || $query->is_page) && $haspost) { $post = $query->posts[0]; $link = get_permalink($post->ID); $page = get_query_var('page'); if ($page && $page > 1) { $link = trailingslashit($link) . "{$page}"; if ($has_ut) { $link = user_trailingslashit($link, 'paged'); } else { $link .= '/'; } } // WP2.2: In Wordpress 2.2+ is_home() returns false and is_page() // returns true if front page is a static page. if ($query->is_page && 'page' == get_option('show_on_front') && $post->ID == get_option('page_on_front')) { $link = trailingslashit($link); } } elseif ($query->is_author && $haspost) { global $wp_version; if ($wp_version >= '2') { $author = get_userdata(get_query_var('author')); if ($author === false) { return false; } if (function_exists('get_author_posts_url')) { $link = get_author_posts_url($author->ID, $author->user_nicename); } else { $link = get_author_link(false, $author->ID, $author->user_nicename); } // XXX: get_author_link seems to always return one with // trailing slash. We have to call user_trailingslashit to // make it right. if ($has_ut) { $link = user_trailingslashit($link); } } else { // XXX: get_author_link() bug in WP 1.5.1.2 // s/author_nicename/user_nicename/ global $cache_userdata; $userid = get_query_var('author'); $link = get_author_link(false, $userid, $cache_userdata[$userid]->user_nicename); } } elseif ($query->is_category && $haspost) { $link = get_category_link(get_query_var('cat')); } elseif ($query->is_tag && $haspost) { $link = get_tag_link(get_query_var('tag_id')); } elseif ($query->is_day && $haspost) { $link = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')); } elseif ($query->is_month && $haspost) { $link = get_month_link(get_query_var('year'), get_query_var('monthnum')); } elseif ($query->is_year && $haspost) { $link = get_year_link(get_query_var('year')); } elseif ($query->is_home) { // WP2.1: Handling "Posts page" option. In WordPress 2.1 is_home() // returns true and is_page() returns false if home page has been // set to a page, and we are getting the permalink of that page // here. if (get_option('show_on_front') == 'page' && ($pageid = get_option('page_for_posts'))) { $link = trailingslashit(get_permalink($pageid)); } else { $link = trailingslashit(get_option('home')); } } else { return false; } if ($query->is_paged) { $paged = get_query_var('paged'); if ($paged) { $link = trailingslashit($link) . "page/{$paged}"; if ($has_ut) { $link = user_trailingslashit($link, 'paged'); } else { $link .= '/'; } } } if ($query->is_feed) { $link = trailingslashit($link) . 'feed'; if ($has_ut) { $link = user_trailingslashit($link, 'feed'); } else { $link .= '/'; } } return $link; }
function widget($args, $instance) { // prints the widget extract($args, EXTR_SKIP); $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); $desc1 = empty($instance['desc1']) ? ' ' : apply_filters('widget_desc1', $instance['desc1']); ?> <script type="text/javascript" > function showhide_forgetpw() { if(document.getElementById('lostpassword_form').style.display=='none') { document.getElementById('lostpassword_form').style.display = '' document.getElementById('register_form').style.display = 'none' }else { document.getElementById('lostpassword_form').style.display = 'none'; document.getElementById('register_form').style.display = 'none' } } function showhide_register() { if(document.getElementById('register_form').style.display=='none') { document.getElementById('register_form').style.display = '' document.getElementById('lostpassword_form').style.display = 'none' }else { document.getElementById('register_form').style.display = 'none'; document.getElementById('lostpassword_form').style.display = 'none' } } </script> <div class="widget login_widget" id="login_widget"> <?php global $current_user; if ($current_user->ID) { ?> <h3><?php echo apply_filters('templ_login_widget_myaccount_text_filter', __('Dashboard', 'templatic')); ?> </h3> <ul class="xoxo blogroll"> <?php $authorlink = get_author_link($echo = false, $current_user->data->ID); echo apply_filters('templ_login_widget_dashboardlink_filter', '<li><a href="' . $authorlink . '">' . MYACCOUNT_TEXT . '</a></li>'); echo apply_filters('templ_login_widget_editprofilelink_filter', '<li><a href="' . site_url('/?ptype=profile') . '">' . EDIT_PROFILE_TEXT . '</a></li>'); echo apply_filters('templ_login_widget_logoutlink_filter', '<li><a href="' . wp_logout_url(get_option('siteurl')) . '">' . LOGOUT_TEXT . '</a></li>'); ?> </ul> <?php } else { ?> <?php if ($title) { ?> <h3><?php echo $title; ?> </h3><?php } ?> <?php global $errors, $reg_msg; if ($_REQUEST['widgetptype'] == 'login') { if (is_object($errors)) { foreach ($errors as $errorsObj) { foreach ($errorsObj as $key => $val) { for ($i = 0; $i < count($val); $i++) { echo "<p class=\"error_msg\">" . $val[$i] . '</p>'; } } } } $errors = new WP_Error(); } ?> <form name="loginform" id="loginwidgetform" action='<?php echo get_settings('home') . "/index.php?ptype=register#login_widget"; ?> ' method="post" > <input type="hidden" name="widgetptype" value="login" /> <div class="form_row"><label><?php echo USER_NAME_TEXT; ?> <span>*</span></label> <input name="log" id="widget_user_login" type="text" class="textfield" /> <span id="user_loginInfo"></span> </div> <div class="form_row"><label><?php echo PWD_TEXT; ?> <span>*</span></label> <input name="pwd" id="widget_user_pass" type="password" class="textfield" /><span id="user_passInfo"></span> </div> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['HTTP_REFERER']; ?> " /> <input type="hidden" name="testcookie" value="1" /> <div class="form_row clearfix"> <input type="submit" name="submit" value="<?php echo SIGN_IN_TEXT; ?> " class="b_signin" /> </div> <?php do_action('login_form'); ?> </form> <p class="forgot_link"> <a href="javascript:void(0);showhide_register();" class="lw_new_reg_lnk"><?php echo NEW_USER_REGISTRATION_TEXT . " " . NEW_USER_REGISTRATION_LINK; ?> </a> <br /> <?php if (get_option('is_active_affiliate')) { $aff_link = sprintf(BE_AFFILIATES_MEMBER, "<a href='http://localhost/wpthemes/dailydeal/?ptype=affiliate&type=reg' >Click Here</a>"); echo "<p class='fl'>" . $aff_link . "</p>"; } ?> <a href="javascript:void(0);showhide_forgetpw();" class="lw_fpw_lnk"><?php echo FORGET_PW_TEXT; ?> </a> </p> <?php if ($_REQUEST['widgetptype'] == 'login') { if ($reg_msg) { echo "<p class=\"error_msg\">" . $reg_msg . '</p>'; } if (is_object($errors)) { foreach ($errors as $errorsObj) { foreach ($errorsObj as $key => $val) { for ($i = 0; $i < count($val); $i++) { echo "<p class=\"error_msg\">" . $val[$i] . '</p>'; } } } } $errors = new WP_Error(); } ?> <!-- registerartion form --> <div id="register_form" <?php if ($_REQUEST['widgetptype'] == 'register') { ?> style="display:block;" <?php } else { ?> style="display:none;" <?php } ?> > <?php if ($_REQUEST['widgetptype'] == 'register') { if ($reg_msg) { echo "<p class=\"error_msg\">" . $reg_msg . '</p>'; } if (is_object($errors)) { foreach ($errors as $errorsObj) { foreach ($errorsObj as $key => $val) { for ($i = 0; $i < count($val); $i++) { echo "<p class=\"error_msg\">" . $val[$i] . '</p>'; } } } } $errors = new WP_Error(); } ?> <h4> <?php echo NEW_USER_REG_TEXT; ?> </h4> <form name="registerform" id="registerform" method="post" action="<?php echo get_settings('home') . '/index.php?ptype=register&action=register'; ?> "> <input type="hidden" name="reg_redirect_link" value="<?php echo $_SERVER['HTTP_REFERER']; ?> " /> <input type="hidden" name="widgetptype" value="register" /> <div class="form_row clearfix"> <label><?php echo USER_NAME_TEXT; ?> <span class="indicates">*</span></label> <input type="text" name="user_login" id="user_login" class="textfield" value="<?php echo esc_attr(stripslashes($user_email)); ?> " size="25" /> </div> <div class="row_spacer_registration clearfix" > <div class="form_row clearfix"> <label> <?php echo EMAIL_ID_TEXT; ?> <span class="indicates">*</span></label> <input type="text" name="user_email" id="user_email" class="textfield" value="<?php echo esc_attr(stripslashes($user_fname)); ?> " size="25" /> </div> </div> <input type="submit" name="wp-submit" id="wp-submit" value="<?php echo NEW_USER_REGISTRATION_LINK; ?> " class="b_signin" /> </form> </div> <!-- registerartion #end --> <div id="lostpassword_form" <?php if ($_REQUEST['widgetptype'] == 'forgetpass') { ?> style="display:block;" <?php } else { ?> style="display:none;" <?php } ?> > <?php if ($_REQUEST['widgetptype'] == 'forgetpass') { if ($for_msg) { echo "<p class=\"error_msg\">" . $for_msg . '</p>'; } if (is_object($errors)) { foreach ($errors as $errorsObj) { foreach ($errorsObj as $key => $val) { for ($i = 0; $i < count($val); $i++) { echo "<p class=\"error_msg\">" . $val[$i] . '</p>'; } } } } $errors = new WP_Error(); } ?> <!-- forgot password --> <h4><?php echo FORGET_PW_TEXT; ?> </h4> <form name="lostpasswordform" id="lostpasswordform" method="post" action="#login_widget"> <div class="form_row clearfix"> <label> <input type="hidden" name="widgetptype" value="forgetpass" /> <?php echo EMAIL_ID_TEXT; ?> : </label> <input type="text" name="user_login" id="user_login1" value="<?php echo esc_attr($user_login); ?> " size="20" class="textfield" /> <?php do_action('lostpassword_form'); ?> </div> <input type="submit" name="wp-submit" value="<?php echo GET_NEW_PWD_TEXT; ?> " class="b_forgotpass " /> </form> </div> <!-- forgot password #end --> <?php } ?> </div> <?php }
the_title(); ?> </h2> <div class="entry-content"> <?php the_content('<span class="more-link">' . __('Read More »', 'sandbox') . '</span>'); ?> <?php link_pages('<div class="page-link">' . __('Pages: ', 'sandbox'), '</div>', 'number'); ?> </div> <div class="entry-meta"> <?php printf(__('This entry was written by %1$s and posted on <abbr class="published" title="%2$sT%3$s">%4$s at %5$s</abbr> and filed under %6$s%10$s. Bookmark the <a href="%7$s" title="Permalink to %8$s" rel="bookmark">permalink</a>. Follow any comments here with the <a href="%9$s" title="Comments RSS to %8$s" rel="alternate" type="application/rss+xml">RSS feed for this post</a>.', 'sandbox'), '<a class="url fn" href="' . get_author_link(false, $authordata->ID, $authordata->user_nicename) . '" title="View all posts by ' . $authordata->display_name . '">' . get_the_author() . '</a>', get_the_time('Y-m-d'), get_the_time('H:i:sO'), the_date('', '', '', false), get_the_time(), get_the_category_list(', '), get_permalink(), wp_specialchars(get_the_title(), 'double'), comments_rss(), get_the_tag_list(__(' with tags '), ', ')); if (comments_open() && pings_open()) { // COMMENTS & PINGS OPEN ?> <?php printf(__('<a href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a href="%s" rel="trackback" title="Trackback URL for your post">Trackback URL</a>.', 'sandbox'), get_trackback_url()); } elseif (!comments_open() && pings_open()) { // PINGS ONLY OPEN ?> <?php printf(__('Comments are closed, but you can leave a trackback: <a href="%s" rel="trackback" title="Trackback URL for your post">Trackback URL</a>.', 'sandbox'), get_trackback_url()); } elseif (comments_open() && !pings_open()) { // COMMENTS OPEN ?> <?php printf(__('Trackbacks are closed, but you can <a href="#respond" title="Post a comment">post a comment</a>.', 'sandbox'));
function printGeneral() { $obj_ac = new LcmExpenseCommentAccess(0, $this); echo "<!-- ID: " . $this->getDataInt('id_comment') . " -->\n"; echo "<div style='border-bottom: 1px solid #ccc;'>"; // CSS echo '<p class="normal_text">' . get_author_link($this->data) . ' @ ' . format_date($this->getDataString('date_creation')); if ($this->getDataString('date_update') != $this->getDataString('date_creation')) { echo ' (' . _Ti('time_input_date_updated') . format_date($this->getDataString('date_update')) . ')'; } echo "</p>\n"; // Allow edit if author of comment + if expense is pending if ($obj_ac->getEdit()) { echo "<div style='float: right;'>"; echo '<a title="Edit this comment" ' . 'class="edit_lnk" href="edit_exp.php?expense=' . $this->getDataInt('id_expense', '__ASSERT__') . '&c=' . $this->getDataInt('id_comment', '__ASSERT__') . '">' . _T('edit') . '</a>'; // TRAD echo "</div>\n"; } echo '<p class="normal_text">' . nl2br($this->getDataString('comment')) . "</p>\n"; echo "</div>\n"; }
function get_property_info_li($post) { $thumbimage_arr = array(); $thumbimage_arr = bdw_get_images($post->ID, $img_size = 'thumb'); $thumb_img = $thumbimage_arr[0]; ?> <li <?php if (in_category(get_cat_id_from_name(get_option('ptthemes_featuredcategory')))) { echo 'class="featured"'; } ?> ><?php is_new_property($post->ID); ?> <div class="content_block"> <div class="product_image"> <a href="<?php the_permalink(); ?> "> <?php if ($thumb_img) { ?> <img src="<?php echo $thumb_img; ?> " height="109" width="164" alt="" title="" /> <?php } else { ?> <img src="<?php bloginfo('template_directory'); ?> /images/img_not_available.png" alt="" /> <?php } ?> </a></div> <div class="content"> <h3 class="clearfix"><span class="propertyaddress"> <a href="<?php the_permalink(); ?> "> <?php the_title(); ?> </a></span> <?php get_property_listing_price($post->ID); ?> </h3> <?php $address = ''; if (get_post_meta($post->ID, 'address', true)) { $address .= get_post_meta($post->ID, 'address', true) . ', '; } if (get_post_meta($post->ID, 'add_city', true)) { $address .= get_post_meta($post->ID, 'add_city', true) . ', '; } if (get_post_meta($post->ID, 'add_state', true)) { $address .= get_post_meta($post->ID, 'add_state', true) . ', '; } if (get_post_meta($post->ID, 'add_country', true)) { $address .= get_post_meta($post->ID, 'add_country', true); } if (get_post_meta($post->ID, 'add_zip_code', true)) { $address .= ' - ' . get_post_meta($post->ID, 'add_zip_code', true); } if ($address) { echo '<p class="address">' . $address . '</p>'; } ?> <?php $cat_info_arr = get_property_cat_id_name($post->ID); ?> <div class="property_detail"> <p> <span class="field"> <?php _e(AREA_TEXT); ?> </span> <span>: <?php echo get_post_meta($post->ID, 'area', true); ?> (<?php echo get_area_unit(); ?> ) </span> </p> <p> <span class="field"> <?php _e(BEDS_TEXT); ?> </span> <span>: <?php echo get_post_meta($post->ID, 'bed_rooms', true); //echo $cat_info_arr['bed']['name']; ?> </span></p> <p><span class="field"> <?php _e(BATHS_TEXT); ?> </span> <span>: <?php echo get_post_meta($post->ID, 'bath_rooms', true); ?> </span></p> </div> <div class="property_detail"> <p> <span class="field"> <?php _e(PRO_MLS_TEXT); ?> </span> <span>: <?php echo get_post_meta($post->ID, 'mlsno', true); ?> </span> </p> <p> <span class="field"> <?php _e(PRO_PROPERTY_ID_TEXT); ?> </span> <span>: <?php echo $post->ID; ?> </span></p> <p><span class="field"> <?php _e(PRO_POSTED_ON_TEXT); ?> </span> <span>: <?php the_time('F j, Y'); ?> </span></p> </div> <p class="propertylistinglinks"> <span class="agent"> <?php _e(AGENT_TITLE); ?> : <a href="<?php echo get_author_link($echo = false, $post->post_author, $author_nicename = ''); ?> " class="emailagent"><?php echo get_the_author_meta('display_name', $post->post_author); ?> </a> </span> <span><a href="<?php the_permalink(); ?> "><?php _e(VIEW_MORE_DETAILS_TEXT); ?> »</a></span> <?php favourite_html($post->post_author, $post->ID); ?> </p> </div> </div> </li> <?php }
function list_authors2($optioncount = false, $exclude_admin = true, $idmode = '', $hide_empty = true, $feed = '', $feed_image = '') { global $wp_id, $wpdb, $blogfilename; $query = "SELECT ID, user_idmode, user_nickname, user_firstname, user_lastname, user_login from {$wpdb->users[$wp_id]} " . ($exclude_admin ? "WHERE ID <> 1 " : '') . "ORDER BY user_nickname"; $authors = $wpdb->get_results($query); foreach ($authors as $author) { $posts = get_usernumposts($author->ID, true); $name = $author->user_nickname; if (empty($idmode)) { $idmode = $author->user_idmode; } if ($idmode == 'nickname') { $name = $author->user_nickname; } if ($idmode == 'login') { $name = $author->user_login; } if ($idmode == 'firstname') { $name = $author->user_firstname; } if ($idmode == 'lastname') { $name = $author->user_lastname; } if ($idmode == 'namefl') { $name = $author->user_firstname . ' ' . $author->user_lastname; } if ($idmode == 'namelf') { $name = $author->user_lastname . ' ' . $author->user_firstname; } if (!$idmode) { $name = $author->user_nickname; } if (!($posts == 0 && $hide_empty)) { echo "<li>"; } if ($posts == 0) { if (!$hide_empty) { echo $name; } } else { $link = '<a href="' . get_author_link(0, $author->ID, $author->user_login) . '" title="' . sprintf("Posts by %s", htmlspecialchars($author->user_nickname)) . '">' . stripslashes($name) . '</a>'; if (!empty($feed_image) || !empty($feed)) { $link .= ' '; if (empty($feed_image)) { $link .= '('; } $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_login) . '"'; if (!empty($feed)) { $title = ' title="' . stripslashes($feed) . '"'; $alt = ' alt="' . stripslashes($feed) . '"'; $name = stripslashes($feed); $link .= $title; } $link .= '>'; if (!empty($feed_image)) { $link .= "<img src=\"{$feed_image}\" border=\"0\" align=\"absbottom\"{$alt}{$title}" . ' />'; } else { $link .= $name; } $link .= '</a>'; if (empty($feed_image)) { $link .= ')'; } } if ($optioncount) { $link .= ' (' . $posts . ')'; } } if (!($posts == 0 && $hide_empty)) { echo "{$link}</li>"; } } }
function vanilla_postheader() { global $id, $post, $authordata; // Create $posteditlink $posteditlink .= '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $id; $posteditlink .= '" title="' . __('Edit post', 'thematic') . '" class="edit-link">'; $posteditlink .= __('Edit', 'thematic') . '</a>'; if (is_single() || is_page()) { $posttitle = '<h1 class="entry-title">' . get_the_title() . "</h1>\n"; } elseif (is_404()) { $posttitle = '<h1 class="entry-title">' . __('Not Found', 'thematic') . "</h1>\n"; } else { $posttitle = '<h2 class="entry-title"><a href="'; $posttitle .= get_permalink(); $posttitle .= '" title="'; $posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0'); $posttitle .= '" rel="bookmark">'; $posttitle .= get_the_title(); $posttitle .= "</a></h2>\n"; } $postmeta = '<div class="entry-meta">'; // Display edit link if (current_user_can('edit_posts')) { $postmeta .= $posteditlink; } $postmeta .= '<em>' . __('by', 'thematic') . '</em> '; $postmeta .= '<span class="author vcard"><a class="url fn n" href="'; $postmeta .= get_author_link(false, $authordata->ID, $authordata->user_nicename); $postmeta .= '" title="' . __('View all posts by ', 'thematic') . get_the_author() . '">'; $postmeta .= get_the_author(); $postmeta .= "</a></span>\n"; // Display the post category/ies if (!is_category()) { $postmeta .= '<span class="cat-links"><em>' . __('in', 'thematic') . '</em> '; $postmeta .= get_the_category_list(', ') . "</span>\n"; } $postmeta .= '<em>' . __('on', 'thematic') . '</em> '; $postmeta .= '<span class="entry-date"><abbr class="published" title="'; $postmeta .= get_the_time('Y-m-d\\TH:i:sO') . '">'; $postmeta .= the_date('', '', '', false); $postmeta .= '</abbr></span>'; $postmeta .= "</div><!-- .entry-meta -->\n"; if ($post->post_type == 'page' || is_404()) { $postheader = $posttitle; } else { $postheader = $posttitle . $postmeta; } echo apply_filters('vanilla_postheader', $postheader); // Filter to override default post header }
function printGeneral($show_subtitle = true, $allow_edit = true) { if ($show_subtitle) { show_page_subtitle(_T('generic_subtitle_general'), 'cases_intro'); } echo '<ul class="info">'; // TODO: fix html // Author echo '<li>' . '<span class="label2">' . _Ti('case_input_author') . '</span>' . '<span class="value2">' . get_author_link($this->data) . '</span>' . "</li>\n"; // Date start echo '<li>' . '<span class="label2">' . _Ti('time_input_date_start') . '</span>' . '<span class="value2">' . format_date($this->data['date_start']) . '</span>' . "</li>\n"; // Date end echo '<li>' . '<span class="label2">' . _Ti('time_input_date_end') . '</span>' . '<span class="value2">' . format_date($this->data['date_end']) . '</span>' . "</li>\n"; // Date length echo '<li>' . '<span class="label2">' . _Ti('time_input_length') . '</span>' . '<span class="value2">' . format_time_interval_prefs($this->data['length']) . '</span>' . "</li>\n"; // FU type echo '<li>' . '<span class="label2">' . _Ti('fu_input_type') . '</span>' . '<span class="value2">' . _Tkw('followups', $this->data['type']) . '</span>' . "</li>\n"; // Keywords show_all_keywords('followup', $this->getDataInt('id_followup')); // Conclusion for case/status change /* [ML] 2008-01-30 Should not be necessary, done by get_fu_description() if ($this->data['type'] == 'status_change' || $this->data['type'] == 'stage_change') { $tmp = lcm_unserialize($this->data['description']); var_dump($tmp); echo '<li>' . '<span class="label2">' . _Ti('fu_input_conclusion') . '</span>'; echo '<span class="value2">'; if (read_meta('case_result') == 'yes' && $tmp['result']) echo _Tkw('_crimresults', $tmp['result']) . "<br />\n"; echo _Tkw('conclusion', $tmp['conclusion']) . '</span>'; echo "</li>\n"; echo '<li>' . '<span class="label2">' . _Ti('fu_input_sentence') . '</li>' . '<span class="value2">' . _Tkw('sentence', $tmp['sentence']) . '</span>' . "</li>\n"; } */ // Description $desc = get_fu_description($this->data, false); echo '<li class="large">' . '<span class="label2">' . _Ti('fu_input_description') . '</span>' . '<span class="value2">' . $desc . '</span>' . "</li>\n"; // Sum billed (if activated from policy) if ($this->show_sum_billed == 'yes') { echo '<li>' . '<span class="label2">' . _T('fu_input_sum_billed') . '</span>' . '<span class="value2">'; echo format_money(clean_output($this->data['sumbilled'])); $currency = read_meta('currency'); echo htmlspecialchars($currency); echo '</span>'; echo "</li>\n"; } echo "</ul>\n"; }
the_permalink(); ?> " rel="bookmark" title='<?php printf(__('Permanent Link to "%s"', 'k2_domain'), wp_specialchars(get_the_title(), 1)); ?> '><?php the_title(); ?> </a></h3> <small class="entry-meta"> <span class="chronodata"> <?php /* Date & Author */ $count_users = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->usermeta} WHERE `meta_key` = '" . $table_prefix . "user_level' AND `meta_value` > 1"); printf(__('Published %1$s %2$s', 'k2_domain'), $count_users > 1 ? sprintf(__('by %s', 'k2_domain'), '<a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . '">' . get_the_author() . '</a>') : '', function_exists('time_since') ? sprintf(__('%s ago', 'k2_domain'), time_since(abs(strtotime($post->post_date_gmt . " GMT")), time())) : get_the_time(get_option('date_format'))); ?> </span> </small> </div> <!-- .entry-head --> <div class="entry-content"> <p class="<?php echo $classname; ?> "><?php echo $attachment_link; ?> <br /><?php echo basename($post->guid); ?>
Australis Media Pty Ltd has made the contents of this file available under a CC-GNU-GPL license: http://creativecommons.org/licenses/GPL/2.0/ A copy of the full license can be found as part of this distribution in the file LICENSE.TXT You may use the Vanilla theme software in accordance with the terms of that license. You agree that you are solely responsible for your use of the Vanilla theme software and you represent and warrant to Australis Media Pty Ltd that your use of the Vanilla theme software will comply with the CC-GNU-GPL. */ if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die; } if (CFCT_DEBUG) { cfct_banner(__FILE__); } global $previousday, $authordata, $tpl; $previousday = -1; $tpl_tags_list = get_the_tag_list("", ",", ""); $tpl_edit_link = get_edit_post_link(); $tpl_pages_link = wp_link_pages('before=&after=&echo=0'); $content = get_the_content('<span class="more-link">' . __('Continued...', 'carrington') . '</span>'); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $tpl["content"] = array("tpl_file" => "content-default.html"); $tpl["entries"][] = array("id" => get_the_ID(), "class" => sandbox_post_class(false), "permalink" => get_permalink(), "title_attribute" => the_title_attribute('echo=0'), "title" => the_title("", "", false), "content" => $content, "pages_link" => $tpl_pages_link == '' ? false : $tpl_pages_link, "categories_list" => get_the_category_list(', '), "tags_list" => $tpl_tags_list == '' ? false : $tpl_tags_list, "author" => array("link" => get_author_link(false, get_the_author_ID(), $authordata->user_nicename), "name_attribute" => attribute_escape($authordata->display_name), "name" => get_the_author()), "date_time" => get_the_time('Y-m-d\\TH:i:sO'), "date" => the_date("", "", "", false), "comments_link" => vanilla_comments_popup_link(__('No comments', 'carrington'), __('1 comment', 'carrington'), __('% comments', 'carrington')), "edit_link" => $tpl_edit_link == '' ? false : $tpl_edit_link, "edit_link_text" => __('Edit This', 'carrington'));
/** * Builds the sitemap and writes it into a xml file. * * ATTENTION PLUGIN DEVELOPERS! DONT CALL THIS METHOD DIRECTLY! * The method is probably not available, since it is only loaded when needed. * Use do_action("sm_rebuild"); if you want to rebuild the sitemap. * Please refer to the documentation.txt for more details. * * @since 3.0 * @access public * @author Arne Brachhold <himself [at] arnebrachhold [dot] de> * @return array An array with messages such as failed writes etc. */ function BuildSitemap() { global $nxtdb, $posts, $nxt_version; $this->Initate(); if ($this->GetOption("b_memory") != '') { @ini_set("memory_limit", $this->GetOption("b_memory")); } if ($this->GetOption("b_time") != -1) { @set_time_limit($this->GetOption("b_time")); } //This object saves the status information of the script directly to the database $status = new GoogleSitemapGeneratorStatus(); //Other plugins can detect if the building process is active $this->_isActive = true; //$this->AddElement(new GoogleSitemapGeneratorXmlEntry()); //Debug mode? $debug = $this->GetOption("b_debug"); if ($this->GetOption("b_xml")) { $fileName = $this->GetXmlPath(); $status->StartXml($this->GetXmlPath(), $this->GetXmlUrl()); if ($this->IsFileWritable($fileName)) { $this->_fileHandle = fopen($fileName, "w"); if (!$this->_fileHandle) { $status->EndXml(false, "Not openable"); } } else { $status->EndXml(false, "not writable"); } } //Write gzipped sitemap file if ($this->IsGzipEnabled()) { $fileName = $this->GetZipPath(); $status->StartZip($this->GetZipPath(), $this->GetZipUrl()); if ($this->IsFileWritable($fileName)) { $this->_fileZipHandle = gzopen($fileName, "w1"); if (!$this->_fileZipHandle) { $status->EndZip(false, "Not openable"); } } else { $status->EndZip(false, "not writable"); } } if (!$this->_fileHandle && !$this->_fileZipHandle) { $status->End(); return; } //Content of the XML file $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<?xml version="1.0" encoding="UTF-8"' . '?' . '>')); $styleSheet = $this->GetDefaultStyle() && $this->GetOption('b_style_default') === true ? $this->GetDefaultStyle() : $this->GetOption('b_style'); if (!empty($styleSheet)) { $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<' . '?xml-stylesheet type="text/xsl" href="' . $styleSheet . '"?' . '>')); } $this->AddElement(new GoogleSitemapGeneratorDebugEntry("generator=\"nxtclass/" . get_bloginfo('version') . "\"")); $this->AddElement(new GoogleSitemapGeneratorDebugEntry("sitemap-generator-url=\"http://www.arnebrachhold.de\" sitemap-generator-version=\"" . $this->GetVersion() . "\"")); $this->AddElement(new GoogleSitemapGeneratorDebugEntry("generated-on=\"" . date(get_option("date_format") . " " . get_option("time_format")) . "\"")); //All comments as an asso. Array (postID=>commentCount) $comments = $this->GetOption("b_prio_provider") != "" ? $this->GetComments() : array(); //Full number of comments $commentCount = count($comments) > 0 ? $this->GetCommentCount($comments) : 0; if ($debug && $this->GetOption("b_prio_provider") != "") { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Total comment count: " . $commentCount)); } //Go XML! $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">')); $home = get_bloginfo('url'); $homePid = 0; // Load qTranslate settings require_once "sitemap-qtranslate.php"; $qt = qt_settings(); //Add the home page (WITH a slash!) if ($this->GetOption("in_home")) { if ('page' == get_option('show_on_front') && get_option('page_on_front')) { $pageOnFront = get_option('page_on_front'); $p = get_page($pageOnFront); if ($p) { $homePid = $p->ID; if (!$qt["enabled"]) { $this->AddUrl(trailingslashit($home), $this->GetTimestampFromMySql($p->post_modified_gmt && $p->post_modified_gmt != '0000-00-00 00:00:00' ? $p->post_modified_gmt : $p->post_date_gmt), $this->GetOption("cf_home"), $this->GetOption("pr_home")); } qt_permalink($qt, trailingslashit($home), null, $p->post_modified_gmt && $p->post_modified_gmt != '0000-00-00 00:00:00' ? $p->post_modified_gmt : $p->post_date_gmt, $this->GetOption("cf_home"), $this->GetOption("pr_home"), $this); } } else { if (!$qt["enabled"]) { $this->AddUrl(trailingslashit($home), $this->GetTimestampFromMySql(get_lastpostmodified('GMT')), $this->GetOption("cf_home"), $this->GetOption("pr_home")); } qt_permalink($qt, trailingslashit($home), null, get_lastpostmodified('GMT'), $this->GetOption("cf_home"), $this->GetOption("pr_home"), $this); } } //Add the posts if ($this->GetOption("in_posts") || $this->GetOption("in_pages")) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Postings")); } //Pre 2.1 compatibility. 2.1 introduced 'future' as post_status so we don't need to check post_date $nxtCompat = floatval($nxt_version) < 2.1; $excludes = $this->GetOption('b_exclude'); //Excluded posts and pages (user enetered ID) $exclCats = $this->GetOption("b_exclude_cats"); // Excluded cats if ($exclCats && count($exclCats) > 0 && $this->IsTaxonomySupported()) { $excludedCatPosts = get_objects_in_term($exclCats, "category"); // Get all posts in excl. cats. Unforttunately this also gives us pages, revisions and so on... //Remove the pages, revisions etc from the exclude by category list, because they are always in the uncategorized one. if (count($excludedCatPosts) > 0) { $exclPages = $nxtdb->get_col("SELECT ID FROM `" . $nxtdb->posts . "` WHERE post_type!='post' AND ID IN ('" . implode("','", $excludedCatPosts) . "')"); $exclPages = array_map('intval', $exclPages); //Remove the pages from the exlusion list before if (count($exclPages) > 0) { $excludedCatPosts = array_diff($excludedCatPosts, $exclPages); } //Merge the category exclusion list with the users one if (count($excludedCatPosts) > 0) { $excludes = array_merge($excludes, $excludedCatPosts); } } } $contentStmt = ''; if ($qt["enabled"]) { $contentStmt .= ', post_content '; } $postPageStmt = ''; $inSubPages = $this->GetOption('in_posts_sub') === true; if ($inSubPages && $this->GetOption('in_posts') === true) { $pageDivider = '<!--nextpage-->'; $postPageStmt = ", (character_length(`post_content`) - character_length(REPLACE(`post_content`, '{$pageDivider}', ''))) / " . strlen($pageDivider) . " as postPages"; } $sql = "SELECT `ID`, `post_author`, `post_date`, `post_date_gmt`, `post_status`, `post_name`, `post_modified`, `post_modified_gmt`, `post_parent`, `post_type` {$postPageStmt} {$contentStmt} FROM `" . $nxtdb->posts . "` WHERE "; $where = '('; if ($this->GetOption('in_posts')) { //nxt < 2.1: posts are post_status = publish //nxt >= 2.1: post_type must be 'post', no date check required because future posts are post_status='future' if ($nxtCompat) { $where .= "(post_status = 'publish' AND post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "')"; } else { if ($this->IsCustomPostTypesSupported() && count($this->GetOption('in_customtypes')) > 0) { $where .= " (post_status = 'publish' AND (post_type in ('','post'"; foreach ($this->GetOption('in_customtypes') as $customType) { $where .= ",'{$customType}'"; } $where .= "))) "; } else { $where .= " (post_status = 'publish' AND (post_type = 'post' OR post_type = '')) "; } } } if ($this->GetOption('in_pages')) { if ($this->GetOption('in_posts')) { $where .= " OR "; } if ($nxtCompat) { //nxt < 2.1: posts have post_status = published, pages have post_status = static $where .= " post_status='static' "; } else { //nxt >= 2.1: posts have post_type = 'post' and pages have post_type = 'page'. Both must be published. $where .= " (post_status = 'publish' AND post_type = 'page') "; } } $where .= ") "; if (is_array($excludes) && count($excludes) > 0) { $where .= " AND ID NOT IN ('" . implode("','", $excludes) . "')"; } $where .= " AND post_password='' ORDER BY post_modified DESC"; $sql .= $where; if ($this->GetOption("b_max_posts") > 0) { $sql .= " LIMIT 0," . $this->GetOption("b_max_posts"); } $postCount = intval($nxtdb->get_var("SELECT COUNT(*) AS cnt FROM `" . $nxtdb->posts . "` WHERE " . $where, 0, 0)); //Create a new connection because we are using mysql_unbuffered_query and don't want to disturb the nxt connection //Safe Mode for other plugins which use mysql_query() without a connection handler and will destroy our resultset :( $con = $postRes = null; //In 2.2, a bug which prevented additional DB connections was fixed if (floatval($nxt_version) < 2.2) { $this->SetOption("b_safemode", true); } if ($this->GetOption("b_safemode") === true) { $postRes = mysql_query($sql, $nxtdb->dbh); if (!$postRes) { trigger_error("MySQL query failed: " . mysql_error(), E_USER_NOTICE); //E_USER_NOTICE will be displayed on our debug mode return; } } else { $con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, true); if (!$con) { trigger_error("MySQL Connection failed: " . mysql_error(), E_USER_NOTICE); return; } if (!mysql_select_db(DB_NAME, $con)) { trigger_error("MySQL DB Select failed: " . mysql_error(), E_USER_NOTICE); return; } $postRes = mysql_unbuffered_query($sql, $con); if (!$postRes) { trigger_error("MySQL unbuffered query failed: " . mysql_error(), E_USER_NOTICE); return; } } if ($postRes) { //#type $prioProvider GoogleSitemapGeneratorPrioProviderBase $prioProvider = NULL; if ($this->GetOption("b_prio_provider") != '') { $providerClass = $this->GetOption('b_prio_provider'); $prioProvider = new $providerClass($commentCount, $postCount); } //$posts is used by Alex King's Popularity Contest plugin //if($posts == null || !is_array($posts)) { // $posts = &$postRes; //} $z = 1; $zz = 1; //Default priorities $default_prio_posts = $this->GetOption('pr_posts'); $default_prio_pages = $this->GetOption('pr_pages'); //Change frequencies $cf_pages = $this->GetOption('cf_pages'); $cf_posts = $this->GetOption('cf_posts'); $minPrio = $this->GetOption('pr_posts_min'); //Cycle through all posts and add them while ($post = mysql_fetch_object($postRes)) { //Fill the cache with our DB result. Since it's incomplete (no text-content for example), we will clean it later. $cache = array(&$post); update_post_cache($cache); //Set the current working post for other plugins which depend on "the loop" $GLOBALS['post'] =& $post; $permalink = get_permalink($post->ID); if ($permalink != $home && $post->ID != $homePid) { $isPage = false; if ($nxtCompat) { $isPage = $post->post_status == 'static'; } else { $isPage = $post->post_type == 'page'; } //Default Priority if auto calc is disabled $prio = 0; if ($isPage) { //Priority for static pages $prio = $default_prio_pages; } else { //Priority for normal posts $prio = $default_prio_posts; } //If priority calc. is enabled, calculate (but only for posts, not pages)! if ($prioProvider !== null && !$isPage) { //Comment count for this post $cmtcnt = isset($comments[$post->ID]) ? $comments[$post->ID] : 0; $prio = $prioProvider->GetPostPriority($post->ID, $cmtcnt, $post); if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry('Debug: Priority report of postID ' . $post->ID . ': Comments: ' . $cmtcnt . ' of ' . $commentCount . ' = ' . $prio . ' points')); } } if (!$isPage && $minPrio > 0 && $prio < $minPrio) { $prio = $minPrio; } //Add it if (!$qt["enabled"]) { $this->AddUrl($permalink, $this->GetTimestampFromMySql($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt), $isPage ? $cf_pages : $cf_posts, $prio); } qt_permalink($qt, $permalink, $post->post_content, $post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt, $isPage ? $cf_pages : $cf_posts, $prio, $this); if ($inSubPages) { $subPage = ''; for ($p = 1; $p <= $post->postPages; $p++) { if (get_option('permalink_structure') == '') { $subPage = $permalink . '&page=' . ($p + 1); } else { $subPage = trailingslashit($permalink) . user_trailingslashit($p + 1, 'single_paged'); } if (!$qt["enabled"]) { $this->AddUrl($subPage, $this->GetTimestampFromMySql($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt), $isPage ? $cf_pages : $cf_posts, $prio); } //qt_permalink($qt, $subPage, $post->post_content, ($post->post_modified_gmt && $post->post_modified_gmt!='0000-00-00 00:00:00'?$post->post_modified_gmt:$post->post_date_gmt), ($isPage?$cf_pages:$cf_posts), $prio, $this); } } } //Update the status every 100 posts and at the end. //If the script breaks because of memory or time limit, //we have a "last reponded" value which can be compared to the server settings if ($zz == 100 || $z == $postCount) { $status->SaveStep($z); $zz = 0; } else { $zz++; } $z++; //Clean cache because it's incomplete if (version_compare($nxt_version, "2.5", ">=")) { //nxt 2.5 makes a mysql query for every clean_post_cache to clear the child cache //so I've copied the function here until a patch arrives... nxt_cache_delete($post->ID, 'posts'); nxt_cache_delete($post->ID, 'post_meta'); clean_object_term_cache($post->ID, 'post'); } else { clean_post_cache($post->ID); } } unset($postRes); unset($prioProvider); if ($this->GetOption("b_safemode") !== true && $con) { mysql_close($con); } } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Postings")); } } //Add the cats if ($this->GetOption("in_cats")) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Cats")); } $exclCats = $this->GetOption("b_exclude_cats"); // Excluded cats if ($exclCats == null) { $exclCats = array(); } if (!$this->IsTaxonomySupported()) { $catsRes = $nxtdb->get_results("\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tc.cat_ID AS ID,\r\n\t\t\t\t\t\t\t\tMAX(p.post_modified_gmt) AS last_mod\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t`" . $nxtdb->categories . "` c,\r\n\t\t\t\t\t\t\t\t`" . $nxtdb->post2cat . "` pc,\r\n\t\t\t\t\t\t\t\t`" . $nxtdb->posts . "` p\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tpc.category_id = c.cat_ID\r\n\t\t\t\t\t\t\t\tAND p.ID = pc.post_id\r\n\t\t\t\t\t\t\t\tAND p.post_status = 'publish'\r\n\t\t\t\t\t\t\t\tAND p.post_type='post'\r\n\t\t\t\t\t\t\tGROUP\r\n\t\t\t\t\t\t\t\tBY c.cat_id\r\n\t\t\t\t\t\t\t"); if ($catsRes) { foreach ($catsRes as $cat) { if ($cat && $cat->ID && $cat->ID > 0 && !in_array($cat->ID, $exclCats)) { if ($debug) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Cat-ID:" . $cat->ID)); } } if (!$qt["enabled"]) { $this->AddUrl(get_category_link($cat->ID), $this->GetTimestampFromMySql($cat->last_mod), $this->GetOption("cf_cats"), $this->GetOption("pr_cats")); } qt_permalink($qt, get_category_link($cat->ID), null, $cat->last_mod, $this->GetOption("cf_cats"), $this->GetOption("pr_cats"), $this); } } } } else { $cats = get_terms("category", array("hide_empty" => true, "hierarchical" => false)); if ($cats && is_array($cats) && count($cats) > 0) { foreach ($cats as $cat) { if (!in_array($cat->term_id, $exclCats)) { if (!$qt["enabled"]) { $this->AddUrl(get_category_link($cat->term_id), 0, $this->GetOption("cf_cats"), $this->GetOption("pr_cats")); } qt_permalink($qt, get_category_link($cat->term_id), null, 0, $this->GetOption("cf_cats"), $this->GetOption("pr_cats"), $this); } } } } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Cats")); } } //Add the archives if ($this->GetOption("in_arch")) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Archive")); } $now = current_time('mysql'); //nxt2.1 introduced post_status='future', for earlier nxt versions we need to check the post_date_gmt $arcresults = $nxtdb->get_results("\r\n\t\t\t\t\t\tSELECT DISTINCT\r\n\t\t\t\t\t\t\tYEAR(post_date_gmt) AS `year`,\r\n\t\t\t\t\t\t\tMONTH(post_date_gmt) AS `month`,\r\n\t\t\t\t\t\t\tMAX(post_date_gmt) as last_mod,\r\n\t\t\t\t\t\t\tcount(ID) as posts\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t{$nxtdb->posts}\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tpost_date < '{$now}'\r\n\t\t\t\t\t\t\tAND post_status = 'publish'\r\n\t\t\t\t\t\t\tAND post_type = 'post'\r\n\t\t\t\t\t\t\t" . (floatval($nxt_version) < 2.1 ? "AND {$nxtdb->posts}.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'" : "") . "\r\n\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\tYEAR(post_date_gmt),\r\n\t\t\t\t\t\t\tMONTH(post_date_gmt)\r\n\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\tpost_date_gmt DESC"); if ($arcresults) { foreach ($arcresults as $arcresult) { $url = get_month_link($arcresult->year, $arcresult->month); $changeFreq = ""; //Archive is the current one if ($arcresult->month == date("n") && $arcresult->year == date("Y")) { $changeFreq = $this->GetOption("cf_arch_curr"); } else { // Archive is older $changeFreq = $this->GetOption("cf_arch_old"); } if (!$qt["enabled"]) { $this->AddUrl($url, $this->GetTimestampFromMySql($arcresult->last_mod), $changeFreq, $this->GetOption("pr_arch")); } qt_permalink($qt, $url, null, $arcresult->last_mod, $changeFreq, $this->GetOption("pr_arch"), $this); } } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Archive")); } } //Add the author pages if ($this->GetOption("in_auth")) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Author pages")); } $linkFunc = null; //get_author_link is deprecated in nxt 2.1, try to use get_author_posts_url first. if (function_exists('get_author_posts_url')) { $linkFunc = 'get_author_posts_url'; } else { if (function_exists('get_author_link')) { $linkFunc = 'get_author_link'; } } //Who knows what happens in later nxt versions, so check again if it worked if ($linkFunc !== null) { //Unfortunately there is no API function to get all authors, so we have to do it the dirty way... //We retrieve only users with published and not password protected posts (and not pages) //nxt2.1 introduced post_status='future', for earlier nxt versions we need to check the post_date_gmt $sql = "SELECT DISTINCT\r\n\t\t\t\t\t\t\tu.ID,\r\n\t\t\t\t\t\t\tu.user_nicename,\r\n\t\t\t\t\t\t\tMAX(p.post_modified_gmt) AS last_post\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t{$nxtdb->users} u,\r\n\t\t\t\t\t\t\t{$nxtdb->posts} p\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tp.post_author = u.ID\r\n\t\t\t\t\t\t\tAND p.post_status = 'publish'\r\n\t\t\t\t\t\t\tAND p.post_type = 'post'\r\n\t\t\t\t\t\t\tAND p.post_password = ''\r\n\t\t\t\t\t\t\t" . (floatval($nxt_version) < 2.1 ? "AND p.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'" : "") . "\r\n\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\tu.ID,\r\n\t\t\t\t\t\t\tu.user_nicename"; $authors = $nxtdb->get_results($sql); if ($authors && is_array($authors)) { foreach ($authors as $author) { if ($debug) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Author-ID:" . $author->ID)); } } $url = $linkFunc == 'get_author_posts_url' ? get_author_posts_url($author->ID, $author->user_nicename) : get_author_link(false, $author->ID, $author->user_nicename); if (!$qt["enabled"]) { $this->AddUrl($url, $this->GetTimestampFromMySql($author->last_post), $this->GetOption("cf_auth"), $this->GetOption("pr_auth")); } qt_permalink($qt, $url, null, $author->last_post, $this->GetOption("cf_auth"), $this->GetOption("pr_auth"), $this); } } } else { //Too bad, no author pages for you :( if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: No valid author link function found")); } } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Author pages")); } } //Add tag pages if ($this->GetOption("in_tags") && $this->IsTaxonomySupported()) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Tags")); } $tags = get_terms("post_tag", array("hide_empty" => true, "hierarchical" => false)); if ($tags && is_array($tags) && count($tags) > 0) { foreach ($tags as $tag) { if (!$qt["enabled"]) { $this->AddUrl(get_tag_link($tag->term_id), 0, $this->GetOption("cf_tags"), $this->GetOption("pr_tags")); } qt_permalink($qt, get_tag_link($tag->term_id), null, 0, $this->GetOption("cf_tags"), $this->GetOption("pr_tags"), $this); } } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Tags")); } } //Add custom taxonomy pages if ($this->GetOption("in_tax") && $this->IsTaxonomySupported()) { if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start custom taxonomies")); } $enabledTaxonomies = $this->GetOption("in_tax"); $taxList = array(); foreach ($enabledTaxonomies as $taxName) { $taxonomy = get_taxonomy($taxName); if ($taxonomy) { $taxList[] = $nxtdb->escape($taxonomy->name); } } if (count($taxList) > 0) { //We're selecting all term information (t.*) plus some additional fields //like the last mod date and the taxonomy name, so nxt doesnt need to make //additional queries to build the permalink structure. //This does NOT work for categories and tags yet, because nxt uses get_category_link //and get_tag_link internally and that would cause one additional query per term! $sql = "\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tt.*,\r\n\t\t\t\t\t\ttt.taxonomy AS _taxonomy,\r\n\t\t\t\t\t\tUNIX_TIMESTAMP(MAX(post_date_gmt)) as _mod_date\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t{$nxtdb->posts} p ,\r\n\t\t\t\t\t\t{$nxtdb->term_relationships} r,\r\n\t\t\t\t\t\t{$nxtdb->terms} t,\r\n\t\t\t\t\t\t{$nxtdb->term_taxonomy} tt\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tp.ID = r.object_id\r\n\t\t\t\t\t\tAND p.post_status = 'publish'\r\n\t\t\t\t\t\tAND p.post_type = 'post'\r\n\t\t\t\t\t\tAND p.post_password = ''\r\n\t\t\t\t\t\tAND r.term_taxonomy_id = t.term_id\r\n\t\t\t\t\t\tAND t.term_id = tt.term_id\r\n\t\t\t\t\t\tAND tt.count > 0\r\n\t\t\t\t\t\tAND tt.taxonomy IN ('" . implode("','", $taxList) . "')\r\n\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\tt.term_id"; $termInfo = $nxtdb->get_results($sql); foreach ($termInfo as $term) { $this->AddUrl(get_term_link($term, $term->_taxonomy), $term->_mod_date, $this->GetOption("cf_tags"), $this->GetOption("pr_tags")); } } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End custom taxonomies")); } } //Add the custom pages if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Custom Pages")); } if ($this->_pages && is_array($this->_pages) && count($this->_pages) > 0) { //#type $page GoogleSitemapGeneratorPage foreach ($this->_pages as $page) { $this->AddUrl($page->GetUrl(), $page->getLastMod(), $page->getChangeFreq(), $page->getPriority()); } } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Custom Pages")); } if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start additional URLs")); } do_action('sm_buildmap'); if ($debug) { $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End additional URLs")); } $this->AddElement(new GoogleSitemapGeneratorXmlEntry("</urlset>")); $pingUrl = ''; if ($this->GetOption("b_xml")) { if ($this->_fileHandle && fclose($this->_fileHandle)) { $this->_fileHandle = null; $status->EndXml(true); $pingUrl = $this->GetXmlUrl(); } else { $status->EndXml(false, "Could not close the sitemap file."); } } if ($this->IsGzipEnabled()) { if ($this->_fileZipHandle && fclose($this->_fileZipHandle)) { $this->_fileZipHandle = null; $status->EndZip(true); $pingUrl = $this->GetZipUrl(); } else { $status->EndZip(false, "Could not close the zipped sitemap file"); } } //Ping Google if ($this->GetOption("b_ping") && !empty($pingUrl)) { $sPingUrl = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" . urlencode($pingUrl); $status->StartGooglePing($sPingUrl); $pingres = $this->RemoteOpen($sPingUrl); if ($pingres == NULL || $pingres === false) { $status->EndGooglePing(false, $this->_lastError); trigger_error("Failed to ping Google: " . htmlspecialchars(strip_tags($pingres)), E_USER_NOTICE); } else { $status->EndGooglePing(true); } } //Ping Ask.com if ($this->GetOption("b_pingask") && !empty($pingUrl)) { $sPingUrl = "http://submissions.ask.com/ping?sitemap=" . urlencode($pingUrl); $status->StartAskPing($sPingUrl); $pingres = $this->RemoteOpen($sPingUrl); if ($pingres == NULL || $pingres === false || strpos($pingres, "successfully received and added") === false) { //Ask.com returns 200 OK even if there was an error, so we need to check the content. $status->EndAskPing(false, $this->_lastError); trigger_error("Failed to ping Ask.com: " . htmlspecialchars(strip_tags($pingres)), E_USER_NOTICE); } else { $status->EndAskPing(true); } } //Ping Bing if ($this->GetOption("b_pingmsn") && !empty($pingUrl)) { $sPingUrl = "http://www.bing.com/webmaster/ping.aspx?siteMap=" . urlencode($pingUrl); $status->StartMsnPing($sPingUrl); $pingres = $this->RemoteOpen($sPingUrl); //Bing returns ip/country-based success messages, so there is no way to check the content. Rely on HTTP 500 only then... if ($pingres == NULL || $pingres === false || strpos($pingres, " ") === false) { trigger_error("Failed to ping Bing: " . htmlspecialchars(strip_tags($pingres)), E_USER_NOTICE); $status->EndMsnPing(false, $this->_lastError); } else { $status->EndMsnPing(true); } } $status->End(); $this->_isActive = false; //done... return $status; }
function veryplaintxt_author_hCard() { global $wpdb, $authordata; echo '<span class="entry-author author vcard"><a class="url fn n" href="' . get_author_link(false, $authordata->ID, $authordata->user_nicename) . '" title="View all posts by ' . $authordata->display_name . '">' . get_the_author() . '</a></span>'; }
if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) { $secure_cookie = false; } $user = wp_signon('', $secure_cookie); $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user); if (is_wp_error($user)) { if (strstr($_SERVER['HTTP_REFERER'], 'ptype=submition') && $_POST['log'] != '' && $_POST['pwd'] != '') { wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); } } if (!is_wp_error($user)) { if (!strstr($_SERVER['HTTP_REFERER'], 'ptype=submition')) { if ($_REQUEST['ptype1'] != '') { $redirect_to = site_url() . "/?ptype=" . $_REQUEST['ptype1']; } else { $redirect_to = get_author_link($echo = false, $user->data->ID); } } if (isset($_REQUEST['redirect_to'])) { $redirect_to = $_REQUEST['redirect_to']; } $redirect_to = apply_filters('templ_login_redirect_filter', $redirect_to); wp_redirect($redirect_to); exit; } $errors = $user; // Clear errors if loggedout is set. if (!empty($_GET['loggedout'])) { $errors = new WP_Error(); } // If cookies are disabled we can't log in even with a valid user+pass
function get_author_rss_link($echo = false, $author_id, $author_nicename) { $auth_ID = $author_id; $permalink_structure = get_settings('permalink_structure'); if ('' == $permalink_structure) { $link = get_settings('home') . '?feed=rss2&author=' . $author_id; } else { $link = get_author_link(0, $author_id, $author_nicename); $link = $link . "feed/"; } $link = apply_filters('author_feed_link', $link); if ($echo) { echo $link; } return $link; }
function yoast_guess_url($query) { if ($query->is_404 || $query->is_search) { return false; } $haspost = count($query->posts) > 0; $has_ut = function_exists('user_trailingslashit'); // Copied entirely and slightly modified from Scott Yang's Permalink Redirect, http://svn.fucoder.com/fucoder/permalink-redirect/ if (get_query_var('m')) { // Handling special case with '?m=yyyymmddHHMMSS' // Since there is no code for producing the archive links for // is_time, we will give up and not try to produce a link. $m = preg_replace('/[^0-9]/', '', get_query_var('m')); switch (strlen($m)) { case 4: // Yearly $link = get_year_link($m); break; case 6: // Monthly $link = get_month_link(substr($m, 0, 4), substr($m, 4, 2)); break; case 8: // Daily $link = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2)); break; default: return false; } } elseif (($query->is_single || $query->is_page) && $haspost) { $post = $query->posts[0]; $link = get_permalink($post->ID); $link = yoast_get_paged($link); // WP2.2: In Wordpress 2.2+ is_home() returns false and is_page() // returns true if front page is a static page. if ($query->is_page && 'page' == get_option('show_on_front') && $post->ID == get_option('page_on_front')) { $link = trailingslashit($link); } } elseif ($query->is_author && $haspost) { global $wp_version; if ($wp_version >= '2') { $author = get_userdata(get_query_var('author')); if ($author === false) { return false; } $link = get_author_link(false, $author->ID, $author->user_nicename); } else { // XXX: get_author_link() bug in WP 1.5.1.2 // s/author_nicename/user_nicename/ global $cache_userdata; $userid = get_query_var('author'); $link = get_author_link(false, $userid, $cache_userdata[$userid]->user_nicename); } } elseif ($query->is_category && $haspost) { $link = get_category_link(get_query_var('cat')); $link = yoast_get_paged($link); } else { if ($query->is_tag && $haspost) { $tag = get_term_by('slug', get_query_var('tag'), 'post_tag'); if (!empty($tag->term_id)) { $link = get_tag_link($tag->term_id); } $link = yoast_get_paged($link); } elseif ($query->is_day && $haspost) { $link = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')); } elseif ($query->is_month && $haspost) { $link = get_month_link(get_query_var('year'), get_query_var('monthnum')); } elseif ($query->is_year && $haspost) { $link = get_year_link(get_query_var('year')); } elseif ($query->is_home) { // WP2.1: Handling "Posts page" option. In WordPress 2.1 is_home() // returns true and is_page() returns false if home page has been // set to a page, and we are getting the permalink of that page // here. if (get_option('show_on_front') == 'page' && ($pageid = get_option('page_for_posts'))) { $link = get_permalink($pageid); $link = yoast_get_paged($link); $link = trailingslashit($link); } else { $link = get_option('home'); $link = yoast_get_paged($link); $link = trailingslashit($link); } } else { return false; } } return $link; }
function echo_to_blog_header() { if (is_feed()) { return; } global $wp_query; $post = $wp_query->get_queried_object(); $meta_string = null; $meta = null; $can_link = ''; $canonical = get_option('psp_canonical'); //echo("wp_head() " . wp_title('', false) . " is_home() => " . is_home() . ", is_page() => " . is_page() . ", is_single() => " . is_single() . ", is_static_front_page() => " . $this->is_static_front_page() . ", is_static_posts_page() => " . $this->is_static_posts_page()); if (is_single() || is_page()) { $psp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'psp_disable', true))); if ($psp_disable) { return; } //$pspmeta = $_POST["psp_robotsmeta"]; $pspmeta = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'robotsmeta', true))); if (isset($pspmeta) && !empty($pspmeta)) { if (get_option('psp_comnts_pages_noindex') && get_option('page_comments') && (get_query_var('cpage') >= 1 || get_query_var('cpage') < get_comment_pages_count())) { $meta .= "noindex,follow"; } else { $meta = $pspmeta; } } else { if (get_option('psp_comnts_pages_noindex') && get_option('page_comments') && (get_query_var('cpage') >= 1 || get_query_var('cpage') < get_comment_pages_count())) { $meta .= "noindex,follow"; } else { $meta .= "index,follow"; } } $psp_noarchive = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'psp_noarchive', true))); if ($psp_noarchive) { if ($meta != "") { $meta .= ","; } $meta .= "noarchive"; } $psp_nosnippet = htmlspecialchars(stripcslashes(get_post_meta($post->ID, 'psp_nosnippet', true))); if ($psp_nosnippet) { if ($meta != "") { $meta .= ","; } $meta .= "nosnippet"; } } else { if (is_author() && get_option('psp_author_archives_noindex') || is_category() && get_option('psp_category_noindex') || is_date() && get_option('psp_archive_noindex') || is_search() && get_option('psp_search_results_noindex') || function_exists('is_tag') && is_tag() && get_option('psp_tags_noindex')) { $meta .= "noindex,follow"; } else { if (is_home()) { if (get_option('psp_sub_pages_home_noindex') && get_query_var('paged') > 1) { $meta .= "noindex,follow"; } else { $meta .= "index,follow"; } } else { if (function_exists('is_tag') && is_tag() && !get_option('psp_tags_noindex') || is_category() && !get_option('psp_category_noindex') || is_author() && !get_option('psp_author_archives_noindex') || is_date() && !get_option('psp_archive_noindex') || is_search() && !get_option('psp_search_results_noindex')) { if (get_option('psp_sub_pages_home_noindex') && get_query_var('paged') > 1) { $meta .= "noindex,follow"; } else { $meta .= "index,follow"; } } } } } if (get_option('psp_noodp_metatag')) { if ($meta != "") { $meta .= ","; } $meta .= "noodp"; } if (get_option('psp_noydir_metatag')) { if ($meta != "") { $meta .= ","; } $meta .= "noydir"; } if ($meta != "" || isset($meta)) { if ($meta_string != "" || isset($meta_string)) { ${$meta_string} .= "\n"; } $meta_string .= '<meta name="robots" content="' . $meta . '" />'; } echo "\n<!-- platinum seo pack {$this->version} "; if ($this->ob_start_detected) { echo "ob_start_detected "; } //echo "[$this->title_start,$this->title_end] "; echo "-->\n"; if (is_home() && get_option('aiosp_home_keywords')) { // || $this->is_static_front_page()) { $keywords = trim($this->internationalize(get_option('aiosp_home_keywords'))); } else { $keywords = $this->get_all_keywords(); } if (is_single() || is_page() || $this->is_static_front_page()) { //if ($this->is_static_front_page()) { // $description = trim(stripcslashes($this->internationalize(get_option('aiosp_home_description')))); //} else { $description = $this->get_post_description($post); if ($canonical) { $post_link = get_permalink($post->ID); $can_link = $this->paged_link($post_link); //$can_link = trailingslashit($can_link); if ($this->is_static_front_page()) { $can_link = trailingslashit($can_link); } } // } } else { if (is_home()) { $description = trim(stripcslashes($this->internationalize(get_option('aiosp_home_description')))); if ($canonical) { if (get_option('show_on_front') == 'page' && ($pageid = get_option('page_for_posts'))) { $page_for_posts_link = get_permalink($pageid); $can_link = $this->paged_link($page_for_posts_link); $can_link = trailingslashit($can_link); } else { $home_link = get_option('home'); $can_link = $this->paged_link($home_link); $can_link = trailingslashit($can_link); } } } else { if (is_category()) { $cat_description = category_description(); $description = $this->get_string_between($cat_description, "[description]", "[/description]"); $keywords = $this->get_string_between($cat_description, "[keywords]", "[/keywords]"); if ($description == "" || $description == null) { $description = $this->trim_excerpt_without_filters($this->internationalize($cat_description)); } else { $description = $this->trim_excerpt_without_filters($this->internationalize($description)); } if ($keywords != "" || $keywords != null) { $keywords = $this->internationalize($keywords); } if ($canonical) { $cat_link = get_category_link(get_query_var('cat')); $can_link = $this->paged_link($cat_link); } } else { if (is_date() && $canonical) { if (get_query_var('m')) { $m = preg_replace('/[^0-9]/', '', get_query_var('m')); switch (strlen($m)) { case 4: $can_link = get_year_link($m); $can_link = $this->paged_link($can_link); break; case 6: $can_link = get_month_link(substr($m, 0, 4), substr($m, 4, 2)); $can_link = $this->paged_link($can_link); break; case 8: $can_link = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2)); $can_link = $this->paged_link($can_link); break; default: $can_link = ''; } } if ($wp_query->is_day) { $can_link = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')); $can_link = $this->paged_link($can_link); } else { if ($wp_query->is_month) { $can_link = get_month_link(get_query_var('year'), get_query_var('monthnum')); $can_link = $this->paged_link($can_link); } else { if ($wp_query->is_year) { $can_link = get_year_link(get_query_var('year')); $can_link = $this->paged_link($can_link); } } } } else { if (function_exists('is_tag') && is_tag()) { if (function_exists('tag_description')) { $tag_description = tag_description(); $description = $this->get_string_between($tag_description, "[description]", "[/description]"); $keywords = $this->get_string_between($tag_description, "[keywords]", "[/keywords]"); if ($description == "" || $description == null) { $description = $this->trim_excerpt_without_filters($this->internationalize($tag_description)); } else { $description = $this->trim_excerpt_without_filters($this->internationalize($description)); } if ($keywords != "" || $keywords != null) { $keywords = $this->internationalize($keywords); } } if ($canonical) { $tag = get_term_by('slug', get_query_var('tag'), 'post_tag'); if (!empty($tag->term_id)) { $tag_link = get_tag_link($tag->term_id); } $can_link = $this->paged_link($tag_link); } } else { if (is_author() && $canonical) { global $wp_version; if ($wp_version >= '2') { $author = get_userdata(get_query_var('author')); if ($author === false) { return false; } $auth_link = get_author_link(false, $author->ID, $author->user_nicename); $can_link = $this->paged_link($auth_link); } else { global $cache_userdata; $userid = get_query_var('author'); $auth_link = get_author_link(false, $userid, $cache_userdata[$userid]->user_nicename); $can_link = $this->paged_link($auth_link); } } } } } } } if (isset($description) && strlen($description) > $this->min_description_length && !(is_home() && is_paged() || is_category() && is_paged() || function_exists('is_tag') && is_tag() && is_paged())) { $description = trim(strip_tags($description)); $description = str_replace('"', '', $description); // replace newlines on mac / windows? $description = str_replace("\r\n", ' ', $description); // maybe linux uses this alone $description = str_replace("\n", ' ', $description); if (isset($meta_string)) { $meta_string .= "\n"; } else { $meta_string = ''; } // description format $description_format = get_option('aiosp_description_format'); if (!isset($description_format) || empty($description_format)) { $description_format = "%description%"; } $description = str_replace('%description%', $description, $description_format); $description = str_replace('%blog_title%', get_bloginfo('name'), $description); $description = str_replace('%blog_description%', get_bloginfo('description'), $description); $description = str_replace('%wp_title%', $this->get_original_title(), $description); $meta_string .= sprintf("<meta name=\"description\" content=\"%s\" />", $description); } if (isset($keywords) && !empty($keywords) && !(is_home() && is_paged() || is_category() && is_paged() || function_exists('is_tag') && is_tag() && is_paged())) { if (isset($meta_string)) { $meta_string .= "\n"; } $meta_string .= sprintf("<meta name=\"keywords\" content=\"%s\" />", $keywords); } $page_meta = stripcslashes(get_option('aiosp_page_meta_tags')); $post_meta = stripcslashes(get_option('aiosp_post_meta_tags')); $home_meta = stripcslashes(get_option('aiosp_home_meta_tags')); if (is_page() && isset($page_meta) && !empty($page_meta)) { if (isset($meta_string)) { $meta_string .= "\n"; } echo "\n{$page_meta}"; } if (is_single() && isset($post_meta) && !empty($post_meta)) { if (isset($meta_string)) { $meta_string .= "\n"; } $meta_string .= "{$post_meta}"; } if (is_home() && !empty($home_meta)) { if (isset($meta_string)) { $meta_string .= "\n"; } $meta_string .= "{$home_meta}"; } if ($meta_string != null) { echo "{$meta_string}\n"; } if ($can_link != '' && $canonical) { echo "" . '<link rel="canonical" href="' . $can_link . '" />' . "\n"; } echo "<!-- /platinum one seo pack -->\n"; }
function redirect_canonical($requested_url = NULL, $do_redirect = true) { global $wp_rewrite, $posts, $is_IIS; if (is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || isset($_POST) && count($_POST)) { return; } if (!$requested_url) { // build the URL in the address bar $requested_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://'; $requested_url .= $_SERVER['HTTP_HOST']; $requested_url .= $_SERVER['REQUEST_URI']; } $original = @parse_url($requested_url); if (false === $original) { return; } // Some PHP setups turn requests for / into /index.php in REQUEST_URI $original['path'] = preg_replace('|/index\\.php$|', '/', $original['path']); $redirect = $original; $redirect_url = false; // These tests give us a WP-generated permalink if (is_404()) { $redirect_url = redirect_guess_404_permalink(); } elseif (is_object($wp_rewrite) && $wp_rewrite->using_permalinks()) { // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101 if (is_single() && isset($_GET['p'])) { if ($redirect_url = get_permalink(get_query_var('p'))) { $redirect['query'] = remove_query_arg('p', $redirect['query']); } } elseif (is_page() && isset($_GET['page_id'])) { if ($redirect_url = get_permalink(get_query_var('page_id'))) { $redirect['query'] = remove_query_arg('page_id', $redirect['query']); } } elseif (isset($_GET['m']) && (is_year() || is_month() || is_day())) { $m = get_query_var('m'); switch (strlen($m)) { case 4: // Yearly $redirect_url = get_year_link($m); break; case 6: // Monthly $redirect_url = get_month_link(substr($m, 0, 4), substr($m, 4, 2)); break; case 8: // Daily $redirect_url = get_day_link(substr($m, 0, 4), substr($m, 4, 2), substr($m, 6, 2)); break; } if ($redirect_url) { $redirect['query'] = remove_query_arg('m', $redirect['query']); } // now moving on to non ?m=X year/month/day links } elseif (is_day() && get_query_var('year') && get_query_var('monthnum') && isset($_GET['day'])) { if ($redirect_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'))) { $redirect['query'] = remove_query_arg(array('year', 'monthnum', 'day'), $redirect['query']); } } elseif (is_month() && get_query_var('year') && isset($_GET['monthnum'])) { if ($redirect_url = get_month_link(get_query_var('year'), get_query_var('monthnum'))) { $redirect['query'] = remove_query_arg(array('year', 'monthnum'), $redirect['query']); } } elseif (is_year() && isset($_GET['year'])) { if ($redirect_url = get_year_link(get_query_var('year'))) { $redirect['query'] = remove_query_arg('year', $redirect['query']); } } elseif (is_category() && isset($_GET['cat'])) { if ($redirect_url = get_category_link(get_query_var('cat'))) { $redirect['query'] = remove_query_arg('cat', $redirect['query']); } } elseif (is_author() && isset($_GET['author'])) { $author = get_userdata(get_query_var('author')); if (false !== $author && ($redirect_url = get_author_link(false, $author->ID, $author->user_nicename))) { $redirect['query'] = remove_query_arg('author', $redirect['author']); } } // paging if ($paged = get_query_var('paged')) { if ($paged > 0) { if (!$redirect_url) { $redirect_url = $requested_url; } $paged_redirect = @parse_url($redirect_url); $paged_redirect['path'] = preg_replace('|/page/[0-9]+?(/+)?$|', '/', $paged_redirect['path']); // strip off any existing paging $paged_redirect['path'] = preg_replace('|/index.php/?$|', '/', $paged_redirect['path']); // strip off trailing /index.php/ if ($paged > 1 && !is_single()) { $paged_redirect['path'] = trailingslashit($paged_redirect['path']); if ($wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false) { $paged_redirect['path'] .= 'index.php/'; } $paged_redirect['path'] .= user_trailingslashit("page/{$paged}", 'paged'); } elseif (!is_home() && !is_single()) { $paged_redirect['path'] = user_trailingslashit($paged_redirect['path'], 'paged'); } $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path']; $redirect['path'] = $paged_redirect['path']; } $redirect['query'] = remove_query_arg('paged', $redirect['query']); } } // tack on any additional query vars if ($redirect_url && $redirect['query']) { if (strpos($redirect_url, '?') !== false) { $redirect_url .= '&'; } else { $redirect_url .= '?'; } $redirect_url .= $redirect['query']; } if ($redirect_url) { $redirect = @parse_url($redirect_url); } // www.example.com vs example.com $user_home = @parse_url(get_option('home')); $redirect['host'] = $user_home['host']; // Handle ports if (isset($user_home['port'])) { $redirect['port'] = $user_home['port']; } else { unset($redirect['port']); } // trailing /index.php/ $redirect['path'] = preg_replace('|/index.php/$|', '/', $redirect['path']); // strip /index.php/ when we're not using PATHINFO permalinks if (!$wp_rewrite->using_index_permalinks()) { $redirect['path'] = str_replace('/index.php/', '/', $redirect['path']); } // trailing slashes if (is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_home() || is_home() && get_query_var('paged') > 1)) { $user_ts_type = ''; if (get_query_var('paged') > 0) { $user_ts_type = 'paged'; } else { foreach (array('single', 'category', 'page', 'day', 'month', 'year') as $type) { $func = 'is_' . $type; if (call_user_func($func)) { $user_ts_type = $type; } break; } } $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type); } elseif (is_home()) { $redirect['path'] = trailingslashit($redirect['path']); } // Always trailing slash the 'home' URL if ($redirect['path'] == $user_home['path']) { $redirect['path'] = trailingslashit($redirect['path']); } // Ignore differences in host capitalization, as this can lead to infinite redirects if (strtolower($original['host']) == strtolower($redirect['host'])) { $redirect['host'] = $original['host']; } if (array($original['host'], $original['port'], $original['path'], $original['query']) !== array($redirect['host'], $redirect['port'], $redirect['path'], $redirect['query'])) { $redirect_url = $redirect['scheme'] . '://' . $redirect['host']; if (isset($redirect['port'])) { $redirect_url .= ':' . $redirect['port']; } $redirect_url .= $redirect['path']; if ($redirect['query']) { $redirect_url .= '?' . $redirect['query']; } } if ($redirect_url && $redirect_url != $requested_url) { // var_dump($redirect_url); die(); $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url); if ($do_redirect) { // protect against chained redirects if (!redirect_canonical($redirect_url, false)) { wp_redirect($redirect_url, 301); exit; } else { return false; } } else { return $redirect_url; } } else { return false; } }
?> '><?php the_title(); ?> </a></h3> <?php /* Edit Link */ edit_post_link(__('Edit', 'redo_domain'), '<span class="editLink">', '</span>'); ?> <div class="entry-meta"> <div class="meta-row"> <?php /* Date & Author */ printf(__('%1$s', 'redo_domain'), sprintf(__('<span class="authordata">By %s</span>', 'redo_domain'), '<span class="vcard author"><a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . '" class="url fn">' . get_the_author() . '</a></span>')); ?> <?php /* Comments */ comments_popup_link(__('Leave a ') . '<span>' . __('Comments', 'redo_domain') . '</span>', '1 <span>' . __('Comment', 'redo_domain') . '</span>', '% <span>' . __('Comments', 'redo_domain') . '</span>', 'commentslink', '<span>' . __('Closed', 'redo_domain') . '</span>'); ?> </div> <div class="meta-row"> <?php /* Categories */ printf(__('<span class="entry-category">Categories: %s</span>', 'redo_domain'), redo_nice_category(', ', ' ' . __('and', 'redo_domain') . ' ')); ?> </div> </div> <!-- .entry-meta -->
?> </a></div> <div class="entry-caption"><?php if (!empty($post->post_excerpt)) { the_excerpt(); } ?> </div> <?php the_content(); ?> </div> <div class="entry-meta"> <?php printf(__('Posted by %1$s on <abbr class="published" title="%2$sT%3$s">%4$s at %5$s</abbr>. Bookmark the <a href="%6$s" title="Permalink to %7$s" rel="bookmark">permalink</a>. Follow any comments here with the <a href="%8$s" title="Comments RSS to %7$s" rel="alternate" type="application/rss+xml">RSS feed for this post</a>.', 'sandbox'), '<span class="author vcard"><a class="url fn n" href="' . get_author_link(false, $authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__('View all posts by %s', 'sandbox'), $authordata->display_name) . '">' . get_the_author() . '</a></span>', get_the_time('Y-m-d'), get_the_time('H:i:sO'), the_date('', '', '', false), get_the_time(), get_permalink(), the_title_attribute('echo=0'), comments_rss()); ?> <?php if ('open' == $post->comment_status && 'open' == $post->ping_status) { // Comments and trackbacks open ?> <?php printf(__('<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'sandbox'), get_trackback_url()); } elseif (!('open' == $post->comment_status) && 'open' == $post->ping_status) { // Only trackbacks open ?> <?php printf(__('Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', 'sandbox'), get_trackback_url()); } elseif ('open' == $post->comment_status && !('open' == $post->ping_status)) { // Only comments open
/** * Entry Footer * * @since 1.2 */ function rolo_entry_footer() { global $post; ?> <div class="entry-meta"> <span class="meta-prep meta-prep-author"><?php _e('By ', 'rolopress'); ?> </span> <span class="author"><a href="<?php echo get_author_link(false, $authordata->ID, $authordata->user_nicename); ?> " title="<?php printf(__('View all posts by %s', 'rolopress'), $authordata->display_name); ?> "><?php the_author(); ?> </a></span> <span class="meta-sep"> | </span> <span class="meta-prep meta-prep-entry-date"><?php _e('Created on ', 'rolopress'); ?> </span> <span class="entry-date"><abbr class="created" title="<?php the_time('Y-m-d\\TH:i:sO'); ?> "><?php the_time(get_option('date_format')); ?> </abbr></span> </div><!-- .entry-meta --> <div class="entry-utility group"> <?php rolo_category_list(); ?> <?php rolo_tag_list(); ?> <?php if ($post->post_type == 'post') { rolo_notes(); } // only show notes for posts ?> <?php rolo_edit_item(); ?> </div><!-- #entry-utility --> <?php }
?> " rel="bookmark"><?php the_title(); ?> </a></h2> <ul> <li class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\\TH:i:sO'); ?> "><?php unset($previousday); printf(__('%1$s – %2$s', 'sandbox'), the_date('', '', '', false), get_the_time()); ?> </abbr></li> <!-- <li class="entry-author author vcard"><?php printf(__('By %s', 'sandbox'), '<a class="url fn" href="' . get_author_link(false, $authordata->ID, $authordata->user_nicename) . '" title="View all posts by ' . $authordata->display_name . '">' . get_the_author() . '</a>'); ?> </li> --> </ul> </div> <div class="entry-content"> <?php the_content(); ?> <?php link_pages('<div class="page-link">' . __('Pages: ', 'sandbox'), '</div>', 'number'); ?> <?php edit_post_link(__('Edit this entry.', 'sandbox'), '<p class="edit-link">', '</p>');
function thematic_postheader() { global $id, $post, $authordata; // Create $posteditlink $posteditlink .= '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $id; $posteditlink .= '" title="' . __('Edit post', 'thematic') . '">'; $posteditlink .= __('Edit', 'thematic') . '</a>'; $posteditlink = apply_filters('thematic_postheader_posteditlink', $posteditlink); if (is_single() || is_page()) { $posttitle = '<h1 class="entry-title">' . get_the_title() . "</h1>\n"; } elseif (is_404()) { $posttitle = '<h1 class="entry-title">' . __('Not Found', 'thematic') . "</h1>\n"; } else { $posttitle = '<h2 class="entry-title"><a href="'; $posttitle .= get_permalink(); $posttitle .= '" title="'; $posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0'); $posttitle .= '" rel="bookmark">'; $posttitle .= get_the_title(); $posttitle .= "</a></h2>\n"; } $posttitle = apply_filters('thematic_postheader_posttitle', $posttitle); $postmeta = '<div class="entry-meta">'; $postmeta .= '<span class="meta-prep meta-prep-author">' . __('By ', 'thematic') . '</span>'; $postmeta .= '<span class="author vcard">' . '<a class="url fn n" href="'; $postmeta .= get_author_link(false, $authordata->ID, $authordata->user_nicename); $postmeta .= '" title="' . __('View all posts by ', 'thematic') . get_the_author() . '">'; $postmeta .= get_the_author(); $postmeta .= '</a></span><span class="meta-sep meta-sep-entry-date"> | </span>'; $postmeta .= '<span class="meta-prep meta-prep-entry-date">' . __('Published: ', 'thematic') . '</span>'; $postmeta .= '<span class="entry-date"><abbr class="published" title="'; $postmeta .= get_the_time(thematic_time_title()) . '">'; $postmeta .= get_the_time(thematic_time_display()); $postmeta .= '</abbr></span>'; // Display edit link if (current_user_can('edit_posts')) { $postmeta .= ' <span class="meta-sep meta-sep-edit">|</span> ' . '<span class="edit">' . $posteditlink . '</span>'; } $postmeta .= "</div><!-- .entry-meta -->\n"; $postmeta = apply_filters('thematic_postheader_postmeta', $postmeta); if ($post->post_type == 'page' || is_404()) { $postheader = $posttitle; } else { $postheader = $posttitle . $postmeta; } echo apply_filters('thematic_postheader', $postheader); // Filter to override default post header }
link_pages('<p class="pages-link">' . __('Pages: ', 'carrington'), "</p>\n", 'number'); ?> </div><!--/entry-content--> <p class="filed"> <span class="categories"><?php printf(__('Posted in %s.', 'carrington'), get_the_category_list(', ')); ?> </span> <?php the_tags(__('<span class="tags">Tagged with ', 'carrington'), ', ', '.</span>'); ?> </p><!--/filed--> <div class="by-line"> <address class="author vcard full-author"> <?php printf(__('<span class="by">By</span> %s', 'carrington'), '<a class="url fn" href="' . get_author_link(false, get_the_author_ID(), $authordata->user_nicename) . '" title="View all posts by ' . attribute_escape($authordata->display_name) . '">' . get_the_author() . '</a>'); ?> </address> <span class="date full-date"><abbr class="published" title="<?php the_time('Y-m-d\\TH:i:sO'); ?> "><?php the_date(); ?> </abbr></span> </div><!--/by-line--> <p class="comments-link"><?php comments_popup_link(__('No comments', 'carrington'), __('1 comment', 'carrington'), __('% comments', 'carrington')); ?> </p> <div id="post-comments-<?php
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { global $wpdb; $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; $authors = $wpdb->get_results($query); foreach ( $authors as $author ) { $author = get_userdata( $author->ID ); $posts = get_usernumposts($author->ID); $name = $author->nickname; if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) $name = "$author->first_name $author->last_name"; if ( !($posts == 0 && $hide_empty) ) echo "<li>"; if ( $posts == 0 ) { if ( !$hide_empty ) $link = $name; } else { $link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>'; if ( (! empty($feed_image)) || (! empty($feed)) ) { $link .= ' '; if (empty($feed_image)) $link .= '('; $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"'; if ( !empty($feed) ) { $title = ' title="' . $feed . '"'; $alt = ' alt="' . $feed . '"'; $name = $feed; $link .= $title; } $link .= '>'; if ( !empty($feed_image) ) $link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />'; else $link .= $name; $link .= '</a>'; if ( empty($feed_image) ) $link .= ')'; } if ( $optioncount ) $link .= ' ('. $posts . ')'; } if ( !($posts == 0 && $hide_empty) ) echo "$link</li>"; } }
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?> <div id="nav-above" class="navigation"> <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">«</span> Older posts', 'uthili' )) ?></div> <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</span>', 'uthili' )) ?></div> </div><!-- #nav-above --> <?php } ?> <?php while ( have_posts() ) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'uthili'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <div class="entry-meta"> <span class="meta-prep meta-prep-author"><?php _e('By ', 'uthili'); ?></span> <span class="author vcard"><a class="url fn n" href="<?php echo get_author_link( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'uthili' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span> <span class="meta-sep"> | </span> <span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'uthili'); ?></span> <span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time( get_option( 'date_format' ) ); ?></abbr></span> <?php edit_post_link( __( 'Edit', 'uthili' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ?> </div><!-- .entry-meta --> <div class="entry-summary"> <?php the_excerpt( __( 'Continue reading <span class="meta-nav">»</span>', 'uthili' ) ); ?> </div><!-- .entry-summary --> <div class="entry-utility"> <?php if ( $cats_meow = cats_meow(', ') ) : // Returns categories other than the one queried ?> <span class="cat-links"><?php printf( __( 'Also posted in %s', 'uthili' ), $cats_meow ) ?></span> <span class="meta-sep"> | </span> <?php endif ?>
/** * Compile various meta tags. */ function meta() { global $thesis; // Public blogs need to give robots a little direction. if (get_option('blog_public') != 0) { $current_page = get_query_var('paged'); // Should robots be allowed to index the content? if (is_page() || is_single()) { global $post; if (get_post_meta($post->ID, 'thesis_noindex', true)) { $meta['robots'] = '<meta name="robots" content="noindex, nofollow" />'; } } elseif (is_search() || is_404() || is_category() && $thesis['head']['noindex']['category'] || is_tag() && $thesis['head']['noindex']['tag'] || is_author() && $thesis['head']['noindex']['author'] || is_day() && $thesis['head']['noindex']['day'] || is_month() && $thesis['head']['noindex']['month'] || is_year() && $thesis['head']['noindex']['year'] || $current_page > 1) { $meta['robots'] = '<meta name="robots" content="noindex, nofollow" />'; } } // Canonical URL if (!function_exists('yoast_canonical_link') && $thesis['head']['canonical'] && !is_404()) { if (is_single() || is_page()) { global $post; $url = is_page() && get_option('show_on_front') == 'page' && get_option('page_on_front') == $post->ID ? trailingslashit(get_permalink()) : get_permalink(); } elseif (is_author()) { $author = get_userdata(get_query_var('author')); $url = get_author_link(false, $author->ID, $author->user_nicename); } elseif (is_category()) { $url = get_category_link(get_query_var('cat')); } elseif (is_tag()) { $tag = get_term_by('slug', get_query_var('tag'), 'post_tag'); if (!empty($tag->term_id)) { $url = get_tag_link($tag->term_id); } } elseif (is_day()) { $url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')); } elseif (is_month()) { $url = get_month_link(get_query_var('year'), get_query_var('monthnum')); } elseif (is_year()) { $url = get_year_link(get_query_var('year')); } elseif (is_home()) { $url = get_option('show_on_front') == 'page' ? trailingslashit(get_permalink(get_option('page_for_posts'))) : trailingslashit(get_option('home')); } $meta['canonical'] = '<link rel="canonical" href="' . $url . '" />'; } // Is All-in-One SEO installed? If so, defer to it for SEO meta handling. if (!class_exists('All_in_One_SEO_Pack')) { if (is_single() || is_page()) { global $post; $custom_description = get_post_meta($post->ID, 'thesis_description', true); $deprecated_custom_meta = get_post_meta($post->ID, thesis_get_custom_field_key('meta'), true); $excerpt = trim(strip_tags(wp_specialchars($post->post_excerpt))); $custom_keywords = get_post_meta($post->ID, 'thesis_keywords', true); $deprecated_custom_keywords = get_post_meta($post->ID, thesis_get_custom_field_key('keywords'), true); if (strlen($custom_description)) { $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($custom_description)))) . '" />'; } elseif (strlen($deprecated_custom_meta)) { $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($deprecated_custom_meta)))) . '" />'; } elseif (strlen($excerpt)) { $meta['description'] = '<meta name="description" content="' . $excerpt . '" />'; } if (strlen($custom_keywords)) { $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize(strip_tags(stripslashes($custom_keywords)))) . '" />'; } elseif (strlen($deprecated_custom_keywords)) { $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize(strip_tags(stripslashes($deprecated_custom_keywords)))) . '" />'; } else { $tags = thesis_get_post_tags($post->ID); if ($tags) { $meta['keywords'] = '<meta name="keywords" content="' . implode(', ', $tags) . '" />'; } } } elseif (is_category()) { $category_description = trim(strip_tags(stripslashes(category_description()))); $meta['description'] = strlen($category_description) ? '<meta name="description" content="' . $category_description . '" />' : '<meta name="description" content="' . single_cat_title('', false) . '" />'; } else { if ($thesis['home']['meta']['description']) { $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($thesis['home']['meta']['description'])))) . '" />'; } elseif (strlen(get_bloginfo('description'))) { $meta['description'] = '<meta name="description" content="' . get_bloginfo('description') . '" />'; } if ($thesis['home']['meta']['keywords']) { $meta['keywords'] = '<meta name="keywords" content="' . $thesis['home']['meta']['keywords'] . '" />'; } } } if ($thesis['head']['version']) { $meta['version'] = '<meta name="wp_theme" content="Thesis ' . thesis_get_theme_version() . '" />'; } if ($meta) { $this->meta = $meta; } }