| [ Index ] |
|
Code source de Serendipity 1.2 |
1 <?php # $Id: functions_entries.inc.php 435 2005-08-25 12:36:39Z garvinhicking $ 2 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) 3 # All rights reserved. See LICENSE file for licensing details 4 5 if (IN_serendipity !== true) { 6 die ("Don't hack!"); 7 } 8 9 if (defined('S9Y_FRAMEWORK_PLUGINS_ADMIN')) { 10 return; 11 } 12 @define('S9Y_FRAMEWORK_PLUGINS_ADMIN', true); 13 14 /** 15 * Returns the name of a usergroup. 16 * 17 * If a special constant is defined for the name of the group, the name has been 18 * internationalized. This applies to the Admin/Chief Editor/Editor group names, 19 * which are different for each language. If such a constant is not present, 20 * the simple name of the group will be returned. 21 * 22 * @access public 23 * @param string name of the group 24 * @return string realname of the group 25 */ 26 function serendipity_groupname($group) { 27 if (defined('PLUGIN_GROUP_' . $group)) { 28 return constant('PLUGIN_GROUP_' . $group); 29 } else { 30 return $group; 31 } 32 } 33 34 /** 35 * Sort the pluginlist by case-insensitive string functions 36 * 37 * @access public 38 * @param array Compared Plugin #1 39 * @param array Compared Plugin #2 40 * @return boolean Return code for array comparison 41 */ 42 function serendipity_pluginListSort($x, $y) { 43 return strnatcasecmp($x['name'] . ' - ' . $x['description'], $y['name'] . ' - ' . $y['description']); 44 } 45 46 /** 47 * Show the list of plugins 48 * 49 * Shows a HTML list of all installed plugins, complete with config/delete/sort order options 50 * 51 * @access public 52 * @param boolean Indicates if event plugins (TRUE) or sidebar plugins (FALSE) shall be shown 53 * @return null 54 */ 55 function show_plugins($event_only = false, $sidebars = null) 56 { 57 static $opts = array( 58 'event' => PLUGIN_ACTIVE, 59 'eventh' => PLUGIN_INACTIVE 60 ); 61 62 global $serendipity; 63 64 $sql_filter = ''; 65 if (is_array($sidebars)) { 66 foreach($sidebars AS $sidebar) { 67 $up = strtoupper($sidebar); 68 if ($sidebar == 'hide') { 69 $opts[$sidebar] = HIDDEN; 70 } elseif (defined('SIDEBAR_' . $up)) { 71 $opts[$sidebar] = constant('SIDEBAR_' . $up); 72 } elseif (defined($up)) { 73 $opts[$sidebar] = constant($up); 74 } else { 75 $opts[$sidebar] = $up; 76 } 77 $sql_filter .= "AND placement != '" . serendipity_db_escape_string($sidebar) . "' "; 78 } 79 } 80 81 if (!$event_only) { 82 $sql = "SELECT * from {$serendipity['dbPrefix']}plugins 83 WHERE placement != 'event' 84 AND placement != 'eventh' 85 " . $sql_filter; 86 $invisible_plugins = serendipity_db_query($sql); 87 if (is_array($invisible_plugins)) { 88 $sidebars[] = 'NONE'; 89 $opts['NONE'] = NONE; 90 } 91 } 92 93 $eyecandy = !isset($serendipity['eyecandy']) || serendipity_db_bool($serendipity['eyecandy']); 94 if (!$eyecandy) { 95 echo ' <form action="?serendipity[adminModule]=plugins" method="post">'; 96 } elseif (!$event_only) { 97 echo '<script type="text/javascript"> function templatePluginMoverInit() { '; 98 $is_first = true; 99 foreach($sidebars AS $sidebar) { 100 ?> 101 <?php echo ($is_first ? 'var ' : ''); ?> list = document.getElementById("<?php echo $sidebar; ?>_col"); 102 DragDrop.makeListContainer(list, 'g1'); 103 list.onDragOver = function() { this.style["border"] = "1px solid #4d759b"; }; 104 list.onDragOut = function() { this.style["border"] = "none"; }; 105 <?php 106 $is_first = false; 107 } 108 echo ' } addLoadEvent(templatePluginMoverInit);</script>'; 109 echo ' <form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSort(); return true">'; 110 echo ' <input type="hidden" name="serendipity[pluginorder]" id="order" value="" />'; 111 112 } else { 113 echo '<script type="text/javascript">addLoadEvent(pluginMoverInitEvent);</script>'; 114 echo ' <form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSortEvent(); return true">'; 115 echo ' <input type="hidden" name="serendipity[pluginorder]" id="eventorder" value="" />'; 116 } 117 118 echo serendipity_setFormToken(); 119 ?> 120 <table class="pluginmanager" border="0" cellpadding="5" cellspacing="3" width="100%"> 121 <tr> 122 <?php 123 $errors = array(); 124 125 /* Block display the plugins per placement location. */ 126 if ($event_only) { 127 $plugin_placements = array('event', 'eventh'); 128 } else { 129 $plugin_placements = $sidebars; 130 } 131 132 $total = 0; 133 foreach ($plugin_placements as $plugin_placement) { 134 if (!$event_only && $plugin_placement == 'NONE') { 135 $is_invisible = true; 136 } else { 137 $is_invisible = false; 138 } 139 $ptitle = $opts[$plugin_placement]; 140 $pid = $plugin_placement; 141 142 echo '<td class="pluginmanager_side">'; 143 echo '<div class="heading">' . $ptitle . '</div>'; 144 echo '<ol id="' . $pid . '_col" class="pluginmanager_container">'; 145 if ($is_invisible) { 146 $plugins = $invisible_plugins; 147 } else { 148 $plugins = serendipity_plugin_api::enum_plugins($plugin_placement); 149 } 150 151 if (!is_array($plugins)) { 152 continue; 153 } 154 155 $sort_idx = 0; 156 foreach ($plugins as $plugin_data) { 157 $total++; 158 $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid']); 159 $key = urlencode($plugin_data['name']); 160 $css_key = 's9ycid' . str_replace('%', '-', $key); 161 $is_plugin_owner = ($plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers')); 162 $is_plugin_editable = ($is_plugin_owner || $plugin_data['authorid'] == '0'); 163 164 if (!is_object($plugin)) { 165 $name = $title = ERROR . '!'; 166 $desc = ERROR . ': ' . $plugin_data['name']; 167 $can_configure = false; 168 } else { 169 /* query for its name, description and configuration data */ 170 171 $bag = new serendipity_property_bag; 172 $plugin->introspect($bag); 173 174 $name = htmlspecialchars($bag->get('name')); 175 $desc = htmlspecialchars($bag->get('description')); 176 $desc .= '<br />' . VERSION . ': <em>' . $bag->get('version') . '</em>'; 177 178 $title = serendipity_plugin_api::get_plugin_title($plugin, '[' . $name . ']'); 179 180 if ($bag->is_set('configuration') && ($plugin->protected === FALSE || $plugin_data['authorid'] == '0' || $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'))) { 181 $can_configure = true; 182 } else { 183 $can_configure = false; 184 } 185 } 186 187 if ($event_only) { 188 $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable, true, $opts); 189 $event_only_uri = '&serendipity[event_plugin]=true'; 190 } else { 191 $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable, false, $opts); 192 $event_only_uri = ''; 193 } 194 195 /* Only display UP/DOWN links if there's somewhere for the plugin to go */ 196 if ($sort_idx == 0) { 197 $moveup = ' '; 198 } else { 199 $moveup = '<a href="?' . serendipity_setFormToken('url') . '&serendipity[adminModule]=plugins&submit=move+up&serendipity[plugin_to_move]=' . $key . $event_only_uri . '" style="border: 0"><img src="' . serendipity_getTemplateFile('admin/img/uparrow.png') .'" height="16" width="16" border="0" alt="' . UP . '" /></a>'; 200 } 201 202 if ($sort_idx == (count($plugins)-1)) { 203 $movedown = ' '; 204 } else { 205 $movedown = ($moveup != '' ? ' ' : '') . '<a href="?' . serendipity_setFormToken('url') . '&serendipity[adminModule]=plugins&submit=move+down&serendipity[plugin_to_move]=' . $key . $event_only_uri . '" style="border: 0"><img src="' . serendipity_getTemplateFile('admin/img/downarrow.png') . '" height="16" width="16" alt="'. DOWN .'" border="0" /></a>'; 206 } 207 ?> 208 <li class="pluginmanager_item_<?php echo ($sort_idx % 2 ? 'even' : 'uneven'); ?>" id="<?php echo $css_key; ?>"> 209 <div id="g<?php echo $css_key; ?>" class="pluginmanager_grablet"> 210 <a href="#" id="grab<?php echo $css_key; ?>"></a> 211 </div> 212 <?php if ($is_plugin_editable) { ?> 213 <input class="input_checkbox" type="checkbox" name="serendipity[plugin_to_remove][]" value="<?php echo $plugin_data['name']; ?>" /> 214 <?php } ?> 215 216 <?php if ( $can_configure ) { ?> 217 <a class="pluginmanager_configure" href="?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=<?php echo $key ?>"><img src="<?php echo serendipity_getTemplateFile('admin/img/configure.png') ?>" style="border: 0; vertical-align: bottom;" alt="[C]" /></a> 218 <?php } ?> 219 220 <span class="pluginmanager_title"> 221 <?php if ( $can_configure ) { ?> 222 <a href="?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=<?php echo $key ?>"><?php echo $title; ?></a> 223 <?php } else { ?> 224 <?php echo $title; ?> 225 <?php } ?></span><br /> 226 <div class="pluginmanager_description" style="font-size: 8pt"><?php echo $desc; ?></div> 227 <div class="pluginmanager_ownership"><?php ownership($plugin_data['authorid'], $plugin_data['name'], $is_plugin_owner); ?></div> 228 <?php echo ($eyecandy ? '<noscript>' : ''); ?> 229 <div class="pluginmanager_place"><?php echo $place; ?></div> 230 <div class="pluginmanager_move"><?php echo $moveup ?> <?php echo $movedown ?></div> 231 <?php echo ($eyecandy ? '</noscript>' : ''); ?> 232 </li> 233 <?php 234 $sort_idx++; 235 } 236 237 echo '</ol></td>'; 238 } 239 240 ?> 241 </tr> 242 <tr> 243 <td colspan="3" align="right"><?php printf(PLUGIN_AVAILABLE_COUNT, $total); ?></td> 244 </tr> 245 </table> 246 <br /> 247 <div> 248 <input type="submit" name="REMOVE" title="<?php echo DELETE; ?>" value="<?php echo REMOVE_TICKED_PLUGINS; ?>" class="serendipityPrettyButton input_button" /> 249 <input type="submit" name="SAVE" title="<?php echo SAVE_CHANGES_TO_LAYOUT; ?>" value="<?php echo SAVE; ?>" class="serendipityPrettyButton input_button" /> 250 </div> 251 </form> 252 <?php 253 } 254 255 /** 256 * Returns HTML code for the ownership column of the plugin listing 257 * 258 * Used by the function show_plugins() 259 * 260 * @access private 261 * @see show_plugins() 262 * @param int ID of the current user 263 * @param string plugin name 264 * @param boolean Toggle whether the plugin belongs to the current author 265 * @return null 266 */ 267 function ownership($authorid, $name, $is_plugin_owner = false) { 268 global $serendipity; 269 270 static $users = array(); 271 if (empty($users)) { 272 $users = serendipity_fetchUsers(); 273 } 274 275 if ($is_plugin_owner) { 276 ?> 277 <select name="serendipity[ownership][<?php echo $name; ?>]"> 278 <option value="0"><?php echo ALL_AUTHORS; ?></option> 279 <?php 280 } 281 282 foreach($users AS $user) { 283 if (!$is_plugin_owner && $user['authorid'] == $authorid) { 284 $realname = htmlspecialchars($user['realname']); 285 } elseif ($is_plugin_owner) { 286 ?> 287 <option value="<?php echo $user['authorid']; ?>"<?php echo ($user['authorid'] == $authorid ? ' selected="selected"' : ''); ?>><?php echo htmlspecialchars($user['realname']); ?></option> 288 <?php 289 } 290 } 291 292 if ($is_plugin_owner) { 293 ?> 294 </select> 295 <?php 296 } else { 297 echo (empty($realname) ? ALL_AUTHORS : $realname); 298 } 299 } 300 301 /** 302 * Show a placement box on where to move a sidebar plugin to 303 * 304 * @access private 305 * @see show_plugins() 306 * @param string plugin name 307 * @param string current position of the plugin 308 * @param boolean Toggle whether a plugin is editable (depends on authorid and permissions) 309 * @param boolean Toggle whether a plugin is an event plugin 310 * @return string HTML code for placement select box 311 */ 312 function placement_box($name, $val, $is_plugin_editable = false, $is_event = false, $opts = null) 313 { 314 if ($opts === null) { 315 $opts = array( 316 'left' => LEFT, 317 'right' => RIGHT, 318 'hide' => HIDDEN 319 ); 320 } 321 322 static $event_opts = array( 323 'event' => PLUGIN_ACTIVE, 324 'eventh' => PLUGIN_INACTIVE, 325 ); 326 327 if ($is_event) { 328 $gopts =& $event_opts; 329 } else { 330 $gopts =& $opts; 331 } 332 333 $x = "\n<select name=\"$name\">\n"; 334 foreach ($gopts as $k => $v) { 335 if (!$is_plugin_editable && $k == 'hide') { 336 continue; 337 } 338 339 $x .= " <option value=\"$k\"" . ($k == $val ? ' selected="selected"' : '') . ">$v</option>\n"; 340 } 341 return $x . "</select>\n"; 342 } 343 344 /** 345 * Show a placement box on where to move a sidebar plugin to 346 * 347 * @access public 348 * @param object A plugin object 349 * @param object The plugins property bag object 350 * @param string The name of the plugin 351 * @param string The description of the plugin 352 * @param array The property bag 'configuration' array, holding the array of config items. 353 * @param boolean Shows the surrounding HTML table? 354 * @param boolean Shows the FORM submit button? 355 * @param boolean Shows a plugin's "example" method output? 356 * @param boolean Spawn a plugins' configuration WYSIWYG items? 357 * @param string The array index name of POSTed values ($serendipity['POST'][xxx]) 358 * @return boolean 359 */ 360 function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_names, $showTable = true, $showSubmit = true, $showExample = true, $spawnNuggets = true, $postKey = 'plugin') { 361 global $serendipity; 362 363 if ($showTable) { 364 ?> 365 <table id="serendipity_plugin_config" border="0" cellspacing="0" cellpadding="3" width="100%"> 366 <?php 367 } 368 369 $elcount = 0; 370 $htmlnugget = array(); 371 foreach ($config_names as $config_item) { 372 $elcount++; 373 $cbag = new serendipity_property_bag; 374 $plugin->introspect_config_item($config_item, $cbag); 375 376 $cname = htmlspecialchars($cbag->get('name')); 377 $cdesc = htmlspecialchars($cbag->get('description')); 378 $value = $plugin->get_config($config_item, 'unset'); 379 $lang_direction = htmlspecialchars($cbag->get('lang_direction')); 380 381 if (empty($lang_direction)) { 382 $lang_direction = LANG_DIRECTION; 383 } 384 385 /* Apparently no value was set for this config item */ 386 if ($value === 'unset') { 387 /* Try and the default value for the config item */ 388 $value = $cbag->get('default'); 389 390 /* Still, we don't have a value, try and get (bool)false - from an old plugin */ 391 if ($value === '') { 392 $value = $plugin->get_config($config_item, false, true); 393 } 394 } 395 396 if (isset($_POST['serendipity'][$postkey][$config_item])) { 397 if (is_array($_POST['serendipity'][$postkey][$config_item])) { 398 $hvalue = $_POST['serendipity'][$postkey][$config_item]; 399 array_walk($hvalue, 'htmlspecialchars'); 400 } else { 401 $hvalue = htmlspecialchars($_POST['serendipity'][$postkey][$config_item]); 402 } 403 } else { 404 $hvalue = htmlspecialchars($value); 405 } 406 407 $radio = array(); 408 $select = array(); 409 $per_row = null; 410 411 $is_multi_select = false; 412 $ctype = $cbag->get('type'); 413 switch ($ctype) { 414 case 'seperator': 415 ?> 416 <tr> 417 <td colspan="2"><hr noshade="noshade" size="1" /></td> 418 </tr> 419 <?php 420 break; 421 422 case 'multiselect': 423 $is_multi_select = true; 424 425 case 'select': 426 if (is_array($hvalue)) { 427 $selected_options = $hvalue; 428 } elseif ($is_multi_select) { 429 $selected_options = explode('^', $hvalue); 430 } else { 431 $selected_options = array($hvalue => $hvalue); 432 } 433 434 $pre_selected = (array)$cbag->get('select_preselected'); 435 $select_size = $cbag->get('select_size'); 436 $select = $cbag->get('select_values'); 437 ?> 438 <tr> 439 <td style="border-bottom: 1px solid #000000; vertical-align: top"><strong><?php echo $cname; ?></strong> 440 <?php 441 if ($cdesc != '') { 442 ?> 443 <br><span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span> 444 <?php } ?> 445 </td> 446 <td style="border-bottom: 1px solid #000000; vertical-align: middle" width="250"> 447 <div> 448 <select class="direction_<?php echo $lang_direction; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]<?php echo ($is_multi_select ? '[]' : ''); ?>" <?php echo ($is_multi_select ? 'multiple="multiple"' : ''); ?> <?php echo ($is_multi_select && $select_size > 0 ? 'size="' . $select_size . '"' : ''); ?>> 449 <?php 450 foreach($select AS $select_value => $select_desc) { 451 $id = htmlspecialchars($config_item . $select_value); 452 ?> 453 <option value="<?php echo $select_value; ?>" <?php echo ( (in_array($select_value, $selected_options) || in_array($select_value, $pre_selected) ) ? 'selected="selected"' : ''); ?> title="<?php echo htmlspecialchars($select_desc); ?>"> 454 <?php echo htmlspecialchars($select_desc); ?> 455 </option> 456 <?php 457 } 458 ?> 459 </select> 460 </div> 461 </td> 462 </tr> 463 <?php 464 break; 465 466 case 'tristate': 467 $per_row = 3; 468 $radio['value'][] = 'default'; 469 $radio['desc'][] = USE_DEFAULT; 470 471 case 'boolean': 472 $radio['value'][] = 'true'; 473 $radio['desc'][] = YES; 474 475 $radio['value'][] = 'false'; 476 $radio['desc'][] = NO; 477 478 case 'radio': 479 if (!count($radio) > 0) { 480 $radio = $cbag->get('radio'); 481 } 482 483 if (empty($per_row)) { 484 $per_row = $cbag->get('radio_per_row'); 485 if (empty($per_row)) { 486 $per_row = 2; 487 } 488 } 489 ?> 490 <tr> 491 <td style="border-bottom: 1px solid #000000; vertical-align: top"><strong><?php echo $cname; ?></strong> 492 <?php 493 if ($cdesc != '') { 494 ?> 495 <br /><span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span> 496 <?php 497 } 498 ?> 499 </td> 500 <td style="border-bottom: 1px solid #000000; vertical-align: middle;" width="250"> 501 <?php 502 $counter = 0; 503 foreach($radio['value'] AS $radio_index => $radio_value) { 504 $id = htmlspecialchars($config_item . $radio_value); 505 $counter++; 506 $checked = ""; 507 508 if ($radio_value == 'true' && ($hvalue === '1' || $hvalue === 'true')) { 509 $checked = " checked"; 510 } elseif ($radio_value == 'false' && ($hvalue === '' || $hvalue === 'false')) { 511 $checked = " checked"; 512 } elseif ($radio_value == $hvalue) { 513 $checked = " checked"; 514 } 515 516 if ($counter == 1) { 517 ?> 518 <div> 519 <?php 520 } 521 ?> 522 <input class="direction_<?php echo $lang_direction; ?> input_radio" type="radio" id="serendipity_plugin_<?php echo $id; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $radio_value; ?>" <?php echo $checked ?> title="<?php echo htmlspecialchars($radio['desc'][$radio_index]); ?>" /> 523 <label for="serendipity_plugin_<?php echo $id; ?>"><?php echo htmlspecialchars($radio['desc'][$radio_index]); ?></label> 524 <?php 525 if ($counter == $per_row) { 526 $counter = 0; 527 ?> 528 </div> 529 <?php 530 } 531 } 532 ?> 533 </td> 534 </tr> 535 <?php 536 break; 537 538 case 'string': 539 ?> 540 <tr> 541 <td style="border-bottom: 1px solid #000000"> 542 <strong><?php echo $cname; ?></strong> 543 <br><span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span> 544 </td> 545 <td style="border-bottom: 1px solid #000000" width="250"> 546 <div> 547 <input class="direction_<?php echo $lang_direction; ?> input_textbox" type="text" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $hvalue; ?>" size="30" /> 548 </div> 549 </td> 550 </tr> 551 <?php 552 break; 553 554 case 'html': 555 case 'text': 556 ?> 557 <tr> 558 <td colspan="2"><strong><?php echo $cname; ?></strong> 559 <span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span> 560 </td> 561 </tr> 562 563 <tr> 564 <td colspan="2"> 565 <div> 566 <textarea class="direction_<?php echo $lang_direction; ?>" style="width: 100%" id="nuggets<?php echo $elcount; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" rows="20" cols="80"><?php echo $hvalue; ?></textarea> 567 </div> 568 </td> 569 </tr> 570 <?php 571 if ($cbag->get('type') == 'html') { 572 $htmlnugget[] = $elcount; 573 serendipity_emit_htmlarea_code('nuggets', 'nuggets', true); 574 } 575 break; 576 577 case 'content': 578 ?><tr><td colspan="2"><?php echo $cbag->get('default'); ?></td></tr><?php 579 break; 580 581 case 'custom': 582 ?><tr><td colspan="2"> 583 <input type="hidden" id="config_<?php echo $postKey; ?>_<?php echo $config_item; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $hvalue; ?>" size="30" /> 584 <?php echo $cbag->get('custom'); ?> 585 </td></tr><?php 586 break; 587 588 case 'hidden': 589 ?><tr><td colspan="2"><input class="direction_<?php echo $lang_direction; ?>" type="hidden" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $cbag->get('value'); ?>" /></td></tr><?php 590 break; 591 592 case 'media': 593 // Output the JavaScript, if we haven't already 594 $mediajs_output = $serendipity['mediajs_output']; 595 if (!$mediajs_output) 596 { 597 print <<<EOS 598 <script type="text/javascript" language="JavaScript" src="serendipity_editor.js"></script> 599 <script type="text/javascript"> 600 function change_preview(id) 601 { 602 var text_box = document.getElementById('serendipity[template][' + id + ']'); 603 var image_box = document.getElementById(id + '_preview'); 604 var filename = text_box.value; 605 image_box.style.backgroundImage = 'url(' + filename + ')'; 606 } 607 function choose_media(id) 608 { 609 window.open('serendipity_admin_image_selector.php?serendipity[htmltarget]=' + id + '&serendipity[filename_only]=true', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1'); 610 } 611 </script> 612 613 EOS; 614 $serendipity['mediajs_output'] = true; 615 } 616 // Print the HTML to display the popup media selector 617 $preview_width = $cbag->get('preview_width'); 618 if (!$preview_width || $preview_width == "") { 619 $preview_width = '400px'; 620 } 621 $preview_height = $cbag->get('preview_height'); 622 if (!$preview_height || $preview_height == "") { 623 $preview_height = '100px'; 624 } 625 $media_link_text = MEDIA_LIBRARY; 626 print <<<EOS 627 <tr><td colspan="2"> 628 <strong>$cname</strong> 629 <br /><span style="color: #5E7A94; font-size: 8pt;">$cdesc</span> 630 </td> </tr> 631 <tr> 632 <td style="border-bottom: 1px solid #000000"> 633 <div id="{$config_item}_preview" style="background-image: url($value); width:$preview_width; height: $preview_height;"> </div> 634 </td> 635 <td style="border-bottom: 1px solid #000000"> 636 <input class="input_textbox" type="text" id="serendipity[$postKey][$config_item]" name="serendipity[$postKey][$config_item]" value="$value" onchange="change_preview('$config_item')"/> 637 <br /><a href="#" onclick="choose_media('serendipity[$postKey][$config_item]')">$media_link_text</a> 638 </td> 639 </tr> 640 EOS; 641 break; 642 643 default: 644 // Unknown configuration key. Let the plugin handle it. 645 $addData = func_get_args(); 646 $eventData = array( 647 'config_item' => $config_item, 648 'cbag' => $cbag, 649 'plugin' => $plugin, 650 'value' => $value, 651 'bag' => $bag, 652 'postKey' => $postKey 653 ); 654 serendipity_plugin_api::hook_event('backend_pluginconfig_' . $ctype, $eventData, $addData); 655 break; 656 } 657 } 658 659 if ($showTable) { 660 ?> 661 </table> 662 <br /> 663 <?php 664 } 665 666 if ($showSubmit) { 667 ?> 668 <div style="padding-left: 20px"> 669 <input type="submit" name="SAVECONF" value="<?php echo SAVE; ?>" class="serendipityPrettyButton input_button" /> 670 </div> 671 <?php 672 } 673 674 if ($showExample && method_exists($plugin, 'example') ) { 675 ?> 676 <div> 677 <?php echo $plugin->example() ?> 678 </div> 679 <?php 680 } 681 682 if ($spawnNuggets && isset($serendipity['wysiwyg']) && $serendipity['wysiwyg'] && count($htmlnugget) > 0) { 683 $ev = array('nuggets' => $htmlnugget, 'skip_nuggets' => false); 684 serendipity_plugin_api::hook_event('backend_wysiwyg_nuggets', $ev); 685 686 if ($ev['skip_nuggets'] === false) { 687 ?> 688 <script type="text/javascript"> 689 function Spawnnugget() { 690 /* blar */ 691 <?php foreach($htmlnugget AS $htmlnuggetid) { ?> 692 Spawnnuggets('<?php echo $htmlnuggetid; ?>'); 693 <?php } ?> 694 } 695 </script> 696 <?php 697 } 698 } 699 700 return true; 701 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Nov 24 09:00:37 2007 | par Balluche grâce à PHPXref 0.7 |
|