<?php if (!defined('PmWiki')) exit (); /* Google Voice Widget for PmWiki instructions for use are located at http://www.pmwiki.org/wiki/Cookbook/GoogleVoice (:googleVoice id width=XXX height=XXX:) + an $ROEPatterns that automatically converts the Google Voice Widget into valid PmWiki markup copyright 2010, Adam Overton 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. */ # Version date $RecipeInfo['GoogleVoiceWidget']['Version'] = '2010-08-26'; Markup('GoogleVoiceWidget', '<img', "/\\(:googleVoice\\s+([^\\s]+)\\s*:\\)/e", "GoogleVoiceWidgetFunc('$1')"); $ROEPatterns['!<object.*google\.com\/voice\/embed\/webCallButton.*<\/object>!ie'] = "GoogleVoiceWidgetROE(PSS('$0'))"; function GoogleVoiceWidgetROE($pattern) { preg_match('#id=([^"\'&]+)[&"\']#', $pattern, $matches); $id = $matches[1]; $out = "(:googleVoice $id:)"; return $out; } # Example Output # <object type="application/x-shockwave-flash" data="https://clients4.google.com/voice/embed/webCallButton" width="230" height="85"><param name="movie" value="https://clients4.google.com/voice/embed/webCallButton" /><param name="wmode" value="transparent" /><param name="FlashVars" value="id=NNNNNNNNNNNNNNNNNNNN&style=0" /></object> function GoogleVoiceWidgetFunc($id) { $out = '<object type="application/x-shockwave-flash" data="https://clients4.google.com/voice/embed/webCallButton" width="230" height="85"><param name="movie" value="https://clients4.google.com/voice/embed/webCallButton" /><param name="wmode" value="transparent" /><param name="FlashVars" value="id='.$id.'&style=0" /></object>'; return Keep($out); }