abstract class vB_SiteMap

Abstract class to construct sitemap files and the index file. Must be subclassed for specific content types.

Constants

FLAG_PING_GOOGLE

FLAG_PING_BING

Properties

protected int $lastid The last id of the content, for per_page
protected array $forum_custom_priority An array of custom Forum priorities forumid => priority
protected array $custom_priority An array of custom priorities contenttype => forumid => priority
protected vB_Registry $registry The vBulletin registry object
protected vB_Database $dbobject The vBulletin database object
protected vB_XML_Parser $xmlobject A vB_XML_Parser database object
protected string $content String to save the content of the sitemap while being generated before being written out
protected int $pagecount Counter for the numbers of URLs added to the current sitemap content
protected boolean|null $has_more Determines if there is more of this content type to process.
protected array $errors Array to store any errors encountered while building data
protected array $sitemap_index Array to store currently generated (or listed) site maps. Used to generate sitemap index file (the master one). ['loc'] && ['lastmod']
array $search_engines Array of search engine urls' for sitemap call back, populated with defaults from options
protected $sitemap_path
protected $tempfile

Methods

__construct(vB_Registry $registry)

Constructor - checks that the registry object has been passed correctly.

generate_sitemap()

This function will generate the actual sitemap content.

array
get_sitemap_index()

Gets the current data that will be used to build the sitemap index

set_sitemap_index(array $value)

Sets the current data that will be used to build the sitemap index

boolean|null
has_more()

Returns indicator for whether there's more of this content to be processed.

float
get_effective_priority(string $contenttype, integer $contentid)

Returns the effective priority for a non-forum type

int
get_pagecount()

Accessor

int
get_lastid()

Accessor

boolean
create_sitemap_index()

Write out the sitemap index file using sitemap file refrences in $this->sitemap_index

boolean
create_sitemap($filename)

Build the actual file for the sitemap

string
url_block(string $url, int $lastmod, double $pri = false, boolean $formatting = false)

Create a url XML text block for one URL

boolean
remove_sitemaps()

Delete all sitemaps named : '_sitemap.xml' '_sitemap.xml.gz' 'sitemap_index.xml'

none
ping_search_engines()

Ping the search engines

Details

at line 669
__construct(vB_Registry $registry)

Constructor - checks that the registry object has been passed correctly.

Parameters

vB_Registry $registry Instance of the vBulletin data registry object - expected to have the database object as one of its $this->db member.

at line 681
abstract protected generate_sitemap()

This function will generate the actual sitemap content.

at line 690
array get_sitemap_index()

Gets the current data that will be used to build the sitemap index

Return Value

array

at line 700
set_sitemap_index(array $value)

Sets the current data that will be used to build the sitemap index

Parameters

array $value

at line 711
boolean|null has_more()

Returns indicator for whether there's more of this content to be processed.

Useful for the case where there is exactly the "per page" pieces of content.

Return Value

boolean|null Null is unknown, booling otherwise

at line 724
float get_effective_priority(string $contenttype, integer $contentid)

Returns the effective priority for a non-forum type

Parameters

string $contenttype content type
integer $contentid content ID

Return Value

float Usable priority

at line 739
int get_pagecount()

Accessor

Return Value

int

at line 750
int get_lastid()

Accessor

Return Value

int

at line 761
final boolean create_sitemap_index()

Write out the sitemap index file using sitemap file refrences in $this->sitemap_index

Return Value

boolean indicates success. On failure an error message will be recorded in $this->errors

at line 806
final boolean create_sitemap($filename)

Build the actual file for the sitemap

Parameters

$filename

Return Value

boolean indicates success. On failure an error message will be recorded in $this->errors

at line 861
protected string url_block(string $url, int $lastmod, double $pri = false, boolean $formatting = false)

Create a url XML text block for one URL

Parameters

string $url The URL (not encoded) to add to the sitemap
int $lastmod The unix timestamp of the last modifictaion time of the data in UTC
double $pri The priority of the data from 0.1 to 1.0
boolean $formatting Enable formatting of the output

Return Value

string Formatted escaped wrapped text

at line 925
final boolean remove_sitemaps()

Delete all sitemaps named : '_sitemap.xml' '_sitemap.xml.gz' 'sitemap_index.xml'

Return Value

boolean FALSE on any fails

at line 964
none ping_search_engines()

Ping the search engines

Return Value

none A blind call, no return currently parsed