コード例 #1
0
    /**
     * @see Walker::start_el()
     * @since 2.7.0
     *
     * @param string $output Passed by reference. Used to append additional content.
     * @param object $comment Comment data object.
     * @param int $depth Depth of comment in reference to parents.
     * @param array $args
     */
    function start_el(&$output, $comment, $depth = 0, $args = array(), $current_object_id = 0)
    {
        global $deliberaThemes;
        $depth++;
        $GLOBALS['comment_depth'] = $depth;
        $args['avatar_size'] = '85';
        if (!empty($args['callback'])) {
            call_user_func($args['callback'], $comment, $args, $depth);
            return;
        }
        $GLOBALS['comment'] = $comment;
        $tipo = get_comment_meta($comment->comment_ID, "delibera_comment_tipo", true);
        $situacao = delibera_get_situacao($comment->comment_post_ID);
        extract($args, EXTR_SKIP);
        if ('div' == $args['style']) {
            $tag = 'div';
            $add_below = 'comment';
        } else {
            $tag = 'li';
            $add_below = 'delibera-comment';
        }
        $classes = array();
        if (!empty($args['has_children'])) {
            $classes[] = 'parent';
        }
        if ($tipo == 'encaminhamento' || $tipo == 'resolucao' || $tipo == 'encaminhamento_selecionado') {
            $classes[] = 'encaminhamento';
            if (in_array($situacao->slug, array('comresolucao', 'emvotacao'))) {
                $classes[] = 'encaminhamentos-selecionados';
            }
        }
        ob_start();
        ?>

        <?php 
        if (($tipo == 'resolucao' || $tipo == 'encaminhamento') && $situacao->slug == 'comresolucao') {
            ?>
            <?php 
            $nvotos = get_comment_meta($comment->comment_ID, "delibera_comment_numero_votos", true);
            ?>
            <?php 
            $classes[] = 'clearfix';
            ?>
            <li <?php 
            comment_class($classes);
            ?>
>
                <div class="alignleft votos">
                    <span><?php 
            echo $nvotos == 1 ? sprintf(__('%d voto', 'delibera'), $nvotos) : sprintf(__('%d votos', 'delibera'), $nvotos);
            ?>
</span>
                </div>
                <div class="alignleft content">
                    <?php 
            comment_text();
            ?>
                </div>
            </li>
        <?php 
        } elseif ($situacao->slug == 'emvotacao' && $tipo == 'voto') {
            ?>
            <?php 
            $avatar = get_avatar_with_title($comment->user_id);
            ?>
            <li><?php 
            echo $avatar;
            ?>
</li>
        <?php 
        } else {
            ?>
            <li <?php 
            comment_class($classes);
            ?>
>
                <article id="delibera-comment-<?php 
            echo $comment->comment_ID;
            ?>
">
                    <header class="coment-meta comment-author vcard clearfix">
                        <div class="alignleft">
                            <?php 
            echo get_avatar($comment, 44);
            ?>
                            <cite class="fn"><?php 
            echo $comment->comment_author;
            ?>
</cite>
                            <a href="<?php 
            echo htmlspecialchars(delibera_get_comment_link($comment->comment_ID));
            ?>
">
                                <time datetime="<?php 
            echo get_comment_date('c');
            ?>
">
                                    <?php 
            $time = mysql2date('G', $comment->comment_date);
            $time_diff = time() - $time;
            if ($time_diff > 0 && $time_diff < 30 * 24 * 60 * 60) {
                printf(__('há %s', 'delibera'), human_time_diff(mysql2date('U', $comment->comment_date, true)));
            } else {
                echo get_comment_date('d \\d\\e F \\d\\e Y à\\s H:i');
            }
            ?>
                                </time>
                            </a>
                        </div>
                        <div class="alignright textright">
                            <span class="type"><?php 
            delibera_get_comment_type_label($comment);
            ?>
</span>
                            <?php 
            if ($situacao->slug == 'discussao' || $situacao->slug == 'relatoria' && current_user_can('relatoria')) {
                echo "<br/>";
                delibera_edit_comment_link(__('Edit'), '', '');
                delibera_delete_comment_link(__('Deletar'), '', '');
            }
            ?>
                        </div>
                    </header>
                    <section class="comment-content">
                        <?php 
            if ($comment->comment_approved == '0') {
                ?>
                            <em class="delibera-comment-awaiting-moderation"><?php 
                _e('Seu comentário está aguardando moderação.', 'delibera');
                ?>
</em>
                            <br />
                        <?php 
            }
            ?>
                        <?php 
            comment_text();
            ?>
                        <?php 
            delibera_comment_edit_form();
            ?>
                    </section>
                    <section class="actions clearfix">
                        <?php 
            if (delibera_comments_is_open($comment->comment_post_ID) && $situacao->slug != 'emvotacao' && $situacao->slug != 'relatoria') {
                ?>
                            <div class="bottom alignleft">
                                <div class="reply">
                                    <?php 
                if ($situacao->slug != 'validacao' && is_user_logged_in()) {
                    $args['reply_text'] = __("Responder", 'delibera');
                    ?>
                                        <?php 
                    comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'])));
                    ?>
                                        <?php 
                } else {
                    if (is_user_logged_in()) {
                        ?>
                                        <a href="<?php 
                        delibera_get_comment_link();
                        ?>
#respond" class="comment-reply-link"><?php 
                        _e('De sua opinião', 'delibera');
                        ?>
</a>
                                        <?php 
                    } else {
                        ?>
                                        <a href="<?php 
                        echo wp_login_url(delibera_get_comment_link());
                        ?>
#respond" class="comment-reply-link"><?php 
                        _e('Faça login e de sua opinião', 'delibera');
                        ?>
</a>
                                        <?php 
                    }
                }
                ?>
                                </div>
                            </div>
                        <?php 
            }
            ?>
                        <?php 
            if ($situacao->slug == 'relatoria' && current_user_can('relatoria')) {
                $baseouseem = get_comment_meta($comment->comment_ID, 'delibera-baseouseem', true);
                if (!empty($baseouseem)) {
                    $elements = explode(',', $baseouseem);
                    $result = '';
                    $count = count($elements);
                    foreach ($elements as $key => $element) {
                        $reference_comment = get_comment($element);
                        $result .= "<a href='#delibera-comment-{$reference_comment->comment_ID}'>{$reference_comment->comment_author}</a>";
                        if ($key + 1 < $count) {
                            $result .= ', ';
                        }
                    }
                    echo '<div>' . __('Proposta baseada em:', 'delibera') . '&nbsp;' . $result . '</div>';
                }
            }
            if (($tipo == "encaminhamento" || $tipo == 'encaminhamento_selecionado') && current_user_can('relatoria') && $situacao->slug == "relatoria") {
                $selecionados = delibera_get_comments_encaminhamentos_selecionados_ids($comment->comment_post_ID);
                if (!$selecionados) {
                    $selecionados = array();
                }
                ?>
                            <div class="bottom alignleft">
                                <p>
                                    <input id="baseadoem-checkbox-<?php 
                echo $comment->comment_ID;
                ?>
" type="checkbox" name="baseadoem-checkbox[]" value="<?php 
                echo $comment->comment_ID;
                ?>
" class="baseadoem-checkbox" autocomplete="off" />
                                    <label for="baseadoem-checkbox-<?php 
                echo $comment->comment_ID;
                ?>
"><?php 
                _e('Criar novo encaminhamento baseado neste', 'delibera');
                ?>
</label>
                                </p>
                                <p>
                                    <input id="usar-na-votacao-<?php 
                echo $comment->comment_ID;
                ?>
" class="usar-na-votacao" type="checkbox" name="usar_na_votacao[]" value="<?php 
                echo $comment->comment_ID;
                ?>
" <?php 
                echo in_array($comment->comment_ID, $selecionados) ? ' checked="checked" ' : '';
                ?>
 />
                                    <label for="usar-na-votacao-<?php 
                echo $comment->comment_ID;
                ?>
"><?php 
                _e('Usar este encaminhamento na votação', 'delibera');
                ?>
</label>
                                    <img class="usar-na-votacao-feedback" src="<?php 
                echo $deliberaThemes->getThemeUrl();
                ?>
/img/accept.png" style="display: none;" />
                                </p>
                            </div>
                            <?php 
            }
            $ncurtiu = get_comment_meta($comment->comment_ID, 'delibera_numero_curtir', true);
            $ndiscordou = get_comment_meta($comment->comment_ID, 'delibera_numero_discordar', true);
            if (is_user_logged_in() || $ncurtiu || $ndiscordou) {
                ?>
                            <div class="bottom alignright textright">
                                <?php 
                $curtir = delibera_gerar_curtir($comment->comment_ID, 'comment');
                $discordar = delibera_gerar_discordar($comment->comment_ID, 'comment');
                if ($curtir) {
                    echo $curtir;
                }
                if ($discordar) {
                    echo $discordar;
                }
                ?>
                            </div>
                        <?php 
            }
            ?>
                    </section><!-- .reply -->
                </article>
            </li>
        <?php 
        }
        $output .= ob_get_clean();
    }
