当前位置: 首页>>代码示例>>PHP>>正文


PHP theme_setup函数代码示例

本文整理汇总了PHP中theme_setup函数的典型用法代码示例。如果您正苦于以下问题:PHP theme_setup函数的具体用法?PHP theme_setup怎么用?PHP theme_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了theme_setup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_resource_artefact_timestamp

function smarty_resource_artefact_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
{
    $name = explode(':', $tpl_name);
    $plugin_name = $name[0];
    $plugin_path = $name[1];
    $basedir = get_config('docroot') . 'artefact/' . $plugin_name . '/theme/';
    foreach (theme_setup()->inheritance as $theme) {
        $filename = $basedir . $theme . '/' . $plugin_path;
        if (is_readable($filename)) {
            $tpl_timestamp = filemtime($filename);
            return true;
        }
    }
    return false;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:15,代码来源:resource.artefact.php

示例2: custom_setup

/**
 * Theme Functions
 *
 *
 * @package WordPress
 * @subpackage New Theme
 * @since New Theme v1.0
 */
function custom_setup()
{
    // launching operation cleanup
    add_action('init', 'head_cleanup');
    // remove WP version from RSS
    add_filter('the_generator', 'rss_version');
    // remove pesky injected css for recent comments widget
    add_filter('wp_head', 'remove_wp_widget_recent_comments_style', 1);
    // clean up comment styles in the head
    add_action('wp_head', 'remove_recent_comments_style', 1);
    // clean up gallery output in wp
    add_filter('gallery_style', 'gallery_style');
    // enqueue base scripts and styles
    add_action('wp_enqueue_scripts', 'scripts_and_styles', 999);
    // launching this stuff after theme setup
    theme_setup();
    // adding sidebars to Wordpress (these are created in functions.php)
    // add_action( 'widgets_init', 'theme_widgets_init' );
}
开发者ID:emzilla,项目名称:bittersweet,代码行数:27,代码来源:functions.php

示例3: smarty_resource_blocktype_get_filepath

function smarty_resource_blocktype_get_filepath($tpl_name)
{
    static $filepaths = array();
    if (isset($filepaths[$tpl_name])) {
        return $filepaths[$tpl_name];
    }
    $name = explode(':', $tpl_name);
    $artefactplugin = get_field('blocktype_installed', 'artefactplugin', 'name', $name[0]);
    $template_path = $name[1];
    $basedir = get_config('docroot');
    if ($artefactplugin) {
        $basedir .= 'artefact/' . $artefactplugin . '/blocktype/' . $name[0] . '/theme/';
    } else {
        $basedir .= 'blocktype/' . $name[0] . '/theme/';
    }
    foreach (theme_setup()->inheritance as $theme) {
        $filename = $basedir . $theme . '/' . $template_path;
        if (is_readable($filename)) {
            return $filepaths[$tpl_name] = $filename;
        }
    }
    return $filepaths[$tpl_name] = false;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:23,代码来源:resource.blocktype.php

示例4: smarty_resource_export_get_filepath

function smarty_resource_export_get_filepath($tpl_name)
{
    static $filepaths = array();
    if (isset($filepaths[$tpl_name])) {
        return $filepaths[$tpl_name];
    }
    $name = explode(':', $tpl_name);
    $plugin = $name[0];
    $template_path = $name[1];
    $basedir = get_config('docroot');
    $pluginbits = explode('/', $plugin);
    if (count($pluginbits) == 2) {
        $basedir .= 'artefact/' . $pluginbits[1] . '/export/' . $pluginbits[0] . '/theme/';
    } else {
        $basedir .= 'export/' . $plugin . '/theme/';
    }
    foreach (theme_setup()->inheritance as $theme) {
        $filename = $basedir . $theme . '/' . $template_path;
        if (is_readable($filename)) {
            return $filepaths[$tpl_name] = $filename;
        }
    }
    return $filepaths[$tpl_name] = false;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:24,代码来源:resource.export.php

示例5: get_string

$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strthemes = get_string("themes");
$strpreview = get_string("preview");
$strchoose = get_string("choose");
$strinfo = get_string("info");
$strtheme = get_string("theme");
$strthemesaved = get_string("themesaved");
$strscreenshot = get_string("screenshot");
$stroldtheme = get_string("oldtheme");
if ($choose and confirm_sesskey()) {
    if (!is_dir($CFG->themedir . '/' . $choose)) {
        error("This theme is not installed!");
    }
    if (set_config("theme", $choose)) {
        theme_setup($choose);
        admin_externalpage_print_header();
        print_heading(get_string("themesaved"));
        if (file_exists("{$choose}/README.html")) {
            print_simple_box_start("center");
            readfile("{$choose}/README.html");
            print_simple_box_end();
        } else {
            if (file_exists("{$choose}/README.txt")) {
                print_simple_box_start("center");
                $file = file("{$choose}/README.txt");
                echo format_text(implode('', $file), FORMAT_MOODLE);
                print_simple_box_end();
            }
        }
        print_continue("{$CFG->wwwroot}/");
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:31,代码来源:index.php

示例6: begin_sql

                                         FROM ' . $CFG->prefix . 'course WHERE category=' . $category->id);
            $count = $count->max + 100;
            begin_sql();
            foreach ($courses as $course) {
                set_field('course', 'sortorder', $count, 'id', $course->id);
                $count++;
            }
            commit_sql();
            fix_course_sortorder($category->id);
        }
    }
}
if (!empty($CFG->allowcategorythemes)) {
    if (isset($category->theme)) {
        // specifying theme here saves us some dbqs
        theme_setup($category->theme);
    }
}
/// Print headings
$numcategories = count_records("course_categories");
$stradministration = get_string("administration");
$strcategories = get_string("categories");
$strcategory = get_string("category");
$strcourses = get_string("courses");
$navlinks = array();
$navlinks[] = array('name' => $strcategories, 'link' => 'index.php', 'type' => 'misc');
$navlinks[] = array('name' => format_string($category->name), 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
if ($creatorediting) {
    if ($adminediting) {
        // modify this to treat this as an admin page
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:category.php

示例7: style_sheet_setup

/**
 * This function is called by stylesheets to set up the header
 * approriately as well as the current path
 *
 * @uses $CFG
 * @param int $lastmodified ?
 * @param int $lifetime ?
 * @param string $thename ?
 */
function style_sheet_setup($lastmodified = 0, $lifetime = 300, $themename = '', $forceconfig = '', $lang = '')
{
    global $CFG, $THEME;
    // Fix for IE6 caching - we don't want the filemtime('styles.php'), instead use now.
    $lastmodified = time();
    header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $lastmodified) . ' GMT');
    header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
    header('Cache-Control: max-age=' . $lifetime);
    header('Pragma: ');
    header('Content-type: text/css');
    // Correct MIME type
    $DEFAULT_SHEET_LIST = array('styles_layout', 'styles_fonts', 'styles_color');
    if (empty($themename)) {
        $themename = current_theme();
        // So we have something.  Normally not needed.
    } else {
        $themename = clean_param($themename, PARAM_SAFEDIR);
    }
    theme_setup($themename);
    if (!empty($forceconfig)) {
        // Page wants to use the config from this theme instead
        unset($THEME);
        include $CFG->themedir . '/' . $forceconfig . '/' . 'config.php';
    }
    /// If this is the standard theme calling us, then find out what sheets we need
    if ($themename == 'standard') {
        if (!isset($THEME->standardsheets) or $THEME->standardsheets === true) {
            // Use all the sheets we have
            $THEME->sheets = $DEFAULT_SHEET_LIST;
        } else {
            if (empty($THEME->standardsheets)) {
                // We can stop right now!
                echo "/***** Nothing required from this stylesheet by main theme *****/\n\n";
                exit;
            } else {
                // Use the provided subset only
                $THEME->sheets = $THEME->standardsheets;
            }
        }
        /// If we are a parent theme, then check for parent definitions
    } else {
        if (!empty($THEME->parent) && $themename == $THEME->parent) {
            if (!isset($THEME->parentsheets) or $THEME->parentsheets === true) {
                // Use all the sheets we have
                $THEME->sheets = $DEFAULT_SHEET_LIST;
            } else {
                if (empty($THEME->parentsheets)) {
                    // We can stop right now!
                    echo "/***** Nothing required from this stylesheet by main theme *****/\n\n";
                    exit;
                } else {
                    // Use the provided subset only
                    $THEME->sheets = $THEME->parentsheets;
                }
            }
        }
    }
    /// Work out the last modified date for this theme
    foreach ($THEME->sheets as $sheet) {
        if (file_exists($CFG->themedir . '/' . $themename . '/' . $sheet . '.css')) {
            $sheetmodified = filemtime($CFG->themedir . '/' . $themename . '/' . $sheet . '.css');
            if ($sheetmodified > $lastmodified) {
                $lastmodified = $sheetmodified;
            }
        }
    }
    /// Get a list of all the files we want to include
    $files = array();
    foreach ($THEME->sheets as $sheet) {
        $files[] = array($CFG->themedir, $themename . '/' . $sheet . '.css');
    }
    if ($themename == 'standard') {
        // Add any standard styles included in any modules
        if (!empty($THEME->modsheets)) {
            // Search for styles.php within activity modules
            if ($mods = get_list_of_plugins('mod')) {
                foreach ($mods as $mod) {
                    if (file_exists($CFG->dirroot . '/mod/' . $mod . '/styles.php')) {
                        $files[] = array($CFG->dirroot, '/mod/' . $mod . '/styles.php');
                    }
                }
            }
        }
        if (!empty($THEME->blocksheets)) {
            // Search for styles.php within block modules
            if ($mods = get_list_of_plugins('blocks')) {
                foreach ($mods as $mod) {
                    if (file_exists($CFG->dirroot . '/blocks/' . $mod . '/styles.php')) {
                        $files[] = array($CFG->dirroot, '/blocks/' . $mod . '/styles.php');
                    }
                }
//.........这里部分代码省略.........
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:weblib.php

示例8: report_session_error

function report_session_error()
{
    global $CFG, $FULLME;
    if (empty($CFG->lang)) {
        $CFG->lang = "en";
    }
    // Set up default theme and locale
    theme_setup();
    moodle_setlocale();
    //clear session cookies
    if (check_php_version('5.2.0')) {
        //PHP 5.2.0
        setcookie('MoodleSession' . $CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
        setcookie('MoodleSessionTest' . $CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
    } else {
        setcookie('MoodleSession' . $CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure);
        setcookie('MoodleSessionTest' . $CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure);
    }
    //increment database error counters
    if (isset($CFG->session_error_counter)) {
        set_config('session_error_counter', 1 + $CFG->session_error_counter);
    } else {
        set_config('session_error_counter', 1);
    }
    redirect($FULLME, get_string('sessionerroruser2', 'error'), 5);
}
开发者ID:nadavkav,项目名称:rtlMoodle,代码行数:26,代码来源:moodlelib.php

示例9: redirect

    if (empty($category)) {
        redirect($CFG->wwwroot . '/course/index.php?categoryedit=on');
    } else {
        redirect($CFG->wwwroot . '/course/category.php?categoryedit=on&id=' . $category->id);
    }
} else {
    if ($data = $mform->get_data()) {
        $newcategory = new stdClass();
        $newcategory->name = $data->name;
        $newcategory->description = $data->description;
        $newcategory->sortorder = 999;
        $newcategory->parent = $data->parent;
        // if $id = 0, the new category will be a top-level category
        if (!empty($data->theme) && !empty($CFG->allowcategorythemes)) {
            $newcategory->theme = $data->theme;
            theme_setup();
        }
        if (empty($category) && has_capability('moodle/category:create', $context)) {
            // Create a new category
            if (!($newcategory->id = insert_record('course_categories', $newcategory))) {
                notify("Could not insert the new category '{$newcategory->name}' ");
            } else {
                $newcategory->context = get_context_instance(CONTEXT_COURSECAT, $newcategory->id);
                mark_context_dirty($newcategory->context->path);
                redirect('index.php?categoryedit=on');
            }
        } elseif (has_capability('moodle/category:update', $context)) {
            $newcategory->id = $category->id;
            if ($newcategory->parent != $category->parent) {
                $parent_cat = get_record('course_categories', 'id', $newcategory->parent);
                move_category($newcategory, $parent_cat);
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:editcategory.php

示例10: optional_param

$access = optional_param('access', 0, PARAM_TEXT);
$itemid = optional_param('itemid', 0, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA);
$commentid = optional_param('commentid', 0, PARAM_INT);
$deletecomment = optional_param('deletecomment', 0, PARAM_INT);
$backtype = optional_param('backtype', 0, PARAM_TEXT);
require_login(0, true);
$item = block_exabis_eportfolio_get_item($itemid, $access);
if (!$item) {
    print_error("bookmarknotfound", "block_exabis_eportfolio");
}
if (!($user = get_record("user", "id", $item->userid))) {
    print_error("nouserforid", "block_exabis_eportfolio");
}
// Set THEME (nadavkav)
theme_setup($view->theme);
if ($item->access->page == 'view') {
    if ($item->access->request == 'intern') {
        block_exabis_eportfolio_print_header("views");
    } else {
        print_header(get_string("externaccess", "block_exabis_eportfolio"), get_string("externaccess", "block_exabis_eportfolio") . " " . fullname($user, $user->id));
    }
} elseif ($item->access->page == 'portfolio') {
    if ($item->access->request == 'intern') {
        if ($backtype && $item->userid == $USER->id) {
            block_exabis_eportfolio_print_header("bookmarks" . block_exabis_eportfolio_get_plural_item_type($backtype));
        } else {
            block_exabis_eportfolio_print_header("sharedbookmarks");
        }
    } else {
        print_header(get_string("externaccess", "block_exabis_eportfolio"), get_string("externaccess", "block_exabis_eportfolio") . " " . fullname($user, $user->id));
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:shared_item.php

示例11: theme_get_path

/** 
 * This function returns the full path to an image
 * Always use it to get image paths
 * @param $imagelocation path to image relative to theme/$theme/static/
 * @param $pluginlocation path to plugin relative to docroot
 */
function theme_get_path($location, $pluginlocation = '', $all = false)
{
    $theme = theme_setup();
    $list = array();
    foreach ($theme->inheritance as $themedir) {
        if (is_readable(get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location)) {
            if ($all) {
                $list[$themedir] = get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location;
            } else {
                return get_config('docroot') . $pluginlocation . 'theme/' . $themedir . '/static/' . $location;
            }
        }
    }
    if ($all) {
        return $list;
    }
}
开发者ID:Br3nda,项目名称:mahara,代码行数:23,代码来源:web.php

示例12: page_theme_process_styles

/**
 * Collects all styles that would be included in calls to styles.php
 * from the various themes (standard, parent, current, etc).
 *
 * @return void
 **/
function page_theme_process_styles($lifetime = 300, $forceconfig = '', $lang = '')
{
    global $CFG, $THEME;
    if (!empty($forceconfig)) {
        $current = $forceconfig;
    } else {
        $current = current_theme();
    }
    // Determine if we need to Refresh the client cached stylesheet
    $headers = apache_request_headers();
    $lastmodified = filemtime($CFG->themedir . '/.');
    // themes change means styles are modified
    $timestamp = time();
    $ETag = '' . ($timestamp - $timestamp % 3600);
    // Rounded to the hour
    if (isset($headers['If-None-Match']) and isset($headers['If-Modified-Since']) and strpos($headers['If-None-Match'], "{$ETag}") and gmdate("D, d M Y H:i:s", $lastmodified) == $headers['If-Modified-Since']) {
        // Send Not Modified headers with the same info as in style_sheet_setup
        header('HTTP/1.1 304 Not Modified');
        header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $lastmodified) . ' GMT');
        header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
        header('Cache-Control: max-age=' . $lifetime);
        header('Pragma: ');
        header('Content-type: text/css');
        // Correct MIME type
        header('ETag: "' . $ETag . '"');
        exit;
    } else {
        // Refresh the contents
        /// Process Style Sheets --------------------------------------------------
        ob_start();
        style_sheet_setup(time(), $lifetime, 'standard', $forceconfig, $lang);
        $standard = ob_get_contents();
        ob_end_clean();
        // Replace relative strings in standard
        $css = page_theme_fix_relative_urls($standard, 'standard');
        theme_setup($current);
        $css .= "/**************************************\n";
        $css .= " * THEME NAME: {$current} and parents   *\n";
        $css .= " **************************************/\n\n";
        $parentsheets = page_theme_get_parent_styles($current);
        foreach ($parentsheets as $themename => $styles) {
            if ($themename == 'page') {
                $fixurls = false;
            } else {
                $fixurls = true;
            }
            $css .= page_theme_combine_css($styles, $themename, $fixurls);
        }
        $css .= page_theme_combine_css($THEME->sheets, $current, $current != 'page');
        /// END Process Style Sheets ----------------------------------------------
        // Append Necessary Headers for proper caching
        header('Content-length: ' . strlen($css));
        header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $lastmodified));
        header('ETag: "' . $ETag . '"');
        echo $css;
        // Now that header information is done send contents
    }
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:64,代码来源:lib.php

示例13: httpsrequired

/**
 * This function sets the $HTTPSPAGEREQUIRED global
 * (used in some parts of moodle to change some links)
 * and calculate the proper wwwroot to be used
 *
 * By using this function properly, we can ensure 100% https-ized pages
 * at our entire discretion (login, forgot_password, change_password)
 */
function httpsrequired()
{
    global $CFG, $HTTPSPAGEREQUIRED;
    if (!empty($CFG->loginhttps)) {
        $HTTPSPAGEREQUIRED = true;
        $CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->wwwroot);
        $CFG->httpsthemewww = str_replace('http:', 'https:', $CFG->themewww);
        // change theme URLs to https
        theme_setup();
    } else {
        $CFG->httpswwwroot = $CFG->wwwroot;
        $CFG->httpsthemewww = $CFG->themewww;
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:22,代码来源:moodlelib.php

示例14: optional_param

<?php

// $Id: preview.php,v 1.6 2007/08/17 19:09:25 nicolasconnault Exp $
require_once "../config.php";
$preview = optional_param('preview', 'standard', PARAM_FILE);
// which theme to show
if (!file_exists($CFG->themedir . '/' . $preview)) {
    $preview = 'standard';
}
if (!($site = get_site())) {
    error("Site doesn't exist!");
}
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
$CFG->theme = $preview;
theme_setup($CFG->theme, array('forceconfig=' . $CFG->theme));
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strthemes = get_string("themes");
$strpreview = get_string("preview");
$strsavechanges = get_string("savechanges");
$strtheme = get_string("theme");
$strthemesaved = get_string("themesaved");
$navlinks = array();
$navlinks[] = array('name' => $strthemes, 'link' => null, 'type' => 'misc');
$navlinks[] = array('name' => $strpreview, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("{$site->shortname}: {$strpreview}", $site->fullname, $navigation);
print_simple_box_start('center', '80%');
print_heading($preview);
print_simple_box_end();
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:preview.php

示例15: pieform_template_dir

/**
 * Should be used to provide the 'templatedir' directive to pieforms using a 
 * template for layout.
 *
 * This depends on theme_setup(), so potentially should be in lib/web.php, but 
 * for now it lives with the other pieform functions.
 *
 * @param string $file The file to be used as a pieform template, e.g. 
 *                     "admin/site/files.php". This is the value you used as 
 *                     the 'template' option for your pieform
 * @param string $pluginlocation Which plugin to search for the template, e.g. 
 *                               artefact/file
 */
function pieform_template_dir($file, $pluginlocation = '')
{
    $theme = theme_setup();
    foreach ($theme->inheritance as $themedir) {
        $filepath = get_config('docroot') . $pluginlocation . '/theme/' . $themedir . '/pieforms/' . $file;
        if (is_readable($filepath)) {
            return dirname($filepath);
        }
    }
    throw new SystemException('No pieform template available: ' . $file);
}
开发者ID:Br3nda,项目名称:mahara,代码行数:24,代码来源:mahara.php


注:本文中的theme_setup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。