Skip to content

Commit

Permalink
release: fixes
Browse files Browse the repository at this point in the history
### Fixes
- Separated settings in the General section
- Enhanced security
  • Loading branch information
vytisbulkevicius authored Jan 12, 2024
2 parents 75a5fef + 03ae27b commit 6b293e6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion includes/abstract/feedzy-rss-feeds-admin-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ function() {
$feed = $this->init_feed( $feed_url, $cache, $sc, false );
} elseif ( is_string( $feed_url ) || ( is_array( $feed_url ) && 1 === count( $feed_url ) ) ) {
do_action( 'themeisle_log_event', FEEDZY_NAME, 'Trying to use raw data', 'debug', __FILE__, __LINE__ );
$data = wp_remote_retrieve_body( wp_remote_get( $feed_url, array( 'user-agent' => $default_agent ) ) );
$data = wp_remote_retrieve_body( wp_safe_remote_get( $feed_url, array( 'user-agent' => $default_agent ) ) );
$cloned_feed->set_raw_data( $data );
$cloned_feed->init();
$error_raw = $cloned_feed->error();
Expand Down
1 change: 0 additions & 1 deletion includes/admin/feedzy-rss-feeds-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ private function save_settings() {
$settings = apply_filters( 'feedzy_get_settings', array() );
switch ( $post_tab ) {
case 'general':
$settings['general']['rss-feeds'] = isset( $_POST['rss-feeds'] ) ? (int) filter_input( INPUT_POST, 'rss-feeds', FILTER_SANITIZE_NUMBER_INT ) : '';
$settings['general']['disable-default-style'] = isset( $_POST['disable-default-style'] ) ? (int) filter_input( INPUT_POST, 'disable-default-style', FILTER_SANITIZE_NUMBER_INT ) : '';
$settings['general']['feedzy-delete-days'] = isset( $_POST['feedzy-delete-days'] ) ? (int) filter_input( INPUT_POST, 'feedzy-delete-days', FILTER_SANITIZE_NUMBER_INT ) : '';
$settings['general']['default-thumbnail-id'] = isset( $_POST['default-thumbnail-id'] ) ? (int) filter_input( INPUT_POST, 'default-thumbnail-id', FILTER_SANITIZE_NUMBER_INT ) : 0;
Expand Down
1 change: 1 addition & 0 deletions includes/admin/feedzy-rss-feeds-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -2204,6 +2204,7 @@ public function save_tab_settings( $settings, $tab ) {

if ( 'misc' === $tab ) {
$settings['canonical'] = isset( $_POST['canonical'] ) ? filter_input( INPUT_POST, 'canonical', FILTER_SANITIZE_NUMBER_INT ) : 0;
$settings['general']['rss-feeds'] = isset( $_POST['rss-feeds'] ) ? (int) filter_input( INPUT_POST, 'rss-feeds', FILTER_SANITIZE_NUMBER_INT ) : '';
}

return $settings;
Expand Down
24 changes: 11 additions & 13 deletions includes/layouts/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ class="<?php echo $_tab === $active_tab ? esc_attr( 'active' ) : ''; ?>"><?php e

<form method="post" action="">
<?php
$disble_featured_image = '';
if ( isset( $settings['general']['rss-feeds'] ) && 1 === intval( $settings['general']['rss-feeds'] ) ) {
$disble_featured_image = 'checked';
}

$disble_default_style = 0;
if ( isset( $settings['general']['disable-default-style'] ) && 1 === intval( $settings['general']['disable-default-style'] ) ) {
$disble_default_style = 1;
Expand All @@ -115,13 +110,7 @@ class="<?php echo $_tab === $active_tab ? esc_attr( 'active' ) : ''; ?>"><?php e
<div class="fz-form-wrap">
<div class="form-block">
<div class="fz-form-group">
<div class="fz-form-switch pb-16">
<input type="checkbox" id="rss-feeds" class="fz-switch-toggle" name="rss-feeds"
value="1" <?php echo esc_html( $disble_featured_image ); ?> />
<label for="rss-feeds" class="form-label"><?php echo esc_html_e( 'Do NOT add the featured image to the website\'s RSS feed.', 'feedzy-rss-feeds' ); ?></label>
</div>
</div>
<div class="fz-form-group">
<label for="feed-post-default-thumbnail" class="form-label"><?php echo esc_html_e( 'Fallback image for imported posts', 'feedzy-rss-feeds' ); ?></label>
<div class="help-text pb-8"><?php esc_html_e( 'Select an image to be the fallback featured image(Feed2Post).', 'feedzy-rss-feeds' ); ?></div>
<?php
$btn_label = esc_html__( 'Choose image', 'feedzy-rss-feeds' );
Expand All @@ -137,7 +126,16 @@ class="<?php echo $_tab === $active_tab ? esc_attr( 'active' ) : ''; ?>"><?php e
<a href="javascript:;" class="feedzy-remove-media btn btn-outline-primary <?php echo $default_thumbnail_id ? esc_attr( 'is-show' ) : ''; ?>"><?php esc_html_e( 'Remove', 'feedzy-rss-feeds' ); ?></a>
<input type="hidden" name="default-thumbnail-id" id="feed-post-default-thumbnail" value="<?php echo esc_attr( $default_thumbnail_id ); ?>">
</div>
<div class="help-text"><?php esc_html_e( 'This image will be used for the Feed Items that don\'t have one.', 'feedzy-rss-feeds' ); ?></div>
<div class="help-text">
<?php
echo wp_kses(
__( 'This image will be used for the <strong>imported posts</strong> if an image is not available in the source XML Feed.', 'feedzy-rss-feeds' ),
array(
'strong' => true,
)
);
?>
</div>
</div>
</div>
<div class="form-block">
Expand Down
16 changes: 16 additions & 0 deletions includes/views/misc-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,20 @@
</div>
</div>
</div>
<div class="form-block">
<div class="fz-form-group">
<div class="fz-form-switch">
<?php
$disble_featured_image = '';
if ( isset( $this->free_settings['general']['rss-feeds'] ) && 1 === intval( $this->free_settings['general']['rss-feeds'] ) ) {
$disble_featured_image = 'checked';
}
?>
<input type="checkbox" id="rss-feeds" class="fz-switch-toggle" name="rss-feeds"
value="1" <?php echo esc_html( $disble_featured_image ); ?> />
<label for="rss-feeds" class="form-label"><?php echo esc_html_e( 'Do NOT add the featured image to the website\'s RSS feed.', 'feedzy-rss-feeds' ); ?></label>
</div>
<div class="help-text pb-8"><?php esc_html_e( 'This setting controls whether there are featured images available in the RSS XML Feed of your own website.', 'feedzy-rss-feeds' ); ?></div>
</div>
</div>
</div>

0 comments on commit 6b293e6

Please sign in to comment.