return isset($array[$key]) ? $array[$key] : false;
}
}
-
- /**
- * based on self::ifset check also the value
- *
- * @param array $array The array to use
- * @param string $key The key to check
- * @param string $value The value to compare
- * @return bool
- */
- static function ifsetValue(array $array, string $key, string $value): bool {
- if(self::ifset($array,$key) !== false) {
- return $array[$key] == $value;
- }
- return false;
- }
-
+
/**
* Replace in $haystack the $needle with $replace only once
*
<option value="">Please select</option>
<?php foreach($TemplateData['ownerSelection'] as $k=>$v) { ?>
<option value="<?php echo $k; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'owner',$k)) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData']['owner'] ?? '') == $k ? 'selected' : ''; ?>
><?php echo $v['login']; ?> (<?php echo $v['name']; ?>)</option>
<?php } ?>
</select>
<option value="">Please select</option>
<?php foreach($TemplateData['groupSelection'] as $k=>$v) { ?>
<option value="<?php echo $k; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'group',$k)) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData']['group'] ?? '') == $k ? 'selected' : ''; ?>
><?php echo $v['name']; ?> (<?php echo $v['description']; ?>)</option>
<?php } ?>
</select>
<tr>
<td>
<input id="user_read" type="checkbox" name="fdata[rights][user][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'read', 'r')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['user']['read'] ?? '') == 'r' ? "checked" : ""; ?>>
<label for="user_read">r </label>
<input id="user_write" type="checkbox" name="fdata[rights][user][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'write', 'w')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['user']['write'] ?? '') == 'w' ? "checked" : ""; ?>>
<label for="user_write">w </label>
<input id="user_delete" type="checkbox" name="fdata[rights][user][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'delete', 'x')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['user']['delete'] ?? '') == 'x' ? "checked" : ""; ?>>
<label for="user_delete">x </label>
</td>
<td>
<input id="group_read" type="checkbox" name="fdata[rights][group][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'read', 'r')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['group']['read'] ?? '') == 'r' ? "checked" : ""; ?>>
<label for="group_read">r </label>
<input id="group_write" type="checkbox" name="fdata[rights][group][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'write', 'w')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['group']['write'] ?? '') == 'w' ? "checked" : ""; ?>>
<label for="group_write">w </label>
<input id="group_delete" type="checkbox" name="fdata[rights][group][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'delete', 'x')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['group']['delete'] ?? '') == 'x' ? "checked" : ""; ?>>
<label for="group_delete">x </label>
</td>
<td>
<input id="other_read" type="checkbox" name="fdata[rights][other][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'read', 'r')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['other']['read'] ?? '') == 'r' ? "checked" : ""; ?>>
<label for="other_read">r </label>
<input id="other_write" type="checkbox" name="fdata[rights][other][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'write', 'w')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['other']['write'] ?? '') == 'w' ? "checked" : ""; ?>>
<label for="other_write">w </label>
<input id="other_delete" type="checkbox" name="fdata[rights][other][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'delete', 'x')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['other']['delete'] ?? '') == 'x' ? "checked" : ""; ?>>
<label for="other_delete">x </label>
</td>
</tr>
<option value="">Please select</option>
<?php foreach($field['options'] as $k=>$v) { ?>
<option value="<?php echo $v; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], $field['identifier'],$v)) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData'][$field['identifier']] ?? '') == $v ? 'selected' : ''; ?>
><?php echo $v; ?></option>
<?php } ?>
</select>
<tr>
<td>
<input id="user_read" type="checkbox" name="fdata[rights][user][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'read', 'r')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['user']['read'] ?? '') == 'r' ? "checked" : ""; ?>>
<label for="user_read">r </label>
<input id="user_write" type="checkbox" name="fdata[rights][user][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'write', 'w')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['user']['write'] ?? '') == 'w' ? "checked" : ""; ?>>
<label for="user_write">w </label>
<input id="user_delete" type="checkbox" name="fdata[rights][user][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'delete', 'x')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['user']['delete'] ?? '') == 'x' ? "checked" : ""; ?>>
<label for="user_delete">x </label>
</td>
<td>
<input id="group_read" type="checkbox" name="fdata[rights][group][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'read', 'r')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['group']['read'] ?? '') == 'r' ? "checked" : ""; ?>>
<label for="group_read">r </label>
<input id="group_write" type="checkbox" name="fdata[rights][group][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'write', 'w')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['group']['write'] ?? '') == 'w' ? "checked" : ""; ?>>
<label for="group_write">w </label>
<input id="group_delete" type="checkbox" name="fdata[rights][group][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'delete', 'x')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['group']['delete'] ?? '') == 'x' ? "checked" : ""; ?>>
<label for="group_delete">x </label>
</td>
<td>
<input id="other_read" type="checkbox" name="fdata[rights][other][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'read', 'r')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['other']['read'] ?? '') == 'r' ? "checked" : ""; ?>>
<label for="other_read">r </label>
<input id="other_write" type="checkbox" name="fdata[rights][other][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'write', 'w')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['other']['write'] ?? '') == 'w' ? "checked" : ""; ?>>
<label for="other_write">w </label>
<input id="other_delete" type="checkbox" name="fdata[rights][other][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'delete', 'x')) echo "checked"; ?>>
+ <?php echo ($TemplateData['editData']['rights']['other']['delete'] ?? '') == 'x' ? "checked" : ""; ?>>
<label for="other_delete">x </label>
</td>
</tr>
value="<?php echo $TemplateData['editData']['description'] ?? ''; ?>">
</div>
- <?php if(isset($TemplateData['editData']['name']) && Summoner::ifsetValue($TemplateData['editData'], 'protected', '0')) { ?>
+ <?php if(isset($TemplateData['editData']['name']) && (($TemplateData['editData']['protected'] ?? '') == '0' ? true : false)) { ?>
<div class="field-row-stacked">
<p>
Warning: Content owned by this group will not be deleted and thus only manageable by admin!<br />
<option value="">Please select</option>
<?php foreach($TemplateData['existingGroups'] as $k=>$v) { ?>
<option value="<?php echo $k; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'baseGroupId',$k)) echo 'selected'; ?>
+ <?php ($TemplateData['editData']['baseGroupId'] ?? '') == $k ? 'selected' : ''; ?>
><?php echo $v['name']; ?> (<?php echo $v['description']; ?>)</option>
<?php } ?>
</select>
<?php if(isset($TemplateData['editData']['active'])) echo "checked"; ?>>
<label for="active">Can login</label>
</div>
- <?php if(isset($TemplateData['editData']['name']) && Summoner::ifsetValue($TemplateData['editData'], 'protected', '0')) { ?>
+ <?php if(isset($TemplateData['editData']['name']) && (($TemplateData['editData']['protected'] ?? '') == '0' ? true : false)) { ?>
<div class="field-row-stacked">
<input id="delete" type="checkbox" name="fdata[doDelete]" value="1">
<label for="delete">Delete.</label>
<option value="">Please select</option>
<?php foreach($TemplateData['simpleSearchFields'] as $k=>$v) { ?>
<option value="<?php echo $v['identifier']; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'defaultSearchField', $v['identifier'])) echo 'selected'; ?>
+ <?php ($TemplateData['editData']['defaultSearchField'] ?? '') == $v['identifier'] ? 'selected' : ''; ?>
><?php echo $v['displayname']; ?> (<?php echo $v['type']; ?>)</option>
<?php } ?>
</select>
<option value="">Please select</option>
<?php foreach($TemplateData['simpleSearchFields'] as $k=>$v) { ?>
<option value="<?php echo $v['identifier']; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'defaultSortField', $v['identifier'])) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData']['defaultSortField'] ?? '') == $v['identifier'] ? 'selected' : ''; ?>
><?php echo $v['displayname']; ?> (<?php echo $v['type']; ?>)</option>
<?php } ?>
</select>
<option value="">Please select</option>
<?php foreach($TemplateData['ownerSelection'] as $k=>$v) { ?>
<option value="<?php echo $k; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'owner',$k)) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData']['owner'] ?? '') == $k ? 'selected' : ''; ?>
><?php echo $v['login']; ?> (<?php echo $v['name']; ?>)</option>
<?php } ?>
</select>
<option value="">Please select</option>
<?php foreach($TemplateData['groupSelection'] as $k=>$v) { ?>
<option value="<?php echo $k; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'group',$k)) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData']['group'] ?? '') == $k ? 'selected' : ''; ?>
><?php echo $v['name']; ?> (<?php echo $v['description']; ?>)</option>
<?php } ?>
</select>
<tr>
<td>
<label>r:<input class="uk-checkbox" type="checkbox" name="fdata[rights][user][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'read', 'r')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['user']['read'] ?? '') == 'r' ? "checked" : ""; ?>></label>
<label>w:<input class="uk-checkbox" type="checkbox" name="fdata[rights][user][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'write', 'w')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['user']['write'] ?? '') == 'w' ? "checked" : ""; ?>></label>
<label>x:<input class="uk-checkbox" type="checkbox" name="fdata[rights][user][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'delete', 'x')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['user']['delete'] ?? '') == 'x' ? "checked" : ""; ?>></label>
</td>
<td>
<label>r:<input class="uk-checkbox" type="checkbox" name="fdata[rights][group][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'read', 'r')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['group']['read'] ?? '') == 'r' ? "checked" : ""; ?>></label>
<label>w:<input class="uk-checkbox" type="checkbox" name="fdata[rights][group][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'write', 'w')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['group']['write'] ?? '') == 'w' ? "checked" : ""; ?>></label>
<label>x:<input class="uk-checkbox" type="checkbox" name="fdata[rights][group][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'delete', 'x')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['group']['delete'] ?? '') == 'x' ? "checked" : ""; ?>></label>
</td>
<td>
<label>r:<input class="uk-checkbox" type="checkbox" name="fdata[rights][other][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'read', 'r')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['other']['read'] ?? '') == 'r' ? "checked" : ""; ?>></label>
<label>w:<input class="uk-checkbox" type="checkbox" name="fdata[rights][other][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'write', 'w')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['other']['write'] ?? '') == 'w' ? "checked" : ""; ?>></label>
<label>x:<input class="uk-checkbox" type="checkbox" name="fdata[rights][other][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'delete', 'x')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['other']['delete'] ?? '') == 'x' ? "checked" : ""; ?>></label>
</td>
</tr>
</table>
<option value="">Please select</option>
<?php foreach($field['options'] as $k=>$v) { ?>
<option value="<?php echo $v; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], $field['identifier'],$v)) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData'][$field['identifier']] ?? '') == $v ? 'selected' : ''; ?>
><?php echo $v; ?></option>
<?php } ?>
</select>
<tr>
<td>
<label>r:<input class="uk-checkbox" type="checkbox" name="fdata[rights][user][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'read', 'r')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['user']['read'] ?? '') == 'r' ? "checked" : ""; ?>></label>
<label>w:<input class="uk-checkbox" type="checkbox" name="fdata[rights][user][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'write', 'w')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['user']['write'] ?? '') == 'w' ? "checked" : ""; ?>></label>
<label>x:<input class="uk-checkbox" type="checkbox" name="fdata[rights][user][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['user'], 'delete', 'x')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['user']['delete'] ?? '') == 'x' ? "checked" : ""; ?>></label>
</td>
<td>
<label>r:<input class="uk-checkbox" type="checkbox" name="fdata[rights][group][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'read', 'r')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['group']['read'] ?? '') == 'r' ? "checked" : ""; ?>></label>
<label>w:<input class="uk-checkbox" type="checkbox" name="fdata[rights][group][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'write', 'w')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['group']['write'] ?? '') == 'w' ? "checked" : ""; ?>></label>
<label>x:<input class="uk-checkbox" type="checkbox" name="fdata[rights][group][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['group'], 'delete', 'x')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['group']['delete'] ?? '') == 'x' ? "checked" : ""; ?>></label>
</td>
<td>
<label>r:<input class="uk-checkbox" type="checkbox" name="fdata[rights][other][read]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'read', 'r')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['other']['read'] ?? '') == 'r' ? "checked" : ""; ?>></label>
<label>w:<input class="uk-checkbox" type="checkbox" name="fdata[rights][other][write]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'write', 'w')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['other']['write'] ?? '') == 'w' ? "checked" : ""; ?>></label>
<label>x:<input class="uk-checkbox" type="checkbox" name="fdata[rights][other][delete]" value="1"
- <?php if(Summoner::ifsetValue($TemplateData['editData']['rights']['other'], 'delete', 'x')) echo "checked"; ?>></label>
+ <?php echo ($TemplateData['editData']['rights']['other']['delete'] ?? '') == 'x' ? "checked" : ""; ?>></label>
</td>
</tr>
</table>
</div>
</div>
- <?php if(isset($TemplateData['editData']['name']) && Summoner::ifsetValue($TemplateData['editData'], 'protected', '0')) { ?>
+ <?php if(isset($TemplateData['editData']['name']) && (($TemplateData['editData']['protected'] ?? '') == '0' ? true : false)) { ?>
<div class="uk-margin">
<div class="uk-form-label">Delete <span uk-icon="warning"></span></div>
<div class="uk-form-controls uk-form-controls-text">
<option value="">Please select</option>
<?php foreach($TemplateData['existingGroups'] as $k=>$v) { ?>
<option value="<?php echo $k; ?>"
- <?php if(Summoner::ifsetValue($TemplateData['editData'], 'baseGroupId',$k)) echo 'selected'; ?>
+ <?php echo ($TemplateData['editData']['baseGroupId'] ?? '') == $k ? 'selected' : ''; ?>
><?php echo $v['name']; ?> (<?php echo $v['description']; ?>)</option>
<?php } ?>
</select>
</label>
</div>
</div>
- <?php if(isset($TemplateData['editData']['name']) && Summoner::ifsetValue($TemplateData['editData'], 'protected', '0')) { ?>
+ <?php if(isset($TemplateData['editData']['name']) && (($TemplateData['editData']['protected'] ?? '') == '0' ? true : false)) { ?>
<div class="uk-margin">
<div class="uk-form-label">Delete <span uk-icon="warning"></span></div>
<div class="uk-form-controls uk-form-controls-text">
<div class="uk-form-controls">
<input class="uk-input" id="search" type="text" autocomplete="off"
name="fdata[search]"
- value="<?php echo $TemplateData['editEntry']['title'] ? ''; ?>"
+ value="<?php echo $TemplateData['editEntry']['title'] ?? ''; ?>"
>
</div>
<div class="uk-margin">