[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/parser_handler.php,v $ 14 | $Revision: 1.4 $ 15 | $Date: 2005/12/14 17:37:34 $ 16 | $Author: sweetas $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 if (!defined('e107_INIT')) { exit; } 21 22 function register_parser($plugin_name, $regexp) { 23 if ($plugin_name != '' OR $regexp != '') { 24 if (file_exists(e_PLUGIN."{$plugin_name}/parser.php")) { 25 require_once(e_PLUGIN."{$plugin_name}/parser.php"); 26 if (function_exists($plugin_name.'_parse')) { 27 if (IsRegExp($regexp)) { 28 $oursql = new db; 29 $oursql->db_Select("parser", "*", "parser_pluginname = '{$plugin_name}' AND parser_regexp = '{$regexp}'"); 30 if ($row = $oursql->db_Fetch()) { 31 // Already exists, handle error if needed. 32 } else { 33 $regexp = str_replace("\\" , "\\\\", $regexp); 34 $oursql->db_Insert("parser", "0, '{$plugin_name}', '{$regexp}'"); 35 return 1; 36 } 37 } else { 38 // handle error if wanted to - not a valid regexp 39 } 40 } else { 41 // handle error if wanted to - function does not exist 42 } 43 } else { 44 // handle error if wanted to - Unable to include file 45 } 46 } else { 47 // handle error if wanted to - plugin name or regexp value empty 48 } 49 } 50 51 function IsRegExp($sREGEXP) { 52 $sPREVIOUSHANDLER = Set_Error_Handler("TrapError"); 53 Preg_Match ($sREGEXP, ""); 54 Restore_Error_Handler ($sPREVIOUSHANDLER); 55 Return !TrapError (); 56 } 57 58 function TrapError () { 59 Static $iERRORES; 60 if (!Func_Num_Args()) { 61 $iRETORNO = $iERRORES; 62 $iERRORES = 0; 63 return $iRETORNO; 64 } else { 65 $iERRORES++; 66 } 67 } 68 69 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |