X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FWordReplacements.php;h=21a1d99c068d588ecb9fddd1b8252b5018325aef;hb=ea0677f57b1008657cfe7b3c21822a04c93e3447;hp=884cc6526a96c0712ba0bcefbba88c0b72f9bf3c;hpb=ce4fd42f89389d27c1ddd061b5ad2e92809ebe9a;p=civicrm-core.git diff --git a/CRM/Admin/Form/WordReplacements.php b/CRM/Admin/Form/WordReplacements.php index 884cc6526a..21a1d99c06 100644 --- a/CRM/Admin/Form/WordReplacements.php +++ b/CRM/Admin/Form/WordReplacements.php @@ -1,9 +1,9 @@ _defaults !== NULL) { return $this->_defaults; @@ -110,13 +113,21 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { /** * Function to actually build the form * - * @return None + * @return void * @access public */ public function buildQuickForm() { $config = CRM_Core_Config::singleton(); $values = $config->localeCustomStrings[$config->lcMessages]; - $instances = (count($values, COUNT_RECURSIVE) - 6); + + //CRM-14179 + $instances = 0; + foreach ( $values as $valMatchType ) { + foreach ( $valMatchType as $valPairs ) { + $instances += count($valPairs); + } + } + if ($instances > 10) { $this->_numStrings = $instances; } @@ -126,7 +137,7 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { if ($this->_soInstance) { $soInstances = array($this->_soInstance); } - elseif (CRM_Utils_Array::value('old', $_POST)) { + elseif (!empty($_POST['old'])) { $soInstances = $stringOverrideInstances = array_keys($_POST['old']); } elseif (!empty($this->_defaults) && is_array($this->_defaults)) { @@ -187,8 +198,8 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { elseif (!$v && $newValues[$k]) { $errors['old[' . $k . ']'] = ts('Please Enter the value for Original Word'); } - elseif ((!CRM_Utils_Array::value($k, $newValues) && !CRM_Utils_Array::value($k, $oldValues)) - && (CRM_Utils_Array::value($k, $enabled) || CRM_Utils_Array::value($k, $exactMatch)) + elseif ((empty($newValues[$k]) && empty($oldValues[$k])) + && (!empty($enabled[$k]) || !empty($exactMatch[$k])) ) { $errors['old[' . $k . ']'] = ts('Please Enter the value for Original Word'); $errors['new[' . $k . ']'] = ts('Please Enter the value for Replacement Word'); @@ -203,7 +214,7 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { * * @access public * - * @return None + * @return void */ public function postProcess() { $params = $this->controller->exportValues($this->_name); @@ -211,13 +222,9 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { $enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array(); for ($i = 1; $i <= $this->_numStrings; $i++) { - if (CRM_Utils_Array::value($i, $params['new']) && - CRM_Utils_Array::value($i, $params['old']) - ) { - if (isset($params['enabled']) && CRM_Utils_Array::value($i, $params['enabled'])) { - if (CRM_Utils_Array::value('cb', $params) && - CRM_Utils_Array::value($i, $params['cb']) - ) { + if (!empty($params['new'][$i]) && !empty($params['old'][$i])) { + if (isset($params['enabled']) && !empty($params['enabled'][$i])) { + if (!empty($params['cb']) && !empty($params['cb'][$i])) { $enabled['exactMatch'] += array($params['old'][$i] => $params['new'][$i]); } else {