From 9f22c6f4a78cd9b254945853d062b2f51061496e Mon Sep 17 00:00:00 2001
From: Thorsten <88725484+IMC-GER@users.noreply.github.com>
Date: Mon, 26 Dec 2022 18:02:49 +0100
Subject: [PATCH] v1.1.0
---
README.md | 6 ++
curlyquotes_version.json | 4 +-
imcger/curlyquotes/README.md | 6 ++
imcger/curlyquotes/composer.json | 4 +-
imcger/curlyquotes/core/fixer.php | 56 +++++++++++--------
imcger/curlyquotes/event/main_listener.php | 6 +-
imcger/curlyquotes/ext.php | 46 ++++++++++-----
.../language/de/info_acp_curlyquotes.php | 4 +-
.../de_x_sie/info_acp_curlyquotes.php | 4 +-
.../language/en/info_acp_curlyquotes.php | 4 +-
10 files changed, 90 insertions(+), 50 deletions(-)
diff --git a/README.md b/README.md
index 927d9ef..63433e6 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,12 @@ Go to "ACP" > "Extension" > "Curly Quotes Settings" and set the quote style for
## Changelog
+### v1.1.0 (26-12-2022)
+- Added suport for coordinates and length specifications ft./in.
+- Added replace quotes in preview
+- Changed PHP max to v8.2
+- Update check system requirement
+
### v1.0.3 (02-10-2022)
- Fixed don't show attachment in post
diff --git a/curlyquotes_version.json b/curlyquotes_version.json
index a8ba527..1b59489 100644
--- a/curlyquotes_version.json
+++ b/curlyquotes_version.json
@@ -1,7 +1,7 @@
{
"stable": {
- "1.0": {
- "current": "1.0.3",
+ "1.1": {
+ "current": "1.1.0",
"announcement": "https://www.phpbb.de/community/viewtopic.php?t=246397",
"download": "https://github.com/IMC-GER/phpBB-Curly-Quotes/tags",
"eol": null,
diff --git a/imcger/curlyquotes/README.md b/imcger/curlyquotes/README.md
index 927d9ef..63433e6 100644
--- a/imcger/curlyquotes/README.md
+++ b/imcger/curlyquotes/README.md
@@ -25,6 +25,12 @@ Go to "ACP" > "Extension" > "Curly Quotes Settings" and set the quote style for
## Changelog
+### v1.1.0 (26-12-2022)
+- Added suport for coordinates and length specifications ft./in.
+- Added replace quotes in preview
+- Changed PHP max to v8.2
+- Update check system requirement
+
### v1.0.3 (02-10-2022)
- Fixed don't show attachment in post
diff --git a/imcger/curlyquotes/composer.json b/imcger/curlyquotes/composer.json
index 4faedfe..f9ad734 100644
--- a/imcger/curlyquotes/composer.json
+++ b/imcger/curlyquotes/composer.json
@@ -3,8 +3,8 @@
"type": "phpbb-extension",
"description": "Replaces quotation marks with curly quotes.",
"homepage": "https://github.com/IMC-GER/phpBB-Curly-Quotes",
- "version": "1.0.3",
- "time": "2022-10-02",
+ "version": "1.1.0",
+ "time": "2022-12-26",
"license": "GPL-2.0-only",
"authors": [{
"name": "Thorsten Ahlers",
diff --git a/imcger/curlyquotes/core/fixer.php b/imcger/curlyquotes/core/fixer.php
index da52492..0f7607c 100644
--- a/imcger/curlyquotes/core/fixer.php
+++ b/imcger/curlyquotes/core/fixer.php
@@ -6,6 +6,8 @@
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license.
*
+ * Copyright (c) 2022, Customizations for phpBB by Thorsten Ahlers
+ *
* https://en.wikipedia.org/wiki/Quotation_mark
* https://www.virtualsystem.de/browsersprachen/
*/
@@ -21,26 +23,26 @@ class fixer
public const ALL_SPACES = "\xE2\x80\xAF|\xC2\xAD|\xC2\xA0|\\s"; // All supported spaces, used in regexps. Better than \s
public const NO_BREAK_THIN_SPACE = "\xE2\x80\xAF"; //
public const NO_BREAK_SPACE = "\xC2\xA0"; //
- public const SHY = "\xC2\xAD"; //
- public const ELLIPSIS = '…'; // …
- public const LDQUO = '“'; // “ or “
- public const RDQUO = '”'; // ” or ”
- public const BDQUO = '„'; // „ or „
- public const LSQUO = '‘'; // ‘
- public const RSQUO = '’'; // ’
- public const SBQUO = '‚'; // ‚
- public const LAQUO = '«'; // «
- public const RAQUO = '»'; // »
- public const LSAQUO = '‹'; // ‹
- public const RSAQUO = '›'; // ›
- public const PRIME = '″'; // ″
- public const SPRIME = '′'; // ′
- public const TIMES = '×'; // ×
- public const NDASH = '–'; // – or –
- public const MDASH = '—'; // — or —
- public const TRADE = '™'; // ™
- public const REG = '®'; // ®
- public const COPY = '©'; // ©
+ public const SHY = "\xC2\xAD"; //
+ public const ELLIPSIS = '…'; // …
+ public const LDQUO = '“'; // “ or “
+ public const RDQUO = '”'; // ” or ”
+ public const BDQUO = '„'; // „ or „
+ public const LSQUO = '‘'; // ‘
+ public const RSQUO = '’'; // ’
+ public const SBQUO = '‚'; // ‚
+ public const LAQUO = '«'; // «
+ public const RAQUO = '»'; // »
+ public const LSAQUO = '‹'; // ‹
+ public const RSAQUO = '›'; // ›
+ public const PRIME = '″'; // ″
+ public const SPRIME = '′'; // ′
+ public const TIMES = '×'; // ×
+ public const NDASH = '–'; // – or –
+ public const MDASH = '—'; // — or —
+ public const TRADE = '™'; // ™
+ public const REG = '®'; // ®
+ public const COPY = '©'; // ©
protected $dopening;
protected $dclosing;
@@ -60,13 +62,19 @@ public function fix($content, $set_prime)
}
$pattern = [
- '@([a-z0-9])\'([a-z])@im', // Apostrophe
- '@(^|\s|\>|\()"([^"^\<]+)"@im', // Double Quotes
- '@(^|\s|\>|\()\'([^\'^\<]+)\'@im', // Single Quotes
- '@([^\d\s]+)[' . self::ALL_SPACES . ']*(,)[' . self::ALL_SPACES . ']*@mu', // No space before comma (,)
+ '@(\d+\°)[' . self::ALL_SPACES . ']{0,1}(\d+)\'[' . self::ALL_SPACES . ']{0,1}((\d{1,2})|(\d{1,2}[.,]\d+))"@im', // GPS Koordinaten ddd mm ss.ss
+ '@(\d+\°)[' . self::ALL_SPACES . ']{0,1}((\d{1,2})|(\d{1,2}[.,]\d+))\'@im', // GPS Koordinaten ddd mm.mmm
+ '@(\d+)\'[' . self::ALL_SPACES . ']{0,1}((\d{1,2})|(\d{1,2}[.,]\d+))"@im', // Dimension in inches
+ '@([a-z0-9])\'([a-z])@im', // Apostrophe
+ '@(^|\s|\>|\()"([^"^\<]+)"@im', // Double Quotes
+ '@(^|\s|\>|\()\'([^\'^\<]+)\'@im', // Single Quotes
+ '@([^\d\s]+)[' . self::ALL_SPACES . ']*(,)[' . self::ALL_SPACES . ']*@mu', // No space before comma (,)
];
$replacement = [
+ '$1' . self::NO_BREAK_THIN_SPACE . '$2' . self::SPRIME . self::NO_BREAK_THIN_SPACE . '$3' . self::PRIME,
+ '$1' . self::NO_BREAK_THIN_SPACE . '$2' . self::SPRIME,
+ '$1' . self::SPRIME . self::NO_BREAK_THIN_SPACE . '$2' . self::PRIME,
'$1' . self::RSQUO . '$2',
'$1' . $this->dopening . $this->dopeningSuffix . '$2' . $this->dclosingPrefix . $this->dclosing,
'$1' . $this->sopening . $this->sopeningSuffix . '$2' . $this->sclosingPrefix . $this->sclosing,
diff --git a/imcger/curlyquotes/event/main_listener.php b/imcger/curlyquotes/event/main_listener.php
index bf0ab4a..1afd49f 100644
--- a/imcger/curlyquotes/event/main_listener.php
+++ b/imcger/curlyquotes/event/main_listener.php
@@ -92,18 +92,20 @@ public function __construct
public static function getSubscribedEvents()
{
return [
- 'core.modify_text_for_display_before' => 'modify_text_for_display_before',
+ 'core.modify_text_for_display_before' => 'modify_text_for_display', // Fix in post
+ 'core.modify_format_display_text_before' => 'modify_text_for_display', // Fix in preview
];
}
/**
* Fix the quotes before display in post
+ * Fix the quotes before display in preview
*
* @param object $event The event object
* @return null
* @access public
*/
- public function modify_text_for_display_before($event)
+ public function modify_text_for_display($event)
{
$post_text = $event['text'];
diff --git a/imcger/curlyquotes/ext.php b/imcger/curlyquotes/ext.php
index 026a61f..542de61 100644
--- a/imcger/curlyquotes/ext.php
+++ b/imcger/curlyquotes/ext.php
@@ -16,37 +16,55 @@
*/
class ext extends \phpbb\extension\base
{
+ /** @var Extension name */
+ protected $ext_name = 'curlyquotes';
+
+ /** @var min phpBB version */
+ protected $phpbb_min_version = '3.2.0';
+
+ /** @var max phpBB version (>= query) */
+ protected $phpbb_max_version = '4.0.0';
+
+ /** @var min PHP version */
+ protected $php_min_version = '5.4.7';
+
+ /** @var max PHP version (>= query) */
+ protected $php_max_version = '8.3.0';
+
+ /**
+ * Check the minimum and maximum requirements.
+ *
+ * @return bool|string|array A error message
+ */
public function is_enableable()
{
- $config = $this->container->get('config');
-
/* If phpBB version 3.1 or less cancel */
- if (phpbb_version_compare($config['version'], '3.2.0', '<'))
+ if (phpbb_version_compare(PHPBB_VERSION, '3.2.0', '<'))
{
return false;
}
$language = $this->container->get('language');
- $language->add_lang('info_acp_curlyquotes', 'imcger/curlyquotes');
+ $language->add_lang('info_acp_'. $this->ext_name, 'imcger/'. $this->ext_name);
$error_message = [];
- /* phpBB version greater equal 3.2.0 and less then 4.0 */
- if (phpbb_version_compare($config['version'], '3.2.0', '<') || phpbb_version_compare($config['version'], '4.0.0', '>='))
+ /* phpBB version greater equal $phpbb_min_version and less then $phpbb_max_version */
+ if (phpbb_version_compare(PHPBB_VERSION, $this->phpbb_min_version, '<') || phpbb_version_compare(PHPBB_VERSION, $this->phpbb_max_version, '>='))
{
- $error_message += ['error1' => $language->lang('IMCGER_REQUIRE_PHPBB'),];
+ $error_message += ['error1' => $language->lang('IMCGER_REQUIRE_PHPBB', $this->phpbb_min_version, $this->phpbb_max_version, PHPBB_VERSION),];
}
- /* php version equal or greater 5.4.7 and less 8.2 */
- if (version_compare(PHP_VERSION, '8.0', '<') || version_compare(PHP_VERSION, '8.2', '>='))
+ /* php version equal or greater $php_min_version and less $php_max_version */
+ if (version_compare(PHP_VERSION, $this->php_min_version, '<') || version_compare(PHP_VERSION, $this->php_max_version, '>='))
{
- $error_message += ['error2' => $language->lang('IMCGER_REQUIRE_PHP'),];
+ $error_message += ['error2' => $language->lang('IMCGER_REQUIRE_PHP', $this->php_min_version, $this->php_max_version, PHP_VERSION),];
}
- /* When phpBB older then 3.3.0 use trigger_error() for message output */
- if (phpbb_version_compare($config['version'], '3.3.0', '<') && !empty($error_message))
+ /* When phpBB v3.2 use trigger_error() for message output. For v3.1 return false. */
+ if (phpbb_version_compare(PHPBB_VERSION, '3.3.0', '<') && !empty($error_message))
{
- $error_message = implode('
', $error_message);
- trigger_error($error_message, E_USER_WARNING);
+ $message = implode('
', $error_message);
+ trigger_error($message, E_USER_WARNING);
}
return empty($error_message) ? true : $error_message;
diff --git a/imcger/curlyquotes/language/de/info_acp_curlyquotes.php b/imcger/curlyquotes/language/de/info_acp_curlyquotes.php
index 6e3c86e..1f38881 100644
--- a/imcger/curlyquotes/language/de/info_acp_curlyquotes.php
+++ b/imcger/curlyquotes/language/de/info_acp_curlyquotes.php
@@ -43,6 +43,6 @@
'ACP_CURLYQUOTES_SETTINGS' => 'Einstellungen',
'ACP_CURLYQUOTES_SETTING_SAVED' => 'Curly Quotes Einstellungen erfolgreich gespeichert.',
- 'IMCGER_REQUIRE_PHPBB' => 'Diese Erweiterung benötigt eine phpBB Version gleich oder grösser 3.2.0 und kleiner 4.0.0',
- 'IMCGER_REQUIRE_PHP' => 'Diese Erweiterung benötigt eine php Version gleich oder grösser 8.0 und kleiner 8.2.',
+ 'IMCGER_REQUIRE_PHPBB' => 'Diese Erweiterung benötigt eine phpBB Version gleich oder grösser %1$s und kleiner %2$s. Deine Version ist %3$s.',
+ 'IMCGER_REQUIRE_PHP' => 'Diese Erweiterung benötigt eine php Version gleich oder grösser %1$s und kleiner %2$s. Deine Version ist %3$s.',
]);
diff --git a/imcger/curlyquotes/language/de_x_sie/info_acp_curlyquotes.php b/imcger/curlyquotes/language/de_x_sie/info_acp_curlyquotes.php
index 6e3c86e..1f38881 100644
--- a/imcger/curlyquotes/language/de_x_sie/info_acp_curlyquotes.php
+++ b/imcger/curlyquotes/language/de_x_sie/info_acp_curlyquotes.php
@@ -43,6 +43,6 @@
'ACP_CURLYQUOTES_SETTINGS' => 'Einstellungen',
'ACP_CURLYQUOTES_SETTING_SAVED' => 'Curly Quotes Einstellungen erfolgreich gespeichert.',
- 'IMCGER_REQUIRE_PHPBB' => 'Diese Erweiterung benötigt eine phpBB Version gleich oder grösser 3.2.0 und kleiner 4.0.0',
- 'IMCGER_REQUIRE_PHP' => 'Diese Erweiterung benötigt eine php Version gleich oder grösser 8.0 und kleiner 8.2.',
+ 'IMCGER_REQUIRE_PHPBB' => 'Diese Erweiterung benötigt eine phpBB Version gleich oder grösser %1$s und kleiner %2$s. Deine Version ist %3$s.',
+ 'IMCGER_REQUIRE_PHP' => 'Diese Erweiterung benötigt eine php Version gleich oder grösser %1$s und kleiner %2$s. Deine Version ist %3$s.',
]);
diff --git a/imcger/curlyquotes/language/en/info_acp_curlyquotes.php b/imcger/curlyquotes/language/en/info_acp_curlyquotes.php
index 5eb0b37..7471112 100644
--- a/imcger/curlyquotes/language/en/info_acp_curlyquotes.php
+++ b/imcger/curlyquotes/language/en/info_acp_curlyquotes.php
@@ -43,6 +43,6 @@
'ACP_CURLYQUOTES_SETTINGS' => 'Settings',
'ACP_CURLYQUOTES_SETTING_SAVED' => 'Curly Quotes settings saved successfully.',
- 'IMCGER_REQUIRE_PHPBB' => 'This extension requires a phpBB version greater or equal than 3.2.0 and less than 4.0.0',
- 'IMCGER_REQUIRE_PHP' => 'This extension requires a php version greater or equal than 8.0 and less than 8.2.',
+ 'IMCGER_REQUIRE_PHPBB' => 'This extension requires a phpBB version greater or equal than %1$s and less than %2$s. Your version is %3$s.',
+ 'IMCGER_REQUIRE_PHP' => 'This extension requires a php version greater or equal than %1$s and less than %2$s. Your version is %3$s.',
]);