Class WPGlobus_Utils
Class WPGlobus_Utils
Methods summary
public static
string
|
#
localize_url( string $url = '', string $language = '',
Localize URL by inserting language prefix |
public static
string
|
#
extract_language_from_url( string $url = '',
Extract language from URL http://example.com/ru/page/ returns 'ru' |
public static
boolean
|
#
is_function_in_backtrace( string $function_name )
Check if was called by a specific function (could be any levels deep). Note: does not check if the function is in a class method. |
public static
string
|
#
domain_tld( string $url )
Strip the prefix from the host name http://www.example.com becomes example.com |
public static
string
|
#
build_multilingual_string( string[] $translations )
Convert array of local texts to multilingual string (with WPGlobus delimiters) |
public static
|
#
current_url( )
Returns the current URL. There is no method of getting the current URL in WordPress. Various snippets published on the Web use a combination of home_url and add_query_arg. However, none of them work when WordPress is installed in a subfolder. The method below looks valid. There is a theoretical chance of HTTP_HOST tampered, etc. However, the same line of code is used by the WordPress core, for example in @see wp_admin_canonical_url, so we are going to use it, too * Note that #hash is always lost because it's a client-side parameter. We might add it using a JavaScript call. |
public static
string[]
|
|
public static
string
|
|
public static
string
|
#
url_wpglobus_site(
Localize www.wpglobus.com for use in outgoing links |
public static
boolean
|
|
public static
string
|
|
public static
boolean
|
|
public static
boolean
|