本文整理汇总了PHP中Skin::get_stylesheets方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::get_stylesheets方法的具体用法?PHP Skin::get_stylesheets怎么用?PHP Skin::get_stylesheets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::get_stylesheets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_stylesheets_for_current_page
/**
* Helper function (called by smarty()) to determine what stylesheets to include
* on the page (based on constants, global variables, and $extraconfig)
*
* @param $stylesheets Stylesheets we already know we're going to need
* @param $extraconfig Extra configuration passed to smarty()
* @return array
*/
function get_stylesheets_for_current_page($stylesheets, $extraconfig)
{
global $USER, $SESSION, $THEME, $HEADDATA, $langselectform;
// stylesheet set up - if we're in a plugin also get its stylesheet
$allstylesheets = $THEME->get_url('style/style.css', true);
// determine if we want to include the parent css
if (isset($THEME->overrideparentcss) && $THEME->overrideparentcss && $THEME->parent) {
unset($allstylesheets[$THEME->parent]);
}
$stylesheets = array_merge($stylesheets, array_reverse(array_values($allstylesheets)));
if (defined('SECTION_PLUGINTYPE') && defined('SECTION_PLUGINNAME') && SECTION_PLUGINTYPE != 'core') {
if ($pluginsheets = $THEME->get_url('style/style.css', true, SECTION_PLUGINTYPE . '/' . SECTION_PLUGINNAME)) {
$stylesheets = array_merge($stylesheets, array_reverse($pluginsheets));
}
}
if ($adminsection = in_admin_section()) {
if ($adminsheets = $THEME->get_url('style/admin.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($adminsheets));
}
}
if (get_config('developermode') & DEVMODE_DEBUGCSS) {
$stylesheets[] = get_config('wwwroot') . 'theme/debug.css';
}
// look for extra stylesheets
if (isset($extraconfig['stylesheets']) && is_array($extraconfig['stylesheets'])) {
foreach ($extraconfig['stylesheets'] as $extrasheet) {
if ($sheets = $THEME->get_url($extrasheet, true)) {
$stylesheets = array_merge($stylesheets, array_reverse(array_values($sheets)));
}
}
}
if ($sheets = $THEME->additional_stylesheets()) {
$stylesheets = array_merge($stylesheets, $sheets);
}
// Give the skin a chance to affect the page
if (!empty($extraconfig['skin'])) {
require_once get_config('docroot') . '/lib/skin.php';
$skinobj = new Skin($extraconfig['skin']['skinid']);
$viewid = isset($extraconfig['skin']['viewid']) ? $extraconfig['skin']['viewid'] : null;
$stylesheets = array_merge($stylesheets, $skinobj->get_stylesheets($viewid));
}
$langdirection = get_string('thisdirection', 'langconfig');
// Include rtl.css for right-to-left langs
if ($langdirection == 'rtl') {
$smarty->assign('LANGDIRECTION', 'rtl');
if ($rtlsheets = $THEME->get_url('style/rtl.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($rtlsheets));
}
}
$stylesheets = append_version_number($stylesheets);
return $stylesheets;
}
示例2: smarty
//.........这里部分代码省略.........
$stringjs .= "\nfunction plural(n) { return " . get_raw_string('pluralrule', 'langconfig') . "; }\n";
$stringjs .= '</script>';
// stylesheet set up - if we're in a plugin also get its stylesheet
$stylesheets = array_reverse(array_values($THEME->get_url('style/style.css', true)));
if (defined('SECTION_PLUGINTYPE') && defined('SECTION_PLUGINNAME') && SECTION_PLUGINTYPE != 'core') {
if ($pluginsheets = $THEME->get_url('style/style.css', true, SECTION_PLUGINTYPE . '/' . SECTION_PLUGINNAME)) {
$stylesheets = array_merge($stylesheets, array_reverse($pluginsheets));
}
}
if ($adminsection = in_admin_section()) {
if ($adminsheets = $THEME->get_url('style/admin.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($adminsheets));
}
}
if (get_config('developermode') & DEVMODE_DEBUGCSS) {
$stylesheets[] = get_config('wwwroot') . 'theme/debug.css';
}
// look for extra stylesheets
if (isset($extraconfig['stylesheets']) && is_array($extraconfig['stylesheets'])) {
foreach ($extraconfig['stylesheets'] as $extrasheet) {
if ($sheets = $THEME->get_url($extrasheet, true)) {
$stylesheets = array_merge($stylesheets, array_reverse(array_values($sheets)));
}
}
}
if ($sheets = $THEME->additional_stylesheets()) {
$stylesheets = array_merge($stylesheets, $sheets);
}
// Give the skin a chance to affect the page
if (!empty($extraconfig['skin'])) {
require_once get_config('docroot') . '/lib/skin.php';
$skinobj = new Skin($extraconfig['skin']['skinid']);
$viewid = isset($extraconfig['skin']['viewid']) ? $extraconfig['skin']['viewid'] : null;
$stylesheets = array_merge($stylesheets, $skinobj->get_stylesheets($viewid));
}
// Include rtl.css for right-to-left langs
if ($langdirection == 'rtl') {
$smarty->assign('LANGDIRECTION', 'rtl');
if ($rtlsheets = $THEME->get_url('style/rtl.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($rtlsheets));
}
}
$smarty->assign('STRINGJS', $stringjs);
$stylesheets = append_version_number($stylesheets);
$smarty->assign('STYLESHEETLIST', $stylesheets);
if (!empty($theme_list)) {
// this gets assigned in smarty_core, but do it again here if it's changed locally
$smarty->assign('THEMELIST', json_encode(array_merge((array) json_decode($smarty->get_template_vars('THEMELIST')), $theme_list)));
}
$dropdownmenu = get_config('dropdownmenu');
// disable drop-downs if overridden at institution level
$sitethemeprefs = get_config('sitethemeprefs');
$institutions = $USER->institutions;
if (!empty($institutions)) {
foreach ($institutions as $i) {
if (!empty($sitethemeprefs)) {
if (!empty($USER->accountprefs['theme']) && $USER->accountprefs['theme'] == $THEME->basename . '/' . $i->institution) {
$dropdownmenu = $i->dropdownmenu;
}
} else {
if (!empty($USER->accountprefs['theme']) && $USER->accountprefs['theme'] == $THEME->basename . '/' . $i->institution || empty($USER->accountprefs) && $i->theme == $THEME->basename && $USER->institutiontheme->institutionname == $i->institution) {
$dropdownmenu = $i->dropdownmenu;
}
}
}
}
示例3: smarty
//.........这里部分代码省略.........
$stringjs .= "\nfunction plural(n) { return " . get_raw_string('pluralrule', 'langconfig') . "; }\n";
$stringjs .= '</script>';
// stylesheet set up - if we're in a plugin also get its stylesheet
$stylesheets = array_merge($stylesheets, array_reverse(array_values($THEME->get_url('style/style.css', true))));
if (defined('SECTION_PLUGINTYPE') && defined('SECTION_PLUGINNAME') && SECTION_PLUGINTYPE != 'core') {
if ($pluginsheets = $THEME->get_url('style/style.css', true, SECTION_PLUGINTYPE . '/' . SECTION_PLUGINNAME)) {
$stylesheets = array_merge($stylesheets, array_reverse($pluginsheets));
}
}
if ($adminsection = in_admin_section()) {
if ($adminsheets = $THEME->get_url('style/admin.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($adminsheets));
}
}
if (get_config('developermode') & DEVMODE_DEBUGCSS) {
$stylesheets[] = get_config('wwwroot') . 'theme/debug.css';
}
// look for extra stylesheets
if (isset($extraconfig['stylesheets']) && is_array($extraconfig['stylesheets'])) {
foreach ($extraconfig['stylesheets'] as $extrasheet) {
if ($sheets = $THEME->get_url($extrasheet, true)) {
$stylesheets = array_merge($stylesheets, array_reverse(array_values($sheets)));
}
}
}
if ($sheets = $THEME->additional_stylesheets()) {
$stylesheets = array_merge($stylesheets, $sheets);
}
// Give the skin a chance to affect the page
if (!empty($extraconfig['skin'])) {
require_once get_config('docroot') . '/lib/skin.php';
$skinobj = new Skin($extraconfig['skin']['skinid']);
$viewid = isset($extraconfig['skin']['viewid']) ? $extraconfig['skin']['viewid'] : null;
$stylesheets = array_merge($stylesheets, $skinobj->get_stylesheets($viewid));
}
// Allow us to set the HTML lang attribute
$smarty->assign('LANGUAGE', substr(current_language(), 0, 2));
// Include rtl.css for right-to-left langs
if ($langdirection == 'rtl') {
$smarty->assign('LANGDIRECTION', 'rtl');
if ($rtlsheets = $THEME->get_url('style/rtl.css', true)) {
$stylesheets = array_merge($stylesheets, array_reverse($rtlsheets));
}
}
$smarty->assign('STRINGJS', $stringjs);
$stylesheets = append_version_number($stylesheets);
$smarty->assign('STYLESHEETLIST', $stylesheets);
if (!empty($theme_list)) {
// this gets assigned in smarty_core, but do it again here if it's changed locally
$smarty->assign('THEMELIST', json_encode(array_merge((array) json_decode($smarty->get_template_vars('THEMELIST')), $theme_list)));
}
$dropdownmenu = get_config('dropdownmenu');
// disable drop-downs if overridden at institution level
$sitethemeprefs = get_config('sitethemeprefs');
$institutions = $USER->institutions;
if (!empty($institutions)) {
foreach ($institutions as $i) {
if (!empty($sitethemeprefs)) {
if (!empty($USER->accountprefs['theme']) && $USER->accountprefs['theme'] == $THEME->basename . '/' . $i->institution) {
$dropdownmenu = $i->dropdownmenu;
}
} else {
if (!empty($USER->accountprefs['theme']) && $USER->accountprefs['theme'] == $THEME->basename . '/' . $i->institution || empty($USER->accountprefs) && $i->theme == $THEME->basename && $USER->institutiontheme->institutionname == $i->institution) {
$dropdownmenu = $i->dropdownmenu;
}
}