Пример #1
0
 function setUp()
 {
     parent::setUp();
     create_initial_taxonomies();
     $this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     $this->home_url = get_option('home');
 }
 function WpsPlugin()
 {
     global $wps_subdomains, $wps_this_subdomain, $wps_category_base, $wps_showall_pages, $wps_permalink_set;
     // Stuff changed in WP 2.8
     if (function_exists('create_initial_taxonomies')) {
         create_initial_taxonomies();
     }
     //--- Create the SubDomains Object
     $wps_subdomains = new WpsSubDomains();
     //--- Grab This Subdomain object (if we're on one)
     $wps_this_subdomain = $wps_subdomains->getThisSubdomain();
     //--- Grab all the Pages with the Show On All override
     $wps_showall_pages = wps_showall_pages();
     //--- Set the category base global
     if (get_option('category_base')) {
         $wps_category_base = get_option('category_base') . '/';
     } else {
         $wps_category_base = 'category/';
     }
     //--- Check permalinks are setup
     if (get_option('permalink_structure')) {
         $wps_permalink_set = true;
     }
     //--- Add Admin Menu Pages
     add_action('admin_menu', 'wps_add_options');
     // If the permalink is configured then we can setup everything else
     if ($wps_permalink_set && get_option(WPS_OPT_DISABLED) == '') {
         //--- Add the Actions
         $this->addActions();
         //--- Add the Filters
         $this->addFilters();
     }
     // this action can't be in addActions because the admin interface doesn't work without it.
     add_action('admin_init', 'wps_admin_init');
 }
	function setUp() {
		parent::setUp();

		update_option( 'page_comments', true );
		update_option( 'comments_per_page', 5 );
		update_option( 'posts_per_page', 5 );

		update_option( 'permalink_structure', $this->structure );
		create_initial_taxonomies();
		$GLOBALS['wp_rewrite']->init();
		flush_rewrite_rules();

		$this->old_current_user = get_current_user_id();
		$this->author_id = $this->factory->user->create( array( 'user_login' => 'canonical-author' ) );
		wp_set_current_user( $this->author_id );

		// Already created by install defaults:
		// $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );

		$this->term_ids = array();

		$this->factory->post->create( array( 'import_id' => 587, 'post_title' => 'post-format-test-audio', 'post_date' => '2008-06-02 00:00:00' ) );
		$post_id = $this->factory->post->create( array( 'post_title' => 'post-format-test-gallery', 'post_date' => '2008-06-10 00:00:00' ) );
		$this->factory->post->create( array( 'import_id' => 611, 'post_type' => 'attachment', 'post_title' => 'canola2', 'post_parent' => $post_id ) );

		$this->factory->post->create( array(
			'post_title' => 'images-test',
			'post_date' => '2008-09-03 00:00:00',
			'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3'
		) );

		$post_id = $this->factory->post->create( array( 'import_id' => 149, 'post_title' => 'comment-test', 'post_date' => '2008-03-03 00:00:00' ) );
		$this->factory->comment->create_post_comments( $post_id, 15 );

		$this->factory->post->create( array( 'post_date' => '2008-09-05 00:00:00' ) );

		$this->factory->post->create( array( 'import_id' => 123 ) );
		$this->factory->post->create( array( 'import_id' => 1 ) );
		$this->factory->post->create( array( 'import_id' => 358 ) );

		$this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'sample-page' ) );
		$this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
		$post_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
		$this->factory->post->create(
			array( 'import_id' => 144, 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $post_id,
		) );

		$this->term_ids['/category/parent/'] = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'parent' ) );
		$this->term_ids['/category/parent/child-1/'] = $this->factory->term->create( array(
			'taxonomy' => 'category', 'name' => 'child-1', 'parent' => $this->term_ids['/category/parent/'],
		) );
		$this->term_ids['/category/parent/child-1/child-2/'] = $this->factory->term->create( array(
			'taxonomy' => 'category', 'name' => 'child-2', 'parent' => $this->term_ids['/category/parent/child-1/'],
		) );

		$this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
		$this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );

		$this->factory->term->create( array( 'name' => 'post-formats' ) );
	}
