array('format' => '%d', 'value' => 0), 'container' => array('format' => '%s', 'value' => 'img'), 'content_type' => array('format' => '%s', 'value' => 'none'), 'custom_jquery' => array('format' => '%s', 'value' => ''), 'folder' => array('format' => '%s', 'value' => ''), 'fx' => array('format' => '%s', 'value' => 'fade'), 'height' => array('format' => '%d', 'value' => 195), 'image_height' => array('format' => '%d', 'value' => 183), 'image_width' => array('format' => '%d', 'value' => 183), 'imgcache_toggle' => array('format' => '%d', 'value' => 0), 'imgcache_slide' => array('format' => '%s', 'value' => ''), 'imgcache_pager_item' => array('format' => '%s', 'value' => ''), 'input_type' => array('format' => '%s', 'value' => 'images'), 'max_image' => array('format' => '%d', 'value' => null), 'next' => array('format' => '%d', 'value' => 1), 'nodes' => array('format' => '%s', 'value' => ''), 'node_body_teaser' => array('format' => '%s', 'value' => 'body'), 'order' => array('format' => '%s', 'value' => 'random'), 'origin' => array('format' => '%s', 'value' => null), 'output' => array('format' => '%s', 'value' => 'view_content'), 'overflow' => array('format' => '%d', 'value' => 1), 'pause' => array('format' => '%d', 'value' => 1), 'pager_toggle' => array('format' => '%d', 'value' => 0), 'pager' => array('format' => '%s', 'value' => 'none'), 'pager_container' => array('format' => '%s', 'value' => 'pager-item'), 'pager_event' => array('format' => '%s', 'value' => 'click'), 'pager_height' => array('format' => '%d', 'value' => 25), 'pager_width' => array('format' => '%d', 'value' => 195), 'pager_position' => array('format' => '%s', 'value' => 'top'), 'speed' => array('format' => '%d', 'value' => 1000), 'timeout' => array('format' => '%d', 'value' => 3000), 'widget' => array('format' => '%s', 'value' => 'default'), 'width' => array('format' => '%d', 'value' => 195), 'css' => array('format' => '%s', 'value' => 'none'), 'slide_text' => array('format' => '%d', 'value' => 0), 'slide_text_after_effect' => array('format' => '%s', 'value' => 'fadeIn'), 'slide_text_after_speed' => array('format' => '%d', 'value' => 1000), 'slide_text_before_effect' => array('format' => '%s', 'value' => 'fadeOut'), 'slide_text_before_speed' => array('format' => '%d', 'value' => 250), 'slide_text_container' => array('format' => '%s', 'value' => 'div.slide-text'), 'slide_text_position' => array('format' => '%s', 'value' => 'bottom'), 'template' => array('format' => '%s', 'value' => 'none'), 'custom_template' => array('format' => '%s', 'value' => ''), ); public function __construct (Array $settings) { foreach ($settings as $key => $value) { $this->__set($key, $value); } } /** * Use overload functions to get and set $settings * * Keys passed to the set function should be keys that already * exist in the settings array. */ public function __set($key, $value) { if (!array_key_exists($key, $this->settings)) { return; } $this->settings[$key]['value'] = sprintf($this->settings[$key]['format'], $value); } /** * Use overload functions to get and set $settings */ public function __get($key) { if (!array_key_exists($key, $this->settings)) { return null; } return $this->settings[$key]['value']; } /** * Alternate function to __get */ public function get($key, $default) { return ($this->__get($key) !== NULL) ? $this->__get($key) : $default; } public function settings() { $settings = array(); foreach ($this->settings as $key => $value) { $settings[$key] = $value['value']; } return $settings; } }