function renderListOfPresets() { $presetDirs = array($this->getMyPresetsDir() => __('My PhotoQ Presets', 'PhotoQ')); foreach ($this->_presetCategories as $key => $value) { $presetDirs[$this->getPresetsDir() . $key . '/'] = $value; } _e('Choose your Theme Preset: ', 'PhotoQ'); echo '<select name="presetFile" id="presetFile">'; foreach ($presetDirs as $path => $displayName) { $presetFilePaths = PhotoQHelper::getMatchingDirContent($path, '#\\.xml$#'); if (count($presetFilePaths)) { echo '<optgroup label="' . $displayName . '">'; } foreach ($presetFilePaths as $presetPath) { echo '<option value="' . $presetPath . '">' . PhotoQHelper::niceDisplayNameFromFileName(basename($presetPath)) . '</option>'; } if (count($presetFilePaths)) { echo '</optgroup>'; } } echo '</select>'; }