FM

/home/u523506497/domains/mymelon.in/public_html/wp-content/plugins/wpforms-lite/src/Helpers UP

<?php

// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @noinspection PhpIllegalPsrClassPathInspection */

namespace WPForms\Helpers;

// phpcs:ignore WPForms.PHP.UseStatement.UnusedUseStatement
use WPForms_DB;
use WPForms_Lite;
use WPForms_Pro;

/**
 * DB helpers.
 *
 * @since 1.8.7
 */
class DB {

	/**
	 * Existing tables transient name.
	 *
	 * @since 1.8.7
	 * @since 1.9.0 Changed from 'wpforms_existing_tables' to 'existing_tables'
	 *
	 * @var string
	 */
	const EXISTING_TABLES_TRANSIENT_NAME = 'existing_tables';

	/**
	 * Existing tables transient expiration, sec.
	 *
	 * @since 1.8.7
	 *
	 * @var int
	 * @noinspection SummerTimeUnsafeTimeManipulationInspection
	 */
	const EXISTING_TABLES_TRANSIENT_EXPIRATION = WEEK_IN_SECONDS; // A week.

	/**
	 * Existing tables.
	 *
	 * @since 1.8.7
	 *
	 * @var array
	 */
	private static $existing_tables = [];

	/**
	 * Get the list of existing tables and cache the result.
	 *
	 * @since 1.8.7
	 *
	 * @param string $table_name Table name. Can have SQL wildcard.
	 *
	 * @return array List of table names.
	 */
	public static function get_existing_tables( string $table_name ): array {

		global $wpdb;

		/**
		 * Filters existence of a table before a request to the database is executed.
		 *
		 * @since 1.8.7
		 *
		 * @param array  $tables     Existing tables with given table name.
		 * @param string $table_name Table name.
		 */
		$tables = (array) apply_filters( 'wpforms_helpers_db_pre_get_existing_tables', [], $table_name );

		if ( $tables ) {
			return $tables;
		}

		$tables = self::get_existing_tables_cache( $table_name );

		if ( $tables ) {
			return $tables;
		}

		// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
		$tables = $wpdb->get_results(
			$wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ),
			'ARRAY_N'
		);
		// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching

		$tables = ! empty( $tables ) ? wp_list_pluck( $tables, 0 ) : [];

		self::set_existing_tables_cache( $tables, $table_name );

