当前位置: 首页>>代码示例>>PHP>>正文


PHP cron_polls_place函数代码示例

本文整理汇总了PHP中cron_polls_place函数的典型用法代码示例。如果您正苦于以下问题:PHP cron_polls_place函数的具体用法?PHP cron_polls_place怎么用?PHP cron_polls_place使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cron_polls_place函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_poll_table


//.........这里部分代码省略.........
        include_once ABSPATH . '/wp-admin/includes/upgrade.php';
    } elseif (@is_file(ABSPATH . '/wp-admin/upgrade-functions.php')) {
        include_once ABSPATH . '/wp-admin/upgrade-functions.php';
    } elseif (@is_file(ABSPATH . '/wp-admin/includes/upgrade.php')) {
        include_once ABSPATH . '/wp-admin/includes/upgrade.php';
    } else {
        die('We have problem finding your \'/wp-admin/upgrade-functions.php\' and \'/wp-admin/includes/upgrade.php\'');
    }
    // Create Poll Tables (3 Tables)
    $charset_collate = '';
    if ($wpdb->supports_collation()) {
        if (!empty($wpdb->charset)) {
            $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
        }
        if (!empty($wpdb->collate)) {
            $charset_collate .= " COLLATE {$wpdb->collate}";
        }
    }
    $create_table = array();
    $create_table['pollsq'] = "CREATE TABLE {$wpdb->pollsq} (" . "pollq_id int(10) NOT NULL auto_increment," . "pollq_question varchar(200) character set utf8 NOT NULL default ''," . "pollq_timestamp varchar(20) NOT NULL default ''," . "pollq_totalvotes int(10) NOT NULL default '0'," . "pollq_active tinyint(1) NOT NULL default '1'," . "pollq_expiry varchar(20) NOT NULL default ''," . "pollq_multiple tinyint(3) NOT NULL default '0'," . "pollq_totalvoters int(10) NOT NULL default '0'," . "PRIMARY KEY (pollq_id)) {$charset_collate};";
    $create_table['pollsa'] = "CREATE TABLE {$wpdb->pollsa} (" . "polla_aid int(10) NOT NULL auto_increment," . "polla_qid int(10) NOT NULL default '0'," . "polla_answers varchar(200) character set utf8 NOT NULL default ''," . "polla_votes int(10) NOT NULL default '0'," . "PRIMARY KEY (polla_aid)) {$charset_collate};";
    $create_table['pollsip'] = "CREATE TABLE {$wpdb->pollsip} (" . "pollip_id int(10) NOT NULL auto_increment," . "pollip_qid varchar(10) NOT NULL default ''," . "pollip_aid varchar(10) NOT NULL default ''," . "pollip_ip varchar(100) NOT NULL default ''," . "pollip_host VARCHAR(200) NOT NULL default ''," . "pollip_timestamp varchar(20) NOT NULL default '0000-00-00 00:00:00'," . "pollip_user tinytext NOT NULL," . "pollip_userid int(10) NOT NULL default '0'," . "PRIMARY KEY (pollip_id)," . "KEY pollip_ip (pollip_id)," . "KEY pollip_qid (pollip_qid)" . ") {$charset_collate};";
    maybe_create_table($wpdb->pollsq, $create_table['pollsq']);
    maybe_create_table($wpdb->pollsa, $create_table['pollsa']);
    maybe_create_table($wpdb->pollsip, $create_table['pollsip']);
    // Check Whether It is Install Or Upgrade
    $first_poll = $wpdb->get_var("SELECT pollq_id FROM {$wpdb->pollsq} LIMIT 1");
    // If Install, Insert 1st Poll Question With 5 Poll Answers
    if (empty($first_poll)) {
        // Insert Poll Question (1 Record)
        $insert_pollq = $wpdb->query("INSERT INTO {$wpdb->pollsq} VALUES (1, '" . __('How Is My Site?', 'wp-polls') . "', '" . current_time('timestamp') . "', 0, 1, '', 0, 0);");
        if ($insert_pollq) {
            // Insert Poll Answers  (5 Records)
            $wpdb->query("INSERT INTO {$wpdb->pollsa} VALUES (1, 1, '" . __('Good', 'wp-polls') . "', 0);");
            $wpdb->query("INSERT INTO {$wpdb->pollsa} VALUES (2, 1, '" . __('Excellent', 'wp-polls') . "', 0);");
            $wpdb->query("INSERT INTO {$wpdb->pollsa} VALUES (3, 1, '" . __('Bad', 'wp-polls') . "', 0);");
            $wpdb->query("INSERT INTO {$wpdb->pollsa} VALUES (4, 1, '" . __('Can Be Improved', 'wp-polls') . "', 0);");
            $wpdb->query("INSERT INTO {$wpdb->pollsa} VALUES (5, 1, '" . __('No Comments', 'wp-polls') . "', 0);");
        }
    }
    // Add In Options (16 Records)
    add_option('poll_template_voteheader', '<p style="text-align: center;"><strong>%POLL_QUESTION%</strong></p>' . '<div id="polls-%POLL_ID%-ans" class="wp-polls-ans">' . '<ul class="wp-polls-ul">');
    add_option('poll_template_votebody', '<li><input type="%POLL_CHECKBOX_RADIO%" id="poll-answer-%POLL_ANSWER_ID%" name="poll_%POLL_ID%" value="%POLL_ANSWER_ID%" /> <label for="poll-answer-%POLL_ANSWER_ID%">%POLL_ANSWER%</label></li>');
    add_option('poll_template_votefooter', '</ul>' . '<p style="text-align: center;"><input type="button" name="vote" value="   ' . __('Vote', 'wp-polls') . '   " class="Buttons" onclick="poll_vote(%POLL_ID%);" /></p>' . '<p style="text-align: center;"><a href="#ViewPollResults" onclick="poll_result(%POLL_ID%); return false;" title="' . __('View Results Of This Poll', 'wp-polls') . '">' . __('View Results', 'wp-polls') . '</a></p>' . '</div>');
    add_option('poll_template_resultheader', '<p style="text-align: center;"><strong>%POLL_QUESTION%</strong></p>' . '<div id="polls-%POLL_ID%-ans" class="wp-polls-ans">' . '<ul class="wp-polls-ul">');
    add_option('poll_template_resultbody', '<li>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%%' . __(',', 'wp-polls') . ' %POLL_ANSWER_VOTES% ' . __('Votes', 'wp-polls') . ')</small><div class="pollbar" style="width: %POLL_ANSWER_IMAGEWIDTH%%;" title="%POLL_ANSWER_TEXT% (%POLL_ANSWER_PERCENTAGE%% | %POLL_ANSWER_VOTES% ' . __('Votes', 'wp-polls') . ')"></div></li>');
    add_option('poll_template_resultbody2', '<li><strong><i>%POLL_ANSWER% <small>(%POLL_ANSWER_PERCENTAGE%%' . __(',', 'wp-polls') . ' %POLL_ANSWER_VOTES% ' . __('Votes', 'wp-polls') . ')</small></i></strong><div class="pollbar" style="width: %POLL_ANSWER_IMAGEWIDTH%%;" title="' . __('You Have Voted For This Choice', 'wp-polls') . ' - %POLL_ANSWER_TEXT% (%POLL_ANSWER_PERCENTAGE%% | %POLL_ANSWER_VOTES% ' . __('Votes', 'wp-polls') . ')"></div></li>');
    add_option('poll_template_resultfooter', '</ul>' . '<p style="text-align: center;">' . __('Total Voters', 'wp-polls') . ': <strong>%POLL_TOTALVOTERS%</strong></p>' . '</div>');
    add_option('poll_template_resultfooter2', '</ul>' . '<p style="text-align: center;">' . __('Total Voters', 'wp-polls') . ': <strong>%POLL_TOTALVOTERS%</strong></p>' . '<p style="text-align: center;"><a href="#VotePoll" onclick="poll_booth(%POLL_ID%); return false;" title="' . __('Vote For This Poll', 'wp-polls') . '">' . __('Vote', 'wp-polls') . '</a></p>' . '</div>');
    add_option('poll_template_disable', __('Sorry, there are no polls available at the moment.', 'wp-polls'));
    add_option('poll_template_error', __('An error has occurred when processing your poll.', 'wp-polls'));
    add_option('poll_currentpoll', 0);
    add_option('poll_latestpoll', 1);
    add_option('poll_archive_perpage', 5);
    add_option('poll_ans_sortby', 'polla_aid');
    add_option('poll_ans_sortorder', 'asc');
    add_option('poll_ans_result_sortby', 'polla_votes');
    add_option('poll_ans_result_sortorder', 'desc');
    // Database Upgrade For WP-Polls 2.1
    add_option('poll_logging_method', '3');
    add_option('poll_allowtovote', '2');
    maybe_add_column($wpdb->pollsq, 'pollq_active', "ALTER TABLE {$wpdb->pollsq} ADD pollq_active TINYINT( 1 ) NOT NULL DEFAULT '1';");
    // Database Upgrade For WP-Polls 2.12
    maybe_add_column($wpdb->pollsip, 'pollip_userid', "ALTER TABLE {$wpdb->pollsip} ADD pollip_userid INT( 10 ) NOT NULL DEFAULT '0';");
    add_option('poll_archive_url', site_url('pollsarchive'));
    // Database Upgrade For WP-Polls 2.13
    add_option('poll_bar', array('style' => 'default', 'background' => 'd8e1eb', 'border' => 'c8c8c8', 'height' => 8));
    // Database Upgrade For WP-Polls 2.14
    maybe_add_column($wpdb->pollsq, 'pollq_expiry', "ALTER TABLE {$wpdb->pollsq} ADD pollq_expiry varchar(20) NOT NULL default '';");
    add_option('poll_close', 1);
    // Database Upgrade For WP-Polls 2.20
    add_option('poll_ajax_style', array('loading' => 1, 'fading' => 1));
    add_option('poll_template_pollarchivelink', '<ul>' . '<li><a href="%POLL_ARCHIVE_URL%">' . __('Polls Archive', 'wp-polls') . '</a></li>' . '</ul>');
    add_option('poll_archive_displaypoll', 2);
    add_option('poll_template_pollarchiveheader', '');
    add_option('poll_template_pollarchivefooter', '<p>' . __('Start Date:', 'wp-polls') . ' %POLL_START_DATE%<br />' . __('End Date:', 'wp-polls') . ' %POLL_END_DATE%</p>');
    maybe_add_column($wpdb->pollsq, 'pollq_multiple', "ALTER TABLE {$wpdb->pollsq} ADD pollq_multiple TINYINT( 3 ) NOT NULL DEFAULT '0';");
    $pollq_totalvoters = maybe_add_column($wpdb->pollsq, 'pollq_totalvoters', "ALTER TABLE {$wpdb->pollsq} ADD pollq_totalvoters INT( 10 ) NOT NULL DEFAULT '0';");
    if ($pollq_totalvoters) {
        $pollq_totalvoters = intval($wpdb->get_var("SELECT SUM(pollq_totalvoters) FROM {$wpdb->pollsq}"));
        if ($pollq_totalvoters == 0) {
            $wpdb->query("UPDATE {$wpdb->pollsq} SET pollq_totalvoters = pollq_totalvotes");
        }
    }
    // Database Upgrade For WP-Polls 2.30
    add_option('poll_cookielog_expiry', 0);
    add_option('poll_template_pollarchivepagingheader', '');
    add_option('poll_template_pollarchivepagingfooter', '');
    // Database Upgrade For WP-Polls 2.50
    delete_option('poll_archive_show');
    // Database Upgrade For WP-Polls 2.61
    $wpdb->query("ALTER TABLE {$wpdb->pollsip} ADD INDEX pollip_ip (pollip_id);");
    $wpdb->query("ALTER TABLE {$wpdb->pollsip} ADD INDEX pollip_qid (pollip_qid);");
    // Set 'manage_polls' Capabilities To Administrator
    $role = get_role('administrator');
    if (!$role->has_cap('manage_polls')) {
        $role->add_cap('manage_polls');
    }
    cron_polls_place();
}
开发者ID:vsalx,项目名称:rattieinfo,代码行数:101,代码来源:wp-polls.php

