liberty
[ class tree: liberty ] [ index: liberty ] [ all elements ]

Source for file data.googleviewer.php

Documentation is available at data.googleviewer.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_data
  6.  */
  7.  
  8. /**
  9.  * definitions
  10.  */
  11.  
  12. global $gLibertySystem;
  13. define'PLUGIN_GUID_DATAGOOGLEVIEWER''datagoogleviewer' );
  14. $pluginParams array (
  15.     'tag'           => 'GOOGLEVIEWER',
  16.     'auto_activate' => FALSE,
  17.     'requires_pair' => FALSE,
  18.     'load_function' => 'data_googleviewer',
  19.     'title'         => 'Google Viewer',
  20.     'help_page'     => 'DataPluginGoogleviewer',
  21.     'description'   => tra"This plugin allows you to simply embed a PDF document in a page using the embeddable Google Viewer." ),
  22.     'help_function' => 'data_googleviewer_help',
  23.     'syntax'        => "{googleviewer url=}",
  24.     'plugin_type'   => DATA_PLUGIN
  25. );
  26. $gLibertySystem->registerPluginPLUGIN_GUID_DATAGOOGLEVIEWER$pluginParams );
  27. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATAGOOGLEVIEWER );
  28.  
  29. /**
  30.  * data_googleviewer_help
  31.  * 
  32.  * @access public
  33.  * @return HTML help in a table
  34.  */
  35. function data_googleviewer_help({
  36.     return
  37.         '<table class="data help">'
  38.             .'<tr>'
  39.                 .'<th>' tra"Key" '</th>'
  40.                 .'<th>' tra"Type" '</th>'
  41.                 .'<th>' tra"Comments" '</th>'
  42.             .'</tr>'
  43.             .'<tr class="odd">'
  44.                 .'<td>url</td>'
  45.                 .'<td>' tra"string" '<br />' tra("(required)"'</td>'
  46.                 .'<td>' tra"URL of the PDF online" '</td>'
  47.             .'</tr>'
  48.             .'<tr class="even">'
  49.                 .'<td>width</td>'
  50.                 .'<td>' tra"numeric" '<br />' tra"(optional)" '</td>'
  51.                 .'<td>' tra"Alternate width of the Google Viewer box in pixels.  Default is 100%." '</td>'
  52.             .'</tr>'
  53.             .'<tr class="odd">'
  54.                 .'<td>height</td>'
  55.                 .'<td>' tra"numeric" '<br />' tra("(optional)"'</td>'
  56.                 .'<td>' tra"Alternate height of the Google Viewer box in pixels. Default is 650." '</td>'
  57.             .'</tr>'
  58.         .'</table>'
  59.         . tra"Example: " '{googleviewer url=XXXXX width=425 height=355}';
  60. }
  61.  
  62. /**
  63.  * data_googleviewer
  64.  * 
  65.  * @param array $pData 
  66.  * @param array $pParams 
  67.  * @access public
  68.  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  69.  */
  70. function data_googleviewer$pData$pParams {
  71.     extract$pParams );
  72.     $width   !empty$width )  $width  "100%" );
  73.     $height  !empty$height $height "650" );
  74.  
  75.     if!empty$url )) {
  76.         return '<!--~np~--><iframe width="'.$width.'" height="'.$height.'" style="border:none;" src="http://docs.google.com/viewer?embedded=true&url='.urlencode($url).'"></iframe><!--~/np~-->';
  77.     else {
  78.         return tra'No URL given' );
  79.     }
  80. }
  81. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:19 +0000 by phpDocumentor 1.5.0-lsces