示例#1
0
function dk_speakout_paginate_signaturelist()
{
    include_once 'class.signaturelist.php';
    $list = new dk_speakout_Signaturelist();
    $table = $list->table($_POST['id'], $_POST['start'], $_POST['limit'], 'ajax', $_POST['dateformat']);
    echo $table;
    // end AJAX processing
    die;
}
function dk_speakout_signatures_shortcode($attr)
{
    include_once 'class.signaturelist.php';
    $options = get_option('dk_speakout_options');
    $id = 1;
    $rows = $options['signaturelist_rows'];
    $nextbuttontext = '>';
    $prevbuttontext = '<';
    $dateformat = 'M d, Y';
    if (isset($attr['id']) && is_numeric($attr['id'])) {
        $id = $attr['id'];
    }
    if (isset($attr['rows']) && is_numeric($attr['rows'])) {
        $rows = absint($attr['rows']);
    }
    if (isset($attr['nextbuttontext'])) {
        $nextbuttontext = $attr['nextbuttontext'];
    }
    if (isset($attr['prevbuttontext'])) {
        $prevbuttontext = $attr['prevbuttontext'];
    }
    if (isset($attr['dateformat'])) {
        $dateformat = $attr['dateformat'];
    }
    // make sure ajax callback url works on both https and http
    $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
    $params = array('ajaxurl' => admin_url('admin-ajax.php', $protocol), 'dateformat' => $dateformat);
    wp_enqueue_script('dk_speakout_signaturelist_js', plugins_url('speakout/js/signaturelist.js'), array('jquery'));
    wp_localize_script('dk_speakout_signaturelist_js', 'dk_speakout_signaturelist_js', $params);
    $table_html = dk_speakout_Signaturelist::table($id, 0, $rows, 'shortcode', $dateformat, $nextbuttontext, $prevbuttontext);
    return $table_html;
}