Exemplo n.º 1
0
/**
 * Post actions buttons
 * @return 	string
 * @param  array $disable
 * @return void
 * @since 	2.0
 */
function ap_post_actions_buttons($disable = array())
{
    global $post;
    if (!$post->post_type == 'question' || !$post->post_type == 'answer') {
        return;
    }
    $actions = array();
    /**
     * Select answer button
     * @var string
     */
    if ($post->post_type == 'answer') {
        $actions['select_answer'] = ap_select_answer_btn_html($post->ID);
    }
    /**
     * Comment button
     */
    if (ap_user_can_comment()) {
        $actions['comment'] = ap_comment_btn_html();
    }
    $actions['status'] = ap_post_change_status_btn_html($post->ID);
    /**
     * edit question link
     */
    if (ap_user_can_edit_question($post->ID) && $post->post_type == 'question') {
        $actions['dropdown']['edit_question'] = ap_edit_post_link_html();
    }
    if (ap_user_can_edit_ans($post->ID) && $post->post_type == 'answer') {
        $actions['dropdown']['edit_answer'] = ap_edit_post_link_html();
    }
    if (is_user_logged_in()) {
        $actions['dropdown']['flag'] = ap_flag_btn_html();
    }
    if (is_super_admin() && $post->post_type == 'question') {
        $actions['dropdown']['featured'] = ap_featured_post_btn();
    }
    if (ap_user_can_delete($post->ID) && $post->post_status != 'trash') {
        $actions['dropdown']['delete'] = ap_post_delete_btn_html();
    }
    if (ap_user_can_delete($post->ID)) {
        $actions['dropdown']['permanent_delete'] = ap_post_permanent_delete_btn_html();
    }
    /**
     * FILTER: ap_post_actions_buttons
     * For filtering post actions buttons
     * @var 	string
     * @since 	2.0
     */
    $actions = apply_filters('ap_post_actions_buttons', $actions);
    if (!empty($actions) && count($actions) > 0) {
        echo '<ul id="ap_post_actions_' . $post->ID . '" class="ap-q-actions ap-ul-inline clearfix">';
        foreach ($actions as $k => $action) {
            if (!empty($action) && $k != 'dropdown' && !in_array($k, $disable)) {
                echo '<li class="ap-post-action ap-action-' . $k . '">' . $action . '</li>';
            }
        }
        if (!empty($actions['dropdown'])) {
            echo '<li class="ap-post-action dropdown">';
            echo '<div id="ap_post_action_' . $post->ID . '" class="ap-dropdown">';
            echo '<a class="apicon-ellipsis more-actions ap-tip ap-dropdown-toggle" title="' . __('More action', 'ap') . '" href="#"></a>';
            echo '<ul class="ap-dropdown-menu">';
            foreach ($actions['dropdown'] as $sk => $sub) {
                echo '<li class="ap-post-action ap-action-' . $sk . '">' . $sub . '</li>';
            }
            echo '</ul>';
            echo '</div>';
            echo '</li>';
        }
        echo '</ul>';
    }
}
Exemplo n.º 2
0
        ?>
</li>					
									<li><?php 
        ap_comment_btn_html();
        ?>
</li>					
									<li><?php 
        ap_close_vote_html();
        ?>
</li>	
									<li><?php 
        ap_flag_btn_html();
        ?>
</li>
									<li><?php 
        ap_post_delete_btn_html();
        ?>
</li>
								</ul>
							</div>
							<div class="ap-qfooter">								
								<div class="ap-tlitem">
									<?php 
        echo ap_get_latest_history_html(get_the_ID(), true, true);
        ?>
								</div>
								<div class="ap-tlitem">
									<span class="ap-icon-hit ap-tlicon"></span>
									<ul class="ap-question-meta">
										<li>
											<?php