本文整理汇总了PHP中PMA_convert_display_charset函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_convert_display_charset函数的具体用法?PHP PMA_convert_display_charset怎么用?PHP PMA_convert_display_charset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_convert_display_charset函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
while ($i < $tbl_result_cnt) {
list($tbl) = PMA_DBI_fetch_row($tbl_result);
$fld_results = PMA_DBI_get_fields($db, $tbl);
$fld_results_cnt = $fld_results ? count($fld_results) : 0;
$j = 0;
if (empty($tbl_names[$tbl]) && !empty($TableList)) {
$tbl_names[$tbl] = '';
} else {
$tbl_names[$tbl] = ' selected="selected"';
}
// end if
// The fields list per selected tables
if ($tbl_names[$tbl] == ' selected="selected"') {
$fld[$k++] = PMA_backquote($tbl) . '.*';
while ($j < $fld_results_cnt) {
$fld[$k] = PMA_convert_display_charset($fld_results[$j]['Field']);
$fld[$k] = PMA_backquote($tbl) . '.' . PMA_backquote($fld[$k]);
// increase the width if necessary
if (strlen($fld[$k]) > $form_column_width) {
$form_column_width = strlen($fld[$k]);
}
//end if
$k++;
$j++;
}
// end while
}
// end if
$i++;
}
// end if
示例2: PMA_DBI_field_flags
/**
* returns concatenated string of human readable field flags
*
* @uses MYSQLI_UNIQUE_KEY_FLAG
* @uses MYSQLI_NUM_FLAG
* @uses MYSQLI_PART_KEY_FLAG
* @uses MYSQLI_TYPE_SET
* @uses MYSQLI_TIMESTAMP_FLAG
* @uses MYSQLI_AUTO_INCREMENT_FLAG
* @uses MYSQLI_TYPE_ENUM
* @uses MYSQLI_BINARY_FLAG
* @uses MYSQLI_ZEROFILL_FLAG
* @uses MYSQLI_UNSIGNED_FLAG
* @uses MYSQLI_BLOB_FLAG
* @uses MYSQLI_MULTIPLE_KEY_FLAG
* @uses MYSQLI_UNIQUE_KEY_FLAG
* @uses MYSQLI_PRI_KEY_FLAG
* @uses MYSQLI_NOT_NULL_FLAG
* @uses mysqli_fetch_field_direct()
* @uses PMA_convert_display_charset()
* @param object mysqli result $result
* @param integer $i field
* @return string field flags
*/
function PMA_DBI_field_flags($result, $i)
{
$f = mysqli_fetch_field_direct($result, $i);
$f = $f->flags;
$flags = '';
if ($f & MYSQLI_UNIQUE_KEY_FLAG) {
$flags .= 'unique ';
}
if ($f & MYSQLI_NUM_FLAG) {
$flags .= 'num ';
}
if ($f & MYSQLI_PART_KEY_FLAG) {
$flags .= 'part_key ';
}
if ($f & MYSQLI_TYPE_SET) {
$flags .= 'set ';
}
if ($f & MYSQLI_TIMESTAMP_FLAG) {
$flags .= 'timestamp ';
}
if ($f & MYSQLI_AUTO_INCREMENT_FLAG) {
$flags .= 'auto_increment ';
}
if ($f & MYSQLI_TYPE_ENUM) {
$flags .= 'enum ';
}
// @TODO seems to be outdated
if ($f & MYSQLI_BINARY_FLAG) {
$flags .= 'binary ';
}
if ($f & MYSQLI_ZEROFILL_FLAG) {
$flags .= 'zerofill ';
}
if ($f & MYSQLI_UNSIGNED_FLAG) {
$flags .= 'unsigned ';
}
if ($f & MYSQLI_BLOB_FLAG) {
$flags .= 'blob ';
}
if ($f & MYSQLI_MULTIPLE_KEY_FLAG) {
$flags .= 'multiple_key ';
}
if ($f & MYSQLI_UNIQUE_KEY_FLAG) {
$flags .= 'unique_key ';
}
if ($f & MYSQLI_PRI_KEY_FLAG) {
$flags .= 'primary_key ';
}
if ($f & MYSQLI_NOT_NULL_FLAG) {
$flags .= 'not_null ';
}
return PMA_convert_display_charset(trim($flags));
}
示例3: PMA_convert_display_charset
/**
* Converts encoding according to current settings.
*
* @param mixed what to convert (string or array of strings or object returned by mysql_fetch_field)
*
* @return string converted string or array of strings
*
* @global array the configuration array
* @global boolean whether recoding is allowed or not
* @global string the current charset
* @global array the charset to convert to
*
* @access public
*
* @author nijel
*/
function PMA_convert_display_charset($what)
{
global $cfg, $allow_recoding, $charset, $convcharset;
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding) || $convcharset == $charset || defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) {
// lem9: even if AllowAnywhereRecoding is TRUE, do not recode for MySQL >= 4.1.x since MySQL does the job
return $what;
} elseif (is_array($what)) {
$result = array();
foreach ($what as $key => $val) {
if (is_string($val) || is_array($val)) {
if (is_string($key)) {
$result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val);
} else {
$result[$key] = PMA_convert_display_charset($val);
}
} else {
$result[$key] = $val;
}
}
// end while
return $result;
} elseif (is_string($what)) {
switch ($GLOBALS['PMA_recoding_engine']) {
case PMA_CHARSET_RECODE:
return recode_string($convcharset . '..' . $charset, $what);
case PMA_CHARSET_ICONV:
return iconv($convcharset, $charset . $cfg['IconvExtraParams'], $what);
case PMA_CHARSET_ICONV_AIX:
return PMA_aix_iconv_wrapper($convcharset, $charset . $cfg['IconvExtraParams'], $what);
case PMA_CHARSET_LIBICONV:
return libiconv($convcharset, $charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
default:
return $what;
}
} elseif (is_object($what)) {
// isn't it object returned from mysql_fetch_field ?
if (@is_string($what->name)) {
$what->name = PMA_convert_display_charset($what->name);
}
if (@is_string($what->table)) {
$what->table = PMA_convert_display_charset($what->table);
}
if (@is_string($what->Database)) {
$what->Database = PMA_convert_display_charset($what->Database);
}
return $what;
} else {
// when we don't know what it is we don't touch it...
return $what;
}
}
示例4: PMA_DBI_field_flags
function PMA_DBI_field_flags($result, $i)
{
return PMA_convert_display_charset(mysql_field_flags($result, $i));
}
示例5: PMA_mysql_tablename
function PMA_mysql_tablename($result, $i)
{
return PMA_convert_display_charset(mysql_tablename($result, $i));
}
示例6: PMA_DBI_field_flags
function PMA_DBI_field_flags($result, $i)
{
$f = mysqli_fetch_field_direct($result, $i);
$f = $f->flags;
$flags = '';
if ($f & UNIQUE_FLAG) {
$flags .= 'unique ';
}
if ($f & NUM_FLAG) {
$flags .= 'num ';
}
if ($f & PART_KEY_FLAG) {
$flags .= 'part_key ';
}
if ($f & SET_FLAG) {
$flags .= 'set ';
}
if ($f & TIMESTAMP_FLAG) {
$flags .= 'timestamp ';
}
if ($f & AUTO_INCREMENT_FLAG) {
$flags .= 'auto_increment ';
}
if ($f & ENUM_FLAG) {
$flags .= 'enum ';
}
if ($f & BINARY_FLAG) {
$flags .= 'binary ';
}
if ($f & ZEROFILL_FLAG) {
$flags .= 'zerofill ';
}
if ($f & UNSIGNED_FLAG) {
$flags .= 'unsigned ';
}
if ($f & BLOB_FLAG) {
$flags .= 'blob ';
}
if ($f & MULTIPLE_KEY_FLAG) {
$flags .= 'multiple_key ';
}
if ($f & UNIQUE_KEY_FLAG) {
$flags .= 'unique_key ';
}
if ($f & PRI_KEY_FLAG) {
$flags .= 'primary_key ';
}
if ($f & NOT_NULL_FLAG) {
$flags .= 'not_null ';
}
return PMA_convert_display_charset(trim($flags));
}
示例7: PMA_DBI_field_flags
/**
* returns concatenated string of human readable field flags
*
* @uses MYSQLI_UNIQUE_KEY_FLAG
* @uses MYSQLI_NUM_FLAG
* @uses MYSQLI_PART_KEY_FLAG
* @uses MYSQLI_TYPE_SET
* @uses MYSQLI_TIMESTAMP_FLAG
* @uses MYSQLI_AUTO_INCREMENT_FLAG
* @uses MYSQLI_TYPE_ENUM
* @uses MYSQLI_ZEROFILL_FLAG
* @uses MYSQLI_UNSIGNED_FLAG
* @uses MYSQLI_BLOB_FLAG
* @uses MYSQLI_MULTIPLE_KEY_FLAG
* @uses MYSQLI_UNIQUE_KEY_FLAG
* @uses MYSQLI_PRI_KEY_FLAG
* @uses MYSQLI_NOT_NULL_FLAG
* @uses MYSQLI_TYPE_TINY_BLOB
* @uses MYSQLI_TYPE_BLOB
* @uses MYSQLI_TYPE_MEDIUM_BLOB
* @uses MYSQLI_TYPE_LONG_BLOB
* @uses MYSQLI_TYPE_VAR_STRING
* @uses MYSQLI_TYPE_STRING
* @uses mysqli_fetch_field_direct()
* @uses PMA_convert_display_charset()
* @param object mysqli result $result
* @param integer $i field
* @return string field flags
*/
function PMA_DBI_field_flags($result, $i)
{
// This is missing from PHP 5.2.5, see http://bugs.php.net/bug.php?id=44846
if (!defined('MYSQLI_ENUM_FLAG')) {
define('MYSQLI_ENUM_FLAG', 256);
// see MySQL source include/mysql_com.h
}
$f = mysqli_fetch_field_direct($result, $i);
$type = $f->type;
$charsetnr = $f->charsetnr;
$f = $f->flags;
$flags = '';
if ($f & MYSQLI_UNIQUE_KEY_FLAG) {
$flags .= 'unique ';
}
if ($f & MYSQLI_NUM_FLAG) {
$flags .= 'num ';
}
if ($f & MYSQLI_PART_KEY_FLAG) {
$flags .= 'part_key ';
}
if ($f & MYSQLI_SET_FLAG) {
$flags .= 'set ';
}
if ($f & MYSQLI_TIMESTAMP_FLAG) {
$flags .= 'timestamp ';
}
if ($f & MYSQLI_AUTO_INCREMENT_FLAG) {
$flags .= 'auto_increment ';
}
if ($f & MYSQLI_ENUM_FLAG) {
$flags .= 'enum ';
}
// See http://dev.mysql.com/doc/refman/6.0/en/c-api-datatypes.html:
// to determine if a string is binary, we should not use MYSQLI_BINARY_FLAG
// but instead the charsetnr member of the MYSQL_FIELD
// structure. Watch out: some types like DATE returns 63 in charsetnr
// so we have to check also the type.
// Unfortunately there is no equivalent in the mysql extension.
if (($type == MYSQLI_TYPE_TINY_BLOB || $type == MYSQLI_TYPE_BLOB || $type == MYSQLI_TYPE_MEDIUM_BLOB || $type == MYSQLI_TYPE_LONG_BLOB || $type == MYSQLI_TYPE_VAR_STRING || $type == MYSQLI_TYPE_STRING) && 63 == $charsetnr) {
$flags .= 'binary ';
}
if ($f & MYSQLI_ZEROFILL_FLAG) {
$flags .= 'zerofill ';
}
if ($f & MYSQLI_UNSIGNED_FLAG) {
$flags .= 'unsigned ';
}
if ($f & MYSQLI_BLOB_FLAG) {
$flags .= 'blob ';
}
if ($f & MYSQLI_MULTIPLE_KEY_FLAG) {
$flags .= 'multiple_key ';
}
if ($f & MYSQLI_UNIQUE_KEY_FLAG) {
$flags .= 'unique_key ';
}
if ($f & MYSQLI_PRI_KEY_FLAG) {
$flags .= 'primary_key ';
}
if ($f & MYSQLI_NOT_NULL_FLAG) {
$flags .= 'not_null ';
}
return PMA_convert_display_charset(trim($flags));
}
示例8: PMA_convert_display_charset
/**
* Converts encoding according to current settings.
*
* @param mixed what to convert (string or array of strings or object returned by mysql_fetch_field)
*
* @return string converted string or array of strings
*
* @global array the configuration array
* @global boolean whether recoding is allowed or not
* @global string the current charset
* @global array the charset to convert to
*
* @access public
*
* @author nijel
*/
function PMA_convert_display_charset($what)
{
global $cfg, $allow_recoding, $charset, $convcharset;
if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding) || $convcharset == $charset) {
// rabus: if input and output charset are the same, we don't have to do anything...
return $what;
} else {
if (is_array($what)) {
$result = array();
foreach ($what as $key => $val) {
if (is_string($val) || is_array($val)) {
if (is_string($key)) {
$result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val);
} else {
$result[$key] = PMA_convert_display_charset($val);
}
} else {
$result[$key] = $val;
}
}
// end while
return $result;
} else {
if (is_string($what)) {
switch ($GLOBALS['PMA_recoding_engine']) {
case PMA_CHARSET_RECODE:
return recode_string($convcharset . '..' . $charset, $what);
case PMA_CHARSET_ICONV:
return iconv($convcharset, $charset . $cfg['IconvExtraParams'], $what);
case PMA_CHARSET_LIBICONV:
return libiconv($convcharset, $charset, $what);
default:
return $what;
}
} else {
if (is_object($what)) {
// isn't it object returned from mysql_fetch_field ?
if (@is_string($what->name)) {
$what->name = PMA_convert_display_charset($what->name);
}
if (@is_string($what->table)) {
$what->table = PMA_convert_display_charset($what->table);
}
if (@is_string($what->Database)) {
$what->Database = PMA_convert_display_charset($what->Database);
}
return $what;
} else {
// when we don't know what it is we don't touch it...
return $what;
}
}
}
}
}