Astra_Target_Rules_Fields::admin_styles()

Function Name: admin_styles.


Description

Function Description: admin_styles.


Source

File: classes/modules/target-rule/class-astra-target-rules-fields.php

		public function admin_styles() {

			wp_enqueue_script( 'astra-select2', ASTRA_EXT_URI . 'classes/modules/target-rule/select2.js', array( 'jquery' ), ASTRA_EXT_VER, true );

			$wp_lang  = get_locale();
			$ast_lang = '';
			if ( '' !== $wp_lang ) {

				$select2_lang = array(
					''               => 'en',
					'hi_IN'          => 'hi',
					'mr'             => 'mr',
					'af'             => 'af',
					'ar'             => 'ar',
					'ary'            => 'ar',
					'as'             => 'as',
					'azb'            => 'az',
					'az'             => 'az',
					'bel'            => 'be',
					'bg_BG'          => 'bg',
					'bn_BD'          => 'bn',
					'bo'             => 'bo',
					'bs_BA'          => 'bs',
					'ca'             => 'ca',
					'ceb'            => 'ceb',
					'cs_CZ'          => 'cs',
					'cy'             => 'cy',
					'da_DK'          => 'da',
					'de_CH'          => 'de',
					'de_DE'          => 'de',
					'de_DE_formal'   => 'de',
					'de_CH_informal' => 'de',
					'dzo'            => 'dz',
					'el'             => 'el',
					'en_CA'          => 'en',
					'en_GB'          => 'en',
					'en_AU'          => 'en',
					'en_NZ'          => 'en',
					'en_ZA'          => 'en',
					'eo'             => 'eo',
					'es_MX'          => 'es',
					'es_VE'          => 'es',
					'es_CR'          => 'es',
					'es_CO'          => 'es',
					'es_GT'          => 'es',
					'es_ES'          => 'es',
					'es_CL'          => 'es',
					'es_PE'          => 'es',
					'es_AR'          => 'es',
					'et'             => 'et',
					'eu'             => 'eu',
					'fa_IR'          => 'fa',
					'fi'             => 'fi',
					'fr_BE'          => 'fr',
					'fr_FR'          => 'fr',
					'fr_CA'          => 'fr',
					'gd'             => 'gd',
					'gl_ES'          => 'gl',
					'gu'             => 'gu',
					'haz'            => 'haz',
					'he_IL'          => 'he',
					'hr'             => 'hr',
					'hu_HU'          => 'hu',
					'hy'             => 'hy',
					'id_ID'          => 'id',
					'is_IS'          => 'is',
					'it_IT'          => 'it',
					'ja'             => 'ja',
					'jv_ID'          => 'jv',
					'ka_GE'          => 'ka',
					'kab'            => 'kab',
					'km'             => 'km',
					'ko_KR'          => 'ko',
					'ckb'            => 'ku',
					'lo'             => 'lo',
					'lt_LT'          => 'lt',
					'lv'             => 'lv',
					'mk_MK'          => 'mk',
					'ml_IN'          => 'ml',
					'mn'             => 'mn',
					'ms_MY'          => 'ms',
					'my_MM'          => 'my',
					'nb_NO'          => 'nb',
					'ne_NP'          => 'ne',
					'nl_NL'          => 'nl',
					'nl_NL_formal'   => 'nl',
					'nl_BE'          => 'nl',
					'nn_NO'          => 'nn',
					'oci'            => 'oc',
					'pa_IN'          => 'pa',
					'pl_PL'          => 'pl',
					'ps'             => 'ps',
					'pt_BR'          => 'pt',
					'pt_PT_ao90'     => 'pt',
					'pt_PT'          => 'pt',
					'rhg'            => 'rhg',
					'ro_RO'          => 'ro',
					'ru_RU'          => 'ru',
					'sah'            => 'sah',
					'si_LK'          => 'si',
					'sk_SK'          => 'sk',
					'sl_SI'          => 'sl',
					'sq'             => 'sq',
					'sr_RS'          => 'sr',
					'sv_SE'          => 'sv',
					'szl'            => 'szl',
					'ta_IN'          => 'ta',
					'te'             => 'te',
					'th'             => 'th',
					'tl'             => 'tl',
					'tr_TR'          => 'tr',
					'tt_RU'          => 'tt',
					'tah'            => 'ty',
					'ug_CN'          => 'ug',
					'uk'             => 'uk',
					'ur'             => 'ur',
					'uz_UZ'          => 'uz',
					'vi'             => 'vi',
					'zh_CN'          => 'zh',
					'zh_TW'          => 'zh',
					'zh_HK'          => 'zh',
				);

				if ( isset( $select2_lang[ $wp_lang ] ) && file_exists( ASTRA_EXT_DIR . 'classes/modules/target-rule/i18n/' . $select2_lang[ $wp_lang ] . '.js' ) ) {

					$ast_lang = $select2_lang[ $wp_lang ];
					wp_enqueue_script(
						'astra-select2-lang',
						ASTRA_EXT_URI . 'classes/modules/target-rule/i18n/' . $select2_lang[ $wp_lang ] . '.js',
						array(
							'jquery',
							'astra-select2',
						),
						ASTRA_EXT_VER,
						true
					);
				}
			}

			wp_enqueue_script(
				'astra-target-rule',
				ASTRA_EXT_URI . 'classes/modules/target-rule/target-rule.js',
				array(
					'jquery',
					'astra-select2',
				),
				ASTRA_EXT_VER,
				true
			);
			wp_enqueue_script(
				'astra-user-role',
				ASTRA_EXT_URI . 'classes/modules/target-rule/user-role.js',
				array(
					'jquery',
				),
				ASTRA_EXT_VER,
				true
			);
			wp_enqueue_style( 'astra-select2', ASTRA_EXT_URI . 'classes/modules/target-rule/select2.css', '', ASTRA_EXT_VER );
			wp_enqueue_style( 'astra-target-rule', ASTRA_EXT_URI . 'classes/modules/target-rule/target-rule.css', '', ASTRA_EXT_VER );

			/**
			 * Registered localize vars
			 */
			$localize_vars = array(
				'ast_lang'      => $ast_lang,
				'please_enter'  => __( 'Please enter', 'astra-addon' ),
				'please_delete' => __( 'Please delete', 'astra-addon' ),
				'more_char'     => __( 'or more characters', 'astra-addon' ),
				'character'     => __( 'character', 'astra-addon' ),
				'loading'       => __( 'Loading more results…', 'astra-addon' ),
				'only_select'   => __( 'You can only select', 'astra-addon' ),
				'item'          => __( 'item', 'astra-addon' ),
				'char_s'        => __( 's', 'astra-addon' ),
				'no_result'     => __( 'No results found', 'astra-addon' ),
				'searching'     => __( 'Searching…', 'astra-addon' ),
				'not_loader'    => __( 'The results could not be loaded.', 'astra-addon' ),
				'search'        => __( 'Search pages / post / categories', 'astra-addon' ),
				'ajax_nonce'    => wp_create_nonce( 'astra-addon-get-posts-by-query' ),
			);
			wp_localize_script( 'astra-select2', 'astRules', $localize_vars );
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.