/home/techb158/public_html/wp-content/plugins/wpforms-lite/src/Admin/Education
Edit: /home/techb158/public_html/wp-content/plugins/wpforms-lite/src/Admin/Education/AddonsItemBase.php (3561B)
allow_load() ) {
return;
}
// Store the instance of the Education core class.
$this->education = wpforms()->obj( 'education' );
// Store the instance of the Education\Addons class.
$this->addons = wpforms()->obj( 'addons' );
// Define hooks.
$this->hooks();
}
/**
* Hooks.
*
* @since 1.6.6
*/
abstract public function hooks();
/**
* Display single addon item.
*
* @since 1.6.6
*
* @param array $addon Addon data.
*
* @noinspection ReturnTypeCanBeDeclaredInspection
* @noinspection PhpMissingParamTypeInspection
*/
protected function display_single_addon( $addon ) {
/**
* Filter to disallow addons to be displayed in the Education feature.
*
* @since 1.8.2
*
* @param bool $display Whether to hide the addon.
* @param array $slug Addon data.
*/
$is_disallowed = (bool) apply_filters( 'wpforms_admin_education_addons_item_base_display_single_addon_hide', false, $addon );
if ( empty( $addon ) || $is_disallowed ) {
return;
}
echo wpforms_render( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$this->single_addon_template,
$addon,
true
);
}
/**
* Prepare field data-attributes for the education actions.
* E.g., install, activate, incompatible.
*
* @since 1.9.4
*
* @param array $addon Current addon information.
*
* @return array
*/
protected function prepare_field_action_data( array $addon ): array {
if ( empty( $addon['plugin_allow'] ) ) {
return [];
}
if ( $addon['action'] === 'install' ) {
return [
'data' => [
'action' => 'install',
'name' => $addon['modal_name'],
'url' => $addon['url'],
'nonce' => wp_create_nonce( 'wpforms-admin' ),
'license' => $addon['license_level'],
],
'class' => 'education-modal',
];
}
if ( $addon['action'] === 'activate' ) {
return [
'data' => [
'action' => 'activate',
'name' => sprintf( /* translators: %s - addon name. */
esc_html__( '%s addon', 'wpforms-lite' ),
$addon['name']
),
'path' => $addon['path'],
'nonce' => wp_create_nonce( 'wpforms-admin' ),
],
'class' => 'education-modal',
];
}
if ( $addon['action'] === 'incompatible' ) {
return [
'data' => [
'action' => 'incompatible',
'message' => Requirements::get_instance()->get_notice( $addon['path'] ),
],
'class' => 'education-modal',
];
}
return [];
}
}