Found my own solution ??
In case anyone else wants it, here’s the server-side code:
checkver.php
<?php
if(empty($_GET)) {
echo "You forgot to tell me what you're looking for!";
} else {
if(isset($_GET['app']) && isset($_GET['option'])) {
$app = $_GET['app'];
$option = $_GET['option'];
$ini_array = parse_ini_file("checkver.ini", true);
if($ini_array[$app]) {
if($ini_array[$app][$option]) {
echo $ini_array[$app][$option];
} else {
echo 'Invalid option!';
}
} else {
echo "$app not found!";
}
} elseif(isset($_GET['app']) && !isset($_GET['option'])) {
echo "Option not specified for " . $_GET['app'] . "!";
} elseif(!isset($_GET['app']) && isset($_GET['option'])) {
echo "Get option " . $_GET['option'] . " for what?";
} else {
echo "Uh-oh... you're really lost aren't you?";
}
}
?>
Here’s the ini file:
checkver.ini
[Plugin Name]
ver=1.0
Here’s the client side code:
// Define some variables
$app='Plugin Name';
$ver='1.0';
// Check for updates
function update_check() {
$latest = file_get_contents('https://path.to/checkver.php?app=' . rawurlencode($GLOBALS[app]) . '&option=ver');
if($latest) {
if(version_compare($GLOBALS[ver], $latest, '<')) { ?>
<div class="updated"><p>An update for <?php echo $GLOBALS[app]; ?> is available! You are running version <?php echo $GLOBALS[ver]; ?>, the latest is version <?php echo $latest; ?>!</p></div>
<?php }
}
}
add_action('admin_notices', 'update_check');