Airtight Interactive for NextGEN Gallery. Initial Plugin by Alex Rabe, who did the bulk of the work. Find more information on the original plugin here. Go to Gallery->FlashViewer to change the options. Author: Boris Glumpler Author URI: http://travel-junkie.com/ Version: 1.1b Copyright 2008 by Alex Rabe & Airtight Interactive & Boris Glumpler This script is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **************************************************************************** **************************************************************************** SimpleViewer/TiltViewer/Autoviewer may be used in any kinds of personal and/or commercial projects. Please ensure that the SimpleViewer/TiltViewer/Autoviewer download link in the bottom right corner is clearly visible. SimpleViewer/TiltViewer may not be redistributed or resold to other companies or third parties. Specifically, SimpleViewer/TiltViewer/Autoviewer may not be redistributed as part of a content management system or online hosting solution See more at http://www.airtightinteractive.com/ */ //################################################################# // Stop direct call if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(__('You are not allowed to call this page directly.', 'nggflash')); } //################################################################# // Let's Go // Pre-2.6 compatibility if ( !defined('WP_CONTENT_URL') ) define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // define URL define('NGGFLASHVIEWER_URLPATH', WP_CONTENT_URL.'/plugins/'.plugin_basename( dirname(__FILE__)).'/' ); // look for SimpleViewer define('SIMPLEVIEWER_EXIST', file_exists (dirname (__FILE__).'/flash/viewer.swf')); // look for TiltViewer define('TILTVIEWER_EXIST', file_exists (dirname (__FILE__).'/flash/TiltViewer.swf')); // look for AutoViewer define('AUTOVIEWER_EXIST', file_exists (dirname (__FILE__).'/flash/autoviewer.swf')); // look for PostcardViewer define('PCVIEWER_EXIST', file_exists (dirname (__FILE__).'/flash/pcviewer.swf')); //Create Text Domain For Translations function nggflash_textdomain() { if (function_exists('load_plugin_textdomain')) { load_plugin_textdomain('nggflash','wp-content/plugins/'.dirname(plugin_basename(__FILE__)).'/langs'); } } // Check for NextGEN Gallery function checkNGGallery() { if (!class_exists('nggallery') ) { add_action('admin_notices', create_function('', 'echo \'
' . __('Sorry, NextGEN FlashViewer works only in combination with NextGEN Gallery.','nggflash') . '
)*\s*\[simpleviewer\s*=\s*(\w+|^\+)(|,(\d+))(|,(\d+))(|,\*(.*?)\*)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches)) { if (is_array($matches)) { foreach ($matches[1] as $key =>$match) { // check for gallery id $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$match' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$match' "); if($galleryID) { $search = $matches[0][$key]; // get the size if they are set and the link if used $width = $matches[3][$key]; $height = $matches[5][$key]; $link = $matches[7][$key]; if (SIMPLEVIEWER_EXIST) $replace = nggShowSimpleViewer($galleryID,$width,$height,$link); else $replace ="[".__('viewer.swf not found','nggflash')."]"; $content= str_replace ($search, $replace, $content); } } } }// end slideshow } if ( stristr( $content, '[tiltviewer' )) { $search = "@(?:)*\s*\[tiltviewer\s*=\s*(\w+|^\+)(|,(\d+))(|,(\d+))(|,\*(.*?)\*)*(|,\+(.*?)\+)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches)) { if (is_array($matches)) { foreach ($matches[1] as $key =>$match) { // check for gallery id if($match == "flickr") $galleryID = "flickr"; else $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$match' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$match' "); if($galleryID) { $search = $matches[0][$key]; // get the size if they are set and the link if used $width = $matches[3][$key]; $height = $matches[5][$key]; $link = $matches[7][$key]; $flickrtags = $matches[9][$key]; if (TILTVIEWER_EXIST) $replace= nggShowTiltViewer($galleryID,$width,$height,$link,$flickrtags); else $replace ="[".__('TiltViewer.swf not found','nggflash')."]"; $content= str_replace ($search, $replace, $content); } } } }// end slideshow } if ( stristr( $content, '[autoviewer' )) { $search = "@(?:)*\s*\[autoviewer\s*=\s*(\w+|^\+)(|,(\d+))(|,(\d+))(|,\*(.*?)\*)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches)) { if (is_array($matches)) { foreach ($matches[1] as $key =>$match) { // check for gallery id $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$match' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$match' "); if($galleryID) { $search = $matches[0][$key]; // get the size if they are set and the link if used $width = $matches[3][$key]; $height = $matches[5][$key]; $link = $matches[7][$key]; if (AUTOVIEWER_EXIST) $replace= nggShowAutoViewer($galleryID,$width,$height,$link); else $replace ="[".__('autoviewer.swf not found','nggflash')."]"; $content= str_replace ($search, $replace, $content); } } } }// end slideshow } if ( stristr( $content, '[pcviewer' )) { $search = "@(?:)*\s*\[pcviewer\s*=\s*(\w+|^\+)(|,(\d+))(|,(\d+))(|,\*(.*?)\*)\]\s*(?:
)*@i"; if (preg_match_all($search, $content, $matches)) { if (is_array($matches)) { foreach ($matches[1] as $key =>$match) { // check for gallery id $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$match' "); if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$match' "); if($galleryID) { $search = $matches[0][$key]; // get the size if they are set and the link if used $width = $matches[3][$key]; $height = $matches[5][$key]; $link = $matches[7][$key]; if (PCVIEWER_EXIST) $replace= nggShowPcViewer($galleryID,$width,$height,$link); else $replace ="[".__('pcviewer.swf not found','nggflash')."]"; $content= str_replace ($search, $replace, $content); } } } }// end slideshow } return $content; } function nggShowSimpleViewer($galleryID,$irWidth,$irHeight, $link = false) { global $wpdb; $ngg_options = get_option('ngg_options'); $ngg_fv_options = get_option('ngg_fv_options'); $obj = 'so'.$galleryID; if (empty($irWidth) ) $irWidth = (int) $ngg_options['irWidth']; if (empty($irHeight)) $irHeight = (int) $ngg_options['irHeight']; if ($ngg_fv_options['ngg_fv_effects'] == "highslide" && !empty($link)) { } else { require_once (dirname (__FILE__).'/lib/swfobject.php'); // init the flash output $swfobject = new swfobject( NGGFLASHVIEWER_URLPATH.'flash/viewer.swf', $obj, $irWidth, $irHeight, '7.0.0', 'false'); // adding the flash parameter $swfobject->classname = 'simpleviewer'; $swfobject->message = ''. __('The Flash Player and a browser with Javascript support are needed..', 'nggallery').'
'; $swfobject->add_params('wmode', 'opaque'); $swfobject->add_params('allowFullScreen', 'true'); $swfobject->add_params('bgcolor', '#'.$ngg_fv_options['ngg_fv_irBackcolor'].''); $swfobject->add_flashvars( 'preloaderColor', '0x'.$ngg_fv_options['ngg_sv_preloader_color'] ); $swfobject->add_flashvars( 'langOpenImage', apply_filters('the_title', $ngg_fv_options['ngg_fv_langOpenImage']) ); $swfobject->add_flashvars( 'langAbout', apply_filters('the_title', $ngg_fv_options['ngg_fv_langAbout']) ); $swfobject->add_flashvars( 'xmlDataPath', NGGFLASHVIEWER_URLPATH.'nggSimpleViewerXML.php?gid='.$galleryID ); } // create the output if (!empty($link)) { if ($ngg_fv_options['ngg_fv_effects'] == "thickbox") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "highslide") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "lightview") $out = ''.$link.''; if (!$ngg_fv_options['ngg_fv_effects'] == "highslide") { $out .= "\n".''; } } else { $out = "\n".''. __('The Flash Player and a browser with Javascript support are needed..', 'nggallery').'
'; $swfobject->add_params('wmode', 'opaque'); $swfobject->add_params('allowfullscreen', 'true'); $swfobject->add_params('bgcolor', '#'.$ngg_fv_options['ngg_fv_irBackcolor'].''); // adding the flash parameter $swfobject->add_flashvars( 'useFlickr', $flickr ); if ($flickr == "true") { $swfobject->add_flashvars( 'user_id', $ngg_fv_options['ngg_tv_user_id'] ); $swfobject->add_flashvars( 'tags', $flickrtags ); $swfobject->add_flashvars( 'tag_mode', $ngg_fv_options['ngg_tv_tag_mode'] ); $swfobject->add_flashvars( 'showTakenByText', $ngg_fv_options['ngg_tv_showTakenByText'] ); $swfobject->add_flashvars( 'showLinkButton', $ngg_fv_options['ngg_tv_showLinkButton'] ); $swfobject->add_flashvars( 'linkLabel', apply_filters('the_title', $ngg_fv_options['ngg_tv_linkLabel']) ); } if ($flickr == "false") $swfobject->add_flashvars( 'maxJPGSize', $ngg_fv_options['ngg_tv_max_jpg_size'] ); $swfobject->add_flashvars( 'useReloadButton', $ngg_fv_options['ngg_tv_use_reload_button'] ); $swfobject->add_flashvars( 'showFlipButton', $ngg_fv_options['ngg_tv_show_flip_button'] ); $swfobject->add_flashvars( 'columns', $ngg_fv_options['ngg_tv_columns'] ); $swfobject->add_flashvars( 'rows', $ngg_fv_options['ngg_tv_rows'] ); $swfobject->add_flashvars( 'frameColor', '0x'.$ngg_fv_options['ngg_tv_frame_color'] ); $swfobject->add_flashvars( 'backColor', '0x'.$ngg_fv_options['ngg_tv_back_color'] ); $swfobject->add_flashvars( 'bkgndInnerColor', '0x'.$ngg_fv_options['ngg_tv_bkgnd_inner_color'] ); $swfobject->add_flashvars( 'bkgndOuterColor', '0x'.$ngg_fv_options['ngg_tv_bkgnd_outer_color'] ); $swfobject->add_flashvars( 'langGoFull', apply_filters('the_title', $ngg_fv_options['ngg_tv_lang_go_full']) ); $swfobject->add_flashvars( 'langExitFull', apply_filters('the_title', $ngg_fv_options['ngg_tv_lang_exit_full']) ); $swfobject->add_flashvars( 'langAbout', apply_filters('the_title', $ngg_fv_options['ngg_fv_langAbout']) ); if ($ngg_fv_options['have_pro_tv'] == "true") { $swfobject->add_flashvars( 'bkgndTransparent', $ngg_fv_options['ngg_tv_pro_bkgndTransparent'] ); $swfobject->add_flashvars( 'showFullscreenOption', $ngg_fv_options['ngg_tv_pro_showFullscreenOption'] ); $swfobject->add_flashvars( 'frameWidth', $ngg_fv_options['ngg_tv_pro_frameWidth'] ); $swfobject->add_flashvars( 'zoomedInDistance', $ngg_fv_options['ngg_tv_pro_zoomedInDistance'] ); $swfobject->add_flashvars( 'zoomedOutDistance', $ngg_fv_options['ngg_tv_pro_zoomedOutDistance'] ); $swfobject->add_flashvars( 'fontName', $ngg_fv_options['ngg_tv_pro_fontName'] ); $swfobject->add_flashvars( 'titleFontSize', $ngg_fv_options['ngg_tv_pro_titleFontSize'] ); $swfobject->add_flashvars( 'descriptionFontSize', $ngg_fv_options['ngg_tv_pro_descriptionFontSize'] ); $swfobject->add_flashvars( 'navButtonColor', '0x'.$ngg_fv_options['ngg_tv_pro_navButtonColor'] ); $swfobject->add_flashvars( 'flipButtonColor', '0x'.$ngg_fv_options['ngg_tv_pro_flipButtonColor'] ); $swfobject->add_flashvars( 'textColor', '0x'.$ngg_fv_options['ngg_tv_pro_textColor'] ); if ($flickr == "true") { $swfobject->add_flashvars( 'linkTextColor', '0x'.$ngg_fv_options['ngg_tv_pro_linkTextColor'] ); $swfobject->add_flashvars( 'linkBkgndColor', '0x'.$ngg_fv_options['ngg_tv_pro_linkBkgndColor'] ); $swfobject->add_flashvars( 'linkFontSize', $ngg_fv_options['ngg_tv_pro_linkFontSize'] ); $swfobject->add_flashvars( 'linkTarget', $ngg_fv_options['ngg_tv_pro_linkTarget'] ); } } if ($flickr == "false") $swfobject->add_flashvars( 'xmlURL', NGGFLASHVIEWER_URLPATH.'nggTiltViewerXML.php?gid='.$galleryID); } // create the output if (!empty($link)) { if ($ngg_fv_options['ngg_fv_effects'] == "thickbox") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "highslide") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "lightview") $out = ''.$link.''; if (!$ngg_fv_options['ngg_fv_effects'] == "highslide") { $out .= "\n".''; } } else { $out = "\n".''. __('The Flash Player and a browser with Javascript support are needed..', 'nggallery').'
'; $swfobject->add_params('wmode', 'opaque'); $swfobject->add_params('allowfullscreen', 'true'); $swfobject->add_params('bgcolor', '#'.$ngg_fv_options['ngg_fv_irBackcolor'].''); // adding the flash parameter $swfobject->add_flashvars( 'langOpenImage', apply_filters('the_title', $ngg_fv_options['ngg_fv_langOpenImage']) ); $swfobject->add_flashvars( 'langAbout', apply_filters('the_title', $ngg_fv_options['ngg_fv_langAbout']) ); $swfobject->add_flashvars( 'xmlURL', NGGFLASHVIEWER_URLPATH.'nggAutoViewerXML.php?gid='.$galleryID ); } // create the output if (!empty($link)) { if ($ngg_fv_options['ngg_fv_effects'] == "thickbox") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "highslide") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "lightview") $out = ''.$link.''; if (!$ngg_fv_options['ngg_fv_effects'] == "highslide") { $out .= "\n".''; } } else { $out = "\n".''. __('The Flash Player and a browser with Javascript support are needed..', 'nggallery').'
'; $swfobject->add_params('wmode', 'opaque'); $swfobject->add_params('allowfullscreen', 'true'); $swfobject->add_params('bgcolor', '#'.$ngg_fv_options['ngg_fv_irBackcolor'].''); // adding the flash parameter $swfobject->add_flashvars( 'langOpenImage', apply_filters('the_title', $ngg_fv_options['ngg_fv_langOpenImage']) ); $swfobject->add_flashvars( 'langAbout', apply_filters('the_title', $ngg_fv_options['ngg_fv_langAbout']) ); $swfobject->add_flashvars( 'xmlURL', NGGFLASHVIEWER_URLPATH.'nggPostcardViewerXML.php?gid='.$galleryID ); } // create the output if (!empty($link)) { if ($ngg_fv_options['ngg_fv_effects'] == "thickbox") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "highslide") $out = ''.$link.''; if ($ngg_fv_options['ngg_fv_effects'] == "lightview") $out = ''.$link.''; if (!$ngg_fv_options['ngg_fv_effects'] == "highslide") { $out .= "\n".''; } } else { $out = "\n".'