[wp-trac] [WordPress Trac] #3300: Problems with get_archives_link()

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 29 08:55:51 GMT 2006


#3300: Problems with get_archives_link()
---------------------+------------------------------------------------------
 Reporter:  bipster  |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  normal   |   Milestone:           
Component:  General  |     Version:  2.0.4    
 Severity:  normal   |    Keywords:           
---------------------+------------------------------------------------------
 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";
 }

 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3300>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list