format_code_lang

Definition:
function format_code_lang( $code = '' ) {}

Parameters

  • $code

Defined filters

  • lang_codes
    apply_filters( 'lang_codes', $lang_codes, $code )

Source code

function format_code_lang( $code = '' ) {

	$code = strtolower( substr( $code, 0, 2 ) );

	$lang_codes = array(

		'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali',

		'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree',

		'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic',

		'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue',

		'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz',

		'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam',

		'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',

		'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian',

		'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',

		'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',

		've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );

	$lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );

	return strtr( $code, $lang_codes );

}

1090

force_ssl_content

Definition:
function force_ssl_content( $force = '' ) {}

Whether to force SSL on content.

Parameters

  • string|bool $force

Return values

returns:True if forced, false if not forced.

Source code

function force_ssl_content( $force = '' ) {

	static $forced_content;



	if ( '' != $force ) {

		$old_forced = $forced_content;

		$forced_content = $force;

		return $old_forced;

	}



	return $forced_content;

}

1086

force_ssl_admin

Definition:
function force_ssl_admin( $force = null ) {}

Whether to force SSL used for the Administration Screens.

Parameters

  • string|bool $force

Return values

returns:True if forced, false if not forced.

Source code

function force_ssl_admin( $force = null ) {

	static $forced = false;



	if ( !is_null( $force ) ) {

		$old_forced = $forced;

		$forced = $force;

		return $old_forced;

	}



	return $forced;

}

1084

force_balance_tags

Definition:
function force_balance_tags( $text ) {}

Balances tags of string using a modified stack.

Parameters

  • string $text: Text to be balanced.

Return values

returns:Balanced text.

Source code

function force_balance_tags( $text ) {

	$tagstack = array();

	$stacksize = 0;

	$tagqueue = '';

	$newtext = '';

	$single_tags = array( 'br', 'hr', 'img', 'input' ); // Known single-entity/self-closing tags

	$nestable_tags = array( 'blockquote', 'div', 'span', 'q' ); // Tags that can be immediately nested within themselves



	// WP bug fix for comments - in case you REALLY meant to type '< !--'

	$text = str_replace('< !--', '<    !--', $text);

	// WP bug fix for LOVE ❤ (and other situations with '<' before a number)

	$text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);



	while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {

		$newtext .= $tagqueue;



		$i = strpos($text, $regex[0]);

		$l = strlen($regex[0]);



		// clear the shifter

		$tagqueue = '';

		// Pop or Push

		if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag

			$tag = strtolower(substr($regex[1],1));

			// if too many closing tags

			if( $stacksize <= 0 ) {

				$tag = '';

				// or close to be safe $tag = '/' . $tag;

			}

			// if stacktop value = tag close value then pop

			else if ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag

				$tag = '</' . $tag . '>'; // Close Tag

				// Pop

				array_pop( $tagstack );

				$stacksize--;

			} else { // closing tag not at top, search for it

				for ( $j = $stacksize-1; $j >= 0; $j-- ) {

					if ( $tagstack[$j] == $tag ) {

					// add tag to tagqueue

						for ( $k = $stacksize-1; $k >= $j; $k--) {

							$tagqueue .= '</' . array_pop( $tagstack ) . '>';

							$stacksize--;

						}

						break;

					}

				}

				$tag = '';

			}

		} else { // Begin Tag

			$tag = strtolower($regex[1]);



			// Tag Cleaning



			// If self-closing or '', don't do anything.

			if ( substr($regex[2],-1) == '/' || $tag == '' ) {

				// do nothing

			}

			// ElseIf it's a known single-entity tag but it doesn't close itself, do so

			elseif ( in_array($tag, $single_tags) ) {

				$regex[2] .= '/';

			} else {	// Push the tag onto the stack

				// If the top of the stack is the same as the tag we want to push, close previous tag

				if ( $stacksize > 0 && !in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag ) {

					$tagqueue = '</' . array_pop ($tagstack) . '>';

					$stacksize--;

				}

				$stacksize = array_push ($tagstack, $tag);

			}



			// Attributes

			$attributes = $regex[2];

			if( !empty($attributes) )

				$attributes = ' '.$attributes;



			$tag = '<' . $tag . $attributes . '>';

			//If already queuing a close tag, then put this tag on, too

			if ( !empty($tagqueue) ) {

				$tagqueue .= $tag;

				$tag = '';

			}

		}

		$newtext .= substr($text, 0, $i) . $tag;

		$text = substr($text, $i + $l);

	}



	// Clear Tag Queue

	$newtext .= $tagqueue;



	// Add Remaining text

	$newtext .= $text;



	// Empty Stack

	while( $x = array_pop($tagstack) )

		$newtext .= '</' . $x . '>'; // Add remaining tags to close



	// WP fix for the bug with HTML comments

	$newtext = str_replace("< !--","<!--",$newtext);

	$newtext = str_replace("<    !--","< !--",$newtext);



	return $newtext;

}

1082