' . __('Sorry, NextGEN ImageFlow works only in combination with NextGEN Gallery.','nggflow') . '

\';')); return; } add_action('admin_menu','modify_menu_for_nggImageFlow'); } // ImageFlow settings function ngg_if_default_options() { $ngg_if_options['ngg_if_background_color'] = "ffffff"; // Background color of the reflection $ngg_if_options['ngg_if_effect'] = "none"; // Javascript effect for top image. Can be "none" or "highslide" (more effects to come) $ngg_if_options['ngg_if_reflection'] = 0.7; // Sets the height of the reflection in % of the source image $ngg_if_options['ngg_if_focus'] = 2; // Sets the number of images on each side of the focused one $ngg_if_options['ngg_if_sldr_width'] = 14; // Sets the px width of the slider div $ngg_if_options['ngg_if_img_cursor'] = "pointer"; // Sets the cursor type for all images. Default is "pointer". $ngg_if_options['ngg_if_sldr_cursor'] = "e-resize"; // Sets the slider cursor type. Default is "e-resize". $ngg_if_options['ngg_if_start_image'] = 3; // Sets which image the slideshow will start with $ngg_if_options['ngg_if_use_style'] = "true"; // Sets whether to use the stylesheet or not $ngg_if_options['ngg_if_use_reflection'] = "true"; // Sets whether to use the reflections or not update_option('ngg_if_options', $ngg_if_options); } function SearchForImageFlow($content) { global $wpdb; if ( stristr( $content, '[imageflow' )) { $search = "@(?:

)*\s*\[imageflow\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]; $replace = nggShowImageFlow($galleryID,$width,$height,$link); $content= str_replace ($search, $replace, $content); } } } }// end slideshow } return $content; } function nggShowImageFlow($galleryID,$irWidth,$irHeight, $link = false) { global $wpdb; $ngg_options = get_option ('ngg_options'); $ngg_if_options = get_option('ngg_if_options'); $pictures = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid WHERE t.gid = '$galleryID' AND tt.exclude != 1 ORDER BY tt.$ngg_options[galSort] $ngg_options[galSortDir] "); $siteurl = get_option ('siteurl'); if (!is_array($pictures)) die; $out = '
'; $out .= '
'; $out .= "\n".'
'; $out .= "\n".''.__('Loading', 'nggflow').''; $out .= "\n".'
'; $out .= "\n".'
'; foreach ($pictures as $picture) { if ($ngg_if_options['ngg_if_use_reflection'] == "true"){ $out .= "\n".'path.'/'.$picture->filename.'|'.apply_filters('the_title', $picture->description).'\');'; } else { $out .= $siteurl.'/'.$picture->path.'/'.$picture->filename; } $out .= '" alt="'.apply_filters('the_title', $picture->description).'" />'; } $out .= "\n".'
'; $out .= "\n".'
'; $out .= "\n".'
'; $out .= "\n".'
'; $out .= "\n".'
'; $out .= "\n".'
'; $out .= "\n".'
'; return $out; } function nggHeadImageFlow() { $ngg_if_options = get_option('ngg_if_options'); if ($ngg_if_options['ngg_if_use_style'] == "true") { echo ''."\n"; } if ($ngg_if_options['ngg_if_effects'] == "none") { echo ''."\n"; } elseif ($ngg_if_options['ngg_if_effects'] == "highslide") { echo ''."\n"; /* Needs some more work to... well, work... } elseif ($ngg_if_options['ngg_if_effects'] == "lightbox") { echo ''."\n"; */ } else { echo ''."\n"; } echo ''."\n"; } // load script files depending on page function ngg_if_add_admin_js() { if ($_GET["page"] == "nggallery-imageflow") wp_enqueue_script('tabs', NGGALLERY_URLPATH .'admin/js/jquery.ui.tabs.pack.js', array('jquery'), '2.7.4'); } // load css files depending on page function ngg_if_add_admin_css() { if ($_GET["page"] == "nggallery-imageflow") { echo ''."\n"; echo ''."\n"; } } function addImageFlowPage() { // reduce footprint if ($_GET["page"] == "nggallery-imageflow") { include_once (dirname (__FILE__). '/nggImageFlowSettings.php'); // nggallery_admin_options showImageFlowPage(); } } function modify_menu_for_nggImageFlow() { // add to NextGEN Menu add_submenu_page( NGGFOLDER , __('ImageFlow', 'nggflow'), __('ImageFlow', 'nggflow'), 'NextGEN Change options', 'nggallery-imageflow', 'addImageFlowPage'); } //action and filter calls add_action('init','nggflow_textdomain'); add_action('plugins_loaded', 'checkIFNGGallery'); add_action('wp_head', 'nggHeadImageFlow'); add_action('init', 'ngg_if_add_admin_js'); add_action('admin_head', 'ngg_if_add_admin_css'); add_filter('the_content', 'SearchForImageFlow'); add_filter('the_excerpt', 'SearchForImageFlow'); register_activation_hook(__FILE__,'ngg_if_default_options'); ?>