Make WordPress Core

Ticket #7527: 7527.r8903.patch

File 7527.r8903.patch, 35.2 KB (added by jacobsantos, 16 years ago)

Inline documentation for wp-admin/includes files based off of r8903

  • 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;
     
    193205                update_option( 'dashboard_widget_options', $widget_options );
    194206}
    195207
    196 // Echoes out the dashboard
     208/**
     209 * Displays the dashboard.
     210 *
     211 * @since unknown
     212 */
    197213function wp_dashboard() {
    198214        echo "<div id='dashboard-widgets'>\n\n";
    199215
     
    205221        echo "<br class='clear' />\n</div>\n\n\n";
    206222}
    207223
    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 */
    209231function wp_dashboard_sidebars_widgets() { // hackery
    210232        return $GLOBALS['wp_dashboard_sidebars'];
    211233}
    212234
    213235// Modifies sidbar params on the fly to set up ids, class names, titles for each widget (called once per widget)
    214236// 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 */
    215245function wp_dashboard_dynamic_sidebar_params( $params ) {
    216246        global $wp_registered_widgets, $wp_registered_widget_controls;
    217247
     
    483513        echo $after_widget;
    484514}
    485515
     516/**
     517 * Display recent comments dashboard widget content.
     518 *
     519 * @since unknown
     520 *
     521 * @param unknown_type $sidebar_args
     522 */
    486523function wp_dashboard_recent_comments( $sidebar_args ) {
    487524        global $comment;
    488525        extract( $sidebar_args, EXTR_SKIP );
     
    536573        echo $after_widget;
    537574}
    538575
    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 */
    540583function wp_dashboard_incoming_links_output() {
    541584        $widgets = get_option( 'dashboard_widget_options' );
    542585        @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
     
    596639        }
    597640}
    598641
    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 */
    600651function wp_dashboard_rss_output( $widget_id ) {
    601652        $widgets = get_option( 'dashboard_widget_options' );
    602653        wp_widget_rss_output( $widgets[$widget_id] );
    603654}
    604655
    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 */
    606665function wp_dashboard_secondary_output() {
    607666        $widgets = get_option( 'dashboard_widget_options' );
    608667        @extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
     
    624683        echo "</ul>\n<br class='clear' />\n";
    625684}
    626685
    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 */
    628693function wp_dashboard_plugins_output() {
    629694        $popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
    630695        $new     = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
     
    672737        }
    673738}
    674739
    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 */
    679755function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
    680756        $loading = '<p class="widget-loading">' . __( 'Loading&#8230;' ) . '</p>';
    681757
     
    711787        return true;
    712788}
    713789
    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 */
    716801function wp_dashboard_empty( $sidebar_args, $callback = false ) {
    717802        extract( $sidebar_args, EXTR_SKIP );
    718803
     
    732817        echo $after_widget;
    733818}
    734819
    735 /* Dashboard Widgets Controls. Ssee also wp_dashboard_empty() */
     820/* Dashboard Widgets Controls. See also wp_dashboard_empty() */
    736821
    737822// Temp
    738823function wp_dashboard_empty_control() {
     
    740825}
    741826
    742827// 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 */
    743835function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
    744836        global $wp_registered_widget_controls;
    745837        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']) )
    746838                call_user_func_array( $wp_registered_widget_controls[$widget_control_id]['callback'], $wp_registered_widget_controls[$widget_control_id]['params'] );
    747839}
    748840
    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 */
    750852function wp_dashboard_rss_control( $args ) {
    751853        extract( $args );
    752854        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 );
     
    120124                        $metadata['image_meta'] = $image_meta;
    121125
    122126        }
     127
    123128        return apply_filters( 'wp_generate_attachment_metadata', $metadata );
    124129}
    125130
    126131/**
    127  * wp_load_image() - Load an image which PHP Supports.
     132 * Load an image which PHP Supports.
    128133 *
    129  * @package WordPress
    130134 * @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.
    133135 *
     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.
    134140 */
    135141function wp_load_image( $file ) {
    136142        if ( is_numeric( $file ) )
     
    153159}
    154160
    155161/**
    156  * get_udims() - Calculated the new dimentions for downsampled images
     162 * Calculated the new dimentions for downsampled images.
    157163 *
    158  * @package WordPress
    159  * @internal Missing Description
     164 * @since unknown
    160165 * @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.
    164166 *
     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.
     170 *
    165171 */
    166172function get_udims( $width, $height) {
    167173        return wp_shrink_dimensions( $width, $height );
    168174}
     175
    169176/**
    170  * wp_shrink_dimensions() - Calculates the new dimentions for a downsampled image.
     177 * Calculates the new dimentions for a downsampled image.
    171178 *
    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.
     179 * @since unknown
     180 * @see wp_constrain_dimensions()
    179181 *
     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.
     187 *
    180188 */
    181189function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
    182190        return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
    183191}
    184192
    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 */
    186201function wp_exif_frac2dec($str) {
    187202        @list( $n, $d ) = explode( '/', $str );
    188203        if ( !empty($d) )
     
    190205        return $str;
    191206}
    192207
    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 */
    194216function wp_exif_date2ts($str) {
    195         // seriously, who formats a date like 'YYYY:MM:DD hh:mm:ss'?
    196217        @list( $date, $time ) = explode( ' ', trim($str) );
    197218        @list( $y, $m, $d ) = explode( ':', $date );
    198219
    199220        return strtotime( "{$y}-{$m}-{$d} {$time}" );
    200221}
    201222
    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 */
    203231function wp_read_image_metadata( $file ) {
    204232        if ( !file_exists( $file ) )
    205233                return false;
    206234
    207235        list(,,$sourceImageType) = getimagesize( $file );
    208236
    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.
    212241        $meta = array(
    213242                'aperture' => 0,
    214243                'credit' => '',
     
    222251                'title' => '',
    223252        );
    224253
    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
    226256        if ( is_callable('iptcparse') ) {
    227257                getimagesize($file, $info);
    228258                if ( !empty($info['APP13']) ) {
     
    231261                                $meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
    232262                        elseif ( !empty($iptc['2#080'][0]) ) // byline
    233263                                $meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
    234                         if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created datee and time
     264                        if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created date and time
    235265                                $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
    236266                        if ( !empty($iptc['2#120'][0]) ) // caption
    237267                                $meta['caption'] = utf8_encode(trim($iptc['2#120'][0]));
     
    258288                if (!empty($exif['ExposureTime']))
    259289                        $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] );
    260290        }
    261         // FIXME: try other exif libraries if available
     291        /** @todo FIXME: try other exif libraries if available */
    262292
    263293        return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
    264294
    265295}
    266296
    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 */
    268305function file_is_valid_image($path) {
    269306        $size = @getimagesize($path);
    270307        return !empty($size);
    271308}
    272309
    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 */
    274319function file_is_displayable_image($path) {
    275320        $info = @getimagesize($path);
    276321        if ( empty($info) )
  • media.php

     
    691691                        'html'       => image_link_input_fields($post, get_option('image_default_link_type')),
    692692                        'helps'      => __('Enter a link URL or click above for presets.'),
    693693                ),
    694         'menu_order'   => array(
     694                'menu_order'   => array(
    695695                        'label'      => __('Order'),
    696696                        'value'      => $edit_post->menu_order
    697697                ),
     
    14911491
    14921492// support a GET parameter for disabling the flash uploader
    14931493function media_upload_use_flash($flash) {
    1494         if ( array_key_exists('flash', $_REQUEST) )
    1495                 $flash = !empty($_REQUEST['flash']);
    1496         return $flash;
     1494        if ( array_key_exists('flash', $_REQUEST) )
     1495                $flash = !empty($_REQUEST['flash']);
     1496        return $flash;
    14971497}
    14981498
    14991499add_filter('flash_uploader', 'media_upload_use_flash');
    15001500
    15011501function media_upload_flash_bypass() {
    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>';
     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>';
    15051505}
    15061506
    15071507add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
    15081508
    15091509function media_upload_html_bypass() {
    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.') );
     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.') );
    15171517
    1518         echo '</p>';
     1518        echo '</p>';
    15191519}
    15201520
    15211521add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
     
    15231523
    15241524// make sure the GET parameter sticks when we submit a form
    15251525function media_upload_bypass_url($url) {
    1526         if ( array_key_exists('flash', $_REQUEST) )
    1527                 $url = add_query_arg('flash', intval($_REQUEST['flash']));
    1528         return $url;
     1526        if ( array_key_exists('flash', $_REQUEST) )
     1527                $url = add_query_arg('flash', intval($_REQUEST['flash']));
     1528        return $url;
    15291529}
    15301530
    15311531add_filter('media_upload_form_url', 'media_upload_bypass_url');
  • plugin-install.php

     
    11<?php
     2/**
     3 * WordPress Plugin Install Administration API
     4 *
     5 * @package WordPress
     6 * @subpackage Administration
     7 */
    28
    3 function plugins_api($action, $args = NULL) {
     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 */
     27function plugins_api($action, $args = null) {
    428        global $wp_version;
    529
    630        if( is_array($args) )
     
    1943        return apply_filters('plugins_api_result', $res, $action, $args);
    2044}
    2145
     46/**
     47 *
     48 *
     49 * @param unknown_type $args
     50 * @return unknown
     51 */
    2252function install_popular_tags( $args = array() ) {
    2353        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.
    2555
    2656        if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
    2757                return $cache->cached;
  • plugin.php

     
    9696                                );
    9797}
    9898
     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 */
    99119function get_plugins($plugin_folder = '') {
    100120
    101121        if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
     
    169189        return in_array($plugin, get_option('active_plugins'));
    170190}
    171191
     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 */
    172216function activate_plugin($plugin, $redirect = '') {
    173                 $current = get_option('active_plugins');
    174                 $plugin = trim($plugin);
     217        $current = get_option('active_plugins');
     218        $plugin = trim($plugin);
    175219
    176                 $valid = validate_plugin($plugin);
    177                 if ( is_wp_error($valid) )
    178                         return $valid;
     220        $valid = validate_plugin($plugin);
     221        if ( is_wp_error($valid) )
     222                return $valid;
    179223
    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                 }
     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        }
    191235
    192                 return null;
     236        return null;
    193237}
    194238
     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 */
    195250function deactivate_plugins($plugins, $silent= false) {
    196251        $current = get_option('active_plugins');
    197252
     
    209264        update_option('active_plugins', $current);
    210265}
    211266
     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 */
    212281function activate_plugins($plugins, $redirect = '') {
    213282        if ( !is_array($plugins) )
    214283                $plugins = array($plugins);
     
    228297        return true;
    229298}
    230299
     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 */
    231312function delete_plugins($plugins, $redirect = '' ) {
    232313        global $wp_filesystem;
    233314
     
    331412        return $invalid;
    332413}
    333414
     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 */
    334425function validate_plugin($plugin) {
    335426        if ( validate_file($plugin) )
    336427                return new WP_Error('plugin_invalid', __('Invalid plugin path.'));
     
    343434/**
    344435 * Whether the plugin can be uninstalled.
    345436 *
    346  * @since 2.7
     437 * @since 2.7.0
    347438 *
    348439 * @param string $plugin Plugin path to check.
    349440 * @return bool Whether plugin can be uninstalled.
     
    363454 *
    364455 * Calls the uninstall hook, if it is available.
    365456 *
    366  * @since 2.7
     457 * @since 2.7.0
    367458 *
    368459 * @param string $plugin Relative plugin path from Plugin Directory.
    369460 */
     
    454545        return $hookname;
    455546}
    456547
     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 */
    457558function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
    458559        return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function );
    459560}
  • 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 *
     
    195195                $text       = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
    196196                $text       = funky_javascript_fix( $text);
    197197                $popupurl   = clean_url($_REQUEST['popupurl']);
    198         $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
    199     }
     198                $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
     199        }
    200200
    201201        if ( !empty( $_REQUEST['excerpt'] ) )
    202202                $post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
     
    226226}
    227227
    228228function get_default_page_to_edit() {
    229         $page = get_default_post_to_edit();
    230         $page->post_type = 'page';
    231         return $page;
     229        $page = get_default_post_to_edit();
     230        $page->post_type = 'page';
     231        return $page;
    232232}
    233233
    234234// Get an existing post and format it for editing.
  • 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