예제 #1
0
 /**
  * Initializes Social.
  *
  * @wp-action  init
  * @return void
  */
 public function init()
 {
     // Load the language translations
     if (Social::$loaded_by_theme) {
         $path = trailingslashit(Social::$plugins_path) . 'lang';
         load_theme_textdomain('social', $path);
     } else {
         $plugin_dir = basename(dirname(SOCIAL_FILE)) . '/lang';
         load_plugin_textdomain('social', false, $plugin_dir);
     }
     if (version_compare(PHP_VERSION, '5.2.4', '<')) {
         deactivate_plugins(basename(__FILE__));
         // Deactivate ourself
         wp_die(__("Sorry, Social requires PHP 5.2.4 or higher. Ask your host how to enable PHP 5 as the default on your servers.", 'social'));
     }
     // Just activated?
     if (!Social::option('install_date')) {
         Social::option('install_date', current_time('timestamp', 1));
         Social::option('system_cron_api_key', wp_generate_password(16, false));
     }
     // Plugins URL
     $url = plugins_url('', SOCIAL_FILE);
     Social::$plugins_url = trailingslashit(apply_filters('social_plugins_url', $url));
     Social::$plugins_path = trailingslashit(apply_filters('social_plugins_path', SOCIAL_PATH));
     // Set the logger
     Social::$log = Social_Log::factory();
     // Require Facebook and Twitter by default.
     require Social::$plugins_path . 'social-twitter.php';
     require Social::$plugins_path . 'social-facebook.php';
 }