403Webshell
Server IP : 172.67.158.161  /  Your IP : 3.129.218.179
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/giankuin/sieuthiweb.com.vn/dup-installer/lib/snaplib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/giankuin/sieuthiweb.com.vn/dup-installer/lib/snaplib/class.snaplib.u.string.php
<?php
/**
 * Snap strings utils
 *
 * Standard: PSR-2
 * @link http://www.php-fig.org/psr/psr-2
 *
 * @package SnapLib
 * @copyright (c) 2017, Snapcreek LLC
 * @license	https://opensource.org/licenses/GPL-3.0 GNU Public License
 *
 */
defined('ABSPATH') || defined('DUPXABSPATH') || exit;

if (!class_exists('DupProSnapLibStringU', false)) {

    class DupProSnapLibStringU
    {

        public static function boolToString($b)
        {
            return ($b ? 'true' : 'false');
        }

        public static function truncateString($s, $maxWidth)
        {
            if (strlen($s) > $maxWidth) {
                $s = substr($s, 0, $maxWidth - 3).'...';
            }

            return $s;
        }

        /**
         * Returns true if the $haystack string starts with the $needle
         *
         * @param string  $haystack     The full string to search in
         * @param string  $needle       The string to for
         *
         * @return bool Returns true if the $haystack string starts with the $needle
         */
        public static function startsWith($haystack, $needle)
        {
            $length = strlen($needle);
            return (substr($haystack, 0, $length) === $needle);
        }

        /**
         * Returns true if the $haystack string end with the $needle
         *
         * @param string  $haystack     The full string to search in
         * @param string  $needle       The string to for
         *
         * @return bool Returns true if the $haystack string starts with the $needle
         */
         public static function endsWith($haystack, $needle)
        {
            $length = strlen($needle);
            if ($length == 0) {
                return true;
            }

            return (substr($haystack, -$length) === $needle);
        }

        /**
         * Returns true if the $needle is found in the $haystack
         *
         * @param string  $haystack     The full string to search in
         * @param string  $needle       The string to for
         *
         * @return bool
         */
        public static function contains($haystack, $needle)
        {
            $pos = strpos($haystack, $needle);
            return ($pos !== false);
        }

        /**
         * 
         * @param string $glue
         * @param array $pieces
         * @param string $format
         * @return string
         */
        public static function implodeKeyVals($glue, $pieces, $format = '%s="%s"')
        {
            $strList = array();
            foreach ($pieces as $key => $value) {
                if (is_scalar($value)) {
                    $strList[] = sprintf($format, $key, $value);
                } else {
                    $strList[] = sprintf($format, $key, print_r($value, true));
                }
            }
            return implode($glue, $strList);
        }

        /**
         * Replace last occurrence
         *
         * @param  String  $search         The value being searched for
         * @param  String  $replace        The replacement value that replaces found search values
         * @param  String  $str        The string or array being searched and replaced on, otherwise known as the haystack
         * @param  Boolean $caseSensitive Whether the replacement should be case sensitive or not
         *
         * @return String
         */
        public static function strLastReplace($search, $replace, $str, $caseSensitive = true)
        {
            $pos = $caseSensitive ? strrpos($str, $search) : strripos($str, $search);
            if (false !== $pos) {
                $str = substr_replace($str, $replace, $pos, strlen($search));
            }
            return $str;
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit