Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/blogvaul.../callback/wings
File: misc.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (!defined('ABSPATH')) exit;
[2] Fix | Delete
if (!class_exists('BVMiscCallback')) :
[3] Fix | Delete
[4] Fix | Delete
class BVMiscCallback extends BVCallbackBase {
[5] Fix | Delete
public $settings;
[6] Fix | Delete
public $bvinfo;
[7] Fix | Delete
public $siteinfo;
[8] Fix | Delete
public $account;
[9] Fix | Delete
public $bvapi;
[10] Fix | Delete
public $db;
[11] Fix | Delete
[12] Fix | Delete
const MISC_WING_VERSION = 1.3;
[13] Fix | Delete
[14] Fix | Delete
public function __construct($callback_handler) {
[15] Fix | Delete
$this->settings = $callback_handler->settings;
[16] Fix | Delete
$this->siteinfo = $callback_handler->siteinfo;
[17] Fix | Delete
$this->account = $callback_handler->account;
[18] Fix | Delete
$this->db = $callback_handler->db;
[19] Fix | Delete
$this->bvinfo = new BVInfo($callback_handler->settings);
[20] Fix | Delete
$this->bvapi = new BVWPAPI($callback_handler->settings);
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
public function refreshPluginUpdates() {
[24] Fix | Delete
global $wp_current_filter;
[25] Fix | Delete
$wp_current_filter[] = 'load-update-core.php';
[26] Fix | Delete
[27] Fix | Delete
wp_update_plugins();
[28] Fix | Delete
[29] Fix | Delete
array_pop($wp_current_filter);
[30] Fix | Delete
[31] Fix | Delete
wp_update_plugins();
[32] Fix | Delete
[33] Fix | Delete
return array("wpupdateplugins" => true);
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
public function refreshThemeUpdates() {
[37] Fix | Delete
global $wp_current_filter;
[38] Fix | Delete
$wp_current_filter[] = 'load-update-core.php';
[39] Fix | Delete
[40] Fix | Delete
wp_update_themes();
[41] Fix | Delete
[42] Fix | Delete
array_pop($wp_current_filter);
[43] Fix | Delete
[44] Fix | Delete
wp_update_themes();
[45] Fix | Delete
[46] Fix | Delete
return array("wpupdatethemes" => true);
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
public function getWingInfo() {
[50] Fix | Delete
return array('wing_info' => self::$wing_infos);
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
public function post_types_data($post_params) {
[54] Fix | Delete
$result = array();
[55] Fix | Delete
$get_post_types_args = $post_params['get_post_types_args'];
[56] Fix | Delete
$post_types = get_post_types($get_post_types_args);
[57] Fix | Delete
$post_types = array_merge($post_types, $post_params['include_post_types']);
[58] Fix | Delete
$post_types = array_diff( $post_types, $post_params['exclude_post_types']);
[59] Fix | Delete
$result['post_types'] = $post_types;
[60] Fix | Delete
$post_types = esc_sql($post_types);
[61] Fix | Delete
$post_types = "'" . implode("','", $post_types) . "'";
[62] Fix | Delete
$post_table = $post_params['table'];
[63] Fix | Delete
$post_select_columns = implode(", ", $post_params['select_column']);
[64] Fix | Delete
$post_query = "SELECT MAX(ID) as $post_select_columns FROM ( SELECT
[65] Fix | Delete
$post_select_columns FROM $post_table WHERE post_type IN ( $post_types )
[66] Fix | Delete
AND post_status='publish' ORDER BY post_date DESC ) AS posts GROUP BY post_type";
[67] Fix | Delete
$posts = $this->db->getResult($post_query);
[68] Fix | Delete
foreach ( $posts as $key => $post ) {
[69] Fix | Delete
$posts[$key]['url'] = get_permalink($post['ID']);
[70] Fix | Delete
}
[71] Fix | Delete
$result['posts'] = $posts;
[72] Fix | Delete
return $result;
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
public function taxonomy_data($taxonomy_params) {
[76] Fix | Delete
$result = array();
[77] Fix | Delete
$get_taxonomies_args = $taxonomy_params['get_taxonomies_args'];
[78] Fix | Delete
$taxonomies = get_taxonomies($get_taxonomies_args);
[79] Fix | Delete
$taxonomies = array_diff($taxonomies, $taxonomy_params['exclude_taxonomies']);
[80] Fix | Delete
$result['taxonomies'] = $taxonomies;
[81] Fix | Delete
$taxonomies = esc_sql( $taxonomies );
[82] Fix | Delete
$taxonomies = "'" . implode( "','", $taxonomies ) . "'";
[83] Fix | Delete
$taxonomy_table = $taxonomy_params['table'];
[84] Fix | Delete
$taxonomy_select_columns = implode(", ", $taxonomy_params['select_column']);
[85] Fix | Delete
$taxonomy_query = "SELECT MAX( term_id ) AS $taxonomy_select_columns FROM (
[86] Fix | Delete
SELECT $taxonomy_select_columns FROM $taxonomy_table WHERE taxonomy IN (
[87] Fix | Delete
$taxonomies ) AND count > 0) AS taxonomies GROUP BY taxonomy";
[88] Fix | Delete
[89] Fix | Delete
$taxonomies = $this->db->getResult($taxonomy_query);
[90] Fix | Delete
foreach($taxonomies as $key => $taxonomy) {
[91] Fix | Delete
$taxonomies[$key]['url'] = get_term_link((int)$taxonomy['term_id'], $taxonomy['taxonomy']);
[92] Fix | Delete
}
[93] Fix | Delete
$result['taxonomy_data'] = $taxonomies;
[94] Fix | Delete
return $result;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
public function process($request) {
[98] Fix | Delete
$bvinfo = $this->bvinfo;
[99] Fix | Delete
$settings = $this->settings;
[100] Fix | Delete
$params = $request->params;
[101] Fix | Delete
switch ($request->method) {
[102] Fix | Delete
case "dummyping":
[103] Fix | Delete
$resp = array();
[104] Fix | Delete
$resp = array_merge($resp, $this->siteinfo->info());
[105] Fix | Delete
$resp = array_merge($resp, $this->account->info());
[106] Fix | Delete
$resp = array_merge($resp, $this->bvinfo->info());
[107] Fix | Delete
$resp = array_merge($resp, $this->getWingInfo());
[108] Fix | Delete
break;
[109] Fix | Delete
case "pngbv":
[110] Fix | Delete
$info = array();
[111] Fix | Delete
$this->siteinfo->basic($info);
[112] Fix | Delete
$this->bvapi->pingbv('/bvapi/pingbv', $info);
[113] Fix | Delete
$resp = array("status" => true);
[114] Fix | Delete
break;
[115] Fix | Delete
case "enablebadge":
[116] Fix | Delete
$option = $bvinfo->badgeinfo;
[117] Fix | Delete
$badgeinfo = array();
[118] Fix | Delete
$badgeinfo['badgeurl'] = $params['badgeurl'];
[119] Fix | Delete
$badgeinfo['badgeimg'] = $params['badgeimg'];
[120] Fix | Delete
$badgeinfo['badgealt'] = $params['badgealt'];
[121] Fix | Delete
$settings->updateOption($option, $badgeinfo);
[122] Fix | Delete
$resp = array("status" => $settings->getOption($option));
[123] Fix | Delete
break;
[124] Fix | Delete
case "disablebadge":
[125] Fix | Delete
$option = $bvinfo->badgeinfo;
[126] Fix | Delete
$settings->deleteOption($option);
[127] Fix | Delete
$resp = array("status" => !$settings->getOption($option));
[128] Fix | Delete
break;
[129] Fix | Delete
case "getoption":
[130] Fix | Delete
$resp = array('getoption' => $settings->getOption($params['opkey']));
[131] Fix | Delete
break;
[132] Fix | Delete
case "setdynplug":
[133] Fix | Delete
$settings->updateOption('bvdynplug', $params['dynplug']);
[134] Fix | Delete
$resp = array("setdynplug" => $settings->getOption('bvdynplug'));
[135] Fix | Delete
break;
[136] Fix | Delete
case "unsetdynplug":
[137] Fix | Delete
$settings->deleteOption('bvdynplug');
[138] Fix | Delete
$resp = array("unsetdynplug" => $settings->getOption('bvdynplug'));
[139] Fix | Delete
break;
[140] Fix | Delete
case "wpupplgs":
[141] Fix | Delete
$resp = $this->refreshPluginUpdates();
[142] Fix | Delete
break;
[143] Fix | Delete
case "wpupthms":
[144] Fix | Delete
$resp = $this->refreshThemeUpdates();
[145] Fix | Delete
break;
[146] Fix | Delete
case "wpupcre":
[147] Fix | Delete
$resp = array("wpupdatecore" => wp_version_check());
[148] Fix | Delete
break;
[149] Fix | Delete
case "phpinfo":
[150] Fix | Delete
phpinfo();
[151] Fix | Delete
die();
[152] Fix | Delete
break;
[153] Fix | Delete
case "wpnonce":
[154] Fix | Delete
$resp = array("wpnonce" => wp_create_nonce($params["wpnonce_action"]));
[155] Fix | Delete
break;
[156] Fix | Delete
case "dlttrsnt":
[157] Fix | Delete
$resp = array("dlttrsnt" => $settings->deleteTransient($params['key']));
[158] Fix | Delete
break;
[159] Fix | Delete
case "optns":
[160] Fix | Delete
$resp = array();
[161] Fix | Delete
[162] Fix | Delete
if (array_key_exists("get_options", $params))
[163] Fix | Delete
$resp["get_options"] = $settings->getOptions($params["get_options"]);
[164] Fix | Delete
[165] Fix | Delete
if (array_key_exists("update_options", $params))
[166] Fix | Delete
$resp["update_options"] = $settings->updateOptions($params["update_options"]);
[167] Fix | Delete
[168] Fix | Delete
if (array_key_exists("delete_options", $params))
[169] Fix | Delete
$resp["delete_options"] = $settings->deleteOptions($params["delete_options"]);
[170] Fix | Delete
[171] Fix | Delete
break;
[172] Fix | Delete
case "setbvss":
[173] Fix | Delete
$resp = array("status" => $settings->updateOption('bv_site_settings', $params['bv_site_settings']));
[174] Fix | Delete
break;
[175] Fix | Delete
case "stsrvcs":
[176] Fix | Delete
$resp = array();
[177] Fix | Delete
$deleted_configs = array();
[178] Fix | Delete
$updated_configs = array();
[179] Fix | Delete
if (array_key_exists("configs_to_delete", $params)) {
[180] Fix | Delete
foreach($params["configs_to_delete"] as $config_name) {
[181] Fix | Delete
$deleted_configs[$config_name] = $settings->deleteOption($config_name);
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
if (array_key_exists("configs_to_update", $params)) {
[185] Fix | Delete
foreach($params["configs_to_update"] as $config_name => $config_value) {
[186] Fix | Delete
$settings->updateOption($config_name, $config_value);
[187] Fix | Delete
$updated_configs[$config_name] = $settings->getOption($config_name);
[188] Fix | Delete
}
[189] Fix | Delete
}
[190] Fix | Delete
$resp["updated_configs"] = $updated_configs;
[191] Fix | Delete
$resp["deleted_configs"] = $deleted_configs;
[192] Fix | Delete
break;
[193] Fix | Delete
case "critical_css_data":
[194] Fix | Delete
$resp = array();
[195] Fix | Delete
if (array_key_exists('fetch_post_data', $params) && $params['fetch_post_data'] == true) {
[196] Fix | Delete
$post_params = $params['post_params'];
[197] Fix | Delete
$post_result = $this->post_types_data($post_params);
[198] Fix | Delete
$resp['post_cp_results'] = $post_result['posts'];
[199] Fix | Delete
$resp['post_types'] = $post_result['post_types'];
[200] Fix | Delete
}
[201] Fix | Delete
if (array_key_exists('fetch_taxonomy_data', $params) && $params['fetch_taxonomy_data'] == true) {
[202] Fix | Delete
$taxonomy_params = $params['taxonomy_params'];
[203] Fix | Delete
$taxonomy_result = $this->taxonomy_data($taxonomy_params);
[204] Fix | Delete
$resp['taxonomy_cp_results'] = $taxonomy_result['taxonomy_data'];
[205] Fix | Delete
$resp['taxonomies'] = $taxonomy_result['taxonomies'];
[206] Fix | Delete
}
[207] Fix | Delete
break;
[208] Fix | Delete
[209] Fix | Delete
case "get_post_ids":
[210] Fix | Delete
if (array_key_exists('urls', $params)) {
[211] Fix | Delete
$resp = array();
[212] Fix | Delete
foreach ( $params['urls'] as $url ) {
[213] Fix | Delete
$resp[$url] = url_to_postid($url);
[214] Fix | Delete
}
[215] Fix | Delete
}
[216] Fix | Delete
break;
[217] Fix | Delete
[218] Fix | Delete
case "permalink":
[219] Fix | Delete
if (array_key_exists('post_ids', $params)) {
[220] Fix | Delete
$resp = array();
[221] Fix | Delete
foreach ( $params['post_ids'] as $id ) {
[222] Fix | Delete
$resp[$id]['url'] = get_permalink($id);
[223] Fix | Delete
}
[224] Fix | Delete
}
[225] Fix | Delete
break;
[226] Fix | Delete
default:
[227] Fix | Delete
$resp = false;
[228] Fix | Delete
}
[229] Fix | Delete
return $resp;
[230] Fix | Delete
}
[231] Fix | Delete
}
[232] Fix | Delete
endif;
[233] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function