Changeset 3953


Ignore:
Timestamp:
Oct 1, 2009, 5:11:58 PM (11 years ago)
Author:
patdenice
Message:

Simplification of commit 3951.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/template.class.php

    r3951 r3953  
    432432  function set_prefilter($handle, $callback, $weight=50)
    433433  {
    434     $this->external_filters[$handle][$weight][] = array('pre', $callback);
     434    $this->external_filters[$handle][$weight][] = array('prefilter', $callback);
    435435    ksort($this->external_filters[$handle]);
    436436  }
     
    438438  function set_postfilter($handle, $callback, $weight=50)
    439439  {
    440     $this->external_filters[$handle][$weight][] = array('post', $callback);
     440    $this->external_filters[$handle][$weight][] = array('postfilter', $callback);
    441441    ksort($this->external_filters[$handle]);
    442442  }
     
    444444  function set_outputfilter($handle, $callback, $weight=50)
    445445  {
    446     $this->external_filters[$handle][$weight][] = array('output', $callback);
     446    $this->external_filters[$handle][$weight][] = array('outputfilter', $callback);
    447447    ksort($this->external_filters[$handle]);
    448448  }
     
    464464          list($type, $callback) = $filter;
    465465          $compile_id .= $type.( is_array($callback) ? implode('', $callback) : $callback );
    466           switch ($type)
    467           {
    468             case 'pre':
    469               $this->smarty->register_prefilter($callback);
    470               break;
    471             case 'post':
    472               $this->smarty->register_postfilter($callback);
    473               break;
    474             case 'output':
    475               $this->smarty->register_outputfilter($callback);
    476               break;
    477           }
     466          call_user_func(array($this->smarty, 'register_'.$type), $callback);
    478467        }
    479468      }
     
    491480        {
    492481          list($type, $callback) = $filter;
    493           switch ($type)
    494           {
    495             case 'pre':
    496               $this->smarty->unregister_prefilter($callback);
    497               break;
    498             case 'post':
    499               $this->smarty->unregister_postfilter($callback);
    500               break;
    501             case 'output':
    502               $this->smarty->unregister_outputfilter($callback);
    503               break;
    504           }
     482          call_user_func(array($this->smarty, 'unregister_'.$type), $callback);
    505483        }
    506484      }
Note: See TracChangeset for help on using the changeset viewer.