mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +02:00
Additional updates for processwire/processwire-issues#1467
This commit is contained in:
@@ -41,6 +41,7 @@ class FilenameArray implements \IteratorAggregate, \Countable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function getKey($filename) {
|
protected function getKey($filename) {
|
||||||
|
$filename = (string) $filename;
|
||||||
$pos = strpos($filename, '?');
|
$pos = strpos($filename, '?');
|
||||||
$key = $pos ? substr($filename, 0, $pos) : $filename;
|
$key = $pos ? substr($filename, 0, $pos) : $filename;
|
||||||
return md5($key);
|
return md5($key);
|
||||||
|
@@ -1831,6 +1831,8 @@ abstract class Inputfield extends WireData implements Module {
|
|||||||
/** @var Sanitizer $sanitizer */
|
/** @var Sanitizer $sanitizer */
|
||||||
$sanitizer = $this->wire('sanitizer');
|
$sanitizer = $this->wire('sanitizer');
|
||||||
|
|
||||||
|
$str = (string) $str;
|
||||||
|
|
||||||
// if already encoded, then un-encode it
|
// if already encoded, then un-encode it
|
||||||
if(strpos($str, '&') !== false && preg_match('/&(#\d+|[a-zA-Z]+);/', $str)) {
|
if(strpos($str, '&') !== false && preg_match('/&(#\d+|[a-zA-Z]+);/', $str)) {
|
||||||
$str = $sanitizer->unentities($str);
|
$str = $sanitizer->unentities($str);
|
||||||
|
@@ -2788,7 +2788,7 @@ class PageFinder extends Wire {
|
|||||||
|
|
||||||
} else if(in_array($field, array('created', 'modified', 'published'))) {
|
} else if(in_array($field, array('created', 'modified', 'published'))) {
|
||||||
// prepare value for created, modified or published date fields
|
// prepare value for created, modified or published date fields
|
||||||
if(!ctype_digit($value)) {
|
if(!ctype_digit("$value")) {
|
||||||
$value = $datetime->strtotime($value);
|
$value = $datetime->strtotime($value);
|
||||||
}
|
}
|
||||||
if(empty($value)) {
|
if(empty($value)) {
|
||||||
|
@@ -367,7 +367,8 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
public function ___getConfigInputfields(Field $field) {
|
public function ___getConfigInputfields(Field $field) {
|
||||||
|
|
||||||
$inputfields = parent::___getConfigInputfields($field);
|
$inputfields = parent::___getConfigInputfields($field);
|
||||||
$wdt = $this->wire('datetime');
|
$wdt = $this->wire('datetime'); /** @var WireDateTime $wdt */
|
||||||
|
$dateOutputFormat = (string) $field->get('dateOutputFormat');
|
||||||
|
|
||||||
/** @var InputfieldSelect $f */
|
/** @var InputfieldSelect $f */
|
||||||
$f = $this->modules->get('InputfieldSelect');
|
$f = $this->modules->get('InputfieldSelect');
|
||||||
@@ -384,7 +385,7 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
$dateFormatted = $wdt->formatDate($date, $format);
|
$dateFormatted = $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($field->get('dateOutputFormat'), $format) !== false) {
|
if(!$found && strpos($dateOutputFormat, $format) !== false) {
|
||||||
$f->attr('value', $format);
|
$f->attr('value', $format);
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
@@ -400,7 +401,6 @@ class FieldtypeDatetime extends Fieldtype {
|
|||||||
$f->addOption('', $this->_('None'));
|
$f->addOption('', $this->_('None'));
|
||||||
$f->columnWidth = 50;
|
$f->columnWidth = 50;
|
||||||
$date = strtotime('5:10:02 PM');
|
$date = strtotime('5:10:02 PM');
|
||||||
$dateOutputFormat = $field->get('dateOutputFormat');
|
|
||||||
foreach($wdt->getTimeFormats() as $format) {
|
foreach($wdt->getTimeFormats() as $format) {
|
||||||
$timeFormatted = $wdt->formatDate($date, $format);
|
$timeFormatted = $wdt->formatDate($date, $format);
|
||||||
$f->addOption($format, "$timeFormatted [$format]");
|
$f->addOption($format, "$timeFormatted [$format]");
|
||||||
|
@@ -1565,7 +1565,7 @@ class FieldtypeFile extends FieldtypeMulti implements ConfigurableModule, Fieldt
|
|||||||
$extensions = array();
|
$extensions = array();
|
||||||
$badExtensions = array();
|
$badExtensions = array();
|
||||||
$whitelistExtensions = array();
|
$whitelistExtensions = array();
|
||||||
$extensionsStr = $field->get('extensions');
|
$extensionsStr = (string) $field->get('extensions');
|
||||||
$okExtensions = $field->get('okExtensions');
|
$okExtensions = $field->get('okExtensions');
|
||||||
$validators = array();
|
$validators = array();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user