1 |
ca0757b9
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Provides Media Internet module hook implementations for testing purposes.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Implements hook_media_internet_providers().
|
10 |
|
|
*/
|
11 |
|
|
function media_internet_test_media_internet_providers() {
|
12 |
2b3c8cc1
|
Assos Assos
|
// Allow tests to enable or disable this hook.
|
13 |
|
|
if (!variable_get('media_internet_test_media_internet_providers', FALSE)) {
|
14 |
|
|
return array();
|
15 |
|
|
}
|
16 |
|
|
|
17 |
ca0757b9
|
Assos Assos
|
return array(
|
18 |
|
|
'MediaInternetTestHandler' => array(
|
19 |
|
|
'title' => t('Media Internet Test'),
|
20 |
|
|
),
|
21 |
|
|
);
|
22 |
|
|
}
|
23 |
|
|
|
24 |
2b3c8cc1
|
Assos Assos
|
/**
|
25 |
|
|
* Implements hook_media_browser_plugin_info_alter_alter().
|
26 |
|
|
*/
|
27 |
|
|
function media_internet_test_media_internet_providers_alter(&$providers) {
|
28 |
|
|
// Allow tests to enable or disable this hook.
|
29 |
|
|
if (!variable_get('media_internet_test_media_internet_providers_alter', FALSE)) {
|
30 |
|
|
return;
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
$providers['MediaInternetTestHandler']['title'] = t('Altered provider title');
|
34 |
|
|
}
|
35 |
|
|
|
36 |
ca0757b9
|
Assos Assos
|
/**
|
37 |
|
|
* Implements hook_stream_wrappers().
|
38 |
|
|
*/
|
39 |
|
|
function media_internet_test_stream_wrappers() {
|
40 |
|
|
return array(
|
41 |
|
|
'mediainternettest' => array(
|
42 |
|
|
'name' => t('Media Internet Test'),
|
43 |
|
|
'class' => 'MediaInternetTestStreamWrapper',
|
44 |
|
|
'description' => t('Media Internet Test.'),
|
45 |
|
|
'type' => STREAM_WRAPPERS_READ_VISIBLE,
|
46 |
|
|
),
|
47 |
|
|
);
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
/**
|
51 |
|
|
* Implements hook_media_parse().
|
52 |
|
|
*
|
53 |
|
|
* @todo This hook should be deprecated. Refactor Media module to not call it
|
54 |
|
|
* any more, since media_internet should be able to automatically route to the
|
55 |
|
|
* appropriate handler.
|
56 |
|
|
*/
|
57 |
|
|
function media_internet_test_media_parse($embed_code) {
|
58 |
|
|
$handler = new MediaInternetTestHandler($embed_code);
|
59 |
|
|
return $handler->parse($embed_code);
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
/**
|
63 |
|
|
* Implements hook_file_mimetype_mapping_alter().
|
64 |
|
|
*/
|
65 |
|
|
function media_internet_test_file_mimetype_mapping_alter(&$mapping) {
|
66 |
|
|
$mapping['mimetypes'][] = 'video/mediainternettest';
|
67 |
|
|
} |