addBehavior('initWidgets',array('adminArlequin','initWidgets'));
class adminArlequin
{
public static function initWidgets($w)
{
$w->create('arlequin',__('Arlequin'),array('publicArlequinInterface','arlequinWidget'),
null,
__('Theme switcher'));
$w->arlequin->setting('title',__('Title:'),__('Choose a theme'));
$w->arlequin->setting('homeonly',__('Display on:'),0,'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
)
);
$w->arlequin->setting('content_only',__('Content only'),0,'check');
$w->arlequin->setting('class',__('CSS class:'),'');
$w->arlequin->setting('offline',__('Offline'),0,'check');
}
public static function getDefaults()
{
return array(
'e_html'=>'
%4$s',
'a_html'=>'%4$s',
's_html'=>'');
}
public static function loadSettings($settings,&$initialized)
{
global $core;
$initialized = false;
$mt_cfg = @unserialize($settings->arlequinMulti->get('mt_cfg'));
$mt_exclude = $settings->arlequinMulti->get('mt_exclude');
// Paramètres corrompus ou inexistants
if ($mt_cfg === false ||
$mt_exclude === null ||
!(isset($mt_cfg['e_html']) &&
isset($mt_cfg['a_html']) &&
isset($mt_cfg['s_html'])))
{
$mt_cfg = adminArlequin::getDefaults();
$settings->addNameSpace('arlequinMulti');
$settings->arlequinMulti->put('mt_cfg',serialize($mt_cfg),'string','Arlequin configuration');
$settings->arlequinMulti->put('mt_exclude','customCSS','string','Excluded themes');
$initialized = true;
$core->blog->triggerBlog();
}
return array($mt_cfg,$mt_exclude);
}
}