Exemplo n.º 1
0
 /**
  * Test action
  *
  * @return void
  */
 public function testAction()
 {
     $str = "test  --------  test";
     $str = preg_replace("/\\s*[-\\s]+\\s*/", "_", $str);
     echo "<pre>";
     print_r($str);
     echo "</pre>";
     exit;
     //    	html_entity_decode();
     //  		$convert = Digitalus_Convert::removeAccent("Bùi Văn Tiến Đức");
     //		$objhtmlEntities 	= new Zend_Filter_HtmlEntities();
     $v = new Digitalus_Convert();
     $str = '<img align="left" style="" width="" height="" class="border_img" src="/media/image/images_2.jpeg" alt="" />';
     //		&lt;p&gt;&lt;img height=\&quot;150\&quot; width=\&quot;100\&quot; src=\&quot;/media/image/images_2.jpeg\&quot; alt=\&quot;\&quot; /&gt;&lt;/p&gt;
     //		&lt;p&gt;&lt;img height=\&quot;150\&quot; width=\&quot;100\&quot; src=\&quot;/media/image/images_2.jpeg\&quot; alt=\&quot;\&quot; /&gt;&lt;/p&gt;
     //		&lt;img align=&quot;left&quot; style=&quot;&quot; width=&quot;&quot; height=&quot;&quot; class=&quot;border_img&quot; src=&quot;/media/image/images_2.jpeg&quot; alt=&quot;&quot; /&gt;
     $ss = "&lt;p&gt;&lt;img height=\\&quot;150\\&quot; width=\\&quot;100\\&quot; src=\\&quot;/media/image/images_2.jpeg\\&quot; alt=\\&quot;\\&quot; /&gt;&lt;/p&gt;";
     // Nguyen goc
     print_r($str);
     // Luu vao database
     $str_1 = $v->scriptToData($str, 'editor');
     print_r($str_1);
     // Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
     //		$str = htmlentities($str);
     //		$str = $objhtmlEntities->filter($str);
     // Outputs: A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;
     //		echo htmlentities($str, ENT_QUOTES);
     // Script View
     print_r($v->dataToScriptView($str_1));
     echo "<br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
     print_r($v->dataToScriptEdit($ss, 'editor'));
     exit;
     if ($this->_request->isPost()) {
         $upload = new Digitalus_Resource_Image();
         $ext = Digitalus_Filesystem_File::getFileExtension($_FILES['file_field']['name']);
         $upload->uploadImage('file_field', time() . ".{$ext}", 'tam_tru');
         echo "<pre>";
         print_r($upload->fullPath);
         echo "</pre>";
         echo "<pre>";
         print_r($_FILES);
         echo "</pre>";
         exit;
     }
 }
Exemplo n.º 2
0
 public function viewDetailAction()
 {
     $this->_helper->layout()->disableLayout();
     // Disable for this action
     $this->_helper->viewRenderer->setNoRender();
     $id = $this->_request->getParam('id');
     $rowContent = $this->_objContents->find($id)->current();
     // Tra ve html chuan
     $html = Digitalus_Convert::changeDataToScriptEdit($rowContent->html, 'editor');
     $this->getResponse()->setBody($html);
 }
Exemplo n.º 3
0
 /**
  * strips the tags from each key in the text array
  * protected $_text = array('text_1','text_2');
  */
 private function _validateText()
 {
     //        $filter = new Zend_Filter_StripTags();
     $convert = new Digitalus_Convert();
     if (isset($this->_text)) {
         foreach ($this->_text as $t) {
             if (isset($this->_data[$t])) {
                 //                    $this->_data[$t] = $filter->filter($this->_data[$t]);
                 $this->_data[$t] = $convert->scriptToData($this->_data[$t]);
             }
         }
     }
 }