Zend Guard API

With the Zend Guard API, you can complete the following tasks:

  • Check if Zend Zend Guard Loader is enabled to handle encoded files.

  • Check if a valid license exists and gather information from a valid license.

  • Get the running files path at runtime. 

The following API describes how the Zend Guard determines if encoding is enabled:

Name

zend_loader_enabled

Synopsis

Checks the Zend Guard Loader's configuration to verify that it is configured to load encoded files.

Note:

Zend Guard Loader setting can be configured in the php.ini file. Enable Zend Guard Loader line syntax: zend_optimizer.enable_loader = on|off.
By default, this is set to On. Therefore, you do not have to make any changes for the Zend Guard Loader to run encoded scripts.

Syntax

zend_loader_enabled()

Results

Returns Boolean

TRUE The Zend Guard Loader is configured to load encoded files.

FALSE The Zend Guard Loader is not configured to load encoded files.

 

Name

zend_get_id

Synopsis

Returns array of the host ids. If all_ids is true, then all IDs are returned, otherwise only IDs considered "primary" are returned.

Syntax

array zend_get_id([bool all_ids = false])

 

The following API describes how the Zend Guard checks if a valid license exists:

Name

zend_loader_file_licensed

Synopsis

Compares the signature of the running file against the signatures of the License files loaded by the php.ini file into the License Registry. If a valid license file exists, the values of the license file are read into an array.

If a valid license does not exist or is not specified in the php.ini, it will not be entered in the PHP server's license registry.

If a valid license, matching in product and signature cannot be found in the license directory, an array is not created.

For information on the proper installation of a license file as well as the php.ini directive, see Limiting the Number of Concurrent Users: Proper Use of Cookies

When the "Require Cookies" option is NOT selected, any page can be loaded, once, from any number of browsers concurrently even when the number of concurrent users is limited (even to a single user).

This happens because, the first time that the page is accessed no cookie is present. The second time that the page is accessed, a cookie *is* present (even though not required). The server then limits access.

In addition, if the "Require Cookies" option is NOT selected, AND the browser is set to not receive cookies, any page can be loaded, any number of times, from any number of browsers.

This happens because no cookie is present at any time. The server has no way to know that the page has been accessed.

In order to effectively limit the number of concurrent users, you must require cookies.

Syntax

$lic_info = zend_loader_file_licensed().

Results

Returns an array or FALSE array.

If an array is returned, a valid license exists in the location indicated in the php.ini file and for the product. The array has an element for each line of the license file. This includes the license generation settings and any additional user information added to the license.

Example from a license file:

Product-Name = My Product

The array index names are the line content from the left side of the equations (Product-Name) within the license file text.

The array values are the text content to the right or the equation
(My Product.

FALSE

"False" means that no valid license was found. This can mean that no license exists in the license directory or that the license file exists and has become invalid or corrupted.

 

Name

zend_loader_install_license

Synopsis

Dynamically loads a license for applications encoded with Zend Guard. The Override controls if it will override old licenses for the same product.

Syntax

boolean zend_loader_install_license(string license_file[, bool override])

 

The following APIs describe how Zend Guard checks for obfuscation:

Name

zend_loader_current_file

Synopsis

Obtains the full path of the currently running file at run-time, in other words, the path of the file calling this API function.

Does not evaluate the running files path during encoding, but evaluates only at run-time.

Syntax

zend_loader_current_file()

Results

Returns a string containing the full path of the currently running file.

 

Name

Zend_obfuscate_function_name

Synopsis

Obfuscate and return the given function name with the internal obfuscation function.

Syntax

string obfuscate_function_name(string function_name)

Results

Returns the obfuscated form of the given string.

 

Name

Zend_obfuscate_class_name

Synopsis

Obfuscate and return the given class name with the internal obfuscation function.

Syntax

string obfuscate_class_name(string class_name)

Results

Returns the obfuscated form of the given string.

 

Name

zend_loader_file_encoded

Syntax

boolean zend_loader_file_encoded()

Results

Returns true if the current file is a Zend-encoded file.

 

Name

zend_current_obfuscation_level

Syntax

int zend_current_obfuscation_level()

Results

returns the current obfuscation level support (set by zend_optimizer.obfuscation_level_support)

 

Name

zend_runtime_obfuscate

Syntax

bool zend_runtime_obfuscate()

Results

Start runtime-obfuscation support that allows limited mixing of obfuscated and un-obfuscated code.