Using Web357 Framework Utility Functions in Your Code
The Web357 Framework plugin includes several utility functions used internally by our extensions. However, developers can also use them manually in a custom module, template override, or plugin.
Prerequisites
- Joomla version 4.x or 5.x
- The plugin System - Web357 Framework must be installed and enabled
Available Helper Functions
The following methods are available from the helper class:
getCountry()
– Returns the visitor’s country based on IP addressgetBrowser()
– Returns the visitor’s browsergetOS()
– Returns the visitor’s operating system
Example Usage
<?php // Load the Web357 Framework helper class require_once(JPATH_PLUGINS . '/system/web357framework/web357framework.class.php'); // Instantiate the helper class $web57framework = new \Web357FrameworkHelperClass; // Get system information $country = $web57framework->getCountry(); $browser = $web57framework->getBrowser(); $operating_system = $web57framework->getOS(); // Get Joomla user info $user = JFactory::getUser(); $username = $user->name !== '' ? $user->name : 'None'; $ip = isset($_SERVER['REMOTE_ADDR']) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : 'Unknown IP'; $username = htmlspecialchars($username); // Output example (e.g. in footer) echo "<p class='footer2' style='font-size: 1em; text-align:left;'>"; echo "Active Licensed User: {$username}<br />"; echo "Country: {$country}<br />"; echo "User Browser: {$browser}<br />"; echo "User OS: {$operating_system}<br />"; echo "User IP: {$ip}</p>"; ?>
Notes
- The helper functions must be called manually; they do not output data by default.
- The helper class is not autoloaded. You must include it using
require_once
.
Where to Use
- Inside a custom module or system plugin
- In a template override (e.g.,
footer.php
) - Anywhere you want to programmatically display country, OS, browser, or IP information
Additional Suggestions
These helper functions were originally built for internal use across Web357 extensions. However, we welcome feedback. If you would like to see these functions wrapped into a Joomla module or shortcode plugin, let us know.