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


PHP PMA_Transformation_getOptions函数代码示例

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


在下文中一共展示了PMA_Transformation_getOptions函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
     );
 }
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:17,代码来源:PMA_transformation_test.php

示例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
//.........这里部分代码省略.........
开发者ID:nkeat12,项目名称:dv,代码行数:101,代码来源:DisplayResults.class.php

示例3: _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
  * @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 ($currentColumn = 0; $currentColumn < $this->__get('fields_cnt'); ++$currentColumn) {
         // assign $i with appropriate column order
         $i = $col_order ? $col_order[$currentColumn] : $currentColumn;
         $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[$currentColumn] && $_SESSION['tmpval']['disp_direction'] != self::DISP_DIR_VERTICAL ? 'hide' : '';
         // 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_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[PMA_Util::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_URL_getCommon($_url_params);
         $vertical_display = $this->__get('vertical_display');
         // Check whether the field needs to display with syntax highlighting
         if (!empty($this->transformation_info[strtolower($this->__get('db'))][strtolower($this->__get('table'))][strtolower($meta->name)]) && trim($row[$i]) != '') {
             $row[$i] = PMA_Util::formatSql($row[$i]);
             include_once $this->transformation_info[strtolower($this->__get('db'))][strtolower($this->__get('table'))][strtolower($meta->name)][0];
             $transformation_plugin = new $this->transformation_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->transformation_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']) && !empty($GLOBALS['special_schema_links'][strtolower($this->__get('db'))][strtolower($this->__get('table'))][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
             $vertical_display['data'][$row_no][$i] = $this->_getDataCellForNumericColumns($row[$i], $class, $condition_field, $meta, $map, $is_field_truncated, $analyzed_sql, $transformation_plugin, $default_function, $transform_options);
         } elseif (stristr($meta->type, self::BLOB_FIELD)) {
             //  b l o b
//.........这里部分代码省略.........
开发者ID:BIGGANI,项目名称:zpanelx,代码行数:101,代码来源:DisplayResults.class.php

示例4: 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;
}
开发者ID:hewenhao2008,项目名称:phpmyadmin,代码行数:101,代码来源:insert_edit.lib.php

示例5: PMA_File

 // 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();
 }
 // delete $file_to_insert temporary variable
 $file_to_insert->cleanUp();
开发者ID:altesien,项目名称:FinalProject,代码行数:31,代码来源:tbl_replace.php

示例6: 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 string $file           file containing the transformation plugin
 * @param string $column_name    column name
 * @param array  $extra_data     extra data array
 *
 * @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_URL_getCommon($_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, '');
        }
    }
    // end of loop for each transformation cell
    return $extra_data;
}
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:35,代码来源:insert_edit.lib.php

示例7: PMA_getMime

if (isset($where_clause)) {
    $result = $GLOBALS['dbi']->query('SELECT * FROM ' . PMA\libraries\Util::backquote($table) . ' WHERE ' . $where_clause . ';', null, PMA\libraries\DatabaseInterface::QUERY_STORE);
    $row = $GLOBALS['dbi']->fetchAssoc($result);
} else {
    $result = $GLOBALS['dbi']->query('SELECT * FROM ' . PMA\libraries\Util::backquote($table) . ' LIMIT 1;', null, PMA\libraries\DatabaseInterface::QUERY_STORE);
    $row = $GLOBALS['dbi']->fetchAssoc($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;
        }
    }
}
// Only output the http headers
$response = PMA\libraries\Response::getInstance();
$response->getHeader()->sendHttpHeaders();
// [MIME]
if (isset($ct) && !empty($ct)) {
    $mime_type = $ct;
} else {
    $mime_type = (!empty($mime_map[$transform_key]['mimetype']) ? str_replace('_', '/', $mime_map[$transform_key]['mimetype']) : $default_ct) . (isset($mime_options['charset']) ? $mime_options['charset'] : '');
}
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:31,代码来源:transformation_wrapper.php


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