| 1 |
<?php |
<?php |
| 2 |
// $Id: audio.module,v 1.153 2009/05/10 18:26:07 drewish Exp $ |
// $Id: audio.module,v 1.154 2009/05/10 19:03:03 drewish Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 1158 |
* Full path to an audio file. be aware that the file will be moved into |
* Full path to an audio file. be aware that the file will be moved into |
| 1159 |
* drupal's directory. |
* drupal's directory. |
| 1160 |
* @param $title_format |
* @param $title_format |
| 1161 |
* A t() formatting string for generating the node's title. you can use any |
* An optional, token string for generating the node's title. If nothing is |
| 1162 |
* value in the node's audio_tags array as variable. if nothing is provided |
* provided the default title format will be used. |
| 1163 |
* the default title format will be used. |
* @param $body |
| 1164 |
|
* An optional string to use for the node's body. |
| 1165 |
|
* @param $taxonomy |
| 1166 |
|
* An optional array of taxonomy terms to assign to the node if the taxonomy |
| 1167 |
|
* module is installed. |
| 1168 |
* @param $tags |
* @param $tags |
| 1169 |
* An, optional, array of metadata to add to the node. these will be |
* An optional array of metadata to add to the node. These will overwrite |
| 1170 |
* available to the $title_format. |
* any values loaded from the ID3 tags. |
| 1171 |
* @return |
* @return |
| 1172 |
* A node or FALSE on error. |
* A node or FALSE on error. |
| 1173 |
*/ |
*/ |
| 1174 |
function audio_api_insert($filepath, $title_format = NULL, $tags = array(), $body = NULL) { |
function audio_api_insert($filepath, $title_format = NULL, $body = NULL, $tags = array(), $taxonomy = array()) { |
| 1175 |
global $user; |
global $user; |
| 1176 |
|
|
| 1177 |
// For node_object_prepare() |
// For node_object_prepare() |
| 1211 |
if (module_exists('comment')) { |
if (module_exists('comment')) { |
| 1212 |
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE); |
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE); |
| 1213 |
} |
} |
| 1214 |
|
if (module_exists('taxonomy') && is_array($taxonomy)) { |
| 1215 |
|
$node->taxonomy = $taxonomy; |
| 1216 |
|
} |
| 1217 |
|
|
| 1218 |
$node->audio_tags = array(); |
$node->audio_tags = array(); |
| 1219 |
$node->audio_images = array(); |
$node->audio_images = array(); |
| 1231 |
audio_invoke_audioapi('upload', $node); |
audio_invoke_audioapi('upload', $node); |
| 1232 |
|
|
| 1233 |
// Add the tags (overwriting any that audio_getid3 may have loaded). |
// Add the tags (overwriting any that audio_getid3 may have loaded). |
| 1234 |
if ($tags) { |
if (is_array($tags)) { |
| 1235 |
$node->audio_tags = $tags; |
$node->audio_tags = array_merge($node->audio_tags, $tags); |
| 1236 |
} |
} |
| 1237 |
|
|
| 1238 |
// Build the title manually (since we don't call node_validate()). |
// Build the title manually (since we don't call node_validate()). |