Skip to content

Commit

Permalink
output MDL-25597 Added three new config settings that allow you to ad…
Browse files Browse the repository at this point in the history
…d additional HTML to every page.
  • Loading branch information
Sam Hemelryk committed Dec 7, 2010
1 parent feaddca commit 90e920c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
7 changes: 7 additions & 0 deletions admin/settings/appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@

// link to tag management interface
$ADMIN->add('appearance', new admin_externalpage('managetags', get_string('managetags', 'tag'), "$CFG->wwwroot/tag/manage.php"));

$temp = new admin_settingpage('additionalhtml', get_string('additionalhtml', 'admin'));
$temp->add(new admin_setting_heading('additionalhtml_heading', get_string('additionalhtml_heading', 'admin'), get_string('additionalhtml_desc', 'admin')));
$temp->add(new admin_setting_configtextarea('additionalhtmlhead', get_string('additionalhtmlhead', 'admin'), get_string('additionalhtmlhead_desc', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtextarea('additionalhtmltopofbody', get_string('additionalhtmltopofbody', 'admin'), get_string('additionalhtmltopofbody_desc', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtextarea('additionalhtmlfooter', get_string('additionalhtmlfooter', 'admin'), get_string('additionalhtmlfooter_desc', 'admin'), '', PARAM_RAW));
$ADMIN->add('appearance', $temp);

} // end of speedup

9 changes: 9 additions & 0 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@

$string['accessdenied'] = 'Access denied';
$string['accounts'] = 'Accounts';
$string['additionalhtml'] = 'Additional HTML';
$string['additionalhtml_heading'] = 'Additional HTML to be added to every page.';
$string['additionalhtml_desc'] = 'These settings allow you to specify HTML that you want added to every page. You can set HTML that will be added within the HEAD tag for the page, immediatly after the BODY tag has been opened, or immediatly before the body tag is closed.<br />Doing this allows you add custom headers or footers on every page, or add support for services like Google Analytics very easily and independent of your chosen theme.';
$string['additionalhtmlhead'] = 'Within HEAD';
$string['additionalhtmlhead_desc'] = 'Content here will be added to the bottom of the HEAD tag for every page.';
$string['additionalhtmltopofbody'] = 'When BODY is opened';
$string['additionalhtmltopofbody_desc'] = 'Content here will be added in to every page immediatly after the opening body tag.';
$string['additionalhtmlfooter'] = 'Before BODY is closed';
$string['additionalhtmlfooter_desc'] = 'Content here will be added in to every page right before the body tag is closed.';
$string['adminseesall'] = 'Admins see all';
$string['adminseesallevents'] = 'Administrators see all events';
$string['adminseesownevents'] = 'Administrators are just like other users';
Expand Down
14 changes: 13 additions & 1 deletion lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ public function standard_head_html() {
$output .= html_writer::empty_tag('link', array('rel' => 'alternate',
'type' => $type, 'title' => $alt->title, 'href' => $alt->url));
}

if (!empty($CFG->additionalhtmlhead)) {
$output .= "\n".$CFG->additionalhtmlhead;
}

return $output;
}
Expand All @@ -334,7 +338,12 @@ public function standard_head_html() {
* @return string HTML fragment.
*/
public function standard_top_of_body_html() {
return $this->page->requires->get_top_of_body_code();
global $CFG;
$output = $this->page->requires->get_top_of_body_code();
if (!empty($CFG->additionalhtmltopofbody)) {
$output .= "\n".$CFG->additionalhtmltopofbody;
}
return $output;
}

/**
Expand Down Expand Up @@ -367,6 +376,9 @@ public function standard_footer_html() {
<li><a href="http://www.contentquality.com/mynewtester/cynthia.exe?rptmode=0&amp;warnp2n3e=1&amp;url1=' . urlencode(qualified_me()) . '">WCAG 1 (2,3) Check</a></li>
</ul></div>';
}
if (!empty($CFG->additionalhtmlfooter)) {
$output .= "\n".$CFG->additionalhtmlfooter;
}
return $output;
}

Expand Down

0 comments on commit 90e920c

Please sign in to comment.