Skip to content

Commit

Permalink
release: fixes
Browse files Browse the repository at this point in the history
### Fixes
- Allow adding content in the title field before the magic tag
- Updated Internal dependencies
- Fixed issue with feed's featured image being overwritten by ChatGPT image generation even when present [PRO]
  • Loading branch information
vytisbulkevicius authored Mar 29, 2024
2 parents 2533ef6 + 6b1f148 commit 7b249a1
Show file tree
Hide file tree
Showing 15 changed files with 171 additions and 138 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/pr_verify_linked_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Verify PR

on:
pull_request:
types: [ edited, synchronize, opened, reopened ]
types: [edited, synchronize, opened, reopened]
branches:
- development
check_run:
Expand All @@ -19,13 +19,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
with:
quiet: 'true'
quiet: "true"
- name: Find Comment
uses: peter-evans/find-comment@v1
id: find_coomment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'pirate-bot'
comment-author: "pirate-bot"
body-includes: No Linked Issue found
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
Expand All @@ -41,9 +41,9 @@ jobs:
if: steps.verify_linked_issues.outputs.has_linked_issues == 'false'
run: exit 1;
- name: Delete comment
uses: jungwinter/comment@v1
uses: winterjung/comment@v1
if: steps.verify_linked_issues.outputs.has_linked_issues == 'true' && steps.find_coomment.outputs.comment-id != ''
with:
type: delete
comment_id: ${{ steps.find_coomment.outputs.comment-id }}
token: ${{ secrets.BOT_TOKEN }}
token: ${{ secrets.BOT_TOKEN }}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"source": "https://github.com/Codeinwp/feedzy-rss-feeds"
},
"require": {
"codeinwp/themeisle-sdk": "^3.2"
"codeinwp/themeisle-sdk": "^3.3"
},
"autoload": {
"files": [
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions css/metabox-settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
.fz-input-group{flex-wrap: wrap;}
.fz-input-group .fz-input-group-right{width: 100%; padding-left: 0; padding-top: 8px;}
.fz-input-group .fz-input-group-right .btn.dropdown-toggle{width: 100%;}
.fz-form-wrap .form-block.form-block-two-column .left{width: 100%; padding-right: 0; padding-bottom: 24px;}
.fz-form-wrap .form-block.form-block-two-column .right{width: 100%;}
.fz-form-action .left{width: 100%; padding-bottom: 16px;}
.fz-form-action .left .btn{width: 100%; display: block; text-align: center;}
.fz-form-action .right{width: 100%; flex-direction: column;}
.fz-form-action .right .btn + .btn{margin-left: 0; margin-top: 8px;}
.fz-form-wrap .form-block.form-block-two-column .fz-left{width: 100%; padding-right: 0; padding-bottom: 24px;}
.fz-form-wrap .form-block.form-block-two-column .fz-right{width: 100%;}
.fz-form-action .fz-left{width: 100%; padding-bottom: 16px;}
.fz-form-action .fz-left .btn{width: 100%; display: block; text-align: center;}
.fz-form-action .fz-right{width: 100%; flex-direction: column;}
.fz-form-action .fz-right .btn + .btn{margin-left: 0; margin-top: 8px;}
.fz-form-row .fz-form-col-6, .fz-form-row .fz-form-col-4, .fz-form-row .fz-form-col-8{width: 100%;}
.fz-document-list > ul > li{width: 100%;}
.fz-help-improve-box .left{width: 100%;}
.fz-help-improve-box .right{width: 100%;}
.fz-help-improve-box .fz-left{width: 100%;}
.fz-help-improve-box .fz-right{width: 100%;}
.fz-tabs-menu ul {flex-wrap: wrap;}
.fz-tabs-menu ul li{flex-shrink: 0; width: 50%;}
.fz-tabs-menu ul li a{padding: 0px; border: 1px solid transparent;}
Expand Down
25 changes: 13 additions & 12 deletions css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,15 @@ fieldset[disabled] .form-control {
display: flex;
flex-wrap: wrap;
}
.fz-form-wrap .form-block.form-block-two-column .left{
.fz-form-wrap .form-block.form-block-two-column .fz-left{
width: 285px;
padding-right: 24px;
}
.fz-form-wrap .form-block.form-block-two-column .right{
.fz-form-wrap .form-block.form-block-two-column .fz-right{
width: calc(100% - 285px);
text-align: left;
}
.fz-form-wrap .form-block.form-block-two-column .right .upgrade-alert{
.fz-form-wrap .form-block.form-block-two-column .fz-right .upgrade-alert{
margin-top: 20px;
}
.fz-form-wrap .form-block .only-pro-content{
Expand Down Expand Up @@ -666,14 +667,14 @@ input.fz-switch-toggle[type=checkbox]:checked:before{
flex-wrap: wrap;
justify-content: space-between;
}
.fz-form-action .right{
.fz-form-action .fz-right{
display: flex;
flex-wrap: wrap;
}
.fz-form-action .right .btn{
.fz-form-action .fz-right .btn{
margin-bottom: 8px;
}
.fz-form-action .right .btn + .btn{
.fz-form-action .fz-right .btn + .btn{
margin-left: 16px;
}

Expand Down Expand Up @@ -901,9 +902,9 @@ input.fz-switch-toggle[type=checkbox]:checked:before{
}
.fz-form-wrap .tagify__tag{
position: relative;
margin-left: 0;
margin-right: 16px;
margin-bottom: 16px;
margin-left: 2px;
margin-right: 2px;
margin-bottom: 2px;
vertical-align: top;
}
.fz-form-wrap .tagify__tag>div{
Expand Down Expand Up @@ -1310,18 +1311,18 @@ input.fz-switch-toggle[type=checkbox]:checked:before{
flex-direction: row-reverse;
border: 1px solid #D9D9D9;
}
.fz-help-improve-box .left{
.fz-help-improve-box .fz-left{
width: calc(100% - 320px);
padding: 30px;
}
.fz-help-improve-box .left p{
.fz-help-improve-box .fz-left p{
font-size: 16px;
line-height: 24px;
color: #050505;
margin-bottom: 24px;
max-width: 710px;
}
.fz-help-improve-box .right{
.fz-help-improve-box .fz-right{
width: 320px;
padding: 18px;
background-color: #F5F7F9;
Expand Down
1 change: 1 addition & 0 deletions feedzy-rss-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function run_feedzy_rss_feeds() {
define( 'FEEDZY_REST_VERSION', '1' );
// to redirect all themeisle_log_event to error log.
define( 'FEEDZY_LOCAL_DEBUG', false );
define( 'FEEDZY_FEED_CUSTOM_TAG_NAMESPACE', 'http://feedzy.themeisle.com' );

// always make this true before testing
// also used in gutenberg.
Expand Down
22 changes: 14 additions & 8 deletions includes/abstract/feedzy-rss-feeds-admin-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ public function get_short_code_attributes( $atts ) {
*
* @param string $raw Url or list of urls.
*
* @return mixed|void Urls of the feeds.
* @return string|array<string> Urls of the feeds.
*/
public function normalize_urls( $raw ) {
$feeds = apply_filters( 'feedzy_process_feed_source', $raw );
Expand Down Expand Up @@ -1412,12 +1412,12 @@ public function get_feed_array( $feed_items, $sc, $feed, $feed_url, $sizes ) {
* @since 3.0.0
* @access private
*
* @param array $sc The shorcode attributes array.
* @param array $sizes The sizes array.
* @param object $item The feed item object.
* @param string $feed_url The feed url.
* @param int $index The item number (may not be the same as the item_index).
* @param int $item_index The real index of this items in the feed (maybe be different from $index if filters are used).
* @param array $sc The shorcode attributes array.
* @param array $sizes The sizes array.
* @param \SimplePie_Item $item The feed item object.
* @param string $feed_url The feed url.
* @param int $index The item number (may not be the same as the item_index).
* @param int $item_index The real index of this items in the feed (maybe be different from $index if filters are used).
*
* @return array
*/
Expand Down Expand Up @@ -1515,8 +1515,14 @@ private function get_feed_item_filter( $sc, $sizes, $item, $feed_url, $index, $i

// multiple sources?
$is_multiple = is_array( $feed_url );
$feed_source = $item->get_feed()->get_title();

$feed_source = '';
$feed_source_tags = $item->get_item_tags( FEEDZY_FEED_CUSTOM_TAG_NAMESPACE, 'parent-source' );
if ( ! empty( $feed_source_tags ) && ! empty( $feed_source_tags[0]['data'] ) ) {
$feed_source = $feed_source_tags[0]['data'];
} else {
$feed_source = $item->get_feed()->get_title();
}
// author.
if ( $item->get_author() && $meta_args['author'] ) {
$author = $item->get_author();
Expand Down
18 changes: 11 additions & 7 deletions includes/admin/feedzy-rss-feeds-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,21 +453,25 @@ private function summarize_content() {
}

/**
* Generate item image.
* Generate item image using OpenAI.
* Return default value if OpenAI is not available or `Generate only for missing images` option is enabled and feed has image.
*
* @return string
* @return string Image URL to download.
*/
private function generate_image() {
$content = call_user_func( array( $this, 'item_title' ) );

if ( ! class_exists( '\Feedzy_Rss_Feeds_Pro_Openai' ) ) {
return isset( $this->default_value ) ? $this->default_value : '';
}
if ( $this->current_job->data->generateImgWithChatGPT && empty( $this->default_value ) ) {

$feed_has_image = false !== filter_var( $this->default_value, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED );
if ( ( ! isset( $this->current_job->data->generateOnlyMissingImages ) || ! empty( $this->current_job->data->generateOnlyMissingImages ) ) && $feed_has_image ) {
return isset( $this->default_value ) ? $this->default_value : '';
}
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
$content = $openai->call_api( $this->settings, $content, 'image', array() );
return $content;

$prompt = call_user_func( array( $this, 'item_title' ) );
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
return $openai->call_api( $this->settings, $prompt, 'image', array() );
}
}
}
Loading

0 comments on commit 7b249a1

Please sign in to comment.