403Webshell
Server IP : 162.0.217.223  /  Your IP : 216.73.216.153
Web Server : LiteSpeed
System : Linux premium269.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : mypckeys ( 1539)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/mypckeys/yeslicense.org/wp-content/plugins/supportcandy/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mypckeys/yeslicense.org/wp-content/plugins/supportcandy/includes/class-wpsc-translations.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly!
}

if ( ! class_exists( 'WPSC_Translations' ) ) :

	final class WPSC_Translations {

		/**
		 * Init class
		 */
		public static function init() {
			add_action( 'admin_init', array( __CLASS__, 'register_strings' ) );
		}

		/**
		 * Register custom strings for translation
		 */
		public static function register_strings() {

			$strings = get_option( 'wpsc-string-translation', array() );

			// latest compatible.
			if ( defined( 'WPML_PLUGIN_PATH' ) ) {
				foreach ( $strings as $name => $str ) {
					do_action( 'wpml_register_single_string', 'SupportCandy', $name, $str );
				}
				return;
			}

			// depricated but being used by other rival plugins like polylang, translatepress, etc.
			if ( function_exists( 'icl_register_string' ) ) {
				foreach ( $strings as $name => $str ) {
					icl_register_string( 'SupportCandy', $name, $str );
				}
				return;
			}
		}

		/**
		 * Get translated string
		 *
		 * @param mixed $name - String index given earlier while adding it to translation.
		 * @param mixed $str - String to be translated.
		 * @return mixed
		 */
		public static function get( $name, $str ) {

			// latest compatible.
			if ( defined( 'WPML_PLUGIN_PATH' ) ) {
				return apply_filters( 'wpml_translate_single_string', $str, 'SupportCandy', $name, ICL_LANGUAGE_CODE );
			}

			if ( function_exists( 'icl_t' ) ) {
				return icl_t( 'SupportCandy', $name );
			}

			return $str;
		}

		/**
		 * Adds a string to translation
		 *
		 * @param mixed $name - Unique index for string.
		 * @param mixed $str - String to be translated.
		 * @return void
		 */
		public static function add( $name, $str ) {

			if ( ! $str ) {
				return;
			}

			$strings = get_option( 'wpsc-string-translation', array() );
			if ( isset( $strings[ $name ] ) ) {
				self::remove( $name );
			}

			$strings[ $name ] = $str;
			update_option( 'wpsc-string-translation', $strings );

			// register strings.
			self::register_strings();
		}

		/**
		 * Remove string from translation
		 *
		 * @param string $name - translation string name.
		 * @return void
		 */
		public static function remove( $name ) {

			if ( function_exists( 'icl_unregister_string' ) ) {
				icl_unregister_string( 'SupportCandy', $name );
			}

			$strings = get_option( 'wpsc-string-translation', array() );
			if ( isset( $strings[ $name ] ) ) {
				unset( $strings[ $name ] );
				update_option( 'wpsc-string-translation', $strings );
			}
		}
	}
endif;

WPSC_Translations::init();

Youez - 2016 - github.com/yon3zu
LinuXploit