comparison models/extractapp.php @ 54:f9e7119339b2 extractapp

bug fixed: when addTagTitle, removing self-closing tag which causes error in coloring tag
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 30 Mar 2015 15:34:47 +0200
parents f9594c240826
children e930eb88b547
comparison
equal deleted inserted replaced
53:f9594c240826 54:f9e7119339b2
86 $this->lg_text = $lg_text; 86 $this->lg_text = $lg_text;
87 } 87 }
88 88
89 public function GetTextFromLocal($_id){ 89 public function GetTextFromLocal($_id){
90 $this->section_id = $_id; 90 $this->section_id = $_id;
91 $this->branch_id = 1; // local test sets branch_id to 1
91 $this->messages .= "DEBUG: from my local"."<br>"; 92 $this->messages .= "DEBUG: from my local"."<br>";
92 $this->lg_text = $this->GetSectionContent(); 93 $this->lg_text = $this->GetSectionContent();
93 94
94 } 95 }
95 96
401 if ($_postdata['text']){ 402 if ($_postdata['text']){
402 $date = date('Y_m_d_H_i_s', time()); 403 $date = date('Y_m_d_H_i_s', time());
403 if ( file_exists("data/parsing_files/".$_postdata['sectionId'].".txt") ) { 404 if ( file_exists("data/parsing_files/".$_postdata['sectionId'].".txt") ) {
404 $oldFile = file_get_contents("data/parsing_files/".$_postdata['sectionId'].".txt"); 405 $oldFile = file_get_contents("data/parsing_files/".$_postdata['sectionId'].".txt");
405 //saving in my local machine in developing phrase 406 //saving in my local machine in developing phrase
406 //file_put_contents("data/parsing_files/".$_postdata['sectionId']."_".$date.".txt", $oldFile); 407 file_put_contents("data/parsing_files/".$_postdata['sectionId']."_".$date.".txt", $oldFile);
407 } 408 }
408 409
409 if (get_magic_quotes_gpc()) { 410 if (get_magic_quotes_gpc()) {
410 $require = stripslashes($_postdata['text']); 411 $require = stripslashes($_postdata['text']);
411 } else { 412 } else {
412 $require = $_postdata['text']; 413 $require = $_postdata['text'];
413 } 414 }
414 415
416 echo "Debug: (full text before) ". $require;
417
415 $require = preg_replace("/【<a(.*?)>(.*?)<\/a>】/u", "【\\2】", $require); 418 $require = preg_replace("/【<a(.*?)>(.*?)<\/a>】/u", "【\\2】", $require);
416 $require = preg_replace('/&amp;/u', "&", $require); 419 $require = preg_replace('/&amp;/u', "&", $require);
417 $require = preg_replace("/○/u", " ", $require); 420 $require = preg_replace("/○/u", " ", $require);
418 $require = preg_replace("/<br>/u", "\n", $require); 421 $require = preg_replace("/<br>/u", "\n", $require);
419 //$require = preg_replace("/<br>/u", "\n", $require); 422 //$require = preg_replace("/<br>/u", "\n", $require);
423
424 echo "----------------------------------<br>";
425 echo "Debug: (full text after) ". $require;
420 426
421 if ($_postdata['branchId'] == 0) { 427 if ($_postdata['branchId'] == 0) {
422 // -- new branch case 428 // -- new branch case
423 $require = "<text_content>\n".$require."</text_content>\n"; 429 $require = "<text_content>\n".$require."</text_content>\n";
424 } 430 }
425 $require = $this->AppendMetaData($require); 431 $require = $this->AppendMetaData($require);
426 432
427 //saving in my local machine in developing phrase 433 //saving in my local machine in developing phrase
428 //file_put_contents("data/parsing_files/".$_postdata['sectionId'].".txt", $require); 434 file_put_contents("data/parsing_files/".$_postdata['sectionId'].".txt", $require);
429 } 435 }
430 436
431 // ------ 437 // ------
432 438
433 439
471 'Content-type: multipart/form-data;charset=utf-8' 477 'Content-type: multipart/form-data;charset=utf-8'
472 )); 478 ));
473 479
474 // execute the request 480 // execute the request
475 // **** commended to DEBUG *** 481 // **** commended to DEBUG ***
476 $output = curl_exec($ch); 482 //$output = curl_exec($ch);
477 // ***** 483 // *****
478 484
479 // output the profile information - includes the header 485 // output the profile information - includes the header
480 //echo($output) . PHP_EOL; 486 //echo($output) . PHP_EOL;
481 487
1241 $this->book_meta = $book_metaArray; 1247 $this->book_meta = $book_metaArray;
1242 } 1248 }
1243 1249
1244 // echo $taglist->name.", ".$taglist->tag."," .$taglist->color; 1250 // echo $taglist->name.", ".$taglist->tag."," .$taglist->color;
1245 // --- detect if the taglist set is up-to-date or not --- 1251 // --- detect if the taglist set is up-to-date or not ---
1246 $contentString = (string)$xml->text_content->asXML(); 1252
1253 $contentString = (string)($xml->text_content->asXML());
1247 //$removed_str = array("<text_content>","</text_content>"); 1254 //$removed_str = array("<text_content>","</text_content>");
1248 //$new_contentString = str_replace($removed_str, "", $contentString); 1255 //$new_contentString = str_replace($removed_str, "", $contentString);
1249 1256
1250 return $contentString; 1257 return $contentString;
1251 } 1258 }
1295 array_push($book_meta, array($row['id'],$row['name'],$row['author'],(string)$row['start_year'],(string)$row['line'])); 1302 array_push($book_meta, array($row['id'],$row['name'],$row['author'],(string)$row['start_year'],(string)$row['line']));
1296 // use 'start_year' as year, 'line' is pagenumber 1303 // use 'start_year' as year, 'line' is pagenumber
1297 } 1304 }
1298 1305
1299 $this->book_meta = $book_meta; 1306 $this->book_meta = $book_meta;
1300
1301 1307
1302 return $stringInput; 1308 return $stringInput;
1303 } 1309 }
1304 1310
1305 private function GetDataPath() { 1311 private function GetDataPath() {