hUtils.php

The hUtils.php helper contains various utility functions for Osclass, including methods for retrieving request parameters, formatting data, handling subdomains, managing widgets, and interacting with the view layer. These functions assist in streamlining development and improving site functionality.

Functions Description

__get($key) – Retrieves the value of the specified key from the View.

osc_get_param($key) – Retrieves a variable from $_REQUEST[$key].

osc_field($item, $field, $locale) – A generic function for the view layer that returns the specified field of an item.

osc_show_widgets($location) – Prints all widgets assigned to the specified location.

osc_show_recaptcha($section = '') – Prints the reCAPTCHA HTML. If $section is set to "recover_password", it applies specific settings.

osc_format_date($date) – Formats the given date using the appropriate format based on site preferences.

osc_escape_string($string) – Escapes letters and numbers in a string for security.

osc_private_user_menu($options = null) – Prints the user's account menu, allowing customization via the $options parameter.

osc_highlight($txt, $len = 300, $start_tag = '', $end_tag = '') – Prepares and shortens text while adding optional highlight tags.

osc_get_http_referer() – Returns $_SERVER['HTTP_REFERER'] if available; otherwise, returns an empty string.

osc_add_route($id, $regexp, $url, $file, $user_menu = false, $location = "custom", $section = "custom", $title = "Custom") – Defines a new route in the Rewrite class. This is commonly used in plugins to define custom URLs.

Helpers for Subdomains

osc_get_subdomain_params() – Sets the current subdomain parameter into an array. Only one key can be active at a time.

  • sCategory – Subdomain category ID
  • sCountry – Subdomain country code
  • sRegion – Subdomain region ID
  • sCity – Subdomain city ID
  • sUser – Subdomain user ID

osc_subdomains_filter_conditions() – Generates an array with details about the current subdomain and applicable filter conditions.