Changeset 1195 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 04/28/2004 02:23:46 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/admin-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r1143 r1195 217 217 global $post_ID; 218 218 // Exit if no meta 219 if (!$meta) return; 220 221 222 print " 223 <table id='meta-list'> 224 <tr> 225 <th>Key</th> 226 <th>Value</th> 227 <th> </th> 228 </tr>\n"; 219 if (!$meta) return; 220 ?> 221 <table id='meta-list' width='98%'> 222 <tr> 223 <th><?php _e('Key') ?></th> 224 <th><?php _e('Value') ?></th> 225 <th colspan='2'><?php _e('Action') ?></th> 226 </tr> 227 <?php 229 228 230 229 foreach ($meta as $entry) { 231 // TBD: Still need to add edit/del logic... 232 print " 233 <tr> 234 <td>{$entry['meta_key']}</td> 235 <td>{$entry['meta_value']}</td> 236 <td><a href=\"?action=deletemeta&meta_id={$entry['meta_id']}&post={$entry['post_id']}\">Delete</a></td> 237 </tr>\n"; 238 } 239 print " 240 </table>\n"; 230 $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; 231 echo " 232 <tr $style> 233 <td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' value='{$entry['meta_key']}' /></td> 234 <td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='40'>{$entry['meta_value']}</textarea></td> 235 <td align='center'><input name='updatemeta' type='submit' id='updatemeta' tabindex='6' value='" . __('Update') ."' /></td> 236 <td align='center'><input name='deletemeta[{$entry['meta_id']}]' type='submit' id='deletemeta' tabindex='6' value='" . __('Delete') ."' /></td> 237 </tr> 238 "; 239 } 240 echo " 241 </table> 242 "; 241 243 } 242 244 … … 257 259 $keys = get_meta_keys(); 258 260 ?> 259 <h4><?php _e('Add new custom data to this post:') ?></h4> 260 <div id="postcustomkeys"> 261 <p><?php _e('Select existing key or enter new key') ?></p> 262 <?php 263 if ($keys) { 264 ?> 265 <select id="metakeyselect" name="metakeyselect"> 261 <h3><?php _e('Add new custom data to this post:') ?></h3> 262 <table width="100%" cellspacing="3" cellpadding="3"> 263 <tr> 264 <th colspan="2"><?php _e('Key') ?></th> 265 <th><?php _e('Value') ?></th> 266 <th></th> 267 </tr> 268 <tr valign="top"> 269 <td align="right"><select id="metakeyselect" name="metakeyselect"> 266 270 <option value="#NONE#">- Select -</option> 267 271 <?php 268 272 foreach($keys as $key) { 269 echo " <option value='$key'>$key</option>\n";273 echo "\n\t<option value='$key'>$key</option>"; 270 274 } 271 275 ?> 272 </select> 273 <?php 274 } // if ($keys) 275 ?> 276 <input type="text" id="metakeyinput" name="metakeyinput" /> 277 </div> 278 <div id="postcustomvals"> 279 <p><?php _e('Custom Value') ?></p> 280 281 <textarea id="metavalue" name="metavalue" rows="3" cols="25"></textarea> 282 </div> 283 <br style="clear: both;" /> 284 <div id="postcustomsubmit"> 285 <input type="submit" id="save" name="save" value="<?php _e('Add Custom') ?>"> 286 </div> 276 </select> or </td><td><input type="text" id="metakeyinput" name="metakeyinput" /></td> 277 <td><textarea id="metavalue" name="metavalue" rows="3" cols="25"></textarea></td> 278 <td></td> 279 </tr> 280 281 </table> 282 <p class="submit"><input type="submit" id="save" name="save" value="<?php _e('Add Custom Fields »') ?>"></p> 287 283 <?php 288 284 } … … 291 287 global $wpdb, $tablepostmeta; 292 288 293 $metakeyselect = trim($_POST['metakeyselect']);294 $metakeyinput = trim($_POST['metakeyinput']);295 $metavalue = trim($_POST['metavalue']);289 $metakeyselect = $wpdb->escape( stripslashes( trim($_POST['metakeyselect']) ) ); 290 $metakeyinput = $wpdb->escape( stripslashes( trim($_POST['metakeyinput']) ) ); 291 $metavalue = $wpdb->escape( stripslashes( trim($_POST['metavalue']) ) ); 296 292 297 293 if (!empty($metavalue) && ((('#NONE#' != $metakeyselect) && !empty($metakeyselect)) || !empty($metakeyinput))) { … … 315 311 function del_meta($mid) { 316 312 global $wpdb, $tablepostmeta; 317 313 318 314 $result = $wpdb->query("DELETE FROM $tablepostmeta WHERE meta_id = '$mid'"); 319 315 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)