Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Adding "annotation" and updating script inclusion #1

Merged
merged 1 commit into from Jan 19, 2012
Jump to file or symbol
Failed to load files and symbols.
+11 −3
Split
View
@@ -1,6 +1,7 @@
<?php
$url = isset($_GET['url']) ? $_GET['url'] : "";
$size = isset($_GET['size']) ? $_GET['size'] : "";
+$anno = isset($_GET['annotation']) ? $_GET['annotation'] : "inline";
if(empty($url)) {
echo "Need to specify URL (?url=http://...)";
@@ -22,8 +23,15 @@
<body>
<!-- See http://www.google.com/webmasters/+1/button/index.html -->
<!-- Place this tag where you want the +1 button to render -->
-<g:plusone size="<?php echo htmlspecialchars($size); ?>" href="<?php echo htmlspecialchars($url); ?>"></g:plusone>
-<!-- Place this tag in your head or just before your close body tag -->
-<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
+<g:plusone size="<?php echo htmlspecialchars($size); ?>" annotation="<?php echo htmlspecialchars($anno) ?>" href="<?php echo htmlspecialchars($url); ?>"></g:plusone>
+
+<!-- Place this render call where appropriate -->
+<script type="text/javascript">
+ (function() {
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+ po.src = 'https://apis.google.com/js/plusone.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+ })();
+</script>
</body>
</html>