Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../central/modules
File: plugin.php
// Loops around each plugin available.
[500] Fix | Delete
foreach ($get_plugins as $key => $value) {
[501] Fix | Delete
$slug = basename($key, '.php');
[502] Fix | Delete
[503] Fix | Delete
// If the plugin name matches that of the specified name, it will gather details.
[504] Fix | Delete
// In case name check isn't enough, we'll use slug to verify if the plugin being queried is actually installed.
[505] Fix | Delete
//
[506] Fix | Delete
// Reason for name check failure:
[507] Fix | Delete
// Due to plugin name inconsistencies - where wordpress.org registered plugin name is different
[508] Fix | Delete
// from the actual plugin files's metadata (found inside the plugin's PHP file itself).
[509] Fix | Delete
if ((!empty($query['plugin']) && $value['Name'] === $query['plugin']) || (!empty($query['slug']) && $slug === $query['slug'])) {
[510] Fix | Delete
$info['installed'] = true;
[511] Fix | Delete
$info['active'] = is_plugin_active($key);
[512] Fix | Delete
$info['plugin_path'] = $key;
[513] Fix | Delete
$info['data'] = $value;
[514] Fix | Delete
break;
[515] Fix | Delete
}
[516] Fix | Delete
}
[517] Fix | Delete
[518] Fix | Delete
return $info;
[519] Fix | Delete
}
[520] Fix | Delete
[521] Fix | Delete
/**
[522] Fix | Delete
* Loads all available plugins with additional attributes and settings needed by UpdraftCentral
[523] Fix | Delete
*
[524] Fix | Delete
* @param array $query Parameter array Any available parameters needed for this action
[525] Fix | Delete
* @return array Contains the result of the current process
[526] Fix | Delete
*/
[527] Fix | Delete
public function load_plugins($query) {
[528] Fix | Delete
[529] Fix | Delete
$error = $this->_validate_fields_and_capabilities($query, array(), array('install_plugins', 'activate_plugins'));
[530] Fix | Delete
if (!empty($error)) {
[531] Fix | Delete
return $error;
[532] Fix | Delete
}
[533] Fix | Delete
[534] Fix | Delete
$website = get_bloginfo('name');
[535] Fix | Delete
$results = array();
[536] Fix | Delete
[537] Fix | Delete
// Load the updates command class if not existed
[538] Fix | Delete
if (!class_exists('UpdraftCentral_Updates_Commands')) include_once('updates.php');
[539] Fix | Delete
$updates = new UpdraftCentral_Updates_Commands($this->rc);
[540] Fix | Delete
[541] Fix | Delete
// Get plugins for update
[542] Fix | Delete
$plugin_updates = $updates->get_item_updates('plugins');
[543] Fix | Delete
[544] Fix | Delete
// Get all plugins
[545] Fix | Delete
$plugins = get_plugins();
[546] Fix | Delete
[547] Fix | Delete
foreach ($plugins as $key => $value) {
[548] Fix | Delete
$slug = basename($key, '.php');
[549] Fix | Delete
[550] Fix | Delete
$plugin = new stdClass();
[551] Fix | Delete
$plugin->name = $value['Name'];
[552] Fix | Delete
$plugin->description = $value['Description'];
[553] Fix | Delete
$plugin->slug = $slug;
[554] Fix | Delete
$plugin->version = $value['Version'];
[555] Fix | Delete
$plugin->author = $value['Author'];
[556] Fix | Delete
$plugin->status = is_plugin_active($key) ? 'active' : 'inactive';
[557] Fix | Delete
$plugin->website = $website;
[558] Fix | Delete
$plugin->multisite = is_multisite();
[559] Fix | Delete
$plugin->site_url = trailingslashit(get_bloginfo('url'));
[560] Fix | Delete
[561] Fix | Delete
if (!empty($plugin_updates[$key])) {
[562] Fix | Delete
$update_info = $plugin_updates[$key];
[563] Fix | Delete
[564] Fix | Delete
if (version_compare($update_info->Version, $update_info->update->new_version, '<')) {
[565] Fix | Delete
if (!empty($update_info->update->new_version)) $plugin->latest_version = $update_info->update->new_version;
[566] Fix | Delete
if (!empty($update_info->update->package)) $plugin->download_link = $update_info->update->package;
[567] Fix | Delete
if (!empty($update_info->update->sections)) $plugin->sections = $update_info->update->sections;
[568] Fix | Delete
}
[569] Fix | Delete
}
[570] Fix | Delete
[571] Fix | Delete
if (empty($plugin->short_description) && !empty($plugin->description)) {
[572] Fix | Delete
// Only pull the first sentence as short description, it should be enough rather than displaying
[573] Fix | Delete
// an empty description or a full blown one which the user can access anytime if they press on
[574] Fix | Delete
// the view details link in UpdraftCentral.
[575] Fix | Delete
$temp = explode('.', $plugin->description);
[576] Fix | Delete
$short_description = $temp[0];
[577] Fix | Delete
[578] Fix | Delete
// Adding the second sentence wouldn't hurt, in case the first sentence is too short.
[579] Fix | Delete
if (isset($temp[1])) $short_description .= '.'.$temp[1];
[580] Fix | Delete
[581] Fix | Delete
$plugin->short_description = $short_description.'.';
[582] Fix | Delete
}
[583] Fix | Delete
[584] Fix | Delete
$results[] = $plugin;
[585] Fix | Delete
}
[586] Fix | Delete
[587] Fix | Delete
$result = array(
[588] Fix | Delete
'plugins' => $results
[589] Fix | Delete
);
[590] Fix | Delete
[591] Fix | Delete
$result = array_merge($result, $this->_get_backup_credentials_settings(WP_PLUGIN_DIR));
[592] Fix | Delete
return $this->_response($result);
[593] Fix | Delete
}
[594] Fix | Delete
[595] Fix | Delete
/**
[596] Fix | Delete
* Gets the backup and security credentials settings for this website
[597] Fix | Delete
*
[598] Fix | Delete
* @param array $query Parameter array Any available parameters needed for this action
[599] Fix | Delete
* @return array Contains the result of the current process
[600] Fix | Delete
*/
[601] Fix | Delete
public function get_plugin_requirements() {
[602] Fix | Delete
return $this->_response($this->_get_backup_credentials_settings(WP_PLUGIN_DIR));
[603] Fix | Delete
}
[604] Fix | Delete
}
[605] Fix | Delete
[606] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function