• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP theme_config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: css_store_css

/**
 * Stores CSS in a file at the given path.
 *
 * This function either succeeds or throws an exception.
 *
 * @param theme_config $theme The theme that the CSS belongs to.
 * @param string $csspath The path to store the CSS at.
 * @param array $cssfiles The CSS files to store.
 */
function css_store_css(theme_config $theme, $csspath, array $cssfiles) {
    global $CFG;

    // Check if both the CSS optimiser is enabled and the theme supports it.
    if (!empty($CFG->enablecssoptimiser) && $theme->supportscssoptimisation) {
        // This is an experimental feature introduced in Moodle 2.3
        // The CSS optimiser organises the CSS in order to reduce the overall number
        // of rules and styles being sent to the client. It does this by collating
        // the CSS before it is cached removing excess styles and rules and stripping
        // out any extraneous content such as comments and empty rules.
        $optimiser = new css_optimiser;
        $css = '';
        foreach ($cssfiles as $file) {
            $css .= file_get_contents($file)."\n";
        }
        $css = $theme->post_process($css);
        $css = $optimiser->process($css);

        // If cssoptimisestats is set then stats from the optimisation are collected
        // and output at the beginning of the CSS
        if (!empty($CFG->cssoptimiserstats)) {
            $css = $optimiser->output_stats_css().$css;
        }
    } else {
        // This is the default behaviour.
        // The cssoptimise setting was introduced in Moodle 2.3 and will hopefully
        // in the future be changed from an experimental setting to the default.
        // The css_minify_css will method will use the Minify library remove
        // comments, additional whitespace and other minor measures to reduce the
        // the overall CSS being sent.
        // However it has the distinct disadvantage of having to minify the CSS
        // before running the post process functions. Potentially things may break
        // here if theme designers try to push things with CSS post processing.
        $css = $theme->post_process(css_minify_css($cssfiles));
    }

    clearstatcache();
    if (!file_exists(dirname($csspath))) {
        @mkdir(dirname($csspath), $CFG->directorypermissions, true);
    }

    // Prevent serving of incomplete file from concurrent request,
    // the rename() should be more atomic than fwrite().
    ignore_user_abort(true);
    if ($fp = fopen($csspath.'.tmp', 'xb')) {
        fwrite($fp, $css);
        fclose($fp);
        rename($csspath.'.tmp', $csspath);
        @chmod($csspath, $CFG->filepermissions);
        @unlink($csspath.'.tmp'); // just in case anything fails
    }
    ignore_user_abort(false);
    if (connection_aborted()) {
        die;
    }
}
开发者ID:ncsu-delta,项目名称:moodle,代码行数:65,代码来源:csslib.php


示例2: get_filter_options

 /**
  * Retrieve the list of available filter options.
  *
  * @return  array                   An array whose keys are the valid options
  *                                  And whose values are the values to display
  */
 public static function get_filter_options()
 {
     $manager = \core_plugin_manager::instance();
     $themes = $manager->get_installed_plugins('theme');
     $options = [];
     foreach (array_keys($themes) as $themename) {
         try {
             $theme = \theme_config::load($themename);
         } catch (Exception $e) {
             // Bad theme, just skip it for now.
             continue;
         }
         if ($themename !== $theme->name) {
             // Obsoleted or broken theme, just skip for now.
             continue;
         }
         if ($theme->hidefromselector) {
             // The theme doesn't want to be shown in the theme selector and as theme
             // designer mode is switched off we will respect that decision.
             continue;
         }
         $options[$theme->name] = get_string('pluginname', "theme_{$theme->name}");
     }
     return $options;
 }
开发者ID:dg711,项目名称:moodle,代码行数:31,代码来源:theme.php


