mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 15:57:01 +02:00
Minor updates in various classes
This commit is contained in:
@@ -451,8 +451,10 @@ class Debug {
|
||||
$arg = '"' . $arg . '"';
|
||||
} else if(is_bool($arg)) {
|
||||
$arg = $arg ? 'true' : 'false';
|
||||
} else if($arg === null) {
|
||||
$arg = 'null';
|
||||
} else {
|
||||
// leave as-is
|
||||
// leave as-is (int, float, etc.)
|
||||
}
|
||||
$newArgs[] = $arg;
|
||||
}
|
||||
|
@@ -1052,9 +1052,10 @@ class ModulesInfo extends ModulesClass {
|
||||
public function clearModuleInfoCache($showMessages = false) {
|
||||
|
||||
$sanitizer = $this->wire()->sanitizer;
|
||||
$config = $this->wire()->config;
|
||||
|
||||
$versionChanges = array();
|
||||
$upgradeLinks = array();
|
||||
$editLinks = array();
|
||||
$newModules = array();
|
||||
$moveModules = array();
|
||||
$missModules = array();
|
||||
@@ -1102,7 +1103,7 @@ class ModulesInfo extends ModulesClass {
|
||||
// apply update now, to Fieldtype modules only (since they are loaded differently)
|
||||
$this->modules->getModule($moduleName);
|
||||
} else {
|
||||
$upgradeLinks[$moduleName] = "<a class='pw-modal' target='_blank' href='$editUrl'>" .
|
||||
$editLinks[$moduleName] = "<a class='pw-modal' target='_blank' href='$editUrl'>" .
|
||||
$sanitizer->entities1($this->_('Apply')) . "</a>";
|
||||
}
|
||||
}
|
||||
@@ -1124,7 +1125,10 @@ class ModulesInfo extends ModulesClass {
|
||||
if(!$file) {
|
||||
$file = $this->modules->getModuleFile($moduleName, array('fast' => true, 'guess' => true));
|
||||
// add flagsNoFile if file cannot be located
|
||||
$missModules[] = "$moduleName => $file";
|
||||
$missModules[$moduleName] = "$moduleName => $file";
|
||||
$editUrl = $this->modules->configs->getModuleEditUrl($moduleName, false) . '&missing=1';
|
||||
$editLinks[$moduleName] = "<a class='pw-modal' target='_blank' href='$editUrl'>" .
|
||||
$sanitizer->entities1($this->_('Edit')) . "</a>";
|
||||
$this->modules->flags->setFlag($moduleID, Modules::flagsNoFile, true);
|
||||
}
|
||||
}
|
||||
@@ -1162,12 +1166,14 @@ class ModulesInfo extends ModulesClass {
|
||||
$items = array();
|
||||
foreach($report['items'] as $moduleName => $item) {
|
||||
$item = $sanitizer->entities($item);
|
||||
if(isset($upgradeLinks[$moduleName])) $item .= " - " . $upgradeLinks[$moduleName];
|
||||
if(isset($editLinks[$moduleName])) $item .= " - " . $editLinks[$moduleName];
|
||||
$items[] = $item;
|
||||
}
|
||||
$itemsStr = implode("\n", $items);
|
||||
$itemsStr = str_replace($config->paths->root, $config->urls->root, $itemsStr);
|
||||
$this->message(
|
||||
$sanitizer->entities1(sprintf($report['label'], count($items))) .
|
||||
'<pre>' . implode("\n", $items) . '</pre>',
|
||||
"<pre>$itemsStr</pre>",
|
||||
'icon-plug markup nogroup'
|
||||
);
|
||||
$qty++;
|
||||
|
@@ -376,7 +376,7 @@ class FieldtypeModule extends Fieldtype {
|
||||
* When specified, value must be a formatted value.
|
||||
* If null or not specified (recommended), it will be retrieved automatically.
|
||||
* @param string $property Optionally specify the property or index to render. If omitted, entire value is rendered.
|
||||
* @return string|MarkupFieldtype Returns a string or object that can be output as a string, ready for output.
|
||||
* @return string Returns a string or object that can be output as a string, ready for output.
|
||||
* Return a MarkupFieldtype value when suitable so that the caller has potential specify additional
|
||||
* config options before typecasting it to a string.
|
||||
*
|
||||
@@ -398,6 +398,7 @@ class FieldtypeModule extends Fieldtype {
|
||||
*/
|
||||
public function ___getSelectorInfo(Field $field, array $data = array()) {
|
||||
if($data) {}
|
||||
/** @var FieldSelectorInfo $selectorInfo */
|
||||
$selectorInfo = $this->wire(new FieldSelectorInfo());
|
||||
$labelField = $field->get('labelField');
|
||||
$info = $selectorInfo->getSelectorInfo($field);
|
||||
@@ -436,4 +437,3 @@ class FieldtypeModule extends Fieldtype {
|
||||
return parent::getMatchQuery($query, $table, $subfield, $operator, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
||||
'author' => 'Avoine + ProcessWire',
|
||||
'autoload' => "template=admin",
|
||||
'addFlag' => Modules::flagsNoUserConfig
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
const debug = false;
|
||||
@@ -634,7 +634,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
||||
$s = $session->get($this->className());
|
||||
if(!is_array($s)) $s = array();
|
||||
if(count($s) > 100) $s = array_slice($s, -100); // prevent from growing too large
|
||||
$id = 'id' . $this->wire('page')->id . "_" . $this->wire()->sanitizer->fieldName($this->attr('name'));
|
||||
$id = 'id' . $this->wire()->page->id . "_" . $this->wire()->sanitizer->fieldName($this->attr('name'));
|
||||
if(!isset($s[$id])) $s[$id] = array();
|
||||
$s[$id][$key] = $value;
|
||||
$session->set($this->className(), $s);
|
||||
@@ -649,7 +649,9 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
||||
*
|
||||
*/
|
||||
protected function sessionGet($key) {
|
||||
$s = $this->wire()->session->get($this->className());
|
||||
$session = $this->wire()->session;
|
||||
if(!$session) return null;
|
||||
$s = $session->get($this->className());
|
||||
if(!$s) return null;
|
||||
$id = 'id' . $this->wire()->page->id . "_" . $this->wire()->sanitizer->fieldName($this->attr('name'));
|
||||
if(empty($s[$id])) return null;
|
||||
@@ -1816,7 +1818,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
||||
*
|
||||
*/
|
||||
public function setAttribute($key, $value) {
|
||||
if($key == 'value') {
|
||||
if($key === 'value' && $value !== null) {
|
||||
if($this->initValue && strpos($value, $this->initValue) === 0) {
|
||||
// remove initValue from value so that inputs aren't drawn for it
|
||||
$value = substr($value, strlen($this->initValue));
|
||||
|
Reference in New Issue
Block a user