Example #1
0
function image_tag($source, $options = array(), $html = false)
{
    $url_path = odContext::getInstance()->get_request("request.initial")->get_referer();
    $url_path .= "/images/" . $source;
    if (!is_array($options)) {
        $options_tab = __transform_string_into_tab($options);
    } else {
        $options_tab = $options;
    }
    $options_tab = array_merge(array("src" => $url_path), $options_tab);
    if (array_key_exists("size", $options_tab)) {
        $size_exploded = explode("x", $options_tab["size"]);
        unset($options_tab["size"]);
        if (isset($size_exploded[0])) {
            $options_tab = array_merge($options_tab, array("width" => $size_exploded[0]));
        }
        if (isset($size_exploded[1])) {
            $options_tab = array_merge($options_tab, array("height" => $size_exploded[1]));
        }
    }
    if ($html) {
        return html_simple_tag("img", $options_tab);
    } else {
        simple_tag("img", $options_tab);
    }
}
Example #2
0
function mail_to($email, $name = "", $options = array(), $default_value = array())
{
    if ($name == "") {
        $name = $email;
    }
    $options_tab = array();
    if (!is_array($options)) {
        $options_tab = __transform_string_into_tab($options);
    } else {
        $options_tab = $options;
    }
    $def_vals = "";
    if ($default_value != null) {
        $def_vals = "?";
        foreach ($default_value as $key => $value) {
            $def_vals .= sprintf("%s=%s&", $key, $value);
        }
        $def_vals = trim($def_vals, "&");
    }
    if (isset($options["encode"]) and $options["encode"] == true) {
        $email_encoded = __encode_text("mailto:" . $email . $def_vals);
        unset($options_tab["encode"]);
    } else {
        $email_encoded = "mailto:" . $email . $def_vals;
    }
    $options_tab = array_merge(array("href" => $email_encoded), $options_tab);
    tag("a", $name, $options_tab);
}