WordPress.org

Plugin Directory

Changeset 487825


Ignore:
Timestamp:
01/10/12 23:25:36 (6 years ago)
Author:
tfnab
Message:

bugfix: now catches if option was not yet set; i18n and German L10n; tested with older versions of WordPress: now supports back to 2.9

Location:
smart-quotes/trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • smart-quotes/trunk/readme.txt

    r486160 r487825  
    33Donate link: http://ten-fingers-and-a-brain.com/donate/ 
    44Tags: smart quotes, curly quotes, curly, quotes, wptexturize 
    5 Requires at least: 3.2 
     5Requires at least: 2.9 
    66Tested up to: 3.3 
    7 Stable tag: 0.2 
     7Stable tag: trunk 
    88 
    99Change the quotation marks that are automatically rendered as smart or curly quotes inside your content. 
     
    1111== Description == 
    1212 
    13 Change the quotation marks, that are automatically rendered as smart or curly quotes inside your content, from the default English style (“…”) to anything you like, e.g. to Croatian/Hungarian/Polish/Romanian style quotation marks („…”), Czech or German style („…“), Danish style (»…«), Finnish or Swedish style (”…”), French style (« … » – with spaces), Greek/Italian/Norwegian/Potuguese/Russian/Spanish/Swiss style («…» – without spaces), Japanese or Traditional Chinese style (「⋯」), or actually to any arbitrary character combination of your choice. Of course you can turn off curly quotes entirely by picking the so-called "dumb" quotes ("…"). 
     13Change the quotation marks, that are automatically rendered as smart or curly quotes inside your content, from the default English style (“…”) to anything you like, e.g. to Croatian/Hungarian/Polish/Romanian style quotation marks („…”), Czech or German style („…“), Danish style (»…«), Finnish or Swedish style (”…”), French style (« … » – with spaces), Greek/Italian/Norwegian/Portuguese/Russian/Spanish/Swiss style («…» – without spaces), Japanese or Traditional Chinese style (「⋯」), or actually to any arbitrary character combination of your choice. Of course you can turn off curly quotes entirely by picking the so-called "dumb" quotes ("…"). 
    1414 
    1515== Installation == 
     
    2020 
    2121== Changelog == 
     22 
     23= 0.3 = 
     24* fixed bug where CSS styles for <q> element were styled incorrectly when user hadn't picked quotation marks 
     25* i18n 
     26* L10n for German (de_DE) 
     27* tested with older WordPress versions: now tagged to require 2.9 (instead of 3.2) 
    2228 
    2329= 0.2 = 
     
    3137== Upgrade Notice == 
    3238 
     39= 0.3 = 
     40bugfix release; German language file added (Deutsche Übersetzung) 
     41 
    3342= 0.2 = 
    3443added support for the <q> element 
  • smart-quotes/trunk/smart-quotes.php

    r487815 r487825  
    44Plugin URI: http://ten-fingers-and-a-brain.com/wordpress-plugins/smart-quotes/ 
    55Version: 0.3 
    6 Description: Change the quotation marks, that are automatically rendered as smart or curly quotes inside your content, from the default English style (“…”) to anything you like, e.g. to Croatian/Hungarian/Polish/Romanian style quotation marks („…”), Czech or German style („…“), Danish style (»…«), Finnish or Swedish style (”…”), French style (« … » – with spaces), Greek/Italian/Norwegian/Potuguese/Russian/Spanish/Swiss style («…» – without spaces), Japanese or Traditional Chinese style (「⋯」), or actually to any arbitrary character combination of your choice. Of course you can turn off curly quotes entirely by picking the so-called "dumb" quotes ("…"). 
     6Description: Change the quotation marks, that are automatically rendered as smart or curly quotes inside your content, from the default English style (“…”) to anything you like, e.g. to Croatian/Hungarian/Polish/Romanian style quotation marks („…”), Czech or German style („…“), Danish style (»…«), Finnish or Swedish style (”…”), French style (« … » – with spaces), Greek/Italian/Norwegian/Portuguese/Russian/Spanish/Swiss style («…» – without spaces), Japanese or Traditional Chinese style (「⋯」), or actually to any arbitrary character combination of your choice. Of course you can turn off curly quotes entirely by picking the so-called "dumb" quotes ("…"). 
    77Author: Martin Lormes 
    88Author URI: http://ten-fingers-and-a-brain.com/ 
     
    3636{ 
    3737  static $quote1, $quote2; 
     38  static $quotes_set = false; 
    3839  if ( empty( $quote1 ) ) 
    3940  { 
    40     $option = get_option( 'smart-quotes' ); 
     41    $quotes_set = ( false !== ( $option = get_option( 'smart-quotes' ) ) ); 
    4142    $quote1 = ( is_array( $option ) && isset( $option['opening'] ) ) ? trim( $option['opening'] ) : '“'; 
    4243    $quote2 = ( is_array( $option ) && isset( $option['closing'] ) ) ? trim( $option['closing'] ) : '”'; 
    4344  } 
    44   return array( $quote1, $quote2 ); 
     45  return array( $quote1, $quote2, $quotes_set ); 
    4546} // function tfnab_smart_quotes_get_option 
    4647 
     
    4950{ 
    5051  if ( 'default' != $domain ) return $s; 
    51   list( $quote1, $quote2 ) = tfnab_smart_quotes_get_option(); 
     52  list( $quote1, $quote2, $quotes_set ) = tfnab_smart_quotes_get_option(); 
     53  if ( !$quotes_set ) return $s; 
    5254  if ( 'opening curly quote' == $context && '&#8220;' == $original ) return str_replace( array( '<', '>' ), array( '&lt;', '&gt;' ), $quote1 ); 
    5355  if ( 'closing curly quote' == $context && '&#8221;' == $original ) return str_replace( array( '<', '>' ), array( '&lt;', '&gt;' ), $quote2 ); 
     
    6365function tfnab_smart_quotes_wp_head () 
    6466{ 
    65   list( $quote1, $quote2 ) = tfnab_smart_quotes_get_option(); 
     67  list( $quote1, $quote2, $quotes_set ) = tfnab_smart_quotes_get_option(); 
     68  if ( $quotes_set ) : 
    6669  ?> 
    6770  <style type="text/css">/*<![CDATA[*/ 
     
    7477  /*]]>*/</style> 
    7578  <?php 
     79  endif; 
    7680} // function tfnab_smart_quotes_wp_head 
    7781add_action( 'wp_head', 'tfnab_smart_quotes_wp_head' ); 
     
    116120        <li><a href="#" onclick="set_smart_quotes('&#8221;','&#8221;');return false;" title="<?php _e( 'Finnish, Swedish', 'smart-quotes' ); ?>">&#8221;&#8230;&#8221;</a></li> 
    117121        <li><a href="#" onclick="set_smart_quotes('&#171;&nbsp;','&nbsp;&#187;');return false;" title="<?php _e( 'French (with spaces)', 'smart-quotes' ); ?>">&#171;&nbsp;&#8230;&nbsp;&#187;</a></li> 
    118         <li><a href="#" onclick="set_smart_quotes('&#171;','&#187;');return false;" title="<?php _e( 'Greek, Italian, Norwegian, Potuguese, Russian, Spanish, Swiss (without spaces)', 'smart-quotes' ); ?>">&#171;&#8230;&#187;</a></li> 
     122        <li><a href="#" onclick="set_smart_quotes('&#171;','&#187;');return false;" title="<?php _e( 'Greek, Italian, Norwegian, Portuguese, Russian, Spanish, Swiss (without spaces)', 'smart-quotes' ); ?>">&#171;&#8230;&#187;</a></li> 
    119123        <li><a href="#" onclick="set_smart_quotes('&#12300;','&#12301;');return false;" title="<?php _e( 'Japanese, Traditional Chinese', 'smart-quotes' ); ?>">&#12300;&#8943;&#12301;</a></li> 
    120124        <li><a href="#" onclick="set_smart_quotes('&quot;','&quot;');return false;" title="<?php _e( '&quot;dumb quotes&quot;', 'smart-quotes' ); ?>">&quot;&#8230;&quot;</a></li> 
Note: See TracChangeset for help on using the changeset viewer.