)*\s*\[simpleviewer\s*=\s*(\w+|^\+)(|,(\d+)|,)(|,(\d+))(|,\*(.*?)\*)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { // remove the comma $match[3] = ltrim($match[3],','); $match[5] = ltrim($match[5],','); $match[7] = ltrim($match[7],','); $replace = "[simpleviewer id=\"{$match[1]}\" width=\"{$match[3]}\" height=\"{$match[5]}\" link=\"{$match[7]}\"]"; $content = str_replace ($match[0], $replace, $content); } } } if ( stristr( $content, '[tiltviewer' )) { $search = "@(?:)*\s*\[tiltviewer\s*=\s*(\w+|^\+)(|,(\d+)|,)(|,(\d+))(|,\*(.*?)\*)*(|,\+(.*?)\+)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { // remove the comma $match[3] = ltrim($match[3],','); $match[5] = ltrim($match[5],','); $match[7] = ltrim($match[7],','); $match[9] = ltrim($match[9],','); $replace = "[tiltviewer id=\"{$match[1]}\" width=\"{$match[3]}\" height=\"{$match[5]}\" link=\"{$match[7]}\" flickrtags=\"{$match[9]}\"]"; $content = str_replace ($match[0], $replace, $content); } } } if ( stristr( $content, '[autoviewer' )) { $search = "@(?:)*\s*\[autoviewer\s*=\s*(\w+|^\+)(|,(\d+)|,)(|,(\d+))(|,\*(.*?)\*)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { // remove the comma $match[3] = ltrim($match[3],','); $match[5] = ltrim($match[5],','); $match[7] = ltrim($match[7],','); $replace = "[autoviewer id=\"{$match[1]}\" width=\"{$match[3]}\" height=\"{$match[5]}\" link=\"{$match[7]}\"]"; $content = str_replace ($match[0], $replace, $content); } } } if ( stristr( $content, '[pcviewer' )) { $search = "@(?:)*\s*\[pcviewer\s*=\s*(\w+|^\+)(|,(\d+)|,)(|,(\d+))(|,\*(.*?)\*)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { // remove the comma $match[3] = ltrim($match[3],','); $match[5] = ltrim($match[5],','); $match[7] = ltrim($match[7],','); $replace = "[pcviewer id=\"{$match[1]}\" width=\"{$match[3]}\" height=\"{$match[5]}\" link=\"{$match[7]}\"]"; $content = str_replace ($match[0], $replace, $content); } } } return $content; } function show_simpleviewer( $atts ) { global $wpdb; extract(shortcode_atts(array( 'id' => 0, 'width' => '', 'height' => '', 'link' => '', ), $atts )); $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$id' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$id' "); if( $galleryID ) $out = nggShowSimpleViewer($galleryID, $width, $height, $link); else $out = __('[Gallery not found]','nggallery'); return $out; } function show_tiltviewer( $atts ) { global $wpdb; extract(shortcode_atts(array( 'id' => 0, 'width' => '', 'height' => '', 'link' => '', 'flickrtags' => '', ), $atts )); if($id == "flickr") $galleryID = "flickr"; else $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$id' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$id' "); if( $galleryID ) $out = nggShowTiltViewer($galleryID, $width, $height, $link, $flickrtags); else $out = __('[Gallery not found]','nggallery'); return $out; } function show_autoviewer( $atts ) { global $wpdb; extract(shortcode_atts(array( 'id' => 0, 'width' => '', 'height' => '', 'link' => '' ), $atts )); $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$id' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$id' "); if( $galleryID ) $out = nggShowAutoViewer($galleryID, $width, $height, $link); else $out = __('[Gallery not found]','nggallery'); return $out; } function show_pcviewer( $atts ) { global $wpdb; extract(shortcode_atts(array( 'id' => 0, 'width' => '', 'height' => '', 'link' => '' ), $atts )); $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$id' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$id' "); if( $galleryID ) $out = nggShowPcViewer($galleryID, $width, $height, $link); else $out = __('[Gallery not found]','nggallery'); return $out; } } // let's use it $nggFlashShortcodes = new NextGENflash_shortcodes; ?>