core->cache->get( $cacheKey ); if ( $downloadUrl ) { $options['package'] = $downloadUrl; return $options; } // If the response code isn't 200, we'll refresh the download URL. switch ( $slug ) { case 'all-in-one-seo-pack-pro': $args = [ 'license' => aioseo()->license->getLicenseKey(), 'domain' => aioseo()->helpers->getSiteDomain( true ), 'sku' => $slug, 'version' => aioseo()->version, 'php_version' => PHP_VERSION, 'wp_version' => get_bloginfo( 'version' ) ]; $response = aioseo()->helpers->wpRemotePost( $this->getUrl() . 'update/', [ 'timeout' => 30, 'body' => wp_json_encode( $args ) ] ); $updateInfo = json_decode( wp_remote_retrieve_body( $response ) ); $downloadUrl = $options['package']; if ( is_object( $updateInfo ) && ! empty( $updateInfo->package ) ) { $downloadUrl = $updateInfo->package; } break; default: // If we don't find a specific slug, we'll assume it's an addon plugin. $downloadUrl = aioseo()->addons->getDownloadUrl( $slug ); $downloadUrl = $downloadUrl ? $downloadUrl : $options['package']; } aioseo()->core->cache->update( $cacheKey, $downloadUrl, 45 * MINUTE_IN_SECONDS ); $options['package'] = $downloadUrl; return $options; } /** * Get the URL to check licenses. * * @since 4.0.0 * @version 4.4.7 Moved to trait. * * @return string The URL. */ public function getUrl() { if ( defined( 'AIOSEO_LICENSING_URL' ) ) { return AIOSEO_LICENSING_URL; } return $this->baseUrl; } }