Exemplo n.º 1
0
/**
 * Callback function for converting notes to HTML output
 */
function renderImageData($input, $argv, $parser)
{
    $image = new Fotonotes($parser->getTitle());
    return $image->renderImageNotes($input);
}
Exemplo n.º 2
0
 /**
  * Create wiki text from xml property
  */
 protected function toWikiText($parser)
 {
     $result = '';
     if (isset($this->xml)) {
         //			$result = "<div class=\"infobox-header\">Image Information</div>\n{|\n";
         //			$date = (string)$this->xml->date;
         //			$hideTopBorder = false;
         //			if ($date) {
         //				$result .= $this->addValueToTableDL('Date', $date);
         //				$hideTopBorder = true;
         //			}
         //		   $place = (string)$this->xml->place;
         //		   if ($place) {
         //   			$result .= $this->addValueToTableDL('Place', "[[Place:$place]]", $hideTopBorder);
         //				$hideTopBorder = true;
         //		   }
         //         $result .= $this->addValuesToTableDL('People', $this->xml->person, 'formatPerson', null, $hideTopBorder);
         //			$hideTopBorder = $hideTopBorder || isset($this->xml->person[0]);
         //         $result .= $this->addValuesToTableDL('Families', $this->xml->family, 'formatFamily', null, $hideTopBorder);
         //			$hideTopBorder = $hideTopBorder || isset($this->xml->family[0]);
         //			if ((string)$this->xml->copyright_holder) {
         //			   $result .= $this->addValueToTableDL('Copyright holder', (string)$this->xml->copyright_holder, $hideTopBorder);
         //			}
         //			$license = (string)$this->xml->license;
         //			if ($license) {
         //			   $license = "{{".$license."}}";
         //			}
         //			else {
         //			   $license = "<font color=red>None selected</font>";
         //			}
         //			$result .= $this->addValueToTableDL('License', $license, true);
         //			$result .= $this->showWatchers();
         //   		$result .= "|}\n";
         // clear left
         //			$result .= "<div class=\"visualClearLeft\"></div>";
         $date = $this->getLV("Date", $this->xml->date);
         $place = $this->getLV("Place", $this->xml->place, 'Place');
         $people = $this->getLV("People", $this->xml->person, 'Person');
         $families = $this->getLV("Families", $this->xml->family, 'Family');
         $copyrightHolder = $this->getLV("Copyright holder", $this->xml->copyright_holder);
         $result = "<div class=\"wr-infobox wr-infobox-imagepage\"><div class=\"wr-infobox-heading\">Image Information</div><dl>{$date}{$place}{$people}{$families}{$copyrightHolder}</dl></div>";
         // add fotonotes
         $fn = new Fotonotes($this->title);
         $result .= $fn->renderImageNotes($this->xml->note);
         // add categories
         $places = array();
         $places[] = (string) $this->xml->place;
         $surnames = array();
         foreach ($this->xml->person as $person) {
             $surnames[] = (string) $person['surname'];
         }
         foreach ($this->xml->family as $family) {
             $matches = array();
             if (preg_match('/.*?([^ ]+) +and .*?([^ ]+) +\\(\\d+\\)$/', (string) $family['title'], $matches)) {
                 if ($matches[1] != 'Unknown') {
                     $surnames[] = $matches[1];
                 }
                 if ($matches[2] != 'Unknown') {
                     $surnames[] = $matches[2];
                 }
             }
         }
         $result .= StructuredData::addCategories($surnames, $places);
         // Add license category(ies) as whatever is in between comments
         // This is pretty ugly because we add the entire template again in ImagePage, but there it's added to late
         // at that stage for the parser to add this page to categories
         $license = (string) $this->xml->license;
         if ($license) {
             $licenseTitle = Title::makeTitleSafe(NS_TEMPLATE, $license);
             if ($licenseTitle) {
                 $licenseRevision = Revision::newFromTitle($licenseTitle);
                 if ($licenseRevision) {
                     $licenseText =& $licenseRevision->getText();
                     $matches = array();
                     if (preg_match('#<!--(.*?)-->#', $licenseText, $matches)) {
                         $result .= $matches[1];
                     }
                 }
             }
         }
     } else {
         // clear left
         //			$result .= "<div class=\"visualClearLeft\"></div>";
     }
     return $result;
 }