本文整理汇总了PHP中Updater::validateLicense方法的典型用法代码示例。如果您正苦于以下问题:PHP Updater::validateLicense方法的具体用法?PHP Updater::validateLicense怎么用?PHP Updater::validateLicense使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Updater
的用法示例。
在下文中一共展示了Updater::validateLicense方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$updater->upgradeLog("The main site has been updated", true, "Success");
// plugins
$allplugins = $plugins->getAllPlugins();
$plugins_to_update = $updater->getSupportedPlugins($allplugins);
if (count($plugins_to_update)) {
foreach ($plugins_to_update as $addon_id => $plugin_data) {
$error = false;
// get license
$plugin_license_key = $settings->getSetting($plugin_data['key_name'], false);
if (!$plugin_license_key) {
$updater->upgradeLog("Validating {$plugin_data['name']} plugin...", false, "No license key");
$error = true;
}
if (!$error) {
// check license
if (!$updater->validateLicense($curl, 0, $addon_id, $plugin_license_key)) {
$updater->upgradeLog("Validating {$plugin_data['name']} plugin...", false, "Invalid license key");
$error = true;
} else {
$updater->upgradeLog("Validating {$plugin_data['name']} plugin...", true, "Success");
}
}
if (!$error) {
$release_files = $curl->get($updater->api_path . "?method=getFileList&key=" . $license_key . "&addon_id=" . $addon_id);
if ($curl->getHttpCode() >= 200 && $curl->getHttpCode() < 400) {
$release_files = json_decode($release_files, true);
if (!isset($release_files[$latest_version]) || !count($release_files[$latest_version])) {
$updater->upgradeLog("Getting plugin file list ({$plugin_data['name']})...", false, "No new files");
$error = true;
} else {
$updater->upgradeLog("Getting plugin file list ({$plugin_data['name']})...", true, "Success");