Пример #4
0
 function setUp()
 {
     global $wp_rewrite;
     parent::setUp();
     set_current_screen('front');
     $GLOBALS['wp_the_query'] = new WP_Query();
     $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     register_taxonomy('testtax', 'post', array('public' => true));
     $wp_rewrite->flush_rules();
     $this->tag_id = $this->factory->tag->create(array('slug' => 'tag-slug'));
     $this->cat_id = $this->factory->category->create(array('slug' => 'cat-slug'));
     $this->tax_id = $this->factory->term->create(array('taxonomy' => 'testtax', 'slug' => 'tax-slug'));
     $this->tax_id2 = $this->factory->term->create(array('taxonomy' => 'testtax', 'slug' => 'tax-slug2'));
     $this->post_id = $this->factory->post->create();
     wp_set_object_terms($this->post_id, $this->cat_id, 'category');
     wp_set_object_terms($this->post_id, array($this->tax_id, $this->tax_id2), 'testtax');
     $this->cat = get_term($this->cat_id, 'category');
     _make_cat_compat($this->cat);
     $this->tag = get_term($this->tag_id, 'post_tag');
     $this->uncat = get_term_by('slug', 'uncategorized', 'category');
     _make_cat_compat($this->uncat);
     add_action('pre_get_posts', array($this, 'pre_get_posts_tax_category_tax_query'));
 }
Пример #5
0
 function setUp()
 {
     parent::setUp();
     $this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     $this->http = set_url_scheme(home_url('sample-page/'), 'http');
     $this->https = set_url_scheme(home_url('sample-page/'), 'https');
 }
	function setUp() {
		parent::setUp();
		global $wp_rewrite;
		update_option( 'permalink_structure', '/%category%/%year%/%postname%/' );
		create_initial_taxonomies();
		$GLOBALS['wp_rewrite']->init();
		flush_rewrite_rules();
	}
Пример #7
0
 function setUp()
 {
     global $wp_rewrite;
     parent::setUp();
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%category%/%year%/%postname%/');
     create_initial_taxonomies();
     $wp_rewrite->flush_rules();
 }
 public function setUp()
 {
     parent::setUp();
     update_option('page_comments', true);
     update_option('comments_per_page', 5);
     update_option('posts_per_page', 5);
     $this->set_permalink_structure($this->structure);
     create_initial_taxonomies();
 }
Пример #9
0
 function setUp()
 {
     parent::setUp();
     set_current_screen('front');
     update_option('comments_per_page', 5);
     update_option('posts_per_page', 5);
     create_initial_taxonomies();
     $this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
 }
Пример #10
0
	function setUp() {
		parent::setUp();

		// Need rewrite rules in place to use url_to_postid
		global $wp_rewrite;
		update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
		create_initial_taxonomies();
		$GLOBALS['wp_rewrite']->init();
		flush_rewrite_rules();
	}
Пример #11
0
 /**
  * Setup.
  */
 public function setUp()
 {
     parent::setUp();
     $this->post_count = (int) get_option('posts_per_rss');
     $this->excerpt_only = get_option('rss_use_excerpt');
     // this seems to break something
     update_option('use_smilies', false);
     $this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
 }
Пример #12
0
 function setUp()
 {
     global $wp_rewrite;
     parent::setUp();
     // Need rewrite rules in place to use url_to_postid
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     $wp_rewrite->flush_rules();
 }
Пример #13
0
 function setUp()
 {
     parent::setUp();
     update_option('comments_per_page', 5);
     update_option('posts_per_page', 5);
     global $wp_rewrite;
     update_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     $GLOBALS['wp_rewrite']->init();
     flush_rewrite_rules();
 }
 public function setUp()
 {
     /** @var WP_Rewrite $wp_rewrite */
     global $wp_rewrite;
     parent::setUp();
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     $wp_rewrite->flush_rules();
     do_action("plugins_loaded");
 }
Пример #15
0
 public function setUp()
 {
     parent::setUp();
     update_option('page_comments', true);
     update_option('comments_per_page', 5);
     update_option('posts_per_page', 5);
     global $wp_rewrite;
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure($this->structure);
     create_initial_taxonomies();
     $wp_rewrite->flush_rules();
 }
