Show
Ignore:
Timestamp:
01/18/06 18:45:19 (6 years ago)
Author:
john
Message:

Made all the file php long tags (uglysvn up)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_controller.php

    r113 r117  
    1 <? 
     1<?php 
    22# $Id$ 
    33# 
     
    187187                    $GLOBALS['current_controller_path'] = "$this->added_path/$this->controller"; 
    188188                    $GLOBALS['current_controller_name'] = $this->controller; 
    189                     $GLOBALS['current_controller_object'] = $this->controller_object; 
     189                    $GLOBALS['current_controller_object'] =& $this->controller_object; 
    190190                } 
    191191 
     
    198198                    if(file_exists(TRAX_LIB_ROOT."/scaffold_controller.php")) { 
    199199                        include_once(TRAX_LIB_ROOT."/scaffold_controller.php"); 
    200                         $GLOBALS['current_controller_object'] = $this->controller_object = new ScaffoldController($scaffold); 
     200                        $this->controller_object = new ScaffoldController($scaffold); 
     201                        $GLOBALS['current_controller_object'] =& $this->controller_object; 
    201202                        if($this->action) { 
    202203                            $this->view_file = TRAX_LIB_ROOT . "/templates/scaffolds/".$this->action.".phtml"; 
     
    350351    function add_before_filter($filter_function_name) { 
    351352        if(is_string($filter_function_name) && !empty($filter_function_name)) { 
    352             $this->before_filters[] = $filter_function_name; 
     353            if(!in_array($filter_function_name, $this->before_filters)) { 
     354                $this->before_filters[] = $filter_function_name; 
     355            }                         
    353356        } elseif(is_array($filter_function_name)) { 
    354357            if(count($this->before_filters) > 0) { 
     
    372375    function add_after_filter($filter_function_name) { 
    373376        if(is_string($filter_function_name) && !empty($filter_function_name)) { 
    374             $this->after_filters[] = $filter_function_name; 
     377            if(!in_array($filter_function_name, $this->after_filters)) { 
     378                $this->after_filters[] = $filter_function_name; 
     379            } 
    375380        } elseif(is_array($filter_function_name)) { 
    376381            if(count($this->after_filters) > 0) { 
     
    383388 
    384389    function add_helper($helper_name) { 
    385         $this->helpers[] = $helper_name; 
    386     } 
    387  
    388     function render_partial($path) { 
     390        if(!in_array($helper_name, $this->helpers)) { 
     391            $this->helpers[] = $helper_name; 
     392        } 
     393    } 
     394 
     395    function render_partial($path, $options = array()) { 
    389396        if(strstr($path, "/")) { 
    390397            $file = substr(strrchr($path, "/"), 1); 
    391398            $path = substr($path, 0, strripos($path, "/")); 
    392             $path_with_file = TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['views']."/".$path."/_".$file.".".$this->views_file_extention; 
     399            $file_with_path = TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['views']."/".$path."/_".$file.".".$this->views_file_extention; 
    393400        } else { 
    394             $path_with_file = $this->views_path."/_".$path.".".$this->views_file_extention; 
    395         } 
    396  
    397         if(file_exists($path_with_file)) { 
     401            $file = $path; 
     402            $file_with_path = $this->views_path."/_".$file.".".$this->views_file_extention; 
     403        } 
     404 
     405        if(file_exists($file_with_path)) { 
     406             
     407            if(array_key_exists("spacer_template", $options)) { 
     408                $spacer_path = $options['spacer_template']; 
     409                if(strstr($spacer_path, "/")) { 
     410                    $spacer_file = substr(strrchr($spacer_path, "/"), 1); 
     411                    $spacer_path = substr($spacer_path, 0, strripos($spacer_path, "/")); 
     412                    $spacer_file_with_file = TRAX_ROOT.$GLOBALS['TRAX_INCLUDES']['views']."/".$spacer_path."/_".$spacer_file.".".$this->views_file_extention; 
     413                } else { 
     414                    $spacer_file = $spacer_path; 
     415                    $spacer_file_with_file = $this->views_path."/_".$spacer_file.".".$this->views_file_extention; 
     416                }   
     417                if(file_exists($spacer_file_with_file)) { 
     418                    $add_spacer = true;     
     419                } 
     420            }           
     421             
    398422            # Pull all the class vars out and turn them from $this->var to $var 
    399423            extract(get_object_vars($this->controller_object)); 
    400             include($path_with_file); 
     424            if(array_key_exists("collection", $options)) { 
     425                foreach($options['collection'] as $tmp_value) { 
     426                    ${$file."_counter"}++; 
     427                    ${$file} = $tmp_value; 
     428                    unset($tmp_value); 
     429                    include($file_with_path);     
     430                    if($add_spacer && (${$file."_counter"} < count($options['collection']))) { 
     431                        include($spacer_file_with_file);         
     432                    }          
     433                }     
     434            } else { 
     435                if(array_key_exists("locals", $options)) { 
     436                    foreach($options['locals'] as $tmp_key => $tmp_value) { 
     437                        ${$tmp_key} = $tmp_value;                 
     438                    }     
     439                    unset($tmp_key); 
     440                    unset($tmp_value); 
     441                } 
     442                include($path_with_file);         
     443            }            
    401444        } 
    402445    }