<?php if (!defined('PmWiki')) exit(); /* +----------------------------------------------------------------------+ | Copyright 2011 Andy Gaskell, . | Designer and Developer @ Software Systems: Open For Business | ag@ssofb.co.uk, www.ssofb.co.uk | A web design and development company based in Aberdeen, UK. | | This program is free software; you can redistribute it and/or modify | it under the terms of the GNU General Public License, Version 2, as | published by the Free Software Foundation. | http://www.gnu.org/copyleft/gpl.html | This program is distributed in the hope that it will be useful, | but WITHOUT ANY WARRANTY; without even the implied warranty of | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | GNU General Public License for more details. +----------------------------------------------------------------------+ Refs: http://www.pmwiki.org/wiki/Cookbook/GooglePlusOne http://www.google.com/intl/en_GB/webmasters/+1/button/index.html http://code.google.com/apis/+1button/ */ # Version date # version 1.0 SDV($RecipeInfo['googleplusone']['Version'], '2011-06-30'); # basic version Markup('googleplusone', 'inline', '/\\(:googleplusone:\\)/e', 'f_googleplusone()'); # version with options Markup('googleplusoneadvanced', 'inline', '/\\(:googleplusone (.*?):\\)/e', 'f_googleplusone("$1")'); ## Add in JS. SDV($HTMLHeaderFmt['googleplusone'], "<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\"></script>"); # function that generates the output function f_googleplusone($options=0) { # check whats passed in $args = ParseArgs($options); # use the size option $size = $args['size']; if ($size == "small") { $sizeoption = " size=\"small\" "; } elseif ($size == "medium") { $sizeoption = " size=\"medium\" "; } elseif ($size == "large") { $sizeoption = " size=\"tall\" "; } else { $sizeoption = ""; } # use the count option $count = $args['count']; if ($count) { $countoption = " count=\"false\" "; } else { $countoption = ""; } # use the url option $url = $args['url']; if ($url) { $urloption = " href=\"" . $url . "\" "; } else { $urloption = ""; } # generate the output $output = "<!-- Google Plus One -->"; $output .= "<g:plusone " . $sizeoption . " " . $countoption . " " . $urloption . "></g:plusone>"; return Keep($output); } ?>