WordPress.org

Plugin Directory

Changeset 524471


Ignore:
Timestamp:
03/27/12 21:22:36 (6 years ago)
Author:
rsantor
Message:

tagging version 0.4

Location:
text-beautify
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • text-beautify/tags/0.4/readme.txt

    r517944 r524471  
    77Requires at least: 2.0.2 
    88Tested up to: 3.3.1 
    9 Stable tag: 0.3 
     9Stable tag: 0.4 
    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.4 = 
     57* Fixed warning message on line 291 
     58* Added default case preservation for days of week, full month names, and short month names 
     59* Added ability to disable automatic case manipulation 
     60 
    5661= 0.3 = 
    5762* Corrected preg_match_all bug with invalid starting delimiter 
  • text-beautify/tags/0.4/text-beautify.php

    r517944 r524471  
    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.3 
     7Version: 0.4 
    88Author: Rommel Santor 
    99Author URI: http://rommelsantor.com 
     
    3232   * 
    3333   */ 
     34  function __get_default_opts($i_key = null) { 
     35    $opts = array( 
     36      'enable_blog' => true, 
     37      'enable_title' => true, 
     38      'enable_comment' => true, 
     39      'enable_autocase' => false, 
     40 
     41      'title_lc' => "a\nan\nin\nthe\nif\nin\nof\nand\nat\nby\nfor\non\nor\nto\nvia\nvs\nv\nis", 
     42 
     43      'enable_repchars' => true, 
     44      'repchars' => '!?*,', 
     45 
     46      'enable_quot' => true, 
     47      'enable_apos' => true, 
     48      'enable_comma' => true, 
     49 
     50      'enable_custom_uc' => true, 
     51      'custom_uc' => "Dr.\nLos Angeles\nPHP\nHTML\nAPI\nURL\nJavaScript\njQuery\niPhone\niPad\n" . 
     52        "Sunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\n" . 
     53        "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember\n" . 
     54        "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec\n", 
     55 
     56      'enable_custom_repl' => true, 
     57      'custom_repl_from' => array('Mon.'), 
     58      'custom_repl_to' => array('Monday'), 
     59    ); 
     60 
     61    return $i_key ? @$opts[$i_key] : $opts; 
     62  } 
     63 
     64  /** 
     65   * 
     66   */ 
    3467  function TextBeautifyPlugin() { 
    35     if (!$this->opts = get_option('textbeautify-opts')) { 
    36       $this->opts = array( 
    37         'enable_blog' => true, 
    38         'enable_title' => true, 
    39         'enable_comment' => true, 
    40  
    41         'title_lc' => "a\nan\nin\nthe\nif\nin\nof\nand\nat\nby\nfor\non\nor\nto\nvia\nvs\nv\nis", 
    42  
    43         'enable_repchars' => true, 
    44         'repchars' => '!?*,', 
    45  
    46         'enable_quot' => true, 
    47         'enable_apos' => true, 
    48         'enable_comma' => true, 
    49  
    50         'enable_custom_uc' => true, 
    51         'custom_uc' => "Dr.\nLos Angeles\nPHP\nHTML\nAPI\nURL\nJavaScript\njQuery\niPhone\niPad\n", 
    52  
    53         'enable_custom_repl' => true, 
    54         'custom_repl_from' => array('Mon.'), 
    55         'custom_repl_to' => array('Monday'), 
    56       ); 
    57     } 
     68    $this->was_installed = false; 
     69 
     70    if (!$this->opts = get_option('textbeautify-opts')) 
     71      $this->opts = $this->__get_default_opts(); 
     72    else 
     73      $this->was_installed = true; 
    5874 
    5975    register_activation_hook(__FILE__, array($this, '__install')); 
     
    122138      return $i_str; 
    123139 
    124     if ($this->opts['title_lc']) 
    125       $lower_terms = array_map('trim', explode("\n", strtolower($this->opts['title_lc']))); 
     140    if ($this->opts['title_lc']) { 
     141      if ($this->opts['enable_autocase']) 
     142        $lower_terms = array_map('trim', explode("\n", strtolower($this->opts['title_lc']))); 
     143      else 
     144        $lower_terms = array_map('trim', explode("\n", $this->opts['title_lc'])); 
     145    } 
    126146 
    127147    foreach ($m[0] as $i => $from) { 
    128148      $word = $m[2][$i]; 
    129149 
    130       if (!empty($lower_terms) && in_array($lower = strtolower($word), $lower_terms)) 
     150      if (!empty($lower_terms) && in_array($lower = $this->opts['enable_autocase'] ? strtolower($word) : $word, $lower_terms)) 
    131151        $to = str_replace($word, $lower, $from); 
    132152      else 
     
    161181 
    162182    foreach ($pieces as $i => $str) { 
    163       $str = strtolower($str); 
     183      if ($this->opts['enable_autocase']) 
     184        $str = strtolower($str); 
     185      else 
     186        $str = $str; 
    164187 
    165188      $str = preg_replace('/(\s+)i((\'(ve|m|d))?[,\s]+)/', '${1}I${2}', $str); 
     
    264287   */ 
    265288  function __install() { 
     289    if ($this->was_installed) { 
     290      $defterms = array_map('trim', explode("\n", $this->__get_default_opts('custom_uc'))); 
     291      $terms = array_map('trim', explode("\n", $this->opts['custom_uc'])); 
     292 
     293      foreach ($defterms as $term) 
     294        if (!in_array($term, $terms)) 
     295          $terms[] = $term; 
     296 
     297      $this->opts['custom_uc'] = implode("\n", $terms); 
     298      update_option('textbeautify-opts', $this->opts); 
     299    } 
    266300  } 
    267301 
     
    289323      $this->opts[$k] = $_POST[$k]; 
    290324 
    291     foreach ($_POST['repl_del'] as $i => $_) { 
    292       unset($this->opts['custom_repl_from'][$i]); 
    293       unset($this->opts['custom_repl_to'][$i]); 
     325    if (@$_POST['repl_del']) { 
     326      foreach ($_POST['repl_del'] as $i => $_) { 
     327        unset($this->opts['custom_repl_from'][$i]); 
     328        unset($this->opts['custom_repl_to'][$i]); 
     329      } 
    294330    } 
    295331 
     
    374410            <td class="pl"> 
    375411              <em>Allow comments to be processed by Text Beautify</em> 
     412            </td> 
     413          </tr> 
     414 
     415          <tr> 
     416            <td nowrap> 
     417              <label for="enable_autocase">Enable case manipulation:</label> 
     418            </td> 
     419            <td> 
     420              <input type="checkbox" id="enable_autocase" name="enable_autocase" value="1" <?php echo $vars['enable_autocase'] ? 'checked' : ''; ?>/> 
     421            </td> 
     422            <td class="pl"> 
     423              <em>Allow Text Beautify to manipulate character case</em> 
    376424            </td> 
    377425          </tr> 
  • text-beautify/trunk/readme.txt

    r517944 r524471  
    77Requires at least: 2.0.2 
    88Tested up to: 3.3.1 
    9 Stable tag: 0.3 
     9Stable tag: 0.4 
    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.4 = 
     57* Fixed warning message on line 291 
     58* Added default case preservation for days of week, full month names, and short month names 
     59* Added ability to disable automatic case manipulation 
     60 
    5661= 0.3 = 
    5762* Corrected preg_match_all bug with invalid starting delimiter 
  • text-beautify/trunk/text-beautify.php

    r517944 r524471  
    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.3 
     7Version: 0.4 
    88Author: Rommel Santor 
    99Author URI: http://rommelsantor.com 
     
    3232   * 
    3333   */ 
     34  function __get_default_opts($i_key = null) { 
     35    $opts = array( 
     36      'enable_blog' => true, 
     37      'enable_title' => true, 
     38      'enable_comment' => true, 
     39      'enable_autocase' => false, 
     40 
     41      'title_lc' => "a\nan\nin\nthe\nif\nin\nof\nand\nat\nby\nfor\non\nor\nto\nvia\nvs\nv\nis", 
     42 
     43      'enable_repchars' => true, 
     44      'repchars' => '!?*,', 
     45 
     46      'enable_quot' => true, 
     47      'enable_apos' => true, 
     48      'enable_comma' => true, 
     49 
     50      'enable_custom_uc' => true, 
     51      'custom_uc' => "Dr.\nLos Angeles\nPHP\nHTML\nAPI\nURL\nJavaScript\njQuery\niPhone\niPad\n" . 
     52        "Sunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\n" . 
     53        "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember\n" . 
     54        "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec\n", 
     55 
     56      'enable_custom_repl' => true, 
     57      'custom_repl_from' => array('Mon.'), 
     58      'custom_repl_to' => array('Monday'), 
     59    ); 
     60 
     61    return $i_key ? @$opts[$i_key] : $opts; 
     62  } 
     63 
     64  /** 
     65   * 
     66   */ 
    3467  function TextBeautifyPlugin() { 
    35     if (!$this->opts = get_option('textbeautify-opts')) { 
    36       $this->opts = array( 
    37         'enable_blog' => true, 
    38         'enable_title' => true, 
    39         'enable_comment' => true, 
    40  
    41         'title_lc' => "a\nan\nin\nthe\nif\nin\nof\nand\nat\nby\nfor\non\nor\nto\nvia\nvs\nv\nis", 
    42  
    43         'enable_repchars' => true, 
    44         'repchars' => '!?*,', 
    45  
    46         'enable_quot' => true, 
    47         'enable_apos' => true, 
    48         'enable_comma' => true, 
    49  
    50         'enable_custom_uc' => true, 
    51         'custom_uc' => "Dr.\nLos Angeles\nPHP\nHTML\nAPI\nURL\nJavaScript\njQuery\niPhone\niPad\n", 
    52  
    53         'enable_custom_repl' => true, 
    54         'custom_repl_from' => array('Mon.'), 
    55         'custom_repl_to' => array('Monday'), 
    56       ); 
    57     } 
     68    $this->was_installed = false; 
     69 
     70    if (!$this->opts = get_option('textbeautify-opts')) 
     71      $this->opts = $this->__get_default_opts(); 
     72    else 
     73      $this->was_installed = true; 
    5874 
    5975    register_activation_hook(__FILE__, array($this, '__install')); 
     
    122138      return $i_str; 
    123139 
    124     if ($this->opts['title_lc']) 
    125       $lower_terms = array_map('trim', explode("\n", strtolower($this->opts['title_lc']))); 
     140    if ($this->opts['title_lc']) { 
     141      if ($this->opts['enable_autocase']) 
     142        $lower_terms = array_map('trim', explode("\n", strtolower($this->opts['title_lc']))); 
     143      else 
     144        $lower_terms = array_map('trim', explode("\n", $this->opts['title_lc'])); 
     145    } 
    126146 
    127147    foreach ($m[0] as $i => $from) { 
    128148      $word = $m[2][$i]; 
    129149 
    130       if (!empty($lower_terms) && in_array($lower = strtolower($word), $lower_terms)) 
     150      if (!empty($lower_terms) && in_array($lower = $this->opts['enable_autocase'] ? strtolower($word) : $word, $lower_terms)) 
    131151        $to = str_replace($word, $lower, $from); 
    132152      else 
     
    161181 
    162182    foreach ($pieces as $i => $str) { 
    163       $str = strtolower($str); 
     183      if ($this->opts['enable_autocase']) 
     184        $str = strtolower($str); 
     185      else 
     186        $str = $str; 
    164187 
    165188      $str = preg_replace('/(\s+)i((\'(ve|m|d))?[,\s]+)/', '${1}I${2}', $str); 
     
    264287   */ 
    265288  function __install() { 
     289    if ($this->was_installed) { 
     290      $defterms = array_map('trim', explode("\n", $this->__get_default_opts('custom_uc'))); 
     291      $terms = array_map('trim', explode("\n", $this->opts['custom_uc'])); 
     292 
     293      foreach ($defterms as $term) 
     294        if (!in_array($term, $terms)) 
     295          $terms[] = $term; 
     296 
     297      $this->opts['custom_uc'] = implode("\n", $terms); 
     298      update_option('textbeautify-opts', $this->opts); 
     299    } 
    266300  } 
    267301 
     
    289323      $this->opts[$k] = $_POST[$k]; 
    290324 
    291     foreach ($_POST['repl_del'] as $i => $_) { 
    292       unset($this->opts['custom_repl_from'][$i]); 
    293       unset($this->opts['custom_repl_to'][$i]); 
     325    if (@$_POST['repl_del']) { 
     326      foreach ($_POST['repl_del'] as $i => $_) { 
     327        unset($this->opts['custom_repl_from'][$i]); 
     328        unset($this->opts['custom_repl_to'][$i]); 
     329      } 
    294330    } 
    295331 
     
    374410            <td class="pl"> 
    375411              <em>Allow comments to be processed by Text Beautify</em> 
     412            </td> 
     413          </tr> 
     414 
     415          <tr> 
     416            <td nowrap> 
     417              <label for="enable_autocase">Enable case manipulation:</label> 
     418            </td> 
     419            <td> 
     420              <input type="checkbox" id="enable_autocase" name="enable_autocase" value="1" <?php echo $vars['enable_autocase'] ? 'checked' : ''; ?>/> 
     421            </td> 
     422            <td class="pl"> 
     423              <em>Allow Text Beautify to manipulate character case</em> 
    376424            </td> 
    377425          </tr> 
Note: See TracChangeset for help on using the changeset viewer.