summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/geo-location.php')
-rw-r--r--plugins/jetpack/modules/geo-location.php38
1 files changed, 27 insertions, 11 deletions
diff --git a/plugins/jetpack/modules/geo-location.php b/plugins/jetpack/modules/geo-location.php
index 4d3e255c..59fb2c0d 100644
--- a/plugins/jetpack/modules/geo-location.php
+++ b/plugins/jetpack/modules/geo-location.php
@@ -1,22 +1,38 @@
<?php
+/**
+ * Module: geo-location
+ *
+ * @package automattic/jetpack
+ */
+
+/**
+ * Adds support for geo-location features.
+ */
-require_once dirname( __FILE__ ) . '/geo-location/class.jetpack-geo-location.php';
+require_once __DIR__ . '/geo-location/class.jetpack-geo-location.php';
/**
- * Geo-location shortcode for display of location data associated with a post.
+ * Geo-location shortcode callback for display of location data associated with a post.
*
* Usage with current global $post:
* [geo-location]
*
* Usage with specific post ID:
* [geo-location post=5]
+ *
+ * @param array $attributes Shortcode attributes.
*/
-add_shortcode( 'geo-location', 'jetpack_geo_shortcode' );
-
function jetpack_geo_shortcode( $attributes ) {
- $attributes = shortcode_atts( array( 'post' => null, 'id' => null ), $attributes );
+ $attributes = shortcode_atts(
+ array(
+ 'post' => null,
+ 'id' => null,
+ ),
+ $attributes
+ );
return jetpack_geo_get_location( $attributes['post'] ? $attributes['post'] : $attributes['id'] );
}
+add_shortcode( 'geo-location', 'jetpack_geo_shortcode' );
/**
* Get the geo-location data associated with the supplied post ID, if it's available
@@ -26,11 +42,11 @@ function jetpack_geo_shortcode( $attributes ) {
* If you do not supply a value for $post_id, the global $post will be used, if
* available.
*
- * @param integer|null $post_id
+ * @param integer|null $post_id Post ID.
*
* @return array|null
*/
-function jetpack_geo_get_data( $post_id = null) {
+function jetpack_geo_get_data( $post_id = null ) {
$geo = Jetpack_Geo_Location::init();
if ( ! $post_id ) {
@@ -46,7 +62,7 @@ function jetpack_geo_get_data( $post_id = null) {
return array(
'latitude' => $meta_values['latitude'],
'longitude' => $meta_values['longitude'],
- 'label' => $meta_values['label']
+ 'label' => $meta_values['label'],
);
}
@@ -57,12 +73,12 @@ function jetpack_geo_get_data( $post_id = null) {
* If you do not supply a value for $post_id, the global $post will be used, if
* available.
*
- * @param integer|null $post_id
+ * @param integer|null $post_id Post ID.
*
* @return void
*/
function jetpack_geo_display_location( $post_id = null ) {
- echo jetpack_geo_get_location( $post_id );
+ echo jetpack_geo_get_location( $post_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in `Jetpack_Geo_Location::get_location_label`.
}
/**
@@ -72,7 +88,7 @@ function jetpack_geo_display_location( $post_id = null ) {
* If you do not supply a value for $post_id, the global $post will be used, if
* available.
*
- * @param integer|null $post_id
+ * @param integer|null $post_id Post ID.
*
* @return string
*/