function mod_placehere_gallery($text, $gallerystyle = "")
 {
     // find all image tags and put them in array images
     // $pattern = '/(<img)\s (src="([a-zA-Z0-9\.;:\/\?&=_|\r|\n]{1,})")/isxmU';
     $retval = "";
     $pattern = '<img[^<>]+>';
     preg_match_all($pattern, $text, $images);
     if (!is_array($images[0]) || empty($images[0])) {
         return $retval;
     }
     $imgs = $images[0];
     $cnt = count($imgs);
     switch ($gallerystyle) {
         case 'raw':
             for ($i = 0; $i < $cnt; $i++) {
                 $alt = $title = "";
                 $clean = modPlaceHereHTML::mod_placehere_xml_attribute_parse($images[0][$i]);
                 if (isset($clean['alt'])) {
                     $alt = $clean['alt'];
                 }
                 if (isset($clean['title'])) {
                     $alt = $clean['title'];
                 }
                 $retval .= '<img src="' . $clean["src"] . '" alt="' . $alt . '" title="' . $title . '" />';
             }
             break;
         case 'list':
         default:
             $retval = '<ul class="modplacehere_gallery">';
             for ($i = 0; $i < $cnt; $i++) {
                 $alt = $title = "";
                 $clean = modPlaceHereHTML::mod_placehere_xml_attribute_parse($images[0][$i]);
                 if (isset($clean['alt'])) {
                     $alt = $clean['alt'];
                 }
                 if (isset($clean['title'])) {
                     $alt = $clean['title'];
                 }
                 $retval .= '<li><img src="' . $clean["src"] . '" alt="' . $alt . '" title="' . $title . '" /></li>';
             }
             $retval .= '</ul>';
             break;
     }
     return $retval;
 }