Exemple #1
0
 /**
  * Return true if xml property is valid
  */
 protected function validateData()
 {
     if (isset($this->xml)) {
         return StructuredData::isValidYear((string) $this->xml->from_year) && StructuredData::isValidYear((string) $this->xml->to_year) && StructuredData::isValidUrl((string) $this->xml->url);
     }
     return true;
 }
Exemple #2
0
 /**
  * Return true if xml property is valid
  */
 protected function validateData(&$textbox1)
 {
     if (!StructuredData::isRedirect($textbox1)) {
         return StructuredData::isValidUrl((string) $this->xml->url);
     }
     return true;
 }
Exemple #3
0
 /**
  * Propagate move, delete, or undelete to other articles if necessary
  *
  * @param String $newTitleString null in case of delete; same as this title string in case of undelete
  * @param int $newNs 0 in case of delete; tame as this title namespace in case of undelete
  * @param String $text text of article
  * @param bool $textChanged set to true if we change the text
  * @return bool true if success
  */
 protected function propagateMoveDeleteUndelete($newTitleString, $newNs, &$text, &$textChanged)
 {
     if ($newNs == NS_REPOSITORY) {
         $repoText = "<repository>\n";
         if (isset($this->xml)) {
             foreach ($this->xml->place as $place) {
                 $repoText .= $this->addSingleLineFieldToXml($place, 'place');
                 break;
             }
             $url = '';
             foreach ($this->xml->repository as $repository) {
                 $url = (string) $repository['source_location'];
                 if (StructuredData::isValidUrl($url)) {
                     break;
                 } else {
                     $url = '';
                 }
             }
             if (!$url) {
                 $url = (string) $this->xml->url;
             }
             if ($url) {
                 $repoText .= $this->addSingleLineFieldToXml($url, 'url');
             }
         }
         $repoText .= "</repository>";
         $text = $repoText . preg_replace('$<source>.*?</source>$s', '', $text);
         $textChanged = true;
     }
     return true;
 }