array( 'name' => 'region', 'type' => 'list', 'exampleValue' => 'Nürnberg', 'title' => 'Select a region', 'values' => array( 'Nürnberg' => 'nuernberg', 'Fürth' => 'fuerth', 'Altdorf' => 'altdorf', 'Ansbach' => 'ansbach', 'Bad Windsheim' => 'bad-windsheim', 'Bamberg' => 'bamberg', 'Dinkelsbühl/Feuchtwangen' => 'dinkelsbuehl-feuchtwangen', 'Feucht' => 'feucht', 'Forchheim' => 'forchheim', 'Gunzenhausen' => 'gunzenhausen', 'Hersbruck' => 'hersbruck', 'Herzogenaurach' => 'herzogenaurach', 'Hilpoltstein' => 'hilpoltstein', 'Höchstadt' => 'hoechstadt', 'Lauf' => 'lauf', 'Neumarkt' => 'neumarkt', 'Neustadt/Aisch' => 'neustadt-aisch', 'Pegnitz' => 'pegnitz', 'Roth' => 'roth', 'Rothenburg o.d.T.' => 'rothenburg-o-d-t', 'Schwabach' => 'schwabach', 'Treuchtlingen' => 'treuchtlingen', 'Weißenburg' => 'weissenburg' ) ), 'policeReports' => array( 'name' => 'Police Reports', 'type' => 'checkbox', 'exampleValue' => 'checked', 'title' => 'Read Police Reports', ) )); private function getImageUrlFromScript($script) { preg_match( "#src=\\\\'(https:[-:\\.\\\\/a-zA-Z0-9%_]*\\.(jpg|JPG|jpeg))#", $script->innertext, $matches, PREG_OFFSET_CAPTURE ); if(isset($matches[1][0])) { return stripcslashes($matches[1][0]) . '?w=800'; } return null; } private function handleArticle($link) { $item = array(); $article = getSimpleHTMLDOM($link); $content = $article->find('div[class*=article-content]', 0); if(is_null($content)) { // If content is null its most likely a slideshow. // we do not support slideshows right now as I (theScrabi) // think there is to little informational value in these // to actually add support to them. return; } $item['uri'] = $link; $item['title'] = $article->find('h1', 0)->innertext; $item['content'] = ''; //first get image from block/modul $figure = $article->find('figure[class*=panorama]', 0); if($figure !== null) { $imgUrl = self::getImageUrlFromScript($figure->find('script', 0)); if($imgUrl === null) { $imgUrl = self::getImageUrlFromScript($figure->find('script', 1)); } $item['content'] .= ''; } // get regular paragraphs foreach($content->children() as $child) { if($child->tag === 'p') { $item['content'] .= $child; } } //get image divs foreach($content->find('div[class*=article-slideshow]') as $slides) { foreach($slides->children() as $child) { switch($child->tag) { case 'p': $item['content'] .= $child; break; case 'h5': $item['content'] .= '