ultimix
jquery_media.php
Go to the documentation of this file.
1 <?php
2 
3  /*
4  * This source code is a part of the Ultimix Project.
5  * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6  * it's own license wich could be found from the corresponding files or sources.
7  * This source code is provided "as is" without any warranties or garanties.
8  *
9  * Have a nice day!
10  *
11  * @url http://ultimix.sorceforge.net
12  *
13  * @author Alexey "gdever" Dodonov
14  */
15 
27 
38  var $CachedMultyFS = false;
39  var $PageJS = false;
40  var $String = false;
41 
56  function __construct()
57  {
58  try
59  {
60  $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
61  $this->PageJS = get_package( 'page::page_js' , 'last' , __FILE__ );
62  $this->String = get_package( 'string' , 'last' , __FILE__ );
63  }
64  catch( Exception $e )
65  {
66  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
67  }
68  }
69 
88  function pre_generation( &$Options )
89  {
90  try
91  {
92  $Path = '{http_host}/'._get_package_relative_path_ex( 'jquery::jquery_media' , 'last' );
93  $this->PageJS->add_javascript( "$Path/include/js/jquery.media.js" );
94  $this->PageJS->add_javascript( "$Path/include/js/jquery.media.autorun.js" );
95  }
96  catch( Exception $e )
97  {
98  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
99  }
100  }
101 
124  private function get_vars( &$Settings )
125  {
126  try
127  {
128  $Vars = array( 'file' => $Settings->get_setting( 'file' ) );
129  $Vars[ 'width' ] = $Settings->get_setting( 'width' , 300 );
130  $Vars[ 'height' ] = $Settings->get_setting( 'height' , 20 );
131  $Vars[ 'autoplay' ] = $Settings->get_setting( 'autoplay' , 0 );
132 
133  return( $Vars );
134  }
135  catch( Exception $e )
136  {
137  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
138  }
139  }
140 
163  function compile_media( &$Settings )
164  {
165  try
166  {
167  $Code = $this->CachedMultyFS->get_template( __FILE__ , 'media.tpl' );
168 
169  $Vars = $this->get_vars( $Settings );
170 
171  $Code = $this->String->print_record( $Code , $Vars );
172 
173  return( $Code );
174  }
175  catch( Exception $e )
176  {
177  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
178  }
179  }
180  }
181 
182 ?>