Changeset 8912
- Timestamp:
- 09/17/2008 12:40:10 AM (16 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/comment.php
r8882 r8912 1 1 <?php 2 /** 3 * WordPress Comment Administration API 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 2 8 3 9 /** … … 19 25 20 26 /** 21 * 22 * 27 * {@internal Missing Short Description}} 28 * 29 * @since unknown 23 30 */ 24 31 function edit_comment() { … … 42 49 } 43 50 } 44 45 51 46 52 if (!empty ( $_POST['edit_date'] ) ) { … … 61 67 } 62 68 69 /** 70 * {@internal Missing Short Description}} 71 * 72 * @since unknown 73 * 74 * @param unknown_type $id 75 * @return unknown 76 */ 63 77 function get_comment_to_edit( $id ) { 64 78 if ( !$comment = get_comment($id) ) … … 79 93 } 80 94 95 /** 96 * {@internal Missing Short Description}} 97 * 98 * @since unknown 99 * @uses $wpdb 100 * 101 * @param int $post_id Post ID 102 * @return unknown 103 */ 81 104 function get_pending_comments_num( $post_id ) { 82 105 global $wpdb; … … 105 128 } 106 129 107 // Add avatars to relevant places in admin, or try to 108 130 /** 131 * Add avatars to relevant places in admin, or try to. 132 * 133 * @since unknown 134 * @uses $comment 135 * 136 * @param string $name User name. 137 * @return string Avatar with Admin name. 138 */ 109 139 function floated_admin_avatar( $name ) { 110 140 global $comment; -
trunk/wp-admin/includes/dashboard.php
r8845 r8912 1 1 <?php 2 3 // Registers dashboard widgets, handles POST data, sets up filters 2 /** 3 * WordPress Dashboard Widget Administration Panel API 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** 10 * Registers dashboard widgets. 11 * 12 * handles POST data, sets up filters. 13 * 14 * @since unknown 15 */ 4 16 function wp_dashboard_setup() { 5 17 global $wpdb, $wp_dashboard_sidebars; … … 194 206 } 195 207 196 // Echoes out the dashboard 208 /** 209 * Displays the dashboard. 210 * 211 * @since unknown 212 */ 197 213 function wp_dashboard() { 198 214 echo "<div id='dashboard-widgets'>\n\n"; … … 206 222 } 207 223 208 // Makes sidebar_widgets option reflect the dashboard settings 224 /** 225 * Makes sidebar_widgets option reflect the dashboard settings. 226 * 227 * @since unknown 228 * 229 * @return array WordPress Dashboard Widgets list. 230 */ 209 231 function wp_dashboard_sidebars_widgets() { // hackery 210 232 return $GLOBALS['wp_dashboard_sidebars']; … … 213 235 // Modifies sidbar params on the fly to set up ids, class names, titles for each widget (called once per widget) 214 236 // Switches widget to edit mode if $_GET['edit'] 237 /** 238 * {@internal Missing Short Description}} 239 * 240 * @since unknown 241 * 242 * @param unknown_type $params 243 * @return unknown 244 */ 215 245 function wp_dashboard_dynamic_sidebar_params( $params ) { 216 246 global $wp_registered_widgets, $wp_registered_widget_controls; … … 484 514 } 485 515 516 /** 517 * Display recent comments dashboard widget content. 518 * 519 * @since unknown 520 * 521 * @param unknown_type $sidebar_args 522 */ 486 523 function wp_dashboard_recent_comments( $sidebar_args ) { 487 524 global $comment; … … 537 574 } 538 575 539 // $sidebar_args are handled by wp_dashboard_empty() 576 /** 577 * Display incoming links dashboard widget content. 578 * 579 * $sidebar_args are handled by wp_dashboard_empty(). 580 * 581 * @since unknown 582 */ 540 583 function wp_dashboard_incoming_links_output() { 541 584 $widgets = get_option( 'dashboard_widget_options' ); … … 597 640 } 598 641 599 // $sidebar_args are handled by wp_dashboard_empty() 642 /** 643 * {@internal Missing Short Description}} 644 * 645 * $sidebar_args are handled by wp_dashboard_empty(). 646 * 647 * @since unknown 648 * 649 * @param int $widget_id 650 */ 600 651 function wp_dashboard_rss_output( $widget_id ) { 601 652 $widgets = get_option( 'dashboard_widget_options' ); … … 603 654 } 604 655 605 // $sidebar_args are handled by wp_dashboard_empty() 656 /** 657 * Display secondary dashboard RSS widget feed. 658 * 659 * $sidebar_args are handled by wp_dashboard_empty(). 660 * 661 * @since unknown 662 * 663 * @return unknown 664 */ 606 665 function wp_dashboard_secondary_output() { 607 666 $widgets = get_option( 'dashboard_widget_options' ); … … 625 684 } 626 685 627 // $sidebar_args are handled by wp_dashboard_empty() 686 /** 687 * Display plugins most popular, newest plugins, and recently updated widget text. 688 * 689 * $sidebar_args are handled by wp_dashboard_empty(). 690 * 691 * @since unknown 692 */ 628 693 function wp_dashboard_plugins_output() { 629 694 $popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' ); … … 673 738 } 674 739 675 // Checks to see if all of the feed url in $check_urls are cached. 676 // If $check_urls is empty, look for the rss feed url found in the dashboard widget optios of $widget_id. 677 // If cached, call $callback, a function that echoes out output for this widget. 678 // If not cache, echo a "Loading..." stub which is later replaced by AJAX call (see top of /wp-admin/index.php) 740 /** 741 * Checks to see if all of the feed url in $check_urls are cached. 742 * 743 * If $check_urls is empty, look for the rss feed url found in the dashboard 744 * widget optios of $widget_id. If cached, call $callback, a function that 745 * echoes out output for this widget. If not cache, echo a "Loading..." stub 746 * which is later replaced by AJAX call (see top of /wp-admin/index.php) 747 * 748 * @since unknown 749 * 750 * @param int $widget_id 751 * @param callback $callback 752 * @param array $check_urls RSS feeds 753 * @return bool False on failure. True on success. 754 */ 679 755 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { 680 756 $loading = '<p class="widget-loading">' . __( 'Loading…' ) . '</p>'; … … 712 788 } 713 789 714 // Empty widget used for JS/AJAX created output. 715 // Callback inserts content between before_widget and after_widget. Used when widget is in edit mode. Can also be used for custom widgets. 790 /** 791 * Empty widget used for JS/AJAX created output. 792 * 793 * Callback inserts content between before_widget and after_widget. Used when 794 * widget is in edit mode. Can also be used for custom widgets. 795 * 796 * @since unknown 797 * 798 * @param array $sidebar_args 799 * @param callback $callback Optional. Only used in edit mode. 800 */ 716 801 function wp_dashboard_empty( $sidebar_args, $callback = false ) { 717 802 extract( $sidebar_args, EXTR_SKIP ); … … 733 818 } 734 819 735 /* Dashboard Widgets Controls. S see also wp_dashboard_empty() */820 /* Dashboard Widgets Controls. See also wp_dashboard_empty() */ 736 821 737 822 // Temp … … 741 826 742 827 // Calls widget_control callback 828 /** 829 * Calls widget control callback. 830 * 831 * @since unknown 832 * 833 * @param int $widget_control_id Registered Widget ID. 834 */ 743 835 function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { 744 836 global $wp_registered_widget_controls; … … 747 839 } 748 840 749 // Sets up $args to be used as input to wp_widget_rss_form(), handles POST data from RSS-type widgets 841 /** 842 * The RSS dashboard widget control. 843 * 844 * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data 845 * from RSS-type widgets. 846 * 847 * @since unknown 848 * 849 * @param array $args Expects 'widget_id' and 'form_inputs'. 850 * @return bool|null False if no widget_id is given. Null on success. 851 */ 750 852 function wp_dashboard_rss_control( $args ) { 751 853 extract( $args ); -
trunk/wp-admin/includes/export.php
r7965 r8912 1 1 <?php 2 3 // version number for the export format. bump this when something changes that might affect compatibility. 2 /** 3 * WordPress Export Administration API 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** 10 * Version number for the export format. 11 * 12 * Bump this when something changes that might affect compatibility. 13 * 14 * @since unknown 15 * @var string 16 */ 4 17 define('WXR_VERSION', '1.0'); 5 18 19 /** 20 * {@internal Missing Short Description}} 21 * 22 * @since unknown 23 * 24 * @param unknown_type $author 25 */ 6 26 function export_wp($author='') { 7 27 global $wpdb, $post_ids, $post; … … 27 47 $tags = (array) get_tags('get=all'); 28 48 49 /** 50 * {@internal Missing Short Description}} 51 * 52 * @since unknown 53 * 54 * @param unknown_type $categories 55 */ 29 56 function wxr_missing_parents($categories) { 30 57 if ( !is_array($categories) || empty($categories) ) … … 62 89 unset($categories); 63 90 91 /** 92 * Place string in CDATA tag. 93 * 94 * @since unknown 95 * 96 * @param string $str String to place in XML CDATA tag. 97 */ 64 98 function wxr_cdata($str) { 65 99 if ( seems_utf8($str) == false ) … … 73 107 } 74 108 109 /** 110 * {@internal Missing Short Description}} 111 * 112 * @since unknown 113 * 114 * @return string Site URL. 115 */ 75 116 function wxr_site_url() { 76 117 global $current_site; … … 86 127 } 87 128 129 /** 130 * {@internal Missing Short Description}} 131 * 132 * @since unknown 133 * 134 * @param object $c Category Object 135 */ 88 136 function wxr_cat_name($c) { 89 137 if ( empty($c->name) ) … … 93 141 } 94 142 143 /** 144 * {@internal Missing Short Description}} 145 * 146 * @since unknown 147 * 148 * @param object $c Category Object 149 */ 95 150 function wxr_category_description($c) { 96 151 if ( empty($c->description) ) … … 100 155 } 101 156 157 /** 158 * {@internal Missing Short Description}} 159 * 160 * @since unknown 161 * 162 * @param object $t Tag Object 163 */ 102 164 function wxr_tag_name($t) { 103 165 if ( empty($t->name) ) … … 107 169 } 108 170 171 /** 172 * {@internal Missing Short Description}} 173 * 174 * @since unknown 175 * 176 * @param object $t Tag Object 177 */ 109 178 function wxr_tag_description($t) { 110 179 if ( empty($t->description) ) … … 114 183 } 115 184 185 /** 186 * {@internal Missing Short Description}} 187 * 188 * @since unknown 189 */ 116 190 function wxr_post_taxonomy() { 117 191 $categories = get_the_category(); -
trunk/wp-admin/includes/image.php
r8879 r8912 4 4 * 5 5 * @package WordPress 6 */ 7 8 /** 9 * wp_create_thumbnail() - Create a thumbnail from an Image given a maximum side size. 10 * 11 * @package WordPress 12 * @param mixed $file Filename of the original image, Or attachment id 13 * @param int $max_side Maximum length of a single side for the thumbnail 14 * @return string Thumbnail path on success, Error string on failure 15 * 16 * This function can handle most image file formats which PHP supports. 17 * If PHP does not have the functionality to save in a file of the same format, the thumbnail will be created as a jpeg. 6 * @subpackage Administration 7 */ 8 9 /** 10 * Create a thumbnail from an Image given a maximum side size. 11 * 12 * This function can handle most image file formats which PHP supports. If PHP 13 * does not have the functionality to save in a file of the same format, the 14 * thumbnail will be created as a jpeg. 15 * 16 * @since unknown 17 * 18 * @param mixed $file Filename of the original image, Or attachment id. 19 * @param int $max_side Maximum length of a single side for the thumbnail. 20 * @return string Thumbnail path on success, Error string on failure. 18 21 */ 19 22 function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { 20 21 23 $thumbpath = image_resize( $file, $max_side, $max_side ); 22 24 return apply_filters( 'wp_create_thumbnail', $thumbpath ); … … 24 26 25 27 /** 26 * wp_crop_image() - Crop an Image to a given size. 27 * 28 * @package WordPress 28 * Crop an Image to a given size. 29 * 29 30 * @internal Missing Long Description 30 * @param int $src_file The source file 31 * @param int $src_x The start x position to crop from 32 * @param int $src_y The start y position to crop from 33 * @param int $src_w The width to crop 34 * @param int $src_h The height to crop 35 * @param int $dst_w The destination width 36 * @param int $dst_h The destination height 37 * @param int $src_abs If the source crop points are absolute 38 * @param int $dst_file The destination file to write to 39 * @return string New filepath on success, String error message on failure 40 * 31 * 32 * @since unknown 33 * 34 * @param string|int $src_file The source file or Attachment ID 35 * @param int $src_x The start x position to crop from. 36 * @param int $src_y The start y position to crop from. 37 * @param int $src_w The width to crop. 38 * @param int $src_h The height to crop. 39 * @param int $dst_w The destination width. 40 * @param int $dst_h The destination height. 41 * @param int $src_abs Optional. If the source crop points are absolute. 42 * @param string $dst_file Optional. The destination file to write to. 43 * @return string New filepath on success, String error message on failure. 41 44 */ 42 45 function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) { … … 75 78 76 79 /** 77 * wp_generate_attachment_metadata() - Generate post Image attachment Metadata 78 * 79 * @package WordPress 80 * Generate post Image attachment Metadata. 81 * 80 82 * @internal Missing Long Description 81 * @param int $attachment_id Attachment Id to process 82 * @param string $file Filepath of the Attached image 83 * @return mixed Metadata for attachment 84 * 83 * 84 * @since unknown 85 * 86 * @param int $attachment_id Attachment Id to process 87 * @param string $file Filepath of the Attached image 88 * @return mixed Metadata for attachment 85 89 */ 86 90 function wp_generate_attachment_metadata( $attachment_id, $file ) { … … 121 125 122 126 } 127 123 128 return apply_filters( 'wp_generate_attachment_metadata', $metadata ); 124 129 } 125 130 126 131 /** 127 * wp_load_image() - Load an image which PHP Supports. 128 * 129 * @package WordPress 132 * Load an image which PHP Supports. 133 * 130 134 * @internal Missing Long Description 131 * @param string $file Filename of the image to load 132 * @return resource The resulting image resource on success, Error string on failure. 133 * 135 * 136 * @since unknown 137 * 138 * @param string $file Filename of the image to load. 139 * @return resource The resulting image resource on success, Error string on failure. 134 140 */ 135 141 function wp_load_image( $file ) { … … 154 160 155 161 /** 156 * get_udims() - Calculated the new dimentions for downsampled images 157 * 158 * @package WordPress 159 * @internal Missing Description 162 * Calculated the new dimentions for downsampled images. 163 * 164 * @since unknown 160 165 * @see wp_shrink_dimensions() 161 * @param int $width Current width of the image 162 * @param int $height Current height of the image 163 * @return mixed Array(height,width) of shrunk dimensions. 166 * 167 * @param int $width Current width of the image 168 * @param int $height Current height of the image 169 * @return mixed Array(height,width) of shrunk dimensions. 164 170 * 165 171 */ … … 167 173 return wp_shrink_dimensions( $width, $height ); 168 174 } 169 /** 170 * wp_shrink_dimensions() - Calculates the new dimentions for a downsampled image. 171 * 172 * @package WordPress 173 * @internal Missing Long Description 174 * @param int $width Current width of the image 175 * @param int $height Current height of the image 176 * @param int $wmax Maximum wanted width 177 * @param int $hmax Maximum wanted height 178 * @return mixed Array(height,width) of shrunk dimensions. 175 176 /** 177 * Calculates the new dimentions for a downsampled image. 178 * 179 * @since unknown 180 * @see wp_constrain_dimensions() 181 * 182 * @param int $width Current width of the image 183 * @param int $height Current height of the image 184 * @param int $wmax Maximum wanted width 185 * @param int $hmax Maximum wanted height 186 * @return mixed Array(height,width) of shrunk dimensions. 179 187 * 180 188 */ … … 183 191 } 184 192 185 // convert a fraction string to a decimal 193 /** 194 * Convert a fraction string to a decimal. 195 * 196 * @since unknown 197 * 198 * @param string $str 199 * @return int|float 200 */ 186 201 function wp_exif_frac2dec($str) { 187 202 @list( $n, $d ) = explode( '/', $str ); … … 191 206 } 192 207 193 // convert the exif date format to a unix timestamp 208 /** 209 * Convert the exif date format to a unix timestamp. 210 * 211 * @since unknown 212 * 213 * @param string $str 214 * @return int 215 */ 194 216 function wp_exif_date2ts($str) { 195 // seriously, who formats a date like 'YYYY:MM:DD hh:mm:ss'?196 217 @list( $date, $time ) = explode( ' ', trim($str) ); 197 218 @list( $y, $m, $d ) = explode( ':', $date ); … … 200 221 } 201 222 202 // get extended image metadata, exif or iptc as available 223 /** 224 * Get extended image metadata, exif or iptc as available 225 * 226 * @since unknown 227 * 228 * @param string $file 229 * @return bool|array False on failure. Image metadata array on success. 230 */ 203 231 function wp_read_image_metadata( $file ) { 204 232 if ( !file_exists( $file ) ) … … 207 235 list(,,$sourceImageType) = getimagesize( $file ); 208 236 209 // exif contains a bunch of data we'll probably never need formatted in ways that are difficult to use. 210 // We'll normalize it and just extract the fields that are likely to be useful. Fractions and numbers 211 // are converted to floats, dates to unix timestamps, and everything else to strings. 237 // exif contains a bunch of data we'll probably never need formatted in ways 238 // that are difficult to use. We'll normalize it and just extract the fields 239 // that are likely to be useful. Fractions and numbers are converted to 240 // floats, dates to unix timestamps, and everything else to strings. 212 241 $meta = array( 213 242 'aperture' => 0, … … 223 252 ); 224 253 225 // read iptc first, since it might contain data not available in exif such as caption, description etc 254 // read iptc first, since it might contain data not available in exif such 255 // as caption, description etc 226 256 if ( is_callable('iptcparse') ) { 227 257 getimagesize($file, $info); … … 232 262 elseif ( !empty($iptc['2#080'][0]) ) // byline 233 263 $meta['credit'] = utf8_encode(trim($iptc['2#080'][0])); 234 if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created date eand time264 if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created date and time 235 265 $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]); 236 266 if ( !empty($iptc['2#120'][0]) ) // caption … … 259 289 $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] ); 260 290 } 261 / / FIXME: try other exif libraries if available291 /** @todo FIXME: try other exif libraries if available */ 262 292 263 293 return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType ); … … 265 295 } 266 296 267 // is the file a real image file? 297 /** 298 * Validate that file is an image. 299 * 300 * @since unknown 301 * 302 * @param string $path File path to test if valid image. 303 * @return bool True if valid image, false if not valid image. 304 */ 268 305 function file_is_valid_image($path) { 269 306 $size = @getimagesize($path); … … 271 308 } 272 309 273 // is the file an image suitable for displaying within a web page? 310 /** 311 * Validate that file is suitable for displaying within a web page. 312 * 313 * @since unknown 314 * @uses apply_filters() Calls 'file_is_displayable_image' on $result and $path. 315 * 316 * @param string $path File path to test. 317 * @return bool True if suitable, false if not suitable. 318 */ 274 319 function file_is_displayable_image($path) { 275 320 $info = @getimagesize($path); -
trunk/wp-admin/includes/media.php
r8853 r8912 692 692 'helps' => __('Enter a link URL or click above for presets.'), 693 693 ), 694 694 'menu_order' => array( 695 695 'label' => __('Order'), 696 696 'value' => $edit_post->menu_order … … 1492 1492 // support a GET parameter for disabling the flash uploader 1493 1493 function media_upload_use_flash($flash) { 1494 1495 1496 1494 if ( array_key_exists('flash', $_REQUEST) ) 1495 $flash = !empty($_REQUEST['flash']); 1496 return $flash; 1497 1497 } 1498 1498 … … 1500 1500 1501 1501 function media_upload_flash_bypass() { 1502 1503 1504 1502 echo '<p class="upload-flash-bypass">'; 1503 printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) ); 1504 echo '</p>'; 1505 1505 } 1506 1506 … … 1508 1508 1509 1509 function media_upload_html_bypass() { 1510 1511 1512 1513 1514 1515 1516 1517 1518 1510 echo '<p class="upload-html-bypass">'; 1511 if ( array_key_exists('flash', $_REQUEST) ) 1512 // the user manually selected the browser uploader, so let them switch back to Flash 1513 printf( __('You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) ); 1514 else 1515 // the user probably doesn't have Flash 1516 printf( __('You are using the Browser uploader.') ); 1517 1518 echo '</p>'; 1519 1519 } 1520 1520 … … 1524 1524 // make sure the GET parameter sticks when we submit a form 1525 1525 function media_upload_bypass_url($url) { 1526 1527 1528 1526 if ( array_key_exists('flash', $_REQUEST) ) 1527 $url = add_query_arg('flash', intval($_REQUEST['flash'])); 1528 return $url; 1529 1529 } 1530 1530 -
trunk/wp-admin/includes/plugin-install.php
r8884 r8912 1 1 <?php 2 3 function plugins_api($action, $args = NULL) { 2 /** 3 * WordPress Plugin Install Administration API 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** 10 * Retrieve plugin installer pages from WordPress Plugins API. 11 * 12 * It is possible for a plugin to override the Plugin API result with three 13 * filters. Assume this is for plugins, which can extend on the Plugin Info to 14 * offer more choices. This is very powerful and must be used with care, when 15 * overridding the filters. 16 * 17 * The first filter, 'plugins_api_args', is for the args and gives the action as 18 * the second parameter. The hook for 'plugins_api_args' must ensure that an 19 * object is returned. 20 * 21 * The second filter, 'plugins_api', is the result that would be returned. 22 * 23 * @param string $action 24 * @param array|object $args Optional. Arguments to serialize for the Plugin Info API. 25 * @return mixed 26 */ 27 function plugins_api($action, $args = null) { 4 28 global $wp_version; 5 29 … … 20 44 } 21 45 46 /** 47 * 48 * 49 * @param unknown_type $args 50 * @return unknown 51 */ 22 52 function install_popular_tags( $args = array() ) { 23 53 if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) ) 24 add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.54 add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload. 25 55 26 56 if ( $cache && $cache->timeout + 3 * 60 * 60 > time() ) -
trunk/wp-admin/includes/plugin.php
r8735 r8912 97 97 } 98 98 99 /** 100 * Check the plugins directory and retrieve all plugin files with plugin data. 101 * 102 * WordPress only supports plugin files in the base plugins directory 103 * (wp-content/plugins) and in one directory above the plugins directory 104 * (wp-content/plugins/my-plugin). The file it looks for has the plugin data and 105 * must be found in those two locations. It is recommended that do keep your 106 * plugin files in directories. 107 * 108 * The file with the plugin data is the file that will be included and therefore 109 * needs to have the main execution for the plugin. This does not mean 110 * everything must be contained in the file and it is recommended that the file 111 * be split for maintainability. Keep everything in one file for extreme 112 * optimization purposes. 113 * 114 * @since unknown 115 * 116 * @param string $plugin_folder Optional. Relative path to single plugin folder. 117 * @return array Key is the plugin file path and the value is an array of the plugin data. 118 */ 99 119 function get_plugins($plugin_folder = '') { 100 120 … … 170 190 } 171 191 192 /** 193 * Attempts activation of plugin in a "sandbox" and redirects on success. 194 * 195 * A plugin that is already activated will not attempt to be activated again. 196 * 197 * The way it works is by setting the redirection to the error before trying to 198 * include the plugin file. If the plugin fails, then the redirection will not 199 * be overwritten with the success message. Also, the options will not be 200 * updated and the activation hook will not be called on plugin error. 201 * 202 * It should be noted that in no way the below code will actually prevent errors 203 * within the file. The code should not be used elsewhere to replicate the 204 * "sandbox", which uses redirection to work. 205 * {@source 13 1} 206 * 207 * If any errors are found or text is outputted, then it will be captured to 208 * ensure that the success redirection will update the error redirection. 209 * 210 * @since unknown 211 * 212 * @param string $plugin Plugin path to main plugin file with plugin data. 213 * @param string $redirect Optional. URL to redirect to. 214 * @return WP_Error|null WP_Error on invalid file or null on success. 215 */ 172 216 function activate_plugin($plugin, $redirect = '') { 173 $current = get_option('active_plugins'); 174 $plugin = trim($plugin); 175 176 $valid = validate_plugin($plugin); 177 if ( is_wp_error($valid) ) 178 return $valid; 179 180 if ( !in_array($plugin, $current) ) { 181 if ( !empty($redirect) ) 182 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error 183 ob_start(); 184 @include(WP_PLUGIN_DIR . '/' . $plugin); 185 $current[] = $plugin; 186 sort($current); 187 update_option('active_plugins', $current); 188 do_action('activate_' . $plugin); 189 ob_end_clean(); 190 } 191 192 return null; 193 } 194 217 $current = get_option('active_plugins'); 218 $plugin = trim($plugin); 219 220 $valid = validate_plugin($plugin); 221 if ( is_wp_error($valid) ) 222 return $valid; 223 224 if ( !in_array($plugin, $current) ) { 225 if ( !empty($redirect) ) 226 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error 227 ob_start(); 228 @include(WP_PLUGIN_DIR . '/' . $plugin); 229 $current[] = $plugin; 230 sort($current); 231 update_option('active_plugins', $current); 232 do_action('activate_' . $plugin); 233 ob_end_clean(); 234 } 235 236 return null; 237 } 238 239 /** 240 * Deactivate a single plugin or multiple plugins. 241 * 242 * The deactivation hook is disabled by the plugin upgrader by using the $silent 243 * parameter. 244 * 245 * @since unknown 246 * 247 * @param string|array $plugins Single plugin or list of plugins to deactivate. 248 * @param bool $silent Optional, default is false. Prevent calling deactivate hook. 249 */ 195 250 function deactivate_plugins($plugins, $silent= false) { 196 251 $current = get_option('active_plugins'); … … 210 265 } 211 266 267 /** 268 * Activate multiple plugins. 269 * 270 * When WP_Error is returned, it does not mean that one of the plugins had 271 * errors. It means that one or more of the plugins file path was invalid. 272 * 273 * The execution will be halted as soon as one of the plugins has an error. 274 * 275 * @since unknown 276 * 277 * @param string|array $plugins 278 * @param string $redirect Redirect to page after successful activation. 279 * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation. 280 */ 212 281 function activate_plugins($plugins, $redirect = '') { 213 282 if ( !is_array($plugins) ) … … 229 298 } 230 299 300 /** 301 * Remove directory and files of a plugin for a single or list of plugin(s). 302 * 303 * If the plugins parameter list is empty, false will be returned. True when 304 * completed. 305 * 306 * @since unknown 307 * 308 * @param array $plugins List of plugin 309 * @param string $redirect Redirect to page when complete. 310 * @return mixed 311 */ 231 312 function delete_plugins($plugins, $redirect = '' ) { 232 313 global $wp_filesystem; … … 332 413 } 333 414 415 /** 416 * Validate the plugin path. 417 * 418 * Checks that the file exists and {@link validate_file() is valid file}. 419 * 420 * @since unknown 421 * 422 * @param string $plugin Plugin Path 423 * @return WP_Error|int 0 on success, WP_Error on failure. 424 */ 334 425 function validate_plugin($plugin) { 335 426 if ( validate_file($plugin) ) … … 344 435 * Whether the plugin can be uninstalled. 345 436 * 346 * @since 2.7 437 * @since 2.7.0 347 438 * 348 439 * @param string $plugin Plugin path to check. … … 364 455 * Calls the uninstall hook, if it is available. 365 456 * 366 * @since 2.7 457 * @since 2.7.0 367 458 * 368 459 * @param string $plugin Relative plugin path from Plugin Directory. … … 455 546 } 456 547 548 /** 549 * Add sub menu page to the management main menu. 550 * 551 * @param string $page_title 552 * @param unknown_type $menu_title 553 * @param unknown_type $access_level 554 * @param unknown_type $file 555 * @param unknown_type $function 556 * @return unknown 557 */ 457 558 function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { 458 559 return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function ); -
trunk/wp-admin/includes/post.php
r8889 r8912 2 2 3 3 /** 4 * _wp_translate_postdata() -Rename $_POST data from form names to DB post columns.4 * Rename $_POST data from form names to DB post columns. 5 5 * 6 6 * Manipulates $_POST directly. … … 196 196 $text = funky_javascript_fix( $text); 197 197 $popupurl = clean_url($_REQUEST['popupurl']); 198 199 198 $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text"; 199 } 200 200 201 201 if ( !empty( $_REQUEST['excerpt'] ) ) … … 227 227 228 228 function get_default_page_to_edit() { 229 230 231 229 $page = get_default_post_to_edit(); 230 $page->post_type = 'page'; 231 return $page; 232 232 } 233 233 -
trunk/wp-admin/includes/widgets.php
r8700 r8912 1 1 <?php 2 3 // $_search is unsanitized 2 /** 3 * WordPress Widgets Administration API 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** 10 * Display list of widgets, either all or matching search. 11 * 12 * @since unknown 13 * 14 * @param unknown_type $show 15 * @param unknown_type $_search Optional. Search for widgets. Should be unsanitized. 16 */ 4 17 function wp_list_widgets( $show = 'all', $_search = false ) { 5 18 global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls; … … 149 162 } 150 163 151 152 164 /** 165 * {@internal Missing Short Description}} 166 * 167 * @since unknown 168 * 169 * @param unknown_type $sidebar 170 */ 153 171 function wp_list_widget_controls( $sidebar ) { 154 172 add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' ); … … 164 182 } 165 183 166 184 /** 185 * {@internal Missing Short Description}} 186 * 187 * @since unknown 188 * 189 * @param unknown_type $params 190 * @return unknown 191 */ 167 192 function wp_list_widget_controls_dynamic_sidebar( $params ) { 168 193 global $wp_registered_widgets; … … 183 208 } 184 209 185 /* 186 * Meta widget used to display the control form for a widget. Called from dynamic_sidebar() 210 /** 211 * Meta widget used to display the control form for a widget. 212 * 213 * Called from dynamic_sidebar(). 214 * 215 * @since unknown 216 * 217 * @param unknown_type $sidebar_args 218 * @return unknown 187 219 */ 188 220 function wp_widget_control( $sidebar_args ) { … … 277 309 } 278 310 311 /** 312 * {@internal Missing Short Description}} 313 * 314 * @since unknown 315 * 316 * @param unknown_type $string 317 * @return unknown 318 */ 279 319 function wp_widget_control_ob_filter( $string ) { 280 320 if ( false === $beg = strpos( $string, '%BEG_OF_TITLE%' ) )
Note: See TracChangeset
for help on using the changeset viewer.