Tribe__Admin__Notice__Plugin_Download::show_inactive_plugins_alert()

Echoes the admin notice, attach to admin_notices

See also


Top ↑

Source

File: src/Tribe/Admin/Notice/Plugin_Download.php

	public function show_inactive_plugins_alert() {
		if ( ! current_user_can( 'activate_plugins' ) ) {
			return;
		}

		$plugin_data = get_plugin_data( $this->plugin_path );
		$req_plugins = array();

		if ( empty( $this->plugins_required ) ) {
			return;
		}

		foreach ( $this->plugins_required as $req_plugin ) {
			$item    = $req_plugin['name'];
			$version = empty( $req_plugin['version'] ) ? '' : ' (' . str_replace( '-dev', '', $req_plugin['version'] ) . ')';

			if ( ! empty( $req_plugin['thickbox_url'] ) ) {
				$item = sprintf(
					'<a href="%1$s" class="thickbox" title="%2$s">%3$s%4$s</a>',
					esc_attr( $req_plugin['thickbox_url'] ),
					esc_attr( $req_plugin['name'] ),
					esc_html( $item ),
					esc_html( $version )
				);
			}

			if ( false === $req_plugin['is_active'] ) {
				$item = sprintf(
					'<strong class="tribe-inactive-plugin">%1$s</strong>',
					$item
				);
			}

			if ( ! empty( $req_plugin['addon'] ) ) {
				$plugin_name[] = $req_plugin['name'];
			}

			$req_plugins[] = $item;
		}

		// If empty then add in the default name.
		if ( empty( $plugin_name[0] ) ) {
			$plugin_name[] = $plugin_data['Name'];
		}

		$allowed_html = array(
			'strong' => array(),
			'a'      => array( 'href' => array() ),
		);

		printf(
			'<div class="error tribe-notice tribe-dependency-error" data-plugin="%1$s"><p>'
			. esc_html__( 'To begin using %2$s, please install and activate the latest version of %3$s.', 'tribe-common' )
			. '</p></div>',
			esc_attr( sanitize_title( $plugin_data['Name'] ) ),
			wp_kses( $this->implode_with_grammar( $plugin_name ), $allowed_html ),
			wp_kses( $this->implode_with_grammar( $req_plugins ), $allowed_html )
		);
	}

Top ↑

Changelog

Changelog
Version Description
4.9.17 Introduced.