Exemple #1
0
 public final function getIp()
 {
     if ($this->ipCountPart == 4) {
         return long2ip($this->ipCoded);
     } else {
         $str = new StringW(self::ip6unpack($this->ipCoded));
         return $str->getString();
     }
 }
Exemple #2
0
 private static function removeBoundaries(array $cs)
 {
     if ($cs == NULL || count($cs) < 3) {
         $ret = new StringW("");
         return $ret->toCharArray();
     }
     $cs2 = [];
     $cs2Length = count($cs) - 1 / 2;
     for ($i = 0; $i < $cs2Length; $i++) {
         $cs2[$i] = $cs[$i * 2 + 1];
     }
     return $cs2;
 }
Exemple #3
0
 public function __construct($width = 400, $height = 200)
 {
     parent::__construct();
     if (!Validator::isNumber($width) || Validator::isNumber($height)) {
         throw new IllegalArgumentException();
     }
     $this->captcha = new Images($width, $height);
     $this->captcha->setBackgroundColor(new Color(0, 0, 0));
     $this->captcha->setTextColor(new Color(255, 255, 255));
     $string = new StringW(Hash::r());
     $this->text = $string->subString(0, Math::randomInterval(6, 8));
     $this->captcha->setText(Math::randomInterval(2, 6), new Point(0, 0), $string, FALSE);
 }
Exemple #4
0
 public function myPrint(StringW $s)
 {
     if ($s == NULL) {
         throw new NullPointerException();
     }
     $index = 0;
     while ($index < $s->getLength()) {
         if ($this->isCurrentLineFull()) {
             $this->wrap2NewLine();
         }
         $this->printer->printChar($s->charAt($index));
         $this->charPerCurrentLine++;
         $index++;
     }
 }
Exemple #5
0
 public function index()
 {
     $ipString = '2001:4cfb:bfc4:0000:0000:0000:0123:4aab';
     $myIP = new IPv6("2001:4cfb:0000:0000:0000:0000:0123:4aab", FALSE);
     //$myIP = new IPv4( '1.2.3.4', TRUE );
     $myIP = new IPvU($ipString, FALSE);
     //$myIP = new IPvU( "1.2.3.4", FALSE);
     echo ' IPString=' . $ipString . '<br>';
     echo 'MY IP=' . $myIP->getNiceIP() . '<br>';
     $z = new StringW("aookkooa");
     echo 'Text:<b>' . $z . '</b><br>Longest palindrome using Manachers algorithm: <b>' . $z->getLongestPalindromeManacher() . '</b>';
     $this->getDB()->query('SELECT user_name FROM users LIMIT 50;', []);
     $res = $this->getDB()->fetchAll();
     $this->getDB()->freeStatement();
     echo 'ack2:' . Math::ackermannLimitedRecoursion(3, 88);
     //echo 'ack:' . Math::ackermann( 3, 17 );
     return $res;
 }
Exemple #6
0
 public function __construct($string = "", $debug = FALSE)
 {
     parent::__construct($string);
     $this->string = strip_tags($string);
 }
Exemple #7
0
 public function __construct($string = "", $debug = FALSE)
 {
     parent::__construct($string);
     $this->string = htmlspecialchars($string, ENT_QUOTES);
 }