Skip to content

Instantly share code, notes, and snippets.

@gioxx
Forked from flodolo/index.php
Created May 13, 2019 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gioxx/d1960f5f386880b71a88f96c4a0d5c7b to your computer and use it in GitHub Desktop.
Save gioxx/d1960f5f386880b71a88f96c4a0d5c7b to your computer and use it in GitHub Desktop.
Install local XML files
<?php
$full_url = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Install searchplugins</title>
<script type="text/javascript">
function installSearchPlugin(pluginname) {
var filename = '<?=$full_url?>' + pluginname + '.xml';
window.external.AddSearchProvider(filename);
}
</script>
</head>
<body>
<h1>Install searchplugins</h1>
<?php
$files_list = glob(__DIR__ . '/*.xml');
foreach ($files_list as $file_name) {
$searchplugin_name = basename($file_name, '.xml');
echo "<p><a href=\"#\" onclick=\"installSearchPlugin('{$searchplugin_name}');\">Install {$searchplugin_name}</a></p>\n";
}
?>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment