v1.1
This commit is contained in:
parent
3c3695d67f
commit
128303194f
15 changed files with 861 additions and 0 deletions
21
CHANGELOG
Normal file
21
CHANGELOG
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
v1.1 - 05-03-2015 - Pierre Van Glabeke
|
||||||
|
* compatibilité dc2.7
|
||||||
|
* cosmétique dc2.6
|
||||||
|
* localisation
|
||||||
|
* aide intégrée
|
||||||
|
* version effectuée depuis la v1.0.1 présente sur DA
|
||||||
|
|
||||||
|
2010-07-15 Gaetan Guillard <gaetan@bistroduweb.com>
|
||||||
|
* v1.0.1 - Corrections for compatibility with Dotclear 2.2
|
||||||
|
|
||||||
|
2008-10-18 Oleksandr Syenchuk <sacha@xn--phnix-csa.net>
|
||||||
|
* v2008.10 - Removed theme parameter from URL
|
||||||
|
|
||||||
|
|
||||||
|
2008-08-21 Oleksandr Syenchuk <sacha@xn--phnix-csa.net>
|
||||||
|
* Excluded themes can not be selected by user.
|
||||||
|
|
||||||
|
|
||||||
|
2008-04-21 Oleksandr Syenchuk <sacha@xn--phnix-csa.net>
|
||||||
|
* Dotclear r1790 compatibility, see
|
||||||
|
http://dev.dotclear.net/2.0/changeset/1790
|
36
_admin.php
Normal file
36
_admin.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2015 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
if (!defined('DC_CONTEXT_ADMIN')) { return; }
|
||||||
|
|
||||||
|
$_menu['Blog']->addItem(__('Theme switcher'),'plugin.php?p=arlequin',
|
||||||
|
'index.php?pf=arlequin/icon.png',
|
||||||
|
preg_match('/plugin.php\?p=arlequin(&.*)?$/',$_SERVER['REQUEST_URI']),
|
||||||
|
$core->auth->check('contentadmin',$core->blog->id));
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/_widgets.php';
|
||||||
|
|
||||||
|
$core->addBehavior('adminDashboardFavorites','arlequinDashboardFavorites');
|
||||||
|
|
||||||
|
function arlequinDashboardFavorites($core,$favs)
|
||||||
|
{
|
||||||
|
$favs->register('arlequin', array(
|
||||||
|
'title' => __('Theme switcher'),
|
||||||
|
'url' => 'plugin.php?p=arlequin',
|
||||||
|
'small-icon' => 'index.php?pf=arlequin/icon.png',
|
||||||
|
'large-icon' => 'index.php?pf=arlequin/icon-big.png',
|
||||||
|
'permissions' => 'usage,contentadmin'
|
||||||
|
));
|
||||||
|
}
|
31
_define.php
Normal file
31
_define.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2015 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
if (!defined('DC_RC_PATH')) { return; }
|
||||||
|
|
||||||
|
$this->registerModule(
|
||||||
|
/* Name */ 'Arlequin',
|
||||||
|
/* Description*/ 'Allows visitors choose a theme',
|
||||||
|
/* Author */ 'Oleksandr Syenchuk, Pierre Van Glabeke',
|
||||||
|
/* Version */ '1.1',
|
||||||
|
/* Properties */
|
||||||
|
array(
|
||||||
|
'permissions' => 'contentadmin',
|
||||||
|
'type' => 'plugin',
|
||||||
|
'dc_min' => '2.7',
|
||||||
|
'support' => 'http://forum.dotclear.org/viewtopic.php?id=48345',
|
||||||
|
'details' => 'http://plugins.dotaddict.org/dc2/details/arlequin'
|
||||||
|
)
|
||||||
|
);
|
185
_public.php
Normal file
185
_public.php
Normal file
|
@ -0,0 +1,185 @@
|
||||||
|
<?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2015 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
if (!defined('DC_RC_PATH')) { return; }
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/_widgets.php';
|
||||||
|
|
||||||
|
/** @doc
|
||||||
|
Arlequin public interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
publicArlequinEngine::trigger($core->blog);
|
||||||
|
$core->addBehavior('publicBeforeDocument',array('publicArlequinEngine','adjustCache'));
|
||||||
|
$core->tpl->addValue('themesList',array('publicArlequinInterface','template'));
|
||||||
|
|
||||||
|
class publicArlequinEngine
|
||||||
|
{
|
||||||
|
public static $cookie_theme;
|
||||||
|
public static $cookie_upddt;
|
||||||
|
|
||||||
|
public static function trigger($blog)
|
||||||
|
{
|
||||||
|
$cname = base_convert($blog->uid,16,36);
|
||||||
|
self::$cookie_theme = 'dc_theme_'.$cname;
|
||||||
|
self::$cookie_upddt = 'dc_user_upddt_'.$cname;
|
||||||
|
|
||||||
|
if (!empty($_REQUEST['theme'])) {
|
||||||
|
# Set cookie for 365 days
|
||||||
|
setcookie(self::$cookie_theme,$_REQUEST['theme'],time()+31536000,'/');
|
||||||
|
setcookie(self::$cookie_upddt,time(),time()+31536000,'/');
|
||||||
|
|
||||||
|
# Redirect if needed
|
||||||
|
if (isset($_GET['theme'])) {
|
||||||
|
$p = '/(\?|&)theme(=.*)?$/';
|
||||||
|
http::redirect(preg_replace($p,'',http::getSelfURI()));
|
||||||
|
}
|
||||||
|
|
||||||
|
# Switch theme
|
||||||
|
self::switchTheme($blog,$_REQUEST['theme']);
|
||||||
|
}
|
||||||
|
elseif (!empty($_COOKIE[self::$cookie_theme])) {
|
||||||
|
self::switchTheme($blog,$_COOKIE[self::$cookie_theme]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function adjustCache($core)
|
||||||
|
{
|
||||||
|
if (!empty($_COOKIE[self::$cookie_upddt])) {
|
||||||
|
$GLOBALS['mod_ts'][] = (integer) $_COOKIE[self::$cookie_upddt];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function switchTheme($blog,$theme)
|
||||||
|
{
|
||||||
|
if ($blog->settings->multitheme->mt_exclude) {
|
||||||
|
if (in_array($theme,explode('/',$blog->settings->multitheme->mt_exclude))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$GLOBALS['__theme'] = $blog->settings->system->theme = $theme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class publicArlequinInterface
|
||||||
|
{
|
||||||
|
public static function arlequinWidget($w)
|
||||||
|
{
|
||||||
|
return self::getHTML($w);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function template($attr)
|
||||||
|
{
|
||||||
|
return '<?php echo publicArlequinInterface::getHTML(); ?>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getHTML($w=false)
|
||||||
|
{
|
||||||
|
global $core;
|
||||||
|
|
||||||
|
if ($w->offline)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$cfg = @unserialize($core->blog->settings->multitheme->get('mt_cfg'));
|
||||||
|
|
||||||
|
if (($w->homeonly == 1 && $core->url->type != 'default') ||
|
||||||
|
($w->homeonly == 2 && $core->url->type == 'default')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cfg === false ||
|
||||||
|
($names = self::getNames()) === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Current page URL and the associated query string. Note : the URL for
|
||||||
|
# the switcher ($s_url) is different to the URL for an item ($e_url)
|
||||||
|
$s_url = $e_url = http::getSelfURI();
|
||||||
|
|
||||||
|
# If theme setting is already present in URL, we will replace its value
|
||||||
|
$replace = preg_match('/(\\?|&)theme\\=[^&]*/',$e_url);
|
||||||
|
|
||||||
|
# URI extension to send theme setting by query string
|
||||||
|
if ($replace) {
|
||||||
|
$ext = '';
|
||||||
|
}
|
||||||
|
elseif (strpos($e_url,'?') === false) {
|
||||||
|
$ext = '?theme=';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ext = (substr($e_url,-1) == '?' ? '' : '&').'theme=';
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
foreach ($names as $k=>$v)
|
||||||
|
{
|
||||||
|
if ($k == $GLOBALS['__theme']) {
|
||||||
|
$format = $cfg['a_html'];
|
||||||
|
} else {
|
||||||
|
$format = $cfg['e_html'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($replace) {
|
||||||
|
$e_url = preg_replace(
|
||||||
|
'/(\\?|&)(theme\\=)([^&]*)/',
|
||||||
|
'$1${2}'.addcslashes($k,'$\\'),
|
||||||
|
$e_url);
|
||||||
|
$val = '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$val = html::escapeHTML(rawurlencode($k));
|
||||||
|
}
|
||||||
|
$res .= sprintf($format,
|
||||||
|
$e_url,$ext,$val,
|
||||||
|
html::escapeHTML($v['name']),
|
||||||
|
html::escapeHTML($v['desc']),
|
||||||
|
html::escapeHTML($k));
|
||||||
|
}
|
||||||
|
|
||||||
|
# Nothing to display
|
||||||
|
if (!trim($res)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = sprintf($cfg['s_html'],$s_url,$res);
|
||||||
|
|
||||||
|
if ($w) {
|
||||||
|
|
||||||
|
$res =
|
||||||
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
|
||||||
|
$res;
|
||||||
|
|
||||||
|
return $w->renderDiv($w->content_only,'arlequin '.$w->class,'',$res);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNames()
|
||||||
|
{
|
||||||
|
global $core;
|
||||||
|
|
||||||
|
$mt_exclude = $core->blog->settings->multitheme->mt_exclude;
|
||||||
|
$exclude = array();
|
||||||
|
if (!empty($mt_exclude)) {
|
||||||
|
$exclude = array_flip(explode('/',$core->blog->settings->multitheme->mt_exclude));
|
||||||
|
}
|
||||||
|
|
||||||
|
$names = array_diff_key($core->themes->getModules(),$exclude);
|
||||||
|
|
||||||
|
return empty($names) ? false : $names;
|
||||||
|
}
|
||||||
|
}
|
73
_widgets.php
Normal file
73
_widgets.php
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
<?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007-2015 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
if (!defined('DC_RC_PATH')) { return; }
|
||||||
|
|
||||||
|
$core->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'=>'<li><a href="%1$s%2$s%3$s">%4$s</a></li>',
|
||||||
|
'a_html'=>'<li><strong>%4$s</strong></li>',
|
||||||
|
's_html'=>'<ul>%2$s</ul>');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadSettings($settings,&$initialized)
|
||||||
|
{
|
||||||
|
global $core;
|
||||||
|
|
||||||
|
$initialized = false;
|
||||||
|
$mt_cfg = @unserialize($settings->multitheme->get('mt_cfg'));
|
||||||
|
$mt_exclude = $settings->multitheme->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('multitheme');
|
||||||
|
$settings->multitheme->put('mt_cfg',serialize($mt_cfg),'string','Arlequin configuration');
|
||||||
|
$settings->multitheme->put('mt_exclude','customCSS','string','Excluded themes');
|
||||||
|
$initialized = true;
|
||||||
|
$core->blog->triggerBlog();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($mt_cfg,$mt_exclude);
|
||||||
|
}
|
||||||
|
}
|
BIN
icon-big.png
Normal file
BIN
icon-big.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
icon.png
Normal file
BIN
icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 867 B |
141
index.php
Normal file
141
index.php
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
<?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2015 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
if (!defined('DC_CONTEXT_ADMIN')) { return; }
|
||||||
|
|
||||||
|
$page_title = __('Arlequin');
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
include dirname(__FILE__).'/models.php';
|
||||||
|
|
||||||
|
$messages = array();
|
||||||
|
|
||||||
|
/* Initialisation
|
||||||
|
--------------------------------------------------- */
|
||||||
|
|
||||||
|
$core->blog->settings->addNameSpace('multitheme');
|
||||||
|
list($mt_cfg,$mt_exclude) =
|
||||||
|
adminArlequin::loadSettings ($core->blog->settings,$initialized);
|
||||||
|
|
||||||
|
/* Enregistrement des données depuis les formulaires
|
||||||
|
--------------------------------------------------- */
|
||||||
|
|
||||||
|
if (isset($_POST['mt_action_config']))
|
||||||
|
{
|
||||||
|
$mt_cfg['e_html'] = $_POST['e_html'];
|
||||||
|
$mt_cfg['a_html'] = $_POST['a_html'];
|
||||||
|
$mt_cfg['s_html'] = $_POST['s_html'];
|
||||||
|
$mt_exclude = $_POST['mt_exclude'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Traitement des requêtes
|
||||||
|
--------------------------------------------------- */
|
||||||
|
|
||||||
|
if (isset($_POST['mt_action_config']))
|
||||||
|
{
|
||||||
|
$core->blog->settings->multitheme->put('mt_cfg',serialize($mt_cfg));
|
||||||
|
$core->blog->settings->multitheme->put('mt_exclude',$mt_exclude);
|
||||||
|
$messages[] = __('Settings have been successfully updated.');
|
||||||
|
$core->blog->triggerBlog();
|
||||||
|
http::redirect($p_url.'&config=1');
|
||||||
|
}
|
||||||
|
if (isset($_POST['mt_action_restore']))
|
||||||
|
{
|
||||||
|
$core->blog->settings->multitheme->drop('mt_cfg');
|
||||||
|
$core->blog->settings->multitheme->drop('mt_exclude');
|
||||||
|
$core->blog->triggerBlog();
|
||||||
|
http::redirect($p_url.'&restore=1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
$core->error->add($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DISPLAY
|
||||||
|
--------------------------------------------------- */
|
||||||
|
|
||||||
|
if ($initialized) {
|
||||||
|
$messages[] = __('Settings have been reinitialized.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Headers
|
||||||
|
|
||||||
|
$jsModels = ''; $cslashes = "\n\"\'";
|
||||||
|
foreach ($mt_models as $m)
|
||||||
|
{
|
||||||
|
$jsModels .= "\t".
|
||||||
|
'arlequin.addModel('.
|
||||||
|
'"'.html::escapeJS($m['name']).'",'.
|
||||||
|
'"'.addcslashes($m['s_html'],$cslashes).'",'.
|
||||||
|
'"'.addcslashes($m['e_html'],$cslashes).'",'.
|
||||||
|
'"'.addcslashes($m['a_html'],$cslashes).'"'.
|
||||||
|
");\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<html><head>
|
||||||
|
<title>'.$page_title.'</title>'.
|
||||||
|
dcPage::jsLoad('index.php?pf=arlequin/js/models.js').'
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
arlequin.msg.predefined_models = "'.html::escapeJS(__('Predefined models')).'";
|
||||||
|
arlequin.msg.select_model = "'.html::escapeJS(__('Select a model')).'";
|
||||||
|
arlequin.msg.user_defined = "'.html::escapeJS(__('User defined')).'";
|
||||||
|
$(function() {
|
||||||
|
arlequin.addDefault();
|
||||||
|
'.$jsModels.'
|
||||||
|
});
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
</head><body>'.
|
||||||
|
dcPage::breadcrumb(
|
||||||
|
array(
|
||||||
|
html::escapeHTML($core->blog->name) => '',
|
||||||
|
'<span class="page-title">'.$page_title.'</span>' => ''
|
||||||
|
));
|
||||||
|
|
||||||
|
// Messages
|
||||||
|
if (!empty($_GET['config'])) {
|
||||||
|
dcPage::success(__('Settings have been successfully updated.'));
|
||||||
|
}
|
||||||
|
if (!empty($_GET['restore'])) {
|
||||||
|
dcPage::success(__('Settings have been reinitialized.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
echo
|
||||||
|
'<form action="'.$p_url.'" method="post">
|
||||||
|
<div class="fieldset two-cols"><h4>'.__('Switcher display format').'</h4>
|
||||||
|
<div id="models"></div>
|
||||||
|
<p class="col"><label for="s_html">'.__('Switcher HTML code:').'</label> '.
|
||||||
|
form::textArea('s_html',50,10,html::escapeHTML($mt_cfg['s_html'])).'</p>
|
||||||
|
<div class="col">
|
||||||
|
<p><label>'.__('Item HTML code:').' '.
|
||||||
|
form::field('e_html',35,'',html::escapeHTML($mt_cfg['e_html'])).'</label></p>
|
||||||
|
<p><label>'.__('Active item HTML code:').' '.
|
||||||
|
form::field('a_html',35,'',html::escapeHTML($mt_cfg['a_html'])).'</label></p>
|
||||||
|
</div><br class="clear" />
|
||||||
|
|
||||||
|
<p><label>'.__('Excluded themes (separated by slashs \'/\'):').' '.
|
||||||
|
form::field(array('mt_exclude'),40,'',html::escapeHTML($mt_exclude)).'</label></p>
|
||||||
|
</div>
|
||||||
|
<p><input type="submit" name="mt_action_config" value="'.__('Update').'" />
|
||||||
|
<input type="submit" name="mt_action_restore" value="'.__('Restore defaults').'" />'.
|
||||||
|
(is_callable(array($core,'formNonce')) ? $core->formNonce() : '').'</p>
|
||||||
|
</form>';
|
||||||
|
|
||||||
|
dcPage::helpBlock('arlequin'); ?>
|
||||||
|
</body></html>
|
82
js/models.js
Normal file
82
js/models.js
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/* -*- tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2015 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
|
||||||
|
var arlequin = {
|
||||||
|
msg : {
|
||||||
|
predefined_models : 'Generic models',
|
||||||
|
select_model : 'Select a generic model:',
|
||||||
|
user_defined : 'User defined'
|
||||||
|
},
|
||||||
|
|
||||||
|
models : Array(),
|
||||||
|
|
||||||
|
addModel : function(model_name, s_html, e_html, a_html) {
|
||||||
|
model = new Array(model_name,s_html,e_html,a_html);
|
||||||
|
arlequin.models.push(model);
|
||||||
|
},
|
||||||
|
|
||||||
|
addDefault : function() {
|
||||||
|
arlequin.addModel(arlequin.msg.user_defined,
|
||||||
|
$("#s_html").val(),
|
||||||
|
$("#e_html").val(),
|
||||||
|
$("#a_html").val());
|
||||||
|
},
|
||||||
|
|
||||||
|
drawInterface : function() {
|
||||||
|
if (!arlequin.models.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = '';
|
||||||
|
res += '<p>'+arlequin.msg.select_model+' ';
|
||||||
|
res += '<select id="mt_model">';
|
||||||
|
for (i in arlequin.models) {
|
||||||
|
res += '<option value="'+i+'">'
|
||||||
|
+ arlequin.models[i][0]+'</option>';
|
||||||
|
}
|
||||||
|
res += '</select>';
|
||||||
|
res += '</p>';
|
||||||
|
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
|
||||||
|
selectModel : function(id) {
|
||||||
|
if (!arlequin.models[id]) { return; }
|
||||||
|
|
||||||
|
$("#s_html").val(arlequin.models[id][1]);
|
||||||
|
$("#e_html").val(arlequin.models[id][2]);
|
||||||
|
$("#a_html").val(arlequin.models[id][3]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
if (!document.getElementById || !document.getElementById('models')) { return; }
|
||||||
|
|
||||||
|
var c = $('#models');
|
||||||
|
c.html('<p><a id="model-control" class="form-control" style="display:inline;" href="#">'+
|
||||||
|
arlequin.msg.predefined_models+'</a></p>');
|
||||||
|
|
||||||
|
$('#model-control').click(function() {
|
||||||
|
c.html(arlequin.drawInterface());
|
||||||
|
|
||||||
|
$('#mt_model').change(function() {
|
||||||
|
arlequin.selectModel(this.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
55
locales/en/help/arlequin.html
Normal file
55
locales/en/help/arlequin.html
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Aide Arlequin</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h4>Inserting the theme selector in the blog interface</h4>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>With a widget</dt>
|
||||||
|
<dd>The easiest way is to use the <em>Theme Selector</em>
|
||||||
|
<a href="plugin.php?p=widgets">widget</a> that displays a list of available themes.</dd>
|
||||||
|
|
||||||
|
<dt>In the template file</dt>
|
||||||
|
<dd>The switch can also be integrated into the blog interface by editing your
|
||||||
|
template file. Simply add the <code>{{tpl:themesList}}</code> instruction in
|
||||||
|
the desired location.</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4>Understanding Models</h4>
|
||||||
|
<p>Arlequin is notable for its flexible configuration, due to the concept of
|
||||||
|
<em>models</em> that create their own interfaces for the theme selector.</p>
|
||||||
|
<p>The information needed to operate the theme selector contained in variables
|
||||||
|
of the form <strong>%n$s</strong> where <strong>n</strong> is an integer
|
||||||
|
denoting a variable.</p>
|
||||||
|
<p>Here is the list of variables that you can use:</p>
|
||||||
|
<dl>
|
||||||
|
<dt>In switcher HTML code</dt>
|
||||||
|
<dd><table><thead>
|
||||||
|
<tr><th>Variable</th><th>Meaning</th></tr>
|
||||||
|
</thead><tbody class="noborder">
|
||||||
|
<tr><th>%1$s</th><td>Current page URL</td></tr>
|
||||||
|
<tr><th>%2$s</th><td>Items HTML code</td></tr>
|
||||||
|
</tbody></table></dd>
|
||||||
|
|
||||||
|
<dt>In items HTML code</dt>
|
||||||
|
<dd><table><thead>
|
||||||
|
<tr><th>Variable</th><th>Meaning</th></tr>
|
||||||
|
</thead><tbody class="noborder">
|
||||||
|
<tr><th>%1$s</th><td>Current page URL</td></tr>
|
||||||
|
<tr><th>%2$s</th><td>A suffix to send theme setting through URL, e.g. "<strong>&theme=</strong>"</td></tr>
|
||||||
|
<tr><th>%3$s</th><td>Theme identifier <em>only to be used in a URL</em></td></tr>
|
||||||
|
<tr><th>%4$s</th><td>Theme name</td></tr>
|
||||||
|
<tr><th>%5$s</th><td>Theme description</td></tr>
|
||||||
|
<tr><th>%6$s</th><td>Theme identifier</td></tr>
|
||||||
|
</tbody></table></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4>Add your own predefined templates</h4>
|
||||||
|
<p>If you are the administrator of a platform of blogs, you can change the
|
||||||
|
predefined templates by editing the file <strong>plugins/arlequin/models.php</strong>.</p>
|
||||||
|
<p><strong>Suggestion</strong>: some interesting models can be created in
|
||||||
|
association with JavaScript or CSS property, changing your themes.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
20
locales/en/resources.php
Normal file
20
locales/en/resources.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2010 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
|
||||||
|
if (!isset($__resources['help']['arlequin']))
|
||||||
|
{
|
||||||
|
$__resources['help']['arlequin'] = dirname(__FILE__).'/help/arlequin.html';
|
||||||
|
}
|
57
locales/fr/help/arlequin.html
Normal file
57
locales/fr/help/arlequin.html
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Aide Arlequin</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h4>Insertion du sélecteur de thème dans l'interface du blog</h4>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt>Avec un widget</dt>
|
||||||
|
<dd>Le plus simple est d'utiliser le <a href="plugin.php?p=widgets">widget</a>
|
||||||
|
<em>Sélecteur de thème</em> qui affiche la liste des thèmes disponibles.</dd>
|
||||||
|
|
||||||
|
<dt>Dans le fichier template</dt>
|
||||||
|
<dd>Le sélecteur peut aussi être intégré dans l'interface du blog en éditant
|
||||||
|
directement votre fichier template. Il suffit pour cela d'ajouter l'instruction
|
||||||
|
<code>{{tpl:themesList}}</code> à l'endroit voulu.</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4>Comprendre les modèles</h4>
|
||||||
|
<p>Arlequin est remarquable pour sa souplesse de configuration, due à la notion
|
||||||
|
de <em>modèles</em> qui permettent de créer ses propres interfaces pour le
|
||||||
|
sélecteur de thème.</p>
|
||||||
|
<p>Les informations nécessaires au fonctionnement du sélecteur de thème sont
|
||||||
|
contenues dans des variables de la forme <strong>%n$s</strong> où <strong>n</strong>
|
||||||
|
est un entier désignant une variable.</p>
|
||||||
|
<p>Voici la liste des variables que vous pouvez utiliser :</p>
|
||||||
|
<dl>
|
||||||
|
<dt>Dans le code HTML du sélecteur</dt>
|
||||||
|
<dd><table><thead>
|
||||||
|
<tr><th>Variable</th><th>Signification</th></tr>
|
||||||
|
</thead><tbody class="noborder">
|
||||||
|
<tr><th>%1$s</th><td>L'adresse URL de la page courante</td></tr>
|
||||||
|
<tr><th>%2$s</th><td>Le code HTML des items</td></tr>
|
||||||
|
</tbody></table></dd>
|
||||||
|
|
||||||
|
<dt>Dans le code HTML des items</dt>
|
||||||
|
<dd><table><thead>
|
||||||
|
<tr><th>Variable</th><th>Signification</th></tr>
|
||||||
|
</thead><tbody class="noborder">
|
||||||
|
<tr><th>%1$s</th><td>L'adresse URL de la page courante</td></tr>
|
||||||
|
<tr><th>%2$s</th><td>Un suffixe pour envoyer le paramètre du thème à travers
|
||||||
|
l'URL, p. ex. "<strong>&theme=</strong>"</td></tr>
|
||||||
|
<tr><th>%3$s</th><td>L'identifiant du thème <em>à utiliser uniquement dans une URL</em></td></tr>
|
||||||
|
<tr><th>%4$s</th><td>Le nom du thème</td></tr>
|
||||||
|
<tr><th>%5$s</th><td>La description du thème</td></tr>
|
||||||
|
<tr><th>%6$s</th><td>L'identifiant du thème</td></tr>
|
||||||
|
</tbody></table></dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4>Ajouter ses propres modèles prédéfinis</h4>
|
||||||
|
<p>Si vous êtes l'administrateur d'une plate-forme de blogs, vous pouvez modifier
|
||||||
|
les modèles prédéfinis en éditant le fichier <strong>plugins/arlequin/models.php</strong>.</p>
|
||||||
|
<p><strong>Conseil</strong> : des modèles assez intéressants peuvent être créés
|
||||||
|
en association avec du JavaScript ou avec des propriétés CSS, en modifiant vos thèmes.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
91
locales/fr/main.po
Normal file
91
locales/fr/main.po
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Project-Id-Version: Dotclear 2 Arlequin v1.1 module\n"
|
||||||
|
"POT-Creation-Date: \n"
|
||||||
|
"PO-Revision-Date: 2009-10-20 21:01+0100\n"
|
||||||
|
"Last-Translator: brol <contact@brol.info>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Poedit-Language: French\n"
|
||||||
|
"X-Poedit-KeywordsList: __\n"
|
||||||
|
"X-Poedit-Basepath: ../..\n"
|
||||||
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
|
||||||
|
#: models.php:32
|
||||||
|
msgid "Bullets list"
|
||||||
|
msgstr "Liste à puces"
|
||||||
|
|
||||||
|
#: models.php:39
|
||||||
|
msgid "Scrolled list"
|
||||||
|
msgstr "Liste déroulante"
|
||||||
|
|
||||||
|
#: models.php:48
|
||||||
|
msgid "active theme"
|
||||||
|
msgstr "thème actif"
|
||||||
|
|
||||||
|
#: forms.php:22
|
||||||
|
msgid "Switcher display format"
|
||||||
|
msgstr "Format d'affichage du sélecteur"
|
||||||
|
|
||||||
|
#: forms.php:24
|
||||||
|
msgid "Switcher HTML code:"
|
||||||
|
msgstr "Code HTML du sélecteur :"
|
||||||
|
|
||||||
|
#: forms.php:27
|
||||||
|
msgid "Item HTML code:"
|
||||||
|
msgstr "Code HTML d'un item :"
|
||||||
|
|
||||||
|
#: forms.php:29
|
||||||
|
msgid "Active item HTML code:"
|
||||||
|
msgstr "Code HTML d'un item actif :"
|
||||||
|
|
||||||
|
#: forms.php:35
|
||||||
|
msgid "Excluded themes (separated by slashs '/'):"
|
||||||
|
msgstr "Thèmes exclus (séparés par des slashs \"/\") :"
|
||||||
|
|
||||||
|
#: forms.php:38
|
||||||
|
msgid "Update"
|
||||||
|
msgstr "Mettre à jour"
|
||||||
|
|
||||||
|
#: forms.php:39
|
||||||
|
msgid "Restore defaults"
|
||||||
|
msgstr "Réinitialiser les paramètres"
|
||||||
|
|
||||||
|
#: _admin.php:18
|
||||||
|
#: _admin.php:29
|
||||||
|
msgid "Theme switcher"
|
||||||
|
msgstr "Sélecteur de thème"
|
||||||
|
|
||||||
|
#: _admin.php:32
|
||||||
|
msgid "Choose a theme"
|
||||||
|
msgstr "Choisissez un thème"
|
||||||
|
|
||||||
|
#: index.php:51
|
||||||
|
msgid "Settings have been successfully updated."
|
||||||
|
msgstr "Les paramètres ont été mis à jour avec succès."
|
||||||
|
|
||||||
|
#: index.php:71
|
||||||
|
msgid "Settings have been reinitialized."
|
||||||
|
msgstr "Les paramètres ont été réinitialisés."
|
||||||
|
|
||||||
|
#: index.php:18
|
||||||
|
msgid "Arlequin - theme switcher configuration"
|
||||||
|
msgstr "Arlequin - configuration du sélecteur de thème"
|
||||||
|
|
||||||
|
#: index.php:95
|
||||||
|
msgid "Predefined models"
|
||||||
|
msgstr "Modèles prédéfinis"
|
||||||
|
|
||||||
|
#: index.php:96
|
||||||
|
msgid "Select a model"
|
||||||
|
msgstr "Sélectionnez un modèle"
|
||||||
|
|
||||||
|
#: index.php:97
|
||||||
|
msgid "User defined"
|
||||||
|
msgstr "Défini par l'utilisateur"
|
||||||
|
|
||||||
|
msgid "Allows visitors choose a theme"
|
||||||
|
msgstr "Permettre aux visiteurs de choisir un thème"
|
||||||
|
|
20
locales/fr/resources.php
Normal file
20
locales/fr/resources.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2010 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
|
||||||
|
if (!isset($__resources['help']['arlequin']))
|
||||||
|
{
|
||||||
|
$__resources['help']['arlequin'] = dirname(__FILE__).'/help/arlequin.html';
|
||||||
|
}
|
49
models.php
Normal file
49
models.php
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||||
|
/***************************************************************\
|
||||||
|
* This is 'Arlequin', a plugin for Dotclear 2 *
|
||||||
|
* *
|
||||||
|
* Copyright (c) 2007,2015 *
|
||||||
|
* Oleksandr Syenchuk and contributors. *
|
||||||
|
* *
|
||||||
|
* This is an open source software, distributed under the GNU *
|
||||||
|
* General Public License (version 2) terms and conditions. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public *
|
||||||
|
* License along with 'Arlequin' (see COPYING.txt); *
|
||||||
|
* if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
|
\***************************************************************/
|
||||||
|
|
||||||
|
$mt_models = array();
|
||||||
|
|
||||||
|
/** Syntaxe pour ajouter vos propres modèles prédéfinis :
|
||||||
|
|
||||||
|
$mt_models[] = array(
|
||||||
|
'name'=>__('Model name'), // Nom du modèle prédéfini, éventuellement
|
||||||
|
// traduit dans un fichier de langue
|
||||||
|
's_html'=>'[HTML code]', // Code HTML du sélecteur de thème
|
||||||
|
'e_html'=>'[HTML code]', // Code HTML d'un item pouvant être sélectionné
|
||||||
|
'a_html'=>'[HTML code]' // Code HTML d'un item actif (thème sélectionné)
|
||||||
|
);
|
||||||
|
|
||||||
|
//*/
|
||||||
|
|
||||||
|
$mt_models[] = array(
|
||||||
|
'name'=>__('Bullets list'),
|
||||||
|
's_html'=>'<ul>%2$s</ul>',
|
||||||
|
'e_html'=>'<li><a href="%1$s%2$s%3$s">%4$s</a></li>',
|
||||||
|
'a_html'=>'<li><strong>%4$s</strong></li>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$mt_models[] = array(
|
||||||
|
'name'=>__('Scrolled list'),
|
||||||
|
's_html'=>
|
||||||
|
'<form action="%1$s" method="post">'."\n".
|
||||||
|
'<p><select name="theme">'."\n".
|
||||||
|
'%2$s'."\n".
|
||||||
|
'</select>'."\n".
|
||||||
|
'<input type="submit" value="'.__('ok').'"/></p>'."\n".
|
||||||
|
'</form>',
|
||||||
|
'e_html'=>'<option value="%3$s">%4$s</option>',
|
||||||
|
'a_html'=>'<option value="%3$s" selected="selected" disabled="disabled">%4$s ('.__('active theme').')</option>'
|
||||||
|
);
|
Loading…
Reference in a new issue