当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_substr函数代码示例

本文整理汇总了PHP中PMA_substr函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_substr函数的具体用法?PHP PMA_substr怎么用?PHP PMA_substr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_substr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_transformation_text_plain__substr

function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '')
{
    // possibly use a global transform and feed it with special options:
    // include('./libs/transformations/global.inc.php');
    // further operations on $buffer using the $options[] array.
    if (!isset($options[0]) || $options[0] == '') {
        $options[0] = 0;
    }
    if (!isset($options[1]) || $options[1] == '') {
        $options[1] = 'all';
    }
    if (!isset($options[2]) || $options[2] == '') {
        $options[2] = '...';
    }
    $newtext = '';
    if ($options[1] != 'all') {
        $newtext = PMA_substr($buffer, $options[0], $options[1]);
    } else {
        $newtext = PMA_substr($buffer, $options[0]);
    }
    $length = strlen($newtext);
    $baselength = strlen($buffer);
    if ($length != $baselength) {
        if ($options[0] != 0) {
            $newtext = $options[2] . $newtext;
        }
        if ($length + $options[0] != $baselength) {
            $newtext .= $options[2];
        }
    }
    return $newtext;
}
开发者ID:BGCX261,项目名称:zhe-project-agri-hg-to-git,代码行数:32,代码来源:text_plain__substr.inc.php

示例2: testMultiByte

 public function testMultiByte()
 {
     $this->assertEquals(
         'čšě',
         PMA_substr('čšěčščěš', 0, 3)
     );
 }
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:7,代码来源:PMA_STR_sub_test.php

