1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-18 22:41:28 +02:00

Merge branch '3.1.x'

This commit is contained in:
Nicofuma
2015-05-06 01:14:08 +02:00
4 changed files with 203 additions and 21 deletions

View File

@@ -24,6 +24,12 @@ class md_exporter
/** @var string phpBB Root Path */
protected $root_path;
/** @var string The minimum version for the events to return */
protected $min_version;
/** @var string The maximum version for the events to return */
protected $max_version;
/** @var string */
protected $filter;
@@ -36,8 +42,10 @@ class md_exporter
/**
* @param string $phpbb_root_path
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
* @param string $min_version
* @param string $max_version
*/
public function __construct($phpbb_root_path, $extension = null)
public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null)
{
$this->root_path = $phpbb_root_path;
$this->path = $this->root_path;
@@ -49,6 +57,8 @@ class md_exporter
$this->events = array();
$this->events_by_file = array();
$this->filter = $this->current_event = '';
$this->min_version = $min_version;
$this->max_version = $max_version;
}
/**
@@ -152,6 +162,11 @@ class md_exporter
$files = $this->validate_file_list($file_details);
$since = $this->validate_since($since);
if (!$this->version_is_filtered($since))
{
continue;
}
$this->events[$event_name] = array(
'event' => $this->current_event,
'files' => $files,
@@ -163,21 +178,48 @@ class md_exporter
return sizeof($this->events);
}
/**
* The version to check
*
* @param string $version
*/
protected function version_is_filtered($version)
{
return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<='))
&& (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>='));
}
/**
* Format the php events as a wiki table
*
* @param string $action
* @return string Number of events found
*/
public function export_events_for_wiki()
public function export_events_for_wiki($action = '')
{
if ($this->filter === 'adm')
{
$wiki_page = '= ACP Template Events =' . "\n";
if ($action === 'diff')
{
$wiki_page = '=== ACP Template Events ===' . "\n";
}
else
{
$wiki_page = '= ACP Template Events =' . "\n";
}
$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Placement !! Added in Release !! Explanation' . "\n";
}
else
{
$wiki_page = '= Template Events =' . "\n";
if ($action === 'diff')
{
$wiki_page = '=== Template Events ===' . "\n";
}
else
{
$wiki_page = '= Template Events =' . "\n";
}
$wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n";
$wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Added in Release !! Explanation' . "\n";
}