Added get_archives, tweaked comment_link.
git-svn-id: https://develop.svn.wordpress.org/trunk@24 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
13152d4f42
commit
50316978bf
@ -110,6 +110,89 @@ function single_month_title($prefix = '', $display = 1 ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_archives($type, $limit='') {
|
||||||
|
global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename, $querystring_start, $querystring_equal, $month;
|
||||||
|
// weekly and daily are *broken*
|
||||||
|
dbconnect();
|
||||||
|
if ('' != $limit) {
|
||||||
|
$limit = (int) $limit;
|
||||||
|
$limit= " LIMIT $limit";
|
||||||
|
}
|
||||||
|
// this is what will separate dates on weekly archive links
|
||||||
|
$archive_week_separator = '–';
|
||||||
|
|
||||||
|
|
||||||
|
// archive link url
|
||||||
|
$archive_link_m = $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal; # monthly archive
|
||||||
|
$archive_link_w = $siteurl.'/'.$blogfilename.$querystring_start.'w'.$querystring_equal; # weekly archive
|
||||||
|
$archive_link_p = $siteurl.'/'.$blogfilename.$querystring_start.'p'.$querystring_equal; # post-by-post archive
|
||||||
|
|
||||||
|
|
||||||
|
$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
|
||||||
|
|
||||||
|
if ($type == 'monthly') {
|
||||||
|
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||||
|
$querycount++;
|
||||||
|
$arc_result=mysql_query($arc_sql) or die($arc_sql.'<br />'.mysql_error());
|
||||||
|
while($arc_row = mysql_fetch_array($arc_result)) {
|
||||||
|
$arc_year = $arc_row['YEAR(post_date)'];
|
||||||
|
$arc_month = $arc_row['MONTH(post_date)'];
|
||||||
|
echo "<li><a href=\"$archive_link_m$arc_year".zeroise($arc_month,2).'">';
|
||||||
|
echo $month[zeroise($arc_month,2)].' '.$arc_year;
|
||||||
|
echo "</a></li>\n";
|
||||||
|
}
|
||||||
|
} elseif ($type == 'daily') {
|
||||||
|
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||||
|
$querycount++;
|
||||||
|
$arc_result=mysql_query($arc_sql) or die($arc_sql.'<br />'.mysql_error());
|
||||||
|
while($arc_row = mysql_fetch_array($arc_result)) {
|
||||||
|
$arc_year = $arc_row['YEAR(post_date)'];
|
||||||
|
$arc_month = $arc_row['MONTH(post_date)'];
|
||||||
|
$arc_dayofmonth = $arc_row['DAYOFMONTH(post_date)'];
|
||||||
|
echo "<li><a href=\"$archive_link_m$arc_year".zeroise($arc_month,2).zeroise($arc_dayofmonth,2).'">';
|
||||||
|
echo mysql2date($archive_day_date_format, $arc_year.'-'.zeroise($arc_month,2).'-'.zeroise($arc_dayofmonth,2).' 00:00:00');
|
||||||
|
echo "</a></li>\n";
|
||||||
|
}
|
||||||
|
} elseif ($type == 'weekly') {
|
||||||
|
if (!isset($start_of_week)) {
|
||||||
|
$start_of_week = 1;
|
||||||
|
}
|
||||||
|
$arc_sql = "SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date), WEEK(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||||
|
$querycount++;
|
||||||
|
$arc_result=mysql_query($arc_sql) or die($arc_sql.'<br />'.mysql_error());
|
||||||
|
$arc_w_last = '';
|
||||||
|
while($arc_row = mysql_fetch_array($arc_result)) {
|
||||||
|
$arc_year = $arc_row['YEAR(post_date)'];
|
||||||
|
$arc_w = $arc_row['WEEK(post_date)'];
|
||||||
|
if ($arc_w != $arc_w_last) {
|
||||||
|
$arc_w_last = $arc_w;
|
||||||
|
$arc_ymd = $arc_year.'-'.zeroise($arc_row['MONTH(post_date)'],2).'-' .zeroise($arc_row['DAYOFMONTH(post_date)'],2);
|
||||||
|
$arc_week = get_weekstartend($arc_ymd, $start_of_week);
|
||||||
|
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
|
||||||
|
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
|
||||||
|
echo "<li><a href=\"$siteurl/".$blogfilename."?m=$arc_year&w=$arc_w\">";
|
||||||
|
echo $arc_week_start.$archive_week_separator.$arc_week_end;
|
||||||
|
echo "</a></li>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($type == 'postbypost') {
|
||||||
|
$requestarc = " SELECT ID,post_date,post_title FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||||
|
$querycount++;
|
||||||
|
$resultarc = mysql_query($requestarc);
|
||||||
|
while($row=mysql_fetch_object($resultarc)) {
|
||||||
|
if ($row->post_date != '0000-00-00 00:00:00') {
|
||||||
|
echo "<li><a href=\"$archive_link_p".$row->ID.'">';
|
||||||
|
$arc_title = stripslashes($row->post_title);
|
||||||
|
if ($arc_title) {
|
||||||
|
echo strip_tags($arc_title);
|
||||||
|
} else {
|
||||||
|
echo $row->ID;
|
||||||
|
}
|
||||||
|
echo "</a></li>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/***** // About-the-blog tags *****/
|
/***** // About-the-blog tags *****/
|
||||||
|
|
||||||
|
|
||||||
@ -870,12 +953,13 @@ function comments_number($zero='no comment', $one='1 comment', $more='% comments
|
|||||||
echo $blah;
|
echo $blah;
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_link($file='') {
|
function comments_link($file='',$echo=true) {
|
||||||
global $id,$pagenow;
|
global $id,$pagenow;
|
||||||
global $querystring_start, $querystring_equal, $querystring_separator;
|
global $querystring_start, $querystring_equal, $querystring_separator;
|
||||||
if ($file == '') $file = $pagenow;
|
if ($file == '') $file = $pagenow;
|
||||||
if ($file == '/') $file = '';
|
if ($file == '/') $file = '';
|
||||||
echo $file.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1#comments';
|
if (!$echo) return $file.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1#comments';
|
||||||
|
else echo $file.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1#comments';
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_popup_script($width=400, $height=400, $file='b2commentspopup.php', $trackbackfile='b2trackbackpopup.php', $pingbackfile='b2pingbackspopup.php') {
|
function comments_popup_script($width=400, $height=400, $file='b2commentspopup.php', $trackbackfile='b2trackbackpopup.php', $pingbackfile='b2pingbackspopup.php') {
|
||||||
|
Loading…
Reference in New Issue
Block a user