_xml; } /** * Singleton, return instance of class * * @access public * @return CreateLink * @static */ public static function getInstance() { if (self::$_instance == NULL) { self::$_instance = new CreateLink(); } return self::$_instance; } /** * Getter. Access to link var * * @access public * @return string */ public function getLink() { return $this->_link; } /** * Getter. Access to title var * * @access public * @return string */ public function getTitle() { return $this->_title; } /** * Getter. Access to font var * * @access public * @return string */ public function getFont() { return $this->_font; } /** * Create a link * * @access public * @param string $arrArgs[0] Text to add * @param string $arrArgs[1] URL to add * @param string $arrArgs[2] RFONTS */ public function createLink() { $this->_xml = ''; $args = func_get_args(); $this->generateP(); $this->generateR(); $this->generateFLDCHAR('begin'); $this->generateR(); $this->generateINSTRTEXT($args[1]); $this->generateR(); $this->generateFLDCHAR('separate'); $this->generatePROOFERR('gramStart'); $this->generateR(); $this->generateRPR(); $this->generateRFONTS($args[2]); $this->generateRSTYLE('Hipervnculo'); $this->generateT($args[0]); $this->generatePROOFERR('gramEnd'); $this->generateR(); $this->generateFLDCHAR('end'); } /** * Generate w:fldChar * * @access protected * @param string $fldCharType */ protected function generateFLDCHAR($fldCharType) { $strXML = '<' . CreateElement::NAMESPACEWORD . ':fldChar ' . CreateElement::NAMESPACEWORD . ':fldCharType="' . $fldCharType . '">'; $this->_xml = str_replace('__GENERATER__', $strXML, $this->_xml); } /** * Generate w:hyperlink * * @access protected * @param string $type */ protected function generateHYPERLINK($type) { $this->_xml = '<' . createElement::NAMESPACEWORD . ':hyperlink r:id="rId5" w:history="1">__GENERATEP__'; } /** * Generate w:instrText * * @access protected * @param string $link. Optional, use http://localhost as default */ protected function generateINSTRTEXT($link = 'http://localhost') { $xml = '<' . createElement::NAMESPACEWORD . ':instrText xml:space="preserve"> HYPERLINK "' . $link . '"'; $this->_xml = str_replace('__GENERATER__', $xml, $this->_xml); } /** * Generate w:proofErr * * @access protected * @param string $type */ protected function generatePROOFERR($type) { $xml = '<' . createElement::NAMESPACEWORD . ':proofErr ' . createElement::NAMESPACEWORD . ':type="' . $type . '">__GENERATERSUB__'; $this->_xml = str_replace('__GENERATERSUB__', $xml, $this->_xml); } /** * Generate w:r * * @access protected */ protected function generateR() { if (preg_match("/__GENERATEP__/", $this->_xml)) { $xml = '<' . createElement::NAMESPACEWORD . ':r>__GENERATER____GENERATERSUB__'; $this->_xml = str_replace('__GENERATEP__', $xml, $this->_xml); } elseif (preg_match("/__GENERATERSUB__/", $this->_xml)) { $xml = '<' . createElement::NAMESPACEWORD . ':r>' . '__GENERATER____GENERATERSUB__'; $this->_xml = str_replace('__GENERATERSUB__', $xml, $this->_xml); } else { $this->_xml = '<' . createElement::NAMESPACEWORD . ':r>__GENERATER____GENERATERSUB__'; } } /** * Generate w:rStyle * * @access protected * @param string $val */ protected function generateRSTYLE($val) { $xml = '<' . createElement::NAMESPACEWORD . ':rStyle ' . createElement::NAMESPACEWORD . ':val="' . $val . '">'; $this->_xml = str_replace('__GENERATERPR__', $xml, $this->_xml); } }