Пример #1
0
/**
 * Form textarea renderer
 * 
 * Prints (to browser) HTML for <textarea></textarea> input
 * 
 * $field params:
 * - value: string
 * - mode: plain-text | tinymce-mini | tinymce-full
 * - placeholder: string (for plain-text only)
 * - name: string
 * 
 * @param array $field
 * @since 0.1
 * @return void
 */
function adverts_field_textarea($field)
{
    $value = '';
    if (isset($field["value"])) {
        $value = $field["value"];
    }
    if ($field["mode"] == "plain-text") {
        $html = new Adverts_Html("textarea", array("name" => $field["name"], "rows" => 10, "cols" => 50, "placeholder" => isset($field["placeholder"]) ? $field["placeholder"] : null), $value);
        $html->forceLongClosing();
        echo $html->render();
    } elseif ($field["mode"] == "tinymce-mini") {
        $params = array("quicktags" => false, "media_buttons" => false, "teeny" => false, "textarea_rows" => 8, 'tinymce' => array('toolbar1' => 'bold,italic,strikethrough,bullist,numlist,blockquote,justifyleft,justifycenter,justifyright,link,unlink,spellchecker,wp_adv', 'theme_advanced_buttons2' => 'formatselect,justifyfull,forecolor,pastetext,pasteword,removeformat,charmap,outdent,indent,undo,redo', 'theme_advanced_buttons1' => 'bold,italic,strikethrough,bullist,numlist,blockquote,justifyleft,justifycenter,justifyright,link,unlink,spellchecker,wp_adv', 'theme_advanced_buttons2' => 'formatselect,justifyfull,forecolor,pastetext,pasteword,removeformat,charmap,outdent,indent,undo,redo'));
        wp_editor($field["value"], $field["name"], $params);
    } elseif ($field["mode"] == "tinymce-full") {
        wp_editor($field["value"], $field["name"]);
    } else {
        echo "Parameter [mode] is missing in the form!";
    }
}
Пример #2
0
/**
 * Display 'Pending' state on Classifieds list
 * 
 * This functions shows Expired state in the wp-admin / Classifieds panel
 * 
 * @see display_post_states filter
 * 
 * @global WP_Post $post
 * @param array $states
 * @return array
 */
function adext_payments_display_pending_state($states)
{
    global $post;
    $arg = get_query_var('post_status');
    if ($arg == 'advert-pending') {
        return $states;
    }
    if ($post->post_status != 'advert-pending') {
        return $states;
    }
    $loop = get_posts(array('post_type' => 'adverts-payment', 'post_status' => 'pending', 'posts_per_page' => 1, 'meta_query' => array(array('key' => '_adverts_object_id', 'value' => $post->ID))));
    if (isset($loop[0])) {
        $id = $loop[0]->ID;
    } else {
        $id = null;
    }
    $order_link = null;
    if ($id !== null) {
        $span = new Adverts_Html("span", array("class" => "dashicons dashicons-cart", "style" => "font-size: 18px"));
        $span->forceLongClosing(true);
        $order_link = new Adverts_Html("a", array("href" => admin_url("edit.php?post_type=advert&page=adext-payment-history&edit=" . $id), "title" => __("View order", "adverts")), $span->render());
    } else {
        $span = new Adverts_Html("span", array("class" => "dashicons dashicons-info", "title" => __('Abandoned', 'adverts'), "style" => "font-size: 18px"));
        $span->forceLongClosing(true);
        $order_link = $span->render();
    }
    return array(__('Pending Payment', 'adverts') . $order_link);
    return $states;
}
Пример #3
0
/**
 * Display 'Pending' state on Classifieds list
 * 
 * This functions shows Expired state in the wp-admin / Classifieds panel
 * 
 * @see display_post_states filter
 * 
 * @global WP_Post $post
 * @param array $states
 * @return array
 */
function adext_featured_post_state($states)
{
    global $post;
    if ($post->post_type == 'advert' && $post->menu_order > 0) {
        $span = new Adverts_Html("span", array("class" => "dashicons dashicons-flag", "title" => __('Featured', 'adverts'), "style" => "font-size: 18px"));
        $span->forceLongClosing(true);
        $states[] = $span->render();
    }
    return $states;
}