| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |  * Smarty plugin | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage plugins | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty count_paragraphs modifier plugin | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Type:     modifier<br> | 
					
						
							|  |  |  |  * Name:     count_paragraphs<br> | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |  * Purpose:  count the number of paragraphs in a text | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |  * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php | 
					
						
							|  |  |  |  *          count_paragraphs (Smarty online manual) | 
					
						
							|  |  |  |  * @param string | 
					
						
							|  |  |  |  * @return integer | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | function smarty_modifier_count_paragraphs($string) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // count \r or \n characters
 | 
					
						
							|  |  |  |     return count(preg_split('/[\r\n]+/', $string)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* vim: set expandtab: */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 |