403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/b2bzend/application/views/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/views/helpers/Truncate.php
<?php
class Zend_View_Helper_Truncate extends Zend_View_Helper_Abstract {
       
        private $_string;
        private $_length;
        private $_postfix;
        private $_cutatspace = true;

        public function truncate($string) {
            $string = strip_tags($string,'<p>');
            $this->_string = trim($string);
            $this->_defaultValues();
            return $this;
        }

        private function _defaultValues() {
            $this->toLength(20);
            $this->withPostfix('&#0133;');
         }

        public function midword() {
            $this->_cutatspace = false;
            return $this;
        }

        public function toLength($int) {
            $this->_length = (int) $int;
            return $this;
        }
        public function withPostfix($str) {
            $this->_postfix = $str;
            return $this;
        }

        public function render() {
            // Return empty string if max length < 1
            if ($this->_length < 1) {
                return '';
            }

            // Return full string if max length >= string length
            if ($this->_length >= strlen($this->_string)) {
                return $this->_string;
            }

            // Return truncated string
            if ($this->_cutatspace) {
                while (strlen($this->_string) > $this->_length) {
                    $cutPos = strrpos($this->_string, ' ', -1);
                    if ($cutPos === false) {
                        // no spaces left, whole string truncated
                        return '';
                    }
                    $this->_string = trim(substr($this->_string, 0, $cutPos));
                }
            } else {
                $this->_string = trim(substr($this->_string, 0, $this->_length));
            }
            return $this->_string . $this->_postfix;
        }

        public function __toString() {
            return $this->render();
        }
}

Youez - 2016 - github.com/yon3zu
LinuXploit