Ejemplo n.º 1
0
 public static function initialisePlugin()
 {
     // NB Network activation will not upgrade a site
     // do upgrade will check current upgrade script version and apply as necessary
     upgrader::checkUpgrade();
     // 2 is required for $file to be populated
     add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'), 10, 2);
     add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
     add_action('wp_head', array(__CLASS__, 'addRssLink'), 100);
     // only include admin files when necessary.
     if (is_admin()) {
         include_once 'settings.php';
         include_once 'postMetaData.php';
         include_once 'categoryMetaData.php';
         settings::addHooks();
         categoryMetaData::addHooks();
         postMetaData::addHooks();
     }
     if (!wp_get_schedule('xmsg_ping')) {
         // ping in 2 hours from when setup.
         wp_schedule_event(time() + 60 * 60 * 2, 'daily', 'xmsg_ping');
     }
     add_action('xmsg_ping', array(__CLASS__, 'doPing'));
     // NB Network activation will not have set up the rules for the site.
     // Check if they exist and then reactivate.
     if (get_option(RULES_OPTION_NAME, null) != RULES_VERSION) {
         add_action('wp_loaded', array(__CLASS__, 'activateRewriteRules'), 99999, 1);
     }
 }
Ejemplo n.º 2
0
 static function run()
 {
     if (isset($_GET['upgrade']) && CODOF\Access\CSRF::valid($_GET['CSRF_token'])) {
         require ABSPATH . 'admin/modules/system/Curl.php';
         if (isset($_GET['checklatest'])) {
             upgrader::check_latest();
         } else {
             if (isset($_GET['download'])) {
                 upgrader::download();
             } else {
                 if (isset($_GET['file_upgrade'])) {
                     upgrader::file_upgrade();
                 } else {
                     if (isset($_GET['direct_upgrade'])) {
                         echo 'started DU';
                         upgrader::direct_upgrade();
                     } else {
                         if (isset($_GET['ftp_step'])) {
                             upgrader::ftp_step();
                         }
                     }
                 }
             }
         }
         session_write_close();
         ob_end_flush();
         exit;
     }
 }