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

Bump version to 3.0.217

This commit is contained in:
Ryan Cramer
2023-05-05 13:00:14 -04:00
parent 013f9ebade
commit 47086751d2
6 changed files with 49 additions and 33 deletions

View File

@@ -25,7 +25,7 @@
* Placeholder class for non-existant and non-saveable Page. * Placeholder class for non-existant and non-saveable Page.
* Many API functions return a NullPage to indicate no match. * Many API functions return a NullPage to indicate no match.
* *
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer * ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com * https://processwire.com
* *
* @property int $id The id property will always be 0 for a NullPage. * @property int $id The id property will always be 0 for a NullPage.
@@ -77,7 +77,9 @@ class NullPage extends Page implements WireNull {
* @throws WireException * @throws WireException
* *
*/ */
public function parents($selector = '') { return $this->wire('pages')->newPageArray(); } public function parents($selector = '') {
return $this->wire()->pages->newPageArray();
}
/** /**
* #pw-internal * #pw-internal
@@ -110,7 +112,22 @@ class NullPage extends Page implements WireNull {
* @throws WireException * @throws WireException
* *
*/ */
public function ___rootParent() { return $this->wire('pages')->newNullPage(); } public function ___rootParent() {
return $this->wire()->pages->newNullPage();
}
/**
* #pw-internal
*
* @param string $selector
* @param bool $includeCurrent
* @return PageArray
* @throws WireException
*
*/
public function siblings($selector = '', $includeCurrent = true) {
return $this->wire()->pages->newPageArray();
}
/** /**
* #pw-internal * #pw-internal
@@ -121,18 +138,9 @@ class NullPage extends Page implements WireNull {
* @throws WireException * @throws WireException
* *
*/ */
public function siblings($selector = '', $options = array()) { return $this->wire('pages')->newPageArray(); } public function children($selector = '', $options = array()) {
return $this->wire()->pages->newPageArray();
/** }
* #pw-internal
*
* @param string $selector
* @param array $options
* @return PageArray
* @throws WireException
*
*/
public function children($selector = '', $options = array()) { return $this->wire('pages')->newPageArray(); }
/** /**
* #pw-internal * #pw-internal
@@ -142,7 +150,9 @@ class NullPage extends Page implements WireNull {
* @throws WireException * @throws WireException
* *
*/ */
public function getAccessParent($type = 'view') { return $this->wire('pages')->newNullPage(); } public function getAccessParent($type = 'view') {
return $this->wire()->pages->newNullPage();
}
/** /**
* #pw-internal * #pw-internal
@@ -152,7 +162,9 @@ class NullPage extends Page implements WireNull {
* @throws WireException * @throws WireException
* *
*/ */
public function getAccessRoles($type = 'view') { return $this->wire('pages')->newPageArray(); } public function getAccessRoles($type = 'view') {
return $this->wire()->pages->newPageArray();
}
/** /**
* #pw-internal * #pw-internal
@@ -173,4 +185,3 @@ class NullPage extends Page implements WireNull {
*/ */
public function isChanged($what = '') { return false; } public function isChanged($what = '') { return false; }
} }

View File

