Skip to content

Commit e438738

Browse files
committed
update version number, phpcs
1 parent e0be02c commit e438738

File tree

9 files changed

+333
-366
lines changed

9 files changed

+333
-366
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "bccampus/pressbooks-textbook",
33
"description": "Adds functionality to Pressbooks to make it easier to author textbooks",
44
"type": "wordpress-plugin",
5-
"version": "4.2.2",
5+
"version": "4.2.3",
66
"homepage": "https://github.com/bccampus/pressbooks-textbook",
77
"authors": [
88
{

inc/admin/class-textbookadmin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ function displayOtbFeed() {
135135
* Options for functionality that support remix
136136
*/
137137
private function remixSettings() {
138-
$page = $option = 'pbt_remix_settings';
138+
$page = 'pbt_remix_settings';
139+
$option = 'pbt_remix_setings';
139140
$section = 'pbt_remix_section';
140141

141142
// Remix

inc/class-textbook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Textbook {
2222
* @since 1.0.0
2323
* @var string
2424
*/
25-
const VERSION = '4.2.2';
25+
const VERSION = '4.2.3';
2626

2727
/**
2828
* Unique identifier for plugin.
@@ -369,7 +369,7 @@ function newBook() {
369369
update_option( 'pressbooks_theme_options_ebook', $epub_compress_images );
370370

371371
// modify the book description
372-
update_option( 'blogdescription', __( 'Open Textbook', $this->plugin_slug ) );
372+
update_option( 'blogdescription', __( 'Open Textbook', 'pressbooks-textbook' ) );
373373

374374
// redistribute latest exports
375375
update_option( 'pbt_redistribute_settings', $redistribute_files );

inc/modules/catalogue/class-equellafetch.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,19 @@ private function searchBySubject( $any_query = '', $order = 'modified', $start =
126126
// start building the URL
127127
$search_where = 'search?' . $any_query . '&collections=' . $this->collectionUuid . '&start=' . $start . '&length=' . $limit . '&order=' . $order . '&where='; //limit 50 is the max results allowed by the API
128128
//switch the API url, depending on whether you are searching for a keyword or a subject.
129+
// SCENARIOS, require three distinct request urls depending...
129130
if ( empty( $this->whereClause ) ) {
130131
$this->url = $this->apiBaseUri . $search_where . $optional_param;
131-
} // SCENARIOS, require three distinct request urls depending...
132-
// 1
133-
elseif ( $this->keywordFlag == true ) {
132+
} elseif ( $this->keywordFlag == true ) {
134133
$first_subject_path = $this->urlEncode( $this->keywordPath );
135134
//oh, the API is case sensitive so this broadens our results, which we want
136135
$second_where = strtolower( $this->whereClause );
137136
$first_where = ucwords( $this->whereClause );
138137
$this->url = $this->apiBaseUri . $search_where . $first_subject_path . $is . "'" . $first_where . "'" . $or . $first_subject_path . $is . "'" . $second_where . "'" . $optional_param; //add the base url, put it all together
139-
} // 2
140-
elseif ( $this->byContributorFlag == true ) {
138+
} elseif ( $this->byContributorFlag == true ) {
141139
$first_subject_path = $this->urlEncode( $this->contributorPath );
142140
$this->url = $this->apiBaseUri . $search_where . $first_subject_path . $is . "'" . $this->whereClause . "'" . $optional_param;
143-
} // 3
144-
else {
141+
} else {
145142
$first_subject_path = $this->urlEncode( $this->subjectPath1 );
146143
$second_subject_path = $this->urlEncode( $this->subjectPath2 );
147144
$this->url = $this->apiBaseUri . $search_where . $first_subject_path . $is . "'" . $this->whereClause . "'" . $or . $second_subject_path . $is . "'" . $this->whereClause . "'" . $optional_param; //add the base url, put it all together
@@ -180,14 +177,11 @@ private function searchBySubject( $any_query = '', $order = 'modified', $start =
180177
$start = $start + 50;
181178
$search_where = 'search?' . $any_query . '&collections=' . $this->collectionUuid . '&start=' . $start . '&length=' . $limit . '&order=' . $order . '&where='; //length 50 is the max results allowed by the API
182179
//Three different scenarios here, depending..
183-
//1
184180
if ( ! empty( $this->whereClause ) && $this->byContributorFlag == true ) {
185181
$this->url = $this->apiBaseUri . $search_where . $first_subject_path . $is . "'" . $this->whereClause . "'" . $optional_param;
186-
} //2
187-
elseif ( ! empty( $this->whereClause ) ) {
182+
} elseif ( ! empty( $this->whereClause ) ) {
188183
$this->url = $this->apiBaseUri . $search_where . $first_subject_path . $is . "'" . $this->whereClause . "'" . $or . $second_subject_path . $is . "'" . $this->whereClause . "'" . $optional_param; //add the base url, put it all together
189-
} //3
190-
else {
184+
} else {
191185
$this->url = $this->apiBaseUri . $search_where . $optional_param;
192186
}
193187
// modify the url

phpcs.ruleset.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar"/>
2121
<exclude name="WordPress.VIP.SessionVariableUsage"/>
2222
<exclude name="WordPress.VIP.SessionFunctionsUsage"/>
23-
<!-- Disable LayoutOrder until humanmade/coding-standards#5 is fixed -->
24-
<exclude name="HM.Layout.Order.WrongOrder"/>
2523
</rule>
2624

2725
<!-- Re-enable rules we agree with -->
@@ -30,11 +28,13 @@
3028
<!-- Disable Side Effects rule for bootstrapping file, extends WordPress core, cron scripts -->
3129
<rule ref="PSR1.Files.SideEffects">
3230
<exclude-pattern>/bin/*</exclude-pattern>
31+
<exclude-pattern>/themes-book/opentextbook/functions.php</exclude-pattern>
3332
</rule>
3433

3534
<!-- Disable Namespaced Functions for cron scripts -->
3635
<rule ref="HM.Functions.NamespacedFunctions">
3736
<exclude-pattern>/bin/*</exclude-pattern>
37+
<exclude-pattern>/themes-book/opentextbook/functions.php</exclude-pattern>
3838
</rule>
3939

4040
<exclude-pattern>/vendor/*</exclude-pattern>

pressbooks-textbook.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @wordpress-plugin
1212
* Plugin Name: Textbooks for Pressbooks
1313
* Description: A plugin that extends Pressbooks for textbook authoring
14-
* Version: 4.2.2
14+
* Version: 4.2.3
1515
* Author: Brad Payne
1616
* Author URI: http://github.com/bdolor
1717
* Text Domain: pressbooks-textbook
@@ -20,12 +20,12 @@
2020
* Domain Path: /languages
2121
* GitHub Plugin URI: https://github.com/BCcampus/pressbooks-textbook
2222
* Tags: pressbooks, OER, publishing, textbooks
23-
* Pressbooks tested up to: 5.6.0
23+
* Pressbooks tested up to: 5.6.3
2424
*/
2525

2626
// If file is called directly, abort.
2727
if ( ! defined( 'WPINC' ) ) {
28-
die();
28+
return;
2929
}
3030

3131
/*
@@ -66,46 +66,46 @@
6666
|
6767
|
6868
*/
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';
7172

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' ) ) {
8474
add_action(
8575
'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>';
8777
}
8878
);
8979

9080
return;
9181
}
92-
}
9382

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;
9892
}
99-
);
93+
}
10094

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+
);
105101

106-
}
102+
return;
103+
}
104+
// need version number outside of init hook
105+
update_site_option( 'pbt_pb_version', PB_PLUGIN_VERSION );
107106

108-
add_action( 'init', 'pb_compatibility' );
107+
}
108+
);
109109

110110
/*
111111
|--------------------------------------------------------------------------

readme.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: bdolor, aparedes
33
Donation link: https://github.com/BCcampus/pressbooks-textbook/wiki/Contribution-guidelines
44
Tags: pressbooks, textbook
55
Requires at least: 4.9.8
6-
Tested up to: 4.9.8
7-
Stable tag: 4.2.2
6+
Tested up to: 5.0.2
7+
Stable tag: 4.2.3
88
Requires PHP: 7.1
99
License: GPLv2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -88,6 +88,10 @@ When creating Open Textbooks and other OERs, we feel it is best to adhere to the
8888

8989
See: https://github.com/BCcampus/pressbooks-textbook/commits/master for more detail
9090

91+
= 4.2.3 (2018/12/20) =
92+
* compatibility with PB 5.6.3
93+
* improved coding standards compliance
94+
9195
= 4.2.2 (2018/11/22) =
9296
* fix fontsize response to a11y function
9397
* update dependencies

0 commit comments

Comments
 (0)