phpBB

Code Changes

File: phpbb/event/md_exporter.php

  Unmodified   Added   Modified   Removed
Line 243Line 243
	}

/**

	}

/**

	* Format the php events as a wiki table

	* Format the md events as a wiki table

	*
* @param string $action

	*
* @param string $action

	* @return string		Number of events found


	* @return string		Number of events found * @deprecated since 3.2
* @deprecated 3.3.5-RC1 (To be removed: 4.0.0-a1)

	*/
public function export_events_for_wiki($action = '')
{

	*/
public function export_events_for_wiki($action = '')
{

Line 296Line 297
		$wiki_page .= '|}' . "\n";

return $wiki_page;

		$wiki_page .= '|}' . "\n";

return $wiki_page;

 
	}

/**
* Format the md events as a rst table
*
* @param string $action
* @return string Number of events found
*/
public function export_events_for_rst(string $action = ''): string
{
$rst_exporter = new rst_exporter();

if ($this->filter === 'adm')
{
if ($action === 'diff')
{
$rst_exporter->add_section_header('h3', 'ACP Template Events');
}
else
{
$rst_exporter->add_section_header('h2', 'ACP Template Events');
}

$rst_exporter->set_columns([
'event' => 'Identifier',
'files' => 'Placement',
'since' => 'Added in Release',
'description' => 'Explanation',
]);
}
else
{
if ($action === 'diff')
{
$rst_exporter->add_section_header('h3', 'Template Events');
}
else
{
$rst_exporter->add_section_header('h2', 'Template Events');
}

$rst_exporter->set_columns([
'event' => 'Identifier',
'files' => 'Prosilver Placement (If applicable)',
'since' => 'Added in Release',
'description' => 'Explanation',
]);
}

$events = [];
foreach ($this->events as $event_name => $event)
{
$files = $this->filter === 'adm' ? implode(', ', $event['files']['adm']) : implode(', ', $event['files']['prosilver']);

$events[] = [
'event' => $event_name,
'files' => $files,
'since' => $event['since'],
'description' => str_replace("\n", '<br>', rtrim($event['description'])),
];
}

$rst_exporter->generate_events_table($events);

return $rst_exporter->get_rst_output();
}

/**
* Format the md events as BBCode list
*
* @param string $action
* @return string Events BBCode
*/
public function export_events_for_bbcode(string $action = ''): string
{
if ($this->filter === 'adm')
{
if ($action === 'diff')
{
$bbcode_text = "[size=150]ACP Template Events[/size]\n";
}
else
{
$bbcode_text = "[size=200]ACP Template Events[/size]\n";
}
}
else
{
if ($action === 'diff')
{
$bbcode_text = "[size=150]Template Events[/size]\n";
}
else
{
$bbcode_text = "[size=200]Template Events[/size]\n";
}
}

if (!count($this->events))
{
return $bbcode_text . "[list][*][i]None[/i][/list]\n";
}

foreach ($this->events as $event_name => $event)
{
$bbcode_text .= "[list]\n";
$bbcode_text .= "[*][b]{$event_name}[/b]\n";

if ($this->filter === 'adm')
{
$bbcode_text .= "Placement: " . implode(', ', $event['files']['adm']) . "\n";
}
else
{
$bbcode_text .= "Prosilver Placement: " . implode(', ', $event['files']['prosilver']) . "\n";
}

$bbcode_text .= "Added in Release: {$event['since']}\n";
$bbcode_text .= "Explanation: {$event['description']}\n";
$bbcode_text .= "[/list]\n";
}

return $bbcode_text;

	}

/**

	}

/**