コード例 #1
0
ファイル: admin.php プロジェクト: kosir/thatcamp-org
 public function db_update()
 {
     $main_obj = new YOP_POLL_Maintenance();
     $main_obj->some_function();
 }
コード例 #2
0
ファイル: maintenance.php プロジェクト: kfwebdev/wp-atd
    public function some_function($x = 0, $current_options = array())
    {
        $installed_version = get_option("yop_poll_version");
        global $wpdb;
        if (version_compare($installed_version, '4.9.3', '<=') || $x == 1) {
            if (!version_compare(phpversion(), '5.3', '<')) {
                ini_set("memory_limit", "1024M");
                require_once ABSPATH . 'wp-admin/includes/upgrade.php';
                require_once YOP_POLL_INC . 'db_schema.php';
                if (empty($current_options)) {
                    $current_options = get_option('yop_poll_options');
                    $default = get_option('yop_poll_options');
                }
                $capObj = YOP_POLL_Capabilities::get_instance();
                $capObj->install_capabilities();
                Yop_Poll_DbSchema::create_poll_database_tables();
                $wpdb->query('ALTER TABLE `' . $wpdb->yop_polls . '` CHANGE `ID` `ID` INT( 11 ) NOT NULL ');
                $this->install_default_options();
                $new_options = array('user_interface_type' => 'beginner', 'is_default_answer' => $current_options['is_default_answer'], 'poll_start_date' => current_time('mysql'), 'poll_end_date' => '01-01-2038 23:59:59', 'view_results' => array($current_options['view_results']), 'view_results_start_date' => convert_date($current_options['view_results_start_date'], 'd-m-Y H:i:s', 1), 'view_results_permissions' => array('guest', 'registered'), 'view_results_type' => $current_options['view_results_type'], 'answer_result_label' => $current_options['answer_result_label'], 'vote_button_label' => $current_options['vote_button_label'], 'template_width' => $current_options['template_width'], 'widget_template_width' => $current_options['widget_template_width'], 'view_results_link' => $current_options['view_results_link'], 'view_results_link_label' => $current_options['view_results_link_label'], 'view_back_to_vote_link' => $current_options['view_back_to_vote_link'], 'view_back_to_vote_link_label' => $current_options['view_back_to_vote_link_label'], 'view_total_votes' => $current_options['view_total_votes'], 'view_total_votes_label' => $current_options['view_total_votes_label'], 'view_total_answers' => $current_options['view_total_answers'], 'view_total_answers_label' => $current_options['view_total_answers_label'], 'message_after_vote' => $current_options['message_after_vote'], 'vote_permisions' => array('guest', 'registered'), 'vote_permisions_wordpress' => $current_options['vote_permisions_wordpress'], 'vote_permisions_wordpress_label' => $current_options['vote_permisions_wordpress_label'], 'vote_permisions_anonymous' => $current_options['vote_permisions_anonymous'], 'vote_permisions_anonymous_label' => $current_options['vote_permisions_anonymous_label'], 'blocking_voters' => array($current_options['blocking_voters']), 'blocking_voters_interval_value' => $current_options['blocking_voters_interval_value'], 'blocking_voters_interval_unit' => $current_options['blocking_voters_interval_unit'], 'limit_number_of_votes_per_user' => $current_options['limit_number_of_votes_per_user'], 'number_of_votes_per_user' => $current_options['number_of_votes_per_user'], 'percentages_decimals' => $current_options['percentages_decimals'], 'use_default_loading_image' => $current_options['use_default_loading_image'], 'loading_image_url' => $current_options['loading_image_url'], 'redirect_after_vote' => $current_options['redirect_after_vote'], 'redirect_after_vote_url' => $current_options['redirect_after_vote_url'], 'date_format' => 'UE', 'view_poll_archive_link' => $current_options['view_poll_archive_link'], 'auto_generate_poll_page' => $current_options['auto_generate_poll_page'], 'has_auto_generate_poll_page' => $current_options['has_auto_generate_poll_page'], 'use_captcha' => $current_options['use_captcha'], 'send_email_notifications' => $current_options['send_email_notifications'], 'allow_other_answers' => $current_options['allow_other_answers'], 'other_answers_label' => $current_options['other_answers_label'], 'is_default_other_answer' => $current_options['is_default_other_answer'], 'add_other_answers_to_default_answers' => $current_options['add_other_answers_to_default_answers'], 'display_other_answers_values' => $current_options['display_other_answers_values'], 'allow_multiple_answers' => $current_options['allow_multiple_answers'], 'allow_multiple_answers_number' => $current_options['allow_multiple_answers_number'], 'allow_multiple_answers_min_number' => $current_options['allow_multiple_answers_min_number'], 'display_answers' => $current_options['display_answers'], 'display_answers_tabulated_cols' => $current_options['display_answers_tabulated_cols'], 'sorting_results' => 'as_defined', 'sorting_answers' => 'as_defined', 'sorting_results_direction' => $current_options['sorting_results_direction'], 'sorting_answers_direction' => $current_options['sorting_answers_direction'], 'singular_answer_result_votes_number_label' => $current_options['singular_answer_result_votes_number_label'], 'plural_answer_result_votes_number_label' => $current_options['plural_answer_result_votes_number_label'], 'display_results' => $current_options['display_results'], 'display_results_tabulated_cols' => $current_options['display_results_tabulated_cols'], 'bar_background' => $current_options['bar_background'], 'bar_height' => $current_options['bar_height'], 'bar_border_color' => $current_options['bar_border_color'], 'bar_border_width' => $current_options['bar_border_width'], 'bar_border_style' => $current_options['bar_border_style'], 'sorting_archive_polls' => 'votes', 'sorting_archive_polls_rule' => 'asc', 'archive_url' => $current_options['archive_url'], 'archive_link_label' => $current_options['view_poll_archive_link_label'], 'show_poll_in_archive' => $current_options['show_in_archive'], 'poll_archive_order' => $current_options['archive_order'], 'archive_polls_per_page' => $current_options['archive_polls_per_page'], 'email_notifications_from_name' => $current_options['email_notifications_from_name'], 'email_notifications_from_email' => $current_options['email_notifications_from_email'], 'email_notifications_recipients' => $current_options['email_notifications_recipients'], 'email_notifications_subject' => $current_options['email_notifications_subject'], 'email_notifications_body' => '<p>A new vote was registered on %VOTE_DATE% for %POLL_NAME%</p>

                                                            <p>Vote Details:</p>

                                                            [QUESTION]

                                                            <p><b>Question:</b> %QUESTION_TEXT%</p>

                                                            <p><b>Answers:</b> <br />

                                                            [ANSWERS]

                                                            %ANSWER_VALUE%

                                                            [/ANSWERS]

                                                            </p>

                                                            <p><b>Custom Fields:</b> <br />

                                                            [CUSTOM_FIELDS]

                                                            %CUSTOM_FIELD_NAME% - %CUSTOM_FIELD_VALUE%

                                                            [/CUSTOM_FIELDS]

                                                            </p>

                                                            [/QUESTION]

                                                            <p><b>Vote ID:</b> <br />%VOTE_ID%</p>', 'schedule_reset_poll_stats' => $current_options['schedule_reset_poll_stats'], 'schedule_reset_poll_date' => current_time('mysql'), 'schedule_reset_poll_recurring_value' => $current_options['schedule_reset_poll_recurring_value'], 'schedule_reset_poll_recurring_unit' => $current_options['schedule_reset_poll_recurring_unit'], 'singular_answer_result_votes_number_label' => __yop_poll("vote"), 'plural_answer_result_votes_number_label' => __yop_poll("votes"), 'start_scheduler' => $current_options['start_scheduler'], 'use_the_same_template_for_widget' => 'yes', 'vote_permisions_facebook' => 'no', 'vote_permisions_facebook_label' => __yop_poll('Vote as Facebook User'), 'facebook_share_after_vote' => 'no', 'facebook_share_description' => __yop_poll('Just casted an YOP Poll vote on ') . get_bloginfo('name'), 'vote_permisions_google' => 'no', 'vote_permisions_google_label' => __yop_poll('Vote as G+ User'), 'show_google_share_button' => 'no', 'google_integration' => 'no', 'facebook_integration' => 'no', 'facebook_show_comments_widget' => "no");
                if ($current_options['blocking_voters'] == 'cookie-ip') {
                    $new_options['blocking_voters'] = array("cookie", 'ip');
                } else {
                    if ($current_options['blocking_voters'] == 'username') {
                        $new_options['blocking_voters'] = array('user_id');
                    }
                }
                list($g1, $d) = explode('-', $current_options['view_results_permissions']);
                $new_options['view_results_permissions'] = array($g1, $d);
                list($g1, $d) = explode('-', $current_options['view_results_link']);
                $new_options['view_results_link'] = array($g1, $d);
                update_option('yop_poll_options', $new_options);
                update_option("yop_poll_version", YOP_POLL_VERSION);
                YOP_POLL_Maintenance::activation_hook($default);
                $wpdb->query('ALTER TABLE `' . $wpdb->yop_polls . '` CHANGE `ID` `ID` INT( 11 ) NOT NULL AUTO_INCREMENT ');
            }
        }
        $installed_version = get_option("yop_poll_version");
        if (version_compare($installed_version, '5.2', '<=')) {
            ini_set('max_execution_time', 700);
            ini_set("memory_limit", "512M");
            $default_poll_options = get_option('yop_poll_options');
            $default_poll_options['email_notifications_body'] = '<p>A new vote was registered on %VOTE_DATE% for %POLL_NAME%</p>

                                                            <p>Vote Details:</p>

                                                            [QUESTION]

                                                            <p><b>Question:</b> %QUESTION_TEXT%</p>

                                                            <p><b>Answers:</b> <br />

                                                            [ANSWERS]

                                                            %ANSWER_VALUE%

                                                            [/ANSWERS]

                                                            </p>

                                                            <p><b>Custom Fields:</b> <br />

                                                            [CUSTOM_FIELDS]

                                                            %CUSTOM_FIELD_NAME% - %CUSTOM_FIELD_VALUE%

                                                            [/CUSTOM_FIELDS]

                                                            </p>

                                                            [/QUESTION]

                                                            <p><b>Vote ID:</b> <br />%VOTE_ID%</p>';
            update_option('yop_poll_options', $default_poll_options);
            $templates = self::yop_poll_get_templates_new_version_from_db();
            foreach ($templates as $template) {
                $template['js'] = <<<NOWDOC
function stripBorder_%POLL-ID%(object) {
\tobject.each(function() {
\t\tif( parseInt(jQuery(this).width() ) > 0) {
\t\t\tjQuery(this).width(
\t\t\t\tparseInt(
\t\t\t\t\tjQuery(this).width() ) -
\t\t\t\t\tparseInt(jQuery(this).css("border-left-width")) -
\t\t\t\t\tparseInt(jQuery(this).css("border-right-width"))
\t\t\t);
\t\t\t}
\t\telse {
\t\tjQuery(this).css("border-left-width", "0px");
\t\tjQuery(this).css("border-right-width", "0px");
\t\t}
\t});
}
function stripPadding_%POLL-ID%(object) {
\tobject.each(function() {
\t\tjQuery(this).width(
\t\tparseInt( jQuery(this).width() ) -
\t\tparseInt(jQuery(this).css("padding-left")) -
\t\tparseInt(jQuery(this).css("padding-left"))
\t\t);
\t});
}

function strip_results_%POLL-ID%() {
\tstripPadding_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%") );
\tstripBorder_%POLL-ID%(  jQuery("#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%") );
}

jQuery(document).ready(function(e) {
\tif(typeof window.strip_results_%POLL-ID% == "function")
\t\tstrip_results_%POLL-ID%();
\tif(typeof window.tabulate_answers_%POLL-ID% == "function")
\t\ttabulate_answers_%POLL-ID%();
\tif(typeof window.tabulate_results_%POLL-ID% == "function")
\t\ttabulate_results_%POLL-ID%();
});

function equalWidth_%POLL-ID%(obj, cols, findWidest ) {
\tfindWidest  = typeof findWidest  !== "undefined" ? findWidest  : false;
\tif ( findWidest ) {
\t\tobj.each(function() {
\t\t\tvar thisWidth = jQuery(this).width();
\t\t\twidth = parseInt(thisWidth / cols);
\t\t\tjQuery(this).width(width);
\t\t\tjQuery(this).css("float", "left");
\t\t});
\t}
\telse {
\t\tvar widest = 0;
\t\tobj.each(function() {
\t\t\tvar thisWidth = jQuery(this).width();
\t\t\tif(thisWidth > widest) {
\t\t\t\twidest = thisWidth;
\t\t\t}
\t\t});
\t\twidth = parseInt( %POLL-WIDTH% / cols[0]);
\t\tobj.width(width-20);
\t\tobj.css("float", "left");
\t}
}

function equalWidth2_%POLL-ID%(obj, cols, findWidest ) {
\tfindWidest  = typeof findWidest  !== "undefined" ? findWidest  : false;
\tif ( findWidest ) {
\t\tobj.each(function() {
\t\t\tvar thisWidth = jQuery(this).width();
\t\t\twidth = parseInt(thisWidth / cols);
\t\t\tjQuery(this).width(width);
\t\t\tjQuery(this).css("float", "left");
\t\t});
\t}
\telse {
\t\tvar widest = 0;
\t\tobj.each(function() {
\t\t\tvar thisWidth = jQuery(this).width();
\t\t\tif(thisWidth > widest) {
\t\t\t\twidest = thisWidth;
\t\t\t}
\t\t});
\t\twidth = parseInt( %POLL-WIDTH% / cols[1]);
\t\tobj.width(width-20);
\t\tobj.css("float", "left");
\t}
}
function tabulate_answers_%POLL-ID%() {

\tequalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%"), %ANSWERS-TABULATED-COLS% );
\t//equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %ANSWERS-TABULATED-COLS%, true );
}

function tabulate_results_%POLL-ID%() {
\tequalWidth2_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%"), %RESULTS-TABULATED-COLS% );
\t//equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %RESULTS-TABULATED-COLS%, true );
\t}

jQuery(document).ready(function(){
\trunOnPollStateChange_%POLL-ID%();
});

function runOnPollStateChange_%POLL-ID%() {

};
NOWDOC;
                self::update_poll_template_in_database($template);
            }
            $polls = self::yop_poll_get_polls_for_body_mail_update();
            foreach ($polls as $poll) {
                $current = new YOP_POLL_Poll_Model($poll['ID']);
                $current->email_notifications_body = '<p>A new vote was registered on %VOTE_DATE% for %POLL_NAME%</p>

                                                            <p>Vote Details:</p>

                [QUESTION]

                                                            <p><b>Question:</b> %QUESTION_TEXT%</p>

                                                            <p><b>Answers:</b> <br />

                                                            [ANSWERS]

                                                            %ANSWER_VALUE%

                                                            [/ANSWERS]

                                                            </p>

                                                            <p><b>Custom Fields:</b> <br />

                                                            [CUSTOM_FIELDS]

                                                            %CUSTOM_FIELD_NAME% - %CUSTOM_FIELD_VALUE%

                                                            [/CUSTOM_FIELDS]

                                                            </p>

                [/QUESTION]

                                                            <p><b>Vote ID:</b> <br />%VOTE_ID%</p>';
                $current->save();
            }
            update_option("yop_poll_version", YOP_POLL_VERSION);
        }
        $installed_version = get_option("yop_poll_version");
        if (version_compare($installed_version, '5.3', '<=')) {
            update_option("yop_poll_version", YOP_POLL_VERSION);
        }
        $installed_version = get_option("yop_poll_version");
        if (version_compare($installed_version, '5.5', '<=')) {
            update_option("yop_poll_version", YOP_POLL_VERSION);
        }
        $installed_version = get_option("yop_poll_version");
        if (version_compare($installed_version, '5.6', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", YOP_POLL_VERSION);
            $default_poll_options = get_option('yop_poll_options');
            $default_poll_options['show_results_in'] = "bar";
            update_option('yop_poll_options', $default_poll_options);
            $wpdb->query('ALTER TABLE `' . $wpdb->yop_poll_templates . '` ADD `after_vote_template_chart` text');
            update_option("yop_poll_version", '5.7');
        }
        if (version_compare($installed_version, '5.7', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", YOP_POLL_VERSION);
            $templates = self::yop_poll_get_templates_new_version_from_db();
            foreach ($templates as $template) {
                $template['js'] = <<<NOWDOC
\tfunction stripBorder_%POLL-ID%(object) {
\tobject.each(function() {
\t\tif( parseInt(jQuery(this).width() ) > 0) {
\t\t\tjQuery(this).width(
\t\t\t\tparseInt(
\t\t\t\t\tjQuery(this).width() ) -
\t\t\t\t\tparseInt(jQuery(this).css("border-left-width")) -
\t\t\t\t\tparseInt(jQuery(this).css("border-right-width"))
\t\t\t);
\t\t\t}
\t\telse {
\t\tjQuery(this).css("border-left-width", "0px");
\t\tjQuery(this).css("border-right-width", "0px");
\t\t}
\t});
}
function stripPadding_%POLL-ID%(object) {
\tobject.each(function() {
\t\tjQuery(this).width(
\t\tparseInt( jQuery(this).width() ) -
\t\tparseInt(jQuery(this).css("padding-left")) -
\t\tparseInt(jQuery(this).css("padding-left"))
\t\t);
\t});
}

function strip_results_%POLL-ID%() {
\tstripPadding_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%") );
\tstripBorder_%POLL-ID%(  jQuery("#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%") );
}

jQuery(document).ready(function(e) {
   jQuery('.yop-poll-forms').removeClass('yop-poll-forms-display');
\tif(typeof window.strip_results_%POLL-ID% == "function")
\t\tstrip_results_%POLL-ID%();
\tif(typeof window.tabulate_answers_%POLL-ID% == "function")
\t\ttabulate_answers_%POLL-ID%();
\tif(typeof window.tabulate_results_%POLL-ID% == "function")
\t\ttabulate_results_%POLL-ID%();



});

function equalWidth_%POLL-ID%(obj, cols, findWidest ) {

    findWidest  = typeof findWidest  !== "undefined" ? findWidest  : false;
    var quest=0;
    if ( findWidest ) {
        obj.each(function() {
            var thisWidth = jQuery(this).width();
            width = parseInt(thisWidth / cols);
            jQuery(this).width(width);
            jQuery(this).css("float", "left");
        });
    }
    else {
        var widest = 0;
        var count  = 0;
        var poz_each_question=0;

        obj.each(function() {

            count++;
            cols[quest][2]=(jQuery('#yop-poll-answers-%POLL-ID%-'+ cols[quest][3] +' li').length);
            var thisWidth = jQuery(this).width();
            if(thisWidth > widest) {
                widest = thisWidth;
            }
            if(count<cols[quest][2])
            { width = parseInt( %POLL-WIDTH% / cols[quest][0]);
             if(cols[quest][0]==1)
                        jQuery(".yop-poll-li-answer-%POLL-ID%-"+cols[quest][3]).css("width","100%");
             else
                         jQuery(".yop-poll-li-answer-%POLL-ID%-"+cols[quest][3]).width(width-20);
             jQuery(".yop-poll-li-answer-%POLL-ID%-"+cols[quest][3]).css("float", "left");
            }
            else
            {
                count=0;


                width = parseInt( %POLL-WIDTH% / cols[quest][0]);
                jQuery(".yop-poll-li-answer-%POLL-ID%-"+cols[quest][3]).width(width-20);
                jQuery(".yop-poll-li-answer-%POLL-ID%-"+cols[quest][3]).css("float", "left");
                quest++;
            }

        });
}
}

function equalWidth2_%POLL-ID%(obj, cols, findWidest ) {
    findWidest  = typeof findWidest  !== "undefined" ? findWidest  : false;
    var quest=0;

    if ( findWidest ) {
        obj.each(function() {
            var thisWidth = jQuery(this).width();
            width = parseInt(thisWidth / cols);
            jQuery(this).width(width);
            jQuery(this).css("float", "left");
        });
    }
    else {
        var widest = 0;
        var count  = 0;
        var poz_each_question=0;

        obj.each(function() {
            count++;
            cols[quest][2]=(jQuery('#yop-poll-answers-%POLL-ID%-'+ cols[quest][3] +' li').length);
            var thisWidth = jQuery(this).width();
            if(thisWidth > widest) {
                widest = thisWidth;
            }
            if(count<cols[quest][2])
            { width = parseInt( %POLL-WIDTH% / cols[quest][1]);
             jQuery(".yop-poll-li-result-%POLL-ID%-"+cols[quest][3]).width(width-20);
             jQuery(".yop-poll-li-result-%POLL-ID%-"+cols[quest][3]).css("float", "left");
            }
            else
            {
                count=0;


                width = parseInt( %POLL-WIDTH% / cols[quest][1]);
                jQuery(".yop-poll-li-result-%POLL-ID%-"+cols[quest][3]).width(width-20);
                jQuery(".yop-poll-li-result-%POLL-ID%-"+cols[quest][3]).css("float", "left");
                quest++;
            }

        });
}
}
function tabulate_answers_%POLL-ID%() {

\tequalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%"), %ANSWERS-TABULATED-COLS% );
\t//equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %ANSWERS-TABULATED-COLS%, true );
}

function tabulate_results_%POLL-ID%() {
\tequalWidth2_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%"), %RESULTS-TABULATED-COLS% );
\t//equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %RESULTS-TABULATED-COLS%, true );
\t}

jQuery(document).ready(function(){
\trunOnPollStateChange_%POLL-ID%();
});

function runOnPollStateChange_%POLL-ID%() {

};
NOWDOC;
                $template['after_vote_template_chart'] = <<<NOWDOC
\t[QUESTION_CONTAINER]
\t<div id = "yop-poll-question-container-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-question-container-%POLL-ID%">
\t\t<div id = "yop-poll-question-%POLL-ID%-%QUESTION-ID%"
             class = "yop-poll-question-%POLL-ID%">%POLL-QUESTION%</div>
\t\t<div id = "yop-poll-answers-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-answers-%POLL-ID%">
                       <div id = "yop-poll-answers-chart-canvas-%POLL-ID%-%QUESTION-ID%" style="text-align:center;"  class="yop-poll-answers-container-chart-%POLL-ID% yop-poll-center-chart">
\t\t\t<canvas id="yop-poll-answers-chart-%POLL-ID%-%QUESTION-ID%" class="yop-poll-answers-chart"></canvas>
                       </div>
\t\t</div>
\t</div>
\t<div class = "yop-poll-clear-%POLL-ID%"></div>
\t[/QUESTION_CONTAINER]
<div id = "yop-poll-vote-%POLL-ID%" class = "yop-poll-footer">
\t<div>%POLL-TOTAL-ANSWERS-LABEL%</div>
\t<div>%POLL-TOTAL-VOTES-LABEL%</div>
\t<div id = "yop-poll-back-%POLL-ID%">%POLL-BACK-TO-VOTE-LINK%</div>
\t<div id = "yop-poll-archive-%POLL-ID%">%POLL-VIEW-ARCHIVE-LINK%</div>
\t%SHARE-BUTTON%
</div>
NOWDOC;
                self::update_poll_template_in_database2($template);
            }
            update_option("yop_poll_version", '5.7.1');
        }
        if (version_compare($installed_version, '5.7.1', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", '5.7.2');
        }
        if (version_compare($installed_version, '5.7.2', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", '5.7.3');
        }
        if (version_compare($installed_version, '5.7.3', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", '5.7.4');
        }
        if (version_compare($installed_version, '5.7.4', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", '5.7.5');
        }
        if (version_compare($installed_version, '5.7.5', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", '5.7.6');
        }
        if (version_compare($installed_version, '5.7.6', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", '5.7.7');
        }
        if (version_compare($installed_version, '5.7.7', '<=')) {
            global $wpdb;
            update_option("yop_poll_version", '5.7.8');
        }
    }