本文整理汇总了PHP中GoogleSitemapGenerator类的典型用法代码示例。如果您正苦于以下问题:PHP GoogleSitemapGenerator类的具体用法?PHP GoogleSitemapGenerator怎么用?PHP GoogleSitemapGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GoogleSitemapGenerator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: jobman_gxs_buildmap
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);
}
}
}
开发者ID:jazzindizzin,项目名称:Jampalan-Baru,代码行数:29,代码来源:plugins.php
示例2: GoogleXmlSitemap
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']);
}
}
}
}
开发者ID:krisatkinson,项目名称:dsidxpress,代码行数:12,代码来源:xml-sitemaps.php
示例3: spp_generate_sitemap
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);
}
}
}
}
开发者ID:jensonbetrail,项目名称:wordpress,代码行数:15,代码来源:StupidSitemap.php
示例4: mediatags_google_sitemap_pages
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);
}
}
}
}
}
}
开发者ID:vsalx,项目名称:rattieinfo,代码行数:19,代码来源:mediatags_thirdparty.php
示例5: IsActive
/**
* 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;
}
开发者ID:yarwalker,项目名称:ecobyt,代码行数:11,代码来源:sitemap-core.php
示例6: LoadPlugin
/**
* Loads the actual generator class and tries to raise the memory and time limits if not already done by WP
*
* @return boolean true if run successfully
*/
function LoadPlugin()
{
$mem = abs(intval(@ini_get('memory_limit')));
if ($mem && $mem < 32) {
@ini_set('memory_limit', '32M');
}
$time = abs(intval(@ini_get("max_execution_time")));
if ($time != 0 && $time < 120) {
@set_time_limit(120);
}
if (!class_exists("GoogleSitemapGenerator")) {
$path = trailingslashit(dirname(__FILE__));
if (!file_exists($path . 'sitemap-core.php')) {
return false;
}
require_once $path . 'sitemap-core.php';
}
GoogleSitemapGenerator::Enable();
return true;
}
开发者ID:sjcockell,项目名称:fuzzierlogic.blog,代码行数:25,代码来源:sitemap.php
示例7: HtmlShowOptionsPage
//.........这里部分代码省略.........
<!--[if lt IE 7]>
<style type="text/css">
div#advancedstuff {
width:735px;
}
</style>
<![endif]-->
<?php
} else {
?>
<style type="text/css">
div.updated-message {
margin-left:0; margin-right:0;
}
</style>
<?php
}
?>
<div class="wrap" id="sm_div">
<form method="post" action="<?php
echo $this->sg->GetBackLink();
?>
">
<h2><?php
_e('XML Sitemap Generator for WordPress', 'sitemap');
echo " " . $this->sg->GetVersion();
?>
</h2>
<?php
if (function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) {
wp_update_plugins();
$file = GoogleSitemapGeneratorLoader::GetBaseName();
$plugin_data = get_plugin_data(GoogleSitemapGeneratorLoader::GetPluginFile());
$current = get_option('update_plugins');
if (isset($current->response[$file])) {
$r = $current->response[$file];
?>
<div id="update-nag" class="sm-update-nag"><?php
if (!current_user_can('edit_plugins') || version_compare($wp_version, "2.5", "<")) {
printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
} else {
if (empty($r->package)) {
printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
} else {
printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&plugin={$file}", 'upgrade-plugin_' . $file));
}
}
?>
</div><?php
}
}
?>
<?php
if (version_compare($wp_version, "2.5", "<")) {
?>
<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
<script type="text/javascript">
//<![CDATA[
addLoadEvent( function() {
var manager = new dbxManager('sm_sitemap_meta_33');
//create new docking boxes group
var meta = new dbxGroup(
开发者ID:SymbiSoft,项目名称:litprojects,代码行数:67,代码来源:sitemap-ui.php
示例8: HtmlShowOptionsPage
/**
* Displays the option page
*
* @since 3.0
* @access public
* @author Arne Brachhold
*/
public function HtmlShowOptionsPage()
{
global $wp_version;
//Hopefully this fixes the caching issues after upgrade. Redirect incl. the versions, but only if no POST data.
if (count($_POST) == 0 && count($_GET) == 1 && isset($_GET["page"])) {
$redirURL = $this->sg->GetBackLink() . '&sm_fromidx=true';
//Redirect so the sm_rebuild GET parameter no longer exists.
@header("location: " . $redirURL);
//If there was already any other output, the header redirect will fail
echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>';
echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>';
exit;
}
$snl = false;
//SNL
$this->sg->Initate();
$message = "";
$is_ms = $this->sg->IsMultiSite();
if (!empty($_REQUEST["sm_rebuild"])) {
//Pressed Button: Rebuild Sitemap
check_admin_referer('sitemap');
if (isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"] == "true") {
//Check again, just for the case that something went wrong before
if (!current_user_can("administrator")) {
echo '<p>Please log in as admin</p>';
return;
}
$oldErr = error_reporting(E_ALL);
$oldIni = ini_set("display_errors", 1);
echo '<div class="wrap">';
echo '<h2>' . __('XML Sitemap Generator for WordPress', 'sitemap') . " " . $this->sg->GetVersion() . '</h2>';
echo '<p>This is the debug mode of the XML Sitemap Generator. It will show all PHP notices and warnings as well as the internal logs, messages and configuration.</p>';
echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>';
echo "<h3>WordPress and PHP Information</h3>";
echo '<p>WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '</p>';
echo '<p>Plugin version: ' . $this->sg->GetVersion() . ' (' . $this->sg->GetSvnVersion() . ')';
echo '<h4>Environment</h4>';
echo "<pre>";
$sc = $_SERVER;
unset($sc["HTTP_COOKIE"]);
print_r($sc);
echo "</pre>";
echo "<h4>WordPress Config</h4>";
echo "<pre>";
$opts = array();
if (function_exists('wp_load_alloptions')) {
$opts = wp_load_alloptions();
} else {
global $wpdb;
$os = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options}");
foreach ((array) $os as $o) {
$opts[$o->option_name] = $o->option_value;
}
}
$popts = array();
foreach ($opts as $k => $v) {
//Try to filter out passwords etc...
if (preg_match("/pass|login|pw|secret|user|usr|key|auth|token/si", $k)) {
continue;
}
$popts[$k] = htmlspecialchars($v);
}
print_r($popts);
echo "</pre>";
echo '<h4>Sitemap Config</h4>';
echo "<pre>";
print_r($this->sg->GetOptions());
echo "</pre>";
echo '<h3>Sitemap Content and Errors, Warnings, Notices</h3>';
echo '<div>';
$sitemaps = $this->sg->SimulateIndex();
foreach ($sitemaps as $sitemap) {
echo "<h4>Sitemap: <a href=\"" . $sitemap["data"]->GetUrl() . "\">" . $sitemap["type"] . "/" . ($sitemap["params"] ? $sitemap["params"] : "(No parameters)") . "</a> by " . $sitemap["caller"]["class"] . "</h4>";
$res = $this->sg->SimulateSitemap($sitemap["type"], $sitemap["params"]);
echo "<ul style='padding-left:10px;'>";
foreach ($res as $s) {
echo "<li>" . $s["data"]->GetUrl() . "</li>";
}
echo "</ul>";
}
$status = GoogleSitemapGeneratorStatus::Load();
echo '</div>';
echo '<h3>MySQL Queries</h3>';
if (defined('SAVEQUERIES') && SAVEQUERIES) {
echo '<pre>';
var_dump($GLOBALS['wpdb']->queries);
echo '</pre>';
$total = 0;
foreach ($GLOBALS['wpdb']->queries as $q) {
$total += $q[1];
}
echo '<h4>Total Query Time</h4>';
echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total, 2) . ' seconds.</pre>';
//.........这里部分代码省略.........
开发者ID:songsanren,项目名称:My-blog,代码行数:101,代码来源:sitemap-ui.php
示例9: GetEnabledTaxonomies
public function GetEnabledTaxonomies(GoogleSitemapGenerator $gsg)
{
$enabledTaxonomies = $gsg->GetOption("in_tax");
if ($gsg->GetOption("in_tags")) {
$enabledTaxonomies[] = "post_tag";
}
if ($gsg->GetOption("in_cats")) {
$enabledTaxonomies[] = "category";
}
$taxList = array();
foreach ($enabledTaxonomies as $taxName) {
$taxonomy = get_taxonomy($taxName);
if ($taxonomy && wp_count_terms($taxonomy->name, array('hide_empty' => true)) > 0) {
$taxList[] = $taxonomy->name;
}
}
return $taxList;
}
开发者ID:ryanurban,项目名称:Orbit,代码行数:18,代码来源:sitemap-builder.php
示例10: ktzplg_generate_sitemap
/**
* 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);
}
}
}
}
}
开发者ID:rolexmessi,项目名称:101,代码行数:27,代码来源:_functions.php
示例11: add_sm_transposh_urls
/**
* 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);
}
}
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:33,代码来源:transposh_3rdparty.php
示例12: guar_add_custom_post_types_to_google_sitemap
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);
}
}
}
}
开发者ID:blocher,项目名称:oneholyname,代码行数:62,代码来源:guar_sitemap.php
示例13: set_sm
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"));
}
}
}
}
}
开发者ID:jeetututeja,项目名称:Ingenia,代码行数:17,代码来源:wp-htaccess-control.php
示例14: header
</table>
</p>
</fieldset>
</form>
</div>
<script type="text/javascript">
sm_addLinks();
sm_gencode();
</script>
<?php
}
}
//Check if ABSPATH and WPINC is defined, this is done in wp-settings.php
//If not defined, we can't guarante that all required functions are available.
if (defined("ABSPATH") && defined("WPINC")) {
GoogleSitemapGenerator::Enable();
}
//Embedded resources
if (isset($_GET["res"]) && !empty($_GET["res"])) {
#region Images
//Paypal
if ($_GET["res"] == "{8C0BAD8C-77FA-4842-956E-CDEF7635F2C7}") {
header("Content-Type: image/gif");
echo base64_decode("R0lGODlhEAAQAMQQANbe5sjT3gAzZpGmvOTp7v///629zYSctK28zbvI1ZKnvfH094SbtHaQrHaRrJ+xxf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAHoAxAALAAAAAAQABAAQAVZICSOZDkGQqGuBTqUSMqqiTACwqIKgGkKwCDwVRIodkDVwjYSMFSNoCNQIgSugZ6vBMBetSYCj0UwCA6lgyy4YoqWASRAZSYNZNaA+VxM7B5bEA9CboGGIyEAOw==");
exit;
}
//Amazon
if ($_GET["res"] == "{9866EAFC-3F85-44df-8A72-4CD1566E2D4F}") {
header("Content-Type: image/gif");
echo base64_decode("R0lGODlhEAAQAMQGADc1NVBOTmloaERCQl1bW9rZ2f///7Szs8rKyubm5nZ0dJuamvPy8qinp31gOLeDOuWgPPGnPM6SO05DNoKBgY+NjXFZN8OLOpRuOWZSN0M8NdqZO1pKNqB1OYhnOOrBhSwAAAAAEAAQAEAFeSAgBsIgnqiYGOxaAM4DRZE0AcOCMOyS/hxLR0KLPCaciEOEMCQKLMVPRIgCetPsaYLRXCKaIm3TuZ08mhMByjpoAQhE4GrwZaGMBnYq6OkNL1kBCwsUABUDFhcXGDIRGVMTDl8QExsSABcbYjQXkABDIh8XHQ5mWiEAOw==");
exit;
开发者ID:jbogota,项目名称:blog-king,代码行数:31,代码来源:sitemap.php
注:本文中的GoogleSitemapGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论