コード例 #2
0
$comment_count = 1;
foreach ($comments_tmp as $comment) {
    $ncurtiu = delibera_numero_curtir($comment->comment_ID, 'comment');
    $tipo = delibera_get_comment_type($comment);
    ?>
	<div class="print-comment-body <?php 
    echo $tipo;
    ?>
">
		<p class="CommentDate">
			<strong>#<?php 
    echo number_format_i18n($comment_count) . ' ';
    if ($tipo == 'resolucao' && !defined('RESOLUCOES')) {
        $tipo = 'encaminhamento';
    }
    delibera_get_comment_type_label($comment, $tipo, TRUE);
    ?>
</strong> <?php 
    _e('de', 'delibera') . ' ';
    ?>
 <u><?php 
    comment_author();
    ?>
</u><?php 
    _e(' em ', 'delibera');
    comment_date(sprintf(__('%s @ %s', 'delibera'), get_option('date_format'), get_option('time_format')));
    if ($ncurtiu > 0) {
        echo ", {$ncurtiu} " . _n('concordou', 'concordaram', $ncurtiu, 'delibera');
        echo " (" . delibera_get_quem_curtiu($comment->comment_ID, 'comment', 'string') . ")";
    }
    ?>
コード例 #3
0
// contorna problema com links simbolicos no ambiente de desenvolvimento
$wp_root = dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . '/../../';
require_once $wp_root . 'wp-load.php';
if (!current_user_can('manage_options')) {
    die('Você não deveria estar aqui');
}
$pautas = get_posts(array('post_type' => 'pauta', 'post_status' => 'publish'));
$comments = array();
foreach ($pautas as $pauta) {
    $comments = array_merge($comments, delibera_get_comments($pauta->ID, array('discussao', 'encaminhamento', 'encaminhamento_selecionado', 'resolucao')));
}
foreach ($comments as $comment) {
    $situacao = delibera_get_situacao($comment->comment_post_ID);
    $comment->pauta_title = get_the_title($comment->comment_post_ID);
    $comment->pauta_status = $situacao->name;
    $comment->type = delibera_get_comment_type_label($comment, false, false);
    $comment->link = get_comment_link($comment);
    $comment->concordaram = (int) get_comment_meta($comment->comment_ID, 'delibera_numero_curtir', true);
    $comment->discordaram = (int) get_comment_meta($comment->comment_ID, 'delibera_numero_discordar', true);
    $comment->votes_count = (int) get_comment_meta($comment->comment_ID, "delibera_comment_numero_votos", true);
}
header('Pragma: public');
header('Cache-Control: no-store, no-cache, must-revalidate');
// HTTP/1.1
header("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: none');
header('Content-Type: application/vnd.ms-excel; charset=UTF-8');
// This should work for IE & Opera
header("Content-type: application/x-msexcel; charset=UTF-8");
// This should work for the rest