WordPress.org

Plugin Directory

Changeset 665515


Ignore:
Timestamp:
02/09/13 06:49:00 (5 years ago)
Author:
rsantor
Message:

tagging version 0.6

Location:
text-beautify/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • text-beautify/trunk/readme.txt

    r531580 r665515  
    66Tags: grammar, text, case, punctuation, text beautify, aesthetics, sentence case, title case, curly quotes 
    77Requires at least: 2.0.2 
    8 Tested up to: 3.3.1 
    9 Stable tag: 0.5 
     8Tested up to: 3.5.1 
     9Stable tag: 0.6 
    1010 
    1111Cleans up posts and comments for sentence case or title case, fixes punctuation, makes quotes and commas curly, and allows custom enhancements. 
     
    5454== Changelog == 
    5555 
     56= 0.6 = 
     57* Fixed significant bug wherein some beautified text was getting mangled or stripped. It would only happen on occasional page loads. Thanks to James Burnby who alerted me to this issue. 
     58 
    5659= 0.5 = 
    5760* Plugin will now automatically leave any text contained within square brackets untouched. Example: if [some plugin="CODE"] is in your body of text, it will be passed through as-is. This is because it's very common for other WordPress plugins to use such special bracket tags to do their own special processing. 
  • text-beautify/trunk/text-beautify.php

    r531580 r665515  
    55Plugin URI: http://rommelsantor.com/clog/2012/02/09/text-beautify-wordpress-plugin/ 
    66Description: Intelligently cleans up the case of blog post title/contents and/or comments to display in sentence case or title case, cleans up sloppy punctuation, makes quotes and commas curly, and allows other admin-customizable text enhancements. This is primarily targeted at the discerning blogger and designer type who is concerned with the aesthetics of the typewritten word. 
    7 Version: 0.5 
     7Version: 0.6 
    88Author: Rommel Santor 
    99Author URI: http://rommelsantor.com 
     
    168168    if (preg_match_all('#\[[^]]+\]#', $i_str, $m)) { 
    169169      foreach ($m[0] as $orig) { 
    170         $tmp = '<!--' . md5(rand()) . '-->'; 
     170        $tmp = '<!--X' . preg_replace('#\W#', '', crc32(rand())) . 'X-->'; 
    171171        $i_str = str_replace($orig, $tmp, $i_str); 
    172172        $tags[$tmp] = $orig; 
     
    176176    $pieces = array(); 
    177177 
    178     // we must account for tags so we don't process strings contained within 
    179     if (preg_match_all('#<[^<>]+>#s', $i_str, $m)) { 
    180       $splitter = '<!--++' . strtolower(md5(rand())) . '++-->'; 
    181       $placeholder = '<!--' . strtolower(md5(rand())) . '-->'; 
    182  
    183       $i_str = preg_replace('#<[^<>]+>#s', $splitter . $placeholder, $i_str); 
     178    // we must account for meta data so we don't process chars contained within 
     179    if (preg_match_all('#<(?!!--)[^<>]+>#s', $i_str, $m)) { 
     180      $splitter = '<!--++X' . preg_replace('#\W#', '', crc32(rand())) . 'X++-->'; 
     181      $placeholder = '<!--X' . preg_replace('#\W#', '', crc32(rand())) . 'X-->'; 
     182 
     183      $i_str = preg_replace('#<(?!!--)[^<>]+>#s', $splitter . $placeholder, $i_str); 
    184184      $pieces = explode($splitter, $i_str); 
    185185    } 
    186186    else 
    187187      $pieces = array($i_str); 
     188 
     189    $comma = '<!--X' . preg_replace('#\W#', '', crc32(rand())) . 'X-->'; 
    188190 
    189191    foreach ($pieces as $i => $str) { 
     
    206208        } 
    207209      } 
    208  
    209       if ($this->opts['enable_comma']) 
    210         $comma = '<!--' . md5(rand()) . '-->'; 
    211       else 
    212         $comma = ','; 
    213210 
    214211      $style = ' style="font-family:georgia' . $comma . 'serif;"'; 
     
    262259      } 
    263260 
    264       if ($this->opts['enable_comma']) { 
     261      if ($this->opts['enable_comma']) 
    265262        $str = str_replace(',', '<span style="font-family:georgia,serif;">&sbquo;</span>', $str); 
    266         $str = str_replace($comma, ',', $str); 
    267       } 
     263      
     264      $str = str_replace($comma, ',', $str); 
    268265 
    269266      $pieces[$i] = $str; 
Note: See TracChangeset for help on using the changeset viewer.