The Foreign Vocabulary Of The Qur An - warwickfoster/qurantools GitHub Wiki
app/library/functions.php
File:Purpose
The provided code contains a collection of functions and utility methods that are used throughout the application. They perform various tasks such as:
- User authentication and management
- Site configuration and settings
- Google Tag Manager integration
- Branding and customization
- Contact information management
Key Functions
- is_running_locally(): Determines if the application is running on a local development machine.
- is_show_google_tag_manager(): Determines whether Google Tag Manager should be displayed on the page.
- is_user_registration_allowed(): Checks if user registration is allowed.
- is_branded(): Determines if the application has been branded.
- branding_text(): Returns the branding text with a link if available.
- show_contact_us_link(): Determines if the contact us link should be displayed.
Utility Methods
- get_google_recaptcha_mode(): Gets the Google reCAPTCHA mode.
- get_google_recaptcha_key(): Gets the Google reCAPTCHA key based on the mode.
- is_admin_user(): Checks if the user is an administrator.
- start_session(): Starts a PHP session.
- end_session(): Ends a PHP session.
- redirect(): Redirects the user to a specified URL.
- is_logged_in(): Checks if the user is logged in.
Global Variables
- $config: An array containing site configuration settings.
- $logged_in_user: An array containing information about the logged-in user.
Usage
These functions and methods can be called within PHP code to perform the corresponding actions. For example, to check if user registration is allowed, you can use the following code:
if (is_user_registration_allowed()) {
// Allow user registration
} else {
// Disable user registration
}
Conclusion
The provided code provides a comprehensive set of functions and utility methods that enhance the functionality of the application. They simplify common tasks such as user management, site configuration, and integration with Google Tag Manager.