/** * {@inheritdoc} */ public function process($elongate = false) { $return = parent::process(false); if (isset($return['type'])) { $return['uri'] = $return['type']; unset($return['type']); } if (isset($return['uri'])) { // http://example.com if (preg_match('/^https?:/i', $return['uri'])) { $return['uri_hint'] = 'url'; if (!isset($return['description'])) { $return['description'] = $return['uri']; } } elseif (preg_match('/[\\w\\._\\-\\+]+@[\\w\\._\\-\\+]+\\./i', $return['uri'])) { $return['uri_hint'] = 'mail'; if (!isset($return['description'])) { $return['description'] = $return['uri']; } } elseif (preg_match('/^(\\w*)((:|@)(\\/\\/)?)(.*)$/', $return['uri'], $m) && ($data = Services::get($m[1], $m[5]))) { $return['uri_hint'] = 'url'; $return['uri'] = $data['uri']; if (!isset($return['description'])) { $return['description'] = $data['long']; } } } return $return; }
/** * {@inheritdoc} */ public function process($elongate = false) { $content = $this->clean($this->tag->getContent()); $identifier = null; $uri = null; // Match: My Name <URI> preg_match_all('/([^<]*)?(<([^<]*)>)?/', $content, $matches); if (isset($matches[1])) { $identifier = $matches[1][0]; } if (isset($matches[3])) { $uri = $matches[3][0]; } $return = array(); $return['name'] = $this->tag->getName(); if ($uri) { $return['uri'] = $uri; $return['identifier'] = $return['uri']; // http://example.com if (preg_match('/^https?:/i', $return['uri'])) { $return['uri_hint'] = 'url'; } elseif (preg_match('/[\\w\\._\\-\\+]+@[\\w\\._\\-\\+]+\\./i', $return['uri'])) { $return['uri_hint'] = 'mail'; } elseif (preg_match('/^(\\w*)((:|@)(\\/\\/)?)(.*)$/', $return['uri'], $m) && ($data = Services::get($m[1], $m[5]))) { $return['uri_hint'] = 'service'; $return['uri'] = $data['uri']; if (!isset($return['description'])) { $return['description'] = $data['long']; } } } if ($identifier) { $return['identifier'] = trim($identifier); } return $return; }