mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
Compare commits
No commits in common. "81b8d870a453abad0858859113bd07dcf42a4447" and "7370c85dae9963eb52d097a4e020c7b25a7cc889" have entirely different histories.
81b8d870a4
...
7370c85dae
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1 @@
|
||||
.DS_Store
|
||||
/vendor
|
||||
/public
|
||||
/composer.lock
|
||||
|
69
.scrutinizer.yml
Normal file
69
.scrutinizer.yml
Normal file
@ -0,0 +1,69 @@
|
||||
inherit: true
|
||||
|
||||
checks:
|
||||
php:
|
||||
verify_property_names: true
|
||||
verify_argument_usable_as_reference: true
|
||||
verify_access_scope_valid: true
|
||||
useless_calls: true
|
||||
use_statement_alias_conflict: true
|
||||
variable_existence: true
|
||||
unused_variables: true
|
||||
unused_properties: true
|
||||
unused_parameters: true
|
||||
unused_methods: true
|
||||
unreachable_code: true
|
||||
too_many_arguments: true
|
||||
sql_injection_vulnerabilities: true
|
||||
simplify_boolean_return: true
|
||||
side_effects_or_types: true
|
||||
security_vulnerabilities: true
|
||||
return_doc_comments: true
|
||||
return_doc_comment_if_not_inferrable: true
|
||||
require_scope_for_properties: true
|
||||
require_scope_for_methods: true
|
||||
require_php_tag_first: true
|
||||
psr2_switch_declaration: true
|
||||
psr2_class_declaration: true
|
||||
property_assignments: true
|
||||
prefer_while_loop_over_for_loop: true
|
||||
precedence_mistakes: true
|
||||
precedence_in_conditions: true
|
||||
phpunit_assertions: true
|
||||
php5_style_constructor: true
|
||||
parse_doc_comments: true
|
||||
parameter_non_unique: true
|
||||
parameter_doc_comments: true
|
||||
param_doc_comment_if_not_inferrable: true
|
||||
optional_parameters_at_the_end: true
|
||||
one_class_per_file: true
|
||||
no_unnecessary_if: true
|
||||
no_trailing_whitespace: true
|
||||
no_property_on_interface: true
|
||||
no_non_implemented_abstract_methods: true
|
||||
no_error_suppression: true
|
||||
no_duplicate_arguments: true
|
||||
no_commented_out_code: true
|
||||
newline_at_end_of_file: true
|
||||
missing_arguments: true
|
||||
method_calls_on_non_object: true
|
||||
instanceof_class_exists: true
|
||||
foreach_traversable: true
|
||||
fix_line_ending: true
|
||||
fix_doc_comments: true
|
||||
duplication: true
|
||||
deprecated_code_usage: true
|
||||
deadlock_detection_in_loops: true
|
||||
code_rating: true
|
||||
closure_use_not_conflicting: true
|
||||
catch_class_exists: true
|
||||
blank_line_after_namespace_declaration: false
|
||||
avoid_multiple_statements_on_same_line: true
|
||||
avoid_duplicate_types: true
|
||||
avoid_conflicting_incrementers: true
|
||||
avoid_closing_tag: true
|
||||
assignment_of_null_return: true
|
||||
argument_type_checks: true
|
||||
|
||||
filter:
|
||||
paths: [code/*, tests/*]
|
29
CHANGELOG.md
Normal file
29
CHANGELOG.md
Normal file
@ -0,0 +1,29 @@
|
||||
# Changelog
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
Older releases can be found on Github.
|
||||
|
||||
## 2.1.7
|
||||
|
||||
- Adds legacy file for migration from Silverstripe 3
|
||||
|
||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.6...2.1.7
|
||||
|
||||
## 2.1.6
|
||||
|
||||
- Fixes incorrect priority calculations
|
||||
|
||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.5...2.1.6
|
||||
|
||||
## 2.1.5
|
||||
|
||||
- FIX: enable stream context to pass through CWP egres proxy, fixes #156
|
||||
|
||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.4...2.1.5
|
||||
|
||||
## 2.1.4
|
||||
|
||||
- Fixes extending alterSiteMap to support falsey values
|
||||
|
||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.3...2.1.4
|
@ -12,10 +12,6 @@
|
||||
|
||||
> composer require "wilr/silverstripe-googlesitemaps"
|
||||
|
||||
If you're using Silverstripe 5 then version 3 or `dev-main` will work.
|
||||
|
||||
For Silverstripe 4 use the `2.x` branch line.
|
||||
|
||||
## Documentation
|
||||
|
||||
Provides support for the [Sitemaps XML Protocol](http://www.sitemaps.org/protocol.html),
|
||||
|
@ -4,8 +4,9 @@ namespace Wilr\GoogleSitemaps\Control;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Control\HTTPResponse;
|
||||
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
||||
use Wilr\GoogleSitemaps\GoogleSitemap;
|
||||
use SilverStripe\View\ArrayData;
|
||||
|
||||
@ -51,7 +52,7 @@ class GoogleSitemapController extends Controller
|
||||
$this->extend('updateGoogleSitemaps', $sitemaps);
|
||||
|
||||
return $this->customise(new ArrayData([
|
||||
'Sitemaps' => $sitemaps,
|
||||
'Sitemaps' => $sitemaps
|
||||
]))->renderWith(__CLASS__);
|
||||
} else {
|
||||
return new HTTPResponse('Page not found', 404);
|
||||
@ -75,8 +76,7 @@ class GoogleSitemapController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
GoogleSitemap::enabled()
|
||||
if (GoogleSitemap::enabled()
|
||||
&& $class
|
||||
&& ($page > 0)
|
||||
&& ($class == SiteTree::class || $class == 'GoogleSitemapRoute' || GoogleSitemap::is_registered($class))
|
||||
@ -129,10 +129,4 @@ class GoogleSitemapController extends Controller
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
public function AbsoluteLink($action = null)
|
||||
{
|
||||
return Controller::join_links(Director::absoluteBaseURL(), 'sitemap.xml', $action);
|
||||
}
|
||||
}
|
||||
|
@ -66,10 +66,6 @@ class GoogleSitemapExtension extends DataExtension
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($can) && isset($can[0])) {
|
||||
return $can[0];
|
||||
}
|
||||
|
||||
return $can;
|
||||
}
|
||||
|
||||
|
@ -104,10 +104,6 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension
|
||||
$result = parent::canIncludeInGoogleSitemap();
|
||||
$result = ($this->owner instanceof ErrorPage) ? false : $result;
|
||||
|
||||
if (is_array($result) && isset($result[0])) {
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type='text/xsl' href='{$AbsoluteLink('styleSheetIndex')}'?>
|
||||
<?xml-stylesheet type='text/xsl' href='{$AbsoluteBaseURL}/sitemap.xml/styleSheetIndex'?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><% loop Sitemaps %>
|
||||
<sitemap>
|
||||
<loc>{$AbsoluteLink('sitemap')}/{$ClassName}/{$Page.xml}</loc>
|
||||
<% if $LastModified %><lastmod>{$LastModified}</lastmod><% end_if %>
|
||||
<loc>{$AbsoluteBaseURL}/sitemap.xml/sitemap/$ClassName/$Page.xml</loc>
|
||||
<% if $LastModified %><lastmod>$LastModified</lastmod><% end_if %>
|
||||
</sitemap><% end_loop %>
|
||||
</sitemapindex>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type='text/xsl' href='{$AbsoluteLink('styleSheet')}'?>
|
||||
<?xml-stylesheet type='text/xsl' href='{$AbsoluteBaseURL}/sitemap.xml/styleSheet'?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
|
||||
<% loop $Items %>
|
||||
<url>
|
||||
<loc>{$AbsoluteLink}</loc>
|
||||
<% if $LastEdited %><lastmod>{$LastEdited.Rfc3339()}</lastmod><% end_if %>
|
||||
<loc>$AbsoluteLink</loc>
|
||||
<% if $LastEdited %><lastmod>$LastEdited.Rfc3339()</lastmod><% end_if %>
|
||||
<% if $ChangeFrequency %><changefreq>$ChangeFrequency</changefreq><% end_if %>
|
||||
<% if $GooglePriority %><priority>$GooglePriority</priority><% end_if %>
|
||||
<% if $ImagesForSitemap %><% loop $ImagesForSitemap %>
|
||||
|
@ -4,6 +4,7 @@ namespace Wilr\GoogleSitemaps\Tests;
|
||||
|
||||
use Exception;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Forms\DropdownField;
|
||||
@ -24,8 +25,6 @@ class GoogleSitemapTest extends FunctionalTest
|
||||
'GoogleSitemapPageTest.yml',
|
||||
];
|
||||
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected static $extra_dataobjects = [
|
||||
TestDataObject::class,
|
||||
OtherDataObject::class,
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type='text/xsl' href='http://localhost/sitemap.xml/styleSheetIndex'?>
|
||||
<?xml-stylesheet type='text/xsl' href='http://localhostsitemap.xml/styleSheetIndex'?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap>
|
||||
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
||||
<lastmod>2023-02-13</lastmod>
|
||||
</sitemap>
|
||||
<sitemap>
|
||||
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-OtherDataObject/1</loc>
|
||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-OtherDataObject/1</loc>
|
||||
<lastmod>2023-02-13</lastmod>
|
||||
</sitemap>
|
||||
</sitemapindex>
|
||||
|
@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type='text/xsl' href='http://localhost/sitemap.xml/styleSheetIndex'?>
|
||||
<?xml-stylesheet type='text/xsl' href='http://localhostsitemap.xml/styleSheetIndex'?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap>
|
||||
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
||||
<lastmod>2023-02-13</lastmod>
|
||||
</sitemap>
|
||||
<sitemap>
|
||||
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/2</loc>
|
||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/2</loc>
|
||||
<lastmod>2023-02-13</lastmod>
|
||||
</sitemap>
|
||||
<sitemap>
|
||||
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/3</loc>
|
||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/3</loc>
|
||||
<lastmod>2023-02-13</lastmod>
|
||||
</sitemap>
|
||||
</sitemapindex>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type='text/xsl' href='http://localhost/sitemap.xml/styleSheetIndex'?>
|
||||
<?xml-stylesheet type='text/xsl' href='http://localhostsitemap.xml/styleSheetIndex'?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap>
|
||||
<loc>http://localhost/sitemap.xml/sitemap/GoogleSitemapRoute/1</loc>
|
||||
<loc>http://localhostsitemap.xml/sitemap/GoogleSitemapRoute/1</loc>
|
||||
</sitemap>
|
||||
</sitemapindex>
|
||||
|
Loading…
Reference in New Issue
Block a user