Skip to content

Commit 7ecd4f5

Browse files
author
Todd Gardner
committed
some security warnings from wordpress
1 parent c16242c commit 7ecd4f5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
=== Plugin Name ===
1+
=== Request Metrics Real User Performance Monitoring ===
22
Contributors: requestmetrics
3-
Tags: pagespeed, web-vitals, performance, speed, core-web-vitals, seo
3+
Tags: pagespeed, web-vitals, performance, speed, core-web-vitals
44
Requires at least: 4.9
55
Tested up to: 6.4.3
66
Stable tag: 1.0.0

request-metrics.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ function rm_add_admin_menu() {
7676
}
7777

7878
function rm_account_settings_section_render() {
79-
echo __('General settings to link your Request Metrics account.', 'request-metrics');
79+
echo esc_html(__('General settings to link your Request Metrics account.', 'request-metrics'));
8080
}
8181

8282
function rm_token_render() {
8383
$options = get_option('request_metrics');
8484
?>
85-
<input type='text' name='request_metrics[token]' value='<?php echo $options['token']; ?>'>
85+
<input type='text' name='request_metrics[token]' value='<?php echo esc_html($options['token']); ?>'>
8686
<?php
8787
}
8888

@@ -114,8 +114,8 @@ function rm_install_js_snippet() {
114114
<script>
115115
(function(t,e,n,r){function a(){return e&&e.now?e.now():null}if(!n.version){n._events=[];n._errors=[];n._metadata={};n._urlGroup=null;window.RM=n;n.install=function(e){n._options=e;var a=t.createElement("script");a.async=true;a.crossOrigin="anonymous";a.src=r;var o=t.getElementsByTagName("script")[0];o.parentNode.insertBefore(a,o)};n.identify=function(t,e){n._userId=t;n._identifyOptions=e};n.sendEvent=function(t,e){n._events.push({eventName:t,metadata:e,time:a()})};n.setUrlGroup=function(t){n._urlGroup=t};n.track=function(t,e){n._errors.push({error:t,metadata:e,time:a()})};n.addMetadata=function(t){n._metadata=Object.assign(n._metadata,t)}}})(document,window.performance,window.RM||{},"https://cdn.requestmetrics.com/agent/current/rm.js");
116116
RM.install({
117-
token: '<?php echo $options['token']; ?>'<?php if (!empty($page_group)) {?>,
118-
urlGroup: '<?php echo $page_group; ?>'<?php } ?>
117+
token: '<?php echo esc_js($options['token']); ?>'<?php if (!empty($page_group)) {?>,
118+
urlGroup: '<?php echo esc_js($page_group); ?>'<?php } ?>
119119
});
120120
</script>
121121
<?php
@@ -132,11 +132,11 @@ function rm_send_conversion($order_id) {
132132
?>
133133
<script>
134134
setTimeout(() => {
135-
var ORDER_TRACKED_KEY = "rm_order_tracked_<?php echo $order_id ?>";
135+
var ORDER_TRACKED_KEY = "rm_order_tracked_<?php echo esc_js($order_id); ?>";
136136
if (!localStorage.getItem(ORDER_TRACKED_KEY)) {
137137
window.RM && RM.sendEvent("purchase", {
138138
isConversion: true,
139-
conversionValue: <?php echo $order_total ?>
139+
conversionValue: <?php echo esc_js($order_total); ?>
140140
});
141141
localStorage.setItem(ORDER_TRACKED_KEY, true);
142142
}

0 commit comments

Comments
 (0)