Passed
Push — master ( 8005c7...9b803d )
by Goffy
03:14
created
index.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
     Github\GithubClient
29 29
 };
30 30
 
31
-require __DIR__ . '/header.php';
31
+require __DIR__.'/header.php';
32 32
 $GLOBALS['xoopsOption']['template_main'] = 'wggithub_index.tpl';
33
-include_once \XOOPS_ROOT_PATH . '/header.php';
33
+include_once \XOOPS_ROOT_PATH.'/header.php';
34 34
 
35 35
 // Permissions
36 36
 $permGlobalView = $permissionsHandler->getPermGlobalView();
37 37
 if (!$permGlobalView) {
38 38
     $GLOBALS['xoopsTpl']->assign('error', _NOPERM);
39
-    require __DIR__ . '/footer.php';
39
+    require __DIR__.'/footer.php';
40 40
 }
41 41
 $permGlobalRead   = $permissionsHandler->getPermGlobalRead();
42 42
 $permReadmeUpdate = $permissionsHandler->getPermReadmeUpdate();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 // Define Stylesheet
52 52
 $GLOBALS['xoTheme']->addStylesheet($style, null);
53
-$GLOBALS['xoTheme']->addStylesheet(WGGITHUB_URL . '/assets/css/tabs.css', null);
53
+$GLOBALS['xoTheme']->addStylesheet(WGGITHUB_URL.'/assets/css/tabs.css', null);
54 54
 $keywords = [];
55 55
 // 
56 56
 $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL);
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
             foreach (\array_keys($directoriesAll) as $i) {
121 121
                 $directories[$i] = $directoriesAll[$i]->getValuesDirectories();
122 122
                 $dirName = $directoriesAll[$i]->getVar('dir_name');
123
-                $dirFilterRelease = (bool)$directoriesAll[$i]->getVar('dir_filterrelease');
123
+                $dirFilterRelease = (bool) $directoriesAll[$i]->getVar('dir_filterrelease');
124 124
                 $repos = [];
125 125
                 $crRepositories = new \CriteriaCompo();
126 126
                 $crRepositories->add(new \Criteria('repo_user', $dirName));
127 127
                 $repositoriesCountTotal = $repositoriesHandler->getCount($crRepositories);
128 128
                 if ('any' === $filterRelease && $dirFilterRelease) {
129
-                    $crRepositories->add(new \Criteria('repo_prerelease', 1) );
129
+                    $crRepositories->add(new \Criteria('repo_prerelease', 1));
130 130
                     $crRepositories->add(new \Criteria('repo_release', 1), 'OR');
131 131
                 }
132 132
                 if ('final' === $filterRelease && $dirFilterRelease) {
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
                 }
182 182
                 $directories[$i]['repos'] = $repos;
183 183
                 $directories[$i]['previousRepos'] = $start > 0;
184
-                $directories[$i]['previousOp'] = '&start=' . ($start - $limit) . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
184
+                $directories[$i]['previousOp'] = '&start='.($start - $limit).'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
185 185
                 $directories[$i]['nextRepos'] = ($repositoriesCount - $start) > $limit;
186
-                $directories[$i]['nextOp'] = '&start=' . ($start + $limit) . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
186
+                $directories[$i]['nextOp'] = '&start='.($start + $limit).'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
187 187
                 $GLOBALS['xoopsTpl']->assign('start', $start);
188 188
                 $GLOBALS['xoopsTpl']->assign('limit', $limit);
189 189
                 $GLOBALS['xoopsTpl']->assign('menu', $menu);
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
             unset($crDirectories, $directories);
195 195
             // Display Navigation
196 196
             if ($directoriesCount > $limit) {
197
-                require_once \XOOPS_ROOT_PATH . '/class/pagenav.php';
198
-                $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
197
+                require_once \XOOPS_ROOT_PATH.'/class/pagenav.php';
198
+                $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit);
199 199
                 $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
200 200
             }
201 201
             $GLOBALS['xoopsTpl']->assign('lang_thereare', \sprintf(\_MA_WGGITHUB_INDEX_THEREARE, $directoriesCount));
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
         // Permissions
209 209
         if (!$permGlobalRead) {
210 210
             $GLOBALS['xoopsTpl']->assign('error', \_NOPERM);
211
-            require __DIR__ . '/footer.php';
211
+            require __DIR__.'/footer.php';
212 212
         }
213 213
         $dirName = Request::getString('dir_name', '');
