/** * Create OpenDocument_Hyperlink instance * * @param mixed $object * @param mixed $content * @param string $location * @param string $type optional * @param string $target optional * @param string $name optional * @return OpenDocument_Hyperlink */ public static function instance($object, $content, $location, $type = 'simple', $target = '', $name = '') { if ($object instanceof OpenDocument) { $document = $object; $node = $object->cursor; } else { if ($object instanceof OpenDocument_Element) { $document = $object->getDocument(); $node = $object->getNode(); } else { throw new Exception('Object must be OpenDocument or OpenDocument_Element'); } } $element = new OpenDocument_Hyperlink($node->ownerDocument->createElementNS(self::nodeNS, self::nodeName), $document); $node->appendChild($element->node); $element->__set('location', $location); $element->__set('type', $type); $element->__set('target', $target); $element->__set('name', $name); if (is_scalar($content)) { $element->createTextElement($content); } return $element; }
/** * Create OpenDocument_Hyperlink * * @param string $text * @param string $location * @param string $type optional * @param string $target optional * @param string $name optional * @return OpenDocument_Hyperlink */ public function createHyperlink($text, $location, $type = 'simple', $target = '', $name = '') { return OpenDocument_Hyperlink::instance($this, $text, $location, $type, $target, $name); }