balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

mu-plugins.php (1961B)


      1 <?php
      2 namespace Elementor\Modules\System_Info\Reporters;
      3 
      4 if ( ! defined( 'ABSPATH' ) ) {
      5 	exit; // Exit if accessed directly.
      6 }
      7 
      8 /**
      9  * Elementor must-use plugins report.
     10  *
     11  * Elementor system report handler class responsible for generating a report for
     12  * must-use plugins.
     13  *
     14  * @since 1.0.0
     15  */
     16 class MU_Plugins extends Base {
     17 
     18 	/**
     19 	 * Must-Use plugins.
     20 	 *
     21 	 * Holds the sites must-use plugins list.
     22 	 *
     23 	 * @since 1.0.0
     24 	 * @access private
     25 	 *
     26 	 * @var array
     27 	 */
     28 	private $plugins;
     29 
     30 	/**
     31 	 * Get must-use plugins.
     32 	 *
     33 	 * Retrieve the must-use plugins.
     34 	 *
     35 	 * @since 2.0.0
     36 	 * @access private
     37 	 *
     38 	 * @return array Must-Use plugins.
     39 	 */
     40 	private function get_mu_plugins() {
     41 		if ( ! $this->plugins ) {
     42 			$this->plugins = get_mu_plugins();
     43 		}
     44 
     45 		return $this->plugins;
     46 	}
     47 
     48 	/**
     49 	 * Is enabled.
     50 	 *
     51 	 * Whether there are must-use plugins or not.
     52 	 *
     53 	 * @since 1.0.0
     54 	 * @access public
     55 	 *
     56 	 * @return bool True if the site has must-use plugins, False otherwise.
     57 	 */
     58 	public function is_enabled() {
     59 		return ! ! $this->get_mu_plugins();
     60 	}
     61 
     62 	/**
     63 	 * Get must-use plugins reporter title.
     64 	 *
     65 	 * Retrieve must-use plugins reporter title.
     66 	 *
     67 	 * @since 1.0.0
     68 	 * @access public
     69 	 *
     70 	 * @return string Reporter title.
     71 	 */
     72 	public function get_title() {
     73 		return 'Must-Use Plugins';
     74 	}
     75 
     76 	/**
     77 	 * Get must-use plugins report fields.
     78 	 *
     79 	 * Retrieve the required fields for the must-use plugins report.
     80 	 *
     81 	 * @since 1.0.0
     82 	 * @access public
     83 	 *
     84 	 * @return array Required report fields with field ID and field label.
     85 	 */
     86 	public function get_fields() {
     87 		return [
     88 			'must_use_plugins' => 'Must-Use Plugins',
     89 		];
     90 	}
     91 
     92 	/**
     93 	 * Get must-use plugins.
     94 	 *
     95 	 * Retrieve the sites must-use plugins.
     96 	 *
     97 	 * @since 1.0.0
     98 	 * @access public
     99 	 *
    100 	 * @return array {
    101 	 *    Report data.
    102 	 *
    103 	 *    @type string $value The must-use plugins list.
    104 	 * }
    105 	 */
    106 	public function get_must_use_plugins() {
    107 		return [
    108 			'value' => $this->get_mu_plugins(),
    109 		];
    110 	}
    111 }