= 2.3) { $tags = get_tags(); // Always query top tags } elseif ($wp_version >= 2.0) { if (class_exists('UltimateTagWarriorCore')) { $tags = $wpdb->get_results("SELECT tag as name, COUNT(*) count FROM $tabletags t inner join $tablepost2tag p2t on t.tag_id = p2t.tag_id GROUP BY tag"); // check SimpleTagging Plugin } elseif (class_exists('SimpleTagging')) { $tags = $wpdb->get_results("SELECT tag_name as name, COUNT(*) count FROM $simpletags GROUP BY tag_name"); } } else { $tags = null; } return $tags; } function getMaxTag() { global $wp_version; global $wpdb; global $table_prefix; $simpletags = $table_prefix . "stp_tags"; if ($wp_version >= 2.3) { $tag_max = $wpdb->get_var("SELECT MAX(count) FROM $wpdb->term_taxonomy WHERE taxonomy = 'post_tag';"); } elseif ($wp_version >= 2.0) { if (class_exists('UltimateTagWarriorCore')) : $tag_max = UltimateTagWarriorCore::GetMostPopularTagCount(); // check SimpleTagging Plugin elseif (class_exists('SimpleTagging')) : $tag_max = $wpdb->get_var("SELECT count(tag_name) FROM $simpletags GROUP BY tag_name"); endif; } else { $tag_max = null; } return $tag_max; } function getCategories() { global $wp_version; global $wpdb; if ($wp_version >= 2.3) { $categories = get_categories(); } elseif ($wp_version >= 2.0) { $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories"); } else { $categories = null; } return $categories; } function getMaxCategory() { global $wp_version; global $wpdb; if ($wp_version >= 2.3) { $cat_max = $wpdb->get_var("SELECT MAX(count) FROM $wpdb->term_taxonomy WHERE taxonomy = 'category';"); } elseif ($wp_version >= 2.0) { $cat_max = $wpdb->get_var("SELECT MAX(category_count) FROM $wpdb->categories"); } else { $cat_max = null; } return $cat_max; } function flush_rewrite_rules() { global $wp_rewrite; $wp_rewrite->flush_rules(); } function rewrite_rules($wp_rewrite) { $new_rules = array( 'apml$' => 'index.php?apml=apml', 'apml/(.+)' => 'index.php?apml=apml', 'wp-apml.php$' => 'index.php?apml=apml' ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } /** * Add 'apml' as a valid query variables. **/ function query_vars($vars) { $vars[] = 'apml'; return $vars; } /** * Print APML document if 'apml' query variable is present **/ function apml_xml() { global $wp_query; if( isset( $wp_query->query_vars['apml'] )) { APML::printAPML(); } } function insert_meta_tags() { global $wp_rewrite; echo '' . "\n"; } function printAPML() { global $wp_version; $date = date('Y-m-d\Th:i:s'); $url = get_bloginfo('url'); $url = str_replace('https://', '', $url); $url = str_replace('http://', '', $url); $tags = APML::getTags(); $tag_max = APML::getMaxTag(); $categories = APML::getCategories(); $cat_max = APML::getMaxCategory(); header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); echo ''; ?> Taxonomy APML for <?php echo get_bloginfo('name', 'display') ?> wordpress/