From d96e05c77505d74cba5d6e0066f8c4bb2deebb13 Mon Sep 17 00:00:00 2001
From: Konstantinos Galanakis
Date: Mon, 14 Aug 2023 10:54:28 +0300
Subject: [PATCH 1/5] Add a check to ensure we have a valid PHP version before
loading plugin functionality and output an admin notice if needed
---
insert-special-characters.php | 47 +++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/insert-special-characters.php b/insert-special-characters.php
index 788a9aa..53804a9 100644
--- a/insert-special-characters.php
+++ b/insert-special-characters.php
@@ -17,6 +17,53 @@
namespace InsertSpecialCharacters;
+/**
+ * Get the minimum version of PHP required by this plugin.
+ *
+ * @since 1.0.8
+ *
+ * @return string Minimum version required.
+ */
+function minimum_php_requirement(): string {
+ return '7.4';
+}
+
+/**
+ * Whether PHP installation meets the minimum requirements
+ *
+ * @since 1.0.8
+ *
+ * @return bool True if meets minimum requirements, false otherwise.
+ */
+function site_meets_php_requirements(): bool {
+ return version_compare( phpversion(), minimum_php_requirement(), '>=' );
+}
+
+// Try to load the plugin files, ensuring our PHP version is met first.
+if ( ! site_meets_php_requirements() ) {
+ add_action(
+ 'admin_notices',
+ function() {
+ ?>
+
+
Date: Fri, 15 Sep 2023 18:11:35 +0300
Subject: [PATCH 2/5] Make main plugin file PHP 5.6 compatible and move main
plugin functionality in a separate file
---
inc/plugin.php | 170 +++++++++++++++++++++++++++++++++
insert-special-characters.php | 174 ++--------------------------------
2 files changed, 179 insertions(+), 165 deletions(-)
create mode 100644 inc/plugin.php
diff --git a/inc/plugin.php b/inc/plugin.php
new file mode 100644
index 0000000..803e6c5
--- /dev/null
+++ b/inc/plugin.php
@@ -0,0 +1,170 @@
+ get_most_used_palette_setting(),
+ )
+ )
+ )
+ );
+}
+add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\gcm_block_enqueue_scripts' );
+
+/**
+ * Registers settings fields.
+ */
+function register_settings_fields() {
+ register_setting(
+ 'writing',
+ 'tenup_isc_most_read_palette',
+ array(
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'default' => false,
+ )
+ );
+
+ add_settings_section(
+ 'tenup_isc_writing_section',
+ esc_html__( 'Insert Special Characters', 'insert-special-characters' ),
+ null,
+ 'writing'
+ );
+
+ add_settings_field(
+ 'tenup_isc_most_read_palette',
+ esc_html__( 'Most used characters palette', 'insert-special-characters' ),
+ __NAMESPACE__ . '\render_isc_writing_setting',
+ 'writing',
+ 'tenup_isc_writing_section',
+ array(
+ 'label_for' => 'tenup_isc_most_read_palette',
+ )
+ );
+}
+add_action( 'admin_init', __NAMESPACE__ . '\register_settings_fields' );
+
+/**
+ * Renders settings fields.
+ */
+function render_isc_writing_setting() {
+ $option = get_most_used_palette_setting();
+ ?>
+
+
+
+
+
+
+
+
+
+
+ __( 'Palette cleared', 'insert-special-characters' ),
+ )
+ );
+}
+add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\load_admin_scripts' );
diff --git a/insert-special-characters.php b/insert-special-characters.php
index 53804a9..abd292b 100644
--- a/insert-special-characters.php
+++ b/insert-special-characters.php
@@ -17,6 +17,9 @@
namespace InsertSpecialCharacters;
+define( 'ISC_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
+define( 'ISC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
+
/**
* Get the minimum version of PHP required by this plugin.
*
@@ -24,7 +27,7 @@
*
* @return string Minimum version required.
*/
-function minimum_php_requirement(): string {
+function minimum_php_requirement() {
return '7.4';
}
@@ -35,7 +38,7 @@ function minimum_php_requirement(): string {
*
* @return bool True if meets minimum requirements, false otherwise.
*/
-function site_meets_php_requirements(): bool {
+function site_meets_php_requirements() {
return version_compare( phpversion(), minimum_php_requirement(), '>=' );
}
@@ -50,7 +53,7 @@ function() {
get_most_used_palette_setting(),
- )
- )
- )
- );
-}
-add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\gcm_block_enqueue_scripts' );
-
-/**
- * Registers settings fields.
- */
-function register_settings_fields() {
- register_setting(
- 'writing',
- 'tenup_isc_most_read_palette',
- array(
- 'type' => 'boolean',
- 'show_in_rest' => true,
- 'default' => false,
- )
- );
-
- add_settings_section(
- 'tenup_isc_writing_section',
- esc_html__( 'Insert Special Characters', 'insert-special-characters' ),
- null,
- 'writing'
- );
-
- add_settings_field(
- 'tenup_isc_most_read_palette',
- esc_html__( 'Most used characters palette', 'insert-special-characters' ),
- __NAMESPACE__ . '\render_isc_writing_setting',
- 'writing',
- 'tenup_isc_writing_section',
- array(
- 'label_for' => 'tenup_isc_most_read_palette',
- )
- );
-}
-add_action( 'admin_init', __NAMESPACE__ . '\register_settings_fields' );
-
-/**
- * Renders settings fields.
- */
-function render_isc_writing_setting() {
- $option = get_most_used_palette_setting();
- ?>
-
-
-
-
-
-
-
-
-
-
- __( 'Palette cleared', 'insert-special-characters' ),
- )
- );
-}
-add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\load_admin_scripts' );
+require_once __DIR__ . '/inc/plugin.php';
From 501dc62c0dc2998bb48d0735d17e70b074d6fcb7 Mon Sep 17 00:00:00 2001
From: Konstantinos Galanakis
Date: Fri, 15 Sep 2023 18:13:10 +0300
Subject: [PATCH 3/5] Add PHP Compatibility check for 5.6 on the main file and
fo 7.4 for the rest of the plugin
---
.github/workflows/php-compatibility.yml | 7 ++++--
inc/plugin.php | 33 ++++++++++++++-----------
insert-special-characters.php | 2 +-
3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml
index 09aa667..73f6a54 100644
--- a/.github/workflows/php-compatibility.yml
+++ b/.github/workflows/php-compatibility.yml
@@ -29,5 +29,8 @@ jobs:
- name: Install dependencies
run: composer install
- - name: Run PHP Compatibility
- run: vendor/bin/phpcs insert-special-characters.php --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 7.4-
\ No newline at end of file
+ - name: Run PHP Compatibility on all files.
+ run: vendor/bin/phpcs inc --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 7.4-
+
+ - name: Run PHP Compatibility on main file.
+ run: vendor/bin/phpcs insert-special-characters.php --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.6-
diff --git a/inc/plugin.php b/inc/plugin.php
index 803e6c5..89cb689 100644
--- a/inc/plugin.php
+++ b/inc/plugin.php
@@ -1,7 +1,10 @@
-
-
+
+
-
-
+
-
-
+
Date: Tue, 19 Sep 2023 10:37:04 +1000
Subject: [PATCH 4/5] CS: Whitespace cleanup.
---
inc/plugin.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/inc/plugin.php b/inc/plugin.php
index 89cb689..318561f 100644
--- a/inc/plugin.php
+++ b/inc/plugin.php
@@ -106,9 +106,9 @@ function render_isc_writing_setting() {
>
From 70926c8b530c57b14baa197a34eab6e56d9e3176 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 7 Oct 2023 11:04:33 +0000
Subject: [PATCH 5/5] Bump postcss from 8.4.20 to 8.4.31
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.20 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.20...8.4.31)
---
updated-dependencies:
- dependency-name: postcss
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
---
package-lock.json | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 1b0dd67..0ef138a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13151,9 +13151,16 @@
"license": "ISC"
},
"node_modules/nanoid": {
- "version": "3.3.4",
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
+ "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"dev": true,
- "license": "MIT",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
"bin": {
"nanoid": "bin/nanoid.cjs"
},
@@ -14120,7 +14127,9 @@
}
},
"node_modules/postcss": {
- "version": "8.4.20",
+ "version": "8.4.31",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
+ "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"dev": true,
"funding": [
{
@@ -14130,11 +14139,14 @@
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
}
],
- "license": "MIT",
"dependencies": {
- "nanoid": "^3.3.4",
+ "nanoid": "^3.3.6",
"picocolors": "^1.0.0",
"source-map-js": "^1.0.2"
},
@@ -27353,7 +27365,9 @@
"dev": true
},
"nanoid": {
- "version": "3.3.4",
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
+ "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"dev": true
},
"natural-compare": {
@@ -27969,10 +27983,12 @@
}
},
"postcss": {
- "version": "8.4.20",
+ "version": "8.4.31",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
+ "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"dev": true,
"requires": {
- "nanoid": "^3.3.4",
+ "nanoid": "^3.3.6",
"picocolors": "^1.0.0",
"source-map-js": "^1.0.2"
}