TODO / Feature list
-+ Replace ifset https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op
- from summoner.class.php
++ combine category and tag class into one.
++ installer
+ Whole Page snapshot
+ view table really still needed?
+ theme support
-+ combine category and tag class into one.
+
return $ret;
}
-
- /**
- * simulate the Null coalescing operator in php5
- * this only works with arrays and checking if the key is there and echo/return it.
- * http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op
- *
- * @param array $array
- * @param string $key
- * @return mixed
- */
- static function ifset(array $array, string $key): mixed {
- return $array[$key] ?? false;
- }
-
+
/**
* try to gather meta information from given URL
*
<div class="columns">
<div class="column">
<h1 class="is-size-2"><?php echo $linkData['title']; ?></h1>
- <h3><a href="index.php?p=linkinfo&id=<?php echo Summoner::ifset($formData, 'hash'); ?>">
+ <h3><a href="index.php?p=linkinfo&id=<?php echo $formData['hash'] ?? ''; ?>">
<i class="icon ion-md-return-left"></i></a></h3>
</div>
</div>
<p><?php echo $T->t('view.title'); ?></p>
</div>
<div class="column">
- <input class="input" type="text" name="data[title]" value="<?php echo Summoner::ifset($formData, 'title'); ?>" />
+ <input class="input" type="text" name="data[title]" value="<?php echo $formData['title'] ?? ''; ?>" />
</div>
</div>
<div class="columns">
<p><?php echo $T->t('view.description'); ?></p>
</div>
<div class="column">
- <input class="input" type="text" name="data[description]" value="<?php echo Summoner::ifset($formData, 'description'); ?>" />
+ <input class="input" type="text" name="data[description]" value="<?php echo $formData['description'] ?? ''; ?>" />
</div>
</div>
<div class="columns">
<p>
<img class="linkthumbnail" src="<?php echo $linkData['imageToShow']; ?>" alt="<?php echo $T->t('view.image.noimage'); ?>">
</p>
- <input class="input" type="text" name="data[image]" value="<?php echo Summoner::ifset($formData, 'image'); ?>" /><br />
+ <input class="input" type="text" name="data[image]" value="<?php echo $formData['image'] ?? ''; ?>" /><br />
<br />
<label class="checkbox">
- <input type="checkbox" name="data[localImage]" value="1" <?php if(Summoner::ifset($formData, 'localImage')) echo "checked"; ?> />
+ <input type="checkbox" name="data[localImage]" value="1" <?php if(isset($formData['localImage'])) echo "checked"; ?> />
<?php echo $T->t('edit.link.image.save'); ?>
</label>
</div>
<p><a href="<?php echo $linkData['snapshotLink']; ?>" target="_blank"><?php echo $T->t('edit.link.thumbnail.view'); ?></a></p>
<?php } ?>
<label class="checkbox">
- <input type="checkbox" name="data[snapshot]" value="1" <?php if(Summoner::ifset($formData, 'snapshot')) echo "checked"; ?> />
+ <input type="checkbox" name="data[snapshot]" value="1" <?php if(isset($formData['snapshot'])) echo "checked"; ?> />
<?php echo $T->t('edit.link.thumbnail.save'); ?>
</label>
</div>
<p><a href="<?php echo $linkData['pagescreenshotLink']; ?>" target="_blank"><?php echo $T->t('edit.link.full.screenshot.view'); ?></a></p>
<?php } ?>
<label class="checkbox">
- <input type="checkbox" name="data[pagescreenshot]" value="1" <?php if(Summoner::ifset($formData, 'pagescreenshot')) echo "checked"; ?> />
+ <input type="checkbox" name="data[pagescreenshot]" value="1" <?php if(isset($formData['pagescreenshot'])) echo "checked"; ?> />
<?php echo $T->t('edit.link.full.screenshot.save'); ?>
</label>
</div>
</div>
<div class="column">
<label class="checkbox">
- <input type="checkbox" name="data[private]" value="1" <?php if(Summoner::ifset($formData, 'private')) echo "checked"; ?> />
+ <input type="checkbox" name="data[private]" value="1" <?php if(isset($formData['private'])) echo "checked"; ?> />
<?php echo $T->t('view.private'); ?>
</label>
</div>
<div class="field has-addons">
<div class="control is-expanded">
<div class="control has-icons-left">
- <input type="url" name="data[url]" class="input" value="<?php echo Summoner::ifset($formData, 'url'); ?>" />
+ <input type="url" name="data[url]" class="input" value="<?php echo $formData['url'] ?? ''; ?>" />
<span class="icon is-small is-left">
<i class="ion-link"></i>
</span>
<div class="field">
<label class="label"><?php echo $T->t('view.title'); ?></label>
<div class="control">
- <input class="input" type="text" name="data[title]" value="<?php echo Summoner::ifset($formData, 'title'); ?>" />
+ <input class="input" type="text" name="data[title]" value="<?php echo $formData['title'] ?? ''; ?>" />
</div>
</div>
</div>
<div class="field">
<label class="label"><?php echo $T->t('view.description'); ?></label>
<div class="control">
- <input class="input" type="text" name="data[description]" value="<?php echo Summoner::ifset($formData, 'description'); ?>" />
+ <input class="input" type="text" name="data[description]" value="<?php echo $formData['description'] ?? ''; ?>" />
</div>
</div>
</div>
<div class="columns">
<div class="column is-half">
- <img class="linkthumbnail" src="<?php echo Summoner::ifset($formData, 'imageToShow'); ?>" alt="<?php echo $T->t('view.image.of.link'); ?>" />
+ <img class="linkthumbnail" src="<?php echo $formData['imageToShow'] ?? ''; ?>" alt="<?php echo $T->t('view.image.of.link'); ?>" />
</div>
<div class="column is-half">
<div class="field">
<label class="label"><?php echo $T->t('view.image.link'); ?></label>
<div class="control">
- <input class="input" type="url" name="data[image]" value="<?php echo Summoner::ifset($formData, 'image'); ?>" />
+ <input class="input" type="url" name="data[image]" value="<?php echo $formData['image'] ?? ''; ?>" />
</div>
</div>
</div>
<div class="columns">
<div class="column is-half">
<label class="checkbox is-pulled-right">
- <input type="checkbox" name="data[private]" value="1" <?php if(Summoner::ifset($formData, 'private')) echo "checked"; ?> />
+ <input type="checkbox" name="data[private]" value="1" <?php if(isset($formData['private'])) echo "checked"; ?> />
<?php echo $T->t('view.private'); ?>
</label>
</div>