File_Sitemap
[ class tree: File_Sitemap ] [ index: File_Sitemap ] [ all elements ]

Class: File_Sitemap_Base

Source Location: /File_Sitemap-0.1.4/File/Sitemap/Base.php

Class Overview


Abstract class providing common functions to File_Sitemap related classes.


Author(s):

Version:

  • Release: 0.1.2

Variables

Methods


Child classes:

File_Sitemap_Index
Generate sitemap index file.
File_Sitemap
Generate sitemap files. See http://www.sitemaps.org/protocol.php for more details.

Inherited Variables

Inherited Methods


Class Details

[line 53]
Abstract class providing common functions to File_Sitemap related classes.


[ Top ]


Class Variables

$dom =

[line 61]

The internal DOMDocument used by this class
  • Access: protected

Type:   DOMDocument


[ Top ]



Method Detail

__construct (Constructor)   [line 81]

void __construct( string $root, string $schema)

Constructor. Build an empty XML document, with xmlns and root element.
  • Access: public

Overridden in child classes as:

File_Sitemap_Index::__construct()
Constructor.
File_Sitemap::__construct()
Constructor. Build an empty XML document, with xmlns and root element.

Parameters:

string   $root   —  Name of the root element
string   $schema   —  Location of the schema

[ Top ]

findLoc   [line 103]

mixed findLoc( string $url)

Returns the DOMNode element which contains $url, or false if not found.
  • Return: DOMNode | false
  • Access: protected

Parameters:

string   $url   —  URL (loc) we are looking for.

[ Top ]

load   [line 284]

void load( string $file)

Load sitemap from file. The file can be gzipped or not.

Parameters:

string   $file   —  Filename (or URL).

[ Top ]

notify   [line 348]

void notify( string $url, [mixed $site = 'http://www.google.com/webmasters/sitemaps/ping'])

Notify $site that a sitemap was updated at $url

Parameters:

string   $url   —  URL of the sitemap file (must be valid)
mixed   $site   —  string | array. URL (or array of URL) of the search engine ping site

[ Top ]

parseDateTime   [line 237]

string parseDateTime( string $datetime)

Ensure that $datetime is a valid date time string

If $datetime is conform to the spec, it is returned as is. Else we try to decode it using strtotime function.


Parameters:

string   $datetime   —  The date (and time) to pase.

[ Top ]

parseURL   [line 183]

string parseURL( string $url)

Ensure url contains valid chars and isn't longer than 2048 chars.

urlencode invalid chars. Convert invalid XML chars to entities.

  • Throws: File_Sitemap_Exception URL doesn't begin with valid protocol (http, https, ftp) or encoded URL longer than 2048 chars.
  • Access: protected

Parameters:

string   $url   —  The url we want to verify and encode.

[ Top ]

remove   [line 266]

void remove( string $loc)

Remove DOMNode that contains url $loc from the document.
  • Access: public

Parameters:

string   $loc   —  URL to remove

[ Top ]

save   [line 315]

void save( string $file, [boolean $compress = true], [boolean $formatOutput = false])

Save sitemap to file.

Parameters:

string   $file   —  Filename (or URL), including path.
boolean   $compress   —  gzip the file? Default true.
boolean   $formatOutput   —  Nice format XML. Default false.

[ Top ]

test   [line 397]

boolean test( [array &$results = array()])

Test that all url in sitemap are valid URL
  • Return: true if all URLs reached
  • Access: public

Parameters:

array   &$results   —  An array that will contains result codes. key is the url, value is the response code (200, 302, 404, etc.)

[ Top ]

updateNode   [line 125]

void updateNode( DOMNode $urlNode, string $nodeName, string $nodeVal)

Set to $nodeValue the value of the $nodeName child of $urlNode.

If $urlNode doen't have a $nodeName child, add it.

  • Access: protected

Parameters:

DOMNode   $urlNode   —  The parent of the node we want to update.
string   $nodeName   —  The name of the node we want to update.
string   $nodeVal   —  The value we want to put into the node.

[ Top ]

validate   [line 427]

boolean validate( string $schema)

Validate the sitemap document against DTD

Be warned that it will issue some warnings if it doesn't validate.

  • Access: public

Overridden in child classes as:

File_Sitemap_Index::validate()
Validate sitemap index with the schema definition.
File_Sitemap::validate()
Validate sitemap against its schema definition.

Parameters:

string   $schema   —  URL of the validating schema.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:46:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.