Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/Support.tar

Template.php000066600000010405151143676770007055 0ustar00<?php

namespace YoastSEO_Vendor\WordProof\SDK\Support;

class Template
{
    private static $blocks = [];
    private static $cache_path = 'cache/';
    private static $template_path = 'templates/';
    private static $cache_enabled = \true;
    private static $store_cache = \false;
    public static function setOptions(array $options)
    {
        foreach ($options as $optionName => $optionValue) {
            if (\property_exists(__CLASS__, $optionName)) {
                self::${$optionName} = $optionValue;
            }
        }
    }
    public static function setCachePath($path)
    {
        self::$cache_path = $path;
    }
    public static function setTemplatePath($path)
    {
        self::$template_path = $path;
    }
    public static function render($file, $data = [])
    {
        \ob_start();
        self::view($file, $data);
        return \ob_get_contents();
    }
    public static function view($file, $data = [])
    {
        if (self::$store_cache) {
            $cached_file = self::cache($file);
            \extract($data, \EXTR_SKIP);
            require $cached_file;
        } else {
            $code = self::includeFiles($file);
            $code = self::compileCode($code);
            $code = '?>' . \PHP_EOL . $code . \PHP_EOL . "<?php";
            \extract($data, \EXTR_SKIP);
            eval($code);
        }
    }
    private static function cache($file)
    {
        if (!\file_exists(self::$cache_path)) {
            \mkdir(self::$cache_path, 0744);
        }
        $cached_file = self::$cache_path . \str_replace(['/', '.html'], ['_', ''], $file . '.php');
        if (!self::$cache_enabled || !\file_exists($cached_file) || \filemtime($cached_file) < \filemtime($file)) {
            $code = self::includeFiles($file);
            $code = self::compileCode($code);
            \file_put_contents($cached_file, '<?php class_exists(\'' . __CLASS__ . '\') or exit; ?>' . \PHP_EOL . $code);
        }
        return $cached_file;
    }
    public static function clearCache()
    {
        foreach (\glob(self::$cache_path . '*') as $file) {
            \unlink($file);
        }
    }
    private static function compileCode($code)
    {
        $code = self::compileBlock($code);
        $code = self::compileYield($code);
        $code = self::compileEscapedEchos($code);
        $code = self::compileEchos($code);
        $code = self::compilePHP($code);
        return $code;
    }
    private static function includeFiles($file)
    {
        $code = \file_get_contents(self::$template_path . $file);
        \preg_match_all('/{% ?(extends|include) ?\'?(.*?)\'? ?%}/i', $code, $matches, \PREG_SET_ORDER);
        foreach ($matches as $value) {
            $code = \str_replace($value[0], self::includeFiles($value[2]), $code);
        }
        $code = \preg_replace('/{% ?(extends|include) ?\'?(.*?)\'? ?%}/i', '', $code);
        return $code;
    }
    private static function compilePHP($code)
    {
        return \preg_replace('~{%\\s*(.+?)\\s*%}~is', '<?php $1 ?>', $code);
    }
    private static function compileEchos($code)
    {
        return \preg_replace('~{{\\s*(.+?)\\s*}}~is', '<?php echo $1 ?>', $code);
    }
    private static function compileEscapedEchos($code)
    {
        return \preg_replace('~{{{\\s*(.+?)\\s*}}}~is', '<?php echo htmlentities($1, ENT_QUOTES, \'UTF-8\') ?>', $code);
    }
    private static function compileBlock($code)
    {
        \preg_match_all('/{% ?block ?(.*?) ?%}(.*?){% ?endblock ?%}/is', $code, $matches, \PREG_SET_ORDER);
        foreach ($matches as $value) {
            if (!\array_key_exists($value[1], self::$blocks)) {
                self::$blocks[$value[1]] = '';
            }
            if (\strpos($value[2], '@parent') === \false) {
                self::$blocks[$value[1]] = $value[2];
            } else {
                self::$blocks[$value[1]] = \str_replace('@parent', self::$blocks[$value[1]], $value[2]);
            }
            $code = \str_replace($value[0], '', $code);
        }
        return $code;
    }
    private static function compileYield($code)
    {
        foreach (self::$blocks as $block => $value) {
            $code = \preg_replace('/{% ?yield ?' . $block . ' ?%}/', $value, $code);
        }
        $code = \preg_replace('/{% ?yield ?(.*?) ?%}/i', '', $code);
        return $code;
    }
}
.htaccess000066600000000424151143676770006367 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>Loader.php000066600000004502151143676770006511 0ustar00<?php

namespace YoastSEO_Vendor\WordProof\SDK\Support;

