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

Source for file HTMLEmbed.class.php

Documentation is available at HTMLEmbed.class.php

  1. <?php
  2. /**
  3.  * @package html
  4.  */
  5.  
  6. /**
  7.  *
  8.  */
  9. include_once CLASSPATH."filesystem/Files.class.php";
  10. /**
  11.  *
  12.  */
  13. include_once CLASSPATH."html/ABSTHTMLTag.class.php";
  14.  
  15. /**
  16.  * @package html
  17.  *
  18.  * @version    0.1.1
  19.  * @since      0.9.0.8
  20.  * @deprecated
  21.  * @author     Daniel Plücken <daniel@debakel.net>
  22.  * @license    http://www.gnu.org/copyleft/lesser.html
  23.  *              GNU Lesser General Public License
  24.  * @copyright  Copyright (C) 2006 Daniel Plücken <daniel@debakel.net>
  25.  *
  26.  *  This library is free software; you can redistribute it and/or
  27.  *  modify it under the terms of the GNU Lesser General Public
  28.  *  License as published by the Free Software Foundation; either
  29.  *  version 2.1 of the License.
  30.  *
  31.  *  This library is distributed in the hope that it will be useful,
  32.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  33.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34.  *  GNU Lesser General Public License for more details.
  35.  *
  36.  *  You should have received a copy of the GNU Lesser General
  37.  *  Public License along with this library; if not, write to the
  38.  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  39.  *  Boston, MA 02111-1307 USA
  40.  */
  41. class HTMLEmbed extends Files
  42. {
  43.   /**
  44.    * @access public
  45.    * @var    string  $kind 
  46.    */
  47.   var $kind = ""// MPG, MOV or AVI
  48.   /**
  49.    * Stores the value of the width-attribute of this HTMLEmbed-object.
  50.    *
  51.    * @var   integer $width 
  52.    *  access public
  53.    */
  54.   var $width;
  55.   /**
  56.    * Stores the value of the height-attribute of this HTMLEmbed-object.
  57.    *
  58.    * @var   integer $height 
  59.    *  access public
  60.    */
  61.   var $height;
  62.   /**
  63.    * Stores the url of the plugin to play the embeded file.
  64.    *
  65.    * @var    string $pluginspage 
  66.    * @access public
  67.    */
  68.   var $pluginspage = "http://www.apple.com/quicktime/download/";
  69.   /**
  70.    * @access public
  71.    * @var    string $str_show_controller 
  72.    */
  73.   var $str_show_controller = "true";
  74.   /**
  75.    * @access public
  76.    * @var    string $str_autoplay 
  77.    */
  78.   var $str_autoplay = "true";
  79.   /**
  80.    * @access public
  81.    * @var    string $mime_type 
  82.    */
  83.   var $mime_type = "";
  84.  
  85.  
  86.  
  87.   /**
  88.    * Constructor
  89.    *
  90.    * @access  public
  91.    * @version 1.03
  92.    * @since   0.1.0
  93.    *
  94.    * @param   string  $path_and_filename 
  95.    * @or
  96.    * @param   string  $path 
  97.    * @param   string  $filename 
  98.    */
  99.   function HTMLEmbed$path$filename "" )
  100.   {
  101.     parent::Files$path$filename );
  102.  
  103.     if (
  104.          $this->kind == "MPG"
  105.       || preg_match"!\.mpe?g$!i"$this->filename )
  106.        )
  107.     {
  108.        $this->kind = "MPG";
  109.        $this->mime_type = "video/mpeg";
  110.     }
  111.     else
  112.     if (
  113.          $this->kind == "MOV"
  114.       || preg_match"!\.mov$!i",  $this->filename )
  115.        )
  116.     {
  117.        $this->kind = "MOV";
  118.        $this->mime_type = "video/quicktime";
  119.     }
  120.     else
  121.     if (
  122.         $this->kind == "AVI"
  123.       || preg_match"!\.avi$!i",  $this->filename )
  124.        )
  125.     {
  126.        $this->kind = "AVI";
  127.        $this->mime_type = "video/avi";
  128.     }
  129.     else
  130.       die"Not supported file format!" );
  131.  
  132.   }
  133.  
  134.  
  135.  
  136.   /**
  137.    * Sets the value of the attribute pluginspage of the embed-tag.
  138.    *
  139.    * @version 1.0
  140.    * @since   0.1.0
  141.    * @author  Daniel Plücken <daniel@debakel.net>
  142.    * @access  public
  143.    * @param   string $url 
  144.    * @return  void 
  145.    */
  146.   function setPluginspage$url )
  147.   $this->pluginspage = ""}
  148.  
  149.  
  150.  
  151.   /**
  152.    * Sets how the uploaded file should be named.
  153.    *
  154.    * @access  public
  155.    * @version 1.0
  156.    * @since   0.1.0
  157.    *
  158.    * @param   integer $int 
  159.    *
  160.    * @return  void 
  161.    */
  162.   function setWidth$int )
  163.   {
  164.     if preg_match"!^\d+$!"$int ) )
  165.        $this->width = intval$int );
  166.   }
  167.  
  168.  
  169.  
  170.   /**
  171.    * Sets how the uploaded file should be named.
  172.    *
  173.    * @access  public
  174.    * @version 1.0
  175.    * @since   0.1.0
  176.    *
  177.    * @param   integer $int 
  178.    *
  179.    * @return  void 
  180.    */
  181.   function setHeight$int )
  182.   {
  183.     if preg_match"!^\d+$!"$int ) )
  184.        $this->height = intval$int );
  185.   }
  186.  
  187.  
  188.  
  189.   /**
  190.    * Returns a generated string based on the attributes of this HTML-Object.
  191.    *
  192.    * @access  public
  193.    * @version 1.02
  194.    * @since   0.1.0
  195.    *
  196.    * @return  string 
  197.    */
  198.   function get()
  199.   {
  200.     ABSTHTMLTag::idExists$this->idtrue );
  201.     if !preg_match"!/$!"$this->path ) )
  202.        $this->path .= "/";
  203.  
  204.     return "<embed src=\"".$this->path.$this->filename."\" "
  205.                  .(
  206.                     !empty$this->width )
  207.                     ? "width=\"".$this->width."\" "
  208.                     : ""
  209.                   )
  210.                  .(
  211.                     !empty$this->height )
  212.                     ? "height=\"".$this->height."\" "
  213.                     : ""
  214.                   )
  215.                  ."controller=\"".$this->str_show_controller."\" "
  216.                  ."autoplay=\"".$this->str_autoplay."\" "
  217.                  ."type=\"".$this->mime_type."\" "
  218.                  ."pluginspage=\"".$this->pluginspage."\">"
  219.           ."</embed>";
  220.   }
  221. // END of class HTMLEmbed
  222. ?>

Documentation generated on Thu, 05 Jun 2008 19:12:10 +0200 by phpDocumentor 1.4.1