mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/10631] Various tidbits and cleanup on the acp extensions manager
PHPBB3-10631
This commit is contained in:
parent
c45243a91e
commit
3ba59c6362
5 changed files with 253 additions and 243 deletions
|
@ -1,64 +1,51 @@
|
|||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a name="maincontent"></a>
|
||||
|
||||
<h1>{L_EXTENSIONS_ADMIN}</h1>
|
||||
|
||||
<p>{L_EXTENSIONS_EXPLAIN}</p>
|
||||
|
||||
<table cellspacing="1">
|
||||
<col class="row1" ><col class="row2" ><col class="row2" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_EXTENSION_NAME}</th>
|
||||
<th>{L_EXTENSION_OPTIONS}</th>
|
||||
<th>{L_EXTENSION_ACTIONS}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .enabled -->
|
||||
<tr>
|
||||
<td class="row3" colspan="3">
|
||||
<strong>{L_ENABLED} {L_EXTENSIONS}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN enabled -->
|
||||
<tr>
|
||||
<td><strong>{enabled.EXT_NAME}</strong></a></td>
|
||||
<td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td>
|
||||
<td style="text-align: center;"><a href="{enabled.U_DISABLE}">{L_DISABLE}</a>
|
||||
| <a href="{enabled.U_PURGE}">{L_PURGE}</a></td>
|
||||
</tr>
|
||||
<!-- END enabled -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF .disabled -->
|
||||
<tr>
|
||||
<td class="row3" colspan="3"><strong>{L_DISABLED} {L_EXTENSIONS}</strong></td>
|
||||
</tr>
|
||||
<!-- BEGIN disabled -->
|
||||
<tr>
|
||||
<td><strong>{disabled.EXT_NAME}</strong></a></td>
|
||||
<td style="text-align: center;"><a href="{disabled.U_DETAILS}">{L_DETAILS}</a></td>
|
||||
<td style="text-align: center;"><a href="{disabled.U_ENABLE}">{L_ENABLE}</a>
|
||||
| <a href="{disabled.U_PURGE}">{L_PURGE}</a>
|
||||
| <a href="{disabled.U_DELETE}">{L_DELETE}</a></td>
|
||||
</tr>
|
||||
<!-- END disabled -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF .avaliable -->
|
||||
<tr>
|
||||
<td class="row3" colspan="3"><strong>{L_AVALIABLE} {L_EXTENSIONS}</strong></td>
|
||||
</tr>
|
||||
<!-- BEGIN avaliable -->
|
||||
<tr>
|
||||
<td><strong>{avaliable.EXT_NAME}</strong></a></td>
|
||||
<td style="text-align: center;"><a href="{avaliable.U_DETAILS}">{L_DETAILS}</a></td>
|
||||
<td style="text-align: center;"><a href="{avaliable.U_ENABLE}">{L_ENABLE}</a>
|
||||
| <a href="{avaliable.U_DELETE}">{L_DELETE}</a></td>
|
||||
</tr>
|
||||
<!-- END avaliable -->
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<a name="maincontent"></a>
|
||||
|
||||
<h1>{L_EXTENSIONS_ADMIN}</h1>
|
||||
|
||||
<p>{L_EXTENSIONS_EXPLAIN}</p>
|
||||
|
||||
<table cellspacing="1">
|
||||
<col class="row1" ><col class="row2" ><col class="row2" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_EXTENSION_NAME}</th>
|
||||
<th>{L_EXTENSION_OPTIONS}</th>
|
||||
<th>{L_EXTENSION_ACTIONS}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- IF .enabled -->
|
||||
<tr>
|
||||
<td class="row3" colspan="3">
|
||||
<strong>{L_ENABLED} {L_EXTENSIONS}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN enabled -->
|
||||
<tr>
|
||||
<td><strong>{enabled.EXT_NAME}</strong></a></td>
|
||||
<td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td>
|
||||
<td style="text-align: center;"><a href="{enabled.U_DISABLE}">{L_DISABLE}</a>
|
||||
| <a href="{enabled.U_PURGE}">{L_PURGE}</a></td>
|
||||
</tr>
|
||||
<!-- END enabled -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF .disabled -->
|
||||
<tr>
|
||||
<td class="row3" colspan="3"><strong>{L_DISABLED} {L_EXTENSIONS}</strong></td>
|
||||
</tr>
|
||||
<!-- BEGIN disabled -->
|
||||
<tr>
|
||||
<td><strong>{disabled.EXT_NAME}</strong></a></td>
|
||||
<td style="text-align: center;"><a href="{disabled.U_DETAILS}">{L_DETAILS}</a></td>
|
||||
<td style="text-align: center;"><a href="{disabled.U_ENABLE}">{L_ENABLE}</a>
|
||||
<!-- IF disabled.U_PURGE -->| <a href="{disabled.U_PURGE}">{L_PURGE}</a> <!-- ENDIF -->
|
||||
<!-- IF disabled.U_DELETE -->| <a href="{disabled.U_DELETE}">{L_DELETE}</a><!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- END disabled -->
|
||||
<!-- ENDIF -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
|
|
|
@ -25,7 +25,7 @@ class acp_extensions
|
|||
function main()
|
||||
{
|
||||
// Start the page
|
||||
global $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path;
|
||||
global $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx;
|
||||
|
||||
$user->add_lang(array('install', 'acp/extensions'));
|
||||
|
||||
|
@ -39,8 +39,8 @@ class acp_extensions
|
|||
{
|
||||
case 'list':
|
||||
default:
|
||||
$this->list_enabled_exts($db, $template);
|
||||
$this->list_disabled_exts($db, $template);
|
||||
$this->list_enabled_exts($phpbb_extension_manager, $template);
|
||||
$this->list_disabled_exts($phpbb_extension_manager, $template);
|
||||
$this->list_available_exts($phpbb_extension_manager, $template);
|
||||
|
||||
$this->tpl_name = 'acp_ext_list';
|
||||
|
@ -103,7 +103,7 @@ class acp_extensions
|
|||
));
|
||||
break;
|
||||
|
||||
case 'delete_pre':
|
||||
/*case 'delete_pre':
|
||||
$this->tpl_name = 'acp_ext_delete';
|
||||
|
||||
$template->assign_vars(array(
|
||||
|
@ -114,11 +114,15 @@ class acp_extensions
|
|||
|
||||
case 'delete':
|
||||
$this->tpl_name = 'acp_ext_delete';
|
||||
break;
|
||||
break;*/
|
||||
|
||||
case 'details':
|
||||
$md_manager = new phpbb_extension_metadata_manager($ext_name, $db, $phpbb_extension_manager, $phpbb_root_path, ".$phpEx", $template);
|
||||
$md_manager->get_all_meta_data('all', true);
|
||||
|
||||
if ($md_manager->get_metadata('all', true) === false)
|
||||
{
|
||||
trigger_error('EXTENSION_INVALID');
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_ext_details';
|
||||
break;
|
||||
|
@ -128,91 +132,74 @@ class acp_extensions
|
|||
/**
|
||||
* Lists all the enabled extensions and dumps to the template
|
||||
*
|
||||
* @param $db A database connection
|
||||
* @param $template An instance of the template engine
|
||||
* @param $phpbb_extension_manager An instance of the extension manager
|
||||
* @param $template An instance of the template engine
|
||||
* @return null
|
||||
*/
|
||||
private function list_enabled_exts($db, $template)
|
||||
private function list_enabled_exts(phpbb_extension_manager $phpbb_extension_manager, phpbb_template $template)
|
||||
{
|
||||
$sql = 'SELECT ext_name
|
||||
FROM ' . EXT_TABLE . '
|
||||
WHERE ext_active = 1
|
||||
ORDER BY ext_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
// TODO: Use the display name from the composer.json
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
foreach ($phpbb_extension_manager->all_enabled() as $name => $location)
|
||||
{
|
||||
$md_manager = $phpbb_extension_manager->get_extension_metadata($name, $template);
|
||||
|
||||
$template->assign_block_vars('enabled', array(
|
||||
'EXT_NAME' => $row['ext_name'],
|
||||
'EXT_NAME' => $md_manager->get_metadata('name'),
|
||||
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $row['ext_name'],
|
||||
'U_PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . $row['ext_name'],
|
||||
'U_DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . $row['ext_name'],
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $name,
|
||||
'U_PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . $name,
|
||||
'U_DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . $name,
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all the disabled extensions and dumps to the template
|
||||
*
|
||||
* @param $db A database connection
|
||||
* @param $template An instance of the template engine
|
||||
* @param $phpbb_extension_manager An instance of the extension manager
|
||||
* @param $template An instance of the template engine
|
||||
* @return null
|
||||
*/
|
||||
private function list_disabled_exts($db, $template)
|
||||
private function list_disabled_exts(phpbb_extension_manager $phpbb_extension_manager, phpbb_template $template)
|
||||
{
|
||||
$sql = 'SELECT ext_name
|
||||
FROM ' . EXT_TABLE . '
|
||||
WHERE ext_active = 0
|
||||
ORDER BY ext_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
// TODO: Use the display name from the composer.json
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
foreach ($phpbb_extension_manager->all_disabled() as $name => $location)
|
||||
{
|
||||
$md_manager = $phpbb_extension_manager->get_extension_metadata($name, $template);
|
||||
|
||||
$template->assign_block_vars('disabled', array(
|
||||
'EXT_NAME' => $row['ext_name'],
|
||||
'EXT_NAME' => $md_manager->get_metadata('name'),
|
||||
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $row['ext_name'],
|
||||
'U_PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . $row['ext_name'],
|
||||
'U_DELETE' => $this->u_action . '&action=delete_pre&ext_name=' . $row['ext_name'],
|
||||
'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $row['ext_name'],
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $name,
|
||||
'U_PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . $name,
|
||||
//'U_DELETE' => $this->u_action . '&action=delete_pre&ext_name=' . $name,
|
||||
'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $name,
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all the available extensions and dumps to the template
|
||||
*
|
||||
* @param $db A database connection
|
||||
* @param $template An instance of the template engine
|
||||
* @param $phpbb_extension_manager An instance of the extension manager
|
||||
* @param $template An instance of the template engine
|
||||
* @return null
|
||||
*/
|
||||
function list_available_exts($phpbb_extension_manager, $template)
|
||||
function list_available_exts(phpbb_extension_manager $phpbb_extension_manager, phpbb_template $template)
|
||||
{
|
||||
$phpbb_extension_manager->load_extensions();
|
||||
$all_available = array_keys($phpbb_extension_manager->all_available());
|
||||
$all_configured = array_keys($phpbb_extension_manager->all_configured());
|
||||
$uninstalled = array_diff($all_available, $all_configured);
|
||||
|
||||
// TODO: Use the display name from the composer.json
|
||||
|
||||
foreach ($uninstalled as $ext)
|
||||
foreach ($uninstalled as $name => $location)
|
||||
{
|
||||
$template->assign_block_vars('disabled', array(
|
||||
'EXT_NAME' => $ext['ext_name'],
|
||||
$md_manager = $phpbb_extension_manager->get_extension_metadata($ext, $template);
|
||||
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $ext['ext_name'],
|
||||
'U_DELETE' => $this->u_action . '&action=delete_pre&ext_name=' . $ext['ext_name'],
|
||||
'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $ext['ext_name'],
|
||||
$template->assign_block_vars('disabled', array(
|
||||
'EXT_NAME' => $md_manager->get_metadata('name'),
|
||||
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $name,
|
||||
//'U_DELETE' => $this->u_action . '&action=delete_pre&ext_name=' . $name,
|
||||
'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $name,
|
||||
));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ if (!defined('IN_PHPBB'))
|
|||
*/
|
||||
class phpbb_extension_manager
|
||||
{
|
||||
protected $db;
|
||||
protected $cache;
|
||||
protected $php_ext;
|
||||
protected $extensions;
|
||||
|
@ -120,6 +121,18 @@ class phpbb_extension_manager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates the metadata manager for the extension with the given name
|
||||
*
|
||||
* @param string $name The extension name
|
||||
* @param string $template The template manager
|
||||
* @return phpbb_extension_metadata_manager Instance of the metadata manager
|
||||
*/
|
||||
public function get_extension_metadata($name, phpbb_template $template)
|
||||
{
|
||||
return new phpbb_extension_metadata_manager($name, $this->db, $this, $this->phpbb_root_path, $this->phpEx, $template);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a step of the extension enabling process.
|
||||
*
|
||||
|
|
|
@ -26,6 +26,7 @@ class phpbb_extension_metadata_manager
|
|||
protected $extension_manager;
|
||||
protected $db;
|
||||
protected $phpbb_root_path;
|
||||
protected $template;
|
||||
protected $ext_name;
|
||||
public $metadata;
|
||||
protected $metadata_file;
|
||||
|
@ -38,11 +39,12 @@ class phpbb_extension_metadata_manager
|
|||
* @param string $phpbb_root_path Path to the phpbb includes directory.
|
||||
* @param string $phpEx php file extension
|
||||
*/
|
||||
public function __construct($ext_name, dbal $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php')
|
||||
public function __construct($ext_name, dbal $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', phpbb_template $template)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->db = $db;
|
||||
$this->phpEx = $phpEx;
|
||||
$this->template = $template;
|
||||
$this->extension_manager = $extension_manager;
|
||||
$this->ext_name = $ext_name;
|
||||
$this->metadata = array();
|
||||
|
@ -56,7 +58,7 @@ class phpbb_extension_metadata_manager
|
|||
* @param boolean $template_output True if you want the requested metadata assigned to template vars
|
||||
* @return array Contains all of the requested metadata
|
||||
*/
|
||||
public function get_metadata($element = 'all', $template_output = false, phpbb_template $template)
|
||||
public function get_metadata($element = 'all', $template_output = false)
|
||||
{
|
||||
// TODO: Check ext_name exists and is an extension that exists
|
||||
if (!$this->set_metadata_file())
|
||||
|
@ -64,6 +66,11 @@ class phpbb_extension_metadata_manager
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!$this->fetch_metadata())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($element)
|
||||
{
|
||||
case 'all':
|
||||
|
@ -82,7 +89,7 @@ class phpbb_extension_metadata_manager
|
|||
break;
|
||||
|
||||
case 'name':
|
||||
if ($this->validate_name)
|
||||
if ($this->validate_name())
|
||||
{
|
||||
if ($template_output)
|
||||
{
|
||||
|
@ -90,6 +97,7 @@ class phpbb_extension_metadata_manager
|
|||
'MD_NAME' => htmlspecialchars($this->metadata['name']),
|
||||
));
|
||||
}
|
||||
|
||||
return $this->metadata['name'];
|
||||
}
|
||||
else
|
||||
|
@ -129,7 +137,7 @@ class phpbb_extension_metadata_manager
|
|||
* @return array Contains the cleaned and validated metadata array
|
||||
*/
|
||||
private function clean_metadata_array()
|
||||
{
|
||||
{
|
||||
if (!$this->validate_name() || !$this->validate_type() || !$this->validate_license() || !$this->validate_description() || !$this->validate_version() || !$this->validate_require_phpbb() || !$this->validate_extra_display_name())
|
||||
{
|
||||
return false;
|
||||
|
@ -150,7 +158,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_name()
|
||||
{
|
||||
return preg_match('^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$', $this->metadata['name']);
|
||||
return preg_match('#^[a-zA-Z0-9_\x7f-\xff]{2,}/[a-zA-Z0-9_\x7f-\xff]{2,}$#', $this->metadata['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +168,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_type()
|
||||
{
|
||||
return $this->metadata['type'] != 'phpbb3-extension';
|
||||
return $this->metadata['type'] == 'phpbb3-extension';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +178,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_description()
|
||||
{
|
||||
return preg_match('^{10,}$', $this->metadata['description']);
|
||||
return preg_match('#^{10,}$#', $this->metadata['description']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,7 +188,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_version()
|
||||
{
|
||||
return preg_match('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}', $this->metadata['version']);
|
||||
return preg_match('#^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}#', $this->metadata['version']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,7 +209,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_require_phpbb()
|
||||
{
|
||||
return (preg_match('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$', $this->metadata['require']['phpbb']) && version_compare($this->metadata['require']['phpbb']), '3.1.0', '>');
|
||||
return (preg_match('#^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$#', $this->metadata['require']['phpbb']) && version_compare($this->metadata['require']['phpbb'], '3.1.0', '>='));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,7 +219,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_extra_display_name()
|
||||
{
|
||||
return preg_match('^[a-zA-Z0-9_]{2,0}$', $this->metadata['name']);
|
||||
return preg_match('#^[a-zA-Z0-9_]{2,0}$#', $this->metadata['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -234,7 +242,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_require_php()
|
||||
{
|
||||
return preg_match('^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$', $this->metadata['require']['phpbb']
|
||||
return (preg_match('#^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$#', $this->metadata['require']['php']) && version_compare($this->metadata['require']['php'], phpversion(), '>='));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -255,7 +263,7 @@ class phpbb_extension_metadata_manager
|
|||
*/
|
||||
private function validate_homepage()
|
||||
{
|
||||
return preg_match('([\d\w-.]+?\.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|pro)(\b|\W(?<!&|=)(?!\.\s|\.{3}).*?))(\s|$)', $this->metadata['homepage'])
|
||||
return preg_match('#([\d\w-.]+?\.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|pro)(\b|\W(?<!&|=)(?!\.\s|\.{3}).*?))(\s|$)#', $this->metadata['homepage']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,19 +295,32 @@ class phpbb_extension_metadata_manager
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the contents of the composer.json file and can also assign template vars
|
||||
* Gets the contents of the composer.json file
|
||||
*
|
||||
* @return array Contains everything from the meta data file. Do not use without validating and cleaning first
|
||||
* @return bool True of false (if loading succeeded or failed)
|
||||
*/
|
||||
private function fetch_metadata()
|
||||
{
|
||||
// Read it
|
||||
$metadata_file = file_get_contents($metadata_filepath);
|
||||
$metadata = json_decode($metadata_file, true)
|
||||
|
||||
$this->metadata = $metadata;
|
||||
|
||||
return $metadata;
|
||||
if (!file_exists($this->metadata_file))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!($file_contents = file_get_contents($this->metadata_file)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($metadata = json_decode($file_contents, true)) === NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->metadata = $metadata;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,3 +355,4 @@ class phpbb_extension_metadata_manager
|
|||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,103 +1,104 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* acp_extensions [English]
|
||||
*
|
||||
* @package language
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT CHANGE
|
||||
*/
|
||||
if (empty($lang) || !is_array($lang))
|
||||
{
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
// DEVELOPERS PLEASE NOTE
|
||||
//
|
||||
// Placeholders can now contain order information, e.g. instead of
|
||||
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
|
||||
// translators to re-order the output of data while ensuring it remains correct
|
||||
//
|
||||
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
|
||||
// equally where a string contains only two placeholders which are used to wrap text
|
||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||
|
||||
|
||||
$lang = array_merge($lang, array(
|
||||
'EXTENSION' => 'Extension',
|
||||
'EXTENSIONS' => 'Extensions',
|
||||
'EXTENSIONS_ADMIN' => 'Extensions Manager',
|
||||
'EXTENSIONS_EXPLAIN' => 'The Extensions Manager is a tool in your phpBB Board which allows you to manage all of your extensions statuses and view information about them.',
|
||||
|
||||
'DETAILS' => 'Details',
|
||||
|
||||
'AVAILABLE' => 'Available',
|
||||
'ENABLED' => 'Enabled',
|
||||
'DISABLED' => 'Disabled',
|
||||
'PURGED' => 'Purged',
|
||||
'DELETED' => 'Deleted',
|
||||
'UPLOADED' => 'Uploaded',
|
||||
|
||||
'ENABLE' => 'Enable',
|
||||
'DISABLE' => 'Disable',
|
||||
'PURGE' => 'Purge',
|
||||
'DELETE' => 'Delete',
|
||||
|
||||
'ENABLE_EXPLAIN' => 'Enabling an extension allows you to use it on your board.',
|
||||
'DISABLE_EXPLAIN' => 'Disabling an extension retains its files and settings but removes any functionality added by the extension.',
|
||||
'PURGE_EXPLAIN' => 'Purging an extension clears an extensions data while retaining its files.',
|
||||
'DELETE_EXPLAIN' => 'Deleting an extension removes all of its files and settings. Log entries will remain, although any language variables added by the extension will not be available.',
|
||||
|
||||
'ENABLE_SUCESS' => 'The extension was enabled successfully',
|
||||
'DISABLE_SUCESS' => 'The extension was disabled successfully',
|
||||
'PURGE_SUCESS' => 'The extension was purged successfully',
|
||||
'DELETE_SUCESS' => 'The extension was deleted successfully',
|
||||
|
||||
'ENABLE_FAIL' => 'The extension could not be enabled',
|
||||
'DISABLE_FAIL' => 'The extension could not be disabled',
|
||||
'PURGE_FAIL' => 'The extension could not be purged',
|
||||
'DELETE_FAIL' => 'The extension could not be deleted',
|
||||
|
||||
'EXTENSION_NAME' => 'Extension Name',
|
||||
'EXTENSION_ACTIONS' => 'Actions',
|
||||
'EXTENSION_OPTIONS' => 'Options',
|
||||
|
||||
'ENABLE_CONFIRM' => 'Are you sure that you wish to enable this extension?',
|
||||
'DISABLE_CONFIRM' => 'Are you sure that you wish to disable this extension?',
|
||||
'PURGE_CONFIRM' => 'Are you sure that you wish to purge this extension's data? This cannot be undone.',
|
||||
'DELETE_CONFIRM' => 'Are you sure that you wish to data this extension's files and clear its data? This cannot be undone.',
|
||||
|
||||
'WARNING' => 'Warning',
|
||||
'RETURN' => 'Return',
|
||||
|
||||
'EXT_DETAILS' => 'Extension Details',
|
||||
'DISPLAY_NAME' => 'Display Name',
|
||||
'CLEAN_NAME' => 'Clean Name',
|
||||
'TYPE' => 'Type',
|
||||
'DESCRIPTION' => 'Description',
|
||||
'VERSION' => 'Version',
|
||||
'HOMEPAGE' => 'Homepage',
|
||||
'PATH' => 'File Path',
|
||||
'TIME' => 'Release Time',
|
||||
'LICENCE' => 'Licence',
|
||||
|
||||
'REQUIREMENTS' => 'Requirements',
|
||||
'PHPBB_VERSION' => 'phpBB Version',
|
||||
'PHP_VERSION' => 'PHP Version',
|
||||
'AUTHOR_INFORMATION' => 'Author Information',
|
||||
'AUTHOR_NAME' => 'Name',
|
||||
'AUTHOR_EMAIL' => 'Email',
|
||||
'AUTHOR_HOMEPAGE' => 'Homepage',
|
||||
'AUTHOR_ROLE' => 'Role',
|
||||
));
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* acp_extensions [English]
|
||||
*
|
||||
* @package language
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
||||
*
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT CHANGE
|
||||
*/
|
||||
if (empty($lang) || !is_array($lang))
|
||||
{
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
// DEVELOPERS PLEASE NOTE
|
||||
//
|
||||
// Placeholders can now contain order information, e.g. instead of
|
||||
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
|
||||
// translators to re-order the output of data while ensuring it remains correct
|
||||
//
|
||||
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
|
||||
// equally where a string contains only two placeholders which are used to wrap text
|
||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||
|
||||
|
||||
$lang = array_merge($lang, array(
|
||||
'EXTENSION' => 'Extension',
|
||||
'EXTENSIONS' => 'Extensions',
|
||||
'EXTENSIONS_ADMIN' => 'Extensions Manager',
|
||||
'EXTENSIONS_EXPLAIN' => 'The Extensions Manager is a tool in your phpBB Board which allows you to manage all of your extensions statuses and view information about them.',
|
||||
'EXTENSION_INVALID' => 'The selected extension is not valid.',
|
||||
|
||||
'DETAILS' => 'Details',
|
||||
|
||||
'AVAILABLE' => 'Available',
|
||||
'ENABLED' => 'Enabled',
|
||||
'DISABLED' => 'Disabled',
|
||||
'PURGED' => 'Purged',
|
||||
'DELETED' => 'Deleted',
|
||||
'UPLOADED' => 'Uploaded',
|
||||
|
||||
'ENABLE' => 'Enable',
|
||||
'DISABLE' => 'Disable',
|
||||
'PURGE' => 'Purge',
|
||||
'DELETE' => 'Delete',
|
||||
|
||||
'ENABLE_EXPLAIN' => 'Enabling an extension allows you to use it on your board.',
|
||||
'DISABLE_EXPLAIN' => 'Disabling an extension retains its files and settings but removes any functionality added by the extension.',
|
||||
'PURGE_EXPLAIN' => 'Purging an extension clears an extensions data while retaining its files.',
|
||||
'DELETE_EXPLAIN' => 'Deleting an extension removes all of its files and settings. Log entries will remain, although any language variables added by the extension will not be available.',
|
||||
|
||||
'ENABLE_SUCESS' => 'The extension was enabled successfully',
|
||||
'DISABLE_SUCESS' => 'The extension was disabled successfully',
|
||||
'PURGE_SUCESS' => 'The extension was purged successfully',
|
||||
'DELETE_SUCESS' => 'The extension was deleted successfully',
|
||||
|
||||
'ENABLE_FAIL' => 'The extension could not be enabled',
|
||||
'DISABLE_FAIL' => 'The extension could not be disabled',
|
||||
'PURGE_FAIL' => 'The extension could not be purged',
|
||||
'DELETE_FAIL' => 'The extension could not be deleted',
|
||||
|
||||
'EXTENSION_NAME' => 'Extension Name',
|
||||
'EXTENSION_ACTIONS' => 'Actions',
|
||||
'EXTENSION_OPTIONS' => 'Options',
|
||||
|
||||
'ENABLE_CONFIRM' => 'Are you sure that you wish to enable this extension?',
|
||||
'DISABLE_CONFIRM' => 'Are you sure that you wish to disable this extension?',
|
||||
'PURGE_CONFIRM' => 'Are you sure that you wish to purge this extension's data? This cannot be undone.',
|
||||
'DELETE_CONFIRM' => 'Are you sure that you wish to data this extension's files and clear its data? This cannot be undone.',
|
||||
|
||||
'WARNING' => 'Warning',
|
||||
'RETURN' => 'Return',
|
||||
|
||||
'EXT_DETAILS' => 'Extension Details',
|
||||
'DISPLAY_NAME' => 'Display Name',
|
||||
'CLEAN_NAME' => 'Clean Name',
|
||||
'TYPE' => 'Type',
|
||||
'DESCRIPTION' => 'Description',
|
||||
'VERSION' => 'Version',
|
||||
'HOMEPAGE' => 'Homepage',
|
||||
'PATH' => 'File Path',
|
||||
'TIME' => 'Release Time',
|
||||
'LICENCE' => 'Licence',
|
||||
|
||||
'REQUIREMENTS' => 'Requirements',
|
||||
'PHPBB_VERSION' => 'phpBB Version',
|
||||
'PHP_VERSION' => 'PHP Version',
|
||||
'AUTHOR_INFORMATION' => 'Author Information',
|
||||
'AUTHOR_NAME' => 'Name',
|
||||
'AUTHOR_EMAIL' => 'Email',
|
||||
'AUTHOR_HOMEPAGE' => 'Homepage',
|
||||
'AUTHOR_ROLE' => 'Role',
|
||||
));
|
||||
|
|
Loading…
Add table
Reference in a new issue