GC_Community_Events::get_events_transient_key()

最后更新于:2021-11-26 22:58:12

GC_Community_Events::get_events_transient_key( array$location)

Generates a transient key based on user location.

参数

$location

(array) (Required) Should contain ‘latitude’ and ‘longitude’ indexes.

响应

(string|false) Transient key on success, false on failure.

源文件

文件: gc-admin/includes/class-gc-community-events.php

	protected function get_events_transient_key( $location ) {
		$key = false;

		if ( isset( $location['ip'] ) ) {
			$key = 'community-events-' . md5( $location['ip'] );
		} elseif ( isset( $location['latitude'], $location['longitude'] ) ) {
			$key = 'community-events-' . md5( $location['latitude'] . $location['longitude'] );
		}

		return $key;
	}