Removes tags, shortens a string to $iMaxSize adding "..."

@param string  $sInput          input to process
@param integer $iMaxSize        maximum output size
@param bool    $blRemoveNewline if true - \n and \r will be replaced by " "

@return string
977205
public function shrink($sInput, $iMaxSize, $blRemoveNewline = true)
    {
        if ($blRemoveNewline) {
            $sInput = str_replace("\r\n", " ", $sInput);
            $sInput = str_replace("\n", " ", $sInput);
        }

        $sInput = str_replace("\t", "    ", $sInput);

        // remove html entities, remove html tags
        $sInput = $this->_unHTMLEntities(strip_tags($sInput));

        $oStr = getStr();
        if ($oStr->strlen($sInput) > $iMaxSize - 3) {
            $sInput = $oStr->substr($sInput, 0, $iMaxSize - 5) . "...";
        }

        return $sInput;
    }
289015
public function prepareCSV($sInput)
    {
        $sInput = \OxidEsales\Eshop\Core\Registry::getUtilsString()->prepareCSVField($sInput);

        return str_replace(["&nbsp;", "&euro;", "|"], [" ", "", ""], $sInput);
    }
254762
public function checkImgType($imgName){
	    $file = fopen($imgName, "rb");
	    $bin = fread($file, 2);
	    $strInfo  = @unpack("C2chars", $bin);
	    $typeCode = intval($strInfo['chars1'].$strInfo['chars2']);
	    switch($typeCode)
	    {
	        case '255216':
	            return 'jpg';
	            break;
	        case '7173':
	            return 'gif';
	            break;
	        case '13780':
	            return 'png';
	            break;
	        case '6677':
	            return 'bmp';
	            break;
	        default:
	            return 'unknown';
	            break;
	    }
	}
1280544
protected void format (@Nonnull final JSFormatter aFormatter, @Nonnull final String sIndent)
  {
    if (!isEmpty ())
      aFormatter.plain (sIndent);

    final Iterator <Object> aIter = iterator ();
    while (aIter.hasNext ())
    {
      final Object aValue = aIter.next ();

      if (aValue instanceof String)
      {
        int nIdx;
        String sValue = (String) aValue;
        while ((nIdx = sValue.indexOf ('\n')) != -1)
        {
          final String sLine = sValue.substring (0, nIdx);
          if (sLine.length () > 0)
            aFormatter.plain (_escape (sLine));
          sValue = sValue.substring (nIdx + 1);
          aFormatter.nlFix ().plain (sIndent);
        }
        if (sValue.length () != 0)
          aFormatter.plain (_escape (sValue));
      }
      else
        if (aValue instanceof AbstractJSClass)
        {
          ((AbstractJSClass) aValue).printLink (aFormatter);
        }
        else
          if (aValue instanceof AbstractJSType)
          {
            aFormatter.generatable ((AbstractJSType) aValue);
          }
          else
            throw new IllegalStateException ("Unsupported value: " + aValue);
    }

    if (!isEmpty ())
      aFormatter.nlFix ();
  }
174895
function sizeOutput(output) {
  let size = 0;
  size += encoding.sizeVarint(output.value);
  size += sizeScript(output.script);
  return size;
}
30115
private function indentFrom(Console\Input\InputInterface $input): ?Normalizer\Format\Indent
    {
        /** @var null|string $indentSize */
        $indentSize = $input->getOption('indent-size');

        /** @var null|string $indentStyle */
        $indentStyle = $input->getOption('indent-style');

        if (null === $indentSize && null === $indentStyle) {
            return null;
        }

        if (null === $indentSize) {
            throw new \RuntimeException('When using the indent-style option, an indent size needs to be specified using the indent-size option.');
        }

        if (null === $indentStyle) {
            throw new \RuntimeException(\sprintf(
                'When using the indent-size option, an indent style (one of "%s") needs to be specified using the indent-style option.',
                \implode('", "', \array_keys(self::$indentStyles))
            ));
        }

        if ((string) (int) $indentSize !== $indentSize || 1 > $indentSize) {
            throw new \RuntimeException(\sprintf(
                'Indent size needs to be an integer greater than 0, but "%s" is not.',
                $indentSize
            ));
        }

        try {
            $indent = Normalizer\Format\Indent::fromSizeAndStyle(
                (int) $indentSize,
                $indentStyle
            );
        } catch (Normalizer\Exception\InvalidIndentSizeException $exception) {
            throw new \RuntimeException(\sprintf(
                'Indent size needs to be an integer greater than %d, but "%s" is not.',
                $exception->minimumSize(),
                $exception->size()
            ));
        } catch (Normalizer\Exception\InvalidIndentStyleException $exception) {
            throw new \RuntimeException(\sprintf(
                'Indent style needs to be one of "%s", but "%s" is not.',
                \implode('", "', \array_keys(self::$indentStyles)),
                $indentStyle
            ));
        }

        return $indent;
    }
