/**
  * @covers WPSEO_Rewrite::query_vars
  */
 public function test_query_vars()
 {
     $this->assertEquals(array(), self::$class_instance->query_vars(array()));
     $options = WPSEO_Options::get_all();
     $options['stripcategorybase'] = true;
     update_option(WPSEO_Option_Permalinks::get_instance()->option_name, $options);
     $this->assertEquals(array('wpseo_category_redirect'), self::$class_instance->query_vars(array()));
 }
コード例 #2
0
/**
 * Runs on activation of the plugin.
 */
function _wpseo_activate()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    wpseo_load_textdomain();
    // Make sure we have our translations available for the defaults.
    WPSEO_Options::get_instance();
    if (!is_multisite()) {
        WPSEO_Options::initialize();
    } else {
        WPSEO_Options::maybe_set_multisite_defaults(true);
    }
    WPSEO_Options::ensure_options_exist();
    if (is_multisite() && ms_is_switched()) {
        delete_option('rewrite_rules');
    } else {
        $wpseo_rewrite = new WPSEO_Rewrite();
        $wpseo_rewrite->schedule_flush();
    }
    wpseo_add_capabilities();
    // Clear cache so the changes are obvious.
    WPSEO_Utils::clear_cache();
    do_action('wpseo_activate');
}