|
11 | 11 | * @wordpress-plugin
|
12 | 12 | * Plugin Name: Textbooks for Pressbooks
|
13 | 13 | * Description: A plugin that extends Pressbooks for textbook authoring
|
14 |
| - * Version: 4.2.2 |
| 14 | + * Version: 4.2.3 |
15 | 15 | * Author: Brad Payne
|
16 | 16 | * Author URI: http://github.com/bdolor
|
17 | 17 | * Text Domain: pressbooks-textbook
|
|
20 | 20 | * Domain Path: /languages
|
21 | 21 | * GitHub Plugin URI: https://github.com/BCcampus/pressbooks-textbook
|
22 | 22 | * Tags: pressbooks, OER, publishing, textbooks
|
23 |
| - * Pressbooks tested up to: 5.6.0 |
| 23 | + * Pressbooks tested up to: 5.6.3 |
24 | 24 | */
|
25 | 25 |
|
26 | 26 | // If file is called directly, abort.
|
27 | 27 | if ( ! defined( 'WPINC' ) ) {
|
28 |
| - die(); |
| 28 | + return; |
29 | 29 | }
|
30 | 30 |
|
31 | 31 | /*
|
|
66 | 66 | |
|
67 | 67 | |
|
68 | 68 | */
|
69 |
| -function pb_compatibility() { |
70 |
| - $min_pb_compatibility_version = '5.0.0'; |
| 69 | +add_filter( |
| 70 | + 'init', function () { |
| 71 | + $min_pb_compatibility_version = '5.0.0'; |
71 | 72 |
|
72 |
| - if ( ! @include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) { |
73 |
| - add_action( |
74 |
| - 'admin_notices', function () { |
75 |
| - echo '<div id="message" class="error fade"><p>' . __( 'PBT cannot find a Pressbooks install.', 'pressbooks-textbook' ) . '</p></div>'; |
76 |
| - } |
77 |
| - ); |
78 |
| - |
79 |
| - return; |
80 |
| - } |
81 |
| - |
82 |
| - if ( function_exists( 'pb_meets_minimum_requirements' ) ) { |
83 |
| - if ( ! pb_meets_minimum_requirements() ) { // This PB function checks for both multisite, PHP and WP minimum versions. |
| 73 | + if ( ! include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) { |
84 | 74 | add_action(
|
85 | 75 | 'admin_notices', function () {
|
86 |
| - echo '<div id="message" class="error fade"><p>' . __( 'Your PHP or WP version may not be up to date.', 'pressbooks-textbook' ) . '</p></div>'; |
| 76 | + echo '<div id="message" class="error fade"><p>' . __( 'PBT cannot find a Pressbooks install.', 'pressbooks-textbook' ) . '</p></div>'; |
87 | 77 | }
|
88 | 78 | );
|
89 | 79 |
|
90 | 80 | return;
|
91 | 81 | }
|
92 |
| - } |
93 | 82 |
|
94 |
| - if ( ! version_compare( PB_PLUGIN_VERSION, $min_pb_compatibility_version, '>=' ) ) { |
95 |
| - add_action( |
96 |
| - 'admin_notices', function () { |
97 |
| - echo '<div id="message" class="error fade"><p>' . __( 'Textbooks for Pressbooks requires Pressbooks 5.0.0 or greater.', 'pressbooks-textbook' ) . '</p></div>'; |
| 83 | + if ( function_exists( 'pb_meets_minimum_requirements' ) ) { |
| 84 | + if ( ! pb_meets_minimum_requirements() ) { // This PB function checks for both multisite, PHP and WP minimum versions. |
| 85 | + add_action( |
| 86 | + 'admin_notices', function () { |
| 87 | + echo '<div id="message" class="error fade"><p>' . __( 'Your PHP or WP version may not be up to date.', 'pressbooks-textbook' ) . '</p></div>'; |
| 88 | + } |
| 89 | + ); |
| 90 | + |
| 91 | + return; |
98 | 92 | }
|
99 |
| - ); |
| 93 | + } |
100 | 94 |
|
101 |
| - return; |
102 |
| - } |
103 |
| - // need version number outside of init hook |
104 |
| - update_site_option( 'pbt_pb_version', PB_PLUGIN_VERSION ); |
| 95 | + if ( ! version_compare( PB_PLUGIN_VERSION, $min_pb_compatibility_version, '>=' ) ) { |
| 96 | + add_action( |
| 97 | + 'admin_notices', function () { |
| 98 | + echo '<div id="message" class="error fade"><p>' . __( 'Textbooks for Pressbooks requires Pressbooks 5.0.0 or greater.', 'pressbooks-textbook' ) . '</p></div>'; |
| 99 | + } |
| 100 | + ); |
105 | 101 |
|
106 |
| -} |
| 102 | + return; |
| 103 | + } |
| 104 | + // need version number outside of init hook |
| 105 | + update_site_option( 'pbt_pb_version', PB_PLUGIN_VERSION ); |
107 | 106 |
|
108 |
| -add_action( 'init', 'pb_compatibility' ); |
| 107 | + } |
| 108 | +); |
109 | 109 |
|
110 | 110 | /*
|
111 | 111 | |--------------------------------------------------------------------------
|
|
0 commit comments