示例3: applyTransformation

 /**
  * Does the actual work of each specific transformations plugin.
  *
  * @param string $buffer  text to be transformed
  * @param array  $options transformation options
  * @param string $meta    meta information
  *
  * @return void
  */
 public function applyTransformation($buffer, $options = array(), $meta = '')
 {
     // possibly use a global transform and feed it with special options
     // further operations on $buffer using the $options[] array.
     if (!isset($options[0]) || $options[0] == '') {
         $options[0] = 0;
     }
     if (!isset($options[1]) || $options[1] == '') {
         $options[1] = 'all';
     }
     if (!isset($options[2]) || $options[2] == '') {
         $options[2] = '…';
     }
     $newtext = '';
     if ($options[1] != 'all') {
         $newtext = PMA_substr($buffer, $options[0], $options[1]);
     } else {
         $newtext = PMA_substr($buffer, $options[0]);
     }
     $length = strlen($newtext);
     $baselength = strlen($buffer);
     if ($length != $baselength) {
         if ($options[0] != 0) {
             $newtext = $options[2] . $newtext;
         }
         if ($length + $options[0] != $baselength) {
             $newtext .= $options[2];
         }
     }
     return $newtext;
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:40,代码来源:SubstringTransformationsPlugin.class.php

示例4: testMultiByte

 public function testMultiByte()
 {
     /* The PDF testing seems to set mb encoding to ASCII */
     if (function_exists('mb_internal_encoding')) {
         mb_internal_encoding('utf-8');
     }
     $this->assertEquals(
         'čšě',
         PMA_substr('čšěčščěš', 0, 3)
     );
 }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:11,代码来源:PMA_STR_sub_test.php

示例5: PMA_STR_charIsEscaped

/**
 * Checks if a given character position in the string is escaped or not
 *
 * @uses    PMA_strlen()
 * @uses    PMA_substr()
 * @uses    max()
 * @uses    intval()
 * @param   string   string to check for
 * @param   integer  the character to check for
 * @param   integer  starting position in the string
 * @return  boolean  whether the character is escaped or not
 */
function PMA_STR_charIsEscaped($string, $pos, $start = 0)
{
    $pos = max(intval($pos), 0);
    $start = max(intval($start), 0);
    $len = PMA_strlen($string);
    // Base case:
    // Check for string length or invalid input or special case of input
    // (pos == $start)
    if ($pos <= $start || $len <= max($pos, $start)) {
        return false;
    }
    $pos--;
    $escaped = false;
    while ($pos >= $start && PMA_substr($string, $pos, 1) == '\\') {
        $escaped = !$escaped;
        $pos--;
    }
    // end while
    return $escaped;
}
开发者ID:alecbenson,项目名称:TurnoutWeb-Patches,代码行数:32,代码来源:string.lib.php

示例6: PMA_displayTableBody


//.........这里部分代码省略.........
                //  b l o b
            } elseif ($GLOBALS['cfg']['ShowBlob'] == false && stristr($meta->type, 'BLOB')) {
                // loic1 : PMA_mysql_fetch_fields returns BLOB in place of
                // TEXT fields type, however TEXT fields must be displayed
                // even if $GLOBALS['cfg']['ShowBlob'] is false -> get the true type
                // of the fields.
                $field_flags = PMA_DBI_field_flags($dt_result, $i);
                if (stristr($field_flags, 'BINARY')) {
                    $blobtext = '[BLOB';
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $blobtext .= ' - NULL';
                        $blob_size = 0;
                    } elseif (isset($row[$i])) {
                        $blob_size = strlen($row[$i]);
                        $display_blob_size = PMA_formatByteDown($blob_size, 3, 1);
                        $blobtext .= ' - ' . $display_blob_size[0] . ' ' . $display_blob_size[1];
                        unset($display_blob_size);
                    }
                    $blobtext .= ']';
                    if (strpos($transform_function, 'octetstream')) {
                        $blobtext = $row[$i];
                    }
                    if ($blob_size > 0) {
                        $blobtext = $default_function != $transform_function ? $transform_function($blobtext, $transform_options, $meta) : $default_function($blobtext, array(), $meta);
                    }
                    unset($blob_size);
                    $vertical_display['data'][$row_no][$i] = '    <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>';
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                    } elseif ($row[$i] != '') {
                        // garvin: if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $dontlimitchars != 1) {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        }
                        // loic1: displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $row[$i] . '</td>' . "\n";
                    } else {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                    }
                }
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    // loic1: support blanks in the key
                    $relation_id = $row[$i];
                    // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // lem9: (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $dontlimitchars != 1 && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                    }
                    // loic1: displays special characters from binaries
                    $field_flags = PMA_DBI_field_flags($dt_result, $i);
                    if (stristr($field_flags, 'BINARY')) {
                        $row[$i] = str_replace("", '\\0', $row[$i]);
                        $row[$i] = str_replace("", '\\b', $row[$i]);
                        $row[$i] = str_replace("\n", '\\n', $row[$i]);
                        $row[$i] = str_replace("\r", '\\r', $row[$i]);
                        $row[$i] = str_replace("", '\\Z', $row[$i]);
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                    } else {
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                    }
开发者ID:a195474368,项目名称:ejiawang,代码行数:67,代码来源:display_tbl.lib.php

示例7: PMA_displayTableBody


