Merge pull request #17882 from owncloud/allow-classes-in-titles

Allow classes in <h2> tags
This commit is contained in:
Morris Jobke 2015-07-27 09:13:18 +02:00
commit 660e36b49b
2 changed files with 4 additions and 4 deletions

View File

@ -197,8 +197,8 @@ if (\OC::$server->getLockingProvider() instanceof NoopLockingProvider) {
}
$formsMap = array_map(function ($form) {
if (preg_match('%(<h2[^>]*>.*?</h2>)%i', $form, $regs)) {
$sectionName = str_replace('<h2>', '', $regs[0]);
if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
$sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
$sectionName = str_replace('</h2>', '', $sectionName);
$anchor = strtolower($sectionName);
$anchor = str_replace(' ', '-', $anchor);

View File

@ -137,8 +137,8 @@ $formsAndMore[]= ['anchor' => 'passwordform', 'section-name' => $l->t('Personal
$forms=OC_App::getForms('personal');
$formsMap = array_map(function($form){
if (preg_match('%(<h2[^>]*>.*?</h2>)%i', $form, $regs)) {
$sectionName = str_replace('<h2>', '', $regs[0]);
if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
$sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
$sectionName = str_replace('</h2>', '', $sectionName);
$anchor = strtolower($sectionName);
$anchor = str_replace(' ', '-', $anchor);