Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/CDPT-2258 Handle empty post and text domain. Add constructor to notify-for-wordpress #770

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions bin/composer-post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ if [ -f "$MOJ_COMPONENTS_FILE" ] ; then
MOJ_COMPONENTS_CONTENT=$(perl -0777pe 's/'"$MOJ_COMPONENTS_SEARCH_PARAGRAPH"'/'"$MOJ_COMPONENTS_REPLACE_PARAGRAPH"'/s' "$MOJ_COMPONENTS_FILE")
echo "$MOJ_COMPONENTS_CONTENT" > "$MOJ_COMPONENTS_FILE"
fi


NOTIFY_FILE=/var/www/html/public/app/plugins/notify-for-wordpress/inc/admin/class-dashboard-table.php
NOTIFY_SEARCH="public function get_columns"
NOTIFY_REPLACE='private \$plugin_text_domain;

public function __construct(string \$plugin_text_domain)
{
parent::__construct();
\$this->plugin_text_domain = \$plugin_text_domain;
}

public function get_columns'

if [ -f "$NOTIFY_FILE" ] ; then
echo "Adding code blocke to notify-for-wordpress plugin"
NOTIFY_CONTENT=$(perl -0777pe 's/'"$NOTIFY_SEARCH"'/'"$NOTIFY_REPLACE"'/s' "$NOTIFY_FILE")
echo "$NOTIFY_CONTENT" > "$NOTIFY_FILE"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function coauthors_filter_wp_die_handler(string $handler): string
global $post;

// If the post does not have an error and is a guest-author post type.
if (!is_wp_error($post) && $post->post_type === 'guest-author') {
if (!is_wp_error($post) && $post?->post_type === 'guest-author') {
return 'coauthors_wp_die_handler';
}

Expand All @@ -173,11 +173,11 @@ function coauthors_filter_wp_die_handler(string $handler): string
*
* @param string $translated_text The translated text
* @param string $text The original text
* @param string $domain The text domain
* @param ?string $domain The text domain
* @return string The modified text
*/

function coauthors_filter_text(string $translated_text, string $text, string $domain): string
function coauthors_filter_text(string $translated_text, string $text, ?string $domain): string
{
if ($domain === 'co-authors-plus') {
// Remove the string 'WordPress' from the plugin's text.
Expand Down
Loading