Skip to content

Commit 5fca6be

Browse files
Merge branch 'development' of girish.github.com:Codeinwp/feedzy-rss-feeds into bugfix/pro/724
2 parents 1893137 + 495d9f7 commit 5fca6be

35 files changed

+1190
-651
lines changed

.github/workflows/test-php.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ concurrency:
55
on:
66
push:
77
branches-ignore:
8-
- 'master'
8+
- "master"
99

1010
jobs:
1111
phplint:
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup PHP version
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '7.4'
18+
php-version: "7.4"
1919
extensions: simplexml
2020
- name: Checkout source code
2121
uses: actions/checkout@v2
@@ -38,7 +38,7 @@ jobs:
3838

3939
phpunit:
4040
name: PHPUnit
41-
runs-on: ubuntu-latest
41+
runs-on: ubuntu-22.04
4242
services:
4343
mysql:
4444
image: mysql:5.7
@@ -51,7 +51,7 @@ jobs:
5151
- name: Setup PHP version
5252
uses: shivammathur/setup-php@v2
5353
with:
54-
php-version: '7.4'
54+
php-version: "7.4"
5555
extensions: simplexml, mysql
5656
tools: phpunit-polyfills
5757
- name: Checkout source code

composer.lock

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/settings.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,7 @@ span.error-message .components-external-link .components-visually-hidden{
17191719
margin-left: auto;
17201720
padding: 0;
17211721
height: auto;
1722+
box-shadow: none !important;
17221723
}
17231724
.fz-action-btn button {
17241725
display: flex;
@@ -1765,7 +1766,7 @@ span.error-message .components-external-link .components-visually-hidden{
17651766
position: relative;
17661767
}
17671768
.popover-action-list{
1768-
width: 250px;
1769+
width: 270px;
17691770
position: absolute;
17701771
left: 100%;
17711772
bottom: 0;
@@ -2020,7 +2021,8 @@ li.draggable-item .components-panel__body-toggle.components-button{
20202021
.fz-action-panel .fz-chat-cpt-action .components-notice {
20212022
width: 100%;
20222023
}
2023-
.fz-action-panel .fz-chat-cpt-action .components-panel__row {
2024+
.fz-action-panel .fz-chat-cpt-action .components-panel__row,
2025+
.fz-action-panel .fz-modify-links .components-panel__row {
20242026
display: block;
20252027
}
20262028
.fz-action-panel .fz-upgrade-notice {
@@ -2090,7 +2092,8 @@ li.draggable-item .components-panel__body-toggle.components-button{
20902092
cursor: not-allowed !important;
20912093
}
20922094

2093-
.fz-action-panel .fz-chat-cpt-action .fz-notice-wrap {
2095+
.fz-action-panel .fz-chat-cpt-action .fz-notice-wrap,
2096+
.fz-action-panel .fz-modify-links .fz-notice-wrap {
20942097
padding: 0;
20952098
}
20962099

feedzy-rss-feed.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function() {
161161
'location' => 'feedzy-admin-menu',
162162
'has_upgrade_menu' => ! feedzy_is_pro(),
163163
'upgrade_text' => esc_html__( 'Upgrade to Pro', 'feedzy-rss-feeds' ),
164-
'upgrade_link' => tsdk_utmify( FEEDZY_UPSELL_LINK, 'aboutUsPage' ),
164+
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'aboutUsPage' ), 'query' ),
165165
);
166166
}
167167
);
@@ -217,8 +217,8 @@ function feedzy_themeisle_log_event( $name, $msg, $type, $file, $line ) {
217217
'primary_color' => '#4268CF',
218218
'pages' => array( 'feedzy_imports', 'edit-feedzy_imports', 'edit-feedzy_categories', 'feedzy_page_feedzy-settings', 'feedzy_page_feedzy-support' ),
219219
'has_upgrade_menu' => ! feedzy_is_pro(),
220-
'upgrade_link' => tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ),
221-
'documentation_link' => tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ),
220+
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ), 'query' ),
221+
'documentation_link' => tsdk_translate_link( tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ), 'query' ),
222222
'wizard_link' => ! feedzy_is_pro() && ! empty( get_option( 'feedzy_fresh_install', false ) ) ? admin_url( 'admin.php?page=feedzy-setup-wizard&tab#step-1' ) : '',
223223
);
224224
}

