/home/techb158/public_html/wp-content/plugins/meta-box/src/Updater
Edit: /home/techb158/public_html/wp-content/plugins/meta-box/src/Updater/Notification.php (5649B)
checker = $checker;
$this->option = $option;
$this->settings_page = $option->is_network_activated() ? network_admin_url( 'settings.php?page=meta-box-updater' ) : admin_url( 'admin.php?page=meta-box-updater' );
}
/**
* Add hooks to show admin notice.
*/
public function init() {
if ( ! $this->checker->has_extensions() ) {
return;
}
// Show update message on Plugins page.
$extensions = $this->checker->get_extensions();
foreach ( $extensions as $extension ) {
$file = "{$extension}/{$extension}.php";
add_action( "in_plugin_update_message-$file", [ $this, 'show_update_message' ], 10, 2 );
add_filter( "plugin_action_links_$file", [ $this, 'plugin_links' ], 20 );
}
$admin_notices_hook = $this->option->is_network_activated() ? 'network_admin_notices' : 'admin_notices';
add_action( $admin_notices_hook, [ $this, 'notify' ] );
}
public function notify() {
$excluded_screens = [
'meta-box_page_meta-box-updater',
'settings_page_meta-box-updater-network',
'meta-box_page_meta-box-aio',
];
$screen = get_current_screen();
if ( in_array( $screen->id, $excluded_screens, true ) ) {
return;
}
$messages = [
// Translators: %1$s - URL to the settings page, %2$s - URL to the pricing page.
'no_key' => __( 'You have not entered a Meta Box license key. Please
enter your license key or
purchase a license to enable premium features.', 'meta-box' ),
// Translators: %1$s - URL to the settings page, %2$s - URL to the pricing page.
'invalid' => __( 'Your license key for Meta Box is
invalid. Please
update your license key or
get a new one to enable automatic updates.', 'meta-box' ),
// Translators: %1$s - URL to the settings page, %2$s - URL to the pricing page.
'error' => __( 'Your license key for Meta Box is
invalid. Please
update your license key or
get a new one to enable automatic updates.', 'meta-box' ),
// Translators: %3$s - URL to the My Account page.
'expired' => __( 'Your license key for Meta Box is
expired. Please
renew your license to get automatic updates and premium support.', 'meta-box' ),
// Translators: %2$s - URL to the pricing page.
'refunded' => __( 'Your Meta Box license has been
refunded. To continue using Meta Box premium features and receive updates, please
purchase a new license. Otherwise, premium features will be disabled.', 'meta-box' ),
];
$status = $this->option->get_license_status();
if ( ! isset( $messages[ $status ] ) ) {
return;
}
echo '
', wp_kses_post( sprintf( $messages[ $status ], $this->settings_page, 'https://elu.to/mnp', 'https://elu.to/mna' ) ), '
';
}
/**
* Show update message on Plugins page.
*
* @param array $plugin_data Plugin data.
* @param object $response Available plugin update data.
*/
public function show_update_message( $plugin_data, $response ) {
// Users have an active license.
if ( ! empty( $response->package ) ) {
return;
}
$messages = [
// Translators: %1$s - URL to the settings page, %2$s - URL to the pricing page.
'no_key' => __( 'Please
enter your license key or
get a new one here.', 'meta-box' ),
// Translators: %1$s - URL to the settings page, %2$s - URL to the pricing page.
'invalid' => __( 'Your license key is
invalid. Please
update your license key or
get a new one here.', 'meta-box' ),
// Translators: %1$s - URL to the settings page, %2$s - URL to the pricing page.
'error' => __( 'Your license key is
invalid. Please
update your license key or
get a new one here.', 'meta-box' ),
// Translators: %3$s - URL to the My Account page.
'expired' => __( 'Your license key is
expired. Please
renew your license.', 'meta-box' ),
// Translators: %2$s - URL to the pricing page.
'refunded' => __( 'Your license has been
refunded. Please
purchase a new license to enable premium features.', 'meta-box' ),
];
$status = $this->option->get_license_status();
if ( ! isset( $messages[ $status ] ) ) {
return;
}
echo '
' . wp_kses_post( sprintf( $messages[ $status ], $this->settings_page, 'https://elu.to/mnp', 'https://elu.to/mna' ) );
}
public function plugin_links( array $links ): array {
$status = $this->option->get_license_status();
if ( 'active' === $status ) {
return $links;
}
$text = 'no_key' === $status ? __( 'Activate License', 'meta-box' ) : __( 'Update License', 'meta-box' );
$links[] = '
' . esc_html( $text ) . '';
return $links;
}
}