hDefines.php

The hDefines.php helper centralizes all path and URL definitions for an Osclass installation. These functions allow you to quickly retrieve paths for core components (such as libraries, themes, plugins, and uploads) and generate complete URLs for both the public website and the admin panel. Additionally, a set of helper functions generate URLs for various site actions, including contact forms, item operations, search pages, and subdomain management.

Core Paths and URLs

osc_base_url($with_index = false) – Gets the root URL for your installation.

osc_admin_base_url($with_index = false) – Gets the root URL of oc-admin for your installation.

osc_base_path() – Gets the root path for your installation.

osc_admin_base_path() – Gets the root path of oc-admin.

osc_lib_path() – Gets the libraries path.

osc_content_path() – Gets the content path.

osc_themes_path() – Gets the themes path.

osc_plugins_path() – Gets the plugins path.

osc_translations_path() – Gets the translations path.

osc_uploads_path() – Gets the uploads path.

osc_lib_url() – Gets the libraries URL.

osc_content_url() – Gets the content URL.

osc_themes_url() – Gets the themes URL.

osc_plugins_url() – Gets the plugins URL.

osc_translations_url() – Gets the translations URL.

osc_current_admin_theme() – Gets the current oc-admin theme.

osc_current_admin_theme_url($file = '') – Gets the complete URL of a given admin’s file.

osc_current_admin_theme_path($file = '') – Gets the complete path of a given admin’s file.

osc_current_admin_theme_styles_url($file = '') – Gets the complete URL of a given style’s file.

osc_current_admin_theme_js_url($file = '') – Gets the complete URL of a given JS file.

osc_current_web_theme() – Gets the current theme for the public website.

osc_current_web_theme_url($file = '') – Gets the complete URL of a given file using the theme URL as a root.

osc_current_web_theme_path($file = '') – Gets the complete path of a given file using the theme path as a root and includes the file (using require).

osc_current_web_theme_path_value($file = '') – Gets the complete path of a given file using the theme path as a root.

osc_current_web_theme_styles_url($file = '') – Gets the complete URL of a given styles file using the theme path as a root.

osc_current_web_theme_js_url($file = '') – Gets the complete URL of a given JS file using the theme path as a root.

Helpers for the Public Website

osc_contact_url() – Automatically creates the contact URL.

osc_item_post_url_in_category() – Automatically creates the URL to post an item in a specific category.

osc_item_post_url() – Automatically creates the URL to post an item.

osc_search_category_url($pattern = '') – Automatically creates the URL of a category.

osc_user_dashboard_url() – Automatically creates the URL of the users’ dashboard.

osc_user_logout_url() – Automatically creates the logout URL.

osc_user_login_url() – Automatically creates the login URL.

osc_register_account_url() – Automatically creates the URL to register an account.

osc_user_activate_url($id, $code) – Automatically creates the URL to activate an account.

osc_item_renew_url($secret = '', $id = '') – Generates the URL to renew a listing once expired.

osc_item_comments_url($page = 'all', $locale = '') – Automatically creates the URL of the item’s comments page.

osc_comment_url($locale = '') – Automatically creates the URL of the item’s comments page.

osc_item_url($locale = '') – Automatically creates the URL of the item details page.

osc_premium_url($locale = '') – Automatically creates the URL of the premium item details page.

osc_item_url_ns($id, $locale = '') – Creates the non-friendly URL of the item using its ID.

osc_item_admin_edit_url($id) – Automatically creates the URL for admin to edit an item.

osc_user_alerts_url() – Retrieves the current user alerts URL.

osc_user_unsubscribe_alert_url($email = '', $secret = '') – Retrieves the current user alert unsubscribe URL.

osc_user_activate_alert_url($secret, $email) – Retrieves the URL to activate user alerts.

osc_user_profile_url() – Retrieves the current user profile/account URL.

osc_user_public_profile_url($user_id = '') – Retrieves the public profile URL for a given user.

osc_user_list_items_url($page = '') – Retrieves the URL for listing items of the current user.

osc_change_user_email_url() – Retrieves the URL to change the user’s email.

osc_change_user_email_confirm_url($userId, $code) – Retrieves the confirmation URL for changing email.

osc_change_user_password_url() – Retrieves the URL for changing the password.

osc_recover_user_password_url() – Retrieves the URL for recovering the password.

osc_forgot_user_password_confirm_url($userId, $code) – Retrieves the URL to confirm the forgot password process.

osc_forgot_admin_password_confirm_url($adminId, $code) – Retrieves the URL for confirming admin password recovery.

osc_change_language_url($locale) – Retrieves the URL for changing the website language (for users).

Helpers for Items

osc_item_edit_url($secret = '', $id = '') – Retrieves the URL for editing an item.

osc_item_delete_url($secret = '', $id = '') – Retrieves the URL for deleting an item.

osc_item_activate_url($secret = '', $id = '') – Retrieves the URL for activating an item.

osc_item_deactivate_url($secret = '', $id = '') – Retrieves the URL for deactivating an item.

osc_item_resource_delete_url($id, $item, $code, $secret = '') – Retrieves the URL for deleting a resource of an item.

osc_item_send_friend_url() – Retrieves the URL for sending an item to a friend.

Helpers for Search

osc_get_countries() – Retrieves the list of countries.

osc_get_regions($country = '') – Retrieves the list of regions from a specified country.

osc_get_cities($region = '') – Retrieves the list of cities from a specified region.

osc_get_country_row($code) – Retrieves the country record for a given code.

osc_get_region_row($code) – Retrieves the region record for a given code.

osc_get_city_row($code) – Retrieves the city record for a given code.

Helpers for Location

osc_is_ad_page() – Determines if the current page is an ad page.

osc_is_search_page() – Determines if the current page is a search page.

osc_is_static_page() – Determines if the current page is a static page.

osc_is_home_page() – Determines if the current page is the homepage.

osc_is_user_dashboard() – Determines if the current page is the user dashboard.

osc_is_publish_page() – Determines if the current page is the item publish page.

osc_is_edit_page() – Determines if the current page is the item edit page.

osc_is_login_form() – Determines if the current page is a login form.

osc_get_osclass_location() – Retrieves the current location.

osc_get_osclass_section() – Retrieves the current section.

Utility Helpers

osc_is_backoffice() – Returns true if the back office is visited.

osc_is_frontoffice() – Returns true if the front office is visited.

osc_add_option_menu($option = '') – Prints the additional options to the menu.

Helpers for Subdomains

osc_subdomain_enabled() – Returns true when subdomains are enabled; otherwise, false.

osc_subdomain_id() – Returns the related ID/code of the current subdomain.

osc_subdomain_name() – Returns the related name of the current subdomain (e.g., category, user, or country name). Returns null if on the root domain.

osc_subdomain_slug() – Returns the related slug of the current subdomain (e.g., “us” or “united-states”). Returns null if on the root domain.

osc_is_subdomain() – Returns true when viewing a subdomain (not the root domain).

osc_is_topdomain() – Returns true when viewing the top-domain (root); it is the negation of osc_is_subdomain().

osc_is_subdomain_base() – Returns true when viewing the top-domain (root) and subdomains are enabled; otherwise, false.

osc_subdomain_type_name() – Returns the name of the enabled subdomain type (e.g., Country, Region).

osc_subdomain_top_url($with_index = false, $stop_redirect_param = '') – Returns the URL to the top-domain page. If automatic redirect is enabled, ?nored=1 is appended to avoid redirection.

osc_subdomain_base_url($params = array()) – Returns the URL to a subdomain based on the specified parameters.