public/wordpress/wp-content/plugins/h5p/h5p-php-library/h5p-default-storage.class.php
/**
   * Copy a content from one directory to another. Defaults to cloning
   * content from the current temporary upload folder to the editor path.
   *
   * @param string $source path to source directory
   * @param string $contentId Id of content
   *
   * @return object Object containing h5p json and content json data
   */
Copy a content from one directory to another. Defaults to cloning
content from the current temporary upload folder to the editor path.

@param string $source path to source directory
@param string $contentId Id of content

@return object Object containing h5p json and content json data
Copy a content from one directory to another . Defaults to cloning content from the current temporary upload folder to the editor path . @param string $source path to source directory @param string $contentId Id of content @return object Object containing h5p json and content json data
public function moveContentDirectory($source, $contentId = NULL) {
    if ($source === NULL) {
      return NULL;
    }
    if ($contentId === NULL || $contentId == 0) {
      $target = $this->getEditorPath();
    }
    else {
      $target = "{$this->path}/content/{$contentId}";
    }
    $contentSource = $source . DIRECTORY_SEPARATOR . 'content';
    $contentFiles = array_diff(scandir($contentSource), array('.','..', 'content.json'));
    foreach ($contentFiles as $file) {
      if (is_dir("{$contentSource}/{$file}")) {
        self::copyFileTree("{$contentSource}/{$file}", "{$target}/{$file}");
      }
      else {
        copy("{$contentSource}/{$file}", "{$target}/{$file}");
      }
    }
    $h5pJson = $this->getContent($source . DIRECTORY_SEPARATOR . 'h5p.json');
    $contentJson = $this->getContent($contentSource . DIRECTORY_SEPARATOR . 'content.json');
    return (object) array(
      'h5pJson' => $h5pJson,
      'contentJson' => $contentJson
    );
  }
public function moveContentDirectory ( $ source , $ contentId = NULL ) { if ( $ source === NULL ) { return NULL ; } if ( $ contentId === NULL || $ contentId == 0 ) { $ target = $ this -> getEditorPath ( ) ; } else { $ target = " { $ this -> path } /content/ { $ contentId } " ; } $ contentSource = $ source . DIRECTORY_SEPARATOR . 'content' ; $ contentFiles = array_diff ( scandir ( $ contentSource ) , array ( '.' , '..' , 'content.json' ) ) ; foreach ( $ contentFiles as $ file ) { if ( is_dir ( " { $ contentSource } / { $ file } " ) ) { self :: copyFileTree ( " { $ contentSource } / { $ file } " , " { $ target } / { $ file } " ) ; } else { copy ( " { $ contentSource } / { $ file } " , " { $ target } / { $ file } " ) ; } } $ h5pJson = $ this -> getContent ( $ source . DIRECTORY_SEPARATOR . 'h5p.json' ) ; $ contentJson = $ this -> getContent ( $ contentSource . DIRECTORY_SEPARATOR . 'content.json' ) ; return ( object ) array ( 'h5pJson' => $ h5pJson , 'contentJson' => $ contentJson ) ; }
Copy a content from one directory to another.
Copy a content from one directory to another .
// Use content folder // Successfully loaded content json of file into editor