t_s_poll_question_settings = $ts_poll_old_standard = ''; $total_soft_poll_res_count = 1; $total_soft_poll_res_count1 = 0; $ts_poll_answers_columned = $ts_poll_answers_order = $ts_poll_question_query = $ts_poll_colors_array = array(); remove_all_filters( 'embed_oembed_html', 10 ); if ( $ts_poll_edit != 'true' ) { wp_enqueue_script( $this->plugin_name . 'ResizeSensor', plugin_dir_url( __DIR__ ) . 'public/js/ResizeSensor.js', array(), time(), false ); wp_enqueue_script( $this->plugin_name . 'ElementQueries', plugin_dir_url( __DIR__ ) . 'public/js/ElementQueries.js', array(), time(), false ); } if ( is_numeric( $total_soft_poll ) && is_int( (int) $total_soft_poll ) && (int) $total_soft_poll > 0 || array_key_exists( $total_soft_poll, $tsp_themes ) ) { if ( is_numeric( $total_soft_poll ) && is_int( (int) $total_soft_poll ) && (int) $total_soft_poll > 0 ) { $ts_poll_question_query = apply_filters( "tsp_get_all_params", (string) $total_soft_poll, true, true, false); if ($ts_poll_question_query["Question_Param"]["TS_Poll_Q_Theme"] === "Video Poll" || $ts_poll_question_query["Question_Param"]["TS_Poll_Q_Theme"] === "Video Without Button" || $ts_poll_question_query["Question_Param"]["TS_Poll_Q_Theme"] === "Image Without Button") { global $wp_embed; foreach ($ts_poll_question_query['Answers'] as $tsp_response_key => $tsp_response_value) { $tsp_check_embed = ""; if ($ts_poll_question_query["Question_Param"]["TS_Poll_Q_Theme"] === "Image Without Button") { $tsp_check_embed = sprintf( '
', $tsp_response_value["Answer_Param"]["TotalSoftPoll_Ans_Im"] == '' ? esc_url( plugin_dir_url( __DIR__ ) . '/public/img/tsp_no_img.jpg' ) : esc_url( $tsp_response_value["Answer_Param"]["TotalSoftPoll_Ans_Im"] ), $tsp_response_value["Answer_Param"]["TotalSoftPoll_Ans_Im"] == '' ? esc_html("No Image avaible" ) : html_entity_decode( htmlspecialchars_decode( $tsp_response_value['Answer_Title'] ), ENT_QUOTES ) ); } else { $tsp_check_embed = sprintf( ' ', $tsp_response_value["Answer_Param"]["TotalSoftPoll_Ans_Vd"] == '' ? sprintf( '', esc_url( plugin_dir_url( __DIR__ ) . '/public/img/tsp_no_video.png' ) ) : do_shortcode( $wp_embed->run_shortcode( '[embed]' . esc_url( $tsp_response_value["Answer_Param"]["TotalSoftPoll_Ans_Vd"] ) . '[/embed]' ) ) ); } $ts_poll_question_query['Answers'][$tsp_response_key]["embed"] = $tsp_check_embed; } } } elseif ( array_key_exists( $total_soft_poll, $tsp_themes ) ) { if ( $ts_poll_edit !== 'true' ) { return false; } $ts_poll_question_query = apply_filters( "tsp_get_all_params", (string) $total_soft_poll, false, true, false); } else { return false; } if ($ts_poll_question_query === false) { return false; } $t_s_poll_answers_values = $ts_poll_question_query['Answers']; $ts_poll_answers_count = $ts_poll_question_query['answers_count']; $tspoll_question_styles = $ts_poll_question_query['Question_Style']; $ts_poll_question_params = $ts_poll_question_query['Question_Param']; $t_s_poll_question_settings = $ts_poll_question_query['Question_Settings']; $total_soft_poll_res_count = array_sum( array_column( $t_s_poll_answers_values , 'Answer_Votes' ) ); if ( $total_soft_poll_res_count == 0 ) { $total_soft_poll_res_count = 1; $total_soft_poll_res_count1 = 0; } else { $total_soft_poll_res_count1 = $total_soft_poll_res_count; } } else { return false; } if (is_array($ts_poll_question_query)) { $ts_poll_base_id = $ts_poll_generated_css = ''; if ( $ts_poll_edit === 'true' || $ts_poll_edit === 'false') { $ts_poll_base_id = $total_soft_poll; }else { $ts_poll_base_id = $total_soft_poll; $total_soft_poll = rand( 100000, 999999 ); $tspoll_fontfamily_swap_arr = array( 'ts_poll_q_ff', 'ts_poll_boxsh', 'ts_poll_vb_ff', 'ts_poll_rb_ff', 'TotalSoft_Poll_Set_09' ); foreach ( $tspoll_fontfamily_swap_arr as $key => $value ) { if ( isset( $tspoll_question_styles[$value] ) || isset( $t_s_poll_question_settings[$value] ) ) { if ( isset( $tspoll_question_styles[$value] ) ) { $ts_poll_generated_css .= apply_filters("tsp_get_font_face", $tspoll_question_styles[$value]); } else { $ts_poll_generated_css .= apply_filters("tsp_get_font_face", $t_s_poll_question_settings[$value]); } } } } wp_enqueue_style( "ts_poll_special_{$total_soft_poll}", plugin_dir_url( __DIR__ ) . 'public/css/ts_poll-content-special.css', array(), time(), 'all' ); include plugin_dir_path( dirname( __FILE__ ) ) . 'public/css/tsp-form-css.php'; $ts_poll_popup_standard = false; $ts_poll_popup_standard_html = ""; echo sprintf( ' ', wp_nonce_field( 'tsp_vote_nonce_' . $total_soft_poll, 'tsp_vote_nonce_field_' . $total_soft_poll, true, false ), $ts_poll_popup_standard_html ); if($ts_poll_edit === "true"){ wp_add_inline_style("ts_poll_special_{$total_soft_poll}",$ts_poll_generated_css); }else{ echo sprintf( ' ', $ts_poll_generated_css ); } if ( $ts_poll_edit === 'true' ) { include plugin_dir_path( dirname( __FILE__ ) ) . 'public/js/tsp-content-js-edit.php'; }elseif ($ts_poll_edit === 'false') { return; } else { wp_enqueue_script( "ts_poll_js_{$total_soft_poll}", plugin_dir_url( __DIR__ ) . 'public/js/ts_poll-content.js', array( 'jquery' ), time(), false ); include plugin_dir_path( dirname( __FILE__ ) ) . 'public/js/tsp-content-js.php'; } }else{ return false; } } /** * Shortcode function for show poll * * @since 1.7.0 * * @param array $atts Shortcode attributes provided by a user. * * @return string */ public function ts_poll_shortcode( $atts ) { $atts = shortcode_atts( array( 'id' => '', 'edit' => '' ), $atts ); \ob_start(); $this->ts_poll_content( $atts['id'], $atts['edit'] ); return \ob_get_clean(); } /** * Retrieve the version number of the plugin. * * @since 1.7.0 * @return string The version number of the plugin. */ public function get_version() { return $this->version; } }