Make WordPress Core

Opened 18 years ago

Closed 17 years ago

Last modified 7 months ago

#3300 closed defect (bug) (wontfix)

Problems with get_archives_link()

Reported by: bipster's profile bipster Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0.4
Component: Template Keywords:
Focuses: Cc:

Description

Some anchor rewriting plugins (like Click Counter, http://frenchfragfactory.net/ozh/archives/2004/09/17/click-counter-plugin-for-wordpress/ ) are having problems with the following function found in the wp-includes/template-functions-general.php script:

/* link navigation hack by Orien http://icecode.com/ */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
	$text = wptexturize($text);
	$title_text = wp_specialchars($text, 1);

	if ('link' == $format)
		return "\t<link rel='archives' title='$title_text' href='$url' />\n";
	elseif ('option' == $format)
		return "\t<option value='$url'>$before $text $after</option>\n";
	elseif ('html' == $format)
		return "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
	else // custom
		return "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
}

Could you replace double quotes with single quotes and viceversa in the "return" statements like in the rest of the script ?

Correct code:

/* link navigation hack by Orien http://icecode.com/ */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
	$text = wptexturize($text);
	$title_text = wp_specialchars($text, 1);

	if ('link' == $format)
		return "\t".'<link rel="archives" title="'.$title_text.' href="'.$url.'" />'."\n";
	elseif ('option' == $format)
		return "\t".'<option value="'.$url.'">'.$before.' '.$text.' '.$after.'</option>'."\n";
	elseif ('html' == $format)
		return "\t".'<li>'.$before.'<a href="'.$url.'" title="'.$title_text.'">'.$text.'</a>'.$after.'</li>'."\n";
	else // custom
		return "\t".$before.'<a href="'.$url.'" title="'.$title_text.'">'.$text.'</a>'.$after."\n";
}

Change History (6)

#1 @Viper007Bond
18 years ago

I use that plugin on my site and I don't seem to be having any problems...

#2 @bipster
18 years ago

If I use the KG Archives plugin http://www.katesgasis.com/2005/05/01/kg-archives-plugin/, which calls the get_archives_link() function, all links in the Archive section break when the Click Counter plugin is active. With my proposed code, they don't.

#3 @Nazgul
17 years ago

  • Milestone set to 2.4 (future)

#4 @santosj
17 years ago

  • Component changed from General to Template

#5 @pishmishy
17 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Closing as won't fix. I doubt the code will be fixed for one person having a problem with one plugin. Sorry. If others have this problem please ask them to reopen and weigh in here.

#6 @lloydbudd
17 years ago

  • Milestone 2.5 deleted
Note: See TracTickets for help on using tickets.