PLUGIN_ACTIVE, 'eventh' => PLUGIN_INACTIVE ); global $serendipity; $sql_filter = ''; if (is_array($sidebars)) { foreach($sidebars AS $sidebar) { $up = strtoupper($sidebar); if ($sidebar == 'hide') { $opts[$sidebar] = HIDDEN; } elseif (defined('SIDEBAR_' . $up)) { $opts[$sidebar] = constant('SIDEBAR_' . $up); } elseif (defined($up)) { $opts[$sidebar] = constant($up); } else { $opts[$sidebar] = $up; } $sql_filter .= "AND placement != '" . serendipity_db_escape_string($sidebar) . "' "; } } if (!$event_only) { $sql = "SELECT * from {$serendipity['dbPrefix']}plugins WHERE placement != 'event' AND placement != 'eventh' " . $sql_filter; $invisible_plugins = serendipity_db_query($sql); if (is_array($invisible_plugins)) { $sidebars[] = 'NONE'; $opts['NONE'] = NONE; } } $eyecandy = !isset($serendipity['eyecandy']) || serendipity_db_bool($serendipity['eyecandy']); if (!$eyecandy) { echo '
'; } elseif (!$event_only) { echo ''; echo ' '; echo ' '; } else { echo ''; echo ' '; echo ' '; } echo serendipity_setFormToken(); ?> '; echo '
' . $ptitle . '
'; echo '
    '; if ($is_invisible) { $plugins = $invisible_plugins; } else { $plugins = serendipity_plugin_api::enum_plugins($plugin_placement); } if (!is_array($plugins)) { continue; } $sort_idx = 0; foreach ($plugins as $plugin_data) { $total++; $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid']); $key = urlencode($plugin_data['name']); $css_key = 's9ycid' . str_replace('%', '-', $key); $is_plugin_owner = ($plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers')); $is_plugin_editable = ($is_plugin_owner || $plugin_data['authorid'] == '0'); if (!is_object($plugin)) { $name = $title = ERROR . '!'; $desc = ERROR . ': ' . $plugin_data['name']; $can_configure = false; } else { /* query for its name, description and configuration data */ $bag = new serendipity_property_bag; $plugin->introspect($bag); $name = htmlspecialchars($bag->get('name')); $desc = htmlspecialchars($bag->get('description')); $desc .= '
    ' . VERSION . ': ' . $bag->get('version') . ''; $title = serendipity_plugin_api::get_plugin_title($plugin, '[' . $name . ']'); if ($bag->is_set('configuration') && ($plugin->protected === FALSE || $plugin_data['authorid'] == '0' || $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'))) { $can_configure = true; } else { $can_configure = false; } } if ($event_only) { $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable, true, $opts); $event_only_uri = '&serendipity[event_plugin]=true'; } else { $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable, false, $opts); $event_only_uri = ''; } /* Only display UP/DOWN links if there's somewhere for the plugin to go */ if ($sort_idx == 0) { $moveup = ' '; } else { $moveup = '' . UP . ''; } if ($sort_idx == (count($plugins)-1)) { $movedown = ' '; } else { $movedown = ($moveup != '' ? ' ' : '') . ''. DOWN .''; } ?>
  1. [C]
    ' : ''); ?>
    ' : ''); ?>
  2. '; } ?>

