Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/elemento.../core
File: wp-api.php
<?php
[0] Fix | Delete
namespace Elementor\Core;
[1] Fix | Delete
[2] Fix | Delete
use Elementor\Core\Utils\Collection;
[3] Fix | Delete
[4] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[5] Fix | Delete
exit; // Exit if accessed directly.
[6] Fix | Delete
}
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* This class is responsible for the interaction with WordPress Core API.
[10] Fix | Delete
* The main benefit is making it easy to mock in testing
[11] Fix | Delete
* and it can help to create unit tests without the hustle of mocking WordPress itself.
[12] Fix | Delete
*/
[13] Fix | Delete
class Wp_Api {
[14] Fix | Delete
/**
[15] Fix | Delete
* @var Collection
[16] Fix | Delete
*/
[17] Fix | Delete
private $plugins;
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* @return Collection
[21] Fix | Delete
*/
[22] Fix | Delete
public function get_plugins() {
[23] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[24] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
if ( ! $this->plugins ) {
[28] Fix | Delete
$this->plugins = new Collection( get_plugins() );
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
return $this->plugins;
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
/**
[35] Fix | Delete
* @return Collection
[36] Fix | Delete
*/
[37] Fix | Delete
public function get_active_plugins() {
[38] Fix | Delete
return $this->get_plugins()
[39] Fix | Delete
->only( get_option( 'active_plugins' ) );
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* @return object|array
[44] Fix | Delete
*/
[45] Fix | Delete
public function plugins_api( $action, $args ) {
[46] Fix | Delete
return plugins_api( $action, $args );
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* @return bool
[51] Fix | Delete
*/
[52] Fix | Delete
public function is_plugin_active( $plugin ) {
[53] Fix | Delete
return is_plugin_active( $plugin );
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
/**
[57] Fix | Delete
* @return bool|int|null|true
[58] Fix | Delete
*/
[59] Fix | Delete
public function activate_plugin( $plugin ) {
[60] Fix | Delete
return activate_plugin( $plugin );
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
public function wp_attachment_is_image( $post = null ) {
[64] Fix | Delete
return wp_attachment_is_image( $post );
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function