# timetics/1.0.63/vendor/themewinter/email-notification-sdk/src/Utils/Helpers.php

Timetics – Appointment Booking Calendar &amp; Scheduling, version 1.0.63. 144 lines.

- Page: https://pluginprobe.com/plugins/timetics/1.0.63/code/vendor/themewinter/email-notification-sdk/src/Utils/Helpers.php
- Raw: https://pluginprobe.com/plugins/timetics/1.0.63/raw/vendor/themewinter/email-notification-sdk/src/Utils/Helpers.php
- Modified: 2026-09-21T08:26:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/timetics/1.0.63/code/vendor/themewinter/email-notification-sdk/src/Utils/Helpers.php#L10-L20`.

```php
<?php
namespace Ens\Utils;

class Helpers {

    /**
     * will return strings after translation
     *
     * @return  array
     */
    public static function ens_get_translatable_strings( $string, $text_domain ) {
        return $string;
    }

    /**
     * Build the private nonce action for a plugin using this SDK.
     *
     * The public 'wp_rest' action must not be used on its own: WordPress hands
     * the same 'wp_rest' nonce to every logged out visitor, and plugins print
     * it on public pages, so it proves nothing about who is calling.
     *
     * @since 1.0.0
     *
     * @param   string  $identifier
     *
     * @return  string
     */
    public static function get_nonce_action( $identifier ) {
        return 'ens_' . $identifier . '_flow';
    }

    /**
     * will verify nonce
     *
     * @return  array
     */
    public static function ens_verify_nonce( $nonce, $identifier ) {
        if ( ! empty( $nonce ) && wp_verify_nonce( $nonce, self::get_nonce_action( $identifier ) ) ) {
            return true;
        }

        // Backward compatibility: plugins bundling an older SDK still send a
        // 'wp_rest' nonce. This is only a CSRF check; authorization is enforced
        // by the capability check in each route's permission_callback.
        if ( ! empty( $nonce ) && wp_verify_nonce( $nonce, 'wp_rest' ) ) {
            return true;
        }

        $response = [
            'success'     => 0,
            'status_code' => 403,
            'message'     => __( 'Nonce not verified', self::get_config_data( $identifier,'text_domain' ) ),
            'data'        => [],
        ];
        return new WP_HTTP_Response( $response, 403 );
    }

    /**
     * will sanitize recursive
     *
     * @return  array
     */
    public static function ens_sanitize_recursive( $input ) {
        if ( is_array( $input ) ) {

            foreach ( $input as $key => $value ) {
                $input[$key] = ens_sanitize_recursive( $value );
            }

        } elseif ( is_object( $input ) ) {

            foreach ( $input as $key => $value ) {
                $input->$key = ens_sanitize_recursive( $value );
            }

        } else {
            if ( filter_var( $input, FILTER_VALIDATE_URL ) !== false ) {
                $input = sanitize_url( $input );
            } elseif ( is_email( $input ) ) {
                $input = sanitize_email( $input );
            } elseif ( is_int( $input ) ) {
                $input = intval( $input );
            } elseif ( is_float( $input ) ) {
                $input = floatval( $input );
            } elseif ( is_string( $input ) ) {
                if ( strpos( $input, '<svg' ) === false ) {
                    $input = wp_kses_post( $input );
                }
            }
        }

        return $input;
    }

    /**
     * will return post status
     *
     * @return  array
     */
    public static function ens_get_post_status() {
        return ['publish', 'draft', 'trash'];
    }

    /**
     * Get config data value with fallback
     *
     * @param string $prefix
     * @param string $value_of
     * @return mixed|null
     */
    public static function get_config_data($prefix, $value_of) {
        $key = $prefix . '_ens_config';

        $data = get_option( $key );

        if (isset($data[$value_of])) {
            return $data[$value_of];
        }

        return null;
    }

    /**
     * Build a plugin-scoped hook name.
     *
     * Prepends the consumer plugin's hook_prefix (or general_prefix as
     * fallback) to the given suffix so hooks fired from the SDK do not
     * collide when the package is bundled in multiple plugins.
     *
     * @param string $identifier The consumer plugin identifier (general_prefix).
     * @param string $hook_suffix The unscoped hook name (e.g. 'email_body').
     *
     * @return string
     */
    public static function get_hook_name( $identifier, $hook_suffix ) {
        $prefix = self::get_config_data( $identifier, 'hook_prefix' );

        if ( empty( $prefix ) ) {
            $prefix = $identifier;
        }

        return $prefix . '_' . $hook_suffix;
    }
}
```
