Skip to content

Commit

Permalink
update version number, phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
bdolor committed Dec 20, 2018
1 parent e0be02c commit e438738
Show file tree
Hide file tree
Showing 9 changed files with 333 additions and 366 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bccampus/pressbooks-textbook",
"description": "Adds functionality to Pressbooks to make it easier to author textbooks",
"type": "wordpress-plugin",
"version": "4.2.2",
"version": "4.2.3",
"homepage": "https://github.com/bccampus/pressbooks-textbook",
"authors": [
{
Expand Down
3 changes: 2 additions & 1 deletion inc/admin/class-textbookadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ function displayOtbFeed() {
* Options for functionality that support remix
*/
private function remixSettings() {
$page = $option = 'pbt_remix_settings';
$page = 'pbt_remix_settings';
$option = 'pbt_remix_setings';
$section = 'pbt_remix_section';

// Remix
Expand Down
4 changes: 2 additions & 2 deletions inc/class-textbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Textbook {
* @since 1.0.0
* @var string
*/
const VERSION = '4.2.2';
const VERSION = '4.2.3';

/**
* Unique identifier for plugin.
Expand Down Expand Up @@ -369,7 +369,7 @@ function newBook() {
update_option( 'pressbooks_theme_options_ebook', $epub_compress_images );

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

// redistribute latest exports
update_option( 'pbt_redistribute_settings', $redistribute_files );
Expand Down
18 changes: 6 additions & 12 deletions inc/modules/catalogue/class-equellafetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,19 @@ private function searchBySubject( $any_query = '', $order = 'modified', $start =
// start building the URL
$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
//switch the API url, depending on whether you are searching for a keyword or a subject.
// SCENARIOS, require three distinct request urls depending...
if ( empty( $this->whereClause ) ) {
$this->url = $this->apiBaseUri . $search_where . $optional_param;
} // SCENARIOS, require three distinct request urls depending...
// 1
elseif ( $this->keywordFlag == true ) {
} elseif ( $this->keywordFlag == true ) {
$first_subject_path = $this->urlEncode( $this->keywordPath );
//oh, the API is case sensitive so this broadens our results, which we want
$second_where = strtolower( $this->whereClause );
$first_where = ucwords( $this->whereClause );
$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
} // 2
elseif ( $this->byContributorFlag == true ) {
} elseif ( $this->byContributorFlag == true ) {
$first_subject_path = $this->urlEncode( $this->contributorPath );
$this->url = $this->apiBaseUri . $search_where . $first_subject_path . $is . "'" . $this->whereClause . "'" . $optional_param;
} // 3
else {
} else {
$first_subject_path = $this->urlEncode( $this->subjectPath1 );
$second_subject_path = $this->urlEncode( $this->subjectPath2 );
$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
Expand Down Expand Up @@ -180,14 +177,11 @@ private function searchBySubject( $any_query = '', $order = 'modified', $start =
$start = $start + 50;
$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
//Three different scenarios here, depending..
//1
if ( ! empty( $this->whereClause ) && $this->byContributorFlag == true ) {
$this->url = $this->apiBaseUri . $search_where . $first_subject_path . $is . "'" . $this->whereClause . "'" . $optional_param;
} //2
elseif ( ! empty( $this->whereClause ) ) {
} elseif ( ! empty( $this->whereClause ) ) {
$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
} //3
else {
} else {
$this->url = $this->apiBaseUri . $search_where . $optional_param;
}
// modify the url
Expand Down
4 changes: 2 additions & 2 deletions phpcs.ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar"/>
<exclude name="WordPress.VIP.SessionVariableUsage"/>
<exclude name="WordPress.VIP.SessionFunctionsUsage"/>
<!-- Disable LayoutOrder until humanmade/coding-standards#5 is fixed -->
<exclude name="HM.Layout.Order.WrongOrder"/>
</rule>

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

<!-- Disable Namespaced Functions for cron scripts -->
<rule ref="HM.Functions.NamespacedFunctions">
<exclude-pattern>/bin/*</exclude-pattern>
<exclude-pattern>/themes-book/opentextbook/functions.php</exclude-pattern>
</rule>

<exclude-pattern>/vendor/*</exclude-pattern>
Expand Down
60 changes: 30 additions & 30 deletions pressbooks-textbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @wordpress-plugin
* Plugin Name: Textbooks for Pressbooks
* Description: A plugin that extends Pressbooks for textbook authoring
* Version: 4.2.2
* Version: 4.2.3
* Author: Brad Payne
* Author URI: http://github.com/bdolor
* Text Domain: pressbooks-textbook
Expand All @@ -20,12 +20,12 @@
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/BCcampus/pressbooks-textbook
* Tags: pressbooks, OER, publishing, textbooks
* Pressbooks tested up to: 5.6.0
* Pressbooks tested up to: 5.6.3
*/

// If file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die();
return;
}

/*
Expand Down Expand Up @@ -66,46 +66,46 @@
|
|
*/
function pb_compatibility() {
$min_pb_compatibility_version = '5.0.0';
add_filter(
'init', function () {
$min_pb_compatibility_version = '5.0.0';

if ( ! @include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) {
add_action(
'admin_notices', function () {
echo '<div id="message" class="error fade"><p>' . __( 'PBT cannot find a Pressbooks install.', 'pressbooks-textbook' ) . '</p></div>';
}
);

return;
}

if ( function_exists( 'pb_meets_minimum_requirements' ) ) {
if ( ! pb_meets_minimum_requirements() ) { // This PB function checks for both multisite, PHP and WP minimum versions.
if ( ! include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) {
add_action(
'admin_notices', function () {
echo '<div id="message" class="error fade"><p>' . __( 'Your PHP or WP version may not be up to date.', 'pressbooks-textbook' ) . '</p></div>';
echo '<div id="message" class="error fade"><p>' . __( 'PBT cannot find a Pressbooks install.', 'pressbooks-textbook' ) . '</p></div>';
}
);

return;
}
}

if ( ! version_compare( PB_PLUGIN_VERSION, $min_pb_compatibility_version, '>=' ) ) {
add_action(
'admin_notices', function () {
echo '<div id="message" class="error fade"><p>' . __( 'Textbooks for Pressbooks requires Pressbooks 5.0.0 or greater.', 'pressbooks-textbook' ) . '</p></div>';
if ( function_exists( 'pb_meets_minimum_requirements' ) ) {
if ( ! pb_meets_minimum_requirements() ) { // This PB function checks for both multisite, PHP and WP minimum versions.
add_action(
'admin_notices', function () {
echo '<div id="message" class="error fade"><p>' . __( 'Your PHP or WP version may not be up to date.', 'pressbooks-textbook' ) . '</p></div>';
}
);

return;
}
);
}

return;
}
// need version number outside of init hook
update_site_option( 'pbt_pb_version', PB_PLUGIN_VERSION );
if ( ! version_compare( PB_PLUGIN_VERSION, $min_pb_compatibility_version, '>=' ) ) {
add_action(
'admin_notices', function () {
echo '<div id="message" class="error fade"><p>' . __( 'Textbooks for Pressbooks requires Pressbooks 5.0.0 or greater.', 'pressbooks-textbook' ) . '</p></div>';
}
);

}
return;
}
// need version number outside of init hook
update_site_option( 'pbt_pb_version', PB_PLUGIN_VERSION );

add_action( 'init', 'pb_compatibility' );
}
);

/*
|--------------------------------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: bdolor, aparedes
Donation link: https://github.com/BCcampus/pressbooks-textbook/wiki/Contribution-guidelines
Tags: pressbooks, textbook
Requires at least: 4.9.8
Tested up to: 4.9.8
Stable tag: 4.2.2
Tested up to: 5.0.2
Stable tag: 4.2.3
Requires PHP: 7.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -88,6 +88,10 @@ When creating Open Textbooks and other OERs, we feel it is best to adhere to the

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

= 4.2.3 (2018/12/20) =
* compatibility with PB 5.6.3
* improved coding standards compliance

= 4.2.2 (2018/11/22) =
* fix fontsize response to a11y function
* update dependencies
Expand Down
Loading

0 comments on commit e438738

Please sign in to comment.