<?php
-class NP_GoogleSitemap extends NucleusPlugin
-{
+/** ============================================================================
+ * GoogleSitemap for Nucleus
+ *
+ * Copyright 2005 by Niels Leenheer
+ * ============================================================================
+ * This program is free software and open source software; you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
+ * http://www.gnu.org/licenses/gpl.html
+ * ============================================================================
+ **/
- /* ==========================================================================================
- * GoogleSitemap for Nucleus
- *
- * Copyright 2005 by Niels Leenheer
- * ==========================================================================================
- * This program is free software and open source software; you can redistribute
- * it and/or modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
- * http://www.gnu.org/licenses/gpl.html
- * ==========================================================================================
- */
+/**
+ * History
+ * 0.7 modified release by shizuki
+ * Generate URL modified from
+ * 'http://example.com/action.php?action=plugin&name=Sitemap' to
+ * 'http://example.com/sitemap.xml' and,or
+ * 'http://example.com/index.php?virtualpath=sitemap.xml'
+ * Add 'lastmod' attribute
+ * 0.9 SitemapProtocol updated release
+ * SitemapProtocol ver.0.9 as common for Google, Yahoo! and MSN(Live! Search)
+ * 1.0 Add Sitemap type and chage 'lastmod' generate
+ * Add 'ROR Sitemap' format
+ * For details about the ROR format, go to www.rorweb.com
+ * Modify 'lastmod' attribute
+ * item posted time or comment posted time or item update time
+ * item update time generate by NP_UpdateTime
+ **/
+class NP_GoogleSitemap extends NucleusPlugin
+{
function getName()
{
function getVersion()
{
- return '0.7';
+ return '1.0';
}
function getDescription()
{
- return 'This plugin provides a Google sitemap for your website.<br /> Sitemap URL: http://example.cm/sitemap.xml';
+ return _G_SITEMAP_DESC;
}
function getEventList()
{
return array(
- 'PostAddItem',
- 'PreSendContentType'
+ 'PostAddItem',
+ 'PreSendContentType'
);
}
- function supportsFeature($feature) {
+ function supportsFeature($feature)
+ {
switch($feature) {
case 'SqlTablePrefix':
return 1;
{
global $CONF, $manager, $blogid;
+ $mcategories = $this->pluginCheck('MultipleCategories');
+ if ($mcategories) {
+ if (method_exists($mcategories, 'getRequestName')) {
+ $subReq = $mcategories->getRequestName();
+ } else {
+ $subReq = 'subcatid';
+ }
+ }
+ $npUpdateTime = $this->pluginCheck('UpdateTime');
+
if (!$blogid) {
$blogid = $CONF['DefaultBlog'];
} else {
- $blogid = (is_numeric($blogid)) ? intval($blogid) : intval(getBlogIDFromName($blogid));
+ if (is_numeric($blogid)) {
+ $blogid = intval($blogid);
+ } else {
+ $blogid = intval(getBlogIDFromName($blogid));
+ }
}
$b =& $manager->getBlog($blogid);
- $SelfURL = $b->getURL();
- $BlogURL = $SelfURL;
+ $BlogURL = $b->getURL();
- if (substr($SelfURL, -4) == '.php') $CONF['URLMode'] = 'normal';
-
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
- if (substr($SelfURL, -1) == '/') {
- $SelfURL = ($usePathInfo) ? substr($SelfURL, 0, -1) : $SelfURL . 'index.php';
- } elseif (substr($SelfURL, -4) != '.php') {
- $SelfURL = ($usePathInfo) ? $SelfURL : $SelfURL . '/index.php';
- }
-
- if (substr($BlogURL, -1) != '/' && substr($BlogURL, -4) != '.php') {
+ if ( substr($BlogURL, -1) != '/'
+ && substr($BlogURL, -4) != '.php') {
$BlogURL .= '/';
}
return;
}
- $path_arr = explode('/', $info);
- $PcMap = $this->getBlogOption($blogid, 'PcSitemap');
+ $path_arr = explode('/', $info);
+ $PcMap = $this->getBlogOption($blogid, 'PcSitemap');
$MobileMap = $this->getBlogOption($blogid, 'MobileSitemap');
- if (end($path_arr) == $PcMap || (!empty($MobileMap) && end($path_arr) == $MobileMap)) {
- $CONF['ItemURL'] = $SelfURL;
- $CONF['CategoryURL'] = $SelfURL;
+ if ( end($path_arr) == $PcMap
+ || end($path_arr) == 'ror.xml'
+ || (!empty($MobileMap) && end($path_arr) == $MobileMap) ) {
$sitemap = array();
- if ($this->getOption('AllBlogMap') == 'yes' && $blogid == $CONF['DefaultBlog']) {
- $blog_query = 'SELECT * FROM %s';
- $blog_res = sql_query(sprintf($blog_query, sql_table('blog')));
+ if ( $this->getOption('AllBlogMap') == 'yes'
+ && $blogid == $CONF['DefaultBlog']) {
+ $blogQuery = 'SELECT * '
+ . 'FROM %s '
+ . 'ORDER BY bnumber';
+ $blogQuery = sprintf($blogQuery, sql_table('blog'));
+ $blogResult = sql_query($blogQuery);
} else {
- $blog_query = 'SELECT * FROM %s WHERE bnumber = %d';
- $blog_res = sql_query(sprintf($blog_query, sql_table('blog'), $blogid));
- $current_blog = TRUE;
+ $blogQuery = 'SELECT * '
+ . 'FROM %s '
+ . 'WHERE bnumber = %d';
+ $blogQuery = sprintf($blogQuery, sql_table('blog'), $blogid);
+ $blogResult = sql_query($blogQuery);
+ $currentBlog = TRUE;
}
- while ($blogs = mysql_fetch_array($blog_res)) {
- $blog_id = $blogs['bnumber'];
- if ($this->getBlogOption($blog_id, 'IncludeSitemap') == 'yes' || !empty($current_blog)) {
- $temp_b =& $manager->getBlog($blog_id);
- $TempURL = $temp_b->getURL();
- $SelfURL = $TempURL;
- if (substr($TempURL, -1) != '/' && substr($TempURL, -4) != '.php') {
+ while ($blogs = mysql_fetch_array($blogResult)) {
+ $blog_id = intval($blogs['bnumber']);
+ if ( $this->getBlogOption($blog_id, 'IncludeSitemap') == 'yes'
+ || !empty($currentBlog)) {
+ $temp_b =& $manager->getBlog($blog_id);
+ $TempURL = $temp_b->getURL();
+ $SelfURL = $TempURL;
+
+ $URLMode = $CONF['URLMode'];
+ if (substr($TempURL, -4) == '.php') {
+ $CONF['URLMode'] = 'normal';
+ }
+
+ $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
+
+ if (substr($SelfURL, -1) == '/') {
+
+ if ($usePathInfo) {
+ $SelfURL = substr($SelfURL, 0, -1);
+ } else {
+ $SelfURL = $SelfURL . 'index.php';
+ }
+
+ } elseif (substr($SelfURL, -4) != '.php') {
+
+ if ($usePathInfo) {
+ $SelfURL = $SelfURL;
+ } else {
+ $SelfURL = $SelfURL . '/index.php';
+ }
+
+ }
+
+ $CONF['ItemURL'] = $SelfURL;
+ $CONF['CategoryURL'] = $SelfURL;
+
+ if ( substr($TempURL, -1) != '/'
+ && substr($TempURL, -4) != '.php') {
$TempURL .= '/';
}
+
$patternURL = '/^' . preg_replace('/\//', '\/', $BlogURL) . '/';
+
if (preg_match($patternURL, $TempURL)) {
- $sitemap[] = array(
- 'loc' => $this->_prepareLink($SelfURL, $TempURL),
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
-
- $cat_query = 'SELECT * FROM %s WHERE cblog = %d ORDER BY catid';
- $cat_res = sql_query(sprintf($cat_query, sql_table('category'), $blog_id));
- $mcategories = $this->pluginCheck('MultipleCategories');
- while ($cat = mysql_fetch_array($cat_res)) {
+
+ if (end($path_arr) == 'ror.xml') {
+ $rorTitleURL = $this->_prepareLink($SelfURL, $TempURL);
+ $rooTitleURL = htmlspecialchars($rooTitleURL, ENT_QUOTES, _CHARSET);
+ $sitemapTitle = " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
+ . " <link>" . $rorTitleURL . "</link>\n"
+ . " <item>\n"
+ . " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
+ . " <link>" . $rorTitleURL . "</link>\n"
+ . " <ror:about>sitemap</ror:about>\n"
+ . " <ror:type>SiteMap</ror:type>\n"
+ . " </item>\n";
+ } else {
$sitemap[] = array(
- 'loc' => $this->_prepareLink($SelfURL, createCategoryLink($cat['catid'])),
- 'priority' => '1.0',
+ 'loc' => $this->_prepareLink($SelfURL, $TempURL),
+ 'priority' => '1.0',
'changefreq' => 'daily'
);
+ }
+
+ $catQuery = 'SELECT * '
+ . 'FROM %s '
+ . 'WHERE cblog = %d '
+ . 'ORDER BY catid';
+ $catTable = sql_table('category');
+ $catQuery = sprintf($catQuery, $catTable, $blog_id);
+ $catResult = sql_query($catQuery);
+
+ while ($cat = mysql_fetch_array($catResult)) {
+
+ $cat_id = intval($cat['catid']);
+ $Link = createCategoryLink($cat_id);
+ $catLoc =$this->_prepareLink($SelfURL, $Link);
+
+ if (end($path_arr) != 'ror.xml') {
+ $sitemap[] = array(
+ 'loc' => $catLoc,
+ 'priority' => '1.0',
+ 'changefreq' => 'daily'
+ );
+ }
+
if ($mcategories) {
- $subrequest = $mcategories->getRequestName();
- $scat_query = 'SELECT * FROM %s WHERE catid = %d ORDER BY scatid';
- $scat_res = sql_query(sprintf($scat_query, sql_table('plug_multiple_categories_sub'), $cat['catid']));
- while ($scat = mysql_fetch_array($scat_res)) {
- $sitemap[] = array(
- 'loc' => $this->_prepareLink($SelfURL, createCategoryLink($cat['catid'], array($subrequest => $scat['scatid']))),
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
+ $scatQuery = 'SELECT * '
+ . 'FROM %s '
+ . 'WHERE catid = %d '
+// . 'ORDER BY scatid';
+ . 'ORDER BY ordid';
+ $scatTable = sql_table('plug_multiple_categories_sub');
+ $scatQuery = sprintf($scatQuery, $scatTable, $cat_id);
+ $scatResult = sql_query($scatQuery);
+
+ while ($scat = mysql_fetch_array($scatResult)) {
+
+ $scat_id = intval($scat['scatid']);
+ $params = array($subReq => $scat_id);
+ $Link = createCategoryLink($cat_id, $params);
+ $scatLoc = $this->_prepareLink($SelfURL, $Link);
+
+ if (end($path_arr) != 'ror.xml') {
+ $sitemap[] = array(
+ 'loc' => $scatLoc,
+ 'priority' => '1.0',
+ 'changefreq' => 'daily'
+ );
+ }
+
}
+
}
+
}
-
- $item_query = 'SELECT *, UNIX_TIMESTAMP(itime) AS timestamp FROM %s WHERE iblog = %d AND idraft = 0 ORDER BY inumber DESC';
- $item_res = sql_query(sprintf($item_query, sql_table('item'), $blog_id));
-
- while ($item = mysql_fetch_array($item_res)) {
- $tz = date('O', $item['timestamp']);
- $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
-
- if (time() - $item['timestamp'] < 86400 * 2) {
+
+ $itemQuery = 'SELECT *, '
+ . ' UNIX_TIMESTAMP(itime) AS timestamp '
+ . 'FROM %s '
+ . 'WHERE iblog = %d '
+ . 'AND idraft = 0 '
+ . 'ORDER BY itime DESC';
+ $itemTable = sql_table('item');
+ $itemQuery = sprintf($itemQuery, $itemTable, $blog_id);
+ $itemResult = sql_query($itemQuery);
+ while ($item = mysql_fetch_array($itemResult)) {
+
+ $item_id = intval($item['inumber']);
+ $Link = createItemLink($item_id);
+ $tz = date('O', $item['timestamp']);
+ $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
+ $itemLoc = $this->_prepareLink($SelfURL, $Link);
+
+ $mdQuery = 'SELECT'
+ . ' UNIX_TIMESTAMP(ctime) AS timestamp'
+ . ' FROM '
+ . sql_table('comment')
+ . ' WHERE'
+ . ' citem = ' . $item_id
+ . ' ORDER BY'
+ . ' ctime DESC'
+ . ' LIMIT'
+ . ' 1';
+ $modTime = sql_query($mdQuery);
+ if (mysql_num_rows($modTime) > 0) {
+ $lastMod = mysql_fetch_object($modTime);
+ $itemTime = $lastMod->timestamp;
+ } elseif ($npUpdateTime) { // NP_UpdateTime exists
+ $mdQuery = 'SELECT'
+ . ' UNIX_TIMESTAMP(ctime) AS timestamp'
+ . ' FROM '
+ . sql_table('plugin_rectime')
+ . ' WHERE'
+ . ' up_id = ' . $item_id;
+ $modTime = sql_query($mdQuery);
+ if (mysql_num_rows($modTime) > 0) {
+ $lastMod = mysql_fetch_object($modTime);
+ $itemTime = $lastMod->timestamp;
+ }
+ } else {
+ $itemTime = $item['timestamp'];
+ }
+
+/* if (time() - $itemTime < 86400 * 2) {
$fq = 'hourly';
- } elseif (time() - $item['timestamp'] < 86400 * 14) {
+ } elseif (time() - $itemTime < 86400 * 14) {
$fq = 'daily';
- } elseif (time() - $item['timestamp'] < 86400 * 62) {
+ } elseif (time() - $itemTime < 86400 * 62) {
$fq = 'weekly';
} else {
$fq = 'monthly';
+ }*/
+ if ($itemTime < strtotime('-1 month')) {
+ $fq = 'monthly';
+ } elseif ($itemTime < strtotime('-1 week')) {
+ $fq = 'weekly';
+ } elseif ($itemTime < strtotime('-1 day')) {
+ $fq = 'daily';
+ } else {
+ $fq = 'hourly';
}
- $sitemap[] = array(
- 'loc' => $this->_prepareLink($SelfURL, createItemLink($item['inumber'])),
- 'lastmod' => gmdate('Y-m-d\TH:i:s', $item['timestamp']) . $tz,
- 'priority' => '1.0',
- 'changefreq' => $fq
- );
+ $lastmod = gmdate('Y-m-d\TH:i:s', $itemTime) . $tz;
+
+ if (end($path_arr) != 'ror.xml') {
+ $sitemap[] = array(
+ 'loc' => $itemLoc,
+ 'lastmod' => $lastmod,
+ 'priority' => '1.0',
+ 'changefreq' => $fq
+ );
+ } else {
+ $iTitle = $item['ititle'];
+ if (_CHARSET != 'UTF-8') {
+ $iTitle = mb_conbert_encoding($iTitle, 'UTF-8', _CHARSET);
+ }
+ $sitemap[] = array(
+ 'title' => $iTitle,
+ 'link' => $itemLoc,
+ 'ror:updated' => $lastmod,
+ 'ror:updatePeriod' => 'day',
+ 'ror:sortOrder' => '0',
+ 'ror:resourceOf' => 'sitemap',
+ );
+ }
+
}
+
}
+
+ }
+
+ if ($CONF['URLMode'] != $URLMode) {
+ $CONF['URLMode'] = $URLMode;
}
+
}
-
+
$manager->notify('SiteMap', array ('sitemap' => & $sitemap));
-
+
header ("Content-type: application/xml");
- echo "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n";
- echo "\t<urlset" . ' xmlns="http://www.google.com/schemas/sitemap/0.84"' . "\n";
- echo "\t" . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
- echo "\t" . 'xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . "\n";
- echo "\t" . ' http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . "\n";
-
- while (list(,$url) = each($sitemap)) {
- echo "\t<url>\n";
-
- while (list($key,$value) = each($url)) {
+
+ if (end($path_arr) == 'ror.xml') {
+
+ // ror sitemap feed
+ $sitemapHeader ="<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
+ . "<!-- This file is a ROR Sitemap for describing this website to the search engines. "
+ . "For details about the ROR format, go to www.rorweb.com. -->\n"
+ . '<rss version="2.0" xmlns:ror="http://rorweb.com/0.1/" >' . "\n"
+ . "<channel>\n";
+
+ } else {
+
+ // old Google sitemap protocol ver.0.84
+// $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n";
+// . "\t<urlset" . ' xmlns="http://www.google.com/schemas/sitemap/0.84"' . "\n";
+// . "\t" . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
+// . "\t" . 'xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . "\n";
+// . "\t" . ' http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . "\n";
+
+ // new sitemap common protocol ver 0.9
+ $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
+ . '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n"
+ . ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n"
+ . ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"' . "\n"
+ . ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
+ // uncomment and edit next line when you need "example_schema"
+// $sitemapHeader .= ' xmlns:example="http://www.example.com/schemas/example_schema"';
+ $sitemapHeader .= '>';
+
+ }
+
+ echo $sitemapHeader;
+ if (end($path_arr) == 'ror.xml') {
+ echo $sitemapTitle;
+ }
+
+ while (list(, $url) = each($sitemap)) {
+
+ if (end($path_arr) == 'ror.xml') {
+ echo "\t<item>\n";
+ } else {
+ echo "\t<url>\n";
+ }
+
+ while (list($key, $value) = each($url)) {
if ($key == 'loc') {
$value = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $value);
- echo "\t\t<" . $key . ">" . htmlspecialchars($value, ENT_QUOTES) . "</" . $key . ">\n";
+ $data = "\t\t<" . $key . ">"
+ . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
+ . "</" . $key . ">\n";
} else {
- echo "\t\t<" . $key . ">" . htmlspecialchars($value, ENT_QUOTES) . "</" . $key . ">\n";
+ $data = "\t\t<" . $key . ">"
+ . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
+ . "</" . $key . ">\n";
}
+ echo $data;
}
-
- echo "\t</url>\n";
+
+ if (end($path_arr) == 'ror.xml') {
+ echo "\t</item>\n";
+ } else {
+ echo "\t</url>\n";
+ }
+
}
-
- echo "</urlset>\n";
+
+ if (end($path_arr) == 'ror.xml') {
+ echo "</channel>\n</rss>\n";
+ } else {
+ echo "</urlset>\n";
+ }
+// echo "</urlset>\n";
exit;
+
}
}
function pluginCheck($pluginName)
{
global $manager;
- if (!$manager->pluginInstalled('NP_'.$pluginName)) return;
- $plugin =& $manager->getPlugin('NP_'.$pluginName);
- return $plugin;
+ if (!$manager->pluginInstalled('NP_' . $pluginName)) {
+ return;
+ } else {
+ $plugin =& $manager->getPlugin('NP_' . $pluginName);
+ return $plugin;
+ }
}
function _prepareLink($base, $url) {
- if (substr($url, 0, 7) == 'http://')
+ if (substr($url, 0, 7) == 'http://') {
return $url;
- else
+ } else {
return $base . $url;
+ }
}
function event_PostAddItem(&$data)
{
global $manager, $CONF;
- $blog_id = getBlogIDFromItemID($data['itemid']);
- if ($this->getOption('PingGoogle') == 'yes') {
- $b =& $manager->getBlog($blog_id);
- $b_url = $b->getURL();
+ $item_id = intval($data['itemid']);
+ $blog_id = intval(getBlogIDFromItemID($item_id));
+
+ if ($this->getBlogOption($blog_id, 'PingGoogle') == 'yes') {
+
+ $b =& $manager->getBlog($blog_id);
+ $b_url = $b->getURL();
+
+ if (substr($b_url, -4) == '.php') $CONF['URLMode'] = 'normal';
$usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-/* if (substr($b_url, -1) == '/') {
- $b_url = ($usePathInfo) ? substr($b_url, 0, -1) : $b_url . 'index.php';
+ if (substr($b_url, -1) == '/') {
+ if (!$usePathInfo) {
+ $b_url .= 'index.php?virtualpath=';
+ }
+ } elseif (substr($b_url, -4) == '.php') {
+ $b_url .= '?virtualpath=';
} else {
- $b_url = (substr($b_url, -4) == '.php') ? $b_url : $b_url . '/index.php';
+ if ($usePathInfo) {
+ $b_url = $b_url . '/';
+ } else {
+ $b_url = $b_url . '/index.php?virtualpath=';
+ }
}
-// if (substr($b_url, -1) != '/' && substr($b_url, -4) != '.php') {
-// $b_url .= '/';
-// } elseif (substr($b_url, -4) == '.php') {
-// $b_url .= '?virtualpath=';
-// }*/
+
$siteMap = $this->getBlogOption($blog_id, 'PcSitemap');
- $url = 'http://www.google.com/webmasters/sitemaps/ping?sitemap=' .
- urlencode($b_url . $siteMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
+ $url = 'http://www.google.com/webmasters/sitemaps/ping?sitemap='
+ . urlencode($b_url . $siteMap);
+ $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
+ $fp = @fopen($url, 'r');
@fclose($fp);
$MobileMap = $this->getBlogOption($blog_id, 'MobileSitemap');
if (!empty($MobileMap)) {
- $url = 'http://www.google.com/webmasters/sitemaps/ping?sitemap=' .
- urlencode($b_url . $MobileMap);
+ $url = 'http://www.google.com/webmasters/sitemaps/ping?sitemap='
+ . urlencode($b_url . $MobileMap);
$url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
+ $fp = @fopen($url, 'r');
@fclose($fp);
}
}
}
+ function init()
+ {
+ global $admin;
+ $language = ereg_replace( '[\\|/]', '', getLanguageName());
+ if (file_exists($this->getDirectory() . $language.'.php')) {
+ include_once($this->getDirectory() . $language.'.php');
+ }else {
+ include_once($this->getDirectory() . 'english.php');
+ }
+ }
+
function install()
{
- $this->createOption('PingGoogle', 'Ping Google after adding a new item', 'yesno', 'yes');
- $this->createOption('AllBlogMap', 'Generate All Blog\'s Google Sitemap', 'yesno', 'yes');
- $this->createBlogOption('IncludeSitemap', 'Include this blog in Google Sitemap when All Blog mode', 'yesno', 'yes');
- $this->createBlogOption('PcSitemap', 'Virtual file name for PC Sitemap', 'text', 'testmap.xml');
- $this->createBlogOption('MobileSitemap', 'Virtual file name for Mobile Sitemap', 'text', '');
+ $this->createOption('AllBlogMap', _G_SITEMAP_ALLB, 'yesno', 'yes');
+ $this->createBlogOption('PingGoogle', _G_SITEMAP_PING, 'yesno', 'yes');
+ $this->createBlogOption('IncludeSitemap', _G_SITEMAP_INC, 'yesno', 'yes');
+ $this->createBlogOption('PcSitemap', _G_SITEMAP_PCSM, 'text', 'sitemap.xml');
+ $this->createBlogOption('MobileSitemap', _G_SITEMAP_MBSM, 'text', '');
}
}
-?>
\ No newline at end of file