'win', 'width' => '450', 'height' => '550', 'position' => 'right', 'features' => "toolbar=no, scrollbars=yes, menubar=yes", 'text' => 'Abrir', 'img' => '', 'button' => false); $extractParams = array( 'url', 'name', 'width', 'height', 'position', 'features', 'text', 'img', 'button'); /* verifica se todos os parâmetros obrigatórios foram passados */ foreach ($requiredParams as $required) if (!array_key_exists($required, $params) || (empty($params[$required]))) $smarty->trigger_error("[wf_window_open] missing required parameter(s): $required", E_USER_ERROR); /* atribui valores default para os parâmetros não passados */ foreach ($defaultValues as $key => $value) if (!isset($params[$key])) $params[$key] = $value; /* extrai alguns parâmetros da matriz de parâmetros */ foreach ($extractParams as $extract) $$extract = $params[$extract]; /* parâmetros extras são "acumulados" em uma única matriz */ $extraParams = array(); foreach ($params as $key => $value) if (!in_array($key, $extractParams)) $extraParams[] = $key . ' = "' . $value . '"'; $click_command = "wf_open_window('$url', '$name', '$width', '$height', '$position', '$features');"; if ($button) { $output = ""; } else { if ($img) { $text = ''; } $output = "$text"; } return $output; } ?>