214 214
         $result = executeUpdate($dirName);
215
-        $redir = 'index.php?op=list_afterupdate&start=' . $start . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
215
+        $redir = 'index.php?op=list_afterupdate&start='.$start.'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
216 216
         if ($result) {
217 217
             \redirect_header($redir, 2, \_MA_WGGITHUB_READGH_SUCCESS);
218 218
         } else {
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
         // Permissions
225 225
         if (!$permReadmeUpdate) {
226 226
             $GLOBALS['xoopsTpl']->assign('error', \_NOPERM);
227
-            require __DIR__ . '/footer.php';
227
+            require __DIR__.'/footer.php';
228 228
         }
229 229
         $repoId = Request::getInt('repo_id', 0);
230 230
         $repoUser  = Request::getString('repo_user', 'none');
231 231
         $repoName  = Request::getString('repo_name', 'none');
232 232
         $result = $helper->getHandler('Readmes')->updateReadmes($repoId, $repoUser, $repoName);
233
-        $redir = 'index.php?op=list_afterupdate&start=' . $start . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
233
+        $redir = 'index.php?op=list_afterupdate&start='.$start.'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
234 234
         if ($result) {
235 235
             \redirect_header($redir, 2, \_MA_WGGITHUB_READGH_SUCCESS);
236 236
         } else {
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 // Breadcrumbs
244 244
 $xoBreadcrumbs[] = ['title' => \_MA_WGGITHUB_INDEX];
245 245
 // Keywords
246
-wggithubMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords));
246
+wggithubMetaKeywords($helper->getConfig('keywords').', '.\implode(',', $keywords));
247 247
 unset($keywords);
248 248
 // Description
249 249
 wggithubMetaDescription(\_MA_WGGITHUB_INDEX_DESC);
250 250
 $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', WGGITHUB_URL.'/index.php');
251 251
 $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL);
252 252
 $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
253
-require __DIR__ . '/footer.php';
253
+require __DIR__.'/footer.php';
254 254
 
255 255
 
256 256
 /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $dirName
259 259
  * @return bool
260 260
  */