@@ -5,7 +5,7 @@
* *
* Provides implementation for Page access functions. * Provides implementation for Page access functions.
* *
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer * ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com * https://processwire.com
* *
*/ */
@@ -85,7 +85,7 @@ class PageAccess {
$parent = null; $parent = null;
if($type === 'edit' && $page->isTrash() && $page->id != $page->wire('config')->trashPageID) { if($type === 'edit' && $page->isTrash() && $page->id != $page->wire()->config->trashPageID) {
// pages in trash have an edit access parent as whatever it was prior to being trashed // pages in trash have an edit access parent as whatever it was prior to being trashed
$info = $pages->trasher()->parseTrashPageName($page->name); $info = $pages->trasher()->parseTrashPageName($page->name);
if(!empty($info['parent_id'])) $parent = $pages->get((int) $info['parent_id']); if(!empty($info['parent_id'])) $parent = $pages->get((int) $info['parent_id']);
@@ -160,9 +160,13 @@ class PageAccess {
* *
*/ */
public function wire($name = '', $value = null, $lock = false) { public function wire($name = '', $value = null, $lock = false) {
if(!is_null($value)) return $this->wire->wire($name, $value, $lock); if(!is_null($value)) {
else if($name instanceof WireFuelable && $this->wire) $name->setWire($this->wire); return $this->wire->wire($name, $value, $lock);
else if($name) return $this->wire->wire($name); } else if($name instanceof WireFuelable && $this->wire) {
$name->setWire($this->wire);
} else if($name) {
return $this->wire->wire($name);
}
return $this->wire; return $this->wire;
} }

View File

@@ -1511,4 +1511,3 @@ class Pagefile extends WireData implements WireArrayItem {
return $info; return $info;
} }
} }

View File

@@ -17,7 +17,7 @@
* Pages using templates that already define their access (determined by $template->useRoles) * Pages using templates that already define their access (determined by $template->useRoles)
* are omitted from the pages_access table, as they aren't necessary. * are omitted from the pages_access table, as they aren't necessary.
* *
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer * ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com * https://processwire.com
* *
* *
@@ -194,8 +194,6 @@ class PagesAccess extends Wire {
if(!$accessParent->id || $accessParent->id == $page->id) { if(!$accessParent->id || $accessParent->id == $page->id) {
// page is the same as the one that defines access, so it doesn't need to be here // page is the same as the one that defines access, so it doesn't need to be here
$query = $database->prepare("DELETE FROM pages_access WHERE pages_id=:page_id"); $query = $database->prepare("DELETE FROM pages_access WHERE pages_id=:page_id");
$query->bindValue(":page_id", $page_id, \PDO::PARAM_INT);
$query->execute();
} else { } else {
$template_id = (int) $accessParent->template->id; $template_id = (int) $accessParent->template->id;
@@ -205,11 +203,12 @@ class PagesAccess extends Wire {
"ON DUPLICATE KEY UPDATE templates_id=VALUES(templates_id) "; "ON DUPLICATE KEY UPDATE templates_id=VALUES(templates_id) ";
$query = $database->prepare($sql); $query = $database->prepare($sql);
$query->bindValue(":page_id", $page_id, \PDO::PARAM_INT);
$query->bindValue(":template_id", $template_id, \PDO::PARAM_INT); $query->bindValue(":template_id", $template_id, \PDO::PARAM_INT);
$query->execute();
} }
$query->bindValue(":page_id", $page_id, \PDO::PARAM_INT);
$query->execute();
if($page->numChildren > 0) { if($page->numChildren > 0) {
if($page->parentPrevious && $accessParent->id != $page->id) { if($page->parentPrevious && $accessParent->id != $page->id) {

View File

@@ -79,7 +79,7 @@ class ProcessWire extends Wire {
* Reversion revision number * Reversion revision number
* *
*/ */
const versionRevision = 216; const versionRevision = 217;
/** /**
* Version suffix string (when applicable) * Version suffix string (when applicable)

View File

@@ -86,6 +86,9 @@ class WireTextTools extends Wire {
'finishReplacements' => array(), // replacements applied at very end (internal) 'finishReplacements' => array(), // replacements applied at very end (internal)
); );
$str = (string) $str;
if(!strlen($str)) return '';
// merge options using arrays // merge options using arrays
foreach(array('replacements') as $key) { foreach(array('replacements') as $key) {
if(!isset($options[$key])) continue; if(!isset($options[$key])) continue;
@@ -379,7 +382,7 @@ class WireTextTools extends Wire {
* - `linksToUrls` (bool): Convert links to "(url)" rather than removing entirely? (default=false) Since 3.0.132 * - `linksToUrls` (bool): Convert links to "(url)" rather than removing entirely? (default=false) Since 3.0.132
* - `endBlocksWith` (string): Character or string to insert to identify paragraph/header separation (default='') * - `endBlocksWith` (string): Character or string to insert to identify paragraph/header separation (default='')
* - `convertEntities` (bool): Convert entity-encoded characters to text? (default=true) * - `convertEntities` (bool): Convert entity-encoded characters to text? (default=true)
* @return mixed|string * @return string
* *
*/ */
public function collapse($str, array $options = array()) { public function collapse($str, array $options = array()) {
@@ -762,7 +765,7 @@ class WireTextTools extends Wire {
* Get array of punctuation characters * Get array of punctuation characters
* *
* @param bool $sentence Get only sentence-ending punctuation * @param bool $sentence Get only sentence-ending punctuation
* @return array|string * @return array
* *
*/ */
public function getPunctuationChars($sentence = false) { public function getPunctuationChars($sentence = false) {
@@ -1334,7 +1337,7 @@ class WireTextTools extends Wire {
$str = array_shift($parts); $str = array_shift($parts);
foreach($parts as $key => $part) { foreach($parts as $part) {
$len = $this->strlen($part); $len = $this->strlen($part);
$char = $len > 0 ? $this->substr($part, 0, 1) : ''; // char being escaped $char = $len > 0 ? $this->substr($part, 0, 1) : ''; // char being escaped