/** * Returns the singleton instance of the class. * * @since 2.0.0 * * @return object The Optin_Monster_License object. */ public static function get_instance() { if (!isset(self::$instance) && !self::$instance instanceof Optin_Monster_License) { self::$instance = new Optin_Monster_License(); } return self::$instance; }
/** * Pings the remote server for addons data. * * @since 2.0.0 * * @param string $key The user license key. * @return bool|array False if no key or failure, array of addon data otherwise. */ public function get_addons_data($key) { $addons = Optin_Monster_License::get_instance()->perform_remote_request('get-addons-data', array('tgm-updater-key' => $key)); // If there was an API error, set transient for only 10 minutes. if (!$addons) { set_transient('_om_addons', false, 10 * MINUTE_IN_SECONDS); return false; } // If there was an error retrieving the addons, set the error. if (isset($addons->error)) { set_transient('_om_addons', false, 10 * MINUTE_IN_SECONDS); return false; } // Otherwise, our request worked. Save the data and return it. set_transient('_om_addons', $addons, DAY_IN_SECONDS); return $addons; }