1 | <?php |
||
10 | class Wikipedia extends Connector |
||
11 | { |
||
12 | |||
13 | public static $ID = 22; |
||
14 | |||
15 | public $debug = true; |
||
16 | public $truncatedDebug = false; |
||
17 | |||
18 | public function __construct() |
||
22 | |||
23 | protected function getConnection($token = false) |
||
27 | |||
28 | public function getToken() |
||
40 | |||
41 | public function handle() |
||
42 | { |
||
43 | |||
44 | /* ⣠⣾⣿⣿⣷⣄ Simple PHP Wiki Info Box ⣠⣾⣿⣿⣷⣄ */ |
||
45 | /* https://github.com/gaffling/PHP-Wiki-API */ |
||
46 | // Get the Parameter from the URL |
||
47 | if (isset($_GET['language']) ) { |
||
48 | $language = $_GET['language']; |
||
49 | } else { |
||
50 | $language = 'de'; |
||
51 | } |
||
52 | if (isset($_GET['userAgent']) ) { |
||
53 | $userAgent = $_GET['userAgent']; |
||
54 | } else { |
||
55 | $userAgent = 'WikiBot/1.0 (+http://'.$_SERVER['SERVER_NAME'].'/)'; |
||
56 | } |
||
57 | if (isset($_GET['betterResults']) |
||
58 | and ($_GET['betterResults'] == 'false' or $_GET['betterResults'] == 0) |
||
59 | ) { |
||
60 | $betterResults = false; |
||
61 | } else { |
||
62 | $betterResults = true; |
||
63 | } |
||
64 | if (isset($_GET['proxy']) ) { |
||
65 | $proxy = $_GET['proxy']; |
||
66 | } else { |
||
67 | $proxy = null; |
||
68 | } |
||
69 | if (isset($_GET['imageProxy']) |
||
70 | and ($_GET['imageProxy'] == 'false' or $_GET['imageProxy']== 0) |
||
71 | ) { |
||
72 | $imageProxy = false; |
||
73 | } else { |
||
74 | $imageProxy = true; |
||
75 | } |
||
76 | if (isset($_GET['DEBUG']) ) { |
||
77 | $DEBUG = $_GET['DEBUG']; |
||
78 | } else { |
||
79 | $DEBUG = null; |
||
80 | } |
||
81 | // Set the Parameter |
||
82 | $options = array( |
||
83 | 'language' => $language, |
||
84 | 'userAgent' => $userAgent, |
||
85 | 'betterResults' => $betterResults, |
||
86 | 'proxy' => $proxy, |
||
87 | 'imageProxy' => $imageProxy, |
||
88 | 'DEBUG' => $DEBUG, |
||
89 | ); |
||
90 | // Include the Wikipedia API Class |
||
91 | include_once __DIR__.'/wiki2api.php'; |
||
92 | // Start the Wikipedia API Class |
||
93 | $wiki = new wiki($options); |
||
94 | // Output the API Response |
||
95 | echo $wiki->api($_GET['q']); |
||
96 | // Print the Script Runtime in DEBUG Mode |
||
97 | if (isset($DEBUG) ) { |
||
98 | echo "<pre>\n\n\tRuntime: ".number_format((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT']), 3); |
||
99 | } |
||
100 | } |
||
101 | |||
102 | public function getNewDataForComponent($component) |
||
106 | |||
107 | } |
||
108 |