1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- class context_reaction {
- var $plugin;
- var $title;
- var $description;
-
- function __clone() {
- foreach ($this as $key => $val) {
- if (is_object($val) || (is_array($val))) {
- $this->{$key} = unserialize(serialize($val));
- }
- }
- }
-
- function __construct($plugin, $info) {
- $this->plugin = $plugin;
- $this->title = isset($info['title']) ? $info['title'] : $plugin;
- $this->description = isset($info['description']) ? $info['description'] : '';
- }
- function options_form($context) {
- return array();
- }
-
- function options_form_submit($values) {
- return $values;
- }
-
- function settings_form() {
- return array();
- }
-
-
- function get_contexts() {
- $contexts = array();
- foreach (context_active_contexts() as $context) {
- if ($this->fetch_from_context($context)) {
- $contexts[$context->name] = $context;
- }
- }
- return $contexts;
- }
-
- function fetch_from_context($context) {
- return isset($context->reactions[$this->plugin]) ? $context->reactions[$this->plugin] : array();
- }
- }
|