$setting_value ) { // If the setting didn't previously exist, add the default value to the $settings array. if ( ! isset( $settings[ $setting_key ] ) ) $settings[ $setting_key ] = $setting_value; } // Update the plugin settings. update_option( 'wprss_settings_general', $settings ); } /** * Takes care of cron and DB changes between versions 2+ and 3 * * @since 3.0 */ function wprss_upgrade_30() { wp_clear_scheduled_hook( 'wprss_fetch_feeds_hook' ); // Get the settings from the database. $settings = get_option( 'wprss_settings' ); // Put them into our new field update_option( 'wprss_settings_general', $settings ); // Remove old options field, we are now using wprss_settings_general delete_option( 'wprss_settings' ); } /** * Migrates the feed sources from the wprss_options field to the wp_posts table (for older versions) * * @since 2.0 */ function wprss_migrate() { // Get the plugin options $options = get_option( 'wprss_options' ); $feed_sources = array_chunk( $options, 2 ); foreach ( $feed_sources as $feed_source ) { $feed_title = $feed_source[0]; $feed_url = $feed_source[1]; // Create post object $feed_item = array( 'post_title' => $feed_title, 'post_content' => '', 'post_status' => 'publish', 'post_type' => 'wprss_feed' ); $inserted_ID = wp_insert_post( $feed_item, $wp_error ); // insert post meta update_post_meta( $inserted_ID, 'wprss_url', $feed_url ); } // delete unneeded option delete_option( 'wprss_options' ); } /** * Returns an array of the default plugin settings. These are only used on initial setup. * * @since 2.0 */ function wprss_get_default_settings_general() { // Set up the default plugin settings $settings = apply_filters( 'wprss_default_settings_general', array( // from version 1.1 'open_dd' => 'blank', 'follow_dd' => 'no_follow', // from version 2.0 'feed_limit' => 15, // from version 3.0 'date_format' => 'Y-m-d', 'limit_feed_items_db' => 200, 'cron_interval' => 'hourly', 'styles_disable' => 0, 'title_link' => 1, 'title_limit' => '', 'source_enable' => 1, 'text_preceding_source' => 'Source:', 'date_enable' => 1, 'text_preceding_date' => 'Published on', // from version 3.1 'limit_feed_items_imported' => 0, // from version 3.3 'custom_feed_url' => 'wprss', 'custom_feed_limit' => '', 'source_link' => 0, // from version 3.4 'video_link' => 'false', // from version 3.8 'limit_feed_items_age' => '', 'limit_feed_items_age_unit' => 'days', // from version 4.0.5 'time_ago_format_enable' => 0, // tracking 'tracking' => 0, // from version 4.1.2 'custom_feed_title' => 'Latest imported feed items on ' . get_bloginfo('name'), // From version 4.2.3 'pagination' => 'default', // From 4.2.4 'authors_enable' => 0, // From 4.7.2 'unique_titles' => 0, // From 4.7.8 'expiration_notice_period' => '2 weeks', // From 4.8.2 'feed_request_useragent' => null, // From 4.11.2 'limit_feed_items_per_import' => null, 'feed_items_import_order' => '', 'feed_items_import_order' => '', ) ); // Return the default settings return $settings; } /** * Returns the default tracking settings. * * @since 3.6 */ function wprss_get_default_tracking_settings() { return apply_filters( 'wprss_default_tracking_settings', array( 'use_presstrends' => 'false', 'tracking_notice' => '' ) ); }