This article shows the differences of functionality of LoxBerry's Perl modules and LoxBerry's PHP modules. It is mainly meant as a quick reference for module developers.

The functions and variables are developed as similar as possible, but differences of the call syntax is unavoidable. Because the PHP modules are new, Perl legacy code was avoided in the PHP code. 

LoxBerry::System vs. loxberry_system.php

Provides basic functions to query and set information from users settings at LoxBerry, e.g. the plugins and the Miniservers.

FunctionDescriptionPerl LoxBerry::SystemPHP loxberry_system.phpMore information
Plugin Global VariablesGlobal Variables for the path to Plugin directories

PHP: Globals and Constants
System Global VariablesGlobal Variables for the system directories

get_miniserversReads the Miniserver list from general.cfg

get_miniserver_by_ipGet Miniserver number by IP address

get_miniserver_by_nameGet Miniserver number by it's name

get_binariesGet a hash of all system binaries

pluginversionReturn Plugin version of plugin database

pluginloglevelReturns the loglevel of the plugin

plugindataReturns plugin data for a specific plugin

get_pluginsReturns an array of all plugins

lbversionReturns LoxBerry system version

systemloglevelReturns the LoxBerry system loglevel

get_ftpportReturns the FTP port of Miniserver (incl. Cloud DNS)

get_localipReturns the current IP address as string

lblanguageReturns LoxBerrys language from GET, POST or system setting

readlanguageCollects the translations and returns a hash/array

lbhostnameReturns current LoxBerry hostname

lbfriendlynameReturns the user set friendlyname

lbwebserverportReturns the Apache2 port of LoxBerry

is_enabledReturns 1/True for fuzzy enabled strings

is_disabledReturns 0/True for fuzzy disabled strings

trimTrims blanks

PHP: System function
ltrimTrims left blanks

PHP: System function
rtrimTrims right blanks

PHP: System function
begins_withReturns true if one string begins with a other string

PHP: if(strpos($str, "http://") === 0)
currtimeReturns the current time in different formats

check_securepinChecks the submitted securepin against the database

reboot_requredSets the reboot required state with optional text.

diskspaceinfoReturns diskspace infos for a specific path or all volumes

lock / unlockLocks and unlocks a file to prevent multiple execution

bytes_humanreadableCreates a human-readable string from a filesize

read_fileReads a full file in one pass

Usable for pluginsFeatures are supported to be used in Plugins

Usable for system widgetsSystem widgets are LoxBerrys own configuration "plugins", shown on the Settings page.

LoxBerry::Web vs. loxberry_web.php

Functions to generate the user interface, and add pre-rendered html code to simplify ui generation.

FunctionDescriptionPerl LoxBerry::WebPHP loxberry_web.phpMore information
$lbpluginpage, $lbsystempageGlobal vars to LoxBerry's index page

This should be used if your plugin links back to LoxBerry's Plugin overview
lbheaderPrints the header template including help

lbfooterPrints the footer template

headPrints the template <head> including <body> start tag

pagestartPrints the jQuery Mobile page start template including help

pageendPrints the jQuery Mobile page end template

footPrints the template foot

get_plugin_iconReturns the URI of the plugin icon in specified size

iso_languagesReturns all or only translated ISO 639-1 languages

PHP: As this feature is primary for LoxBerry-Core, no PHP feature is planned
Navigation Bar (Perl)Prints navigation on top of the page

logfile_button_htmlReturns the full html code to display a dynamic logfile button

loglist_urlReturns the link to a list of logfiles of a plugin

loglist_button_htmlReturns the full html code to display a button to the logfile list

mslist_select_htmlReturns html for a Miniserver selection dropdown

loglevel_select_htmlReturns html for a loglevel selection dropdown

loglist_htmlReturns html showing a list of logfiles

Usable for pluginsFunctions can be used in plugins

Usable for system widgetsSystem widgets are LoxBerrys own configuration "plugins", shown on the Settings page.

System help files currently not supported (untested).



LoxBerry::Storage vs. loxberry_storage.php

Functions for storage devices like usb and network shares.

FunctionDescriptionPerl LoxBerry::StoragePHP loxberry_storage.phpMore information
get_netsharesReturns an array of all reachable Network Shares

Could be used to create a <select>-list with available network shares.
get_netserversReturns an array of all reachable Network Servers (which offers shares)

get_usbstoragesReturns an array of all conneted USB Storage devices

 Could be used to create a <select>-list with available usb storage devices.
get_storageReturns an array of all storage devices (combined USB and Shares)

get_storage_htmlReturns a ready html+js for a storage selection dropdown (e.g. to provide users to select a location)

LoxBerry::Log vs. loxberry_log.php

Library to create and show logfiles, and handles notifications. 

FunctionDescriptionPerl LoxBerry::LogPHP loxberry_log.phpMore information
Logging class (methods to a log object)
newConstructor for a new logging session

LOGSTART / LOGENDStarting and finishing the logging session

loglevelQueries and sets the loglevel

autoraiseOn a LOGCRIT log entry, auto-raises the loglevel to 6

filehandleLEGACY for LB <1.2.5 

filenameReturns the current filename

dbkeyReturns the current database key

addtimeAdds the current time to every logline

logtitleChanges the title of the log during logging

defaultOn multiple opened logs, set one log to the default logfile

Logfile handling functions
get_logsReturns an array with all logs, with filters by parameter

Notification functions
notifyCreates an info or error notification

notify_extCreates a notification with extended parameters

get_notificationsReturns an array with all notifications, selected by parameters

get_notification_countReturns the number of notifications, selected by parameters

delete_notificationsDeletes all notifications, selected by parameters

delete_notification_keyDeletes a specific notification by key

get_notifications_htmlReturns ready html+js for a list of notifications

LoxBerry::IO vs. loxberry_io.php

Functions to easily communicate to the Miniserver

FunctionDescriptionPerl LoxBerry::IOPHP loxberry_io.phpMore information
mshttp_sendSends values to Miniserver's HTTP REST API

mshttp_send_memSends values to Miniserver's HTTP REST API, using caching

mshttp_getReads values from Miniservers HTTP REST API

mshttp_callRaw function to send or read data via HTTP REST API

msudp_sendSends values via UDP to the Miniserver

msudp_send_memSends values via UDP to the Miniserver, using caching

LoxBerry::JSON (PHP not available)

Class to simplify working with json (config) files

FunctionDescriptionPerl LoxBerry::JSONPHP not availableMore information
newConstructor for a json object

parseParse an already available json string

openOpens and parses a json file

writeSaves a changed file to disk, using change detection

filenameQueries the current filename, or sets a new filename

findFind a string in an object in the json (array or named list)

dumpDumps the content of the json to stderr