Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Foellmann <foellmann@foe-services.de>2014-04-05 17:35:38 +0400
committerChristian Foellmann <foellmann@foe-services.de>2014-04-05 17:35:38 +0400
commit9eb27ef6ebc763ddc6f6278462b8ffeed6de0e36 (patch)
treed3b4a1c7ae68cafb05b9d60040c9c22d457cee62 /libraries/StringNativeType.class.php
parentd472216554769ba596795f23a70c1809fa8897a3 (diff)
INIT phpmyadmin 4.1.12 multilanguage
Diffstat (limited to 'libraries/StringNativeType.class.php')
-rw-r--r--libraries/StringNativeType.class.php138
1 files changed, 138 insertions, 0 deletions
diff --git a/libraries/StringNativeType.class.php b/libraries/StringNativeType.class.php
new file mode 100644
index 0000000000..04b7679ee5
--- /dev/null
+++ b/libraries/StringNativeType.class.php
@@ -0,0 +1,138 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Implements PMA_StringByte interface using native PHP functions.
+ *
+ * @package PhpMyAdmin-String
+ * @subpackage Native
+ */
+if (! defined('PHPMYADMIN')) {
+ exit;
+}
+
+require_once 'libraries/StringAbstractType.class.php';
+
+/**
+ * Implements PMA_StringByte interface using native PHP functions.
+ *
+ * @package PhpMyAdmin-String
+ * @subpackage Native
+ * @todo May be join this class with PMA_StringNative class
+ */
+class PMA_StringNativeType extends PMA_StringAbstractType
+{
+ /**
+ * Checks if a character is an alphanumeric one
+ *
+ * @param string $c character to check for
+ *
+ * @return boolean whether the character is an alphanumeric one or not
+ */
+ public function isAlnum($c)
+ {
+ return ($this->isAlpha($c) || $this->isDigit($c));
+ } // end of the "isAlnum()" function
+
+ /**
+ * Checks if a character is an alphabetic one
+ *
+ * @param string $c character to check for
+ *
+ * @return boolean whether the character is an alphabetic one or not
+ */
+ public function isAlpha($c)
+ {
+ return ($this->isUpper($c) || $this->isLower($c));
+ } // end of the "isAlpha()" function
+
+ /**
+ * Checks if a character is a digit
+ *
+ * @param string $c character to check for
+ *
+ * @return boolean whether the character is a digit or not
+ */
+ public function isDigit($c)
+ {
+ $ord_zero = 48; //ord('0');
+ $ord_nine = 57; //ord('9');
+ $ord_c = ord($c);
+
+ return $this->numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
+ } // end of the "isDigit()" function
+
+ /**
+ * Checks if a character is an upper alphabetic one
+ *
+ * @param string $c character to check for
+ *
+ * @return boolean whether the character is an upper alphabetic one or not
+ */
+ public function isUpper($c)
+ {
+ $ord_zero = 65; //ord('A');
+ $ord_nine = 90; //ord('Z');
+ $ord_c = ord($c);
+
+ return $this->numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
+ } // end of the "isUpper()" function
+
+ /**
+ * Checks if a character is a lower alphabetic one
+ *
+ * @param string $c character to check for
+ *
+ * @return boolean whether the character is a lower alphabetic one or not
+ */
+ public function isLower($c)
+ {
+ $ord_zero = 97; //ord('a');
+ $ord_nine = 122; //ord('z');
+ $ord_c = ord($c);
+
+ return $this->numberInRangeInclusive($ord_c, $ord_zero, $ord_nine);
+ } // end of the "isLower()" function
+
+ /**
+ * Checks if a character is a space one
+ *
+ * @param string $c character to check for
+ *
+ * @return boolean whether the character is a space one or not
+ */
+ public function isSpace($c)
+ {
+ $ord_space = 32; //ord(' ')
+ $ord_tab = 9; //ord('\t')
+ $ord_CR = 13; //ord('\n')
+ $ord_NOBR = 160; //ord('U+00A0);
+ $ord_c = ord($c);
+
+ return ($ord_c == $ord_space
+ || $ord_c == $ord_NOBR
+ || $this->numberInRangeInclusive($ord_c, $ord_tab, $ord_CR));
+ } // end of the "isSpace()" function
+
+ /**
+ * Checks if a character is an hexadecimal digit
+ *
+ * @param string $c character to check for
+ *
+ * @return boolean whether the character is an hexadecimal digit or not
+ */
+ public function isHexDigit($c)
+ {
+ $ord_Aupper = 65; //ord('A');
+ $ord_Fupper = 70; //ord('F');
+ $ord_Alower = 97; //ord('a');
+ $ord_Flower = 102; //ord('f');
+ $ord_zero = 48; //ord('0');
+ $ord_nine = 57; //ord('9');
+ $ord_c = ord($c);
+
+ return ($this->numberInRangeInclusive($ord_c, $ord_zero, $ord_nine)
+ || $this->numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper)
+ || $this->numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower));
+ } // end of the "isHexDigit()" function
+}
+?>