WordPress.org

Plugin Directory

Changeset 563394


Ignore:
Timestamp:
06/25/12 04:46:58 (22 months ago)
Author:
wet
Message:

wet_smartslug 1.5: Fix for mb chars in titles

Location:
smart-slug/trunk
Files:
2 edited

Legend:

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

    r560939 r563394  
    33Tags: admin, slug, plugin, Post, posts, administration, seo, permalink, url, tag, category, page, hindi 
    44Requires at least: 2.6 
    5 Tested up to: 3.4 
     5Tested up to: 3.5-alpha 
    66Stable tag: trunk 
    77 
     
    2828== Changelog == 
    2929 
     30= 1.5 = 
     31 
     321. Fix for multi-byte characters in titles 
     33 
    3034= 1.4.2 = 
    3135 
  • smart-slug/trunk/wet_smartslug.php

    r560938 r563394  
    55Description: Smartify your post, page, tag and category slugs by removing too short or insignificant stopwords automatically. 
    66Author: Robert Wetzlmayr 
    7 Version: 1.4.2 
     7Version: 1.5 
    88Author URI: http://wetzlmayr.com/ 
    99*/ 
     
    1313    var $min_chars; 
    1414    var $stopwords = array(); 
     15    var $strlen; 
    1516 
    1617    function wet_smartslug() { 
     
    2324            add_filter('editable_slug', array($this, 'smart_slug'), 100); 
    2425            add_action('admin_menu', array($this, 'admin_menu')); 
     26            $this->strlen = (function_exists('mb_strlen')) ? 'mb_strlen' : 'strlen'; 
    2527        } 
    2628    } 
     
    3941        // strip out too short parts and members of the stoplist array 
    4042        $title = explode('-', $title); 
     43        $f = $this->strlen; 
    4144        foreach ($title as $t) { 
    42             if ((strlen($t) >= $this->min_chars) && !(in_array($t, $this->stopwords))) { 
     45            if (($f($t) >= $this->min_chars) && !(in_array($t, $this->stopwords))) { 
    4346                $out[] = $t; 
    4447            } 
Note: See TracChangeset for help on using the changeset viewer.