예제 #1
0
function message_tags_msglist_after_subject($tools, $msg_vals)
{
    global $page_id;
    if ($tools->get_setting('tags_disabled')) {
        return '';
    }
    $tags = hm_new('tags', $tools);
    $tag_list = array();
    $res = '';
    if (isset($tags->tag_map[$msg_vals['mailbox']][$msg_vals['uid']])) {
        $arg = join(' ', $tags->tag_map[$msg_vals['mailbox']][$msg_vals['uid']]);
        $label = $tools->display_safe($arg);
    } else {
        $arg = false;
        $label = '<span class="tag_image" title="' . $tools->str[1] . '"></span>';
    }
    $res = '</div><div style="float: right;"><complex-' . $page_id . '><div class="tag_cell"><a id="link_' . $msg_vals['uid'] . '" onclick="return edit_tags(\'' . $msg_vals['uid'] . '\', \'' . esc_sq($msg_vals['mailbox']) . '\');">' . $label . '</a></div></complex-' . $page_id . '>';
    return $res;
}
예제 #2
0
function print_array($a)
{
    // Pretty-print an array to string $s.
    global $s;
    static $depth = 0;
    // Keep track of nesting depth to allow tidy indentation.
    ++$depth;
    foreach ($a as $key => $value) {
        for ($i = 0; $i < $depth; $i++) {
            $s .= "\t";
        }
        if (is_string($key)) {
            $s .= sprintf("'%s'\t=> ", esc_sq($key));
        } elseif (is_int($key)) {
            $s .= sprintf("%d\t=> ", $key);
        }
        if (is_array($value)) {
            $s .= sprintf("array( // count == %d\n", count($value));
            print_array($value);
            for ($i = 0; $i < $depth; $i++) {
                $s .= "\t";
            }
            $s .= sprintf("),\n");
        } elseif (is_int($value)) {
            $s .= sprintf("%d,\n", $value);
        } elseif (is_bool($value)) {
            if ($value) {
                $s .= sprintf("TRUE,\n");
            } else {
                $s .= sprintf("FALSE,\n");
            }
        } elseif (is_string($value)) {
            $s .= sprintf("'%s',\n", esc_sq($value));
        }
    }
    $s = preg_replace('/,$/', '', $s);
    --$depth;
}