On Sat, Mar 24, 2012 at 6:20 PM, Alex Marin <alex.ukf@gmail.com> wrote:
Hello,
   
I find these refactoring guidelines useful for everyone, so I'll have a go:

    $start = 0;
    if ( strlen( $type ) > $GLOBALS['cfg']['LimitChars'] ) {
        $start = 13; // strlen( '<abbr title="' );
        $type = '<abbr title="' . $type . '">'
                  . substr( $type, 0, $GLOBALS['cfg']['LimitChars'] )
                  . '</abbr>';
    }

    unset( $field_charset );
    $matches_type = ( substr($type, $start, 4)   == 'char'
                              || substr($type, $start, 7)   == 'varchar'
                              || substr($type, $start, 4)   == 'text'
                              || substr($type, $start, 8)   == 'tinytext'
                              || substr($type, $start, 10) == 'mediumtext'
                              || substr($type, $start, 8)   == 'longtext'
                              || substr($type, $start, 3)   == 'set'
                              || substr($type, $start, 4)   == 'enum'
    );
    $field_charset = '';
    if ( $matches_type && ! $extracted_fieldspec['binary'] ) {
        if ( strpos( $type, ' character set ' ) ) {
            $type = substr( $type, 0, strpos( $type, ' character set ' ) );
        }
        if ( ! empty( $row['Collation'] ) ) {
            $field_charset = $row['Collation'];
        }
    }


These are some refactoring modifications I would see fit, but I am sure
there are others, so I would like to see different approaches.

--
Alex

Without the 3 unnecessary newlines of course ( that were inserted
before my copy-pasted sections).

--
Alex