Skip to content

Commit f237fe5

Browse files
authored
Merge pull request #1 from basicrum/fix
fix variable replace in template
2 parents 0f3cfe5 + 693ca90 commit f237fe5

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

‎includes/core-functions.php‎

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,26 @@
33
if ( ! defined( 'ABSPATH' ) ){
44
exit;
55
}
6-
function basicrum_code() {
7-
// On plugin install, all values doesn't exist in db. That's why we do a check and get values from function basicrum_options_default()
86

9-
if ( !isset( get_option('basicrum_options')['url_to_send_data'] ) ) {
10-
$url = basicrum_options_default()['url_to_send_data'];
11-
} else {
12-
$url = get_option('basicrum_options')['url_to_send_data'];
7+
function basicrum_get_option($key) {
8+
// On plugin install, all values doesn't exist in db. That's why we do a check and get values from function basicrum_options_default()
9+
$result = get_option('basicrum_options')[$key];
10+
if (isset($result)) {
11+
return $result;
1312
}
13+
return basicrum_options_default()[$key];
14+
}
1415

15-
if ( !isset( get_option('basicrum_options')['delay_sending_data'] ) ) {
16-
$milliseconds = basicrum_options_default()['delay_sending_data'];
17-
} else {
18-
$milliseconds = get_option('basicrum_options')['delay_sending_data'];
19-
}
16+
function basicrum_code() {
2017

21-
if ( !isset( get_option('basicrum_options')['monitoring_type'] ) ) {
22-
$boomerang_version = basicrum_options_default()['monitoring_type'];
23-
} else {
24-
$boomerang_version = get_option('basicrum_options')['monitoring_type'];
25-
}
18+
$url = basicrum_get_option('url_to_send_data');
19+
$milliseconds = basicrum_get_option('delay_sending_data');
20+
$boomerang_version = basicrum_get_option('monitoring_type');
2621

2722
$boomerangConfig = <<<EOT
2823
<script data-cfasync="false">
2924
(function(w) {
30-
var WAIT_AFTER_ONLOAD_MILLISECONDS = {{$milliseconds}};
25+
var WAIT_AFTER_ONLOAD_MILLISECONDS = {$milliseconds};
3126
3227
if (!w) {
3328
return;
@@ -54,7 +49,7 @@ function basicrum_code() {
5449
};
5550
5651
w.basicRumBoomerangConfig = {
57-
beacon_url: "{{$url}}",
52+
beacon_url: "{$url}",
5853
instrument_xhr: true,
5954
Continuity: {
6055
enabled: true

0 commit comments

Comments
 (0)