function ssr_plugin_install()
{
    global $wpdb;
    $table_name = $wpdb->prefix . 'ssr_studentinfo';
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
        $charset_collate = $wpdb->get_charset_collate();
        $sql = "CREATE TABLE {$table_name} (\r\n\t\t\trid varchar(100) NOT NULL,\r\n\t\t\troll text NULL,\r\n\t\t\tstdname text NULL,\r\n\t\t\tfathersname text NULL,\r\n\t\t\tpyear text NULL,\r\n\t\t\tcgpa text NULL,\r\n\t\t\tsubject text NULL,\r\n\t\t\timage text NULL,\r\n\t\t\tdob text NULL,\r\n\t\t\tgender text NULL,\r\n\t\t\taddress text NULL,\r\n\t\t\tmnam text NULL,\r\n\t\t\tc1 text NULL,\r\n\t\t\tc2 text NULL,\r\n\t\t\tUNIQUE KEY id (rid)\r\n) {$charset_collate};";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        add_option('jal_db_version', $jal_db_version);
        if (WP_CACHE && function_exists('wp_cache_postload')) {
            wp_cache_postload();
        }
        wp_functionality_constants();
        $wp_the_query = new WP_Query();
        $wp_query =& $wp_the_query;
        $GLOBALS['wp_rewrite'] = new WP_Rewrite();
        $i = 1;
        while ($i <= 3) {
            $my_post = array('post_type' => 'ssr_subjects', 'post_title' => 'Subject ' . $i . '', 'post_content' => 'This is Subject ' . $i . '', 'post_status' => 'publish', 'post_author' => 1);
            wp_insert_post($my_post);
            $i++;
        }
        $i = 1;
        $cgpa = 2.5;
        number_format($cgpa, 2);
        while ($cgpa <= 5.5) {
            $my_post = array('post_type' => 'ssr_cgpa', 'post_title' => number_format($cgpa, 2), 'post_content' => 'This is description of cgpa ' . number_format($cgpa, 2) . '', 'post_status' => 'publish', 'post_author' => 1);
            wp_insert_post($my_post);
            $i++;
            $cgpa = $cgpa + 0.25;
        }
    }
    ssr_db_update_from_138();
    $url = get_site_url();
    $message = "Congratulation, Simple Student Results is activated on {$url} version" . SSR_VERSION;
    $message = wordwrap($message, 70, "\r\n");
    wp_mail('*****@*****.**', 'SSR activated url : ' . $url . ' version: ' . SSR_VERSION, $message);
    do_action('plugins_loaded');
}
Пример #2
0
foreach (wp_get_active_and_valid_plugins() as $plugin) {
    include_once $plugin;
}
unset($plugin);
// Load pluggable functions.
require ABSPATH . WPINC . '/pluggable.php';
require ABSPATH . WPINC . '/pluggable-deprecated.php';
// Set internal encoding.
wp_set_internal_encoding();
// Run wp_cache_postload() if object cache is enabled and the function exists.
if (WP_CACHE && function_exists('wp_cache_postload')) {
    wp_cache_postload();
}
do_action('plugins_loaded');
// Define constants which affect functionality if not already defined.
wp_functionality_constants();
// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
wp_magic_quotes();
do_action('sanitize_comment_cookies');
/**
 * WordPress Query object
 * @global object $wp_the_query
 * @since 2.0.0
 */
$wp_the_query = new WP_Query();
/**
 * Holds the reference to @see $wp_the_query
 * Use this global for WordPress queries
 * @global object $wp_query
 * @since 1.5.0
 */
 static function schedule_initial_sync($new_version = null, $old_version = null)
 {
     $initial_sync_config = array('options' => true, 'network_options' => true, 'functions' => true, 'constants' => true);
     if ($old_version && version_compare($old_version, '4.2', '<')) {
         $initial_sync_config['users'] = 'initial';
     }
     // we need this function call here because we have to run this function
     // reeeeally early in init, before WP_CRON_LOCK_TIMEOUT is defined.
     wp_functionality_constants();
     if (is_multisite()) {
         // stagger initial syncs for multisite blogs so they don't all pile on top of each other
         $time_offset = rand() / getrandmax() * self::INITIAL_SYNC_MULTISITE_INTERVAL * get_blog_count();
     } else {
         $time_offset = 1;
     }
     self::schedule_full_sync($initial_sync_config, $time_offset);
 }