コード例 #1
0
function podPress_print_upgrade_form($table = 'statcounts', $isinit = 'false')
{
    global $wpdb;
    if ('stats' == $table or 'statcounts' == $table) {
        $result_statistics = podPress_current_nr_of_rows($table, $isinit);
        echo '<div id="podPress_upgrade_' . $table . '_table" style="display:none;">';
        echo '<input type="hidden" id="podpress_upgr_' . $table . '_lastpos" value="0" /> ' . "\n";
        echo '<p>';
        echo __('Select an increment:', 'podpress') . ' <select id="podpress_upgr_' . $table . '_increment" name="podpress_upgr_' . $table . '_increment" onchange="podpress_update_button_text_on_increment_change(\'' . $table . '\', this.value);">';
        if ($result_statistics < 1) {
            echo '	<option value="0">0</option>';
        }
        if ($result_statistics >= 1 and $result_statistics < 10) {
            echo '	<option value="' . $result_statistics . '">' . $result_statistics . '</option>';
        }
        for ($i = 10; $i < intval($result_statistics); $i *= 10) {
            for ($j = 1; $j < 10; $j++) {
                $nr = $i * $j;
                if ($nr < intval($result_statistics)) {
                    echo '	<option value="' . $nr . '">' . $nr . '</option>';
                } else {
                    break;
                }
            }
        }
        echo '</select> &lt;= <span id="podpress_upgr_' . $table . '_increment_limit">10</span> <span class="podpress_description">' . __('(The increment should be smaller than this value)', 'podpress') . '</span>';
        echo '</p>';
        echo '<p>';
        echo sprintf(__('Number of rows in the data base table %1$s: %2$s', 'podpress'), '<em>' . $wpdb->prefix . 'podpress_' . $table . '</em>', '<span id="podpress_upgr_' . $table . '_total_rows">' . $result_statistics . '</span>') . "\n";
        echo '</p>';
        echo '<p>';
        echo sprintf(__('Number of rows which need be processed: %1$s', 'podpress'), '<span id="podpress_upgr_' . $table . '_to_process"></span>') . "\n";
        echo '</p>';
        echo '</div>' . "\n";
    }
}
コード例 #2
0
         die('Error: Security check failed.');
     }
     break;
 case 'upgradeaction':
     if (isset($_POST['_ajax_nonce']) and TRUE == function_exists('wp_verify_nonce') and TRUE == wp_verify_nonce($_POST['_ajax_nonce'], $nonce_key)) {
         require_once ABSPATH . PLUGINDIR . '/podpress/podpress_upgrade_functions.php';
         podPress_upgrade_via_ajax($_POST['upgr_process_nr'], $_POST['podpress_upgr_misc']);
     } else {
         die('Error: Security check failed.');
     }
     break;
 case 'curnrofrows':
     // is an upgrade action
     if (isset($_POST['_ajax_nonce']) and TRUE == function_exists('wp_verify_nonce') and TRUE == wp_verify_nonce($_POST['_ajax_nonce'], $nonce_key)) {
         require_once ABSPATH . PLUGINDIR . '/podpress/podpress_upgrade_functions.php';
         podPress_current_nr_of_rows($_POST['podpress_upgr_misc']['table'], 'false', $_POST['upgr_process_nr'], 'ajax');
     } else {
         die('Error: Security check failed.');
     }
     break;
 case 'printupgradeform':
     // is an upgrade action
     if (isset($_POST['_ajax_nonce']) and TRUE == function_exists('wp_verify_nonce') and TRUE == wp_verify_nonce($_POST['_ajax_nonce'], $nonce_key)) {
         require_once ABSPATH . PLUGINDIR . '/podpress/podpress_upgrade_functions.php';
         if (isset($_POST['podpress_upgr_misc']['table']) and ('stats' == $_POST['podpress_upgr_misc']['table'] or 'statcounts' == $_POST['podpress_upgr_misc']['table'])) {
             if (isset($_POST['podpress_upgr_misc']['isinit']) and ('false' == $_POST['podpress_upgr_misc']['isinit'] or 'true' == $_POST['podpress_upgr_misc']['isinit'])) {
                 podPress_print_upgrade_form($_POST['podpress_upgr_misc']['table'], $_POST['podpress_upgr_misc']['isinit']);
             } else {
                 podPress_print_upgrade_form($_POST['podpress_upgr_misc']['table'], 'false');
             }
         } else {