Skip to content

Commit 148a209

Browse files
committed
added escaping for the missing attributes
1 parent 34e8d68 commit 148a209

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

opengraph.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Adds Open Graph metadata to your pages
66
* Author: Will Norris
77
* Author URI: http://willnorris.com/
8-
* Version: 1.8.2
8+
* Version: 1.8.3
99
* License: Apache License, Version 2.0
1010
* License URI: http://www.apache.org/licenses/LICENSE-2.0.html
1111
* Text Domain: opengraph
@@ -44,7 +44,7 @@ function opengraph_add_prefix( $output ) {
4444
if ( preg_match( '/(prefix\s*=\s*[\"|\'])/i', $output ) ) {
4545
$output = preg_replace( '/(prefix\s*=\s*[\"|\'])/i', '${1}' . $prefix_str, $output );
4646
} else {
47-
$output .= ' prefix="' . $prefix_str . '"';
47+
$output .= ' prefix="' . esc_attr( $prefix_str ) . '"';
4848
}
4949

5050
return $output;
@@ -163,7 +163,7 @@ function opengraph_default_title( $title ) {
163163
$title = get_the_archive_title();
164164
}
165165

166-
return $title;
166+
return esc_attr( $title );
167167
}
168168

169169

@@ -181,7 +181,7 @@ function opengraph_default_type( $type ) {
181181
}
182182
}
183183

184-
return $type;
184+
return esc_attr( $type );
185185
}
186186

187187

@@ -283,7 +283,7 @@ function opengraph_default_url( $url ) {
283283
}
284284
}
285285

286-
return $url;
286+
return esc_url( $url );
287287
}
288288

289289

@@ -295,7 +295,7 @@ function opengraph_default_sitename( $name ) {
295295
$name = get_bloginfo( 'name' );
296296
}
297297

298-
return $name;
298+
return esc_attr( $name );
299299
}
300300

301301

@@ -332,7 +332,7 @@ function opengraph_default_description( $description ) {
332332
$description = strip_tags( strip_shortcodes( $description ) );
333333
$description = __opengraph_trim_text( $description );
334334

335-
return $description;
335+
return esc_attr( $description );
336336
}
337337

338338

@@ -363,7 +363,7 @@ function twitter_default_card( $card ) {
363363
$card = 'summary_large_image';
364364
}
365365

366-
return $card;
366+
return esc_attr( $card );
367367
}
368368

369369

@@ -390,7 +390,7 @@ function twitter_default_creator( $creator ) {
390390
$creator = '@' . $matches[1];
391391
}
392392

393-
return $creator;
393+
return esc_attr( $creator );
394394
}
395395

396396

readme.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: willnorris, pfefferle
33
Tags: social, opengraph, ogp, facebook
44
Requires at least: 2.3
5-
Tested up to: 4.9.9
6-
Stable tag: 1.8.2
5+
Tested up to: 5.0.3
6+
Stable tag: 1.8.3
77
License: Apache License, Version 2.0
88
License URI: http://www.apache.org/licenses/LICENSE-2.0.html
99

@@ -65,6 +65,9 @@ The plugin populates the meta 'name' attribute alongside the 'property' attribut
6565

6666
Project maintained on github at [willnorris/wordpress-opengraph](https://github.com/willnorris/wordpress-opengraph).
6767

68+
= version 1.8.3 (Jan 27, 2019) =
69+
- added escaping for the missing attributes
70+
6871
= version 1.8.2 (Nov 21, 2018) =
6972
- fixed PHP warning issue: <https://wordpress.org/support/topic/php-warning-count-parameter-must-be-an-array-or-an-object-that-implements-c/>
7073

0 commit comments

Comments
 (0)