summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-content/smarty-plugins/function.custom_fields.php
blob: 8c684b7bc91308c468cd0c855dfa12a6da90a7ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     function.custom_fields.php
 * Type:     function
 * Name:     custom_fields
 * Purpose:  Passes the custom field value to the named function
 * -------------------------------------------------------------
 */
function smarty_function_custom_fields($params, &$smarty)
{
    global $wpblog, $siteurl;

    extract( $params );
    $fields = get_post_custom();
    if( is_array( $fields ) )
    {
        while( list( $func, $custom_params ) = each( $fields ) ) 
        {
            $func = str_replace('../', '', $func);
            $file = $smarty->plugins_dir . "/custom_fields." . $func . ".php";
            if( is_file( $file ) )
            {
                include_once( $file );
                $func( $smarty, $params, $custom_params );
            }
        }
    }
}
?>