Skip to content

Commit 85fd914

Browse files
Merge branch 'development' into feat/conditions
2 parents b8b3d0a + 44c9900 commit 85fd914

24 files changed

+692
-107
lines changed

.distignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ js/Conditions/
2222
js/Onboarding/
2323
js/ActionPopup/
2424
js/FeedBack/
25+
js/Review/
2526
webpack.config.js
2627
dist
2728
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
@@ -615,6 +615,15 @@ fieldset[disabled] .form-control {
615615
background: #D0D4D7;
616616
}
617617

618+
.fz-form-wrap .chosen-container .chosen-results li.helper-text {
619+
display: block;
620+
background: white;
621+
cursor: help;
622+
font-size: 12px;
623+
text-align: center;
624+
color: #757575;
625+
}
626+
618627
.date-range-group{
619628
display: flex;
620629
align-items: flex-end;
@@ -2449,3 +2458,11 @@ li.draggable-item .components-panel__body-toggle.components-button{
24492458
.fz-panel-tab .fz-panel-tab__content .components-base-control .components-datetime__timezone {
24502459
display: inline-block;
24512460
}
2461+
.fz-prompt-button {
2462+
gap: 7px;
2463+
display: flex;
2464+
margin-top: 10px;
2465+
}
2466+
.fz-prompt-button button.components-button {
2467+
height: 28px;
2468+
}

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 );
@@ -268,6 +268,12 @@ public function enqueue_styles_admin() {
268268
wp_set_script_translations( $this->plugin_name . '_feedback', 'feedzy-rss-feeds' );
269269
}
270270

271+
if ( 'feedzy_imports' === $screen->post_type && 'edit' === $screen->base && feedzy_show_review_notice() ) {
272+
$asset_file = include FEEDZY_ABSPATH . '/build/review/index.asset.php';
273+
wp_enqueue_script( $this->plugin_name . '_review', FEEDZY_ABSURL . 'build/review/index.js', $asset_file['dependencies'], $asset_file['version'], true );
274+
wp_set_script_translations( $this->plugin_name . '_review', 'feedzy-rss-feeds' );
275+
}
276+
271277
wp_enqueue_style( $this->plugin_name . '-settings', FEEDZY_ABSURL . 'css/settings.css', array(), $this->version );
272278
wp_enqueue_style( $this->plugin_name . '-metabox', FEEDZY_ABSURL . 'css/metabox-settings.css', array( $this->plugin_name . '-settings' ), $this->version );
273279
}
@@ -633,6 +639,17 @@ public function feedzy_menu_pages() {
633639
'feedzy_settings_page',
634640
)
635641
);
642+
add_submenu_page(
643+
'feedzy-admin-menu',
644+
__( 'Integration', 'feedzy-rss-feeds' ),
645+
__( 'Integration', 'feedzy-rss-feeds' ),
646+
'manage_options',
647+
'feedzy-integration',
648+
array(
649+
$this,
650+
'feedzy_integration_page',
651+
)
652+
);
636653
add_submenu_page(
637654
'feedzy-admin-menu',
638655
__( 'Support', 'feedzy-rss-feeds' ),
@@ -677,6 +694,21 @@ public function feedzy_settings_page() {
677694
include FEEDZY_ABSPATH . '/includes/layouts/settings.php';
678695
}
679696

697+
/**
698+
* Method to register the integration page.
699+
*
700+
* @access public
701+
*/
702+
public function feedzy_integration_page() {
703+
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 ) ) ) {
704+
$this->save_settings();
705+
$this->notice = __( 'Your settings were saved.', 'feedzy-rss-feeds' );
706+
}
707+
708+
$settings = apply_filters( 'feedzy_get_settings', array() );
709+
include FEEDZY_ABSPATH . '/includes/layouts/integration.php';
710+
}
711+
680712
/**
681713
* Method to save the settings.
682714
*
@@ -1634,6 +1666,7 @@ public function api_license_status() {
16341666
'wordaiStatus' => false,
16351667
'openaiStatus' => false,
16361668
'amazonStatus' => false,
1669+
'openRouterStatus' => false,
16371670
);
16381671

16391672
if ( ! feedzy_is_pro() ) {
@@ -1655,6 +1688,12 @@ public function api_license_status() {
16551688
}
16561689
}
16571690

1691+
if ( isset( $pro_options['openrouter_licence'] ) && 'yes' === $pro_options['openrouter_licence'] ) {
1692+
if ( apply_filters( 'feedzy_is_license_of_type', false, 'business' ) || apply_filters( 'feedzy_is_license_of_type', false, 'agency' ) ) {
1693+
$data['openRouterStatus'] = true;
1694+
}
1695+
}
1696+
16581697
if ( ! empty( $pro_options['amazon_access_key'] ) && ! empty( $pro_options['amazon_secret_key'] ) ) {
16591698
$data['amazonStatus'] = true;
16601699
}
@@ -1989,4 +2028,19 @@ public function get_lang_list() {
19892028

19902029
return $target_lang;
19912030
}
2031+
2032+
/**
2033+
* Register settings.
2034+
*/
2035+
public function register_settings() {
2036+
register_setting(
2037+
'feedzy',
2038+
'feedzy_review_notice',
2039+
array(
2040+
'type' => 'string',
2041+
'default' => 'no',
2042+
'show_in_rest' => true
2043+
)
2044+
);
2045+
}
19922046
}

0 commit comments

Comments
 (0)