Hi and Thanks for the job!!

some rules...
- use language files, at minimum in englisch and german, possible in all 23 installed languages from WB
- your image folder must be the media-folder or a subfolder from MediaDirectory. Better as a free input field is a select box with this folders (see example in attachement)
- use a default value for both checkboxes in save.php. Use if(isset...) to read a submitted value, if not submitted, use the default value
- its better, to use integer fields for the checkbox values (0 or 1) or enum(), go'es faster and better to code
- prevent your install-struct.sql.php with a php-code in the top
Some errors from the test
Undefined array key "crop_images" - if you dont submitted a value for this
Undefined array key "show_filenames" - if you dont submitted a value for this
dispatch\find_photos "foreach() argument must be of type array|object, false given - if you dont submit a existed folder
code, to prevent the install-struct.sql.php (see also in the Accordion-Module)
Quote-- <?php header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); echo '404 Not Found'; flush(); exit;?>
function, to read all subfolders from /media
Quotefunction MediaDirectoryList($directory, $show_hidden = false){
$aMediaFolderList = [];
if (\is_dir($directory))
{
$dir = array_values(array_diff(\scandir($directory),['.','..'])); //Open directory
foreach ($dir as $key => $entry) {
if(($entry[0] === '.') && ($show_hidden == false)) { continue; } // Skip hidden files
$sItem = str_replace('//', '/',$directory.'/'.$entry.(\is_dir($directory.'/'.$entry) ? '' : ''));
if (\is_dir($sItem)) { // Add dir and contents to list
$aMediaFolderList = \array_merge($aMediaFolderList, MediaDirectoryList($sItem));
$aMediaFolderList[] = str_replace(WB_PATH."/",'',$sItem);
}
}
}
if (\natcasesort($aMediaFolderList)) {
// new indexing
$aMediaFolderList = \array_merge($aMediaFolderList);
}
return $aMediaFolderList; // Now return the list
}
$aMediaFolderList = MediaDirectoryList(WB_PATH.MEDIA_DIRECTORY);
Result is a array, called $aMediaFolderList
use it for example like this
Quote<select name="url" style="width: 100%;padding:4px;">
<option value="media">media</option>
<?php
foreach ($aMediaFolderList as $aFolder){
echo '<option value="'.$aFolder.'" ';
if ($aFolder == $url){echo ' selected = "selected"';}
echo ' > '.$aFolder.'</option>';
}
?>
</select>
example for the default value in save.php for non-submitted fields
Quote// crop_images / default=''
if(isset($aRequestVars['crop_images']) && ($aRequestVars['crop_images'] == 'checked')) {
$sCropImages = 'checked';
}else{
$sCropImages = '';
}
proof the incoming datas also for the correct data-type, means integers with is_numeric()
some example links from our addons
-
Brax Highslide Gallery B -> repaired in last week, show the old module structure, you can use it as example for the language files && inclusion
-
Accordion -> show the new module structure "for the future", from my personal view easyer to handle, but its new. Has a included Twig-Template-Editor and this give the possibility, to use in every output section a different template
Please ask, if you need help