Esempio n. 1
0
 function hasImages(&$wikitext)
 {
     if ($this->introOnly) {
         $text = WikiText::getIntro($wikitext);
         $firstImage = Wikitext::getFirstImageURL($text);
         $hasImages = !empty($firstImage) ? "Yes" : "No";
     } else {
         list($stepsText, ) = Wikitext::getStepsSection($wikitext, true);
         if ($stepsText) {
             // has steps section, so assume valid candidate for detailed title
             $num_steps = preg_match_all('/^#[^*]/im', $stepsText, $matches);
         }
         $num_photos = preg_match_all('/\\[\\[Image:/im', $wikitext, $matches);
         $hasImages = $num_photos > $num_steps / 2 ? "Yes" : "No";
     }
     return $hasImages;
 }