Beispiel #1
0
 /**
  * Changing the text from a HTML {{VALUE}} to the actual value decided by the array
  *
  * @param    array    $aText    The result from the match in function translateInputFields
  * @return    mixed
  * @deprecated
  */
 private function changeText($aText)
 {
     // Split them
     $aExplode = explode(".", $aText[1]);
     $sType = $aExplode[0];
     $sName = @$aExplode[1];
     if ($sType == "input") {
         if (array_key_exists($sName, $this->aInputParameters)) {
             return $this->aInputParameters[$sName];
         } else {
             throw new KlarnaApiException('Error in ' . __METHOD__ . ': Invalid inputfield value (' . $sName . ') found in HTML code!');
         }
     } else {
         if ($sType == "lang") {
             return vmText::_('VMPAYMENT_KLARNA_' . strtoupper($sName));
             //$this->fetchFromLanguagePack($sName);
         } else {
             if ($sType == "setup") {
                 if ($sName == "pclasses") {
                     return $this->renderPClasses();
                 }
                 if ($sName == 'threatmetrix') {
                     if (!array_key_exists('threatmetrix', $this->aSetupSettings)) {
                         $this->aSetupSettings['threatmetrix'] = $this->oKlarna->checkoutHTML();
                     }
                     return @$this->aSetupSettings['threatmetrix'];
                 }
                 if ($sName == 'additional_information') {
                     $key = @$this->aSetupSettings['additional_information'];
                     $key = 'VMPAYMENT_KLARNA_' . strtoupper($key);
                     $lang = JFactory::getLanguage();
                     if ($lang->hasKey($key)) {
                         $frmt = @vmText::_($key);
                         //$this->fetchFromLanguagePack($key);
                         return @$this->translateInputFields($frmt);
                     } else {
                         return '';
                     }
                 }
                 return @$this->aSetupSettings[$sName];
             } else {
                 if ($sType == "value") {
                     return @$this->aInputValues[$sName];
                 } else {
                     throw new KlarnaApiException('Error in ' . __METHOD__ . ': Invalid field name (' . $sType . ') found in HTML code!');
                 }
             }
         }
     }
 }