Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * This file is part of the LidaaTwigBundle package. */ namespace Lidaa\TwigB..
Decoded Output download
<?php
/**
* This file is part of the LidaaTwigBundle package.
*/
namespace Lidaa\TwigBundle\Helper;
use Symfony\Component\Locale\Stub\StubNumberFormatter;
/**
* TextHelper
*
* @author Lidaa <[email protected]>
*/
class TextHelper
{
public function highlight($haystack, $string, $color, $tag)
{
$highlight_str = sprintf('<%s style="color: %s">%s</%s>', $tag, $color, $string, $tag);
$haystack = str_replace($string, $highlight_str, $haystack);
return $haystack;
}
public function ellipsize($str, $max_length, $position, $ellipsis)
{
// Strip tags
$str = trim(strip_tags($str));
// Is the string long enough to ellipsize?
if (strlen($str) <= $max_length) {
return $str;
}
$beg = substr($str, 0, floor($max_length * $position));
$position = ($position > 1) ? 1 : $position;
if ($position === 1) {
$end = substr($str, 0, -($max_length - strlen($beg)));
} else {
$end = substr($str, -($max_length - strlen($beg)));
}
return $beg . $ellipsis . $end;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* This file is part of the LidaaTwigBundle package.
*/
namespace Lidaa\TwigBundle\Helper;
use Symfony\Component\Locale\Stub\StubNumberFormatter;
/**
* TextHelper
*
* @author Lidaa <[email protected]>
*/
class TextHelper
{
public function highlight($haystack, $string, $color, $tag)
{
$highlight_str = sprintf('<%s style="color: %s">%s</%s>', $tag, $color, $string, $tag);
$haystack = str_replace($string, $highlight_str, $haystack);
return $haystack;
}
public function ellipsize($str, $max_length, $position, $ellipsis)
{
// Strip tags
$str = trim(strip_tags($str));
// Is the string long enough to ellipsize?
if (strlen($str) <= $max_length) {
return $str;
}
$beg = substr($str, 0, floor($max_length * $position));
$position = ($position > 1) ? 1 : $position;
if ($position === 1) {
$end = substr($str, 0, -($max_length - strlen($beg)));
} else {
$end = substr($str, -($max_length - strlen($beg)));
}
return $beg . $ellipsis . $end;
}
}
Function Calls
| None |
Stats
| MD5 | ac046a2af376a355961e13a45a9e9165 |
| Eval Count | 0 |
| Decode Time | 87 ms |