Пример #1
0
function ceo_insert_comic_into_archive($content)
{
    global $wp_query, $post;
    if ((is_archive() || is_search()) && $post->post_type == 'comic' && !is_single() && !is_feed() && !post_password_required() && ceo_pluginfo('thumbnail_size_for_archive') !== 'none' && in_the_loop()) {
        $content = '<p class="comic-thumbnail-in-archive">' . ceo_display_comic_thumbnail(ceo_pluginfo('thumbnail_size_for_archive'), $post) . '</p>' . $content;
    }
    return apply_filters('ceo_insert_comic_into_archive', $content);
}
Пример #2
0
function ceo_display_buycomic($atts, $content = '')
{
    global $post;
    extract(shortcode_atts(array('character' => '', 'thanks' => __('Thank you for the purchase!', 'comiceasel'), 'cancelled' => __('You have cancelled the transaction.')), $atts));
    $buy_output = '';
    if (isset($_REQUEST['id'])) {
        $comicnum = intval($_REQUEST['id']);
    }
    if (isset($_REQUEST['action'])) {
        $action = esc_attr($_REQUEST['action']);
        switch ($action) {
            case 'thankyou':
                $buy_output .= '<div class="buycomic-thankyou">';
                $buy_output .= $thanks;
                $buy_output .= '</div>';
                break;
            case 'cancelled':
                $buy_output .= '<div class="buycomic-cancelled">';
                $buy_output .= $cancelled;
                $buy_output .= '</div>';
                break;
        }
    }
    if (isset($comicnum)) {
        $buy_print_orig_amount = get_post_meta($comicnum, 'buy_print_orig_amount', true);
        if (empty($buy_print_orig_amount)) {
            $buy_print_orig_amount = ceo_pluginfo('buy_comic_orig_amount');
        }
        $buy_print_amount = get_post_meta($comicnum, 'buy_print_amount', true);
        if (empty($buy_print_amount)) {
            $buy_print_amount = ceo_pluginfo('buy_comic_print_amount');
        }
        $buyprint_status = get_post_meta($comicnum, 'buyprint-status', true);
        if (empty($buyprint_status)) {
            $buyprint_status = __('Available', 'comiceasel');
        }
        $buyorig_status = get_post_meta($comicnum, 'buyorig-status', true);
        if (empty($buyorig_status)) {
            $buyorig_status = __('Available', 'comiceasel');
        }
        ceo_protect();
        $post =& get_post($comicnum);
        // Get the post
        if (!is_wp_error($post) && !empty($post)) {
            // error check make sure it got a post
            $buy_output .= __('Comic ID', 'comiceasel') . ' #' . $comicnum . "<br />\r\n";
            $buy_output .= __('Title: ', 'comiceasel') . get_the_title($post) . "<br />\r\n";
            if (ceo_pluginfo('buy_comic_sell_print')) {
                $buy_output .= __('Print Status: ', 'comiceasel') . $buyprint_status . "<br />\r\n";
            }
            if (ceo_pluginfo('buy_comic_sell_original')) {
                $buy_output .= __('Original Status: ', 'comiceasel') . $buyorig_status . "<br />\r\n";
            }
            $buy_output .= "<br />\r\n";
            $buy_output .= '<table class="buytable" style="width:100%;">';
            $buy_output .= '<tr>';
            // buy print
            if (ceo_pluginfo('buy_comic_sell_print')) {
                $buy_output .= '<td align="left" valign="top" style="width:50%;">';
                $buy_output .= '<div class="buycomic-us-form">';
                $buy_output .= '<h4 class="buycomic-title">Print</h4>';
                $buy_output .= '$' . $buy_print_amount . '<br />';
                if ($buyprint_status == __('Available', 'comiceasel')) {
                    $buy_output .= '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
                    $buy_output .= '<input type="hidden" name="add" value="1" />';
                    $buy_output .= '<input type="hidden" name="cmd" value="_cart" />';
                    $buy_output .= '<input type="hidden" name="notify_url" value="' . home_url() . '/?ceopaypalipn">';
                    $buy_output .= '<input type="hidden" name="item_name" value="' . __('Print', 'comiceasel') . ' - ' . get_the_title($post->ID) . ' - ' . $post->ID . '" />';
                    // Say a thank you and that transaction went through with an action
                    $url = ceo_pluginfo('buy_comic_url');
                    $url_and = strpos($url, '?') ? $url . '&amp;' : $url . '?';
                    $buy_output .= '<input type="hidden" name="return" value="' . $url_and . 'action=thankyou&amp;id=' . $comicnum . '" />';
                    $buy_output .= '<input type="hidden" name="amount" value="' . $buy_print_amount . '" />';
                    $buy_output .= '<input type="hidden" name="item_number" value="' . $comicnum . '" />';
                    $buy_output .= '<input type="hidden" name="business" value="' . ceo_pluginfo('buy_comic_email') . '" />';
                    $buy_output .= '<input type="image" src="' . ceo_pluginfo('plugin_url') . 'images/buynow_paypal.png" name="submit32" alt="' . __('Make payments with PayPal - it is fast, free and secure!', 'comicpress') . '" />';
                    $buy_output .= '</form>';
                }
                if ($buyprint_status == __('Sold', 'comiceasel')) {
                    $buy_output .= '<img src="' . ceo_pluginfo('plugin_url') . 'images/sold.png" alt="' . __('Sold', 'comiceasel') . '" />';
                } elseif ($buyprint_status == __('Out Of Stock', 'comiceasel')) {
                    $buy_output .= '<img src="' . ceo_pluginfo('plugin_url') . 'images/outofstock.png" alt="' . __('Out Of Stock', 'comiceasel') . '" />';
                } elseif ($buyprint_status == __('Not Available', 'comiceasel')) {
                    $buy_output .= '<img src="' . ceo_pluginfo('plugin_url') . 'images/notavailable.png" alt="' . __('Not Available', 'comiceasel') . '" />';
                }
                $buy_output .= '</div>';
                $buy_output .= '</td>';
            }
            // buy original
            if (ceo_pluginfo('buy_comic_sell_original')) {
                $buy_output .= '<td align="left" valign="top" style="width:50%;">';
                $buy_output .= '<div class="buycomic-us-form" style="width:100%;">';
                $buy_output .= '<h4 class="buycomic-title">Original</h4>';
                $buy_output .= '$' . $buy_print_orig_amount . '<br />';
                if ($buyorig_status == __('Available', 'comiceasel')) {
                    $buy_output .= '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
                    $buy_output .= '<input type="hidden" name="add" value="1" />';
                    $buy_output .= '<input type="hidden" name="cmd" value="_cart" />';
                    $buy_output .= '<input type="hidden" name="notify_url" value="' . home_url() . '/?ceopaypalipn">';
                    $buy_output .= '<input type="hidden" name="item_name" value="' . __('Original', 'comiceasel') . ' - ' . get_the_title($post->ID) . ' - ' . $post->ID . '" />';
                    // Say a thank you and that transaction went through with an action
                    $url = ceo_pluginfo('buy_comic_url');
                    $url_and = strpos($url, '?') ? $url . '&amp;' : $url . '?';
                    $buy_output .= '<input type="hidden" name="return" value="' . $url_and . 'action=thankyou&amp;id=' . $comicnum . '" />';
                    $buy_output .= '<input type="hidden" name="amount" value="' . $buy_print_orig_amount . '" />';
                    $buy_output .= '<input type="hidden" name="item_number" value="' . $comicnum . '" />';
                    $buy_output .= '<input type="hidden" name="business" value="' . ceo_pluginfo('buy_comic_email') . '" />';
                    $buy_output .= '<input type="image" src="' . ceo_pluginfo('plugin_url') . 'images/buynow_paypal.png" name="submit32" alt="' . __('Make payments with PayPal - it is fast, free and secure!', 'comicpress') . '" />';
                    $buy_output .= '</form>';
                }
                if ($buyorig_status == __('Sold', 'comiceasel')) {
                    $buy_output .= '<img src="' . ceo_pluginfo('plugin_url') . 'images/sold.png" alt="' . __('Sold', 'comiceasel') . '" />';
                } elseif ($buyorig_status == __('Out Of Stock', 'comiceasel')) {
                    $buy_output .= '<img src="' . ceo_pluginfo('plugin_url') . 'images/outofstock.png" alt="' . __('Out Of Stock', 'comiceasel') . '" />';
                } elseif ($buyorig_status == __('Not Available', 'comiceasel')) {
                    $buy_output .= '<img src="' . ceo_pluginfo('plugin_url') . 'images/notavailable.png" alt="' . __('Not Available', 'comiceasel') . '" />';
                }
                $buy_output .= '</div>';
                $buy_output .= '</td>';
            }
            $buy_output .= '</tr>';
            $buy_output .= "</table>\r\n";
            $buy_output .= '<div class="buy-thumbnail">';
            $buy_output .= ceo_display_comic_thumbnail('large', $post);
            $buy_output .= "</div>\r\n";
            /*			$last_info = get_option('ceo_paypal_receiver'); // Debug to see the last transaction, which is stored in this option
            					if (!empty($last_info)) $buy_output .= nl2br($last_info); */
        } else {
            $buy_output .= __('Invalid Comic ID.', 'comiceasel') . "<br />\r\n";
        }
        ceo_unprotect();
    }
    return $buy_output;
}
Пример #3
0
function ceo_inject_thumbnail_into_archive_posts()
{
    global $post;
    if ($post->post_type == 'comic') {
        echo '<p>' . str_replace('alt=', 'class="aligncenter" alt=', ceo_display_comic_thumbnail('medium', $post, true, 320)) . '</p>';
    }
}
Пример #4
0
function ceo_manage_comic_columns($column_name, $id)
{
    global $wpdb;
    switch ($column_name) {
        case 'chapter':
            $allterms = get_the_terms($id, 'chapters');
            if (!empty($allterms) && !isset($allterms->errors)) {
                foreach ($allterms as $term) {
                    $term_list_chapters[] = '<a href="' . admin_url('edit.php?post_type=comic&chapters=' . $term->name) . '">' . $term->name . '</a>';
                }
                echo join(', ', $term_list_chapters);
            }
            break;
        case 'characters':
            $allterms = get_the_terms($id, 'characters');
            if (!empty($allterms) && !isset($allterms->errors)) {
                foreach ($allterms as $term) {
                    $term_list_characters[] = '<a href="' . admin_url('edit.php?post_type=comic&characters=' . $term->name) . '">' . $term->name . '</a>';
                }
                echo join(', ', $term_list_characters);
            }
            break;
        case 'locations':
            $allterms = get_the_terms($id, 'locations');
            if (!empty($allterms) && !isset($allterms->errors)) {
                foreach ($allterms as $term) {
                    $term_list_locations[] = '<a href="' . admin_url('/wp-admin/edit.php?post_type=comic&locations=' . $term->name) . '">' . $term->name . '</a>';
                }
                echo join(', ', $term_list_locations);
            }
            break;
        case 'comicimages':
            $post = get_post($id);
            $comicthumb = ceo_display_comic_thumbnail('thumbnail', $post, array(120, 0));
            if (!$comicthumb) {
                echo __('No thumbnail Found.', 'comiceasel');
            } else {
                echo $comicthumb;
            }
            break;
        default:
            break;
    }
    // end switch
}