Provides a central repository for custom functions, javascript and CSS used by other plugins. This ensures that the Javascript and CSS are loaded only once to prevent problems with duplicate JS classes.
This plugin uses the glFusion automated plugin installer. Simply upload the distribtuion using the glFusion plugin installer located in the Plugin Administration page.
The plugin may be installed manually, if necessary.
The upgrade process is identical to the installation process, simply upload the distribution from the Plugin Administration page.
Provides commonly-used Javascript and PHP functions
Nearly all of the functions of lgLib are transparent to the administrator and site visitor, except for enabling popup messages.
The messaging function allows plugins to store messages for a user or session that can be displayed during a subsequent visit. For example, the Membership plugin uses this facility to add a message during user creation so that the user will be invited to join the organization after their first login.
LGLIB_getDocURL($file=“”, $pi_name=“lglib”, $doclang=“english”)
Gets the URL to a plugin's configuration help file, or other documentation file found under public_html/<plugin>/doc/<language>
LGLIB_invokeService($type, $action, $args, &$output, &$svc_msg)
This invokes a service function in another plugin, if available. It is identical to the standard PLG_invokeService() function, except this version does not require enabling web services.
LGLIB_storeMessage($args, $title=“”, $persist=false, $expires = “”, $pi_code = “”, $uid = 0, $use_sess_id = true)
Stores a text message in the database for a plugin. This allows messages to be created asynchronously and not require an immediate page refresh. Any type of text message can be stored.
Retrieves all the messages for the current user. Called by LGLIB_showAllMessages().
Args: None
Deletes all messages for the current user.
Args: None
LGLIB_deleteMessage($uid, $pi_code = “”)
Deletes a single message for a specific user and, optionally, a specific plugin.
Deletes all expired messages from the database
LGLIB_showAllMessages($persist = false)
Retrieves and displays all pending messages for the current user. If $persist is true, the message box will remain visible using a simple message box. If false, the function calls COM_showMessageText() to display the fading message box.
Note that if any individual message has its own “persist” flag set then the message box will persist regardless of the parameter passed to this function.
LGLIB_setGlobal($name, $value, $clobber=true)
Sets a value in the global variable array $_LGLIB_GLOBALS. This, coupled with LGLIB_getGlobal(), gives a convenient method to pass variables between functions without needing to declare the global variable everywhere.
LGLIB_getGlobal($name, $remove=false)
Retrieves a variable set by LGLIB_setGlobal().
LGLIB_setSession($name, $value, $clobber=true)
Like LGLIB_setGlobal(), this function is just a shortcut to set a session variable.
LGLIB_getSession($name, $remove=false)
Retrieves a session variable.
LGLIB_ImageUrl($orig_path, $width=0, $height=0, $rnd = 0)
Resizes an image and places the resized version under public_html/lglib/imgcache with a unique filename.
Comparison with img.php (TimThumb):
LGLIB_obfuscate($str)
A simple function to obfuscate sensitive strings, such as email addresses, to (somewhat) thwart spders.
LGLIB_pushJob($pi_name, $job_name, $params=“”)
Pushes a job into the job queue. This is meant to be used with public_html/lglib/cron.php to run long-running jobs from the command line to avoid browser timeouts.
LGLIB_run_jobqueue($pi = “”)
Runs jobs in the job queue, for a single plugin or for all. cron.php can be called with a plugin name to run only one plugin's jobs.
Jobs are run by calling LGLIB_invokeService(pi_name, “runjob”, array(complete job queue record), $output, $svc_msg). The plugin is responsible for implementing a “service_runjob_plugin” function and returning either PLG_RET_OK or PLG_RET_ERROR. The $output is not used.
LGLIB_update_job_status($jobid, $status)
Update the status of a single job. The $status comes from the plugin's service function.
LGLIB_getIcon($name, $style=“info”)
Gets the icon name for either Uikit or FontAwesome icon sets. The style is used to add coloring to the icon, for instance, “info”, “warning”, “danger”, etc.
A configuration option can be set to enable the experimental automatic image resizer. This is called from plugin_templateSetVars_lglib() and resizes images to the specified width and height values in the image tag.
Compared to LGLIB_imageUrl():
Also included is a modified version of TimThumb. TimThumb is no longer supported and this version will likely be scaled down to minimize any attack surface.
Session variables are used to locate the original images for plugins and images are resized on the fly. This is similar to the automatic resizer, but works for all plugins.
Compared to LGLIB_imageUrl():
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.