Plugin Directory

Changeset 2481913


Ignore:
Timestamp:
02/26/2021 01:53:53 AM (5 years ago)
Author:
areimann
Message:

You can now specify longitude and latitude not just Zip code

Location:
weekly-shabbat-times/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • weekly-shabbat-times/trunk/hebcal-json.php

    r1933365 r2481913  
    44 * Plugin URI: http://aaronreimann.com
    55 * Description: Grabs JSON string from hebcal.com and enables shortcodes display the information dynamically
    6  * Version: 1.0.0
     6 * Version: 1.1.0
    77 * Author: areimann, jfennell
    88 */
     
    2222    }
    2323
    24     static function fetch( $zip ) {
     24    static function fetch( $zip, $longitude, $latitude, $tzid ) {
    2525        $json_obj = get_transient( 'hebcal_json' );
    2626        if ( ! $json_obj ) {
    2727
    28             $url = 'http://www.hebcal.com/shabbat/?cfg=json&zip=' . $zip;
     28            if ( $zip != NULL ) {
     29                $url = 'https://www.hebcal.com/shabbat/?cfg=json&zip=' . $zip;
     30            } else {
     31                $url = 'https://www.hebcal.com/shabbat/?cfg=json&geo=pos&longitude=' . $longitude . '&latitude=' . $latitude . '&tzid=' .$tzid;
     32            }
    2933
    3034            $json_string = file_get_contents( $url );
     
    4246            'param'    => 'title',
    4347            'category' => 'parashat',
    44             'zip'      => '10001' // Zip in New York as default
     48            'zip'      => '',
     49            'longitude' => '',
     50            'latitude' => '',
     51            'tzid' => ''
    4552        ), $atts );
    4653
    47         $json_obj = self::fetch( $atts['zip'] );
     54        $json_obj = self::fetch( $atts['zip'], $atts['longitude'], $atts['latitude'], $atts['tzid'] );
     55
    4856
    4957        $string = '';
  • weekly-shabbat-times/trunk/readme.txt

    r1933365 r2481913  
    22Contributors: areimann, jfennell
    33Donate link: http://aaronreimann.com
    4 Tags:
     4Tags: Shabbat
    55Requires at least: 4.7
    6 Tested up to: 4.9.8
    7 Stable 1.0.0
     6Tested up to: 5.6.2
     7Stable 1.1.0
    88Stable tag: trunk
    99License: GPLv2 or later
     
    2323
    2424= What does it do? =
     25
     26It simple gives a few shortcodes to display the Shabbat lighting times. Watch the video to see what it does:
    2527[youtube https://www.youtube.com/watch?v=ztzHENB9g7Y]
    2628
     
    3133= How do I use it? =
    3234
    33 Example shortcodes:
     35Example shortcodes using Zip Code:
    3436
    3537[hebcal_sc category="parashat" param="title" zip="30066"]
     
    3941[hebcal_sc category="candles" param="title" zip="30066"]
    4042[hebcal_sc category="candles" param="hebrew" zip="30066"]
     43
     44Example shortcode using Longitude, Latitude, and Time Zone ID:
     45
     46[hebcal_sc category="candles" param="title" longitude="-84.500434" latitude="34.024356" tzid="America/New_York"]
     47
     48You can get a list of timezone ID's by going to [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones]https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
     49
    4150
    4251= Possible categories from the feed =
     
    5362== Changelog ==
    5463
     64= 1.1.0 =
     65* Adds longitude and latitude to the shortcode so you can drop in your longitude, latitude, and timezone ID.
     66
    5567= 1.0.0 =
    5668* Initial release
Note: See TracChangeset for help on using the changeset viewer.