| 1 |
<?php
|
| 2 |
function embedfilter_install() {
|
| 3 |
|
| 4 |
variable_set('embedfilter_filtertip', t('You can use <object>, <embed> and <script> tags from the following sites to add media to your posts:'));
|
| 5 |
|
| 6 |
$whitelist = array(
|
| 7 |
$_SERVER['HTTP_HOST'],
|
| 8 |
'youtube.com',
|
| 9 |
'flicker.com',
|
| 10 |
'twitter.com',
|
| 11 |
'facebook.com',
|
| 12 |
'google.com',
|
| 13 |
'yahoo.com',
|
| 14 |
);
|
| 15 |
variable_set('embedfilter_host_whitelist', implode("\n", $whitelist));
|
| 16 |
}
|
| 17 |
|
| 18 |
function embedfilter_update_6000() {
|
| 19 |
$ret = array();
|
| 20 |
// Create a new format with only this filter.
|
| 21 |
db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('%s', '', %d)", 'feature_embed', 1);
|
| 22 |
$format_id = db_last_insert_id('filter_formats', 'format');
|
| 23 |
|
| 24 |
db_query("INSERT INTO {filters} (`format`, `module`, `delta`, `weight`) VALUES (%d, '%s', %d, %d)", $format_id, 'feature_embed', 0, 0);
|
| 25 |
variable_set('embedfilter_format', $format_id);
|
| 26 |
return $ret;
|
| 27 |
}
|
| 28 |
|
| 29 |
function embedfilter_uninstall() {
|
| 30 |
db_query("DELETE FROM {variable} WHERE NAME LIKE 'embedfilter%'");
|
| 31 |
}
|