Changeset 2130839
- Timestamp:
- 07/30/2019 01:51:59 PM (7 years ago)
- Location:
- calj/trunk
- Files:
-
- 2 edited
-
CalJPlugin.php (modified) (4 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
calj/trunk/CalJPlugin.php
r1559123 r2130839 28 28 { 29 29 $decodedAttr = shortcode_atts( array( 30 'val' => '' 30 'val' => '', 31 'lang' => '', 32 'city' => '' 31 33 ), $atts ); 32 34 … … 72 74 if (isset($json['success']) && $json['success']) { 73 75 76 $city = $decodedAttr['city']; 77 $lang = $decodedAttr['lang']; 78 74 79 // dot notation to access the json properties 75 80 $jsonPath = preg_split('#\.#', $decodedAttr['val']); … … 77 82 for($i = 0; $i < count($jsonPath); ++ $i) { 78 83 $component = $jsonPath[$i]; 79 if (array_key_exists($component, $jsonCursor)) { 84 85 // If the component name exists with a 'Loc' suffix, 86 // treat it as an array of language codes 87 if ($lang && 88 array_key_exists($component.'Loc', $jsonCursor) && 89 is_array($jsonCursor[$component.'Loc']) && 90 array_key_exists($lang, $jsonCursor[$component.'Loc']) 91 ) { 92 $jsonCursor = $jsonCursor[$component.'Loc'][$lang]; 93 } 94 95 else if (array_key_exists($component, $jsonCursor)) { 80 96 $jsonCursor = $jsonCursor[$component]; 81 97 } … … 109 125 $key = $options['api_key']; 110 126 $city = $options['city']; 111 $response = file_get_contents('http ://api.calj.net/wp/1/shabbat.json?city='.$city.'&key='.$key);127 $response = file_get_contents('https://api.calj.net/wp/1/shabbat.json?city='.$city.'&key='.$key); 112 128 113 129 $response = json_decode($response, true); -
calj/trunk/readme.txt
r2127860 r2130839 5 5 Requires at least: 4 6 6 Tested up to: 5.2.2 7 Stable tag: 1. 1.17 Stable tag: 1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 21 21 1. Activate the plugin through the 'Plugins' screen in WordPress 22 22 1. Use the Settings->CalJ screen to configure the plugin 23 1. Register for a n API key on http://www.calj.net/api23 1. Register for a free API key for your current WordPress instance inside the Settings Form 24 24 25 25 … … 37 37 38 38 Prints the name of the current week's Parasha. 39 40 * `[caljshabbat val="shabbat.parasha" lang="he"]` 41 42 Prints the name of the current week's Parasha in Hebrew. 39 43 40 44 * `[caljshabbat val="shabbat.begins"]` … … 66 70 Prints the name of the Jewish month of Shabbat. 67 71 72 * `[caljshabbat val="shabbat.jmonthName" lang="ru"]` 73 74 Prints the name of the Jewish month of Shabbat in Russian. 75 68 76 * `[caljshabbat val="shabbat.jyear"]` 69 77 … … 82 90 == Changelog == 83 91 92 = 1.2 = 93 Support for additional languages. 94 84 95 = 1.1 = 85 96 Added Daf Yomi.
Note: See TracChangeset
for help on using the changeset viewer.