Plugin Directory

Changeset 223938


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

Version 0.4

Location:
wp-headline/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • wp-headline/trunk/readme.txt

    r223756 r223938  
    44Requires at least: 2.0
    55Tested up to: 2.9
    6 Stable tag: 0.3
     6Stable tag: 0.4
    77Donate link: http://coding-bereich.de/
    88
     
    3232* Add the plugin
    3333
     34= 0.4 =
    3435
     36* Add extern CSS file
     37* Bugfix
     38
  • wp-headline/trunk/wp-headline.php

    r223756 r223938  
    44Author URI: http://coding-bereich.de/
    55Description: Adds Headline BBCodes to WordPress. Use: [hl=1-5]Headline[/hl] or [h=1-5]Headline[/h]
    6 Version: 0.3
     6Version: 0.4
    77Author: Thomas Heck
    88Plugin URI: http://coding-bereich.de/2010/03/31/allgemein/wordpress-plugin-wp-headline.html
     
    1717    {
    1818        add_filter('the_content', array($this, 'onTheContent'));
     19        add_action('wp_print_styles', array($this, 'onPrintStyles'));
     20    }
     21   
     22    function onPrintStyles()
     23    {
     24        $stylePath = '/wp-headline/style.css';
     25       
     26        if( !file_exists(WP_PLUGIN_DIR . $stylePath) )
     27            return;
     28           
     29        wp_register_style('wp-headline-style', WP_PLUGIN_URL . $stylePath);
     30        wp_enqueue_style('wp-headline-style');
    1931    }
    2032   
    2133    function onTheContent($content='')
    2234    {
    23         $content = preg_replace_callback('/\[h(?:\s*=\s*(?P<1>[1-5]\s*))?\](?P<2>.*)\[\/h\]/imS', array($this, 'onH'), $content);
    24         $content = preg_replace_callback('/\[hl(?:\s*=\s*(?P<1>[1-5]\s*))?\](?P<2>.*)\[\/hl\]/imS', array($this, 'onHL'), $content);
     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);
    2537       
    2638        if( isset($this->_headlines[0]) )
    2739        {
    28             $head = '<ul class="contentlist" style="list-style-type:none; background-color: #005555; border: 1px #000000 solid; float:right; margin:0px; padding:5px;">';
     40            $head = '<ul class="contentlist">';
    2941            foreach($this->_headlines as $h)
    30             {
    31                 $head .= '<li style="padding-left: ' . (($h['level']-1)*15) . 'px; margin: 2px;"><a href="#' . $h['name'] . '">' . $h['title'] . '</a></li>';
    32             }
     42                $head .= '<li class="contentlistlevel' . $h['level'] . '" style="padding-left: ' . (($h['level']-1)*10) . 'px;"><a href="#' . $h['name'] . '">' . $h['title'] . '</a></li>';
    3343            $head .='</ul>';
    3444           
     
    4252    {
    4353        $h = 1;
    44         if( !empty($in[1]) )
    45             $h = $in[1];
     54        if( !empty($in['h']) )
     55            $h = $in['h'];
    4656       
    47         $title = $in[2];       
     57        $title = $in['t'];     
    4858       
    4959        return '<h' . ($h+1) . '>' . $title . '</h' . ($h+1) . '>';
     
    5363    {
    5464        $h = 1;
    55         if( !empty($in[1]) )
    56             $h = $in[1];
     65        if( !empty($in['h']) )
     66            $h = $in['h'];
    5767       
    58         $title = $in[2];
     68        $title = $in['t'];
    5969       
    6070        $name = preg_replace('/\s+/mS', '_', $title);
Note: See TracChangeset for help on using the changeset viewer.