moodle_url MDL-20674 Added a method to allow the dev to set the anchor attribute of a moodle_url

This commit is contained in:
Sam Hemelryk 2009-10-30 06:20:59 +00:00
parent 7e0b616a4a
commit 13b0b27172

View File

@ -548,6 +548,17 @@ class moodle_url {
return true;
}
/**
* Sets the anchor for the URI (the bit after the hash)
* @param string $anchor
*/
public function set_anchor($anchor) {
// Match the anchor against the NMTOKEN spec
if (preg_match('#[a-zA-Z\_\:][a-zA-Z0-9\_\-\.\:]*#', $anchor)) {
$this->fragment = $anchor;
}
}
}
/**