Ejemplo n.º 1
0
function getMsg($lat, $lng, $myPlace, $mydate)
{
    include_once 'prayer.php';
    $time_zone = 5.5;
    $calcmethod = 1;
    $prayTime = new PrayTime($calcmethod);
    $times = $prayTime->getPrayerTimes($mydate, $lat, $lng, $time_zone);
    $msg[0] = "Namaz Timings for {$myPlace} on " . date('l jS \\of F Y', $mydate) . "\n";
    $msg[0] .= "Fajr => " . date('h:i A', strtotime($times[0])) . "\n";
    //$msg[0] .= "Sunrise => " . date('h:i A',strtotime($times[1])) . "\n";
    $msg[0] .= "Dhuhr => " . date('h:i A', strtotime($times[2])) . "\n";
    $msg[0] .= "Asr => " . date('h:i A', strtotime($times[3])) . "\n";
    //$msg[0] .= "Sunset => " . date('h:i A',strtotime($times[4])) . "\n";
    $msg[0] .= "Maghrib => " . date('h:i A', strtotime($times[5])) . "\n";
    $msg[0] .= "Isha => " . date('h:i A', strtotime($times[6])) . "\n";
    $msg[1] = "Today's Iftar at " . date('h:i A', strtotime($times[5])) . ".({$myPlace})\n";
    return $msg;
}
Ejemplo n.º 2
0
<!-- #Header Starts -->

<!-- senarai -->
<div id="works"  class=" clearfix grid">
<?php 
$sql = "SELECT * FROM `location` ORDER BY `tempat`";
$result = mysql_query($sql) or die(mysql_error());
$count = 1;
while ($row = mysql_fetch_array($result)) {
    $url = "https://maps.googleapis.com/maps/api/geocode/json?key=[google key]&address=" . urlencode($row['tempat']);
    $json = file_get_contents($url);
    $data = json_decode($json);
    $lat = $data->results[0]->geometry->location->lat;
    $lng = $data->results[0]->geometry->location->lng;
    list($method, $year, $latitude, $longitude, $timeZone) = array(5, $today['year'], $lat, $lng, 8);
    $prayTime = new PrayTime($method);
    $date = strtotime($year . '-' . $today['mon'] . '-' . $today['mday']);
    $endDate = strtotime($year . '-' . $today['mon'] . '-' . ($today['mday'] + 1));
    echo "<figure class=\"effect-oscar  wowload fadeInUp\">";
    echo "<img src=\"images/portfolio/" . $count . ".jpg\" alt=\"img01\"/>";
    echo "<figcaption>";
    echo "<h2>" . $row['tempat'] . "</h2>";
    while ($date < $endDate) {
        $times = $prayTime->getPrayerTimes($date, $latitude, $longitude, $timeZone);
        $day = date('M d', $date);
        echo "<p>Fajr - " . $times[0] . "<br>Sunrise - " . $times[1] . "<br>Dhuhr - " . $times[2] . "<br>Asr - " . $times[3] . "<br>Sunset - " . $times[4] . "<br>Maghrib - " . $times[5] . "<br>Isha - " . $times[6] . "</p>";
        $date += 24 * 60 * 60;
        // next day
    }
    echo "</figcaption>";
    echo "</figure>";
Ejemplo n.º 3
0
define("FLICKR_KEY", "GETYOUROWNKEY");
// GET YOUR OWN KEY
include 'PrayTime.php';
error_reporting(0);
$lat = $_GET['lat'];
$long = $_GET['long'];
$units = $_GET['units'];
$tzone = $_GET['tzone'];
if ($lat == '' || $long == '' || $units == '') {
    $lat = "50.72471";
    $long = "-3.50782";
    $units = "c";
    $tzone = 5;
}
$prayTime = new PrayTime();
$prayTime->setCalcMethod($prayTime->Karachi);
$prayTime->setAsrMethod($prayTime->Hanafi);
$times = $prayTime->getPrayerTimes(time(), $lat, $long, $tzone);
$fajr = (int) str_replace(':', '', $times[0]);
$sunrise = (int) str_replace(':', '', $times[1]);
$dhuhur = (int) str_replace(':', '', $times[2]);
$asr = (int) str_replace(':', '', $times[3]);
$sunset = (int) str_replace(':', '', $times[4]);
$maghrib = (int) str_replace(':', '', $times[5]);
$isha = (int) str_replace(':', '', $times[6]);
$prayers = $times;
$flickrResponse = get_data('https://api.flickr.com/services/rest/?method=flickr.places.findByLatLon&format=json&api_key=' . FLICKR_KEY . '&lat=' . $lat . '&lon=' . $long);
$flickrResponse = json_decode(substr($flickrResponse, 14, strlen($flickrResponse) - 15), true);
$woeid = $flickrResponse['places']['place'][0]['woeid'];
$woename = $flickrResponse['places']['place'][0]['woe_name'];
Ejemplo n.º 4
0
    {
        return $d * M_PI / 180.0;
    }
    // radian to degree
    function rtd($r)
    {
        return $r * 180.0 / M_PI;
    }
    // range reduce angle in degrees.
    function fixangle($a)
    {
        $a = $a - 360.0 * floor($a / 360.0);
        $a = $a < 0 ? $a + 360.0 : $a;
        return $a;
    }
    // range reduce hours to 0..23
    function fixhour($a)
    {
        $a = $a - 24.0 * floor($a / 24.0);
        $a = $a < 0 ? $a + 24.0 : $a;
        return $a;
    }
}
//---------------------- prayTime Object -----------------------
parse_str(implode('&', array_slice($argv, 1)), $_GET);
$prayTime = new PrayTime($_GET['calc_method']);
// $prayTime->setCalcMethod ($_GET['calc_method']);
$prayTime->setAsrMethod($_GET['asr_method']);
echo implode(",", $prayTime->timeNames);
echo "\n";
echo implode(",", $prayTime->getPrayerTimes(time(), $_GET['lat'], $_GET['lon'], $_GET['tz']));