Skip to content

Commit

Permalink
Enhancement: Use heredoc strings to print cse_snippet and remove end …
Browse files Browse the repository at this point in the history
…of file delimiter
  • Loading branch information
PablNico committed Sep 11, 2024
1 parent a9db9b9 commit ea310b1
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions include/prepend.inc
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,26 @@ function myphpnet_save(): void

}

// Embed Google Custom Search engine
function google_cse(): void {
?>
<noscript>
php.net's search functionality requires JavaScript to operate. Please enable
JavaScript and reload to continue.
</noscript>
<script>
(function() {
var cx = '011570197911755000456:fip9wopfz_u';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<div class="gcse-search" data-linktarget></div>
<?php
$cse_snippet = <<<EOF
<noscript>
php.net's search functionality requires JavaScript to operate. Please enable
JavaScript and reload to continue.
</noscript>
<script>
(function() {
var cx = '011570197911755000456:fip9wopfz_u';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<div class="gcse-search" data-linktarget></div>
EOF;

echo $cse_snippet;
}

0 comments on commit ea310b1

Please sign in to comment.