php theme_essential-toolbox类(方法)实例源码

下面列出了php theme_essential-toolbox 类(方法)源码代码实例,从而了解它的用法。

作者:nadavka    项目:moodle-accessibilit   
/**
 * 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;
}

作者:RobsonT    项目:Moodl   
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;
}

作者:igormateu    项目:moodle-theme_essentia   
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;
}

作者:igormateu    项目:moodle-theme_essentia   
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);
 }

作者:lucisgi    项目:moodle-theme_essentia   
// 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();
?>
"/>

作者:igormateu    项目:moodle-theme_essentia   
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>

作者:nadavka    项目:moodle-accessibilit   
<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');
    ?>

作者:julenpard    项目:moodle-theme_essentia   
/**
  * 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;
     }
 }

作者:RobsonT    项目:Moodl   
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 
}

作者:gin    项目:moodle-theme_essentia   
/**
  * 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;
 }

作者:igormateu    项目:moodle-theme_essentia   
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;
 }

作者:gin    项目:moodle-theme_essentia   
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));
 }

作者:igormateu    项目:moodle-theme_essentia   
$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;

作者:lucisgi    项目:moodle-theme_essentia   
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>

作者:igormateu    项目:moodle-theme_essentia   
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);
 }

作者:gin    项目:moodle-theme_essentia   
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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/>.
/**
 * This is built using the bootstrapbase template to allow for new theme's using
 * Moodle's new Bootstrap theme engine
 *
 * @package     theme_essential
 * @copyright   2013 Julian Ridden
 * @copyright   2014 Gareth J Barnard, David Bezemer
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
if (\theme_essential\toolbox::get_setting('analyticsenabled')) {
    $analytics = \theme_essential\toolbox::get_setting('analytics');
    if ($analytics === "piwik") {
        require_once \theme_essential\toolbox::get_tile_file('piwik');
    } else {
        if ($analytics === "guniversal") {
            require_once \theme_essential\toolbox::get_tile_file('guniversal');
        }
    }
}

作者:eemartinezsanche    项目:moodle-theme_essentia   
public function get_title($location)
 {
     global $CFG, $SITE;
     $title = '';
     if ($location === 'navbar') {
         $url = preg_replace("(https?:)", "", $CFG->wwwroot);
         switch (\theme_essential\toolbox::get_setting('navbartitle')) {
             case 0:
                 return false;
                 break;
             case 1:
                 $title = '<a class="brand" href="' . $url . '">' . format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))) . '</a>';
                 break;
             case 2:
                 $title = '<a class="brand" href="' . $url . '">' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . '</a>';
                 break;
             default:
                 $title = '<a class="brand" href="' . $url . '">' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . '</a>';
                 break;
         }
     } else {
         if ($location === 'header') {
             switch (\theme_essential\toolbox::get_setting('headertitle')) {
                 case 0:
                     return false;
                     break;
                 case 1:
                     $title = '<h1 id="title">' . format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))) . '</h1>';
                     break;
                 case 2:
                     $title = '<h1 id="title">' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . '</h1>';
                     break;
                 case 3:
                     $title = '<h1 id="smalltitle">' . format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))) . '</h2>';
                     $title .= '<h2 id="subtitle">' . strip_tags($SITE->summary) . '</h3>';
                     break;
                 case 4:
                     $title = '<h1 id="smalltitle">' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . '</h2>';
                     $title .= '<h2 id="subtitle">' . strip_tags($SITE->summary) . '</h3>';
                     break;
                 default:
                     break;
             }
         }
     }
     return $title;
 }

作者:RobsonT    项目:Moodl   
</section>
</div>

<footer>
    <a href="#top" class="back-to-top" ><i class="fa fa-angle-up "></i></a>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            <?php 
if (\theme_essential\toolbox::not_lte_ie9()) {
    echo "jQuery('#essentialnavbar').affix({";
    echo "offset: {";
    echo "top: \$('#page-header').height()";
    echo "}";
    echo "});";
    if ($breadcrumbstyle == '1') {
        echo "\$('.breadcrumb').jBreadCrumb();";
    }
}
if (\theme_essential\toolbox::get_setting('fitvids')) {
    echo "\$('#page').fitVids();";
}
?>
        });
    </script>
</footer>

<?php 
echo $OUTPUT->standard_end_of_body_html();
?>
</body>
</html>

作者:lucisgi    项目:moodle-theme_essentia   
public function test_render_slide()
 {
     set_config('slide1url', 'https://about.me/gjbarnard', 'theme_essential');
     set_config('slide1target', '_blank', 'theme_essential');
     set_config('slide1', 'Test slide one', 'theme_essential');
     set_config('slide1caption', '<p>Test of link in caption: <a href="https://about.me/gjbarnard" target="_blank">me.</a></p>', 'theme_essential');
     set_config('slide2target', '_blank', 'theme_essential');
     set_config('slide2', 'Test slide two', 'theme_essential');
     set_config('slide2caption', '<p>Test of link in caption: <a href="https://about.me/gjbarnard" target="_blank">me.</a></p>', 'theme_essential');
     $this->resetAfterTest(true);
     $this->setup_renderer();
     $theslide1 = \theme_essential\toolbox::render_slide(1, 0);
     $thecontent1 = '<a href="https://about.me/gjbarnard" target="_blank" class="item side-caption active">';
     $thecontent1 .= '<div class="container-fluid"><div class="row-fluid"><div class="span5 the-side-caption">';
     $thecontent1 .= '<div class="the-side-caption-content"><h4>Test slide one</h4><div><p>Test of link in caption: me.</p>';
     $thecontent1 .= '</div></div></div><div class="span7"><div class="carousel-image-container">';
     $thecontent1 .= '<img src="http://www.example.com/moodle/theme/image.php/_s/essential/theme/1/default_slide" ';
     $thecontent1 .= 'alt="Test slide one" class="carousel-image"></div></div></div></div></a>';
     $this->assertEquals($thecontent1, $theslide1);
     $theslide2 = \theme_essential\toolbox::render_slide(2, 0);
     $thecontent2 = '<div class="item side-caption">';
     $thecontent2 .= '<div class="container-fluid"><div class="row-fluid"><div class="span5 the-side-caption">';
     $thecontent2 .= '<div class="the-side-caption-content"><h4>Test slide two</h4><div>';
     $thecontent2 .= '<p>Test of link in caption: <a href="https://about.me/gjbarnard" target="_blank">me.</a></p>';
     $thecontent2 .= '</div></div></div><div class="span7"><div class="carousel-image-container">';
     $thecontent2 .= '<img src="http://www.example.com/moodle/theme/image.php/_s/essential/theme/1/default_slide" ';
     $thecontent2 .= 'alt="Test slide two" class="carousel-image"></div></div></div></div></div>';
     $this->assertEquals($thecontent2, $theslide2);
 }

作者:nadavka    项目:moodle-accessibilit   
function theme_essential_process_css($css, $theme)
{
    // Set the theme width.
    $pagewidth = \theme_essential\toolbox::get_setting('pagewidth', false, $theme);
    $css = \theme_essential\toolbox::set_pagewidth($css, $pagewidth);
    // Set the theme font.
    $css = \theme_essential\toolbox::set_font($css, 'heading', \theme_essential\toolbox::get_setting('fontnameheading'));
    $css = \theme_essential\toolbox::set_font($css, 'body', \theme_essential\toolbox::get_setting('fontnamebody'));
    // Set the theme colour.
    $themecolor = \theme_essential\toolbox::get_setting('themecolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $themecolor, '[[setting:themecolor]]', '#30add1');
    // Set the theme text colour.
    $themetextcolor = \theme_essential\toolbox::get_setting('themetextcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $themetextcolor, '[[setting:themetextcolor]]', '#047797');
    // Set the theme url colour.
    $themeurlcolor = \theme_essential\toolbox::get_setting('themeurlcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $themeurlcolor, '[[setting:themeurlcolor]]', '#FF5034');
    // Set the theme hover colour.
    $themehovercolor = \theme_essential\toolbox::get_setting('themehovercolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $themehovercolor, '[[setting:themehovercolor]]', '#F32100');
    // Set the theme header text colour.
    $themetextcolor = \theme_essential\toolbox::get_setting('headertextcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $themetextcolor, '[[setting:headertextcolor]]', '#217a94');
    // Set the theme icon colour.
    $themeiconcolor = \theme_essential\toolbox::get_setting('themeiconcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $themeiconcolor, '[[setting:themeiconcolor]]', '#30add1');
    // Set the theme navigation colour.
    $themenavcolor = \theme_essential\toolbox::get_setting('themenavcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $themenavcolor, '[[setting:themenavcolor]]', '#ffffff');
    // Set the footer colour.
    $footercolor = \theme_essential\toolbox::hex2rgba(\theme_essential\toolbox::get_setting('footercolor', false, $theme), '0.95');
    $css = \theme_essential\toolbox::set_color($css, $footercolor, '[[setting:footercolor]]', '#30add1');
    // Set the footer text colour.
    $footertextcolor = \theme_essential\toolbox::get_setting('footertextcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footertextcolor, '[[setting:footertextcolor]]', '#ffffff');
    // Set the footer block background colour.
    $footerheadingcolor = \theme_essential\toolbox::get_setting('footerblockbackgroundcolour', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footerheadingcolor, '[[setting:footerblockbackgroundcolour]]', '#cccccc');
    // Set the footer block heading colour.
    $footerheadingcolor = \theme_essential\toolbox::get_setting('footerheadingcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footerheadingcolor, '[[setting:footerheadingcolor]]', '#cccccc');
    // Set the footer text colour.
    $footertextcolor = \theme_essential\toolbox::get_setting('footerblocktextcolour', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footertextcolor, '[[setting:footerblocktextcolour]]', '#000000');
    // Set the footer block URL colour.
    $footerurlcolor = \theme_essential\toolbox::get_setting('footerblockurlcolour', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footerurlcolor, '[[setting:footerblockurlcolour]]', '#000000');
    // Set the footer block hover colour.
    $footerhovercolor = \theme_essential\toolbox::get_setting('footerblockhovercolour', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footerhovercolor, '[[setting:footerblockhovercolour]]', '#555555');
    // Set the footer separator colour.
    $footersepcolor = \theme_essential\toolbox::get_setting('footersepcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footersepcolor, '[[setting:footersepcolor]]', '#313131');
    // Set the footer URL colour.
    $footerurlcolor = \theme_essential\toolbox::get_setting('footerurlcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footerurlcolor, '[[setting:footerurlcolor]]', '#cccccc');
    // Set the footer hover colour.
    $footerhovercolor = \theme_essential\toolbox::get_setting('footerhovercolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $footerhovercolor, '[[setting:footerhovercolor]]', '#bbbbbb');
    // Set the slide header colour.
    $slideshowcolor = \theme_essential\toolbox::get_setting('slideshowcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $slideshowcolor, '[[setting:slideshowcolor]]', '#30add1');
    // Set the slide header colour.
    $slideheadercolor = \theme_essential\toolbox::get_setting('slideheadercolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $slideheadercolor, '[[setting:slideheadercolor]]', '#30add1');
    // Set the slide caption text colour.
    $slidecaptiontextcolor = \theme_essential\toolbox::get_setting('slidecaptiontextcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $slidecaptiontextcolor, '[[setting:slidecaptiontextcolor]]', '#ffffff');
    // Set the slide caption background colour.
    $slidecaptionbackgroundcolor = \theme_essential\toolbox::get_setting('slidecaptionbackgroundcolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $slidecaptionbackgroundcolor, '[[setting:slidecaptionbackgroundcolor]]', '#30add1');
    // Set the slide button colour.
    $slidebuttoncolor = \theme_essential\toolbox::get_setting('slidebuttoncolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $slidebuttoncolor, '[[setting:slidebuttoncolor]]', '#30add1');
    // Set the slide button hover colour.
    $slidebuttonhcolor = \theme_essential\toolbox::get_setting('slidebuttonhovercolor', false, $theme);
    $css = \theme_essential\toolbox::set_color($css, $slidebuttonhcolor, '[[setting:slidebuttonhovercolor]]', '#217a94');
    if (\theme_essential\toolbox::get_setting('enablealternativethemecolors1', false, $theme) || \theme_essential\toolbox::get_setting('enablealternativethemecolors2', false, $theme) || \theme_essential\toolbox::get_setting('enablealternativethemecolors3', false, $theme) || \theme_essential\toolbox::get_setting('enablealternativethemecolors4', false, $theme)) {
        // Set theme alternative colours.
        $defaultcolors = array('#a430d1', '#d15430', '#5dd130', '#006b94');
        $defaulthovercolors = array('#9929c4', '#c44c29', '#53c429', '#4090af');
        foreach (range(1, 4) as $alternative) {
            $default = $defaultcolors[$alternative - 1];
            $defaulthover = $defaulthovercolors[$alternative - 1];
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'color' . $alternative, \theme_essential\toolbox::get_setting('alternativethemecolor' . $alternative, false, $theme), $default);
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'textcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemetextcolor' . $alternative, false, $theme), $default);
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'urlcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemeurlcolor' . $alternative, false, $theme), $default);
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'iconcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemeiconcolor' . $alternative, false, $theme), $default);
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'navcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemenavcolor' . $alternative, false, $theme), $default);
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'hovercolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemehovercolor' . $alternative, false, $theme), $defaulthover);
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footercolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefootercolor' . $alternative, false, $theme), '#30add1');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footertextcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefootertextcolor' . $alternative, false, $theme), '#30add1');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footerblockbackgroundcolour' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefooterblockbackgroundcolour' . $alternative, false, $theme), '#cccccc');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footerblocktextcolour' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefooterblocktextcolour' . $alternative, false, $theme), '#000000');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footerblockurlcolour' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefooterblockurlcolour' . $alternative, false, $theme), '#000000');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footerblockhovercolour' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefooterblockhovercolour' . $alternative, false, $theme), '#555555');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footerheadingcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefooterheadingcolor' . $alternative, false, $theme), '#cccccc');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footersepcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefootersepcolor' . $alternative, false, $theme), '#313131');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footerurlcolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefooterurlcolor' . $alternative, false, $theme), '#cccccc');
            $css = \theme_essential\toolbox::set_alternativecolor($css, 'footerhovercolor' . $alternative, \theme_essential\toolbox::get_setting('alternativethemefooterhovercolor' . $alternative, false, $theme), '#bbbbbb');
//.........这里部分代码省略.........


问题


面经


文章

微信
公众号

扫码关注公众号