示例3: get_template_directories_for_component

 /**
  * Helper function for getting a list of valid template directories for a specific component.
  *
  * @param string $component The component to search
  * @param string $themename The current theme name
  * @return string[] List of valid directories for templates for this compoonent. Directories are not checked for existence.
  */
 public static function get_template_directories_for_component($component, $themename = '')
 {
     global $CFG, $PAGE;
     // Default the param.
     if ($themename == '') {
         $themename = $PAGE->theme->name;
     }
     // Clean params for safety.
     $component = clean_param($component, PARAM_COMPONENT);
     $themename = clean_param($themename, PARAM_COMPONENT);
     // Validate the component.
     $dirs = array();
     $compdirectory = core_component::get_component_directory($component);
     if (!$compdirectory) {
         throw new coding_exception("Component was not valid: " . s($component));
     }
     // Find the parent themes.
     $parents = array();
     if ($themename === $PAGE->theme->name) {
         $parents = $PAGE->theme->parents;
     } else {
         $themeconfig = theme_config::load($themename);
         $parents = $themeconfig->parents;
     }
     // First check the theme.
     $dirs[] = $CFG->dirroot . '/theme/' . $themename . '/templates/' . $component . '/';
     // Now check the parent themes.
     // Search each of the parent themes second.
     foreach ($parents as $parent) {
         $dirs[] = $CFG->dirroot . '/theme/' . $parent . '/templates/' . $component . '/';
     }
     $dirs[] = $compdirectory . '/templates/';
     return $dirs;
 }
开发者ID:zaintq,项目名称:Extensions-for-Open-Courseware,代码行数:41,代码来源:mustache_template_finder.php


示例4: 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 'true' if you want to use Essential's settings after removing the '$THEME->parents_exclude_sheets' in config.php.
       Then to get the alternive colours back, renove the overridden method 'custom_menu_themecolours' in the 'theme_essentials_core_renderer'
       class in the 'core_renderer.php' file in the 'classes' folder. */
    $usingessentialsettings = false;
    if ($usingessentialsettings) {
        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!
        static $parenttheme;
        if (empty($parenttheme)) {
            $parenttheme = theme_config::load('essential');
        }
        $css = theme_essential_process_css($css, $parenttheme);
    }
    // If you have your own settings, then add them here.
    // Finally return processed CSS
    return $css;
}
开发者ID:RobsonTK,项目名称:Moodle,代码行数:33,代码来源:lib.php


示例5: theme_clean_pluginfile

function theme_clean_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
    if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo') {
        $theme = theme_config::load('clean');
        return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
    } else {
        send_file_not_found();
    }
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:8,代码来源:lib.php


