Changeset 223938
- Timestamp:
- 04/01/2010 09:12:28 AM (16 years ago)
- Location:
- wp-headline/trunk
- Files:
-
- 1 added
- 2 edited
-
readme.txt (modified) (2 diffs)
-
style.css (added)
-
wp-headline.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-headline/trunk/readme.txt
r223756 r223938 4 4 Requires at least: 2.0 5 5 Tested up to: 2.9 6 Stable tag: 0. 36 Stable tag: 0.4 7 7 Donate link: http://coding-bereich.de/ 8 8 … … 32 32 * Add the plugin 33 33 34 = 0.4 = 34 35 36 * Add extern CSS file 37 * Bugfix 38 -
wp-headline/trunk/wp-headline.php
r223756 r223938 4 4 Author URI: http://coding-bereich.de/ 5 5 Description: Adds Headline BBCodes to WordPress. Use: [hl=1-5]Headline[/hl] or [h=1-5]Headline[/h] 6 Version: 0. 36 Version: 0.4 7 7 Author: Thomas Heck 8 8 Plugin URI: http://coding-bereich.de/2010/03/31/allgemein/wordpress-plugin-wp-headline.html … … 17 17 { 18 18 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'); 19 31 } 20 32 21 33 function onTheContent($content='') 22 34 { 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); 25 37 26 38 if( isset($this->_headlines[0]) ) 27 39 { 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">'; 29 41 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>'; 33 43 $head .='</ul>'; 34 44 … … 42 52 { 43 53 $h = 1; 44 if( !empty($in[ 1]) )45 $h = $in[ 1];54 if( !empty($in['h']) ) 55 $h = $in['h']; 46 56 47 $title = $in[ 2];57 $title = $in['t']; 48 58 49 59 return '<h' . ($h+1) . '>' . $title . '</h' . ($h+1) . '>'; … … 53 63 { 54 64 $h = 1; 55 if( !empty($in[ 1]) )56 $h = $in[ 1];65 if( !empty($in['h']) ) 66 $h = $in['h']; 57 67 58 $title = $in[ 2];68 $title = $in['t']; 59 69 60 70 $name = preg_replace('/\s+/mS', '_', $title);
Note: See TracChangeset
for help on using the changeset viewer.