コード例 #1
0
ファイル: _public.php プロジェクト: HackerMajor/root
 public static function widgetsHandler($type)
 {
     $wtype = 'widgets_' . $type;
     $widgets = $GLOBALS['core']->blog->settings->{$wtype};
     if (!$widgets) {
         // If widgets value is empty, get defaults
         $widgets = self::defaultWidgets($type);
     } else {
         // Otherwise, load widgets
         $widgets = dcWidgets::load($widgets);
     }
     if ($widgets->isEmpty()) {
         // Widgets are empty, don't show anything
         return;
     }
     foreach ($widgets->elements() as $k => $w) {
         echo $w->call($k);
     }
 }
コード例 #2
0
ファイル: _public.php プロジェクト: nikrou/dotclear
 public static function ifWidgetsHandler($type, $disable = '')
 {
     $wtype = 'widgets_' . $type;
     $GLOBALS['core']->blog->settings->addNameSpace('widgets');
     $widgets = $GLOBALS['core']->blog->settings->widgets->{$wtype};
     if (!$widgets) {
         // If widgets value is empty, get defaults
         $widgets = self::defaultWidgets($type);
     } else {
         // Otherwise, load widgets
         $widgets = dcWidgets::load($widgets);
     }
     return !$widgets->isEmpty();
 }
コード例 #3
0
ファイル: _default_widgets.php プロジェクト: nikrou/dotclear
#
# This file is part of Dotclear 2.
#
# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
if (!defined('DC_RC_PATH')) {
    return;
}
require dirname(__FILE__) . '/class.widgets.php';
# Available widgets
global $__widgets;
$__widgets = new dcWidgets();
$__widgets->create('search', __('Search engine'), array('defaultWidgets', 'search'), null, 'Search engine form');
$__widgets->search->setting('title', __('Title (optional)') . ' :', __('Search'));
$__widgets->search->setting('homeonly', __('Display on:'), 0, 'combo', array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
$__widgets->search->setting('content_only', __('Content only'), 0, 'check');
$__widgets->search->setting('class', __('CSS class:'), '');
$__widgets->search->setting('offline', __('Offline'), 0, 'check');
$__widgets->create('navigation', __('Navigation links'), array('defaultWidgets', 'navigation'), null, 'List of navigation links');
$__widgets->navigation->setting('title', __('Title (optional)') . ' :', '');
$__widgets->navigation->setting('homeonly', __('Display on:'), 0, 'combo', array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
$__widgets->navigation->setting('content_only', __('Content only'), 0, 'check');
$__widgets->navigation->setting('class', __('CSS class:'), '');
$__widgets->navigation->setting('offline', __('Offline'), 0, 'check');
$__widgets->create('bestof', __('Selected entries'), array('defaultWidgets', 'bestof'), null, 'List of selected entries');
$__widgets->bestof->setting('title', __('Title (optional)') . ' :', __('Best of me'));
$__widgets->bestof->setting('orderby', __('Sort:'), 'asc', 'combo', array(__('Ascending') => 'asc', __('Descending') => 'desc'));
コード例 #4
0
ファイル: index.php プロジェクト: HackerMajor/root
        foreach ($_POST['w'] as $nsid => $nsw) {
            foreach ($nsw as $i => $v) {
                if (!empty($v['_rem'])) {
                    unset($_POST['w'][$nsid][$i]);
                    continue;
                }
            }
        }
        if (!isset($_POST['w']['nav'])) {
            $_POST['w']['nav'] = array();
        }
        if (!isset($_POST['w']['extra'])) {
            $_POST['w']['extra'] = array();
        }
        $widgets_nav = dcWidgets::loadArray($_POST['w']['nav'], $__widgets);
        $widgets_extra = dcWidgets::loadArray($_POST['w']['extra'], $__widgets);
        $core->blog->settings->setNameSpace('widgets');
        $core->blog->settings->put('widgets_nav', $widgets_nav->store());
        $core->blog->settings->put('widgets_extra', $widgets_extra->store());
        $core->blog->triggerBlog();
        http::redirect($p_url);
    } catch (Exception $e) {
        $core->error->add($e->getMessage());
    }
} elseif (!empty($_POST['wreset'])) {
    try {
        $core->blog->settings->setNameSpace('widgets');
        $core->blog->settings->put('widgets_nav', '');
        $core->blog->settings->put('widgets_extra', '');
        $core->blog->triggerBlog();
        http::redirect($p_url);
コード例 #5
0
ファイル: _install.php プロジェクト: nikrou/dotclear
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
    return;
}
$version = $core->plugins->moduleInfo('widgets', 'version');
if (version_compare($core->getVersion('widgets'), $version, '>=')) {
    return;
}
require dirname(__FILE__) . '/_default_widgets.php';
$settings =& $core->blog->settings;
$settings->addNamespace('widgets');
if ($settings->widgets->widgets_nav != null) {
    $settings->widgets->put('widgets_nav', dcWidgets::load($settings->widgets->widgets_nav)->store());
} else {
    $settings->widgets->put('widgets_nav', '', 'string', 'Navigation widgets', false);
}
if ($settings->widgets->widgets_extra != null) {
    $settings->widgets->put('widgets_extra', dcWidgets::load($settings->widgets->widgets_extra)->store());
} else {
    $settings->widgets->put('widgets_extra', '', 'string', 'Extra widgets', false);
}
if ($settings->widgets->widgets_custom != null) {
    $settings->widgets->put('widgets_custom', dcWidgets::load($settings->widgets->widgets_custom)->store());
} else {
    $settings->widgets->put('widgets_custom', '', 'string', 'Custom widgets', false);
}
$core->setVersion('widgets', $version);
return true;
コード例 #6
0
ファイル: _default_widgets.php プロジェクト: HackerMajor/root
#
# This file is part of Dotclear 2.
#
# Copyright (c) 2003-2009 Olivier Meunier and contributors
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
    return;
}
require dirname(__FILE__) . '/class.widgets.php';
# Available widgets
global $__widgets;
$__widgets = new dcWidgets();
$__widgets->create('search', __('Search engine'), array('defaultWidgets', 'search'));
$__widgets->search->setting('title', __('Title:'), __('Search'));
$__widgets->create('navigation', __('Navigation links'), array('defaultWidgets', 'navigation'));
$__widgets->navigation->setting('title', __('Title:'), '');
$__widgets->create('bestof', __('Selected entries'), array('defaultWidgets', 'bestof'));
$__widgets->bestof->setting('title', __('Title:'), __('Best of me'));
$__widgets->bestof->setting('homeonly', __('Home page only'), 1, 'check');
$__widgets->create('langs', __('Blog languages'), array('defaultWidgets', 'langs'));
$__widgets->langs->setting('title', __('Title:'), __('Languages'));
$__widgets->langs->setting('homeonly', __('Home page only'), 1, 'check');
$__widgets->create('categories', __('Categories list'), array('defaultWidgets', 'categories'));
$__widgets->categories->setting('title', __('Title:'), __('Categories'));
$__widgets->categories->setting('postcount', __('With entries counts'), 0, 'check');
$__widgets->create('subscribe', __('Subscribe links'), array('defaultWidgets', 'subscribe'));
$__widgets->subscribe->setting('title', __('Title:'), __('Subscribe'));