diff 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
line wrap: on
line diff
--- a/models/extractapp.php	Thu Mar 26 17:25:46 2015 +0100
+++ b/models/extractapp.php	Mon Mar 30 15:34:47 2015 +0200
@@ -88,6 +88,7 @@
 
     public function GetTextFromLocal($_id){
         $this->section_id = $_id;
+        $this->branch_id = 1;   // local test sets branch_id to 1
         $this->messages .= "DEBUG: from my local"."<br>";
         $this->lg_text = $this->GetSectionContent();
 
@@ -403,7 +404,7 @@
             if ( file_exists("data/parsing_files/".$_postdata['sectionId'].".txt") ) {
                 $oldFile = file_get_contents("data/parsing_files/".$_postdata['sectionId'].".txt");
                 //saving in my local machine in developing phrase
-                //file_put_contents("data/parsing_files/".$_postdata['sectionId']."_".$date.".txt", $oldFile);
+                file_put_contents("data/parsing_files/".$_postdata['sectionId']."_".$date.".txt", $oldFile);
             }
             
             if (get_magic_quotes_gpc()) {
@@ -412,11 +413,16 @@
                 $require = $_postdata['text'];
             }
  
+            echo "Debug: (full text before) ". $require;
+
             $require = preg_replace("/【<a(.*?)>(.*?)<\/a>】/u", "【\\2】", $require);
             $require = preg_replace('/&amp;/u', "&", $require); 
             $require = preg_replace("/○/u", " ", $require); 
             $require = preg_replace("/<br>/u", "\n", $require);
             //$require = preg_replace("/<br>/u", "\n", $require);
+            
+            echo "----------------------------------<br>";
+            echo "Debug: (full text after) ". $require;
 
             if ($_postdata['branchId'] == 0) {
                 // -- new branch case
@@ -425,7 +431,7 @@
             $require = $this->AppendMetaData($require);
                 
             //saving in my local machine in developing phrase
-            //file_put_contents("data/parsing_files/".$_postdata['sectionId'].".txt", $require);
+            file_put_contents("data/parsing_files/".$_postdata['sectionId'].".txt", $require);
         } 
 
         // ------
@@ -473,7 +479,7 @@
 
         // execute the request
         // **** commended to DEBUG ***
-        $output = curl_exec($ch);
+        //$output = curl_exec($ch);
         // *****
 
         // output the profile information - includes the header
@@ -1243,7 +1249,8 @@
 
         // echo $taglist->name.", ".$taglist->tag."," .$taglist->color;
         // --- detect if the taglist set is up-to-date or not ---
-        $contentString = (string)$xml->text_content->asXML();
+
+        $contentString = (string)($xml->text_content->asXML());
         //$removed_str = array("<text_content>","</text_content>");
         //$new_contentString = str_replace($removed_str, "", $contentString);
 
@@ -1298,7 +1305,6 @@
 
         $this->book_meta = $book_meta;
 
-
         return $stringInput;
     }