Source for file embed.php

Documentation is available at embed.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Google
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11. jimport('joomla.environment.uri');
  12.  
  13. /**
  14.  * Google API object class for the Joomla Platform.
  15.  *
  16.  * @package     Joomla.Platform
  17.  * @subpackage  Google
  18.  * @since       12.3
  19.  */
  20. abstract class JGoogleEmbed
  21. {
  22.     /**
  23.      * @var    JRegistry  Options for the Google data object.
  24.      * @since  12.3
  25.      */
  26.     protected $options;
  27.  
  28.     /**
  29.      * @var    JUri  URI of the page being rendered.
  30.      * @since  12.3
  31.      */
  32.     protected $uri;
  33.  
  34.     /**
  35.      * Constructor.
  36.      *
  37.      * @param   JRegistry  $options  Google options object
  38.      * @param   JUri       $uri      URL of the page being rendered
  39.      *
  40.      * @since   12.3
  41.      */
  42.     public function __construct(JRegistry $options nullJUri $uri null)
  43.     {
  44.         $this->options = $options $options new JRegistry;
  45.         $this->uri = $uri $uri new JUri;
  46.     }
  47.  
  48.     /**
  49.      * Method to retrieve the javascript header for the embed API
  50.      *
  51.      * @return  string  The header
  52.      *
  53.      * @since   12.3
  54.      */
  55.     public function isSecure()
  56.     {
  57.         return $this->uri->getScheme(== 'https';
  58.     }
  59.  
  60.     /**
  61.      * Method to retrieve the header for the API
  62.      *
  63.      * @return  string  The header
  64.      *
  65.      * @since   12.3
  66.      */
  67.     abstract public function getHeader();
  68.  
  69.     /**
  70.      * Method to retrieve the body for the API
  71.      *
  72.      * @return  string  The body
  73.      *
  74.      * @since   12.3
  75.      */
  76.     abstract public function getBody();
  77.  
  78.     /**
  79.      * Method to output the javascript header for the embed API
  80.      *
  81.      * @return  null 
  82.      *
  83.      * @since   12.3
  84.      */
  85.     public function echoHeader()
  86.     {
  87.         echo $this->getHeader();
  88.     }
  89.  
  90.     /**
  91.      * Method to output the body for the API
  92.      *
  93.      * @return  null 
  94.      *
  95.      * @since   12.3
  96.      */
  97.     public function echoBody()
  98.     {
  99.         echo $this->getBody();
  100.     }
  101.  
  102.     /**
  103.      * Get an option from the JGoogleEmbed instance.
  104.      *
  105.      * @param   string  $key  The name of the option to get.
  106.      *
  107.      * @return  mixed  The option value.
  108.      *
  109.      * @since   12.3
  110.      */
  111.     public function getOption($key)
  112.     {
  113.         return $this->options->get($key);
  114.     }
  115.  
  116.     /**
  117.      * Set an option for the JGoogleEmbed instance.
  118.      *
  119.      * @param   string  $key    The name of the option to set.
  120.      * @param   mixed   $value  The option value to set.
  121.      *
  122.      * @return  JGoogleEmbed  This object for method chaining.
  123.      *
  124.      * @since   12.3
  125.      */
  126.     public function setOption($key$value)
  127.     {
  128.         $this->options->set($key$value);
  129.  
  130.         return $this;
  131.     }
  132. }

Documentation generated on Tue, 19 Nov 2013 15:02:28 +0100 by phpDocumentor 1.4.3