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...
File: wp_admin.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (!defined('ABSPATH')) exit;
[2] Fix | Delete
if (!class_exists('BVWPAdmin')) :
[3] Fix | Delete
[4] Fix | Delete
class BVWPAdmin {
[5] Fix | Delete
public $settings;
[6] Fix | Delete
public $siteinfo;
[7] Fix | Delete
public $bvinfo;
[8] Fix | Delete
public $bvapi;
[9] Fix | Delete
[10] Fix | Delete
function __construct($settings, $siteinfo, $bvapi = null) {
[11] Fix | Delete
$this->settings = $settings;
[12] Fix | Delete
$this->siteinfo = $siteinfo;
[13] Fix | Delete
$this->bvapi = new BVWPAPI($settings);
[14] Fix | Delete
$this->bvinfo = new BVInfo($this->settings);
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
public function mainUrl($_params = '') {
[18] Fix | Delete
if (function_exists('network_admin_url')) {
[19] Fix | Delete
return network_admin_url('admin.php?page='.$this->bvinfo->plugname.$_params);
[20] Fix | Delete
} else {
[21] Fix | Delete
return admin_url('admin.php?page='.$this->bvinfo->plugname.$_params);
[22] Fix | Delete
}
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
function removeAdminNotices() {
[26] Fix | Delete
if (array_key_exists('page', $_REQUEST) && $_REQUEST['page'] == $this->bvinfo->plugname) {
[27] Fix | Delete
remove_all_actions('admin_notices');
[28] Fix | Delete
remove_all_actions('all_admin_notices');
[29] Fix | Delete
}
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
public function initHandler() {
[33] Fix | Delete
if (!current_user_can('activate_plugins'))
[34] Fix | Delete
return;
[35] Fix | Delete
[36] Fix | Delete
if (array_key_exists('bvnonce', $_REQUEST) &&
[37] Fix | Delete
wp_verify_nonce($_REQUEST['bvnonce'], "bvnonce") &&
[38] Fix | Delete
array_key_exists('blogvaultkey', $_REQUEST) &&
[39] Fix | Delete
(strlen(BVAccount::sanitizeKey($_REQUEST['blogvaultkey'])) == 64) &&
[40] Fix | Delete
(array_key_exists('page', $_REQUEST) &&
[41] Fix | Delete
$_REQUEST['page'] == $this->bvinfo->plugname)) {
[42] Fix | Delete
$keys = str_split($_REQUEST['blogvaultkey'], 32);
[43] Fix | Delete
BVAccount::addAccount($this->settings, $keys[0], $keys[1]);
[44] Fix | Delete
if (array_key_exists('redirect', $_REQUEST)) {
[45] Fix | Delete
$location = $_REQUEST['redirect'];
[46] Fix | Delete
wp_redirect($this->bvinfo->appUrl()."/dash/redir?q=".urlencode($location));
[47] Fix | Delete
exit();
[48] Fix | Delete
}
[49] Fix | Delete
}
[50] Fix | Delete
if ($this->bvinfo->isActivateRedirectSet()) {
[51] Fix | Delete
$this->settings->updateOption($this->bvinfo->plug_redirect, 'no');
[52] Fix | Delete
##ACTIVATEREDIRECTCODE##
[53] Fix | Delete
if (!wp_doing_ajax()) {
[54] Fix | Delete
wp_redirect($this->mainUrl());
[55] Fix | Delete
}
[56] Fix | Delete
}
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
public function bvsecAdminMenu($hook) {
[60] Fix | Delete
if ($hook === 'toplevel_page_bvbackup' || BVHelper::safePregMatch("/bv_add_account$/", $hook) ||
[61] Fix | Delete
BVHelper::safePregMatch("/bv_account_details$/", $hook)) {
[62] Fix | Delete
wp_enqueue_style( 'bootstrap', plugins_url('css/bootstrap.min.css', __FILE__));
[63] Fix | Delete
wp_enqueue_style( 'bvplugin', plugins_url('css/bvplugin.min.css', __FILE__));
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
public function menu() {
[68] Fix | Delete
$brand = $this->bvinfo->getPluginWhitelabelInfo();
[69] Fix | Delete
if (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand)) {
[70] Fix | Delete
$bname = $this->bvinfo->getBrandName();
[71] Fix | Delete
$icon = $this->bvinfo->getBrandIcon();
[72] Fix | Delete
add_menu_page($bname, $bname, 'manage_options', $this->bvinfo->plugname,
[73] Fix | Delete
array($this, 'adminPage'), plugins_url($icon, __FILE__));
[74] Fix | Delete
}
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
public function hidePluginUpdate($plugins) {
[78] Fix | Delete
if (!$this->bvinfo->canWhiteLabel()) {
[79] Fix | Delete
return $plugins;
[80] Fix | Delete
}
[81] Fix | Delete
$whitelabel_infos = $this->bvinfo->getPluginsWhitelabelInfos();
[82] Fix | Delete
foreach ($whitelabel_infos as $slug => $brand) {
[83] Fix | Delete
if ($this->bvinfo->canWhiteLabel($slug) && isset($plugins->response[$slug]) && is_array($brand)) {
[84] Fix | Delete
if (array_key_exists('hide_from_menu', $brand) || array_key_exists('hide', $brand)) {
[85] Fix | Delete
unset($plugins->response[$slug]);
[86] Fix | Delete
}
[87] Fix | Delete
}
[88] Fix | Delete
}
[89] Fix | Delete
return $plugins;
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
public function hidePluginDetails($plugin_metas, $slug) {
[93] Fix | Delete
if (!is_array($plugin_metas) || !$this->bvinfo->canWhiteLabel($slug)) {
[94] Fix | Delete
return $plugin_metas;
[95] Fix | Delete
}
[96] Fix | Delete
$whitelabel_info = $this->bvinfo->getPluginWhitelabelInfo($slug);
[97] Fix | Delete
if (array_key_exists('hide_plugin_details', $whitelabel_info)) {
[98] Fix | Delete
foreach ($plugin_metas as $pluginKey => $pluginValue) {
[99] Fix | Delete
if (strpos($pluginValue, sprintf('>%s<', translate('View details')))) {
[100] Fix | Delete
unset($plugin_metas[$pluginKey]);
[101] Fix | Delete
break;
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
}
[105] Fix | Delete
return $plugin_metas;
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
public function handlePluginHealthInfo($plugins) {
[109] Fix | Delete
if (!isset($plugins["wp-plugins-active"]) ||
[110] Fix | Delete
!isset($plugins["wp-plugins-active"]["fields"]) || !$this->bvinfo->canWhiteLabel()) {
[111] Fix | Delete
return $plugins;
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
$whitelabel_infos_by_title = $this->bvinfo->getPluginsWhitelabelInfoByTitle();
[115] Fix | Delete
[116] Fix | Delete
foreach ($whitelabel_infos_by_title as $title => $brand) {
[117] Fix | Delete
if (is_array($brand) && array_key_exists('slug', $brand) && $this->bvinfo->canWhiteLabel($brand["slug"])) {
[118] Fix | Delete
if (array_key_exists('hide', $brand)) {
[119] Fix | Delete
unset($plugins["wp-plugins-active"]["fields"][$title]);
[120] Fix | Delete
} else {
[121] Fix | Delete
$plugin = $plugins["wp-plugins-active"]["fields"][$title];
[122] Fix | Delete
$author = $brand['default_author'];
[123] Fix | Delete
if (array_key_exists('name', $brand)) {
[124] Fix | Delete
$plugin["label"] = $brand['name'];
[125] Fix | Delete
}
[126] Fix | Delete
if (array_key_exists('author', $brand)) {
[127] Fix | Delete
$plugin["value"] = str_replace($author, $brand['author'], $plugin["value"]);
[128] Fix | Delete
}
[129] Fix | Delete
if (array_key_exists('description', $brand)) {
[130] Fix | Delete
$plugin["debug"] = str_replace($author, $brand['author'], $plugin["debug"]);
[131] Fix | Delete
}
[132] Fix | Delete
$plugins["wp-plugins-active"]["fields"][$title] = $plugin;
[133] Fix | Delete
}
[134] Fix | Delete
}
[135] Fix | Delete
}
[136] Fix | Delete
return $plugins;
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
public function settingsLink($links, $file) {
[140] Fix | Delete
#XNOTE: Fix this
[141] Fix | Delete
if ( $file == plugin_basename( dirname(__FILE__).'/blogvault.php' ) ) {
[142] Fix | Delete
$brand = $this->bvinfo->getPluginWhitelabelInfo();
[143] Fix | Delete
if (!array_key_exists('hide_plugin_details', $brand)) {
[144] Fix | Delete
$links[] = '<a href="' . $this->mainUrl() . '">' . __( 'Settings' ) . '</a>';
[145] Fix | Delete
}
[146] Fix | Delete
}
[147] Fix | Delete
return $links;
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
public function getPluginLogo() {
[151] Fix | Delete
$brand = $this->bvinfo->getPluginWhitelabelInfo();
[152] Fix | Delete
if (array_key_exists('logo', $brand)) {
[153] Fix | Delete
return $brand['logo'];
[154] Fix | Delete
}
[155] Fix | Delete
return $this->bvinfo->logo;
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
public function getWebPage() {
[159] Fix | Delete
$brand = $this->bvinfo->getPluginWhitelabelInfo();
[160] Fix | Delete
if (array_key_exists('webpage', $brand)) {
[161] Fix | Delete
return $brand['webpage'];
[162] Fix | Delete
}
[163] Fix | Delete
return $this->bvinfo->webpage;
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
public function siteInfoTags() {
[167] Fix | Delete
require_once dirname( __FILE__ ) . '/recover.php';
[168] Fix | Delete
$bvnonce = wp_create_nonce("bvnonce");
[169] Fix | Delete
$public = BVAccount::getApiPublicKey($this->settings);
[170] Fix | Delete
$secret = BVRecover::defaultSecret($this->settings);
[171] Fix | Delete
$tags = "<input type='hidden' name='url' value='".esc_attr($this->siteinfo->wpurl())."'/>\n".
[172] Fix | Delete
"<input type='hidden' name='homeurl' value='".esc_attr($this->siteinfo->homeurl())."'/>\n".
[173] Fix | Delete
"<input type='hidden' name='siteurl' value='".esc_attr($this->siteinfo->siteurl())."'/>\n".
[174] Fix | Delete
"<input type='hidden' name='dbsig' value='".esc_attr($this->siteinfo->dbsig(false))."'/>\n".
[175] Fix | Delete
"<input type='hidden' name='plug' value='".esc_attr($this->bvinfo->plugname)."'/>\n".
[176] Fix | Delete
"<input type='hidden' name='adminurl' value='".esc_attr($this->mainUrl())."'/>\n".
[177] Fix | Delete
"<input type='hidden' name='bvversion' value='".esc_attr($this->bvinfo->version)."'/>\n".
[178] Fix | Delete
"<input type='hidden' name='serverip' value='".esc_attr($_SERVER["SERVER_ADDR"])."'/>\n".
[179] Fix | Delete
"<input type='hidden' name='abspath' value='".esc_attr(ABSPATH)."'/>\n".
[180] Fix | Delete
"<input type='hidden' name='secret' value='".esc_attr($secret)."'/>\n".
[181] Fix | Delete
"<input type='hidden' name='public' value='".esc_attr($public)."'/>\n".
[182] Fix | Delete
"<input type='hidden' name='bvnonce' value='".esc_attr($bvnonce)."'/>\n";
[183] Fix | Delete
return $tags;
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
public function activateWarning() {
[187] Fix | Delete
global $hook_suffix;
[188] Fix | Delete
if (!BVAccount::isConfigured($this->settings) && $hook_suffix == 'index.php' ) {
[189] Fix | Delete
?>
[190] Fix | Delete
<div id="message" class="updated" style="padding: 8px; font-size: 16px; background-color: #dff0d8">
[191] Fix | Delete
<a class="button-primary" href="<?php echo esc_url($this->mainUrl()); ?>">Activate BlogVault</a>
[192] Fix | Delete
&nbsp;&nbsp;&nbsp;<b>Almost Done:</b> Activate your BlogVault account to backup & secure your site.
[193] Fix | Delete
</div>
[194] Fix | Delete
<?php
[195] Fix | Delete
}
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
public function showAddAccountPage() {
[199] Fix | Delete
require_once dirname( __FILE__ ) . "/admin/add_new_account.php";
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
public function showAccountDetailsPage() {
[203] Fix | Delete
require_once dirname( __FILE__ ) . "/admin/account_details.php";
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
public function adminPage() {
[207] Fix | Delete
if (isset($_REQUEST['bvnonce']) && wp_verify_nonce( $_REQUEST['bvnonce'], 'bvnonce' )) {
[208] Fix | Delete
$info = array();
[209] Fix | Delete
$this->siteinfo->basic($info);
[210] Fix | Delete
$this->bvapi->pingbv('/bvapi/disconnect', $info, BVAccount::sanitizeKey($_REQUEST['pubkey']));
[211] Fix | Delete
BVAccount::remove($this->settings, BVAccount::sanitizeKey($_REQUEST['pubkey']));
[212] Fix | Delete
}
[213] Fix | Delete
if (BVAccount::isConfigured($this->settings)) {
[214] Fix | Delete
if (isset($_REQUEST['add_account'])) {
[215] Fix | Delete
$this->showAddAccountPage();
[216] Fix | Delete
} else {
[217] Fix | Delete
$this->showAccountDetailsPage();
[218] Fix | Delete
}
[219] Fix | Delete
} else {
[220] Fix | Delete
$this->showAddAccountPage();
[221] Fix | Delete
}
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
public function initWhitelabel($plugins) {
[225] Fix | Delete
if (!is_array($plugins) || !$this->bvinfo->canWhiteLabel()) {
[226] Fix | Delete
return $plugins;
[227] Fix | Delete
}
[228] Fix | Delete
$whitelabel_infos = $this->bvinfo->getPluginsWhitelabelInfos();
[229] Fix | Delete
foreach ($whitelabel_infos as $slug => $brand) {
[230] Fix | Delete
if (!isset($slug) || !$this->bvinfo->canWhiteLabel($slug) || !array_key_exists($slug, $plugins) || !is_array($brand)) {
[231] Fix | Delete
continue;
[232] Fix | Delete
}
[233] Fix | Delete
if (array_key_exists('hide', $brand)) {
[234] Fix | Delete
unset($plugins[$slug]);
[235] Fix | Delete
} else {
[236] Fix | Delete
if (array_key_exists('name', $brand)) {
[237] Fix | Delete
$plugins[$slug]['Name'] = $brand['name'];
[238] Fix | Delete
}
[239] Fix | Delete
if (array_key_exists('title', $brand)) {
[240] Fix | Delete
$plugins[$slug]['Title'] = $brand['title'];
[241] Fix | Delete
}
[242] Fix | Delete
if (array_key_exists('description', $brand)) {
[243] Fix | Delete
$plugins[$slug]['Description'] = $brand['description'];
[244] Fix | Delete
}
[245] Fix | Delete
if (array_key_exists('authoruri', $brand)) {
[246] Fix | Delete
$plugins[$slug]['AuthorURI'] = $brand['authoruri'];
[247] Fix | Delete
}
[248] Fix | Delete
if (array_key_exists('author', $brand)) {
[249] Fix | Delete
$plugins[$slug]['Author'] = $brand['author'];
[250] Fix | Delete
}
[251] Fix | Delete
if (array_key_exists('authorname', $brand)) {
[252] Fix | Delete
$plugins[$slug]['AuthorName'] = $brand['authorname'];
[253] Fix | Delete
}
[254] Fix | Delete
if (array_key_exists('pluginuri', $brand)) {
[255] Fix | Delete
$plugins[$slug]['PluginURI'] = $brand['pluginuri'];
[256] Fix | Delete
}
[257] Fix | Delete
}
[258] Fix | Delete
}
[259] Fix | Delete
return $plugins;
[260] Fix | Delete
}
[261] Fix | Delete
}
[262] Fix | Delete
endif;
[263] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function