| Server IP : 43.141.50.122 / Your IP : 113.219.202.141 Web Server : Apache System : Linux VM-8-5-opencloudos 6.6.34-9.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 19 19:35:45 CST 2024 x86_64 User : www ( 1000) PHP Version : 8.1.27 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/www.ucppt.com/wp-content/plugins/wpcom-vip-redeem/includes/ |
Upload File : |
<?php
defined( 'ABSPATH' ) || exit;
class WVRD_Shortcode {
public function __construct() {
add_shortcode( 'vip_redeem', array( $this, 'render' ) );
}
public function render( $atts ) {
$atts = shortcode_atts( array(
'remark' => '',
'ids' => '',
'title' => '兑换码领取',
'desc' => '领取限量兑换码,错过等下一波',
), $atts );
global $wpdb;
$table = $wpdb->prefix . WVRD_TABLE;
if ( $atts['ids'] ) {
$ids = array_map( 'intval', explode( ',', $atts['ids'] ) );
$in = implode( ',', $ids );
$items = $wpdb->get_results( "SELECT id, code, status FROM {$table} WHERE id IN ({$in}) AND status != 2 ORDER BY id ASC" );
} elseif ( $atts['remark'] ) {
$remark = sanitize_text_field( $atts['remark'] );
$items = $wpdb->get_results( $wpdb->prepare(
"SELECT id, code, status FROM {$table} WHERE remark = %s AND status != 2 ORDER BY id ASC",
$remark
) );
} else {
return '';
}
if ( empty( $items ) ) return '';
ob_start();
include WVRD_PATH . 'templates/shortcode-redeem.php';
return ob_get_clean();
}
}