[ticket/11366] Coding style

PHPBB3-11366
This commit is contained in:
Tristan Darricau 2014-05-11 13:04:00 +02:00
parent a80a9efa8d
commit 5e29ea77d8
4 changed files with 40 additions and 36 deletions

View file

@ -6,12 +6,16 @@
<h1>{L_EXTENSIONS_ADMIN}</h1> <h1>{L_EXTENSIONS_ADMIN}</h1>
<!-- IF S_VERSIONCHECK_FAIL --> <!-- IF S_VERSIONCHECK_STATUS == 0 -->
<div class="errorbox notice"> <div class="errorbox notice">
<p>{L_VERSIONCHECK_FAIL}</p> <p>{L_VERSIONCHECK_FAIL}</p>
<p>{VERSIONCHECK_FAIL_REASON}</p> <p>{VERSIONCHECK_FAIL_REASON}</p>
<p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> <p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
</div> </div>
<!-- ELSE IF S_VERSIONCHECK_STATUS == 1 -->
<div class="errorbox notice">
<p>{VERSIONCHECK_FAIL_REASON}</p>
</div>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_VERSIONCHECK --> <!-- IF S_VERSIONCHECK -->
<div class="<!-- IF S_UP_TO_DATE -->successbox<!-- ELSE -->errorbox<!-- ENDIF -->"> <div class="<!-- IF S_UP_TO_DATE -->successbox<!-- ELSE -->errorbox<!-- ENDIF -->">

View file

@ -13,7 +13,7 @@
<th>{L_EXTENSION_NAME}</th> <th>{L_EXTENSION_NAME}</th>
<th width="20%">{L_CURRENT_VERSION}</th> <th width="20%">{L_CURRENT_VERSION}</th>
<th width="10%">{L_EXTENSION_OPTIONS}</th> <th width="10%">{L_EXTENSION_OPTIONS}</th>
<th width="10%">{L_EXTENSION_ACTIONS}</th> <th width="25%">{L_EXTENSION_ACTIONS}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -267,7 +267,7 @@ class acp_extensions
catch (\RuntimeException $e) catch (\RuntimeException $e)
{ {
$template->assign_vars(array( $template->assign_vars(array(
'S_VERSIONCHECK_FAIL' => true, 'S_VERSIONCHECK_STATUS' => $e->getCode(),
'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '',
)); ));
} }
@ -323,7 +323,7 @@ class acp_extensions
} }
} }
uasort($enabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); uasort($enabled_extension_meta_data, array($this, 'sort_extension_meta_data_table'));
foreach ($enabled_extension_meta_data as $name => $infos) foreach ($enabled_extension_meta_data as $name => $infos)
{ {
@ -379,7 +379,7 @@ class acp_extensions
} }
} }
uasort($disabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); uasort($disabled_extension_meta_data, array($this, 'sort_extension_meta_data_table'));
foreach ($disabled_extension_meta_data as $name => $infos) foreach ($disabled_extension_meta_data as $name => $infos)
{ {
@ -438,7 +438,7 @@ class acp_extensions
} }
} }
uasort($available_extension_meta_data, array('self', 'sort_extension_meta_data_table')); uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table'));
foreach ($available_extension_meta_data as $name => $infos) foreach ($available_extension_meta_data as $name => $infos)
{ {
@ -477,20 +477,20 @@ class acp_extensions
* @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check.
* @param bool $force Ignores cached data. Default to false. * @param bool $force Ignores cached data. Default to false.
*/ */
private function version_check(\phpbb\extension\metadata_manager $md_manager, $force = false) protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force = false)
{ {
$meta = $md_manager->get_metadata('all'); $meta = $md_manager->get_metadata('all');
if (! isset($meta['extra']['version-check'])) if (!isset($meta['extra']['version-check']))
{ {
throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK')); throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1);
} }
$meta_vc = $meta['extra']['version-check']; $version_check = $meta['extra']['version-check'];
$version_helper = new \phpbb\version_helper($this->cache, $this->config, $this->user); $version_helper = new \phpbb\version_helper($this->cache, $this->config, $this->user);
$version_helper->set_current_version($meta['version']); $version_helper->set_current_version($meta['version']);
$version_helper->set_file_location($meta_vc['host'], $meta_vc['directory'], $meta_vc['filename']); $version_helper->set_file_location($version_check ['host'], $version_check ['directory'], $version_check ['filename']);
return $updates = $version_helper->get_suggested_updates(true); return $updates = $version_helper->get_suggested_updates(true);
} }
@ -498,7 +498,7 @@ class acp_extensions
/** /**
* Sort helper for the table containing the metadata about the extensions. * Sort helper for the table containing the metadata about the extensions.
*/ */
static private function sort_extension_meta_data_table($val1, $val2) protected function sort_extension_meta_data_table($val1, $val2)
{ {
return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']); return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']);
} }

View file

@ -111,5 +111,5 @@ $lang = array_merge($lang, array(
'UP_TO_DATE' => '%s is up to date', 'UP_TO_DATE' => '%s is up to date',
'ANNOUNCEMENT_TOPIC' => 'Release Announcement', 'ANNOUNCEMENT_TOPIC' => 'Release Announcement',
'DOWNLOAD_LATEST' => 'Download Version', 'DOWNLOAD_LATEST' => 'Download Version',
'NO_VERSIONCHECK' => 'No information on how to check the version.', 'NO_VERSIONCHECK' => 'No version check information given.',
)); ));