function jobman_gxs_buildmap() { global $wpdb; $options = get_option('jobman_options'); if (!$options['plugins']['gxs']) { return; } $generatorObject =& GoogleSitemapGenerator::GetInstance(); if (NULL == $generatorObject) { // GXS doesn't seem to be here. Abort. return; } // Add each job if individual jobs are displayed if ('summary' == $options['list_type']) { $jobs = get_posts('post_type=jobman_job'); if (count($jobs) > 0) { foreach ($jobs as $job) { $generatorObject->AddUrl(get_page_link($job->ID), time(), "daily", 0.5); } } } // Add the categories $categories = get_terms('jobman_category', 'hide_empty=0'); if (count($categories) > 0) { foreach ($categories as $cat) { $generatorObject->AddUrl(get_term_link($cat->slug, 'jobman_category'), time(), "daily", 0.5); } } }
function CallCheckForManualBuild() { if (GoogleSitemapGeneratorLoader::LoadPlugin()) { $gs = GoogleSitemapGenerator::GetInstance(); $gs->CheckForManualBuild(); } }
static function GoogleXmlSitemap() { if (class_exists('GoogleSitemapGenerator') || class_exists('GoogleSitemapGeneratorStandardBuilder')) { $generatorObject =& GoogleSitemapGenerator::GetInstance(); $options = self::GetSitemapOptions(); if ($generatorObject != null && is_array($options)) { foreach ($options as $optionArr) { $generatorObject->AddUrl($optionArr['location'], time(), $optionArr['frequency'], $optionArr['priority']); } } } }
function spp_generate_sitemap() { require 'settings.php'; if (class_exists('GoogleSitemapGenerator')) { $generatorObject =& GoogleSitemapGenerator::GetInstance(); if ($generatorObject != null) { global $wpdb; // Let's get some keywords $terms = $wpdb->get_col('SELECT term FROM ' . $wpdb->prefix . 'spp ORDER BY RAND() LIMIT ' . $settings['limit']); foreach ($terms as $term) { $generatorObject->AddUrl(build_permalink_for($term, $settings['permalink']), time(), "daily", 0.5); } } } }
function mediatags_google_sitemap_pages() { $mediatag_google_plugin = get_option('mediatag_google_plugin', 'no'); if ($mediatag_google_plugin == "yes") { $generatorObject =& GoogleSitemapGenerator::GetInstance(); //Please note the "&" sign! if ($generatorObject != null) { $mediatag_items = get_mediatags(); if ($mediatag_items) { foreach ($mediatag_items as $mediatag_item) { $mediatag_permalink = get_mediatag_link($mediatag_item->term_id); if (strlen($mediatag_permalink)) { $generatorObject->AddUrl($mediatag_permalink, time(), "daily", 0.5); } } } } } }
/** * Returns if the sitemap building process is currently active * * @since 3.0 * @return bool true if active */ public function IsActive() { $inst = GoogleSitemapGenerator::GetInstance(); return $inst != null && $inst->isActive; }
function CallDoRobots() { if (GoogleSitemapGeneratorLoader::LoadPlugin()) { $gs =& GoogleSitemapGenerator::GetInstance(); $gs->DoRobots(); } }
/** * Invokes the DoRobots method of the generator * @uses GoogleSitemapGeneratorLoader::LoadPlugin() * @uses GoogleSitemapGenerator::DoRobots() */ public static function CallDoRobots() { if (self::LoadPlugin()) { GoogleSitemapGenerator::GetInstance()->DoRobots(); } }
/** * Generate sitemap from sitemap generator plugin. * http://www.benhuson.co.uk/2009/07/12/integrate-google-xml-sitemaps/ * This functions should display in sitemap-misc.xml */ function ktzplg_generate_sitemap() { if (class_exists('GoogleSitemapGenerator')) { $gsg =& GoogleSitemapGenerator::GetInstance(); if ($gsg != null) { # Get keyword from options $data_searchterm_fromoption = Ktzagcplugin_Option::get_option('ktzplg_rand_keyword'); if ($data_searchterm_fromoption != '') { $numb = 1000; # This solution for use multiple explode $keyword_fromoption = explode("\n", $data_searchterm_fromoption); $keyword_fromoption = array_slice($keyword_fromoption, 0, $numb, true); foreach ($keyword_fromoption as $term) { $keyword = str_replace(' ', '-', $term); $domain = get_bloginfo('url'); $url = $domain . '/' . $keyword . '.html'; $gsg->AddUrl($url, time(), 'Daily', 0.6); } } } } }
/** * This function integrates with google sitemap generator, and adds for each viewable language, the rest of the languages url * Also - priority is reduced by 0.2 * And this requires the following line at the sitemap-core.php, add-url function (line 1509 at version 3.2.4) * do_action('sm_addurl', $page); * @param GoogleSitemapGeneratorPage $sm_page Object containing the page information */ function add_sm_transposh_urls($sm_page) { tp_logger("in sitemap add url: " . $sm_page->GetUrl() . " " . $sm_page->GetPriority(), 4); $sm_page = clone $sm_page; // we need the generator object (we know it must exist...) $generatorObject =& GoogleSitemapGenerator::GetInstance(); // we reduce the priorty by 0.2, but not below zero $sm_page->SetProprity(max($sm_page->GetPriority() - 0.2, 0)); /* <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/de" /> */ $viewable_langs = explode(',', $this->transposh->options->viewable_languages); $orig_url = $sm_page->GetUrl(); foreach ($viewable_langs as $lang) { if (!$this->transposh->options->is_default_language($lang)) { $newloc = $orig_url; if ($this->transposh->options->enable_url_translate) { $newloc = transposh_utils::translate_url($newloc, $this->transposh->home_url, $lang, array(&$this->transposh->database, 'fetch_translation')); } $newloc = transposh_utils::rewrite_url_lang_param($newloc, $this->transposh->home_url, $this->transposh->enable_permalinks_rewrite, $lang, false); $sm_page->SetUrl($newloc); $generatorObject->AddElement($sm_page); } } }
function guar_add_custom_post_types_to_google_sitemap() { global $wpdb; // get an instance of the GoogleSitemapGenerator - if it's not there, just quit. $generatorObject =& GoogleSitemapGenerator::GetInstance(); //Please note the "&" sign for PHP4! if ($generatorObject == null) { return; } // this is going to ape the original priority settings without getting too involved $comments = $generatorObject->GetComments(); $totalcomments = $generatorObject->GetCommentCount($comments); // just use the priority set for posts $default_prio = $generatorObject->GetOption('pr_posts'); $minPrio = $generatorObject->GetOption('pr_posts_min'); // get the change frequency for posts $cf_posts = $generatorObject->GetOption('cf_posts'); // Get all the excluded post IDs from both explicit IDs and posts in specified categories // Note: the only taxonomy tested for exclusion is "category". Posts needing to be excluded in other taxonomies need to be done by postID. $excludes = $generatorObject->GetOption('b_exclude'); $excludedCat = get_objects_in_term($generatorObject->GetOption('b_exclude_cats'), "category"); $excludes = array_merge($excludes, $excludedCat); $excludes = array_unique($excludes); // get all the available post types $posttypes = get_post_types(); // filter out posts and pages and other assorted post_types we're not interested in $posttypes = guar_filter_posttypes($posttypes); // a filter hook so you can add or remove post types you want $posttypes = apply_filters('guar_sitemap_posttype_filter', $posttypes); if (count($posttypes > 0)) { // build the query $sql = "SELECT `ID`, `post_author`, `post_date`, `post_date_gmt`, `post_status`, `post_name`, `post_modified`, `post_modified_gmt`, `post_parent`, `post_type` FROM `" . $wpdb->posts . "` WHERE "; $where = " ("; foreach ($posttypes as $pt) { $where .= " post_type='{$pt}' OR "; } $where = substr($where, 0, strlen($where) - 3); $where .= ") AND post_status='publish' "; $where .= " AND post_password='' ORDER BY post_modified DESC"; $sql .= $where; // do the query $postRes = $wpdb->get_results($sql); if ($postRes) { foreach ($postRes as $post) { // check excludes if (in_array($post->ID, $excludes)) { continue; } $permalink = get_permalink($post->ID); // priority is a function of the post's comment count against the total comment count $cmtcnt = isset($comments[$post->ID]) ? $comments[$post->ID] : 0; $prio = guar_GetPostPriority($totalcomments, $cmtcnt); // make sure the minimum is set - again this is just using the default for post if ($prio < $minPrio) { $prio = $minPrio; } // add the url to the sitemap object $generatorObject->AddUrl($permalink, $generatorObject->GetTimestampFromMySql($post->post_modified_gmt && $post->post_modified_gmt != '0000-00-00 00:00:00' ? $post->post_modified_gmt : $post->post_date_gmt), $cf_posts, $prio); } } } }
function set_sm() { if (class_exists('GoogleSitemapGenerator') && $this->data['cap'] != '') { $generatorObject =& GoogleSitemapGenerator::GetInstance(); if ($generatorObject != null) { global $wpdb; $sql = "SELECT DISTINCT\n\t\t\t\t\t\t\tp.ID,\n\t\t\t\t\t\t\tu.user_nicename,\n\t\t\t\t\t\t\tMAX(p.post_modified_gmt) AS last_post\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{$wpdb->users} u,\n\t\t\t\t\t\t\t{$wpdb->posts} p\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tp.post_author = u.ID\n\t\t\t\t\t\t\tAND p.post_status = 'publish'\n\t\t\t\t\t\t\tAND p.post_type = 'post'\n\t\t\t\t\t\t\tAND p.post_password = ''\n\t\t\t\t\t\t\t" . (floatval($wp_version) < 2.1 ? "AND p.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'" : "") . "\n\t\t\t\t\t\tGROUP BY\n\t\t\t\t\t\t\tu.ID,\n\t\t\t\t\t\t\tu.user_nicename"; $authors = $wpdb->get_results($sql); if ($authors && is_array($authors)) { foreach ($authors as $author) { $url = get_bloginfo('home') . "/" . $this->data['cap'] . "/" . $author->user_nicename . "/"; $generatorObject->AddUrl($url, $generatorObject->GetTimestampFromMySql($author->last_post), $generatorObject->GetOption("cf_auth"), $generatorObject->GetOption("pr_auth")); } } } } }