261
-function executeUpdate($dirName = ''){
261
+function executeUpdate($dirName = '') {
262 262
 
263 263
     $githubClient = GithubClient::getInstance();
264 264
     $helper = Helper::getInstance();
Please login to merge, or discard this patch.
admin/github-api.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,52 +30,52 @@  discard block
 block discarded – undo
30 30
 use XoopsModules\Wggithub;
31 31
 use XoopsModules\Wggithub\Github;
32 32
 
33
-require __DIR__ . '/header.php';
33
+require __DIR__.'/header.php';
34 34
 // It recovered the value of argument op in URL$
35 35
 
36 36
 
37 37
 $data = [];
38 38
 $url = '/orgs/XoopsModules25x/repos?per_page=100&page=1';
39
-echo "<br>Test read org repo:" . $url;
39
+echo "<br>Test read org repo:".$url;
40 40
 $api = new XoopsModules\Wggithub\Github\GithubClient();
41 41
 $data = $api->testMilo($url);
42 42
 $count = 0;
43 43
 foreach ($data as $key => $repo) {
44
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
44
+    echo "<br>key:".$key.' repo:'.$repo['name'];
45 45
     $count++;
46
-    if ($count>5) {break;}
46
+    if ($count > 5) {break; }
47 47
 }
48 48
 
49 49
 
50 50
 $data = [];
51 51
 $url = '/users/ggoffy/repos?per_page=100&page=1';
52
-echo "<br><br>Test read user repo:" . $url;
52
+echo "<br><br>Test read user repo:".$url;
53 53
 $api = new XoopsModules\Wggithub\Github\GithubClient();
54 54
 $data = $api->testMilo($url);
55 55
 $count = 0;
56 56
 foreach ($data as $key => $repo) {
57
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
57
+    echo "<br>key:".$key.' repo:'.$repo['name'];
58 58
     $count++;
59
-    if ($count>5) {break;}
59
+    if ($count > 5) {break; }
60 60
 }
61 61
 
62 62
 
63 63
 $data = [];
64 64
 $url = '/repos/XoopsModules25x/smallworld/readme';
65
-echo "<br><br>test read readme orgs:" . $url;
65
+echo "<br><br>test read readme orgs:".$url;
66 66
 $api = new XoopsModules\Wggithub\Github\GithubClient();
67 67
 $data = $api->testMilo($url);
68
-echo '<br>name:' . $data['name'];
69
-echo '<br>download_url:' . $data['download_url'];
68
+echo '<br>name:'.$data['name'];
69
+echo '<br>download_url:'.$data['download_url'];
70 70
 
71 71
 
72 72
 $data = [];
73 73
 $url = '/repos/ggoffy/wggithub/readme';
74
-echo "<br><br>test read readme user:" . $url;
74
+echo "<br><br>test read readme user:".$url;
75 75
 $api = new XoopsModules\Wggithub\Github\GithubClient();
76 76
 $data = $api->testMilo($url);
77
-echo '<br>name:' . $data['name'];
78
-echo '<br>download_url:' . $data['download_url'];
77
+echo '<br>name:'.$data['name'];
78
+echo '<br>download_url:'.$data['download_url'];
79 79
 
80 80
 
81 81
 echo "<br><br><br>-----------------------------------";
@@ -84,45 +84,45 @@  discard block
 block discarded – undo
84 84
 
85 85
 $data = [];
86 86
 $url = '/orgs/XoopsModules25x/repos?per_page=100&page=1';
87
-echo "<br>Test read org repo:" . $url;
87
+echo "<br>Test read org repo:".$url;
88 88
 $api = new XoopsModules\Wggithub\Github\GithubClient();
89 89
 $data = $api->testMilo2($url);
90 90
 $count = 0;
91 91
 foreach ($data as $key => $repo) {
92
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
92
+    echo "<br>key:".$key.' repo:'.$repo['name'];
93 93
     $count++;
94
-    if ($count>5) {break;}
94
+    if ($count > 5) {break; }
95 95
 }
96 96
 
97 97
 
98 98
 $data = [];
99 99
 $url = '/users/ggoffy/repos?per_page=100&page=1';
100
-echo "<br><br>Test read user repo:" . $url;
100
+echo "<br><br>Test read user repo:".$url;
101 101
 $api = new XoopsModules\Wggithub\Github\GithubClient();
102 102
 $data = $api->testMilo2($url);
103 103
 $count = 0;
104 104
 foreach ($data as $key => $repo) {
105
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
105
+    echo "<br>key:".$key.' repo:'.$repo['name'];
106 106
     $count++;
107
-    if ($count>5) {break;}
107
+    if ($count > 5) {break; }
108 108
 }
109 109
 
110 110
 
111 111
 $data = [];
112 112
 $url = '/repos/XoopsModules25x/smallworld/readme';
113
-echo "<br><br>test read readme orgs:" . $url;
113
+echo "<br><br>test read readme orgs:".$url;
114 114
 $api = new XoopsModules\Wggithub\Github\GithubClient();
115 115
 $data = $api->testMilo2($url);
116
-echo '<br>name:' . $data['name'];
117
-echo '<br>download_url:' . $data['download_url'];
116
+echo '<br>name:'.$data['name'];
117
+echo '<br>download_url:'.$data['download_url'];
118 118
 
119 119
 
120 120
 $data = [];
121 121
 $url = '/repos/ggoffy/wggithub/readme';
122
-echo "<br><br>test read readme user:" . $url;
122
+echo "<br><br>test read readme user:".$url;
123 123
 $api = new XoopsModules\Wggithub\Github\GithubClient();
124 124
 $data = $api->testMilo2($url);
125
-echo '<br>name:' . $data['name'];
126
-echo '<br>download_url:' . $data['download_url'];
125
+echo '<br>name:'.$data['name'];
126
+echo '<br>download_url:'.$data['download_url'];
127 127
 
128 128
 
Please login to merge, or discard this patch.
class/Github/GithubClient.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     public function testMilo($url) {
83 83
         $api = new Github\Api;
84
-        $response = $api->get(static::BASE_URL . $url);
84
+        $response = $api->get(static::BASE_URL.$url);
85 85
         $data = $api->decode($response);
86 86
         
87 87
         return $data;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         $token = new Github\OAuth\Token('{myKey}', 'bearer', ['repo', 'user', 'public_repo']);
94 94
         $api->setToken($token);
95
-        $response = $api->get(static::BASE_URL . $url);
95
+        $response = $api->get(static::BASE_URL.$url);
96 96
 
97 97
         $data = $api->decode($response);
98 98
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getUserRepositories($username, $per_page = 100, $page = 1)
119 119
     {
120
-        $url = static::BASE_URL . 'users/' . \rawurlencode($username) . '/repos?per_page=' . $per_page . '&page=' . $page;
120
+        $url = static::BASE_URL.'users/'.\rawurlencode($username).'/repos?per_page='.$per_page.'&page='.$page;
121 121
 
122 122
         return $this->_get($url);
123 123
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getOrgRepositories($org, $per_page = 100, $page = 1)
134 134
     {
135
-        $url = static::BASE_URL . 'orgs/' . \rawurlencode($org) . '/repos?per_page=' . $per_page . '&page=' . $page;
135
+        $url = static::BASE_URL.'orgs/'.\rawurlencode($org).'/repos?per_page='.$per_page.'&page='.$page;
136 136
 
137 137
         return $this->_get($url);
138 138
     }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getReadme($username, $repository)
148 148
     {
149
-        $url = static::BASE_URL . 'repos/' . \rawurlencode($username) . '/' . \rawurlencode($repository) . '/readme';
149
+        $url = static::BASE_URL.'repos/'.\rawurlencode($username).'/'.\rawurlencode($repository).'/readme';
150 150
 
151 151
         return $this->_get($url);
152 152
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function getReleases($username, $repository)
162 162
     {
163
-        $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases';
163
+        $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases';
164 164
 
165 165
         return $this->_get($url);
166 166
     }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
     public function getLatestRelease($username, $repository, $prerelease = false)
177 177
     {
178 178
         if ($prerelease) {
179
-            $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases';
179
+            $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases';
180 180
         } else {
181
-            $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases/latest';
181
+            $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases/latest';
182 182
         }
183 183
         $result = $this->_get($url);
184 184
 
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
         } else {
217 217
             $error = true;
218 218
             $errMsg = $response->getContent();
219
-            $logsHandler->updateTableLogs(Constants::LOG_TYPE_ERROR, $errMsg, 'ERROR ' . $code);
219
+            $logsHandler->updateTableLogs(Constants::LOG_TYPE_ERROR, $errMsg, 'ERROR '.$code);
220 220
         }
221 221
         if ($error) {
222 222
             //catch common errors
223 223
             switch ($code) {
224 224
                 case 401:
225
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_401 . '"');
225
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_401.'"');
226 226
                     break;
227 227
                 case 403:
228 228
                     /*
@@ -230,21 +230,21 @@  discard block
 block discarded – undo
230 230
                         $GLOBALS['xoopsTpl']->assign('apiexceed', true);
231 231
                     }
232 232
                     */
233
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_403 . '"');
233
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_403.'"');
234 234
                     break;
235 235
                 case 404:
236
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_404 . '"');
236
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_404.'"');
237 237
                     break;
238 238
                 case 405:
239
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_405 . '"');
239
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_405.'"');
240 240
                     break;
