コード例 #1
0
 /**
  *
  *
  * @since 1.5
  */
 public static function launch($loader_path)
 {
     if (self::$plugin) {
         wp_die(__('Cheatin’ huh?'));
     }
     self::$plugin = new self($loader_path);
     if (WP_DEBUG) {
         include self::$plugin->dirPath . '/debugger/debugger.class.php';
         self::$debugger = Debugger::init('SiteTree', self::$plugin->dirPath);
     }
     if (version_compare(get_bloginfo('version'), self::MIN_WP_VERSION, '<')) {
         self::$plugin->registerFatalError(sprintf(__('To run %s you need at least WordPress %s. Please, update your WordPress installation to ' . 'the %slatest version%s available.', 'sitetree'), 'SiteTree', self::MIN_WP_VERSION, '<a href="http://wordpress.org/download/" target="_blank">', '</a>'));
         add_action('plugins_loaded', array(self::$plugin, 'loadTextdomain'));
         return -1;
     }
     global $pagenow;
     switch ($pagenow) {
         case 'wp-cron.php':
             add_action('sitetree_ping', array(self::$plugin->pingController(), 'ping'));
             // During cron we load the bare minimum, so all works faster.
             return 2;
         case 'plugins.php':
             register_activation_hook($loader_path, array(self::$plugin, 'activate'));
     }
     add_action('init', array(self::$plugin, 'finishLaunching'));
 }