class Loader
{
    protected $actions;
    protected $filters;
    public function __construct()
    {
        $this->actions = [];
        $this->filters = [];
    }
    /**
     * @param string $hook The name of the WordPress action that is being registered.
     * @param object $component A reference to the instance of the object on which the action is defined.
     * @param string $callback The name of the function definition on the $component.
     * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
     * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
     */
    public function addAction($hook, $component, $callback, $priority = 10, $accepted_args = 1)
    {
        $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
    }
    /**
     * @param string $hook The name of the WordPress filter that is being registered.
     * @param object $component A reference to the instance of the object on which the filter is defined.
     * @param string $callback The name of the function definition on the $component.
     * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
     * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
     */
    public function addFilter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
    {
        $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
    }
    public function run()
    {
        foreach ($this->filters as $hook) {
            \add_filter($hook['hook'], [$hook['component'], $hook['callback']], $hook['priority'], $hook['accepted_args']);
        }
        foreach ($this->actions as $hook) {
            \add_action($hook['hook'], [$hook['component'], $hook['callback']], $hook['priority'], $hook['accepted_args']);
        }
    }
    private function add($hooks, $hook, $component, $callback, $priority, $accepted_args)
    {
        $hooks[] = ['hook' => $hook, 'component' => $component, 'callback' => $callback, 'priority' => $priority, 'accepted_args' => $accepted_args];
        return $hooks;
    }
}
Timestamp.php000066600000002241151143676770007244 0ustar00<?php

namespace YoastSEO_Vendor\WordProof\SDK\Support;

use YoastSEO_Vendor\WordProof\SDK\Helpers\AuthenticationHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\PostMetaHelper;
class Timestamp
{
    /**
     * @param array $data
     *
     * @return mixed
     */
    public static function sendPostRequest($data)
    {
        $sourceId = \YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper::sourceId();
        $endpoint = '/api/sources/' . $sourceId . '/timestamps';
        $response = \YoastSEO_Vendor\WordProof\SDK\Support\Api::post($endpoint, $data);
        if (!$response || !isset($response->hash)) {
            //            AuthenticationHelper::logout(); // TODO Only if response is unauthenticated
            return \false;
        }
        if (isset($response->balance)) {
            \YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper::set('balance', $response->balance);
        }
        $key = '_wordproof_hash_input_' . $response->hash;
        \YoastSEO_Vendor\WordProof\SDK\Helpers\PostMetaHelper::update($data['uid'], $key, \json_decode($response->hash_input));
        return $response;
    }
}
Api.php000066600000002405151143676770006014 0ustar00<?php

namespace YoastSEO_Vendor\WordProof\SDK\Support;

use YoastSEO_Vendor\WordProof\SDK\Helpers\EnvironmentHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper;
class Api
{
    /**
     * @param string $endpoint
     * @param array $body
     * @return mixed
     */
    public static function post($endpoint, $body = [])
    {
        $location = \YoastSEO_Vendor\WordProof\SDK\Helpers\EnvironmentHelper::url() . $endpoint;
        $body = \wp_json_encode($body);
        $accessToken = \YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper::accessToken();
        $headers = ['Content-Type' => 'application/json', 'Accept' => 'application/json'];
        $headers = $accessToken ? \array_merge($headers, ['Authorization' => 'Bearer ' . $accessToken]) : $headers;
        $options = ['body' => $body, 'headers' => $headers, 'timeout' => 60, 'redirection' => 5, 'blocking' => \true, 'data_format' => 'body', 'sslverify' => \YoastSEO_Vendor\WordProof\SDK\Helpers\EnvironmentHelper::sslVerify()];
        $request = \wp_remote_post($location, $options);
        $status = \wp_remote_retrieve_response_code($request);
        if ($status < 200 || $status >= 300) {
            return \false;
        }
        return \json_decode(\wp_remote_retrieve_body($request));
    }
}
Authentication.php000066600000012440151143676770010262 0ustar00<?php

namespace YoastSEO_Vendor\WordProof\SDK\Support;

