save_settings() public méthode

* SyndicatedLink::settings_to_notes ()
public save_settings ( $reload = false )
 static function needs_upgrade()
 {
     global $wpdb;
     $fwp_db_version = get_option('feedwordpress_version', NULL);
     $ret = false;
     // innocent until proven guilty
     if (is_null($fwp_db_version) or $fwp_db_version < FEEDWORDPRESS_VERSION) {
         // This is an older version or a fresh install. Does it require a database
         // upgrade or database initialization?
         if (is_null($fwp_db_version)) {
             // Fresh install; brand it as ours. Or possibly a version of FWP
             // from before 0.96. But I'm no longer supporting upgrade paths
             // for versions from the previous decade. Sorry.
             update_option('feedwordpress_version', FEEDWORDPRESS_VERSION);
         } elseif ($fwp_db_version < 2010.0814) {
             // Change in terminology.
             if (get_option('feedwordpress_unfamiliar_category', 'create') == 'default') {
                 update_option('feedwordpress_unfamiliar_category', 'null');
             }
             foreach (FeedWordPress::syndicated_links() as $link) {
                 $sub = new SyndicatedLink($link);
                 $remap_uf = array('default' => 'null', 'filter' => 'null', 'create' => 'create:category', 'tag' => 'create:post_tag');
                 if (isset($sub->settings['unfamiliar category'])) {
                     if ($sub->settings['unfamiliar category'] == 'filter') {
                         $sub->settings['match/filter'] = array('category');
                     }
                     foreach ($remap_uf as $from => $to) {
                         if ($sub->settings['unfamiliar category'] == $from) {
                             $sub->settings['unfamiliar category'] = $to;
                         }
                     }
                 }
                 if (isset($sub->settings['add global categories'])) {
                     $sub->settings['add/category'] = $sub->settings['add global categories'];
                     unset($sub->settings['add global categories']);
                 }
                 $sub->save_settings(true);
             }
             update_option('feedwordpress_version', FEEDWORDPRESS_VERSION);
         } else {
             // No upgrade needed. Just brand it with the new version.
             update_option('feedwordpress_version', FEEDWORDPRESS_VERSION);
         }
     }
     return $ret;
 }
 function needs_upgrade()
 {
     global $wpdb;
     $fwp_db_version = get_option('feedwordpress_version');
     $ret = false;
     // innocent until proven guilty
     if (!$fwp_db_version or $fwp_db_version < FEEDWORDPRESS_VERSION) {
         // This is an older version or a fresh install. Does it
         // require a database upgrade or database initialization?
         if ($fwp_db_version <= 0.96) {
             // Yes. Check to see whether this is a fresh install or an upgrade.
             $syn = $wpdb->get_col("\n\t\t\t\tSELECT post_id\n\t\t\t\tFROM {$wpdb->postmeta}\n\t\t\t\tWHERE meta_key = 'syndication_feed'\n\t\t\t\t");
             if (count($syn) > 0) {
                 // contains at least one syndicated post
                 $ret = true;
             } else {
                 // fresh install; brand it as ours
                 update_option('feedwordpress_version', FEEDWORDPRESS_VERSION);
             }
         } elseif ($fwp_db_version < 2009.0707) {
             // We need to clear out any busted AJAX crap
             $wpdb->query("\n\t\t\t\tDELETE FROM {$wpdb->usermeta}\n\t\t\t\tWHERE LOCATE('feedwordpress', meta_key)\n\t\t\t\tAND LOCATE('box', meta_key);\n\t\t\t\t");
             update_option('feedwordpress_version', FEEDWORDPRESS_VERSION);
         } elseif ($fwp_db_version < 2010.0814) {
             // Change in terminology.
             if (get_option('feedwordpress_unfamiliar_category', 'create') == 'default') {
                 update_option('feedwordpress_unfamiliar_category', 'null');
             }
             foreach (FeedWordPress::syndicated_links() as $link) {
                 $sub = new SyndicatedLink($link);
                 $remap_uf = array('default' => 'null', 'filter' => 'null', 'create' => 'create:category', 'tag' => 'create:post_tag');
                 if (isset($sub->settings['unfamiliar category'])) {
                     if ($sub->settings['unfamiliar category'] == 'filter') {
                         $sub->settings['match/filter'] = array('category');
                     }
                     foreach ($remap_uf as $from => $to) {
                         if ($sub->settings['unfamiliar category'] == $from) {
                             $sub->settings['unfamiliar category'] = $to;
                         }
                     }
                 }
                 if (isset($sub->settings['add global categories'])) {
                     $sub->settings['add/category'] = $sub->settings['add global categories'];
                     unset($sub->settings['add global categories']);
                 }
                 $sub->save_settings(true);
             }
             update_option('feedwordpress_version', FEEDWORDPRESS_VERSION);
         } else {
             // No. Just brand it with the new version.
             update_option('feedwordpress_version', FEEDWORDPRESS_VERSION);
         }
     }
     return $ret;
 }
/** Uninstall plugin
* 
* Called with Wordpress uninstall plugin hook. Cleans up database and removes plugin settings
* @since 0.4 
*/
function faf_uninstall()
{
    $cat_id = FeedWordpress::link_category_id();
    $links = get_bookmarks(array("category" => $cat_id));
    foreach ($links as $l => $link) {
        $Slink = new SyndicatedLink($link);
        unset($Slink->settings["faf_advanced_filters_options"]);
        $Slink->save_settings();
    }
    delete_option("faf_advanced_filters_options");
    global $wpdb;
    $table = $wpdb->prefix . "faftemp";
    $sql = "DROP TABLE IF EXISTS {$table}";
    $wpdb->query($sql);
}