//.........这里部分代码省略.........
                                $bs_tables = $bs_tables[$db];
                                if (isset($bs_tables)) {
                                    $allBSTablesExist = TRUE;
                                    // check if BS tables exist for given database
                                    foreach ($bs_tables as $table_key => $bs_tbl) {
                                        if (!$bs_tables[$table_key]['Exists']) {
                                            $allBSTablesExist = FALSE;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    // if necessary BS tables exist
                    if ($allBSTablesExist) {
                        $bs_reference_exists = PMA_BS_ReferenceExists($row[$i], $db);
                    }
                    // if valid BS reference exists
                    if ($bs_reference_exists) {
                        $blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
                    } else {
                        $blobtext = PMA_handle_non_printable_contents('BLOB', isset($row[$i]) ? $row[$i] : '', $transform_function, $transform_options, $default_function, $meta);
                    }
                    $vertical_display['data'][$row_no][$i] = '    <td align="left"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $blobtext . '</td>';
                    unset($blobtext);
                    // not binary:
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                    } elseif ($row[$i] != '') {
                        // garvin: if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        }
                        // loic1: displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">' . $row[$i] . '</td>' . "\n";
                    } else {
                        $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '">&nbsp;</td>' . "\n";
                    }
                }
                // n o t   n u m e r i c   a n d   n o t   B L O B
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = '    <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
                } elseif ($row[$i] != '') {
                    // loic1: support blanks in the key
                    $relation_id = $row[$i];
                    // nijel: Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // lem9: (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                    }
                    // loic1: displays special characters from binaries
                    $field_flags = PMA_DBI_field_flags($dt_result, $i);
                    if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
                        $row[$i] = PMA_printable_bit_value($row[$i], $meta->length);
                    } elseif (stristr($field_flags, 'BINARY') && $meta->type == 'string') {
                        if ($_SESSION['tmp_user_values']['display_binary'] || isset($GLOBALS['is_analyse']) && $GLOBALS['is_analyse']) {
                            // user asked to see the real contents of BINARY
                            // fields, or we detected a PROCEDURE ANALYSE in
                            // the query (results are reported as being
                            // binary strings)
                            if ($_SESSION['tmp_user_values']['display_binary_as_hex']) {
开发者ID:kolbermoorer,项目名称:edugame,代码行数:67,代码来源:display_tbl.lib.php

示例8: PMA_SQP_formatHtml_colorize

 /**
  * Colorizes SQL queries html formatted
  *
  * @param  array   The SQL queries html formatted
  *
  * @return array   The colorized SQL queries
  *
  * @access public
  */
 function PMA_SQP_formatHtml_colorize($arr)
 {
     $i = $GLOBALS['PMA_strpos']($arr['type'], '_');
     $class = '';
     if ($i > 0) {
         $class = 'syntax_' . PMA_substr($arr['type'], 0, $i) . ' ';
     }
     $class .= 'syntax_' . $arr['type'];
     //TODO: check why adding a "\n" after the </span> would cause extra
     //      blanks to be displayed:
     //      SELECT p . person_name
     return '<span class="' . $class . '">' . htmlspecialchars($arr['data']) . '</span>';
 }
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:22,代码来源:sqlparser.lib.php

示例9: htmlspecialchars

        $val_ordered_current_key = $keys[$val_ordered_current_row];
        $val_ordered_current_val = $values[$val_ordered_current_row];
        $val_ordered_current_row++;
        if (PMA_strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
            $val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
            $val_ordered_current_val_title = '';
        } else {
            $val_ordered_current_val_title = htmlspecialchars($val_ordered_current_val);
            $val_ordered_current_val = htmlspecialchars(PMA_substr($val_ordered_current_val, 0, $cfg['LimitChars']) . '...');
        }
        if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
            $key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
            $key_ordered_current_val_title = '';
        } else {
            $key_ordered_current_val_title = htmlspecialchars($key_ordered_current_val);
            $key_ordered_current_val = htmlspecialchars(PMA_substr($key_ordered_current_val, 0, $cfg['LimitChars']) . '...');
        }
        if (!empty($data)) {
            $val_ordered_current_equals_data = $val_ordered_current_key == $data;
            $key_ordered_current_equals_data = $key_ordered_current_key == $data;
        }
        ?>
    <tr class="noclick <?php 
        echo $odd_row ? 'odd' : 'even';
        $odd_row = !$odd_row;
        ?>
">
        <td nowrap="nowrap">
        <?php 
        echo ($key_ordered_current_equals_data ? '<strong>' : '') . '<a href="#" title="' . __('Use this value') . ($key_ordered_current_val_title != '' ? ': ' . $key_ordered_current_val_title : '') . '"' . ' onclick="formupdate(\'' . md5($field) . '\', \'' . PMA_jsFormat($key_ordered_current_key, false) . '\'); return false;">' . htmlspecialchars($key_ordered_current_key) . '</a>' . ($key_ordered_current_equals_data ? '</strong>' : '');
        ?>
开发者ID:htom78,项目名称:project,代码行数:31,代码来源:browse_foreigners.php

示例10: __

    <th><?php 
echo __('Original position');
?>
</th>
    <th><?php 
echo __('Information');
?>
</th>
</tr>
</thead>
<tbody>
<?php 
$odd_row = true;
while ($value = PMA_DBI_fetch_assoc($result)) {
    if (!$dontlimitchars && PMA_strlen($value['Info']) > $GLOBALS['cfg']['LimitChars']) {
        $value['Info'] = PMA_substr($value['Info'], 0, $GLOBALS['cfg']['LimitChars']) . '...';
    }
    ?>
<tr class="noclick <?php 
    echo $odd_row ? 'odd' : 'even';
    ?>
">
    <td>&nbsp;<?php 
    echo $value['Log_name'];
    ?>
&nbsp;</td>
    <td align="right">&nbsp;<?php 
    echo $value['Pos'];
    ?>
&nbsp;</td>
    <td>&nbsp;<?php 
开发者ID:zseand,项目名称:kloxo,代码行数:31,代码来源:server_binlog.php

示例11: PMA_SQP_formatHtml_colorize

    /**
     * Colorizes SQL queries html formatted
     *
     * @todo check why adding a "\n" after the </span> would cause extra blanks
     * to be displayed: SELECT p . person_name
     * @param  array   The SQL queries html formatted
     *
     * @return array   The colorized SQL queries
     *
     * @access public
     */
    function PMA_SQP_formatHtml_colorize($arr)
    {
        $i         = $GLOBALS['PMA_strpos']($arr['type'], '_');
        $class     = '';
        if ($i > 0) {
            $class = 'syntax_' . PMA_substr($arr['type'], 0, $i) . ' ';
        }

        $class     .= 'syntax_' . $arr['type'];

        return '<span class="' . $class . '">' . htmlspecialchars($arr['data']) . '</span>';
    } // end of the "PMA_SQP_formatHtml_colorize()" function
开发者ID:blumenbach,项目名称:blumenbach-online.de,代码行数:23,代码来源:sqlparser.lib.php

示例12: PMA_displayTableBody


//.........这里部分代码省略.........
                    $where_comparison = ' = ' . $row[$i];
                    $vertical_display['data'][$row_no][$i] = '<td align="right"' . PMA_prepare_row_data($class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
                } else {
                    $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta, 'align="right"');
                }
                //  b l o b
            } elseif (stristr($meta->type, 'BLOB')) {
                // PMA_mysql_fetch_fields returns BLOB in place of
                // TEXT fields type so we have to ensure it's really a BLOB
                $field_flags = PMA_DBI_field_flags($dt_result, $i);
                // remove 'inline_edit' from $class as we can't edit binary data.
                $class = str_replace('inline_edit', '', $class);
                if (stristr($field_flags, 'BINARY')) {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta);
                    } else {
                        // for blobstreaming
                        // if valid BS reference exists
                        if (PMA_BS_IsPBMSReference($row[$i], $db)) {
                            $blobtext = PMA_BS_CreateReferenceLink($row[$i], $db);
                        } else {
                            $blobtext = PMA_handle_non_printable_contents('BLOB', isset($row[$i]) ? $row[$i] : '', $transform_function, $transform_options, $default_function, $meta, $_url_params);
                        }
                        $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $blobtext);
                        unset($blobtext);
                    }
                    // not binary:
                } else {
                    if (!isset($row[$i]) || is_null($row[$i])) {
                        $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta);
                    } elseif ($row[$i] != '') {
                        // if a transform function for blob is set, none of these replacements will be made
                        if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
                            $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                            $is_field_truncated = true;
                        }
                        // displays all space characters, 4 space
                        // characters for tabulations and <cr>/<lf>
                        $row[$i] = $default_function != $transform_function ? $transform_function($row[$i], $transform_options, $meta) : $default_function($row[$i], array(), $meta);
                        $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $row[$i]);
                    } else {
                        $vertical_display['data'][$row_no][$i] = PMA_buildEmptyDisplay($class, $condition_field, $meta);
                    }
                }
                // g e o m e t r y
            } elseif ($meta->type == 'geometry') {
                $geometry_text = PMA_handle_non_printable_contents('GEOMETRY', isset($row[$i]) ? $row[$i] : '', $transform_function, $transform_options, $default_function, $meta);
                // remove 'inline_edit' from $class as we can't edit geometry data.
                $class = str_replace('inline_edit', '', $class);
                $vertical_display['data'][$row_no][$i] = PMA_buildValueDisplay($class, $condition_field, $geometry_text);
                unset($geometry_text);
                // n o t   n u m e r i c   a n d   n o t   B L O B
            } else {
                if (!isset($row[$i]) || is_null($row[$i])) {
                    $vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta);
                } elseif ($row[$i] != '') {
                    // support blanks in the key
                    $relation_id = $row[$i];
                    // Cut all fields to $GLOBALS['cfg']['LimitChars']
                    // (unless it's a link-type transformation)
                    if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
                        $row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
                        $is_field_truncated = true;
                    }
                    // displays special characters from binaries
                    $field_flags = PMA_DBI_field_flags($dt_result, $i);
