Skip to content

Commit

Permalink
Merge pull request #903 from Codeinwp/fix/full-content-import-source-…
Browse files Browse the repository at this point in the history
…per-feed

feat: add tag parsing for feed source generated by endpoint
  • Loading branch information
vytisbulkevicius authored Mar 28, 2024
2 parents 63a31ea + 3777a5e commit 19b0e4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
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

0 comments on commit 19b0e4f

Please sign in to comment.