| 1 |
<?php |
<?php |
| 2 |
// $Id: textile.module,v 1.20 2007/03/01 18:16:02 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.20 2007/03/01 18:16:02 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 |
*/ |
*/ |
| 337 |
/** |
/** |
| 338 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 339 |
*/ |
*/ |
| 340 |
function textile_help($section = 'admin/help#textile') { |
function textile_help($path = 'admin/help#textile', $arg) { |
| 341 |
switch ($section) { |
switch ($path) { |
| 342 |
case 'admin/help#textile': |
case 'admin/help#textile': |
| 343 |
return t(' |
return t(' |
| 344 |
<p> |
<p> |
| 356 |
* |
* |
| 357 |
* Run a check for the library and set an error message if not present. |
* Run a check for the library and set an error message if not present. |
| 358 |
*/ |
*/ |
| 359 |
function hook_enable() { |
function textile_enable() { |
| 360 |
if ($error = _textile_lib_check()) { |
if ($error = _textile_lib_check()) { |
| 361 |
drupal_set_message($error, 'error'); |
drupal_set_message($error, 'error'); |
| 362 |
} |
} |
| 384 |
|
|
| 385 |
if ($textile === NULL) { |
if ($textile === NULL) { |
| 386 |
$path = drupal_get_path('module', 'textile'); |
$path = drupal_get_path('module', 'textile'); |
| 387 |
include_once($path . '/classTextile.php'); |
include_once($path .'/classTextile.php'); |
| 388 |
|
|
| 389 |
$textile = new Textile(); |
$textile = new Textile(); |
| 390 |
//$textile->hu is the string that preceeds all relative URLs. |
//$textile->hu is the string that preceeds all relative URLs. |
| 391 |
//So I copied the part of url() implementation in common.inc |
//So I copied the part of url() implementation in common.inc |
| 392 |
//not tested in real non-Apache webserver yet |
//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='); |
$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 |
//should there be any encoding declaration of some sort? Can't find how to do it though |
| 396 |
return $textile->TextileThis($matches[1]); |
return $textile->TextileThis($matches[1]); |
| 403 |
function _textile_lib_check() { |
function _textile_lib_check() { |
| 404 |
$path = drupal_get_path('module', 'textile'); |
$path = drupal_get_path('module', 'textile'); |
| 405 |
if (!file_exists($path .'/classTextile.php')) { |
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')); |
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 |
} |
} |