public static function register() { self::$logger = new FBSS_Logger(__CLASS__); self::$plugin_dir_url = FBSS_Registry::get('plugin_base_dir_url'); self::$logger->log("Registered action for JS.", __LINE__); if (get_option('fbss_setting_disable_js')) { self::$logger->log("JS disabled by settings.", __LINE__); } else { add_action('wp_enqueue_scripts', array(__CLASS__, 'add_js_library')); } }
public static function register() { $fb_page_name = get_option('fbss_setting_fb_page_name'); $fb_access_token = get_option('fbss_setting_fb_access_token'); self::$stream_msg_limit = get_option('fbss_setting_msg_limit', 20); // init registry with plugin data first FBSS_Registry::set('plugin_name', self::$plugin_name); FBSS_Registry::set('plugin_version', self::$plugin_version); FBSS_Registry::set('plugin_base_dir_url', plugin_dir_url(__FILE__)); FBSS_Registry::set('plugin_base_dir', plugin_dir_path(__FILE__)); FBSS_Registry::set('fb_page_name', $fb_page_name); FBSS_Registry::set('fb_access_token', $fb_access_token); FBSS_Registry::set('stream_msg_limit', self::$stream_msg_limit); self::$logger = new FBSS_Logger(__CLASS__); self::$db = new FBSS_DB(); self::$logger->log("Register plugin.", __LINE__); /* hooks */ register_activation_hook(__FILE__, array(__CLASS__, 'onActivation')); register_deactivation_hook(__FILE__, array(__CLASS__, 'onDeactivation')); register_uninstall_hook(__FILE__, array(__CLASS__, 'onUninstall')); /* translations */ add_action('plugins_loaded', array(__CLASS__, 'initTextDomain')); /* init plugin template */ self::initTemplate(); if (is_admin()) { /* administration submenu */ $admin = new FBSS_Admin(); /* settings link */ add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(__CLASS__, 'setPluginSettingsLink')); } /* check plugin version */ self::checkPluginVersion(); /* register shortcodes */ FBSS_Shortcodes::register(); /* register ajax handler to update social stream */ add_action('wp_ajax_wp_fb_social_stream_update', array(__CLASS__, 'ajaxUpdateSocialStream')); add_action('wp_ajax_nopriv_wp_fb_social_stream_update', array(__CLASS__, 'ajaxUpdateSocialStream')); add_action('wp_ajax_wp_fb_social_stream_force_update', array(__CLASS__, 'ajaxForceUpdateSocialStream')); /* register javascript libraries */ FBSS_JS::register(); /* register stylesheets */ FBSS_CSS::register(); }