start(); } public function forge() { echo '
';
var_dump($this->response->getHeaderLine('content-type'));
}
public function model()
{
$model = new class() extends Model {
protected $table = 'job';
};
$results = $model->findAll();
$developer = $model->findWhere('name', 'Developer');
$politician = $model->find(3);
dd($politician);
}
public function curl()
{
$client = Services::curlrequest([
'debug' => true,
'follow_redirects' => true,
'json' => ['foo' => 'bar']
]);
echo '';
$response = $client->request('PUT', 'http://ci4.dev/checks/catch');
echo $response->getBody();
}
// Simply echos back what's given in the body.
public function catch()
{
$body = print_r($this->request->getRawInput(), true);
echo $body;
}
public function redirect()
{
return redirect('/checks/model');
}
public function image()
{
$info = Services::image('imagick')
->withFile("/Users/kilishan/Documents/BobHeader.jpg")
->getFile()
->getProperties(true);
dd(ENVIRONMENT);
$images = Services::image('imagick')
->getVersion();
// ->withFile("/Users/kilishan/Documents/BobHeader.jpg")
// ->resize(500, 100, true)
// ->crop(200, 75, 20, 0, false)
// ->rotate(90)
// ->save('/Users/kilishan/temp.jpg');
// $images = Services::image('imagick')
// ->withFile("/Users/kilishan/Documents/BobHeader.jpg")
// ->fit(500, 100, 'bottom-left')
// ->text('Bob is Back!', [
// 'fontPath' => '/Users/kilishan/Downloads/Calibri.ttf',
// 'fontSize' => 40,
// 'padding' => 0,
// 'opacity' => 0.5,
// 'vAlign' => 'top',
// 'hAlign' => 'right',
// 'withShadow' => true,
// ])
// ->save('/Users/kilishan/temp.jpg', 100);
ddd($images);
}
public function time()
{
$time = new Time();
echo($time);
echo '
';
echo Time::now();
echo '
';
echo Time::parse('First Monday of December');
echo '
';
$time = new Time('Next Monday');
die($time);
}
public function csp()
{
// $this->response->CSP->reportOnly(true);
$this->response->CSP->setDefaultSrc(base_url());
$this->response->CSP->addStyleSrc('unsafe-inline');
$this->response->CSP->addStyleSrc('https://maxcdn.bootstrapcdn.com');
echo <<
EOF;
}
public function upload()
{
if ($this->request->getMethod() == 'post')
{
$this->validate([
'avatar' => 'uploaded[avatar]|ext_in[avatar,png,jpg,jpeg,gif]'
]);
/**
* @var \CodeIgniter\HTTP\Files\UploadedFile
*/
$file = $this->request->getFile('avatar');
echo "Name: {$file->getName()}
";
echo "Temp Name: {$file->getTempName()}
";
echo "Original Name: {$file->getClientName()}
";
echo "Random Name: {$file->getRandomName()}
";
echo "Extension: {$file->getExtension()}
";
echo "Client Extension: {$file->getClientExtension()}
";
echo "Guessed Extension: {$file->guessExtension()}
";
echo "MimeType: {$file->getMimeType()}
";
echo "IsValid: {$file->isValid()}
";
echo "Size (b): {$file->getSize()}
";
echo "Size (kb): {$file->getSize('kb')}
";
echo "Size (mb): {$file->getSize('mb')}
";
echo "Size (mb): {$file->getSize('mb')}
";
echo "Path: {$file->getPath()}
";
echo "RealPath: {$file->getRealPath()}
";
echo "Filename: {$file->getFilename()}
";
echo "Basename: {$file->getBasename()}
";
echo "Pathname: {$file->getPathname()}
";
echo "Permissions: {$file->getPerms()}
";
echo "Inode: {$file->getInode()}
";
echo "Owner: {$file->getOwner()}
";
echo "Group: {$file->getGroup()}
";
echo "ATime: {$file->getATime()}
";
echo "MTime: {$file->getMTime()}
";
echo "CTime: {$file->getCTime()}
";
dd($file);
}
echo <<
EOF;
;
}
public function parser()
{
$this->parser = Services::parser();
}
public function error()
{
throw new \RuntimeException('Oops!', 403);
}
}