All pastes #166175 Raw Edit

Stuff

public text v1 · immutable
·published 2006-09-10 17:09 UTC
rendered paste body
function amword_links($links, $delimiter = ' | ') {
if (!is_array($links)) {
return '';
}

/* Maps a link to it's associated class */
$link_to_id = array(
t('HOME') => 'home',
t('OPINIONS & EDITORIALS') => 'oped',
t('LIFESTYLE & ENTERTAINMENT') => 'life-ent',
t('SPORTS') => 'sports',
t('read more') => 'read-more',
t('add new comment') => 'comment',
t('printer friendly version') => 'print',
t('email this page') => 'email',
t('delete') => 'delete',
t('edit') => 'edit',
t('reply') => 'reply',
t('calendar') => 'calendar',
);

$new_links = array();

foreach ($links as $link) {
foreach ($link_to_id as $text => $id) {
if (strpos($link, $text)) {
$link = str_replace('<a ', "<a class=\"icon-$id\" ", $link);
}
}
$new_links[] = $link;
}

return implode($delimiter, $new_links);
}
?>