diff -urp 5.x/inline/inline.info 6.x/inline/inline.info --- 5.x/inline/inline.info 2007-04-18 14:05:15.000000000 +0200 +++ 6.x/inline/inline.info 2008-04-27 23:19:26.000000000 +0200 @@ -1,9 +1,11 @@ -; $Id: inline.info,v 1.1.2.1 2007/03/27 03:52:31 sun Exp $ +; $Id: inline.info,v 1.1.2.6 2008/04/27 03:52:31 SiliconMind $ name = Inline description = Allows attached files to be placed into the body of a node either automatically or by using simple tags. package = "Input filters" -dependencies = filter upload -; Information added by drupal.org packaging script on 2007-04-18 -version = "5.x-1.1" +dependencies[] = filter +dependencies[] = upload +core = 6.x + +version = "6.x-dev" project = "inline" diff -urp 5.x/inline/inline.module 6.x/inline/inline.module --- 5.x/inline/inline.module 2007-04-18 13:22:27.000000000 +0200 +++ 6.x/inline/inline.module 2008-04-27 23:29:06.000000000 +0200 @@ -1,23 +1,20 @@ 'admin/settings/inline', - 'title' => t('Inline'), - 'description' => t('Manage automatic and manual inclusion of attachments in the content of your posts.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('inline_settings'), - 'access' => user_access('administer inline settings'), - ); - } + $items['admin/settings/inline'] = array( + 'title' => 'Inline', + 'description' => t('Manage automatic and manual inclusion of attachments in the content of your posts.'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('inline_settings'), + 'access arguments' => array('administer inline settings'), + ); return $items; } @@ -25,14 +22,14 @@ function inline_perm() { return array('administer inline settings'); } -function inline_help($section = 'admin/help#inline') { +function inline_help($path, $arg) { $output = ''; - switch ($section) { + switch ($path) { case 'admin/help#inline': return t('
Sometimes a user may want to add an image or a file inside the body of a node. This can be done with special tags that are replaced by links to the corresponding uploaded file. If the file is an image, it will be displayed inline, otherwise a link to the file will be inserted. To enable this feature and learn the proper syntax, visit the filters configuration screen.
', array('!filters' => url('admin/filters'))); case 'filter#short-tip': - return t('You may add links to files uploaded with this node using special tags', array('!explanation-url' => url('filter/tips', NULL, 'image'))); + return t('You may add links to files uploaded with this node using special tags', array('!explanation-url' => url('filter/tips', array('fragment' => 'image')))); case 'filter#long-tip': return t('You may link to files uploaded with the current node using special tags. The tags will be replaced by the corresponding files. Syntax: [inline:file_id]. Parameter: file_id represents the file uploaded with the node in which to link, assuming that the first uploaded file is labeled as 1 and so on.
<a href=file1.pdf.png>test</a>');
}
else {
- return t('You may use [inline:xx] tags to display uploaded files or images inline.', array("!inline_help" => url("filter/tips/$format", NULL, 'filter-inline')));
+ return t('You may use [inline:xx] tags to display uploaded files or images inline.', array("!inline_help" => url("filter/tips/$format", array('fragment' => 'filter-inline'))));
}
}
@@ -178,6 +175,7 @@ function inline_nodeapi(&$node, $op, $ar
if (!is_array($node->files)) {
return;
}
+
switch ($op) {
case 'alter':
case 'print':
@@ -195,7 +193,7 @@ function inline_nodeapi(&$node, $op, $ar
return;
case 'prepare':
- case 'submit':
+ case 'presave':
$node->teaser = _inline_replace_numbers($node, 'teaser');
$node->body = _inline_replace_numbers($node, 'body');
return;
@@ -238,55 +236,28 @@ function inline_prepare_file_object($fil
return $file;
}
-function theme_inline_as_link($file) {
- // prepare link text with title or filename
- $linktext = ($file->title ? $file->title : $file->filename);
-
- return l($linktext, file_create_url($file->filepath), array('title' => t('Download: @name (@size)', array('@name' => $file->filename, '@size' => format_size($file->filesize)))));
-}
-
-function theme_inline_img($file, $field) {
- $title = (!empty($file->title) ? $file->title : $file->filename);
- $inline_preset = $field == 'teaser' ? 'inline_teaser_preset' : 'inline_full_preset';
-
- if (module_exists('imagecache') && variable_get($inline_preset, '') != '') {
- $image = theme('imagecache',
- variable_get($inline_preset, ''),
- $file->filepath,
- $title,
- $title,
- array('class' => 'inline')
- );
- }
- else {
- $image = theme('image',
- $file->filepath,
- $title,
- $title,
- array('class' => 'inline')
- );
- }
-
- if (variable_get('inline_link_img', '1')) {
- $attributes = array(
- 'class' => 'inline-image-link',
- 'title' => t("View") .': '. $title,
+/**
+ * Implementation of hook_theme()
+ */
+function inline_theme() {
+ return array(
+ 'inline_as_link' => array(
+ 'arguments' => array('link' => NULL),
+ 'file' => 'inline.theme.inc'
+ ),
+ 'inline_img' => array(
+ 'arguments' => array('file' => NULL, 'field' => NULL),
+ 'file' => 'inline.theme.inc'
+ ),
+ 'inline_add_to_teaser' => array(
+ 'arguments' => array('node' => NULL, 'file' => NULL, 'field' => NULL),
+ 'file' => 'inline.theme.inc'
+ ),
+ 'inline_add_to_body' => array(
+ 'arguments' => array('node' => NULL, 'file' => NULL, 'field' => NULL),
+ 'file' => 'inline.theme.inc'
+ )
);
- $html = l($image, $file->filepath, $attributes, NULL, NULL, FALSE, TRUE);
- }
- else {
- $html = $image;
- }
-
- return $html;
-}
-
-function theme_inline_add_to_teaser($node, $file, $field) {
- return theme('inline_img', $file, $field) . $node->teaser;
-}
-
-function theme_inline_add_to_body($node, $file, $field) {
- return theme('inline_img', $file, $field) . $node->body;
}
function _inline_auto_add($node) {
Only in 6.x/inline: inline.theme.inc