		return self::$existing_tables[ $table_name ] ?? [];
	}

	/**
	 * Get the list of all existing custom tables starting with `wpforms_*` and cache the result.
	 *
	 * @since 1.8.7
	 *
	 * @return array List of table names.
	 */
	public static function get_existing_custom_tables(): array {

		global $wpdb;

		return self::get_existing_tables( "{$wpdb->prefix}wpforms_%" );
	}

	/**
	 * Check if the database table exists and cache the result.
	 *
	 * @since 1.8.7
	 *
	 * @param string $table_name Table name. Can have SQL wildcard.
	 *
	 * @return bool
	 */
	public static function table_exists( string $table_name ): bool {

		/**
		 * Filters existence of a table before a request to the database is executed.
		 *
		 * @since 1.8.7
		 *
		 * @param integer $exists     Table exists.
		 * @param string  $table_name Table name.
		 */
		if ( apply_filters( 'wpforms_helpers_db_pre_table_exists', false, $table_name ) ) {
			return true;
		}

		foreach ( self::get_existing_tables( $table_name ) as $existing_table ) {
			if ( self::wildcard_match( $table_name, $existing_table ) ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * Get the list of existing tables from cache.
	 *
	 * @since 1.8.7
	 *
	 * @param string $table_name Table name. Can have SQL wildcard.
	 *
	 * @return array List of table names.
	 */
	private static function get_existing_tables_cache( string $table_name ): array {

		$tables                = Transient::get( self::EXISTING_TABLES_TRANSIENT_NAME );
		self::$existing_tables = $tables ? $tables : [];

		return self::$existing_tables[ $table_name ] ?? [];
	}

	/**
	 * Set existing tables cache.
	 *
	 * @since 1.8.7
	 *
	 * @param array  $tables     Existing tables with given table name.
	 * @param string $table_name Table name.
	 *
	 * @return void
	 */
	private static function set_existing_tables_cache( array $tables, string $table_name ) {

		if ( empty( $tables ) ) {
			return;
		}

		self::$existing_tables[ $table_name ] = $tables;

		/**
		 * Filters existing tables transient expiration time.
		 *
		 * @since 1.8.7
		 *
		 * @param integer $expiration Expiration time.
		 */
		$expiration = apply_filters( 'wpforms_helpers_db_existing_tables_transient_expiration', self::EXISTING_TABLES_TRANSIENT_EXPIRATION );

		Transient::set( self::EXISTING_TABLES_TRANSIENT_NAME, self::$existing_tables, $expiration );
	}

	/**
	 * Flush existing tables cache.
	 *
	 * @since 1.9.0
	 *
	 * @return void
	 */
	public static function flush_existing_tables_cache() {

		self::$existing_tables = [];

		Transient::delete( self::EXISTING_TABLES_TRANSIENT_NAME );
	}

	/**
	 * Wildcard match.
	 * Works as MySQL LIKE match.
	 *
	 * @since 1.8.7
	 *
	 * @param string $pattern Pattern.
	 * @param string $subject String to search into.
	 *
	 * @return false|int
	 */
	private static function wildcard_match( string $pattern, string $subject ) {

		$regex = str_replace(
			[ '%', '_' ], // MySQL wildcard chars.
			[ '.*', '.' ],  // Regexp chars.
			preg_quote( $pattern, '/' )
		);

		return preg_match( '/^' . $regex . '$/is', $subject );
	}

	/**
	 * Check if all custom tables exist.
	 *
	 * @since 1.9.0
	 *
	 * @return bool True if all custom tables exist. False if any is missing.
	 */
	public static function custom_tables_exist(): bool {

		global $wpdb;

		$existing_tables = self::get_existing_custom_tables();
		$custom_tables   = wpforms()->is_pro() ? WPForms_Pro::CUSTOM_TABLES : WPForms_Lite::CUSTOM_TABLES;

		foreach ( $custom_tables as $table_name => $handler_class ) {
			if ( ! in_array( $wpdb->prefix . $table_name, $existing_tables, true ) ) {
				return false;
			}
		}

		return true;
	}

	/**
	 * Create all custom DB tables.
	 *
	 * @since 1.9.0
	 *
	 * @param bool $flush_cache Clear existing custom tables cache.
	 *
	 * @noinspection PhpPossiblePolymorphicInvocationInspection
	 */
	public static function create_custom_tables( bool $flush_cache = false ) {

		global $wpdb;

		if ( $flush_cache ) {
			self::flush_existing_tables_cache();
		}

		$existing_tables = self::get_existing_custom_tables();
		$custom_tables   = wpforms()->is_pro() ? WPForms_Pro::CUSTOM_TABLES : WPForms_Lite::CUSTOM_TABLES;
		$created         = false;

		foreach ( $custom_tables as $table_name => $handler_class ) {
			if ( in_array( $wpdb->prefix . $table_name, $existing_tables, true ) ) {
				continue;
			}

			/**
			 * Child class of WPForms_DB.
			 *
			 * @var $handler WPForms_DB
			 */
			$handler = new $handler_class();

			// Create a table.
			$handler->create_table();

			$created = true;
		}

		if ( $created ) {
			Transient::delete( self::EXISTING_TABLES_TRANSIENT_NAME );
		}
	}
}
CacheBase.php11329V
Chain.php8504V
Crypto.php2931V
DB.php6753V
File.php8466V
Form.php1926V
PathParser.php1404V
PluginSilentUpgrader.php23846V
Templates.php6410V
Transient.php7521V
MyMelon - Digital Marketing and Creative Agency in Delhi, India
Skip to content Skip to footer

MyMelon Home Page

Bored Of Old School Strategies?

Conventional strategies do no justice to complex modern problems. Bringing in kickass blueprints to escalate your exclusive ideas to the growth trajectory.

MyMelon Home Page (1)

Falling In Love With Your Problems

Your problems are our play! You get to decide which ‘solutions’ feel like an astounding fuck yes!

Discover pitch-perfect marketing strategies to deliver complex ideas into simplified solutions. 

Diversity in our problem solving approach makes us who we are!

You Do You

For us every client and their offerings are unique. We offer tailored and hot-off-the-press strategies to produce a unique brand identity. Listening, evolving, and promoting your articles of faith is what makes our work kickass and compelling too!

#
Award
Type
Project
01
Best Project
Art Business
Business Style
2017
02
Best Design
Creative Work
Best Designers
2018
03
Best Concept
New Strategy
Branding Concept
2019
04
Best Picture
Visualization
Small Figures
2020

Our Inspirations

Vivekanand

Arise, awake, and stop not until the goal is achieved

Dr APJ Abdul Kalam

Creativity is seeing the same thing but thinking differently

Christopher Columbus

By prevailing over all obstacles one may unfailingly arrive at his chosen goal.

JRD Tata

Uncommon thinkers reuse what common thinkers refuse.

Lead The Way With Your New Digital Partners

Waiting to get viral? Don’t worry we’ve got your back!

Leading your way through business acumen and business strategies tailored to your needs.

Handholding you since your first lightbulb moment to making a mark in the industry through unique formulas.  Bringing unexpected things to the table is in our DNA.

Producing Tailored Solutions

One solution for multiple solutions is hard to swallow. Creating tailored solutions for your unique problems

Setting Benchmarks

Doesn’t carving a path for others give the best kick ever?

Making A Difference

You can’t wait for a case study. You will be too late!

Blogs

Contact Us

We work hard and then succeed on purpose.

We are constantly looking for a needle in a haystack and connecting to get the deal to happen!

If you've loved our idea and want to take the road less traveled, reach out to us on …….

Before you take the sure-shots of success, let's take some shots of vodka!

    Polscy gracze coraz częściej wybierają kasyno bez weryfikacji przy wypłacie bez ukrytych opłat, aby cieszyć się szybkim dostępem do gier i przejrzystymi warunkami wypłaty wygranych. Tego typu platformy stawiają na uproszczoną rejestrację, nowoczesne metody płatności oraz jasne zasady dotyczące transakcji. Przed rozpoczęciem gry warto zapoznać się z opiniami innych użytkowników, aby ocenić jakość obsługi i niezawodność serwisu.

    Jeśli chcesz znaleźć rzetelne opinie oraz porównać najlepsze platformy, casino Revolut Pay może pomóc Ci podjąć świadomą decyzję. Znajdziesz tam recenzje użytkowników, szczegóły bonusów oraz informacje o wpłatach i wypłatach w kasynach akceptujących Revolut.

    People searching for gerçek canlı casino usually mean live-dealer roulette, blackjack, baccarat, or game-show tables streamed from a studio with a real dealer, rather than an RNG-only game. To assess authenticity, verify the operator’s licence directly with the regulator, check the named game provider and studio, look for clear rules and table limits, inspect withdrawal terms, and confirm that the service is legal in your jurisdiction; a foreign licence does not automatically make an operator legal in Türkiye.

    [canlı casino lisans rehberi](https://guvenilircanlicasinos.com/)[gerçek krupiyeli oyunlar](https://www.livecasinos.com/tr/) [guvenilircanlicasinos](https://guvenilircanlicasinos.com/)

    Many Dutch players now look for beste online casino iDEAL to benefit from secure iDEAL deposits, low minimum stakes, and quick withdrawals. These casinos integrate trusted Dutch payment infrastructure with streamlined cashout systems, ideal for users who value speed, simplicity, and transparent transactions. By consulting authentic player reviews, gamblers can identify sites that consistently deliver rapid payouts and a seamless gaming experience.

    Gli online casinos with bancoposta sono principalmente operatori che accettano la carta Visa o Mastercard collegata al conto BancoPosta per depositi e, in alcuni casi, prelievi. Tra i nomi più citati in Italia figurano 888casino, SNAI, LeoVegas, Planetwin365, Gioco Digitale, Sisal e StarCasinò, con depositi minimi spesso tra 10€ e 20€ e limiti massimi che possono arrivare a diverse migliaia di euro. Per utilizzare la carta, di solito basta selezionare Visa o Mastercard alla cassa, inserire i dati della carta BancoPosta e completare la verifica 3D Secure; i prelievi possono tornare sulla stessa carta o sul conto tramite bonifico, con tempi tipici da 24 ore a 3–5 giorni lavorativi.

    Gracze poszukujący sprawdzonych platform często wybierają kasyno niemcy, które oferuje przejrzyste zasady wypłat i bezpieczne metody płatności. Przed rejestracją warto porównać limity transakcji, czas realizacji przelewów oraz dostępne opcje wpłat, aby uniknąć niepotrzebnych opóźnień. Opinie innych użytkowników mogą pomóc ocenić rzetelność obsługi, jakość gier i ogólny komfort korzystania z platformy.

    Oferty określane jako zagraniczne kasyna bonus bez depozytu mogą obejmować darmowe spiny lub niewielkie środki promocyjne przyznawane po rejestracji i weryfikacji konta. Przed skorzystaniem z promocji należy dokładnie sprawdzić wymagania obrotu, maksymalną wypłatę, czas ważności bonusu oraz ograniczenia dla użytkowników z Polski. Zagraniczna licencja nie legalizuje automatycznie działalności hazardowej w Polsce, dlatego warto zweryfikować operatora w oficjalnych źródłach i grać odpowiedzialnie .