src/AppBundle/Twig/UploaderExtension.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Twig;
use AppBundle\Util\UploaderToken;
class UploaderExtension extends \Twig_Extension
{
protected $container;
protected $pageScripts;
public function __construct($container)
{
$this->container = $container;
}
public function getFilters()
{
return array();
}
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('uploader_token', array($this, 'makeUpoaderToken')),
new \Twig_SimpleFunction('uploader_process', array($this, 'getProcessMode')),
new \Twig_SimpleFunction('uploader_accept', array($this, 'getUploadFileAccept')),
);
}
public function makeUpoaderToken($targetType, $targetId, $bucket, $ttl = 86400)
{
$maker = new UploaderToken();
return $maker->make($targetType, $targetId, $bucket, $ttl);
}
public function getProcessMode($targetType)
{
$modes = array(
'course-task' => 'auto',
'coursematerial' => 'auto',
'materiallib' => 'auto',
'course-activity' => 'auto',
'headLeader' => 'none',
);
if (isset($modes[$targetType])) {
return $modes[$targetType];
}
return 'auto';
}
public function getUploadFileAccept($targetType, $only = '')
{
$targetAcceptTypes = array(
'course-task' => array('video', 'audio', 'flash', 'ppt', 'cloud_document'),
'course-activity' => array('video', 'audio', 'flash', 'ppt', 'document', 'all'),
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。