Module Comparison Perl vs. PHP

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.

Function Description Perl LoxBerry::System PHP loxberry_system.php More information
Plugin Global Variables Global Variables for the path to Plugin directories AVAILABLE AVAILABLE PHP: Globals and Constants
System Global Variables Global Variables for the system directories AVAILABLE AVAILABLE
get_miniservers Reads the Miniserver list from general.cfg AVAILABLE AVAILABLE
get_miniserver_by_ip Get Miniserver number by IP address AVAILABLE AVAILABLE
get_miniserver_by_name Get Miniserver number by it's name AVAILABLE AVAILABLE
get_binaries Get a hash of all system binaries AVAILABLE AVAILABLE
pluginversion Return Plugin version of plugin database AVAILABLE AVAILABLE
pluginloglevel Returns the loglevel of the plugin AVAILABLE
plugindata Returns plugin data for a specific plugin AVAILABLE AVAILABLE
get_plugins Returns an array of all plugins AVAILABLE AVAILABLE
lbversion Returns LoxBerry system version AVAILABLE AVAILABLE
systemloglevel Returns the LoxBerry system loglevel AVAILABLE
get_ftpport Returns the FTP port of Miniserver (incl. Cloud DNS) AVAILABLE AVAILABLE
get_localip Returns the current IP address as string AVAILABLE AVAILABLE
lblanguage Returns LoxBerrys language from GET, POST or system setting AVAILABLE AVAILABLE
readlanguage Collects the translations and returns a hash/array AVAILABLE AVAILABLE
lbhostname Returns current LoxBerry hostname AVAILABLE AVAILABLE
lbfriendlyname Returns the user set friendlyname AVAILABLE AVAILABLE
lbwebserverport Returns the Apache2 port of LoxBerry AVAILABLE AVAILABLE
is_enabled Returns 1/True for fuzzy enabled strings AVAILABLE AVAILABLE
is_disabled Returns 0/True for fuzzy disabled strings AVAILABLE AVAILABLE
trim Trims blanks AVAILABLE AVAILABLE PHP: System function
ltrim Trims left blanks AVAILABLE AVAILABLE PHP: System function
rtrim Trims right blanks AVAILABLE AVAILABLE PHP: System function
begins_with Returns true if one string begins with a other string AVAILABLE AVAILABLE PHP: if(strpos($str, "http://") === 0)
currtime Returns the current time in different formats AVAILABLE AVAILABLE
check_securepin Checks the submitted securepin against the database AVAILABLE N/A
reboot_requred Sets the reboot required state with optional text. AVAILABLE AVAILABLE
diskspaceinfo Returns diskspace infos for a specific path or all volumes AVAILABLE N/A
lock / unlock Locks and unlocks a file to prevent multiple execution AVAILABLE
bytes_humanreadable Creates a human-readable string from a filesize AVAILABLE
read_file Reads a full file in one pass AVAILABLE
Usable for plugins Features are supported to be used in Plugins FULL FULL
Usable for system widgetsSystem widgets are LoxBerrys own configuration "plugins", shown on the Settings page. FULL FULL

LoxBerry::Web vs. loxberry_web.php

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

Function Description Perl LoxBerry::Web PHP loxberry_web.php More information
$lbpluginpage, $lbsystempage Global vars to LoxBerry's index page AVAILABLE AVAILABLE This should be used if your plugin links back to LoxBerry's Plugin overview
lbheader Prints the header template including help AVAILABLE AVAILABLE
lbfooter Prints the footer template AVAILABLE AVAILABLE
head Prints the template <head> including <body> start tag AVAILABLE AVAILABLE
pagestart Prints the jQuery Mobile page start template including help AVAILABLE AVAILABLE
pageend Prints the jQuery Mobile page end template AVAILABLE AVAILABLE
foot Prints the template foot AVAILABLE AVAILABLE
get_plugin_icon Returns the URI of the plugin icon in specified size AVAILABLE AVAILABLE
iso_languages Returns all or only translated ISO 639-1 languages AVAILABLE N/A PHP: As this feature is primary for LoxBerry-Core, no PHP feature is planned
Navigation Bar (Perl)Prints navigation on top of the page AVAILABLE AVAILABLE
logfile_button_html Returns the full html code to display a dynamic logfile button AVAILABLE
loglist_url Returns the link to a list of logfiles of a plugin AVAILABLE
loglist_button_html Returns the full html code to display a button to the logfile list AVAILABLE
mslist_select_html Returns html for a Miniserver selection dropdown AVAILABLE
loglevel_select_html Returns html for a loglevel selection dropdown AVAILABLE
loglist_html Returns html showing a list of logfiles AVAILABLE
Usable for plugins Functions can be used in plugins FULL FULL
Usable for system widgets System widgets are LoxBerrys own configuration "plugins", shown on the Settings page. FULL LIMITED System help files currently not supported (untested).

