: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (!defined('ABSPATH')) exit;
if (!class_exists('BVInfoCallback')) :
class BVInfoCallback extends BVCallbackBase {
const INFO_WING_VERSION = 2.3;
public function __construct($callback_handler) {
$this->db = $callback_handler->db;
$this->siteinfo = $callback_handler->siteinfo;
$this->settings = $callback_handler->settings;
$this->bvinfo = new BVInfo($this->settings);
$this->bvapi = new BVWPAPI($this->settings);
public function getPosts($post_type, $count = 5) {
$args = array('numberposts' => $count, 'post_type' => $post_type);
$posts = get_posts($args);
$keys = array('post_title', 'guid', 'ID', 'post_date');
foreach ($posts as $post) {
$post_array = get_object_vars($post);
foreach ($keys as $key) {
$pdata[$key] = $post_array[$key];
$result["posts"][] = $pdata;
public function getStats() {
"posts" => get_object_vars(wp_count_posts()),
"pages" => get_object_vars(wp_count_posts("page")),
"comments" => get_object_vars(wp_count_comments())
public function addDBInfoToPlugin($pdata, $plugin_file) {
case "woocommerce/woocommerce.php":
$pdata['current_db_version'] = $this->settings->getOption('woocommerce_db_version');
$pdata['latest_db_version'] = $this->bvinfo->getLatestWooCommerceDBVersion();
case "elementor/elementor.php":
$pdata['current_db_version'] = $this->settings->getOption('elementor_version');
$pdata['latest_db_version'] = $this->bvinfo->getLatestElementorDBVersion($plugin_file);
case "elementor-pro/elementor-pro.php":
$pdata['current_db_version'] = $this->settings->getOption('elementor_pro_version');
$pdata['latest_db_version'] = $this->bvinfo->getLatestElementorDBVersion($plugin_file);
public function getPlugins() {
if (!function_exists('get_plugins')) {
require_once (ABSPATH."wp-admin/includes/plugin.php");
$plugins = get_plugins();
foreach ($plugins as $plugin_file => $plugin_data) {
'title' => $plugin_data['Title'],
'version' => $plugin_data['Version'],
'active' => is_plugin_active($plugin_file),
'network' => $plugin_data['Network'],
"plugin_uri" => $plugin_data["PluginURI"],
"update_uri" => $plugin_data["UpdateURI"],
"author_uri" => $plugin_data["AuthorURI"],
"author" => $plugin_data["AuthorName"],
$pdata = $this->addDBInfoToPlugin($pdata, $plugin_file);
$result["plugins"][] = $pdata;
public function themeToArray($theme) {
'title' => $theme->Title,
'stylesheet' => $theme->get_stylesheet(),
'template' => $theme->Template,
'version' => $theme->Version,
'theme_uri' => $theme->get('ThemeURI'),
'author' => $theme->get('Author'),
'author_uri' => $theme->get('AuthorURI'),
'update_uri' => $theme->get('UpdateURI'),
'name' => $theme["Name"],
'title' => $theme["Title"],
'stylesheet' => $theme["Stylesheet"],
'template' => $theme["Template"],
'version' => $theme["Version"],
'author' => $theme['Author'],
'author_uri' => $theme['Author URI'],
public function getThemes() {
$themes = function_exists('wp_get_themes') ? wp_get_themes() : get_themes();
foreach($themes as $theme) {
$pdata = $this->themeToArray($theme);
$result["themes"][] = $pdata;
$theme = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme();
$pdata = $this->themeToArray($theme);
$result["currenttheme"] = $pdata;
public function getSystemInfo() {
'host' => $_SERVER['HTTP_HOST'],
'phpversion' => phpversion(),
'AF_INET6' => defined('AF_INET6')
if (array_key_exists('SERVER_ADDR', $_SERVER)) {
$sys_info['serverip'] = $_SERVER['SERVER_ADDR'];
if (function_exists('get_current_user')) {
$sys_info['user'] = get_current_user();
if (function_exists('getmygid')) {
$sys_info['gid'] = getmygid();
if (function_exists('getmyuid')) {
$sys_info['uid'] = getmyuid();
if (function_exists('posix_getuid')) {
$sys_info['webuid'] = posix_getuid();
$sys_info['webgid'] = posix_getgid();
public function getWpInfo() {
global $wp_version, $wp_db_version, $wp_local_package;
$siteinfo = $this->siteinfo;
$upload_dir = wp_upload_dir();
'dbprefix' => $db->dbprefix(),
'wpmu' => $siteinfo->isMultisite(),
'mainsite' => $siteinfo->isMainSite(),
'main_site_id' => $siteinfo->getMainSiteId(),
'name' => get_bloginfo('name'),
'siteurl' => $siteinfo->siteurl(),
'homeurl' => $siteinfo->homeurl(),
'charset' => get_bloginfo('charset'),
'wpversion' => $wp_version,
'dbversion' => $wp_db_version,
'mysql_version' => $db->getMysqlVersion(),
'bvpluginpath' => defined('BVBASEPATH') ? BVBASEPATH : null,
'uploadpath' => $upload_dir['basedir'],
'uploaddir' => wp_upload_dir(),
'contentdir' => defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : null,
'contenturl' => defined('WP_CONTENT_URL') ? WP_CONTENT_URL : null,
'plugindir' => defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : null,
'themedir' => get_stylesheet_directory(),
'templatedir' => get_template_directory(),
'dbcharset' => defined('DB_CHARSET') ? DB_CHARSET : null,
'disallow_file_edit' => defined('DISALLOW_FILE_EDIT'),
'disallow_file_mods' => defined('DISALLOW_FILE_MODS'),
'custom_users' => defined('CUSTOM_USER_TABLE') ? CUSTOM_USER_TABLE : null,
'custom_usermeta' => defined('CUSTOM_USERMETA_TABLE') ? CUSTOM_USERMETA_TABLE : null,
'locale' => get_locale(),
'wp_local_string' => $wp_local_package,
'charset_collate' => $db->getCharsetCollate()
public function getUsers($full, $args = array()) {
$users = get_users($args);
$results = $this->objectToArray($users);
foreach( (array) $users as $user) {
$result['user_email'] = $user->user_email;
$result['ID'] = $user->ID;
$result['roles'] = $user->roles;
$result['user_login'] = $user->user_login;
$result['display_name'] = $user->display_name;
$result['user_registered'] = $user->user_registered;
$result['user_status'] = $user->user_status;
$result['user_url'] = $user->url;
public function availableFunctions(&$info) {
if (extension_loaded('openssl')) {
if (function_exists('is_ssl') && is_ssl()) {
if (function_exists('openssl_public_encrypt')) {
$info['openssl_public_encrypt'] = "1";
if (function_exists('openssl_public_decrypt')) {
$info['openssl_public_decrypt'] = "1";
if (function_exists('base64_encode')) {
$info['b64encode'] = true;
if (function_exists('base64_decode')) {
$info['b64decode'] = true;
public function servicesInfo(&$data) {
$settings = $this->settings;
$data['protect'] = $settings->getOption('bvptconf');
$data['brand'] = $settings->getOption($this->bvinfo->brand_option);
$data['badgeinfo'] = $settings->getOption($this->bvinfo->badgeinfo);
$data[$this->bvinfo->services_option_name] = $this->bvinfo->config;
public function dbconf(&$info) {
if (defined('DB_CHARSET'))
$info['dbcharset'] = DB_CHARSET;
$info['dbprefix'] = $db->dbprefix();
$info['charset_collate'] = $db->getCharsetCollate();
public function cookieInfo() {
if (defined('COOKIEPATH'))
$info['cookiepath'] = COOKIEPATH;
if (defined('COOKIE_DOMAIN'))
$info['cookiedomain'] = COOKIE_DOMAIN;
public function activate() {
$this->siteinfo->basic($info);
$this->servicesInfo($info);
$this->availableFunctions($info);
public function getHostInfo() {
$host_info['PHP_SERVER_NAME'] = php_uname('\n');
if (array_key_exists('IS_PRESSABLE', get_defined_constants())) {
$host_info['IS_PRESSABLE'] = true;
if (array_key_exists('GRIDPANE', get_defined_constants())) {
$host_info['IS_GRIDPANE'] = true;
if (defined('WPE_APIKEY')) {
$host_info['WPE_APIKEY'] = WPE_APIKEY;
if (defined('IS_ATOMIC')) {
$host_info['IS_ATOMIC'] = IS_ATOMIC;
public function serverConfig() {
'software' => $_SERVER['SERVER_SOFTWARE'],
'sapi' => (function_exists('php_sapi_name')) ? php_sapi_name() : false,
'has_apache_get_modules' => function_exists('apache_get_modules'),
'posix_getuid' => (function_exists('posix_getuid')) ? posix_getuid() : null,
'uid' => (function_exists('getmyuid')) ? getmyuid() : null,
'user_ini' => ini_get('user_ini.filename'),
'php_major_version' => PHP_MAJOR_VERSION
function refreshUpdatesInfo() {
global $wp_current_filter;
$wp_current_filter[] = 'load-update-core.php';
if (function_exists('wp_clean_update_cache')) {
$this->settings->deleteTransient('update_plugins');
$this->settings->deleteTransient('update_themes');
$this->settings->deleteTransient('update_core');
array_pop($wp_current_filter);
wp_version_check(array(), true);
function getUsersHandler($args = array()) {
$table = "{$db->dbprefix()}users";
$count = $db->rowsCount($table);
$result = array("count" => $count);
$max_users = array_key_exists('max_users', $args) ? $args['max_users'] : 500;
$roles = array_key_exists('roles', $args) ? $args['roles'] : array();
if (($count > $max_users) && !empty($roles)) {
foreach ($roles as $role) {
$args['number'] = $max_users;
$fetched = $this->getUsers($args['full'], $args);
$max_users -= sizeof($fetched);
$users = array_merge($users, $fetched);
$args['number'] = $max_users;
$users = $this->getUsers($args['full'], $args);
$result['users_info'] = $users;
function getTransient($name, $asarray = true) {
$transient = $this->settings->getTransient($name);
if ($transient && $asarray)
$transient = $this->objectToArray($transient);
return array("transient" => $transient);
function getPluginsHandler($args = array()) {
$result = array_merge($this->getPlugins(), $this->getTransient('update_plugins'));
if (array_key_exists('clear_filters', $args)) {
$filters = $args['clear_filters'];
foreach ($filters as $filter)
remove_all_filters($filter);
$transient_without_filters = $this->getTransient('update_plugins');
$result['transient_without_filters'] = $transient_without_filters['transient'];
function getThemesHandler($args = array()) {
$result = array_merge($this->getThemes(), $this->getTransient('update_themes'));
if (array_key_exists('clear_filters', $args)) {
$filters = $args['clear_filters'];
foreach ($filters as $filter)
remove_all_filters($filter);
$transient_without_filters = $this->getTransient('update_themes');
$result['transient_without_filters'] = $transient_without_filters['transient'];
function getCoreHandler() {
global $wp_db_version, $wp_version;
$result = $this->getTransient('update_core');
$result['current_db_version'] = $this->settings->getOption('db_version');
$result['latest_db_version'] = $wp_db_version;
$result['wp_version'] = $wp_version;
function getSiteInfo($args) {
if (array_key_exists('pre_refresh_get_options', $args)) {
$result['pre_refresh_get_options'] = $this->settings->getOptions(
$args['pre_refresh_get_options']
if (array_key_exists('refresh', $args))
$result['refreshed'] = $this->refreshUpdatesInfo();
if (array_key_exists('users', $args))
$result['users'] = $this->getUsersHandler($args['users']);
if (array_key_exists('plugins', $args))
$result['plugins'] = $this->getPluginsHandler($args['plugins']);
if (array_key_exists('themes', $args))
$result['themes'] = $this->getThemesHandler($args['themes']);
if (array_key_exists('core', $args))
$result['core'] = $this->getCoreHandler();
if (array_key_exists('sys', $args))
$result['sys'] = $this->getSystemInfo();
if (array_key_exists('get_options', $args))
$result['get_options'] = $this->settings->getOptions($args['get_options']);
$this->siteinfo->basic($info);
$this->bvapi->pingbv('/bvapi/pingbv', $info);
function getPostActivateInfo($args) {
if (array_key_exists('pingbv', $args))
$result['pingbv'] = array('status' => $this->pingBV());
if (array_key_exists('activate_info', $args))
$result['activate_info'] = $this->activate();
if (array_key_exists('cookie_info', $args))
$result['cookie_info'] = $this->cookieInfo();
if (array_key_exists('get_host', $args))
$result['get_host'] = $this->getHostInfo();
if (array_key_exists('get_wp', $args))
$result['get_wp'] = $this->getWpInfo();
if (array_key_exists('get_options', $args))
$result['get_options'] = $this->settings->getOptions($args['get_options']);
if (array_key_exists('get_tables', $args))
$result['get_tables'] = $this->db->showTables();
$result['status'] = true;
function getPluginServicesInfo($args) {
if (array_key_exists('get_options', $args))
$result['get_options'] = $this->settings->getOptions($args['get_options']);
if (array_key_exists('pingbv', $args))
$result['pingbv'] = array('status' => $this->pingBV());
if (array_key_exists('server_config', $args))
$result['server_config'] = $this->serverConfig();
function getPluginFileData($plugin_file) {
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';