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

Diff of /contributions/modules/marksmarty/marksmarty.module

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

revision 1.13, Sun Mar 20 16:57:02 2005 UTC revision 1.13.2.1, Sat Oct 7 19:48:09 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: marksmarty.module,v 1.12 2005/03/20 16:48:32 teradome Exp $  // $Id: marksmarty.module,v 1.13 2005/03/20 16:57:02 teradome Exp $
   
 ini_set('include_path', ini_get('include_path') . ':' . getcwd() . '/modules/marksmarty/');  
   
 require_once('markdown.php');  
 require_once('smartypants.php');  
3    
4  /********************************************************************  /********************************************************************
5   * Drupal Hooks   * Drupal Hooks
# Line 65  function marksmarty_help($in_section = ' Line 60  function marksmarty_help($in_section = '
60   ********************************************************************/   ********************************************************************/
61    
62  function _marksmarty_process($text, $format) {  function _marksmarty_process($text, $format) {
63      require_once(dirname(__FILE__) . '/markdown.php');
64      require_once(dirname(__FILE__) . '/smartypants.php');
65      if (variable_get("marksmarty_is_markdown_on_$format", 1) == 1) {
66        $text = Markdown($text);
67      }
68    if (variable_get("marksmarty_is_smarty_on_$format", 1) == 1) {    if (variable_get("marksmarty_is_smarty_on_$format", 1) == 1) {
69      global $smartypants_attr;      global $smartypants_attr;
70      $smartypants_attr = variable_get("marksmarty_smarty_hyphens_$format", 0) + 1;      $smartypants_attr = variable_get("marksmarty_smarty_hyphens_$format", 0) + 1;
71      return SmartyPants(Markdown($text));      $text = SmartyPants($text);
   }  
   else {  
     return Markdown($text);  
72    }    }
73      return $text;
74  }  }
75    
76  function _marksmarty_settings($format) {  function _marksmarty_settings($format) {
77      require_once(dirname(__FILE__) . '/markdown.php');
78      require_once(dirname(__FILE__) . '/smartypants.php');
79    $the_output = 'Markdown is enabled. Please read the <a href="http://daringfireball.net/projects/markdown/syntax">Markdown documentation</a> for full details on its formatting syntax.';    $the_output = 'Markdown is enabled. Please read the <a href="http://daringfireball.net/projects/markdown/syntax">Markdown documentation</a> for full details on its formatting syntax.';
80      $the_output .= form_select(t('Enable Markdown?'), "marksmarty_is_markdown_on_$format", variable_get("marksmarty_is_markdown_on_$format", 1), array(0 => t('No'), 1 => t('Yes')) );
81    $the_output .= form_select(t('Enable SmartyPants?'), "marksmarty_is_smarty_on_$format", variable_get("marksmarty_is_smarty_on_$format", 1), array(0 => t('No'), 1 => t('Yes')) );    $the_output .= form_select(t('Enable SmartyPants?'), "marksmarty_is_smarty_on_$format", variable_get("marksmarty_is_smarty_on_$format", 1), array(0 => t('No'), 1 => t('Yes')) );
82    $the_output .= form_select(t('Hyphenation settings for SmartyPants'), "marksmarty_smarty_hyphens_$format", variable_get("marksmarty_smarty_hyphens_$format", 0), 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')) );    $the_output .= form_select(t('Hyphenation settings for SmartyPants'), "marksmarty_smarty_hyphens_$format", variable_get("marksmarty_smarty_hyphens_$format", 0), 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')) );
83    $the_output .= 'Markdown PHP Version: <a href="http://www.michelf.com/projects/php-markdown/">'.$GLOBALS['MarkdownPHPVersion'].'</a><br />';    $the_output .= 'Markdown PHP Version: <a href="http://www.michelf.com/projects/php-markdown/">'.$GLOBALS['MarkdownPHPVersion'].'</a><br />';

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.13.2.1

  ViewVC Help
Powered by ViewVC 1.1.2