From fcbe12c5f6055188f29d0596e3054e5b593bbc70 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 31 Mar 2017 19:04:34 -0700 Subject: [PATCH] PHP Notice fixes. mbstring function fallback. --- e107_core/templates/header_default.php | 2 +- e107_handlers/e_parse_class.php | 12 +++++++----- e107_handlers/form_handler.php | 18 +++++++++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index fce88dd3c..9cf7e7ffb 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -489,7 +489,7 @@ function render_meta($type) } } -// legay meta-tag checks. +// legay meta-tag checks. if(empty(e107::getUrl()->response()->getMetaKeywords())) { echo (defined("META_KEYWORDS")) ? "\n\n" : render_meta('keywords'); diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 5ea3eb799..0380f9284 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -1350,23 +1350,25 @@ class e_parse extends e_parser $text = html_entity_decode($text,ENT_QUOTES,'utf-8'); - return mb_strimwidth($text, 0, $len, $more); + if(function_exists('mb_strimwidth')) + { + return mb_strimwidth($text, 0, $len, $more); + } - // $ret = $this->usubstr($text, 0, $len); + $ret = $this->usubstr($text, 0, $len); // search for possible broken html entities // - if an & is in the last 8 chars, removing it and whatever follows shouldn't hurt // it should work for any characters encoding -/* - $leftAmp = $this->ustrrpos($this->usubstr($ret, -8), '&'); if($leftAmp) { $ret = $this->usubstr($ret, 0, $this->ustrlen($ret) - 8 + $leftAmp); } - return $ret.$more;*/ + return $ret.$more; + } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 6bbf4b3d5..9a8a70ba2 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -810,10 +810,22 @@ class e_form function number($name, $value=0, $maxlength = 200, $options = array()) { if(is_string($options)) parse_str($options, $options); - if (empty($options['maxlength'])) $maxlength = $options['maxlength']; + + if(!empty($options['maxlength'])) + { + $maxlength = $options['maxlength']; + } + unset($options['maxlength']); - if(empty($options['size'])) $options['size'] = 15; - if(empty($options['class'])) $options['class'] = 'tbox number e-spinner input-small '; + + if(empty($options['size'])) + { + $options['size'] = 15; + } + if(empty($options['class'])) + { + $options['class'] = 'tbox number e-spinner input-small '; + } if(!empty($options['size'])) {