1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 01:34:31 +02:00

Various minor updates

This commit is contained in:
Ryan Cramer
2025-01-10 10:27:09 -05:00
parent 4604c09abc
commit 4e678c1584
5 changed files with 41 additions and 19 deletions

View File

@@ -5,7 +5,7 @@
*
* Matches selector strings to pages
*
* ProcessWire 3.x, Copyright 2024 by Ryan Cramer
* ProcessWire 3.x, Copyright 2025 by Ryan Cramer
* https://processwire.com
*
* Hookable methods:
@@ -1860,7 +1860,15 @@ class PageFinder extends Wire {
$q->set('joinType', $joinType);
$q->bindOption('global', true); // ensures bound value key are globally unique
$q->bindOption('prefix', 'pf'); // pf=PageFinder
/* @todo To be implemented after 3.0.245
if(strpos($subfields, 'JSON.') === 0) {
if($this->getMatchQueryJSON($q, $tableAlias, $subfields, $selector->operator, $value)) {
continue;
}
}
*/
$q = $fieldtype->getMatchQuery($q, $tableAlias, $subfield, $selector->operator, $value);
$q->copyTo($query, array('select', 'join', 'leftjoin', 'orderby', 'groupby'));
$q->copyBindValuesTo($query);
@@ -1981,6 +1989,22 @@ class PageFinder extends Wire {
return $query;
}
/**
* Get match query when data is stored in a JSON DB column (future use)
*
* @param PageFinderDatabaseQuerySelect DatabaseQuerySelect $q
* @param string $tableAlias
* @param string $subfields
* @param string $operator
* @param string|int|array $value
* @return bool
*
*/
protected function getMatchQueryJSON(DatabaseQuerySelect $q, $tableAlias, $subfields, $operator, $value) {
// @todo to be implemented after 3.0.245
return false;
}
/**
* Post process a DatabaseQuerySelect for page finder
*

View File

@@ -1174,10 +1174,12 @@ class Sanitizer extends Wire {
*/
protected function getPunycodeVersion($version = 0) {
$config = $this->wire()->config;
if(!$version && strpos($config->pageNameWhitelist, 'v') === 0) {
// i.e. "v3" specified at beginning of pageNameWhitelist
$version = substr($config->pageNameWhitelist, 1, 1);
$version = ctype_digit($version) ? (int) $version : 0;
if(!$version) {
$whitelist = $config->pageNameWhitelist;
for($n = 3; $n > 0; $n--) {
if(strpos($whitelist, "v$n") !== false) $version = $n;
if($version) break;
}
}
if(!$version) $version = $config->installedAfter('2025-01-04') ? 3 : 1;
if(!function_exists('idn_to_utf8')) $version = 2;