1369136
public function urlBlankAvatar($iWidth, $iHeight, $mSex = '')
    {
        $sUrl = $this->urlBlankAvatarScheme();

        //  Sub in the values
        $sUrl = str_replace('{{width}}', $iWidth, $sUrl);
        $sUrl = str_replace('{{height}}', $iHeight, $sUrl);
        $sUrl = str_replace('{{sex}}', $mSex, $sUrl);

        return $sUrl;
    }
1047761
public static function resizeImage($image, $newWidth, $newHeight, $autoRotate = false, $mode = ImageTools::MODE_SCALE_CROP, $backgroundColor = 0x00000000)
    {
        $sourceWidth = imagesx($image);
        $sourceHeight = imagesy($image);

        $sourcePar = $sourceWidth / $sourceHeight;
        $newPar = $newWidth / $newHeight;
        $sourceX = $newX = 0;
        $sourceY = $newY = 0;

        if ($autoRotate && (($sourcePar > 1 && $newPar < 1) || ($sourcePar < 1 && $newPar > 1))) {
            $t = $newWidth;
            $newWidth = $newHeight;
            $newHeight = $t;
            $newPar = $newWidth / $newHeight;
        }

        $targetWidth = $newWidth;
        $targetHeight = $newHeight;

        // MODE_EXACT gets handled through default variables

        if ($mode == ImageTools::MODE_CROP) {
            if ($sourceWidth > $newWidth) {
                $sourceX = ($sourceWidth - $newWidth) >> 1;
                $sourceWidth = $newWidth;
            } else {
                $targetWidth = $sourceWidth;
                $newX = ($newWidth - $sourceWidth) >> 1;
            }

            if ($sourceHeight > $newHeight) {
                $sourceY = ($sourceHeight - $newHeight) >> 1;
                $sourceHeight = $newHeight;
            } else {
                $targetHeight = $sourceHeight;
                $newY = ($newHeight - $sourceHeight) >> 1;
            }

        } elseif ($mode == ImageTools::MODE_SCALE_CROP) {
            if ($sourcePar > $newPar) {
                $orgWidth = $sourceWidth;
                $sourceWidth = $sourceHeight * $newPar;
                $sourceX = ($orgWidth - $sourceWidth) >> 1;
            } else {
                $orgHeight = $sourceHeight;
                $sourceHeight = $sourceWidth / $newPar;
                $sourceY = ($orgHeight - $sourceHeight) >> 1;
            }

        } elseif ($mode == ImageTools::MODE_SCALE_PAD) {
            if ($sourcePar > $newPar) {
                $targetHeight = $targetWidth / $sourcePar;
                $newY = ($newHeight - $targetHeight) >> 1;
            } else {
                $targetWidth = $targetHeight * $sourcePar;
                $newX = ($newWidth - $targetWidth) >> 1;
            }
        } elseif ($mode == ImageTools::MODE_FIT) {
            if ($sourcePar > $newPar) {
                $targetHeight = $newHeight = round($newWidth / $sourcePar);
            } else {
                $targetWidth = $newWidth = round($newHeight * $sourcePar);
            }
        }

        $new = imagecreatetruecolor($newWidth, $newHeight);

        imagealphablending($new, false);

        $backgroundColor = self::colorHexToRgba($backgroundColor);
        $backgroundColor = imagecolorallocatealpha($new, $backgroundColor['r'], $backgroundColor['g'], $backgroundColor['b'], 127 - floor($backgroundColor['a'] / 2));

        imagefilledrectangle($new, 0, 0, $newWidth, $newHeight, $backgroundColor);

        imagesavealpha($new, true);

        imagecopyresampled($new, $image, $newX, $newY, $sourceX, $sourceY, $targetWidth, $targetHeight, $sourceWidth, $sourceHeight);

        return $new;
    }
