Class bbWP2UTF8

Description

bbWP2UTF8 is a class/plugin which strives to convert wordpress / wordpress mu database content in whatever character set to utf8

  • author: Bjorn Wijers
  • version: $Id$
  • copyright: Bjorn Wijers / VPRO Digitaal
  • license: GNU Public License

Located in /bbWP2UTF8.php (line 37)


	
			
Variable Summary
object reference $_wpdb
Method Summary
bbWP2UTF8 bbWP2UTF8 ()
string convertDatabase2UTF8 ([string $database_name = DB_NAME], [string $collation = 'utf8_general_ci'])
string convertTable2UTF8 (string $table_name, [string $collation = 'utf8_general_ci'])
boolean isColumnCharSetBinary (string $table_name, string $column_name, [string $database_name = DB_NAME])
boolean isWPMU ()
void showInterface ()
void _addToMenu ()
string _binarizeTableColumn ( $table_name,  $column)
string _createTablesList (array $tables, [boolean $useCheckboxes = TRUE])
string _deBinarizeTableColumn ( $table_name,  $column)
mixed _getAllTables ()
mixed _getColumnCharacterSet (string $table_name, string $column_name, [string $database_name = DB_NAME])
mixed _getTableCollation (string $table_name, [string $database_name = DB_NAME])
mixed _getTableColumns ( $table_name)
mixed _processColumnInfo (object column $column)
void _setupClassVars ()
void _setWPHooks ()
Variables
object reference $_wpdb (line 44)

reference to the wordpress wpdb database object

  • var: to wpdb
  • access: private
Methods
Constructor bbWP2UTF8 (line 55)

Constructor (backwards compatible with php4..) Calls the _setClassVars function to set the class variables and calls the _setWPHooks in order to set the appropriate hooks.

  • access: public
bbWP2UTF8 bbWP2UTF8 ()
convertDatabase2UTF8 (line 524)

Sets a database's character set to utf8

  • return: the performed query
  • access: public
string convertDatabase2UTF8 ([string $database_name = DB_NAME], [string $collation = 'utf8_general_ci'])
  • string $database_name: database name; Optional defaults to DB_NAME set in wp-config.php
  • string $collation: collation; Optional defaults to utf8_general_ci
convertTable2UTF8 (line 507)

Sets a table's character set to utf8

  • return: the performed query
  • access: public
string convertTable2UTF8 (string $table_name, [string $collation = 'utf8_general_ci'])
  • string $table_name: table name
  • string $collation: collation; Optional defaults to utf8_general_ci
isColumnCharSetBinary (line 488)

Check if a column's character set is binary or not (wraps _getColumnCharacterSet in it..)

  • return: FALSE when no info could be retrieved or character set is not binary. TRUE if character set is binary
  • access: public
boolean isColumnCharSetBinary (string $table_name, string $column_name, [string $database_name = DB_NAME])
  • string $table_name: table name
  • string $column_name: column name
  • string $database_name: database name; Optional, defaults to DB_NAME set in wp-config.php
isWPMU (line 551)

Checks if we're dealing with Wordpress MU or not by checking the existance of wpmu-settings.php

  • return: TRUE when its Wordpress MU or FALSE when not
  • access: public
boolean isWPMU ()
showCurrentDatabaseCharacterSet (line 537)

Retrieve the current database's character set

  • return: object with character set or boolean FALSE
  • access: public
mixed showCurrentDatabaseCharacterSet ()
showInterface (line 104)

Builds the interface and handles the different steps of the conversion.

Basically the core of this plugin Called by the add_submenu_page hook.

  • access: public
void showInterface ()
_addToMenu (line 89)

Sink function for the 'admin_menu' hook

Makes it easy to add optional pages as a sub-option of the top level menu items

  • access: private
void _addToMenu ()
_binarizeTableColumn (line 283)

Converts a given column's type of a given table to its binary counterpart according to the list below:

CHAR -> BINARY VARCHAR -> VARBINARY TINYTEXT -> TINYBLOB TEXT -> BLOB MEDIUMTEXT -> MEDIUMBLOB LONGTEXT -> LONGBLOB

Columns with the type ENUM and SET will be set to character set binary

  • return: performed query
  • access: private
string _binarizeTableColumn ( $table_name,  $column)
  • $table_name
  • $column
_createTablesList (line 219)

Creates a list with all available tables

  • return: html
  • todo: should remove collation function from this function and make part of _getAllTables
  • access: private
string _createTablesList (array $tables, [boolean $useCheckboxes = TRUE])
  • array $tables: tables
  • boolean $useCheckboxes: useCheckboxes default TRUE; switches checkboxes on/off
_deBinarizeTableColumn (line 362)

Converts a given column's binary type of a given table to its previous non-binary type according to the list below:

BINARY -> CHAR VARBINARY -> VARCHAR TINYBLOB -> TINYTEXT BLOB -> TEXT MEDIUMBLOB -> MEDIUMTEXT LONGBLOB -> LONGTEXT

Columns with the type ENUM and SET will be set to character set utf8

  • return: performed query
  • access: private
string _deBinarizeTableColumn ( $table_name,  $column)
  • $table_name
  • $column
_getAllTables (line 244)

Retrieves all tables from database defined by DB_NAME in wp-config.php

  • return: either an array with tables or a boolean FALSE
  • access: private
mixed _getAllTables ()
_getColumnCharacterSet (line 454)

Retrieves a column's character set

  • return: string character set or a boolean FALSE when no info could be retrieved
  • access: private
mixed _getColumnCharacterSet (string $table_name, string $column_name, [string $database_name = DB_NAME])
  • string $table_name: table name
  • string $column_name: column name
  • string $database_name: database name; Optional, defaults to DB_NAME set in wp-config.php
_getTableCollation (line 471)

Retrieves a table's collation

  • return: string collation type or a boolean FALSE when no info could be retrieved
  • access: private
mixed _getTableCollation (string $table_name, [string $database_name = DB_NAME])
  • string $table_name: table name
  • string $database_name: database name; Optional, defaults to DB_NAME set in wp-config.php
_getTableColumns (line 259)

Retrieves all columns from a given table

  • return: either an array with columns or a boolean FALSE
  • access: private
mixed _getTableColumns ( $table_name)
  • $table_name
_processColumnInfo (line 431)

Expects a column object and returns the column type and extra info in an array

  • return: int -1 when not using the appropriate parameter or an array with column data: $array[0] = column type such as vaechar, $array[1] = type size info such as 255 or a boolean FALSE when no info could be retrieved
  • access: private
mixed _processColumnInfo (object column $column)
  • object column $column
_setupClassVars (line 67)

Set the defaults for the class variables

  • access: private
void _setupClassVars ()
_setWPHooks (line 78)

Set the Wordpress specific filter and action hooks

  • access: private
void _setWPHooks ()

Documentation generated on Tue, 01 Jul 2008 16:28:16 +0200 by phpDocumentor 1.4.2