本文整理汇总了PHP中theme_essential\toolbox类的典型用法代码示例。如果您正苦于以下问题:PHP toolbox类的具体用法?PHP toolbox怎么用?PHP toolbox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了toolbox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_essentials_process_css
/**
* Essentials is a basic child theme of Essential to help you as a theme
* developer create your own child theme of Essential.
*
* @package theme_essentials
* @copyright 2015 Gareth J Barnard
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function theme_essentials_process_css($css, $theme)
{
/* Change to 'false' if you don't want to use Essential's settings and remove '$THEME->parents_exclude_sheets' in config.php.
*
* If you want to override any Essential setting with a separate version in this child theme, then define it in 'settings.php' with the
* same name bar the theme name prefix and 'theme_essential_process_css' will do the rest via 'toolbox.php'. Please look at the examples
* already coded in 'settings.php'.
*
* If you want the alternative colours, then remove the overridden method 'custom_menu_themecolours' in the 'theme_essentials_core_renderer'
* class in the 'core_renderer.php' file in the 'classes' folder. */
$usingessentialsettings = true;
if ($usingessentialsettings) {
global $CFG;
if (file_exists("{$CFG->dirroot}/theme/essential/lib.php")) {
require_once "{$CFG->dirroot}/theme/essential/lib.php";
} else {
if (!empty($CFG->themedir) and file_exists("{$CFG->themedir}/essential/lib.php")) {
require_once "{$CFG->themedir}/essential/lib.php";
}
}
// else will just fail when cannot find theme_essential_process_css!
$css = theme_essential_process_css($css, $theme);
}
// If you have your own additional settings, then add them here.
$css = essentials_set_frontpagetitlestyle($css, \theme_essential\toolbox::get_setting('frontpagetitlestyle', false, $theme));
// Finally return processed CSS
return $css;
}
示例2: theme_essential_insert_analytics_tracking
function theme_essential_insert_analytics_tracking()
{
$siteurl = \theme_essential\toolbox::get_setting('analyticssiteurl');
$tracking = '';
if (!empty($siteurl)) {
$imagetrack = \theme_essential\toolbox::get_setting('analyticsimagetrack');
$siteid = \theme_essential\toolbox::get_setting('analyticssiteid');
$trackadmin = \theme_essential\toolbox::get_setting('analyticstrackadmin');
$cleanurl = \theme_essential\toolbox::get_setting('analyticscleanurl');
if ($imagetrack) {
$addition = '<noscript><p><img src="//' . $siteurl . '/piwik.php?idsite=' . $siteid . '" style="border:0" alt="" /></p></noscript>';
} else {
$addition = '';
}
if ($cleanurl) {
$doctitle = "_paq.push(['setDocumentTitle', " . theme_essential_analytics_trackurl() . "]);";
} else {
$doctitle = "";
}
if (!is_siteadmin() || $trackadmin) {
$tracking = "<script type='text/javascript'>\n var _paq = _paq || [];\n " . $doctitle . "\n _paq.push(['enableLinkTracking']);\n _paq.push(['trackPageView']);\n (function(){\n var u=(('https:' == document.location.protocol) ? 'https' : 'http') + '://" . $siteurl . "/';\n _paq.push(['setSiteId', " . $siteid . "]);\n _paq.push(['setTrackerUrl', u+'piwik.php']);\n var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js';\n s.parentNode.insertBefore(g,s);\n })();\n </script>\n " . $addition;
}
}
return $tracking;
}
示例3: insert_analytics_tracking
function insert_analytics_tracking()
{
global $PAGE, $OUTPUT;
$trackingid = \theme_essential\toolbox::get_setting('analyticstrackingid');
$trackadmin = \theme_essential\toolbox::get_setting('analyticstrackadmin');
$cleanurl = \theme_essential\toolbox::get_setting('analyticscleanurl');
$tracking = '';
if ($cleanurl) {
$addition = "{'hitType' : 'pageview',\n 'page' : " . analytics_trackurl() . ",\n 'title' : '" . addslashes($PAGE->heading) . "'\n }";
} else {
$addition = "'pageview'";
}
if (!is_siteadmin() || $trackadmin) {
$tracking = "\n <script>\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n ga('create', '" . $trackingid . "', {'siteSpeedSampleRate': 50});\n ga('send', " . $addition . ");\n\n </script>";
}
return $tracking;
}
示例4: test_render_slide
public function test_render_slide()
{
$theslide = \theme_essential\toolbox::render_slide(1, 0);
$thecontent = '<a href="https://about.me/gjbarnard" target="_blank" class="item side-caption active">';
$thecontent .= '<div class="container-fluid"><div class="row-fluid"><div class="span5 the-side-caption">';
$thecontent .= '<div class="the-side-caption-content"><h4>Test slide one</h4><div><p>Test of link in caption: me.</p>';
$thecontent .= '</div></div></div><div class="span7"><div class="carousel-image-container">';
$thecontent .= '<img src="http://www.example.com/moodle/theme/image.php/_s/essential/theme/1/default_slide" ';
$thecontent .= 'alt="Test slide one" class="carousel-image"></div></div></div></div></a>';
$this->assertEquals($thecontent, $theslide);
$theslide = \theme_essential\toolbox::render_slide(2, 0);
$thecontent = '<div class="item side-caption">';
$thecontent .= '<div class="container-fluid"><div class="row-fluid"><div class="span5 the-side-caption">';
$thecontent .= '<div class="the-side-caption-content"><h4>Test slide two</h4><div>';
$thecontent .= '<p>Test of link in caption: <a href="https://about.me/gjbarnard" target="_blank">me.</a></p>';
$thecontent .= '</div></div></div><div class="span7"><div class="carousel-image-container">';
$thecontent .= '<img src="http://www.example.com/moodle/theme/image.php/_s/essential/theme/1/default_slide" ';
$thecontent .= 'alt="Test slide two" class="carousel-image"></div></div></div></div></div>';
$this->assertEquals($thecontent, $theslide);
}
示例5:
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Essential is a clean and customizable theme.
*
* @package theme_essential
* @copyright 2016 Gareth J Barnard
* @copyright 2014 Gareth J Barnard, David Bezemer
* @copyright 2013 Julian Ridden
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once \theme_essential\toolbox::get_tile_file('additionaljs');
require_once \theme_essential\toolbox::get_tile_file('pagesettings');
echo $OUTPUT->doctype();
?>
<html <?php
echo $OUTPUT->htmlattributes();
?>
>
<head>
<title><?php
echo $OUTPUT->page_title();
?>
</title>
<link rel="shortcut icon" href="<?php
echo $OUTPUT->favicon();
?>
"/>
示例6:
echo $OUTPUT->course_content_footer();
}
?>
</section>
<?php
if (!$footerregion) {
if ($hasboringlayout && $left || !$left) {
echo $OUTPUT->blocks('side-pre', 'span3 desktop-first-column');
} else {
echo $OUTPUT->blocks('side-pre', 'span3 pull-right');
}
}
?>
</div>
<?php
if ($footerregion) {
echo $OUTPUT->essential_blocks('side-pre', 'row-fluid', 'aside', 4);
}
?>
</div>
</div>
<!-- End Main Regions -->
</section>
</div>
<?php
require_once \theme_essential\toolbox::get_tile_file('footer');
?>
</body>
</html>
示例7: preg_replace
<div class="row-fluid">
<!-- HEADER: LOGO AREA -->
<div class="<?php
echo $logoclass;
echo !$left ? ' pull-right' : ' pull-left';
?>
">
<?php
if (!$haslogo) {
?>
<a class="textlogo" href="<?php
echo preg_replace("(https?:)", "", $CFG->wwwroot);
?>
">
<i id="headerlogo" class="fa fa-<?php
echo \theme_essential\toolbox::get_setting('siteicon');
?>
"></i>
<?php
echo $OUTPUT->get_title('header');
?>
</a>
<?php
} else {
?>
<a class="logo" href="<?php
echo preg_replace("(https?:)", "", $CFG->wwwroot);
?>
" title="<?php
print_string('home');
?>
示例8: favicon
/**
* Returns the url of the custom favicon.
*/
public function favicon()
{
$favicon = \theme_essential\toolbox::get_setting('favicon', 'format_file_url');
if (empty($favicon)) {
return $this->page->theme->pix_url('favicon', 'theme');
} else {
return $favicon;
}
}
示例9:
echo $OUTPUT->essential_edit_button('theme_essential_slideshow');
?>
<ol class="carousel-indicators">
<?php
for ($indicatorslideindex = 0; $indicatorslideindex < $numberofslides; $indicatorslideindex++) {
echo '<li data-target="#essentialCarousel" data-slide-to="' . $indicatorslideindex . '"';
if ($indicatorslideindex == 0) {
echo 'class="active"';
}
echo '></li>';
}
?>
</ol>
<div class="carousel-inner<?php
echo $captionscenter . $captionsbelowclass;
?>
">
<?php
for ($slideindex = 1; $slideindex <= $numberofslides; $slideindex++) {
echo \theme_essential\toolbox::render_slide($slideindex, $captionoptions);
}
?>
</div>
<?php
echo \theme_essential\toolbox::render_slide_controls($left);
?>
</div>
</div>
</div>
<?php
}
示例10: coursecat_coursebox_content
/**
* Returns HTML to display course content (summary, course contacts and optionally category name)
*
* This method is called from coursecat_coursebox() and may be re-used in AJAX
*
* @param coursecat_helper $chelper various display options
* @param stdClass|course_in_list $course
* @return string
*/
protected function coursecat_coursebox_content(coursecat_helper $chelper, $course)
{
if (!$this->enablecategoryicon) {
return parent::coursecat_coursebox_content($chelper, $course);
}
global $CFG;
if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
return '';
}
if ($course instanceof stdClass) {
require_once $CFG->libdir . '/coursecatlib.php';
$course = new course_in_list($course);
}
$content = '';
$coursehascontacts = $course->has_course_contacts();
// Display course summary.
if ($course->has_summary()) {
$summaryclass = 'summary';
if ($coursehascontacts == false) {
$summaryclass .= ' noteachers';
}
$content .= html_writer::start_tag('div', array('class' => $summaryclass));
$content .= $chelper->get_course_formatted_summary($course, array('overflowdiv' => true, 'noclean' => true, 'para' => false));
$content .= html_writer::end_tag('div');
// Class .summary.
}
// Display course overview files.
$contentimages = $contentfiles = '';
foreach ($course->get_course_overviewfiles() as $file) {
$isimage = $file->is_valid_image();
$url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
if ($isimage) {
$contentimages .= html_writer::tag('div', html_writer::empty_tag('img', array('src' => $url)), array('class' => 'courseimage'));
} else {
$image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')) . html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
$contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon'));
}
}
$content .= $contentimages . $contentfiles;
// Display course contacts. See course_in_list::get_course_contacts().
if ($coursehascontacts) {
$content .= html_writer::start_tag('ul', array('class' => 'teachers'));
foreach ($course->get_course_contacts() as $userid => $coursecontact) {
$faiconsetting = \theme_essential\toolbox::get_setting('courselistteachericon');
$faiconsettinghtml = empty($faiconsetting) ? '' : '<i class="fa fa-' . $faiconsetting . '"></i> ';
$name = $faiconsettinghtml . $coursecontact['rolename'] . ': ' . html_writer::link(new moodle_url('/user/view.php', array('id' => $userid, 'course' => SITEID)), $coursecontact['username']);
$content .= html_writer::tag('li', $name);
}
$content .= html_writer::end_tag('ul');
// Class .teachers.
}
// Display course category if necessary (for example in search results).
if ($chelper->get_show_courses() == self::COURSECAT_SHOW_COURSES_EXPANDED_WITH_CAT) {
require_once $CFG->libdir . '/coursecatlib.php';
if ($cat = coursecat::get($course->category, IGNORE_MISSING)) {
$content .= html_writer::start_tag('div', array('class' => 'coursecat'));
$content .= get_string('category') . ': ' . html_writer::link(new moodle_url('/course/index.php', array('categoryid' => $cat->id)), $cat->get_formatted_name(), array('class' => $cat->visible ? '' : 'dimmed'));
$content .= html_writer::end_tag('div');
// Class .coursecat.
}
}
return $content;
}
示例11: set_font
public static function set_font($css, $type, $fontname)
{
$familytag = '[[setting:' . $type . 'font]]';
$facetag = '[[setting:fontfiles' . $type . ']]';
if (empty($fontname)) {
$familyreplacement = 'Verdana';
$facereplacement = '';
} else {
if (\theme_essential\toolbox::get_setting('fontselect') === '3') {
$fontfiles = array();
$fontfileeot = self::setting_file_url('fontfileeot' . $type, 'fontfileeot' . $type);
if (!empty($fontfileeot)) {
$fontfiles[] = "url('" . $fontfileeot . "?#iefix') format('embedded-opentype')";
}
$fontfilewoff = self::setting_file_url('fontfilewoff' . $type, 'fontfilewoff' . $type);
if (!empty($fontfilewoff)) {
$fontfiles[] = "url('" . $fontfilewoff . "') format('woff')";
}
$fontfilewofftwo = self::setting_file_url('fontfilewofftwo' . $type, 'fontfilewofftwo' . $type);
if (!empty($fontfilewofftwo)) {
$fontfiles[] = "url('" . $fontfilewofftwo . "') format('woff2')";
}
$fontfileotf = self::setting_file_url('fontfileotf' . $type, 'fontfileotf' . $type);
if (!empty($fontfileotf)) {
$fontfiles[] = "url('" . $fontfileotf . "') format('opentype')";
}
$fontfilettf = self::setting_file_url('fontfilettf' . $type, 'fontfilettf' . $type);
if (!empty($fontfilettf)) {
$fontfiles[] = "url('" . $fontfilettf . "') format('truetype')";
}
$fontfilesvg = self::setting_file_url('fontfilesvg' . $type, 'fontfilesvg' . $type);
if (!empty($fontfilesvg)) {
$fontfiles[] = "url('" . $fontfilesvg . "') format('svg')";
}
if (!empty($fontfiles)) {
$familyreplacement = '"' . $fontname . '"';
$facereplacement = '@font-face {' . PHP_EOL . 'font-family: "' . $fontname . '";' . PHP_EOL;
$facereplacement .= !empty($fontfileeot) ? "src: url('" . $fontfileeot . "');" . PHP_EOL : '';
$facereplacement .= "src: ";
$facereplacement .= implode("," . PHP_EOL . " ", $fontfiles);
$facereplacement .= ";";
$facereplacement .= '' . PHP_EOL . "}";
} else {
// No files back to default.
$familyreplacement = 'Verdana';
$facereplacement = '';
}
} else {
$familyreplacement = '"' . $fontname . '"';
$facereplacement = '';
}
}
$css = str_replace($familytag, $familyreplacement, $css);
$css = str_replace($facetag, $facereplacement, $css);
return $css;
}
示例12: test_pix
public function test_pix()
{
$ouricon = \theme_essential\toolbox::pix_url('essential_button', 'theme');
$this->assertEquals('http://www.example.com/moodle/theme/image.php/_s/essential/theme/1/essential_button', $ouricon->out(false));
}
示例13:
$iphoneicon = \theme_essential\toolbox::get_setting('iphoneicon', 'format_file_url');
} else {
$iphoneicon = $OUTPUT->pix_url('homeicon/iphone', 'theme');
}
if (\theme_essential\toolbox::get_setting('ipadicon')) {
$ipadicon = \theme_essential\toolbox::get_setting('ipadicon', 'format_file_url');
} else {
$ipadicon = $OUTPUT->pix_url('homeicon/ipad', 'theme');
}
if (\theme_essential\toolbox::get_setting('iphoneretinaicon')) {
$iphoneretinaicon = \theme_essential\toolbox::get_setting('iphoneretinaicon', 'format_file_url');
} else {
$iphoneretinaicon = $OUTPUT->pix_url('homeicon/iphone_retina', 'theme');
}
if (\theme_essential\toolbox::get_setting('ipadretinaicon')) {
$ipadretinaicon = \theme_essential\toolbox::get_setting('ipadretinaicon', 'format_file_url');
} else {
$ipadretinaicon = $OUTPUT->pix_url('homeicon/ipad_retina', 'theme');
}
?>
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="<?php
echo $iphoneicon;
?>
"/>
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php
echo $ipadicon;
?>
"/>
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php
echo $iphoneretinaicon;
示例14:
echo \theme_essential\toolbox::get_setting('marketing' . $mspot, true);
?>
</span></h5></div>
<?php
if ($spotimage[$mspot]) {
?>
<div class="marketing-image-container">
<div class="marketing-image" id="marketing-image<?php
echo $mspot;
?>
"></div>
</div>
<?php
}
?>
<div class="content<?php
echo $additionalmarketingcontentclass ? ' withbutton' : '';
?>
">
<?php
echo \theme_essential\toolbox::get_setting('marketing' . $mspot . 'content', 'format_html');
echo $spotbutton[$mspot];
?>
</div>
</div>
<?php
}
?>
</div>
</div>
示例15: print_single_section_page
public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
{
return \theme_essential\toolbox::print_single_section_page($this, $this->courserenderer, $course, $sections, $mods, $modnames, $modnamesused, $displaysection);
}