use YoastSEO_Vendor\WordProof\SDK\Helpers\AdminHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\AuthenticationHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\EnvironmentHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\PostTypeHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\SettingsHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\AppConfigHelper;
class Authentication
{
    private static $callbackEndpoint = 'wordproof/v1/oauth/callback';
    public static function authorize($redirectUrl = null)
    {
        $state = \wp_generate_password(40, \false);
        $codeVerifier = \wp_generate_password(128, \false);
        $originalUrl = \YoastSEO_Vendor\WordProof\SDK\Helpers\AdminHelper::currentUrl();
        \YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper::set('wordproof_authorize_state', $state, 1200);
        \YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper::set('wordproof_authorize_code_verifier', $codeVerifier, 1200);
        \YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper::set('wordproof_authorize_current_url', $redirectUrl ?: $originalUrl);
        $encoded = \base64_encode(\hash('sha256', $codeVerifier, \true));
        $codeChallenge = \strtr(\rtrim($encoded, '='), '+/', '-_');
        $data = ['client_id' => \YoastSEO_Vendor\WordProof\SDK\Helpers\EnvironmentHelper::client(), 'redirect_uri' => self::getCallbackUrl(), 'response_type' => 'code', 'scope' => '', 'state' => $state, 'code_challenge' => $codeChallenge, 'code_challenge_method' => 'S256', 'partner' => \YoastSEO_Vendor\WordProof\SDK\Helpers\AppConfigHelper::getPartner()];
        /**
         * Login with user if v2 plugin data exist.
         */
        $accessToken = \YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper::get('wordproof_v2_authenticate_with_token');
        if ($accessToken) {
            $data = \array_merge($data, ['access_token_login' => $accessToken]);
        } else {
            $data = \array_merge($data, ['confirm_account' => \true]);
        }
        self::redirect('/wordpress-sdk/authorize', $data);
    }
    /**
     * Retrieve the access token with the state and code.
     *
     * @param string $state The state from remote
     * @param string $code The code from remote
     * @return \WP_REST_Response
     * @throws \Exception
     */
    public static function token($state, $code)
    {
        $localState = \YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper::getOnce('wordproof_authorize_state');
        $codeVerifier = \YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper::getOnce('wordproof_authorize_code_verifier');
        if (\strlen($localState) <= 0 || $localState !== $state) {
            throw new \Exception('WordProof: No state found.');
        }
        $data = ['grant_type' => 'authorization_code', 'client_id' => \YoastSEO_Vendor\WordProof\SDK\Helpers\EnvironmentHelper::client(), 'redirect_uri' => self::getCallbackUrl(), 'code_verifier' => $codeVerifier, 'code' => $code];
        $response = \YoastSEO_Vendor\WordProof\SDK\Support\Api::post('/api/wordpress-sdk/token', $data);
        if (isset($response->error) && $response->error === 'invalid_grant') {
            $data = (object) ['status' => 401, 'message' => 'invalid_grant'];
            return new \WP_REST_Response($data, $data->status);
        }
        if (!isset($response->access_token)) {
            $data = (object) ['status' => 401, 'message' => 'no_access_token'];
            return new \WP_REST_Response($data, $data->status);
        }
        \YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper::setAccessToken($response->access_token);
        $data = ['webhook_url' => \get_rest_url(null, 'wordproof/v1/webhook'), 'url' => \get_site_url(), 'available_post_types' => \YoastSEO_Vendor\WordProof\SDK\Helpers\PostTypeHelper::getPublicPostTypes(), 'partner' => \YoastSEO_Vendor\WordProof\SDK\Helpers\AppConfigHelper::getPartner(), 'local_settings' => (array) \YoastSEO_Vendor\WordProof\SDK\Helpers\SettingsHelper::get()];
        /**
         * Use existing source if user was authenticated in v2 of the plugin.
         */
        $sourceId = \YoastSEO_Vendor\WordProof\SDK\Helpers\TransientHelper::getOnce('wordproof_v2_get_existing_source');
        if ($sourceId) {
            $data = \array_merge($data, ['source_id' => \intval($sourceId)]);
        }
        $response = \YoastSEO_Vendor\WordProof\SDK\Support\Api::post('/api/wordpress-sdk/source', $data);
        \YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper::setSourceId($response->source_id);
        $data = (object) ['status' => 200, 'message' => 'authentication_success', 'source_id' => \YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper::get('source_id'), 'is_authenticated' => \YoastSEO_Vendor\WordProof\SDK\Helpers\AuthenticationHelper::isAuthenticated()];
        return new \WP_REST_Response($data, $data->status);
    }
    private static function getCallbackUrl()
    {
        return \get_rest_url(null, self::$callbackEndpoint);
    }
    public static function redirect($endpoint, $parameters)
    {
        $location = \YoastSEO_Vendor\WordProof\SDK\Helpers\EnvironmentHelper::url() . $endpoint . '?' . \http_build_query($parameters);
        \header("Location: " . $location);
    }
}
Settings.php000066600000002132151143676770007100 0ustar00<?php

namespace YoastSEO_Vendor\WordProof\SDK\Support;

use YoastSEO_Vendor\WordProof\SDK\Helpers\AuthenticationHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper;
use YoastSEO_Vendor\WordProof\SDK\Helpers\AppConfigHelper;
class Settings
{
    public static function redirect($redirectUrl = null)
    {
        if (!\YoastSEO_Vendor\WordProof\SDK\Helpers\AuthenticationHelper::isAuthenticated()) {
            return \false;
        }
        $options = \YoastSEO_Vendor\WordProof\SDK\Helpers\OptionsHelper::all();
        if (!$options->source_id) {
            return \false;
        }
        $endpoint = "/sources/" . $options->source_id . "/settings";
        if (\YoastSEO_Vendor\WordProof\SDK\Helpers\AppConfigHelper::getPartner() === 'yoast') {
            $endpoint = '/yoast/dashboard';
        }
        \YoastSEO_Vendor\WordProof\SDK\Support\Authentication::redirect($endpoint, ['redirect_uri' => $redirectUrl, 'partner' => \YoastSEO_Vendor\WordProof\SDK\Helpers\AppConfigHelper::getPartner(), 'source_id' => $options->source_id, 'access_token_login' => $options->access_token]);
    }
}