コード例 #1
0
 function akpc_install()
 {
     global $akpc;
     if (!is_a($akpc, 'ak_popularity_contest')) {
         $akpc = new ak_popularity_contest();
     }
     $akpc->install();
     $akpc->upgrade();
     $akpc->mine_gap_data();
 }
コード例 #2
0
function akpc_init()
{
    global $wpdb, $akpc;
    $wpdb->ak_popularity = $wpdb->prefix . 'ak_popularity';
    $wpdb->ak_popularity_options = $wpdb->prefix . 'ak_popularity_options';
    $akpc = new ak_popularity_contest();
    // CHECK FOR POPULARITY TABLES
    if (isset($_GET['action']) && $_GET['action'] == 'activate') {
        $result = mysql_list_tables(DB_NAME);
        $tables = array();
        while ($row = mysql_fetch_row($result)) {
            $tables[] = $row[0];
        }
        if (!in_array($wpdb->ak_popularity, $tables) && !in_array($wpdb->ak_popularity_options, $tables)) {
            $akpc->install();
        } else {
            $akpc->get_settings();
            $akpc->mine_gap_data();
        }
    }
    $akpc->get_settings();
}