Commit:    426758701bcfa182ef5214eacb775a5c2584c1fb
Author:    Peter Cowburn <[email protected]>         Wed, 6 Dec 2017 13:40:05 
+0000
Parents:   6105808df062c793f29c05363c4ced62f6ef4c21
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=426758701bcfa182ef5214eacb775a5c2584c1fb

Log:
update cse code

The old CSE code stopped working Dec 4th, use the new
recommended way of embedding CSE.

Thanks Philip!

Changed paths:
  M  include/prepend.inc


Diff:
diff --git a/include/prepend.inc b/include/prepend.inc
index 23ded65..7969612 100644
--- a/include/prepend.inc
+++ b/include/prepend.inc
@@ -209,27 +209,18 @@ function google_cse($default = '', $lang = 'en') {
   php.net's search functionality requires JavaScript to operate. Please enable
   JavaScript and reload to continue.
 </noscript>
-<div id="cse" style="width: 100%;"></div>
-<script src="//www.google.com/jsapi" type="text/javascript"></script>
-<script type="text/javascript"> 
-  document.getElementById("cse").innerHTML = "Loading...";
-  google.load('search', '1', {language : '<?php echo $lang; ?>', style : 
google.loader.themes.MINIMALIST});
-  google.setOnLoadCallback(function() {
-    var customSearchOptions = {};
-    var customSearchControl = new google.search.CustomSearchControl(
-      '011570197911755000456:fip9wopfz_u', customSearchOptions);
-    customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
-    
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
-    var options = new google.search.DrawOptions();
-    options.setAutoComplete(true);
-    customSearchControl.draw('cse', options);
-<?php
-    if ($default) {
-        echo "    customSearchControl.execute(" . json_encode($default) . ");";
-    }
-?>
-  }, true);
+<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>
+<gcse:search></gcse:search>
 <?php
 }


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to