mirror of
https://github.com/processwire/processwire.git
synced 2025-08-10 08:44:46 +02:00
Fixes for processwire/processwire-issues#1467
This commit is contained in:
@@ -1622,7 +1622,7 @@ class Modules extends WireArray {
|
||||
$module = true;
|
||||
} else {
|
||||
// module in root namespace or some other namespace
|
||||
$namespace = $this->getModuleNamespace($moduleName, array('file' => $file));
|
||||
$namespace = (string) $this->getModuleNamespace($moduleName, array('file' => $file));
|
||||
$className = trim($namespace, "\\") . "\\$moduleName";
|
||||
if(class_exists($className, false)) {
|
||||
// successful include module
|
||||
@@ -1888,6 +1888,8 @@ class Modules extends WireArray {
|
||||
public function isInstalled($class) {
|
||||
|
||||
if(is_object($class)) $class = $this->getModuleClass($class);
|
||||
$class = (string) $class;
|
||||
if(empty($class)) return false;
|
||||
|
||||
$operator = null;
|
||||
$requiredVersion = null;
|
||||
|
@@ -142,6 +142,7 @@ class Selectors extends WireArray {
|
||||
*
|
||||
*/
|
||||
public function setSelectorString($selectorStr) {
|
||||
$selectorStr = (string) $selectorStr;
|
||||
$this->selectorStr = $selectorStr;
|
||||
$this->extractString(trim($selectorStr));
|
||||
}
|
||||
|
@@ -312,8 +312,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
|
||||
*
|
||||
*/
|
||||
protected function ___findPagesCode(Page $page) {
|
||||
if($page) {}
|
||||
$pages = $this->wire('pages'); // so that it is locally scoped to the eval
|
||||
$pages = $this->wire()->pages; // so that it is locally scoped to the eval
|
||||
if(empty($this->findPagesCode)) return $pages->newPageArray();
|
||||
return eval($this->findPagesCode);
|
||||
}
|
||||
@@ -469,6 +468,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
|
||||
/** @var InputfieldWrapper $repeaterWrapper */
|
||||
$value = null;
|
||||
foreach($repeaterWrapper->getAll() as $in) {
|
||||
/** @var Inputfield $in */
|
||||
if("$in->hasField" !== $field) continue;
|
||||
$value = $in->val();
|
||||
break;
|
||||
@@ -592,9 +592,9 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
|
||||
} else if($this->labelFieldName) {
|
||||
$label = $page->get($this->labelFieldName);
|
||||
}
|
||||
if(!strlen($label)) $label = $page->name;
|
||||
if(!strlen("$label")) $label = $page->name;
|
||||
if($page->hasStatus(Page::statusUnpublished)) $label .= ' ' . $this->_('(unpublished)');
|
||||
if(!$allowMarkup) $label = $this->wire('sanitizer')->markupToLine($label);
|
||||
if(!$allowMarkup) $label = $this->wire()->sanitizer->markupToLine($label);
|
||||
return $label;
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
|
||||
$process = $this->wire()->process;
|
||||
|
||||
if($this->derefAsPage) $inputfield->set('maxSelectedItems', 1);
|
||||
if($process && $process instanceof WirePageEditor) $page = $process->getPage();
|
||||
if($process instanceof WirePageEditor) $page = $process->getPage();
|
||||
|
||||
$inputfield->attr('name', $this->attr('name'));
|
||||
$inputfield->attr('id', $this->attr('id'));
|
||||
@@ -1070,7 +1070,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
|
||||
|
||||
if(!$this->getSetting('addable') || !$parent_id || !$template_id) return;
|
||||
|
||||
$user = $this->wire('user');
|
||||
$user = $this->wire()->user;
|
||||
$key = "_{$this->name}_add_items";
|
||||
$value = trim($input->$key);
|
||||
|
||||
@@ -1150,7 +1150,6 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
|
||||
|
||||
} else if($value instanceof PageArray) {
|
||||
// derefAsPageArray
|
||||
/** @var PageArray $value */
|
||||
if(!count($value)) return true;
|
||||
|
||||
} else {
|
||||
@@ -1515,7 +1514,8 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
|
||||
|
||||
if(!isset($data[$name]) || !is_array($data[$name])) $data[$name] = self::$defaultInputfieldClasses;
|
||||
$fields = $this->wire(new InputfieldWrapper());
|
||||
$modules = $this->wire('modules');
|
||||
$this->wire($fields);
|
||||
$modules = $this->wire()->modules;
|
||||
/** @var InputfieldAsmSelect $field */
|
||||
$field = $modules->get("InputfieldAsmSelect");
|
||||
$field->attr('name', $name);
|
||||
|
@@ -168,7 +168,7 @@ class InputfieldTextTags extends Inputfield implements
|
||||
*/
|
||||
public function setAttribute($key, $value) {
|
||||
if($key === 'value') {
|
||||
if(is_object($value) && $value instanceof WireArray) {
|
||||
if($value instanceof WireArray) {
|
||||
$value = explode('|', (string) $value);
|
||||
}
|
||||
if(is_array($value)) {
|
||||
@@ -218,11 +218,11 @@ class InputfieldTextTags extends Inputfield implements
|
||||
*
|
||||
*/
|
||||
public function tagStringToArray($tagString) {
|
||||
$tagString = trim($tagString);
|
||||
$tagString = trim("$tagString");
|
||||
$tagArray = array();
|
||||
if(!strlen($tagString)) return $tagArray;
|
||||
$a = explode($this->delimiter(), $tagString);
|
||||
foreach($a as $key => $tag) {
|
||||
foreach($a as $tag) {
|
||||
$tag = trim("$tag");
|
||||
if(!strlen($tag)) continue;
|
||||
if(strpos($tag, '_') === 0 && ctype_digit(substr($tag, 1))) $tag = ltrim($tag, '_');
|
||||
@@ -288,7 +288,7 @@ class InputfieldTextTags extends Inputfield implements
|
||||
$regex = $allowLabels ? '/[\r\n\t]+/' : '/[\s\r\n\t]+/';
|
||||
$a = preg_split($regex, $tagString);
|
||||
|
||||
foreach($a as $key => $tag) {
|
||||
foreach($a as $tag) {
|
||||
$tag = trim("$tag");
|
||||
if(!strlen($tag)) continue;
|
||||
if(strpos($tag, '=') !== false) {
|
||||
@@ -597,7 +597,7 @@ class InputfieldTextTags extends Inputfield implements
|
||||
/**
|
||||
* Get tags ready for use by renderReady() or render()
|
||||
*
|
||||
* @return array|string
|
||||
* @return array
|
||||
* @throws WireException
|
||||
*
|
||||
*/
|
||||
@@ -866,7 +866,7 @@ class InputfieldTextTags extends Inputfield implements
|
||||
protected function isPageField() {
|
||||
if($this->hasField && $this->hasFieldtype instanceof FieldtypePage) {
|
||||
return $this->hasField;
|
||||
} else if($this->hasInputfield && $this->hasInputfield instanceof InputfieldPage) {
|
||||
} else if($this->hasInputfield instanceof InputfieldPage) {
|
||||
return $this->hasInputfield;
|
||||
} else {
|
||||
return false;
|
||||
@@ -1027,7 +1027,7 @@ class InputfieldTextTags extends Inputfield implements
|
||||
} else {
|
||||
$selector = '';
|
||||
$hasInputfield = $this->hasInputfield;
|
||||
if($hasInputfield && $hasInputfield instanceof InputfieldPage) $selector = $hasInputfield->createFindPagesSelector();
|
||||
if($hasInputfield instanceof InputfieldPage) $selector = $hasInputfield->createFindPagesSelector();
|
||||
if(!strlen($selector)) $selector = $this->_('your page finding selector here');
|
||||
$exampleCode =
|
||||
'$wire->addHook("/' . $examplePath . '/", function($e) { ' .
|
||||
|
@@ -197,7 +197,7 @@ class ProcessPageClone extends Process {
|
||||
/** @var Language $language */
|
||||
if($language->isDefault()) continue;
|
||||
$value = $page->get("name$language");
|
||||
if(!strlen($value)) continue;
|
||||
if(!strlen("$value")) continue;
|
||||
$result["name$language"] = $pages->names()->incrementName($value, $n);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user