mirror of
https://github.com/processwire/processwire.git
synced 2025-08-11 09:14:58 +02:00
Additional updates for PHP 8.1+ processwire/processwire-issues#1467
This commit is contained in:
@@ -430,11 +430,12 @@ abstract class DatabaseQuery extends WireData {
|
|||||||
* Implied parameters (using "?") was added in 3.0.157.
|
* Implied parameters (using "?") was added in 3.0.157.
|
||||||
*
|
*
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param array $args
|
* @param array $arguments
|
||||||
* @return $this
|
* @return $this
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function __call($method, $args) {
|
public function __call($method, $arguments) {
|
||||||
|
$args = &$arguments;
|
||||||
|
|
||||||
// if(!$this->has($method)) return parent::__call($method, $args);
|
// if(!$this->has($method)) return parent::__call($method, $args);
|
||||||
if(!isset($this->queryMethods[$method])) return parent::__call($method, $args);
|
if(!isset($this->queryMethods[$method])) return parent::__call($method, $args);
|
||||||
@@ -443,11 +444,10 @@ abstract class DatabaseQuery extends WireData {
|
|||||||
if(!is_array($curValue)) $curValue = array();
|
if(!is_array($curValue)) $curValue = array();
|
||||||
$value = $args[0];
|
$value = $args[0];
|
||||||
|
|
||||||
if(is_object($value) && $value instanceof DatabaseQuery) {
|
if($value instanceof DatabaseQuery) {
|
||||||
// if we've been given another DatabaseQuery, load from its $method
|
// if we've been given another DatabaseQuery, load from its $method
|
||||||
// note that if using bindValues you should also copy them separately
|
// note that if using bindValues you should also copy them separately
|
||||||
// behavior deprecated in 3.l0.157+, please use the copyTo() method instead
|
// behavior deprecated in 3.l0.157+, please use the copyTo() method instead
|
||||||
/** @var DatabaseQuery $query */
|
|
||||||
$query = $value;
|
$query = $value;
|
||||||
$value = $query->$method; // array
|
$value = $query->$method; // array
|
||||||
if(!is_array($value) || !count($value)) return $this; // nothing to import
|
if(!is_array($value) || !count($value)) return $this; // nothing to import
|
||||||
|
@@ -25,11 +25,11 @@
|
|||||||
* @property array $limit
|
* @property array $limit
|
||||||
* @property string $comment Comments for query
|
* @property string $comment Comments for query
|
||||||
*
|
*
|
||||||
* @method $this select($sql, array $params = array())
|
* @method $this select($sql, $params = array())
|
||||||
* @method $this from($sql)
|
* @method $this from($sql)
|
||||||
* @method $this join($sql, array $params = array())
|
* @method $this join($sql, $params = array())
|
||||||
* @method $this leftjoin($sql, array $params = array())
|
* @method $this leftjoin($sql, $params = array())
|
||||||
* @method $this where($sql, array $params = array())
|
* @method $this where($sql, $params = array())
|
||||||
* @method $this groupby($sql)
|
* @method $this groupby($sql)
|
||||||
* @method $this limit($sql)
|
* @method $this limit($sql)
|
||||||
*
|
*
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* ProcessWire WireMail
|
* ProcessWire WireMail
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2021 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* #pw-summary A module type that handles sending of email in ProcessWire
|
* #pw-summary A module type that handles sending of email in ProcessWire
|
||||||
@@ -92,7 +92,7 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
'header' => array(),
|
'header' => array(),
|
||||||
'param' => array(),
|
'param' => array(),
|
||||||
'attachments' => array(),
|
'attachments' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* Construct
|
||||||
@@ -148,6 +148,7 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function sanitizeEmail($email) {
|
protected function sanitizeEmail($email) {
|
||||||
|
$email = (string) $email;
|
||||||
if(!strlen($email)) return '';
|
if(!strlen($email)) return '';
|
||||||
$email = strtolower(trim($email));
|
$email = strtolower(trim($email));
|
||||||
if(strpos($email, ':') && preg_match('/^(.+):\d+$/', $email, $matches)) {
|
if(strpos($email, ':') && preg_match('/^(.+):\d+$/', $email, $matches)) {
|
||||||
@@ -155,14 +156,15 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
// so remove trailing port, i.e. ':8888', if present since it will not validate
|
// so remove trailing port, i.e. ':8888', if present since it will not validate
|
||||||
$email = $matches[1];
|
$email = $matches[1];
|
||||||
}
|
}
|
||||||
$clean = $this->wire('sanitizer')->email($email);
|
$sanitizer = $this->wire()->sanitizer;
|
||||||
|
$clean = $sanitizer->email($email);
|
||||||
if($email !== $clean) {
|
if($email !== $clean) {
|
||||||
throw new WireException("Invalid email address: " . $this->wire('sanitizer')->entities($email));
|
throw new WireException("Invalid email address: " . $sanitizer->entities($email));
|
||||||
}
|
}
|
||||||
/** @var WireMailTools $mail */
|
/** @var WireMailTools $mail */
|
||||||
$mail = $this->wire('mail');
|
$mail = $this->wire('mail');
|
||||||
if($mail && $mail->isBlacklistEmail($email)) {
|
if($mail && $mail->isBlacklistEmail($email)) {
|
||||||
throw new WireException("Email address not allowed: " . $this->wire('sanitizer')->entities($email));
|
throw new WireException("Email address not allowed: " . $sanitizer->entities($email));
|
||||||
}
|
}
|
||||||
return $clean;
|
return $clean;
|
||||||
}
|
}
|
||||||
@@ -176,8 +178,7 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function ___sanitizeHeaderName($name) {
|
protected function ___sanitizeHeaderName($name) {
|
||||||
/** @var Sanitizer $sanitizer */
|
$sanitizer = $this->wire()->sanitizer;
|
||||||
$sanitizer = $this->wire('sanitizer');
|
|
||||||
$name = $sanitizer->emailHeader($name, true);
|
$name = $sanitizer->emailHeader($name, true);
|
||||||
// ensure consistent capitalization for header names
|
// ensure consistent capitalization for header names
|
||||||
$name = ucwords(str_replace('-', ' ', $name));
|
$name = ucwords(str_replace('-', ' ', $name));
|
||||||
@@ -194,7 +195,7 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function ___sanitizeHeaderValue($value) {
|
protected function ___sanitizeHeaderValue($value) {
|
||||||
return $this->wire('sanitizer')->emailHeader($value);
|
return $this->wire()->sanitizer->emailHeader($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,6 +220,7 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
*/
|
*/
|
||||||
protected function extractEmailAndName($email) {
|
protected function extractEmailAndName($email) {
|
||||||
$name = '';
|
$name = '';
|
||||||
|
$email = (string) $email;
|
||||||
if(strpos($email, '<') !== false && strpos($email, '>') !== false) {
|
if(strpos($email, '<') !== false && strpos($email, '>') !== false) {
|
||||||
// email has separate from name and email
|
// email has separate from name and email
|
||||||
if(preg_match('/^(.*?)<([^>]+)>.*$/', $email, $matches)) {
|
if(preg_match('/^(.*?)<([^>]+)>.*$/', $email, $matches)) {
|
||||||
@@ -598,7 +600,7 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prep any additional PHP mail params
|
// prep any additional PHP mail params
|
||||||
$param = $this->wire('config')->phpMailAdditionalParameters;
|
$param = $this->wire()->config->phpMailAdditionalParameters;
|
||||||
if(is_null($param)) $param = '';
|
if(is_null($param)) $param = '';
|
||||||
foreach($this->param as $value) {
|
foreach($this->param as $value) {
|
||||||
$param .= " $value";
|
$param .= " $value";
|
||||||
@@ -629,12 +631,13 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
*/
|
*/
|
||||||
protected function renderMailHeader() {
|
protected function renderMailHeader() {
|
||||||
|
|
||||||
$settings = $this->wire()->config->wireMail;
|
$config = $this->wire()->config;
|
||||||
|
$settings = $config->wireMail;
|
||||||
$from = $this->from;
|
$from = $this->from;
|
||||||
|
|
||||||
if(!strlen($from) && !empty($settings['from'])) $from = $settings['from'];
|
if(!strlen($from) && !empty($settings['from'])) $from = $settings['from'];
|
||||||
if(!strlen($from)) $from = $this->wire('config')->adminEmail;
|
if(!strlen($from)) $from = $config->adminEmail;
|
||||||
if(!strlen($from)) $from = 'processwire@' . $this->wire('config')->httpHost;
|
if(!strlen($from)) $from = 'processwire@' . $config->httpHost;
|
||||||
|
|
||||||
$header = "From: " . ($this->fromName ? $this->bundleEmailAndName($from, $this->fromName) : $from);
|
$header = "From: " . ($this->fromName ? $this->bundleEmailAndName($from, $this->fromName) : $from);
|
||||||
|
|
||||||
@@ -741,10 +744,11 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
protected function renderMailAttachments() {
|
protected function renderMailAttachments() {
|
||||||
$body = '';
|
$body = '';
|
||||||
$boundary = $this->multipartBoundary();
|
$boundary = $this->multipartBoundary();
|
||||||
|
$sanitizer = $this->wire()->sanitizer;
|
||||||
|
|
||||||
foreach($this->attachments as $filename => $file) {
|
foreach($this->attachments as $filename => $file) {
|
||||||
|
|
||||||
$filename = $this->wire('sanitizer')->text($filename, array(
|
$filename = $sanitizer->text($filename, array(
|
||||||
'maxLength' => 512,
|
'maxLength' => 512,
|
||||||
'truncateTail' => false,
|
'truncateTail' => false,
|
||||||
'stripSpace' => '-',
|
'stripSpace' => '-',
|
||||||
@@ -802,7 +806,7 @@ class WireMail extends WireData implements WireMailInterface {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function ___htmlToText($html) {
|
protected function ___htmlToText($html) {
|
||||||
$text = $this->wire('sanitizer')->getTextTools()->markupToText($html);
|
$text = $this->wire()->sanitizer->getTextTools()->markupToText($html);
|
||||||
$text = str_replace("\n", "\r\n", $text);
|
$text = str_replace("\n", "\r\n", $text);
|
||||||
$text = $this->strReplace($text, $this->multipartBoundary());
|
$text = $this->strReplace($text, $this->multipartBoundary());
|
||||||
return $text;
|
return $text;
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* For documentation about the fields used in this class, please see:
|
* For documentation about the fields used in this class, please see:
|
||||||
* /wire/core/Fieldtype.php
|
* /wire/core/Fieldtype.php
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2019 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -184,8 +184,7 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
* @param Field $field
|
* @param Field $field
|
||||||
* @param int $value
|
* @param int $value
|
||||||
* @param array $options
|
* @param array $options
|
||||||
*
|
* @return string
|
||||||
* @return array|false|float|int|string
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function ___exportValue(Page $page, Field $field, $value, array $options = array()) {
|
public function ___exportValue(Page $page, Field $field, $value, array $options = array()) {
|
||||||
@@ -203,7 +202,7 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
*/
|
*/
|
||||||
public function isEmptyValue(Field $field, $value) {
|
public function isEmptyValue(Field $field, $value) {
|
||||||
|
|
||||||
if(is_object($value) && $value instanceof Selector) {
|
if($value instanceof Selector) {
|
||||||
// PageFinder is asking if it should let this Fieldtype handle the operator/value
|
// PageFinder is asking if it should let this Fieldtype handle the operator/value
|
||||||
// combination with potential empty value present in a Selector
|
// combination with potential empty value present in a Selector
|
||||||
$selector = $value;
|
$selector = $value;
|
||||||
@@ -366,12 +365,13 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
*/
|
*/
|
||||||
public function ___getConfigInputfields(Field $field) {
|
public function ___getConfigInputfields(Field $field) {
|
||||||
|
|
||||||
|
$modules = $this->wire()->modules;
|
||||||
$inputfields = parent::___getConfigInputfields($field);
|
$inputfields = parent::___getConfigInputfields($field);
|
||||||
$wdt = $this->wire('datetime'); /** @var WireDateTime $wdt */
|
$wdt = $this->wire('datetime'); /** @var WireDateTime $wdt */
|
||||||
$dateOutputFormat = (string) $field->get('dateOutputFormat');
|
$dateOutputFormat = (string) $field->get('dateOutputFormat');
|
||||||
|
|
||||||
/** @var InputfieldSelect $f */
|
/** @var InputfieldSelect $f */
|
||||||
$f = $this->modules->get('InputfieldSelect');
|
$f = $modules->get('InputfieldSelect');
|
||||||
$f->attr('name', '_dateOutputFormat');
|
$f->attr('name', '_dateOutputFormat');
|
||||||
$f->label = $this->_('Date Output Format');
|
$f->label = $this->_('Date Output Format');
|
||||||
$f->description = $this->_('Select the format to be used when outputting dates with this field.') . ' ';
|
$f->description = $this->_('Select the format to be used when outputting dates with this field.') . ' ';
|
||||||
@@ -382,7 +382,7 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
$date = strlen(date('jn')) < 4 ? time() : strtotime('2016-04-08 5:10:02 PM');
|
$date = strlen(date('jn')) < 4 ? time() : strtotime('2016-04-08 5:10:02 PM');
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach($wdt->getDateFormats() as $format) {
|
foreach($wdt->getDateFormats() as $format) {
|
||||||
$dateFormatted = $wdt->formatDate($date, $format);
|
$dateFormatted = (string) $wdt->formatDate($date, $format);
|
||||||
if($format == 'U') $dateFormatted .= " " . $this->_('(unix timestamp)');
|
if($format == 'U') $dateFormatted .= " " . $this->_('(unix timestamp)');
|
||||||
$f->addOption($format, "$dateFormatted [$format]");
|
$f->addOption($format, "$dateFormatted [$format]");
|
||||||
if(!$found && strpos($dateOutputFormat, $format) !== false) {
|
if(!$found && strpos($dateOutputFormat, $format) !== false) {
|
||||||
@@ -393,7 +393,8 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
$f->attr('onchange', "$('#Inputfield_dateOutputFormat').val($(this).val() + ' ' + $('#Inputfield__timeOutputFormat').val());");
|
$f->attr('onchange', "$('#Inputfield_dateOutputFormat').val($(this).val() + ' ' + $('#Inputfield__timeOutputFormat').val());");
|
||||||
$inputfields->add($f);
|
$inputfields->add($f);
|
||||||
|
|
||||||
$f = $this->modules->get('InputfieldSelect');
|
/** @var InputfieldSelect $f */
|
||||||
|
$f = $modules->get('InputfieldSelect');
|
||||||
$f->attr('name', '_timeOutputFormat');
|
$f->attr('name', '_timeOutputFormat');
|
||||||
$f->label = $this->_('Time Output Format');
|
$f->label = $this->_('Time Output Format');
|
||||||
$f->description = $this->_('If you want to output time in addition to the date, select the format to be used when outputting time with this field. This will be combined with the date format.');
|
$f->description = $this->_('If you want to output time in addition to the date, select the format to be used when outputting time with this field. This will be combined with the date format.');
|
||||||
@@ -414,18 +415,19 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
$inputfields->add($f);
|
$inputfields->add($f);
|
||||||
|
|
||||||
/** @var InputfieldText $f */
|
/** @var InputfieldText $f */
|
||||||
$f = $this->modules->get("InputfieldText");
|
$f = $modules->get("InputfieldText");
|
||||||
$f->attr('name', 'dateOutputFormat');
|
$f->attr('name', 'dateOutputFormat');
|
||||||
$f->attr('value', $field->get('dateOutputFormat'));
|
$f->attr('value', $field->get('dateOutputFormat'));
|
||||||
$f->attr('size', 20);
|
$f->attr('size', 20);
|
||||||
$f->label = $this->_('Date/Time Output Format Code');
|
$f->label = $this->_('Date/Time Output Format Code');
|
||||||
$f->description = $this->_('The date/time will be output according to the format below. This is automatically built from the date/time selections above, but you may change it as needed to suit your needs.') . ' ';
|
$f->description = $this->_('The date/time will be output according to the format below. This is automatically built from the date/time selections above, but you may change it as needed to suit your needs.') . ' ';
|
||||||
$f->description .= $this->_('See the [PHP date](http://www.php.net/manual/en/function.date.php) function reference for more information on how to customize this format. Alternatively, you may use a [PHP strftime](http://www.php.net/manual/en/function.strftime.php) format if desired for localization.');
|
$f->description .= $this->_('See the [PHP date](https://www.php.net/manual/en/function.date.php) function reference for more information on how to customize this format. Alternatively, you may use a [PHP strftime](https://www.php.net/manual/en/function.strftime.php) format if desired for localization.');
|
||||||
$f->icon = 'code';
|
$f->icon = 'code';
|
||||||
$f->collapsed = Inputfield::collapsedYes;
|
$f->collapsed = Inputfield::collapsedYes;
|
||||||
if($this->languages) {
|
if($this->languages) {
|
||||||
$f->useLanguages = true;
|
$f->useLanguages = true;
|
||||||
foreach($this->languages as $language) {
|
foreach($this->languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$f->set("value$language", (string) $field->get('dateOutputFormat' . $language));
|
$f->set("value$language", (string) $field->get('dateOutputFormat' . $language));
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* This Inputfield connects the jQuery UI Autocomplete widget with the ProcessWire ProcessPageSearch AJAX API.
|
* This Inputfield connects the jQuery UI Autocomplete widget with the ProcessWire ProcessPageSearch AJAX API.
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2019 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* @property int $parent_id Limit results to this parent, or if combined with findPagesSelector, the search is performed as $pages->get($parent_id)->find() rather than $pages->find().
|
* @property int $parent_id Limit results to this parent, or if combined with findPagesSelector, the search is performed as $pages->get($parent_id)->find() rather than $pages->find().
|
||||||
@@ -34,7 +34,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
|||||||
'title' => __('Page Auto Complete', __FILE__), // Module Title
|
'title' => __('Page Auto Complete', __FILE__), // Module Title
|
||||||
'summary' => __('Multiple Page selection using auto completion and sorting capability. Intended for use as an input field for Page reference fields.', __FILE__), // Module Summary
|
'summary' => __('Multiple Page selection using auto completion and sorting capability. Intended for use as an input field for Page reference fields.', __FILE__), // Module Summary
|
||||||
'version' => 112,
|
'version' => 112,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,8 +104,8 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
|||||||
*/
|
*/
|
||||||
protected function ___renderListItem($label, $value, $class = '') {
|
protected function ___renderListItem($label, $value, $class = '') {
|
||||||
if($class) $class = " $class";
|
if($class) $class = " $class";
|
||||||
if(strpos($label, '&') !== false) $label = $this->wire('sanitizer')->unentities($label);
|
if(strpos($label, '&') !== false) $label = $this->wire()->sanitizer->unentities($label);
|
||||||
$label = $this->wire('sanitizer')->entities($label);
|
$label = $this->wire()->sanitizer->entities($label);
|
||||||
$out =
|
$out =
|
||||||
"<li class='ui-state-default$class'>" .
|
"<li class='ui-state-default$class'>" .
|
||||||
"<i class='itemSort fa fa-arrows fa-fw'></i> " .
|
"<i class='itemSort fa fa-arrows fa-fw'></i> " .
|
||||||
@@ -146,8 +146,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function ___render() {
|
public function ___render() {
|
||||||
/** @var Sanitizer $sanitizer */
|
$sanitizer = $this->wire()->sanitizer;
|
||||||
$sanitizer = $this->wire('sanitizer');
|
|
||||||
|
|
||||||
if($this->maxSelectedItems == 1) $this->useList = false;
|
if($this->maxSelectedItems == 1) $this->useList = false;
|
||||||
$out = $this->useList ? $this->renderList() : '';
|
$out = $this->useList ? $this->renderList() : '';
|
||||||
@@ -157,7 +156,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
|||||||
// convert our list of search fields to a CSV string for use in the ProcessPageSearch query
|
// convert our list of search fields to a CSV string for use in the ProcessPageSearch query
|
||||||
$searchField = '';
|
$searchField = '';
|
||||||
$searchFields = str_replace(array(',', '|'), ' ', $this->searchFields);
|
$searchFields = str_replace(array(',', '|'), ' ', $this->searchFields);
|
||||||
foreach(explode(' ', $searchFields) as $key => $name) {
|
foreach(explode(' ', $searchFields) as /* $key => */ $name) {
|
||||||
$name = trim($name);
|
$name = trim($name);
|
||||||
// @esrch pr#994 --
|
// @esrch pr#994 --
|
||||||
if(strpos($name, '.')) {
|
if(strpos($name, '.')) {
|
||||||
@@ -206,7 +205,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
|||||||
$remove = '';
|
$remove = '';
|
||||||
if(!$this->useList) {
|
if(!$this->useList) {
|
||||||
if(count($this->value)) {
|
if(count($this->value)) {
|
||||||
$item = $this->wire('pages')->getById($this->value)->first();
|
$item = $this->wire()->pages->getById($this->value)->first();
|
||||||
if($item && $item->id) {
|
if($item && $item->id) {
|
||||||
$textValue = $this->labelFieldFormat ? $item->getText($this->labelFieldFormat, true, false) : $item->get($labelField);
|
$textValue = $this->labelFieldFormat ? $item->getText($this->labelFieldFormat, true, false) : $item->get($labelField);
|
||||||
if(!strlen($textValue)) $textValue = $item->get('title|name');
|
if(!strlen($textValue)) $textValue = $item->get('title|name');
|
||||||
@@ -285,7 +284,7 @@ _OUT;
|
|||||||
protected function getAjaxUrl() {
|
protected function getAjaxUrl() {
|
||||||
|
|
||||||
$pipe = '%7C'; // encoded pipe "|"
|
$pipe = '%7C'; // encoded pipe "|"
|
||||||
$selector = $this->findPagesSelector;
|
$selector = (string) $this->findPagesSelector;
|
||||||
|
|
||||||
if($this->parent_id) {
|
if($this->parent_id) {
|
||||||
if($selector) {
|
if($selector) {
|
||||||
@@ -329,7 +328,9 @@ _OUT;
|
|||||||
// specify what label field we want to retrieve
|
// specify what label field we want to retrieve
|
||||||
if($this->labelFieldFormat) {
|
if($this->labelFieldFormat) {
|
||||||
$name = "autocomplete_" . $this->attr('name');
|
$name = "autocomplete_" . $this->attr('name');
|
||||||
$this->wire('modules')->get('ProcessPageSearch')->setDisplayFormat($name, $this->labelFieldFormat, true);
|
/** @var ProcessPageSearch $pps */
|
||||||
|
$pps = $this->wire()->modules->get('ProcessPageSearch');
|
||||||
|
$pps->setDisplayFormat($name, $this->labelFieldFormat, true);
|
||||||
$selector .= "&format_name=$name";
|
$selector .= "&format_name=$name";
|
||||||
}
|
}
|
||||||
$selector .= "&get=" . $this->labelFieldName;
|
$selector .= "&get=" . $this->labelFieldName;
|
||||||
@@ -371,10 +372,11 @@ _OUT;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function ___getConfigInputfields() {
|
public function ___getConfigInputfields() {
|
||||||
|
$modules = $this->wire()->modules;
|
||||||
$inputfields = parent::___getConfigInputfields();
|
$inputfields = parent::___getConfigInputfields();
|
||||||
|
|
||||||
/** @var InputfieldRadios $field */
|
/** @var InputfieldRadios $field */
|
||||||
$field = $this->modules->get('InputfieldRadios');
|
$field = $modules->get('InputfieldRadios');
|
||||||
$field->setAttribute('name', 'operator');
|
$field->setAttribute('name', 'operator');
|
||||||
$field->label = $this->_('Autocomplete search operator');
|
$field->label = $this->_('Autocomplete search operator');
|
||||||
$field->description = $this->_("The search operator that is used in the API when performing autocomplete matches.");
|
$field->description = $this->_("The search operator that is used in the API when performing autocomplete matches.");
|
||||||
@@ -396,7 +398,7 @@ _OUT;
|
|||||||
$inputfields->add($field);
|
$inputfields->add($field);
|
||||||
|
|
||||||
/** @var InputfieldText $field */
|
/** @var InputfieldText $field */
|
||||||
$field = $this->modules->get('InputfieldText');
|
$field = $modules->get('InputfieldText');
|
||||||
$field->attr('name', 'searchFields');
|
$field->attr('name', 'searchFields');
|
||||||
$field->label = $this->_('Fields to query for autocomplete');
|
$field->label = $this->_('Fields to query for autocomplete');
|
||||||
$field->description = $this->_('Enter the names of the fields that should have their text queried for autocomplete matches.');
|
$field->description = $this->_('Enter the names of the fields that should have their text queried for autocomplete matches.');
|
||||||
@@ -405,7 +407,8 @@ _OUT;
|
|||||||
$field->collapsed = Inputfield::collapsedNo;
|
$field->collapsed = Inputfield::collapsedNo;
|
||||||
$field->attr('value', $this->searchFields);
|
$field->attr('value', $this->searchFields);
|
||||||
$notes = $this->_('Indexed text fields include:');
|
$notes = $this->_('Indexed text fields include:');
|
||||||
foreach($this->wire('fields') as $f) {
|
foreach($this->wire()->fields as $f) {
|
||||||
|
/** @var Field $f */
|
||||||
if(!$f->type instanceof FieldtypeText) continue;
|
if(!$f->type instanceof FieldtypeText) continue;
|
||||||
$notes .= ' ' . $f->name . ',';
|
$notes .= ' ' . $f->name . ',';
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Multi-language support page names module
|
* Multi-language support page names module
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2021 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* @property int $moduleVersion
|
* @property int $moduleVersion
|
||||||
@@ -253,8 +253,8 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
$testPath = trim($path, '/') . '/';
|
$testPath = trim($path, '/') . '/';
|
||||||
$segments = $this->wire()->pages->pathFinder()->languageSegments();
|
$segments = $this->wire()->pages->pathFinder()->languageSegments();
|
||||||
|
|
||||||
foreach($segments as $languageId => $segment) {
|
foreach($segments as /* $languageId => */ $segment) {
|
||||||
if(!strlen($segment)) continue;
|
if(!strlen("$segment")) continue;
|
||||||
$name = "$segment/";
|
$name = "$segment/";
|
||||||
if(strpos($testPath, $name) !== 0) continue;
|
if(strpos($testPath, $name) !== 0) continue;
|
||||||
$path = substr($testPath, strlen($name));
|
$path = substr($testPath, strlen($name));
|
||||||
@@ -456,12 +456,11 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
*
|
*
|
||||||
* @param Page $page
|
* @param Page $page
|
||||||
* @param Language $language
|
* @param Language $language
|
||||||
* @return bool|string|array
|
* @return bool|array
|
||||||
* @since 3.0.186
|
* @since 3.0.186
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function ___pageNotAvailableInLanguage(Page $page, Language $language) {
|
public function ___pageNotAvailableInLanguage(Page $page, Language $language) {
|
||||||
if($language) {} // ignore
|
|
||||||
if($page->editable()) return true;
|
if($page->editable()) return true;
|
||||||
if($page->id == $this->wire()->config->http404PageID) return true;
|
if($page->id == $this->wire()->config->http404PageID) return true;
|
||||||
$redirect404 = (int) $this->redirect404;
|
$redirect404 = (int) $this->redirect404;
|
||||||
@@ -627,7 +626,6 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function hookPageRender(HookEvent $event) {
|
public function hookPageRender(HookEvent $event) {
|
||||||
if($event) {}
|
|
||||||
if($this->force404) {
|
if($this->force404) {
|
||||||
$this->force404 = false; // prevent another 404 on the 404 page
|
$this->force404 = false; // prevent another 404 on the 404 page
|
||||||
throw new Wire404Exception('Not available in requested language', Wire404Exception::codeLanguage);
|
throw new Wire404Exception('Not available in requested language', Wire404Exception::codeLanguage);
|
||||||
@@ -728,6 +726,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
|
|
||||||
// add labels and inputs for other languages
|
// add labels and inputs for other languages
|
||||||
foreach($languages as $language) {
|
foreach($languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$user->setLanguage($language);
|
$user->setLanguage($language);
|
||||||
$value = $page->get("name$language");
|
$value = $page->get("name$language");
|
||||||
@@ -784,6 +783,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
$sanitizer = $this->wire()->sanitizer;
|
$sanitizer = $this->wire()->sanitizer;
|
||||||
|
|
||||||
foreach($languages as $language) {
|
foreach($languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
|
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
if(!$languages->editable($language)) continue;
|
if(!$languages->editable($language)) continue;
|
||||||
@@ -1016,7 +1016,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
$language = $languages->get($language);
|
$language = $languages->get($language);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$language || !$language->id || !$language instanceof Language) {
|
if(!$language instanceof Language || !$language->id) {
|
||||||
$language = $languages->getDefault();
|
$language = $languages->getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1134,6 +1134,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
if(!is_array($extraData)) $extraData = array();
|
if(!is_array($extraData)) $extraData = array();
|
||||||
|
|
||||||
foreach($this->wire()->languages as $language) {
|
foreach($this->wire()->languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
|
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$language_id = (int) $language->id;
|
$language_id = (int) $language->id;
|
||||||
@@ -1206,6 +1207,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
if($userTrackChanges) $user->setTrackChanges(false);
|
if($userTrackChanges) $user->setTrackChanges(false);
|
||||||
|
|
||||||
foreach($this->wire()->languages as $language) {
|
foreach($this->wire()->languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$user->setLanguage($language);
|
$user->setLanguage($language);
|
||||||
$name = $page->get("name$language");
|
$name = $page->get("name$language");
|
||||||
@@ -1244,6 +1246,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
// go into this only if we know the renamed hook hasn't already been called
|
// go into this only if we know the renamed hook hasn't already been called
|
||||||
$renamed = false;
|
$renamed = false;
|
||||||
foreach($this->wire()->languages as $language) {
|
foreach($this->wire()->languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$namePrevious = $page->get("-name$language");
|
$namePrevious = $page->get("-name$language");
|
||||||
if(!$namePrevious) continue;
|
if(!$namePrevious) continue;
|
||||||
@@ -1318,6 +1321,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
if(!$p->id) continue;
|
if(!$p->id) continue;
|
||||||
$duplicates = 0; // count duplicate names, which would invalidate any $foundLanguage
|
$duplicates = 0; // count duplicate names, which would invalidate any $foundLanguage
|
||||||
foreach($languages as $language) {
|
foreach($languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
$key = 'name' . ($language->isDefault() ? '' : $language->id);
|
$key = 'name' . ($language->isDefault() ? '' : $language->id);
|
||||||
$name = $p->get($key);
|
$name = $p->get($key);
|
||||||
if($name === $part) {
|
if($name === $part) {
|
||||||
@@ -1361,6 +1365,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
|
|
||||||
if($query->rowCount() < 2) {
|
if($query->rowCount() < 2) {
|
||||||
foreach($this->wire()->languages as $language) {
|
foreach($this->wire()->languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$status = "status" . (int) $language->id;
|
$status = "status" . (int) $language->id;
|
||||||
$database->exec("ALTER TABLE pages ADD $status INT UNSIGNED NOT NULL DEFAULT " . Page::statusOn);
|
$database->exec("ALTER TABLE pages ADD $status INT UNSIGNED NOT NULL DEFAULT " . Page::statusOn);
|
||||||
@@ -1394,6 +1399,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
$defaultUrlPrefix = $config->get('_pageNumUrlPrefix|pageNumUrlPrefix');
|
$defaultUrlPrefix = $config->get('_pageNumUrlPrefix|pageNumUrlPrefix');
|
||||||
|
|
||||||
foreach($this->wire()->languages as $language) {
|
foreach($this->wire()->languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
/** @var InputfieldName $f */
|
/** @var InputfieldName $f */
|
||||||
$f = $modules->get('InputfieldName');
|
$f = $modules->get('InputfieldName');
|
||||||
$name = "pageNumUrlPrefix$language";
|
$name = "pageNumUrlPrefix$language";
|
||||||
@@ -1469,6 +1475,7 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
|
|||||||
$database = $this->wire()->database;
|
$database = $this->wire()->database;
|
||||||
$sqls = array();
|
$sqls = array();
|
||||||
foreach($languages as $language) {
|
foreach($languages as $language) {
|
||||||
|
/** @var Language $language */
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$name = 'name' . $language->id;
|
$name = 'name' . $language->id;
|
||||||
if(!$database->columnExists("pages", $name)) continue;
|
if(!$database->columnExists("pages", $name)) continue;
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* Keeps track of past URLs where pages have lived and automatically 301 redirects
|
* Keeps track of past URLs where pages have lived and automatically 301 redirects
|
||||||
* to the new location whenever the past URL is accessed.
|
* to the new location whenever the past URL is accessed.
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2021 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* @method upgrade($fromVersion, $toVersion)
|
* @method upgrade($fromVersion, $toVersion)
|
||||||
@@ -87,7 +87,7 @@ class PagePathHistory extends WireData implements Module, ConfigurableModule {
|
|||||||
*/
|
*/
|
||||||
protected function getVersion() {
|
protected function getVersion() {
|
||||||
if($this->version) return $this->version;
|
if($this->version) return $this->version;
|
||||||
$this->version = $this->wire('modules')->getModuleInfoProperty($this, 'version');
|
$this->version = $this->wire()->modules->getModuleInfoProperty($this, 'version');
|
||||||
if(!$this->version) $this->version = 1;
|
if(!$this->version) $this->version = 1;
|
||||||
return $this->version;
|
return $this->version;
|
||||||
}
|
}
|
||||||
@@ -118,10 +118,10 @@ class PagePathHistory extends WireData implements Module, ConfigurableModule {
|
|||||||
// ok
|
// ok
|
||||||
} else if($language === 0) {
|
} else if($language === 0) {
|
||||||
$language = $languages->getDefault();
|
$language = $languages->getDefault();
|
||||||
} else if(is_int($language) || ctype_digit($language)) {
|
} else if(is_int($language) || ctype_digit("$language")) {
|
||||||
$language = $languages->get((int) $language);
|
$language = $languages->get((int) $language);
|
||||||
} else if(is_string($language) && $language) {
|
} else if(is_string($language) && $language) {
|
||||||
$language = $languages->get($this->wire('sanitizer')->pageNameUTF8($language));
|
$language = $languages->get($this->wire()->sanitizer->pageNameUTF8($language));
|
||||||
}
|
}
|
||||||
if($language && !$language->id) $language = null;
|
if($language && !$language->id) $language = null;
|
||||||
return $language;
|
return $language;
|
||||||
@@ -138,7 +138,7 @@ class PagePathHistory extends WireData implements Module, ConfigurableModule {
|
|||||||
*/
|
*/
|
||||||
public function setPathHistory(Page $page, $path, $language = null) {
|
public function setPathHistory(Page $page, $path, $language = null) {
|
||||||
|
|
||||||
$database = $this->wire('database');
|
$database = $this->wire()->database;
|
||||||
$table = self::dbTableName;
|
$table = self::dbTableName;
|
||||||
$result = $this->addPathHistory($page, $path, $language);
|
$result = $this->addPathHistory($page, $path, $language);
|
||||||
|
|
||||||
@@ -655,7 +655,7 @@ class PagePathHistory extends WireData implements Module, ConfigurableModule {
|
|||||||
if($matchRow) {
|
if($matchRow) {
|
||||||
// ok found
|
// ok found
|
||||||
$result['matchType'] = 'exact';
|
$result['matchType'] = 'exact';
|
||||||
} else if($rowCount) {
|
} else {
|
||||||
// select from multiple matched rows (urlSegments mode only)
|
// select from multiple matched rows (urlSegments mode only)
|
||||||
// order by quantity of slashes (most to least)
|
// order by quantity of slashes (most to least)
|
||||||
arsort($pathCounts);
|
arsort($pathCounts);
|
||||||
@@ -668,8 +668,6 @@ class PagePathHistory extends WireData implements Module, ConfigurableModule {
|
|||||||
$result['matchType'] = 'partial';
|
$result['matchType'] = 'partial';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// no match
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($matchRow) {
|
if($matchRow) {
|
||||||
|
@@ -383,7 +383,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
* Check for a bookmark specified in GET variable $n
|
* Check for a bookmark specified in GET variable $n
|
||||||
*
|
*
|
||||||
* @param string $bookmarkID
|
* @param string $bookmarkID
|
||||||
* @return null|int|bool Returns NULL if not applicable, boolean false if bookmark not found, or integer of bookmark ID if applied
|
* @return null|string|false Returns NULL if not applicable, boolean false if bookmark not found, or integer of bookmark ID if applied
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function checkBookmark($bookmarkID = '') {
|
public function checkBookmark($bookmarkID = '') {
|
||||||
@@ -399,7 +399,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$this->set('defaultSort', $bookmark['sort']);
|
$this->set('defaultSort', $bookmark['sort']);
|
||||||
$this->sessionSet('sort', $bookmark['sort']);
|
$this->sessionSet('sort', $bookmark['sort']);
|
||||||
$this->set('columns', $bookmark['columns']);
|
$this->set('columns', $bookmark['columns']);
|
||||||
$this->headline($this->wire('page')->title . ' - ' . $bookmark['title']);
|
$this->headline($this->wire()->page->title . ' - ' . $bookmark['title']);
|
||||||
return $bookmarkID;
|
return $bookmarkID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,6 +724,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
|
|
||||||
// custom fields (sort)
|
// custom fields (sort)
|
||||||
foreach($fields as $field) {
|
foreach($fields as $field) {
|
||||||
|
/** @var Field $field */
|
||||||
if(!$this->allowColumnField($field)) continue;
|
if(!$this->allowColumnField($field)) continue;
|
||||||
if($useLabels) {
|
if($useLabels) {
|
||||||
if($template) {
|
if($template) {
|
||||||
@@ -916,13 +917,13 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$selectors2 = new Selectors();
|
$selectors2 = new Selectors();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($selectors1 as $key1 => $selector1) {
|
foreach($selectors1 as /* $key1 => */ $selector1) {
|
||||||
//$value = $selector1->value;
|
//$value = $selector1->value;
|
||||||
//if(is_array($value) || strlen($value)) continue;
|
//if(is_array($value) || strlen($value)) continue;
|
||||||
$fieldName1 = $selector1->field;
|
$fieldName1 = $selector1->field;
|
||||||
if(is_array($fieldName1)) $fieldName1 = implode('|', $fieldName1);
|
if(is_array($fieldName1)) $fieldName1 = implode('|', $fieldName1);
|
||||||
// see if we have the same field in selectors2
|
// see if we have the same field in selectors2
|
||||||
foreach($selectors2 as $key2 => $selector2) {
|
foreach($selectors2 as /* $key2 => */ $selector2) {
|
||||||
$fieldName2 = $selector2->field;
|
$fieldName2 = $selector2->field;
|
||||||
if(is_array($fieldName2)) $fieldName2 = implode('|', $fieldName2);
|
if(is_array($fieldName2)) $fieldName2 = implode('|', $fieldName2);
|
||||||
if($fieldName1 == $fieldName2) {
|
if($fieldName1 == $fieldName2) {
|
||||||
@@ -1209,7 +1210,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$templatesAPI = $this->wire()->templates;
|
$templatesAPI = $this->wire()->templates;
|
||||||
foreach($template as $t) {
|
foreach($template as $t) {
|
||||||
$t = $templatesAPI->get($t);
|
$t = $templatesAPI->get($t);
|
||||||
if($t && $t instanceof Template) $templates[] = $t;
|
if($t instanceof Template) $templates[] = $t;
|
||||||
}
|
}
|
||||||
return $templates;
|
return $templates;
|
||||||
}
|
}
|
||||||
@@ -1394,7 +1395,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$p->of(false);
|
$p->of(false);
|
||||||
$values = array();
|
$values = array();
|
||||||
|
|
||||||
foreach($columns as $cnt => $name) {
|
foreach($columns as /* $cnt => */ $name) {
|
||||||
$value = $this->buildListerTableCol($p, $fields, $name);
|
$value = $this->buildListerTableCol($p, $fields, $name);
|
||||||
$values[] = $value;
|
$values[] = $value;
|
||||||
}
|
}
|
||||||
@@ -1529,12 +1530,11 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
//if($value instanceof Pageimages && $this->imageFirst) $value = array($value->first());
|
//if($value instanceof Pageimages && $this->imageFirst) $value = array($value->first());
|
||||||
$values = array();
|
$values = array();
|
||||||
$isImage = false;
|
$isImage = false;
|
||||||
foreach($value as $k => $v) {
|
foreach($value as /* $k => */ $v) {
|
||||||
if(empty($v)) continue;
|
if(empty($v)) continue;
|
||||||
if($subname == 'data') $v = (string) $v;
|
if($subname == 'data') $v = (string) $v;
|
||||||
if($subname && is_object($v)) $v = $v->$subname;
|
if($subname && is_object($v)) $v = $v->$subname;
|
||||||
if($v instanceof Pageimage) {
|
if($v instanceof Pageimage) {
|
||||||
/** @var Pageimage $v */
|
|
||||||
$vfull = $v;
|
$vfull = $v;
|
||||||
if($this->imageWidth || $this->imageHeight) $v = $v->size($this->imageWidth, $this->imageHeight);
|
if($this->imageWidth || $this->imageHeight) $v = $v->size($this->imageWidth, $this->imageHeight);
|
||||||
$alt = $vfull->basename . ($vfull->description ? ' - ' . $sanitizer->entities1($vfull->description) : "");
|
$alt = $vfull->basename . ($vfull->description ? ' - ' . $sanitizer->entities1($vfull->description) : "");
|
||||||
@@ -1626,8 +1626,6 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$languages = $this->wire()->languages;
|
$languages = $this->wire()->languages;
|
||||||
if(!$languages) return null;
|
if(!$languages) return null;
|
||||||
|
|
||||||
$language = null;
|
|
||||||
|
|
||||||
if(strpos($name, '-') && preg_match('/-([-_a-z0-9]+)$/', $name, $matches)) {
|
if(strpos($name, '-') && preg_match('/-([-_a-z0-9]+)$/', $name, $matches)) {
|
||||||
// i.e. title-de or categories.title-de
|
// i.e. title-de or categories.title-de
|
||||||
$language = $languages->get($matches[1]);
|
$language = $languages->get($matches[1]);
|
||||||
@@ -1759,31 +1757,25 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$target = $editMode == self::windowModeBlank ? "_blank" : "";
|
$target = $editMode == self::windowModeBlank ? "_blank" : "";
|
||||||
if($editMode == self::windowModeDirect) $directURL = $actions['edit']['url'];
|
if($editMode == self::windowModeDirect) $directURL = $actions['edit']['url'];
|
||||||
$actionsOut .= $this->renderListerTableColAction($actions['edit'], $class, $target);
|
$actionsOut .= $this->renderListerTableColAction($actions['edit'], $class, $target);
|
||||||
unset($actions['edit']);
|
|
||||||
} else {
|
|
||||||
unset($actions['edit']);
|
|
||||||
}
|
}
|
||||||
|
unset($actions['edit']);
|
||||||
|
|
||||||
if($viewable) {
|
if($viewable) {
|
||||||
$class = $viewMode == self::windowModeModal ? "modal" : "";
|
$class = $viewMode == self::windowModeModal ? "modal" : "";
|
||||||
$target = $viewMode == self::windowModeBlank ? "_blank" : "";
|
$target = $viewMode == self::windowModeBlank ? "_blank" : "";
|
||||||
if($viewMode == self::windowModeDirect) $directURL = $p->url;
|
if($viewMode == self::windowModeDirect) $directURL = $p->url;
|
||||||
$actionsOut .= $this->renderListerTableColAction($actions['view'], $class, $target);
|
$actionsOut .= $this->renderListerTableColAction($actions['view'], $class, $target);
|
||||||
unset($actions['view']);
|
|
||||||
} else {
|
|
||||||
unset($actions['view']);
|
|
||||||
}
|
}
|
||||||
|
unset($actions['view']);
|
||||||
|
|
||||||
if($addable) {
|
if($addable) {
|
||||||
$actions['new']['url'] = $this->addURL . "?parent_id=$p->id";
|
$actions['new']['url'] = $this->addURL . "?parent_id=$p->id";
|
||||||
$class = $editMode == self::windowModeModal ? "modal" : "";
|
$class = $editMode == self::windowModeModal ? "modal" : "";
|
||||||
$target = $editMode == self::windowModeBlank ? "_blank" : "";
|
$target = $editMode == self::windowModeBlank ? "_blank" : "";
|
||||||
$actionsOut .= $this->renderListerTableColAction($actions['new'], "$class PageAdd PageEdit", $target);
|
$actionsOut .= $this->renderListerTableColAction($actions['new'], "$class PageAdd PageEdit", $target);
|
||||||
unset($actions['new']);
|
|
||||||
} else {
|
|
||||||
unset($actions['new']);
|
|
||||||
}
|
}
|
||||||
|
unset($actions['new']);
|
||||||
|
|
||||||
if($directURL) {
|
if($directURL) {
|
||||||
// click goes directly to edit or view
|
// click goes directly to edit or view
|
||||||
$value = "<a id='page$p->id' href='$directURL'>$icon$value$statusIcon</a>";
|
$value = "<a id='page$p->id' href='$directURL'>$icon$value$statusIcon</a>";
|
||||||
@@ -1858,12 +1850,13 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
static $pageListRender = null;
|
static $pageListRender = null;
|
||||||
|
|
||||||
if(is_null($pageListRender)) {
|
if(is_null($pageListRender)) {
|
||||||
require_once($this->wire()->config->paths->ProcessPageList . 'ProcessPageListRenderJSON.php');
|
require_once($this->wire()->config->paths('ProcessPageList') . 'ProcessPageListRenderJSON.php');
|
||||||
$pageListRender = new ProcessPageListRenderJSON($this->wire()->page, $this->wire()->pages->newPageArray());
|
$pageListRender = new ProcessPageListRenderJSON($this->wire()->page, $this->wire()->pages->newPageArray());
|
||||||
$pageListRender = $this->wire($pageListRender);
|
$this->wire($pageListRender);
|
||||||
$pageListRender->setUseTrash($this->wire()->user->isSuperuser());
|
$pageListRender->setUseTrash($this->wire()->user->isSuperuser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var ProcessPageListRenderJSON $pageListRender */
|
||||||
$actions = $pageListRender->getPageActions($p);
|
$actions = $pageListRender->getPageActions($p);
|
||||||
|
|
||||||
if(isset($actions['edit']) && $this->editURL && strpos($actions['edit']['url'], '/page/edit/') !== false) {
|
if(isset($actions['edit']) && $this->editURL && strpos($actions['edit']['url'], '/page/edit/') !== false) {
|
||||||
@@ -1988,8 +1981,6 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$pagerOut = $pager->render($results);
|
$pagerOut = $pager->render($results);
|
||||||
$pageURL = $this->wire()->page->url;
|
$pageURL = $this->wire()->page->url;
|
||||||
$pagerOut = str_replace($pageURL . "'", $pageURL . "?pageNum=1'", $pagerOut); // specifically identify page1
|
$pagerOut = str_replace($pageURL . "'", $pageURL . "?pageNum=1'", $pagerOut); // specifically identify page1
|
||||||
} else {
|
|
||||||
$pagerOut = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1998,6 +1989,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->wire()->notices as $notice) {
|
foreach($this->wire()->notices as $notice) {
|
||||||
|
/** @var Notice $notice */
|
||||||
if($notice instanceof NoticeError) {
|
if($notice instanceof NoticeError) {
|
||||||
$out .= "<p class='ui-state-error-text'>$notice->text</p>";
|
$out .= "<p class='ui-state-error-text'>$notice->text</p>";
|
||||||
} else {
|
} else {
|
||||||
@@ -2144,7 +2136,8 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$out = '';
|
$out = '';
|
||||||
if($minimal) {
|
if($minimal) {
|
||||||
/** @var InputfieldHidden $f */
|
/** @var InputfieldHidden $f */
|
||||||
$sort = htmlspecialchars($this->sessionGet('sort'));
|
$sort = (string) $this->sessionGet('sort');
|
||||||
|
$sort = htmlspecialchars($sort);
|
||||||
$out .= "<input type='hidden' name='sort' id='lister_sort' value='$sort' />";
|
$out .= "<input type='hidden' name='sort' id='lister_sort' value='$sort' />";
|
||||||
$out .= "<input type='hidden' name='columns' id='lister_columns' value='ignore' />";
|
$out .= "<input type='hidden' name='columns' id='lister_columns' value='ignore' />";
|
||||||
$out .= "<input type='hidden' name='filters' id='ProcessListerFilters' value='ignore' />";
|
$out .= "<input type='hidden' name='filters' id='ProcessListerFilters' value='ignore' />";
|
||||||
|
Reference in New Issue
Block a user