mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-04 06:11:37 +01:00 
			
		
		
		
	
		
			
	
	
		
			20 lines
		
	
	
		
			438 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			20 lines
		
	
	
		
			438 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * Smarty plugin
							 | 
						||
| 
								 | 
							
								 * -------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								 * Type:     modifier
							 | 
						||
| 
								 | 
							
								 * Name:     count_paragraphs
							 | 
						||
| 
								 | 
							
								 * Purpose:  count the number of paragraphs in a text
							 | 
						||
| 
								 | 
							
								 * -------------------------------------------------------------
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								function smarty_modifier_count_paragraphs($string)
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    // count \r or \n characters
							 | 
						||
| 
								 | 
							
								    return count(preg_split('/[\r\n]+/', $string));
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* vim: set expandtab: */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								?>
							 |