diff --git a/includes/admin/feedzy-rss-feeds-admin.php b/includes/admin/feedzy-rss-feeds-admin.php index a0b4ae18..50cf3a51 100644 --- a/includes/admin/feedzy-rss-feeds-admin.php +++ b/includes/admin/feedzy-rss-feeds-admin.php @@ -1978,6 +1978,10 @@ public function feedzy_load_setup_wizard_page() { * Enqueue setup wizard required scripts. */ public function feedzy_enqueue_setup_wizard_scripts() { + if ( ! did_action( 'wp_enqueue_media' ) ) { + wp_enqueue_media(); + } + wp_enqueue_style( $this->plugin_name . '_chosen' ); wp_enqueue_style( $this->plugin_name . '_smart_wizard', FEEDZY_ABSURL . 'css/smart_wizard_all.min.css', array(), $this->version ); wp_enqueue_style( $this->plugin_name . '_setup_wizard', FEEDZY_ABSURL . 'includes/views/css/style-wizard.css', array( $this->plugin_name . '-settings' ), $this->version, 'all' ); @@ -2003,6 +2007,18 @@ public function feedzy_enqueue_setup_wizard_scripts() { 'firstButtonText' => __( 'Create Page', 'feedzy-rss-feeds' ), 'secondButtonText' => __( 'Do not create', 'feedzy-rss-feeds' ), ), + 'mediaUploadText' => array( + 'iframeTitle' => __( 'Select image', 'feedzy-rss-feeds' ), + 'iframeButton' => __( 'Set default image', 'feedzy-rss-feeds' ), + 'actionButtonTextOne' => __( 'Choose image', 'feedzy-rss-feeds' ), + 'actionButtonTextTwo' => __( 'Replace image', 'feedzy-rss-feeds' ), + 'actionButtonTextThree' => __( 'Remove image', 'feedzy-rss-feeds' ), + ), + 'dryRun' => array( + 'loading' => '
' + . '', + 'title' => __( 'Importable Items', 'feedzy-rss-feeds' ), + ), ) ); } diff --git a/includes/admin/feedzy-rss-feeds-import.php b/includes/admin/feedzy-rss-feeds-import.php index a343ce72..9f954c14 100644 --- a/includes/admin/feedzy-rss-feeds-import.php +++ b/includes/admin/feedzy-rss-feeds-import.php @@ -561,9 +561,14 @@ public function feedzy_import_feed_options() { $default_thumbnail_id = 0; $inherited_thumbnail_id = ! empty( $this->free_settings['general']['default-thumbnail-id'] ) ? (int) $this->free_settings['general']['default-thumbnail-id'] : 0; + $custom_thumbnail_id = get_post_meta( $post->ID, 'default_thumbnail_id', true ); + + if ( is_numeric( $custom_thumbnail_id ) ) { + $default_thumbnail_id = $custom_thumbnail_id; + } + if ( feedzy_is_pro() ) { - $default_thumbnail_id = get_post_meta( $post->ID, 'default_thumbnail_id', true ); - $import_schedule = array( + $import_schedule = array( 'fz_cron_schedule' => ! empty( $this->free_settings['general']['fz_cron_schedule'] ) ? $this->free_settings['general']['fz_cron_schedule'] : '', ); } @@ -3951,6 +3956,8 @@ private function wizard_import_feed() { $post_type = ! empty( $_POST['post_type'] ) ? sanitize_text_field( wp_unslash( $_POST['post_type'] ) ) : ''; $post_status = ! empty( $_POST['post_status'] ) ? sanitize_text_field( wp_unslash( $_POST['post_status'] ) ) : ''; + $fallback_image = ! empty( $_POST['fallback_image'] ) ? sanitize_text_field( wp_unslash( $_POST['fallback_image'] ) ) : ''; + $excluded_post_title = ! empty( $_POST['excluded_post_title'] ) ? sanitize_text_field( wp_unslash( $_POST['excluded_post_title'] ) ) : ''; $wizard_data = get_option( 'feedzy_wizard_data', array() ); $wizard_data = ! empty( $wizard_data ) ? $wizard_data : array(); $wizard_data['post_type'] = $post_type; @@ -3994,7 +4001,25 @@ private function wizard_import_feed() { // Update wizard data. $wizard_data['job_id'] = $job_id; update_option( 'feedzy_wizard_data', $wizard_data ); - + + $filter_conditions = array( + 'match' => 'all', + 'conditions' => array(), + ); + + if ( ! empty( $excluded_post_title ) ) { + $filter_conditions['conditions'] = array( + array( + 'field' => 'title', + 'operator' => 'not_contains', + 'value' => $excluded_post_title, + ), + ); + } + + update_post_meta( $job_id, 'filter_conditions', wp_json_encode( $filter_conditions ) ); + update_post_meta( $job_id, 'default_thumbnail_id', $fallback_image ); + $response = array( 'status' => true, ); diff --git a/includes/layouts/setup-wizard.php b/includes/layouts/setup-wizard.php index d729e9ea..8d61f8c5 100644 --- a/includes/layouts/setup-wizard.php +++ b/includes/layouts/setup-wizard.php @@ -24,6 +24,7 @@ } $published_status = array( 'publish', 'draft' ); +add_thickbox(); ?>