| 1 |
<?php |
<?php |
| 2 |
// $Id: marksmarty.module,v 1.17 2006/07/15 20:35:19 teradome Exp $ |
// $Id: marksmarty.module,v 1.18 2006/10/07 19:28:17 teradome Exp $ |
| 3 |
|
|
| 4 |
/******************************************************************** |
/******************************************************************** |
| 5 |
* Drupal Hooks |
* Drupal Hooks |
| 26 |
|
|
| 27 |
function marksmarty_filter_tips($delta = 0, $format = -1, $long) { |
function marksmarty_filter_tips($delta = 0, $format = -1, $long) { |
| 28 |
if ($long) { |
if ($long) { |
| 29 |
$the_output = t('Quick Tips:<ul> |
$the_output = t('Quick Tips:<ul> |
| 30 |
<li>Two or more spaces at a line\'s end = Line break</li> |
<li>Two or more spaces at a line\'s end = Line break</li> |
| 31 |
<li>Double returns = Paragraph</li> |
<li>Double returns = Paragraph</li> |
| 32 |
<li>*Single asterisks* or _single underscores_ = <em>Emphasis</em></li> |
<li>*Single asterisks* or _single underscores_ = <em>Emphasis</em></li> |
| 33 |
<li>**Double** or __double__ = <strong>Strong</strong></li> |
<li>**Double** or __double__ = <strong>Strong</strong></li> |
| 41 |
return $the_output; |
return $the_output; |
| 42 |
} |
} |
| 43 |
|
|
| 44 |
function marksmarty_help($in_section = 'admin/help#marksmarty') { |
function marksmarty_help($path = 'admin/help#marksmarty', $arg) { |
| 45 |
switch ($in_section) { |
switch ($path) { |
| 46 |
case 'admin/settings/modules#description': |
case 'admin/settings/modules#description': |
| 47 |
$the_output = t('Allows content to be submitted using Markdown, a simple plain-text syntax that is transformed into valid XHTML, and/or using SmartyPants, a filter for auto-translating plain ASCII characters to Unicode characters.'); |
$the_output = t('Allows content to be submitted using Markdown, a simple plain-text syntax that is transformed into valid XHTML, and/or using SmartyPants, a filter for auto-translating plain ASCII characters to Unicode characters.'); |
| 48 |
break; |
break; |
| 51 |
$the_output = t('<p>The Markdown with SmartyPants module allows you to enter content using <a href="http://daringfireball.net/projects/markdown">Markdown</a>, a simple plain-text syntax that is transformed into valid XHTML, and will automatically convert plain ASCII characters to their proper Unicode entities in context ("curly quotes," et al.) using <a href="http://daringfireball.net/projects/smartypants">SmartyPants</a>.</p>'); |
$the_output = t('<p>The Markdown with SmartyPants module allows you to enter content using <a href="http://daringfireball.net/projects/markdown">Markdown</a>, a simple plain-text syntax that is transformed into valid XHTML, and will automatically convert plain ASCII characters to their proper Unicode entities in context ("curly quotes," et al.) using <a href="http://daringfireball.net/projects/smartypants">SmartyPants</a>.</p>'); |
| 52 |
break; |
break; |
| 53 |
} |
} |
| 54 |
|
if (isset($the_output)) { |
| 55 |
return $the_output; |
return $the_output; |
| 56 |
|
} |
| 57 |
} |
} |
| 58 |
|
|
| 59 |
/******************************************************************** |
/******************************************************************** |
| 61 |
********************************************************************/ |
********************************************************************/ |
| 62 |
|
|
| 63 |
function _marksmarty_process($text, $format) { |
function _marksmarty_process($text, $format) { |
| 64 |
require_once(dirname(__FILE__) . '/markdown.php'); |
require_once(dirname(__FILE__) .'/markdown.php'); |
| 65 |
require_once(dirname(__FILE__) . '/smartypants.php'); |
require_once(dirname(__FILE__) .'/smartypants.php'); |
| 66 |
if (variable_get("marksmarty_is_markdown_on_$format", 1) == 1) { |
if (variable_get("marksmarty_is_markdown_on_$format", 1) == 1) { |
| 67 |
$text = Markdown($text); |
$text = Markdown($text); |
| 68 |
} |
} |
| 75 |
} |
} |
| 76 |
|
|
| 77 |
function _marksmarty_settings($format) { |
function _marksmarty_settings($format) { |
| 78 |
require_once(dirname(__FILE__) . '/markdown.php'); |
require_once(dirname(__FILE__) .'/markdown.php'); |
| 79 |
require_once(dirname(__FILE__) . '/smartypants.php'); |
require_once(dirname(__FILE__) .'/smartypants.php'); |
| 80 |
$form['markdown_settings'] = array( |
$form['markdown_settings'] = array( |
| 81 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 82 |
'#title' => t('Markdown with SmartyPants'), |
'#title' => t('Markdown with SmartyPants'), |
| 106 |
'#options' => array(0 => t('"--" for em-dashes; no en-dash support'), 1 => t('"---" for em-dashes; "--" for en-dashes'), 2 => t('"--" for em-dashes; "---" for en-dashes')), |
'#options' => array(0 => t('"--" for em-dashes; no en-dash support'), 1 => t('"---" for em-dashes; "--" for en-dashes'), 2 => t('"--" for em-dashes; "---" for en-dashes')), |
| 107 |
); |
); |
| 108 |
|
|
| 109 |
$the_output = '<p>Markdown PHP Version: <a href="http://www.michelf.com/projects/php-markdown/">'.$GLOBALS['MarkdownPHPVersion'].'</a><br />'; |
$links[] = 'Markdown PHP Version: <a href="http://www.michelf.com/projects/php-markdown/">'. $GLOBALS['MarkdownPHPVersion'] .'</a>'; |
| 110 |
$the_output .= 'Markdown Syntax Version: '.$GLOBALS['MarkdownSyntaxVersion'].'<br />'; |
$links[] .= 'Markdown Syntax Version: '. $GLOBALS['MarkdownSyntaxVersion']; |
| 111 |
$the_output .= 'SmartyPants PHP Version: <a href="http://www.michelf.com/projects/php-smartypants/">'.$GLOBALS['SmartyPantsPHPVersion'].'</a><br />'; |
$links[] .= 'SmartyPants PHP Version: <a href="http://www.michelf.com/projects/php-smartypants/">'. $GLOBALS['SmartyPantsPHPVersion'] .'</a>'; |
| 112 |
$the_output .= 'SmartyPants Syntax Version: '.$GLOBALS['SmartyPantsSyntaxVersion'] .'</p>'; |
$links[] .= 'SmartyPants Syntax Version: '. $GLOBALS['SmartyPantsSyntaxVersion']; |
| 113 |
|
|
| 114 |
$form['markdown_settings']['markdown_status'] = array( |
$form['markdown_settings']['markdown_status'] = array( |
| 115 |
'#type' => 'markup', |
'#title' => t('Versions'), |
| 116 |
'#value' => $the_output, |
'#type' => 'item', |
| 117 |
|
'#value' => theme('item_list', $links), |
| 118 |
); |
); |
| 119 |
|
|
| 120 |
return $form; |
return $form; |
|
} |
|
|
|
|
|
?> |
|
| 121 |
|
} |