LEFT, 'right' => RIGHT, 'hide' => HIDDEN ); } static $event_opts = array( 'event' => PLUGIN_ACTIVE, 'eventh' => PLUGIN_INACTIVE, ); if ($is_event) { $gopts =& $event_opts; } else { $gopts =& $opts; } $x = "\n\n"; } /** * Show a placement box on where to move a sidebar plugin to * * @access public * @param object A plugin object * @param object The plugins property bag object * @param string The name of the plugin * @param string The description of the plugin * @param array The property bag 'configuration' array, holding the array of config items. * @param boolean Shows the surrounding HTML table? * @param boolean Shows the FORM submit button? * @param boolean Shows a plugin's "example" method output? * @param boolean Spawn a plugins' configuration WYSIWYG items? * @param string The array index name of POSTed values ($serendipity['POST'][xxx]) * @return boolean */ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_names, $showTable = true, $showSubmit = true, $showExample = true, $spawnNuggets = true, $postKey = 'plugin') { global $serendipity; if (empty($config_names)) { return false; } if ($showSubmit && $postKey != 'plugin') { ?>
introspect_config_item($config_item, $cbag); $cname = htmlspecialchars($cbag->get('name')); $cdesc = htmlspecialchars($cbag->get('description')); $value = $plugin->get_config($config_item, 'unset'); $lang_direction = htmlspecialchars($cbag->get('lang_direction')); if (empty($lang_direction)) { $lang_direction = LANG_DIRECTION; } /* Apparently no value was set for this config item */ if ($value === 'unset') { /* Try and the default value for the config item */ $value = $cbag->get('default'); /* Still, we don't have a value, try and get (bool)false - from an old plugin */ if ($value === '') { $value = $plugin->get_config($config_item, false, true); } } if (isset($_POST['serendipity'][$postkey][$config_item])) { if (is_array($_POST['serendipity'][$postkey][$config_item])) { $hvalue = $_POST['serendipity'][$postkey][$config_item]; array_walk($hvalue, 'htmlspecialchars'); } else { $hvalue = htmlspecialchars($_POST['serendipity'][$postkey][$config_item]); } } else { $hvalue = htmlspecialchars($value); } $radio = array(); $select = array(); $per_row = null; $text_rows = null; $input_type = null; $is_multi_select = false; $ctype = $cbag->get('type'); switch ($ctype) { case 'seperator': ?> $hvalue); } $pre_selected = (array)$cbag->get('select_preselected'); $select_size = $cbag->get('select_size'); $select = $cbag->get('select_values'); ?> 0) { $radio = $cbag->get('radio'); } if (empty($per_row)) { $per_row = $cbag->get('radio_per_row'); if (empty($per_row)) { $per_row = 2; } } ?> get('input_type'); if (empty($input_type)) { $input_type = "text"; } } ?> get('rows'); if (empty($text_rows)) { $text_rows = 20; } } ?> get('type') == 'html') { $htmlnugget[] = $elcount; serendipity_emit_htmlarea_code('nuggets', 'nuggets', true); } break; case 'content': ?> EOS; $serendipity['mediajs_output'] = true; } // Print the HTML to display the popup media selector $preview_width = $cbag->get('preview_width'); if (!$preview_width || $preview_width == "") { $preview_width = '400px'; } $preview_height = $cbag->get('preview_height'); if (!$preview_height || $preview_height == "") { $preview_height = '100px'; } $media_link_text = MEDIA_LIBRARY; print << EOS; break; case 'sequence': // For the drag-n-drop to work, the list must be included in // a container (probably an
    ) that JavaScript can access // (easiest by ID), with
  1. children that have unique IDs, // and handles with ids of 'g'.$li_id. // I can't get it to work unless there's a class of // pluginmanager_container on the ol, either. // The drag-n-drop returns the list of IDs in order. $sequencejs_output = $serendipity['sequencejs_output']; if (!$sequencejs_output) { echo ''; $serendipity['sequencejs_output'] = true; } // I want this generic sequence widget to hide the ID, but // display a name or description with an optional picture. // (This would allow users to identify choices by thumbnail.) // Therefore, I need an array with keys 'id', 'display', and // 'imgurl' (or similar) to generate each list item. // Get the data we need to display the list if (!$value) { $value = $eventData['default']; } $cname = $cbag->get('name'); $cdesc = $cbag->get('description'); $checkable = $cbag->get('checkable'); /** Unordered array of values */ $items = $cbag->get('values'); if (!is_array($items)) { $items = null; } /** Array specifying order to use values in $items */ $order = null; if ($value) { $store_order = $order = explode(',', $value); } $uparrow_img = serendipity_getTemplateFile('admin/img/uparrow.png'); $downarrow_img = serendipity_getTemplateFile('admin/img/downarrow.png'); // $items is the list of things to sequence. It's not in // order, and reordering PHP arrays is problematic. So // we keep it unordered, and access its values according // to another array (appropriately named $order). if (is_array($items)) { // Allow simple value for any sequence item foreach ($items as $key => $item) { if (!is_array($item)) { // Replace this item with an empty array unset($items[$key]); $items[$item] = array(); } } // Make sure all the items are in the order list; new items // go on the end (new items could have been added without // this config item being updated) // Also fill out thumbnails and display names foreach ($items as $id => $junk) { if ($order == null) { $order = array($id); } else if (!in_array($id, $order)) { $order[] = $id; } // If there's no defined display name, default to the ID if (!isset($items[$id]['display'])) { $items[$id]['display'] = $id; } // If there's no image, we just won't display anything. } // Make sure all the items to be ordered exist! Otherwise // we could try to sequence nothing. $filtered = array(); foreach ($order as $id) { if (array_key_exists($id, $items)) { $filtered[] = $id; } } $order = $filtered; } else { // If there's nothing to sequence, make the order in // which to use them valid, but empty $order = array(); } // Start the row, add one cell for the name and description print <<
