public/wordpress/wp-content/plugins/h5p/public/class-h5p-wordpress.php
/**
   * Replaces existing content type cache with the one passed in
   *
   * @param object $contentTypeCache Json with an array called 'libraries'
   *  containing the new content type cache that should replace the old one.
   */
Replaces existing content type cache with the one passed in
@param object $contentTypeCache Json with an array called 'libraries'
containing the new content type cache that should replace the old one.
Replaces existing content type cache with the one passed in @param object $contentTypeCache Json with an array called ' libraries ' containing the new content type cache that should replace the old one .
public function replaceContentTypeCache($contentTypeCache) {
    global $wpdb;
    $wpdb->query("TRUNCATE TABLE {$wpdb->base_prefix}h5p_libraries_hub_cache");
    foreach ($contentTypeCache->contentTypes as $ct) {
      $wpdb->insert("{$wpdb->base_prefix}h5p_libraries_hub_cache", array(
        'machine_name'      => $ct->id,
        'major_version'     => $ct->version->major,
        'minor_version'     => $ct->version->minor,
        'patch_version'     => $ct->version->patch,
        'h5p_major_version' => $ct->coreApiVersionNeeded->major,
        'h5p_minor_version' => $ct->coreApiVersionNeeded->minor,
        'title'             => $ct->title,
        'summary'           => $ct->summary,
        'description'       => $ct->description,
        'icon'              => $ct->icon,
        'created_at'        => self::dateTimeToTime($ct->createdAt),
        'updated_at'        => self::dateTimeToTime($ct->updatedAt),
        'is_recommended'    => $ct->isRecommended === TRUE ? 1 : 0,
        'popularity'        => $ct->popularity,
        'screenshots'       => json_encode($ct->screenshots),
        'license'           => json_encode(isset($ct->license) ? $ct->license : array()),
        'example'           => $ct->example,
        'tutorial'          => isset($ct->tutorial) ? $ct->tutorial : '',
        'keywords'          => json_encode(isset($ct->keywords) ? $ct->keywords : array()),
        'categories'        => json_encode(isset($ct->categories) ? $ct->categories : array()),
        'owner'             => $ct->owner
      ), array(
        '%s',
        '%d',
        '%d',
        '%d',
        '%d',
        '%d',
        '%s',
        '%s',
        '%s',
        '%s',
        '%d',
        '%d',
        '%d',
        '%d',
        '%s',
        '%s',
        '%s',
        '%s',
        '%s',
        '%s',
        '%s'
      ));
    }
  }
public function replaceContentTypeCache ( $ contentTypeCache ) { global $ wpdb ; $ wpdb -> query ( " TRUNCATE TABLE  { $ wpdb -> base_prefix } h5p_libraries_hub_cache " ) ; foreach ( $ contentTypeCache -> contentTypes as $ ct ) { $ wpdb -> insert ( " { $ wpdb -> base_prefix } h5p_libraries_hub_cache " , array ( 'machine_name' => $ ct -> id , 'major_version' => $ ct -> version -> major , 'minor_version' => $ ct -> version -> minor , 'patch_version' => $ ct -> version -> patch , 'h5p_major_version' => $ ct -> coreApiVersionNeeded -> major , 'h5p_minor_version' => $ ct -> coreApiVersionNeeded -> minor , 'title' => $ ct -> title , 'summary' => $ ct -> summary , 'description' => $ ct -> description , 'icon' => $ ct -> icon , 'created_at' => self :: dateTimeToTime ( $ ct -> createdAt ) , 'updated_at' => self :: dateTimeToTime ( $ ct -> updatedAt ) , 'is_recommended' => $ ct -> isRecommended === TRUE ? 1 : 0 , 'popularity' => $ ct -> popularity , 'screenshots' => json_encode ( $ ct -> screenshots ) , 'license' => json_encode ( isset ( $ ct -> license ) ? $ ct -> license : array ( ) ) , 'example' => $ ct -> example , 'tutorial' => isset ( $ ct -> tutorial ) ? $ ct -> tutorial : '' , 'keywords' => json_encode ( isset ( $ ct -> keywords ) ? $ ct -> keywords : array ( ) ) , 'categories' => json_encode ( isset ( $ ct -> categories ) ? $ ct -> categories : array ( ) ) , 'owner' => $ ct -> owner ) , array ( '%s' , '%d' , '%d' , '%d' , '%d' , '%d' , '%s' , '%s' , '%s' , '%s' , '%d' , '%d' , '%d' , '%d' , '%s' , '%s' , '%s' , '%s' , '%s' , '%s' , '%s' ) ) ; } }
Replaces existing content type cache with the one passed in
 @param object $contentTypeCache Json with an array called 'libraries'
  containing the new content type cache that should replace the old one.
Replaces existing content type cache with the one passed in @param object $contentTypeCache Json with an array called ' libraries ' containing the new content type cache that should replace the old one .
// Replace existing content type cache // Insert into db