/** * If the editor is disabled then we'll see if we need to run * nl2br on the text if it doesn't contain any HTML tags */ public function FormatWYSIWYGHTML($HTML) { if(GetConfig('UseWYSIWYG')) { return $HTML; } else { // We need to sanitise all the line feeds first to 'nl' $HTML = Interspire_String::toUnixLineEndings($HTML); // Now we can use nl2br() $HTML = nl2br($HTML); // But we still need to strip out the new lines as nl2br doesn't really 'replace' the new lines, it just inserts <br />before it $HTML = str_replace("\n", "", $HTML); // Fix up new lines and block level elements. $HTML = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $HTML); $HTML = preg_replace("#( )+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $HTML); return $HTML; } }
public function update_simplepay_checkout_module() { if (!ModuleIsConfigured('checkout_paysimple')) { return true; } GetModuleById('checkout', $module, 'checkout_paysimple'); // Check to see if the module hasn't already been updated $value = $module->GetValue('merchantkey'); if (!is_null($value) && trim($value) !== '') { return true; } // OK, it hasn't been updated yet, so do so $keyFile = ISC_BASE_PATH . "/modules/checkout/paysimple/lib/keyHalf.txt"; if (!file_exists($keyFile)) { return true; } if (!is_readable($keyFile)) { $this->SetError('Unable to read the key file ' . GetConfig('AppPath') . '/modules/checkout/paysimple/lib/keyHalf.txt. Please CHMOD it to 646 or 666.'); return false; } $newKey = @file_get_contents(ISC_BASE_PATH . "/modules/checkout/paysimple/lib/keyHalf.txt"); $newKey = trim($newKey); if ($newKey == '') { return true; } // Make sure you get the 'static' part $newKey = Interspire_String::toUnixLineEndings($newKey); $newKey = explode("\n", $newKey); $newKey = $newKey[0]; $module->setMerchantKey($newKey); return true; }