acf_pro_get_translated_connect_message()ACF 6.2.3

Get translated upstream message

Хуков нет.

Возвращает

Строку. a translated (or original, if unavailable), message string.

Использование

acf_pro_get_translated_connect_message( $text );
$text(строка) (обязательный)
Server side message string.

Список изменений

С версии 6.2.3 Введена.

Код acf_pro_get_translated_connect_message() ACF 6.4.2

function acf_pro_get_translated_connect_message( $text ) {

	if ( strpos( $text, 'key activated' ) !== false ) {
		return __( 'Your license key has been activated successfully. Access to updates, support & PRO features is now enabled.', 'acf' );
	} elseif ( strpos( $text, 'key deactivated' ) !== false ) {
		return __( 'Your license key has been deactivated.', 'acf' );
	} elseif ( strpos( $text, 'key not found' ) !== false ) {
		$text = __( 'License key not found. Make sure you have copied your license key exactly as it appears in your receipt or your account.', 'acf' );

		$text .= sprintf(
			' <a href="%1$s" target="_blank">%2$s</a>',
			acf_add_url_utm_tags(
				'https://www.advancedcustomfields.com/my-account/view-licenses/',
				'activation error',
				'license key not found'
			),
			__( 'View your licenses', 'acf' )
		);

		return $text;
	} elseif ( strpos( $text, 'key unavailable' ) !== false ) {
		$text = __( 'Your license key has expired and cannot be activated.', 'acf' );

		$text .= sprintf(
			' <a href="%1$s" target="_blank">%2$s</a>',
			acf_add_url_utm_tags(
				'https://www.advancedcustomfields.com/my-account/subscriptions/',
				'activation error',
				'license key expired'
			),
			__( 'View your subscriptions', 'acf' )
		);

		return $text;
	} elseif ( strpos( $text, 'Activation limit reached' ) !== false ) {
		$text = __( 'You have reached the activation limit for the license.', 'acf' );

		$view_license = sprintf(
			'<a href="%1$s" target="_blank">%2$s</a>',
			acf_add_url_utm_tags(
				'https://www.advancedcustomfields.com/my-account/view-licenses/',
				'activation error',
				'license limit exceeded'
			),
			__( 'View your licenses', 'acf' )
		);

		// Check again on the updates page if shown, or the field group page if not.
		$nonce    = wp_create_nonce( 'acf_retry_activation' );
		$base_url = 'edit.php?post_type=acf-field-group';
		if ( acf_pro_is_updates_page_visible() ) {
			$base_url .= '&page=acf-settings-updates';
		}

		$check_again = sprintf(
			'<a href="%1$s">%2$s</a>',
			admin_url( $base_url . '&acf_retry_nonce=' . $nonce ),
			__( 'check again', 'acf' )
		);

		/* translators: %1$s - link to view licenses, %2$s - link to try activating license again */
		$text .= ' ' . sprintf( __( '%1$s or %2$s.', 'acf' ), $view_license, $check_again );

		return $text;
	} elseif ( strpos( $text, 'upstream API error' ) !== false ) {
		return __( 'An upstream API error occurred when checking your ACF PRO license status. We will retry again shortly.', 'acf' );
	} elseif ( strpos( $text, 'scheduled maintenance' ) !== false ) {
		return __( 'The ACF activation service is temporarily unavailable for scheduled maintenance. Please try again later.', 'acf' );
	} elseif ( strpos( $text, 'Something went wrong' ) !== false ) {
		return __( 'The ACF activation service is temporarily unavailable. Please try again later.', 'acf' );
	}

	/* translators: %s an untranslatable internal upstream error message */
	return sprintf( __( 'An unknown error occurred while trying to communicate with the ACF activation service: %s.', 'acf' ), $text );
}