Skip to content

Commit 31cfeed

Browse files
committed
chore: move dependency check
1 parent e5cef53 commit 31cfeed

5 files changed

Lines changed: 48 additions & 169 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [3.0.4] - 2022-10-21
8+
### Changed
9+
- Replaced Composer plugin dependency check with runtime check.
10+
711
## [3.0.3] - 2022-10-07
812
### Chore
913
- Update dependencies + reference pdc-base plugin from BitBucket to GitHub

composer.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@
99
}
1010
],
1111
"type": "wordpress-plugin",
12-
"repositories": [
13-
{
14-
"type": "vcs",
15-
"url": "git@github.com:OpenWebconcept/plugin-pdc-base.git"
16-
}
17-
],
1812
"require": {
19-
"php": ">=7.0",
20-
"plugin/pdc-base": "^3.0.0"
13+
"php": "^7.4|^8.0"
2114
},
2215
"require-dev": {
2316
"mockery/mockery": "*",
@@ -28,7 +21,7 @@
2821
},
2922
"autoload": {
3023
"psr-4": {
31-
"OWC\\PDC\\FAQ\\": "./src/FAQ"
24+
"OWC\\PDC\\": "./src"
3225
}
3326
},
3427
"autoload-dev": {

composer.lock

Lines changed: 19 additions & 156 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdc-faq.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: PDC FAQ
55
* Plugin URI: https://www.openwebconcept.nl/
66
* Description: Plugin to create the frequently asked questions section for a PDC item.
7-
* Version: 3.0.3
7+
* Version: 3.0.4
88
* Author: Yard Digital Agency
99
* Author URI: https://www.yard.nl/
1010
* License: GPL-3.0
@@ -34,8 +34,12 @@
3434
/**
3535
* manual loaded file: the autoloader.
3636
*/
37-
require_once __DIR__ . '/autoloader.php';
38-
$autoloader = new Autoloader();
37+
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
38+
require_once __DIR__ . '/vendor/autoload.php';
39+
} else {
40+
require_once __DIR__ . '/autoloader.php';
41+
$autoloader = new Autoloader();
42+
}
3943

4044
/**
4145
* Begin execution of the plugin
@@ -45,6 +49,21 @@
4549
* and wp_loaded action hooks.
4650
*/
4751
add_action('plugins_loaded', function () {
52+
if (! class_exists('OWC\PDC\Base\Foundation\Plugin')) {
53+
add_action('admin_notices', function () {
54+
$list = '<p>' . __(
55+
'The following plugins are required to use the PDC FAQ:',
56+
'pdc-faq'
57+
) . '</p><ol><li>OpenPDC Base (version >= 3.0.0)</li></ol>';
58+
59+
printf('<div class="notice notice-error"><p>%s</p></div>', $list);
60+
});
61+
62+
\deactivate_plugins(\plugin_basename(__FILE__));
63+
64+
return;
65+
}
66+
4867
$plugin = (new Plugin(__DIR__))->boot();
4968
}, 10);
5069

src/FAQ/Foundation/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ class Plugin extends BasePlugin
2727
*
2828
* @const string VERSION
2929
*/
30-
const VERSION = '3.0.3';
30+
const VERSION = '3.0.4';
3131
}

0 commit comments

Comments
 (0)