mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Add PagesPathFinder class to core
This commit is contained in:
@@ -3826,7 +3826,7 @@ class Page extends WireData implements \Countable, WireMatchable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function status($value = false, $status = null) {
|
public function status($value = false, $status = null) {
|
||||||
if($value !== true) return $this->setStatus($value);
|
if($value !== true && $value !== false) return $this->setStatus($value);
|
||||||
if($status === null) $status = $this->status;
|
if($status === null) $status = $this->status;
|
||||||
if($value === false) return $status;
|
if($value === false) return $status;
|
||||||
return PageProperties::statusToNames($status);
|
return PageProperties::statusToNames($status);
|
||||||
@@ -4021,7 +4021,7 @@ class Page extends WireData implements \Countable, WireMatchable {
|
|||||||
*/
|
*/
|
||||||
public function secureFiles() {
|
public function secureFiles() {
|
||||||
if($this->wire()->config->pagefileSecure && !$this->isPublic()) return true;
|
if($this->wire()->config->pagefileSecure && !$this->isPublic()) return true;
|
||||||
$template = $this->template();
|
$template = $this->getAccessTemplate();
|
||||||
if(!$template) return null;
|
if(!$template) return null;
|
||||||
$value = $template->pagefileSecure;
|
$value = $template->pagefileSecure;
|
||||||
if($value < 1) return false; // 0: disabled
|
if($value < 1) return false; // 0: disabled
|
||||||
|
@@ -2343,7 +2343,7 @@ class PageFinder extends Wire {
|
|||||||
$pages = $this->pages;
|
$pages = $this->pages;
|
||||||
$database = $this->database;
|
$database = $this->database;
|
||||||
$user = $this->wire()->user;
|
$user = $this->wire()->user;
|
||||||
$language = $this->languages && $user->language ? $user->language : null;
|
$language = $this->languages && $user && $user->language ? $user->language : null;
|
||||||
|
|
||||||
// support `sort=a|b|c` in correct order (because orderby prepend used below)
|
// support `sort=a|b|c` in correct order (because orderby prepend used below)
|
||||||
if(count($values) > 1) $values = array_reverse($values);
|
if(count($values) > 1) $values = array_reverse($values);
|
||||||
|
1439
wire/core/PagesPathFinder.php
Normal file
1439
wire/core/PagesPathFinder.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1124,9 +1124,10 @@ class Sanitizer extends Wire {
|
|||||||
if($charset === 'UTF8' && $beautify === self::okUTF8) {
|
if($charset === 'UTF8' && $beautify === self::okUTF8) {
|
||||||
$value = $this->pagePathNameUTF8($value);
|
$value = $this->pagePathNameUTF8($value);
|
||||||
} else {
|
} else {
|
||||||
if(in_array($beautify, array(self::okUTF8, self::toUTF8, self::toAscii))) $beautify = false;
|
$b = $beautify;
|
||||||
|
if(in_array($beautify, array(self::okUTF8, self::toUTF8, self::toAscii))) $b = false;
|
||||||
// regular ascii path
|
// regular ascii path
|
||||||
$value = $this->name($value, $beautify, $maxLength, '-', $options);
|
$value = $this->name($value, $b, $maxLength, '-', $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disallow double slashes
|
// disallow double slashes
|
||||||
@@ -1137,7 +1138,7 @@ class Sanitizer extends Wire {
|
|||||||
|
|
||||||
// disallow names that start with a period
|
// disallow names that start with a period
|
||||||
while(strpos($value, '/.') !== false) $value = str_replace('/.', '/', $value);
|
while(strpos($value, '/.') !== false) $value = str_replace('/.', '/', $value);
|
||||||
|
|
||||||
// ascii to UTF8 conversion, when requested
|
// ascii to UTF8 conversion, when requested
|
||||||
if($charset === 'UTF8' && $beautify === self::toUTF8) {
|
if($charset === 'UTF8' && $beautify === self::toUTF8) {
|
||||||
if(strpos($value, 'xn-') === false) return $value;
|
if(strpos($value, 'xn-') === false) return $value;
|
||||||
|
Reference in New Issue
Block a user