示例6: list_templates

 /**
  * Return a list of details about installed templates.
  *
  * @param string $component Filter the list to a single component.
  * @param string $search Search string to optionally filter the list of templates.
  * @param string $themename The name of the current theme.
  * @return array[string] Where each template is in the form "component/templatename".
  */
 public static function list_templates($component = '', $search = '', $themename = '')
 {
     global $CFG, $PAGE;
     if (empty($themename)) {
         $themename = $PAGE->theme->name;
     }
     $themeconfig = \theme_config::load($themename);
     $templatedirs = array();
     $results = array();
     if ($component !== '') {
         // Just look at one component for templates.
         $dirs = mustache_template_finder::get_template_directories_for_component($component, $themename);
         $templatedirs[$component] = $dirs;
     } else {
         // Look at all the templates dirs for core.
         $templatedirs['core'] = mustache_template_finder::get_template_directories_for_component('core', $themename);
         // Look at all the templates dirs for subsystems.
         $subsystems = core_component::get_core_subsystems();
         foreach ($subsystems as $subsystem => $dir) {
             $dir .= '/templates';
             if (is_dir($dir)) {
                 $dirs = mustache_template_finder::get_template_directories_for_component('core_' . $subsystem, $themename);
                 $templatedirs['core_' . $subsystem] = $dirs;
             }
         }
         // Look at all the templates dirs for plugins.
         $plugintypes = core_component::get_plugin_types();
         foreach ($plugintypes as $type => $dir) {
             $plugins = core_component::get_plugin_list_with_file($type, 'templates', false);
             foreach ($plugins as $plugin => $dir) {
                 if ($type == 'theme' && $plugin != $themename && !in_array($plugin, $themeconfig->parents)) {
                     continue;
                 }
                 if (!empty($dir) && is_dir($dir)) {
                     $pluginname = $type . '_' . $plugin;
                     $dirs = mustache_template_finder::get_template_directories_for_component($pluginname, $themename);
                     $templatedirs[$pluginname] = $dirs;
                 }
             }
         }
     }
     foreach ($templatedirs as $templatecomponent => $dirs) {
         foreach ($dirs as $dir) {
             // List it.
             $files = glob($dir . '/*.mustache');
             foreach ($files as $file) {
                 $templatename = basename($file, '.mustache');
                 if ($search == '' || strpos($templatename, $search) !== false) {
                     $results[$templatecomponent . '/' . $templatename] = 1;
                 }
             }
         }
     }
     $results = array_keys($results);
     sort($results);
     return $results;
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:65,代码来源:api.php


示例7: theme_essential_pluginfile

/**
 * Serves any files associated with the theme settings.
 *
 * @param stdClass $course.
 * @param stdClass $cm.
 * @param context $context.
 * @param string $filearea.
 * @param array $args.
 * @param bool $forcedownload.
 * @param array $options.
 * @return bool.
 */
function theme_essential_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
    static $theme;
    if (empty($theme)) {
        $theme = theme_config::load('essential');
    }
    if ($context->contextlevel == CONTEXT_SYSTEM) {
        if ($filearea === 'logo') {
            return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
        } else {
            if ($filearea === 'style') {
                theme_essential_serve_css($args[1]);
            } else {
                if ($filearea === 'headerbackground') {
                    return $theme->setting_file_serve('headerbackground', $args, $forcedownload, $options);
                } else {
                    if ($filearea === 'pagebackground') {
                        return $theme->setting_file_serve('pagebackground', $args, $forcedownload, $options);
                    } else {
                        if ($filearea === 'favicon') {
                            return $theme->setting_file_serve('favicon', $args, $forcedownload, $options);
                        } else {
                            if (preg_match("/^fontfile(eot|otf|svg|ttf|woff|woff2)(heading|body)\$/", $filearea)) {
                                // http://www.regexr.com/.
                                return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
                            } else {
                                if (preg_match("/^(marketing|slide)[1-9][0-9]*image\$/", $filearea)) {
                                    return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
                                } else {
                                    if ($filearea === 'iphoneicon') {
                                        return $theme->setting_file_serve('iphoneicon', $args, $forcedownload, $options);
                                    } else {
                                        if ($filearea === 'iphoneretinaicon') {
                                            return $theme->setting_file_serve('iphoneretinaicon', $args, $forcedownload, $options);
                                        } else {
                                            if ($filearea === 'ipadicon') {
                                                return $theme->setting_file_serve('ipadicon', $args, $forcedownload, $options);
                                            } else {
                                                if ($filearea === 'ipadretinaicon') {
                                                    return $theme->setting_file_serve('ipadretinaicon', $args, $forcedownload, $options);
                                                } else {
                                                    send_file_not_found();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        send_file_not_found();
    }
}
开发者ID:nadavkav,项目名称:moodle-accessibility,代码行数:69,代码来源:lib.php


示例8: __construct

 public function __construct(moodle_page $page, $target)
 {
     parent::__construct($page, $target);
     static $theme;
     if (empty($theme)) {
         $theme = theme_config::load('essential');
     }
     $this->enablecategoryicon = !empty($theme->settings->enablecategoryicon) ? $theme->settings->enablecategoryicon : false;
 }
开发者ID:ging,项目名称:moodle-theme_essential,代码行数:9,代码来源:core_course_renderer.php


示例9: get_child_theme_config

 private static function get_child_theme_config()
 {
     if (!self::$checkedchildtheme) {
         global $PAGE;
         if (in_array('essential', $PAGE->theme->parents)) {
             $themename = $PAGE->theme->name;
             self::$childtheme = \theme_config::load($themename);
             self::$checkedchildtheme = true;
         }
     }
     return self::$childtheme;
 }
开发者ID:nadavkav,项目名称:moodle-accessibility,代码行数:12,代码来源:toolbox.php


示例10: theme_clean_pluginfile

/**
 * Serves any files associated with the theme settings.
 *
 * @param stdClass $course
 * @param stdClass $cm
 * @param context $context
 * @param string $filearea
 * @param array $args
 * @param bool $forcedownload
 * @param array $options
 * @return bool
 */
function theme_clean_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
    if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo' || $filearea === 'smalllogo') {
        $theme = theme_config::load('clean');
        // By default, theme files must be cache-able by both browsers and proxies.
        if (!array_key_exists('cacheability', $options)) {
            $options['cacheability'] = 'public';
        }
        return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
    } else {
        send_file_not_found();
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:25,代码来源:lib.php


示例11: css_store_css

/**
 * Stores CSS in a file at the given path.
 *
 * This function either succeeds or throws an exception.
 *
 * @param theme_config $theme The theme that the CSS belongs to.
 * @param string $csspath The path to store the CSS at.
 * @param array $cssfiles The CSS files to store.
 */
function css_store_css(theme_config $theme, $csspath, array $cssfiles)
{
    global $CFG;
    if (!empty($CFG->enablecssoptimiser)) {
        // This is an experimental feature introduced in Moodle 2.3
        // The CSS optimiser organises the CSS in order to reduce the overall number
        // of rules and styles being sent to the client. It does this by collating
        // the CSS before it is cached removing excess styles and rules and stripping
        // out any extraneous content such as comments and empty rules.
        $optimiser = new css_optimiser();
        $css = '';
        foreach ($cssfiles as $file) {
            $css .= file_get_contents($file) . "\n";
        }
        $css = $theme->post_process($css);
        $css = $optimiser->process($css);
        // If cssoptimisestats is set then stats from the optimisation are collected
        // and output at the beginning of the CSS
        if (!empty($CFG->cssoptimiserstats)) {
            $css = $optimiser->output_stats_css() . $css;
        }
    } else {
        // This is the default behaviour.
        // The cssoptimise setting was introduced in Moodle 2.3 and will hopefully
        // in the future be changed from an experimental setting to the default.
        // The css_minify_css will method will use the Minify library remove
        // comments, additional whitespace and other minor measures to reduce the
        // the overall CSS being sent.
        // However it has the distinct disadvantage of having to minify the CSS
        // before running the post process functions. Potentially things may break
        // here if theme designers try to push things with CSS post processing.
        $css = $theme->post_process(css_minify_css($cssfiles));
    }
    check_dir_exists(dirname($csspath));
    $fp = fopen($csspath, 'w');
    fwrite($fp, $css);
    fclose($fp);
}
开发者ID:numbas,项目名称:moodle,代码行数:47,代码来源:csslib.php


示例12: 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 'true' if you want to use Essential's settings after removing the '$THEME->parents_exclude_sheets' in config.php.
    $usingessentialsettings = false;
    if ($usingessentialsettings) {
        require_once dirname(__FILE__) . '/../essential/lib.php';
        static $parenttheme;
        if (empty($parenttheme)) {
            $parenttheme = theme_config::load('essential');
        }
        $css = theme_essential_process_css($css, $parenttheme);
    }
    // If you have your own settings, then add them here.
    // Finally return processed CSS
    return $css;
}
开发者ID:Keneth1212,项目名称:moodle,代码行数:24,代码来源:lib.php


示例13: theme_essentials_pluginfile

/**
 * Serves any files associated with the theme settings.
 *
 * @param stdClass $course.
 * @param stdClass $cm.
 * @param context $context.
 * @param string $filearea.
 * @param array $args.
 * @param bool $forcedownload.
 * @param array $options.
 * @return bool.
 */
function theme_essentials_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
    static $theme;
    if (empty($theme)) {
        $theme = theme_config::load('essentials');
    }
    if ($context->contextlevel == CONTEXT_SYSTEM) {
        if ($filearea === 'logo') {
            return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
        } else {
            send_file_not_found();
        }
    } else {
        send_file_not_found();
    }
}
开发者ID:nadavkav,项目名称:moodle-accessibility,代码行数:28,代码来源:lib.php


示例14: get_setting

    /**
     * Returns settings as formatted text
     *
     * @param string $setting
     * @param string $format = false
     * @param string $theme = null
     * @return string
     */
    public function get_setting($setting, $format = false, $theme = null) {
        if (empty($theme)) {
            $theme = theme_config::load('adaptable');
        }

        if (empty($theme->settings->$setting)) {
            return false;
        } else if (!$format) {
            return $theme->settings->$setting;
        } else if ($format === 'format_text') {
            return format_text($theme->settings->$setting, FORMAT_PLAIN);
        } else if ($format === 'format_html') {
            return format_text($theme->settings->$setting, FORMAT_HTML, array('trusted' => true));
        } else {
            return format_string($theme->settings->$setting);
        }
    }
开发者ID:educacionbe,项目名称:campus,代码行数:25,代码来源:renderers.php


示例15: theme_lambda_pluginfile

function theme_lambda_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
    if ($context->contextlevel == CONTEXT_SYSTEM) {
        $theme = theme_config::load('lambda');
        if ($filearea === 'logo') {
            return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
        } else {
            if ($filearea === 'pagebackground') {
                return $theme->setting_file_serve('pagebackground', $args, $forcedownload, $options);
            } else {
                if ($filearea === 'slide1image') {
                    return $theme->setting_file_serve('slide1image', $args, $forcedownload, $options);
                } else {
                    if ($filearea === 'slide2image') {
                        return $theme->setting_file_serve('slide2image', $args, $forcedownload, $options);
                    } else {
                        if ($filearea === 'slide3image') {
                            return $theme->setting_file_serve('slide3image', $args, $forcedownload, $options);
                        } else {
                            if ($filearea === 'slide4image') {
                                return $theme->setting_file_serve('slide4image', $args, $forcedownload, $options);
                            } else {
                                if ($filearea === 'slide5image') {
                                    return $theme->setting_file_serve('slide5image', $args, $forcedownload, $options);
                                } else {
                                    if (substr($filearea, 0, 15) === 'carousel_image_') {
                                        return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
                                    } else {
                                        send_file_not_found();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        send_file_not_found();
    }
}
开发者ID:sirromas,项目名称:medical,代码行数:41,代码来源:lib.php


示例16: test_svg_image_use

 /**
  * This function will test directives used to serve SVG images to make sure
  * this are making the right decisions.
  */
 public function test_svg_image_use()
 {
     global $CFG;
     $this->resetAfterTest();
     // The two required tests.
     $this->assertTrue(file_exists($CFG->dirroot . '/pix/i/test.svg'));
     $this->assertTrue(file_exists($CFG->dirroot . '/pix/i/test.png'));
     $theme = theme_config::load(theme_config::DEFAULT_THEME);
     // First up test the forced setting.
     $imagefile = $theme->resolve_image_location('i/test', 'moodle', true);
     $this->assertSame('test.svg', basename($imagefile));
     $imagefile = $theme->resolve_image_location('i/test', 'moodle', false);
     $this->assertSame('test.png', basename($imagefile));
     // Now test the use of the svgicons config setting.
     // We need to clone the theme as usesvg property is calculated only once.
     $testtheme = clone $theme;
     $CFG->svgicons = true;
     $imagefile = $testtheme->resolve_image_location('i/test', 'moodle', null);
     $this->assertSame('test.svg', basename($imagefile));
     $CFG->svgicons = false;
     // We need to clone the theme as usesvg property is calculated only once.
     $testtheme = clone $theme;
     $imagefile = $testtheme->resolve_image_location('i/test', 'moodle', null);
     $this->assertSame('test.png', basename($imagefile));
     unset($CFG->svgicons);
     // Finally test a few user agents.
     $useragents = array('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' => false, 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)' => false, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)' => false, 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)' => false, 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)' => true, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0)' => false, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)' => true, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0; Touch; .NET4.0E; .NET4.0C; Tablet PC 2.0)' => true, 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)' => true, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)' => true, 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Chrome/11.0.652.0 Safari/534.17' => true, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1' => true, 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1' => true, 'Mozilla/5.0 (Windows NT 6.1; rv:1.9) Gecko/20100101 Firefox/4.0' => true, 'Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0.1' => true, 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1' => true, 'Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.10.289 Version/12.02' => false, 'Mozilla/5.0 (Linux; U; Android 0.5; en-us) AppleWebKit/522+ (KHTML, like Gecko) Safari/419.3' => false, 'Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' => false, 'Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13' => true, 'Mozilla/5.0 (Linux; Android 4.3; it-it; SAMSUNG GT-I9505/I9505XXUEMJ7 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36' => true);
     foreach ($useragents as $agent => $expected) {
         core_useragent::instance(true, $agent);
         // We need to clone the theme as usesvg property is calculated only once.
         $testtheme = clone $theme;
         $imagefile = $testtheme->resolve_image_location('i/test', 'moodle', null);
         if ($expected) {
             $this->assertSame('test.svg', basename($imagefile), 'Incorrect image returned for user agent `' . $agent . '`');
         } else {
             $this->assertSame('test.png', basename($imagefile), 'Incorrect image returned for user agent `' . $agent . '`');
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:43,代码来源:theme_config_test.php


示例17: theme_bcu_pluginfile

/**
 * Serves any files associated with the theme settings.
 *
 * @param stdClass $course
 * @param stdClass $cm
 * @param context $context
 * @param string $filearea
 * @param array $args
 * @param bool $forcedownload
 * @param array $options
 * @return bool
 */
function theme_bcu_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
    static $theme;
    if (empty($theme)) {
        $theme = theme_config::load('bcu');
    }
    if ($context->contextlevel == CONTEXT_SYSTEM) {
        if ($filearea === 'logo') {
            return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
        } else {
            if ($filearea === 'style') {
                theme_essential_serve_css($args[1]);
            } else {
                if ($filearea === 'pagebackground') {
                    return $theme->setting_file_serve('pagebackground', $args, $forcedownload, $options);
                } else {
                    if (preg_match("/p[1-9][0-9]/", $filearea) !== false) {
                        return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
                    } else {
                        if (substr($filearea, 0, 9) === 'marketing' && substr($filearea, 10, 5) === 'image') {
                            return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
                        } else {
                            if ($filearea === 'iphoneicon') {
                                return $theme->setting_file_serve('iphoneicon', $args, $forcedownload, $options);
                            } else {
                                if ($filearea === 'iphoneretinaicon') {
                                    return $theme->setting_file_serve('iphoneretinaicon', $args, $forcedownload, $options);
                                } else {
                                    if ($filearea === 'ipadicon') {
                                        return $theme->setting_file_serve('ipadicon', $args, $forcedownload, $options);
                                    } else {
                                        if ($filearea === 'ipadretinaicon') {
                                            return $theme->setting_file_serve('ipadretinaicon', $args, $forcedownload, $options);
                                        } else {
                                            if ($filearea === 'fontfilettfheading') {
                                                return $theme->setting_file_serve('fontfilettfheading', $args, $forcedownload, $options);
                                            } else {
                                                if ($filearea === 'fontfilettfbody') {
                                                    return $theme->setting_file_serve('fontfilettfbody', $args, $forcedownload, $options);
                                                } else {
                                                    send_file_not_found();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        send_file_not_found();
    }
}
开发者ID:JOANMM,项目名称:bcu,代码行数:68,代码来源:lib.php


示例18: file_pluginfile


//.........这里部分代码省略.........
                                    }
                                    // If its a group event require either membership of view all groups capability
                                    if ($event->eventtype === 'group') {
                                        if (!has_capability('moodle/site:accessallgroups', $context) && !groups_is_member($event->groupid, $USER->id)) {
                                            send_file_not_found();
                                        }
                                    } else {
                                        if ($event->eventtype === 'course' || $event->eventtype === 'site') {
                                            // Ok. Please note that the event type 'site' still uses a course context.
                                        } else {
                                            // Some other type.
                                            send_file_not_found();
                                        }
                                    }
                                    // If we get this far we can serve the file
                                    $filename = array_pop($args);
                                    $filepath = $args ? '/' . implode('/', $args) . '/' : '/';
                                    if (!($file = $fs->get_file($context->id, $component, $filearea, $eventid, $filepath, $filename)) or $file->is_directory()) {
                                        send_file_not_found();
                                    }
                                    \core\session\manager::write_close();
                                    // Unlock session during file serving.
                                    send_stored_file($file, 60 * 60, 0, $forcedownload, array('preview' => $preview));
                                } else {
                                    send_file_not_found();
                                }
                            }
                        }
                        // ========================================================================================================================
                    } else {
                        if ($component === 'user') {
                            if ($filearea === 'icon' and $context->contextlevel == CONTEXT_USER) {
                                if (count($args) == 1) {
                                    $themename = theme_config::DEFAULT_THEME;
                                    $filename = array_shift($args);
                                } else {
                                    $themename = array_shift($args);
                                    $filename = array_shift($args);
                                }
                                // fix file name automatically
                                if ($filename !== 'f1' and $filename !== 'f2' and $filename !== 'f3') {
                                    $filename = 'f1';
                                }
                                if ((!empty($CFG->forcelogin) and !isloggedin()) || !empty($CFG->forceloginforprofileimage) && (!isloggedin() || isguestuser())) {
                                    // protect images if login required and not logged in;
                                    // also if login is required for profile images and is not logged in or guest
                                    // do not use require_login() because it is expensive and not suitable here anyway
                                    $theme = theme_config::load($themename);
                                    redirect($theme->pix_url('u/' . $filename, 'moodle'));
                                    // intentionally not cached
                                }
                                if (!($file = $fs->get_file($context->id, 'user', 'icon', 0, '/', $filename . '.png'))) {
                                    if (!($file = $fs->get_file($context->id, 'user', 'icon', 0, '/', $filename . '.jpg'))) {
                                        if ($filename === 'f3') {
                                            // f3 512x512px was introduced in 2.3, there might be only the smaller version.
                                            if (!($file = $fs->get_file($context->id, 'user', 'icon', 0, '/', 'f1.png'))) {
                                                $file = $fs->get_file($context->id, 'user', 'icon', 0, '/', 'f1.jpg');
                                            }
                                        }
                                    }
                                }
                                if (!$file) {
                                    // bad reference - try to prevent future retries as hard as possible!
                                    if ($user = $DB->get_record('user', array('id' => $context->instanceid), 'id, picture')) {
                                        if ($user->picture > 0) {
                                            $DB->set_field('user', 'picture', 0, array('id' => $user->id));
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:67,代码来源:filelib.php


示例19: get_list_of_themes

/**
 * Returns a list of valid and compatible themes
 *
 * @return array
 */
function get_list_of_themes()
{
    global $CFG;
    $themes = array();
    if (!empty($CFG->themelist)) {
        // Use admin's list of themes.
        $themelist = explode(',', $CFG->themelist);
    } else {
        $themelist = array_keys(core_component::get_plugin_list("theme"));
    }
    foreach ($themelist as $key => $themename) {
        $theme = theme_config::load($themename);
        $themes[$themename] = $theme;
    }
    core_collator::asort_objects_by_method($themes, 'get_theme_name');
    return $themes;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:22,代码来源:moodlelib.php


示例20: find_theme_config

 /**
  * Loads the theme config from config.php file.
  *
  * @param string $themename
  * @param stdClass $settings from config_plugins table
  * @param boolean $parentscheck true to also check the parents.    .
  * @return stdClass The theme configuration
  */
 private static function find_theme_config($themename, $settings, $parentscheck = true)
 {
     // We have to use the variable name $THEME (upper case) because that
     // is what is used in theme config.php files.
     if (!($dir = theme_config::find_theme_location($themename))) {
         return null;
     }
     $THEME = new stdClass();
     $THEME->name = $th 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP thesaurus类代码示例发布时间:2022-05-23
下一篇:
PHP theme类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap