/var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/src/Framework/Database
NameSizeModeActions
Exceptions/-0755rm
DB.php57460644editdlrm
Edit: /var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/src/Framework/Database/DB.php (5746B)
prepare method * * @see WPDB::prepare() for usage details * * @since 2.9.6 * * @param string $query * @param mixed ...$args * * @return false|mixed */ public static function prepare($query, ...$args) { global $wpdb; return $wpdb->prepare($query, ...$args); } /** * Magic method which calls the static method on the $wpdb while performing error checking * * @since 2.9.6 * * @param $name * @param $arguments * * @return mixed * @throws DatabaseQueryException */ public static function __callStatic($name, $arguments) { return self::runQueryWithErrorChecking( function () use ($name, $arguments) { global $wpdb; return call_user_func_array([$wpdb, $name], $arguments); } ); } /** * Get last insert ID * * @since 2.10.0 * @return int */ public static function last_insert_id() { global $wpdb; return $wpdb->insert_id; } /** * Prefix given table name with $wpdb->prefix * * @param string $tableName * * @return string */ public static function prefix($tableName) { global $wpdb; return $wpdb->prefix . $tableName; } /** * Create QueryBuilder instance * * @param string $table * @param null|string $alias * * @return QueryBuilder */ public static function table($table, $alias = null) { $builder = new QueryBuilder(); $builder->from($table, $alias); return $builder; } /** * Used as a flag to tell QueryBuilder not to process the provided SQL * If $args are provided, we will assume that dev wants to use DB::prepare method with raw SQL * * @param string $sql * @param ...$args * * @return RawSQL */ public static function raw($sql, ...$args) { return new RawSQL($sql, ...$args); } /** * Runs a query callable and checks to see if any unique SQL errors occurred when it was run * * @since 2.9.2 * * @param Callable $queryCaller * * @return mixed * @throws DatabaseQueryException */ private static function runQueryWithErrorChecking($queryCaller) { global $wpdb, $EZSQL_ERROR; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $errorCount = is_array($EZSQL_ERROR) ? count($EZSQL_ERROR) : 0; $hasShowErrors = $wpdb->hide_errors(); $output = $queryCaller(); if ($hasShowErrors) { $wpdb->show_errors(); } $wpError = self::getQueryErrors($errorCount); if ( ! empty($wpError->errors)) { throw DatabaseQueryException::create($wpError->get_error_messages()); } return $output; } /** * Retrieves the SQL errors stored by WordPress * * @since 2.9.2 * * @param int $initialCount * * @return WP_Error */ private static function getQueryErrors($initialCount = 0) { global $EZSQL_ERROR; $wpError = new WP_Error(); if (is_array($EZSQL_ERROR)) { for ($index = $initialCount, $indexMax = count($EZSQL_ERROR); $index < $indexMax; $index++) { $error = $EZSQL_ERROR[$index]; if (empty($error['error_str']) || empty($error['query']) || 0 === strpos( $error['query'], 'DESCRIBE ' )) { continue; } $wpError->add('db_delta_error', $error['error_str']); } } return $wpError; } }