=') ); //This works only in WP2.2 or higher if ((version_compare($wp_version, '2.1', '>=')) or (IS_WPMU)){ // Version and path to check version define('NGGVERSION', "0.80"); define('NGGURL', "http://nextgen.boelinger.com/version.php"); // define URL $myabspath = str_replace("\\","/",ABSPATH); // required for Windows & XAMPP define('WINABSPATH', $myabspath); define('NGGFOLDER', dirname(plugin_basename(__FILE__))); define('NGGALLERY_ABSPATH', $myabspath.'wp-content/plugins/' . NGGFOLDER .'/'); define('NGGALLERY_URLPATH', get_option('siteurl').'/wp-content/plugins/' . NGGFOLDER.'/'); // look for imagerotator define('NGGALLERY_IREXIST', file_exists(NGGALLERY_ABSPATH.'imagerotator.swf')); // get value for safe mode if ((gettype(ini_get('safe_mode')) == 'string')) { // if sever did in in a other way if (ini_get('safe_mode') == 'off') define('SAFE_MODE', FALSE); else define('SAFE_MODE', ini_get('safe_mode')); } else define('SAFE_MODE', ini_get('safe_mode')); //pass the init check or show a message if (get_option( "ngg_init_check" ) != false ) add_action('admin_notices', create_function('', 'echo \'

' . get_option( "ngg_init_check" ) . '

\';')); //read the options $ngg_options = get_option('ngg_options'); // add database pointer $wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures'; $wpdb->nggallery = $wpdb->prefix . 'ngg_gallery'; $wpdb->nggalbum = $wpdb->prefix . 'ngg_album'; $wpdb->nggtags = $wpdb->prefix . 'ngg_tags'; $wpdb->nggpic2tags = $wpdb->prefix . 'ngg_pic2tags'; // Load language function nggallery_init () { load_plugin_textdomain('nggallery','wp-content/plugins/' . NGGFOLDER.'/lang'); } // Load the admin panel if (is_admin()) { include_once (dirname (__FILE__)."/ngginstall.php"); include_once (dirname (__FILE__)."/admin/admin.php"); } else { // Load the gallery generator include_once (dirname (__FILE__)."/nggfunctions.php"); } // Load tinymce button include_once (dirname (__FILE__)."/tinymce/tinymce.php"); // Load gallery class require_once (dirname (__FILE__).'/lib/nggallery.lib.php'); // Init the clas $nggallery = new nggallery(); // Add rewrite rules $nggRewrite = new nggRewrite(); // add javascript to header add_action('wp_head', 'ngg_addjs', 1); function ngg_addjs() { global $wp_version, $ngg_options; echo "\n"; if ($ngg_options['activateCSS']) echo "\n".''; if ($ngg_options['thumbEffect'] == "thickbox") { echo "\n".''; echo "\n".''."\n"; if ($wp_version < "2.3") { if ($wp_version > "2.1.3") wp_deregister_script('jquery'); wp_enqueue_script('jquery', NGGALLERY_URLPATH .'admin/js/jquery.js', FALSE, '1.1.3.1'); } wp_enqueue_script('thickbox', NGGALLERY_URLPATH .'thickbox/thickbox-pack.js', array('jquery'), '3.1.1'); // add NextGEN jQuery Plugin if ($ngg_options['galUsejQuery']) wp_enqueue_script('nextgen', NGGALLERY_URLPATH .'admin/js/jquery.nextgen.pack.js', array('jquery'), '0.5'); //TODO: NEW AJAX Version // wp_enqueue_script('nextgen-ajax', NGGALLERY_URLPATH .'admin/js/jquery.nextgen.ajax.js', array('jquery'), '0.1'); // wp_enqueue_script('blockui', NGGALLERY_URLPATH .'admin/js/jquery.blockUI.js', array('jquery'), '0.1'); } // test for wordTube function if (!function_exists('integrate_swfobject')) { wp_enqueue_script('swfobject', NGGALLERY_URLPATH .'admin/js/swfobject.js', FALSE, '1.5'); } } // load language file add_action('init', 'nggallery_init'); // Init options & tables during activation // add_action('activate_' . NGGFOLDER.'/nggallery.php', 'ngg_install'); // WP recommended function, not used until 2.2.3 register_activation_hook(NGGFOLDER.'/nggallery.php','ngg_install'); register_deactivation_hook(NGGFOLDER.'/nggallery.php','ngg_deinstall'); // init tables in wp-database if plugin is activated function ngg_install() { global $nggRewrite; // Check for admin role nggallery_install(); // Flush ReWrite rules $nggRewrite->flush(); } function ngg_deinstall() { // remove & reset the init check option delete_option( "ngg_init_check" ); } // Action calls for all functions add_filter('the_content', 'searchnggallerytags'); add_filter('the_excerpt', 'searchnggallerytags'); // Content Filters add_filter('ngg_gallery_name', 'sanitize_title'); } else { add_action('admin_notices', create_function('', 'echo \'

' . __('Sorry, NextGEN Gallery works only under WordPress 2.1 or higher',"nggallery") . '

\';')); }// End Check for WP 2.1 ?>