From be0f25c330a3b054b46978f278eacaac8afea89f Mon Sep 17 00:00:00 2001 From: Markus Unterkofler <157289+munterkofler@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:59:44 +0200 Subject: [PATCH 1/6] Wordpress Plugin Readme --- wp-plugin/README.md | 43 +++++++++++++++++++ .../SrfWeatherWidgetApiClient.php | 2 +- wp-plugin/srf-weather-widget/meteo.php | 2 + 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/wp-plugin/README.md b/wp-plugin/README.md index e69de29..84d4f97 100644 --- a/wp-plugin/README.md +++ b/wp-plugin/README.md @@ -0,0 +1,43 @@ +## Wordpress Plugin for SRF Weather Widget + +### Installation + +tbd + +### Shortcode usage + +The following shortcode can be added to a post's content or in the theme of your blog at your prefered position (e.g. sidebar). Just click on the Plus-Button, choose "shortcode" and enter the widget's shortcode like below. + +Most simple variant. Uses position set in wordpress settings, size s, displays next hours: +```html +[meteo] +``` + +Same as above, but set a specific size: +```html +[meteo size="L"] +``` + +Medium size and with days instead of hours: +```html +[meteo size="M" mode="days"] +``` + +Small widget with Bern as position: +```html +[meteo geolocation="46.9471,7.4441"] +``` + +Or use Bern as position by its name: +```html +[meteo locationName="Bern"] +``` + +### Shortcode Attributes + +| Name | Attribute | Possible Values | Default | Required | +|---------------|---------------------| ------------------------ | ------------------------------------- | -------- | +| Size | size | S, M, L | S | No | +| Mode | mode | hours, three_hours, days | hours | No | +| Geolocation | geolocation | | 47.4171,8.5612 (Zürich Fernsehstudio) | No | +| Location Name | locationName | Zürich, Genf, MyLocation | | No | diff --git a/wp-plugin/srf-weather-widget/SrfWeatherWidgetApiClient.php b/wp-plugin/srf-weather-widget/SrfWeatherWidgetApiClient.php index 1b816d8..e1090f5 100644 --- a/wp-plugin/srf-weather-widget/SrfWeatherWidgetApiClient.php +++ b/wp-plugin/srf-weather-widget/SrfWeatherWidgetApiClient.php @@ -63,6 +63,6 @@ public static function getForecastData($geolocationId, $accessToken) set_transient('srf_weather_forecastpoint_' . $cacheKey, $response, self::CACHE_TTL); } - return wp_remote_retrieve_body($response); + return wp_remote_retrieve_body($response); } } diff --git a/wp-plugin/srf-weather-widget/meteo.php b/wp-plugin/srf-weather-widget/meteo.php index 1a722c5..d760c90 100644 --- a/wp-plugin/srf-weather-widget/meteo.php +++ b/wp-plugin/srf-weather-widget/meteo.php @@ -3,6 +3,8 @@ * @package SRF Weather Widget * * Plugin Name: SRF Weather Widget + * Plugin URI: https://mmz-srf.github.io/srf-weather-widget/ + * Description: Add SRF Weather Widget to your posts or theme. */ require_once __DIR__ . '/SrfWeatherWidgetSettings.php'; From 55f7a13b8ca75be0aaacd435bc6f03e418eaa91e Mon Sep 17 00:00:00 2001 From: rothfahl Date: Tue, 3 Oct 2023 16:16:00 +0200 Subject: [PATCH 2/6] add gh action to zip wp-plugin --- .github/workflows/zip-wp-plugin.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/zip-wp-plugin.yml diff --git a/.github/workflows/zip-wp-plugin.yml b/.github/workflows/zip-wp-plugin.yml new file mode 100644 index 0000000..20e8aa4 --- /dev/null +++ b/.github/workflows/zip-wp-plugin.yml @@ -0,0 +1,20 @@ +name: Create wp-plugin zip +on: + push: + branches: ["main"] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Archive Release + uses: thedoctor0/zip-release@0.7.1 + with: + type: 'zip' + filename: 'wp-srf-weather-widget.zip' + directory: ./wp-plugin + - name: Upload Release + uses: ncipollo/release-action@v1.12.0 + with: + artifacts: 'wp-srf-weather-widget.zip' + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From c0b5338dc7d4b38b279127da49720bb46d5670d4 Mon Sep 17 00:00:00 2001 From: rothfahl Date: Tue, 3 Oct 2023 16:19:43 +0200 Subject: [PATCH 3/6] remove release step --- .github/workflows/zip-wp-plugin.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/zip-wp-plugin.yml b/.github/workflows/zip-wp-plugin.yml index 20e8aa4..88f9c6c 100644 --- a/.github/workflows/zip-wp-plugin.yml +++ b/.github/workflows/zip-wp-plugin.yml @@ -13,8 +13,3 @@ jobs: type: 'zip' filename: 'wp-srf-weather-widget.zip' directory: ./wp-plugin - - name: Upload Release - uses: ncipollo/release-action@v1.12.0 - with: - artifacts: 'wp-srf-weather-widget.zip' - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 1aa54aa26a441ae88411eafc6053254c7007e104 Mon Sep 17 00:00:00 2001 From: rothfahl Date: Tue, 3 Oct 2023 16:27:38 +0200 Subject: [PATCH 4/6] upload zip artefact --- .github/workflows/zip-wp-plugin.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/zip-wp-plugin.yml b/.github/workflows/zip-wp-plugin.yml index 88f9c6c..b57449e 100644 --- a/.github/workflows/zip-wp-plugin.yml +++ b/.github/workflows/zip-wp-plugin.yml @@ -6,10 +6,18 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Archive Release + - name: Checkout + uses: actions/checkout@v4 + + - name: Create zip archive uses: thedoctor0/zip-release@0.7.1 with: type: 'zip' filename: 'wp-srf-weather-widget.zip' directory: ./wp-plugin + + - name: Upload zip + uses: actions/upload-artifact@v3 + with: + name: 'wp-srf-weather-widget.zip' + path: ./ From ee17233221e10a6604d69c73f109c20b8da673a3 Mon Sep 17 00:00:00 2001 From: rothfahl Date: Tue, 3 Oct 2023 16:31:25 +0200 Subject: [PATCH 5/6] zip ONLY wp-plugin --- .github/workflows/zip-wp-plugin.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/zip-wp-plugin.yml b/.github/workflows/zip-wp-plugin.yml index b57449e..e5e6ea9 100644 --- a/.github/workflows/zip-wp-plugin.yml +++ b/.github/workflows/zip-wp-plugin.yml @@ -13,11 +13,11 @@ jobs: uses: thedoctor0/zip-release@0.7.1 with: type: 'zip' - filename: 'wp-srf-weather-widget.zip' - directory: ./wp-plugin + filename: "wp-srf-weather-widget.zip" + path: "./wp-plugin" - name: Upload zip uses: actions/upload-artifact@v3 with: name: 'wp-srf-weather-widget.zip' - path: ./ + path: '/wp-plugin/wp-srf-weather-widget.zip' From 531ef3b80669f5bf1e1e578593a7d86f51b08b25 Mon Sep 17 00:00:00 2001 From: rothfahl Date: Tue, 3 Oct 2023 16:32:21 +0200 Subject: [PATCH 6/6] zip artefact: fix path --- .github/workflows/zip-wp-plugin.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/zip-wp-plugin.yml b/.github/workflows/zip-wp-plugin.yml index e5e6ea9..98b658a 100644 --- a/.github/workflows/zip-wp-plugin.yml +++ b/.github/workflows/zip-wp-plugin.yml @@ -14,10 +14,11 @@ jobs: with: type: 'zip' filename: "wp-srf-weather-widget.zip" - path: "./wp-plugin" + directory: "./wp-plugin" + path: "./srf-weather-widget" - name: Upload zip uses: actions/upload-artifact@v3 with: - name: 'wp-srf-weather-widget.zip' - path: '/wp-plugin/wp-srf-weather-widget.zip' + name: 'wp-srf-weather-widget' + path: './wp-plugin/wp-srf-weather-widget.zip'