WordPress.org

Make WordPress Core

Ticket #7527: 7527.r8653.patch

File 7527.r8653.patch, 30.7 KB (added by santosj, 10 years ago)

Incomplete patch with all template inline documentation to work on this weekend.

  • bookmark.php

     
    11<?php
     2/**
     3 * WordPress Bookmark Administration API
     4 *
     5 * @package WordPress
     6 * @subpackage Administration
     7 */
    28
     9/**
     10 * {@internal Missing Short Description}}
     11 *
     12 * @since unknown
     13 *
     14 * @return unknown
     15 */
    316function add_link() {
    417        return edit_link();
    518}
    619
     20/**
     21 * {@internal Missing Short Description}}
     22 *
     23 * @since unknown
     24 *
     25 * @param unknown_type $link_id
     26 * @return unknown
     27 */
    728function edit_link( $link_id = '' ) {
    829        if (!current_user_can( 'manage_links' ))
    930                wp_die( __( 'Cheatin&#8217; uh?' ));
     
    2445        }
    2546}
    2647
     48/**
     49 * {@internal Missing Short Description}}
     50 *
     51 * @since unknown
     52 *
     53 * @return unknown
     54 */
    2755function get_default_link_to_edit() {
    2856        if ( isset( $_GET['linkurl'] ) )
    2957                $link->link_url = clean_url( $_GET['linkurl']);
     
    4068        return $link;
    4169}
    4270
     71/**
     72 * {@internal Missing Short Description}}
     73 *
     74 * @since unknown
     75 *
     76 * @param unknown_type $link_id
     77 * @return unknown
     78 */
    4379function wp_delete_link($link_id) {
    4480        global $wpdb;
    4581
     
    5490        return true;
    5591}
    5692
     93/**
     94 * {@internal Missing Short Description}}
     95 *
     96 * @since unknown
     97 *
     98 * @param unknown_type $link_id
     99 * @return unknown
     100 */
    57101function wp_get_link_cats($link_id = 0) {
    58102
    59103        $cats = wp_get_object_terms($link_id, 'link_category', 'fields=ids');
     
    61105        return array_unique($cats);
    62106}
    63107
     108/**
     109 * {@internal Missing Short Description}}
     110 *
     111 * @since unknown
     112 *
     113 * @param unknown_type $link_id
     114 * @return unknown
     115 */
    64116function get_link_to_edit( $link_id ) {
    65117        return get_bookmark( $link_id, OBJECT, 'edit' );
    66118}
    67119
     120/**
     121 * {@internal Missing Short Description}}
     122 *
     123 * @since unknown
     124 *
     125 * @param unknown_type $linkdata
     126 * @return unknown
     127 */
    68128function wp_insert_link($linkdata) {
    69129        global $wpdb, $current_user;
    70130
     
    140200        return $link_id;
    141201}
    142202
     203/**
     204 * {@internal Missing Short Description}}
     205 *
     206 * @since unknown
     207 *
     208 * @param unknown_type $link_id
     209 * @param unknown_type $link_categories
     210 */
    143211function wp_set_link_cats($link_id = 0, $link_categories = array()) {
    144212        // If $link_categories isn't already an array, make it one:
    145213        if (!is_array($link_categories) || 0 == count($link_categories))
     
    151219        wp_set_object_terms($link_id, $link_categories, 'link_category');
    152220}       // wp_set_link_cats()
    153221
     222/**
     223 * {@internal Missing Short Description}}
     224 *
     225 * @since unknown
     226 *
     227 * @param unknown_type $linkdata
     228 * @return unknown
     229 */
    154230function wp_update_link($linkdata) {
    155231        $link_id = (int) $linkdata['link_id'];
    156232
  • comment.php

     
    11<?php
     2/**
     3 * WordPress Comment Administration API
     4 *
     5 * @package WordPress
     6 * @subpackage Administration
     7 */
    28
    39/**
    410 * {@internal Missing Short Description}}
     
    1824}
    1925
    2026/**
    21  *
     27 * {@internal Missing Short Description}}
    2228 *
     29 * @since unknown
    2330 */
    2431function edit_comment() {
    2532
     
    4249                }
    4350        }
    4451
    45 
    4652        if (!empty ( $_POST['edit_date'] ) ) {
    4753                $aa = $_POST['aa'];
    4854                $mm = $_POST['mm'];
     
    6066        wp_update_comment( $_POST);
    6167}
    6268
     69/**
     70 * {@internal Missing Short Description}}
     71 *
     72 * @since unknown
     73 *
     74 * @param unknown_type $id
     75 * @return unknown
     76 */
    6377function get_comment_to_edit( $id ) {
    6478        if ( !$comment = get_comment($id) )
    6579                return false;
     
    7892        return $comment;
    7993}
    8094
     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 */
    81104function get_pending_comments_num( $post_id ) {
    82105        global $wpdb;
    83106
     
    104127        return $pending_keyed;
    105128}
    106129
    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 */
    109139function floated_admin_avatar( $name ) {
    110140        global $comment;
    111141
  • dashboard.php

     
    11<?php
     2/**
     3 * WordPress Dashboard Widget Administration Panel API
     4 *
     5 * @package WordPress
     6 * @subpackage Administration
     7 */
    28
    3 // Registers dashboard widgets, handles POST data, sets up filters
     9/**
     10 * Registers dashboard widgets.
     11 *
     12 * handles POST data, sets up filters.
     13 *
     14 * @since unknown
     15 */
    416function wp_dashboard_setup() {
    517        global $wpdb, $wp_dashboard_sidebars;
    618        $update = false;
     
    158170                update_option( 'dashboard_widget_options', $widget_options );
    159171}
    160172
    161 // Echoes out the dashboard
     173/**
     174 * Displays the dashboard.
     175 *
     176 * @since unknown
     177 */
    162178function wp_dashboard() {
    163179        echo "<div id='dashboard-widgets'>\n\n";
    164180
     
    170186        echo "<br class='clear' />\n</div>\n\n\n";
    171187}
    172188
    173 // Makes sidebar_widgets option reflect the dashboard settings
     189/**
     190 * Makes sidebar_widgets option reflect the dashboard settings.
     191 *
     192 * @since unknown
     193 *
     194 * @return array WordPress Dashboard Widgets list.
     195 */
    174196function wp_dashboard_sidebars_widgets() { // hackery
    175197        return $GLOBALS['wp_dashboard_sidebars'];
    176198}
    177199
    178200// Modifies sidbar params on the fly to set up ids, class names, titles for each widget (called once per widget)
    179201// Switches widget to edit mode if $_GET['edit']
     202/**
     203 * {@internal Missing Short Description}}
     204 *
     205 * @since unknown
     206 *
     207 * @param unknown_type $params
     208 * @return unknown
     209 */
    180210function wp_dashboard_dynamic_sidebar_params( $params ) {
    181211        global $wp_registered_widgets, $wp_registered_widget_controls;
    182212
     
    258288
    259289/* Dashboard Widgets */
    260290
     291/**
     292 * Display recent comments dashboard widget content.
     293 *
     294 * @since unknown
     295 *
     296 * @param unknown_type $sidebar_args
     297 */
    261298function wp_dashboard_recent_comments( $sidebar_args ) {
    262299        global $comment;
    263300        extract( $sidebar_args, EXTR_SKIP );
     
    311348        echo $after_widget;
    312349}
    313350
    314 // $sidebar_args are handled by wp_dashboard_empty()
     351/**
     352 * Display incoming links dashboard widget content.
     353 *
     354 * $sidebar_args are handled by wp_dashboard_empty().
     355 *
     356 * @since unknown
     357 */
    315358function wp_dashboard_incoming_links_output() {
    316359        $widgets = get_option( 'dashboard_widget_options' );
    317360        @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
     
    371414        }
    372415}
    373416
    374 // $sidebar_args are handled by wp_dashboard_empty()
     417/**
     418 * {@internal Missing Short Description}}
     419 *
     420 * $sidebar_args are handled by wp_dashboard_empty().
     421 *
     422 * @since unknown
     423 *
     424 * @param int $widget_id
     425 */
    375426function wp_dashboard_rss_output( $widget_id ) {
    376427        $widgets = get_option( 'dashboard_widget_options' );
    377428        wp_widget_rss_output( $widgets[$widget_id] );
    378429}
    379430
    380 // $sidebar_args are handled by wp_dashboard_empty()
     431/**
     432 * Display secondary dashboard RSS widget feed.
     433 *
     434 * $sidebar_args are handled by wp_dashboard_empty().
     435 *
     436 * @since unknown
     437 *
     438 * @return unknown
     439 */
    381440function wp_dashboard_secondary_output() {
    382441        $widgets = get_option( 'dashboard_widget_options' );
    383442        @extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
     
    399458        echo "</ul>\n<br class='clear' />\n";
    400459}
    401460
    402 // $sidebar_args are handled by wp_dashboard_empty()
     461/**
     462 * Display plugins most popular, newest plugins, and recently updated widget text.
     463 *
     464 * $sidebar_args are handled by wp_dashboard_empty().
     465 *
     466 * @since unknown
     467 */
    403468function wp_dashboard_plugins_output() {
    404469        $popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
    405470        $new     = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
     
    447512        }
    448513}
    449514
    450 // Checks to see if all of the feed url in $check_urls are cached.
    451 // If $check_urls is empty, look for the rss feed url found in the dashboard widget optios of $widget_id.
    452 // If cached, call $callback, a function that echoes out output for this widget.
    453 // If not cache, echo a "Loading..." stub which is later replaced by AJAX call (see top of /wp-admin/index.php)
     515/**
     516 * Checks to see if all of the feed url in $check_urls are cached.
     517 *
     518 * If $check_urls is empty, look for the rss feed url found in the dashboard
     519 * widget optios of $widget_id. If cached, call $callback, a function that
     520 * echoes out output for this widget. If not cache, echo a "Loading..." stub
     521 * which is later replaced by AJAX call (see top of /wp-admin/index.php)
     522 *
     523 * @since unknown
     524 *
     525 * @param int $widget_id
     526 * @param callback $callback
     527 * @param array $check_urls RSS feeds
     528 * @return bool False on failure. True on success.
     529 */
    454530function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
    455531        $loading = '<p class="widget-loading">' . __( 'Loading&#8230;' ) . '</p>';
    456532
     
    486562        return true;
    487563}
    488564
    489 // Empty widget used for JS/AJAX created output.
    490 // Callback inserts content between before_widget and after_widget.  Used when widget is in edit mode.  Can also be used for custom widgets.
     565/**
     566 * Empty widget used for JS/AJAX created output.
     567 *
     568 * Callback inserts content between before_widget and after_widget. Used when
     569 * widget is in edit mode. Can also be used for custom widgets.
     570 *
     571 * @since unknown
     572 *
     573 * @param array $sidebar_args
     574 * @param callback $callback Optional. Only used in edit mode.
     575 */
    491576function wp_dashboard_empty( $sidebar_args, $callback = false ) {
    492577        extract( $sidebar_args, EXTR_SKIP );
    493578
     
    507592        echo $after_widget;
    508593}
    509594
    510 /* Dashboard Widgets Controls. Ssee also wp_dashboard_empty() */
     595/* Dashboard Widgets Controls. See also wp_dashboard_empty() */
    511596
    512 // Calls widget_control callback
     597/**
     598 * Calls widget control callback.
     599 *
     600 * @since unknown
     601 *
     602 * @param int $widget_control_id Registered Widget ID.
     603 */
    513604function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
    514605        global $wp_registered_widget_controls;
    515606        if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_registered_widget_controls[$widget_control_id]) && is_callable($wp_registered_widget_controls[$widget_control_id]['callback']) )
    516607                call_user_func_array( $wp_registered_widget_controls[$widget_control_id]['callback'], $wp_registered_widget_controls[$widget_control_id]['params'] );
    517608}
    518609
    519 // Sets up $args to be used as input to wp_widget_rss_form(), handles POST data from RSS-type widgets
     610/**
     611 * The RSS dashboard widget control.
     612 *
     613 * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data
     614 * from RSS-type widgets.
     615 *
     616 * @since unknown
     617 *
     618 * @param array $args Expects 'widget_id' and 'form_inputs'.
     619 * @return bool|null False if no widget_id is given. Null on success.
     620 */
    520621function wp_dashboard_rss_control( $args ) {
    521622        extract( $args );
    522623        if ( !$widget_id )
  • export.php

     
    11<?php
     2/**
     3 * WordPress Export Administration API
     4 *
     5 * @package WordPress
     6 * @subpackage Administration
     7 */
    28
    3 // version number for the export format.  bump this when something changes that might affect compatibility.
     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 */
    417define('WXR_VERSION', '1.0');
    518
     19/**
     20 * {@internal Missing Short Description}}
     21 *
     22 * @since unknown
     23 *
     24 * @param unknown_type $author
     25 */
    626function export_wp($author='') {
    727global $wpdb, $post_ids, $post;
    828
     
    2646$categories = (array) get_categories('get=all');
    2747$tags = (array) get_tags('get=all');
    2848
     49/**
     50 * {@internal Missing Short Description}}
     51 *
     52 * @since unknown
     53 *
     54 * @param unknown_type $categories
     55 */
    2956function wxr_missing_parents($categories) {
    3057        if ( !is_array($categories) || empty($categories) )
    3158                return array();
     
    6188}
    6289unset($categories);
    6390
     91/**
     92 * Place string in CDATA tag.
     93 *
     94 * @since unknown
     95 *
     96 * @param string $str String to place in XML CDATA tag.
     97 */
    6498function wxr_cdata($str) {
    6599        if ( seems_utf8($str) == false )
    66100                $str = utf8_encode($str);
     
    72106        return $str;
    73107}
    74108
     109/**
     110 * {@internal Missing Short Description}}
     111 *
     112 * @since unknown
     113 *
     114 * @return string Site URL.
     115 */
    75116function wxr_site_url() {
    76117        global $current_site;
    77118
     
    85126        }
    86127}
    87128
     129/**
     130 * {@internal Missing Short Description}}
     131 *
     132 * @since unknown
     133 *
     134 * @param object $c Category Object
     135 */
    88136function wxr_cat_name($c) {
    89137        if ( empty($c->name) )
    90138                return;
     
    92140        echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
    93141}
    94142
     143/**
     144 * {@internal Missing Short Description}}
     145 *
     146 * @since unknown
     147 *
     148 * @param object $c Category Object
     149 */
    95150function wxr_category_description($c) {
    96151        if ( empty($c->description) )
    97152                return;
     
    99154        echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
    100155}
    101156
     157/**
     158 * {@internal Missing Short Description}}
     159 *
     160 * @since unknown
     161 *
     162 * @param object $t Tag Object
     163 */
    102164function wxr_tag_name($t) {
    103165        if ( empty($t->name) )
    104166                return;
     
    106168        echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
    107169}
    108170
     171/**
     172 * {@internal Missing Short Description}}
     173 *
     174 * @since unknown
     175 *
     176 * @param object $t Tag Object
     177 */
    109178function wxr_tag_description($t) {
    110179        if ( empty($t->description) )
    111180                return;
     
    113182        echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
    114183}
    115184
     185/**
     186 * {@internal Missing Short Description}}
     187 *
     188 * @since unknown
     189 */
    116190function wxr_post_taxonomy() {
    117191        $categories = get_the_category();
    118192        $tags = get_the_tags();
  • image.php

     
    33 * File contains all the administration image manipulation functions.
    44 *
    55 * @package WordPress
     6 * @subpackage Administration
    67 */
    78
    89/**
    9  * wp_create_thumbnail() - Create a thumbnail from an Image given a maximum side size.
     10 * Create a thumbnail from an Image given a maximum side size.
    1011 *
    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
     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.
    1515 *
    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.
     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.
    1821 */
    1922function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
    20 
    2123        $thumbpath = image_resize( $file, $max_side, $max_side );
    2224        return apply_filters( 'wp_create_thumbnail', $thumbpath );
    2325}
    2426
    2527/**
    26  * wp_crop_image() - Crop an Image to a given size.
     28 * Crop an Image to a given size.
    2729 *
    28  * @package WordPress
    2930 * @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
    4031 *
     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.
    4144 */
    4245function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
    4346        if ( is_numeric( $src_file ) ) // Handle int as attachment ID
     
    7477}
    7578
    7679/**
    77  * wp_generate_attachment_metadata() - Generate post Image attachment Metadata
     80 * Generate post Image attachment Metadata.
    7881 *
    79  * @package WordPress
    8082 * @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
    8483 *
     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
    8589 */
    8690function wp_generate_attachment_metadata( $attachment_id, $file ) {
    8791        $attachment = get_post( $attachment_id );
     
    111115                        $metadata['image_meta'] = $image_meta;
    112116
    113117        }
     118
    114119        return apply_filters( 'wp_generate_attachment_metadata', $metadata );
    115120}
    116121
    117122/**
    118  * wp_load_image() - Load an image which PHP Supports.
     123 * Load an image which PHP Supports.
    119124 *
    120  * @package WordPress
    121125 * @internal Missing Long Description
    122  * @param       string  $file   Filename of the image to load
    123  * @return      resource                The resulting image resource on success, Error string on failure.
    124126 *
     127 * @since unknown
     128 *
     129 * @param string $file Filename of the image to load.
     130 * @return resource The resulting image resource on success, Error string on failure.
    125131 */
    126132function wp_load_image( $file ) {
    127133        if ( is_numeric( $file ) )
     
    144150}
    145151
    146152/**
    147  * get_udims() - Calculated the new dimentions for downsampled images
     153 * Calculated the new dimentions for downsampled images.
    148154 *
    149  * @package WordPress
    150  * @internal Missing Description
     155 * @since unknown
    151156 * @see wp_shrink_dimensions()
    152  * @param       int             $width  Current width of the image
    153  * @param       int     $height Current height of the image
    154  * @return      mixed                   Array(height,width) of shrunk dimensions.
    155157 *
     158 * @param int $width Current width of the image
     159 * @param int $height Current height of the image
     160 * @return mixed Array(height,width) of shrunk dimensions.
     161 *
    156162 */
    157163function get_udims( $width, $height) {
    158164        return wp_shrink_dimensions( $width, $height );
    159165}
     166
    160167/**
    161  * wp_shrink_dimensions() - Calculates the new dimentions for a downsampled image.
     168 * Calculates the new dimentions for a downsampled image.
    162169 *
    163  * @package WordPress
    164  * @internal Missing Long Description
    165  * @param       int             $width  Current width of the image
    166  * @param       int     $height Current height of the image
    167  * @param       int             $wmax   Maximum wanted width
    168  * @param       int             $hmax   Maximum wanted height
    169  * @return      mixed                   Array(height,width) of shrunk dimensions.
     170 * @since unknown
     171 * @see wp_constrain_dimensions()
    170172 *
     173 * @param int $width Current width of the image
     174 * @param int $height Current height of the image
     175 * @param int $wmax Maximum wanted width
     176 * @param int $hmax Maximum wanted height
     177 * @return mixed Array(height,width) of shrunk dimensions.
     178 *
    171179 */
    172180function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
    173181        return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
    174182}
    175183
    176 // convert a fraction string to a decimal
     184/**
     185 * Convert a fraction string to a decimal.
     186 *
     187 * @since unknown
     188 *
     189 * @param string $str
     190 * @return int|float
     191 */
    177192function wp_exif_frac2dec($str) {
    178193        @list( $n, $d ) = explode( '/', $str );
    179194        if ( !empty($d) )
     
    181196        return $str;
    182197}
    183198
    184 // convert the exif date format to a unix timestamp
     199/**
     200 * Convert the exif date format to a unix timestamp.
     201 *
     202 * @since unknown
     203 *
     204 * @param string $str
     205 * @return int
     206 */
    185207function wp_exif_date2ts($str) {
    186         // seriously, who formats a date like 'YYYY:MM:DD hh:mm:ss'?
    187208        @list( $date, $time ) = explode( ' ', trim($str) );
    188209        @list( $y, $m, $d ) = explode( ':', $date );
    189210
    190211        return strtotime( "{$y}-{$m}-{$d} {$time}" );
    191212}
    192213
    193 // get extended image metadata, exif or iptc as available
     214/**
     215 * Get extended image metadata, exif or iptc as available
     216 *
     217 * @since unknown
     218 *
     219 * @param string $file
     220 * @return bool|array False on failure. Image metadata array on success.
     221 */
    194222function wp_read_image_metadata( $file ) {
    195223        if ( !file_exists( $file ) )
    196224                return false;
    197225
    198226        list(,,$sourceImageType) = getimagesize( $file );
    199227
    200         // exif contains a bunch of data we'll probably never need formatted in ways that are difficult to use.
    201         // We'll normalize it and just extract the fields that are likely to be useful.  Fractions and numbers
    202         // are converted to floats, dates to unix timestamps, and everything else to strings.
     228        // exif contains a bunch of data we'll probably never need formatted in ways
     229        // that are difficult to use. We'll normalize it and just extract the fields
     230        // that are likely to be useful.  Fractions and numbers are converted to
     231        // floats, dates to unix timestamps, and everything else to strings.
    203232        $meta = array(
    204233                'aperture' => 0,
    205234                'credit' => '',
     
    213242                'title' => '',
    214243        );
    215244
    216         // read iptc first, since it might contain data not available in exif such as caption, description etc
     245        // read iptc first, since it might contain data not available in exif such
     246        // as caption, description etc
    217247        if ( is_callable('iptcparse') ) {
    218248                getimagesize($file, $info);
    219249                if ( !empty($info['APP13']) ) {
     
    222252                                $meta['credit'] = trim( $iptc['2#110'][0] );
    223253                        elseif ( !empty($iptc['2#080'][0]) ) // byline
    224254                                $meta['credit'] = trim( $iptc['2#080'][0] );
    225                         if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created datee and time
     255                        if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created date and time
    226256                                $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
    227257                        if ( !empty($iptc['2#120'][0]) ) // caption
    228258                                $meta['caption'] = trim( $iptc['2#120'][0] );
     
    249279                if (!empty($exif['ExposureTime']))
    250280                        $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] );
    251281        }
    252         // FIXME: try other exif libraries if available
     282        /** @todo FIXME: try other exif libraries if available */
    253283
    254284        return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
    255285
    256286}
    257287
    258 // is the file a real image file?
     288/**
     289 * Validate that file is an image.
     290 *
     291 * @since unknown
     292 *
     293 * @param string $path File path to test if valid image.
     294 * @return bool True if valid image, false if not valid image.
     295 */
    259296function file_is_valid_image($path) {
    260297        $size = @getimagesize($path);
    261298        return !empty($size);
    262299}
    263300
    264 // is the file an image suitable for displaying within a web page?
     301/**
     302 * Validate that file is suitable for displaying within a web page.
     303 *
     304 * @since unknown
     305 * @uses apply_filters() Calls 'file_is_displayable_image' on $result and $path.
     306 *
     307 * @param string $path File path to test.
     308 * @return bool True if suitable, false if not suitable.
     309 */
    265310function file_is_displayable_image($path) {
    266311        $info = @getimagesize($path);
    267312        if ( empty($info) )
  • import.php

     
    4444        return array( 'file' => $file, 'id' => $id );
    4545}
    4646
    47 ?>
     47?>
     48 No newline at end of file
  • media.php

     
    688688                        'html'       => image_link_input_fields($post, get_option('image_default_link_type')),
    689689                        'helps'      => __('Enter a link URL or click above for presets.'),
    690690                ),
    691         'menu_order'   => array(
     691                'menu_order'   => array(
    692692                        'label'      => __('Order'),
    693693                        'value'      => $edit_post->menu_order
    694694                ),
     
    14881488
    14891489// support a GET parameter for disabling the flash uploader
    14901490function media_upload_use_flash($flash) {
    1491         if ( array_key_exists('flash', $_REQUEST) )
    1492                 $flash = !empty($_REQUEST['flash']);
    1493         return $flash;
     1491        if ( array_key_exists('flash', $_REQUEST) )
     1492                $flash = !empty($_REQUEST['flash']);
     1493        return $flash;
    14941494}
    14951495
    14961496add_filter('flash_uploader', 'media_upload_use_flash');
    14971497
    14981498function media_upload_flash_bypass() {
    1499         echo '<p class="upload-flash-bypass">';
    1500         printf( __('You are using the Flash uploader.  Problems?  Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
    1501         echo '</p>';
     1499        echo '<p class="upload-flash-bypass">';
     1500        printf( __('You are using the Flash uploader.  Problems?  Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
     1501        echo '</p>';
    15021502}
    15031503
    15041504add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
    15051505
    15061506function media_upload_html_bypass() {
    1507         echo '<p class="upload-html-bypass">';
    1508         if ( array_key_exists('flash', $_REQUEST) )
    1509                 // the user manually selected the browser uploader, so let them switch back to Flash
    1510                 printf( __('You are using the Browser uploader.  Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
    1511         else
    1512                 // the user probably doesn't have Flash
    1513                 printf( __('You are using the Browser uploader.') );
     1507        echo '<p class="upload-html-bypass">';
     1508        if ( array_key_exists('flash', $_REQUEST) )
     1509                // the user manually selected the browser uploader, so let them switch back to Flash
     1510                printf( __('You are using the Browser uploader.  Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
     1511        else
     1512                // the user probably doesn't have Flash
     1513                printf( __('You are using the Browser uploader.') );
    15141514
    1515         echo '</p>';
     1515        echo '</p>';
    15161516}
    15171517
    15181518add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
     
    15201520
    15211521// make sure the GET parameter sticks when we submit a form
    15221522function media_upload_bypass_url($url) {
    1523         if ( array_key_exists('flash', $_REQUEST) )
    1524                 $url = add_query_arg('flash', intval($_REQUEST['flash']));
    1525         return $url;
     1523        if ( array_key_exists('flash', $_REQUEST) )
     1524                $url = add_query_arg('flash', intval($_REQUEST['flash']));
     1525        return $url;
    15261526}
    15271527
    15281528add_filter('media_upload_form_url', 'media_upload_bypass_url');
  • post.php

     
    11<?php
    22
    33/**
    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.
    55 *
    66 * Manipulates $_POST directly.
    77 *
     
    189189                $text       = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
    190190                $text       = funky_javascript_fix( $text);
    191191                $popupurl   = clean_url($_REQUEST['popupurl']);
    192         $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
    193     }
     192                $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
     193        }
    194194
    195195        if ( !empty( $_REQUEST['excerpt'] ) )
    196196                $post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
     
    220220}
    221221
    222222function get_default_page_to_edit() {
    223         $page = get_default_post_to_edit();
    224         $page->post_type = 'page';
    225         return $page;
     223        $page = get_default_post_to_edit();
     224        $page->post_type = 'page';
     225        return $page;
    226226}
    227227
    228228// Get an existing post and format it for editing.
  • theme.php

     
    11<?php
     2/**
     3 * WordPress Theme Administration API
     4 *
     5 * @package WordPress
     6 * @subpackage Administration
     7 */
    28
     9/**
     10 * {@internal Missing Short Description}}
     11 *
     12 * @since unknown
     13 *
     14 * @return unknown
     15 */
    316function current_theme_info() {
    417        $themes = get_themes();
    518        $current_theme = get_current_theme();
     
    1831        return $ct;
    1932}
    2033
     34/**
     35 * {@internal Missing Short Description}}
     36 *
     37 * @since unknown
     38 *
     39 * @return unknown
     40 */
    2141function get_broken_themes() {
    2242        global $wp_broken_themes;
    2343
     
    2545        return $wp_broken_themes;
    2646}
    2747
     48/**
     49 * {@internal Missing Short Description}}
     50 *
     51 * @since unknown
     52 *
     53 * @return unknown
     54 */
    2855function get_page_templates() {
    2956        $themes = get_themes();
    3057        $theme = get_current_theme();
     
    5279        return $page_templates;
    5380}
    5481
    55 ?>
     82?>
     83 No newline at end of file
  • widgets.php

     
    11<?php
     2/**
     3 * WordPress Widgets Administration API
     4 *
     5 * @package WordPress
     6 * @subpackage Administration
     7 */
    28
    3 // $_search is unsanitized
     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 */
    417function wp_list_widgets( $show = 'all', $_search = false ) {
    518        global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
    619        if ( $_search ) {
     
    148161<?php
    149162}
    150163
    151 
    152 
     164/**
     165 * {@internal Missing Short Description}}
     166 *
     167 * @since unknown
     168 *
     169 * @param unknown_type $sidebar
     170 */
    153171function wp_list_widget_controls( $sidebar ) {
    154172        add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
    155173?>
     
    163181<?php
    164182}
    165183
    166 
     184/**
     185 * {@internal Missing Short Description}}
     186 *
     187 * @since unknown
     188 *
     189 * @param unknown_type $params
     190 * @return unknown
     191 */
    167192function wp_list_widget_controls_dynamic_sidebar( $params ) {
    168193        global $wp_registered_widgets;
    169194        static $i = 0;
     
    182207        return $params;
    183208}
    184209
    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
    187219 */
    188220function wp_widget_control( $sidebar_args ) {
    189221        global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
     
    276308        return $sidebar_args;
    277309}
    278310
     311/**
     312 * {@internal Missing Short Description}}
     313 *
     314 * @since unknown
     315 *
     316 * @param unknown_type $string
     317 * @return unknown
     318 */
    279319function wp_widget_control_ob_filter( $string ) {
    280320        if ( false === $beg = strpos( $string, '%BEG_OF_TITLE%' ) )
    281321                return '';
     
    286326        return trim( wp_specialchars( strip_tags( $string ) ) );
    287327}
    288328
    289 ?>
     329?>
     330 No newline at end of file