HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/plugins/wpml-string-translation/classes/AutoRegisterStringsNotice.php
<?php

namespace WPML\ST;

use WPML\ST\Gettext\AutoRegisterSettings;
use WPML_WP_API;
use function WPML\Container\make;

class AutoRegisterStringsNotice {

	public static function init() {
		$wp_api = new WPML_WP_API();
		if ( current_user_can( 'manage_options' ) && $wp_api->is_string_translation_page() ) {
			$autoRegisterDisabled = make( AutoRegisterSettings::class )->getIsTypeDisabled();
			$notices              = wpml_get_admin_notices();
			$noticeId             = 'AutoRegisterStringsNotice';

			if ( $autoRegisterDisabled ) {
				// If Auto Register Strings is disabled, create or update a notice.
				$stPath = $wp_api->constant( 'WPML_ST_FOLDER' ) . '/menu/string-translation';

				// Check if we are on Admin Texts Translation page (query string trop=1 is present), Display the absolute link.
				$linkHref   = ! empty( $_GET['trop'] )
					? admin_url( 'admin.php?page=' . $stPath . '.php#dashboard_wpml_st_autoregister' )
					: '#dashboard_wpml_st_autoregister';
				$linkText   = '<a href="' . $linkHref . '" id="wpml_open_autoregistration_setting">' . __( 'Click here to enable it', 'wpml-string-translation' ) . '</a>';
				$noticeText = __( 'String auto registration is disabled. ', 'wpml-string-translation' );
				$notice     = $notices->get_new_notice(
					$noticeId, $noticeText . $linkText
				)->set_css_class_types( 'warning' );
				$notice->set_dismissible( true );
				$notice->set_restrict_to_screen_ids( [ $stPath ] );
				$notices->add_notice( $notice );
			} elseif ( ! $autoRegisterDisabled && ! is_null( $notices->get_notice( $noticeId ) ) ) {
				// If Auto Register Strings is enabled but notice exist, remove it.
				$notices->remove_notice( $notices::DEFAULT_GROUP, $noticeId );
			}
		}
	}

}