1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-30 10:00:00 +02:00

Various updates primarily aimed at simplifying the check for presence of LanguageSupportPageNames module

This commit is contained in:
Ryan Cramer
2021-10-04 11:13:25 -04:00
parent f61feb56fd
commit 3cf1ba5cab
18 changed files with 173 additions and 113 deletions

View File

@@ -351,10 +351,12 @@ class MarkupQA extends Wire {
if(!preg_match_all($re, $value, $matches)) return;
$replacements = array();
$languages = $this->wire('languages');
$languages = $this->wire()->languages;
$debug = $this->debug();
$config = $this->wire()->config;
$pages = $this->wire()->pages;
if($languages && !$this->wire('modules')->isInstalled('LanguageSupportPageNames')) $languages = null;
if($languages && !$languages->hasPageNames()) $languages = null;
foreach($matches[3] as $key => $path) {
@@ -370,7 +372,7 @@ class MarkupQA extends Wire {
// scheme and hostname present
/** @noinspection PhpUnusedLocalVariableInspection */
list($x, $host) = explode('//', $href);
if($host != $this->wire('config')->httpHost && !in_array($host, $this->wire('config')->httpHosts)) {
if($host != $config->httpHost && !in_array($host, $config->httpHosts)) {
$counts['external']++;
if($debug) $this->message("MarkupQA sleepLinks skipping because hostname: $host");
// external hostname, which we will skip over
@@ -415,11 +417,11 @@ class MarkupQA extends Wire {
'allowUrlSegments' => true,
'useHistory' => true
);
$page = $this->wire()->pages->getByPath($path, $getByPathOptions);
$page = $pages->getByPath($path, $getByPathOptions);
if(!$page->id) {
// if not found try again with non-urlSegment partial matching
$getByPathOptions['allowUrlSegments'] = false;
$page = $this->wire()->pages->getByPath($path, $getByPathOptions);
$page = $pages->getByPath($path, $getByPathOptions);
}
$pageID = $page->id;
@@ -430,7 +432,7 @@ class MarkupQA extends Wire {
if($languages) {
/** @var Language $language */
$language = $this->wire('modules')->get('LanguageSupportPageNames')->getPagePathLanguage($path, $page);
$language = $languages->pageNames()->getPagePathLanguage($path, $page);
$pwid = !$language || $language->isDefault() ? $pageID : "$pageID-$language";
} else {
$language = null;