Exemple #1
0
function smarty_function_view($params, &$smarty)
{
    $src = $params["file"];
    if ($src != "") {
        $smarty->display(view_path . "/" . ltrim($src, "/"));
        return;
    }
    //FIXME: Burası tek bir merkezden kontrol edilmeli.
    global $rule;
    foreach ($rule as $r) {
        if (eregi($r["class"], $params["class"])) {
            $class_path = controller_root . "/" . $r["file"];
            $class_name = $r["class"];
            break;
        }
    }
    $method = $params["method"];
    $method_arguments = get_arguments($params);
    if (!file_exists($class_path)) {
        echo "Module ({$class_name}) Not Found<br/>";
    } else {
        require_once $class_path;
    }
    if (!method_exists($class_name, $method)) {
        echo "Method ({$method}) Not Found<br/>";
    } else {
        eval("\$class = new {$class_name}();");
        $class->arguments = $smarty->get_template_vars();
        call_user_method_array($method, $class, $method_arguments);
    }
}
Exemple #2
0
/**
 * Retrieve the function's prototype as HTML
 *
 * Use the wp_parser_prototype filter to change the content of this.
 *
 * @return string Prototype HTML
 */
function get_prototype()
{
    $type = get_return_type();
    $friendly_args = array();
    $args = get_arguments();
    foreach ($args as $arg) {
        $friendly = sprintf('<span class="type">%s</span> <span class="variable">%s</span>', implode('|', $arg['types']), $arg['name']);
        $friendly .= empty($arg['default_value']) ? '' : ' <span class="default"> = <span class="value">' . $arg['default_value'] . '</span></span>';
        $friendly_args[] = $friendly;
    }
    $friendly_args = implode(', ', $friendly_args);
    $name = get_the_title();
    $prototype = sprintf('<p class="wp-parser-prototype"><code><span class="type">%s</span> %s ( %s )</code></p>', implode('|', $type), $name, $friendly_args);
    return apply_filters('wp_parser_prototype', $prototype);
}