nickname) <= mb_strlen($match[0]) ? $mentioned->nickname : $match[0]; } if($mentioned instanceof Profile) { $matches[$match[1]] = array('mentioned' => array($mentioned), 'type' => 'mention', 'text' => $text, 'position' => $match[1], 'length' => mb_strlen($match[0]), 'url' => $mentioned->profileurl); } } foreach ($mentions as $i => $other) { // If we share a common prefix with a local user, override it! $pos = $other['position']; if (isset($matches[$pos])) { $mentions[$i] = $matches[$pos]; unset($matches[$pos]); } } foreach ($matches as $mention) { $mentions[] = $mention; } return true; } public function onStartGetProfileFromURI($uri, &$profile) { $mention_profile = Mention_url_profile::getKV('profileurl', $uri); if($mention_profile instanceof Mention_url_profile) { $profile = $mention_profile->getProfile(); return !($profile instanceof Profile); } return true; } public function onCheckSchema() { $schema = Schema::get(); $schema->ensureTable('mention_url_profile', Mention_url_profile::schemaDef()); return true; } public function onPluginVersion(array &$versions) { $versions[] = array('name' => 'MentionURL', 'version' => self::PLUGIN_VERSION, 'author' => 'Stephen Paul Weber', 'homepage' => 'http://gnu.io/', 'description' => // TRANS: Plugin description. _m('Plugin to allow mentioning arbitrary URLs.')); return true; } }