install($package, $args); } /** * @param string $plugin * @param string $redirect * @param bool $networkWide * @param bool $silent * @return WP_Error|null */ public function activatePlugin($plugin, $redirect = '', $networkWide = false, $silent = false) { return activate_plugin($plugin, $redirect, $networkWide, $silent); } public function wpGetAttachmentImageSrcset(int $attachmentId, $size = 'medium', $imageMeta = null) { return wp_get_attachment_image_srcset($attachmentId, $size, $imageMeta); } public function getResultsFromWpDb($query, ...$args) { global $wpdb; return $wpdb->get_results($wpdb->prepare($query, $args)); } /** * @return string|null Prefixed table name */ public function getWPTableName(string $table) { global $wpdb; if (property_exists($wpdb, $table)) { return $wpdb->$table; } return null; } /** * @param string $host * @return array|bool */ public function parseDbHost($host) { global $wpdb; return $wpdb->parse_db_host($host); } /** * @param int|\WP_Post $post * @param string $context * @return string|null */ public function getEditPostLink($post, string $context = 'display') { return get_edit_post_link($post, $context); } /** * @param string $string * @param array[]|string $allowedHtml * @param array $allowedProtocols * @return string */ public function wpKses(string $string, $allowedHtml, $allowedProtocols = []) { return wp_kses($string, $allowedHtml, $allowedProtocols); } }