mirror of
https://github.com/processwire/processwire.git
synced 2025-08-15 11:14:12 +02:00
A few minor adjustments
This commit is contained in:
@@ -617,6 +617,7 @@ class Pageimage extends Pagefile {
|
||||
*
|
||||
*/
|
||||
public function size($width, $height, $options = array()) {
|
||||
if(!is_array($options)) $options = $this->sizeOptionsToArray($options);
|
||||
|
||||
if($this->wire('hooks')->isHooked('Pageimage::size()')) {
|
||||
$result = $this->__call('size', array($width, $height, $options));
|
||||
@@ -648,23 +649,7 @@ class Pageimage extends Pagefile {
|
||||
|
||||
$this->error = '';
|
||||
if($this->ext == 'svg') return $this;
|
||||
|
||||
if(!is_array($options)) {
|
||||
if(is_string($options)) {
|
||||
// optionally allow a string to be specified with crop direction, for shorter syntax
|
||||
if(strpos($options, ',') !== false) $options = explode(',', $options); // 30,40
|
||||
$options = array('cropping' => $options);
|
||||
} else if(is_int($options)) {
|
||||
// optionally allow an integer to be specified with quality, for shorter syntax
|
||||
$options = array('quality' => $options);
|
||||
} else if(is_bool($options)) {
|
||||
// optionally allow a boolean to be specified with upscaling toggle on/off
|
||||
$options = array('upscaling' => $options);
|
||||
} else {
|
||||
// unknown options type
|
||||
$options = array();
|
||||
}
|
||||
}
|
||||
if(!is_array($options)) $options = $this->sizeOptionsToArray($options);
|
||||
|
||||
// originally requested options
|
||||
$requestOptions = $options;
|
||||
@@ -900,6 +885,25 @@ class Pageimage extends Pagefile {
|
||||
return $pageimage;
|
||||
}
|
||||
|
||||
protected function sizeOptionsToArray($options) {
|
||||
if(is_array($options)) return $options;
|
||||
if(is_string($options)) {
|
||||
// optionally allow a string to be specified with crop direction, for shorter syntax
|
||||
if(strpos($options, ',') !== false) $options = explode(',', $options); // 30,40
|
||||
$options = array('cropping' => $options);
|
||||
} else if(is_int($options)) {
|
||||
// optionally allow an integer to be specified with quality, for shorter syntax
|
||||
$options = array('quality' => $options);
|
||||
} else if(is_bool($options)) {
|
||||
// optionally allow a boolean to be specified with upscaling toggle on/off
|
||||
$options = array('upscaling' => $options);
|
||||
} else {
|
||||
// unknown options type
|
||||
$options = array();
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as size() but with width/height assumed to be hidpi width/height
|
||||
*
|
||||
|
@@ -690,6 +690,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
||||
protected function getSystemColumns() {
|
||||
$systemColumns = array_keys($this->systemLabels);
|
||||
$systemColumns = array_merge($systemColumns, array('id', 'name', 'path'));
|
||||
sort($systemColumns);
|
||||
return $systemColumns;
|
||||
}
|
||||
|
||||
|
@@ -808,7 +808,7 @@ class ProcessPageView extends Process {
|
||||
if($pageNum > 1 && $page->template->allowPageNum) {
|
||||
$prefix = $this->pageNumPrefix ? $this->pageNumPrefix : $this->wire('config')->pageNumUrlPrefix;
|
||||
if(!$prefix) $prefix = 'page';
|
||||
$url .= "$prefix$pageNum";
|
||||
$url = rtrim($url, '/') . "/$prefix$pageNum";
|
||||
if($page->template->slashPageNum) {
|
||||
// defined setting for trailing slash
|
||||
if($page->template->slashPageNum == 1) $url .= '/';
|
||||
|
Reference in New Issue
Block a user