本文整理汇总了PHP中PMA_transformation_getOptions函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_transformation_getOptions函数的具体用法?PHP PMA_transformation_getOptions怎么用?PHP PMA_transformation_getOptions使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_transformation_getOptions函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetOptions
/**
* Test for parsing options.
*
* @param string $input String to parse
* @param array $expected Expected result
*
* @return void
*
* @dataProvider getOptionsData
*/
public function testGetOptions($input, $expected)
{
$this->assertEquals(
$expected,
PMA_transformation_getOptions($input)
);
}
示例2: testEmpty
public function testEmpty()
{
$this->assertEquals(
array(),
PMA_transformation_getOptions('')
);
}
示例3: PMA_displayTableBody
//.........这里部分代码省略.........
$pointer = function_exists('is_null') ? $i : $meta->name;
// garvin: See if this column should get highlight because it's used in the
// where-query.
if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
$condition_field = true;
} else {
$condition_field = false;
}
$mouse_events = '';
if ($disp_direction == 'vertical' && (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1')) {
if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
$mouse_events .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');" ';
}
if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
$mouse_events .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'odd\', \'even\', \'hover\', \'marked\'); setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
} else {
$mouse_events .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
}
}
// end if
// garvin: Wrap MIME-transformations. [MIME]
$default_function = 'default_function';
// default_function
$transform_function = $default_function;
$transform_options = array();
if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
$include_file = PMA_sanitizeTransformationFile($GLOBALS['mime_map'][$meta->name]['transformation']);
if (file_exists('./libraries/transformations/' . $include_file)) {
$transformfunction_name = preg_replace('@(\\.inc\\.php3?)$@i', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
require_once './libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions(isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
}
}
// end if file_exists
}
// end if transformation is set
}
// end if mime/transformation works.
$transform_options['wrapper_link'] = '?' . (isset($url_query) ? $url_query : '') . '&primary_key=' . (isset($uva_condition) ? $uva_condition : '') . '&sql_query=' . (isset($sql_query) ? urlencode($url_sql_query) : '') . '&goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '') . '&transform_key=' . urlencode($meta->name);
// n u m e r i c
if ($meta->numeric == 1) {
// lem9: if two fields have the same name (this is possible
// with self-join queries, for example), using $meta->name
// will show both fields NULL even if only one is NULL,
// so use the $pointer
// (works only if function_exists('is_null')
// PS: why not always work with the number ($i), since
// the default second parameter of
// mysql_fetch_array() is MYSQL_BOTH, so we always get
// associative and numeric indices?
//if (!isset($row[$meta->name])
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
} elseif ($row[$i] != '') {
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . ' nowrap">';
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
foreach ($analyzed_sql[0]['select_expr'] as $select_expr_position => $select_expr) {
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
if (isset($alias) && strlen($alias)) {
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
if ($alias == $meta->name) {
$meta->name = $true_column;
示例4: PMA_displayTableBody
//.........这里部分代码省略.........
$pointer = $i;
// garvin: See if this column should get highlight because it's used in the
// where-query.
if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
$condition_field = true;
} else {
$condition_field = false;
}
$mouse_events = '';
if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical' && (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1')) {
if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
$mouse_events .= ' onmouseover="setVerticalPointer(this, ' . $row_no . ', \'over\', \'odd\', \'even\', \'hover\', \'marked\');"' . ' onmouseout="setVerticalPointer(this, ' . $row_no . ', \'out\', \'odd\', \'even\', \'hover\', \'marked\');" ';
}
if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
$mouse_events .= ' onmousedown="setVerticalPointer(this, ' . $row_no . ', \'click\', \'odd\', \'even\', \'hover\', \'marked\'); setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
} else {
$mouse_events .= ' onmousedown="setCheckboxColumn(\'id_rows_to_delete' . $row_no . '\');" ';
}
}
// end if
// garvin: Wrap MIME-transformations. [MIME]
$default_function = 'default_function';
// default_function
$transform_function = $default_function;
$transform_options = array();
if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
$include_file = $GLOBALS['mime_map'][$meta->name]['transformation'];
if (file_exists('./libraries/transformations/' . $include_file)) {
$transformfunction_name = str_replace('.inc.php', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
require_once './libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions(isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
}
}
// end if file_exists
}
// end if transformation is set
}
// end if mime/transformation works.
$_url_params = array('db' => $db, 'table' => $table, 'where_clause' => $where_clause, 'transform_key' => $meta->name);
if (!empty($sql_query)) {
$_url_params['sql_query'] = $url_sql_query;
}
$transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
// n u m e r i c
if ($meta->numeric == 1) {
// lem9: if two fields have the same name (this is possible
// with self-join queries, for example), using $meta->name
// will show both fields NULL even if only one is NULL,
// so use the $pointer
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
} elseif ($row[$i] != '') {
$nowrap = ' nowrap';
$where_comparison = ' = ' . $row[$i];
$vertical_display['data'][$row_no][$i] = '<td align="right"' . PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options);
} else {
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ' nowrap' . ($condition_field ? ' condition' : '') . '"> </td>' . "\n";
}
// b l o b
} elseif (stristr($meta->type, 'BLOB')) {
// loic1 : PMA_mysql_fetch_fields returns BLOB in place of
// TEXT fields type so we have to ensure it's really a BLOB
示例5: PMA_DBI_query
if (isset($primary_key)) {
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';', null, PMA_DBI_QUERY_STORE);
$row = PMA_DBI_fetch_assoc($result);
} else {
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE);
$row = PMA_DBI_fetch_assoc($result);
}
// No row returned
if (!$row) {
exit;
}
// end if (no record returned)
$default_ct = 'application/octet-stream';
if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
$mime_map = PMA_getMime($db, $table);
$mime_options = PMA_transformation_getOptions(isset($mime_map[urldecode($transform_key)]['transformation_options']) ? $mime_map[urldecode($transform_key)]['transformation_options'] : '');
foreach ($mime_options as $key => $option) {
if (substr($option, 0, 10) == '; charset=') {
$mime_options['charset'] = $option;
}
}
}
// garvin: For re-usability, moved http-headers and stylesheets
// to a seperate file. It can now be included by libs/header.inc.php,
// querywindow.php.
require_once './libs/header_http.inc.php';
// [MIME]
if (isset($ct) && !empty($ct)) {
$content_type = 'Content-Type: ' . urldecode($ct);
} else {
$content_type = 'Content-Type: ' . (isset($mime_map[urldecode($transform_key)]['mimetype']) ? str_replace('_', '/', $mime_map[urldecode($transform_key)]['mimetype']) : $default_ct) . (isset($mime_options['charset']) ? $mime_options['charset'] : '');
示例6: PMA_displayTableBody
//.........这里部分代码省略.........
// to $inline_edit_class
$class = 'data ' . $inline_edit_class . ' ' . $not_null_class . ' ' . $alternating_color_class . ' ' . $relation_class;
// See if this column should get highlight because it's used in the
// where-query.
if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
$condition_field = true;
} else {
$condition_field = false;
}
if ($_SESSION['tmp_user_values']['disp_direction'] == 'vertical' && (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1')) {
// the row number corresponds to a data row, not HTML table row
$class .= ' row_' . $row_no;
if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) {
$class .= ' vpointer';
}
if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) {
$class .= ' vmarker';
}
}
// end if
// Wrap MIME-transformations. [MIME]
$default_function = 'default_function';
// default_function
$transform_function = $default_function;
$transform_options = array();
if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
$include_file = PMA_securePath($GLOBALS['mime_map'][$meta->name]['transformation']);
if (file_exists('./libraries/transformations/' . $include_file)) {
$transformfunction_name = str_replace('.inc.php', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
require_once './libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions(isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
}
}
// end if file_exists
}
// end if transformation is set
}
// end if mime/transformation works.
$_url_params = array('db' => $db, 'table' => $table, 'where_clause' => $where_clause, 'transform_key' => $meta->name);
if (!empty($sql_query)) {
$_url_params['sql_query'] = $url_sql_query;
}
$transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
// n u m e r i c
if ($meta->numeric == 1) {
// if two fields have the same name (this is possible
// with self-join queries, for example), using $meta->name
// will show both fields NULL even if only one is NULL,
// so use the $pointer
if (!isset($row[$i]) || is_null($row[$i])) {
$vertical_display['data'][$row_no][$i] = PMA_buildNullDisplay($class, $condition_field, $meta, 'align="right"');
} elseif ($row[$i] != '') {
$nowrap = ' nowrap';
$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
示例7: PMA_DBI_fetch_assoc
PMA_DBI_QUERY_STORE
);
$row = PMA_DBI_fetch_assoc($result);
}
// No row returned
if (!$row) {
exit;
} // end if (no record returned)
$default_ct = 'application/octet-stream';
if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
$mime_map = PMA_getMime($db, $table);
$mime_options = PMA_transformation_getOptions(
isset($mime_map[$transform_key]['transformation_options'])
? $mime_map[$transform_key]['transformation_options'] : ''
);
foreach ($mime_options AS $key => $option) {
if (substr($option, 0, 10) == '; charset=') {
$mime_options['charset'] = $option;
}
}
}
// For re-usability, moved http-headers and stylesheets
// to a seperate file. It can now be included by libraries/header.inc.php,
// querywindow.php.
require_once './libraries/header_http.inc.php';
// [MIME]
示例8: array
}
$edited_values = array();
parse_str($_REQUEST['transform_fields_list'], $edited_values);
foreach ($mime_map as $transformation) {
$include_file = PMA_securePath($transformation['transformation']);
$column_name = $transformation['column_name'];
foreach ($edited_values as $cell_index => $curr_cell_edited_values) {
if (isset($curr_cell_edited_values[$column_name])) {
$column_data = $curr_cell_edited_values[$column_name];
$_url_params = array('db' => $db, 'table' => $table, 'where_clause' => $_REQUEST['where_clause'], 'transform_key' => $column_name);
if (file_exists('./libraries/transformations/' . $include_file)) {
$transformfunction_name = str_replace('.inc.php', '', $transformation['transformation']);
include_once './libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions(isset($transformation['transformation_options']) ? $transformation['transformation_options'] : '');
$transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
}
}
$extra_data['transformations'][$cell_index] = $transform_function($column_data, $transform_options);
}
}
// end of loop for each transformation cell
}
// end of loop for each $mime_map
}
/**Get the total row count of the table*/
$extra_data['row_count'] = PMA_Table::countRecords($_REQUEST['db'], $_REQUEST['table']);
$extra_data['sql_query'] = PMA_showMessage($message, $GLOBALS['display_query']);
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}
示例9: PMA_transformEditedValues
/**
* Transform edited values
*
* @param string $db db name
* @param string $table table name
* @param array $transformation mimetypes for all columns of a table
* [field_name][field_key]
* @param array $edited_values transform columns list and new values
* @param array $extra_data extra data array
* @param string $file file containing the transformation plugin
*
* @return array $extra_data
*/
function PMA_transformEditedValues($db, $table, $transformation, $edited_values, $file, $column_name, $extra_data)
{
foreach ($edited_values as $cell_index => $curr_cell_edited_values) {
if (isset($curr_cell_edited_values[$column_name])) {
$column_data = $curr_cell_edited_values[$column_name];
$_url_params = array('db' => $db, 'table' => $table, 'where_clause' => $_REQUEST['where_clause'], 'transform_key' => $column_name);
$include_file = 'libraries/plugins/transformations/' . $file;
if (file_exists($include_file)) {
include_once $include_file;
$transform_options = PMA_transformation_getOptions(isset($transformation['transformation_options']) ? $transformation['transformation_options'] : '');
$transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
$class_name = str_replace('.class.php', '', $file);
$plugin_manager = null;
$transformation_plugin = new $class_name($plugin_manager);
}
$extra_data['transformations'][$cell_index] = $transformation_plugin->applyTransformation($column_data, $transform_options, $meta = '');
}
}
// end of loop for each transformation cell
return $extra_data;
}
示例10: _getRowValues
/**
* Prepare rows
*
* @param integer &$dt_result the link id associated to the query
* which results have to be displayed
* @param array $row current row data
* @param integer $row_no the index of current row
* @param array $col_order the column order
* false when a property not found
* @param array $map the list of relations
* @param string $grid_edit_class the class for all editable columns
* @param boolean $col_visib column is visible(false)
* array column isn't visible(string array)
* @param string $where_clause where clause
* @param string $url_sql_query the analyzed sql query
* @param array $analyzed_sql the analyzed query
* @param boolean $directionCondition the directional condition
*
* @return string $row_values_html html content
*
* @access private
*
* @see _getTableBody()
*/
private function _getRowValues(&$dt_result, $row, $row_no, $col_order, $map, $grid_edit_class, $col_visib, $where_clause, $url_sql_query, $analyzed_sql, $directionCondition)
{
$row_values_html = '';
// Following variable are needed for use in isset/empty or
// use with array indexes/safe use in foreach
$sql_query = $this->__get('_sql_query');
$fields_meta = $this->__get('_fields_meta');
$highlight_columns = $this->__get('_highlight_columns');
$mime_map = $this->__get('_mime_map');
$row_info = $this->_getRowInfoForSpecialLinks($row, $col_order);
for ($j = 0; $j < $this->__get('_fields_cnt'); ++$j) {
// assign $i with appropriate column order
$i = $col_order ? $col_order[$j] : $j;
$meta = $fields_meta[$i];
$not_null_class = $meta->not_null ? 'not_null' : '';
$relation_class = isset($map[$meta->name]) ? 'relation' : '';
$hide_class = $col_visib && !$col_visib[$j] && $_SESSION['tmp_user_values']['disp_direction'] != self::DISP_DIR_VERTICAL ? 'hide' : '';
// handle datetime-related class, for grid editing
$field_type_class = $this->_getClassForDateTimeRelatedFields($meta->type);
$pointer = $i;
$is_field_truncated = false;
//If the previous column had blob data, we need to reset the class
// to $inline_edit_class
$class = $this->_getResettedClassForInlineEdit($grid_edit_class, $not_null_class, $relation_class, $hide_class, $field_type_class, $row_no);
// See if this column should get highlight because it's used in the
// where-query.
$condition_field = isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[$this->getCommonFunctions()->backquote($meta->name)])) ? true : false;
// Wrap MIME-transformations. [MIME]
$default_function = '_mimeDefaultFunction';
// default_function
$transformation_plugin = $default_function;
$transform_options = array();
if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
if (isset($mime_map[$meta->name]['mimetype']) && isset($mime_map[$meta->name]['transformation']) && !empty($mime_map[$meta->name]['transformation'])) {
$file = $mime_map[$meta->name]['transformation'];
$include_file = 'libraries/plugins/transformations/' . $file;
if (file_exists($include_file)) {
include_once $include_file;
$class_name = str_replace('.class.php', '', $file);
// todo add $plugin_manager
$plugin_manager = null;
$transformation_plugin = new $class_name($plugin_manager);
$transform_options = PMA_transformation_getOptions(isset($mime_map[$meta->name]['transformation_options']) ? $mime_map[$meta->name]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $mime_map[$meta->name]['mimetype']);
}
// end if file_exists
}
// end if transformation is set
}
// end if mime/transformation works.
$_url_params = array('db' => $this->__get('_db'), 'table' => $this->__get('_table'), 'where_clause' => $where_clause, 'transform_key' => $meta->name);
if (!empty($sql_query)) {
$_url_params['sql_query'] = $url_sql_query;
}
$transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
$vertical_display = $this->__get('_vertical_display');
// Check whether the field needs to display with syntax highlighting
if ($this->_isNeedToSytaxHighlight($meta->name) && trim($row[$i]) != '') {
$parsed_sql = PMA_SQP_parse($row[$i]);
$row[$i] = PMA_CommonFunctions::getInstance()->formatSql($parsed_sql, $row[$i]);
include_once $this->sytax_highlighting_column_info[strtolower($this->__get('_db'))][strtolower($this->__get('_table'))][strtolower($meta->name)][0];
$transformation_plugin = new $this->sytax_highlighting_column_info[strtolower($this->__get('_db'))][strtolower($this->__get('_table'))][strtolower($meta->name)][1](null);
$transform_options = PMA_transformation_getOptions(isset($mime_map[$meta->name]['transformation_options']) ? $mime_map[$meta->name]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $this->sytax_highlighting_column_info[strtolower($this->__get('_db'))][strtolower($this->__get('_table'))][strtolower($meta->name)][2]);
}
// Check for the predefined fields need to show as link in schemas
include_once 'libraries/special_schema_links.lib.php';
if (isset($GLOBALS['special_schema_links']) && $this->_isFieldNeedToLink(strtolower($meta->name))) {
$linking_url = $this->_getSpecialLinkUrl($row[$i], $row_info, strtolower($meta->name));
include_once "libraries/plugins/transformations/Text_Plain_Link.class.php";
$transformation_plugin = new Text_Plain_Link(null);
$transform_options = array(0 => $linking_url, 2 => true);
$meta->mimetype = str_replace('_', '/', 'Text/Plain');
}
if ($meta->numeric == 1) {
// n u m e r i c
//.........这里部分代码省略.........
示例11: PMA_displayTableBody
//.........这里部分代码省略.........
require './libraries/display_tbl_links.lib.php';
}
// end if (1.3)
echo $disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped' ? "\n" : '';
}
// end if (1)
// 2. Displays the rows' values
for ($i = 0; $i < $fields_cnt; ++$i) {
$meta = $fields_meta[$i];
// loic1: To fix bug #474943 under php4, the row pointer will
// depend on whether the "is_null" php4 function is
// available or not
$pointer = function_exists('is_null') ? $i : $meta->name;
// garvin: See if this column should get highlight because it's used in the
// where-query.
if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
$column_style = 'style="border: 1px solid ' . $GLOBALS['cfg']['BrowseMarkerColor'] . '"';
} else {
$column_style = '';
}
// garvin: Wrap MIME-transformations. [MIME]
$default_function = 'default_function';
// default_function
$transform_function = $default_function;
$transform_options = array();
if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
if (isset($GLOBALS['mime_map'][$meta->name]['mimetype']) && isset($GLOBALS['mime_map'][$meta->name]['transformation']) && !empty($GLOBALS['mime_map'][$meta->name]['transformation'])) {
$include_file = PMA_sanitizeTransformationFile($GLOBALS['mime_map'][$meta->name]['transformation']);
if (file_exists('./libraries/transformations/' . $include_file)) {
$transformfunction_name = preg_replace('@(\\.inc\\.php3?)$@i', '', $GLOBALS['mime_map'][$meta->name]['transformation']);
require_once './libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions(isset($GLOBALS['mime_map'][$meta->name]['transformation_options']) ? $GLOBALS['mime_map'][$meta->name]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $GLOBALS['mime_map'][$meta->name]['mimetype']);
}
}
// end if file_exists
}
// end if transformation is set
}
// end if mime/transformation works.
$transform_options['wrapper_link'] = '?' . (isset($url_query) ? $url_query : '') . '&primary_key=' . (isset($uva_condition) ? $uva_condition : '') . '&sql_query=' . (isset($sql_query) ? urlencode($sql_query) : '') . '&goto=' . (isset($sql_goto) ? urlencode($lnk_goto) : '') . '&transform_key=' . urlencode($meta->name);
// n u m e r i c
if ($meta->numeric == 1) {
// lem9: if two fields have the same name (this is possible
// with self-join queries, for example), using $meta->name
// will show both fields NULL even if only one is NULL,
// so use the $pointer
// (works only if function_exists('is_null')
// PS: why not always work with the number ($i), since
// the default second parameter of
// mysql_fetch_array() is MYSQL_BOTH, so we always get
// associative and numeric indices?
//if (!isset($row[$meta->name])
if (!isset($row[$pointer]) || function_exists('is_null') && is_null($row[$pointer])) {
$vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '"><i>NULL</i></td>' . "\n";
} else {
if ($row[$pointer] != '') {
$vertical_display['data'][$row_no][$i] = ' <td align="right" valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '" nowrap="nowrap">';
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
foreach ($analyzed_sql[0]['select_expr'] as $select_expr_position => $select_expr) {
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
if (!empty($alias)) {
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
if ($alias == $meta->name) {
示例12: PMA_getTransformationFunctionAndTransformationOptions
/**
* Get transformation function and transformation options
*
* @param string $db db name
* @param string $table table name
* @param array $transformation mimetypes for all columns of a table
* [field_name][field_key]
* @param array $edited_values transform fields list
* @param array $extra_data extra data array
* @param string $include_file file containing the transformation plugin
*
* @return array $extra_data
*/
function PMA_getTransformationFunctionAndTransformationOptions($db, $table, $transformation, $edited_values, $extra_data, $include_file)
{
foreach ($edited_values as $cell_index => $curr_cell_edited_values) {
if (isset($curr_cell_edited_values[$column_name])) {
$column_data = $curr_cell_edited_values[$column_name];
$_url_params = array('db' => $db, 'table' => $table, 'where_clause' => $_REQUEST['where_clause'], 'transform_key' => $column_name);
if (file_exists('libraries/transformations/' . $include_file)) {
$transformfunction_name = str_replace('.inc.php', '', $transformation['transformation']);
include_once 'libraries/transformations/' . $include_file;
if (function_exists('PMA_transformation_' . $transformfunction_name)) {
$transform_function = 'PMA_transformation_' . $transformfunction_name;
$transform_options = PMA_transformation_getOptions(isset($transformation['transformation_options']) ? $transformation['transformation_options'] : '');
$transform_options['wrapper_link'] = PMA_generate_common_url($_url_params);
}
}
$extra_data['transformations'][$cell_index] = $transform_function($column_data, $transform_options);
}
}
// end of loop for each transformation cell
return $extra_data;
}