开发者ID:anmolview,项目名称:yiidemos,代码行数:67,代码来源:display_tbl.lib.php

示例13: _getDataCellForNonNumericAndNonBlobColumns

 /**
  * Get data cell for non numeric and non blob type fields
  *
  * @param string  $column                the relavent column in data row
  * @param string  $class                 the html class for column
  * @param object  $meta                  the meta-information about the field
  * @param array   $map                   the list of relations
  * @param array   $_url_params           the parameters for generate url
  * @param boolean $condition_field       the column should highlighted
  *                                       or not
  * @param string  $transformation_plugin the name of transformation function
  * @param string  $default_function      the default transformation function
  * @param string  $transform_options     the transformation parameters
  * @param boolean $is_field_truncated    the condition for blob data
  *                                       replacements
  * @param array   $analyzed_sql          the analyzed query
  * @param integer &$dt_result            the link id associated to the query
  *                                        which results have to be displayed
  * @param integer $col_index             the column index
  *
  * @return  string  $cell               the prepared data cell, html content
  *
  * @access  private
  *
  * @see     _getTableBody()
  */
 private function _getDataCellForNonNumericAndNonBlobColumns($column, $class, $meta, $map, $_url_params, $condition_field, $transformation_plugin, $default_function, $transform_options, $is_field_truncated, $analyzed_sql, &$dt_result, $col_index)
 {
     $is_analyse = $this->__get('_is_analyse');
     $field_flags = PMA_DBI_field_flags($dt_result, $col_index);
     if (stristr($field_flags, self::BINARY_FIELD) && ($GLOBALS['cfg']['ProtectBinary'] == 'all' || $GLOBALS['cfg']['ProtectBinary'] == 'noblob')) {
         $class = str_replace('grid_edit', '', $class);
     }
     if (!isset($column) || is_null($column)) {
         $cell = $this->_buildNullDisplay($class, $condition_field, $meta);
     } elseif ($column != '') {
         // Cut all fields to $GLOBALS['cfg']['LimitChars']
         // (unless it's a link-type transformation)
         if (PMA_strlen($column) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == self::DISPLAY_PARTIAL_TEXT && gettype($transformation_plugin) == "object" && !strpos($transformation_plugin::getName(), 'Link') === true) {
             $column = PMA_substr($column, 0, $GLOBALS['cfg']['LimitChars']) . '...';
             $is_field_truncated = true;
         }
         $formatted = false;
         if (isset($meta->_type) && $meta->_type === MYSQLI_TYPE_BIT) {
             $column = $this->getCommonFunctions()->printableBitValue($column, $meta->length);
             // some results of PROCEDURE ANALYSE() are reported as
             // being BINARY but they are quite readable,
             // so don't treat them as BINARY
         } elseif (stristr($field_flags, self::BINARY_FIELD) && $meta->type == self::STRING_FIELD && !(isset($is_analyse) && $is_analyse)) {
             if ($_SESSION['tmp_user_values']['display_binary']) {
                 // user asked to see the real contents of BINARY
                 // fields
                 if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && $this->getCommonFunctions()->containsNonPrintableAscii($column)) {
                     $column = bin2hex($column);
                 } else {
                     $column = htmlspecialchars($this->getCommonFunctions()->replaceBinaryContents($column));
                 }
             } else {
                 // we show the BINARY message and field's size
                 // (or maybe use a transformation)
                 $column = $this->_handleNonPrintableContents(self::BINARY_FIELD, $column, $transformation_plugin, $transform_options, $default_function, $meta, $_url_params);
                 $formatted = true;
             }
         }
         if ($formatted) {
             $cell = $this->_buildValueDisplay($class, $condition_field, $column);
         } else {
             // transform functions may enable no-wrapping:
             $function_nowrap = 'applyTransformationNoWrap';
             $bool_nowrap = $default_function != $transformation_plugin && function_exists($transformation_plugin->{$function_nowrap}()) ? $transformation_plugin->{$function_nowrap}($transform_options) : false;
             // do not wrap if date field type
             $nowrap = preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap ? ' nowrap' : '';
             $where_comparison = ' = \'' . $this->getCommonFunctions()->sqlAddSlashes($column) . '\'';
             $cell = $this->_getRowData($class, $condition_field, $analyzed_sql, $meta, $map, $column, $transformation_plugin, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
         }
     } else {
         $cell = $this->_buildEmptyDisplay($class, $condition_field, $meta);
     }
     return $cell;
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:80,代码来源:DisplayResults.class.php

示例14: _displayBinaryAsPrintable

 /**
  * Display binary fields as hex string for PHP <5.4, 
  * otherwise escape the contents if it may be displayed as hex
  *
  * @param string $content         String to parse
  * @param string $binary_or_blob  'binary' or 'blob'
  * @param int    $hexlength       optional, get substring
  *
  * @return Displayable version of the binary string
  *
  * @access private
  *
  * @see    _getDataCellForGeometryColumns
  *         _getDataCellForNonNumericAndNonBlobColumns
  *         _handleNonPrintableContents
  */
 private function _displayBinaryAsPrintable($content, $binary_or_blob, $hexlength = null)
 {
     if (PMA_PHP_INT_VERSION < 50400 || $binary_or_blob === 'binary' && $_SESSION['tmp_user_values']['display_binary_as_hex'] && PMA_Util::containsNonPrintableAscii($content)) {
         $content = bin2hex($content);
         if ($hexlength !== null) {
             $content = PMA_substr($content, $hexlength);
         }
     } else {
         $content = htmlspecialchars(PMA_Util::replaceBinaryContents($content), ENT_SUBSTITUTE);
     }
     return $content;
 }
开发者ID:dennisblokland,项目名称:MyReddit,代码行数:28,代码来源:DisplayResults.class.php

示例15: PMA_STR_charIsEscaped

/**
 * Checks if a given character position in the string is escaped or not
 *
 * @param   string   string to check for
 * @param   integer  the character to check for
 * @param   integer  starting position in the string
 *
 * @return  boolean  whether the character is escaped or not
 */
function PMA_STR_charIsEscaped($string, $pos, $start = 0)
{
    $len = PMA_strlen($string);
    // Base case:
    // Check for string length or invalid input or special case of input
    // (pos == $start)
    if ($pos == $start || $len <= $pos) {
        return FALSE;
    }
    $p = $pos - 1;
    $escaped = FALSE;
    while ($p >= $start && PMA_substr($string, $p, 1) == '\\') {
        $escaped = !$escaped;
        $p--;
    }
    // end while
    if ($pos < $start) {
        // throw error about strings
    }
    return $escaped;
}
开发者ID:tmhaoge,项目名称:moped,代码行数:30,代码来源:string.lib.php


注:本文中的PMA_substr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。