1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Docs] Global Constants and Variables

Discussion in 'Developing Plugins' started by Nick, Sep 28, 2009.

  1. Nick

    Nick Well-Known Member

    Here's an overview of the main global constants and variables.

    Constants

    Database:

    DB_USER
    DB_PASSWORD
    DB_NAME
    DB_HOST
    DB_PREFIX
    DB_LANG

    Database tables:

    TABLE_BLOCKED
    TABLE_CATEGORIES
    TABLE_COMMENTS
    TABLE_COMMENTVOTES
    TABLE_MISCDATA
    TABLE_PLUGINS
    TABLE_PLUGINHOOKS
    TABLE_PLUGINSETTINGS
    TABLE_POSTS
    TABLE_POSTMETA
    TABLE_POSTVOTES
    TABLE_SETTINGS
    TABLE_TAGS
    TABLE_TEMPDATA
    TABLE_USERS
    TABLE_USERMETA
    TABLE_USERACTIVITY
    TABLE_WIDGETS

    Absolute URL Path, e.g. http://yoursite.com/ :

    BASEURL

    Absolute Server Path, e.g. /home/username/public_html/ :

    BASE
    ADMIN
    CACHE
    INSTALL
    LIBS
    EXTENSIONS
    THEMES
    PLUGINS
    LANGUAGES
    ADMIN_THEMES

    Settings, pulled from the database settings table (details here):

    Note: These are all strings.

    SITE_OPEN
    SITE_NAME
    THEME
    ADMIN_THEME
    LANGUAGE_PACK
    FRIENDLY_URLS
    SITE_EMAIL
    DB_CACHE_ON
    DB_CACHE_DURATION
    RSS_CACHE_ON
    RSS_CACHE_DURATION
    CSS_JS_CACHE_ON
    HTML_CACHE_ON
    DEBUG

    Objects

    Traditional globals variables are almost entirely eliminated from Hotaru. Instead, class methods and properties are accessible through the Hotaru class, i.e.:

    $h - the main Hotaru object
    $h->db - database
    $h->lang - language
    $h->cage - Inspekt input validation and filtering
    $h->plugin - used only to access plugin properties in the Plugin class
    $h->currentUser - you, i.e. the person logged in and viewing the site, provides access to user functions in UserAuth and UserBase
    $h->post - provides persistent access to the Post class
    $h->avatar - provides persistent access to the Avatar class
    $h->includes - provides persistent access to the Include CssJs class
     
    Last edited: Jan 8, 2010

Share This Page