Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Commit

Permalink
remove dolphiq
Browse files Browse the repository at this point in the history
  • Loading branch information
HOMMinteractive committed Nov 12, 2019
1 parent 6a23c7e commit b599f25
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 56 deletions.
16 changes: 7 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "homm/hommsitemap",
"description": "Craft 3 plugin that provides an easy way to provide and manage a XML sitemap for search engines like Google and Bing",
"type": "craft-plugin",
"version": "1.0.9",
"version": "1.1.1",
"keywords": [
"craft",
"cms",
Expand All @@ -16,9 +16,9 @@
"license": "MIT",
"authors": [
{
"name": "Dolphiq",
"email": "[email protected]",
"homepage": "https://dolphiq.nl/"
"name": "Homm",
"email": "[email protected]",
"homepage": "https://homm.ch/"
}
],
"require": {
Expand All @@ -39,16 +39,14 @@
"extra": {
"name": "XML Sitemap Homm",
"handle": "sitemap",
"schemaVersion": "1.0.2",
"developer": "Dolphiq",
"developerUrl": "https://dolphiq.nl/",
"schemaVersion": "1.1.1",
"developer": "Homm",
"developerUrl": "https://homm.ch/",
"hasCpSettings": true,
"hasCpSection": false,
"components": {
"sitemapService": "homm\\hommsitemap\\services\\SitemapService"
},
"documentationUrl": "https://github.com/Dolphiq/craft3-plugin-sitemap/blob/master/README.md",
"changelogUrl": "https://github.com/Dolphiq/craft3-plugin-sitemap/blob/master/CHANGELOG.md",

"class": "homm\\hommsitemap\\Sitemap"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down Expand Up @@ -59,7 +59,7 @@ class Sitemap extends Plugin
public $hasCpSettings = true;

// table schema version
public $schemaVersion = '1.0.2';
public $schemaVersion = '1.1.1';

/**
* Return the settings response (if some one clicks on the settings/plugin icon)
Expand Down
2 changes: 1 addition & 1 deletion src/assetbundles/indexcpsection/IndexCPSectionAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/assetbundles/sitemap/SitemapAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
63 changes: 29 additions & 34 deletions src/controllers/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down Expand Up @@ -47,8 +47,7 @@ class SitemapController extends Controller
private $_sourceRouteParams = [];
protected $allowAnonymous = ['index'];
// Public Methods
// =========================================================================

// =========================================================================

/**
* @inheritdoc
Expand All @@ -71,7 +70,6 @@ private function getUrl($uri, $siteId)
*/
public function actionIndex()
{

try {
// try to register the searchengine visit
$CrawlerDetect = new CrawlerDetect;
Expand All @@ -84,7 +82,6 @@ public function actionIndex()
$visit->save();
}
} catch (\Exception $err) {

}
Craft::$app->response->format = \yii\web\Response::FORMAT_RAW;
$headers = Craft::$app->response->headers;
Expand All @@ -102,38 +99,40 @@ public function actionIndex()
$dom->appendChild($urlset);

foreach ($this->_createEntrySectionQuery()->all() as $item) {

$entries = \craft\elements\Entry::find()
->id($item['elementId'])
->one();


if ($entries) {
$entry = $entries->getAttributes(['seoIndexierung']);
$weiterleitung = $entries->getAttributes(['navigationAlsWeiterleitung']);

if ($entry['seoIndexierung']) {
$loc = $this->getUrl($item['uri'], $item['siteId']);
if ($loc === null) continue;

$url = $dom->createElement('url');
$urlset->appendChild($url);

$url->appendChild($dom->createElement('loc', $loc));
$url->appendChild($dom->createElement('priority', $item['priority']));
$url->appendChild($dom->createElement('changefreq', $item['changefreq']));
$dateUpdated = strtotime($item['dateUpdated']);
$url->appendChild($dom->createElement('lastmod', date('Y-m-d\TH:i:sP', $dateUpdated)));
if ($item['alternateLinkCount'] > 1) {
$alternateLinks = $this->_createAlternateSectionQuery($item['elementId'])->all();
if (count($alternateLinks) > 0) {
foreach ($alternateLinks as $alternateItem) {
$alternateLoc = $this->getUrl($alternateItem['uri'], $alternateItem['siteId']);
if ($alternateLoc === null) continue;

$alternateLink = $dom->createElementNS('http://www.w3.org/1999/xhtml', 'xhtml:link');
$alternateLink->setAttribute('rel', 'alternate');
$alternateLink->setAttribute('hreflang', strtolower($alternateItem['siteLanguate']));
$alternateLink->setAttribute('href', $alternateLoc);
$url->appendChild($alternateLink);
if ($weiterleitung['navigationAlsWeiterleitung'] == '') {
$loc = $this->getUrl($item['uri'], $item['siteId']);
if ($loc === null) continue;

$url = $dom->createElement('url');
$urlset->appendChild($url);

$url->appendChild($dom->createElement('loc', $loc));
$url->appendChild($dom->createElement('priority', $item['priority']));
$url->appendChild($dom->createElement('changefreq', $item['changefreq']));
$dateUpdated = strtotime($item['dateUpdated']);
$url->appendChild($dom->createElement('lastmod', date('Y-m-d\TH:i:sP', $dateUpdated)));
if ($item['alternateLinkCount'] > 1) {
$alternateLinks = $this->_createAlternateSectionQuery($item['elementId'])->all();
if (count($alternateLinks) > 0) {
foreach ($alternateLinks as $alternateItem) {
$alternateLoc = $this->getUrl($alternateItem['uri'], $alternateItem['siteId']);
if ($alternateLoc === null) continue;

$alternateLink = $dom->createElementNS('http://www.w3.org/1999/xhtml', 'xhtml:link');
$alternateLink->setAttribute('rel', 'alternate');
$alternateLink->setAttribute('hreflang', strtolower($alternateItem['siteLanguate']));
$alternateLink->setAttribute('href', $alternateLoc);
$url->appendChild($alternateLink);
}
}
}
}
Expand All @@ -152,15 +151,12 @@ public function actionIndex()
$url->appendChild($dom->createElement('changefreq', $item['changefreq']));
$dateUpdated = strtotime($item['dateUpdated']);
$url->appendChild($dom->createElement('lastmod', date('Y-m-d\TH:i:sP', $dateUpdated)));


}
return $dom->saveXML();
}

private function _createEntrySectionQuery(): Query
{

$subQuery = (new Query())
->select('COUNT(DISTINCT other_elements_sites.id)')
->from('{{%elements_sites}} other_elements_sites')
Expand All @@ -176,7 +172,6 @@ private function _createEntrySectionQuery(): Query
'elements.id elementId',
'alternateLinkCount' => $subQuery,


])
->from(['{{%sections}} sections'])
->innerJoin('{{%homm_sitemap_entries}} sitemap_entries', '[[sections.id]] = [[sitemap_entries.linkId]] AND [[sitemap_entries.type]] = "section"')
Expand Down
2 changes: 1 addition & 1 deletion src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/records/SitemapCrawlerVisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/records/SitemapEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/services/SitemapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down
2 changes: 1 addition & 1 deletion src/templates/settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author Johan Zandstra
* @copyright Copyright (c) 2017 Johan Zandstra
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @package Sitemap
* @since 1.0.0
*/
Expand Down
2 changes: 1 addition & 1 deletion src/translations/en/sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Craft 3 plugin that provides an easy way to enable and manage a xml sitemap for search engines like Google
*
* @link https://github.com/Dolphiq/craft3-plugin-sitemap
* @link https://github.com/HOMMinteractive/hommsitemap
* @copyright Copyright (c) 2017 Johan Zandstra
*/

Expand Down

0 comments on commit b599f25

Please sign in to comment.