Merge with 751c993bc0ebcf4f6a31d9e157d63d848652084c

skala
Ivan Tcholakov 16 years ago
commit f9d6f5b7cf
  1. 1
      main/inc/global.inc.php
  2. 48
      main/inc/lib/media.lib.php
  3. 2
      tests/all.test.php
  4. 14
      tests/main/inc/lib/media.lib.test.php

@ -190,7 +190,6 @@ require_once($lib_path.'display.lib.php');
require_once($lib_path.'text.lib.php');
require_once($lib_path.'security.lib.php');
require_once($lib_path.'events.lib.inc.php');
//require_once($lib_path.'media.lib.php'); // TODO: Deprecated, to be removed. Ivan Tcholakov, 23-SEP-2003.
// @todo: this shouldn't be done here. It should be stored correctly during installation
if(empty($_configuration['statistics_database']) && $already_installed)

@ -1,48 +0,0 @@
<?php
// TODO: This file is deprecated, it will be removed. Ivan Tcholakov, 23-SEP-2003.
// These constants specify multi-media related resource files (scripts, players, etc.).
define('FLASH_PLAYER_AUDIO', 'FLASH_PLAYER_AUDIO');
define('FLASH_PLAYER_VIDEO', 'FLASH_PLAYER_VIDEO');
define('SCRIPT_SWFOBJECT', 'SCRIPT_SWFOBJECT');
define('SCRIPT_ASCIIMATHML', 'SCRIPT_ASCIIMATHML');
/**
* A static class for serving the Dokeos system's multi-media features.
* @author Ivan Tcholakov, July 2009.
*/
class Media {
/**
* This method returns the path (location) of a specified multi-media resource file.
* @param string $media_resource The identificator of the requested resource: FLASH_PLAYER_AUDIO, FLASH_PLAYER_VIDEO, SCRIPT_SWFOBJECT, SCRIPT_ASCIIMATHML
* @param string $path_type (optional) Type (or base) of the returned path, it can be: WEB_PATH, SYS_PATH, REL_PATH (default)
* @return string Path to access the requeted media-related file.
* Note: At the moment returned paths are based on hard-coded data. Configuration data may be used in the future.
*/
public function get_path($media_resource, $path_type = REL_PATH) {
switch ($media_resource) {
case FLASH_PLAYER_AUDIO:
$relative_path = 'main/inc/lib/mediaplayer/player.swf';
break ;
case FLASH_PLAYER_VIDEO:
$relative_path = 'main/inc/lib/mediaplayer/player.swf';
break;
case SCRIPT_SWFOBJECT:
$relative_path = 'main/inc/lib/swfobject/swfobject.js';
break;
case SCRIPT_ASCIIMATHML:
$relative_path = 'main/inc/lib/asciimath/ASCIIMathML.js';
break;
default:
return '';
}
$base_path = api_get_path($path_type);
if (empty($base_path)) {
return '';
}
return $base_path.$relative_path;
}
}

@ -48,7 +48,6 @@ class AllTests extends TestSuite {
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/import.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/mail.lib.inc.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/main_api.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/media.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/message.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/internationalization.lib.test.php');
//$this->addTestFile(dirname(__FILE__).'/main/inc/lib/online.inc.test.php');
@ -98,7 +97,6 @@ class AllTests extends TestSuite {
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/legal.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/mail.lib.inc.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/main_api.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/media.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/message.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/internationalization.lib.test.php');
$this->addTestFile(dirname(__FILE__).'/main/inc/lib/online.inc.test.php');

@ -1,14 +0,0 @@
<?php
require_once(api_get_path(LIBRARY_PATH).'media.lib.php');
class TestMedia extends UnitTestCase {
public function testget_path() {
$result1 = Media::get_path(FLASH_PLAYER_AUDIO, REL_PATH);
$result2 = Media::get_path(FLASH_PLAYER_VIDEO, WEB_PATH);
$result3 = Media::get_path(SCRIPT_SWFOBJECT, SYS_PATH);
$result4 = Media::get_path(SCRIPT_ASCIIMATHML, REL_PATH);
$this->assertTrue(!empty($result1) && !empty($result2) && !empty($result3) && !empty($result4));
}
}
?>
Loading…
Cancel
Save