get(\WPRSS_SERVICE_ID_PREFIX.'bulk_source_import'); /* @var $importer Aventura\Wprss\Core\Component\BulkSourceImport */ $results = $importer->import($bulk_feeds); \wprss()->getAdminAjaxNotices()->addNotice('bulk_feed_import'); } } add_action( 'admin_init', 'wp_rss_aggregator_export', 1 ); /** * Handles exporting of aggregator settings * * @since 3.1 */ function wp_rss_aggregator_export() { if ( isset( $_POST['export'] ) && check_admin_referer( 'wprss-settings-export' ) ) { $blogname = str_replace( " ", "", get_option( 'blogname' ) ); $date = date( "m-d-Y" ); $json_name = $blogname . "-" . $date; // Naming the filename that will be generated. header( 'Content-Description: File Transfer' ); header( "Content-Type: text/json; charset=" . get_option( 'blog_charset' ) ); header( "Content-Disposition: attachment; filename=$json_name.json" ); wp_rss_set_export_data(); die(); } } /** * Gathers relevant options, encodes them in Json and echoes the file * * @since 3.1 */ function wp_rss_set_export_data() { $options = apply_filters( 'wprss_fields_export', array( 'wprss_settings_general' => get_option( 'wprss_settings_general' ) ) ); $json_file = json_encode( $options ); foreach ( $options as $key => $value ) { $value = maybe_unserialize( $value ); $need_options[ $key ] = $value; } $json_file = json_encode( $need_options ); // Encode data into json data echo $json_file; die(); } /** * Notice for a successful export * * @since 3.1 */ function wp_rss_aggregator_export_notice() { ?>
0) { wp_die( "Error during import" ); } else { $file_name = $_FILES['import']['name']; $file_name_parts = explode( ".", $file_name ); $file_ext = strtolower( end( $file_name_parts ) ); $file_size = $_FILES['import']['size']; if ( ( $file_ext == "json" ) && ( $file_size < 500000 ) ) { $encode_options = file_get_contents( $_FILES['import']['tmp_name'] ); $options = json_decode( $encode_options, true ); foreach ( $options as $key => $value ) { update_option( $key, $value ); } wprss()->getAdminAjaxNotices()->addNotice('settings_import_success'); do_action( 'wprss_settings_imported' ); } else { wprss()->getAdminAjaxNotices()->addNotice('settings_import_failed'); } } } } } /** * Handles the import/export page display * * @since 3.1 */ function wprss_import_export_settings_page_display() { if ( !isset( $_POST['export'] ) ) { ?>



Export Settings button to generate a file containing all the settings used by WP RSS Aggregator', WPRSS_TEXT_DOMAIN ) ) ?>

Choose file button and choose a backup file.', WPRSS_TEXT_DOMAIN ) ) ?> Import Settings button, and WordPress will do the rest for you.', WPRSS_TEXT_DOMAIN ) ) ?>

Import and Export functionality.', WPRSS_TEXT_DOMAIN ), get_admin_url() ) ) ?> Export page, check the Feed Sources radio button and click the Download Export File button. WordPress will then create an XML file containing all the feed sources.', WPRSS_TEXT_DOMAIN ), get_admin_url() ) ) ?> Import page, choose the previously created file and click the Upload file and import button.', WPRSS_TEXT_DOMAIN ), get_admin_url() ) ) ?>
\WPRSS_NOTICE_SERVICE_ID_PREFIX, 'service_id_prefix' => \WPRSS_SERVICE_ID_PREFIX, 'event_prefix' => \WPRSS_EVENT_PREFIX, )); $container->register($serviceProvider); });