1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

10 Commits

9 changed files with 1650 additions and 2005 deletions

3586
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "connector-mobilizon",
"version": "1.2.0",
"version": "1.3.0",
"description": "Display Mobilizon events in WordPress.",
"private": true,
"type": "module",
@ -28,28 +28,28 @@
"luxon": "3.5.0"
},
"devDependencies": {
"@babel/core": "7.25.2",
"@babel/eslint-parser": "7.25.1",
"@babel/preset-env": "7.25.3",
"@babel/preset-react": "7.24.7",
"@wordpress/eslint-plugin": "20.1.0",
"ava": "6.1.3",
"babel-loader": "9.1.3",
"@babel/core": "7.26.0",
"@babel/eslint-parser": "7.25.9",
"@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.25.9",
"@wordpress/eslint-plugin": "21.4.0",
"ava": "6.2.0",
"babel-loader": "9.2.1",
"browser-env": "3.3.0",
"c8": "10.1.2",
"copy-webpack-plugin": "12.0.2",
"eslint": "8.57.0",
"eslint-plugin-ava": "14.0.0",
"eslint-plugin-jsx": "0.1.0",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react": "7.37.2",
"esm": "3.2.25",
"gulp": "5.0.0",
"gulp-replace": "1.1.4",
"husky": "9.1.4",
"lint-staged": "15.2.8",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"prettier": "3.3.3",
"rimraf": "5.0.10",
"webpack": "5.93.0",
"webpack": "5.96.1",
"webpack-cli": "5.1.4"
},
"ava": {
@ -61,7 +61,7 @@
"niceName": "Connector for Mobilizon",
"phpMinimumVersion": 7.4,
"wordpressMinimumVersion": 5.6,
"wordpressTestedUpToVersion": "6.6"
"wordpressTestedUpToVersion": "6.7"
},
"lint-staged": {
"source/**/*.js": "eslint",

View File

@ -6,6 +6,18 @@
#### Fixed
#### Security
### [1.3.0]
#### Added
- Comment for translators what placeholder will contain
#### Changed
- Confirm compatibility with WordPress 6.7
- Load block script only in footer to reduce waiting time
- Update dependencies
#### Fixed
- Mark event-related data as non-translatable within plugin
- Add version number to script registration to break browser caching
- Handle location being null
### [1.2.0]
#### Added
- Display event picture if available

View File

@ -10,7 +10,7 @@ class EventsListBlock {
'wp-blocks',
'wp-components',
'wp-i18n'
]);
], '<wordpress-version>', array('in_footer' => true));
register_block_type(NAME . '/events-list', [
'api_version' => 2,
'title' => __('Events List', 'connector-mobilizon'),

View File

@ -26,7 +26,7 @@ final class Formatter
return $dateText;
}
public static function format_location(string $description, string $locality): string {
public static function format_location(string $description, ?string $locality): string {
$location = '';
if ($description && trim($description)) {
$location .= trim($description);

View File

@ -43,6 +43,18 @@ You have to use their username, e.g. `@nosliensvivants`, and append the name of
## Changelog
### [1.3.0]
#### Added
- Comment for translators what placeholder will contain
#### Changed
- Confirm compatibility with WordPress 6.7
- Load block script only in footer to reduce waiting time
- Update dependencies
#### Fixed
- Mark event-related data as non-translatable within plugin
- Add version number to script registration to break browser caching
- Handle location being null
### [1.2.0]
#### Added
- Display event picture if available

View File

@ -7,5 +7,8 @@ if (!defined('ABSPATH')) {
}
?>
<div class="<?php echo esc_attr($classNamePrefix); ?>_events-list">
<?php echo esc_html(sprintf(__('The group "%s" could not be found!', 'connector-mobilizon'), $groupName)); ?>
<?php
/* translators: %s is replaced with the name of the group. */
echo esc_html(sprintf(__('The group "%s" could not be found!', 'connector-mobilizon'), $groupName));
?>
</div>

View File

@ -13,12 +13,12 @@ if (!defined('ABSPATH')) {
<?php if (isset($event['picture'])) { ?>
<img alt="<?php echo esc_attr($event['picture']['alt']); ?>" src="<?php echo esc_attr($event['picture']['base64']); ?>" style="display: block; max-width: 100%;">
<?php } ?>
<a href="<?php echo esc_attr($event['url']); ?>"><?php echo esc_html_e($event['title']); ?></a>
<a href="<?php echo esc_attr($event['url']); ?>"><?php echo esc_html($event['title']); ?></a>
<br>
<?php echo esc_html_e(Formatter::format_date($locale, $timeZone, $event['beginsOn'], $event['endsOn'], $isShortOffsetNameShown)); ?>
<?php echo esc_html(Formatter::format_date($locale, $timeZone, $event['beginsOn'], $event['endsOn'], $isShortOffsetNameShown)); ?>
<?php if (isset($event['physicalAddress'])) { ?>
<br>
<?php echo esc_html_e(Formatter::format_location($event['physicalAddress']['description'], $event['physicalAddress']['locality'])) ?>
<?php echo esc_html(Formatter::format_location($event['physicalAddress']['description'], $event['physicalAddress']['locality'])) ?>
<?php } ?>
</li>
<?php } ?>

View File

@ -42,6 +42,10 @@ final class FormatterTest extends PHPUnit\Framework\TestCase
$this->assertSame('a', Formatter::format_location('a', ''));
}
public function testLocationFormatDescriptionOnlyWithNull(): void {
$this->assertSame('a', Formatter::format_location('a', null));
}
public function testLocationFormatDescriptionWithSpaceOnly(): void {
$this->assertSame('', Formatter::format_location(' ', ''));
}