/** * Build the URI for the purge request. * * @since 1.0.0. * * @param string $key The surrogate key for the group of items to purge. * @return string The purge URI. */ private function _build_request_uri_for_surrogate_key($key) { return trailingslashit(PURGELY_API_ENDPOINT) . 'service/' . PURGELY_FASTLY_SERVICE_ID . '/purge/' . purgely_sanitize_surrogate_key($key); }
/** * Build the URI for the purge request. * * @since 1.0.0. * * @param string $key The surrogate key for the group of items to purge. * @return string The purge URI. */ private function _build_request_uri_for_surrogate_key($key) { $api_endpoint = Purgely_Settings::get_setting('api_endpoint'); $fastly_service_id = Purgely_Settings::get_setting('fastly_service_id'); return trailingslashit($api_endpoint) . 'service/' . $fastly_service_id . '/purge/' . purgely_sanitize_surrogate_key($key); }
/** * Determine if the first arg is a surrogate key. * * @param string $thing The first argument passed to the function. * @return bool True if the thing is a surrogate key, false if not. */ private function _is_key($thing) { return !empty($thing) && purgely_sanitize_surrogate_key($thing) === $thing; }
/** * Sanitize a surrogate key. * * @since 1.0.0. * * @param string $key The unsanitized key. * @return string The sanitized key. */ public function sanitize_key($key) { return purgely_sanitize_surrogate_key($key); }