示例2: __

    $update_poll_text[] = __('Poll Close Option', 'wp-polls');
    $update_poll_text[] = __('Logging Method', 'wp-polls');
    $update_poll_text[] = __('Cookie And Log Expiry Option', 'wp-polls');
    $update_poll_text[] = __('Allow To Vote Option', 'wp-polls');
    $i = 0;
    $text = '';
    foreach ($update_poll_queries as $update_poll_query) {
        if ($update_poll_query) {
            $text .= '<p style="color: green;">' . $update_poll_text[$i] . ' ' . __('Updated', 'wp-polls') . '</p>';
        }
        $i++;
    }
    if (empty($text)) {
        $text = '<p style="color: red;">' . __('No Poll Option Updated', 'wp-polls') . '</p>';
    }
    cron_polls_place();
}
?>
<script type="text/javascript">
/* <![CDATA[*/
	function set_pollbar_height(height) {
			jQuery("#poll_bar_height").val(height);
	}
	function update_pollbar(where) {
		pollbar_background = "#" + jQuery("#poll_bar_bg").val();
		pollbar_border = "#" + jQuery("#poll_bar_border").val();
		pollbar_height = jQuery("#poll_bar_height").val() + "px";
		if(where  == "background") {
			jQuery("#wp-polls-pollbar-bg").css("background-color", pollbar_background);
		} else if(where == "border") {
			jQuery("#wp-polls-pollbar-border").css("background-color", pollbar_border);
开发者ID:2030449c,项目名称:farkol,代码行数:31,代码来源:polls-options.php


注:本文中的cron_polls_place函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。