Esempio n. 1
0
 /**
  * Let's get it started
  *
  * @since 1.1
  */
 public function __construct()
 {
     // load plugin files relative to this directory
     $this->plugin_directory = dirname(__FILE__) . '/';
     $this->set_locale();
     // Load the textdomain for translations
     load_plugin_textdomain('facebook', false, $this->plugin_directory . 'languages/');
     $credentials = get_option('facebook_application');
     if (!is_array($credentials)) {
         $credentials = array();
     }
     $this->credentials = $credentials;
     unset($credentials);
     add_action('widgets_init', array(&$this, 'widgets_init'));
     // load shortcodes
     if (!class_exists('Facebook_Shortcodes')) {
         require_once $this->plugin_directory . 'social-plugins/shortcodes.php';
     }
     Facebook_Shortcodes::init();
     if (is_user_logged_in()) {
         // admin bar may show on public-facing site as well as administrative section
         add_action('add_admin_bar_menus', array(&$this, 'admin_bar'));
     }
     if (is_admin()) {
         add_action('admin_enqueue_scripts', array(&$this, 'register_js_sdk'), 1);
         $this->admin_init();
     } else {
         add_action('wp_enqueue_scripts', array(&$this, 'register_js_sdk'), 1);
         add_action('wp', array(&$this, 'public_init'));
     }
 }
Esempio n. 2
0
 /**
  * Configures the plugin and future actions.
  *
  * @since 1.1
  */
 public function __construct()
 {
     // load plugin files relative to this directory
     $this->plugin_directory = dirname(__FILE__) . '/';
     // set the Facebook locale based on the WordPress site's locale. Used to load the appropriate version of the Facebook SDK for JavaScript.
     $this->set_locale();
     // Load the textdomain for translations
     load_plugin_textdomain('facebook', false, $this->plugin_directory . 'languages/');
     // load Facebook application data
     $credentials = get_option('facebook_application');
     if (!is_array($credentials)) {
         $credentials = array();
     }
     $this->credentials = $credentials;
     unset($credentials);
     $this->kid_directed = (bool) get_option('facebook_kid_directed_site');
     if ($this->app_access_token_exists()) {
         // Facebook Social Publisher functionality
         if (!class_exists('Facebook_Social_Publisher')) {
             require_once $this->plugin_directory . 'admin/social-publisher/social-publisher.php';
         }
         add_action('init', array('Facebook_Social_Publisher', 'init'));
     }
     // Include Facebook widgets
     add_action('widgets_init', array(&$this, 'widgets_init'));
     // load shortcodes
     if (!class_exists('Facebook_Shortcodes')) {
         require_once $this->plugin_directory . 'social-plugins/shortcodes.php';
     }
     Facebook_Shortcodes::init();
     if (is_user_logged_in()) {
         // admin bar may show on public-facing site as well as administrative section
         add_action('add_admin_bar_menus', array(&$this, 'admin_bar'));
     }
     if (is_admin()) {
         add_action('admin_enqueue_scripts', array(&$this, 'register_js_sdk'), 1);
         $this->admin_init();
     } else {
         add_action('wp_enqueue_scripts', array(&$this, 'register_js_sdk'), 1);
         // split initialization functions into early (init) and regular (wp) action groups
         add_action('init', array(&$this, 'public_early_init'), 1, 0);
         add_action('wp', array(&$this, 'public_init'));
     }
 }