= 0 && strpos($haystack, $needle, $temp) !== FALSE);
}
public static function imagesInFolder($pdo) {
if (is_null($pdo)) {
$pdo = DbUtils::openDbAndReturnPdo();
}
$files = scandir("restaurantbilder");
$images = array();
foreach($files as $aFile) {
if (self::endsWith(strtolower($aFile), ".jpg")
||
self::endsWith(strtolower($aFile), ".png")
||
self::endsWith(strtolower($aFile), ".gif")
) {
$fileWithoutExtension = substr($aFile, 0, strlen($aFile) - 4);
if (file_exists("restaurantbilder/" . $fileWithoutExtension . ".txt")) {
$images[] = array("image" => $aFile, "description" => $fileWithoutExtension . ".txt");
} else if ("restaurantbilder/" . file_exists($fileWithoutExtension . ".TXT")) {
$images[] = array("image" => $aFile, "description" => $fileWithoutExtension . ".TXT");
} else {
$images[] = array("image" => $aFile, "description" => null);
}
}
}
return $images;
}
public static function getPageLayout($images,$prevImg,$imgno,$nextImg) {
$html = '
'; $html .= ' | ';
if (!is_null($images[$imgno]["description"])) {
$txt = file_get_contents("restaurantbilder/" . $images[$imgno]["description"]);
$txt = str_replace("\n"," ",$txt); $html .= $txt . ' '; } $html .= ''; $html .= ' | '; $html .= ' |