/** * Initialise the taxonomy data * * @return $this */ protected function _initTaxonomies() { if (!is_null(self::$_taxonomies)) { return $this; } self::$_taxonomies = false; $transportObject = new Varien_Object(array('taxonomies' => false)); Mage::dispatchEvent('wordpress_app_init_taxonomies', array('transport' => $transportObject)); if ($transportObject->getTaxonomies()) { self::$_taxonomies = $transportObject->getTaxonomies(); } else { $blogPrefix = Mage::helper('wordpress')->isWordPressMU() && Mage::helper('wp_addon_multisite')->canRun() && Mage::helper('wp_addon_multisite')->isDefaultBlog(); $bases = array('category' => Mage::helper('wordpress')->getWpOption('category_base'), 'post_tag' => Mage::helper('wordpress')->getWpOption('tag_base')); foreach ($bases as $baseType => $base) { if ($blogPrefix && $base && strpos($base, '/blog') === 0) { $bases[$baseType] = substr($base, strlen('/blog')); } } self::$_taxonomies = array('category' => Mage::getModel('wordpress/term_taxonomy')->setData(array('type' => 'category', 'taxonomy_type' => 'category', 'labels' => array('name' => 'Categories', 'singular_name' => 'Category'), 'public' => true, 'hierarchical' => true, 'rewrite' => array('hierarchical' => true, 'slug' => $bases['category']), '_builtin' => true)), 'post_tag' => Mage::getModel('wordpress/term_taxonomy')->setData(array('type' => 'post_tag', 'taxonomy_type' => 'post_tag', 'labels' => array('name' => 'Tags', 'singular_name' => 'Tag'), 'public' => true, 'hierarchical' => false, 'rewrite' => array('slug' => $bases['post_tag']), '_builtin' => true))); } if (isset(self::$_taxonomies['category'])) { $helper = Mage::helper('wordpress'); $canRemoveCategoryPrefix = $helper->isPluginEnabled('wp-no-category-base/no-category-base.php') || $helper->isPluginEnabled('wp-remove-category-base/wp-remove-category-base.php') || $helper->isPluginEnabled('remove-category-url/remove-category-url.php') || Mage::helper('wp_addon_wordpressseo')->canRemoveCategoryBase(); if ($canRemoveCategoryPrefix) { self::$_taxonomies['category']->setSlug(''); } } return $this; }