EOS; // Now add one cell for the list print << EOS; // Print the list print <<
    EOS; $sort_idx == 0; $last = count($order) - 1; foreach ($order as $id) { // Create the variables required to print this item if ($sort_idx > 0) { $swapping = $order; $temp = $swapping[(int)$sort_idx]; $swapping[(int)$sort_idx] = $swapping[(int)($sort_idx - 1)]; $swapping[(int)($sort_idx - 1)] = $temp; $oneup = implode(',' , $swapping); } if ($sort_idx < $last) { $swapping = $order; $temp = $swapping[(int)$sort_idx]; $swapping[(int)$sort_idx] = $swapping[(int)($sort_idx + 1)]; $swapping[(int)($sort_idx + 1)] = $temp; $onedown = implode(',' , $swapping); } // Print the HTML // // Set the item and its ID print '
  1. ' . "\n"; // Make a handle with ID 'g$id' print '
    ' . "\n"; if ($checkable) { print ' ' . "\n"; } // Add the item contents print ' '.$items[$id]['display'].'' . "\n"; if (isset($items[$id]['img'])) { print ' ' . "\n"; } // Luddite submit buttons (please, think of the scriptless!) print "\n"; // Close the item print '
  2. '."\n"; // Next, please $sort_idx++; } if (!is_array($items) or empty($order)) { // Print the empty message print(NONE); } // Print the Javascript to drag-n-drop the list print << function sort_${config_item}_Sequence() { //var seq = DragDrop.serData('${config_item}_group', null); var seq = DragDrop.serData(null, '${config_item}'); var start = seq.indexOf("("); var end = seq.indexOf(")"); seq = seq.slice((start + 1), end); checkable_seq = seq.split(","); out_seq = ''; for (i in checkable_seq) { if (document.getElementById('activate_' + checkable_seq[i]) && !document.getElementById('activate_' + checkable_seq[i]).checked) { continue; } else { if (out_seq != '') { out_seq += ','; } out_seq += checkable_seq[i]; } } var order = document.getElementById("${config_item}_value"); order.value = out_seq; } function init_${config_item}_Sequence() { var lst = document.getElementById("${config_item}"); DragDrop.makeListContainer(lst, '${config_item}_group'); lst.onDragOut = function() { sort_${config_item}_Sequence(); }; } addLoadEvent(init_${config_item}_Sequence); EOS; // Finish the row print << EOS; break; default: // Unknown configuration key. Let the plugin handle it. $addData = func_get_args(); $eventData = array( 'config_item' => $config_item, 'cbag' => $cbag, 'plugin' => $plugin, 'value' => $value, 'bag' => $bag, 'postKey' => $postKey ); serendipity_plugin_api::hook_event('backend_pluginconfig_' . $ctype, $eventData, $addData); break; } } if ($showTable) { ?>


 

 
$radio_value) { $id = htmlspecialchars($config_item . $radio_value); $counter++; $checked = ""; if ($radio_value == 'true' && ($hvalue === '1' || $hvalue === 'true')) { $checked = " checked"; } elseif ($radio_value == 'false' && ($hvalue === '' || $hvalue === 'false')) { $checked = " checked"; } elseif ($radio_value == $hvalue) { $checked = " checked"; } if ($counter == 1) { ?>
title="" />

 
  
get('default'); ?>
get('custom'); ?>
$cname
$cdesc
 

$media_link_text
$cname
$cdesc

example() ?>
0) { $ev = array('nuggets' => $htmlnugget, 'skip_nuggets' => false); serendipity_plugin_api::hook_event('backend_wysiwyg_nuggets', $ev); if ($ev['skip_nuggets'] === false) { ?>