mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 15:57:01 +02:00
@@ -45,7 +45,7 @@ class ProcessWire extends Wire {
|
||||
* Reversion revision number
|
||||
*
|
||||
*/
|
||||
const versionRevision = 46;
|
||||
const versionRevision = 47;
|
||||
|
||||
/**
|
||||
* Version suffix string (when applicable)
|
||||
@@ -275,13 +275,15 @@ class ProcessWire extends Wire {
|
||||
// If script is being called externally, add an extra shutdown function
|
||||
if(!$config->internal) register_shutdown_function(function() {
|
||||
if(error_get_last()) return;
|
||||
$process = $this->wire('process');
|
||||
$process = isset($this) ? $this->wire('process') : wire('process');
|
||||
if($process == 'ProcessPageView') $process->finished();
|
||||
});
|
||||
|
||||
if($config->useFunctionsAPI) {
|
||||
include($config->paths->core . 'FunctionsAPI.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->setStatus(self::statusBoot);
|
||||
}
|
||||
|
@@ -434,16 +434,6 @@ class User extends Page {
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL where this user can be edited
|
||||
*
|
||||
*
|
||||
* #pw-internal
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the URL necessary to edit this user
|
||||
*
|
||||
|
@@ -240,6 +240,40 @@ class WireUpload extends Wire {
|
||||
return $_FILES[$this->name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the directory where files should upload to
|
||||
*
|
||||
* @return string
|
||||
* @throws WireException If no suitable upload directory can be found
|
||||
*
|
||||
*/
|
||||
protected function getUploadDir() {
|
||||
|
||||
$config = $this->wire('config');
|
||||
$dir = $config->uploadTmpDir;
|
||||
|
||||
if(!$dir && stripos(PHP_OS, 'WIN') === 0) {
|
||||
$dir = $config->paths->cache . 'uploads/';
|
||||
if(!is_dir($dir)) wireMkdir($dir);
|
||||
}
|
||||
|
||||
if(!$dir || !is_writable($dir)) {
|
||||
$dir = ini_get('upload_tmp_dir');
|
||||
}
|
||||
|
||||
if(!$dir || !is_writable($dir)) {
|
||||
$dir = sys_get_temp_dir();
|
||||
}
|
||||
|
||||
if(!$dir || !is_writable($dir)) {
|
||||
throw new WireException(
|
||||
"Error writing to $dir. Please define \$config->uploadTmpDir and ensure it exists and is writable."
|
||||
);
|
||||
}
|
||||
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an ajax file upload and constructs a resulting $_FILES
|
||||
*
|
||||
@@ -251,13 +285,7 @@ class WireUpload extends Wire {
|
||||
|
||||
if(!$filename = $_SERVER['HTTP_X_FILENAME']) return false;
|
||||
$filename = rawurldecode($filename); // per #1487
|
||||
|
||||
$dir = $this->wire('config')->uploadTmpDir;
|
||||
if(!$dir || !is_writable($dir)) $dir = ini_get('upload_tmp_dir');
|
||||
if(!$dir || !is_writable($dir)) $dir = sys_get_temp_dir();
|
||||
if(!$dir || !is_writable($dir)) {
|
||||
throw new WireException("Error writing to $dir. Please define \$config->uploadTmpDir and ensure it is writable.");
|
||||
}
|
||||
$dir = $this->getUploadDir();
|
||||
$tmpName = tempnam($dir, wireClassName($this, false));
|
||||
file_put_contents($tmpName, file_get_contents('php://input'));
|
||||
$filesize = is_file($tmpName) ? filesize($tmpName) : 0;
|
||||
|
@@ -59,6 +59,8 @@
|
||||
display: none !important; }
|
||||
.Inputfields .InputfieldRepeater .InputfieldRepeaterNewItem {
|
||||
display: none; }
|
||||
.Inputfields .InputfieldRepeater .InputfieldRepeaterDelete {
|
||||
display: none; }
|
||||
|
||||
.InputfieldRepeater .InputfieldWrapper,
|
||||
.InputfieldRepeater .InputfieldWrapper > .Inputfields {
|
||||
|
@@ -708,7 +708,7 @@ function InputfieldRepeater($) {
|
||||
|
||||
$inputfields.addClass('InputfieldRepeaterInit');
|
||||
|
||||
$("input.InputfieldRepeaterDelete", $this).parents('.InputfieldCheckbox').hide();
|
||||
//$("input.InputfieldRepeaterDelete", $this).parents('.InputfieldCheckbox').hide();
|
||||
|
||||
if(isItem) {
|
||||
initHeaders($this.children('.InputfieldHeader'), $inputfieldRepeater, renderValueMode);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -328,7 +328,7 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
|
||||
// also add a delete checkbox to the repeater page fields
|
||||
$delete = $this->wire('modules')->get('InputfieldCheckbox');
|
||||
$delete->attr('id+name', "delete_repeater{$page->id}");
|
||||
$delete->class = 'InputfieldRepeaterDelete';
|
||||
$delete->addClass('InputfieldRepeaterDelete', 'wrapClass');
|
||||
$delete->label = $this->_('Delete');
|
||||
$delete->attr('value', $page->id);
|
||||
|
||||
@@ -372,6 +372,13 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
|
||||
if($isClone) $wrap->addClass('InputfieldRepeaterItemClone');
|
||||
if($itemID) $wrap->addClass('InputfieldRepeaterItemRequested');
|
||||
|
||||
if($page->get('_repeater_delete')) {
|
||||
// something indicates it should already show delete state in editor
|
||||
$delete->attr('checked', 'checked');
|
||||
$wrap->addClass('InputfieldRepeaterDeletePending');
|
||||
$wrap->addClass('ui-state-error', 'headerClass');
|
||||
}
|
||||
|
||||
if($isOpen) {
|
||||
$wrap->collapsed = Inputfield::collapsedNo;
|
||||
$numOpen++;
|
||||
@@ -660,8 +667,11 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
|
||||
$collapse = $this->field->get('repeaterCollapse');
|
||||
$forIDs = null;
|
||||
if($loading == FieldtypeRepeater::loadingAll && $collapse != FieldtypeRepeater::collapseNone) $forIDs = array();
|
||||
|
||||
return $this->buildForm(0, $forIDs)->render() . $out;
|
||||
|
||||
$form = $this->buildForm(0, $forIDs);
|
||||
$out = ($this->renderValueMode ? $form->renderValue() : $form->render()) . $out;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -105,6 +105,12 @@
|
||||
// used by non-ajax add mode
|
||||
display: none;
|
||||
}
|
||||
|
||||
.InputfieldRepeaterDelete {
|
||||
// delete checkbox
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.InputfieldRepeater {
|
||||
@@ -118,8 +124,7 @@
|
||||
//padding-left: 25px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.InputfieldRepeaterAddItem input {
|
||||
// count of added items hidden
|
||||
position: absolute;
|
||||
|
@@ -583,7 +583,9 @@ class LanguageSupport extends WireData implements Module, ConfigurableModule {
|
||||
$inputfield = $event->return;
|
||||
if(!$inputfield) return;
|
||||
$translatable = array('label', 'description', 'notes');
|
||||
if($inputfield->attr('placeholder') !== null) $translatable[] = 'placeholder';
|
||||
if($inputfield->attr('placeholder') !== null && $this->wire('process') != 'ProcessField') {
|
||||
$translatable[] = 'placeholder';
|
||||
}
|
||||
$languages = $template ? $template->getLanguages() : $this->wire('languages');
|
||||
$useLanguages = $template && $template->noLang ? false : true;
|
||||
if(!$languages) $languages = $this->wire('languages');
|
||||
|
Reference in New Issue
Block a user