Example #1
0
 /**
  * Типографирование текста
  *
  * @param 	mixed $tofs строка или массив из названий тофов, которые будут применены при типографирование текста
  * @throws 	Jare_Typograph_Exception
  * @return 	string
  */
 public function parse($tofs)
 {
     if (is_string($tofs)) {
         $tofs = array($tofs);
     }
     if (!is_array($tofs)) {
         require_once 'Jare/Typograph/Exception.php';
         throw new Jare_Typograph_Exception('Incorrect type of tof-variable - try set array or string');
     }
     if (!count($tofs)) {
         require_once 'Jare/Typograph/Exception.php';
         throw new Jare_Typograph_Exception('You must set 1 or more tofs; your array is empty!');
     }
     require_once 'Jare/Typograph/Tool.php';
     Jare_Typograph_Tool::addCustomBlocks('<pre>', '</pre>');
     Jare_Typograph_Tool::addCustomBlocks('<script>', '</script>');
     Jare_Typograph_Tool::addCustomBlocks('<style>', '</style>');
     $this->_text = Jare_Typograph_Tool::safeCustomBlocks($this->_text, true);
     $this->_text = Jare_Typograph_Tool::safeTagChars($this->_text, true);
     $this->_text = Jare_Typograph_Tool::clearSpecialChars($this->_text, Jare_Typograph_Tool::CLEAR_MODE_UTF8_NATIVE | Jare_Typograph_Tool::CLEAR_MODE_HTML_MATTER);
     foreach ($tofs as $tofName) {
         $this->getTof($tofName)->parse();
     }
     $this->_text = Jare_Typograph_Tool::safeTagChars($this->_text, false);
     $this->_text = Jare_Typograph_Tool::safeCustomBlocks($this->_text, false);
     return $this->_text;
 }
Example #2
0
 /**
  * Создание защищенного тега с содержимым
  *
  * @see 	Jare_Typograph_Tool::buildSafeTag
  * @param 	string $content
  * @param 	string $tag
  * @param 	array $attribute
  * @return 	string
  */
 protected function _buildTag($content, $tag = 'span', $attribute = array())
 {
     require_once 'Jare/Typograph/Tool.php';
     $html = Jare_Typograph_Tool::buildSafedTag($content, $tag, $attribute);
     return $html;
 }