Ticket #5639: functions.phpdoc.r6597.diff
| File functions.phpdoc.r6597.diff, 30.4 KB (added by , 19 years ago) |
|---|
-
functions.php
1 1 <?php 2 /** 3 * 4 * 5 * @package WordPress 6 */ 2 7 8 /** 9 * mysql2date() - {@internal Missing Short Description}} 10 * 11 * {@internal Missing Long Description}} 12 * 13 * @since 0.71 14 * 15 * @param unknown_type $dateformatstring 16 * @param unknown_type $mysqlstring 17 * @param unknown_type $translate 18 * @return unknown 19 */ 3 20 function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) { 4 21 global $wp_locale; 5 22 $m = $mysqlstring; … … 43 60 return $j; 44 61 } 45 62 46 63 /** 64 * current_time() - {@internal Missing Short Description}} 65 * 66 * {@internal Missing Long Description}} 67 * 68 * @since 1.0.0 69 * 70 * @param unknown_type $type 71 * @param unknown_type $gmt 72 * @return unknown 73 */ 47 74 function current_time( $type, $gmt = 0 ) { 48 75 switch ( $type ) { 49 76 case 'mysql': … … 55 82 } 56 83 } 57 84 58 85 /** 86 * date_i18n() - {@internal Missing Short Description}} 87 * 88 * {@internal Missing Long Description}} 89 * 90 * @since 0.71 91 * 92 * @param unknown_type $dateformatstring 93 * @param unknown_type $unixtimestamp 94 * @return unknown 95 */ 59 96 function date_i18n( $dateformatstring, $unixtimestamp ) { 60 97 global $wp_locale; 61 98 $i = $unixtimestamp; … … 80 117 return $j; 81 118 } 82 119 83 120 /** 121 * number_format_i18n() - {@internal Missing Short Description}} 122 * 123 * {@internal Missing Long Description}} 124 * 125 * @since 2.3.0 126 * 127 * @param unknown_type $number 128 * @param unknown_type $decimals 129 * @return unknown 130 */ 84 131 function number_format_i18n( $number, $decimals = null ) { 85 132 global $wp_locale; 86 133 // let the user override the precision only … … 89 136 return number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); 90 137 } 91 138 92 139 /** 140 * size_format() - {@internal Missing Short Description}} 141 * 142 * {@internal Missing Long Description}} 143 * 144 * @since 2.3.0 145 * 146 * @param unknown_type $bytes 147 * @param unknown_type $decimals 148 * @return unknown 149 */ 93 150 function size_format( $bytes, $decimals = null ) { 94 151 // technically the correct unit names for powers of 1024 are KiB, MiB etc 95 152 // see http://en.wikipedia.org/wiki/Byte … … 107 164 return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit; 108 165 } 109 166 110 167 /** 168 * get_weekstartend() - {@internal Missing Short Description}} 169 * 170 * {@internal Missing Long Description}} 171 * 172 * @since 0.71 173 * 174 * @param unknown_type $mysqlstring 175 * @param unknown_type $start_of_week 176 * @return unknown 177 */ 111 178 function get_weekstartend( $mysqlstring, $start_of_week = '' ) { 112 179 $my = substr( $mysqlstring, 0, 4 ); 113 180 $mm = substr( $mysqlstring, 8, 2 ); … … 134 201 return $week; 135 202 } 136 203 137 204 /** 205 * maybe_unserialize() - {@internal Missing Short Description}} 206 * 207 * {@internal Missing Long Description}} 208 * 209 * @since 2.0.0 210 * 211 * @param unknown_type $original 212 * @return unknown 213 */ 138 214 function maybe_unserialize( $original ) { 139 215 if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in 140 216 if ( false !== $gm = @unserialize( $original ) ) … … 142 218 return $original; 143 219 } 144 220 145 221 /** 222 * is_serialized() - {@internal Missing Short Description}} 223 * 224 * {@internal Missing Long Description}} 225 * 226 * @since 2.0.5 227 * 228 * @param unknown_type $data 229 * @return unknown 230 */ 146 231 function is_serialized( $data ) { 147 232 // if it isn't a string, it isn't serialized 148 233 if ( !is_string( $data ) ) … … 169 254 return false; 170 255 } 171 256 172 257 /** 258 * is_serialized_string() - {@internal Missing Short Description}} 259 * 260 * {@internal Missing Long Description}} 261 * 262 * @since 2.0.5 263 * 264 * @param unknown_type $data 265 * @return unknown 266 */ 173 267 function is_serialized_string( $data ) { 174 268 // if it isn't a string, it isn't a serialized string 175 269 if ( !is_string( $data ) ) … … 183 277 184 278 /* Options functions */ 185 279 186 // expects $setting to already be SQL-escaped 280 /** 281 * get_option() - {@internal Missing Short Description}} 282 * 283 * {@internal Missing Long Description}} 284 * Expects $setting to already be SQL-escaped 285 * 286 * @since 1.5.0 287 * @package WordPress 288 * @subpackage Option 289 * 290 * @param string $setting 291 * @return string 292 */ 187 293 function get_option( $setting ) { 188 294 global $wpdb; 189 295 … … 233 339 return apply_filters( 'option_' . $setting, maybe_unserialize( $value ) ); 234 340 } 235 341 236 342 /** 343 * 344 */ 345 /** 346 * wp_protected_special_option() - {@internal Missing Short Description}} 347 * 348 * {@internal Missing Long Description}} 349 * 350 * @since 2.2.0 351 * @package WordPress 352 * @subpackage Option 353 * 354 * @param unknown_type $option 355 */ 237 356 function wp_protect_special_option( $option ) { 238 357 $protected = array( 'alloptions', 'notoptions' ); 239 358 if ( in_array( $option, $protected ) ) 240 359 die( sprintf( __( '%s is a protected WP option and may not be modified' ), wp_specialchars( $option ) ) ); 241 360 } 242 361 362 /** 363 * form_option() - {@internal Missing Short Description}} 364 * 365 * {@internal Missing Long Description}} 366 * 367 * @since 1.5.0 368 * @package WordPress 369 * @subpackage Option 370 * 371 * @param string $option 372 * @return string 373 */ 243 374 function form_option( $option ) { 244 echo attribute_escape ( get_option( $option ) );375 echo attribute_escape ( get_option( $option ) ); 245 376 } 246 377 378 /** 379 * get_alloptions() - {@internal Missing Short Description}} 380 * 381 * {@internal Missing Long Description}} 382 * 383 * @since 1.0.0 384 * @package WordPress 385 * @subpackage Option 386 * 387 * @return string 388 */ 247 389 function get_alloptions() { 248 global $wpdb , $wp_queries;390 global $wpdb; 249 391 $show = $wpdb->hide_errors(); 250 392 if ( !$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) 251 393 $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); … … 262 404 return apply_filters( 'all_options', $all_options ); 263 405 } 264 406 265 407 /** 408 * wp_load_alloptions() - {@internal Missing Short Description}} 409 * 410 * {@internal Missing Long Description}} 411 * 412 * @since 2.2.0 413 * @package WordPress 414 * @subpackage Option 415 * 416 * @param string $setting 417 * @return string 418 */ 266 419 function wp_load_alloptions() { 267 420 global $wpdb; 268 421 … … 281 434 return $alloptions; 282 435 } 283 436 284 285 // expects $option_name to NOT be SQL-escaped 437 /** 438 * update_option() - {@internal Missing Short Description}} 439 * 440 * {@internal Missing Long Description}} 441 * Expects $option_name to NOT be SQL-escaped 442 * 443 * @since 1.0.0 444 * @package WordPress 445 * @subpackage Option 446 * 447 * @param string $option_name 448 * @param string $newvalue 449 * @return string 450 */ 286 451 function update_option( $option_name, $newvalue ) { 287 452 global $wpdb; 288 453 … … 326 491 return false; 327 492 } 328 493 329 330 // thx Alex Stapleton, http://alex.vort-x.net/blog/ 331 // expects $name to NOT be SQL-escaped 494 /** 495 * add_option() - {@internal Missing Short Description}} 496 * 497 * {@internal Missing Long Description}} 498 * 499 * @since 1.0.0 500 * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton 501 */ 332 502 function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) { 333 503 global $wpdb; 334 504 … … 485 655 fclose( $fp ); 486 656 } 487 657 658 488 659 function do_enclose( $content, $post_ID ) { 489 660 global $wpdb; 490 661 include_once( ABSPATH . WPINC . '/class-IXR.php' ); … … 534 705 // perform a HTTP HEAD or GET request 535 706 // if $file_path is a writable filename, this will do a GET request and write the file to that path 536 707 // returns a list of HTTP headers 708 537 709 function wp_get_http( $url, $file_path = false, $red = 1 ) { 538 710 global $wp_version; 539 711 @set_time_limit( 60 ); … … 551 723 $request_type = 'GET'; 552 724 else 553 725 $request_type = 'HEAD'; 554 726 555 727 $head = "$request_type $file HTTP/1.1\r\nHOST: $host\r\nUser-Agent: WordPress/" . $wp_version . "\r\n\r\n"; 556 728 557 729 $fp = @fsockopen( $host, $parts['port'], $err_num, $err_msg, 3 ); … … 577 749 fclose($fp); 578 750 return wp_get_http( $headers['location'], $file_path, ++$red ); 579 751 } 580 752 581 753 // make a note of the final location, so the caller can tell if we were redirected or not 582 754 $headers['x-final-location'] = $url; 583 755 … … 586 758 fclose($fp); 587 759 return $headers; 588 760 } 589 761 590 762 // GET request - fetch and write it to the supplied filename 591 763 $content_length = $headers['content-length']; 592 764 $got_bytes = 0; … … 599 771 if ($content_length and $got_bytes >= $content_length) 600 772 break; 601 773 } 602 774 603 775 fclose($out_fp); 604 776 fclose($fp); 605 777 return $headers; 606 778 } 607 779 780 /** 781 * wp_get_http_headers() - {@internal Missing Short Description}} 782 * 783 * {@internal Missing Long Description}} 784 * 785 * @since 1.5.1 786 * 787 * @param unknown_type $url 788 * @param unknown_type $red 789 * @return unknown 790 */ 608 791 function wp_get_http_headers( $url, $red = 1 ) { 609 792 return wp_get_http( $url, false, $red ); 610 793 } 611 794 612 795 /** 796 * is_new_day() - {@internal Missing Short Description}} 797 * 798 * {@internal Missing Long Description}} 799 * 800 * @since 0.71 801 * 802 * @return unknown 803 */ 613 804 function is_new_day() { 614 805 global $day, $previousday; 615 806 if ( $day != $previousday ) … … 618 809 return 0; 619 810 } 620 811 621 812 /** 813 * build_query() - {@internal Missing Short Description}} 814 * 815 * {@internal Missing Long Description}} 816 * 817 * @since 2.3.0 818 * 819 * @param unknown_type $data 820 * @return unknown 821 */ 622 822 function build_query( $data ) { 623 823 return _http_build_query( $data, NULL, '&', '', false ); 624 824 } 625 825 626 627 /* 628 add_query_arg: Returns a modified querystring by adding 629 a single key & value or an associative array. 630 Setting a key value to emptystring removes the key. 631 Omitting oldquery_or_uri uses the $_SERVER value. 632 633 Parameters: 634 add_query_arg(newkey, newvalue, oldquery_or_uri) or 635 add_query_arg(associative_array, oldquery_or_uri) 636 */ 826 /** 827 * add_query_arg() - Returns a modified query string 828 * 829 * {@internal Missing Long Description}} 830 * 831 * Adding a single key & value or an associative array. 832 * Setting a key value to emptystring removes the key. 833 * Omitting oldquery_or_uri uses the $_SERVER value. 834 * 835 * @since 1.5.0 836 * 837 * @param mixed $param1 Either newkey or an associative_array 838 * @param mixed $param2 Either newvalue or oldquery or uri 839 * @param mixed $param3 Optional. Old query or uri 840 * @return unknown 841 */ 637 842 function add_query_arg() { 638 843 $ret = ''; 639 844 if ( is_array( func_get_arg(0) ) ) { … … 699 904 return $ret; 700 905 } 701 906 702 703 /* 704 remove_query_arg: Returns a modified querystring by removing 705 a single key or an array of keys. 706 Omitting oldquery_or_uri uses the $_SERVER value. 707 708 Parameters: 709 remove_query_arg(removekey, [oldquery_or_uri]) or 710 remove_query_arg(removekeyarray, [oldquery_or_uri]) 711 */ 712 713 function remove_query_arg( $key, $query=FALSE ) { 907 /** 908 * remove_query_arg() - Removes an item or list from the query string 909 * 910 * Omitting oldquery_or_uri uses the $_SERVER value. 911 * {@internal Missing Long Description}} 912 * 913 * @since 1.5.0 914 * 915 * @param string|array $key The key or list of keys to remove 916 * @param unknown_type $query 917 * @return unknown 918 */ 919 function remove_query_arg( $key, $query=false ) { 714 920 if ( is_array( $key ) ) { // removing multiple keys 715 921 foreach ( (array) $key as $k ) 716 $query = add_query_arg( $k, FALSE, $query );922 $query = add_query_arg( $k, false, $query ); 717 923 return $query; 718 924 } 719 return add_query_arg( $key, FALSE, $query );925 return add_query_arg( $key, false, $query ); 720 926 } 721 927 722 928 /** 929 * add_magic_quotes() - Walks the array while sanitizing the contents 930 * 931 * {@internal Missing Long Description}} 932 * 933 * @since 0.71 934 * 935 * @param array $array 936 * @return array Sanitized array 937 */ 723 938 function add_magic_quotes( $array ) { 724 939 global $wpdb; 725 940 … … 733 948 return $array; 734 949 } 735 950 951 /** 952 * wp_remote_fopen() - {@internal Missing Short Description}} 953 * 954 * {@internal Missing Long Description}} 955 * 956 * @since 1.5.1 957 * 958 * @param unknown_type $uri 959 * @return unknown 960 */ 736 961 function wp_remote_fopen( $uri ) { 737 962 $timeout = 10; 738 963 $parsed_url = @parse_url( $uri ); … … 768 993 } 769 994 } 770 995 771 996 /** 997 * wp() - {@internal Missing Short Description}} 998 * 999 * {@internal Missing Long Description}} 1000 * 1001 * @since 2.0.0 1002 * 1003 * @param unknown_type $query_vars 1004 */ 772 1005 function wp( $query_vars = '' ) { 773 1006 global $wp, $wp_query, $wp_the_query; 774 1007 $wp->main( $query_vars ); … … 777 1010 $wp_the_query = $wp_query; 778 1011 } 779 1012 780 1013 /** 1014 * get_status_header_desc() - {@internal Missing Short Description}} 1015 * 1016 * {@internal Missing Long Description}} 1017 * 1018 * @since 2.3.0 1019 * 1020 * @param unknown_type $code 1021 * @return unknown 1022 */ 781 1023 function get_status_header_desc( $code ) { 782 1024 global $wp_header_to_desc; 783 1025 … … 837 1079 return ''; 838 1080 } 839 1081 840 1082 /** 1083 * status_header() - {@internal Missing Short Description}} 1084 * 1085 * {@internal Missing Long Description}} 1086 * 1087 * @since 2.0.0 1088 * 1089 * @param unknown_type $header 1090 * @return unknown 1091 */ 841 1092 function status_header( $header ) { 842 1093 $text = get_status_header_desc( $header ); 843 1094 … … 857 1108 return @header( $status_header ); 858 1109 } 859 1110 860 1111 /** 1112 * nocache_headers() - {@internal Missing Short Description}} 1113 * 1114 * {@internal Missing Long Description}} 1115 * 1116 * @since 2.0.0 1117 */ 861 1118 function nocache_headers() { 862 1119 // why are these @-silenced when other header calls aren't? 863 1120 @header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); … … 866 1123 @header( 'Pragma: no-cache' ); 867 1124 } 868 1125 869 1126 /** 1127 * cache_javascript_headers() - {@internal Missing Short Description}} 1128 * 1129 * {@internal Missing Long Description}} 1130 * 1131 * @since 2.1.0 1132 */ 870 1133 function cache_javascript_headers() { 871 1134 $expiresOffset = 864000; // 10 days 872 1135 header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) ); … … 874 1137 header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" ); 875 1138 } 876 1139 877 1140 /** 1141 * get_num_queries() - {@internal Missing Short Description}} 1142 * 1143 * {@internal Missing Long Description}} 1144 * 1145 * @since 2.0.0 1146 * 1147 * @return unknown 1148 */ 878 1149 function get_num_queries() { 879 1150 global $wpdb; 880 1151 return $wpdb->num_queries; 881 1152 } 882 1153 883 1154 /** 1155 * bool_from_yn() - Whether input is yes or no 1156 * 1157 * @since 1.0.0 1158 * 1159 * @param string $yn Character string containing either 'y' or 'n' 1160 * @return bool True if yes, false on anything else 1161 */ 884 1162 function bool_from_yn( $yn ) { 885 1163 return ( strtolower( $yn ) == 'y' ); 886 1164 } 887 1165 888 1166 /** 1167 * do_feed() - {@internal Missing Short Description}} 1168 * 1169 * {@internal Missing Long Description}} 1170 * 1171 * @since 2.1.0 1172 * @uses $wp_query 1173 * @uses do_action() 1174 */ 889 1175 function do_feed() { 890 1176 global $wp_query; 891 1177 … … 901 1187 do_action( $hook, $wp_query->is_comment_feed ); 902 1188 } 903 1189 904 1190 /** 1191 * do_feed_rdf() - {@internal Missing Short Description}} 1192 * 1193 * {@internal Missing Long Description}} 1194 * 1195 * @since 2.1.0 1196 */ 905 1197 function do_feed_rdf() { 906 1198 load_template( ABSPATH . WPINC . '/feed-rdf.php' ); 907 1199 } 908 1200 909 1201 /** 1202 * do_feed_rss() - {@internal Missing Short Description}} 1203 * 1204 * {@internal Missing Long Description}} 1205 * 1206 * @since 2.1.0 1207 */ 910 1208 function do_feed_rss() { 911 1209 load_template( ABSPATH . WPINC . '/feed-rss.php' ); 912 1210 } 913 1211 914 1212 /** 1213 * do_feed_rss2() - {@internal Missing Short Description}} 1214 * 1215 * {@internal Missing Long Description}} 1216 * 1217 * @since 2.1.0 1218 * 1219 * @param bool $for_comments Whether to use the comment template or the plain rss2 template 1220 */ 915 1221 function do_feed_rss2( $for_comments ) { 916 1222 if ( $for_comments ) 917 1223 load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' ); … … 919 1225 load_template( ABSPATH . WPINC . '/feed-rss2.php' ); 920 1226 } 921 1227 922 1228 /** 1229 * do_feed_atom() - {@internal Missing Short Description}} 1230 * 1231 * {@internal Missing Long Description}} 1232 * 1233 * @since 2.1.0 1234 * 1235 * @param bool $for_comments Whether to use the comment template or the plain atom template 1236 */ 923 1237 function do_feed_atom( $for_comments ) { 924 1238 if ($for_comments) 925 1239 load_template( ABSPATH . WPINC . '/feed-atom-comments.php'); … … 927 1241 load_template( ABSPATH . WPINC . '/feed-atom.php' ); 928 1242 } 929 1243 1244 /** 1245 * do_robots() - {@internal Missing Short Description}} 1246 * 1247 * {@internal Missing Long Description}} 1248 * 1249 * @since 2.1.0 1250 * @uses do_action() 1251 */ 930 1252 function do_robots() { 931 1253 header( 'Content-Type: text/plain; charset=utf-8' ); 932 1254 … … 941 1263 } 942 1264 } 943 1265 944 1266 /** 1267 * is_blog_installed() - Test whether blog is already installed 1268 * 1269 * {@internal Missing Long Description}} 1270 * 1271 * @since 2.1.0 1272 * @uses $wpdb 1273 * 1274 * @return bool Whether blog is already installed 1275 */ 945 1276 function is_blog_installed() { 946 1277 global $wpdb; 947 1278 948 // Check cache first. If options table goes away and we have true cached, oh well.1279 // Check cache first. If options table goes away and we have true cached, oh well. 949 1280 if ( wp_cache_get('is_blog_installed') ) 950 1281 return true; 951 1282 … … 959 1290 return $installed; 960 1291 } 961 1292 962 1293 /** 1294 * wp_nonce_url() - {@internal Missing Short Description}} 1295 * 1296 * {@internal Missing Long Description}} 1297 * 1298 * @since 2.0.4 1299 * 1300 * @param unknown_type $actionurl 1301 * @param unknown_type $action 1302 * @return unknown 1303 */ 963 1304 function wp_nonce_url( $actionurl, $action = -1 ) { 964 1305 $actionurl = str_replace( '&', '&', $actionurl ); 965 1306 return wp_specialchars( add_query_arg( '_wpnonce', wp_create_nonce( $action ), $actionurl ) ); 966 1307 } 967 1308 968 1309 /** 1310 * wp_nonce_field() - {@internal Missing Short Description}} 1311 * 1312 * {@internal Missing Long Description}} 1313 * 1314 * @since 2.0.4 1315 * 1316 * @param unknown_type $action 1317 * @param unknown_type $name 1318 * @param unknown_type $referer 1319 */ 969 1320 function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true ) { 970 1321 $name = attribute_escape( $name ); 971 1322 echo '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />'; … … 973 1324 wp_referer_field(); 974 1325 } 975 1326 976 1327 /** 1328 * wp_referer_field() - {@internal Missing Short Description}} 1329 * 1330 * {@internal Missing Long Description}} 1331 * 1332 * @since 2.0.4 1333 */ 977 1334 function wp_referer_field() { 978 1335 $ref = attribute_escape( $_SERVER['REQUEST_URI'] ); 979 1336 echo '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />'; … … 983 1340 } 984 1341 } 985 1342 986 1343 /** 1344 * wp_original_referer_field() - {@internal Missing Short Description}} 1345 * 1346 * {@internal Missing Long Description}} 1347 * 1348 * @since 2.0.4 1349 */ 987 1350 function wp_original_referer_field() { 988 1351 echo '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape( stripslashes( $_SERVER['REQUEST_URI'] ) ) . '" />'; 989 1352 } 990 1353 991 1354 /** 1355 * wp_get_referer() - {@internal Missing Short Description}} 1356 * 1357 * {@internal Missing Long Description}} 1358 * 1359 * @since 2.0.4 1360 * 1361 * @return unknown 1362 */ 992 1363 function wp_get_referer() { 993 1364 if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) 994 1365 return $_REQUEST['_wp_http_referer']; … … 997 1368 return false; 998 1369 } 999 1370 1000 1371 /** 1372 * wp_get_original_referer() - {@internal Missing Short Description}} 1373 * 1374 * {@internal Missing Long Description}} 1375 * 1376 * @since 2.0.4 1377 * 1378 * @return unknown 1379 */ 1001 1380 function wp_get_original_referer() { 1002 1381 if ( !empty( $_REQUEST['_wp_original_http_referer'] ) ) 1003 1382 return $_REQUEST['_wp_original_http_referer']; 1004 1383 return false; 1005 1384 } 1006 1385 1007 1386 /** 1387 * wp_mkdir_p() - {@internal Missing Short Description}} 1388 * 1389 * {@internal Missing Long Description}} 1390 * 1391 * @since 2.0.1 1392 * 1393 * @param unknown_type $target 1394 * @return unknown 1395 */ 1008 1396 function wp_mkdir_p( $target ) { 1009 1397 // from php.net/mkdir user contributed notes 1010 1398 if ( file_exists( $target ) ) … … 1027 1415 return false; 1028 1416 } 1029 1417 1030 1031 // Returns an array containing the current upload directory's path and url, or an error message. 1418 /** 1419 * wp_upload_dir() - Get an array containing the current upload directory's path and url, or an error message 1420 * 1421 * {@internal Missing Long Description}} 1422 * 1423 * @since 2.0.0 1424 * 1425 * @param unknown_type $time 1426 * @return unknown 1427 */ 1032 1428 function wp_upload_dir( $time = NULL ) { 1033 1429 $siteurl = get_option( 'siteurl' ); 1034 1430 //prepend ABSPATH to $dir and $siteurl to $url if they're not already there … … 1064 1460 return apply_filters( 'upload_dir', $uploads ); 1065 1461 } 1066 1462 1067 // return a filename that is sanitized and unique for the given directory 1463 /** 1464 * wp_unique_filename() - Get a filename that is sanitized and unique for the given directory 1465 * 1466 * {@internal Missing Long Description}} 1467 * 1468 * @since 2.5 1469 * 1470 * @param unknown_type $dir 1471 * @param unknown_type $filename 1472 * @param unknown_type $unique_filename_callback 1473 * @return unknown 1474 */ 1068 1475 function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) { 1069 1476 1070 1477 // separate the filename into a name and extension 1071 1478 $info = pathinfo($filename); 1072 1479 $ext = $info['extension']; 1073 1480 $name = basename($filename, ".{$ext}"); 1074 1481 1075 1482 // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied. 1076 1483 if ( $unique_filename_callback && function_exists( $unique_filename_callback ) ) { 1077 1484 $filename = $unique_filename_callback( $dir, $name ); … … 1093 1500 $filename = str_replace( $ext, '', $filename ); 1094 1501 $filename = sanitize_title_with_dashes( $filename ) . $ext; 1095 1502 } 1096 1503 1097 1504 return $filename; 1098 1505 } 1099 1506 1507 /** 1508 * wp_upload_bits() - {@internal Missing Short Description}} 1509 * 1510 * {@internal Missing Long Description}} 1511 * 1512 * @since 2.0.0 1513 * 1514 * @param unknown_type $name 1515 * @param unknown_type $deprecated 1516 * @param unknown_type $bits 1517 * @param unknown_type $time 1518 * @return unknown 1519 */ 1100 1520 function wp_upload_bits( $name, $deprecated, $bits, $time = NULL ) { 1101 1521 if ( empty( $name ) ) 1102 1522 return array( 'error' => __( "Empty filename" ) ); … … 1136 1556 return array( 'file' => $new_file, 'url' => $url, 'error' => false ); 1137 1557 } 1138 1558 1139 1559 /** 1560 * wp_check_filetype() - {@internal Missing Short Description}} 1561 * 1562 * {@internal Missing Long Description}} 1563 * 1564 * @since 2.0.4 1565 * 1566 * @param unknown_type $filename 1567 * @param unknown_type $mimes 1568 * @return unknown 1569 */ 1140 1570 function wp_check_filetype( $filename, $mimes = null ) { 1141 1571 // Accepted MIME types are set here as PCRE unless provided. 1142 1572 $mimes = ( is_array( $mimes ) ) ? $mimes : apply_filters( 'upload_mimes', array( … … 1201 1631 return compact( 'ext', 'type' ); 1202 1632 } 1203 1633 1634 /** 1635 * wp_explain_nonce() - {@internal Missing Short Description}} 1636 * 1637 * {@internal Missing Long Description}} 1638 * 1639 * @since 2.0.4 1640 * 1641 * @param unknown_type $action 1642 * @return unknown 1643 */ 1204 1644 function wp_explain_nonce( $action ) { 1205 1645 if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) { 1206 1646 $verb = $matches[1]; … … 1265 1705 return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), $matches[4] ); 1266 1706 } 1267 1707 1268 1708 /** 1709 * wp_nonce_ays() - {@internal Missing Short Description}} 1710 * 1711 * {@internal Missing Long Description}} 1712 * 1713 * @since 2.0.4 1714 * 1715 * @param unknown_type $action 1716 */ 1269 1717 function wp_nonce_ays( $action ) { 1270 1718 global $pagenow; 1271 1719 … … 1294 1742 wp_die( $html, $title ); 1295 1743 } 1296 1744 1297 1745 /** 1746 * wp_die() - {@internal Missing Short Description}} 1747 * 1748 * {@internal Missing Long Description}} 1749 * 1750 * @since 2.0.4 1751 * 1752 * @param unknown_type $message 1753 * @param unknown_type $title 1754 */ 1298 1755 function wp_die( $message, $title = '' ) { 1299 1756 global $wp_locale; 1300 1757 … … 1366 1823 die(); 1367 1824 } 1368 1825 1369 1826 /** 1827 * _config_wp_home() - {@internal Missing Short Description}} 1828 * 1829 * {@internal Missing Long Description}} 1830 * 1831 * @since 2.2.0 1832 * 1833 * @param unknown_type $url 1834 * @return unknown 1835 */ 1370 1836 function _config_wp_home( $url = '' ) { 1371 1837 if ( defined( 'WP_HOME' ) ) 1372 1838 return WP_HOME; 1373 1839 return $url; 1374 1840 } 1375 1841 1376 1842 /** 1843 * _config_wp_siteurl() - {@internal Missing Short Description}} 1844 * 1845 * {@internal Missing Long Description}} 1846 * 1847 * @since 2.2.0 1848 * 1849 * @param unknown_type $url 1850 * @return unknown 1851 */ 1377 1852 function _config_wp_siteurl( $url = '' ) { 1378 1853 if ( defined( 'WP_SITEURL' ) ) 1379 1854 return WP_SITEURL; 1380 1855 return $url; 1381 1856 } 1382 1857 1383 1858 /** 1859 * _mce_set_direction() - {@internal Missing Short Description}} 1860 * 1861 * {@internal Missing Long Description}} 1862 * 1863 * @since 2.1.0 1864 */ 1384 1865 function _mce_set_direction() { 1385 1866 global $wp_locale; 1386 1867 … … 1390 1871 } 1391 1872 } 1392 1873 1393 1874 /** 1875 * _mce_load_rtl_plugin() - {@internal Missing Short Description}} 1876 * 1877 * {@internal Missing Long Description}} 1878 * 1879 * @since 2.1.0 1880 * 1881 * @param unknown_type $input 1882 * @return unknown 1883 */ 1394 1884 function _mce_load_rtl_plugin( $input ) { 1395 1885 global $wp_locale; 1396 1886 … … 1400 1890 return $input; 1401 1891 } 1402 1892 1403 1893 /** 1894 * _mce_add_direction_buttons() - {@internal Missing Short Description}} 1895 * 1896 * {@internal Missing Long Description}} 1897 * 1898 * @since 2.1.0 1899 * 1900 * @param unknown_type $input 1901 * @return unknown 1902 */ 1404 1903 function _mce_add_direction_buttons( $input ) { 1405 1904 global $wp_locale; 1406 1905 … … 1412 1911 return $input; 1413 1912 } 1414 1913 1415 1914 /** 1915 * smilies_init() - {@internal Missing Short Description}} 1916 * 1917 * {@internal Missing Long Description}} 1918 * 1919 * @since 2.2.0 1920 * 1921 */ 1416 1922 function smilies_init() { 1417 1923 global $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace; 1418 1924 … … 1477 1983 } 1478 1984 } 1479 1985 1480 1986 /** 1987 * wp_parse_args() - {@internal Missing Short Description}} 1988 * 1989 * {@internal Missing Long Description}} 1990 * 1991 * @since 2.2.0 1992 * 1993 * @param unknown_type $args 1994 * @param unknown_type $defaults 1995 * @return unknown 1996 */ 1481 1997 function wp_parse_args( $args, $defaults = '' ) { 1482 1998 if ( is_object( $args ) ) 1483 1999 $r = get_object_vars( $args ); … … 1491 2007 return $r; 1492 2008 } 1493 2009 1494 2010 /** 2011 * wp_maybe_load_widgets() - {@internal Missing Short Description}} 2012 * 2013 * {@internal Missing Long Description}} 2014 * 2015 * @since 2.2.0 2016 * @uses add_action() 2017 */ 1495 2018 function wp_maybe_load_widgets() { 1496 2019 if ( !function_exists( 'dynamic_sidebar' ) ) { 1497 2020 require_once( ABSPATH . WPINC . '/widgets.php' ); … … 1499 2022 } 1500 2023 } 1501 2024 1502 2025 /** 2026 * wp_widgets_add_menu() - {@internal Missing Short Description}} 2027 * 2028 * {@internal Missing Long Description}} 2029 * 2030 * @since 2.2.0 2031 * @uses $submenu 2032 */ 1503 2033 function wp_widgets_add_menu() { 1504 2034 global $submenu; 1505 2035 $submenu['themes.php'][7] = array( __( 'Widgets' ), 'switch_themes', 'widgets.php' ); 1506 2036 ksort( $submenu['themes.php'], SORT_NUMERIC ); 1507 2037 } 1508 2038 1509 1510 // For PHP 5.2, make sure all output buffers are flushed 1511 // before our singletons our destroyed. 2039 /** 2040 * wp_ob_end_flush_all() - Flushes all of the output buffers 2041 * 2042 * For PHP 5.2. 2043 * 2044 * Make sure all output buffers are flushed before our singletons our destroyed. 2045 * 2046 * @since 2.2.0 2047 */ 1512 2048 function wp_ob_end_flush_all() { 1513 2049 while ( @ob_end_flush() ); 1514 2050 } 1515 2051 1516 1517 /* 1518 * require_wp_db() - require_once the correct database class file. 2052 /** 2053 * require_wp_db() - require_once the correct database class file 1519 2054 * 1520 * This function is used to load the database class file either at runtime or by wp-admin/setup-config.php 1521 * We must globalise $wpdb to ensure that it is defined globally by the inline code in wp-db.php 2055 * This function is used to load the database class file either at runtime 2056 * or by wp-admin/setup-config.php We must globalise $wpdb to ensure that it 2057 * is defined globally by the inline code in wp-db.php 1522 2058 * 1523 * @global $wpdb 2059 * @since 2.5 2060 * @uses $wpdb Does not actually use $wpdb 1524 2061 */ 1525 2062 function require_wp_db() { 1526 2063 global $wpdb; … … 1530 2067 require_once( ABSPATH . WPINC . '/wp-db.php' ); 1531 2068 } 1532 2069 2070 /** 2071 * dead_db() - {@internal Missing Short Description}} 2072 * 2073 * {@internal Missing Long Description}} 2074 * 2075 * @since 2.5 2076 * @uses $wpdb 2077 */ 1533 2078 function dead_db() { 1534 2079 global $wpdb; 1535 2080 … … 1564 2109 } 1565 2110 1566 2111 /** 1567 * Converts input to an absolute integer 1568 * @param mixed $maybeint data you wish to have convered to an absolute integer 1569 * @return int an absolute integer 2112 * absint() - Converts input to an absolute integer 2113 * 2114 * @since 2.5 2115 * 2116 * @param mixed $maybeint Data you wish to have convered to an absolute integer 2117 * @return int An absolute integer 1570 2118 */ 1571 2119 function absint( $maybeint ) { 1572 2120 return abs( intval( $maybeint ) ); 1573 2121 } 1574 2122 1575 2123 /** 1576 * Determines if the blog can be accessed over SSL 2124 * url_is_accessable_via_ssl() - Determines if the blog can be accessed over SSL 2125 * 2126 * {@internal Missing Long Description}} 2127 * 2128 * @since 2.5 2129 * 1577 2130 * @return bool whether of not SSL access is available 1578 2131 */ 1579 2132 function url_is_accessable_via_ssl($url) 1580 2133 { 1581 2134 if (in_array('curl', get_loaded_extensions())) { 1582 $ssl = preg_replace( '/^http:\/\//', 'https://', $url );2135 $ssl = preg_replace( '/^http:\/\//', 'https://', $url ); 1583 2136 1584 $ch = curl_init();1585 curl_setopt($ch, CURLOPT_URL, $ssl);1586 curl_setopt($ch, CURLOPT_FAILONERROR, true);1587 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);1588 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);2137 $ch = curl_init(); 2138 curl_setopt($ch, CURLOPT_URL, $ssl); 2139 curl_setopt($ch, CURLOPT_FAILONERROR, true); 2140 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 2141 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 1589 2142 1590 curl_exec($ch);2143 curl_exec($ch); 1591 2144 1592 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);1593 curl_close ($ch);2145 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); 2146 curl_close ($ch); 1594 2147 1595 if ($status == 200 || $status == 401) {1596 return true;1597 }2148 if ($status == 200 || $status == 401) { 2149 return true; 2150 } 1598 2151 } 1599 2152 return false; 1600 2153 } 1601 2154 2155 /** 2156 * atom_service_url_filter() - {@internal Missing Short Description}} 2157 * 2158 * {@internal Missing Long Description}} 2159 * 2160 * @since 2.5 2161 * 2162 * @param string $url 2163 * @return string 2164 */ 1602 2165 function atom_service_url_filter($url) 1603 2166 { 1604 2167 if ( url_is_accessable_via_ssl($url) ) … … 1619 2182 * 1620 2183 * @package WordPress 1621 2184 * @package Debug 1622 * @since 2. 42185 * @since 2.5 1623 2186 * @access private 1624 2187 * 1625 2188 * @uses do_action() Calls 'deprecated_function_run' and passes the function name and what to use instead. 1626 2189 * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. 1627 2190 * 1628 2191 * @param string $function The function that was called 1629 * @param string $version The version of WordPress that deprec eated the function2192 * @param string $version The version of WordPress that deprecated the function 1630 2193 * @param string $replacement Optional. The function that should have been called 1631 2194 */ 1632 2195 function _deprecated_function($function, $version, $replacement=null) { … … 1654 2217 * 1655 2218 * @package WordPress 1656 2219 * @package Debug 1657 * @since 2. 42220 * @since 2.5 1658 2221 * @access private 1659 2222 * 1660 2223 * @uses do_action() Calls 'deprecated_file_included' and passes the file name and what to use instead. 1661 2224 * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. 1662 2225 * 1663 2226 * @param string $file The file that was included 1664 * @param string $version The version of WordPress that deprec eated the function2227 * @param string $version The version of WordPress that deprecated the function 1665 2228 * @param string $replacement Optional. The function that should have been called 1666 2229 */ 1667 2230 function _deprecated_file($file, $version, $replacement=null) { … … 1676 2239 trigger_error( printf( __("%s is <strong>deprecated</strong> since version %s with no alternative available."), $file, $version ) ); 1677 2240 } 1678 2241 } 1679 ?> 2242 ?> 2243 No newline at end of file
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)