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


PHP FileManager::verify_file方法代码示例

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


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

示例1: header

<?php

/**
 * Save the changes from Aviary for an image.
 */
$this->require_admin();
$page->layout = false;
header('Content-Type: application/json');
if (!isset($_GET['file'])) {
    echo json_encode(array('success' => false, 'error' => __('No file specified.')));
    return;
}
if (!FileManager::verify_file($_GET['file'])) {
    echo json_encode(array('success' => false, 'error' => __('Invalid file.')));
    return;
}
if (!isset($_GET['url'])) {
    echo json_encode(array('success' => false, 'error' => __('No image url specified.')));
    return;
}
$res = fetch_url($_GET['url']);
if (!$res) {
    echo json_encode(array('success' => false, 'error' => __('Updated image not found.')));
    return;
}
if (!file_put_contents(conf('Paths', 'filemanager_path') . '/' . $_GET['file'], $res)) {
    echo json_encode(array('success' => false, 'error' => __('Unable to write to the file. Please check your folder permissions and try again.')));
    return;
}
echo json_encode(array('success' => true, 'data' => __('File saved.')));
开发者ID:Selwyn-b,项目名称:elefant,代码行数:30,代码来源:img.php

示例2: isset

}
$data['width'] = isset($data['width']) && is_numeric($data['width']) ? $data['width'] : 300;
$data['height'] = isset($data['height']) && is_numeric($data['height']) ? $data['height'] : 200;
$data['alt'] = isset($data['alt']) ? $data['alt'] : '';
$data['class'] = isset($data['class']) ? $data['class'] : false;
if (!isset($data['key'])) {
    echo '<!-- Error: Missing key value -->';
    return;
}
if (!$this->internal) {
    if (isset($data['photo'])) {
        if (!preg_match('|^/files/|', $data['photo'])) {
            $data['photo'] = null;
        } else {
            $photo = preg_replace('|^/files/|', '', $data['photo']);
            if (!FileManager::verify_file($photo)) {
                $data['photo'] = null;
            }
        }
    } else {
        $data['photo'] = null;
    }
}
$data['photo'] = Image::for_key($data['key'], $data['photo']);
if ((!isset($data['link']) || !$data['link'] || $data['link'] === '') && $data['photo'] !== null) {
    $photo = preg_replace('|^/files/|', '', $data['photo']);
    $data['link'] = FileManager::prop($photo, 'link');
}
if ($data['photo']) {
    $data['src'] = '/' . Image::resize($data['photo'], $data['width'], $data['height'], 'cover', 'ext');
} elseif (isset($data['default'])) {
开发者ID:Selwyn-b,项目名称:elefant,代码行数:31,代码来源:photo.php

示例3: preg_replace

<?php

if (!$this->internal) {
    return;
}
if (!isset($data['mp4'])) {
    return;
}
if (!preg_match('|^/files/|', $data['mp4'])) {
    return;
}
$mp4 = preg_replace('|^/files/|', '', $data['mp4']);
if (!FileManager::verify_file($mp4)) {
    return;
}
$data['width'] = isset($data['width']) ? $data['width'] : 952;
$data['height'] = isset($data['height']) ? $data['height'] : 536;
$page->add_style('//vjs.zencdn.net/4.12/video-js.css');
$page->add_script('//vjs.zencdn.net/4.12/video.js');
echo $tpl->render('videojs/embed', $data);
开发者ID:jbroadway,项目名称:videojs,代码行数:20,代码来源:embed.php


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