current_time('timestamp')) { $pollq_active = -1; } else { $pollq_active = 1; } // Poll End Date $pollq_expiry_no = isset( $_POST['pollq_expiry_no'] ) ? (int) sanitize_key($_POST['pollq_expiry_no']) : 0; if ($pollq_expiry_no === 1) { $pollq_expiry = ''; } else { $pollq_expiry_day = (int) sanitize_key($_POST['pollq_expiry_day']); $pollq_expiry_month = (int) sanitize_key($_POST['pollq_expiry_month']); $pollq_expiry_year = (int) sanitize_key($_POST['pollq_expiry_year']); $pollq_expiry_hour = (int) sanitize_key($_POST['pollq_expiry_hour']); $pollq_expiry_minute = (int) sanitize_key($_POST['pollq_expiry_minute']); $pollq_expiry_second = (int) sanitize_key($_POST['pollq_expiry_second']); $pollq_expiry = gmmktime($pollq_expiry_hour, $pollq_expiry_minute, $pollq_expiry_second, $pollq_expiry_month, $pollq_expiry_day, $pollq_expiry_year); if ($pollq_expiry <= current_time('timestamp')) { $pollq_active = 0; } } // Mutilple Poll $pollq_multiple_yes = (int) sanitize_key($_POST['pollq_multiple_yes']); $pollq_multiple = 0; if ($pollq_multiple_yes === 1) { $pollq_multiple = (int) sanitize_key($_POST['pollq_multiple']); } else { $pollq_multiple = 0; } // Insert Poll $add_poll_question = $wpdb->insert( $wpdb->pollsq, array( 'pollq_question' => $pollq_question, 'pollq_timestamp' => $pollq_timestamp, 'pollq_totalvotes' => 0, 'pollq_active' => $pollq_active, 'pollq_expiry' => $pollq_expiry, 'pollq_multiple' => $pollq_multiple, 'pollq_totalvoters' => 0 ), array( '%s', '%s', '%d', '%d', '%s', '%d', '%d' ) ); if ( ! $add_poll_question ) { $text .= '

' . sprintf(__('Error In Adding Poll \'%s\'.', 'wp-polls'), $pollq_question) . '

'; } // Add Poll Answers $polla_answers = $_POST['polla_answers']; $polla_qid = (int) $wpdb->insert_id; foreach ($polla_answers as $polla_answer) { $polla_answer = wp_kses_post( trim( $polla_answer ) ); if( ! empty( $polla_answer ) ) { $add_poll_answers = $wpdb->insert( $wpdb->pollsa, array( 'polla_qid' => $polla_qid, 'polla_answers' => $polla_answer, 'polla_votes' => 0 ), array( '%d', '%s', '%d' ) ); if ( ! $add_poll_answers ) { $text .= '

' . sprintf(__('Error In Adding Poll\'s Answer \'%s\'.', 'wp-polls'), $polla_answer) . '

'; } } else { $text .= '

' . __( 'Poll\'s Answer is empty.', 'wp-polls' ) . '

'; } } // Update Lastest Poll ID To Poll Options $latest_pollid = polls_latest_id(); $update_latestpoll = update_option('poll_latestpoll', $latest_pollid); // If poll starts in the future use the correct poll ID $latest_pollid = ( $latest_pollid < $polla_qid ) ? $polla_qid : $latest_pollid; if ( empty( $text ) ) { $text = '

' . sprintf( __( 'Poll \'%s\' (ID: %s) added successfully. Embed this poll with the shortcode: %s or go back to Manage Polls', 'wp-polls' ), $pollq_question, $latest_pollid, '', $base_page ) . '

'; } else { if( $add_poll_question ) { $text .= '

' . sprintf( __( 'Poll \'%s\' (ID: %s) (Shortcode: %s) added successfully, but there are some errors with the Poll\'s Answers. Embed this poll with the shortcode: %s or go back to Manage Polls', 'wp-polls' ), $pollq_question, $latest_pollid, '' ) .'

'; } } do_action( 'wp_polls_add_poll', $latest_pollid ); cron_polls_place(); } else { $text .= '

' . __( 'Poll Question is empty.', 'wp-polls' ) . '

'; } break; } } ### Add Poll Form $poll_noquestion = 2; $count = 0; ?>
'.removeslashes($text).'
'; } ?>

\n"; echo "\n"; echo "\n"; echo "\n"; $count++; } ?>
 
".sprintf(__('Answer %s', 'wp-polls'), number_format_i18n($i))."