PMA\libraries\Util::getSelectUploadFileBlock PHP Method

getSelectUploadFileBlock() public static method

Prepare the form used to select a file to import from the server upload directory
public static getSelectUploadFileBlock ( ImportPlugin[] $import_list, string $uploaddir ) : String
$import_list PMA\libraries\plugins\ImportPlugin[] array of import plugins
$uploaddir string upload directory
return String
    public static function getSelectUploadFileBlock($import_list, $uploaddir)
    {
        $block_html = '';
        $block_html .= '<label for="radio_local_import_file">' . sprintf(__("Select from the web server upload directory <b>%s</b>:"), htmlspecialchars(self::userDir($uploaddir))) . '</label>';
        $extensions = '';
        foreach ($import_list as $import_plugin) {
            if (!empty($extensions)) {
                $extensions .= '|';
            }
            $extensions .= $import_plugin->getProperties()->getExtension();
        }
        $matcher = '@\\.(' . $extensions . ')(\\.(' . PMA_supportedDecompressions() . '))?$@';
        $active = isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($GLOBALS['local_import_file']) ? $GLOBALS['local_import_file'] : '';
        $files = PMA_getFileSelectOptions(self::userDir($uploaddir), $matcher, $active);
        if ($files === false) {
            Message::error(__('The directory you set for upload work cannot be reached.'))->display();
        } elseif (!empty($files)) {
            $block_html .= "\n" . '    <select style="margin: 5px" size="1" ' . 'name="local_import_file" ' . 'id="select_local_import_file">' . "\n" . '        <option value="">&nbsp;</option>' . "\n" . $files . '    </select>' . "\n";
        } elseif (empty($files)) {
            $block_html .= '<i>' . __('There are no files to upload!') . '</i>';
        }
        return $block_html;
    }
Util