Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -179,7 +179,7 @@ |
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Get the array mapping module names to class names |
183 | | - * @return array (modulename => classname) |
| 183 | + * @return array array(modulename => classname) |
184 | 184 | */ |
185 | 185 | function getModules() { |
186 | 186 | return array_merge( $this->mQueryPropModules, $this->mQueryListModules, $this->mQueryMetaModules ); |
Index: trunk/phase3/includes/api/ApiParamInfo.php |
— | — | @@ -49,61 +49,66 @@ |
50 | 50 | $params = $this->extractRequestParams(); |
51 | 51 | $result = $this->getResult(); |
52 | 52 | |
53 | | - $r = array(); |
| 53 | + $res = array(); |
54 | 54 | if ( is_array( $params['modules'] ) ) { |
55 | | - $modArr = $this->getMain()->getModules(); |
56 | | - $r['modules'] = array(); |
57 | | - foreach ( $params['modules'] as $m ) { |
58 | | - if ( !isset( $modArr[$m] ) ) { |
59 | | - $r['modules'][] = array( 'name' => $m, 'missing' => '' ); |
| 55 | + $modules = $this->getMain()->getModules(); |
| 56 | + $res['modules'] = array(); |
| 57 | + foreach ( $params['modules'] as $mod ) { |
| 58 | + if ( !isset( $modules[$mod] ) ) { |
| 59 | + $res['modules'][] = array( 'name' => $mod, 'missing' => '' ); |
60 | 60 | continue; |
61 | 61 | } |
62 | | - $obj = new $modArr[$m]( $this->getMain(), $m ); |
63 | | - $a = $this->getClassInfo( $obj ); |
64 | | - $a['name'] = $m; |
65 | | - $r['modules'][] = $a; |
| 62 | + $obj = new $modules[$mod]( $this->getMain(), $mod ); |
| 63 | + |
| 64 | + $item = $this->getClassInfo( $obj ); |
| 65 | + $item['name'] = $mod; |
| 66 | + $res['modules'][] = $item; |
66 | 67 | } |
67 | | - $result->setIndexedTagName( $r['modules'], 'module' ); |
| 68 | + $result->setIndexedTagName( $res['modules'], 'module' ); |
68 | 69 | } |
| 70 | + |
69 | 71 | if ( is_array( $params['querymodules'] ) ) { |
70 | | - $qmodArr = $this->queryObj->getModules(); |
71 | | - $r['querymodules'] = array(); |
| 72 | + $queryModules = $this->queryObj->getModules(); |
| 73 | + $res['querymodules'] = array(); |
72 | 74 | foreach ( $params['querymodules'] as $qm ) { |
73 | | - if ( !isset( $qmodArr[$qm] ) ) { |
74 | | - $r['querymodules'][] = array( 'name' => $qm, 'missing' => '' ); |
| 75 | + if ( !isset( $queryModules[$qm] ) ) { |
| 76 | + $res['querymodules'][] = array( 'name' => $qm, 'missing' => '' ); |
75 | 77 | continue; |
76 | 78 | } |
77 | | - $obj = new $qmodArr[$qm]( $this, $qm ); |
78 | | - $a = $this->getClassInfo( $obj ); |
79 | | - $a['name'] = $qm; |
80 | | - $a['querytype'] = $this->queryObj->getModuleType( $qm ); |
81 | | - $r['querymodules'][] = $a; |
| 79 | + $obj = new $queryModules[$qm]( $this, $qm ); |
| 80 | + $item = $this->getClassInfo( $obj ); |
| 81 | + $item['name'] = $qm; |
| 82 | + $item['querytype'] = $this->queryObj->getModuleType( $qm ); |
| 83 | + $res['querymodules'][] = $item; |
82 | 84 | } |
83 | | - $result->setIndexedTagName( $r['querymodules'], 'module' ); |
| 85 | + $result->setIndexedTagName( $res['querymodules'], 'module' ); |
84 | 86 | } |
| 87 | + |
85 | 88 | if ( $params['mainmodule'] ) { |
86 | | - $r['mainmodule'] = $this->getClassInfo( $this->getMain() ); |
| 89 | + $res['mainmodule'] = $this->getClassInfo( $this->getMain() ); |
87 | 90 | } |
| 91 | + |
88 | 92 | if ( $params['pagesetmodule'] ) { |
89 | 93 | $pageSet = new ApiPageSet( $this->queryObj ); |
90 | | - $r['pagesetmodule'] = $this->getClassInfo( $pageSet ); |
| 94 | + $res['pagesetmodule'] = $this->getClassInfo( $pageSet ); |
91 | 95 | } |
| 96 | + |
92 | 97 | if ( is_array( $params['formatmodules'] ) ) { |
93 | 98 | $formats = $this->getMain()->getFormats(); |
94 | | - $r['formatmodules'] = array(); |
| 99 | + $res['formatmodules'] = array(); |
95 | 100 | foreach ( $params['formatmodules'] as $f ) { |
96 | 101 | if ( !isset( $formats[$f] ) ) { |
97 | | - $r['formatmodules'][] = array( 'name' => $f, 'missing' => '' ); |
| 102 | + $res['formatmodules'][] = array( 'name' => $f, 'missing' => '' ); |
98 | 103 | continue; |
99 | 104 | } |
100 | 105 | $obj = new $formats[$f]( $this, $f ); |
101 | | - $a = $this->getClassInfo( $obj ); |
102 | | - $a['name'] = $f; |
103 | | - $r['formatmodules'][] = $a; |
| 106 | + $item = $this->getClassInfo( $obj ); |
| 107 | + $item['name'] = $f; |
| 108 | + $res['formatmodules'][] = $item; |
104 | 109 | } |
105 | | - $result->setIndexedTagName( $r['formatmodules'], 'module' ); |
| 110 | + $result->setIndexedTagName( $res['formatmodules'], 'module' ); |
106 | 111 | } |
107 | | - $result->addValue( null, $this->getModuleName(), $r ); |
| 112 | + $result->addValue( null, $this->getModuleName(), $res ); |
108 | 113 | } |
109 | 114 | |
110 | 115 | /** |