Index: trunk/extensions/DataCenter/DataCenter.php |
— | — | @@ -18,8 +18,8 @@ |
19 | 19 | |
20 | 20 | // Check environment |
21 | 21 | if ( !defined( 'MEDIAWIKI' ) ) { |
22 | | - echo ( "This is a MediaWiki extension and cannot be run standalone.\n" ); |
23 | | - die ( 1 ); |
| 22 | + echo( "This is a MediaWiki extension and cannot be run standalone.\n" ); |
| 23 | + die( 1 ); |
24 | 24 | } |
25 | 25 | |
26 | 26 | /* Configuration */ |
— | — | @@ -35,6 +35,7 @@ |
36 | 36 | $wgExtensionCredits['other'][] = array( |
37 | 37 | 'path' => __FILE__, |
38 | 38 | 'name' => 'DataCenter', |
| 39 | + 'version' => '0.1.0', |
39 | 40 | 'author' => 'Trevor Parscal', |
40 | 41 | 'url' => 'http://www.mediawiki.org/wiki/Extension:DataCenter', |
41 | 42 | 'description' => 'DataCenter Planning and Asset Tracking System', |
Index: trunk/extensions/DataCenter/DataCenter.db.php |
— | — | @@ -139,73 +139,58 @@ |
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Checks if type exists in any of the type categories |
143 | | - * @param category String of category to look up type in |
144 | | - * @param type String of type to check for |
| 143 | + * @param $category String: category to look up type in |
| 144 | + * @param $type String: type to check for |
145 | 145 | */ |
146 | | - public static function isType( |
147 | | - $category, |
148 | | - $type |
149 | | - ) { |
| 146 | + public static function isType( $category, $type ) { |
150 | 147 | return isset( self::$types[$category][$type] ); |
151 | 148 | } |
152 | 149 | |
153 | 150 | /** |
154 | 151 | * Checks if type exists in the facility category |
155 | | - * @param type String of asset type to check for |
| 152 | + * @param $type String: asset type to check for |
156 | 153 | */ |
157 | | - public static function isFacilityType( |
158 | | - $type |
159 | | - ) { |
| 154 | + public static function isFacilityType( $type ) { |
160 | 155 | return isset( self::$types['facility'][$type] ); |
161 | 156 | } |
162 | 157 | |
163 | 158 | /** |
164 | 159 | * Checks if type exists in the link category |
165 | | - * @param type String of asset type to check for |
| 160 | + * @param $type String: asset type to check for |
166 | 161 | */ |
167 | | - public static function isLinkType( |
168 | | - $type |
169 | | - ) { |
| 162 | + public static function isLinkType( $type ) { |
170 | 163 | return isset( self::$types['link'][$type] ); |
171 | 164 | } |
172 | 165 | |
173 | 166 | /** |
174 | 167 | * Checks if type exists in the asset category |
175 | | - * @param type String of asset type to check for |
| 168 | + * @param $type String: asset type to check for |
176 | 169 | */ |
177 | | - public static function isAssetType( |
178 | | - $type |
179 | | - ) { |
| 170 | + public static function isAssetType( $type ) { |
180 | 171 | return isset( self::$types['asset'][$type] ); |
181 | 172 | } |
182 | 173 | |
183 | 174 | /** |
184 | 175 | * Checks if type exists in the model category |
185 | | - * @param type String of model type to check for |
| 176 | + * @param $type String: model type to check for |
186 | 177 | */ |
187 | | - public static function isModelType( |
188 | | - $type |
189 | | - ) { |
| 178 | + public static function isModelType( $type ) { |
190 | 179 | return isset( self::$types['model'][$type] ); |
191 | 180 | } |
192 | 181 | |
193 | 182 | /** |
194 | 183 | * Checks if type exists in the asset category |
195 | | - * @param type String of meta type to check for |
| 184 | + * @param $type String: meta type to check for |
196 | 185 | */ |
197 | | - public static function isMetaType( |
198 | | - $type |
199 | | - ) { |
| 186 | + public static function isMetaType( $type ) { |
200 | 187 | return isset( self::$types['meta'][$type] ); |
201 | 188 | } |
202 | 189 | |
203 | 190 | /** |
204 | 191 | * Checks if class is or is subclass of DataCenterDBRow |
205 | | - * @param rowClass String of name of class to check |
| 192 | + * @param $rowClass String: name of class to check |
206 | 193 | */ |
207 | | - public static function isRowClass( |
208 | | - $class |
209 | | - ) { |
| 194 | + public static function isRowClass( $class ) { |
210 | 195 | return ( |
211 | 196 | class_exists( $class ) && |
212 | 197 | ( |
— | — | @@ -217,15 +202,11 @@ |
218 | 203 | |
219 | 204 | /** |
220 | 205 | * Checks if a column name belongs to a specific type |
221 | | - * @param category String of category to look up type in |
222 | | - * @param type String of type to check for |
223 | | - * @param columnName String of column to look up |
| 206 | + * @param $category String: category to look up type in |
| 207 | + * @param $type String: type to check for |
| 208 | + * @param $columnName String: column to look up |
224 | 209 | */ |
225 | | - public static function isColumnOfType( |
226 | | - $category, |
227 | | - $type, |
228 | | - $columnName |
229 | | - ) { |
| 210 | + public static function isColumnOfType( $category, $type, $columnName ) { |
230 | 211 | return ( |
231 | 212 | strpos( $columnName, self::$types[$category][$type]['prefix'] ) !== |
232 | 213 | false |
— | — | @@ -234,15 +215,11 @@ |
235 | 216 | |
236 | 217 | /** |
237 | 218 | * Gets fully prefixed column name from simplified field name |
238 | | - * @param category String of category to look up type in |
239 | | - * @param type String of type to check for |
240 | | - * @param fieldName String of field to look up |
| 219 | + * @param $category String: category to look up type in |
| 220 | + * @param $type String: type to check for |
| 221 | + * @param $fieldName String: field to look up |
241 | 222 | */ |
242 | | - public static function getColumnName( |
243 | | - $category, |
244 | | - $type, |
245 | | - $fieldName |
246 | | - ) { |
| 223 | + public static function getColumnName( $category, $type, $fieldName ) { |
247 | 224 | return isset( self::$types[$category][$type] ) ? |
248 | 225 | self::$types[$category][$type]['prefix'] . $fieldName : |
249 | 226 | null; |
— | — | @@ -250,15 +227,11 @@ |
251 | 228 | |
252 | 229 | /** |
253 | 230 | * Gets simplified field name from fully prefixed column name |
254 | | - * @param category String of category to look up type in |
255 | | - * @param type String of type to check for |
256 | | - * @param columnName String of column to look up |
| 231 | + * @param $category String: category to look up type in |
| 232 | + * @param $type String: type to check for |
| 233 | + * @param $columnName String: column to look up |
257 | 234 | */ |
258 | | - public static function getFieldName( |
259 | | - $category, |
260 | | - $type, |
261 | | - $columnName |
262 | | - ) { |
| 235 | + public static function getFieldName( $category, $type, $columnName ) { |
263 | 236 | return isset( self::$types[$category][$type]['prefix'] ) ? |
264 | 237 | substr( |
265 | 238 | $columnName, strlen( self::$types[$category][$type]['prefix'] ) |
— | — | @@ -268,13 +241,10 @@ |
269 | 242 | |
270 | 243 | /** |
271 | 244 | * Gets table name from category and type |
272 | | - * @param category String of category to look up type in |
273 | | - * @param type String of type look up table in |
| 245 | + * @param $category String: category to look up type in |
| 246 | + * @param $type String: type look up table in |
274 | 247 | */ |
275 | | - public static function getTableName( |
276 | | - $category, |
277 | | - $type |
278 | | - ) { |
| 248 | + public static function getTableName( $category, $type ) { |
279 | 249 | return isset( self::$types[$category][$type]['table'] ) ? |
280 | 250 | self::$types[$category][$type]['table'] : |
281 | 251 | null; |
— | — | @@ -282,13 +252,10 @@ |
283 | 253 | |
284 | 254 | /** |
285 | 255 | * Gets row defaults from category and type |
286 | | - * @param category String of category to look up type in |
287 | | - * @param type String of type look up defaults in |
| 256 | + * @param $category String: category to look up type in |
| 257 | + * @param $type String: type look up defaults in |
288 | 258 | */ |
289 | | - public static function getRowDefaults( |
290 | | - $category, |
291 | | - $type |
292 | | - ) { |
| 259 | + public static function getRowDefaults( $category, $type ) { |
293 | 260 | return isset( self::$types[$category][$type]['defaults'] ) ? |
294 | 261 | self::$types[$category][$type]['defaults'] : |
295 | 262 | array(); |
— | — | @@ -592,15 +559,11 @@ |
593 | 560 | |
594 | 561 | /** |
595 | 562 | * Gets list of valid enum values for a specific field |
596 | | - * @param category String of category to look up type in |
597 | | - * @param type String of type to look up field in |
598 | | - * @param field String of field to look up values for |
| 563 | + * @param $category String: category to look up type in |
| 564 | + * @param $type String: type to look up field in |
| 565 | + * @param $field String: field to look up values for |
599 | 566 | */ |
600 | | - public static function getEnum( |
601 | | - $category, |
602 | | - $type, |
603 | | - $field |
604 | | - ){ |
| 567 | + public static function getEnum( $category, $type, $field ) { |
605 | 568 | if ( !self::isType( $category, $type ) ) { |
606 | 569 | throw new MWException( |
607 | 570 | $category . '/' . $type . ' is not a valid type' |
— | — | @@ -629,11 +592,9 @@ |
630 | 593 | |
631 | 594 | /** |
632 | 595 | * Checks that a row object represents an existing row in the database |
633 | | - * @param object Subclass of DataCenterDBRow to check |
| 596 | + * @param $object Object: subclass of DataCenterDBRow to check |
634 | 597 | */ |
635 | | - public static function rowExists( |
636 | | - DataCenterDBRow $object |
637 | | - ) { |
| 598 | + public static function rowExists( DataCenterDBRow $object ) { |
638 | 599 | if ( !$object instanceof DataCenterDBRow ) { |
639 | 600 | throw new MWException( |
640 | 601 | 'Object is not an instance of DataCenterDBRow' |
— | — | @@ -658,11 +619,9 @@ |
659 | 620 | |
660 | 621 | /** |
661 | 622 | * Inserts a row in the database based on the contents of a row object |
662 | | - * @param rowObject Subclass of DataCenterDBRow to insert |
| 623 | + * @param $object Object: subclass of DataCenterDBRow to insert |
663 | 624 | */ |
664 | | - public static function insertRow( |
665 | | - $object |
666 | | - ) { |
| 625 | + public static function insertRow( $object ) { |
667 | 626 | if ( !$object instanceof DataCenterDBRow ) { |
668 | 627 | throw new MWException( |
669 | 628 | 'Object is not an instance of DataCenterDBRow' |
— | — | @@ -689,11 +648,9 @@ |
690 | 649 | |
691 | 650 | /** |
692 | 651 | * Updates a row in the database based on the contents of a row object |
693 | | - * @param object Subclass of DataCenterDBRow to update |
| 652 | + * @param $object Object: Subclass of DataCenterDBRow to update |
694 | 653 | */ |
695 | | - public static function updateRow( |
696 | | - $object |
697 | | - ) { |
| 654 | + public static function updateRow( $object ) { |
698 | 655 | if ( !$object instanceof DataCenterDBRow ) { |
699 | 656 | throw new MWException( |
700 | 657 | 'Object is not an instance of DataCenterDBRow' |
— | — | @@ -719,11 +676,9 @@ |
720 | 677 | |
721 | 678 | /** |
722 | 679 | * Deletes a row from the database |
723 | | - * @param rowObject Subclass of DataCenterDBRow to delete |
| 680 | + * @param $object Object: subclass of DataCenterDBRow to delete |
724 | 681 | */ |
725 | | - public static function deleteRow( |
726 | | - $object |
727 | | - ) { |
| 682 | + public static function deleteRow( $object ) { |
728 | 683 | if ( !$object instanceof DataCenterDBRow ) { |
729 | 684 | throw new MWException( |
730 | 685 | 'Object is not an instance of DataCenterDBRow' |
— | — | @@ -754,10 +709,7 @@ |
755 | 710 | * - class as DataCenterDBAsset |
756 | 711 | * - category as asset |
757 | 712 | */ |
758 | | - public static function getAssets( |
759 | | - $type, |
760 | | - array $options = array() |
761 | | - ) { |
| 713 | + public static function getAssets( $type, array $options = array() ) { |
762 | 714 | return self::getRows( 'DataCenterDBAsset', 'asset', $type, $options ); |
763 | 715 | } |
764 | 716 | |
— | — | @@ -766,10 +718,7 @@ |
767 | 719 | * - class as DataCenterDBAsset |
768 | 720 | * - category as asset |
769 | 721 | */ |
770 | | - public static function getAsset( |
771 | | - $type, |
772 | | - $id |
773 | | - ) { |
| 722 | + public static function getAsset( $type, $id ) { |
774 | 723 | return self::getRow( 'DataCenterDBAsset', 'asset', $type, $id ); |
775 | 724 | } |
776 | 725 | |
— | — | @@ -777,10 +726,7 @@ |
778 | 727 | * Wraps self::numRows specializing... |
779 | 728 | * - category as asset |
780 | 729 | */ |
781 | | - public static function numAssets( |
782 | | - $type, |
783 | | - array $options = array() |
784 | | - ) { |
| 730 | + public static function numAssets( $type, array $options = array() ) { |
785 | 731 | return self::numRows( 'asset', $type, $options ); |
786 | 732 | } |
787 | 733 | |
— | — | @@ -791,10 +737,7 @@ |
792 | 738 | * - class as DataCenterDBModel |
793 | 739 | * - category as model |
794 | 740 | */ |
795 | | - public static function getModels( |
796 | | - $type, |
797 | | - array $options = array() |
798 | | - ) { |
| 741 | + public static function getModels( $type, array $options = array() ) { |
799 | 742 | return self::getRows( 'DataCenterDBModel', 'model', $type, $options ); |
800 | 743 | } |
801 | 744 | |
— | — | @@ -803,10 +746,7 @@ |
804 | 747 | * - class as DataCenterDBModel |
805 | 748 | * - category as model |
806 | 749 | */ |
807 | | - public static function getModel( |
808 | | - $type, |
809 | | - $id |
810 | | - ) { |
| 750 | + public static function getModel( $type, $id ) { |
811 | 751 | return self::getRow( 'DataCenterDBModel', 'model', $type, $id ); |
812 | 752 | } |
813 | 753 | |
— | — | @@ -814,10 +754,7 @@ |
815 | 755 | * Wraps self::numRows specializing... |
816 | 756 | * - category as model |
817 | 757 | */ |
818 | | - public static function numModels( |
819 | | - $type, |
820 | | - array $options = array() |
821 | | - ) { |
| 758 | + public static function numModels( $type, array $options = array() ) { |
822 | 759 | return self::numRows( 'model', $type, $options ); |
823 | 760 | } |
824 | 761 | |
— | — | @@ -828,10 +765,7 @@ |
829 | 766 | * - class as DataCenterDBLink |
830 | 767 | * - category as link |
831 | 768 | */ |
832 | | - public static function getLinks( |
833 | | - $type, |
834 | | - array $options = array() |
835 | | - ) { |
| 769 | + public static function getLinks( $type, array $options = array() ) { |
836 | 770 | return self::getRows( 'DataCenterDBLink', 'link', $type, $options ); |
837 | 771 | } |
838 | 772 | |
— | — | @@ -840,10 +774,7 @@ |
841 | 775 | * - class as DataCenterDBLink |
842 | 776 | * - category as link |
843 | 777 | */ |
844 | | - public static function getLink( |
845 | | - $type, |
846 | | - $id |
847 | | - ) { |
| 778 | + public static function getLink( $type, $id ) { |
848 | 779 | return self::getRow( 'DataCenterDBLink', 'link', $type, $id ); |
849 | 780 | } |
850 | 781 | |
— | — | @@ -851,10 +782,7 @@ |
852 | 783 | * Wraps self::numRows specializing... |
853 | 784 | * - category as link |
854 | 785 | */ |
855 | | - public static function numLinks( |
856 | | - $type, |
857 | | - array $options = array() |
858 | | - ) { |
| 786 | + public static function numLinks( $type, array $options = array() ) { |
859 | 787 | return self::numRows( 'link', $type, $options ); |
860 | 788 | } |
861 | 789 | |
— | — | @@ -864,9 +792,7 @@ |
865 | 793 | * - category as link |
866 | 794 | * - type as asset |
867 | 795 | */ |
868 | | - public static function getAssetLinks( |
869 | | - array $options = array() |
870 | | - ) { |
| 796 | + public static function getAssetLinks( array $options = array() ) { |
871 | 797 | return self::getRows( |
872 | 798 | 'DataCenterDBAssetLink', 'link', 'asset', $options |
873 | 799 | ); |
— | — | @@ -878,9 +804,7 @@ |
879 | 805 | * - category as link |
880 | 806 | * - type as asset |
881 | 807 | */ |
882 | | - public static function getAssetLink( |
883 | | - $id |
884 | | - ) { |
| 808 | + public static function getAssetLink( $id ) { |
885 | 809 | return self::getRow( 'DataCenterDBAssetLink', 'link', 'asset', $id ); |
886 | 810 | } |
887 | 811 | |
— | — | @@ -889,9 +813,7 @@ |
890 | 814 | * - category as link |
891 | 815 | * - type as asset |
892 | 816 | */ |
893 | | - public static function numAssetLinks( |
894 | | - array $options = array() |
895 | | - ) { |
| 817 | + public static function numAssetLinks( array $options = array() ) { |
896 | 818 | return self::numRows( 'link', 'asset', $options ); |
897 | 819 | } |
898 | 820 | |
— | — | @@ -901,9 +823,7 @@ |
902 | 824 | * - category as link |
903 | 825 | * - type as model |
904 | 826 | */ |
905 | | - public static function getModelLinks( |
906 | | - array $options = array() |
907 | | - ) { |
| 827 | + public static function getModelLinks( array $options = array() ) { |
908 | 828 | return self::getRows( |
909 | 829 | 'DataCenterDBModelLink', 'link', 'model', $options |
910 | 830 | ); |
— | — | @@ -915,9 +835,7 @@ |
916 | 836 | * - category as link |
917 | 837 | * - type as model |
918 | 838 | */ |
919 | | - public static function getModelLink( |
920 | | - $id |
921 | | - ) { |
| 839 | + public static function getModelLink( $id ) { |
922 | 840 | return self::getRow( 'DataCenterDBModelLink', 'link', 'model', $id ); |
923 | 841 | } |
924 | 842 | |
— | — | @@ -926,9 +844,7 @@ |
927 | 845 | * - category as link |
928 | 846 | * - type as model |
929 | 847 | */ |
930 | | - public static function numModelLinks( |
931 | | - array $options = array() |
932 | | - ) { |
| 848 | + public static function numModelLinks( array $options = array() ) { |
933 | 849 | return self::numRows( 'link', 'model', $options ); |
934 | 850 | } |
935 | 851 | |
— | — | @@ -938,9 +854,7 @@ |
939 | 855 | * - category as link |
940 | 856 | * - type as field |
941 | 857 | */ |
942 | | - public static function getMetaFieldLinks( |
943 | | - array $options = array() |
944 | | - ) { |
| 858 | + public static function getMetaFieldLinks( array $options = array() ) { |
945 | 859 | return self::getRows( 'DataCenterDBMetaFieldLink', 'link', 'field', $options ); |
946 | 860 | } |
947 | 861 | |
— | — | @@ -950,9 +864,7 @@ |
951 | 865 | * - category as link |
952 | 866 | * - type as field |
953 | 867 | */ |
954 | | - public static function getMetaFieldLink( |
955 | | - $id |
956 | | - ) { |
| 868 | + public static function getMetaFieldLink( $id ) { |
957 | 869 | return self::getRow( 'DataCenterDBMetaFieldLink', 'link', 'field', $id ); |
958 | 870 | } |
959 | 871 | |
— | — | @@ -961,9 +873,7 @@ |
962 | 874 | * - category as link |
963 | 875 | * - type as field |
964 | 876 | */ |
965 | | - public static function numMetaFieldLinks( |
966 | | - array $options = array() |
967 | | - ) { |
| 877 | + public static function numMetaFieldLinks( array $options = array() ) { |
968 | 878 | return self::numRows( 'link', 'field', $options ); |
969 | 879 | } |
970 | 880 | |
— | — | @@ -975,9 +885,7 @@ |
976 | 886 | * - category as facility |
977 | 887 | * - type as location |
978 | 888 | */ |
979 | | - public static function getLocations( |
980 | | - array $options = array() |
981 | | - ) { |
| 889 | + public static function getLocations( array $options = array() ) { |
982 | 890 | return self::getRows( |
983 | 891 | 'DataCenterDBLocation', 'facility', 'location', $options |
984 | 892 | ); |
— | — | @@ -989,9 +897,7 @@ |
990 | 898 | * - category as facility |
991 | 899 | * - type as location |
992 | 900 | */ |
993 | | - public static function getLocation( |
994 | | - $id |
995 | | - ) { |
| 901 | + public static function getLocation( $id ) { |
996 | 902 | return self::getRow( |
997 | 903 | 'DataCenterDBLocation', 'facility', 'location', $id |
998 | 904 | ); |
— | — | @@ -1002,9 +908,7 @@ |
1003 | 909 | * - category as facility |
1004 | 910 | * - type as location |
1005 | 911 | */ |
1006 | | - public static function numLocations( |
1007 | | - array $options = array() |
1008 | | - ) { |
| 912 | + public static function numLocations( array $options = array() ) { |
1009 | 913 | return self::numRows( 'facility', 'location', $options ); |
1010 | 914 | } |
1011 | 915 | |
— | — | @@ -1014,9 +918,7 @@ |
1015 | 919 | * - category as facility |
1016 | 920 | * - type as space |
1017 | 921 | */ |
1018 | | - public static function getSpaces( |
1019 | | - array $options = array() |
1020 | | - ) { |
| 922 | + public static function getSpaces( array $options = array() ) { |
1021 | 923 | return self::getRows( |
1022 | 924 | 'DataCenterDBSpace', 'facility', 'space', $options |
1023 | 925 | ); |
— | — | @@ -1028,9 +930,7 @@ |
1029 | 931 | * - category as facility |
1030 | 932 | * - type as space |
1031 | 933 | */ |
1032 | | - public static function getSpace( |
1033 | | - $id |
1034 | | - ) { |
| 934 | + public static function getSpace( $id ) { |
1035 | 935 | return self::getRow( |
1036 | 936 | 'DataCenterDBSpace', 'facility', 'space', $id |
1037 | 937 | ); |
— | — | @@ -1041,9 +941,7 @@ |
1042 | 942 | * - category as facility |
1043 | 943 | * - type as space |
1044 | 944 | */ |
1045 | | - public static function numSpaces( |
1046 | | - array $options = array() |
1047 | | - ) { |
| 945 | + public static function numSpaces( array $options = array() ) { |
1048 | 946 | return self::numRows( 'facility', 'space', $options ); |
1049 | 947 | } |
1050 | 948 | |
— | — | @@ -1055,9 +953,7 @@ |
1056 | 954 | * - category as meta |
1057 | 955 | * - type as plan |
1058 | 956 | */ |
1059 | | - public static function getPlans( |
1060 | | - array $options = array() |
1061 | | - ) { |
| 957 | + public static function getPlans( array $options = array() ) { |
1062 | 958 | return self::getRows( |
1063 | 959 | 'DataCenterDBPlan', |
1064 | 960 | 'meta', |
— | — | @@ -1079,9 +975,7 @@ |
1080 | 976 | * - category as meta |
1081 | 977 | * - type as plan |
1082 | 978 | */ |
1083 | | - public static function getPlan( |
1084 | | - $id |
1085 | | - ) { |
| 979 | + public static function getPlan( $id ) { |
1086 | 980 | return self::getRow( |
1087 | 981 | 'DataCenterDBPlan', |
1088 | 982 | 'meta', |
— | — | @@ -1100,9 +994,7 @@ |
1101 | 995 | * - category as meta |
1102 | 996 | * - type as plan |
1103 | 997 | */ |
1104 | | - public static function numPlans( |
1105 | | - array $options = array() |
1106 | | - ) { |
| 998 | + public static function numPlans( array $options = array() ) { |
1107 | 999 | return self::numRows( 'meta', 'plan', $options ); |
1108 | 1000 | } |
1109 | 1001 | |
— | — | @@ -1112,9 +1004,7 @@ |
1113 | 1005 | * - category as meta |
1114 | 1006 | * - type as change |
1115 | 1007 | */ |
1116 | | - public static function getChanges( |
1117 | | - array $options = array() |
1118 | | - ) { |
| 1008 | + public static function getChanges( array $options = array() ) { |
1119 | 1009 | return self::getRows( |
1120 | 1010 | 'DataCenterDBChange', |
1121 | 1011 | 'meta', |
— | — | @@ -1149,10 +1039,7 @@ |
1150 | 1040 | * - category as meta |
1151 | 1041 | * - type as change |
1152 | 1042 | */ |
1153 | | - public static function getChange( |
1154 | | - $id, |
1155 | | - array $options = array() |
1156 | | - ) { |
| 1043 | + public static function getChange( $id, array $options = array() ) { |
1157 | 1044 | return self::getRow( |
1158 | 1045 | 'DataCenterDBChange', |
1159 | 1046 | 'meta', |
— | — | @@ -1187,9 +1074,7 @@ |
1188 | 1075 | * - category as meta |
1189 | 1076 | * - type as change |
1190 | 1077 | */ |
1191 | | - public static function numChanges( |
1192 | | - array $options = array() |
1193 | | - ) { |
| 1078 | + public static function numChanges( array $options = array() ) { |
1194 | 1079 | return self::numRows( 'meta', 'change', $options ); |
1195 | 1080 | } |
1196 | 1081 | |
— | — | @@ -1199,9 +1084,7 @@ |
1200 | 1085 | * - category as meta |
1201 | 1086 | * - type as field |
1202 | 1087 | */ |
1203 | | - public static function getMetaFields( |
1204 | | - array $options = array() |
1205 | | - ) { |
| 1088 | + public static function getMetaFields( array $options = array() ) { |
1206 | 1089 | return self::getRows( |
1207 | 1090 | 'DataCenterDBMetaField', 'meta', 'field', $options |
1208 | 1091 | ); |
— | — | @@ -1213,9 +1096,7 @@ |
1214 | 1097 | * - category as meta |
1215 | 1098 | * - type as field |
1216 | 1099 | */ |
1217 | | - public static function getMetaField( |
1218 | | - $id |
1219 | | - ) { |
| 1100 | + public static function getMetaField( $id ) { |
1220 | 1101 | return self::getRow( |
1221 | 1102 | 'DataCenterDBMetaField', 'meta', 'field', $id |
1222 | 1103 | ); |
— | — | @@ -1226,9 +1107,7 @@ |
1227 | 1108 | * - category as meta |
1228 | 1109 | * - type as field |
1229 | 1110 | */ |
1230 | | - public static function numMetaFields( |
1231 | | - array $options = array() |
1232 | | - ) { |
| 1111 | + public static function numMetaFields( array $options = array() ) { |
1233 | 1112 | return self::numRows( 'meta', 'field', $options ); |
1234 | 1113 | } |
1235 | 1114 | |
— | — | @@ -1238,9 +1117,7 @@ |
1239 | 1118 | * - category as meta |
1240 | 1119 | * - type as value |
1241 | 1120 | */ |
1242 | | - public static function getMetaValues( |
1243 | | - array $options = array() |
1244 | | - ) { |
| 1121 | + public static function getMetaValues( array $options = array() ) { |
1245 | 1122 | return self::getRows( |
1246 | 1123 | 'DataCenterDBMetaValue', 'meta', 'value', $options |
1247 | 1124 | ); |
— | — | @@ -1252,9 +1129,7 @@ |
1253 | 1130 | * - category as meta |
1254 | 1131 | * - type as value |
1255 | 1132 | */ |
1256 | | - public static function getMetaValue( |
1257 | | - $id |
1258 | | - ) { |
| 1133 | + public static function getMetaValue( $id ) { |
1259 | 1134 | return self::getRow( |
1260 | 1135 | 'DataCenterDBMetaValue', 'meta', 'value', $id |
1261 | 1136 | ); |
— | — | @@ -1265,9 +1140,7 @@ |
1266 | 1141 | * - category as meta |
1267 | 1142 | * - type as value |
1268 | 1143 | */ |
1269 | | - public static function numMetaValues( |
1270 | | - array $options = array() |
1271 | | - ) { |
| 1144 | + public static function numMetaValues( array $options = array() ) { |
1272 | 1145 | return self::numRows( 'meta', 'value', $options ); |
1273 | 1146 | } |
1274 | 1147 | |
— | — | @@ -1275,15 +1148,11 @@ |
1276 | 1149 | |
1277 | 1150 | /** |
1278 | 1151 | * Builds array of options which specify fields to sort results by |
1279 | | - * @param category String of category to lookup type in |
1280 | | - * @param type String of category to lookup fields in |
1281 | | - * @param fields String or Array of Strings of fields to sort by |
| 1152 | + * @param $category String: category to lookup type in |
| 1153 | + * @param $type String: category to lookup fields in |
| 1154 | + * @param $fields String or Array of Strings of fields to sort by |
1282 | 1155 | */ |
1283 | | - public static function buildSort( |
1284 | | - $category, |
1285 | | - $type, |
1286 | | - $fields |
1287 | | - ) { |
| 1156 | + public static function buildSort( $category, $type, $fields ) { |
1288 | 1157 | $columns = array(); |
1289 | 1158 | if ( !is_array( $fields ) ) { |
1290 | 1159 | $fields = array( $fields ); |
— | — | @@ -1382,11 +1251,9 @@ |
1383 | 1252 | |
1384 | 1253 | /** |
1385 | 1254 | * Builds array of options which specify limit and offset |
1386 | | - * @param path Array of link parameters |
| 1255 | + * @param $path Array: array of link parameters |
1387 | 1256 | */ |
1388 | | - public static function buildRange( |
1389 | | - $path |
1390 | | - ) { |
| 1257 | + public static function buildRange( $path ) { |
1391 | 1258 | if ( !isset( $path['limit'] ) || $path['limit'] == null ) { |
1392 | 1259 | $path['limit'] = 10; |
1393 | 1260 | } |
— | — | @@ -1404,17 +1271,12 @@ |
1405 | 1272 | /** |
1406 | 1273 | * Builds array of options which match a query against a number of fields |
1407 | 1274 | * using case-insensitive partial matching |
1408 | | - * @param category String of category to lookup type in |
1409 | | - * @param type String of category to lookup fields in |
1410 | | - * @param fields String of field to match query with |
1411 | | - * @param value String of query to match to field value |
| 1275 | + * @param $category String: category to lookup type in |
| 1276 | + * @param $type String: category to lookup fields in |
| 1277 | + * @param $fields String: field to match query with |
| 1278 | + * @param $query String: query to match to field value |
1412 | 1279 | */ |
1413 | | - public static function buildMatch( |
1414 | | - $category, |
1415 | | - $type, |
1416 | | - $fields, |
1417 | | - $query |
1418 | | - ) { |
| 1280 | + public static function buildMatch( $category, $type, $fields, $query ) { |
1419 | 1281 | $dbr = wfGetDB( DB_SLAVE ); |
1420 | 1282 | $conditions = array(); |
1421 | 1283 | if ( !is_array( $fields ) ) { |
— | — | @@ -1433,13 +1295,10 @@ |
1434 | 1296 | /** |
1435 | 1297 | * Creates and returns an associative array of rows keyed by a specific |
1436 | 1298 | * field, for use as a lookup table or to divide rows into groups |
1437 | | - * @param field String of name of field to use as key |
1438 | | - * @param rows Array of DataCenterDBRow objects to process |
| 1299 | + * @param $field String: name of field to use as key |
| 1300 | + * @param $rows Array: DataCenterDBRow objects to process |
1439 | 1301 | */ |
1440 | | - public static function buildLookupTable( |
1441 | | - $field, |
1442 | | - array $rows |
1443 | | - ) { |
| 1302 | + public static function buildLookupTable( $field, array $rows ) { |
1444 | 1303 | if ( !is_scalar( $field ) && $field !== null ) { |
1445 | 1304 | throw new MWException( |
1446 | 1305 | $field . ' is not a field for table keys to be made from' |
— | — | @@ -1515,11 +1374,7 @@ |
1516 | 1375 | * @param row Optional Associative Array of column and value |
1517 | 1376 | * pairs to use as initial data overriding defaults |
1518 | 1377 | */ |
1519 | | - public function __construct( |
1520 | | - $category, |
1521 | | - $type, |
1522 | | - array $row = array() |
1523 | | - ) { |
| 1378 | + public function __construct( $category, $type, array $row = array() ) { |
1524 | 1379 | $this->category = $category; |
1525 | 1380 | $this->type = $type; |
1526 | 1381 | $this->set( DataCenterDB::getRowDefaults( $category, $type ) ); |
— | — | @@ -1537,9 +1392,7 @@ |
1538 | 1393 | /** |
1539 | 1394 | * Sets row data from an Associative Array of column and value pairs |
1540 | 1395 | */ |
1541 | | - public function setRow( |
1542 | | - array $row = array() |
1543 | | - ) { |
| 1396 | + public function setRow( array $row = array() ) { |
1544 | 1397 | $this->row = count( $row ) > 0 ? $row : null; |
1545 | 1398 | } |
1546 | 1399 | |
— | — | @@ -1578,9 +1431,7 @@ |
1579 | 1432 | * Gets fully prefixed column name from simplified field name |
1580 | 1433 | * @param fieldName String of name of field to lookup |
1581 | 1434 | */ |
1582 | | - public function getColumnName( |
1583 | | - $fieldName |
1584 | | - ) { |
| 1435 | + public function getColumnName( $fieldName ) { |
1585 | 1436 | return DataCenterDB::getColumnName( |
1586 | 1437 | $this->category, $this->type, $fieldName |
1587 | 1438 | ); |
— | — | @@ -1590,9 +1441,7 @@ |
1591 | 1442 | * Gets simplified field name from fully prefixed column name |
1592 | 1443 | * @param columnName String of name of column to lookup |
1593 | 1444 | */ |
1594 | | - public function getFieldName( |
1595 | | - $columnName |
1596 | | - ) { |
| 1445 | + public function getFieldName( $columnName ) { |
1597 | 1446 | return DataCenterDB::getFieldName( |
1598 | 1447 | $this->category, $this->type, $columnName |
1599 | 1448 | ); |
— | — | @@ -1622,11 +1471,7 @@ |
1623 | 1472 | * passed, all fields will be returned as an Associative |
1624 | 1473 | * Array. |
1625 | 1474 | */ |
1626 | | - public function get( |
1627 | | - $category = null, |
1628 | | - $type = null, |
1629 | | - $field = null |
1630 | | - ) { |
| 1475 | + public function get( $category = null, $type = null, $field = null ) { |
1631 | 1476 | if ( $category === null && $type === null && $field === null ) { |
1632 | 1477 | $category = $this->category; |
1633 | 1478 | $type = $this->type; |
— | — | @@ -1653,7 +1498,7 @@ |
1654 | 1499 | } |
1655 | 1500 | } |
1656 | 1501 | return $results; |
1657 | | - } else if ( is_array( $field ) ) { |
| 1502 | + } elseif ( is_array( $field ) ) { |
1658 | 1503 | $results = array(); |
1659 | 1504 | foreach ( $field as $fieldName ) { |
1660 | 1505 | $columnName = DataCenterDB::getColumnName( |
— | — | @@ -1687,10 +1532,7 @@ |
1688 | 1533 | * Array of field and value pairs |
1689 | 1534 | * @param value Optional Scalar of value to set |
1690 | 1535 | */ |
1691 | | - public function set( |
1692 | | - $column, |
1693 | | - $value = null |
1694 | | - ) { |
| 1536 | + public function set( $column, $value = null ) { |
1695 | 1537 | if ( is_array( $column ) ) { |
1696 | 1538 | foreach ( $column as $name => $value ) { |
1697 | 1539 | $columnName = $this->getColumnName( $name ); |
— | — | @@ -1749,9 +1591,7 @@ |
1750 | 1592 | /** |
1751 | 1593 | * Gets changes that reference this object by category, type, and ID |
1752 | 1594 | */ |
1753 | | - public function getChanges( |
1754 | | - array $options = array() |
1755 | | - ) { |
| 1595 | + public function getChanges( array $options = array() ) { |
1756 | 1596 | return DataCenterDB::getChanges( |
1757 | 1597 | array_merge_recursive( |
1758 | 1598 | $options, |
— | — | @@ -1768,9 +1608,7 @@ |
1769 | 1609 | ); |
1770 | 1610 | } |
1771 | 1611 | |
1772 | | - public function numChanges( |
1773 | | - array $options = array() |
1774 | | - ) { |
| 1612 | + public function numChanges( array $options = array() ) { |
1775 | 1613 | return DataCenterDB::numChanges( |
1776 | 1614 | array_merge_recursive( |
1777 | 1615 | $options, |
— | — | @@ -1787,9 +1625,7 @@ |
1788 | 1626 | ); |
1789 | 1627 | } |
1790 | 1628 | |
1791 | | - public function saveMetaValues( |
1792 | | - $values = null |
1793 | | - ) { |
| 1629 | + public function saveMetaValues( $values = null ) { |
1794 | 1630 | if ( !is_array( $values ) ) { |
1795 | 1631 | return; |
1796 | 1632 | } |
— | — | @@ -1823,9 +1659,7 @@ |
1824 | 1660 | } |
1825 | 1661 | } |
1826 | 1662 | |
1827 | | - public function insertChange( |
1828 | | - $values |
1829 | | - ) { |
| 1663 | + public function insertChange( $values ) { |
1830 | 1664 | if ( !is_array( $values ) ) { |
1831 | 1665 | return; |
1832 | 1666 | } |
— | — | @@ -1926,10 +1760,7 @@ |
1927 | 1761 | * - category as asset |
1928 | 1762 | * - type as rack |
1929 | 1763 | */ |
1930 | | - public static function newFromType( |
1931 | | - $type, |
1932 | | - array $values = array() |
1933 | | - ) { |
| 1764 | + public static function newFromType( $type, array $values = array() ) { |
1934 | 1765 | return parent::newFromClass( __CLASS__, 'asset', $type, $values ); |
1935 | 1766 | } |
1936 | 1767 | |
— | — | @@ -1965,10 +1796,7 @@ |
1966 | 1797 | * - class as DataCenterDBModel |
1967 | 1798 | * - category as model |
1968 | 1799 | */ |
1969 | | - public static function newFromType( |
1970 | | - $type, |
1971 | | - array $values = array() |
1972 | | - ) { |
| 1800 | + public static function newFromType( $type, array $values = array() ) { |
1973 | 1801 | return parent::newFromClass( __CLASS__, 'model', $type, $values ); |
1974 | 1802 | } |
1975 | 1803 | |
— | — | @@ -2031,9 +1859,7 @@ |
2032 | 1860 | * - category as link |
2033 | 1861 | * - type as asset |
2034 | 1862 | */ |
2035 | | - public static function newFromValues( |
2036 | | - array $values = array() |
2037 | | - ) { |
| 1863 | + public static function newFromValues( array $values = array() ) { |
2038 | 1864 | return parent::newFromClass( __CLASS__, 'link', 'asset', $values ); |
2039 | 1865 | } |
2040 | 1866 | |
— | — | @@ -2042,9 +1868,7 @@ |
2043 | 1869 | /** |
2044 | 1870 | * Gets flat list of links |
2045 | 1871 | */ |
2046 | | - public function getLinks( |
2047 | | - array $options = array() |
2048 | | - ) { |
| 1872 | + public function getLinks( array $options = array() ) { |
2049 | 1873 | if ( !$this->links ) { |
2050 | 1874 | $links = DataCenterDB::getAssetLinks( |
2051 | 1875 | DataCenterDB::buildCondition( |
— | — | @@ -2081,12 +1905,10 @@ |
2082 | 1906 | |
2083 | 1907 | /** |
2084 | 1908 | * Builds structure of links recursively using list of links |
2085 | | - * @param links Array of DataCenterDBAssetLink to use as source |
2086 | | - * for recursive structure construction |
| 1909 | + * @param $links Array: DataCenterDBAssetLink to use as source for |
| 1910 | + * recursive structure construction |
2087 | 1911 | */ |
2088 | | - public function buildStructure( |
2089 | | - array $links |
2090 | | - ) { |
| 1912 | + public function buildStructure( array $links ) { |
2091 | 1913 | $id = $this->getId(); |
2092 | 1914 | foreach ( $links as $key => $link ) { |
2093 | 1915 | if ( $link->get( 'parent_link' ) == $id ) { |
— | — | @@ -2113,9 +1935,7 @@ |
2114 | 1936 | * - category as link |
2115 | 1937 | * - type as model |
2116 | 1938 | */ |
2117 | | - public static function newFromValues( |
2118 | | - array $values = array() |
2119 | | - ) { |
| 1939 | + public static function newFromValues( array $values = array() ) { |
2120 | 1940 | return parent::newFromClass( __CLASS__, 'link', 'model', $values ); |
2121 | 1941 | } |
2122 | 1942 | |
— | — | @@ -2124,10 +1944,7 @@ |
2125 | 1945 | * @param parent DataCenterDBModel to set as parent |
2126 | 1946 | * @param child DataCenterDBModel to set as child |
2127 | 1947 | */ |
2128 | | - public static function newFromModels( |
2129 | | - $parent, |
2130 | | - $child |
2131 | | - ) { |
| 1948 | + public static function newFromModels( $parent, $child ) { |
2132 | 1949 | if ( !( $parent instanceof DataCenterDBModel ) ) { |
2133 | 1950 | throw new MWException( |
2134 | 1951 | 'Parent object is not compatible with DataCenterDBModel' |
— | — | @@ -2170,9 +1987,7 @@ |
2171 | 1988 | * - category as link |
2172 | 1989 | * - type as field |
2173 | 1990 | */ |
2174 | | - public static function newFromValues( |
2175 | | - array $values = array() |
2176 | | - ) { |
| 1991 | + public static function newFromValues( array $values = array() ) { |
2177 | 1992 | return parent::newFromClass( __CLASS__, 'link', 'field', $values ); |
2178 | 1993 | } |
2179 | 1994 | |
— | — | @@ -2235,9 +2050,7 @@ |
2236 | 2051 | * - category as facility |
2237 | 2052 | * - type as location |
2238 | 2053 | */ |
2239 | | - public static function newFromValues( |
2240 | | - array $values = array() |
2241 | | - ) { |
| 2054 | + public static function newFromValues( array $values = array() ) { |
2242 | 2055 | return parent::newFromClass( |
2243 | 2056 | __CLASS__, 'facility', 'location', $values |
2244 | 2057 | ); |
— | — | @@ -2245,9 +2058,7 @@ |
2246 | 2059 | |
2247 | 2060 | /* Functions */ |
2248 | 2061 | |
2249 | | - public function getSpaces( |
2250 | | - array $options = array() |
2251 | | - ) { |
| 2062 | + public function getSpaces( array $options = array() ) { |
2252 | 2063 | return DataCenterDB::getRows( |
2253 | 2064 | __CLASS__, |
2254 | 2065 | 'facility', |
— | — | @@ -2272,15 +2083,11 @@ |
2273 | 2084 | * - category as facility |
2274 | 2085 | * - type as space |
2275 | 2086 | */ |
2276 | | - public static function newFromValues( |
2277 | | - array $values = array() |
2278 | | - ) { |
| 2087 | + public static function newFromValues( array $values = array() ) { |
2279 | 2088 | return parent::newFromClass( __CLASS__, 'facility', 'space', $values ); |
2280 | 2089 | } |
2281 | 2090 | |
2282 | | - public function getPlans( |
2283 | | - array $options = array() |
2284 | | - ) { |
| 2091 | + public function getPlans( array $options = array() ) { |
2285 | 2092 | if ( $this->type == 'space' ) { |
2286 | 2093 | return DataCenterDB::getPlans( |
2287 | 2094 | array_merge_recursive( |
— | — | @@ -2311,17 +2118,13 @@ |
2312 | 2119 | * - category as meta |
2313 | 2120 | * - type as field |
2314 | 2121 | */ |
2315 | | - public static function newFromValues( |
2316 | | - array $values = array() |
2317 | | - ) { |
| 2122 | + public static function newFromValues( array $values = array() ) { |
2318 | 2123 | return parent::newFromClass( __CLASS__, 'meta', 'field', $values ); |
2319 | 2124 | } |
2320 | 2125 | |
2321 | 2126 | /* Functions */ |
2322 | 2127 | |
2323 | | - public function getLinks( |
2324 | | - array $options = array() |
2325 | | - ) { |
| 2128 | + public function getLinks( array $options = array() ) { |
2326 | 2129 | return DataCenterDB::getMetaFieldLinks( |
2327 | 2130 | array_merge_recursive( |
2328 | 2131 | $options, |
— | — | @@ -2359,9 +2162,7 @@ |
2360 | 2163 | * - category as meta |
2361 | 2164 | * - type as value |
2362 | 2165 | */ |
2363 | | - public static function newFromValues( |
2364 | | - array $values = array() |
2365 | | - ) { |
| 2166 | + public static function newFromValues( array $values = array() ) { |
2366 | 2167 | return parent::newFromClass( __CLASS__, 'meta', 'value', $values ); |
2367 | 2168 | } |
2368 | 2169 | |
— | — | @@ -2398,9 +2199,7 @@ |
2399 | 2200 | * - category as meta |
2400 | 2201 | * - type as change |
2401 | 2202 | */ |
2402 | | - public static function newFromValues( |
2403 | | - array $values = array() |
2404 | | - ) { |
| 2203 | + public static function newFromValues( array $values = array() ) { |
2405 | 2204 | return parent::newFromClass( __CLASS__, 'meta', 'change', $values ); |
2406 | 2205 | } |
2407 | 2206 | |
— | — | @@ -2446,9 +2245,7 @@ |
2447 | 2246 | * - category as meta |
2448 | 2247 | * - type as plan |
2449 | 2248 | */ |
2450 | | - public static function newFromValues( |
2451 | | - array $values = array() |
2452 | | - ) { |
| 2249 | + public static function newFromValues( array $values = array() ) { |
2453 | 2250 | return parent::newFromClass( __CLASS__, 'meta', 'plan', $values ); |
2454 | 2251 | } |
2455 | 2252 | |
— | — | @@ -2466,9 +2263,7 @@ |
2467 | 2264 | /** |
2468 | 2265 | * Gets flat list of links |
2469 | 2266 | */ |
2470 | | - public function getLinks( |
2471 | | - array $options = array() |
2472 | | - ) { |
| 2267 | + public function getLinks( array $options = array() ) { |
2473 | 2268 | if ( !$this->links ) { |
2474 | 2269 | $this->links = DataCenterDB::getAssetLinks( |
2475 | 2270 | DataCenterDB::buildCondition( |
— | — | @@ -2482,9 +2277,7 @@ |
2483 | 2278 | /** |
2484 | 2279 | * Gets structure of links |
2485 | 2280 | */ |
2486 | | - public function getStructure( |
2487 | | - array $options = array() |
2488 | | - ) { |
| 2281 | + public function getStructure( array $options = array() ) { |
2489 | 2282 | if ( !$this->structure ) { |
2490 | 2283 | $links = DataCenterDB::getRows( |
2491 | 2284 | 'DataCenterDBAssetLink', |
Index: trunk/extensions/DataCenter/DataCenter.js |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * |
13 | 13 | */ |
14 | 14 | function DataCenterRenderer() { |
15 | | - |
| 15 | + |
16 | 16 | /* Private Members */ |
17 | 17 | |
18 | 18 | var self = this; |
— | — | @@ -25,9 +25,7 @@ |
26 | 26 | * Gets a reference to a target by it's id |
27 | 27 | * @param target String or Integer of ID of target |
28 | 28 | */ |
29 | | - this.getTarget = function( |
30 | | - target |
31 | | - ) { |
| 29 | + this.getTarget = function( target ) { |
32 | 30 | if ( targets[target] !== undefined ) { |
33 | 31 | return targets[target]; |
34 | 32 | } |
— | — | @@ -38,10 +36,7 @@ |
39 | 37 | * @param type A function object which will be created and then passed |
40 | 38 | * to each job for each target |
41 | 39 | */ |
42 | | - this.addQueue = function( |
43 | | - queue, |
44 | | - type |
45 | | - ) { |
| 40 | + this.addQueue = function( queue, type ) { |
46 | 41 | queues[queue] = type; |
47 | 42 | } |
48 | 43 | /** |
— | — | @@ -49,11 +44,7 @@ |
50 | 45 | * @param queue String of name of rendering system used to reference it |
51 | 46 | * @param target String of XML ID of element to perform this job for |
52 | 47 | */ |
53 | | - this.addJob = function( |
54 | | - queue, |
55 | | - target, |
56 | | - job |
57 | | - ) { |
| 48 | + this.addJob = function( queue, target, job ) { |
58 | 49 | if ( jobs[queue] === undefined ) { |
59 | 50 | jobs[queue] = {}; |
60 | 51 | } |
— | — | @@ -107,7 +98,7 @@ |
108 | 99 | * which can be added, accessed and removed during run-time. |
109 | 100 | */ |
110 | 101 | function DataCenterPool() { |
111 | | - |
| 102 | + |
112 | 103 | /* Private Members */ |
113 | 104 | |
114 | 105 | var self = this; |
— | — | @@ -120,9 +111,7 @@ |
121 | 112 | * Adds an object to pool, and returns it's unique ID |
122 | 113 | * @param object Object reference to add |
123 | 114 | */ |
124 | | - this.addObject = function( |
125 | | - object |
126 | | - ) { |
| 115 | + this.addObject = function( object ) { |
127 | 116 | var id = count++; |
128 | 117 | objects[id] = object; |
129 | 118 | return id; |
— | — | @@ -131,9 +120,7 @@ |
132 | 121 | * Removes an object form pool |
133 | 122 | * @param id ID number of object to remove |
134 | 123 | */ |
135 | | - this.removeObject = function( |
136 | | - id |
137 | | - ) { |
| 124 | + this.removeObject = function( id ) { |
138 | 125 | if ( objects[id] !== undefined ) { |
139 | 126 | delete objects[id]; |
140 | 127 | } |
— | — | @@ -142,9 +129,7 @@ |
143 | 130 | * Gets an object from pool |
144 | 131 | * @param id ID number of object to get |
145 | 132 | */ |
146 | | - this.getObject = function( |
147 | | - id |
148 | | - ) { |
| 133 | + this.getObject = function( id ) { |
149 | 134 | if ( objects[id] !== undefined ) { |
150 | 135 | return objects[id]; |
151 | 136 | } |
— | — | @@ -155,12 +140,9 @@ |
156 | 141 | * @param target The XML ID of a DIV in which a plan should be rendered |
157 | 142 | * into. |
158 | 143 | */ |
159 | | -function DataCenterScene( |
160 | | - target |
161 | | -) { |
162 | | - |
| 144 | +function DataCenterScene( target ) { |
163 | 145 | /* Private Members */ |
164 | | - |
| 146 | + |
165 | 147 | // Reference to itself |
166 | 148 | var self = this; |
167 | 149 | // Colors used in rendering |
— | — | @@ -175,9 +157,9 @@ |
176 | 158 | var features = { |
177 | 159 | radialGradient: true |
178 | 160 | }; |
179 | | - |
| 161 | + |
180 | 162 | /* Configuration */ |
181 | | - |
| 163 | + |
182 | 164 | // Gets target element |
183 | 165 | var element = document.getElementById( target ); |
184 | 166 | // Sets element's background color so there's consistency when resizing |
— | — | @@ -206,9 +188,9 @@ |
207 | 189 | 'click', |
208 | 190 | new Function( target + ".getModule().click();" ) |
209 | 191 | ); |
210 | | - |
| 192 | + |
211 | 193 | /* Public Functions */ |
212 | | - |
| 194 | + |
213 | 195 | /** |
214 | 196 | * Checks if scene that rack is part of is live |
215 | 197 | */ |
— | — | @@ -245,10 +227,7 @@ |
246 | 228 | * @param newModule Object of scene compatible module to render |
247 | 229 | * @param update Boolean flag indicating desire to re-render now |
248 | 230 | */ |
249 | | - this.setModule = function ( |
250 | | - newModule, |
251 | | - update |
252 | | - ) { |
| 231 | + this.setModule = function( newModule, update ) { |
253 | 232 | newModule.setScene( self ); |
254 | 233 | module = newModule; |
255 | 234 | // Automatically re-render |
— | — | @@ -258,9 +237,7 @@ |
259 | 238 | * Re-renders scene |
260 | 239 | * @param update Boolean flag indicating desire to re-render now |
261 | 240 | */ |
262 | | - this.update = function ( |
263 | | - update |
264 | | - ) { |
| 241 | + this.update = function( update ) { |
265 | 242 | // Check if scene is live and update flag is set |
266 | 243 | if ( self.isLive() && update ) { |
267 | 244 | // Renders scene |
— | — | @@ -304,9 +281,7 @@ |
305 | 282 | /** |
306 | 283 | * Abstraction for a Google Maps object |
307 | 284 | */ |
308 | | -function DataCenterMap( |
309 | | - target |
310 | | -) { |
| 285 | +function DataCenterMap( target ) { |
311 | 286 | // Checks that browser is compatible with Google Maps |
312 | 287 | if ( !GBrowserIsCompatible() ) { |
313 | 288 | return; |
— | — | @@ -338,11 +313,7 @@ |
339 | 314 | * content String of content to place in info window (optional) |
340 | 315 | * popup Boolean of whether to initially show info window |
341 | 316 | */ |
342 | | - this.addMarker = function( |
343 | | - lat, |
344 | | - lng, |
345 | | - options |
346 | | - ) { |
| 317 | + this.addMarker = function( lat, lng, options ) { |
347 | 318 | var marker = new GMarker( new GLatLng( lat, lng ) ); |
348 | 319 | map.addOverlay( marker ); |
349 | 320 | if ( options && options.content ) { |
— | — | @@ -366,10 +337,7 @@ |
367 | 338 | * latField Object reference of XML form element to update |
368 | 339 | * lngField Object reference of XML form element to update |
369 | 340 | */ |
370 | | - this.showAddress = function( |
371 | | - address, |
372 | | - options |
373 | | - ) { |
| 341 | + this.showAddress = function( address, options ) { |
374 | 342 | // Adds this object to pool and gets it's ID |
375 | 343 | poolID = dataCenter.pool.addObject( self ); |
376 | 344 | // Stores the options last used for later reference |
— | — | @@ -385,9 +353,7 @@ |
386 | 354 | * Response to address lookup which is called asynchronously |
387 | 355 | * @param point GPoint object of address lookup result |
388 | 356 | */ |
389 | | - this.respond = function( |
390 | | - point |
391 | | - ) { |
| 357 | + this.respond = function( point ) { |
392 | 358 | if ( point ) { |
393 | 359 | map.setCenter( point, 14 ); |
394 | 360 | map.clearOverlays(); |
— | — | @@ -417,11 +383,7 @@ |
418 | 384 | * content String of content to place in info window (optional) |
419 | 385 | * popup Boolean of whether to initially show info window |
420 | 386 | */ |
421 | | - this.showPosition = function( |
422 | | - lat, |
423 | | - lng, |
424 | | - options |
425 | | - ) { |
| 387 | + this.showPosition = function( lat, lng, options ) { |
426 | 388 | var point = new GLatLng( lat, lng ); |
427 | 389 | map.setCenter( point, 14 ); |
428 | 390 | map.clearOverlays(); |
— | — | @@ -438,8 +400,8 @@ |
439 | 401 | dataCenter.ui.layouts = {}; |
440 | 402 | dataCenter.ui.widgets = {}; |
441 | 403 | // Adds hooks that cause dataCenter systems to react to window events |
442 | | -hookEvent( "load", dataCenter.renderer.setup ); |
443 | | -hookEvent( "resize", dataCenter.renderer.render ); |
| 404 | +hookEvent( 'load', dataCenter.renderer.setup ); |
| 405 | +hookEvent( 'resize', dataCenter.renderer.render ); |
444 | 406 | // Adds rendering queues for scene system |
445 | 407 | dataCenter.renderer.addQueue( 'scene', DataCenterScene ); |
446 | 408 | // Adds rendering queues for map system |
Index: trunk/extensions/DataCenter/DataCenter.page.php |
— | — | @@ -17,9 +17,7 @@ |
18 | 18 | |
19 | 19 | /* Abstract Functions */ |
20 | 20 | |
21 | | - public abstract function __construct( |
22 | | - array $path |
23 | | - ); |
| 21 | + public abstract function __construct( array $path ); |
24 | 22 | } |
25 | 23 | |
26 | 24 | abstract class DataCenterView { |
— | — | @@ -30,9 +28,7 @@ |
31 | 29 | |
32 | 30 | /* Functions */ |
33 | 31 | |
34 | | - public function __construct( |
35 | | - $controller |
36 | | - ) { |
| 32 | + public function __construct( $controller ) { |
37 | 33 | $this->controller = $controller; |
38 | 34 | } |
39 | 35 | } |
— | — | @@ -139,9 +135,7 @@ |
140 | 136 | |
141 | 137 | /* Private Static Functions */ |
142 | 138 | |
143 | | - private static function urlToSub( |
144 | | - $url |
145 | | - ) { |
| 139 | + private static function urlToSub( $url ) { |
146 | 140 | global $wgTitle; |
147 | 141 | $start = stripos( $url, $wgTitle->getBaseText() ); |
148 | 142 | if ( $start !== false ) { |
— | — | @@ -154,9 +148,7 @@ |
155 | 149 | return $url; |
156 | 150 | } |
157 | 151 | |
158 | | - private static function subToPath( |
159 | | - $sub |
160 | | - ) { |
| 152 | + private static function subToPath( $sub ) { |
161 | 153 | $path = array(); |
162 | 154 | // Removes leading or trailing slashes, sanitizing hand-entered URLs |
163 | 155 | $sub = trim( $sub, '/'); |
— | — | @@ -212,9 +204,7 @@ |
213 | 205 | |
214 | 206 | /* Public Static Functions */ |
215 | 207 | |
216 | | - public static function getState( |
217 | | - $key |
218 | | - ) { |
| 208 | + public static function getState( $key ) { |
219 | 209 | if ( isset( self::$state['public'][$key] ) ) { |
220 | 210 | return self::$state['public'][$key]; |
221 | 211 | } else { |
— | — | @@ -222,10 +212,7 @@ |
223 | 213 | } |
224 | 214 | } |
225 | 215 | |
226 | | - public static function setState( |
227 | | - $key, |
228 | | - $value |
229 | | - ) { |
| 216 | + public static function setState( $key, $value ) { |
230 | 217 | self::$state['public'][$key] = $value; |
231 | 218 | } |
232 | 219 | |
— | — | @@ -244,9 +231,7 @@ |
245 | 232 | return self::$path; |
246 | 233 | } |
247 | 234 | |
248 | | - public static function userCan( |
249 | | - $action |
250 | | - ) { |
| 235 | + public static function userCan( $action ) { |
251 | 236 | if ( is_array( $action ) ) { |
252 | 237 | if ( count( $action ) > 0 ) { |
253 | 238 | foreach ( $action as $right ) { |
— | — | @@ -270,9 +255,7 @@ |
271 | 256 | wfLoadExtensionMessages( 'DataCenter' ); |
272 | 257 | } |
273 | 258 | |
274 | | - public function execute( |
275 | | - $sub |
276 | | - ) { |
| 259 | + public function execute( $sub ) { |
277 | 260 | global $wgOut, $wgScriptPath, $wgUser, $wgRequest; |
278 | 261 | // Checks if the user is logged in |
279 | 262 | if ( !$wgUser->isLoggedIn() ) { |
Index: trunk/extensions/DataCenter/DataCenter.ui.php |
— | — | @@ -10,9 +10,7 @@ |
11 | 11 | |
12 | 12 | /* Static Functions */ |
13 | 13 | |
14 | | - public static function toAttributes( |
15 | | - array $attributes |
16 | | - ) { |
| 14 | + public static function toAttributes( array $attributes ) { |
17 | 15 | $cssOutput = ''; |
18 | 16 | foreach( $attributes as $name => $value ) { |
19 | 17 | if ( !is_int( $name ) ) { |
— | — | @@ -27,15 +25,12 @@ |
28 | 26 | |
29 | 27 | /* Static Functions */ |
30 | 28 | |
31 | | - public static function chain( |
32 | | - $functions, |
33 | | - $end = true |
34 | | - ) { |
| 29 | + public static function chain( $functions, $end = true ) { |
35 | 30 | $jsFunctions = array(); |
36 | 31 | foreach( $functions as $name => $arguments ) { |
37 | 32 | if ( is_int( $name ) ) { |
38 | 33 | $jsFunctions[] = sprintf( '%s()', $arguments ); |
39 | | - } else if ( is_array( $arguments ) ) { |
| 34 | + } elseif ( is_array( $arguments ) ) { |
40 | 35 | $jsFunctions[] = sprintf( |
41 | 36 | '%s(%s)', $name, implode( ',', $arguments ) |
42 | 37 | ); |
— | — | @@ -47,12 +42,10 @@ |
48 | 43 | } |
49 | 44 | |
50 | 45 | /** |
51 | | - * Escapes a javascript string to make it safe to use anywhere |
52 | | - * @param string String to escape |
| 46 | + * Escapes a JavaScript string to make it safe to use anywhere |
| 47 | + * @param $string String: String to escape |
53 | 48 | */ |
54 | | - public static function escape( |
55 | | - $string |
56 | | - ) { |
| 49 | + public static function escape( $string ) { |
57 | 50 | return Xml::escapeJSString( $string ); |
58 | 51 | } |
59 | 52 | |
— | — | @@ -60,9 +53,7 @@ |
61 | 54 | * Converts a PHP value to a javascript object |
62 | 55 | * @param value Associative Array to convert |
63 | 56 | */ |
64 | | - public static function toObject( |
65 | | - $values |
66 | | - ) { |
| 57 | + public static function toObject( $values ) { |
67 | 58 | // Arrays |
68 | 59 | if ( is_array( $values ) ) { |
69 | 60 | $jsValues = array(); |
— | — | @@ -82,9 +73,7 @@ |
83 | 74 | * Converts a PHP value to a javascript array |
84 | 75 | * @param value Array or Scalar to convert |
85 | 76 | */ |
86 | | - public static function toArray( |
87 | | - $values |
88 | | - ) { |
| 77 | + public static function toArray( $values ) { |
89 | 78 | // Arrays |
90 | 79 | if ( is_array( $values ) ) { |
91 | 80 | $jsValues = array(); |
— | — | @@ -108,9 +97,7 @@ |
109 | 98 | * in which case the ' quotes will be removed and |
110 | 99 | * the value will be used as a statement |
111 | 100 | */ |
112 | | - public static function toScalar( |
113 | | - $value |
114 | | - ) { |
| 101 | + public static function toScalar( $value ) { |
115 | 102 | // Arrays |
116 | 103 | if ( is_array( $value ) ) { |
117 | 104 | return "'" . self::escape( implode( $value ) ) . "'"; |
— | — | @@ -149,18 +136,15 @@ |
150 | 137 | |
151 | 138 | /** |
152 | 139 | * Builds an annonomous javascript function declaration |
153 | | - * @param arguments Array of argument names to accept |
154 | | - * @param body String of code for body |
| 140 | + * @param $arguments Array: array of argument names to accept |
| 141 | + * @param $body String: code for body |
155 | 142 | */ |
156 | | - public static function buildFunction( |
157 | | - $arguments, |
158 | | - $body |
159 | | - ) { |
| 143 | + public static function buildFunction( $arguments, $body ) { |
160 | 144 | if ( is_array( $arguments ) ) { |
161 | 145 | return sprintf( |
162 | 146 | 'function(%s){%s}', implode( ',', $arguments ), $body |
163 | 147 | ); |
164 | | - } else if ( $arguments !== null ) { |
| 148 | + } elseif ( $arguments !== null ) { |
165 | 149 | return sprintf( 'function(%s){%s}', $arguments, $body ); |
166 | 150 | } else { |
167 | 151 | return sprintf( 'function(){%s}', $body ); |
— | — | @@ -169,13 +153,10 @@ |
170 | 154 | |
171 | 155 | /** |
172 | 156 | * Builds an annonomous javascript function declaration |
173 | | - * @param arguments Array of argument names to accept |
174 | | - * @param body String of code for body |
| 157 | + * @param $prototype String |
| 158 | + * @param $arguments Array: array of argument names to accept |
175 | 159 | */ |
176 | | - public static function buildInstance( |
177 | | - $prototype, |
178 | | - $arguments = array() |
179 | | - ) { |
| 160 | + public static function buildInstance( $prototype, $arguments = array() ) { |
180 | 161 | if ( !is_array( $arguments ) ) { |
181 | 162 | $arguments = array( $arguments ); |
182 | 163 | } |
— | — | @@ -202,18 +183,11 @@ |
203 | 184 | ) . ( $end ? ';' : '' ); |
204 | 185 | } |
205 | 186 | |
206 | | - public static function declareVar( |
207 | | - $name, |
208 | | - $value = 'null', |
209 | | - $end = true |
210 | | - ) { |
| 187 | + public static function declareVar( $name, $value = 'null', $end = true ) { |
211 | 188 | return sprintf( 'var %s=%s', $name, $value ) . ( $end ? ';' : '' ); |
212 | 189 | } |
213 | 190 | |
214 | | - public static function declareVars( |
215 | | - array $vars, |
216 | | - $end = true |
217 | | - ) { |
| 191 | + public static function declareVars( array $vars, $end = true ) { |
218 | 192 | $jsOutput = ''; |
219 | 193 | foreach( $vars as $name => $value ) { |
220 | 194 | if ( is_int( $name ) ) { |
— | — | @@ -245,7 +219,7 @@ |
246 | 220 | } |
247 | 221 | |
248 | 222 | /** |
249 | | - * Builds javascript effect |
| 223 | + * Builds JavaScript effect |
250 | 224 | * @param options Array of effect parameters containing... |
251 | 225 | * script JavaScript to run, with sprintf syntax for |
252 | 226 | * including fields in the order listed |
— | — | @@ -262,10 +236,7 @@ |
263 | 237 | * @param row DataCenterDBRow object from which to extract |
264 | 238 | * fields from |
265 | 239 | */ |
266 | | - public static function buildEffect( |
267 | | - $script, |
268 | | - $fields = null |
269 | | - ) { |
| 240 | + public static function buildEffect( $script, $fields = null ) { |
270 | 241 | // Checks for... |
271 | 242 | if ( |
272 | 243 | // Required types |
— | — | @@ -323,7 +294,6 @@ |
324 | 295 | * @param attributes Optional Array of XML attributes |
325 | 296 | * @param content... Any number of Strings of XML content |
326 | 297 | */ |
327 | | - |
328 | 298 | public static function row() { |
329 | 299 | $arguments = func_get_args(); |
330 | 300 | $attributes = array(); |
— | — | @@ -415,11 +385,9 @@ |
416 | 386 | |
417 | 387 | /** |
418 | 388 | * Builds an XML string for a complete input |
419 | | - * @param attributes Array of XML attributes |
| 389 | + * @param $attributes Array: XML attributes |
420 | 390 | */ |
421 | | - public static function input( |
422 | | - array $attributes = array() |
423 | | - ) { |
| 391 | + public static function input( array $attributes = array() ) { |
424 | 392 | return self::tag( 'div', $attributes ); |
425 | 393 | } |
426 | 394 | |
— | — | @@ -446,23 +414,18 @@ |
447 | 415 | |
448 | 416 | /** |
449 | 417 | * Builds an XML string for a tag opening |
450 | | - * @param tag Name of tag |
451 | | - * @param attributes Array of XML attributes |
| 418 | + * @param $tag String: name of tag |
| 419 | + * @param $attributes Array: XML attributes |
452 | 420 | */ |
453 | | - public static function open( |
454 | | - $tag, |
455 | | - array $attributes = array() |
456 | | - ) { |
| 421 | + public static function open( $tag, array $attributes = array() ) { |
457 | 422 | return Xml::openElement( $tag, $attributes ); |
458 | 423 | } |
459 | 424 | |
460 | 425 | /** |
461 | 426 | * Builds an XML string for a tag closing |
462 | | - * @param tag Name of tag |
| 427 | + * @param $tag String: name of tag |
463 | 428 | */ |
464 | | - public static function close( |
465 | | - $tag |
466 | | - ) { |
| 429 | + public static function close( $tag ) { |
467 | 430 | return Xml::closeElement( $tag ); |
468 | 431 | } |
469 | 432 | |
— | — | @@ -478,9 +441,7 @@ |
479 | 442 | * @param script String of raw text to use as script contents or |
480 | 443 | * Array of attributes such as src |
481 | 444 | */ |
482 | | - public static function script( |
483 | | - $script |
484 | | - ) { |
| 445 | + public static function script( $script ) { |
485 | 446 | if ( is_array( $script ) ) { |
486 | 447 | return Xml::element( |
487 | 448 | 'script', |
— | — | @@ -510,9 +471,7 @@ |
511 | 472 | * id Scalar of ID of row |
512 | 473 | * parameter Scalar parameter or Array of parameters |
513 | 474 | */ |
514 | | - public static function url( |
515 | | - array $parameters |
516 | | - ) { |
| 475 | + public static function url( array $parameters ) { |
517 | 476 | global $wgTitle; |
518 | 477 | // Gets the base url |
519 | 478 | if ( !self::$urlBase ) { |
— | — | @@ -550,14 +509,14 @@ |
551 | 510 | $url .= '/' . $parameters['action']; |
552 | 511 | // Checks if parameter was given |
553 | 512 | if ( $parameters['parameter'] !== null ) { |
554 | | - if ( is_array( $parameters['parameter'] ) ) { // Adds parameter to url |
| 513 | + if ( is_array( $parameters['parameter'] ) ) { // Adds parameter to url |
555 | 514 | $url .= ':' . implode( ',', $parameters['parameter'] ); |
556 | 515 | } else { |
557 | 516 | // Adds parameter to url |
558 | 517 | $url .= ':' . $parameters['parameter']; |
559 | 518 | } |
560 | 519 | } |
561 | | - } else if ( $parameters['limit'] !== null ) { |
| 520 | + } elseif ( $parameters['limit'] !== null ) { |
562 | 521 | $url .= '/'; |
563 | 522 | } |
564 | 523 | if ( $parameters['limit'] !== null ) { |
— | — | @@ -600,13 +559,10 @@ |
601 | 560 | |
602 | 561 | /** |
603 | 562 | * Builds an XML string for a link |
604 | | - * @param label String of raw text to use as label |
605 | | - * @param parameters Array of link parameters for self::url |
| 563 | + * @param $label String: raw text to use as label |
| 564 | + * @param $parameters Array: link parameters for self::url |
606 | 565 | */ |
607 | | - public static function link( |
608 | | - $label = null, |
609 | | - array $parameters |
610 | | - ) { |
| 566 | + public static function link( $label = null, array $parameters ) { |
611 | 567 | return Xml::element( |
612 | 568 | 'a', array( 'href' => self::url( $parameters ) ), $label |
613 | 569 | ); |
— | — | @@ -635,10 +591,7 @@ |
636 | 592 | * @param row DataCenterDBRow object from which to extract |
637 | 593 | * field/fields from |
638 | 594 | */ |
639 | | - public static function buildLink( |
640 | | - $options, |
641 | | - $row = null |
642 | | - ) { |
| 595 | + public static function buildLink( $options, $row = null ) { |
643 | 596 | // Checks if row was given |
644 | 597 | if ( isset( $options['page'] ) && $row instanceof DataCenterDBRow ) { |
645 | 598 | // Transforms options based on row |
— | — | @@ -701,18 +654,12 @@ |
702 | 655 | * @param row DataCenterDBRow object from which to extract |
703 | 656 | * field/fields from |
704 | 657 | */ |
705 | | - public static function buildEffects( |
706 | | - array $options, |
707 | | - $fields |
708 | | - ) { |
| 658 | + public static function buildEffects( array $options, $fields ) { |
709 | 659 | if ( $fields instanceof DataCenterDBRow ) { |
710 | 660 | $fields = $fields->get(); |
711 | 661 | } |
712 | | - // Checks for... |
713 | | - if ( |
714 | | - // Required types |
715 | | - ( is_array( $fields ) ) |
716 | | - ) { |
| 662 | + // Checks for required types |
| 663 | + if ( ( is_array( $fields ) ) ) { |
717 | 664 | $effects = array(); |
718 | 665 | // Loops over each effect |
719 | 666 | foreach ( $options as $effect ) { |
— | — | @@ -737,21 +684,17 @@ |
738 | 685 | |
739 | 686 | /** |
740 | 687 | * Abstract function for rendering the input |
741 | | - * @param parameters Array of parameters |
| 688 | + * @param $parameters Array: array of parameters |
742 | 689 | */ |
743 | | - public static function render( |
744 | | - array $parameters |
745 | | - ) {} |
| 690 | + public static function render( array $parameters ) {} |
746 | 691 | |
747 | 692 | /* Protected Static Functions */ |
748 | 693 | |
749 | 694 | /** |
750 | 695 | * Builds XML string of begining of input |
751 | | - * @param class CSS class name of widget |
| 696 | + * @param $class String: CSS class name of widget |
752 | 697 | */ |
753 | | - protected static function begin( |
754 | | - $class |
755 | | - ) { |
| 698 | + protected static function begin( $class ) { |
756 | 699 | return DataCenterXml::open( 'div', array( 'class' => $class ) ); |
757 | 700 | } |
758 | 701 | |
— | — | @@ -775,10 +718,7 @@ |
776 | 719 | |
777 | 720 | /* Static Functions */ |
778 | 721 | |
779 | | - public static function buildPaging( |
780 | | - $page, |
781 | | - $num |
782 | | - ) { |
| 722 | + public static function buildPaging( $page, $num ) { |
783 | 723 | $range = array( 'limit' => 10, 'offset' => 0 ); |
784 | 724 | if ( isset( $page['limit'] ) && $page['limit'] !== null ) { |
785 | 725 | $range['limit'] = $page['limit']; |
— | — | @@ -933,11 +873,7 @@ |
934 | 874 | * @param arguments String or array of strings of arguments which |
935 | 875 | * will be passed to MediaWiki's message parser |
936 | 876 | */ |
937 | | - public static function message( |
938 | | - $type, |
939 | | - $name = null, |
940 | | - $arguments = null |
941 | | - ) { |
| 877 | + public static function message( $type, $name = null, $arguments = null ) { |
942 | 878 | if ( !$name ) { |
943 | 879 | return wfMsg( $type ); |
944 | 880 | } |
— | — | @@ -955,10 +891,7 @@ |
956 | 892 | * no formatting or any of the following... |
957 | 893 | * date Localized date and time format from timestamp |
958 | 894 | */ |
959 | | - public static function format( |
960 | | - $value, |
961 | | - $format |
962 | | - ) { |
| 895 | + public static function format( $value, $format ) { |
963 | 896 | global $wgLang; |
964 | 897 | // Handles format type |
965 | 898 | switch ( $format ) { |
— | — | @@ -1001,7 +934,7 @@ |
1002 | 935 | $wgOut->addScript( |
1003 | 936 | DataCenterXml::script( array( 'src' => $url ) ) |
1004 | 937 | ); |
1005 | | - } else if ( strpos( $url, '<' ) !== false ) { |
| 938 | + } elseif ( strpos( $url, '<' ) !== false ) { |
1006 | 939 | $wgOut->addScript( sprintf( $url, $wgScriptPath ) ); |
1007 | 940 | } else { |
1008 | 941 | $wgOut->addScriptFile( $wgScriptPath . $url ); |
— | — | @@ -1031,14 +964,11 @@ |
1032 | 965 | |
1033 | 966 | /** |
1034 | 967 | * Builds string of XML using widget |
1035 | | - * @param name Name of widget to use |
1036 | | - * @param parameters Parameters to pass on to widget |
| 968 | + * @param $name String: name of widget to use |
| 969 | + * @param $parameters Array: parameters to pass on to widget |
1037 | 970 | * @return String of widget's XML output |
1038 | 971 | */ |
1039 | | - public static function renderWidget( |
1040 | | - $name, |
1041 | | - array $parameters = array() |
1042 | | - ) { |
| 972 | + public static function renderWidget( $name, array $parameters = array() ) { |
1043 | 973 | if ( isset( self::$widgets[$name] ) ) { |
1044 | 974 | $function = array( self::$widgets[$name], 'render' ); |
1045 | 975 | if ( is_callable( $function ) ) { |
— | — | @@ -1053,14 +983,11 @@ |
1054 | 984 | |
1055 | 985 | /** |
1056 | 986 | * Builds string of XML using input |
1057 | | - * @param name Name of input to use |
1058 | | - * @param parameters Parameters to pass on to input |
| 987 | + * @param $name String: name of input to use |
| 988 | + * @param $parameters Array: parameters to pass on to input |
1059 | 989 | * @return String of input's XML output |
1060 | 990 | */ |
1061 | | - public static function renderInput( |
1062 | | - $name, |
1063 | | - array $parameters = array() |
1064 | | - ) { |
| 991 | + public static function renderInput( $name, array $parameters = array() ) { |
1065 | 992 | if ( isset( self::$inputs[$name] ) ) { |
1066 | 993 | $function = array( self::$inputs[$name], 'render' ); |
1067 | 994 | if ( is_callable( $function ) ) { |
— | — | @@ -1075,14 +1002,11 @@ |
1076 | 1003 | |
1077 | 1004 | /** |
1078 | 1005 | * Builds string of XML using layout |
1079 | | - * @param name Name of layout to use |
1080 | | - * @param contents Array of strings of XML to layout |
1081 | | - * @return String of layout's XML output |
| 1006 | + * @param $name String: name of layout to use |
| 1007 | + * @param $contents Array: array of strings of XML to layout |
| 1008 | + * @return String of layout's XML output |
1082 | 1009 | */ |
1083 | | - public static function renderLayout( |
1084 | | - $name, |
1085 | | - array $contents = array() |
1086 | | - ) { |
| 1010 | + public static function renderLayout( $name, array $contents = array() ) { |
1087 | 1011 | if ( isset( self::$layouts[$name] ) ) { |
1088 | 1012 | $function = array( self::$layouts[$name], 'render' ); |
1089 | 1013 | if ( is_callable( $function ) ) { |
— | — | @@ -1097,11 +1021,9 @@ |
1098 | 1022 | |
1099 | 1023 | /** |
1100 | 1024 | * Appends the scripts list, skipping duplicate entries |
1101 | | - * @param url Fully qualified URL to javascript file |
| 1025 | + * @param $url String: fully qualified URL to JavaScript file |
1102 | 1026 | */ |
1103 | | - public static function addScript( |
1104 | | - $url |
1105 | | - ) { |
| 1027 | + public static function addScript( $url ) { |
1106 | 1028 | if ( !in_array( $url, self::$output['scripts'] ) ) { |
1107 | 1029 | self::$output['scripts'][] = $url; |
1108 | 1030 | } |
— | — | @@ -1109,11 +1031,9 @@ |
1110 | 1032 | |
1111 | 1033 | /** |
1112 | 1034 | * Appends content to the output cache |
1113 | | - * @param content String of XML content to append |
| 1035 | + * @param $content String: XML content to append |
1114 | 1036 | */ |
1115 | | - public static function addContent( |
1116 | | - $content |
1117 | | - ) { |
| 1037 | + public static function addContent( $content ) { |
1118 | 1038 | self::$output['content'] .= $content; |
1119 | 1039 | } |
1120 | 1040 | |
— | — | @@ -1198,34 +1118,28 @@ |
1199 | 1119 | |
1200 | 1120 | /** |
1201 | 1121 | * Checks if widget is available |
1202 | | - * @param name Name of widget to look for |
1203 | | - * @return Boolean true if exists, false if not |
| 1122 | + * @param $name String: name of widget to look for |
| 1123 | + * @return Boolean true if exists, false if not |
1204 | 1124 | */ |
1205 | | - public static function isWidget( |
1206 | | - $name |
1207 | | - ) { |
| 1125 | + public static function isWidget( $name ) { |
1208 | 1126 | return isset( self::$widgets[$name] ); |
1209 | 1127 | } |
1210 | 1128 | |
1211 | 1129 | /** |
1212 | 1130 | * Checks if input is available |
1213 | | - * @param name Name of input to look for |
1214 | | - * @return Boolean true if exists, false if not |
| 1131 | + * @param $name String: name of input to look for |
| 1132 | + * @return Boolean true if exists, false if not |
1215 | 1133 | */ |
1216 | | - public static function isInput( |
1217 | | - $name |
1218 | | - ) { |
| 1134 | + public static function isInput( $name ) { |
1219 | 1135 | return isset( self::$inputs[$name] ); |
1220 | 1136 | } |
1221 | 1137 | |
1222 | 1138 | /** |
1223 | 1139 | * Checks if layout is available |
1224 | | - * @param name Name of layout to look for |
1225 | | - * @return Boolean true if exists, false if not |
| 1140 | + * @param $name String: name of layout to look for |
| 1141 | + * @return Boolean true if exists, false if not |
1226 | 1142 | */ |
1227 | | - public static function isLayout( |
1228 | | - $name |
1229 | | - ) { |
| 1143 | + public static function isLayout( $name ) { |
1230 | 1144 | return isset( self::$layouts[$name] ); |
1231 | 1145 | } |
1232 | 1146 | } |