Example #1
0
 private function updateImageContent($tag, $oldTitle, $newTitle, &$pd, &$text)
 {
     if ($newTitle) {
         if ($tag == 'person') {
             $new = Person::getPropagatedElement($tag, $newTitle, $pd);
         } else {
             // family
             $new = Family::getPropagatedElement($tag, $newTitle, $pd);
         }
     } else {
         $new = '';
     }
     $old = "<{$tag}[^>]*? title=\"" . StructuredData::protectRegexSearch(StructuredData::escapeXml($oldTitle)) . "\".*?/>\n";
     if (!preg_match('$' . $old . '$', $text)) {
         $old = "</image_data>";
         $new .= $old;
     }
     $result = preg_replace('$' . $old . '$', StructuredData::protectRegexReplace($new), $text);
     // if nothing changed, return empty string
     if ($result == $text) {
         $result = '';
     }
     return $result;
 }
Example #2
0
 public static function updateFamilyLink($tag, $oldTitle, $newTitle, &$text, &$textChanged)
 {
     if ($newTitle) {
         $new = Family::getPropagatedElement($tag, $newTitle, $pd);
     } else {
         $new = '';
     }
     $old = "<{$tag} title=\"" . StructuredData::protectRegexSearch(StructuredData::escapeXml($oldTitle)) . "\"/>\n";
     if (!preg_match('$' . $old . '$', $text)) {
         $old = ESINHandler::findRelationshipInsertionPointTag($tag, $text);
         $new .= $old;
     }
     $result = preg_replace('$' . $old . '$', StructuredData::protectRegexReplace($new), $text, 1);
     if ($result != $text) {
         $text = $result;
         $textChanged = true;
     }
 }