--- inline_old.module 2006-08-19 18:09:54.000000000 +0200 +++ inline.module 2006-09-12 23:04:03.538625504 +0200 @@ -16,7 +16,23 @@ } } -function inline_settings() { +function inline_menu($maycache) { +if ($maycache) { + $items = array(); + $items[] = array( + 'path' => 'admin/settings/inline', + 'title' => t('Inline module'), + 'description' => t('Controls the display of inline files.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => 'inline_admin_settings', + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); +} +return $items; +} + +function inline_admin_settings() { $form = array(); $form['inline_img_dim'] = array( @@ -36,7 +52,7 @@ '#options' => array('0' => t('Print only <img> tag'),'1' => t('Print <img> tag and the link to the image')), ); - return $form; + return system_settings_form($form); } function inline_form_alter($form_id, &$form) { @@ -113,8 +129,9 @@ //only nodes with our inline filter in the format may be altered foreach (filter_list_format($node->format) as $filter) { if ($filter->module == 'inline') { - $node->teaser = _inline_substitute_tags($node, 'teaser'); - $node->body = _inline_substitute_tags($node, 'body'); + $node->content["teaser"]["#value"] = _inline_substitute_tags($node, 'teaser'); + $node->content["body"]["#value"] = _inline_substitute_tags($node, 'body'); + drupal_add_css("modules/inline/inline.css"); break; } } @@ -174,7 +191,7 @@ $title = ( $file->title ? $file->title : $file->name ); - $html .= ''. $title .''; + $html .= ''. $title .''; if (variable_get('inline_link_img', '1') == '1') { $html .= ''; @@ -183,11 +200,11 @@ } function theme_inline_add_to_teaser($node, $file) { - return theme('inline_img', $file) . $node->teaser; + return theme('inline_img', $file) . $node->content["teaser"]["#value"]; } function theme_inline_add_to_body($node, $file) { - return theme('inline_img', $file) . $node->body; + return theme('inline_img', $file) . $node->content["body"]["#value"]; } function _inline_auto_add($node) { @@ -201,7 +218,7 @@ $file = inline_prepare_file_object($file); if (_inline_decide_img_tag($file)) { $node->files[$fid]->inline = TRUE; - $node->teaser = theme('inline_add_to_teaser', $node, $file); + $node->content["teaser"]["#value"] = theme('inline_add_to_teaser', $node, $file); } else { $node->files[$fid]->inline = FALSE; @@ -213,7 +230,7 @@ $file = inline_prepare_file_object($file); if (_inline_decide_img_tag($file)) { $node->files[$fid]->inline = TRUE; - $node->body = theme('inline_add_to_body', $node, $file); + $node->content["body"]["#value"] = theme('inline_add_to_body', $node, $file); } else { $node->files[$fid]->inline = FALSE; @@ -225,8 +242,8 @@ $file = inline_prepare_file_object($file); if (_inline_decide_img_tag($file)) { $node->files[$fid]->inline = TRUE; - $node->teaser = theme('inline_add_to_teaser', $node, $file); - $node->body = theme('inline_add_to_body', $node, $file); + $node->content["teaser"]["#value"] = theme('inline_add_to_teaser', $node, $file); + $node->content["body"]["#value"] = theme('inline_add_to_body', $node, $file); } else { $node->files[$fid]->inline = FALSE; @@ -238,15 +255,19 @@ } function _inline_substitute_tags(&$node, $field) { - if (preg_match_all("/\[(inline|file|attachment):([^=\\]]+)=?([^\\]]*)?\]/i", $node->$field, $match)) { + if (preg_match_all("/\[(inline|file|attachment):([^=:\\]]+)=?([^:\\]]*)?:?(left|right|centre)?\]/i", $node->content["$field"]["#value"], $match)) { foreach ($match[2] as $key => $value) { // fetch file object $file = inline_prepare_file_object(_inline_fileobj($node, $value)); // deal file title $title = $match[3][$key]; + $align = $match[4][$key]; if (!empty( $title )) { $file->title = $title; } + if (!empty( $align )) { + $file->align = $align; + } $replace = ""; if ($file->fid != NULL) { //decide if we should show a link or an img tag @@ -263,9 +284,9 @@ $mtch[] = $match[0][$key]; $repl[] = $replace; } - return str_replace($mtch, $repl, $node->$field); + return str_replace($mtch, $repl, $node->content["$field"]["#value"]); } - return $node->$field; + return $node->content["$field"]["#value"]; } /**