Файловый менеджер - Редактировать - /home/tuudkjt/globeasy/wp-includes/ID3/Helpers.tar
Назад
DB.php 0000777 00000001511 15252210260 0005542 0 ustar 00 <?php namespace EasyWPSMTP\Helpers; /** * Class for Database functionality. * * @since 2.1.0 */ class DB { /** * The function is used to check if the given index exists in the given table. * * @since 2.1.0 * * @param string $table The table name. * @param string $index The index name. * * @return bool If index exists then return true else returns false. */ public static function index_exists( $table, $index ) { global $wpdb; $query = $wpdb->prepare( 'SELECT COUNT(1) IndexIsThere FROM INFORMATION_SCHEMA.STATISTICS WHERE table_schema = DATABASE() AND table_name = %s AND index_name = %s', $table, $index ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared $result = $wpdb->get_var( $query ); return $result === '1'; } } Helpers.php 0000777 00000010573 15252210260 0006667 0 ustar 00 <?php namespace EasyWPSMTP\Helpers; use EasyWPSMTP\Options; use EasyWPSMTP\WP; use WP_Error; /** * Class with all the misc helper functions that don't belong elsewhere. * * @since 2.0.0 */ class Helpers { /** * Check if the current active mailer has email send confirmation functionality. * * @since 2.1.0 * * @return bool */ public static function mailer_without_send_confirmation() { return ! in_array( Options::init()->get( 'mail', 'mailer' ), [ 'sendlayer', 'smtpcom', 'sendinblue', 'mailgun', 'postmark', 'smtp2go', 'sparkpost', 'mailjet', 'elasticemail', 'mailersend', 'mandrill', 'resend', ], true ); } /** * Include mbstring polyfill. * * @since 2.0.0 */ public static function include_mbstring_polyfill() { static $included = false; if ( $included === true ) { return; } require_once easy_wp_smtp()->plugin_path . '/vendor_prefixed/symfony/polyfill-mbstring/Mbstring.php'; require_once easy_wp_smtp()->plugin_path . '/vendor_prefixed/symfony/polyfill-mbstring/bootstrap.php'; $included = true; } /** * Test if the REST API is accessible. * * @since 2.0.0 * * @return true|\WP_Error */ public static function test_rest_availability() { $headers = [ 'Cache-Control' => 'no-cache', ]; /** This filter is documented in wp-includes/class-wp-http-streams.php */ $sslverify = apply_filters( 'https_local_ssl_verify', false ); $url = rest_url( 'easy-wp-smtp/v1' ); $response = wp_remote_get( $url, [ 'headers' => $headers, 'sslverify' => $sslverify, ] ); if ( is_wp_error( $response ) ) { return $response; } elseif ( wp_remote_retrieve_response_code( $response ) !== 200 ) { return new WP_Error( wp_remote_retrieve_response_code( $response ), wp_remote_retrieve_body( $response ) ); } return true; } /** * Get string size in bytes. * * @since 2.0.0 * * @param string $str String. * * @return int */ public static function strsize( $str ) { if ( ! function_exists( 'mb_strlen' ) ) { self::include_mbstring_polyfill(); } return mb_strlen( $str, '8bit' ); } /** * Format error message. * * @since 2.0.0 * * @param string $message Error message. * @param string $code Error code. * @param string $description Error description. * * @return string */ public static function format_error_message( $message, $code = '', $description = '' ) { $error_text = ''; if ( ! empty( $code ) ) { $error_text .= $code . ': '; } if ( ! is_string( $message ) ) { $error_text .= wp_json_encode( $message ); } else { $error_text .= $message; } if ( ! empty( $description ) ) { $error_text .= WP::EOL . $description; } return $error_text; } /** * Whether it's allowed to send emails from the website's current domain. * * @since 2.0.0 * * @return bool */ public static function is_domain_blocked() { $options = Options::init(); $check_domain = $options->get( 'general', 'domain_check' ); $allowed_domains = $options->get( 'general', 'domain_check_allowed_domains' ); if ( $check_domain && ! empty( $allowed_domains ) ) { $allowed_domains = explode( ',', $allowed_domains ); $site_domain = wp_parse_url( get_site_url(), PHP_URL_HOST ); $match_found = false; foreach ( $allowed_domains as $domain ) { if ( strtolower( trim( $domain ) ) === strtolower( trim( $site_domain ) ) ) { $match_found = true; break; } } if ( ! $match_found ) { return true; } } return false; } /** * Get the default user agent. * * @since 2.2.0 * * @return string */ public static function get_default_user_agent() { $license_type = easy_wp_smtp()->get_license_type(); return 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) . '; EasyWPSMTP/' . $license_type . '-' . EasyWPSMTP_PLUGIN_VERSION; } /** * Import Plugin_Upgrader class from core. * * @since 2.3.0 */ public static function include_plugin_upgrader() { /** \WP_Upgrader class */ require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; /** \Plugin_Upgrader class */ require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php'; } /** * Whether the current request is a WP CLI request. * * @since 2.3.0 */ public static function is_wp_cli() { return defined( 'WP_CLI' ) && WP_CLI; } } UI.php 0000777 00000010061 15252210260 0005572 0 ustar 00 <?php namespace EasyWPSMTP\Helpers; /** * Admin interface helpers. * * @since 2.4.0 */ class UI { /** * Output an obfuscated password field. * * @since 2.4.0 * * @param array $args Field attributes. * * @return void */ public static function hidden_password_field( $args ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh $args = wp_parse_args( $args, [ 'name' => '', 'id' => '', 'value' => '', 'clear_text' => esc_html__( 'Remove', 'easy-wp-smtp' ), ] ); $value = str_repeat( '*', strlen( $args['value'] ) ); // phpcs:disable Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace ?> <div class="easy-wp-smtp-input-btn-row"> <input type="password" spellcheck="false" autocomplete="new-password" <?php if ( ! empty( $value ) ) : ?>disabled<?php endif; ?> <?php if ( ! empty( $args['name'] && empty( $value ) ) ) : ?>name="<?php echo esc_attr( $args['name'] ); ?>"<?php endif; ?> <?php if ( ! empty( $args['name'] ) ) : ?>data-name="<?php echo esc_attr( $args['name'] ); ?>"<?php endif; ?> <?php if ( ! empty( $args['id'] ) ) : ?>id="<?php echo esc_attr( $args['id'] ); ?>"<?php endif; ?> <?php if ( ! empty( $value ) ) : ?>value="<?php echo esc_attr( $value ); ?>"<?php endif; ?>/> <?php if ( ! empty( $value ) ) : ?> <button type="button" class="easy-wp-smtp-btn easy-wp-smtp-btn--tertiary" data-clear-field="<?php echo esc_attr( $args['id'] ); ?>"><?php echo esc_html( $args['clear_text'] ); ?></button> <?php endif; ?> </div> <?php // phpcs:enable Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace } /** * Toggle component. * * @since 2.9.0 * * @param array $args { * Toggle parameters. * * @type string $name Name attribute of the toggle's input element. Default ''. * @type string $value Value attribute of the toggle's input element. Default 'yes'. * @type string|string[] $label Single label, or a 2-elements array of on/off labels. Default ''. * @type string $id ID attribute of the toggle's container element. Default ''. * @type string $class Class attribute of the toggle's container element. Default ''. * @type bool $checked Checked attribute of the toggle's input element. Default false. * @type bool $disabled Disabled attribute of the toggle's input element. Default false. * } */ public static function toggle( $args = [] ) { $args = wp_parse_args( $args, [ 'name' => '', 'value' => 'yes', 'label' => [ esc_html__( 'On', 'easy-wp-smtp' ), esc_html__( 'Off', 'easy-wp-smtp' ), ], 'id' => '', 'class' => '', 'checked' => false, 'disabled' => false, ] ); ?> <label class="easy-wp-smtp-toggle"> <input type="checkbox" name="<?php echo esc_attr( $args['name'] ); ?>" <?php echo empty( $args['class'] ) ? '' : ' class="' . esc_attr( $args['class'] ) . '"'; ?> <?php echo empty( $args['id'] ) ? '' : ' id="' . esc_attr( $args['id'] ) . '"'; ?> value="<?php echo esc_attr( $args['value'] ); ?>" <?php checked( (bool) $args['checked'] ); ?> <?php disabled( (bool) $args['disabled'] ); ?> /> <span class="easy-wp-smtp-toggle__switch"></span> <?php if ( is_array( $args['label'] ) ) : ?> <?php if ( count( $args['label'] ) > 0 ) : ?> <span class="easy-wp-smtp-toggle__label easy-wp-smtp-toggle__label--checked"><?php echo esc_html( $args['label'][0] ); ?></span> <?php endif; ?> <?php if ( count( $args['label'] ) > 1 ) : ?> <span class="easy-wp-smtp-toggle__label easy-wp-smtp-toggle__label--unchecked"><?php echo esc_html( $args['label'][1] ); ?></span> <?php endif; ?> <?php else : ?> <span class="easy-wp-smtp-toggle__label easy-wp-smtp-toggle__label--static"><?php echo esc_html( $args['label'] ); ?></span> <?php endif; ?> </label> <?php } } Crypto.php 0000777 00000012136 15252210260 0006542 0 ustar 00 <?php namespace EasyWPSMTP\Helpers; /** * Class for encryption functionality. * * @since 2.0.0 * * @link https://www.php.net/manual/en/intro.sodium.php */ class Crypto { /** * Get a secret key for encrypt/decrypt. * * @since 2.0.0 * * @param bool $create Should the key be created, if it does not exist yet. * * @return string|bool */ public static function get_secret_key( $create = false ) { if ( defined( 'EASY_WP_SMTP_CRYPTO_KEY' ) ) { return EASY_WP_SMTP_CRYPTO_KEY; } $secret_key = apply_filters( 'easy_wp_smtp_helpers_crypto_get_secret_key', get_option( 'easy_wp_smtp_mail_key' ) ); // If we already have the secret, send it back. if ( false !== $secret_key ) { return base64_decode( $secret_key ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode } if ( $create ) { // We don't have a secret, so let's generate one. try { $secret_key = sodium_crypto_secretbox_keygen(); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_keygenFound } catch ( \Exception $e ) { $secret_key = wp_generate_password( SODIUM_CRYPTO_SECRETBOX_KEYBYTES ); // phpcs:ignore PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_keybytesFound } add_option( 'easy_wp_smtp_mail_key', base64_encode( $secret_key ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode return $secret_key; } return false; } /** * Encrypt a message. * * @since 2.0.0 * * @param string $message Message to encrypt. * @param string $key Encryption key. * * @return string * @throws \Exception The exception object. */ public static function encrypt( $message, $key = '' ) { if ( apply_filters( 'easy_wp_smtp_helpers_crypto_stop', false ) ) { return $message; } // Create a nonce for this operation. It will be stored and recovered in the message itself. // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.random_bytesFound, PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_noncebytesFound $nonce = random_bytes( SODIUM_CRYPTO_SECRETBOX_NONCEBYTES ); if ( empty( $key ) ) { $key = self::get_secret_key( true ); } // Encrypt message and combine with nonce. $cipher = base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode $nonce . sodium_crypto_secretbox( // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretboxFound $message, $nonce, $key ) ); try { sodium_memzero( $message ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sodium_memzeroFound sodium_memzero( $key ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sodium_memzeroFound } catch ( \Exception $e ) { return $cipher; } return $cipher; } /** * Decrypt a message. * Returns encrypted message on any failure and the decrypted message on success. * * @since 2.0.0 * * @param string $encrypted Encrypted message. * @param string $key Encryption key. * * @return string * @throws \Exception The exception object. */ public static function decrypt( $encrypted, $key = '' ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh if ( apply_filters( 'easy_wp_smtp_helpers_crypto_stop', false ) ) { return $encrypted; } // Unpack base64 message. $decoded = base64_decode( $encrypted ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode if ( false === $decoded ) { return $encrypted; } // Include polyfill if mbstring PHP extension is not enabled. if ( ! function_exists( 'mb_strlen' ) || ! function_exists( 'mb_substr' ) ) { Helpers::include_mbstring_polyfill(); } // phpcs:ignore PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_noncebytesFound, PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_macbytesFound if ( mb_strlen( $decoded, '8bit' ) < ( SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES ) ) { return $encrypted; } // Pull nonce and ciphertext out of unpacked message. $nonce = mb_substr( $decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit' ); // phpcs:ignore PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_noncebytesFound $ciphertext = mb_substr( $decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit' ); // phpcs:ignore PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_noncebytesFound $key = empty( $key ) ? self::get_secret_key() : $key; if ( empty( $key ) ) { return $encrypted; } // Decrypt it. $message = sodium_crypto_secretbox_open( // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_openFound $ciphertext, $nonce, $key ); // Check for decryption failures. if ( false === $message ) { return $encrypted; } try { sodium_memzero( $ciphertext ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sodium_memzeroFound sodium_memzero( $key ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.sodium_memzeroFound } catch ( \Exception $e ) { return $message; } return $message; } } Geo.php 0000777 00000001110 15252210260 0005762 0 ustar 00 <?php namespace EasyWPSMTP\Helpers; /** * Class Geo to work with location, domain, IPs etc. * * @since 2.0.0 */ class Geo { /** * Get the current site hostname. * In case of CLI we don't have SERVER_NAME, so use host name instead, may be not a domain name. * Examples: example.com, localhost. * * @since 2.0.0 * * @return string */ public static function get_site_domain() { return ! empty( $_SERVER['SERVER_NAME'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_NAME'] ) ) : wp_parse_url( get_home_url( get_current_blog_id() ), PHP_URL_HOST ); } }
| ver. 1.6 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка