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

PHP min_optional_param函数代码示例

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

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



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

示例1: test_min_optional_param

 /**
  * Test minimalistic getting of page parameters.
  */
 public function test_min_optional_param()
 {
     $this->resetAfterTest();
     $_GET['foo'] = 'bar';
     $_GET['num'] = '1';
     $_GET['xnum'] = '1aa';
     $_POST['foo'] = 'rebar';
     $_POST['oof'] = 'rab';
     $this->assertSame('bar', min_optional_param('foo', null, 'RAW'));
     $this->assertSame(null, min_optional_param('foo2', null, 'RAW'));
     $this->assertSame('rab', min_optional_param('oof', null, 'RAW'));
     $this->assertSame(1, min_optional_param('num', null, 'INT'));
     $this->assertSame(1, min_optional_param('xnum', null, 'INT'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:17,代码来源:configonlylib_test.php


示例2: define

 *
 * @package    core
 * @subpackage lib
 * @copyright  2010 Petr Skoda (skodak)
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
// we need just the values from config.php and minlib.php
define('ABORT_AFTER_CONFIG', true);
require '../config.php';
// this stops immediately at the beginning of lib/setup.php
ini_set('zlib.output_compression', 'Off');
// setup include path
set_include_path($CFG->libdir . '/minify/lib' . PATH_SEPARATOR . get_include_path());
require_once 'Minify.php';
$file = min_optional_param('file', '', 'RAW');
$rev = min_optional_param('rev', 0, 'INT');
// some security first - pick only files with .js extension in dirroot
$jsfiles = array();
$files = explode(',', $file);
foreach ($files as $fsfile) {
    $jsfile = realpath($CFG->dirroot . $fsfile);
    if ($jsfile === false) {
        // does not exist
        continue;
    }
    if ($CFG->dirroot === '/') {
        // Some shared hosting sites serve files directly from '/',
        // this is NOT supported, but at least allow JS when showing
        // errors and warnings.
    } else {
        if (strpos($jsfile, $CFG->dirroot . DIRECTORY_SEPARATOR) !== 0) {
开发者ID:numbas,项目名称:moodle,代码行数:31,代码来源:javascript.php


示例3: define

 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */


// disable moodle specific debug messages and any errors in output,
// comment out when debugging or better look into error log!
define('NO_DEBUG_DISPLAY', true);

// we need just the values from config.php and minlib.php
define('ABORT_AFTER_CONFIG', true);
require('../config.php'); // this stops immediately at the beginning of lib/setup.php

if ($slashargument = min_get_slash_argument()) {
    $path = ltrim($slashargument, '/');
} else {
    $path = min_optional_param('file', '', 'SAFEPATH');
}

$etag = sha1($path);
$parts = explode('/', $path);
$version = array_shift($parts);
if ($version == 'moodle' && count($parts) >= 3) {
    if (!defined('ABORT_AFTER_CONFIG_CANCEL')) {
        define('ABORT_AFTER_CONFIG_CANCEL', true);
        define('NO_UPGRADE_CHECK', true);
        define('NO_MOODLE_COOKIES', true);
        require($CFG->libdir.'/setup.php');
    }
    $frankenstyle = array_shift($parts);
    $module = array_shift($parts);
    $image = array_pop($parts);
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:yui_image.php


示例4: define

 * This file is responsible for serving of individual style sheets in designer mode.
 *
 * @package   moodlecore
 * @copyright 2009 Petr Skoda (skodak)  {@link http://skodak.org}
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */


define('ABORT_AFTER_CONFIG', true);
require('../config.php'); // this stops immediately at the beginning of lib/setup.php
require_once($CFG->dirroot.'/lib/csslib.php');

$themename = min_optional_param('theme', 'standard', 'SAFEDIR');
$type      = min_optional_param('type', '', 'SAFEDIR');
$subtype   = min_optional_param('subtype', '', 'SAFEDIR');
$sheet     = min_optional_param('sheet', '', 'SAFEDIR');

if (!defined('THEME_DESIGNER_CACHE_LIFETIME')) {
    define('THEME_DESIGNER_CACHE_LIFETIME', 4); // this can be also set in config.php
}

if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
    // exists
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
    // exists
} else {
    css_send_css_not_found();
}

// no gzip compression when debugging
开发者ID:JP-Git,项目名称:moodle,代码行数:30,代码来源:styles_debug.php


示例5: ltrim

require '../config.php';
if ($slashargument = min_get_slash_argument()) {
    $slashargument = ltrim($slashargument, '/');
    if (substr_count($slashargument, '/') < 3) {
        font_not_found();
    }
    list($themename, $component, $rev, $font) = explode('/', $slashargument, 4);
    $themename = min_clean_param($themename, 'SAFEDIR');
    $component = min_clean_param($component, 'SAFEDIR');
    $rev = min_clean_param($rev, 'INT');
    $font = min_clean_param($font, 'RAW');
} else {
    $themename = min_optional_param('theme', 'standard', 'SAFEDIR');
    $component = min_optional_param('component', 'core', 'SAFEDIR');
    $rev = min_optional_param('rev', -1, 'INT');
    $font = min_optional_param('font', '', 'RAW');
}
if (!$font) {
    font_not_found();
}
if (empty($component) or $component === 'moodle' or $component === 'core') {
    $component = 'core';
}
if (preg_match('/^[a-z0-9_-]+\\.woff$/i', $font, $matches)) {
    // This is the real standard!
    $font = $matches[0];
    $mimetype = 'application/font-woff';
} else {
    if (preg_match('/^[a-z0-9_-]+\\.ttf$/i', $font, $matches)) {
        $font = $matches[0];
        $mimetype = 'application/x-font-ttf';
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:font.php


示例6: list

        $usesvg = false;
    } else {
        $usesvg = true;
    }
    // image must be last because it may contain "/"
    list($themename, $component, $rev, $image) = explode('/', $slashargument, 4);
    $themename = min_clean_param($themename, 'SAFEDIR');
    $component = min_clean_param($component, 'SAFEDIR');
    $rev = min_clean_param($rev, 'INT');
    $image = min_clean_param($image, 'SAFEPATH');
} else {
    $themename = min_optional_param('theme', 'standard', 'SAFEDIR');
    $component = min_optional_param('component', 'core', 'SAFEDIR');
    $rev = min_optional_param('rev', -1, 'INT');
    $image = min_optional_param('image', '', 'SAFEPATH');
    $usesvg = (bool) min_optional_param('svg', '1', 'INT');
}
if (empty($component) or $component === 'moodle' or $component === 'core') {
    $component = 'core';
}
if (empty($image)) {
    image_not_found();
}
if (file_exists("{$CFG->dirroot}/theme/{$themename}/config.php")) {
    // exists
} else {
    if (!empty($CFG->themedir) and file_exists("{$CFG->themedir}/{$themename}/config.php")) {
        // exists
    } else {
        image_not_found();
    }
开发者ID:covex-nn,项目名称:moodle,代码行数:31,代码来源:image.php


示例7: define

define('ABORT_AFTER_CONFIG', true);
require '../config.php';
// this stops immediately at the beginning of lib/setup.php
require_once "{$CFG->dirroot}/lib/jslib.php";
if ($slashargument = min_get_slash_argument()) {
    $slashargument = ltrim($slashargument, '/');
    if (substr_count($slashargument, '/') < 1) {
        image_not_found();
    }
    // image must be last because it may contain "/"
    list($rev, $file) = explode('/', $slashargument, 2);
    $rev = min_clean_param($rev, 'INT');
    $file = '/' . min_clean_param($file, 'SAFEPATH');
} else {
    $rev = min_optional_param('rev', 0, 'INT');
    $file = min_optional_param('jsfile', '', 'RAW');
    // 'file' would collide with URL rewriting!
}
// some security first - pick only files with .js extension in dirroot
$jsfiles = array();
$files = explode(',', $file);
foreach ($files as $fsfile) {
    $jsfile = realpath($CFG->dirroot . $fsfile);
    if ($jsfile === false) {
        // does not exist
        continue;
    }
    if ($CFG->dirroot === '/') {
        // Some shared hosting sites serve files directly from '/',
        // this is NOT supported, but at least allow JS when showing
        // errors and warnings.
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:31,代码来源:javascript.php


示例8: ltrim

    $slashargument = ltrim($slashargument, '/');
    if (substr_count($slashargument, '/') < 3) {
        image_not_found();
    }
    // image must be last because it may contain "/"
    list($themename, $component, $rev, $image) = explode('/', $slashargument, 4);
    $themename = min_clean_param($themename, 'SAFEDIR');
    $component = min_clean_param($component, 'SAFEDIR');
    $rev       = min_clean_param($rev, 'INT');
    $image     = min_clean_param($image, 'SAFEPATH');

} else {
    $themename = min_optional_param('theme', 'standard', 'SAFEDIR');
    $component = min_optional_param('component', 'core', 'SAFEDIR');
    $rev       = min_optional_param('rev', -1, 'INT');
    $image     = min_optional_param('image', '', 'SAFEPATH');
}

if (empty($component) or $component === 'moodle' or $component === 'core') {
    $component = 'moodle';
}

if (empty($image)) {
    image_not_found();
}

if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
    // exists
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
    // exists
} else {
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:image.php


示例9: ltrim

if ($slashargument = min_get_slash_argument()) {
    $slashargument = ltrim($slashargument, '/');
    if (substr_count($slashargument, '/') < 2) {
        image_not_found();
    }
    // image must be last because it may contain "/"
    list($themename, $rev, $type) = explode('/', $slashargument, 3);
    $themename = min_clean_param($themename, 'SAFEDIR');
    $rev       = min_clean_param($rev, 'INT');
    $type      = min_clean_param($type, 'SAFEDIR');

} else {
    $themename = min_optional_param('theme', 'standard', 'SAFEDIR');
    $rev       = min_optional_param('rev', 0, 'INT');
    $type      = min_optional_param('type', 'all', 'SAFEDIR');
}

if (!in_array($type, array('all', 'ie', 'editor', 'plugins', 'parents', 'theme'))) {
    header('HTTP/1.0 404 not found');
    die('Theme was not found, sorry.');
}

if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
    // exists
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
    // exists
} else {
    header('HTTP/1.0 404 not found');
    die('Theme was not found, sorry.');
}
开发者ID:JP-Git,项目名称:moodle,代码行数:30,代码来源:styles.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ming_useswfversion函数代码示例发布时间:2022-05-15
下一篇:
PHP min_get_slash_argument函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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