本文整理汇总了PHP中PMA_getTransformationClassName函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getTransformationClassName函数的具体用法?PHP PMA_getTransformationClassName怎么用?PHP PMA_getTransformationClassName使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_getTransformationClassName函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_getHtmlForInsertEditFormColumn
//.........这里部分代码省略.........
$extracted_columnspec = PMA_Util::extractColumnSpec($column['Type']);
if (-1 === $column['len']) {
$column['len'] = $GLOBALS['dbi']->fieldLen($current_result, $column_number);
// length is unknown for geometry fields,
// make enough space to edit very simple WKTs
if (-1 === $column['len']) {
$column['len'] = 30;
}
}
//Call validation when the form submitted...
$onChangeClause = $chg_evt_handler . "=\"return verificationsAfterFieldChange('" . PMA_escapeJsString($column['Field_md5']) . "', '" . PMA_escapeJsString($jsvkey) . "','" . $column['pma_type'] . "')\"";
// Use an MD5 as an array index to avoid having special characters
// in the name attribute (see bug #1746964 )
$column_name_appendix = $vkey . '[' . $column['Field_md5'] . ']';
if ($column['Type'] === 'datetime' && !isset($column['Default']) && !is_null($column['Default']) && $insert_mode) {
$column['Default'] = date('Y-m-d H:i:s', time());
}
$html_output = PMA_getHtmlForFunctionOption($odd_row, $column, $column_name_appendix);
if ($GLOBALS['cfg']['ShowFieldTypesInDataEditView']) {
$html_output .= PMA_getHtmlForInsertEditColumnType($column);
}
//End if
// Get a list of GIS data types.
$gis_data_types = PMA_Util::getGISDatatypes();
// Prepares the field value
$real_null_value = false;
$special_chars_encoded = '';
if (!empty($current_row)) {
// (we are editing)
list($real_null_value, $special_chars_encoded, $special_chars, $data, $backup_field) = PMA_getSpecialCharsAndBackupFieldForExistingRow($current_row, $column, $extracted_columnspec, $real_null_value, $gis_data_types, $column_name_appendix, $as_is);
} else {
// (we are inserting)
// display default values
$tmp = $column;
if (isset($repopulate[$column['Field_md5']])) {
$tmp['Default'] = $repopulate[$column['Field_md5']];
}
list($real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded) = PMA_getSpecialCharsAndBackupFieldForInsertingMode($tmp, $real_null_value);
unset($tmp);
}
$idindex = $o_rows * $columns_cnt + $column_number + 1;
$tabindex = $idindex;
// Get a list of data types that are not yet supported.
$no_support_types = PMA_Util::unsupportedDatatypes();
// The function column
// -------------------
if ($GLOBALS['cfg']['ShowFunctionFields']) {
$html_output .= PMA_getFunctionColumn($column, $is_upload, $column_name_appendix, $onChangeClause, $no_support_types, $tabindex_for_function, $tabindex, $idindex, $insert_mode);
}
// The null column
// ---------------
$foreignData = PMA_getForeignData($foreigners, $column['Field'], false, '', '');
$html_output .= PMA_getNullColumn($column, $column_name_appendix, $real_null_value, $tabindex, $tabindex_for_null, $idindex, $vkey, $foreigners, $foreignData);
// The value column (depends on type)
// ----------------
// See bug #1667887 for the reason why we don't use the maxlength
// HTML attribute
//add data attributes "no of decimals" and "data type"
$no_decimals = 0;
$type = current(explode("(", $column['pma_type']));
if (preg_match('/\\(([^()]+)\\)/', $column['pma_type'], $match)) {
$match[0] = trim($match[0], '()');
$no_decimals = $match[0];
}
$html_output .= '<td' . ' data-type="' . $type . '"' . ' data-decimals="' . $no_decimals . '">' . "\n";
// Will be used by js/tbl_change.js to set the default value
// for the "Continue insertion" feature
$html_output .= '<span class="default_value hide">' . $special_chars . '</span>';
// Check input transformation of column
$transformed_html = '';
if (!empty($column_mime['input_transformation'])) {
$file = $column_mime['input_transformation'];
$include_file = 'libraries/plugins/transformations/' . $file;
if (is_file($include_file)) {
include_once $include_file;
$class_name = PMA_getTransformationClassName($file);
$transformation_plugin = new $class_name();
$transformation_options = PMA_Transformation_getOptions($column_mime['input_transformation_options']);
$_url_params = array('db' => $db, 'table' => $table, 'transform_key' => $column['Field'], 'where_clause' => $where_clause);
$transformation_options['wrapper_link'] = PMA_URL_getCommon($_url_params);
$current_value = '';
if (isset($current_row[$column['Field']])) {
$current_value = $current_row[$column['Field']];
}
if (method_exists($transformation_plugin, 'getInputHtml')) {
$transformed_html = $transformation_plugin->getInputHtml($column, $row_id, $column_name_appendix, $transformation_options, $current_value, $text_dir, $tabindex, $tabindex_for_value, $idindex);
}
if (method_exists($transformation_plugin, 'getScripts')) {
$GLOBALS['plugin_scripts'] = array_merge($GLOBALS['plugin_scripts'], $transformation_plugin->getScripts());
}
}
}
if (!empty($transformed_html)) {
$html_output .= $transformed_html;
} else {
$html_output .= PMA_getValueColumn($column, $backup_field, $column_name_appendix, $onChangeClause, $tabindex, $tabindex_for_value, $idindex, $data, $special_chars, $foreignData, $odd_row, array($table, $db), $row_id, $titles, $text_dir, $special_chars_encoded, $vkey, $is_upload, $biggest_max_file_size, $default_char_editing, $no_support_types, $gis_data_types, $extracted_columnspec);
}
$html_output .= '</td>' . '</tr>';
return $html_output;
}
示例2: _getRowValues
/**
* Get the values for one data row
*
* @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
*
* @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)
{
$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);
$uniqueConditionMap = array();
$columnCount = $this->__get('fields_cnt');
for ($currentColumn = 0; $currentColumn < $columnCount; ++$currentColumn) {
// assign $i with appropriate column order
$i = $col_order ? $col_order[$currentColumn] : $currentColumn;
$meta = $fields_meta[$i];
$orgFullColName = $this->__get('db') . '.' . $meta->orgtable . '.' . $meta->orgname;
$not_null_class = $meta->not_null ? 'not_null' : '';
$relation_class = isset($map[$meta->name]) ? 'relation' : '';
$hide_class = $col_visib && !$col_visib[$currentColumn] ? 'hide' : '';
$grid_edit = $meta->orgtable != '' ? $grid_edit_class : '';
// handle datetime-related class, for grid editing
$field_type_class = $this->_getClassForDateTimeRelatedFields($meta->type);
$is_field_truncated = false;
// combine all the classes applicable to this column's value
$class = $this->_getClassesForColumn($grid_edit, $not_null_class, $relation_class, $hide_class, $field_type_class);
// 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[PMA_Util::backquote($meta->name)])) ? true : false;
// Wrap MIME-transformations. [MIME]
$default_function = 'PMA_mimeDefaultFunction';
// default_function
$transformation_plugin = $default_function;
$transform_options = array();
if ($GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
if (isset($mime_map[$orgFullColName]['mimetype']) && !empty($mime_map[$orgFullColName]['transformation'])) {
$file = $mime_map[$orgFullColName]['transformation'];
$include_file = 'libraries/plugins/transformations/' . $file;
if (file_exists($include_file)) {
include_once $include_file;
$class_name = PMA_getTransformationClassName($file);
// todo add $plugin_manager
$plugin_manager = null;
$transformation_plugin = new $class_name($plugin_manager);
$transform_options = PMA_Transformation_getOptions(isset($mime_map[$orgFullColName]['transformation_options']) ? $mime_map[$orgFullColName]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $mime_map[$orgFullColName]['mimetype']);
}
// end if file_exists
}
// end if transformation is set
}
// end if mime/transformation works.
// Check whether the field needs to display with syntax highlighting
$dbLower = mb_strtolower($this->__get('db'));
$tblLower = mb_strtolower($meta->orgtable);
$nameLower = mb_strtolower($meta->orgname);
if (!empty($this->transformation_info[$dbLower][$tblLower][$nameLower]) && trim($row[$i]) != '' && !$_SESSION['tmpval']['hide_transformation']) {
include_once $this->transformation_info[$dbLower][$tblLower][$nameLower][0];
$transformation_plugin = new $this->transformation_info[$dbLower][$tblLower][$nameLower][1](null);
$transform_options = PMA_Transformation_getOptions(isset($mime_map[$orgFullColName]['transformation_options']) ? $mime_map[$orgFullColName]['transformation_options'] : '');
$meta->mimetype = str_replace('_', '/', $this->transformation_info[$dbLower][mb_strtolower($meta->orgtable)][mb_strtolower($meta->orgname)][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']) && !empty($GLOBALS['special_schema_links'][$dbLower][$tblLower][$nameLower])) {
$linking_url = $this->_getSpecialLinkUrl($row[$i], $row_info, mb_strtolower($meta->orgname));
include_once "libraries/plugins/transformations/Text_Plain_Link.class.php";
$transformation_plugin = new Text_Plain_Link();
$transform_options = array(0 => $linking_url, 2 => true);
$meta->mimetype = str_replace('_', '/', 'Text/Plain');
}
$_url_params = array('db' => $this->__get('db'), 'table' => $this->__get('table'), 'where_clause' => $where_clause, 'transform_key' => $meta->name);
/*
* The result set can have columns from more than one table,
* this is why we have to check for the unique conditions
* related to this table; however getUniqueCondition() is
* costly and does not need to be called if we already know
//.........这里部分代码省略.........
示例3: foreach
foreach ($multi_edit_columns_name as $key => $column_name) {
$current_value = $multi_edit_columns[$key];
// Note: $key is an md5 of the fieldname. The actual fieldname is
// available in $multi_edit_columns_name[$key]
$file_to_insert = new PMA_File();
$file_to_insert->checkTblChangeForm($key, $rownumber);
$possibly_uploaded_val = $file_to_insert->getContent();
if ($possibly_uploaded_val !== false) {
$current_value = $possibly_uploaded_val;
}
// Apply Input Transformation if defined
if (!empty($mime_map[$column_name]) && !empty($mime_map[$column_name]['input_transformation'])) {
$filename = 'libraries/plugins/transformations/' . $mime_map[$column_name]['input_transformation'];
if (is_file($filename)) {
include_once $filename;
$classname = PMA_getTransformationClassName($mime_map[$column_name]['input_transformation']);
/** @var IOTransformationsPlugin $transformation_plugin */
$transformation_plugin = new $classname();
$transformation_options = PMA_Transformation_getOptions($mime_map[$column_name]['input_transformation_options']);
$current_value = $transformation_plugin->applyTransformation($current_value, $transformation_options);
// check if transformation was successful or not
// and accordingly set error messages & insert_fail
if (method_exists($transformation_plugin, 'isSuccess') && !$transformation_plugin->isSuccess()) {
$insert_fail = true;
$row_skipped = true;
$insert_errors[] = sprintf(__('Row: %1$s, Column: %2$s, Error: %3$s'), $rownumber, $column_name, $transformation_plugin->getError());
}
}
}
if ($file_to_insert->isError()) {
$message .= $file_to_insert->getError();
示例4: PMA_getTransformationName
/**
* Returns the name of the transformation
*
* @param string $file transformation file
*
* @return String the name of the transformation
*/
function PMA_getTransformationName($file)
{
$include_file = 'libraries/plugins/transformations/' . $file;
/* @var $class_name PMA\libraries\plugins\TransformationsInterface */
$class_name = PMA_getTransformationClassName($include_file);
// include and instantiate the class
include_once $include_file;
return $class_name::getName();
}
示例5: PMA_getTransformationDescription
/**
* Returns the description of the transformation
*
* @param string $file transformation file
* @param boolean $html_formatted whether the description should be formatted
* as HTML
*
* @return String the description of the transformation
*/
function PMA_getTransformationDescription($file, $html_formatted = true)
{
$class_name = PMA_getTransformationClassName($file);
// include and instantiate the class
include_once 'libraries/plugins/transformations/' . $file;
return $class_name::getInfo();
}
示例6: foreach
foreach ($multi_edit_columns_name as $key => $column_name) {
$current_value = $multi_edit_columns[$key];
// Note: $key is an md5 of the fieldname. The actual fieldname is
// available in $multi_edit_columns_name[$key]
$file_to_insert = new PMA\libraries\File();
$file_to_insert->checkTblChangeForm($key, $rownumber);
$possibly_uploaded_val = $file_to_insert->getContent();
if ($possibly_uploaded_val !== false) {
$current_value = $possibly_uploaded_val;
}
// Apply Input Transformation if defined
if (!empty($mime_map[$column_name]) && !empty($mime_map[$column_name]['input_transformation'])) {
$filename = 'libraries/plugins/transformations/' . $mime_map[$column_name]['input_transformation'];
if (is_file($filename)) {
include_once $filename;
$classname = PMA_getTransformationClassName($filename);
/** @var IOTransformationsPlugin $transformation_plugin */
$transformation_plugin = new $classname();
$transformation_options = PMA_Transformation_getOptions($mime_map[$column_name]['input_transformation_options']);
$current_value = $transformation_plugin->applyTransformation($current_value, $transformation_options);
// check if transformation was successful or not
// and accordingly set error messages & insert_fail
if (method_exists($transformation_plugin, 'isSuccess') && !$transformation_plugin->isSuccess()) {
$insert_fail = true;
$row_skipped = true;
$insert_errors[] = sprintf(__('Row: %1$s, Column: %2$s, Error: %3$s'), $rownumber, $column_name, $transformation_plugin->getError());
}
}
}
if ($file_to_insert->isError()) {
$insert_errors[] = $file_to_insert->getError();
示例7: PMA_getTransformationName
/**
* Returns the name of the transformation
*
* @param string $file transformation file
*
* @return String the name of the transformation
*/
function PMA_getTransformationName($file)
{
/* @var $class_name TransformationsInterface */
$class_name = PMA_getTransformationClassName($file);
// include and instantiate the class
include_once $file;
return $class_name::getName();
}