Index: php-typogrify.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typogrify/php-typogrify.php,v
retrieving revision 1.2
diff -a -u -r1.2 php-typogrify.php
--- php-typogrify.php 10 Jul 2007 00:20:01 -0000 1.2
+++ php-typogrify.php 18 Sep 2008 22:19:42 -0000
@@ -261,5 +261,3 @@
// Strip the potential HTML in the header
add_filter('wp_title', 'strip_tags');
}
-
-?>
\ No newline at end of file
Index: smartypants.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typogrify/smartypants.php,v
retrieving revision 1.1
diff -a -u -r1.1 smartypants.php
--- smartypants.php 7 Jun 2007 13:47:15 -0000 1.1
+++ smartypants.php 18 Sep 2008 22:19:44 -0000
@@ -857,4 +857,3 @@
possibility of such damage.
*/
-?>
\ No newline at end of file
Index: typogrify.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typogrify/typogrify.info,v
retrieving revision 1.5
diff -a -u -r1.5 typogrify.info
--- typogrify.info 27 Jul 2007 04:03:33 -0000 1.5
+++ typogrify.info 18 Sep 2008 22:19:44 -0000
@@ -3,24 +3,6 @@
name = Typogrify
description = Adds typographic refinements.
package = "Input filters"
-dependencies = filter
+dependencies[] = filter
project = "typogrify"
-
-
-; Information added by drupal.org packaging script on 2007-06-19
-version = "5.x-1.x-dev"
-project = "typogrify"
-datestamp = "1182212752"
-
-
-; Information added by drupal.org packaging script on 2007-07-10
-version = "5.x-1.x-dev"
-project = "typogrify"
-datestamp = "1184069636"
-
-
-; Information added by drupal.org packaging script on 2007-07-24
-version = "5.x-1.x-dev"
-project = "typogrify"
-datestamp = "1185279036"
-
+core = 6.x
Index: typogrify.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typogrify/typogrify.module,v
retrieving revision 1.4
diff -a -u -r1.4 typogrify.module
--- typogrify.module 27 Jul 2007 04:03:33 -0000 1.4
+++ typogrify.module 18 Sep 2008 22:19:45 -0000
@@ -1,10 +1,16 @@
@@ -35,22 +44,27 @@
Wraps multiple capital letters with <span class=\"caps\">CAPS</span>.
Wraps initial quotation marks with <span class=\"quo\"></span> or <span class=\"dquo\"></span>.
Adds a css style sheet that uses the <span> tags to substitute a showy ampersand in headlines, switch caps to small caps, and hang initial quotation marks.');
- } else {
+ }
+ else {
$the_output = t('Adds typographic refinements.');
}
return $the_output;
}
-function typogrify_menu($may_cache) {
- drupal_add_css(drupal_get_path('module', 'typogrify'). '/typogrify.css', 'module', 'all', TRUE);
+/**
+ * Implementation of hook_filter_init().
+ */
+function typogrify_init() {
+ drupal_add_css(drupal_get_path('module', 'typogrify') .'/typogrify.css');
}
/**
* Implementation of hook_help().
*/
-function typogrify_help($in_section = 'admin/help#typogrify') {
- switch ($in_section) {
+function typogrify_help($path, $arg) {
+ $the_output = '';
+ switch ($path) {
case 'admin/settings/modules#description':
$the_output = t('Adds typographic refinements.');
break;
@@ -65,34 +79,35 @@
/********************************************************************
* Module Functions
- ********************************************************************/
+ *******************************************************************
+ */
function _typogrify_process($text, $format) {
// Load Helpers
- require_once(dirname(__FILE__) . '/php-typogrify.php');
- require_once(dirname(__FILE__) . '/unicode-conversion.php');
+ module_load_include('php', 'typogrify', 'php-typogrify');
+ module_load_include('php', 'typogrify', 'unicode-conversion');
if (! function_exists('smartypants')) {
- require_once(dirname(__FILE__) . '/smartypants.php');
+ module_load_include('php', 'typogrify', 'smartypants');
}
-
+
// Wrap ampersands
if (variable_get("typogrify_is_amp_on_$format", 1) == 1) {
$text = amp($text);
}
-
+
// Remove widows
if (variable_get("typogrify_is_widont_on_$format", 1) == 1) {
$text = widont($text);
}
-
+
// Smartypants formatting
if (variable_get("marksmarty_is_smarty_on_$format", 1) == 1) {
global $smartypants_attr;
$smartypants_attr = variable_get("marksmarty_smarty_hyphens_$format", 0) + 1;
$text = SmartyPants($text);
}
-
+
// Wrap caps
if (variable_get("typogrify_is_caps_on_$format", 1) == 1) {
$text = caps($text);
@@ -107,26 +122,26 @@
global $ligature_map;
if ((is_array($ligature_map)) && (count($ligature_map) > 0)) {
foreach ($ligature_map as $pair => $ligature) {
- $setting = 'typogrify_use_' . $pair . '_ligature_' . $format;
+ $setting = 'typogrify_use_'. $pair .'_ligature_'. $format;
if (variable_get($setting, 0) == 1) {
$characters_to_convert[] = $pair;
}
}
}
-
+
// Build a list of arrows to convert
global $arrow_map;
if ((is_array($arrow_map)) && (count($arrow_map) > 0)) {
foreach ($arrow_map as $ascii => $unicode) {
- $setting = 'typogrify_use_unicode_for_' . $ascii . '_' . $format;
+ $setting = 'typogrify_use_unicode_for_'. $ascii .'_'. $format;
if (variable_get($setting, 0) == 1) {
$characters_to_convert[] = $ascii;
}
}
}
-
+
// Convert ligatures and arrows
- if (count($characters_to_convert) > 0){
+ if (count($characters_to_convert) > 0) {
$text = convert_characters($text, $characters_to_convert);
}
@@ -134,8 +149,11 @@
}
function _typogrify_settings($format) {
-
- require_once(dirname(__FILE__) . '/unicode-conversion.php');
+ module_load_include('php', 'typogrify', 'php-typogrify');
+ module_load_include('php', 'typogrify', 'unicode-conversion');
+ if (! function_exists('smartypants')) {
+ module_load_include('php', 'typogrify', 'smartypants');
+ }
$form['typogrify_settings'] = array(
'#type' => 'fieldset',
@@ -143,12 +161,12 @@
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
-
+
$form['typogrify_settings']['help'] = array(
'#type' => 'markup',
'#value' => 'Enable the following typographic refinements:
',
);
-
+
// Smartypants settings
// We impersonate Marksmarty to ensure that settings are honored by both marksmarty.module and typogrify.module
if (! function_exists('smartypants')) {
@@ -158,7 +176,7 @@
'#title' => t('Use typographers quotation marks and dashes (SmartyPants)'),
'#default_value' => variable_get("marksmarty_is_smarty_on_$format", 1),
);
-
+
// Smartypants hyphenation settings
$form['typogrify_settings']["marksmarty_smarty_hyphens_$format"] = array(
'#type' => 'select',
@@ -173,28 +191,28 @@
'#title' => t('Wrap ampersands'),
'#default_value' => variable_get("typogrify_is_amp_on_$format", 1),
);
-
+
// Remove widows settings
$form['typogrify_settings']["typogrify_is_widont_on_$format"] = array(
'#type' => 'checkbox',
'#title' => t('Remove widows'),
'#default_value' => variable_get("typogrify_is_widont_on_$format", 1),
);
-
+
// Wrap caps settings
$form['typogrify_settings']["typogrify_is_caps_on_$format"] = array(
'#type' => 'checkbox',
'#title' => t('Wrap caps'),
'#default_value' => variable_get("typogrify_is_caps_on_$format", 1),
);
-
+
// Wrap initial quotes settings
$form['typogrify_settings']["typogrify_is_initial_quotes_on_$format"] = array(
'#type' => 'checkbox',
'#title' => t('Wrap quotation marks'),
'#default_value' => variable_get("typogrify_is_initial_quotes_on_$format", 1),
);
-
+
// Ligature Conversion Settings
$form['typogrify_settings']['ligatures'] = array(
'#type' => 'fieldset',
@@ -203,15 +221,16 @@
'#collapsed' => TRUE,
);
+ global $ligature_map;
foreach ($ligature_map as $pair => $ligature) {
- $setting = 'typogrify_use_' . $pair . '_ligature_' . $format;
+ $setting = 'typogrify_use_'. $pair .'_ligature_'. $format;
$form['typogrify_settings']['ligatures'][$setting] = array(
'#type' => 'checkbox',
'#title' => t("Convert $pair to $ligature"),
'#default_value' => variable_get($setting, 0),
);
}
-
+
// Arrow Conversion Settings
$form['typogrify_settings']['arrows'] = array(
@@ -221,21 +240,23 @@
'#collapsed' => TRUE,
);
+ global $arrow_map;
foreach ($arrow_map as $ascii => $unicode) {
- $setting = 'typogrify_use_unicode_for_' . $ascii . '_' . $format;
+ $setting = 'typogrify_use_unicode_for_'. $ascii .'_'. $format;
$form['typogrify_settings']['arrows'][$setting] = array(
'#type' => 'checkbox',
'#title' => t("Convert $ascii to $unicode"),
'#default_value' => variable_get($setting, 0),
);
}
-
-
+
+
// Version Information Settings
$the_output = '';
- if (! function_exists('smartypants')) {
- $the_output .= '- SmartyPants PHP Version: '.$GLOBALS['SmartyPantsPHPVersion'].'
';
- $the_output .= '- SmartyPants Syntax Version: '.$GLOBALS['SmartyPantsSyntaxVersion'] .'
';
+ if (function_exists('smartypants')) {
+ $the_output .= '- SmartyPants PHP Version: ';
+ $the_output .= $GLOBALS['SmartyPantsPHPVersion'] .'
';
+ $the_output .= '- SmartyPants Syntax Version: '. $GLOBALS['SmartyPantsSyntaxVersion'] .'
';
}
$the_output .= '- PHP Typogrify Version: 1.0
';
$the_output .= '
';
@@ -254,5 +275,3 @@
return $form;
}
-
-?>
\ No newline at end of file
Index: unicode-conversion.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typogrify/unicode-conversion.php,v
retrieving revision 1.2
diff -a -u -r1.2 unicode-conversion.php
--- unicode-conversion.php 24 Jul 2007 01:57:09 -0000 1.2
+++ unicode-conversion.php 18 Sep 2008 22:19:46 -0000
@@ -136,5 +136,3 @@
return $tokens;
}
}
-
-?>
\ No newline at end of file