本文整理汇总了PHP中polls_latest_id函数的典型用法代码示例。如果您正苦于以下问题:PHP polls_latest_id函数的具体用法?PHP polls_latest_id怎么用?PHP polls_latest_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了polls_latest_id函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
$polla_answer_new_vote = intval($polla_answers_new_votes[$i]);
$add_poll_answers = $wpdb->query("INSERT INTO {$wpdb->pollsa} VALUES (0, {$pollq_id}, '{$polla_answer_new}', {$polla_answer_new_vote})");
if (!$add_poll_answers) {
$text .= '<p style="color: red;">' . sprintf(__('Error In Adding Poll\'s Answer \'%s\'.', 'wp-polls'), stripslashes($polla_answer_new)) . '</p>';
} else {
$text .= '<p style="color: green;">' . sprintf(__('Poll\'s Answer \'%s\' Added Successfully.', 'wp-polls'), stripslashes($polla_answer_new)) . '</p>';
}
}
$i++;
}
}
if (empty($text)) {
$text = '<p style="color: green">' . sprintf(__('Poll \'%s\' Edited Successfully.', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
}
// Update Lastest Poll ID To Poll Options
$latest_pollid = polls_latest_id();
$update_latestpoll = update_option('poll_latestpoll', $latest_pollid);
cron_polls_place();
break;
}
}
### Determines Which Mode It Is
switch ($mode) {
// Poll Logging
case 'logs':
require 'polls-logs.php';
break;
?>
<?php
break;
// Edit A Poll
示例2: manage_poll
function manage_poll()
{
global $wpdb;
### Form Processing
if (isset($_POST['action']) && $_POST['action'] == 'polls-admin') {
if (!empty($_POST['do'])) {
// Set Header
header('Content-Type: text/html; charset=' . get_option('blog_charset') . '');
// Decide What To Do
switch ($_POST['do']) {
// Delete Polls Logs
case __('Delete All Logs', 'wp-polls'):
check_ajax_referer('wp-polls_delete-polls-logs');
if (trim($_POST['delete_logs_yes']) == 'yes') {
$delete_logs = $wpdb->query("DELETE FROM {$wpdb->pollsip}");
if ($delete_logs) {
echo '<p style="color: green;">' . __('All Polls Logs Have Been Deleted.', 'wp-polls') . '</p>';
} else {
echo '<p style="color: red;">' . __('An Error Has Occurred While Deleting All Polls Logs.', 'wp-polls') . '</p>';
}
}
break;
// Delete Poll Logs For Individual Poll
// Delete Poll Logs For Individual Poll
case __('Delete Logs For This Poll Only', 'wp-polls'):
check_ajax_referer('wp-polls_delete-poll-logs');
$pollq_id = intval($_POST['pollq_id']);
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM {$wpdb->pollsq} WHERE pollq_id = {$pollq_id}");
if (trim($_POST['delete_logs_yes']) == 'yes') {
$delete_logs = $wpdb->query("DELETE FROM {$wpdb->pollsip} WHERE pollip_qid = {$pollq_id}");
if ($delete_logs) {
echo '<p style="color: green;">' . sprintf(__('All Logs For \'%s\' Has Been Deleted.', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
} else {
echo '<p style="color: red;">' . sprintf(__('An Error Has Occurred While Deleting All Logs For \'%s\'', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
}
}
break;
// Delete Poll's Answer
// Delete Poll's Answer
case __('Delete Poll Answer', 'wp-polls'):
check_ajax_referer('wp-polls_delete-poll-answer');
$pollq_id = intval($_POST['pollq_id']);
$polla_aid = intval($_POST['polla_aid']);
$poll_answers = $wpdb->get_row("SELECT polla_votes, polla_answers FROM {$wpdb->pollsa} WHERE polla_aid = {$polla_aid} AND polla_qid = {$pollq_id}");
$polla_votes = intval($poll_answers->polla_votes);
$polla_answers = stripslashes(trim($poll_answers->polla_answers));
$delete_polla_answers = $wpdb->query("DELETE FROM {$wpdb->pollsa} WHERE polla_aid = {$polla_aid} AND polla_qid = {$pollq_id}");
$delete_pollip = $wpdb->query("DELETE FROM {$wpdb->pollsip} WHERE pollip_qid = {$pollq_id} AND pollip_aid = {$polla_aid}");
$update_pollq_totalvotes = $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_totalvotes = (pollq_totalvotes-{$polla_votes}) WHERE pollq_id = {$pollq_id}");
if ($delete_polla_answers) {
echo '<p style="color: green;">' . sprintf(__('Poll Answer \'%s\' Deleted Successfully.', 'wp-polls'), $polla_answers) . '</p>';
} else {
echo '<p style="color: red;">' . sprintf(__('Error In Deleting Poll Answer \'%s\'.', 'wp-polls'), $polla_answers) . '</p>';
}
break;
// Open Poll
// Open Poll
case __('Open Poll', 'wp-polls'):
check_ajax_referer('wp-polls_open-poll');
$pollq_id = intval($_POST['pollq_id']);
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM {$wpdb->pollsq} WHERE pollq_id = {$pollq_id}");
$open_poll = $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_active = 1 WHERE pollq_id = {$pollq_id};");
if ($open_poll) {
echo '<p style="color: green;">' . sprintf(__('Poll \'%s\' Is Now Opened', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
} else {
echo '<p style="color: red;">' . sprintf(__('Error Opening Poll \'%s\'', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
}
break;
// Close Poll
// Close Poll
case __('Close Poll', 'wp-polls'):
check_ajax_referer('wp-polls_close-poll');
$pollq_id = intval($_POST['pollq_id']);
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM {$wpdb->pollsq} WHERE pollq_id = {$pollq_id}");
$close_poll = $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_active = 0 WHERE pollq_id = {$pollq_id};");
if ($close_poll) {
echo '<p style="color: green;">' . sprintf(__('Poll \'%s\' Is Now Closed', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
} else {
echo '<p style="color: red;">' . sprintf(__('Error Closing Poll \'%s\'', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
}
break;
// Delete Poll
// Delete Poll
case __('Delete Poll', 'wp-polls'):
check_ajax_referer('wp-polls_delete-poll');
$pollq_id = intval($_POST['pollq_id']);
$pollq_question = $wpdb->get_var("SELECT pollq_question FROM {$wpdb->pollsq} WHERE pollq_id = {$pollq_id}");
$delete_poll_question = $wpdb->query("DELETE FROM {$wpdb->pollsq} WHERE pollq_id = {$pollq_id}");
$delete_poll_answers = $wpdb->query("DELETE FROM {$wpdb->pollsa} WHERE polla_qid = {$pollq_id}");
$delete_poll_ip = $wpdb->query("DELETE FROM {$wpdb->pollsip} WHERE pollip_qid = {$pollq_id}");
$poll_option_lastestpoll = $wpdb->get_var("SELECT option_value FROM {$wpdb->options} WHERE option_name = 'poll_latestpoll'");
if (!$delete_poll_question) {
echo '<p style="color: red;">' . sprintf(__('Error In Deleting Poll \'%s\' Question', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
}
if (empty($text)) {
echo '<p style="color: green;">' . sprintf(__('Poll \'%s\' Deleted Successfully', 'wp-polls'), stripslashes($pollq_question)) . '</p>';
}
// Update Lastest Poll ID To Poll Options
$latest_pollid = polls_latest_id();
$update_latestpoll = update_option('poll_latestpoll', $latest_pollid);
//.........这里部分代码省略.........
示例3: cron_polls_status
function cron_polls_status()
{
global $wpdb;
// Close Poll
$close_polls = $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_active = 0 WHERE pollq_expiry < '" . current_time('timestamp') . "' AND pollq_expiry != '' AND pollq_active != 0");
// Open Future Polls
$active_polls = $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_active = 1 WHERE pollq_timestamp <= '" . current_time('timestamp') . "' AND pollq_active = -1");
// Update Latest Poll If Future Poll Is Opened
if ($active_polls) {
$update_latestpoll = update_option('poll_latestpoll', polls_latest_id());
}
return;
}