/** * Gets a list of registered addons. * * @return array An assoc array containing addon IDs as array keys and the addon names as array values. */ public function getAddons() { return wprss_get_addons(); }
/** * Sets up the EDD updater for all registered add-ons. * * @since 4.6.3 */ function wprss_setup_edd_updater() { // Get all registered addons $addons = wprss_get_addons(); // retrieve our license key from the DB $licenses = get_option('wprss_settings_license_keys'); // setup the updater if (!class_exists('EDD_SL_Plugin_Updater')) { // load our custom updater include WPRSS_INC . 'libraries/EDD_licensing/EDD_SL_Plugin_Updater.php'; } // Iterate the addons foreach ($addons as $id => $name) { // Prepare the data $license = wprss_get_license_key($id); $uid = strtoupper($id); $name = constant("WPRSS_{$uid}_SL_ITEM_NAME"); $version = constant("WPRSS_{$uid}_VERSION"); $path = constant("WPRSS_{$uid}_PATH"); // Set up an updater $edd_updater = new EDD_SL_Plugin_Updater(WPRSS_SL_STORE_URL, $path, array('version' => $version, 'license' => $license, 'item_name' => $name, 'author' => 'Jean Galea')); } }
/** * Handles the activation/deactivation process * * @since 1.0 */ function wprss_process_addon_license() { $addons = wprss_get_addons(); // Get for each registered addon foreach ($addons as $id => $name) { // listen for our activate button to be clicked if (isset($_POST["wprss_{$id}_license_activate"]) || isset($_POST["wprss_{$id}_license_deactivate"])) { // run a quick security check if (!check_admin_referer("wprss_{$id}_license_nonce", "wprss_{$id}_license_nonce")) { continue; } // get out if we didn't click the Activate/Deactivate button } // retrieve the license keys and statuses from the database $license = wprss_get_license_key($id); $license_statuses = get_option('wprss_settings_license_statuses'); // If the license is not saved in DB, but is included in POST if ($license == '' && !empty($_POST['wprss_settings_license_keys'][$id . '_license_key'])) { // Use the license given in POST $license = $_POST['wprss_settings_license_keys'][$id . '_license_key']; } // Prepare the action to take if (isset($_POST["wprss_{$id}_license_activate"])) { wprss_edd_activate_license($id, $license); } elseif (isset($_POST["wprss_{$id}_license_deactivate"])) { wprss_edd_deactivate_license($id, $license); } } }