define_constants(); $this->load_options(); $this->load_dependencies(); // Init options & tables during activation & deregister init option register_activation_hook( dirname(__FILE__) . '/nggimageflow.php', array(&$this, 'activate') ); // make it multilingual add_action('init', array(&$this, 'load_textdomain') ); if ( function_exists('register_uninstall_hook') ) register_uninstall_hook( dirname(__FILE__) . '/admin/install.php', 'nggflow_uninstall' ); // Why is this not core ? add_action('wp_head', 'wp_print_styles'); // Add the script and style files add_action('wp_print_scripts', array(&$this, 'load_scripts') ); add_action('wp_print_styles', array(&$this, 'load_styles') ); } function define_constants() { // Pre-2.6 compatibility if ( !defined('WP_CONTENT_URL') ) define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // define URL define('NGGIMAGEFLOW_URLPATH', WP_CONTENT_URL.'/plugins/'.plugin_basename( dirname(__FILE__)).'/' ); define('SITEURL', get_option('siteurl')); } function load_dependencies() { if ( is_admin() ) { require_once (dirname (__FILE__) . '/admin/admin.php'); $nggflowAdminPanel = new nggflowAdminPanel(); } else { require_once (dirname (__FILE__).'/lib/shortcodes.php'); require_once (dirname (__FILE__).'/lib/functions.php'); } } function load_textdomain() { if (function_exists('load_plugin_textdomain')) { load_plugin_textdomain('nggflow','wp-content/plugins/'.dirname(plugin_basename(__FILE__)).'/langs'); } } function load_options() { // Load the options $this->options = get_option('ngg_if_options'); } function activate() { include_once (dirname (__FILE__) . '/admin/install.php'); ngg_if_default_options(); } function load_styles() { if ($this->options['ngg_if_use_style'] == "true") { wp_enqueue_style( 'imageflow', NGGIMAGEFLOW_URLPATH.'imageflow/imageflow.css', FALSE, '2.5.0', 'screen' ); } } function load_scripts() { wp_enqueue_script( 'imageflowjs', NGGIMAGEFLOW_URLPATH.'imageflow/imageflow.js', FALSE, '1.0.2' ); } function internationalize($in) { if ( function_exists( 'langswitch_filter_langs_with_message' ) ) { $in = langswitch_filter_langs_with_message($in); } if ( function_exists( 'polyglot_filter' )) { $in = polyglot_filter($in); } if ( function_exists( 'qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage' )) { $in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($in); } $in = apply_filters('localization', $in); return $in; } } // Let's get the show on the road global $nggflow; $nggflow = new nggflow(); } ?>