Created
November 13, 2017 19:17
-
-
Save flodolo/c929b954e47ae52f78528514163894ea to your computer and use it in GitHub Desktop.
Install local XML files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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