Plugin Directory

Changeset 223951


Ignore:
Timestamp:
04/01/2010 09:58:09 AM (16 years ago)
Author:
LiRo
Message:

version 0.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-headline/trunk/wp-headline.php

    r223938 r223951  
    3333    function onTheContent($content='')
    3434    {
    35         $content = preg_replace_callback('/\[h(?:\s*=\s*(?P<h>[1-5])\s*)?\](?P<t>.*)\[\/h\]/imS', array($this, 'onH'), $content);
    36         $content = preg_replace_callback('/\[hl(?:\s*=\s*(?P<h>[1-5])\s*)?\](?P<t>.*)\[\/hl\]/imS', array($this, 'onHL'), $content);
     35        $content = preg_replace_callback('/\[h(?:\s*=\s*([1-5])\s*)?\](.*)\[\/h\]/imS', array($this, 'onH'), $content);
     36        $content = preg_replace_callback('/\[hl(?:\s*=\s*([1-5])\s*)?\](.*)\[\/hl\]/imS', array($this, 'onHL'), $content);
    3737       
    3838        if( isset($this->_headlines[0]) )
     
    5252    {
    5353        $h = 1;
    54         if( !empty($in['h']) )
    55             $h = $in['h'];
    56        
    57         $title = $in['t'];     
     54        if( isset($in[2]) )
     55        {
     56            $h = $in[1];
     57            $title = $in[2];
     58        }
     59        else
     60            $title = $in[1];
     61               
    5862       
    5963        return '<h' . ($h+1) . '>' . $title . '</h' . ($h+1) . '>';
     
    6367    {
    6468        $h = 1;
    65         if( !empty($in['h']) )
    66             $h = $in['h'];
    67        
    68         $title = $in['t'];
     69        if( isset($in[2]) )
     70        {
     71            $h = $in[1];
     72            $title = $in[2];
     73        }
     74        else
     75            $title = $in[1];
    6976       
    7077        $name = preg_replace('/\s+/mS', '_', $title);
Note: See TracChangeset for help on using the changeset viewer.