Index: pearwiki_filter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pearwiki_filter/pearwiki_filter.module,v
retrieving revision 1.8
diff -u -p -r1.8 pearwiki_filter.module
--- pearwiki_filter.module 3 Mar 2007 03:24:21 -0000 1.8
+++ pearwiki_filter.module 8 Mar 2007 09:25:34 -0000
@@ -148,6 +148,7 @@ function pearwiki_filter_filter_settings
$form['pearwiki_filter']['compatibility']['pearwiki_filter_ignore_regexp_'.$format] = array(
'#type' => 'textfield',
'#title' => t('Ignore regexp'),
+<<<<<<< pearwiki_filter.module
'#default_value' => pearwiki_filter_ignore_regexp($format),
'#description' => t('A regular expression where the match is ignored (the full match is untouched). Use this for compatibility with other filters. This can introduce a security risk through XSS scripting. Make sure the ignored text will be processed by another filter.')
);
@@ -157,10 +158,26 @@ function pearwiki_filter_filter_settings
'#type' => 'fieldset',
'#title' => 'Wikilinks',
'#description' => t('The following options control the behavior when wikilinks are used. It is recommended to use one of the additional modules, but only check one. The modules need to be enabled in order to check them.')
+=======
+ '#default_value' => pearwiki_filter_ignore_regexp($format),
+ '#description' => t('A regular expression where the match is ignored (the full match is untouched). Use this for compatibility with other filters. This can introduce a security risk through XSS scripting. Make sure the ignored text will be processed by another filter.')
+>>>>>>> 1.8
);
+<<<<<<< pearwiki_filter.module
$form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_wiki_links_'.$format] = array(
+=======
+ // Wikilink options
+ // ----------------
+ $form['pearwiki_filter']['wikilinks'] = array(
+ '#type' => 'fieldset',
+ '#title' => 'Wikilinks',
+ '#description' => t('The following options control the behavior when wikilinks are used. It is recommended to use one of the additional modules, but only check one. The modules need to be enabled in order to check them.')
+ );
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_wiki_links_'.$format] = array(
+>>>>>>> 1.8
'#type' => 'checkbox',
'#title' => t('Use wiki links?'),
+<<<<<<< pearwiki_filter.module
'#default_value' => pearwiki_filter_use_wiki_links($format),
'#description' => t('Are wiki links activated? If this option is not activated, wikilinks will not be parsed.')
);
@@ -169,7 +186,73 @@ function pearwiki_filter_filter_settings
'#title' => t('Replacement for Spaces'),
'#default_value' => pearwiki_filter_space_replacement($format),
'#description' => t('Set the replacement character for spaces in wikilinks. If left emtpy, no replacement will be made. Set the value to the same as in the autopath module, so a title of a node becomes a wikilink. This option is ignored for the Mediawiki format since the parser alredy replaces spaces with underscores.')
+=======
+ '#default_value' => pearwiki_filter_use_wiki_links($format),
+ '#description' => t('Are wiki links activated? If this option is not activated, wikilinks will not be parsed.')
+ );
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_space_replacement_'.$format] = array(
+ '#type' => 'textfield',
+ '#title' => t('Replacement for Spaces'),
+ '#default_value' => pearwiki_filter_space_replacement($format),
+ '#description' => t('Set the replacement character for spaces in wikilinks. If left emtpy, no replacement will be made. Set the value to the same as in the autopath module, so a title of a node becomes a wikilink. This option is ignored for the Mediawiki format since the parser alredy replaces spaces with underscores.')
+ );
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_wikilink_base_'.$format] = array(
+ '#type' => 'textfield',
+ '#title' => t('Base path for wikilinks'),
+ '#default_value' => pearwiki_filter_wikilink_base($format),
+ '#description' => t('If none of the next three options is used, this path will be prepended to wikilinks.')
+ );
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_wikitools_'.$format] = array(
+ '#type' => 'checkbox',
+ '#title' => l(t('Use wikitools?'), 'http://drupal.org/project/wikitools'),
+ '#default_value' => pearwiki_filter_use_wikitools($format),
+ '#description' => t('Use wikitools to create links. When enabled, all links are passed to the wikitools module for handling and have the wikipath prepended which is specified in the wikitools settings. The module wikitools has to be enabled.'),
+ );
+ if (!module_exists('wikitools')) {
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_wikitools_'.$format]['#default_value'] = false;
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_wikitools_'.$format]['#attributes'] = array('disabled' => 'disabled');
+ }
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_liquid_'.$format] = array(
+ '#type' => 'checkbox',
+ '#title' => l(t('Use liquid?'), 'http://drupal.org/project/liquid'),
+ '#default_value' => pearwiki_filter_use_wikitools($format),
+ '#description' => t('Use liquid to create links. When enabled, all wikilinks are of the form \'wiki/Page Title\'. The module liquid has to be enabled.'),
+ );
+ if (!module_exists('liquid')) {
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_liquid_'.$format]['#default_value'] = false;
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_liquid_'.$format]['#attributes'] = array('disabled' => 'disabled');
+ }
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_freelinking_'.$format] = array(
+ '#type' => 'checkbox',
+ '#title' => l(t('Use freelinking?'), 'http://drupal.org/project/freelinking'),
+ '#default_value' => pearwiki_filter_use_freelinking($format),
+ '#description' => t('Use freelinking to create links. When enabled, all links are passed to the freelinking module for handling, thus they have the form \'freelinking/Page Title\'. The module freelinking has to be enabled, but you don\'t have to activate the freelinking filter for this format.'),
);
+ if (!module_exists('freelinking')) {
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_freelinking_'.$format]['#default_value'] = false;
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_use_freelinking_'.$format]['#attributes'] = array('disabled' => 'disabled');
+ }
+ $form['pearwiki_filter']['wikilinks']['pearwiki_filter_interwiki_mapping_'.$format] = array(
+ '#type' => 'textarea',
+ '#title' => t('Interwiki Mapping'),
+ '#default_value' => pearwiki_filter_interwiki_mapping_text($format),
+ '#description' => t('A list of interwiki mappings Each line denotes one mapping. The format is: title | interwiki name | mapping url.
<path> is a special mapping url which will be transformed into a Drupal path for the current site.')
+ );
+ // Image options
+ // -------------
+ $form['pearwiki_filter']['images'] = array(
+ '#type' => 'fieldset',
+ '#title' => 'Images',
+ '#description' => t('The following options control the behavior when image links are used.')
+ );
+ $form['pearwiki_filter']['images']['pearwiki_filter_image_base_'.$format] = array(
+ '#type' => 'textfield',
+ '#title' => t('Base path for images'),
+ '#default_value' => pearwiki_filter_image_base($format),
+ '#description' => t('Base path for images. Images will be looked for in this directory.')
+>>>>>>> 1.8
+ );
+<<<<<<< pearwiki_filter.module
$form['pearwiki_filter']['wikilinks']['pearwiki_filter_wikilink_base_'.$format] = array(
'#type' => 'textfield',
'#title' => t('Base path for wikilinks'),
@@ -227,6 +310,10 @@ function pearwiki_filter_filter_settings
);
if (module_exists('image')) {
$form['pearwiki_filter']['images']['pearwiki_filter_use_image_'.$format] = array(
+=======
+ if (module_exists('image')) {
+ $form['pearwiki_filter']['images']['pearwiki_filter_use_image_'.$format] = array(
+>>>>>>> 1.8
'#type' => 'checkbox',
'#title' => l(t('Use image module?'), 'http://drupal.org/project/image'),
'#default_value' => pearwiki_filter_use_image($format),
@@ -261,42 +348,99 @@ function pearwiki_filter_syntax($format,
/**
* Location of override directory for $format
*/
+<<<<<<< pearwiki_filter.module
+function pearwiki_filter_pear_override_directory($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_override_path_'.$format, getcwd().'/'.drupal_get_path('module', 'pearwiki_filter').'/pear_override');
+ }
+ variable_set('pearwiki_filter_override_path_'.$format, $value);
+}
+
+/**
+ * Location of PEAR packages for $format.
+ */
+function pearwiki_filter_pear_path($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_pear_path_'.$format, getcwd().'/'.drupal_get_path('module', 'pearwiki_filter').'/');
+ }
+ variable_set('pearwiki_filter_pear_path_'.$format, $value);
+=======
function pearwiki_filter_pear_override_directory($format, $value = NULL) {
if (is_null($value)) {
return variable_get('pearwiki_filter_override_path_'.$format, getcwd().'/'.drupal_get_path('module', 'pearwiki_filter').'/pear_override');
}
variable_set('pearwiki_filter_override_path_'.$format, $value);
+>>>>>>> 1.8
}
/**
+<<<<<<< pearwiki_filter.module
+ * Is basic HTML allowed?
+=======
* Location of PEAR packages for $format.
+>>>>>>> 1.8
*/
+<<<<<<< pearwiki_filter.module
+function pearwiki_filter_allow_html($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_allow_html_'.$format, true);
+ }
+ variable_set('pearwiki_filter_allow_html_'.$format, $value);
+=======
function pearwiki_filter_pear_path($format, $value = NULL) {
if (is_null($value)) {
return variable_get('pearwiki_filter_pear_path_'.$format, getcwd().'/'.drupal_get_path('module', 'pearwiki_filter').'/');
}
variable_set('pearwiki_filter_pear_path_'.$format, $value);
+>>>>>>> 1.8
}
/**
+<<<<<<< pearwiki_filter.module
+ * Space-separated list of tag names which are ignored while rendering.
+=======
* Is basic HTML allowed?
+>>>>>>> 1.8
*/
+<<<<<<< pearwiki_filter.module
+function pearwiki_filter_ignore_tags($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_ignore_tags_'.$format, '');
+ }
+ variable_set('pearwiki_filter_ignore_tags_'.$format, $value);
+=======
function pearwiki_filter_allow_html($format, $value = NULL) {
if (is_null($value)) {
return variable_get('pearwiki_filter_allow_html_'.$format, true);
}
variable_set('pearwiki_filter_allow_html_'.$format, $value);
+>>>>>>> 1.8
}
/**
+<<<<<<< pearwiki_filter.module
+ * Regular expression whose match is ignored while rendering.
+=======
* Space-separated list of tag names which are ignored while rendering.
+>>>>>>> 1.8
*/
+<<<<<<< pearwiki_filter.module
+function pearwiki_filter_ignore_regexp($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_ignore_regexp_'.$format, '');
+ }
+ variable_set('pearwiki_filter_ignore_regexp_'.$format, $value);
+=======
function pearwiki_filter_ignore_tags($format, $value = NULL) {
if (is_null($value)) {
return variable_get('pearwiki_filter_ignore_tags_'.$format, '');
}
variable_set('pearwiki_filter_ignore_tags_'.$format, $value);
+>>>>>>> 1.8
}
+<<<<<<< pearwiki_filter.module
+
+=======
/**
* Regular expression whose match is ignored while rendering.
@@ -308,9 +452,17 @@ function pearwiki_filter_ignore_regexp($
variable_set('pearwiki_filter_ignore_regexp_'.$format, $value);
}
+>>>>>>> 1.8
/**
* Are wikilinks transformed into links?
*/
+<<<<<<< pearwiki_filter.module
+function pearwiki_filter_use_wiki_links($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_use_wiki_links_'.$format, true);
+ }
+ variable_set('pearwiki_filter_use_wiki_links_'.$format, $value);
+=======
function pearwiki_filter_use_wiki_links($format, $value = NULL) {
if (is_null($value)) {
return variable_get('pearwiki_filter_use_wiki_links_'.$format, true);
@@ -326,11 +478,33 @@ function pearwiki_filter_wikilink_base($
return variable_get('pearwiki_filter_wikilink_base_'.$format, 'wiki/');
}
variable_set('pearwiki_filter_wikilink_base_'.$format, $value);
+>>>>>>> 1.8
}
+<<<<<<< pearwiki_filter.module
/**
+ * Base path for wikilinks.
+ */
+function pearwiki_filter_wikilink_base($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_wikilink_base_'.$format, 'wiki/');
+ }
+ variable_set('pearwiki_filter_wikilink_base_'.$format, $value);
+}
+
+=======
+
+>>>>>>> 1.8
+/**
* Is freelinking used for wikilinks?
*/
+<<<<<<< pearwiki_filter.module
+function pearwiki_filter_use_freelinking($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_use_freelinking_'.$format, false);
+ }
+ variable_set('pearwiki_filter_use_freelinking_'.$format, $value);
+=======
function pearwiki_filter_use_freelinking($format, $value = NULL) {
if (is_null($value)) {
return variable_get('pearwiki_filter_use_freelinking_'.$format, false);
@@ -397,8 +571,74 @@ function pearwiki_filter_interwiki_mappi
}
}
return $mappings;
+>>>>>>> 1.8
+}
+<<<<<<< pearwiki_filter.module
+
+/**
+ * Is wikitools used for wikilinks?
+ */
+function pearwiki_filter_use_wikitools($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_use_wikitools_'.$format, false);
+ }
+ variable_set('pearwiki_filter_use_wikitools_'.$format, $value);
+}
+
+/**
+ * Is liquid used for wikilinks?
+ */
+function pearwiki_filter_use_liquid($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_use_liquid_'.$format, false);
+ }
+ variable_set('pearwiki_filter_use_liquid_'.$format, $value);
+}
+
+
+/**
+ * Unprocessed text for interwiki mappings.
+ */
+function pearwiki_filter_interwiki_mapping_text($format, $value = NULL) {
+ if (is_null($value)) {
+ return variable_get('pearwiki_filter_interwiki_mapping_'.$format, t('Local drupal path'). " | path | \ngroups.drupal.org | gdo | http://groups.drupal.org/freelinking/%s\nWikipedia | wp | http://en.wikipedia.org/wiki/%s\n");
+ }
+ variable_set('pearwiki_filter_interwiki_mapping_'.$format, $value);
+}
+
+/**
+ * Information about interwiki mappings.
+ * @param $op
+ * when 'url' is passed, returns an array with interwiki ids as key and url mapping as values
+ * when 'array' is passed, returns an array with interwiki ids as key and an associative array with 'id', 'title' and 'url' as values.
+ */
+function pearwiki_filter_interwiki_mappings($format, $op = 'url') {
+ $mappings = array();
+ $lines = explode("\n", pearwiki_filter_interwiki_mapping_text($format));
+ foreach($lines as $line) {
+ if ($line) {
+ list($title, $id, $url) = explode('|', $line, 3);
+ if (trim($url) == '') {
+ $url = str_replace('__QUERY_POSITION__', '%s', url('__QUERY_POSITION__'));
+ }
+ if ($op == 'url') {
+ $mappings[trim($id)] = trim($url);
+ }
+ elseif ($op == 'array') {
+ $mappings[trim($id)] = array(
+ 'id' => trim($id),
+ 'title' => trim($title),
+ 'url' => trim($url)
+ );
+ }
+ }
+ }
+ return $mappings;
}
+=======
+
+>>>>>>> 1.8
/**
* Replacement for spaces in wiki links.
* Mediawiki ignores this option and always replaces with an underscore
@@ -731,3 +971,29 @@ function pearwiki_filter_default_help($o
function pearwiki_filter_default_config(&$wiki) {
}
+
+/**
+ * Implementation of hook_img_assist().
+ */
+function pearwiki_filter_img_assist() {
+ return array(
+ array(
+ 'id' => 'mediawiki',
+ 'name' => 'Mediawiki',
+ 'javascript' => drupal_get_path('module', 'pearwiki_filter') . '/img_assist_plugin.js',
+ 'css' => ''
+ ),
+ array(
+ 'id' => 'dokuwiki',
+ 'name' => 'Dokuwiki',
+ 'javascript' => drupal_get_path('module', 'pearwiki_filter') . '/img_assist_plugin.js',
+ 'css' => ''
+ ),
+ array(
+ 'id' => 'creole',
+ 'name' => 'Creole',
+ 'javascript' => drupal_get_path('module', 'pearwiki_filter') . '/img_assist_plugin.js',
+ 'css' => ''
+ )
+ );
+}
\ No newline at end of file