コード例 #1
0
ファイル: insert_db.php プロジェクト: brthiess/rockstat_final
function insert_players($team)
{
    foreach ($team->players as $player) {
        insert_player($player);
    }
}
コード例 #2
0
function update_hotslogs_data()
{
    $last_scrape = get_option('hots_logs_last_scrape');
    if (current_time('timestamp') - $last_scrape >= 3600) {
        global $wpdb;
        $table_name = $wpdb->prefix . "hots_logs_plugin";
        $pids = $wpdb->get_col("SELECT player_id FROM {$table_name}");
        foreach ($pids as $pid) {
            insert_player(add_pid($pid));
        }
        $last_scrape = current_time('timestamp');
        update_option('hots_logs_last_scrape', $last_scrape);
    }
}
コード例 #3
0
     } else {
         // If scraper returns false
         add_action('admin_notices', 'error_notice');
         // Show error notice take no other action
     }
 } elseif (isset($_POST['battle_tag'])) {
     $clean_tag = check_input($_POST['battle_tag'], $_POST['region']);
     // Check the user input
     if ($clean_tag != false) {
         // If input is good
         include_once 'scraper/api_scraper.php';
         $valid_player = add_btag($_POST['battle_tag'], $_POST['region']);
         // Scrape the page return false if an invalid battletag is passed
         if ($valid_player != false) {
             // If a valid hotslogs profile is found
             insert_player($valid_player);
             // Insert the player
             add_action('admin_notices', 'player_added_notice');
             // Show success message
         } else {
             // If scraper returns false
             add_action('admin_notices', 'error_notice_btag');
             // Show error notice take no other action
         }
     } else {
         add_action('admin_notices', 'error_notice_btag');
         // Show error notice take no other action
     }
 } elseif (isset($_POST['delete'])) {
     delete_player($_POST['name']);
     add_action('admin_notices', 'player_deleted_notice');