Skip to content

Commit 0230179

Browse files
committed
Merge branch 'development' into various
# Conflicts: # includes/feedzy-rss-feeds.php
2 parents c8d07c4 + 44c9900 commit 0230179

24 files changed

+692
-107
lines changed

.distignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ js/FeedzyBlock
2121
js/Onboarding/
2222
js/ActionPopup/
2323
js/FeedBack/
24+
js/Review/
2425
webpack.config.js
2526
dist
2627
cypress

css/feedzy-rss-feed-import.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@
5454
float: none;
5555
}
5656
.feedzy_page_feedzy-settings #wpcontent,
57-
.feedzy_page_feedzy-support #wpcontent{
57+
.feedzy_page_feedzy-support #wpcontent,
58+
.feedzy_page_feedzy-integration #wpcontent{
5859
padding-left: 0;
5960
}
6061
.feedzy_page_feedzy-settings .feedzy-header,
61-
.feedzy_page_feedzy-support .feedzy-header{
62+
.feedzy_page_feedzy-support .feedzy-header,
63+
.feedzy_page_feedzy-integration .feedzy-header{
6264
margin-bottom: 40px;
6365
}
6466
.feedzy-api-error,

css/settings.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,15 @@ fieldset[disabled] .form-control {
617617
background: #D0D4D7;
618618
}
619619

620+
.fz-form-wrap .chosen-container .chosen-results li.helper-text {
621+
display: block;
622+
background: white;
623+
cursor: help;
624+
font-size: 12px;
625+
text-align: center;
626+
color: #757575;
627+
}
628+
620629
.date-range-group{
621630
display: flex;
622631
align-items: flex-end;
@@ -2361,4 +2370,12 @@ li.draggable-item .components-panel__body-toggle.components-button{
23612370
.feedzy-optimole-upsell .pro-label.free-label {
23622371
color: #4268CF;
23632372
background: rgba(66, 104, 207, 0.20);
2373+
}
2374+
.fz-prompt-button {
2375+
gap: 7px;
2376+
display: flex;
2377+
margin-top: 10px;
2378+
}
2379+
.fz-prompt-button button.components-button {
2380+
height: 28px;
23642381
}

feedzy-rss-feed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function feedzy_themeisle_log_event( $name, $msg, $type, $file, $line ) {
253253
'nice_name' => 'Feedzy',
254254
'logo' => FEEDZY_ABSURL . 'img/feedzy.svg',
255255
'primary_color' => '#4268CF',
256-
'pages' => array( 'feedzy_imports', 'edit-feedzy_imports', 'edit-feedzy_categories', 'feedzy_page_feedzy-settings', 'feedzy_page_feedzy-support' ),
256+
'pages' => array( 'feedzy_imports', 'edit-feedzy_imports', 'edit-feedzy_categories', 'feedzy_page_feedzy-settings', 'feedzy_page_feedzy-support', 'feedzy_page_feedzy-integration' ),
257257
'has_upgrade_menu' => ! feedzy_is_pro(),
258258
'upgrade_link' => tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'floatWidget' ), 'query' ),
259259
'documentation_link' => tsdk_translate_link( tsdk_utmify( 'https://docs.themeisle.com/collection/1569-feedzy-rss-feeds', 'floatWidget' ), 'query' ),

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

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,17 @@ private function chat_gpt_rewrite() {
472472
return $this->current_job->data->ChatGPT;
473473
}
474474

475-
$content = call_user_func( array( $this, $this->current_job->tag ) );
476-
$content = wp_strip_all_tags( $content );
477-
$content = substr( $content, 0, apply_filters( 'feedzy_chat_gpt_content_limit', 3000 ) );
478-
$prompt_content = $this->current_job->data->ChatGPT;
475+
$content = call_user_func( array( $this, $this->current_job->tag ) );
476+
$content = wp_strip_all_tags( $content );
477+
$content = substr( $content, 0, apply_filters( 'feedzy_chat_gpt_content_limit', 3000 ) );
478+
$prompt_content = $this->current_job->data->ChatGPT;
479+
$ai_provider = 'openai';
480+
if ( isset( $this->current_job->data ) && isset( $this->current_job->data->aiProvider ) ) {
481+
$ai_provider = $this->current_job->data->aiProvider;
482+
}
479483
$content = str_replace( array( '{content}' ), array( $content ), $prompt_content );
480484
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
481-
$rewrite_content = $openai->call_api( $this->settings, $content, '', array() );
485+
$rewrite_content = $openai->call_api( $this->settings, $content, '', array( 'ai_provider' => $ai_provider ) );
482486
// Replace prompt content string for specific cases.
483487
$rewrite_content = str_replace( explode( '{content}', $prompt_content ), '', trim( $rewrite_content, '"' ) );
484488
return $rewrite_content;
@@ -494,9 +498,12 @@ private function summarize_content() {
494498
if ( ! class_exists( '\Feedzy_Rss_Feeds_Pro_Openai' ) ) {
495499
return $content;
496500
}
497-
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
498-
$content = $openai->call_api( $this->settings, $content, 'summarize', array() );
499-
return $content;
501+
if ( isset( $this->current_job->data->fz_summarize ) ) {
502+
unset( $this->current_job->data->fz_summarize );
503+
}
504+
// Summarizes the content using the `Rewrite with AI` action, ensuring backward compatibility.
505+
$this->current_job->data->ChatGPT = 'Summarize this article {content} for better SEO.';
506+
return $this->chat_gpt_rewrite();
500507
}
501508

502509
/**
@@ -517,6 +524,9 @@ private function generate_image() {
517524
}
518525

519526
$prompt = call_user_func( array( $this, 'item_title' ) );
527+
if ( ! empty( $this->current_job->data->generateImagePrompt ) ) {
528+
$prompt .= "\r\n" . $this->current_job->data->generateImagePrompt;
529+
}
520530
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
521531
return $openai->call_api( $this->settings, $prompt, 'image', array() );
522532
}

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

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ public function enqueue_styles_admin() {
162162
$this->add_banner_anchor();
163163
}
164164

165-
if ( 'feedzy_page_feedzy-settings' === $screen->base ) {
166-
if ( ! did_action( 'wp_enqueue_media' ) ) {
165+
if ( 'feedzy_page_feedzy-settings' === $screen->base || 'feedzy_page_feedzy-integration' === $screen->base ) {
166+
if ( ! did_action( 'wp_enqueue_media' ) && 'feedzy_page_feedzy-settings' === $screen->base ) {
167167
wp_enqueue_media();
168168
}
169169
wp_enqueue_script( $this->plugin_name . '_setting', FEEDZY_ABSURL . 'js/feedzy-setting.js', array( 'jquery' ), $this->version, true );
@@ -247,6 +247,12 @@ public function enqueue_styles_admin() {
247247
wp_set_script_translations( $this->plugin_name . '_feedback', 'feedzy-rss-feeds' );
248248
}
249249

250+
if ( 'feedzy_imports' === $screen->post_type && 'edit' === $screen->base && feedzy_show_review_notice() ) {
251+
$asset_file = include FEEDZY_ABSPATH . '/build/review/index.asset.php';
252+
wp_enqueue_script( $this->plugin_name . '_review', FEEDZY_ABSURL . 'build/review/index.js', $asset_file['dependencies'], $asset_file['version'], true );
253+
wp_set_script_translations( $this->plugin_name . '_review', 'feedzy-rss-feeds' );
254+
}
255+
250256
wp_enqueue_style( $this->plugin_name . '-settings', FEEDZY_ABSURL . 'css/settings.css', array(), $this->version );
251257
wp_enqueue_style( $this->plugin_name . '-metabox', FEEDZY_ABSURL . 'css/metabox-settings.css', array( $this->plugin_name . '-settings' ), $this->version );
252258
}
@@ -854,6 +860,17 @@ public function feedzy_menu_pages() {
854860
'feedzy_settings_page',
855861
)
856862
);
863+
add_submenu_page(
864+
'feedzy-admin-menu',
865+
__( 'Integration', 'feedzy-rss-feeds' ),
866+
__( 'Integration', 'feedzy-rss-feeds' ),
867+
'manage_options',
868+
'feedzy-integration',
869+
array(
870+
$this,
871+
'feedzy_integration_page',
872+
)
873+
);
857874
add_submenu_page(
858875
'feedzy-admin-menu',
859876
__( 'Support', 'feedzy-rss-feeds' ),
@@ -922,6 +939,21 @@ public function feedzy_settings_page() {
922939
include FEEDZY_ABSPATH . '/includes/layouts/settings.php';
923940
}
924941

942+
/**
943+
* Method to register the integration page.
944+
*
945+
* @access public
946+
*/
947+
public function feedzy_integration_page() {
948+
if ( isset( $_POST['feedzy-integration-submit'] ) && isset( $_POST['tab'] ) && wp_verify_nonce( filter_input( INPUT_POST, 'nonce', FILTER_UNSAFE_RAW ), filter_input( INPUT_POST, 'tab', FILTER_UNSAFE_RAW ) ) ) {
949+
$this->save_settings();
950+
$this->notice = __( 'Your settings were saved.', 'feedzy-rss-feeds' );
951+
}
952+
953+
$settings = apply_filters( 'feedzy_get_settings', array() );
954+
include FEEDZY_ABSPATH . '/includes/layouts/integration.php';
955+
}
956+
925957
/**
926958
* Method to save the settings.
927959
*
@@ -1896,6 +1928,7 @@ public function api_license_status() {
18961928
'wordaiStatus' => false,
18971929
'openaiStatus' => false,
18981930
'amazonStatus' => false,
1931+
'openRouterStatus' => false,
18991932
);
19001933

19011934
if ( ! feedzy_is_pro() ) {
@@ -1917,6 +1950,12 @@ public function api_license_status() {
19171950
}
19181951
}
19191952

1953+
if ( isset( $pro_options['openrouter_licence'] ) && 'yes' === $pro_options['openrouter_licence'] ) {
1954+
if ( apply_filters( 'feedzy_is_license_of_type', false, 'business' ) || apply_filters( 'feedzy_is_license_of_type', false, 'agency' ) ) {
1955+
$data['openRouterStatus'] = true;
1956+
}
1957+
}
1958+
19201959
if ( ! empty( $pro_options['amazon_access_key'] ) && ! empty( $pro_options['amazon_secret_key'] ) ) {
19211960
$data['amazonStatus'] = true;
19221961
}
@@ -2251,4 +2290,19 @@ public function get_lang_list() {
22512290

22522291
return $target_lang;
22532292
}
2293+
2294+
/**
2295+
* Register settings.
2296+
*/
2297+
public function register_settings() {
2298+
register_setting(
2299+
'feedzy',
2300+
'feedzy_review_notice',
2301+
array(
2302+
'type' => 'string',
2303+
'default' => 'no',
2304+
'show_in_rest' => true
2305+
)
2306+
);
2307+
}
22542308
}

0 commit comments

Comments
 (0)