
ashley at svn
Nov 7, 2009, 10:19 AM
Post #1 of 1
(13 views)
Permalink
|
|
SVN: [58727] trunk/extensions/DataCenter
|
|
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/58727 Revision: 58727 Author: ashley Date: 2009-11-07 18:19:16 +0000 (Sat, 07 Nov 2009) Log Message: ----------- DataCenter: *coding style cleanup for remaining files *doxygen tweaks *added version number into $wgExtensionCredits Modified Paths: -------------- trunk/extensions/DataCenter/DataCenter.db.php trunk/extensions/DataCenter/DataCenter.js trunk/extensions/DataCenter/DataCenter.page.php trunk/extensions/DataCenter/DataCenter.php trunk/extensions/DataCenter/DataCenter.ui.php Modified: trunk/extensions/DataCenter/DataCenter.db.php =================================================================== --- trunk/extensions/DataCenter/DataCenter.db.php 2009-11-07 18:07:23 UTC (rev 58726) +++ trunk/extensions/DataCenter/DataCenter.db.php 2009-11-07 18:19:16 UTC (rev 58727) @@ -139,73 +139,58 @@ /** * Checks if type exists in any of the type categories - * @param category String of category to look up type in - * @param type String of type to check for + * @param $category String: category to look up type in + * @param $type String: type to check for */ - public static function isType( - $category, - $type - ) { + public static function isType( $category, $type ) { return isset( self::$types[$category][$type] ); } /** * Checks if type exists in the facility category - * @param type String of asset type to check for + * @param $type String: asset type to check for */ - public static function isFacilityType( - $type - ) { + public static function isFacilityType( $type ) { return isset( self::$types['facility'][$type] ); } /** * Checks if type exists in the link category - * @param type String of asset type to check for + * @param $type String: asset type to check for */ - public static function isLinkType( - $type - ) { + public static function isLinkType( $type ) { return isset( self::$types['link'][$type] ); } /** * Checks if type exists in the asset category - * @param type String of asset type to check for + * @param $type String: asset type to check for */ - public static function isAssetType( - $type - ) { + public static function isAssetType( $type ) { return isset( self::$types['asset'][$type] ); } /** * Checks if type exists in the model category - * @param type String of model type to check for + * @param $type String: model type to check for */ - public static function isModelType( - $type - ) { + public static function isModelType( $type ) { return isset( self::$types['model'][$type] ); } /** * Checks if type exists in the asset category - * @param type String of meta type to check for + * @param $type String: meta type to check for */ - public static function isMetaType( - $type - ) { + public static function isMetaType( $type ) { return isset( self::$types['meta'][$type] ); } /** * Checks if class is or is subclass of DataCenterDBRow - * @param rowClass String of name of class to check + * @param $rowClass String: name of class to check */ - public static function isRowClass( - $class - ) { + public static function isRowClass( $class ) { return ( class_exists( $class ) && ( @@ -217,15 +202,11 @@ /** * Checks if a column name belongs to a specific type - * @param category String of category to look up type in - * @param type String of type to check for - * @param columnName String of column to look up + * @param $category String: category to look up type in + * @param $type String: type to check for + * @param $columnName String: column to look up */ - public static function isColumnOfType( - $category, - $type, - $columnName - ) { + public static function isColumnOfType( $category, $type, $columnName ) { return ( strpos( $columnName, self::$types[$category][$type]['prefix'] ) !== false @@ -234,15 +215,11 @@ /** * Gets fully prefixed column name from simplified field name - * @param category String of category to look up type in - * @param type String of type to check for - * @param fieldName String of field to look up + * @param $category String: category to look up type in + * @param $type String: type to check for + * @param $fieldName String: field to look up */ - public static function getColumnName( - $category, - $type, - $fieldName - ) { + public static function getColumnName( $category, $type, $fieldName ) { return isset( self::$types[$category][$type] ) ? self::$types[$category][$type]['prefix'] . $fieldName : null; @@ -250,15 +227,11 @@ /** * Gets simplified field name from fully prefixed column name - * @param category String of category to look up type in - * @param type String of type to check for - * @param columnName String of column to look up + * @param $category String: category to look up type in + * @param $type String: type to check for + * @param $columnName String: column to look up */ - public static function getFieldName( - $category, - $type, - $columnName - ) { + public static function getFieldName( $category, $type, $columnName ) { return isset( self::$types[$category][$type]['prefix'] ) ? substr( $columnName, strlen( self::$types[$category][$type]['prefix'] ) @@ -268,13 +241,10 @@ /** * Gets table name from category and type - * @param category String of category to look up type in - * @param type String of type look up table in + * @param $category String: category to look up type in + * @param $type String: type look up table in */ - public static function getTableName( - $category, - $type - ) { + public static function getTableName( $category, $type ) { return isset( self::$types[$category][$type]['table'] ) ? self::$types[$category][$type]['table'] : null; @@ -282,13 +252,10 @@ /** * Gets row defaults from category and type - * @param category String of category to look up type in - * @param type String of type look up defaults in + * @param $category String: category to look up type in + * @param $type String: type look up defaults in */ - public static function getRowDefaults( - $category, - $type - ) { + public static function getRowDefaults( $category, $type ) { return isset( self::$types[$category][$type]['defaults'] ) ? self::$types[$category][$type]['defaults'] : array(); @@ -592,15 +559,11 @@ /** * Gets list of valid enum values for a specific field - * @param category String of category to look up type in - * @param type String of type to look up field in - * @param field String of field to look up values for + * @param $category String: category to look up type in + * @param $type String: type to look up field in + * @param $field String: field to look up values for */ - public static function getEnum( - $category, - $type, - $field - ){ + public static function getEnum( $category, $type, $field ) { if ( !self::isType( $category, $type ) ) { throw new MWException( $category . '/' . $type . ' is not a valid type' @@ -629,11 +592,9 @@ /** * Checks that a row object represents an existing row in the database - * @param object Subclass of DataCenterDBRow to check + * @param $object Object: subclass of DataCenterDBRow to check */ - public static function rowExists( - DataCenterDBRow $object - ) { + public static function rowExists( DataCenterDBRow $object ) { if ( !$object instanceof DataCenterDBRow ) { throw new MWException( 'Object is not an instance of DataCenterDBRow' @@ -658,11 +619,9 @@ /** * Inserts a row in the database based on the contents of a row object - * @param rowObject Subclass of DataCenterDBRow to insert + * @param $object Object: subclass of DataCenterDBRow to insert */ - public static function insertRow( - $object - ) { + public static function insertRow( $object ) { if ( !$object instanceof DataCenterDBRow ) { throw new MWException( 'Object is not an instance of DataCenterDBRow' @@ -689,11 +648,9 @@ /** * Updates a row in the database based on the contents of a row object - * @param object Subclass of DataCenterDBRow to update + * @param $object Object: Subclass of DataCenterDBRow to update */ - public static function updateRow( - $object - ) { + public static function updateRow( $object ) { if ( !$object instanceof DataCenterDBRow ) { throw new MWException( 'Object is not an instance of DataCenterDBRow' @@ -719,11 +676,9 @@ /** * Deletes a row from the database - * @param rowObject Subclass of DataCenterDBRow to delete + * @param $object Object: subclass of DataCenterDBRow to delete */ - public static function deleteRow( - $object - ) { + public static function deleteRow( $object ) { if ( !$object instanceof DataCenterDBRow ) { throw new MWException( 'Object is not an instance of DataCenterDBRow' @@ -754,10 +709,7 @@ * - class as DataCenterDBAsset * - category as asset */ - public static function getAssets( - $type, - array $options = array() - ) { + public static function getAssets( $type, array $options = array() ) { return self::getRows( 'DataCenterDBAsset', 'asset', $type, $options ); } @@ -766,10 +718,7 @@ * - class as DataCenterDBAsset * - category as asset */ - public static function getAsset( - $type, - $id - ) { + public static function getAsset( $type, $id ) { return self::getRow( 'DataCenterDBAsset', 'asset', $type, $id ); } @@ -777,10 +726,7 @@ * Wraps self::numRows specializing... * - category as asset */ - public static function numAssets( - $type, - array $options = array() - ) { + public static function numAssets( $type, array $options = array() ) { return self::numRows( 'asset', $type, $options ); } @@ -791,10 +737,7 @@ * - class as DataCenterDBModel * - category as model */ - public static function getModels( - $type, - array $options = array() - ) { + public static function getModels( $type, array $options = array() ) { return self::getRows( 'DataCenterDBModel', 'model', $type, $options ); } @@ -803,10 +746,7 @@ * - class as DataCenterDBModel * - category as model */ - public static function getModel( - $type, - $id - ) { + public static function getModel( $type, $id ) { return self::getRow( 'DataCenterDBModel', 'model', $type, $id ); } @@ -814,10 +754,7 @@ * Wraps self::numRows specializing... * - category as model */ - public static function numModels( - $type, - array $options = array() - ) { + public static function numModels( $type, array $options = array() ) { return self::numRows( 'model', $type, $options ); } @@ -828,10 +765,7 @@ * - class as DataCenterDBLink * - category as link */ - public static function getLinks( - $type, - array $options = array() - ) { + public static function getLinks( $type, array $options = array() ) { return self::getRows( 'DataCenterDBLink', 'link', $type, $options ); } @@ -840,10 +774,7 @@ * - class as DataCenterDBLink * - category as link */ - public static function getLink( - $type, - $id - ) { + public static function getLink( $type, $id ) { return self::getRow( 'DataCenterDBLink', 'link', $type, $id ); } @@ -851,10 +782,7 @@ * Wraps self::numRows specializing... * - category as link */ - public static function numLinks( - $type, - array $options = array() - ) { + public static function numLinks( $type, array $options = array() ) { return self::numRows( 'link', $type, $options ); } @@ -864,9 +792,7 @@ * - category as link * - type as asset */ - public static function getAssetLinks( - array $options = array() - ) { + public static function getAssetLinks( array $options = array() ) { return self::getRows( 'DataCenterDBAssetLink', 'link', 'asset', $options ); @@ -878,9 +804,7 @@ * - category as link * - type as asset */ - public static function getAssetLink( - $id - ) { + public static function getAssetLink( $id ) { return self::getRow( 'DataCenterDBAssetLink', 'link', 'asset', $id ); } @@ -889,9 +813,7 @@ * - category as link * - type as asset */ - public static function numAssetLinks( - array $options = array() - ) { + public static function numAssetLinks( array $options = array() ) { return self::numRows( 'link', 'asset', $options ); } @@ -901,9 +823,7 @@ * - category as link * - type as model */ - public static function getModelLinks( - array $options = array() - ) { + public static function getModelLinks( array $options = array() ) { return self::getRows( 'DataCenterDBModelLink', 'link', 'model', $options ); @@ -915,9 +835,7 @@ * - category as link * - type as model */ - public static function getModelLink( - $id - ) { + public static function getModelLink( $id ) { return self::getRow( 'DataCenterDBModelLink', 'link', 'model', $id ); } @@ -926,9 +844,7 @@ * - category as link * - type as model */ - public static function numModelLinks( - array $options = array() - ) { + public static function numModelLinks( array $options = array() ) { return self::numRows( 'link', 'model', $options ); } @@ -938,9 +854,7 @@ * - category as link * - type as field */ - public static function getMetaFieldLinks( - array $options = array() - ) { + public static function getMetaFieldLinks( array $options = array() ) { return self::getRows( 'DataCenterDBMetaFieldLink', 'link', 'field', $options ); } @@ -950,9 +864,7 @@ * - category as link * - type as field */ - public static function getMetaFieldLink( - $id - ) { + public static function getMetaFieldLink( $id ) { return self::getRow( 'DataCenterDBMetaFieldLink', 'link', 'field', $id ); } @@ -961,9 +873,7 @@ * - category as link * - type as field */ - public static function numMetaFieldLinks( - array $options = array() - ) { + public static function numMetaFieldLinks( array $options = array() ) { return self::numRows( 'link', 'field', $options ); } @@ -975,9 +885,7 @@ * - category as facility * - type as location */ - public static function getLocations( - array $options = array() - ) { + public static function getLocations( array $options = array() ) { return self::getRows( 'DataCenterDBLocation', 'facility', 'location', $options ); @@ -989,9 +897,7 @@ * - category as facility * - type as location */ - public static function getLocation( - $id - ) { + public static function getLocation( $id ) { return self::getRow( 'DataCenterDBLocation', 'facility', 'location', $id ); @@ -1002,9 +908,7 @@ * - category as facility * - type as location */ - public static function numLocations( - array $options = array() - ) { + public static function numLocations( array $options = array() ) { return self::numRows( 'facility', 'location', $options ); } @@ -1014,9 +918,7 @@ * - category as facility * - type as space */ - public static function getSpaces( - array $options = array() - ) { + public static function getSpaces( array $options = array() ) { return self::getRows( 'DataCenterDBSpace', 'facility', 'space', $options ); @@ -1028,9 +930,7 @@ * - category as facility * - type as space */ - public static function getSpace( - $id - ) { + public static function getSpace( $id ) { return self::getRow( 'DataCenterDBSpace', 'facility', 'space', $id ); @@ -1041,9 +941,7 @@ * - category as facility * - type as space */ - public static function numSpaces( - array $options = array() - ) { + public static function numSpaces( array $options = array() ) { return self::numRows( 'facility', 'space', $options ); } @@ -1055,9 +953,7 @@ * - category as meta * - type as plan */ - public static function getPlans( - array $options = array() - ) { + public static function getPlans( array $options = array() ) { return self::getRows( 'DataCenterDBPlan', 'meta', @@ -1079,9 +975,7 @@ * - category as meta * - type as plan */ - public static function getPlan( - $id - ) { + public static function getPlan( $id ) { return self::getRow( 'DataCenterDBPlan', 'meta', @@ -1100,9 +994,7 @@ * - category as meta * - type as plan */ - public static function numPlans( - array $options = array() - ) { + public static function numPlans( array $options = array() ) { return self::numRows( 'meta', 'plan', $options ); } @@ -1112,9 +1004,7 @@ * - category as meta * - type as change */ - public static function getChanges( - array $options = array() - ) { + public static function getChanges( array $options = array() ) { return self::getRows( 'DataCenterDBChange', 'meta', @@ -1149,10 +1039,7 @@ * - category as meta * - type as change */ - public static function getChange( - $id, - array $options = array() - ) { + public static function getChange( $id, array $options = array() ) { return self::getRow( 'DataCenterDBChange', 'meta', @@ -1187,9 +1074,7 @@ * - category as meta * - type as change */ - public static function numChanges( - array $options = array() - ) { + public static function numChanges( array $options = array() ) { return self::numRows( 'meta', 'change', $options ); } @@ -1199,9 +1084,7 @@ * - category as meta * - type as field */ - public static function getMetaFields( - array $options = array() - ) { + public static function getMetaFields( array $options = array() ) { return self::getRows( 'DataCenterDBMetaField', 'meta', 'field', $options ); @@ -1213,9 +1096,7 @@ * - category as meta * - type as field */ - public static function getMetaField( - $id - ) { + public static function getMetaField( $id ) { return self::getRow( 'DataCenterDBMetaField', 'meta', 'field', $id ); @@ -1226,9 +1107,7 @@ * - category as meta * - type as field */ - public static function numMetaFields( - array $options = array() - ) { + public static function numMetaFields( array $options = array() ) { return self::numRows( 'meta', 'field', $options ); } @@ -1238,9 +1117,7 @@ * - category as meta * - type as value */ - public static function getMetaValues( - array $options = array() - ) { + public static function getMetaValues( array $options = array() ) { return self::getRows( 'DataCenterDBMetaValue', 'meta', 'value', $options ); @@ -1252,9 +1129,7 @@ * - category as meta * - type as value */ - public static function getMetaValue( - $id - ) { + public static function getMetaValue( $id ) { return self::getRow( 'DataCenterDBMetaValue', 'meta', 'value', $id ); @@ -1265,9 +1140,7 @@ * - category as meta * - type as value */ - public static function numMetaValues( - array $options = array() - ) { + public static function numMetaValues( array $options = array() ) { return self::numRows( 'meta', 'value', $options ); } @@ -1275,15 +1148,11 @@ /** * Builds array of options which specify fields to sort results by - * @param category String of category to lookup type in - * @param type String of category to lookup fields in - * @param fields String or Array of Strings of fields to sort by + * @param $category String: category to lookup type in + * @param $type String: category to lookup fields in + * @param $fields String or Array of Strings of fields to sort by */ - public static function buildSort( - $category, - $type, - $fields - ) { + public static function buildSort( $category, $type, $fields ) { $columns = array(); if ( !is_array( $fields ) ) { $fields = array( $fields ); @@ -1382,11 +1251,9 @@ /** * Builds array of options which specify limit and offset - * @param path Array of link parameters + * @param $path Array: array of link parameters */ - public static function buildRange( - $path - ) { + public static function buildRange( $path ) { if ( !isset( $path['limit'] ) || $path['limit'] == null ) { $path['limit'] = 10; } @@ -1404,17 +1271,12 @@ /** * Builds array of options which match a query against a number of fields * using case-insensitive partial matching - * @param category String of category to lookup type in - * @param type String of category to lookup fields in - * @param fields String of field to match query with - * @param value String of query to match to field value + * @param $category String: category to lookup type in + * @param $type String: category to lookup fields in + * @param $fields String: field to match query with + * @param $query String: query to match to field value */ - public static function buildMatch( - $category, - $type, - $fields, - $query - ) { + public static function buildMatch( $category, $type, $fields, $query ) { $dbr = wfGetDB( DB_SLAVE ); $conditions = array(); if ( !is_array( $fields ) ) { @@ -1433,13 +1295,10 @@ /** * Creates and returns an associative array of rows keyed by a specific * field, for use as a lookup table or to divide rows into groups - * @param field String of name of field to use as key - * @param rows Array of DataCenterDBRow objects to process + * @param $field String: name of field to use as key + * @param $rows Array: DataCenterDBRow objects to process */ - public static function buildLookupTable( - $field, - array $rows - ) { + public static function buildLookupTable( $field, array $rows ) { if ( !is_scalar( $field ) && $field !== null ) { throw new MWException( $field . ' is not a field for table keys to be made from' @@ -1515,11 +1374,7 @@ * @param row Optional Associative Array of column and value * pairs to use as initial data overriding defaults */ - public function __construct( - $category, - $type, - array $row = array() - ) { + public function __construct( $category, $type, array $row = array() ) { $this->category = $category; $this->type = $type; $this->set( DataCenterDB::getRowDefaults( $category, $type ) ); @@ -1537,9 +1392,7 @@ /** * Sets row data from an Associative Array of column and value pairs */ - public function setRow( - array $row = array() - ) { + public function setRow( array $row = array() ) { $this->row = count( $row ) > 0 ? $row : null; } @@ -1578,9 +1431,7 @@ * Gets fully prefixed column name from simplified field name * @param fieldName String of name of field to lookup */ - public function getColumnName( - $fieldName - ) { + public function getColumnName( $fieldName ) { return DataCenterDB::getColumnName( $this->category, $this->type, $fieldName ); @@ -1590,9 +1441,7 @@ * Gets simplified field name from fully prefixed column name * @param columnName String of name of column to lookup */ - public function getFieldName( - $columnName - ) { + public function getFieldName( $columnName ) { return DataCenterDB::getFieldName( $this->category, $this->type, $columnName ); @@ -1622,11 +1471,7 @@ * passed, all fields will be returned as an Associative * Array. */ - public function get( - $category = null, - $type = null, - $field = null - ) { + public function get( $category = null, $type = null, $field = null ) { if ( $category === null && $type === null && $field === null ) { $category = $this->category; $type = $this->type; @@ -1653,7 +1498,7 @@ } } return $results; - } else if ( is_array( $field ) ) { + } elseif ( is_array( $field ) ) { $results = array(); foreach ( $field as $fieldName ) { $columnName = DataCenterDB::getColumnName( @@ -1687,10 +1532,7 @@ * Array of field and value pairs * @param value Optional Scalar of value to set */ - public function set( - $column, - $value = null - ) { + public function set( $column, $value = null ) { if ( is_array( $column ) ) { foreach ( $column as $name => $value ) { $columnName = $this->getColumnName( $name ); @@ -1749,9 +1591,7 @@ /** * Gets changes that reference this object by category, type, and ID */ - public function getChanges( - array $options = array() - ) { + public function getChanges( array $options = array() ) { return DataCenterDB::getChanges( array_merge_recursive( $options, @@ -1768,9 +1608,7 @@ ); } - public function numChanges( - array $options = array() - ) { + public function numChanges( array $options = array() ) { return DataCenterDB::numChanges( array_merge_recursive( $options, @@ -1787,9 +1625,7 @@ ); } - public function saveMetaValues( - $values = null - ) { + public function saveMetaValues( $values = null ) { if ( !is_array( $values ) ) { return; } @@ -1823,9 +1659,7 @@ } } - public function insertChange( - $values - ) { + public function insertChange( $values ) { if ( !is_array( $values ) ) { return; } @@ -1926,10 +1760,7 @@ * - category as asset * - type as rack */ - public static function newFromType( - $type, - array $values = array() - ) { + public static function newFromType( $type, array $values = array() ) { return parent::newFromClass( __CLASS__, 'asset', $type, $values ); } @@ -1965,10 +1796,7 @@ * - class as DataCenterDBModel * - category as model */ - public static function newFromType( - $type, - array $values = array() - ) { + public static function newFromType( $type, array $values = array() ) { return parent::newFromClass( __CLASS__, 'model', $type, $values ); } @@ -2031,9 +1859,7 @@ * - category as link * - type as asset */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'link', 'asset', $values ); } @@ -2042,9 +1868,7 @@ /** * Gets flat list of links */ - public function getLinks( - array $options = array() - ) { + public function getLinks( array $options = array() ) { if ( !$this->links ) { $links = DataCenterDB::getAssetLinks( DataCenterDB::buildCondition( @@ -2081,12 +1905,10 @@ /** * Builds structure of links recursively using list of links - * @param links Array of DataCenterDBAssetLink to use as source - * for recursive structure construction + * @param $links Array: DataCenterDBAssetLink to use as source for + * recursive structure construction */ - public function buildStructure( - array $links - ) { + public function buildStructure( array $links ) { $id = $this->getId(); foreach ( $links as $key => $link ) { if ( $link->get( 'parent_link' ) == $id ) { @@ -2113,9 +1935,7 @@ * - category as link * - type as model */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'link', 'model', $values ); } @@ -2124,10 +1944,7 @@ * @param parent DataCenterDBModel to set as parent * @param child DataCenterDBModel to set as child */ - public static function newFromModels( - $parent, - $child - ) { + public static function newFromModels( $parent, $child ) { if ( !( $parent instanceof DataCenterDBModel ) ) { throw new MWException( 'Parent object is not compatible with DataCenterDBModel' @@ -2170,9 +1987,7 @@ * - category as link * - type as field */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'link', 'field', $values ); } @@ -2235,9 +2050,7 @@ * - category as facility * - type as location */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'facility', 'location', $values ); @@ -2245,9 +2058,7 @@ /* Functions */ - public function getSpaces( - array $options = array() - ) { + public function getSpaces( array $options = array() ) { return DataCenterDB::getRows( __CLASS__, 'facility', @@ -2272,15 +2083,11 @@ * - category as facility * - type as space */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'facility', 'space', $values ); } - public function getPlans( - array $options = array() - ) { + public function getPlans( array $options = array() ) { if ( $this->type == 'space' ) { return DataCenterDB::getPlans( array_merge_recursive( @@ -2311,17 +2118,13 @@ * - category as meta * - type as field */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'meta', 'field', $values ); } /* Functions */ - public function getLinks( - array $options = array() - ) { + public function getLinks( array $options = array() ) { return DataCenterDB::getMetaFieldLinks( array_merge_recursive( $options, @@ -2359,9 +2162,7 @@ * - category as meta * - type as value */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'meta', 'value', $values ); } @@ -2398,9 +2199,7 @@ * - category as meta * - type as change */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'meta', 'change', $values ); } @@ -2446,9 +2245,7 @@ * - category as meta * - type as plan */ - public static function newFromValues( - array $values = array() - ) { + public static function newFromValues( array $values = array() ) { return parent::newFromClass( __CLASS__, 'meta', 'plan', $values ); } @@ -2466,9 +2263,7 @@ /** * Gets flat list of links */ - public function getLinks( - array $options = array() - ) { + public function getLinks( array $options = array() ) { if ( !$this->links ) { $this->links = DataCenterDB::getAssetLinks( DataCenterDB::buildCondition( @@ -2482,9 +2277,7 @@ /** * Gets structure of links */ - public function getStructure( - array $options = array() - ) { + public function getStructure( array $options = array() ) { if ( !$this->structure ) { $links = DataCenterDB::getRows( 'DataCenterDBAssetLink', Modified: trunk/extensions/DataCenter/DataCenter.js =================================================================== --- trunk/extensions/DataCenter/DataCenter.js 2009-11-07 18:07:23 UTC (rev 58726) +++ trunk/extensions/DataCenter/DataCenter.js 2009-11-07 18:19:16 UTC (rev 58727) @@ -11,7 +11,7 @@ * */ function DataCenterRenderer() { - + /* Private Members */ var self = this; @@ -25,9 +25,7 @@ * Gets a reference to a target by it's id * @param target String or Integer of ID of target */ - this.getTarget = function( - target - ) { + this.getTarget = function( target ) { if ( targets[target] !== undefined ) { return targets[target]; } @@ -38,10 +36,7 @@ * @param type A function object which will be created and then passed * to each job for each target */ - this.addQueue = function( - queue, - type - ) { + this.addQueue = function( queue, type ) { queues[queue] = type; } /** @@ -49,11 +44,7 @@ * @param queue String of name of rendering system used to reference it * @param target String of XML ID of element to perform this job for */ - this.addJob = function( - queue, - target, - job - ) { + this.addJob = function( queue, target, job ) { if ( jobs[queue] === undefined ) { jobs[queue] = {}; } @@ -107,7 +98,7 @@ * which can be added, accessed and removed during run-time. */ function DataCenterPool() { - + /* Private Members */ var self = this; @@ -120,9 +111,7 @@ * Adds an object to pool, and returns it's unique ID * @param object Object reference to add */ - this.addObject = function( - object - ) { + this.addObject = function( object ) { var id = count++; objects[id] = object; return id; @@ -131,9 +120,7 @@ * Removes an object form pool * @param id ID number of object to remove */ - this.removeObject = function( - id - ) { + this.removeObject = function( id ) { if ( objects[id] !== undefined ) { delete objects[id]; } @@ -142,9 +129,7 @@ * Gets an object from pool * @param id ID number of object to get */ - this.getObject = function( - id - ) { + this.getObject = function( id ) { if ( objects[id] !== undefined ) { return objects[id]; } @@ -155,12 +140,9 @@ * @param target The XML ID of a DIV in which a plan should be rendered * into. */ -function DataCenterScene( - target -) { - +function DataCenterScene( target ) { /* Private Members */ - + // Reference to itself var self = this; // Colors used in rendering @@ -175,9 +157,9 @@ var features = { radialGradient: true }; - + /* Configuration */ - + // Gets target element var element = document.getElementById( target ); // Sets element's background color so there's consistency when resizing @@ -206,9 +188,9 @@ 'click', new Function( target + ".getModule().click();" ) ); - + /* Public Functions */ - + /** * Checks if scene that rack is part of is live */ @@ -245,10 +227,7 @@ * @param newModule Object of scene compatible module to render * @param update Boolean flag indicating desire to re-render now */ - this.setModule = function ( - newModule, - update - ) { + this.setModule = function( newModule, update ) { newModule.setScene( self ); module = newModule; // Automatically re-render @@ -258,9 +237,7 @@ * Re-renders scene * @param update Boolean flag indicating desire to re-render now */ - this.update = function ( - update - ) { + this.update = function( update ) { // Check if scene is live and update flag is set if ( self.isLive() && update ) { // Renders scene @@ -304,9 +281,7 @@ /** * Abstraction for a Google Maps object */ -function DataCenterMap( - target -) { +function DataCenterMap( target ) { // Checks that browser is compatible with Google Maps if ( !GBrowserIsCompatible() ) { return; @@ -338,11 +313,7 @@ * content String of content to place in info window (optional) * popup Boolean of whether to initially show info window */ - this.addMarker = function( - lat, - lng, - options - ) { + this.addMarker = function( lat, lng, options ) { var marker = new GMarker( new GLatLng( lat, lng ) ); map.addOverlay( marker ); if ( options && options.content ) { @@ -366,10 +337,7 @@ * latField Object reference of XML form element to update * lngField Object reference of XML form element to update */ - this.showAddress = function( - address, - options - ) { + this.showAddress = function( address, options ) { // Adds this object to pool and gets it's ID poolID = dataCenter.pool.addObject( self ); // Stores the options last used for later reference @@ -385,9 +353,7 @@ * Response to address lookup which is called asynchronously * @param point GPoint object of address lookup result */ - this.respond = function( - point - ) { + this.respond = function( point ) { if ( point ) { map.setCenter( point, 14 ); map.clearOverlays(); @@ -417,11 +383,7 @@ * content String of content to place in info window (optional) * popup Boolean of whether to initially show info window */ - this.showPosition = function( - lat, - lng, - options - ) { + this.showPosition = function( lat, lng, options ) { var point = new GLatLng( lat, lng ); map.setCenter( point, 14 ); map.clearOverlays(); @@ -438,8 +400,8 @@ dataCenter.ui.layouts = {}; dataCenter.ui.widgets = {}; // Adds hooks that cause dataCenter systems to react to window events -hookEvent( "load", dataCenter.renderer.setup ); -hookEvent( "resize", dataCenter.renderer.render ); +hookEvent( 'load', dataCenter.renderer.setup ); +hookEvent( 'resize', dataCenter.renderer.render ); // Adds rendering queues for scene system dataCenter.renderer.addQueue( 'scene', DataCenterScene ); // Adds rendering queues for map system Modified: trunk/extensions/DataCenter/DataCenter.page.php =================================================================== --- trunk/extensions/DataCenter/DataCenter.page.php 2009-11-07 18:07:23 UTC (rev 58726) +++ trunk/extensions/DataCenter/DataCenter.page.php 2009-11-07 18:19:16 UTC (rev 58727) @@ -17,9 +17,7 @@ /* Abstract Functions */ - public abstract function __construct( - array $path - ); + public abstract function __construct( array $path ); } abstract class DataCenterView { @@ -30,9 +28,7 @@ /* Functions */ - public function __construct( - $controller - ) { + public function __construct( $controller ) { $this->controller = $controller; } } @@ -139,9 +135,7 @@ /* Private Static Functions */ - private static function urlToSub( - $url - ) { + private static function urlToSub( $url ) { global $wgTitle; $start = stripos( $url, $wgTitle->getBaseText() ); if ( $start !== false ) { @@ -154,9 +148,7 @@ return $url; } - private static function subToPath( - $sub - ) { + private static function subToPath( $sub ) { $path = array(); // Removes leading or trailing slashes, sanitizing hand-entered URLs $sub = trim( $sub, '/'); @@ -212,9 +204,7 @@ /* Public Static Functions */ - public static function getState( - $key - ) { + public static function getState( $key ) { if ( isset( self::$state['public'][$key] ) ) { return self::$state['public'][$key]; } else { @@ -222,10 +212,7 @@ } } - public static function setState( - $key, - $value - ) { + public static function setState( $key, $value ) { self::$state['public'][$key] = $value; } @@ -244,9 +231,7 @@ return self::$path; } - public static function userCan( - $action - ) { + public static function userCan( $action ) { if ( is_array( $action ) ) { if ( count( $action ) > 0 ) { foreach ( $action as $right ) { @@ -270,9 +255,7 @@ wfLoadExtensionMessages( 'DataCenter' ); } - public function execute( - $sub - ) { + public function execute( $sub ) { global $wgOut, $wgScriptPath, $wgUser, $wgRequest; // Checks if the user is logged in if ( !$wgUser->isLoggedIn() ) { Modified: trunk/extensions/DataCenter/DataCenter.php =================================================================== --- trunk/extensions/DataCenter/DataCenter.php 2009-11-07 18:07:23 UTC (rev 58726) +++ trunk/extensions/DataCenter/DataCenter.php 2009-11-07 18:19:16 UTC (rev 58727) @@ -18,8 +18,8 @@ // Check environment if ( !defined( 'MEDIAWIKI' ) ) { - echo ( "This is a MediaWiki extension and cannot be run standalone.\n" ); - die ( 1 ); + echo( "This is a MediaWiki extension and cannot be run standalone.\n" ); + die( 1 ); } /* Configuration */ @@ -35,6 +35,7 @@ $wgExtensionCredits['other'][] = array( 'path' => __FILE__, 'name' => 'DataCenter', + 'version' => '0.1.0', 'author' => 'Trevor Parscal', 'url' => 'http://www.mediawiki.org/wiki/Extension:DataCenter', 'description' => 'DataCenter Planning and Asset Tracking System', Modified: trunk/extensions/DataCenter/DataCenter.ui.php =================================================================== --- trunk/extensions/DataCenter/DataCenter.ui.php 2009-11-07 18:07:23 UTC (rev 58726) +++ trunk/extensions/DataCenter/DataCenter.ui.php 2009-11-07 18:19:16 UTC (rev 58727) @@ -10,9 +10,7 @@ /* Static Functions */ - public static function toAttributes( - array $attributes - ) { + public static function toAttributes( array $attributes ) { $cssOutput = ''; foreach( $attributes as $name => $value ) { if ( !is_int( $name ) ) { @@ -27,15 +25,12 @@ /* Static Functions */ - public static function chain( - $functions, - $end = true - ) { + public static function chain( $functions, $end = true ) { $jsFunctions = array(); foreach( $functions as $name => $arguments ) { if ( is_int( $name ) ) { $jsFunctions[] = sprintf( '%s()', $arguments ); - } else if ( is_array( $arguments ) ) { + } elseif ( is_array( $arguments ) ) { $jsFunctions[] = sprintf( '%s(%s)', $name, implode( ',', $arguments ) ); @@ -47,12 +42,10 @@ } /** - * Escapes a javascript string to make it safe to use anywhere - * @param string String to escape + * Escapes a JavaScript string to make it safe to use anywhere + * @param $string String: String to escape */ - public static function escape( - $string - ) { + public static function escape( $string ) { return Xml::escapeJSString( $string ); } @@ -60,9 +53,7 @@ * Converts a PHP value to a javascript object * @param value Associative Array to convert */ - public static function toObject( - $values - ) { + public static function toObject( $values ) { // Arrays if ( is_array( $values ) ) { $jsValues = array(); @@ -82,9 +73,7 @@ * Converts a PHP value to a javascript array * @param value Array or Scalar to convert */ - public static function toArray( - $values - ) { + public static function toArray( $values ) { // Arrays if ( is_array( $values ) ) { $jsValues = array(); @@ -108,9 +97,7 @@ * in which case the ' quotes will be removed and * the value will be used as a statement */ - public static function toScalar( - $value - ) { + public static function toScalar( $value ) { // Arrays if ( is_array( $value ) ) { return "'" . self::escape( implode( $value ) ) . "'"; @@ -149,18 +136,15 @@ /** * Builds an annonomous javascript function declaration - * @param arguments Array of argument names to accept - * @param body String of code for body + * @param $arguments Array: array of argument names to accept + * @param $body String: code for body */ - public static function buildFunction( - $arguments, - $body - ) { + public static function buildFunction( $arguments, $body ) { if ( is_array( $arguments ) ) { return sprintf( 'function(%s){%s}', implode( ',', $arguments ), $body ); - } else if ( $arguments !== null ) { + } elseif ( $arguments !== null ) { return sprintf( 'function(%s){%s}', $arguments, $body ); } else { return sprintf( 'function(){%s}', $body ); @@ -169,13 +153,10 @@ /** * Builds an annonomous javascript function declaration - * @param arguments Array of argument names to accept - * @param body String of code for body + * @param $prototype String + * @param $arguments Array: array of argument names to accept */ - public static function buildInstance( - $prototype, - $arguments = array() - ) { + public static function buildInstance( $prototype, $arguments = array() ) { if ( !is_array( $arguments ) ) { $arguments = array( $arguments ); } @@ -202,18 +183,11 @@ ) . ( $end ? ';' : '' ); } - public static function declareVar( - $name, - $value = 'null', - $end = true - ) { + public static function declareVar( $name, $value = 'null', $end = true ) { return sprintf( 'var %s=%s', $name, $value ) . ( $end ? ';' : '' ); } - public static function declareVars( - array $vars, - $end = true - ) { + public static function declareVars( array $vars, $end = true ) { $jsOutput = ''; foreach( $vars as $name => $value ) { if ( is_int( $name ) ) { @@ -245,7 +219,7 @@ } /** - * Builds javascript effect + * Builds JavaScript effect * @param options Array of effect parameters containing... * script JavaScript to run, with sprintf syntax for * including fields in the order listed @@ -262,10 +236,7 @@ * @param row DataCenterDBRow object from which to extract * fields from */ - public static function buildEffect( - $script, - $fields = null - ) { + public static function buildEffect( $script, $fields = null ) { // Checks for... if ( // Required types @@ -323,7 +294,6 @@ * @param attributes Optional Array of XML attributes * @param content... Any number of Strings of XML content */ - public static function row() { $arguments = func_get_args(); $attributes = array(); @@ -415,11 +385,9 @@ /** * Builds an XML string for a complete input - * @param attributes Array of XML attributes + * @param $attributes Array: XML attributes */ - public static function input( - array $attributes = array() - ) { + public static function input( array $attributes = array() ) { return self::tag( 'div', $attributes ); } @@ -446,23 +414,18 @@ /** * Builds an XML string for a tag opening - * @param tag Name of tag - * @param attributes Array of XML attributes + * @param $tag String: name of tag + * @param $attributes Array: XML attributes */ - public static function open( - $tag, - array $attributes = array() - ) { + public static function open( $tag, array $attributes = array() ) { return Xml::openElement( $tag, $attributes ); } /** * Builds an XML string for a tag closing - * @param tag Name of tag + * @param $tag String: name of tag */ - public static function close( - $tag - ) { + public static function close( $tag ) { return Xml::closeElement( $tag ); } @@ -478,9 +441,7 @@ * @param script String of raw text to use as script contents or * Array of attributes such as src */ - public static function script( - $script - ) { + public static function script( $script ) { if ( is_array( $script ) ) { return Xml::element( 'script', @@ -510,9 +471,7 @@ * id Scalar of ID of row * parameter Scalar parameter or Array of parameters */ - public static function url( - array $parameters - ) { + public static function url( array $parameters ) { global $wgTitle; // Gets the base url if ( !self::$urlBase ) { @@ -550,14 +509,14 @@ $url .= '/' . $parameters['action']; // Checks if parameter was given if ( $parameters['parameter'] !== null ) { - if ( is_array( $parameters['parameter'] ) ) { // Adds parameter to url + if ( is_array( $parameters['parameter'] ) ) { // Adds parameter to url $url .= ':' . implode( ',', $parameters['parameter'] ); } else { // Adds parameter to url $url .= ':' . $parameters['parameter']; } } - } else if ( $parameters['limit'] !== null ) { + } elseif ( $parameters['limit'] !== null ) { $url .= '/'; } if ( $parameters['limit'] !== null ) { @@ -600,13 +559,10 @@ /** * Builds an XML string for a link - * @param label String of raw text to use as label - * @param parameters Array of link parameters for self::url + * @param $label String: raw text to use as label + * @param $parameters Array: link parameters for self::url */ - public static function link( - $label = null, - array $parameters - ) { + public static function link( $label = null, array $parameters ) { return Xml::element( 'a', array( 'href' => self::url( $parameters ) ), $label ); @@ -635,10 +591,7 @@ * @param row DataCenterDBRow object from which to extract * field/fields from */ - public static function buildLink( - $options, - $row = null - ) { + public static function buildLink( $options, $row = null ) { // Checks if row was given if ( isset( $options['page'] ) && $row instanceof DataCenterDBRow ) { // Transforms options based on row @@ -701,18 +654,12 @@ * @param row DataCenterDBRow object from which to extract * field/fields from */ - public static function buildEffects( - array $options, - $fields - ) { + public static function buildEffects( array $options, $fields ) { if ( $fields instanceof DataCenterDBRow ) { $fields = $fields->get(); } - // Checks for... - if ( - // Required types - ( is_array( $fields ) ) - ) { + // Checks for required types + if ( ( is_array( $fields ) ) ) { $effects = array(); // Loops over each effect foreach ( $options as $effect ) { @@ -737,21 +684,17 @@ /** * Abstract function for rendering the input - * @param parameters Array of parameters + * @param $parameters Array: array of parameters */ - public static function render( - array $parameters - ) {} + public static function render( array $parameters ) {} /* Protected Static Functions */ /** * Builds XML string of begining of input - * @param class CSS class name of widget + * @param $class String: CSS class name of widget */ - protected static function begin( - $class - ) { + protected static function begin( $class ) { return DataCenterXml::open( 'div', array( 'class' => $class ) ); } @@ -775,10 +718,7 @@ /* Static Functions */ - public static function buildPaging( - $page, - $num - ) { + public static function buildPaging( $page, $num ) { $range = array( 'limit' => 10, 'offset' => 0 ); if ( isset( $page['limit'] ) && $page['limit'] !== null ) { $range['limit'] = $page['limit']; @@ -933,11 +873,7 @@ * @param arguments String or array of strings of arguments which * will be passed to MediaWiki's message parser */ - public static function message( - $type, - $name = null, - $arguments = null - ) { + public static function message( $type, $name = null, $arguments = null ) { if ( !$name ) { return wfMsg( $type ); } @@ -955,10 +891,7 @@ * no formatting or any of the following... * date Localized date and time format from timestamp */ - public static function format( - $value, - $format - ) { + public static function format( $value, $format ) { global $wgLang; // Handles format type switch ( $format ) { @@ -1001,7 +934,7 @@ $wgOut->addScript( DataCenterXml::script( array( 'src' => $url ) ) ); - } else if ( strpos( $url, '<' ) !== false ) { + } elseif ( strpos( $url, '<' ) !== false ) { $wgOut->addScript( sprintf( $url, $wgScriptPath ) ); } else { $wgOut->addScriptFile( $wgScriptPath . $url ); @@ -1031,14 +964,11 @@ /** * Builds string of XML using widget - * @param name Name of widget to use - * @param parameters Parameters to pass on to widget + * @param $name String: name of widget to use + * @param $parameters Array: parameters to pass on to widget * @return String of widget's XML output */ - public static function renderWidget( - $name, - array $parameters = array() - ) { + public static function renderWidget( $name, array $parameters = array() ) { if ( isset( self::$widgets[$name] ) ) { $function = array( self::$widgets[$name], 'render' ); if ( is_callable( $function ) ) { @@ -1053,14 +983,11 @@ /** * Builds string of XML using input - * @param name Name of input to use - * @param parameters Parameters to pass on to input + * @param $name String: name of input to use + * @param $parameters Array: parameters to pass on to input * @return String of input's XML output */ - public static function renderInput( - $name, - array $parameters = array() - ) { + public static function renderInput( $name, array $parameters = array() ) { if ( isset( self::$inputs[$name] ) ) { $function = array( self::$inputs[$name], 'render' ); if ( is_callable( $function ) ) { @@ -1075,14 +1002,11 @@ /** * Builds string of XML using layout - * @param name Name of layout to use - * @param contents Array of strings of XML to layout - * @return String of layout's XML output + * @param $name String: name of layout to use + * @param $contents Array: array of strings of XML to layout + * @return String of layout's XML output */ - public static function renderLayout( - $name, - array $contents = array() - ) { + public static function renderLayout( $name, array $contents = array() ) { if ( isset( self::$layouts[$name] ) ) { $function = array( self::$layouts[$name], 'render' ); if ( is_callable( $function ) ) { @@ -1097,11 +1021,9 @@ /** * Appends the scripts list, skipping duplicate entries - * @param url Fully qualified URL to javascript file + * @param $url String: fully qualified URL to JavaScript file */ - public static function addScript( - $url - ) { + public static function addScript( $url ) { if ( !in_array( $url, self::$output['scripts'] ) ) { self::$output['scripts'][] = $url; } @@ -1109,11 +1031,9 @@ /** * Appends content to the output cache - * @param content String of XML content to append + * @param $content String: XML content to append */ - public static function addContent( - $content - ) { + public static function addContent( $content ) { self::$output['content'] .= $content; } @@ -1198,34 +1118,28 @@ /** * Checks if widget is available - * @param name Name of widget to look for - * @return Boolean true if exists, false if not + * @param $name String: name of widget to look for + * @return Boolean true if exists, false if not */ - public static function isWidget( - $name - ) { + public static function isWidget( $name ) { return isset( self::$widgets[$name] ); } /** * Checks if input is available - * @param name Name of input to look for - * @return Boolean true if exists, false if not + * @param $name String: name of input to look for + * @return Boolean true if exists, false if not */ - public static function isInput( - $name - ) { + public static function isInput( $name ) { return isset( self::$inputs[$name] ); } /** * Checks if layout is available - * @param name Name of layout to look for - * @return Boolean true if exists, false if not + * @param $name String: name of layout to look for + * @return Boolean true if exists, false if not */ - public static function isLayout( - $name - ) { + public static function isLayout( $name ) { return isset( self::$layouts[$name] ); } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS[at]lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
|