form/form.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@
3232
$output .= '<div class="container feedzy_' . $item . '">';
3333
$output .= '<h5>' . $section['title'] . '</h5>';
3434
if ( ! feedzy_is_pro() && 'section_feed' === $item ) {
35-
$upsell_url = add_query_arg(
36-
array(
37-
'utm_source' => 'wpadmin',
38-
'utm_medium' => 'classiceditorshortcode',
39-
'utm_campaign' => 'amazonproductadvertising',
40-
'utm_content' => 'feedzy-rss-feeds',
41-
),
42-
FEEDZY_UPSELL_LINK
43-
);
35+
$upsell_url = tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'amazonproductadvertising', 'classiceditorshortcode' ), 'query' );
36+
4437
$output .= '<div class="upgrade-alert">';
45-
$output .= wp_sprintf( __( '<strong>NEW! </strong>Enable Amazon Product Advertising feeds to generate affiliate revenue by <a href="%s" target="_blank">upgrading to Feedzy Pro.</a>', 'feedzy-rss-feeds' ), esc_url_raw( $upsell_url ) );
38+
$output .= '<strong>' . __( 'NEW!', 'feedzy-rss-feeds' ) . '</strong>';
39+
$output .= wp_sprintf(
40+
// translators: %1$s: opening anchor tag, %2$s: closing anchor tag
41+
__( 'Enable Amazon Product Advertising feeds to generate affiliate revenue by %1$s upgrading to Feedzy Pro. %2$s', 'feedzy-rss-feeds' ),
42+
'<a target="_blank" href="' . esc_url( $upsell_url ) . '" >',
43+
'</a>'
44+
);
4645
$output .= '</div>';
4746
}
4847
if ( isset( $section['description'] ) ) {

includes/abstract/feedzy-rss-feeds-admin-abstract.php

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,13 @@ public function feedzy_default_error_notice( $errors, $feed, $feed_url ) {
208208
$final_msg = '';
209209

210210
if ( $show_error ) {
211-
$final_msg = '<div id="message" class="error"><p>' . sprintf( __( 'Sorry, some part of this feed is currently unavailable or does not exist anymore. The detailed error is %s', 'feedzy-rss-feeds' ), '<p style="font-weight: bold">' . wp_strip_all_tags( $error_msg ) . '</p>' );
211+
$final_msg = '<div id="message" class="error"><p>' . sprintf(
212+
// translators: %s: Detailed error message.
213+
__( 'Sorry, some part of this feed is currently unavailable or does not exist anymore. The detailed error is %s', 'feedzy-rss-feeds' ),
214+
'<p style="font-weight: bold">' . wp_strip_all_tags( $error_msg ) . '</p>'
215+
);
212216
if ( ! is_admin() ) {
213-
$final_msg .= sprintf( __( '%1$s(Only you are seeing this detailed error because you are the creator of this post. Other users will see the error message as below.)%2$s', 'feedzy-rss-feeds' ), '<small>', '</small>' );
217+
$final_msg .= '<small>(' . __( 'Only you are seeing this detailed error because you are the creator of this post. Other users will see the error message as below.', 'feedzy-rss-feeds' ) . ')</small>';
214218
}
215219
$final_msg .= '</p></div>';
216220
} else {
@@ -989,7 +993,13 @@ protected function get_valid_source_urls( $feed_url, $cache, $echo = true ) {
989993
$valid_feed_url[] = $url;
990994
} else {
991995
if ( $echo ) {
992-
echo wp_kses_post( sprintf( __( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ), '<b>' . esc_url( $url ) . '</b>' ) );
996+
echo wp_kses_post(
997+
sprintf(
998+
// translators: %s: Feed URL.
999+
__( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ),
1000+
'<b>' . esc_url( $url ) . '</b>'
1001+
)
1002+
);
9931003
}
9941004
}
9951005
}
@@ -1005,7 +1015,13 @@ protected function get_valid_source_urls( $feed_url, $cache, $echo = true ) {
10051015
$valid_feed_url[] = $feed_url;
10061016
} else {
10071017
if ( $echo ) {
1008-
echo wp_kses_post( sprintf( __( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ), '<b>' . esc_url( $feed_url ) . '</b>' ) );
1018+
echo wp_kses_post(
1019+
sprintf(
1020+
// translators: %s: Feed URL.
1021+
__( 'Feed URL: %s not valid and removed from fetch.', 'feedzy-rss-feeds' ),
1022+
'<b>' . esc_url( $feed_url ) . '</b>'
1023+
)
1024+
);
10091025
}
10101026
}
10111027
}
@@ -1245,7 +1261,11 @@ private function get_dry_run_results( $sc, $item ) {
12451261
if ( ! empty( $item['full_content_error'] ) ) {
12461262
$statuses[] = array(
12471263
'success' => false,
1248-
'msg' => sprintf( __( 'Full content: %s', 'feedzy-rss-feeds' ), $item['full_content_error'] ),
1264+
'msg' => sprintf(
1265+
// translators: %s: Error message for full content extraction.
1266+
__( 'Full content: %s', 'feedzy-rss-feeds' ),
1267+
$item['full_content_error']
1268+
),
12491269
);
12501270
} elseif ( isset( $item['item_full_content'] ) ) {
12511271
if ( ! empty( $item['item_full_content'] ) ) {
@@ -1740,6 +1760,11 @@ public function feedzy_retrieve_image( $item, $sc = null ) {
17401760
}
17411761

17421762
$the_thumbnail = html_entity_decode( $the_thumbnail, ENT_QUOTES, 'UTF-8' );
1763+
1764+
if ( isset( $sc['_dryrun_'] ) && 'yes' === $sc['_dryrun_'] ) {
1765+
return $the_thumbnail;
1766+
}
1767+
17431768
if ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) {
17441769
$feed_url = $this->normalize_urls( $sc['feeds'] );
17451770
$the_thumbnail = ! empty( $the_thumbnail ) ? $the_thumbnail : apply_filters( 'feedzy_default_image', $sc['default'], $feed_url );

includes/admin/feedzy-rss-feeds-actions.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ public function action_process() {
313313
return $this->summarize_content();
314314
case 'fz_image':
315315
return $this->generate_image();
316+
case 'modify_links':
317+
return $this->modify_links();
316318
default:
317319
return $this->default_content();
318320
}
@@ -510,5 +512,55 @@ private function generate_image() {
510512
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
511513
return $openai->call_api( $this->settings, $prompt, 'image', array() );
512514
}
515+
516+
/**
517+
* Modify links.
518+
*
519+
* @return string Item content.
520+
*/
521+
private function modify_links() {
522+
$content = call_user_func( array( $this, $this->current_job->tag ) );
523+
// Returns item content because it has no HTML tags
524+
if ( $content === wp_strip_all_tags( $content ) ) {
525+
return $content;
526+
}
527+
// Pro version is required to perform this action.
528+
if ( ! feedzy_is_pro() ) {
529+
return $content;
530+
}
531+
// converts all special characters to utf-8.
532+
$content = mb_convert_encoding( $content, 'HTML-ENTITIES', 'UTF-8' );
533+
534+
$dom = new DOMDocument( '1.0', 'utf-8' );
535+
libxml_use_internal_errors( true );
536+
$dom->loadHTML( $content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
537+
$xpath = new DOMXPath( $dom );
538+
libxml_clear_errors();
539+
// Get all anchors tags.
540+
$nodes = $xpath->query( '//a' );
541+
542+
foreach ( $nodes as $node ) {
543+
if ( ! empty( $this->current_job->data->remove_links ) ) {
544+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
545+
$node->parentNode->removeChild( $node );
546+
continue;
547+
}
548+
if ( ! empty( $this->current_job->data->target ) ) {
549+
$node->setAttribute( 'target', $this->current_job->data->target );
550+
}
551+
if ( ! empty( $this->current_job->data->follow ) && 'yes' === $this->current_job->data->follow ) {
552+
$node->setAttribute( 'rel', 'nofollow' );
553+
}
554+
}
555+
if ( ! empty( $this->current_job->data->follow ) && 'yes' === $this->current_job->data->follow ) {
556+
add_filter(
557+
'wp_targeted_link_rel',
558+
function() {
559+
return 'nofollow';
560+
}
561+
);
562+
}
563+
return $dom->saveHTML();
564+
}
513565
}
514566
}

includes/admin/feedzy-rss-feeds-admin.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public function render_upsell_rn() {
369369
<li>- Translate content</li>
370370
<li>- Elementor Templates support</li>
371371
</ul>';
372-
echo '<a class="button button-primary " href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'metabox', 'new-category' ) . '" target="_blank">View more details</a>';
372+
echo '<a class="button button-primary " href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'metabox', 'new-category' ), 'query' ) ) . '" target="_blank">View more details</a>';
373373

374374
}
375375

@@ -389,10 +389,17 @@ public function feedzy_category_feed() {
389389

390390
$output = '
391391
<input type="hidden" name="feedzy_category_meta_noncename" id="feedzy_category_meta_noncename" value="' . $nonce . '" />
392-
<strong>' . sprintf( __( 'Please be aware that multiple feeds, when mashed together, may sometimes not work as expected as explained %1$shere%2$s.', 'feedzy-rss-feeds' ), '<a href="http://simplepie.org/wiki/faq/typical_multifeed_gotchas" target="_blank">', '</a>' ) . '</strong><br/><br/>'
392+
<strong>' .
393+
sprintf(
394+
// translators: %1$s and %2$s are placeholders for HTML anchor tags.
395+
__( 'Please be aware that multiple feeds, when mashed together, may sometimes not work as expected as explained %1$s here %2$s.', 'feedzy-rss-feeds' ),
396+
'<a href="' . esc_url( 'https://simplepie.org/wiki/faq/typical_multifeed_gotchas' ) . '" target="_blank">',
397+
'</a>'
398+
)
399+
. '</strong><br/><br/>'
393400
. $invalid
394401
. '<textarea name="feedzy_category_feed" rows="15" class="widefat" placeholder="' . __( 'Place your URL\'s here followed by a comma.', 'feedzy-rss-feeds' ) . '" >' . $feed . '</textarea>
395-
<p><a href="https://docs.themeisle.com/article/1119-feedzy-rss-feeds-documentation#categories" target="_blank">' . __( 'Learn how to organize feeds in Categories', 'feedzy-rss-feeds' ) . '</a></p>
402+
<p><a href="' . esc_url( 'https://docs.themeisle.com/article/1119-feedzy-rss-feeds-documentation#categories' ) . '" target="_blank">' . __( 'Learn how to organize feeds in Categories', 'feedzy-rss-feeds' ) . '</a></p>
396403
';
397404
echo wp_kses( $output, apply_filters( 'feedzy_wp_kses_allowed_html', array() ) );
398405
}
@@ -540,9 +547,9 @@ public function feedzy_filter_plugin_row_meta( $links, $file ) {
540547
$new_links['doc'] = '<a href="https://docs.themeisle.com/article/658-feedzy-rss-feeds" target="_blank" title="' . __( 'Documentation and examples', 'feedzy-rss-feeds' ) . '">' . __( 'Documentation and examples', 'feedzy-rss-feeds' ) . '</a>';
541548

542549
if ( ! feedzy_is_pro() ) {
543-
$new_links['more_features'] = '<a href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmeta', 'plugins' ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade to Pro', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
550+
$new_links['more_features'] = '<a href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmeta', 'plugins' ), 'query' ) ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade to Pro', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
544551
} elseif ( false === apply_filters( 'feedzy_is_license_of_type', false, 'agency' ) ) {
545-
$new_links['more_features'] = '<a href="' . tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmetamore', 'plugins' ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade your license', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
552+
$new_links['more_features'] = '<a href="' . esc_url( tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'rowmetamore', 'plugins' ), 'query' ) ) . '" target="_blank" title="' . __( 'More Features', 'feedzy-rss-feeds' ) . '">' . __( 'Upgrade your license', 'feedzy-rss-feeds' ) . '<i style="width: 17px; height: 17px; margin-left: 4px; color: #ffca54; font-size: 17px; vertical-align: -3px;" class="dashicons dashicons-unlock more-features-icon"></i></a>';
546553
}
547554
$links = array_merge( $links, $new_links );
548555
}

0 commit comments

Comments
 (0)