[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.147.103.106: ~ $
<?php

namespace MailPoet\Config;

if (!defined('ABSPATH')) exit;


use MailPoet\DI\ContainerWrapper;
use MailPoet\Twig;
use MailPoet\Util\CdnAssetUrl;
use MailPoet\WP\Functions as WPFunctions;
use MailPoetVendor\Twig\Environment as TwigEnv;
use MailPoetVendor\Twig\Extension\DebugExtension;
use MailPoetVendor\Twig\Lexer as TwigLexer;
use MailPoetVendor\Twig\Loader\FilesystemLoader as TwigFileSystem;

class Renderer {
  protected $cachePath;
  protected $cachingEnabled;
  protected $debuggingEnabled;
  protected $renderer;
  public $assetsManifestJs;
  public $assetsManifestCss;

  public function __construct(
    $cachingEnabled = false,
    $debuggingEnabled = false
  ) {
    $this->cachingEnabled = $cachingEnabled;
    $this->debuggingEnabled = $debuggingEnabled;
    $this->cachePath = Env::$cachePath;

    $fileSystem = new TwigFileSystem(Env::$viewsPath);
    $this->renderer = new TwigEnv(
      $fileSystem,
      [
        'cache' => $this->detectCache(),
        'debug' => $this->debuggingEnabled,
        'auto_reload' => true,
      ]
    );

    $this->assetsManifestJs = $this->getAssetManifest(Env::$assetsPath . '/dist/js/manifest.json');
    $this->assetsManifestCss = $this->getAssetManifest(Env::$assetsPath . '/dist/css/manifest.json');
    $this->setupDebug();
    $this->setupTranslations();
    $this->setupFunctions();
    $this->setupFilters();
    $this->setupHandlebars();
    $this->setupHelpscout();
    $this->setupAnalytics();
    $this->setupGlobalVariables();
    $this->setupSyntax();
  }

  public function setupTranslations() {
    $this->renderer->addExtension(new Twig\I18n(Env::$pluginName));
  }

  public function setupFunctions() {
    $this->renderer->addExtension(new Twig\Functions());
  }

  public function setupFilters() {
    $this->renderer->addExtension(new Twig\Filters());
  }

  public function setupHandlebars() {
    $this->renderer->addExtension(new Twig\Handlebars());
  }

  public function setupHelpscout() {
    $this->renderer->addExtension(new Twig\Helpscout());
  }

  public function setupAnalytics() {
    $this->renderer->addExtension(new Twig\Analytics());
  }

  public function setupGlobalVariables() {
    $this->renderer->addExtension(new Twig\Assets([
      'version' => Env::$version,
      'assets_url' => Env::$assetsUrl,
      'assets_manifest_js' => $this->assetsManifestJs,
      'assets_manifest_css' => $this->assetsManifestCss,
    ], ContainerWrapper::getInstance()->get(CdnAssetUrl::class)));
  }

  public function setupSyntax() {
    $lexer = new TwigLexer($this->renderer, [
      'tag_comment' => ['<#', '#>'],
      'tag_block' => ['<%', '%>'],
      'tag_variable' => ['<%=', '%>'],
      'interpolation' => ['%{', '}'],
    ]);
    $this->renderer->setLexer($lexer);
  }

  public function detectCache() {
    return $this->cachingEnabled ? $this->cachePath : false;
  }

  public function setupDebug() {
    if ($this->debuggingEnabled) {
      $this->renderer->addExtension(new DebugExtension());
    }
  }

  public function render($template, $context = []) {
    try {
      return $this->renderer->render($template, $context);
    } catch (\RuntimeException $e) {
      throw new \Exception(sprintf(
        WPFunctions::get()->__('Failed to render template "%s". Please ensure the template cache folder "%s" exists and has write permissions. Terminated with error: "%s"'),
        $template,
        $this->cachePath,
        $e->getMessage()
      ));
    }
  }

  public function getAssetManifest($manifestFile) {
    if (is_readable($manifestFile)) {
      $contents = file_get_contents($manifestFile);
      if (is_string($contents)) {
        return json_decode($contents, true);
      }
    }
    return false;
  }

  public function getJsAsset($asset) {
    return (!empty($this->assetsManifestJs[$asset])) ?
      $this->assetsManifestJs[$asset] :
      $asset;
  }

  public function getCssAsset($asset) {
    return (!empty($this->assetsManifestCss[$asset])) ?
      $this->assetsManifestCss[$asset] :
      $asset;
  }
}

Filemanager

Name Type Size Permission Actions
PopulatorData Folder 0755
AccessControl.php File 3.23 KB 0644
Activator.php File 2.22 KB 0644
AssetsLoader.php File 801 B 0644
Capabilities.php File 2.8 KB 0644
Changelog.php File 3.9 KB 0644
Database.php File 2.78 KB 0644
DatabaseInitializer.php File 601 B 0644
DeferredAdminNotices.php File 1.07 KB 0644
Env.php File 3.93 KB 0644
Hooks.php File 10.32 KB 0644
HooksWooCommerce.php File 3.97 KB 0644
Initializer.php File 9.92 KB 0644
Installer.php File 2.69 KB 0644
Localizer.php File 1.15 KB 0644
MP2Migrator.php File 35.34 KB 0644
Menu.php File 14.04 KB 0644
Migrator.php File 25.73 KB 0644
PersonalDataErasers.php File 622 B 0644
PersonalDataExporters.php File 2.64 KB 0644
PluginActivatedHook.php File 682 B 0644
Populator.php File 29.67 KB 0644
PrivacyPolicy.php File 3.37 KB 0644
Renderer.php File 3.95 KB 0644
RendererFactory.php File 474 B 0644
RequirementsChecker.php File 4.3 KB 0644
Router.php File 846 B 0644
ServicesChecker.php File 4.93 KB 0644
Shortcodes.php File 6.22 KB 0644
Updater.php File 1.71 KB 0644
index.php File 0 B 0644