Commit 6b296287 authored by Mike Rockétt's avatar Mike Rockétt

0.3.2 RC

- fixed version check
- other small fixes
parent 3f2ca8d4
{
"title": "Sitemap",
"version": "0.3.1",
"version": "0.3.2",
"author": "Mike Rockett",
"summary": "Renders a sitemap for your ProcessWire powered site. Supports multi-language, multi-site, and image sub-elements. Adapted from MarkupSitemapXML.",
"href": "http://github.com/rockettpw/markup-sitemap",
"hrefsupport": "https://processwire.com/talk/topic/17068-markupsitemap/",
"license": "MIT",
"hreflicense": "http://mit-license.org/",
"requires": "ProcessWire>=2.8.0, PHP>=5.6.0",
"requires": "ProcessWire>=2.8.16, PHP>=5.6.0",
"permanent": false,
"autoload": true,
"singular": true
......
......@@ -10,6 +10,7 @@
* @license MIT
*/
// Require the classloader
require_once __DIR__ . '/ClassLoader.php';
use Rockett\Traits\BuilderTrait as BuildsSitemap;
......@@ -53,15 +54,15 @@ class MarkupSitemap extends WireData implements Module
/**
* Module installer
* Requires ProcessWire 2.8.16+/3.0.16+ (saveConfig; getConfig)
* @throws WireException
*/
public function ___install()
{
// Requires ProcessWire 2/3.0.16 (saveConfig; getConfig)
if (in_array(ProcessWire::versionMajor, [2, 3]) &&
ProcessWire::versionMinor === 0 &&
ProcessWire::versionRevision < 16) {
throw new WireException('MarkupSitemap requires at least ProcessWire ' . ProcessWire::versionMajor . '.0.16 to run.');
$processWireVersion = $this->config->version;
$applicableMajorMinor = ProcessWire::versionMajor === 2 ? '2.8' : '3.0';
if (version_compare($processWireVersion, "{$applicableMajorMinor}.16") < 0) {
throw new WireException("Requires ProcessWire {$applicableMajorMinor}.16+ to run.");
}
}
......@@ -71,6 +72,7 @@ class MarkupSitemap extends WireData implements Module
*/
public function __construct()
{
// Set the request URI
$this->requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
}
......@@ -335,7 +337,11 @@ class MarkupSitemap extends WireData implements Module
*/
protected function getRootPageUri()
{
return (string) str_ireplace(trim($this->config->urls->root, '/'), '', $this->sanitizer->path(dirname($this->requestUri)));
return (string) str_ireplace(
trim($this->config->urls->root, '/'),
'',
$this->sanitizer->path(dirname($this->requestUri))
);
}
/**
......
......@@ -61,7 +61,7 @@ class MarkupSitemapConfig extends ModuleConfig
'name+id' => 'sitemap_include_templates',
'label' => 'Templates with sitemap options',
'description' => $this->_('Select which templates (and, therefore, all pages assigned to those templates) can have individual sitemap options. These options (shown in the Settings tab of the page editor) allow you to set which pages and, optionally, their children should be excluded from the sitemap when it is rendered; define which page’s images should not be included in the sitemap (provided that image fields have been added below); and, lastly, set an optional priority for each page.'),
'notes' => $this->_("**Removal/Restoration:** Removing a template from this list will not delete any page options applicable to it. However, they will also not be read when rendering the sitemap. As such, when restoring a template to this list after having removed it, any previous options saved for a page that uses this template will be used when rendering the sitemap. The only time sitemap options are deleted is when either the page in question is completely deleted after having been trashed, or when the module is uninstalled.\n\n**A note about the home Page: ** This page cannot be excluded from the sitemap. As such, the applicable exclusion options will not be available when editing it."),
'notes' => $this->_("**Removal/Restoration:** Removing a template from this list will not delete any page options applicable to it. However, they will also not be read when rendering the sitemap. As such, when restoring a template to this list after having removed it, any previous options saved for a page that uses this template will be used when rendering the sitemap. The only time sitemap options are deleted is when either the page in question is completely deleted after having been trashed, or when the module is uninstalled.\n\n**A note about the home page: ** This page cannot be excluded from the sitemap. As such, the applicable exclusion options will not be available when editing it."),
'icon' => 'cubes',
]);
foreach ($templates as $template) {
......
......@@ -76,9 +76,11 @@ class Urlset implements OutputContract
$XMLWriter->writeAttribute('xmlns:xsi', 'https://www.w3.org/2001/XMLSchema-instance');
$XMLWriter->writeAttribute('xsi:schemaLocation',
$XMLWriter->writeAttribute(
'xsi:schemaLocation',
'http://www.sitemaps.org/schemas/sitemap/0.9 ' .
'https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd');
'https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd'
);
$XMLWriter->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
......
......@@ -118,7 +118,7 @@ trait BuilderTrait
if ($this->sitemap_include_templates !== null
&& !in_array($page->template->name, $this->sitemap_include_templates)
&& is_array($pageSitemapOptions)) {
array_walk_recursive($pageSitemapOptions, function(&$value) {
array_walk_recursive($pageSitemapOptions, function (&$value) {
$value = false;
});
}
......
......@@ -35,7 +35,8 @@ trait DebugTrait
array_map(
function ($mixed) {
var_dump($mixed);
}, func_get_args()
},
func_get_args()
);
return true;
}
......@@ -96,7 +97,8 @@ trait DebugTrait
array_map(
function ($mixed) {
print_r($mixed);
}, func_get_args()
},
func_get_args()
);
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment