=') ); // Check for WP2.1 or higher define('IS_WP21_COMPATIBLE', version_compare($wp_version, '2.1', '>=') ); // Check for WP2.5 installation define('IS_WP25', version_compare($wp_version, '2.4', '>=') ); //This works only in WP2.1 or higher if ( (IS_WP21_COMPATIBLE == FALSE) and (IS_WPMU != TRUE) ){ add_action('admin_notices', create_function('', 'echo \'

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

\';')); return; } $memory_limit = (int) substr( ini_get('memory_limit'), 0, -1); //This works only with enough memory, 8MB is silly, wordpress requires already 7.9999 if ( ($memory_limit != 0) && ($memory_limit < 12 ) ) { add_action('admin_notices', create_function('', 'echo \'

' . __('Sorry, NextGEN Gallery works only with a Memory Limit of 16 MB higher',"nggallery") . '

\';')); return; } // Version and path to check version define('NGGVERSION', "0.99.1"); // Minimum required database version define('NGG_DBVERSION', "0.84"); define('NGGURL', "http://nextgen.boelinger.com/version.php"); // required for Windows & XAMPP $myabspath = str_replace("\\","/",ABSPATH); define('WINABSPATH', $myabspath); // Pre-2.6 compatibility if ( !defined('WP_CONTENT_URL') ) define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); if ( !defined('WP_CONTENT_DIR') ) define( 'WP_CONTENT_DIR', WINABSPATH . 'wp-content' ); define('NGGFOLDER', plugin_basename( dirname(__FILE__)) ); define('NGGALLERY_ABSPATH', WP_CONTENT_DIR.'/plugins/'.plugin_basename( dirname(__FILE__)).'/' ); define('NGGALLERY_URLPATH', WP_CONTENT_URL.'/plugins/'.plugin_basename( dirname(__FILE__)).'/' ); // 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 () { if (function_exists('load_plugin_textdomain')) { if ( !defined('WP_PLUGIN_DIR') ) { load_plugin_textdomain('nggallery','wp-content/plugins/' . NGGFOLDER . '/lang'); //load_plugin_textdomain('nggallery', str_replace( ABSPATH, '', dirname(__FILE__) ) . '/lang'); } else { load_plugin_textdomain('nggallery', false, dirname(plugin_basename(__FILE__)) . '/lang'); } } } // Load the admin panel if (is_admin()) { include_once (dirname (__FILE__)."/ngginstall.php"); // check for upgrade if( get_option( "ngg_db_version" ) != NGG_DBVERSION ) ngg_upgrade(); if (IS_WP25) include_once (dirname (__FILE__)."/admin/wp25/admin.php"); else include_once (dirname (__FILE__)."/admin/admin.php"); } else { // Load the gallery generator include_once (dirname (__FILE__)."/nggfunctions.php"); // required in WP 2.5, NextGEN should have higher priority than the shortcode // see also http://trac.wordpress.org/ticket/6436 if (IS_WP25) { remove_filter('the_content', 'do_shortcode', 9); add_filter('the_content', 'do_shortcode', 11); } // Action calls for all functions add_filter('the_content', 'searchnggallerytags', 10); add_filter('the_excerpt', 'searchnggallerytags', 10); } // Load tinymce button if (IS_WP25) include_once (dirname (__FILE__)."/tinymce3/tinymce.php"); else include_once (dirname (__FILE__)."/tinymce/tinymce.php"); // Load gallery class require_once (dirname (__FILE__).'/lib/nggallery.lib.php'); // Init the gallery class $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.5") { if ($wp_version > "2.1.3") wp_deregister_script('jquery'); wp_enqueue_script('jquery', NGGALLERY_URLPATH .'admin/js/jquery.js', FALSE, '1.2.2'); } if (IS_WP25) wp_enqueue_script('ngg-thickbox', NGGALLERY_URLPATH .'thickbox/thickbox-pack.js', array('jquery'), '3.1.1'); else wp_enqueue_script('thickbox', NGGALLERY_URLPATH .'thickbox/thickbox-pack.js', array('jquery'), '3.1.1'); } // test for wordTube function if (!function_exists('integrate_swfobject')) { wp_enqueue_script('swfobject', NGGALLERY_URLPATH .'admin/js/swfobject.js', FALSE, '2.1'); } } // 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() { // Check for tables nggallery_install(); } function ngg_deinstall() { // remove & reset the init check option delete_option( "ngg_init_check" ); } // Content Filters add_filter('ngg_gallery_name', 'sanitize_title'); ?>