From 8aeceee0eb359b0bc16caddbc51657d8a6368324 Mon Sep 17 00:00:00 2001 From: JayWll Date: Sat, 16 May 2020 12:03:00 -0600 Subject: [PATCH] Creatinging initial version of weather plugin --- .gitignore | 3 ++ .../calgaryconditions/Plugin.php | 28 +++++++++++++++++++ .../components/CurrentInfo.php | 23 +++++++++++++++ .../components/currentinfo/default.htm | 3 ++ .../calgaryconditions/lang/en-ca/lang.php | 6 ++++ .../calgaryconditions/plugin.yaml | 6 ++++ .../calgaryconditions/updates/version.yaml | 1 + 7 files changed, 70 insertions(+) create mode 100644 www/plugins/jasonwilliams/calgaryconditions/Plugin.php create mode 100644 www/plugins/jasonwilliams/calgaryconditions/components/CurrentInfo.php create mode 100644 www/plugins/jasonwilliams/calgaryconditions/components/currentinfo/default.htm create mode 100644 www/plugins/jasonwilliams/calgaryconditions/lang/en-ca/lang.php create mode 100644 www/plugins/jasonwilliams/calgaryconditions/plugin.yaml create mode 100644 www/plugins/jasonwilliams/calgaryconditions/updates/version.yaml diff --git a/.gitignore b/.gitignore index 9e6463f..b7ddfd8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ # Include the custom theme !/www/themes/jason-williamsca/** + +# Include custom plugins +!/www/plugins/jasonwilliams/** diff --git a/www/plugins/jasonwilliams/calgaryconditions/Plugin.php b/www/plugins/jasonwilliams/calgaryconditions/Plugin.php new file mode 100644 index 0000000..b67812e --- /dev/null +++ b/www/plugins/jasonwilliams/calgaryconditions/Plugin.php @@ -0,0 +1,28 @@ + 'Calgary Conditions', + 'description' => 'Provides local time and weather information for Calgary, AB, Canada', + 'author' => 'Jason Williams', + 'icon' => 'oc-icon-cloud' + ]; + } + + public function registerComponents() + { + return [ + '\JasonWilliams\CalgaryConditions\Components\CurrentInfo' => 'CurrentInfo' + ]; + } +} diff --git a/www/plugins/jasonwilliams/calgaryconditions/components/CurrentInfo.php b/www/plugins/jasonwilliams/calgaryconditions/components/CurrentInfo.php new file mode 100644 index 0000000..51882d3 --- /dev/null +++ b/www/plugins/jasonwilliams/calgaryconditions/components/CurrentInfo.php @@ -0,0 +1,23 @@ + 'Current Info', + 'description' => 'Displays the current weather and time in Calgary, AB, Canada' + ]; + } + + public function onRun() + { + date_default_timezone_set('America/Edmonton'); + $this->fields['time'] = date('g:ia'); + } +} diff --git a/www/plugins/jasonwilliams/calgaryconditions/components/currentinfo/default.htm b/www/plugins/jasonwilliams/calgaryconditions/components/currentinfo/default.htm new file mode 100644 index 0000000..70c8283 --- /dev/null +++ b/www/plugins/jasonwilliams/calgaryconditions/components/currentinfo/default.htm @@ -0,0 +1,3 @@ +{% set conditions = __SELF__.fields %} + +

Right now in Calgary the time is {{ conditions.time }}

diff --git a/www/plugins/jasonwilliams/calgaryconditions/lang/en-ca/lang.php b/www/plugins/jasonwilliams/calgaryconditions/lang/en-ca/lang.php new file mode 100644 index 0000000..4b89674 --- /dev/null +++ b/www/plugins/jasonwilliams/calgaryconditions/lang/en-ca/lang.php @@ -0,0 +1,6 @@ + [ + 'name' => 'Calgary Conditions', + 'description' => 'Provides local time and weather information for Calgary, AB, Canada' + ] +]; diff --git a/www/plugins/jasonwilliams/calgaryconditions/plugin.yaml b/www/plugins/jasonwilliams/calgaryconditions/plugin.yaml new file mode 100644 index 0000000..ced5a83 --- /dev/null +++ b/www/plugins/jasonwilliams/calgaryconditions/plugin.yaml @@ -0,0 +1,6 @@ +plugin: + name: 'jasonwilliams.calgaryconditions::lang.plugin.name' + description: 'jasonwilliams.calgaryconditions::lang.plugin.description' + author: 'Jason Williams' + icon: oc-icon-cloud + homepage: 'https://ja.son-williams.ca/' diff --git a/www/plugins/jasonwilliams/calgaryconditions/updates/version.yaml b/www/plugins/jasonwilliams/calgaryconditions/updates/version.yaml new file mode 100644 index 0000000..13703f5 --- /dev/null +++ b/www/plugins/jasonwilliams/calgaryconditions/updates/version.yaml @@ -0,0 +1 @@ +0.0.1: Initial version