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

Various minor adjustments, typo and text fixes

This commit is contained in:
Ryan Cramer
2020-06-05 08:15:14 -04:00
parent fd2fdd91f0
commit 855cfd7370
6 changed files with 17 additions and 9 deletions

View File

@@ -723,8 +723,10 @@ function wireBytesStr($bytes, $small = false, $options = array()) {
$val = $bytes; $val = $bytes;
if($small) { if($small) {
$label = $val > 0 ? __('B', __FILE__) : ''; // bytes $label = $val > 0 ? __('B', __FILE__) : ''; // bytes
} else if($val == 1) {
$label = __('byte', __FILE__); // singular 1-byte
} else { } else {
$label = __('bytes', __FILE__); $label = __('bytes', __FILE__); // plural 2+ bytes (or 0 bytes)
} }
} else if($bytes < 1000000 || $type === 'k') { } else if($bytes < 1000000 || $type === 'k') {
$val = $bytes / 1024; $val = $bytes / 1024;

View File

@@ -3239,7 +3239,7 @@ class Page extends WireData implements \Countable, WireMatchable {
*/ */
public function url($options = null) { public function url($options = null) {
if($options !== null) return $this->traversal()->urlOptions($this, $options); if($options !== null) return $this->traversal()->urlOptions($this, $options);
$url = rtrim($this->wire('config')->urls->root, "/") . $this->path(); $url = rtrim($this->wire('config')->urls->root, '/') . $this->path();
if($this->template->slashUrls === 0 && $this->settings['id'] > 1) $url = rtrim($url, '/'); if($this->template->slashUrls === 0 && $this->settings['id'] > 1) $url = rtrim($url, '/');
return $url; return $url;
} }

View File

@@ -993,7 +993,7 @@ class WireFileTools extends Wire {
// add .php extension if filename doesn't already have an extension // add .php extension if filename doesn't already have an extension
if($options['autoExtension'] && !strrpos(basename($filename), '.')) { if($options['autoExtension'] && !strrpos(basename($filename), '.')) {
$filename .= "." . $options['autoExtension']; $filename .= '.' . $options['autoExtension'];
} }
if(strpos($filename, '..') !== false) { if(strpos($filename, '..') !== false) {
@@ -1034,10 +1034,15 @@ class WireFileTools extends Wire {
// include the file // include the file
TemplateFile::pushRenderStack($filename); TemplateFile::pushRenderStack($filename);
$func = $options['func']; $func = $options['func'];
if($func == 'require') require($filename); if($func === 'require') {
else if($func == 'require_once') require_once($filename); require($filename);
else if($func == 'include_once') include_once($filename); } else if($func === 'require_once') {
else include($filename); require_once($filename);
} else if($func === 'include_once') {
include_once($filename);
} else {
include($filename);
}
TemplateFile::popRenderStack(); TemplateFile::popRenderStack();
return true; return true;

View File

@@ -259,6 +259,7 @@ class WireLog extends Wire {
* *
*/ */
public function getFilename($name) { public function getFilename($name) {
$name = strtolower($name);
if($name !== $this->wire('sanitizer')->pageName($name)) { if($name !== $this->wire('sanitizer')->pageName($name)) {
throw new WireException("Log name must contain only [-_.a-z0-9] with no extension"); throw new WireException("Log name must contain only [-_.a-z0-9] with no extension");
} }

View File

@@ -25,7 +25,7 @@ if(!defined("PROCESSWIRE")) die();
* Note that if your site may be accessed at either domain.com OR www.domain.com, then you'll * Note that if your site may be accessed at either domain.com OR www.domain.com, then you'll
* want to include entries for both, pointing to the same /site-domain/ directory. * want to include entries for both, pointing to the same /site-domain/ directory.
* *
* Each /site/ dir has it's own /site/config.php file that should be pointing to a separate * Each /site/ dir has its own /site/config.php file that should be pointing to a separate
* database. You shouldn't have two different /site/ dirs sharing the same database. * database. You shouldn't have two different /site/ dirs sharing the same database.
* *
*/ */

View File

@@ -138,7 +138,7 @@ class InputfieldDatetimeSelect extends InputfieldDatetimeType {
$attrs = $this->inputfield->getAttributes(); $attrs = $this->inputfield->getAttributes();
$attrs['type'] = 'hidden'; $attrs['type'] = 'hidden';
$attrs['value'] = date(InputfieldDatetime::defaultDateInputFormat . ' ' . InputfieldDatetime::defaultTimeInputFormat, $value); if($value) $attrs['value'] = date(InputfieldDatetime::defaultDateInputFormat . ' ' . InputfieldDatetime::defaultTimeInputFormat, $value);
unset($attrs['size'], $attrs['placeholder'], $attrs['class'], $attrs['required']); unset($attrs['size'], $attrs['placeholder'], $attrs['class'], $attrs['required']);
$attrs['class'] = 'InputfieldDatetimeValue'; $attrs['class'] = 'InputfieldDatetimeValue';
$attrStr = $this->inputfield->getAttributesString($attrs); $attrStr = $this->inputfield->getAttributesString($attrs);