Skip to content

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
richardkorthuis authored and Mike van den Hoek committed Apr 29, 2024
1 parent 9f9b481 commit c20dfe4
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v3.5.0

- Feat: Add districts with zipcodes, so the REST API can be filtered using a zipcode.

## v3.4.4

- Refactor: CMB2 'show on' taxonomy field type from 'select_advanced' to 'taxonomy_multicheck'
Expand Down
Binary file modified languages/openpub-base-nl_NL.mo
Binary file not shown.
30 changes: 30 additions & 0 deletions languages/openpub-base-nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,26 @@ msgstr "Vrij notitieveld"
msgid "(the law, authority, local regulations, etc.)"
msgstr "(wetgeving, bevoegd gezag, uitvoerder, lokale regelgeving)"

#: config/metaboxes.php:133 config/metaboxes.php:143
msgid "Zipcodes"
msgstr "Postcodes"

#: config/metaboxes.php:149
msgid "Add new zipcode"
msgstr "Voeg nieuwe postcode toe"

#: config/metaboxes.php:150
msgid "Remove zipcode"
msgstr "Verwijder postcode"

#: config/metaboxes.php:155
msgid "Zipcode"
msgstr "Postcode"

#: config/metaboxes.php:156
msgid "A zipcode that is part of this district. (Only numbers, no letters)"
msgstr "Een postcode die bij deze wijk hoort. (Alleen cijfer, geen letters)"

#: config/p2p_connections.php:9
msgid "Connected item(s)"
msgstr "Gekoppelde item(s)"
Expand Down Expand Up @@ -514,6 +534,16 @@ msgctxt "Taxonomy definition"
msgid "Usages"
msgstr "Toepassingen"

#: config/taxonomies.php:73
msgctxt "Taxonomy definition"
msgid "District"
msgstr "Wijk"

#: config/taxonomies.php:73
msgctxt "Taxonomy definition"
msgid "Districts"
msgstr "Wijken"

#: src/Base/Foundation/DependencyChecker.php:62
msgid "The following plugins are required to use the OpenPub:"
msgstr "De volgende plugins zijn vereist om gebruik te maken van de OpenPub:"
Expand Down
30 changes: 30 additions & 0 deletions languages/openpub-base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,26 @@ msgstr "
msgid "(the law, authority, local regulations, etc.)"
msgstr ""

#: config/metaboxes.php:133 config/metaboxes.php:143
msgid "Zipcodes"
msgstr ""

#: config/metaboxes.php:149
msgid "Add new zipcode"
msgstr ""

#: config/metaboxes.php:150
msgid "Remove zipcode"
msgstr ""

#: config/metaboxes.php:155
msgid "Zipcode"
msgstr ""

#: config/metaboxes.php:156
msgid "A zipcode that is part of this district. (Only numbers, no letters)"
msgstr ""

#: config/p2p_connections.php:9
msgctxt "P2P titel"
msgid "Connected item(s)"
Expand Down Expand Up @@ -422,6 +442,16 @@ msgctxt "Taxonomy definition"
msgid "Usages"
msgstr ""

#: config/taxonomies.php:73
msgctxt "Taxonomy definition"
msgid "District"
msgstr ""

#: config/taxonomies.php:73
msgctxt "Taxonomy definition"
msgid "Districts"
msgstr ""

#: src/Base/Foundation/DependencyChecker.php:62
msgid "The following plugins are required to use the OpenPub:"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion openpub-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Yard | OpenPub Base
* Plugin URI: https://www.openwebconcept.nl/
* Description: Acts as foundation for other OpenPub related content plugins. This plugin implements actions to allow for other plugins to add and/or change Custom Posttypes, Metaboxes, Taxonomies, en Posts 2 posts relations.
* Version: 3.4.4
* Version: 3.5
* Author: Yard | Digital Agency
* Author URI: https://www.yard.nl/
* License: GPL-3.0
Expand Down
2 changes: 1 addition & 1 deletion src/Base/Foundation/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Plugin
* Version of the plugin.
* Used for setting versions of enqueue scripts and styles.
*/
public const VERSION = '3.4.4';
public const VERSION = '3.5';

/**
* Path to the root of the plugin.
Expand Down
14 changes: 8 additions & 6 deletions src/Base/Metabox/MetaboxServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,19 @@ protected function getShowOnMetabox(array $configMetaboxes): array
* Save group unserialized so it can be used in the search query.
*
* @param int $termId The current term ID.
*
* @return void
*/
public function saveGroupUnserialized(int $termId): void
{
delete_term_meta($termId, self::PREFIX . 'openpub_zipcode');

$zipcodes = get_term_meta($termId, self::PREFIX . 'openpub_zipcodes_group');
if ($zipcodes) {
foreach ( $zipcodes[0] as $zipcode ) {
add_term_meta( $termId, self::PREFIX . 'openpub_zipcode', $zipcode['openpub_zipcode'] );
}

if (! $zipcodes || empty($zipcodes[0])) {
return;
}

foreach ( $zipcodes[0] as $zipcode ) {
add_term_meta( $termId, self::PREFIX . 'openpub_zipcode', $zipcode['openpub_zipcode'] );
}
}
}
21 changes: 9 additions & 12 deletions src/Base/Repositories/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,15 @@ public static function addZipcodeParameter(string $zipcode): array
$sql = "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key = '_owc_openpub_zipcode' AND meta_value = %s";
$results = $wpdb->get_col($wpdb->prepare($sql, (int)$zipcode));

if ($results) {
return [
'tax_query' => [
[
'taxonomy' => 'openpub-district',
'terms' => $results,
'field' => 'term_id',
'operator' => 'IN'
]
return [
'tax_query' => [
[
'taxonomy' => 'openpub-district',
'terms' => $results,
'field' => 'term_id',
'operator' => 'IN'
]
];
}
return [];
]
];
}
}

0 comments on commit c20dfe4

Please sign in to comment.