' . t('The Textile module allows users to enter content using Textile, a simple, plain text syntax that is filtered into valid XHTML. The filter tips page provides syntax descriptions and examples.', array('@tips_url' => url('filter/tips'))) . '

'; } } /** * Textile filter. Provides filtering of Textile tags into XHTML. */ function _textile_process($text, $format) { if (variable_get("textile_tags_$format", 0)) { return preg_replace_callback( '{\[textile\](.*?)(\[/textile\]|$)}is', '_textile_match_process', $text ); } else { return _textile_match_process(array(NULL, $text)); } } /** * Helper function for preg_replace_callback(). */ function _textile_match_process($matches) { static $textile = NULL; $path = drupal_get_path('module', 'textile') . '/include'; if (empty($textile) && $path) { require_once './' . $path . '/classTextile.php'; $textile = new Textile(); // $textile->hu is the string that preceeds all relative URLs. $textile->hu = url(NULL); } return $textile->TextileThis($matches[1]); } /** * Settings callback for the Textile filter. */ function _textile_settings($format) { $form = array(); $form['textile_settings'] = array( '#type' => 'fieldset', '#title' => t('Textile filter'), '#collapsible' => TRUE ); $form['textile_settings']["textile_tags_$format"] = array( '#type' => 'checkbox', '#title' => t('Use tags'), '#default_value' => variable_get("textile_tags_$format", 0), '#description' => t('If enabled, only text between [textile] and optional [/textile] tags will be processed; otherwise, all text will be processed as Textile markup.') ); return $form; }