ultimix
context_set_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 
27 
38  var $CommonButtons = false;
39  var $FormButtons = false;
40  var $MacroSettings = false;
41  var $String = false;
42 
57  function __construct()
58  {
59  try
60  {
61  $this->CommonButtons = get_package( 'gui::context_set::common_buttons' , 'last' , __FILE__ );
62  $this->FormButtons = get_package( 'gui::context_set::form_buttons' , 'last' , __FILE__ );
63  $this->MacroSettings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
64  $this->String = get_package( 'string' , 'last' , __FILE__ );
65  }
66  catch( Exception $e )
67  {
68  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
69  }
70  }
71 
102  function compile_options( &$Options , $Str , $Changed )
103  {
104  try
105  {
106  for( ; $Parameters = $this->String->get_macro_parameters( $Str , 'options' ) ; )
107  {
108  $this->MacroSettings->load_settings( $Parameters );
109  $Name = $this->MacroSettings->get_setting( 'name' );
110 
111  $Value = $Options->get_setting( $Name , $Options->get_setting( 'default' , '0' ) );
112 
113  $Str = str_replace( "{options:$Parameters}" , $Value , $Str );
114  $Changed = true;
115  }
116 
117  return( array( $Str , $Changed ) );
118  }
119  catch( Exception $e )
120  {
121  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
122  }
123  }
124 
155  function compile_view( &$Options , &$ContextSetSettings , $Str )
156  {
157  try
158  {
159  if( $Options->get_setting( 'view' , 0 ) == 1 )
160  {
161  $Str = $this->CommonButtons->compile_buttons( $ContextSetSettings , $Options , $Str );
162 
163  $Str = $this->FormButtons->compile_buttons( $ContextSetSettings , $Options , $Str );
164 
165  $Changed = false;
166  list( $Str , $Changed ) = $this->compile_options( $Options , $Str , $Changed );
167  }
168 
169  return( $Str );
170  }
171  catch( Exception $e )
172  {
173  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
174  }
175  }
176  }
177 ?>