Forum Replies Created

Viewing 1 replies (of 1 total)
  • Corrected plugin code.

    function rgmk_find_add_key( $url, $original_url, $_context ) {
    	$key = get_option( 'rgmk_google_map_api_key' );
    
    	// If no key added no point in checking
    	if ( ! $key ) {
    		return $url;
    	}
    
    	if ( strstr( $url, "maps.google.com/maps/api/js" ) !== false || strstr( $url, "maps.googleapis.com/maps/api/js" ) !== false ) {// it's a Google maps url
    
    		if ( strstr( $url, "key=" ) === false ) {// it needs a key
    			$url = add_query_arg( 'key',$key,$$original_url);
    			//$url = str_replace( "&", "&", $url ); // or $url = $original_url
    			$url = esc_url($url);
    		}
    
    	}
    
    	return $url;
    }
    • This reply was modified 9 years, 8 months ago by jancinert.
    • This reply was modified 9 years, 8 months ago by jancinert.
Viewing 1 replies (of 1 total)