_blogapi_mt_extra
modules/blogapi/blogapi.module, строка 841
- Версии
- 5 – 6
_blogapi_mt_extra(&$node, $struct)
Handles extra information sent by clients according to MovableType's spec.
Код
<?php
function _blogapi_mt_extra(&$node, $struct) {
if (is_array($node)) {
$was_array = TRUE;
$node = (object)$node;
}
// mt_allow_comments
if (array_key_exists('mt_allow_comments', $struct)) {
switch ($struct['mt_allow_comments']) {
case 0:
$node->comment = COMMENT_NODE_DISABLED;
break;
case 1:
$node->comment = COMMENT_NODE_READ_WRITE;
break;
case 2:
$node->comment = COMMENT_NODE_READ_ONLY;
break;
}
}
// merge the 3 body sections (description, mt_excerpt, mt_text_more) into
// one body
if ($struct['mt_excerpt']) {
$node->body = $struct['mt_excerpt'] .'<!--break-->'.$node->body;
}
if ($struct['mt_text_more']) {
$node->body = $node->body .'<!--extended-->'. $struct['mt_text_more'];
}
// mt_convert_breaks
if ($struct['mt_convert_breaks']) {
$node->format = $struct['mt_convert_breaks'];
}
// dateCreated
if ($struct['dateCreated']) {
$node->date = format_date(mktime($struct['dateCreated']->hour, $struct['dateCreated']->minute, $struct['dateCreated']->second, $struct['dateCreated']->month, $struct['dateCreated']->day, $struct['dateCreated']->year), 'custom', 'Y-m-d H:i:s O');
}
if ($was_array) {
$node = (array)$node;
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии