1Jeremy Curry - The guy who made linknotes Author: Jeremy Curry Author URI: http://jeremycurry.com Add Linknotes to your posts. Simply Go :"Jeremy Curry(The guy who made linknotes)":http://jeremycurry.com and then a superscript will show up wherever you put that code, and at the bottom of your post, this will follow: 1Jeremy Curry - The guy who made linknotes ### Changes v0.2 - In superscript anchor tag, replaced the HREF attribute with actual link URI. Used JavaScript to re-write href to go to linknotes. Used to compensate when RSS agregators remove attributes - Added Title and description of Linknote to the Title attribute in the superscript Anchor. - Added a hyphen (-) to seperate the post number, and the number of the linknote in the ID's used to jump to and from the Linknotes - Wrapped Linknotes into a
tag with the CSS class alt */ $lnCfg['begin'] = '
Linknotes:
'; $lnCfg['end'] = '
'; $lnCfg['seperate'] = '
'; $lnCfg = (object) $lnCfg; class linknotes { var $hlgn; var $vlgn; var $clas; var $lnge; var $styl; var $cspn; var $rspn; var $a; var $s; var $c; var $pnct; function linknotes() { $this->hlgn = "(?:\<(?!>)|(?|\<\>|\=|[()]+)"; $this->vlgn = "[\-^~]"; $this->clas = "(?:\([^)]+\))"; $this->lnge = "(?:\[[^]]+\])"; $this->styl = "(?:\{[^}]+\})"; $this->cspn = "(?:\\\\\d+)"; $this->rspn = "(?:\/\d+)"; $this->a = "(?:{$this->hlgn}?{$this->vlgn}?|{$this->vlgn}?{$this->hlgn}?)"; $this->s = "(?:{$this->cspn}?{$this->rspn}?|{$this->rspn}?{$this->cspn}?)"; $this->c = "(?:{$this->clas}?{$this->styl}?{$this->lnge}?|{$this->styl}?{$this->lnge}?{$this->clas}?|{$this->lnge}?{$this->styl}?{$this->clas}?)"; $this->pnct = '[\!"#\$%&\'()\*\+,\-\./:;<=>\?@\[\\\]\^_`{\|}\~]'; } function linkify($text) { $text = preg_replace_callback('/ :([\s[{(]|[[:punct:]])? # $pre " # start (' . $this->c . ') # $atts ([^"]+) # $text \s? (?:\(([^)]+)\)(?="))? # $title ": (\S+\b) # $url (\/)? # $slash ([^\w\/;]*) # $post (?=\s|$) /Ux', array(&$this, "linkd"), $text); if ($this->are_links) { $linknotes = $this->begin; for ($i=1; $i <= $this->i; $i++) { $linknotes .= ''.$i.' '.$this->links[$i].$this->seperate; } $linknotes .= $this->end; $text = $text.$linknotes; } return $text; } function linkd($m) { $this->are_links = true; list(, $pre, $atts, $title, $text, $url, $slash, $post) = $m; if ($text) $text = ' - ' . $text; $this->i++; $this->links[$this->i] = $pre . '' . $title . '' . $text . $post; return "id.'-'.$this->i."'\" id=\"noted-$this->id-$this->i\" title=\"$title$text\">[$this->i]"; } function shelve($val) { $this->shelf[] = $val; return ' <' . count($this->shelf) . '>'; } } function linknotes( $string ) { global $lnCfg,$id; $ln = new linknotes; $ln->begin = $lnCfg->begin; $ln->end = $lnCfg->end; $ln->seperate = $lnCfg->seperate; $ln->id = $id; return $ln->linkify($string); //$string } add_filter('the_content', 'linknotes', 5);