openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1bd7d7ea63e33d6d142e781185d8f4e6898c3ca6
parent ae3e3617f911a53a9620c2820fc2f570b340576e
Author: dankert <devnull@localhost>
Date:   Thu, 19 Mar 2009 00:00:41 +0100

Verwenden von Präprozessor-Anweisungen, um Ausgabedateien deutlich kürzer zu halten.

Diffstat:
themes/default/include/html/cell.inc.php | 17++++++++++-------
themes/default/include/html/if-end.inc.php | 3++-
themes/default/include/html/if.inc.php | 125++++++++++++++++++++++++++++++++++++-------------------------------------------
themes/default/include/html/image.inc.php | 50+++++++++++++++++++++++++++++++++++---------------
4 files changed, 104 insertions(+), 91 deletions(-)

diff --git a/themes/default/include/html/cell.inc.php b/themes/default/include/html/cell.inc.php @@ -1,16 +1,19 @@ <?php -// if (empty($attr_class)) -// $attr['class']=$row_class; $column_class_idx++; if ($column_class_idx > count($column_classes)) $column_class_idx=1; $column_class=$column_classes[$column_class_idx-1]; if (empty($attr_class)) - $attr['class']=$column_class; + $attr_class=$column_class; global $cell_column_nr; $cell_column_nr++; if ( isset($column_widths[$cell_column_nr-1]) && !isset($attr_rowspan) ) - $attr['width']=$column_widths[$cell_column_nr-1]; - -?><td <?php foreach( $attr as $a_name=>$a_value ) echo " $a_name=\"$a_value\"" ?>>- \ No newline at end of file + $attr_width=$column_widths[$cell_column_nr-1]; +?><td<?php +if ( isset($attr_width )) { ?> width="<?php echo $attr_width ?>" <?php } +if ( isset($attr_style )) { ?> style="<?php echo $attr_style?>" <?php } +if ( isset($attr_class )) { ?> class="<?php echo $attr_class ?>" <?php } +if ( isset($attr_colspan)) { ?> colspan="<?php echo $attr_colspan ?>" <?php } +if ( isset($attr_rowspan)) { ?> rowspan="<?php echo $attr_rowspan ?>" <?php } +?>>+ \ No newline at end of file diff --git a/themes/default/include/html/if-end.inc.php b/themes/default/include/html/if-end.inc.php @@ -1,2 +1,3 @@ -/* Ignore: */ <?php { ?> +/* THIS LINE WILL BE IGNORED */ <?php { ?> + <?php } ?> \ No newline at end of file diff --git a/themes/default/include/html/if.inc.php b/themes/default/include/html/if.inc.php @@ -1,82 +1,70 @@ <?php +#IF-ATTR true# // Wahr-Vergleich - if ( isset($attr_true) ) - { - if (gettype($attr_true) === '' && gettype($attr_true) === '1') - $exec = $$attr_true == true; - else - $exec = $attr_true == true; - } + if (gettype($attr_true) === '' && gettype($attr_true) === '1') + $attr_tmp_exec = $$attr_true == true; + else + $attr_tmp_exec = $attr_true == true; +#END-IF# - // Falsch-Vergleich - elseif ( isset($attr_false) ) - { - if (gettype($attr_false) === '' && gettype($attr_false) === '1') - $exec = $$attr_false == false; - else - $exec = $attr_false == false; - } - // Inhalt-Vergleich mit Wertliste - elseif( isset($attr_contains) ) - $exec = in_array($attr_value,explode(',',$attr_contains)); - - // Inhalt-Vergleich - elseif( isset($attr_equals)&& isset($attr_value) ) - $exec = $attr_equals == $attr_value; +#IF-ATTR false# + if (gettype($attr_false) === '' && gettype($attr_false) === '1') + $attr_tmp_exec = $$attr_false == false; + else + $attr_tmp_exec = $attr_false == false; + +#END-IF# - // Inhalt-Vergleich - elseif( isset($attr_lessthan)&& isset($attr_value) ) - $exec = intval($attr_lessthan) > intval($attr_value); +#IF-ATTR contains# + // Inhalt-Vergleich mit Wertliste + $attr_tmp_exec = in_array($attr_value,explode(',',$attr_contains)); +#END-IF# +#IF-ATTR equals# + $attr_tmp_exec = $attr_equals == $attr_value; +#END-IF# + +#IF-ATTR lessthan# // Inhalt-Vergleich - elseif( isset($attr_greaterthan)&& isset($attr_value) ) - $exec = intval($attr_greaterthan) < intval($attr_value); - - // Vergleich auf leer - elseif ( isset($attr_empty) ) - { - if ( !isset($$attr_empty) ) - $exec = empty($attr_empty); - elseif ( is_array($$attr_empty) ) - $exec = (count($$attr_empty)==0); - elseif ( is_bool($$attr_empty) ) - $exec = true; - else - $exec = empty( $$attr_empty ); - } + $attr_tmp_exec = intval($attr_lessthan) > intval($attr_value); +#END-IF# - // Vergleich auf Vorhandensein - elseif ( isset($attr_present) ) - { - $exec = isset($$attr_present); -// if ( !isset($$attr_present) ) -// $exec = false; -// elseif ( is_array($$attr_present) ) -// $exec = (count($$attr_present)>0); -// elseif ( is_bool($$attr_present) ) -// $exec = $$attr_present; -// elseif ( is_numeric($$attr_present) ) -// $exec = $$attr_present>=0; -// else -// $exec = true; - } +#IF-ATTR greaterthan# + $attr_tmp_exec = intval($attr_greaterthan) < intval($attr_value); +#END-IF# + +#IF-ATTR empty# + if ( !isset($$attr_empty) ) + $attr_tmp_exec = empty($attr_empty); + elseif ( is_array($$attr_empty) ) + $attr_tmp_exec = (count($$attr_empty)==0); + elseif ( is_bool($$attr_empty) ) + $attr_tmp_exec = true; else - { - trigger_error("error in IF, assume: FALSE"); - $exec = false; - } + $attr_tmp_exec = empty( $$attr_empty ); +#END-IF# + + +#IF-ATTR present# + $attr_tmp_exec = isset($$attr_present); +#END-IF# + +#IF-ATTR invert# // Ergebnis umdrehen // TODO: Bald ausbauen, stattdessen "not" verwenden. if ( !empty($attr_invert) ) - $exec = !$exec; - - // Ergebnis umdrehen + $attr_tmp_exec = !$attr_tmp_exec; +#END-IF# + +#IF-ATTR not# + // Ergebnis umdrehen if ( !empty($attr_not) ) - $exec = !$exec; - + $attr_tmp_exec = !$attr_tmp_exec; +#END-IF# + unset($attr_true); unset($attr_false); unset($attr_notempty); @@ -88,9 +76,10 @@ unset($attr_value); unset($attr_equals); - $last_exec = $exec; + $last_exec = $attr_tmp_exec; - if ( $exec ) + if ( $attr_tmp_exec ) { ?> -/* Ignore: */ <?php } ?>- \ No newline at end of file + +/* THIS LINE WILL BE IGNORED */ <?php } ?>+ \ No newline at end of file diff --git a/themes/default/include/html/image.inc.php b/themes/default/include/html/image.inc.php @@ -1,15 +1,35 @@ <?php -if (isset($attr_elementtype)) { -?><img src="<?php echo $image_dir.'icon_el_'.$attr_elementtype.IMG_ICON_EXT ?>" border="0" align="<?php echo $attr_align ?>"><?php -} elseif (isset($attr_type)) { -?><img src="<?php echo $image_dir.'icon_'.$attr_type.IMG_ICON_EXT ?>" border="0" align="<?php echo $attr_align ?>"><?php -} elseif (isset($attr_icon)) { -?><img src="<?php echo $image_dir.'icon_'.$attr_icon.IMG_ICON_EXT ?>" border="0" align="<?php echo $attr_align ?>"><?php -} elseif (isset($attr_tree)) { -?><img src="<?php echo $image_dir.'tree_'.$attr_tree.IMG_EXT ?>" border="0" align="<?php echo $attr_align ?>"><?php -} elseif (isset($attr_url)) { -?><img src="<?php echo $attr_url ?>" border="0" align="<?php echo $attr_align ?>"><?php -} elseif (isset($attr_fileext)) { -?><img src="<?php echo $image_dir.$attr_fileext ?>" border="0" align="<?php echo $attr_align ?>"><?php -} elseif (isset($attr_file)) { -?><img src="<?php echo $image_dir.$attr_file.IMG_ICON_EXT ?>" border="0" align="<?php echo $attr_align ?>"><?php } ?>- \ No newline at end of file + +/* #IF-ATTR elementtype# */ + $attr_tmp_image_file = $image_dir.'icon_el_'.$attr_elementtype.IMG_ICON_EXT; + $attr_size = '16x16'; +/* #END-IF# */ + +/* #IF-ATTR type# */ + $attr_tmp_image_file = $image_dir.'icon_'.$attr_type.IMG_ICON_EXT; + $attr_size = '16x16'; +/* #END-IF# */ + +/* #IF-ATTR icon# */ + $attr_tmp_image_file = $image_dir.'icon_'.$attr_icon.IMG_ICON_EXT; + $attr_size = '16x16'; +/* #END-IF# */ + +/* #IF-ATTR tree# */ + $attr_tmp_image_file = $image_dir.'tree_'.$attr_tree.IMG_EXT; + $attr_size = '18x18'; +/* #END-IF# */ + +/* #IF-ATTR url# */ + $attr_tmp_image_file = $attr_url; +/* #END-IF# */ + +/* #IF-ATTR fileext# */ + $attr_tmp_image_file = $image_dir.$attr_fileext; +/* #END-IF# */ + +/* #IF-ATTR file# */ + $attr_tmp_image_file = $image_dir.$attr_file.IMG_ICON_EXT; +/* #END-IF# */ + +?><img src="<?php echo $attr_tmp_image_file ?>" border="0"<?php if(isset($attr_align)) echo ' align="'.$attr_align.'"' ?><?php if (isset($attr_size)) { list($attr_tmp_width,$attr_tmp_height)=explode('x',$attr_size);echo ' width="'.$attr_tmp_width.'" height="'.$attr_tmp_height.'"';} ?>>+ \ No newline at end of file