/** * Get the different instances of the core. * * @since 1.0.0 * @param string $type * @return \H5PWordPress|\H5PCore|\H5PContentValidator|\H5PExport|\H5PStorage|\H5PValidator */ public function get_h5p_instance($type) { if (self::$interface === null) { $path = plugin_dir_path(__FILE__); include_once $path . '../h5p-php-library/h5p.classes.php'; include_once $path . '../h5p-php-library/h5p-development.class.php'; include_once $path . 'class-h5p-wordpress.php'; self::$interface = new H5PWordPress(); $language = $this->get_language(); self::$core = new H5PCore(self::$interface, $this->get_h5p_path(), $this->get_h5p_url(), $language, get_option('h5p_export', TRUE)); } switch ($type) { case 'validator': return new H5PValidator(self::$interface, self::$core); case 'storage': return new H5PStorage(self::$interface, self::$core); case 'contentvalidator': return new H5PContentValidator(self::$interface, self::$core); case 'export': return new H5PExport(self::$interface, self::$core); case 'interface': return self::$interface; case 'core': return self::$core; } }
/** * Get the different instances of the core. * * @since 1.0.0 * @param string $type * @return \H5PWordPress|\H5PCore|\H5PContentValidator|\H5PExport|\H5PStorage|\H5PValidator */ public function get_h5p_instance($type) { if (self::$interface === null) { self::$interface = new H5PWordPress(); $language = $this->get_language(); self::$core = new H5PCore(self::$interface, $this->get_h5p_path(), $this->get_h5p_url(), $language, get_option('h5p_export', TRUE)); self::$core->aggregateAssets = !(defined('H5P_DISABLE_AGGREGATION') && H5P_DISABLE_AGGREGATION === true); } switch ($type) { case 'validator': return new H5PValidator(self::$interface, self::$core); case 'storage': return new H5PStorage(self::$interface, self::$core); case 'contentvalidator': return new H5PContentValidator(self::$interface, self::$core); case 'export': return new H5PExport(self::$interface, self::$core); case 'interface': return self::$interface; case 'core': return self::$core; } }