Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php class TestTimberImageIsolated extends Timber_UnitTestCase { /* ----------------..
Decoded Output download
<?php
class TestTimberImageIsolated extends Timber_UnitTestCase
{
/* ----------------
* Helper functions
---------------- */
public static function copyTestImage($img = 'arch.jpg')
{
$upload_dir = wp_upload_dir();
$destination = $upload_dir['path'] . '/' . $img;
if (!file_exists($destination)) {
copy(__DIR__ . '/assets/' . $img, $destination);
}
return $destination;
}
/*
* This test HAS to be in a separate file, otherwise the UPLOADS const bleeds
* in the other tests.
*/
public function testResizeFileNamingWithUploadsConst()
{
define('UPLOADS', 'my/up');
$file_loc = self::copyTestImage('eastern.jpg');
$upload_dir = wp_upload_dir();
$url_src = $upload_dir['url'] . '/eastern.jpg';
$filename = Timber\ImageHelper::get_resize_file_url($url_src, 300, 500, 'default');
$this->assertEquals($upload_dir['url'] . '/eastern-300x500-c-default.jpg', $filename);
}
}
?>
Did this file decode correctly?
Original Code
<?php
class TestTimberImageIsolated extends Timber_UnitTestCase
{
/* ----------------
* Helper functions
---------------- */
public static function copyTestImage($img = 'arch.jpg')
{
$upload_dir = wp_upload_dir();
$destination = $upload_dir['path'] . '/' . $img;
if (!file_exists($destination)) {
copy(__DIR__ . '/assets/' . $img, $destination);
}
return $destination;
}
/*
* This test HAS to be in a separate file, otherwise the UPLOADS const bleeds
* in the other tests.
*/
public function testResizeFileNamingWithUploadsConst()
{
define('UPLOADS', 'my/up');
$file_loc = self::copyTestImage('eastern.jpg');
$upload_dir = wp_upload_dir();
$url_src = $upload_dir['url'] . '/eastern.jpg';
$filename = Timber\ImageHelper::get_resize_file_url($url_src, 300, 500, 'default');
$this->assertEquals($upload_dir['url'] . '/eastern-300x500-c-default.jpg', $filename);
}
}
Function Calls
None |
Stats
MD5 | 799b7ed33d8bf03aba7f0d0d249398d7 |
Eval Count | 0 |
Decode Time | 71 ms |