ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

fs_markup.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
26 class fs_markup_1_0_0
27 {
38 var $CachedMultyFS = false;
39 var $TemplateManager = false;
40
51 function __construct()
52 {
53 try
54 {
55 $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
56 $this->TemplateManager = get_package( 'template_manager' , 'last' , __FILE__ );
57 }
58 catch( Exception $e )
59 {
60 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
61 }
62 }
63
86 function compile_basename( &$Settings )
87 {
88 try
89 {
90 return( basename( $Settings->get_setting( 'value' ) ) );
91 }
92 catch( Exception $e )
93 {
94 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
95 }
96 }
97
116 private function get_path_from_template()
117 {
118 try
119 {
120 $TemplatePath = $this->TemplateManager->get_template_path(
121 $this->TemplateName , $this->TemplateVersion
122 );
123 $RealFilePath = $this->CachedMultyFS->get_file_path(
124 $TemplatePath."/res/images/$FileName" , false
125 );
126 if( $RealFilePath === false )
127 {
128 $PageComposerFilePath = _get_package_relative_path_ex( 'page::page_composer' , 'last' );
129 $RealFilePath = $PageComposerFilePath."/res/images/$FileName";
130 if( file_exists( $RealFilePath ) === false )
131 {
132 throw( new Exception( "File '$FileName' was not found" ) );
133 }
134 }
135 return( $RealFilePath );
136 }
137 catch( Exception $e )
138 {
139 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
140 }
141 }
142
165 function compile_image_path( &$Settings )
166 {
167 try
168 {
169 $FileName = $Settings->get_setting( 'file_name' );
170
171 if( $Settings->get_setting( 'package_name' , false ) === false )
172 {
173 $RealFilePath = $this->get_path_from_template();
174 }
175 else
176 {
177 $PackageFilePath = _get_package_relative_path_ex(
178 $Settings->get_setting( 'package_name' ) , $Settings->get_setting( 'package_version' , 'last' )
179 );
180 $RealFilePath = $PackageFilePath."/res/images/$FileName";
181 if( file_exists( $RealFilePath ) === false )
182 {
183 throw( new Exception( "File '$FileName' was not found" ) );
184 }
185 }
186
187 return( $RealFilePath );
188 }
189 catch( Exception $e )
190 {
191 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
192 }
193 }
194
217 function compile_package_path( &$Settings )
218 {
219 try
220 {
221 $RealPackagePath = _get_package_relative_path_ex(
222 $Settings->get_setting( 'package_name' ) ,
223 $Settings->get_setting( 'package_version' , 'last' )
224 );
225
226 return( $RealPackagePath );
227 }
228 catch( Exception $e )
229 {
230 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
231 }
232 }
233 }
234
235 ?>