Technical Overview

  • Structure

    SocialEngine is based on the Zend Framework 1.12 (customized and upgraded for compatibilities), and is built in an MVC (Model-View-Controller) structure. It is also built with modularity in mind.

    ./application/

    This directory contains the majority of SocialEngine files.

    /application/languages/

    See the section below on Languages

    /application/libraries/

    Third party PHP libraries are typically contained in here. For example, Zend Framework and CSS Scaffold both live in this directory, as does our extensions to Zend Framework (called Engine).

    /application/modules/

    See the section below on Plugins

    /application/settings/

    These files contain configurations that typically will not be modified after your initial installation. Things like your database username/password, cache settings, mail settings, etc are stored in here.

    /application/themes/

    See the section below on Themes

    /development/

    Various tools that we have used during development are contained in this directory. You can mostly ignore this hodge-podge of files.

    /externals/

    Most of our images, javascript libraries, and flash applications that are used globally are retained in this directory. These should contain trusted (i.e. not user-uploaded) content.

    /public/

    User-uploaded content is always contained in here. This directory should be both web-accessible and writable by the web server (chmod 777 recursively).

    /temporary/

    Various temporary files, such as cache files, logs, session files, etc are stored in this directory. It should not be web-accessible, but must be writable by the web server (chmod 777 recursively). We provide an ".htaccess" file to block access to this directory from the web browser, but if you are using a web server other than Apache, we recommend you configure the web server accordingly to prevent view access.

    Plugins

    /application/modules/*

    Most of SocialEngine's functionality resides here. Each module contains within it the MVC structure, where the "Model", "views", and "controllers" directories correspond to the MVC paths. Please download the skeleton module "HelloWorld" for more information on this.

    Languages

    /application/languages/*

    Each language gets its own two-letter (or 5-character with localization support) directory in this sub-directory. The language files are in multiple CSV files, though they are concatenated into one large CSV file (in no particular order, except that "custom.csv" is the last). One important point to keep in mind is that duplicate keys override previously defined keys. So, for example, if you have a key "Turtles are fast!" in both core.csv and custom.csv, since custom.csv is loaded last, the value set to "Turtles run fast!" in custom.csv will be the one used.

    The CSV files have several requirements:

    • Each line has at minimum two columns, and can contain more for different pluralizations.
    • Each column is separated using a semi-colon, and is enclosed in "double-quotes" if it contains any sort of white-space (we recommend wrapping your values in quotes in all cases just to be safe).
    • The first column is always going to be the key. This is the English word or phrase that exists in the view script, controller, or other portion of the code.
    • The second column is always going to be the default translation of the key.
    • If there is an subsequent columns after the second column, it will be for various pluralizations of the key.

    Untranslated variables can be contained within a translation key and translations. Variable replacement is done using the PHP function sprintf, and so the same rules apply. When only one variable is being injected into a translation, typically "%s" is the placeholder for that variable. If multiple variables are being injected, you can use:

    "%1$s", "%2$s", "%3$s"

    etc to put the variables in their proper positions for your translation.

    If your translation has double-quotes in it, you must use two double-quotes. So as an example, the sentence He said "wow". would appear in a CSV files as:

    He said ""wow"".

    Themes

    /application/themes/*

    We utilize a framework called CSS Scaffold which makes editing your community's theme a simple process. Each theme is stored in its own directory within /applications/themes/. A default theme is automatically loaded when you first install SocialEngine. Each theme contains two files: constants.css and theme.css.

    At the top of constants.css, you'll find a series of global CSS settings (called "constants"). You can edit these to adjust the colors, fonts, and other styles throughout your entire community.

    The other file, theme.css, contains more specific styles that are used throughout your community. Many of these styles inherit values from constants.css. If you want to override any of the default styles on your community, you can edit them here. If they aren't present in theme.css (and are being loaded from outside the theme itself), you can override them by adding new styles to the bottom of theme.css.

    More information about how to work with CSS Scaffold is available on Github or Google for CSScaffold for videos and tutorials.

    Tools

    While the following are not necessary for modifying SocialEngine PHP, we recommend the following tools for your development environment.

    • Netbeans IDE
    • Set SocialEngine4 to be in "Development" mode . This prevents the use of caching, while also enables error messages to be displayed to the front-end interface.