From 22e20ea71cb92de958f5da75a4dc363e861bcc7b Mon Sep 17 00:00:00 2001 From: Sylvestre Ho <shotamchay@merethis.com> Date: Tue, 5 Apr 2011 15:50:29 +0000 Subject: [PATCH] preg_preg_split => preg_split git-svn-id: http://svn.centreon.com/trunk/centreon@12017 6bcd3966-0018-0410-8128-fd23d134de7e --- GPL_LIB/Smarty/libs/Smarty_Compiler.class.php | 4 ++-- .../core.assign_smarty_interface.php | 2 +- .../internals/core.create_dir_structure.php | 4 ++-- .../libs/internals/core.write_cache_file.php | 2 +- .../Smarty/libs/plugins/block.textformat.php | 2 +- .../plugins/modifier.count_paragraphs.php | 2 +- .../libs/plugins/modifier.count_words.php | 2 +- .../Smarty/libs/plugins/modifier.spacify.php | 2 +- www/class/centreonExternalCommand.class.php | 6 ++--- .../monitoring/downtime/AddHostDowntime.php | 2 +- .../external_cmd/functionsPopup.php | 24 +++++++++---------- .../xml/broker/makeXMLForOneService.php | 2 +- .../Services/xml/ndo/makeXMLForOneService.php | 2 +- .../options/oreon/modules/listModules.php | 2 +- www/include/reporting/dashboard/DB-Func.php | 6 ++--- 15 files changed, 32 insertions(+), 32 deletions(-) diff --git a/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php b/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php index 5fc8f0bcb5..3201195c8c 100644 --- a/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php +++ b/GPL_LIB/Smarty/libs/Smarty_Compiler.class.php @@ -273,7 +273,7 @@ class Smarty_Compiler extends Smarty { preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match); $template_tags = $_match[1]; /* preg_split content by template tags to obtain non-template content. */ - $text_blocks = preg_preg_split("~{$ldq}.*?{$rdq}~s", $source_content); + $text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content); /* loop through text blocks */ for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) { @@ -1706,7 +1706,7 @@ class Smarty_Compiler extends Smarty { function _parse_var($var_expr) { $_has_math = false; - $_math_vars = preg_preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_preg_split_DELIM_CAPTURE); + $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, preg_split_DELIM_CAPTURE); if(count($_math_vars) > 1) { $_first_var = ""; diff --git a/GPL_LIB/Smarty/libs/internals/core.assign_smarty_interface.php b/GPL_LIB/Smarty/libs/internals/core.assign_smarty_interface.php index 5056ca02e1..2266ff4250 100644 --- a/GPL_LIB/Smarty/libs/internals/core.assign_smarty_interface.php +++ b/GPL_LIB/Smarty/libs/internals/core.assign_smarty_interface.php @@ -28,7 +28,7 @@ function smarty_core_assign_smarty_interface($params, &$smarty) $_smarty_vars_request = array(); - foreach (preg_preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) { + foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) { if (isset($_globals_map[$_c])) { $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]); } diff --git a/GPL_LIB/Smarty/libs/internals/core.create_dir_structure.php b/GPL_LIB/Smarty/libs/internals/core.create_dir_structure.php index 06b695c931..657fe13133 100644 --- a/GPL_LIB/Smarty/libs/internals/core.create_dir_structure.php +++ b/GPL_LIB/Smarty/libs/internals/core.create_dir_structure.php @@ -21,7 +21,7 @@ function smarty_core_create_dir_structure($params, &$smarty) if (DIRECTORY_SEPARATOR=='/') { /* unix-style paths */ $_dir = $params['dir']; - $_dir_parts = preg_preg_split('!/+!', $_dir, -1, PREG_preg_split_NO_EMPTY); + $_dir_parts = preg_split('!/+!', $_dir, -1, preg_split_NO_EMPTY); $_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/'; if($_use_open_basedir = !empty($_open_basedir_ini)) { $_open_basedirs = explode(':', $_open_basedir_ini); @@ -30,7 +30,7 @@ function smarty_core_create_dir_structure($params, &$smarty) } else { /* other-style paths */ $_dir = str_replace('\\','/', $params['dir']); - $_dir_parts = preg_preg_split('!/+!', $_dir, -1, PREG_preg_split_NO_EMPTY); + $_dir_parts = preg_split('!/+!', $_dir, -1, preg_split_NO_EMPTY); if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) { /* leading "//" for network volume, or "[letter]:/" for full path */ $_new_dir = $_root_dir[1]; diff --git a/GPL_LIB/Smarty/libs/internals/core.write_cache_file.php b/GPL_LIB/Smarty/libs/internals/core.write_cache_file.php index d142701154..943f802515 100644 --- a/GPL_LIB/Smarty/libs/internals/core.write_cache_file.php +++ b/GPL_LIB/Smarty/libs/internals/core.write_cache_file.php @@ -39,7 +39,7 @@ function smarty_core_write_cache_file($params, &$smarty) // smarty_core_process_compiled_includes() on a cache-read $match_count = count($match[0]); - $results = preg_preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_preg_split_DELIM_CAPTURE); + $results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, preg_split_DELIM_CAPTURE); $level = 0; $j = 0; diff --git a/GPL_LIB/Smarty/libs/plugins/block.textformat.php b/GPL_LIB/Smarty/libs/plugins/block.textformat.php index 41697bff33..bce4ee9105 100644 --- a/GPL_LIB/Smarty/libs/plugins/block.textformat.php +++ b/GPL_LIB/Smarty/libs/plugins/block.textformat.php @@ -72,7 +72,7 @@ function smarty_block_textformat($params, $content, &$smarty) } // preg_split into paragraphs - $_paragraphs = preg_preg_split('![\r\n][\r\n]!',$content); + $_paragraphs = preg_split('![\r\n][\r\n]!',$content); $_output = ''; for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { diff --git a/GPL_LIB/Smarty/libs/plugins/modifier.count_paragraphs.php b/GPL_LIB/Smarty/libs/plugins/modifier.count_paragraphs.php index ce3078b8da..8a8bef65d1 100644 --- a/GPL_LIB/Smarty/libs/plugins/modifier.count_paragraphs.php +++ b/GPL_LIB/Smarty/libs/plugins/modifier.count_paragraphs.php @@ -21,7 +21,7 @@ function smarty_modifier_count_paragraphs($string) { // count \r or \n characters - return count(preg_preg_split('/[\r\n]+/', $string)); + return count(preg_split('/[\r\n]+/', $string)); } /* vim: set expandtab: */ diff --git a/GPL_LIB/Smarty/libs/plugins/modifier.count_words.php b/GPL_LIB/Smarty/libs/plugins/modifier.count_words.php index 495a24d003..ddb328d08b 100644 --- a/GPL_LIB/Smarty/libs/plugins/modifier.count_words.php +++ b/GPL_LIB/Smarty/libs/plugins/modifier.count_words.php @@ -21,7 +21,7 @@ function smarty_modifier_count_words($string) { // preg_split text by ' ',\r,\n,\f,\t - $preg_split_array = preg_preg_split('/\s+/',$string); + $preg_split_array = preg_split('/\s+/',$string); // count matches that contain alphanumerics $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $preg_split_array); diff --git a/GPL_LIB/Smarty/libs/plugins/modifier.spacify.php b/GPL_LIB/Smarty/libs/plugins/modifier.spacify.php index 0de7b7ce01..00e50a2247 100644 --- a/GPL_LIB/Smarty/libs/plugins/modifier.spacify.php +++ b/GPL_LIB/Smarty/libs/plugins/modifier.spacify.php @@ -22,7 +22,7 @@ function smarty_modifier_spacify($string, $spacify_char = ' ') { return implode($spacify_char, - preg_preg_split('//', $string, -1, PREG_preg_split_NO_EMPTY)); + preg_split('//', $string, -1, preg_split_NO_EMPTY)); } /* vim: set expandtab: */ diff --git a/www/class/centreonExternalCommand.class.php b/www/class/centreonExternalCommand.class.php index e71f29757a..e4346a2c2d 100644 --- a/www/class/centreonExternalCommand.class.php +++ b/www/class/centreonExternalCommand.class.php @@ -303,9 +303,9 @@ class CentreonExternalCommand { * @param string $string */ private function getDate($string) { - $res = preg_preg_split("/ /", $string); - $res3 = preg_preg_split("/\//", $res[0]); - $res4 = preg_preg_split("/:/", $res[1]); + $res = preg_split("/ /", $string); + $res3 = preg_split("/\//", $res[0]); + $res4 = preg_split("/:/", $res[1]); $end_time = mktime($res4[0], $res4[1], "0", $res3[1], $res3[2], $res3[0]); unset($res); return $end_time; diff --git a/www/include/monitoring/downtime/AddHostDowntime.php b/www/include/monitoring/downtime/AddHostDowntime.php index 383f7827f3..99d798eddc 100644 --- a/www/include/monitoring/downtime/AddHostDowntime.php +++ b/www/include/monitoring/downtime/AddHostDowntime.php @@ -177,7 +177,7 @@ */ $hg = new CentreonHostgroups($pearDB); $hostlist = $hg->getHostGroupHosts($_POST['hostgroup_id']); - $host_acl_id = preg_preg_split('/,/', $hostStr); + $host_acl_id = preg_split('/,/', $hostStr); foreach ($hostlist as $host_id) { if ($oreon->user->access->admin || in_array($host_id, $host_acl_id)) { $ecObj->AddHostDowntime($host_id, $_POST["comment"], $_POST["start"], $_POST["end"], $_POST["persistant"], $duration, $dt_w_services); diff --git a/www/include/monitoring/external_cmd/functionsPopup.php b/www/include/monitoring/external_cmd/functionsPopup.php index ad34fc9a8b..7057589c77 100644 --- a/www/include/monitoring/external_cmd/functionsPopup.php +++ b/www/include/monitoring/external_cmd/functionsPopup.php @@ -170,22 +170,22 @@ isset($_GET['fixed']) && $_GET['fixed'] == "true" ? $fixed = 1 : $fixed = 0; isset($_GET['duration']) && $_GET['duration'] && is_numeric($_GET['duration']) ? $duration = $_GET['duration'] : $duration = 0; - $res = preg_preg_split("/ /", $start); + $res = preg_split("/ /", $start); if (count($res) != 2) { throw new Exception('Start date format is not valid'); } - $res1 = preg_preg_split("/\//", $res[0]); - $res2 = preg_preg_split("/:/", $res[1]); + $res1 = preg_split("/\//", $res[0]); + $res2 = preg_split("/:/", $res[1]); $start_time = mktime($res2[0], $res2[1], "0", $res1[1], $res1[2], $res1[0]); $start_time = $centreonGMT->getUTCDate($start_time); - $res = preg_preg_split("/ /", $end); + $res = preg_split("/ /", $end); if (count($res) != 2) { throw new Exception('End date format is not valid'); } - $res3 = preg_preg_split("/\//", $res[0]); - $res4 = preg_preg_split("/:/", $res[1]); + $res3 = preg_split("/\//", $res[0]); + $res4 = preg_split("/:/", $res[1]); $end_time = mktime($res4[0], $res4[1], "0", $res3[1], $res3[2], $res3[0]); $end_time = $centreonGMT->getUTCDate($end_time); if (!$duration) { @@ -241,21 +241,21 @@ isset($_GET['fixed']) && $_GET['fixed'] == "true" ? $fixed = 1 : $fixed = 0; isset($_GET['duration']) && $_GET['duration'] && is_numeric($_GET['duration']) ? $duration = $_GET['duration'] : $duration = 0; - $res = preg_preg_split("/ /", $start); + $res = preg_split("/ /", $start); if (count($res) != 2) { throw new Exception('Start date format is not valid'); } - $res1 = preg_preg_split("/\//", $res[0]); - $res2 = preg_preg_split("/:/", $res[1]); + $res1 = preg_split("/\//", $res[0]); + $res2 = preg_split("/:/", $res[1]); $start_time = mktime($res2[0], $res2[1], "0", $res1[1], $res1[2], $res1[0], -1); $start_time = $centreonGMT->getUTCDate($start_time); - $res = preg_preg_split("/ /", $end); + $res = preg_split("/ /", $end); if (count($res) != 2) { throw new Exception('End date format is not valid'); } - $res3 = preg_preg_split("/\//", $res[0]); - $res4 = preg_preg_split("/:/", $res[1]); + $res3 = preg_split("/\//", $res[0]); + $res4 = preg_split("/:/", $res[1]); $end_time = mktime($res4[0], $res4[1], "0", $res3[1], $res3[2], $res3[0], -1); $end_time = $centreonGMT->getUTCDate($end_time); if (!$duration) { diff --git a/www/include/monitoring/status/Services/xml/broker/makeXMLForOneService.php b/www/include/monitoring/status/Services/xml/broker/makeXMLForOneService.php index 0686f23397..e8a46f41e2 100644 --- a/www/include/monitoring/status/Services/xml/broker/makeXMLForOneService.php +++ b/www/include/monitoring/status/Services/xml/broker/makeXMLForOneService.php @@ -174,7 +174,7 @@ */ /* $obj->XML->writeElement("long_name", _("Extended Status Information"), 0); - $lo_array = preg_preg_split('/<br \/>|<br>|\\\n|\x0A|\x0D\x0A/', $data["long_output"]); + $lo_array = preg_split('/<br \/>|<br>|\\\n|\x0A|\x0D\x0A/', $data["long_output"]); foreach ($lo_array as $val) { if ($val != "") { $obj->XML->startElement("long_output_data"); diff --git a/www/include/monitoring/status/Services/xml/ndo/makeXMLForOneService.php b/www/include/monitoring/status/Services/xml/ndo/makeXMLForOneService.php index afda6bec82..b20f09fbec 100644 --- a/www/include/monitoring/status/Services/xml/ndo/makeXMLForOneService.php +++ b/www/include/monitoring/status/Services/xml/ndo/makeXMLForOneService.php @@ -209,7 +209,7 @@ * Long Output */ $buffer->writeElement("long_name", _("Extended Status Information"), 0); - $lo_array = preg_preg_split('/<br \/>|<br>|\\\n|\x0A|\x0D\x0A/', $ndo["long_output"]); + $lo_array = preg_split('/<br \/>|<br>|\\\n|\x0A|\x0D\x0A/', $ndo["long_output"]); foreach ($lo_array as $val) { if ($val != "") { $buffer->startElement("long_output_data"); diff --git a/www/include/options/oreon/modules/listModules.php b/www/include/options/oreon/modules/listModules.php index 8787c74cf0..0ccbf0f9dc 100644 --- a/www/include/options/oreon/modules/listModules.php +++ b/www/include/options/oreon/modules/listModules.php @@ -46,7 +46,7 @@ * @return array */ function parse_zend_license_file($file) { - $lines = preg_preg_split('/\n/', file_get_contents($file)); + $lines = preg_split('/\n/', file_get_contents($file)); $infos = array(); foreach ($lines as $line) { if (preg_match('/^([^= ]+)\s*=\s*(.+)$/', $line, $match)) { diff --git a/www/include/reporting/dashboard/DB-Func.php b/www/include/reporting/dashboard/DB-Func.php index 76d5c22580..43560f1234 100644 --- a/www/include/reporting/dashboard/DB-Func.php +++ b/www/include/reporting/dashboard/DB-Func.php @@ -471,15 +471,15 @@ $serviceGroupStats[$host_service_id][$name] = 0; } $servicesStats = array(); - $res = preg_preg_split("/_/", $host_service_id); + $res = preg_split("/_/", $host_service_id); $servicesStats = getLogInDbForOneSVC($res[0], $res[1], $start_date, $end_date, $reportTimePeriod); if (isset($servicesStats)) { $serviceGroupStats[$host_service_id] = $servicesStats; - $res = preg_preg_split("/_/", $host_service_id); + $res = preg_split("/_/", $host_service_id); $serviceGroupStats[$host_service_id]["HOST_ID"] = $res[0]; $serviceGroupStats[$host_service_id]["SERVICE_ID"] = $res[1]; - $res = preg_preg_split("/:::/", $host_service_name); + $res = preg_split("/:::/", $host_service_name); $serviceGroupStats[$host_service_id]["HOST_NAME"] = $res[0]; $serviceGroupStats[$host_service_id]["SERVICE_DESC"] = $res[1]; foreach ($serviceStatsLabels as $name) -- GitLab