Description
Core\Is is()
Using our is() function will give you access to our core is class, which is used to check if something is or isn't true based on the method accessed.
Examples
<?php // Check if a user is logged in if (is()->user()) { echo "I am a user"; } // Check if a core module is enabled if (is()->module('core')) { echo "core module enabled"; } // Check if an app is installed if (is()->app('PHPfox_Videos')) { echo "video app is installed"; }
Methods
Method | Description | Usage | Returns |
---|---|---|---|
module(string $module)
$module Module name | Checks if a module is installed based on the path | // Check if a core module is enabled if (is()->module('core')) { echo "core module enabled"; } | true on success, false on failure. |
user() | Checks if a user is logged in or not. | if (is()->user()) { echo "I am a user"; } | true on success, false on failure.
|
app(string $app_id)
$app_id App ID | Checks if an app is installed based on the path
| // Check if an app is installed if (is()->app('PHPfox_Videos')) { echo "video app is installed"; } | true on success, false on failure. |