\NimrodLogger

NimrodLogger class.

Minimal working code example:

require 'class.nimrod.logger.php';
// Inside your translation function just use:
NimrodLogger::logGettext( $translated_text, $text, $domain );

Summary

Methods
Properties
Constants
getStrId()
getUid()
getTargetFile()
resetFiles()
addResourceComments()
logGettext()
logGettextWithContext()
save()
$abspath
No constants found
doHash()
allocateUid()
getLogPath()
getUserDir()
getPotFile()
commonResources()
fmtElemType()
fmtXpathType()
getReference()
fmtReference()
getLogHeader()
removeBasepath()
$strId
$messages
$comments
N/A
No private methods found
No private properties found
N/A

Properties

$abspath

$abspath : 

Optional. The absolute path is used to remove (unwanted?) directory names that are previous to the current base directory; e.g. `/var/www/site/cms/path/file.php` becomes `cms/path/file.php`.

Type

$strId

$strId : 

Read-only. Assign a unique number to each localizable string.

Type

$messages

$messages : 

Database for regular entries.

Type

$comments

$comments : 

Database for Nimrod comments.

Type

Methods

getStrId()

getStrId(string  $text, string  $context, string  $domain) : string

Getter of strId property.

Parameters

string $text

The gettext msgid.

string $context

The gettext context.

string $domain

The gettext domain.

Returns

string

getUid()

getUid() : string

Retrieve user ID.

Returns

string

getTargetFile()

getTargetFile() : array

Retrieve the file currently shown in the browser.

Returns

array

resetFiles()

resetFiles() 

Truncates all user files.

addResourceComments()

addResourceComments(array  $res) 

Creates useful comments for each gettext entry.

Parameters

array $res

Resource string collection.

logGettext()

logGettext(string  $translated_text, string  $text, string  $domain) 

Log gettext message.

Parameters

string $translated_text

The translated message.

string $text

The gettext msgid.

string $domain

The gettext domain.

logGettextWithContext()

logGettextWithContext(string  $translated_text, string  $text, string  $context, string  $domain) 

Log gettext message with context.

Parameters

string $translated_text

The translated message.

string $text

The gettext msgid.

string $context

The gettext msgctxt.

string $domain

The gettext domain.

save()

save() 

Save log.

doHash()

doHash(string  $text, string  $context, string  $domain) : string

Hashing method according to text, context, and domain.

Parameters

string $text

The gettext msgid.

string $context

The gettext context.

string $domain

The gettext domain.

Returns

string

allocateUid()

allocateUid() : string

Assign a user ID, ensuring that Nimrod has write permissions on the logs directory.

Throws

\Exception

if the logs directory is not writable.

Returns

string

getLogPath()

getLogPath() : string

Retrieve log dir path.

Returns

string

getUserDir()

getUserDir() : string

Retrieve user dir path.

Returns

string

getPotFile()

getPotFile(string  $domain) : string

Retrieve POT file path according to the gettext domain.

Parameters

string $domain

The gettext domain.

Returns

string

commonResources()

commonResources(array  $res) : array

Retrieve gettext resources.

Parameters

array $res

Resource string collection.

Returns

array

fmtElemType()

fmtElemType(string  $type, string  $prop) : string

Format element.

Parameters

string $type

Element type (tag name).

string $prop

Element property (attribute).

Returns

string

fmtXpathType()

fmtXpathType(string  $type, string  $xpath) : string

Format xpath.

Parameters

string $type

Element type (tag name).

string $xpath

Element's XPath representation.

Returns

string

getReference()

getReference() : array

Retrieves file and line number where each message is referenced.

Returns

array

fmtReference()

fmtReference() : string

Format message reference.

Returns

string

getLogHeader()

getLogHeader() : string

Retrieves log header.

Returns

string

removeBasepath()

removeBasepath(\strin  $filepath) : string

Removes base path of file, preserving only the relative dir.

Parameters

\strin $filepath

The input file path.

Returns

string