File manager - Edit - /home/infoilmg/public_html/wp-content/plugins/fs-poster/App/Providers/DB.php
Back
<?php namespace FSPoster\App\Providers; use wpdb; /** * Class DB * @package FSPoster\App\Providers */ class DB { const PLUGIN_DB_PREFIX = 'fs_'; /** * @return wpdb */ public static function DB () { global $wpdb; return $wpdb; } /** * @param $tbName * * @return string */ public static function table ( $tbName ) { return self::DB()->base_prefix . self::PLUGIN_DB_PREFIX . $tbName; } /** * @param $tbName * * @return string */ public static function WPtable ( $tbName, $multisite = FALSE ) { $multisitePrefix = ''; if ( $multisite && is_multisite() && Helper::getBlogId() > 1 ) { $multisitePrefix = Helper::getBlogId() . '_'; } return self::DB()->base_prefix . $multisitePrefix . $tbName; } /** * @param $table * @param null $where * * @return mixed */ public static function fetch ( $table, $where = NULL ) { $whereQuery = ''; $argss = []; $where = is_numeric( $where ) && $where > 0 ? [ $where ] : $where; if ( ! empty( $where ) && is_array( $where ) ) { $whereQuery = ''; foreach ( $where as $filed => $value ) { $filed = $filed === 0 ? 'id' : $filed; $whereQuery .= ( $whereQuery === '' ? '' : ' AND ' ) . $filed . '=%s'; $argss[] = (string) $value; } $whereQuery = ' WHERE ' . $whereQuery; } if ( empty( $argss ) ) { return DB::DB()->get_row( "SELECT * FROM " . DB::table( $table ) . $whereQuery, ARRAY_A ); } return DB::DB()->get_row( DB::DB()->prepare( "SELECT * FROM " . DB::table( $table ) . $whereQuery, $argss ), ARRAY_A ); } /** * @param $table * @param null $where * * @return mixed */ public static function fetchAll ( $table, $where = NULL ) { $whereQuery = ''; $argss = []; $where = is_numeric( $where ) && $where > 0 ? [ $where ] : $where; if ( ! empty( $where ) && is_array( $where ) ) { $whereQuery = ''; foreach ( $where as $filed => $value ) { $filed = $filed === 0 ? 'id' : $filed; $whereQuery .= ( $whereQuery === '' ? '' : ' AND ' ) . $filed . '=%s'; $argss[] = (string) $value; } $whereQuery = ' WHERE ' . $whereQuery; } if ( empty( $argss ) ) { return DB::DB()->get_results( "SELECT * FROM " . DB::table( $table ) . $whereQuery, ARRAY_A ); } return DB::DB()->get_results( DB::DB()->prepare( "SELECT * FROM " . DB::table( $table ) . $whereQuery, $argss ), ARRAY_A ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Generation time: 1.1 |
proxy
|
phpinfo
|
Settings