Skip to content

Commit

Permalink
### V1.2.9
Browse files Browse the repository at this point in the history
* `npr_cds_show_message()` only echoes in admin dashboard
* Promo cards without valid `webPages` array are ignored
  • Loading branch information
jwcounts committed Jul 26, 2024
1 parent c3c439c commit a801cd1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ A collection of tools for publishing from and to NPR's Content Distribution Serv
- Requires at least: 4.0
- Tested up to: 6.6
- Requires PHP: 8.0
- Version: 1.2.8.1
- Stable tag: 1.2.8.1
- Version: 1.2.9
- Stable tag: 1.2.9
- Author: Open Public Media
- Author URI: https://github.com/OpenPublicMedia/
- License: GPLv2
Expand Down Expand Up @@ -77,6 +77,10 @@ NPR Stories having been retrieved

## Changelog
<!-- copy from readme.txt to here -->
### V1.2.9
* `npr_cds_show_message()` only echoes in admin dashboard
* Promo cards without valid `webPages` array are ignored

### V1.2.8.1
* Fixed error logging bug which was causing blank errors on failed uploads

Expand Down
2 changes: 1 addition & 1 deletion classes/NPR_CDS_WP.php
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ function get_body_with_layout( stdClass $story ): array {
if ( !empty( $asset_current->documentLink ) ) {
$promo_card = $this->get_document( $asset_current->documentLink->href );
$promo_card_url = '';
if ( ! is_wp_error( $promo_card ) ) {
if ( ! is_wp_error( $promo_card ) && !empty( $promo_card->webPages ) ) {
foreach ( $promo_card->webPages as $web ) {
if ( in_array( 'canonical', $web->rels ) ) {
$promo_card_url = $web->href;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type" : "wordpress-plugin",
"license" : "GPL-2.0+",
"dist": {
"url": "https://github.com/OpenPublicMedia/npr-cds-wordpress/archive/refs/tags/v1.2.8.1.zip",
"url": "https://github.com/OpenPublicMedia/npr-cds-wordpress/archive/refs/tags/v1.2.9.zip",
"type": "zip"
},
"authors": [
Expand Down
14 changes: 8 additions & 6 deletions npr_cds.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: NPR Content Distribution Service
* Plugin URI: https://github.com/OpenPublicMedia/npr-cds-wordpress
* Description: A collection of tools for reusing content from NPR.org, now maintained and updated by NPR member station developers
* Version: 1.2.8.1
* Version: 1.2.9
* Requires at least: 4.0
* Requires PHP: 8.0
* Author: Open Public Media
Expand Down Expand Up @@ -326,12 +326,14 @@ function npr_cds_deactivate(): void {


function npr_cds_show_message( $message, $errormsg = false ): void {
if ( $errormsg ) {
echo '<div id="message" class="error">';
} else {
echo '<div id="message" class="updated fade">';
if ( is_admin() ) {
if ( $errormsg ) {
echo '<div id="message" class="error">';
} else {
echo '<div id="message" class="updated fade">';
}
echo npr_cds_esc_html( "<p><strong>$message</strong></p></div>" );
}
echo npr_cds_esc_html( "<p><strong>$message</strong></p></div>" );
}

add_action( 'init', 'npr_cds_create_post_type' );
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ NPR Stories having been retrieved


== Changelog ==
= V1.2.9 =
* `npr_cds_show_message()` only echoes in admin dashboard
* Promo cards without valid `webPages` array are ignored

= V1.2.8.1 =
* Fixed error logging bug which was causing blank errors on failed uploads

Expand Down

0 comments on commit a801cd1

Please sign in to comment.