Skip to main content Help Control Panel

Aubagne HipHop

Tout le Hip Hop d'Aubagne et des alentours

Home «   Server software «  

Documentation: behaviors/behaviors.php

class Behaviors - Programmable extensions of sections, articles, and files

Behaviors are software extensions used from within sections, articles, and files to change YACS basic behavior on key event, such as:

Behaviors are described in specialized fields either in sections, articles, or files. These multi-line fields allow for the definition of several behaviors per item.

Each line describes one behavior, according to following formats:

behavior_name


or

behavior_name behavior_parameters


The behavior name references one PHP script that extends the behavior interface, defined in behaviors/behavior.php. Parameters consist of optional data provided to the behavior script at run-time.

Some examples of behavior invocations:

// agree on creative common license prior file download (at section, article, or file level)
agree_on_file_access creative_common.txt

// ask to pay for each new article posted in a section
paypal_on_article_creation email@mysite.com 5 EUR

// ask to pay for article access (at section or article level)
paypal_on_article_access email@mysite.com 0.5 EUR

// ask to pay for file download (at section, article, or file level)
paypal_on_file_access email@mysite 1 EUR


How do behaviors compare to overlays?

Overlays are aiming to store additional structured data in articles, where behaviors are stateless, and are scoping sections.

This script is a reference file of this system.

Licence: GNU Lesser General Public License

Auteurs:

behaviors/behaviors.php - All registered behaviors

Behaviors() - Constructor

function Behaviors(&$item, &$anchor)

This function parses behavior declarations put in some item, and in related anchors.

allow() - Allow script execution, or block it

function allow($script, $anchor)

@paral string target anchor, if any

parse() - Bind behavior declarations to real code

function parse(&$text)

Tools
Browse the source of this script
Server software