Exemplo n.º 1
0
 /**
  * Get sitemap items from file
  *
  * @param string $file File Name
  */
 public static function getItems($file)
 {
     $items = array();
     if (file_exists($file)) {
         $xml = simplexml_load_file($file);
         Pandamp_Debug::manager($xml);
         foreach ($xml->url as $url) {
             $items[] = new Pandamp_Seo_Sitemap_Item((string) $url->loc, (string) $url->pubDate);
         }
     }
     return $items;
 }
Exemplo n.º 2
0
 public function invoiceAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->getHelper('viewRenderer')->setNoRender(TRUE);
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->fetchRow("kopel='00015'");
     $temptime = strtotime($rowUser->createdDate);
     //$temptime = time();
     $temptime = Pandamp_Lib_Formater::DateAdd('d', 5, $temptime);
     $rowInvoice = strftime('%Y-%m-%d', $temptime);
     Pandamp_Debug::manager($rowInvoice);
 }
Exemplo n.º 3
0
 public function docAction()
 {
     $this->_helper->layout->setLayout('layout-dms-uploader');
     //$this->_helper->layout->disableLayout();
     //$this->_helper->viewRenderer->setNoRender(TRUE);
     $request = $this->getRequest();
     // 		$source = ROOT_DIR . "/data/PP_NO_31_1995.DOC";
     // 		$source = ROOT_DIR . "/data/PERPRES_NO_77_2007.DOC";
     //\PhpOffice\PhpWord\Settings::loadConfig(CONFIG_PATH.'/phpword.ini');
     //$phpWord = \PhpOffice\PhpWord\IOFactory::load($source,"MsDoc");
     //echo $this->write($phpWord, basename(__FILE__, '.php'), ['HTML' => 'html']);
     // 		Pandamp_Debug::manager($this->read_doc($source));
     if ($request->isPost()) {
         $registry = Zend_Registry::getInstance();
         $files = $registry->get('files');
         $regType = ['peraturan pemerintah', 'peraturan presiden', 'undang-undang', 'peraturan menteri'];
         // 		$content = $this->parseWord($source);
         // 		$lines = file($source);
         // 		$text = strtolower($lines[1]);
         // 		$outtext = preg_replace("/[^a-zA-Z0-9\s\,\.\-\n\r\t@\/\_\(\)]/","",$text);
         // 		if ( file_exists($source) ) {
         $pdf = new PdfParser();
         $string = $pdf->parseFile($files['uploadedFile1']['tmp_name']);
         $outtext = preg_replace("/[^a-zA-Z0-9\\s\\,\\.\\-\n\r\t@\\/\\_\\(\\)]/", "", $string);
         Pandamp_Debug::manager($outtext);
         if (($fh = fopen($files['uploadedFile1']['tmp_name'], 'r')) !== false) {
             $headers = fread($fh, 0xa00);
             $n1 = ord($headers[0x21c]) - 1;
             $n2 = (ord($headers[0x21d]) - 8) * 256;
             $n3 = ord($headers[0x21e]) * 256 * 256;
             $n4 = ord($headers[0x21f]) * 256 * 256 * 256;
             $textLength = $n1 + $n2 + $n3 + $n4;
             $extracted_plaintext = fread($fh, $textLength);
             //echo nl2br($extracted_plaintext);die;
             $c = nl2br($extracted_plaintext);
             //print_r($this->extract_emails_from($extracted_plaintext));die;
             $fp = fopen("php://memory", 'r+');
             fputs($fp, $c);
             rewind($fp);
             while ($line = fgets($fp)) {
                 /*foreach(preg_split("/((\r?\n)|(\r\n?))/", $line) as $l){
                 		    echo $l."\n";die;
                 		}*/
                 $arr = preg_split("/((\r?\n)|(\r\n?))/", $line);
                 //Pandamp_Debug::manager($arr);
                 $result = array_filter($regType, create_function('$e', 'return strstr("' . strtolower($arr[0]) . '", $e);'));
                 if ($result) {
                     $txt = array_values($result);
                     $txt = ucwords($txt[0]) . "\n";
                 }
                 $txt .= $arr[1];
             }
             fclose($fp);
             $this->view->assign('test', $txt);
         }
         // 		}
     }
 }