3 With a rel="NOFOLLOW" attribute on hyperlinks <a> tag, you'll prevent
4 additional page rank bonus and thus any interest for link spammers to
5 target your Wiki (see [doc/LinkSpammers]). This plugin is a bit more
6 clueful in only adding this flag to fresh/new links.
8 It looks up the (at least) two weeks older version of a page to make
9 a decision. That isn't all too slow actually, but you could use the
10 dumber variant "plugins/linking/a_nofollow" alternatively.
13 $ewiki_plugins["fromat_prepare_linking"][] = "ewiki_prepare_linking_find_old_links";
14 $ewiki_plugins["link_final"][] = "ewiki_linking_nofollow_flag_fresh_urls";
17 #-- searches links from older page version
18 function ewiki_prepare_linking_find_old_links(&$src) {
19 global $ewiki_config, $ewiki_id, $ewiki_data;
22 $ewiki_config["old_version_links"] = array();
23 $max_time = time() - 2*7 * 24*60*60;
24 if ($ewiki_data["lastmodified"] <= $max_time) {
28 #-- search version which is at least two weeks older
29 $version = $ewiki_data["version"] - 1;
30 while ($version > 1) {
31 $data = ewiki_db::GET($ewiki_id, $version-1);
32 if ($data && ($data["lastmodified"] <= $max_time)) {
37 $ewiki_config["old_version_links"] = explode("\n", trim($data["refs"]));
42 #-- adds NOFOLLOW attribute to "fresh" urls
43 function ewiki_linking_nofollow_flag_fresh_urls(&$str, $type, $href, $title, &$states) {
45 if (strpos($href, "://") && !in_array($href, $ewiki_config["old_version_links"])) {
46 $states["xhtml"]["rel"] = "NOFOLLOW , NOPAGERANK , NOCOUNT";