Example #1
0
function kingkong_board_latest($attr)
{
    do_action('kingkongboard_latest_display_before', $attr);
    $title = $attr['title'];
    $skin = $attr['skin'];
    $number = $attr['number'];
    $length = $attr['length'];
    $board_id = $attr['board_id'];
    $header = apply_filters('kingkongboard_latest_list_head_before', '<thead><tr><th>' . __('제목', 'kingkongboard') . '</th><th style="text-align:center; width:100px">' . __('작성일', 'kingkongboard') . '</th></tr></thead>', $attr);
    $latest_content = '<div id="kingkongboard-latest-wrapper">';
    $table_before = apply_filters('kingkongboard_latest_table_before', $board_id);
    if ($table_before != $board_id) {
        $latest_content .= $table_before;
    }
    $latest_content .= '<table id="kingkongboard-latest-table">';
    $latest_content .= $header;
    $kingkongboard = new kkbLatest($board_id);
    $latests = $kingkongboard->kkb_get_latest_list($number);
    $latest_priority = apply_filters('kingkongboard_latest_priority', array('title', 'date'), $attr);
    $count = 1;
    foreach ($latests as $latest) {
        $latest_content .= '<tr>';
        foreach ($latest_priority as $priority) {
            switch ($priority) {
                case "title":
                    $read_path = add_query_arg(array('view' => 'read', 'id' => $latest->post_id), get_the_permalink($latest->guid));
                    $title = get_the_title($latest->post_id);
                    $title = str_replace('Private: ', '', $title);
                    $title = str_replace('비공개: ', '', $title);
                    $title = kingkongboard_text_cut($title, $length, "...");
                    $latest_content .= '<td class="kingkongboard-latest-td-' . $priority . '">';
                    $latest_content .= '<a href="' . $read_path . '">' . apply_filters('kkb_latest_title', $title, $board_id, $latest->post_id) . '</a>';
                    $latest_content .= '</td>';
                    break;
                case "date":
                    $latest_content .= '<td class="kingkongboard-latest-td-' . $priority . '">';
                    $latest_content .= get_the_date('Y-m-d', $latest->post_id);
                    $latest_content .= '</td>';
                    break;
            }
            $latest_filter = apply_filters('kingkongboard_latest_priority_case', $content = null, $count, $latest, $priority, $attr);
            if ($latest_filter) {
                $latest_content .= $latest_filter;
            }
        }
        $latest_content .= '</tr>';
        $count++;
    }
    $latest_content .= '</table>';
    $latest_content .= '</div>';
    return apply_filters('kingkongboard_latest_after', $latest_content, $latests, $attr);
}
Example #2
0
function admin_kingkong_board_manage_entry_column($entries, $entry_id)
{
    $return_content = '';
    $controller = new kkbController();
    foreach ($entries as $entry) {
        switch ($entry['value']) {
            case 'thumbnail':
                if (has_post_thumbnail($entry_id)) {
                    $thumbnail_id = get_post_thumbnail_id($entry_id);
                    $url = wp_get_attachment_image_src($thumbnail_id, 'thumbnail');
                    $image = '<img src="' . $url[0] . '" style="width:20px; height:auto">';
                } else {
                    $image = __('없음', 'kingkongboard');
                }
                $return_content .= '<td style="text-align:center">' . $image . '</td>';
                break;
            case "title":
                $entry_type = '';
                $entry_type = get_kingkong_board_meta_value($entry_id, 'type');
                $entry_attachment = get_post_meta($entry_id, 'kingkongboard_attached', true);
                $entry_secret = get_post_meta($entry_id, 'kingkongboard_secret', true);
                if ($entry_attachment) {
                    $entry_attach_text = "<i class='kkb-icon kkb-icon-attachment'></i>";
                } else {
                    $entry_attach_text = "";
                }
                if ($entry_secret) {
                    $entry_secret_icon = '<img src="' . KINGKONGBOARD_PLUGINS_URL . '/assets/images/icon-locked.png" style="width:12px; height:auto; position:relative; top:0px; margin-left:5px">';
                } else {
                    $entry_secret_icon = '';
                }
                $parent = get_kingkong_board_meta_value($entry_id, 'parent');
                $entry_depth = get_kingkong_board_meta_value($entry_id, 'depth');
                $writer = get_kingkong_board_meta_value($entry_id, 'writer');
                if ($entry_depth > 1) {
                    $padding = 10 * $entry_depth;
                    $reply_padding = 'style="padding-left:' . $padding . 'px;"';
                    $reply_icon = '<img src="' . KINGKONGBOARD_PLUGINS_URL . '/assets/images/icon-reply.gif" style="width:25px; height:auto; position:relative; top:3px; margin-right:5px">';
                    $parent_id = '&prnt=' . $parent;
                } else {
                    $reply_padding = '';
                    $reply_icon = '';
                    $parent_id = '';
                }
                $return_content .= "<td " . $reply_padding . ">" . $reply_icon . "<a href='?page=KingkongBoard&view=entry-view&id=" . $entry_id . $parent_id . "'>" . get_the_title($entry_id) . "</a>" . $entry_attach_text . $entry_secret_icon . "</td>";
                break;
            case "date":
                $return_content .= "<td>" . get_the_date('Y-m-d H:i:s', $entry_id) . "</td>";
                break;
            case "writer":
                $user_id = $controller->getMeta($entry_id, 'login_id');
                $post = get_post($entry_id);
                $writer = kingkongboard_text_cut($writer, 8, "...");
                $user_id > 1 ? $writer_path = '<a href="' . get_edit_user_link($user_id) . '">' . $writer . '</a>' : ($writer_path = $writer);
                $return_content .= "<td>" . $writer_path . "</td>";
                break;
            case "options":
                $guid = $controller->getMeta($entry_id, 'guid');
                $preview_path = add_query_arg(array('view' => 'read', 'id' => $entry_id), get_the_permalink($guid));
                $return_content .= "<td style='text-align:left'><a href='admin.php?page=KingkongBoard&view=entry-modify&id=" . $entry_id . "' class='button-kkb kkbgreen button-modify-each-entry' data='" . $entry_id . "'><i class='kkb-icon kkb-icon-modify'></i></a> <a class='button-kkb kkbred button-remove-each-entry' data='" . $entry_id . "'><i class='kkb-icon kkb-icon-trash'></i></a> <a href='" . $preview_path . "' target='_blank' class='button-kkb kkbyellow' data='" . $entry_id . "'><i class='kkb-icon kkb-icon-preview'></i></a></td>";
                break;
        }
    }
    return $return_content;
}
Example #3
0
    </thead>
    <tbody>
<?php 
$count = 1;
foreach ($latests as $latest) {
    ?>
    <tr>
<?php 
    foreach ($latest_priority as $priority) {
        switch ($priority) {
            case "title":
                $read_path = add_query_arg(array('view' => 'read', 'id' => $latest->post_id), get_the_permalink($latest->guid));
                $title = get_the_title($latest->post_id);
                $title = str_replace('Private: ', '', $title);
                $title = str_replace('비공개: ', '', $title);
                $title = kingkongboard_text_cut($title, $length, "...");
                ?>
      <td class="kingkongboard-latest-td-<?php 
                echo $priority;
                ?>
">
        <a href="<?php 
                echo $read_path;
                ?>
"><?php 
                echo apply_filters('kkb_latest_title', $title, $board_id, $latest->post_id);
                ?>
</a>
      </td>
<?php 
                break;