Overview

Namespaces

  • Varunsridharan
    • WordPress

Classes

  • Localizer
  • Overview
  • Namespace
  • Class

Class Localizer

Class Localizer

Namespace: Varunsridharan\WordPress
Package: Varunsridharan\WordPress
Author: Varun Sridharan varunsridharan23@gmail.com
Since: 1.0
Located at src/Localizer.php
Methods summary
public
# __construct( array $args = array() )

Localizer constructor.

Localizer constructor.

Parameters

$args
public static boolean|mixed|Varunsridharan\WordPress\Localizer|Varunsridharan\WordPress\Localizer
# instance( array|string $args = array() )

Returns A New Instance.

Returns A New Instance.

Parameters

$args

Returns

boolean|mixed|Varunsridharan\WordPress\Localizer|Varunsridharan\WordPress\Localizer
$this|\Varunsridharan\WordPress\Localizer
public
# backend_hook( )

Back End Hook.

Back End Hook.

public
# frontend_hook( )

Frontend Hook.

Frontend Hook.

public Varunsridharan\WordPress\Localizer|Varunsridharan\WordPress\Localizer
# add( string $object_id = '', array $args = array(), boolean $merge = true, boolean $convert_js_funcion = true )

Adds a given object to array based on the ID.

Adds a given object to array based on the ID.

Parameters

$object_id
$args
$merge
$convert_js_funcion

Returns

Varunsridharan\WordPress\Localizer|Varunsridharan\WordPress\Localizer
$this
protected mixed
# handle_js_function( $args )

Converts Javascript Function into array.

Converts Javascript Function into array.

Parameters

$args

Returns

mixed
public
# text( string $key = '', string $value = '' )

Custom Text which will be used in JS.

Custom Text which will be used in JS.

Parameters

$key
$value

Returns


$this
public mixed
# render_js_args( )

Returns

mixed
protected boolean
# localize_script( string $handle = '' )

Uses WP-Script-API To Localize script.

Uses WP-Script-API To Localize script.

Parameters

$handle

Returns

boolean
public static string
# php_to_js( $object_name, $l10n )

Parameters

$object_name
$l10n

Returns

string
public static array|string
# js_args_encode( $l10n )

Encodes PHP Array in JSString.

Encodes PHP Array in JSString.

Parameters

$l10n

Returns

array|string
protected
# print_js_data( )

Outputs Raw HTML of js info.

Outputs Raw HTML of js info.

Properties summary
protected static array $instances

Stores All Instance.

Stores All Instance.

# array()
protected null $slug
# null
protected boolean $script_tocheck
# false
protected array $js_args

js_args

js_args

# array()
protected array $translations

translations

translations

# array()
API documentation generated by ApiGen