示例#1
0
 /** @noinspection PhpMissingDocCommentInspection */
 public static function ContentSave($id, $oldContent, $newContent)
 {
     $oldFonts = GFontsDB::GetFontsFromContent($oldContent);
     $newFonts = GFontsDB::GetFontsFromContent($newContent);
     $df = GFontsDB::DetectFontChanges($oldFonts, $newFonts);
     foreach ($df['removed'] as $font) {
         GFontsDB::RemoveFontFromPost($font, $id);
     }
     foreach ($df['added'] as $font) {
         GFontsDB::AddFontToPost($font, $id);
     }
     if (count($newFonts) > 0) {
         update_post_meta($id, GFontsEngine::PLUGIN_META_NO_FONT, 0);
     } else {
         update_post_meta($id, GFontsEngine::PLUGIN_META_NO_FONT, 1);
     }
 }