1 | <?php |
||
7 | class Downloader |
||
8 | { |
||
9 | private $config; |
||
10 | |||
11 | public function __construct(Config $config) |
||
12 | { |
||
13 | $this->config = $config; |
||
14 | } |
||
15 | |||
16 | public function sync($type = 'xml') |
||
17 | { |
||
18 | // Download quran data |
||
19 | foreach ($this->config->get('translations') as $tr) { |
||
20 | $file = $this->config->get('storage_path') . '/' . $tr . '.' . $type; |
||
21 | |||
22 | if (!file_exists($file)) { |
||
23 | $url = 'http://tanzil.net/trans/?transID=' . $tr . '&type=' . $type; |
||
24 | $this->download($url, $file); |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 | |||
29 | public function download($url, $destination) |
||
35 | } |
||
36 |