Пример #16
0
 function setUp()
 {
     parent::setUp();
     set_current_screen('front');
     update_option('comments_per_page', 5);
     update_option('posts_per_page', 5);
     global $wp_rewrite;
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     $wp_rewrite->flush_rules();
 }
 public function setUp()
 {
     /** @var WP_Rewrite $wp_rewrite */
     global $wp_rewrite;
     parent::setUp();
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     update_option('page_comments', true);
     update_option('comments_per_page', 5);
     update_option('posts_per_page', 5);
     $this->post_type = "cpt";
     $this->taxonomy = "ctax";
 }
 function setUp()
 {
     global $wp_rewrite;
     parent::setUp();
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     $this->assertNotEmpty($wp_rewrite->wp_rewrite_rules());
     create_initial_post_types();
     create_initial_taxonomies();
     // Force the install/upgrade routines for each Babble class to run (ugh)
     remove_action('admin_init', '_maybe_update_core');
     remove_action('admin_init', '_maybe_update_plugins');
     remove_action('admin_init', '_maybe_update_themes');
     do_action('admin_init');
 }
 function callback($path = '', $blog_id = 0, $post_type = 'post')
 {
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     if (defined('IS_WPCOM') && IS_WPCOM) {
         $this->load_theme_functions();
     }
     /** This filter is documented in jetpack/json-endpoints/class.wpcom-json-api-list-post-types-endpoint.php */
     if (apply_filters('rest_api_localize_response', false)) {
         // API localization occurs after the initial taxonomies have been
         // registered, so re-register if localizing response
         create_initial_taxonomies();
     }
     $args = $this->query_args();
     $post_type_object = get_post_type_object($post_type);
     if (!$post_type_object || !$post_type_object->publicly_queryable && !current_user_can($post_type_object->cap->edit_posts)) {
         return new WP_Error('unknown_post_type', 'Unknown post type', 404);
     }
     // Get a list of available taxonomies
     $taxonomy_objects = get_object_taxonomies($post_type, 'objects');
     // Construct array of formatted objects
     $formatted_taxonomy_objects = array();
     foreach ($taxonomy_objects as $taxonomy_object) {
         // Omit private taxonomies unless user has assign capability
         if (!$taxonomy_object->public && !current_user_can($taxonomy_object->cap->assign_terms)) {
             continue;
         }
         // Include only the desired keys in the response
         $formatted_taxonomy_object = array();
         foreach (self::$taxonomy_keys_to_include as $key => $value) {
             $formatted_taxonomy_object[$value] = $taxonomy_object->{$key};
         }
         $formatted_taxonomy_objects[] = $formatted_taxonomy_object;
     }
     return array('found' => count($formatted_taxonomy_objects), 'taxonomies' => $formatted_taxonomy_objects);
 }
Пример #20
0
 public function requireTaxonomies()
 {
     if (!empty($this->context['wp_taxonomies'])) {
         return;
     }
     create_initial_taxonomies();
 }
Пример #21
0
 /**
  * Unregister existing taxonomies and register defaults.
  *
  * Run before each test in order to clean up the global scope, in case
  * a test forgets to unregister a taxonomy on its own, or fails before
  * it has a chance to do so.
  */
 protected function reset_taxonomies()
 {
     foreach (get_taxonomies() as $tax) {
         _unregister_taxonomy($tax);
     }
     create_initial_taxonomies();
 }
 function setUp()
 {
     parent::setUp();
     create_initial_taxonomies();
     $this->set_permalink_structure('/%category%/%year%/%postname%/');
 }
Пример #23
0
    }
    unset($network_plugin);
}
do_action('muplugins_loaded');
if (is_multisite()) {
    ms_cookie_constants();
}
// Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
wp_cookie_constants();
// Define and enforce our SSL constants
wp_ssl_constants();
// Create common globals.
require ABSPATH . WPINC . '/vars.php';
// Make taxonomies and posts available to plugins and themes.
// @plugin authors: warning: these get registered again on the init hook.
create_initial_taxonomies();
create_initial_post_types();
// Register the default theme directory root
register_theme_directory(get_theme_root());
// Load active plugins.
foreach (wp_get_active_and_valid_plugins() as $plugin) {
    include_once $plugin;
}
unset($plugin);
// Load pluggable functions.
require ABSPATH . WPINC . '/pluggable.php';
require ABSPATH . WPINC . '/pluggable-deprecated.php';
// Set internal encoding.
wp_set_internal_encoding();
// Run wp_cache_postload() if object cache is enabled and the function exists.
if (WP_CACHE && function_exists('wp_cache_postload')) {
 /**
  * Set up permalink structure
  */
 private function setup_permalink_structure()
 {
     global $wp_rewrite;
     $structure = get_option('permalink_structure');
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure($structure);
     create_initial_taxonomies();
     $wp_rewrite->flush_rules();
 }