File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,17 @@ Filters the Rollbar JavaScript configuration.
193193
194194* ` array $config ` - The Rollbar JavaScript configuration array.
195195
196+ #### ` apply_filters('rollbar_js_nonce', string|null $nonce) `
197+
198+ Filter that can be used to set the nonce attribute value of the frontend JS script.
199+
200+ ** Since: 3.1.0**
201+
202+ ** Parameters**
203+
204+ * ` string|null $nonce ` - The nonce value to be used in the script tag. If ` null ` the attribute is excluded. Default
205+ is ` null ` .
206+
196207#### ` apply_filters('rollbar_plugin_settings', array $settings) `
197208
198209Filters the Rollbar plugin settings.
Original file line number Diff line number Diff line change @@ -349,7 +349,16 @@ public function initJsLogging(): void
349349 return ;
350350 }
351351
352- $ rollbarJs = RollbarJsHelper::buildJs ($ this ->buildJsConfig ());
352+ /**
353+ * Filter that can be used to set the nonce attribute value of the frontend JS script.
354+ *
355+ * @param string|null $nonce The nonce value to be used in the script tag. If `null` the attribute is excluded.
356+ * Default is `null`.
357+ * @since 3.1.0
358+ */
359+ $ nonce = apply_filters ('rollbar_js_nonce ' , null );
360+
361+ $ rollbarJs = RollbarJsHelper::buildJs ($ this ->buildJsConfig (), nonce: $ nonce );
353362
354363 echo $ rollbarJs ;
355364 }
You can’t perform that action at this time.
0 commit comments