/[drupal]/contributions/modules/textile/textile.module
ViewVC logotype

Diff of /contributions/modules/textile/textile.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.19.2.1, Thu Mar 1 18:12:43 2007 UTC revision 1.19.2.2, Thu Jun 28 00:53:34 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: textile.module,v 1.19 2007/02/15 18:10:10 jhriggs Exp $  // $Id: textile.module,v 1.21 2007/06/28 00:26:09 joshk Exp $
3    
4  /**  /**
5   * The textile module allows input of Textile shorthand.   * The textile module allows input of Textile shorthand.
6   *   *
7   * @version $Id: textile.module,v 1.19 2007/02/15 18:10:10 jhriggs Exp $   * @version $Id: textile.module,v 1.21 2007/06/28 00:26:09 joshk Exp $
8   * @copyright Copyright (c) 2003-2007 Jim Riggs.  All rights reserved.   * @copyright Copyright (c) 2003-2007 Jim Riggs.  All rights reserved.
9   * @author Jim Riggs <drupal at jim and lissa dot com>   * @author Jim Riggs <drupal at jim and lissa dot com>
10   */   */
# Line 351  function textile_help($section = 'admin/ Line 351  function textile_help($section = 'admin/
351    }    }
352  }  }
353    
354    /**
355     * Implementation of hook_enable()
356     *
357     * Run a check for the library and set an error message if not present.
358     */
359    function hook_enable() {
360      if ($error = _textile_lib_check()) {
361        drupal_set_message($error, 'error');
362      }
363    }
364    
365    
366  /********************************************************************  /********************************************************************
367   * Module Functions   * Module Functions
368   ********************************************************************/   ********************************************************************/
# Line 371  function _textile_process($matches) { Line 383  function _textile_process($matches) {
383    static $textile = NULL;    static $textile = NULL;
384    
385    if ($textile === NULL) {    if ($textile === NULL) {
386      require_once(dirname(__FILE__) . '/DrupalTextile.inc');      $path = drupal_get_path('module', 'textile');
387        include_once($path . '/classTextile.php');
388    
389      $textile = new DrupalTextile(array('charset' => 'UTF-8', 'char_encoding' => 0, 'smarty_mode' => DEFAULT_OPERATION_MODE));      $textile = new Textile();
390        //$textile->hu is the string that preceeds all relative URLs.
391        //So I copied the part of url() implementation in common.inc
392        //not tested in real non-Apache webserver yet
393        $textile->hu = base_path().((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE) ? 'index.php' : '').((bool)variable_get('clean_url', '0') ? '' : '?q=');
394    }    }
395      //should there be any encoding declaration of some sort?  Can't find how to do it though
396    return $textile->process($matches[1]);    return $textile->TextileThis($matches[1]);
397  }  }
398    
399  ?>  /**
400     * Checking that the classTextile.php library is installed, and if not return an error string.
401     */
402    
403    function _textile_lib_check() {
404      $path = drupal_get_path('module', 'textile');
405      if (!file_exists($path .'/classTextile.php')) {
406        return t('The classTextile.php library is missing. Drupal cannot use textile markup without this library. Please check the <a href="@url">textile module INSTALL documentation</a> for information on how to download this.', array('@url' => 'http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/textile/INSTALL.txt'));
407      }
408    }

Legend:
Removed from v.1.19.2.1  
changed lines
  Added in v.1.19.2.2

  ViewVC Help
Powered by ViewVC 1.1.2