forked from islamic-network/alquran.cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ayah.php
63 lines (57 loc) · 2.96 KB
/
ayah.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
$app->get('/ayah', function ($request, $response, $args) {
if (isset($request->getQueryParams()['reference']) && $request->getQueryParams()['reference'] !== null && $request->getQueryParams()['reference'] != '') {
$reference = urldecode($request->getQueryParams()['reference']);
} else {
$reference = '24:35';
}
$ayah = $this->get('client')->AlQuranCloudApi->ayah($reference, 'quran-uthmani-quran-academy');
return $this->get('renderer')->render($response, 'ayah.php', [
'pageTitle' => 'Quran - Surah ' . $ayah->data->surah->englishName . ' Ayah ' . $ayah->data->numberInSurah . ' (' . $ayah->data->surah->number . ':' . $ayah->data->numberInSurah . ')',
'metaDescription' => 'AlQuran Cloud',
'ayah' => $ayah,
'reference' => $reference,
'editions' => [
'editions' => $this->get('client')->AlQuranCloudApi->editions(null, null, 'text'),
],
'view' => 'ayah'
]);
});
$app->get('/ayah/{reference}', function ($request, $response, $args) {
$reference = urldecode($request->getAttribute('reference'));
if (isset($request->getQueryParams()['reference']) && $request->getQueryParams()['reference'] !== null && $request->getQueryParams()['reference'] != '') {
$reference = $request->getQueryParams()['reference'];
}
$ayah = $this->get('client')->AlQuranCloudApi->ayah($reference, 'quran-uthmani-quran-academy');
return $this->get('renderer')->render($response, 'ayah.php', [
'pageTitle' => 'Quran - Surah ' . $ayah->data->surah->englishName . ' Ayah ' . $ayah->data->numberInSurah . ' (' . $ayah->data->surah->number . ':' . $ayah->data->numberInSurah . ')',
'metaDescription' => 'AlQuran Cloud',
'ayah' => $ayah,
'reference' => $reference,
'editions' => [
'editions' => $this->get('client')->AlQuranCloudApi->editions(null, null, 'text'),
],
'view' => 'ayah'
]);
});
$app->get('/ayah/{reference}/{edition}', function ($request, $response, $args) {
$reference = urldecode($request->getAttribute('reference'));
$edition = $request->getAttribute('edition');
if (isset($request->getQueryParams()['reference']) && $request->getQueryParams()['reference'] !== null && $request->getQueryParams()['reference'] != '') {
$reference = $request->getQueryParams()['reference'];
}
$ayah = $this->get('client')->AlQuranCloudApi->ayah($reference, 'quran-uthmani-quran-academy');
return $this->get('renderer')->render($response, 'ayah.php', [
'pageTitle' => 'Quran - Surah ' . $ayah->data->surah->englishName . ' Ayah ' . $ayah->data->numberInSurah . ' (' . $ayah->data->surah->number . ':' . $ayah->data->numberInSurah . ')',
'metaDescription' => 'AlQuran Cloud',
'ayah' => $ayah,
'reference' => $reference,
'ayahEdition' => $this->get('client')->AlQuranCloudApi->ayah($reference, $edition),
'editions' => [
'editions' => $this->get('client')->AlQuranCloudApi->editions(null, null, 'text'),
],
'view' => 'ayah'
]);
});