示例#1
0
<?php

require_once __DIR__ . "/../../src/utils/WpUtil.php";
require_once remotesync\WpUtil::getWpLoadPath();
require_once __DIR__ . "/../../src/utils/H5pUtil.php";
// This is not a proper unit test, because it relies on the H5P plugin
// to be installed on the system where it runs.
// The intended way to run this test, is to cd into the wp-remote-sync
// directory, when this directory is installed into the plugin plugin
// directory of a WordPress instance. This WordPress instance needs to
// have H5P installed as well. Then run:
//
//   php test/lab/h5ptest.php
//
// From the plugin directory.
use remotesync\H5pUtil;
H5pUtil::saveH5p("my-h5p", __DIR__ . "/introduction-to-3d-printing-133.h5p", "This is my H5P");
//H5pUtil::insertH5p("my-h5p",__DIR__."/testing-with-image.h5p","This is my H5P");
//H5pUtil::deleteH5p("my-h5p");
//echo H5pUtil::getLibraryNameById(10)."\n";
示例#2
0
 /**
  * Delete a local resource.
  */
 function deleteResource($slug)
 {
     remotesync\H5pUtil::deleteH5p($slug);
 }
示例#3
0
 /**
  * Save a H5P content onto the system. If a content with
  * the same slug already exists, it will be replaced.
  */
 static function saveH5p($slug, $h5pFileName, $title)
 {
     if (H5pUtil::h5pExists($slug)) {
         H5pUtil::updateH5p($slug, $h5pFileName, $title);
     } else {
         H5pUtil::insertH5p($slug, $h5pFileName, $title);
     }
 }