LoxBerry::Storage vs. loxberry_storage.php

Functions for storage devices like usb and network shares.

Function Description Perl LoxBerry::Storage PHP loxberry_storage.php More information
get_netshares Returns an array of all reachable Network Shares AVAILABLE

N/A Could be used to create a <select>-list with available network shares.
get_netservers Returns an array of all reachable Network Servers (which offers shares) AVAILABLE


get_usbstorages Returns an array of all conneted USB Storage devices AVAILABLE


 Could be used to create a <select>-list with available usb storage devices.
get_storage Returns an array of all storage devices (combined USB and Shares) AVAILABLE
get_storage_htmlReturns a ready html+js for a storage selection dropdown (e.g. to provide users to select a location) AVAILABLE

LoxBerry::Log vs. loxberry_log.php

Library to create and show logfiles, and handles notifications. 

Function Description Perl LoxBerry::Log PHP loxberry_log.php More information
Logging class (methods to a log object)
new Constructor for a new logging session AVAILABLE
LOGSTART / LOGEND Starting and finishing the logging session AVAILABLE
loglevel Queries and sets the loglevel AVAILABLE
autoraise On a LOGCRIT log entry, auto-raises the loglevel to 6 AVAILABLE
filehandle LEGACY for LB <1.2.5  DEPRECATED
filename Returns the current filename AVAILABLE
dbkey Returns the current database key AVAILABLE
addtime Adds the current time to every logline AVAILABLE
logtitle Changes the title of the log during logging AVAILABLE
default On multiple opened logs, set one log to the default logfile AVAILABLE
Logfile handling functions
get_logs Returns an array with all logs, with filters by parameter AVAILABLE
Notification functions
notify Creates an info or error notification AVAILABLE
notify_ext Creates a notification with extended parameters AVAILABLE
get_notifications Returns an array with all notifications, selected by parameters AVAILABLE
get_notification_count Returns the number of notifications, selected by parameters AVAILABLE
delete_notifications Deletes all notifications, selected by parameters AVAILABLE
delete_notification_key Deletes a specific notification by key AVAILABLE
get_notifications_html Returns ready html+js for a list of notifications AVAILABLE

LoxBerry::IO vs. loxberry_io.php

Functions to easily communicate to the Miniserver

Function Description Perl LoxBerry::IO PHP loxberry_io.php More information
mshttp_send Sends values to Miniserver's HTTP REST API AVAILABLE
mshttp_send_memSends values to Miniserver's HTTP REST API, using caching AVAILABLE
mshttp_get Reads values from Miniservers HTTP REST API AVAILABLE
mshttp_call Raw function to send or read data via HTTP REST API AVAILABLE
msudp_send Sends values via UDP to the Miniserver AVAILABLE
msudp_send_mem Sends values via UDP to the Miniserver, using caching AVAILABLE

LoxBerry::JSON (PHP not available)

Class to simplify working with json (config) files

FunctionDescription Perl LoxBerry::JSON PHP not available More information
new Constructor for a json object AVAILABLE
parse Parse an already available json string AVAILABLE
open Opens and parses a json file AVAILABLE
write Saves a changed file to disk, using change detection AVAILABLE
filenameQueries the current filename, or sets a new filename AVAILABLE
find Find a string in an object in the json (array or named list) AVAILABLE
dump Dumps the content of the json to stderr AVAILABLE