[geeklog-cvs] geeklog: Fixed method descriptions / phpDocumentor tags
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun May 10 05:23:19 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/05dd00b63133
changeset: 7020:05dd00b63133
user: Dirk Haun <dirk at haun-online.de>
date: Sun May 10 10:09:55 2009 +0200
description:
Fixed method descriptions / phpDocumentor tags
diffstat:
1 file changed, 100 insertions(+), 88 deletions(-)
plugins/xmlsitemap/xmlsitemap.class.php | 188 ++++++++++++++++---------------
diffs (truncated from 538 to 300 lines):
diff -r a65dd04d595b -r 05dd00b63133 plugins/xmlsitemap/xmlsitemap.class.php
--- a/plugins/xmlsitemap/xmlsitemap.class.php Sun May 10 09:30:30 2009 +0200
+++ b/plugins/xmlsitemap/xmlsitemap.class.php Sun May 10 10:09:55 2009 +0200
@@ -40,6 +40,9 @@
die('This file can not be used on its own.');
}
+/**
+* "linebreak" constant
+*/
if (!defined('LB')) {
define('LB', "\n");
}
@@ -49,6 +52,7 @@
*
* USAGE:
*
+* <code>
* $sitemap = new SitemapXML();
* $sitemap->setFileNames('path_to_sitemap_file',
* 'path_to_mobile_sitemap_file');
@@ -58,6 +62,8 @@
* // $sitemap->setChangeFreq('article', 'weekly');
* // $sitemap->setChangeFreq('staticpages', 'monthly');
* $sitemap->create();
+* </code>
+*
*/
class SitemapXML
{
@@ -73,16 +79,18 @@
var $_types;
var $_filename;
var $_mobile_filename;
-
- // Valid expressions for 'changefreq' field. Should be constants in PHP5
+
+ /**
+ * Valid expressions for 'changefreq' field. Should be constants in PHP5
+ */
var $_valid_change_freqs = array('always', 'hourly', 'daily', 'weekly',
'monthly', 'yearly', 'never');
-
+
/**
* Constructor
*
* @access public
- * @param encoding string the encoding of contents
+ * @param string $encoding the encoding of contents
*/
function SitemapXML($encoding = '')
{
@@ -90,93 +98,95 @@
$this->setEncoding($encoding);
$this->_changeFreqs = array();
$this->_priorities = array();
-
+
// Set only 'article' as default value
$this->setTypes(array('article'));
}
-
+
/**
* Set the encoding of contents
*
* @access public
- * @param encoding string the encoding of contents
- * @return (void)
+ * @param string $encoding the encoding of contents
+ * @return void
*/
function setEncoding($encoding)
{
if ($encoding == '') {
$encoding = COM_getCharset();
}
- if ($encoding == '') { // This is very unlikely
+ if ($encoding == '') { // This is very unlikely
$encoding = 'iso-8859-1';
}
-
+
$this->_encoding = $encoding;
}
-
+
/**
* Return the encoding of the source content
*
* @access public
- * @return string the encoding of contents
+ * @return string the encoding of contents
*/
function getEncoding()
{
return $this->_encoding;
}
-
+
/**
* Set the name(s) of the sitemap file (and optionally the mobile
* sitemap file)
*
+ * NOTE: Sitemap files must be located in the top directory of the site,
+ * i.e., the same directory as "lib-common.php".
+ *
* @access public
- * @param filename string
- * @param mobile_filename string
- * @note Sitemap files must be located in the top directory of the site,
- * i.e., the same directory as "lib-common.php".
+ * @param string $filename name of sitemap file
+ * @param string $mobile_filename name of mobile sitemap file
*/
function setFileNames($filename = '', $mobile_filename = '')
{
global $_CONF;
-
+
if ($filename != '') {
$this->_filename = $_CONF['path_html'] . basename($filename);
}
-
+
if ($mobile_filename != '') {
$this->_mobile_filename = $_CONF['path_html'] . basename($mobile_filename);
}
}
-
+
/**
* Return the names of sitemap files
*
* @access public
+ * @return array names of the sitemap and mobile sitemap
*/
function getFileNames()
{
return array($this->_filename, $this->_mobile_filename);
}
-
+
/**
* Check if a string stands for a valid value of priority
*
* @access public
- * @param str string a string for a priority
- * @return float a valid value or 0.5 (default value)
+ * @param string $str a string for a priority
+ * @return float a valid value or 0.5 (default value)
*/
function checkPriority($str)
{
$v = (float) $str;
return (($v >= 0.0) AND ($v <= 1.0)) ? $v : 0.5;
}
-
+
/**
* Set the priority of the item
*
* @access public
- * @param type string 'article', 'staticpages', ...
- * @param value float the value of priority
+ * @param string $type 'article', 'staticpages', ...
+ * @param float $value the value of priority
*/
function setPriority($type, $value)
{
@@ -185,13 +195,13 @@
$this->_priorities[$type] = $value;
}
}
-
+
/**
* Return the value of priority
*
* @access public
- * @param type string 'article', 'staticpages', ...
- * @return float 0.0..1.0 (default value is 0.5)
+ * @param string $type 'article', 'staticpages', ...
+ * @return float 0.0..1.0 (default value is 0.5)
*/
function getPriority($type)
{
@@ -201,26 +211,26 @@
return 0.5;
}
}
-
+
/**
* Check if a string stands for a proper frequency
*
* @access public
- * @param str string a string for a frequency
- * @return string a valid string or an empty string
+ * @param string $str a string for a frequency
+ * @return string a valid string or an empty string
*/
function checkChangeFreq($str)
{
$str = strtolower($str);
return in_array($str, $this->_valid_change_freqs) ? $str : '';
}
-
+
/**
* Set the change frequency of the item
*
* @access public
- * @param type string 'article', 'staticpages', ...
- * @param value string any of 'always', 'hourly', 'daily', 'weekly',
+ * @param string $type 'article', 'staticpages', ...
+ * @param string $value any of 'always', 'hourly', 'daily', 'weekly',
* 'monthly', 'yearly', 'never'
*/
function setChangeFreq($type, $value)
@@ -230,13 +240,13 @@
$this->_change_freqs[$type] = $value;
}
}
-
+
/**
* Return the value of change frequency
*
* @access public
- * @param type string 'article', 'staticpages', ...
- * @param value string any of 'always', 'hourly', 'daily', 'weekly',
+ * @param string $type 'article', 'staticpages', ...
+ * @return string any of 'always', 'hourly', 'daily', 'weekly',
* 'monthly', 'yearly', 'never', ''
*/
function getChangeFreq($type)
@@ -247,74 +257,75 @@
return '';
}
}
-
+
/**
* Set the types of content
*
+ * NOTE: $types parameter is not checked to handle a case where
+ * a plugins is being enabled/disabled, i.e., when you can't
+ * depend on $_PLUGINS.
+ *
* @access public
- * @param types mixed (string or array of string)
- * @note $types paramter is not checked to handle a case where
- * a plugins is being enabled/disabled, i.e., when you can't
- * depend on $_PLUGINS.
+ * @param mixed $types (string or array of string): 'article', ...
*/
function setTypes($types)
{
$this->_types = array_unique($types);
}
-
+
/**
* Get the types of content
*
* @access public
- * @return array of string
+ * @return array array of strings of types: 'article', 'staticpages', ...
*/
function getTypes()
{
return $this->_types;
}
-
+
/**
* Normalize a URL
*
* @access private
- * @param url string
- * @return string a normalized URL
+ * @param string $url URL to normalize
+ * @return string a normalized URL
*/
function _normalizeURL($url)
{
static $encoding = NULL;
-
+
if ($encoding === NULL) {
$encoding = $this->getEncoding();
}
-
+
$url = str_replace(
array('<', '>', '&', '"', '''),
array( '<', '>', '&', '"', "'"),
$url
More information about the geeklog-cvs
mailing list