_config = unserialize($conf[self::$CONFIG_NAME]); } else { $this->_config = $config; } } public static function createDefaultConfiguration () { $config = array( // // global parameters // 'mediaFilePattern' => '/^(?.*)\\/(?[^\\/]*)_-_(?flv|mp4|swf|mp3)(?:_(?\\d+)x(?\\d+))?/i', // // overlaylib parameters // 'modalOverlayLib' => 'mediaboxAdvanced', 'modalOverlayTheme' => 'grey', 'favoritePicture' => true, 'hdPicture' => true, 'downloadPicture' => true, 'addToBasket' => true, // // content parameters // // Display the HD picture in shadowbox when the picture is clicked in the picture content page 'hdPictureInOverlay' => true, 'hdPicturePrefilterPattern' => '/href="javascript:phpWGOpenWindow.*"/i', 'hdPicturePrefilterReplacement' => 'href="{$high.U_HIGH}" rel="lightbox"', // Display media player in the piwigo default content page 'displayMediaPlayer' => true, // // sideshow // 'slideshowInOverlay' => true, 'slideshowPrefilterPattern' => '/(href="\\{\\$(?:U_SLIDESHOW|U_SLIDESHOW_START)\\}")([^>]*)(rel=".*")?/i', 'slideshowPrefilterReplacement' => '$1 rel="lightbox[diaporama 80% 80%]"$2', 'slideshowClosePattern' => '/href="\\{\\$U_SLIDESHOW_STOP\\}"([^>]*)/i', 'slideshowCloseReplacement' => 'href="#" onclick="parent.window.ShadogoOverlayWnd.close(); return false;"$1', // // Thumbnail 'thumbInOverlay' => true, 'thumbMediaPlayerIcon' => true, 'thumbContentIcon' => true, 'thumbContentLabel' => false, 'thumbContentInOverlay' => false, 'thumbButtonsTemplateSearch' => '{if isset($thumbnail.NAME)}{$thumbnail.NAME}{/if}', 'thumbHrefContentSearch' => 'href="{$thumbnail.URL}"' ); return $config; } public static function install() { global $conf; $c = self::createDefaultConfiguration(); if (!isset($conf[self::$CONFIG_NAME])) { $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'. self::$CONFIG_NAME .'" , "'.pwg_db_real_escape_string(serialize($c)).'" , "Shadogo configuration");'; pwg_query($query); } } public static function uninstall() { // Clean DB $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="'. self::$CONFIG_NAME .'" LIMIT 1;'; pwg_query($q); // Clean global config if (isset($conf[self::$CONFIG_NAME])) unset($conf[self::$CONFIG_NAME]); } public function &__get($name) { return $this->_config[$name]; } public function get($name) { return $this->_config[$name]; } function &__set($name, $val) { $this->_config[$name] = $val; } public function set($name, $value) { $this->_config[$name] = $value; } public function commit() { conf_update_param(self::$CONFIG_NAME, pwg_db_real_escape_string(serialize($this->_config))); } public function assign(&$template) { $template->assign(self::$CONFIG_NAME, $this->_config); } }