Skip to content

Commit

Permalink
Merge branch 'release/3.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Oct 14, 2023
2 parents d0ca705 + c363ec6 commit 8927e42
Show file tree
Hide file tree
Showing 52 changed files with 127 additions and 701 deletions.
32 changes: 0 additions & 32 deletions .codeclimate.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 3.3.4 - 2023-10-14
### Fixed
- Fixed an an error where deleted sections were still shown in the sitemap settings ([#82](https://github.com/studioespresso/craft-seo-fields/issues/82))


## 3.3.3 - 2023-09-18
### Fixed
- Fixed an error when using a custom meta template ([#81](https://github.com/studioespresso/craft-seo-fields/issues/81))
Expand Down
24 changes: 0 additions & 24 deletions codeception.yml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "studioespresso/craft-seo-fields",
"description": "Fields for your SEO & OG meta data",
"type": "craft-plugin",
"version": "3.3.3",
"version": "3.3.4",
"keywords": [
"craft",
"cms",
Expand Down
6 changes: 0 additions & 6 deletions phpstan.neon

This file was deleted.

42 changes: 19 additions & 23 deletions src/SeoFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use Craft;
use craft\base\Plugin;
use craft\db\Query;
use craft\events\ElementEvent;
use craft\events\EntryTypeEvent;
use craft\events\ExceptionEvent;
Expand Down Expand Up @@ -42,7 +41,6 @@
use studioespresso\seofields\services\RedirectService;
use studioespresso\seofields\services\RenderService;
use studioespresso\seofields\services\SitemapService;
use studioespresso\seofields\variables\SeoFieldsVariable;
use yii\base\Event;
use yii\base\Exception;
use yii\console\Application as ConsoleApplication;
Expand Down Expand Up @@ -102,7 +100,7 @@ public function init()
$this->controllerNamespace = 'studioespresso\seofields\console\controllers';
}

Craft::$app->view->hook('seo-fields', function (array &$context) {
Craft::$app->view->hook('seo-fields', function(array &$context) {
return $this->renderService->renderMeta($context);
});

Expand Down Expand Up @@ -174,7 +172,7 @@ protected function settingsHtml(): string
return Craft::$app->view->renderTemplate(
'seo-fields/_settings',
[
'settings' => $this->getSettings()
'settings' => $this->getSettings(),
]
);
}
Expand All @@ -192,7 +190,7 @@ private function _registerField()
Event::on(
Fields::class,
Fields::EVENT_REGISTER_FIELD_TYPES,
function (RegisterComponentTypesEvent $event) {
function(RegisterComponentTypesEvent $event) {
$event->types[] = SeoField::class;
}
);
Expand All @@ -203,7 +201,7 @@ private function _registerPermissions()
Event::on(
UserPermissions::class,
UserPermissions::EVENT_REGISTER_PERMISSIONS,
function (RegisterUserPermissionsEvent $event) {
function(RegisterUserPermissionsEvent $event) {

// Register our custom permissions
$permissions = [
Expand All @@ -224,7 +222,7 @@ function (RegisterUserPermissionsEvent $event) {
'seo-fields:sitemap' => [
'label' => Craft::t('seo-fields', 'Sitemap'),
],
]
],
];
$event->permissions[Craft::t('seo-fields', 'SEO Fields')] = $permissions;
}
Expand All @@ -237,15 +235,14 @@ private function _registerTwigExtension()
if (!$request->isConsoleRequest) {
Craft::$app->getView()->registerTwigExtension(new SeoFieldsExtension());
}

}

private function _registerFrontendRoutes()
{
Event::on(
UrlManager::class,
UrlManager::EVENT_REGISTER_SITE_URL_RULES,
function (RegisterUrlRulesEvent $event) {
function(RegisterUrlRulesEvent $event) {
$robots = SeoFields::$plugin->defaultsService->getRobotsForSite(Craft::$app->getSites()->getCurrentSite());
if ($robots) {
$event->rules = array_merge($event->rules, [
Expand All @@ -260,7 +257,7 @@ function (RegisterUrlRulesEvent $event) {
if ($shouldRender) {
$event->rules = array_merge($event->rules, [
'sitemap.xml' => 'seo-fields/sitemap/render',
'sitemap_<siteId:\d+>_<type:(entry|product|category)>_<sectionId:\d+>_<handle:.*>.xml' => 'seo-fields/sitemap/detail'
'sitemap_<siteId:\d+>_<type:(entry|product|category)>_<sectionId:\d+>_<handle:.*>.xml' => 'seo-fields/sitemap/detail',
]);
}
}
Expand All @@ -272,7 +269,7 @@ private function _registerCpRoutes()
Event::on(
UrlManager::class,
UrlManager::EVENT_REGISTER_CP_URL_RULES,
function (RegisterUrlRulesEvent $event) {
function(RegisterUrlRulesEvent $event) {
// Register our Control Panel routes
$event->rules = array_merge($event->rules, [
'seo-fields' => 'seo-fields/defaults/index',
Expand All @@ -293,7 +290,7 @@ private function _registerCpListeners()
Event::on(
Sites::class,
Sites::EVENT_AFTER_SAVE_SITE,
function (SiteEvent $event) {
function(SiteEvent $event) {
if ($event->isNew) {
SeoFields::$plugin->defaultsService->copyDefaultsForSite($event->site, $event->oldPrimarySiteId);
}
Expand All @@ -303,36 +300,36 @@ function (SiteEvent $event) {
Event::on(
Elements::class,
Elements::EVENT_AFTER_SAVE_ELEMENT,
function (ElementEvent $event) {
function(ElementEvent $event) {
SeoFields::$plugin->sitemapSerivce->clearCacheForElement($event->element);
}
);

Event::on(
Elements::class,
Elements::EVENT_AFTER_DELETE_ELEMENT,
function (ElementEvent $event) {
function(ElementEvent $event) {
SeoFields::$plugin->sitemapSerivce->clearCacheForElement($event->element);
}
);

Event::on(
Sections::class,
Sections::EVENT_AFTER_DELETE_SECTION,
function (SectionEvent $event) {
function(SectionEvent $event) {
SeoFields::$plugin->sitemapSerivce->clearCaches();
}
);

Event::on(
Sections::class,
Sections::EVENT_AFTER_DELETE_ENTRY_TYPE,
function (EntryTypeEvent $event) {
function(EntryTypeEvent $event) {
SeoFields::$plugin->sitemapSerivce->clearCaches();
}
);

Event::on(Gc::class, Gc::EVENT_RUN, function () {
Event::on(Gc::class, Gc::EVENT_RUN, function() {
try {
$limit = SeoFields::$plugin->getSettings()->notFoundLimit;
if (!is_int($limit)) {
Expand All @@ -356,7 +353,7 @@ private function _registerSiteListeners()
Event::on(
ErrorHandler::class,
ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION,
function (ExceptionEvent $event) {
function(ExceptionEvent $event) {
try {
if ($event->exception instanceof HttpException && $event->exception->statusCode === 404 && Craft::$app->getRequest()->getIsSiteRequest()) {
Craft::debug("404 exception, processing...", __CLASS__);
Expand All @@ -374,15 +371,15 @@ private function _registerCacheOptions()
Event::on(
ClearCaches::class,
ClearCaches::EVENT_REGISTER_CACHE_OPTIONS,
function (RegisterCacheOptionsEvent $event) {
function(RegisterCacheOptionsEvent $event) {
// Register our Control Panel routes
$event->options = array_merge(
$event->options, [
[
"key" => 'seofields_sitemaps',
"label" => "Sitemap caches (SEO Fields)",
"action" => [SeoFields::$plugin->sitemapSerivce, 'clearCaches']
]
"action" => [SeoFields::$plugin->sitemapSerivce, 'clearCaches'],
],
]);
}
);
Expand All @@ -400,11 +397,10 @@ private function _registerCustomElements()

if ($elements) {
Event::on(SeoFields::class, SeoFields::EVENT_SEOFIELDS_REGISTER_ELEMENT,
function (RegisterSeoElementEvent $event) use ($elements) {
function(RegisterSeoElementEvent $event) use ($elements) {
$event->elements = array_merge($event->elements, $elements);
}
);
}
}

}
4 changes: 2 additions & 2 deletions src/assetbundles/RobotsAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public function init()
];

$this->css = [
'robots.css'
'robots.css',
];

parent::init();
}
}
}
7 changes: 3 additions & 4 deletions src/assetbundles/SeoFieldAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use craft\web\AssetBundle;
use craft\web\assets\cp\CpAsset;
use craft\web\View;

class SeoFieldAsset extends AssetBundle
{
Expand All @@ -21,13 +20,13 @@ public function init()
];

$this->js = [
'field.js'
'field.js',
];

$this->css = [
'field.css'
'field.css',
];

parent::init();
}
}
}
2 changes: 1 addition & 1 deletion src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"sitemapPerSite" => false,
"fieldHandle" => "seo",
"notFoundLimit" => 10000,
];
];
6 changes: 1 addition & 5 deletions src/console/controllers/MigrateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
use craft\helpers\App;
use craft\helpers\Console;
use craft\helpers\Db;
use ether\seo\models\data\SeoData;
use studioespresso\seofields\jobs\MigrateFieldDataJob;
use studioespresso\seofields\services\migrate\Ether;
use yii\console\Controller;

class MigrateController extends Controller
{

public $newHandle = 'newSeo';
public $oldHandle = 'seo';
public $siteId;
Expand Down Expand Up @@ -47,7 +45,6 @@ public function actionEther()

$etherMigration = new Ether();
$etherMigration->migrate($this->oldHandle = 'seo', $this->newHandle = 'newSeo', $this->siteId, $this->titleSeperator);

}

public function actionFields()
Expand All @@ -68,7 +65,6 @@ public function actionFields()
$entries = Entry::findAll(['sectionId' => $data['sectionId'], 'typeId' => $data['typeId']]);
$this->stdout("Processing entries in {$section->name} ($type->name)" . PHP_EOL, Console::FG_GREEN);
foreach ($entries as $entry) {

Craft::$app->getQueue()->push(new MigrateFieldDataJob([
'entryId' => $entry->id,
'fieldHandle' => $this->fieldHandle,
Expand All @@ -78,4 +74,4 @@ public function actionFields()
};
}
}
}
}
Loading

0 comments on commit 8927e42

Please sign in to comment.