1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-19 13:01:26 +02:00

Various minor updates

This commit is contained in:
Ryan Cramer
2022-12-30 12:24:04 -05:00
parent 28bd6cdeec
commit 483b63d496
5 changed files with 102 additions and 5 deletions

View File

@@ -1369,7 +1369,10 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
$json = (int) $input->get('json'); // 1 or 0 (for json output mode on or off)
$rotate = (int) $input->get('rotate');
$flip = $input->get('flip');
$crop = $input->get('crop');
if($flip != 'v' && $flip != 'h') $flip = '';
if($crop !== null && (!ctype_alnum($crop) || strlen($crop) > 20)) $crop = '';
if(strpos($class, 'hidpi') !== false) {
if(!$hidpi) $hidpi = true;
@@ -1378,7 +1381,8 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
}
$image = $this->getPageimage(true);
if(strpos($image->basename, '-cropx') !== false) $image = $this->getLastCrop($image);
if(!$crop && strpos($image->basename, '-cropx') !== false) $image = $this->getLastCrop($image);
if( (!$hidpi && $width < $image->width) ||
($hidpi && $width < $image->hidpiWidth()) ||
@@ -1392,6 +1396,7 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
);
if($rotate) $options['rotate'] = $rotate;
if($flip) $options['flip'] = $flip;
if($crop) $options['cropping'] = $crop;
//$this->log(print_r($options, true));
$resized = $image->width($width, $options);
$height = $resized->height();

View File

@@ -284,7 +284,20 @@ abstract class ProcessPageListRender extends Wire {
*
*/
public function ___getPageActions(Page $page) {
return $this->actions->getActions($page);
$actions = $this->actions->getActions($page);
/*
* @todo force 'extras' option to be last
if(isset($actions['extras'])) {
$keys = array_keys($actions);
$lastKey = array_pop($keys);
if($lastKey !== 'extras') {
$extras = $actions['extras'];
unset($actions['extras']);
$actions['extras'] = $extras; // move to last
}
}
*/
return $actions;
}
/**

View File

@@ -652,7 +652,7 @@ class ProcessTemplate extends Process implements ConfigurableModule {
$template->roles = array($this->wire()->roles->getGuestRole()->id);
$template->save();
$this->message(sprintf($this->_('Added template and fieldgroup: %s'), $basename));
$this->message(sprintf($this->_('Added template and fieldgroup: %s'), $template->name));
$addedTemplates[] = $template;
} catch(\Exception $e) {