|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
include_once __DIR__ . '/../../../config.php'; |
|
4
|
|
|
include_once __DIR__ . '/QueryManagerMysql.php'; |
|
5
|
|
|
|
|
6
|
|
|
abstract class QueryManager { |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
protected static $time_offset; |
|
9
|
|
|
protected static $config; |
|
10
|
|
|
|
|
11
|
|
|
private static $current; |
|
12
|
|
|
public static function current() { |
|
13
|
|
|
global $time_offset; |
|
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
if (self::$current == null) { |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
$variables = realpath(dirname(__FILE__)) . '/../../json/variables.json'; |
|
18
|
|
|
self::$config = json_decode(file_get_contents($variables)); |
|
19
|
|
|
|
|
20
|
|
|
include_once(SYS_PATH.'/core/process/timezone.loader.php'); |
|
21
|
|
|
self::$time_offset = $time_offset; |
|
22
|
|
|
|
|
23
|
|
|
switch (self::$config->system->db_type) { |
|
24
|
|
|
case "monocle-hydro": |
|
25
|
|
|
self::$current = new QueryManagerMonocleHydro(); |
|
26
|
|
|
break; |
|
27
|
|
|
|
|
28
|
|
|
default: |
|
29
|
|
|
self::$current = new QueryManagerRocketmap(); |
|
30
|
|
|
break; |
|
31
|
|
|
} |
|
32
|
|
|
} |
|
33
|
|
|
return self::$current; |
|
34
|
|
|
} |
|
35
|
|
|
private function __construct(){} |
|
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
// Misc |
|
38
|
|
|
public abstract function getEcapedString($string); |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
// Tester |
|
41
|
|
|
public abstract function testTotalPokemon(); |
|
|
|
|
|
|
42
|
|
|
public abstract function testTotalGyms(); |
|
|
|
|
|
|
43
|
|
|
public abstract function testTotalPokestops(); |
|
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
// Homepage |
|
46
|
|
|
public abstract function getTotalPokemon(); |
|
|
|
|
|
|
47
|
|
|
public abstract function getTotalLures(); |
|
|
|
|
|
|
48
|
|
|
public abstract function getTotalGyms(); |
|
|
|
|
|
|
49
|
|
|
public abstract function getTotalRaids(); |
|
|
|
|
|
|
50
|
|
|
public abstract function getTotalGymsForTeam($team_id); |
|
|
|
|
|
|
51
|
|
|
public abstract function getRecentAll(); |
|
|
|
|
|
|
52
|
|
|
public abstract function getRecentMythic($mythic_pokemon); |
|
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
// Single Pokemon |
|
55
|
|
|
public abstract function getGymsProtectedByPokemon($pokemon_id); |
|
|
|
|
|
|
56
|
|
|
public abstract function getPokemonLastSeen($pokemon_id); |
|
|
|
|
|
|
57
|
|
|
public abstract function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction); |
|
|
|
|
|
|
58
|
|
|
public abstract function getTop50Trainers($pokemon_id, $best_order_by, $best_direction); |
|
|
|
|
|
|
59
|
|
|
public abstract function getPokemonHeatmap($pokemon_id, $start, $end); |
|
|
|
|
|
|
60
|
|
|
public abstract function getPokemonGraph($pokemon_id); |
|
|
|
|
|
|
61
|
|
|
public abstract function getPokemonLive($pokemon_id, $ivMin, $ivMax, $inmap_pokemons); |
|
|
|
|
|
|
62
|
|
|
public abstract function getPokemonSliederMinMax(); |
|
|
|
|
|
|
63
|
|
|
public abstract function getMapsCoords(); |
|
|
|
|
|
|
64
|
|
|
|
|
65
|
|
|
// Pokestops |
|
66
|
|
|
public abstract function getTotalPokestops(); |
|
|
|
|
|
|
67
|
|
|
public abstract function getAllPokestops(); |
|
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
// Gyms |
|
70
|
|
|
public abstract function getTeamGuardians($team_id); |
|
|
|
|
|
|
71
|
|
|
public abstract function getOwnedAndPoints($team_id); |
|
|
|
|
|
|
72
|
|
|
public abstract function getAllGyms(); |
|
|
|
|
|
|
73
|
|
|
public abstract function getGymData($gym_id); |
|
|
|
|
|
|
74
|
|
|
public abstract function getGymDefenders($gym_id); |
|
|
|
|
|
|
75
|
|
|
|
|
76
|
|
|
// Raids |
|
77
|
|
|
public abstract function getAllRaids($page); |
|
|
|
|
|
|
78
|
|
|
|
|
79
|
|
|
// Trainers |
|
80
|
|
|
public abstract function getTrainers($trainer_name, $team, $page, $ranking); |
|
|
|
|
|
|
81
|
|
|
public abstract function getTrainerLevelCount($team_id); |
|
|
|
|
|
|
82
|
|
|
|
|
83
|
|
|
// Cron |
|
84
|
|
|
public abstract function getPokemonCountsActive(); |
|
|
|
|
|
|
85
|
|
|
public abstract function getPoekmonCountsLastDay(); |
|
|
|
|
|
|
86
|
|
|
public abstract function getPokemonSinceLastUpdate($pokemon_id, $last_update); |
|
|
|
|
|
|
87
|
|
|
public abstract function getRaidsSinceLastUpdate($pokemon_id, $last_update); |
|
|
|
|
|
|
88
|
|
|
public abstract function getCaptchaCount(); |
|
|
|
|
|
|
89
|
|
|
public abstract function getNestData(); |
|
|
|
|
|
|
90
|
|
|
} |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.