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 /** * @group called-post-constructor */ class TestTimberSidebar extends Timber_Un..

Decoded Output download

<?php

/**
 * @group called-post-constructor
 */
class TestTimberSidebar extends Timber_UnitTestCase
{
    public function testTwigSidebar()
    {
        $context = Timber::context();
        $sidebar_post = $this->factory->post->create([
            'post_title' => 'Sidebar post content',
        ]);
        $sidebar_context = [];
        $sidebar_context['post'] = Timber::get_post($sidebar_post);
        $context['sidebar'] = Timber::get_sidebar('assets/sidebar.twig', $sidebar_context);
        $result = Timber::compile('assets/main-w-sidebar.twig', $context);
        $this->assertEquals('I am the main stuff <h4>Sidebar post content</h4>', trim($result));
    }

    public function testPHPSidebar()
    {
        add_filter('timber/context', function ($context) {
            $context['sidebar'] = Timber::get_sidebar('assets/my-sidebar.php');
            return $context;
        });
        $context = Timber::context();
        $result = Timber::compile('assets/main-w-sidebar-php.twig', $context);
        $this->assertEquals("A Fever You Can't Sweat Out by Panic! at the Disco from 2005", trim($result));
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

/**
 * @group called-post-constructor
 */
class TestTimberSidebar extends Timber_UnitTestCase
{
    public function testTwigSidebar()
    {
        $context = Timber::context();
        $sidebar_post = $this->factory->post->create([
            'post_title' => 'Sidebar post content',
        ]);
        $sidebar_context = [];
        $sidebar_context['post'] = Timber::get_post($sidebar_post);
        $context['sidebar'] = Timber::get_sidebar('assets/sidebar.twig', $sidebar_context);
        $result = Timber::compile('assets/main-w-sidebar.twig', $context);
        $this->assertEquals('I am the main stuff <h4>Sidebar post content</h4>', trim($result));
    }

    public function testPHPSidebar()
    {
        add_filter('timber/context', function ($context) {
            $context['sidebar'] = Timber::get_sidebar('assets/my-sidebar.php');
            return $context;
        });
        $context = Timber::context();
        $result = Timber::compile('assets/main-w-sidebar-php.twig', $context);
        $this->assertEquals("A Fever You Can't Sweat Out by Panic! at the Disco from 2005", trim($result));
    }
}

Function Calls

None

Variables

None

Stats

MD5 cb82219217221548bfae807542d60011
Eval Count 0
Decode Time 104 ms