diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2019-01-01 22:18:11 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2019-01-01 22:18:11 -0500 |
commit | 018bd442ec1e04ba78a6628763414eb60b359398 (patch) | |
tree | 448cde462397af33e5a964ba5d0803b73c65040e /plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php | |
parent | Update easy-table 1.8 (diff) | |
download | blogs-gentoo-018bd442ec1e04ba78a6628763414eb60b359398.tar.gz blogs-gentoo-018bd442ec1e04ba78a6628763414eb60b359398.tar.bz2 blogs-gentoo-018bd442ec1e04ba78a6628763414eb60b359398.zip |
Update jetpack 6.8.1
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php')
-rw-r--r-- | plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php b/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php index 1e0094f2..e4941537 100644 --- a/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php +++ b/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php @@ -33,6 +33,15 @@ class Jetpack_Geo_Location { private static $instance; + /** + * Whether dashicons are enqueued. + * + * @since 6.6.0 + * + * @var bool + */ + private static $style_enqueued = false; + public static function init() { if ( is_null( self::$instance ) ) { self::$instance = new Jetpack_Geo_Location(); @@ -52,7 +61,6 @@ class Jetpack_Geo_Location { add_action( 'init', array( $this, 'wordpress_init' ) ); add_action( 'wp_head', array( $this, 'wp_head' ) ); add_filter( 'the_content', array( $this, 'the_content_microformat' ) ); - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); $this->register_rss_hooks(); } @@ -152,6 +160,12 @@ class Jetpack_Geo_Location { return; } + if ( ! self::$style_enqueued ) { + // only enqueue scripts and styles when needed. + self::enqueue_scripts(); + self::$style_enqueued = true; + } + echo "\n<!-- Jetpack Geo-location Tags -->\n"; if ( $meta_values['label'] ) { @@ -235,7 +249,7 @@ class Jetpack_Geo_Location { * Add the georss namespace during RSS generation. */ public function rss_namespace() { - echo 'xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" '; + echo PHP_EOL . 'xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"' . PHP_EOL; } /** @@ -262,7 +276,7 @@ class Jetpack_Geo_Location { /** * Enqueue CSS for rendering post flair with geo-location. */ - public function enqueue_scripts() { + private static function enqueue_scripts() { wp_enqueue_style( 'dashicons' ); } |