12.07
php
saved
gwoo
Note
Latest swf object helper, check __baseOptions for the default usage.
Latest swf object helper, check __baseOptions for the default usage.
- <?php
- /* SVN FILE: $Id: swfobject.php 16 2006-12-04 07:51:37Z gwoo $ */
- /**
- * Short description for file.
- *
- * Long description here...
- *
- * PHP versions 4 and 5
- *
- * TBD
- * Copyright (c) 2006, Cake Software Foundation, Inc.
- * 1785 E. Sahara Avenue, Suite 490-204
- * Las Vegas, Nevada 89104
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @filesource
- * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
- * @link TBD
- * @package TBD
- * @subpackage TBD.views.helpers
- * @since TBD
- * @version $Revision: 16 $
- * @modifiedby $LastChangedBy: gwoo $
- * @lastmodified $Date: 2006-12-03 23:51:37 -0800 (Sun, 03 Dec 2006) $
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
- /**
- * Short description for class.
- *
- * Long description for class..
- *
- * @brief Class wrapper for the SWFObject.
- * @dependencies SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ put the js file in app/webroot/js/
- * @package TBD
- * @subpackage TBD.views.helpers
- * @brief Class wrapper for the SWFObject.
- * @dependencies SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ put the js file in app/webroot/js/
- *
- */
- class SwfobjectHelper extends Helper {
- /**
- * The name of the message div
- *
- * @var string
- */
- var $div = 'flashcontent';
- /**
- * the message to display when the user needs to upgrade
- *
- * @var string
- */
- var $message = '<strong>You need to upgrade your Flash Player</strong>
- This is replaced by the Flash content. Place your alternate content here
- and users without the Flash plugin or with Javascript turned off will see
- this. Content here allows you to leave out <code>noscript</code> tags.';
- /**
- * Flash vars. addVariable
- *
- * @var array
- */
- /**
- * Swfobject params. addParam
- *
- * @var array
- */
- /**
- * Attributes. addAttribute
- *
- * @var unknown_type
- */
- /**
- * Enter description here...
- *
- * @var unknown_type
- */
- 'version' => '9', 'bgColor' => '#fff', 'express' => true);
- /**
- * Enter description here...
- *
- * @param string $path
- * @param array $options defaults to __baseConfig
- * @return formatted js code for
- */
- $options = am($this->__baseOptions, $options);
- if($this->__debug) {
- }
- $out = '
- <div id="'.$this->div.'">
- '.$this->message.'
- </div>
- ';
- $out .= '<script type="text/javascript">
- // <![CDATA[
- ';
- $out .= 'var so = new SWFObject("'.str_replace('//', '/', $this->webroot.$path).'", "'.join('","', $options).'");';
- foreach ($this->__flashvars as $flashvar => $flashvarValue) {
- $out .= 'so.addVariable("'.$flashvar.'", "'.$flashvarValue.'");';
- }
- foreach ($this->__swfparams as $swfparam => $swfparamValue) {
- $out .= 'so.addParam("'.$swfparam.'", "'.$swfparamValue.'");';
- }
- foreach ($this->__attributes as $attr => $attrValue) {
- $out .= 'so.setAttibute("'.$attr.'", "'.$attrValue.'");';
- }
- $out .= 'so.write("'.$this->div.'");';
- $out .='
- // ]]>
- </script>
- ';
- return $out;
- }
- /**
- * Enter description here...
- *
- * @param unknown_type $var
- * @param unknown_type $value
- */
- function addFlashvar($var, $value = null) {
- $this->__flashvars = am($var, $this->__flashvars);
- } else if($value !== null) {
- $this->__flashvars[$var] = $value;
- }
- }
- /**
- * Enter description here...
- *
- * @param unknown_type $var
- * @param unknown_type $value
- */
- function addParam($var, $value) {
- $this->__swfparams = am($var, $this->__swfparams);
- } else if($value !== null) {
- $this->__swfparams[$var] = $value;
- }
- }
- /**
- * Enter description here...
- *
- * @param unknown_type $var
- * @param unknown_type $value
- */
- function addAttribute($var, $value) {
- $this->__attributes = am($var, $this->__attributes);
- } else if($value !== null) {
- $this->__attributes[$var] = $value;
- }
- }
- /**
- * Enter description here...
- *
- * @param unknown_type $var
- * @param unknown_type $value
- */
- function debug($value = null) {
- return $this->__debug = $value;
- } else {
- $this->__debug = Configure::read();
- }
- }
- }
- ?>
Parsed in 0.117 seconds, using GeSHi 1.0.7.14