blog->settings->widgets->widgets_nav) { $widgets_nav = dcWidgets::load($core->blog->settings->widgets->widgets_nav); } $widgets_extra = null; if ($core->blog->settings->widgets->widgets_extra) { $widgets_extra = dcWidgets::load($core->blog->settings->widgets->widgets_extra); } $widgets_custom = null; if ($core->blog->settings->widgets->widgets_custom) { $widgets_custom = dcWidgets::load($core->blog->settings->widgets->widgets_custom); } $append_combo = array( '-' => 0, __('navigation') => 'nav', __('extra') => 'extra', __('custom') => 'custom' ); function literalNullString($v) { if ($v == '') { return '<'.__('empty string').'>'; } return $v; } # Adding widgets to sidebars if (!empty($_POST['append']) && is_array($_POST['addw'])) { # Filter selection $addw = array(); foreach ($_POST['addw'] as $k => $v) { if (($v == 'extra' || $v == 'nav' || $v == 'custom') && $__widgets->{$k} !== null ) { $addw[$k] = $v; } } # Append widgets if (!empty($addw)) { if (!($widgets_nav instanceof dcWidgets)) { $widgets_nav = new dcWidgets; } if (!($widgets_extra instanceof dcWidgets)) { $widgets_extra = new dcWidgets(); } if (!($widgets_custom instanceof dcWidgets)) { $widgets_custom = new dcWidgets(); } foreach ($addw as $k => $v) { switch ($v) { case 'nav': $widgets_nav->append($__widgets->{$k}); break; case 'extra': $widgets_extra->append($__widgets->{$k}); break; case 'custom': $widgets_custom->append($__widgets->{$k}); break; } } try { $core->blog->settings->addNamespace('widgets'); $core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store()); $core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store()); $core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store()); $core->blog->triggerBlog(); http::redirect($p_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } } # Update sidebars if (!empty($_POST['wup'])) { if (!isset($_POST['w']) || !is_array($_POST['w'])) { $_POST['w'] = array(); } try { # Removing mark as _rem widgets 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(); } if (!isset($_POST['w']['custom'])) { $_POST['w']['custom'] = array(); } $widgets_nav = dcWidgets::loadArray($_POST['w']['nav'],$__widgets); $widgets_extra = dcWidgets::loadArray($_POST['w']['extra'],$__widgets); $widgets_custom = dcWidgets::loadArray($_POST['w']['custom'],$__widgets); $core->blog->settings->addNamespace('widgets'); $core->blog->settings->widgets->put('widgets_nav',$widgets_nav->store()); $core->blog->settings->widgets->put('widgets_extra',$widgets_extra->store()); $core->blog->settings->widgets->put('widgets_custom',$widgets_custom->store()); $core->blog->triggerBlog(); http::redirect($p_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } elseif (!empty($_POST['wreset'])) { try { $core->blog->settings->addNamespace('widgets'); $core->blog->settings->widgets->put('widgets_nav',''); $core->blog->settings->widgets->put('widgets_extra',''); $core->blog->settings->widgets->put('widgets_custom',''); $core->blog->triggerBlog(); http::redirect($p_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } ?>
'.__('Widgets may be used to add various blocks of content to be displayed on your public pages. To add a widget, '. 'drag it from the Available widgets list on the left to one of the sidebars on the right of this page. You can order '. 'your widgets in a sidebar by dragging them up or down. You must update sidebars to apply your changes.').'
'. ''.__('Once included in a sidebar, widgets have configuration options that you can reach by clicking on the + sign next '. 'to their name.').'
'. ''.__('Reset sidebars to get back to default widgets installation.').'
'. ''.__('If you are allowed to edit your theme templates, you can directly add widgets as '. 'templates tags, with their own configuration.').'
'. ''.__('To add a widget in your template, you need to write code like this:').'
'. '<tpl:Widget id="'.__('Widget ID').'"> <setting name="'.__('Setting name').'">'.__('Setting value').'</setting> ... </tpl:Widget>'. '
'.__('Here are the following available widgets for your blog:').'
'; $widget_elements->content .= ''.__('No setting for this widget').'
'; } else { $widget_elements->content .= '0
".__('or')." 1
";
break;
case 'combo':
$s['options'] = array_map("literalNullString", $s['options']);
$s_type = __('listitem').", ".__('possible values:')." ".implode('
, ',$s['options'])."
";
break;
case 'text':
case 'textarea':
default:
$s_type = __('string');
break;
}
$widget_elements->content .=
'