666240
function trimToMaxWidth (width, text) {
	var truncated = text.split('\n').map(function (line) {
		return line.substring(0, width);
	});
	return truncated.join('\n');
}
152518
public void trimToSize(int maxSize) {
        while (true) {
            K key;
            V value;
            synchronized (this) {
                if (size < 0 || (map.isEmpty() && size != 0)) {
                    throw new IllegalStateException(getClass().getName()
                            + ".sizeOf() is reporting inconsistent results!");
                }

                if (size <= maxSize) {
                    break;
                }
                Map.Entry<K, V> toEvict = null;
                try {
                    toEvict = (Map.Entry<K, V>) map.getClass().getMethod("eldest").invoke(map);

                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
                if (toEvict == null) {
                    break;
                }
                key = toEvict.getKey();
                value = toEvict.getValue();
                map.remove(key);
                size -= safeSizeOf(key, value);
                evictionCount++;
            }
            entryRemoved(true, key, value, null);
        }
    }
879073
public static String ellipsize(String text, int maxLength, String end) {
        if (text != null && text.length() > maxLength) {
            return text.substring(0, maxLength - end.length()) + end;
        }
        return text;
    }
747100
public static String truncate(String str, int maxSize) {
        if (str == null) {
            return null;
        }

        if (str.length() <= maxSize) {
            return str;
        }

        return str.substring(0, maxSize);
    }
977114
function resultMessage(sourceSize, resultSize)
{
	return sourceSize+'B to '+resultSize+'B ('+(resultSize-sourceSize)+'B, '+(((resultSize-sourceSize)/sourceSize*1e4|0)/100)+'%)'
}
862774
public function removeSid($sInput)
    {
        $sSid = $this->getSession()->getId();

        // remove sid from link
        $sOutput = str_replace("sid={$sSid}/", "", $sInput);
        $sOutput = str_replace("sid/{$sSid}/", "", $sOutput);
        $sOutput = str_replace("sid={$sSid}&amp;", "", $sOutput);
        $sOutput = str_replace("sid={$sSid}&", "", $sOutput);
        $sOutput = str_replace("sid={$sSid}", "", $sOutput);

        return $sOutput;
    }
174441
function truncateTextStart($element, $rootNode, $clipNode, options) {
    var element = $element[0];
    var original = $element.text();

    var maxChunk = '';
    var mid, chunk;
    var low = 0;
    var high = original.length;

    while (low <= high) {
      mid = low + ((high - low) >> 1); // Integer division

      chunk = options.ellipsis + trimRight(original.substr(mid - 1, original.length));
      setText(element, chunk);

      if ($rootNode.height() > options.maxHeight) {
        // too big, reduce the chunk
        low = mid + 1;
      }
      else {
        // chunk valid, try to get a bigger chunk
        high = mid - 1;
        maxChunk = maxChunk.length > chunk.length ? maxChunk : chunk;
      }
    }

    if (maxChunk.length > 0) {
      setText(element, maxChunk);
      return true;
    } else {
      return truncateNearestSibling($element, $rootNode, $clipNode, options);
    }
  }
136250
public static String rset(String input, int width)
   {
      String result; // result to return
      StringBuilder pad = new StringBuilder();
      if (input == null)
      {
         for (int i = 0; i < width - 1; i++)
         {
            pad.append(' '); // put blanks into buffer
         }
         result = " " + pad; // one short to use + overload
      }
      else
      {
         if (input.length() >= width)
         {
            result = input.substring(0, width); // when input is too long, truncate
         }
         else
         {
            int padLength = width - input.length(); // number of blanks to add
            for (int i = 0; i < padLength; i++)
            {
               pad.append(' '); // actually put blanks into buffer
            }
            result = pad + input; // concatenate
         }
      }
      return result;
   }
397064
protected function truncateIdentifier($identifier, $lengthLimit = null, $hashSource = null)
    {
        if ($lengthLimit === null) {
            $lengthLimit = $this->getMaxIdentifierLength();
        }
        if (strlen($identifier) > $lengthLimit) {
            $identifier = substr($identifier, 0, $lengthLimit - 6) . '_' . substr(sha1($hashSource !== null ? $hashSource : $identifier), 0, 5);
        }

        return $identifier;
    }