241 241
                 case 0:
242 242
                 default:
243
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API . $errMsg . '"');
243
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API.$errMsg.'"');
244 244
                     break;
245 245
             }
246 246
         }
247
-        $data = (array)$api->decode($response);
247
+        $data = (array) $api->decode($response);
248 248
 
249 249
         return $data;
250 250
     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $setting = $settingsHandler->getPrimarySetting();
261 261
 
262 262
         if (0 == \count($setting)) {
263
-            \redirect_header(\XOOPS_URL . '/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS);
263
+            \redirect_header(\XOOPS_URL.'/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS);
264 264
         }
265 265
         //$this->userAuth = $setting['user'];
266 266
         $this->tokenAuth = $setting['token'];
Please login to merge, or discard this patch.
test.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
     Github\GithubClient
29 29
 };
30 30
 
31
-require __DIR__ . '/header.php';
31
+require __DIR__.'/header.php';
32 32
 $GLOBALS['xoopsOption']['template_main'] = 'wggithub_index.tpl';
33
-include_once \XOOPS_ROOT_PATH . '/header.php';
33
+include_once \XOOPS_ROOT_PATH.'/header.php';
34 34
 // Define Stylesheet
35 35
 $GLOBALS['xoTheme']->addStylesheet($style, null);
36 36
 $keywords = [];
@@ -166,4 +166,4 @@  discard block
 block discarded – undo
166 166
 var_dump($result);
167 167
 */
168 168
 
169
-require __DIR__ . '/footer.php';
169
+require __DIR__.'/footer.php';
Please login to merge, or discard this patch.