phpdoc for wp-admin/includes from jacobsantos. see #7527

git-svn-id: https://develop.svn.wordpress.org/trunk@9053 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-10-02 01:03:26 +00:00
parent 6dcd601a90
commit f885a9f93a
15 changed files with 2236 additions and 109 deletions

View File

@ -1,9 +1,30 @@
<?php
/**
* WordPress Bookmark Administration API
*
* @package WordPress
* @subpackage Administration
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function add_link() {
return edit_link();
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $link_id
* @return unknown
*/
function edit_link( $link_id = '' ) {
if (!current_user_can( 'manage_links' ))
wp_die( __( 'Cheatin&#8217; uh?' ));
@ -24,6 +45,13 @@ function edit_link( $link_id = '' ) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function get_default_link_to_edit() {
if ( isset( $_GET['linkurl'] ) )
$link->link_url = clean_url( $_GET['linkurl']);
@ -40,6 +68,14 @@ function get_default_link_to_edit() {
return $link;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $link_id
* @return unknown
*/
function wp_delete_link($link_id) {
global $wpdb;
@ -56,6 +92,14 @@ function wp_delete_link($link_id) {
return true;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $link_id
* @return unknown
*/
function wp_get_link_cats($link_id = 0) {
$cats = wp_get_object_terms($link_id, 'link_category', 'fields=ids');
@ -63,10 +107,26 @@ function wp_get_link_cats($link_id = 0) {
return array_unique($cats);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $link_id
* @return unknown
*/
function get_link_to_edit( $link_id ) {
return get_bookmark( $link_id, OBJECT, 'edit' );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $linkdata
* @return unknown
*/
function wp_insert_link($linkdata, $wp_error = false) {
global $wpdb, $current_user;
@ -154,6 +214,14 @@ function wp_insert_link($linkdata, $wp_error = false) {
return $link_id;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $link_id
* @param unknown_type $link_categories
*/
function wp_set_link_cats($link_id = 0, $link_categories = array()) {
// If $link_categories isn't already an array, make it one:
if (!is_array($link_categories) || 0 == count($link_categories))
@ -167,6 +235,14 @@ function wp_set_link_cats($link_id = 0, $link_categories = array()) {
clean_bookmark_cache($link_id);
} // wp_set_link_cats()
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $linkdata
* @return unknown
*/
function wp_update_link($linkdata) {
$link_id = (int) $linkdata['link_id'];
@ -189,4 +265,4 @@ function wp_update_link($linkdata) {
return wp_insert_link($linkdata);
}
?>
?>

View File

@ -1,13 +1,20 @@
<?php
/**
* File contains all the administration image manipulation functions.
*
* @package WordPress
* @subpackage Administration
*/
/** The descriptions for theme files. */
$wp_file_descriptions = array (
'index.php' => __( 'Main Index Template' ),
'style.css' => __( 'Stylesheet' ),
'rtl.css' => __( 'RTL Stylesheet' ),
'comments.php' => __( 'Comments' ),
'comments-popup.php' => __( 'Popup Comments' ),
'footer.php' => __( 'Footer' ),
'header.php' => __( 'Header' ),
'rtl.css' => __( 'RTL Stylesheet' ),
'comments.php' => __( 'Comments' ),
'comments-popup.php' => __( 'Popup Comments' ),
'footer.php' => __( 'Footer' ),
'header.php' => __( 'Header' ),
'sidebar.php' => __( 'Sidebar' ),
'archive.php' => __( 'Archives' ),
'category.php' => __( 'Category Template' ),
@ -27,6 +34,15 @@ $wp_file_descriptions = array (
'.htaccess' => __( '.htaccess (for rewrite rules )' ),
// Deprecated files
'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $file
* @return unknown
*/
function get_file_description( $file ) {
global $wp_file_descriptions;
@ -42,6 +58,13 @@ function get_file_description( $file ) {
return basename( $file );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function get_home_path() {
$home = get_option( 'home' );
if ( $home != '' && $home != get_option( 'siteurl' ) ) {
@ -56,6 +79,14 @@ function get_home_path() {
return $home_path;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $file
* @return unknown
*/
function get_real_file_to_edit( $file ) {
if ('index.php' == $file || '.htaccess' == $file ) {
$real_file = get_home_path() . $file;
@ -65,8 +96,16 @@ function get_real_file_to_edit( $file ) {
return $real_file;
}
//$folder = Full path to folder
//$levels = Levels of folders to follow, Default: 100 (PHP Loop limit)
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param string $folder Optional. Full path to folder
* @param int $levels Optional. Levels of folders to follow, Default: 100 (PHP Loop limit).
* @return bool|array
*/
function list_files( $folder = '', $levels = 100 ) {
if( empty($folder) )
return false;
@ -94,6 +133,13 @@ function list_files( $folder = '', $levels = 100 ) {
return $files;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function get_temp_dir() {
if ( defined('WP_TEMP_DIR') )
return trailingslashit(WP_TEMP_DIR);
@ -108,6 +154,15 @@ function get_temp_dir() {
return '/tmp/';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $filename
* @param unknown_type $dir
* @return unknown
*/
function wp_tempnam($filename = '', $dir = ''){
if ( empty($dir) )
$dir = get_temp_dir();
@ -120,6 +175,15 @@ function wp_tempnam($filename = '', $dir = ''){
return $filename;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $file
* @param unknown_type $allowed_files
* @return unknown
*/
function validate_file_to_edit( $file, $allowed_files = '' ) {
$file = stripslashes( $file );
@ -140,11 +204,15 @@ function validate_file_to_edit( $file, $allowed_files = '' ) {
}
}
// array wp_handle_upload ( array &file [, array overrides] )
// file: reference to a single element of $_FILES. Call the function once for each uploaded file.
// overrides: an associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
// On success, returns an associative array of file attributes.
// On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
* @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
* @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
*/
function wp_handle_upload( &$file, $overrides = false ) {
// The default error handler.
if (! function_exists( 'wp_handle_upload_error' ) ) {
@ -236,7 +304,18 @@ function wp_handle_upload( &$file, $overrides = false ) {
return $return;
}
// Pass this function an array similar to that of a $_FILES POST array.
/**
* {@internal Missing Short Description}}
*
* Pass this function an array similar to that of a $_FILES POST array.
*
* @since unknown
*
* @param unknown_type $file
* @param unknown_type $overrides
* @return unknown
*/
function wp_handle_sideload( &$file, $overrides = false ) {
// The default error handler.
if (! function_exists( 'wp_handle_upload_error' ) ) {
@ -334,11 +413,14 @@ function wp_handle_sideload( &$file, $overrides = false ) {
}
/**
* Downloads a url to a local file using the Snoopy HTTP Class
*
* @param string $url the URL of the file to download
* @return mixed WP_Error on failure, string Filename on success.
*/
* Downloads a url to a local file using the Snoopy HTTP Class.
*
* @since unknown
* @todo Transition over to using the new HTTP Request API (jacob).
*
* @param string $url the URL of the file to download
* @return mixed WP_Error on failure, string Filename on success.
*/
function download_url( $url ) {
//WARNING: The file is not automatically deleted, The script must unlink() the file.
if( ! $url )
@ -367,6 +449,15 @@ function download_url( $url ) {
return $tmpfname;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $file
* @param unknown_type $to
* @return unknown
*/
function unzip_file($file, $to) {
global $wp_filesystem;
@ -427,6 +518,15 @@ function unzip_file($file, $to) {
return true;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $from
* @param unknown_type $to
* @return unknown
*/
function copy_dir($from, $to) {
global $wp_filesystem;
@ -452,6 +552,14 @@ function copy_dir($from, $to) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $args
* @return unknown
*/
function WP_Filesystem( $args = false ) {
global $wp_filesystem;
@ -480,6 +588,14 @@ function WP_Filesystem( $args = false ) {
return true;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $args
* @return unknown
*/
function get_filesystem_method($args = array()) {
$method = false;
if( function_exists('getmyuid') && function_exists('fileowner') ){
@ -495,6 +611,16 @@ function get_filesystem_method($args = array()) {
return apply_filters('filesystem_method', $method);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $form_post
* @param unknown_type $type
* @param unknown_type $error
* @return unknown
*/
function request_filesystem_credentials($form_post, $type = '', $error = false) {
$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
if ( '' !== $req_cred )

View File

@ -221,7 +221,7 @@ function wp_exif_date2ts($str) {
}
/**
* Get extended image metadata, exif or iptc as available
* Get extended image metadata, exif or iptc as available.
*
* @since unknown
*

View File

@ -1,5 +1,18 @@
<?php
/**
* WordPress Administration Importer API.
*
* @package WordPress
* @subpackage Administration
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function get_importers() {
global $wp_importers;
if ( is_array($wp_importers) )
@ -7,6 +20,17 @@ function get_importers() {
return $wp_importers;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
* @param unknown_type $name
* @param unknown_type $description
* @param unknown_type $callback
* @return unknown
*/
function register_importer( $id, $name, $description, $callback ) {
global $wp_importers;
if ( is_wp_error( $callback ) )
@ -14,10 +38,24 @@ function register_importer( $id, $name, $description, $callback ) {
$wp_importers[$id] = array ( $name, $description, $callback );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
*/
function wp_import_cleanup( $id ) {
wp_delete_attachment( $id );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function wp_import_handle_upload() {
$overrides = array( 'test_form' => false, 'test_type' => false );
$_FILES['import']['name'] .= '.import';

View File

@ -1,5 +1,18 @@
<?php
/**
* WordPress Administration Media API.
*
* @package WordPress
* @subpackage Administration
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_tabs() {
$_default_tabs = array(
'type' => __('Choose File'), // handler action suffix => tab text
@ -10,6 +23,14 @@ function media_upload_tabs() {
return apply_filters('media_upload_tabs', $_default_tabs);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $tabs
* @return unknown
*/
function update_gallery_tab($tabs) {
global $wpdb;
if ( !isset($_REQUEST['post_id']) ) {
@ -25,6 +46,11 @@ function update_gallery_tab($tabs) {
}
add_filter('media_upload_tabs', 'update_gallery_tab');
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function the_media_upload_tabs() {
global $redir_tab;
$tabs = media_upload_tabs();
@ -51,6 +77,20 @@ function the_media_upload_tabs() {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
* @param unknown_type $alt
* @param unknown_type $title
* @param unknown_type $align
* @param unknown_type $url
* @param unknown_type $rel
* @param unknown_type $size
* @return unknown
*/
function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {
$html = get_image_tag($id, $alt, $title, $align, $size);
@ -65,6 +105,20 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
return $html;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $html
* @param unknown_type $id
* @param unknown_type $alt
* @param unknown_type $title
* @param unknown_type $align
* @param unknown_type $url
* @param unknown_type $size
* @return unknown
*/
function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
@ -84,8 +138,15 @@ function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
}
add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $html
*/
function media_send_to_editor($html) {
?>
?>
<script type="text/javascript">
/* <![CDATA[ */
var win = window.dialogArguments || opener || parent || top;
@ -96,7 +157,18 @@ win.send_to_editor('<?php echo addslashes($html); ?>');
exit;
}
// this handles the file upload POST itself, creating the attachment post
/**
* {@internal Missing Short Description}}
*
* This handles the file upload POST itself, creating the attachment post.
*
* @since unknown
*
* @param unknown_type $file_id
* @param unknown_type $post_id
* @param unknown_type $post_data
* @return unknown
*/
function media_handle_upload($file_id, $post_id, $post_data = array()) {
$overrides = array('test_form'=>false);
$file = wp_handle_upload($_FILES[$file_id], $overrides);
@ -137,6 +209,17 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $file_array
* @param unknown_type $post_id
* @param unknown_type $desc
* @param unknown_type $post_data
* @return unknown
*/
function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
$overrides = array('test_form'=>false);
$file = wp_handle_sideload($file_array, $overrides);
@ -178,9 +261,16 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
return $id;
}
// wrap iframe content (produced by $content_func) in a doctype, html head/body etc
// any additional function args will be passed to content_func
/**
* {@internal Missing Short Description}}
*
* Wrap iframe content (produced by $content_func) in a doctype, html head/body
* etc any additional function args will be passed to content_func.
*
* @since unknown
*
* @param unknown_type $content_func
*/
function wp_iframe($content_func /* ... */) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@ -220,6 +310,11 @@ if ( is_string($content_func) )
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function media_buttons() {
global $post_ID, $temp_ID;
$uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
@ -245,6 +340,13 @@ EOF;
add_action( 'media_buttons', 'media_buttons' );
add_action('media_upload_media', 'media_upload_handler');
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_form_handler() {
check_admin_referer('media-form');
@ -294,6 +396,13 @@ function media_upload_form_handler() {
return $errors;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_image() {
$errors = array();
$id = 0;
@ -339,6 +448,16 @@ function media_upload_image() {
return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $file
* @param unknown_type $post_id
* @param unknown_type $desc
* @return unknown
*/
function media_sideload_image($file, $post_id, $desc = null) {
if (!empty($file) ) {
$file_array['name'] = basename($file);
@ -367,6 +486,13 @@ function media_sideload_image($file, $post_id, $desc = null) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_audio() {
$errors = array();
$id = 0;
@ -410,6 +536,13 @@ function media_upload_audio() {
return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_video() {
$errors = array();
$id = 0;
@ -453,6 +586,13 @@ function media_upload_video() {
return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_file() {
$errors = array();
$id = 0;
@ -496,6 +636,13 @@ function media_upload_file() {
return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_gallery() {
$errors = array();
@ -512,6 +659,13 @@ function media_upload_gallery() {
return wp_iframe( 'media_upload_gallery_form', $errors );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function media_upload_library() {
$errors = array();
if ( !empty($_POST) ) {
@ -527,6 +681,15 @@ function media_upload_library() {
}
// produce HTML for the image alignment radio buttons with the specified one checked
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post
* @param unknown_type $checked
* @return unknown
*/
function image_align_input_fields($post, $checked='') {
$alignments = array('none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right');
@ -544,6 +707,15 @@ function image_align_input_fields($post, $checked='') {
}
// produce HTML for the size radio buttons with the specified one checked
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post
* @param unknown_type $checked
* @return unknown
*/
function image_size_input_fields($post, $checked='') {
// get a list of the actual pixel dimensions of each possible intermediate version of this image
@ -582,6 +754,15 @@ function image_size_input_fields($post, $checked='') {
}
// produce HTML for the Link URL buttons with the default link type as specified
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post
* @param unknown_type $url_type
* @return unknown
*/
function image_link_input_fields($post, $url_type='') {
$file = wp_get_attachment_url($post->ID);
@ -602,6 +783,15 @@ function image_link_input_fields($post, $url_type='') {
</script>\n";
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $form_fields
* @param unknown_type $post
* @return unknown
*/
function image_attachment_fields_to_edit($form_fields, $post) {
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
$form_fields['post_title']['required'] = true;
@ -624,11 +814,29 @@ function image_attachment_fields_to_edit($form_fields, $post) {
add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2);
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $form_fields
* @param unknown_type $post
* @return unknown
*/
function media_single_attachment_fields_to_edit( $form_fields, $post ) {
unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']);
return $form_fields;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post
* @param unknown_type $attachment
* @return unknown
*/
function image_attachment_fields_to_save($post, $attachment) {
if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
if ( strlen(trim($post['post_title'])) == 0 ) {
@ -642,6 +850,16 @@ function image_attachment_fields_to_save($post, $attachment) {
add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $html
* @param unknown_type $attachment_id
* @param unknown_type $attachment
* @return unknown
*/
function image_media_send_to_editor($html, $attachment_id, $attachment) {
$post =& get_post($attachment_id);
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
@ -667,6 +885,15 @@ function image_media_send_to_editor($html, $attachment_id, $attachment) {
add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post
* @param unknown_type $errors
* @return unknown
*/
function get_attachment_fields_to_edit($post, $errors = null) {
if ( is_int($post) )
$post =& get_post($post);
@ -732,6 +959,15 @@ function get_attachment_fields_to_edit($post, $errors = null) {
return $form_fields;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post_id
* @param unknown_type $errors
* @return unknown
*/
function get_media_items( $post_id, $errors ) {
if ( $post_id ) {
$post = get_post($post_id);
@ -755,6 +991,15 @@ function get_media_items( $post_id, $errors ) {
return $output;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $attachment_id
* @param unknown_type $args
* @return unknown
*/
function get_media_item( $attachment_id, $args = null ) {
global $redir_tab;
@ -919,6 +1164,11 @@ function get_media_item( $attachment_id, $args = null ) {
return $item;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function media_upload_header() {
?>
<script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script>
@ -928,6 +1178,13 @@ function media_upload_header() {
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $errors
*/
function media_upload_form( $errors = null ) {
global $type, $tab;
@ -1017,6 +1274,15 @@ jQuery(function($){
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $type
* @param unknown_type $errors
* @param unknown_type $id
*/
function media_upload_type_form($type = 'file', $errors = null, $id = null) {
media_upload_header();
@ -1144,6 +1410,13 @@ var addExtImage = {
endif;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $errors
*/
function media_upload_gallery_form($errors) {
global $redir_tab;
@ -1189,6 +1462,13 @@ jQuery(function($){
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $errors
*/
function media_upload_library_form($errors) {
global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
@ -1335,6 +1615,13 @@ jQuery(function($){
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function type_form_image() {
if ( apply_filters( 'disable_captions', '' ) ) {
@ -1411,6 +1698,13 @@ function type_form_image() {
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function type_form_audio() {
return '
<table class="describe"><tbody>
@ -1439,6 +1733,13 @@ function type_form_audio() {
';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function type_form_video() {
return '
<table class="describe"><tbody>
@ -1467,6 +1768,13 @@ function type_form_video() {
';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function type_form_file() {
return '
<table class="describe"><tbody>
@ -1496,6 +1804,14 @@ function type_form_file() {
}
// support a GET parameter for disabling the flash uploader
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $flash
* @return unknown
*/
function media_upload_use_flash($flash) {
if ( array_key_exists('flash', $_REQUEST) )
$flash = !empty($_REQUEST['flash']);
@ -1504,6 +1820,11 @@ function media_upload_use_flash($flash) {
add_filter('flash_uploader', 'media_upload_use_flash');
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function media_upload_flash_bypass() {
echo '<p class="upload-flash-bypass">';
printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
@ -1512,6 +1833,11 @@ function media_upload_flash_bypass() {
add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function media_upload_html_bypass() {
echo '<p class="upload-html-bypass">';
if ( array_key_exists('flash', $_REQUEST) )
@ -1528,6 +1854,14 @@ add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
add_action('post-html-upload-ui', 'media_upload_html_bypass');
// make sure the GET parameter sticks when we submit a form
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $url
* @return unknown
*/
function media_upload_bypass_url($url) {
if ( array_key_exists('flash', $_REQUEST) )
$url = add_query_arg('flash', intval($_REQUEST['flash']));

View File

@ -1,12 +1,32 @@
<?php
/**
* Misc WordPress Administration API.
*
* @package WordPress
* @subpackage Administration
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function got_mod_rewrite() {
$got_rewrite = apache_mod_loaded('mod_rewrite', true);
return apply_filters('got_rewrite', $got_rewrite);
}
// Returns an array of strings from a file (.htaccess ) from between BEGIN
// and END markers.
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $filename
* @param unknown_type $marker
* @return array An array of strings from a file (.htaccess ) from between BEGIN and END markers.
*/
function extract_from_markers( $filename, $marker ) {
$result = array ();
@ -30,10 +50,20 @@ function extract_from_markers( $filename, $marker ) {
return $result;
}
// Inserts an array of strings into a file (.htaccess ), placing it between
// BEGIN and END markers. Replaces existing marked info. Retains surrounding
// data. Creates file if none exists.
// Returns true on write success, false on failure.
/**
* {@internal Missing Short Description}}
*
* Inserts an array of strings into a file (.htaccess ), placing it between
* BEGIN and END markers. Replaces existing marked info. Retains surrounding
* data. Creates file if none exists.
*
* @since unknown
*
* @param unknown_type $filename
* @param unknown_type $marker
* @param unknown_type $insertion
* @return bool True on write success, false on failure.
*/
function insert_with_markers( $filename, $marker, $insertion ) {
if (!file_exists( $filename ) || is_writeable( $filename ) ) {
if (!file_exists( $filename ) ) {
@ -82,9 +112,11 @@ function insert_with_markers( $filename, $marker, $insertion ) {
/**
* Updates the htaccess file with the current rules if it is writable.
*
* Always writes to the file if it exists and is writable to ensure that we blank out old rules.
* Always writes to the file if it exists and is writable to ensure that we
* blank out old rules.
*
* @since unknown
*/
function save_mod_rewrite_rules() {
global $wp_rewrite;
@ -103,6 +135,13 @@ function save_mod_rewrite_rules() {
return false;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $file
*/
function update_recently_edited( $file ) {
$oldfiles = (array ) get_option( 'recently_edited' );
if ( $oldfiles ) {
@ -118,7 +157,14 @@ function update_recently_edited( $file ) {
update_option( 'recently_edited', $oldfiles );
}
// If siteurl or home changed, flush rewrite rules.
/**
* If siteurl or home changed, flush rewrite rules.
*
* @since unknown
*
* @param unknown_type $old_value
* @param unknown_type $value
*/
function update_home_siteurl( $old_value, $value ) {
global $wp_rewrite;
@ -132,6 +178,14 @@ function update_home_siteurl( $old_value, $value ) {
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $url
* @return unknown
*/
function url_shorten( $url ) {
$short_url = str_replace( 'http://', '', stripslashes( $url ));
$short_url = str_replace( 'www.', '', $short_url );
@ -142,6 +196,13 @@ function url_shorten( $url ) {
return $short_url;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $vars
*/
function wp_reset_vars( $vars ) {
for ( $i=0; $i<count( $vars ); $i += 1 ) {
$var = $vars[$i];
@ -160,6 +221,13 @@ function wp_reset_vars( $vars ) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $message
*/
function show_message($message) {
if( is_wp_error($message) ){
if( $message->get_error_data() )
@ -171,14 +239,44 @@ function show_message($message) {
}
/* Whitelist functions */
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $option_group
* @param unknown_type $option_name
* @param unknown_type $sanitize_callback
* @return unknown
*/
function register_setting($option_group, $option_name, $sanitize_callback = '') {
return add_option_update_handler($option_group, $option_name, $sanitize_callback);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $option_group
* @param unknown_type $option_name
* @param unknown_type $sanitize_callback
* @return unknown
*/
function unregister_setting($option_group, $option_name, $sanitize_callback = '') {
return remove_option_update_handler($option_group, $option_name, $sanitize_callback);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $option_group
* @param unknown_type $option_name
* @param unknown_type $sanitize_callback
*/
function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
global $new_whitelist_options;
$new_whitelist_options[ $option_group ][] = $option_name;
@ -186,6 +284,15 @@ function add_option_update_handler($option_group, $option_name, $sanitize_callba
add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $option_group
* @param unknown_type $option_name
* @param unknown_type $sanitize_callback
*/
function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
global $new_whitelist_options;
$pos = array_search( $option_name, $new_whitelist_options );
@ -195,6 +302,14 @@ function remove_option_update_handler($option_group, $option_name, $sanitize_cal
remove_filter( "sanitize_option_{$option_name}", $sanitize_callback );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $options
* @return unknown
*/
function option_update_filter( $options ) {
global $new_whitelist_options;
@ -205,6 +320,15 @@ function option_update_filter( $options ) {
}
add_filter( 'whitelist_options', 'option_update_filter' );
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $new_options
* @param unknown_type $options
* @return unknown
*/
function add_option_whitelist( $new_options, $options = '' ) {
if( $options == '' ) {
global $whitelist_options;
@ -221,6 +345,15 @@ function add_option_whitelist( $new_options, $options = '' ) {
return $whitelist_options;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $del_options
* @param unknown_type $options
* @return unknown
*/
function remove_option_whitelist( $del_options, $options = '' ) {
if( $options == '' ) {
global $whitelist_options;

View File

@ -1,4 +1,10 @@
<?php
/**
* WordPress Post Administration API.
*
* @package WordPress
* @subpackage Administration
*/
/**
* Rename $_POST data from form names to DB post columns.
@ -6,10 +12,10 @@
* Manipulates $_POST directly.
*
* @package WordPress
* @since 2.6
* @since 2.6.0
*
* @param bool $update Are we updating a pre-existing post?
* @param post_data array Array of post data. Defaults to the contents of $_POST
* @param post_data array Array of post data. Defaults to the contents of $_POST.
* @return object|bool WP_Error on failure, true on success.
*/
function _wp_translate_postdata( $update = false, $post_data = null ) {
@ -110,8 +116,14 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
return $post_data;
}
// Update an existing post with values provided in $_POST.
/**
* Update an existing post with values provided in $_POST.
*
* @since unknown
*
* @param array $post_data Optional.
* @return int Post ID.
*/
function edit_post( $post_data = null ) {
if ( empty($post_data) )
@ -177,7 +189,16 @@ function edit_post( $post_data = null ) {
return $post_ID;
}
// updates all bulk edited posts/pages, adding (but not removing) tags and categories. Skips pages when they would be their own parent or child.
/**
* {@internal Missing Short Description}}
*
* Updates all bulk edited posts/pages, adding (but not removing) tags and
* categories. Skips pages when they would be their own parent or child.
*
* @since unknown
*
* @return array
*/
function bulk_edit_posts( $post_data = null ) {
global $wpdb;
@ -258,7 +279,13 @@ function bulk_edit_posts( $post_data = null ) {
return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked );
}
// Default post information to use when populating the "Write Post" form.
/**
* Default post information to use when populating the "Write Post" form.
*
* @since unknown
*
* @return unknown
*/
function get_default_post_to_edit() {
if ( !empty( $_REQUEST['post_title'] ) )
$post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
@ -306,13 +333,27 @@ function get_default_post_to_edit() {
return $post;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function get_default_page_to_edit() {
$page = get_default_post_to_edit();
$page->post_type = 'page';
return $page;
}
// Get an existing post and format it for editing.
/**
* Get an existing post and format it for editing.
*
* @since unknown
*
* @param unknown_type $id
* @return unknown
*/
function get_post_to_edit( $id ) {
$post = get_post( $id, OBJECT, 'edit' );
@ -323,6 +364,16 @@ function get_post_to_edit( $id ) {
return $post;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $title
* @param unknown_type $content
* @param unknown_type $post_date
* @return unknown
*/
function post_exists($title, $content = '', $post_date = '') {
global $wpdb;
@ -338,7 +389,13 @@ function post_exists($title, $content = '', $post_date = '') {
return 0;
}
// Creates a new post from the "Write Post" form using $_POST information.
/**
* Creates a new post from the "Write Post" form using $_POST information.
*
* @since unknown
*
* @return unknown
*/
function wp_write_post() {
global $user_ID;
@ -405,6 +462,13 @@ function wp_write_post() {
return $post_ID;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function write_post() {
$result = wp_write_post();
if( is_wp_error( $result ) )
@ -417,6 +481,14 @@ function write_post() {
// Post Meta
//
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post_ID
* @return unknown
*/
function add_meta( $post_ID ) {
global $wpdb;
$post_ID = (int) $post_ID;
@ -451,6 +523,14 @@ function add_meta( $post_ID ) {
return false;
} // add_meta
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $mid
* @return unknown
*/
function delete_meta( $mid ) {
global $wpdb;
$mid = (int) $mid;
@ -461,7 +541,13 @@ function delete_meta( $mid ) {
return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
}
// Get a list of previously defined keys
/**
* Get a list of previously defined keys.
*
* @since unknown
*
* @return unknown
*/
function get_meta_keys() {
global $wpdb;
@ -474,6 +560,14 @@ function get_meta_keys() {
return $keys;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $mid
* @return unknown
*/
function get_post_meta_by_id( $mid ) {
global $wpdb;
$mid = (int) $mid;
@ -484,7 +578,16 @@ function get_post_meta_by_id( $mid ) {
return $meta;
}
// Some postmeta stuff
/**
* {@internal Missing Short Description}}
*
* Some postmeta stuff.
*
* @since unknown
*
* @param unknown_type $postid
* @return unknown
*/
function has_meta( $postid ) {
global $wpdb;
@ -494,6 +597,16 @@ function has_meta( $postid ) {
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $meta_id
* @param unknown_type $meta_key
* @param unknown_type $meta_value
* @return unknown
*/
function update_meta( $meta_id, $meta_key, $meta_value ) {
global $wpdb;
@ -518,7 +631,15 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
// Private
//
// Replace hrefs of attachment anchors with up-to-date permalinks.
/**
* Replace hrefs of attachment anchors with up-to-date permalinks.
*
* @since unknown
* @access private
*
* @param unknown_type $post_ID
* @return unknown
*/
function _fix_attachment_links( $post_ID ) {
$post = & get_post( $post_ID, ARRAY_A );
@ -559,7 +680,16 @@ function _fix_attachment_links( $post_ID ) {
return wp_update_post( $post);
}
// Move child posts to a new parent
/**
* Move child posts to a new parent.
*
* @since unknown
* @access private
*
* @param unknown_type $old_ID
* @param unknown_type $new_ID
* @return unknown
*/
function _relocate_children( $old_ID, $new_ID ) {
global $wpdb;
$old_ID = (int) $old_ID;
@ -567,12 +697,28 @@ function _relocate_children( $old_ID, $new_ID ) {
return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $type
* @return unknown
*/
function get_available_post_statuses($type = 'post') {
$stati = wp_count_posts($type);
return array_keys(get_object_vars($stati));
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $q
* @return unknown
*/
function wp_edit_posts_query( $q = false ) {
global $wpdb;
if ( false === $q )
@ -613,6 +759,14 @@ function wp_edit_posts_query( $q = false ) {
return array($post_stati, $avail_post_stati);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $type
* @return unknown
*/
function get_available_post_mime_types($type = 'attachment') {
global $wpdb;
@ -620,6 +774,14 @@ function get_available_post_mime_types($type = 'attachment') {
return $types;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $q
* @return unknown
*/
function wp_edit_attachments_query( $q = false ) {
global $wpdb;
if ( false === $q )
@ -647,6 +809,15 @@ function wp_edit_attachments_query( $q = false ) {
return array($post_mime_types, $avail_post_mime_types);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
* @param unknown_type $page
* @return unknown
*/
function postbox_classes( $id, $page ) {
$current_user = wp_get_current_user();
if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) {
@ -658,6 +829,16 @@ function postbox_classes( $id, $page ) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
* @param unknown_type $title
* @param unknown_type $name
* @return unknown
*/
function get_sample_permalink($id, $title=null, $name = null) {
$post = &get_post($id);
if (!$post->ID) {
@ -701,6 +882,16 @@ function get_sample_permalink($id, $title=null, $name = null) {
return $permalink;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
* @param unknown_type $new_title
* @param unknown_type $new_slug
* @return unknown
*/
function get_sample_permalink_html($id, $new_title=null, $new_slug=null) {
$post = &get_post($id);
list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
@ -720,8 +911,14 @@ function get_sample_permalink_html($id, $new_title=null, $new_slug=null) {
return $return;
}
// false: not locked or locked by current user
// int: user ID of user with lock
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post_id
* @return bool|int False: not locked or locked by current user. Int: user ID of user with lock.
*/
function wp_check_post_lock( $post_id ) {
global $current_user;
@ -738,6 +935,14 @@ function wp_check_post_lock( $post_id ) {
return false;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post_id
* @return unknown
*/
function wp_set_post_lock( $post_id ) {
global $current_user;
if ( !$post = get_post( $post_id ) )
@ -754,11 +959,11 @@ function wp_set_post_lock( $post_id ) {
}
/**
* wp_create_post_autosave() - creates autosave data for the specified post from $_POST data
* Creates autosave data for the specified post from $_POST data.
*
* @package WordPress
* @subpackage Post Revisions
* @since 2.6
* @subpackage Post_Revisions
* @since 2.6.0
*
* @uses _wp_translate_postdata()
* @uses _wp_post_revision_fields()
@ -780,10 +985,10 @@ function wp_create_post_autosave( $post_id ) {
}
/**
* wp_teeny_mce() - adds a trimmed down version of the tinyMCE editor used on the Write -> Post screen.
* Adds a trimmed down version of the tinyMCE editor used on the Write -> Post screen.
*
* @package WordPress
* @since 2.6
* @since 2.6.0
*/
function wp_teeny_mce( $args = null ) {
if ( !user_can_richedit() )

View File

@ -1,6 +1,14 @@
<?php
// Here we keep the DB structure and option values
/**
* WordPress Schema for installation and upgrading.
*
* Here we keep the DB structure and option values.
*
* @package WordPress
* @subpackage Administration
*/
/** WordPress Database collate charset */
$charset_collate = '';
// Declare these as global in case schema.php is included from a function.
@ -13,7 +21,8 @@ if ( $wpdb->has_cap( 'collation' ) ) {
$charset_collate .= " COLLATE $wpdb->collate";
}
$wp_queries="CREATE TABLE $wpdb->terms (
/** Create WordPress database tables SQL */
$wp_queries = "CREATE TABLE $wpdb->terms (
term_id bigint(20) NOT NULL auto_increment,
name varchar(200) NOT NULL default '',
slug varchar(200) NOT NULL default '',
@ -152,6 +161,13 @@ CREATE TABLE $wpdb->usermeta (
KEY meta_key (meta_key)
) $charset_collate;";
/**
* Create WordPress options and set the default values.
*
* @since unknown
* @uses $wpdb
* @uses $wp_db_version
*/
function populate_options() {
global $wpdb, $wp_db_version;
@ -280,6 +296,11 @@ function populate_options() {
endforeach;
}
/**
* Execute WordPress role creation for the various WordPress versions.
*
* @since unknown (2.0.0)
*/
function populate_roles() {
populate_roles_160();
populate_roles_210();
@ -289,6 +310,11 @@ function populate_roles() {
populate_roles_270();
}
/**
* Create the roles for WordPress 2.0
*
* @since 2.0.0
*/
function populate_roles_160() {
// Add roles
@ -384,6 +410,11 @@ function populate_roles_160() {
$role->add_cap('level_0');
}
/**
* Create and modify WordPress roles for WordPress 2.1.
*
* @since 2.1.0
*/
function populate_roles_210() {
$roles = array('administrator', 'editor');
foreach ($roles as $role) {
@ -426,6 +457,11 @@ function populate_roles_210() {
}
}
/**
* Create and modify WordPress roles for WordPress 2.3.
*
* @since 2.3.0
*/
function populate_roles_230() {
$role = get_role( 'administrator' );
@ -434,6 +470,11 @@ function populate_roles_230() {
}
}
/**
* Create and modify WordPress roles for WordPress 2.5.
*
* @since 2.5.0
*/
function populate_roles_250() {
$role = get_role( 'administrator' );
@ -442,6 +483,11 @@ function populate_roles_250() {
}
}
/**
* Create and modify WordPress roles for WordPress 2.6.
*
* @since 2.6.0
*/
function populate_roles_260() {
$role = get_role( 'administrator' );
@ -451,6 +497,11 @@ function populate_roles_260() {
}
}
/**
* Create and modify WordPress roles for WordPress 2.7.
*
* @since 2.7.0
*/
function populate_roles_270() {
$role = get_role( 'administrator' );

View File

@ -1,9 +1,23 @@
<?php
/**
* WordPress Taxonomy Administration API.
*
* @package WordPress
* @subpackage Administration
*/
//
// Category
//
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $cat_name
* @return unknown
*/
function category_exists($cat_name) {
$id = is_term($cat_name, 'category');
if ( is_array($id) )
@ -11,11 +25,28 @@ function category_exists($cat_name) {
return $id;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
* @return unknown
*/
function get_category_to_edit( $id ) {
$category = get_category( $id, OBJECT, 'edit' );
return $category;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $cat_name
* @param unknown_type $parent
* @return unknown
*/
function wp_create_category( $cat_name, $parent = 0 ) {
if ( $id = category_exists($cat_name) )
return $id;
@ -23,6 +54,15 @@ function wp_create_category( $cat_name, $parent = 0 ) {
return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $categories
* @param unknown_type $post_id
* @return unknown
*/
function wp_create_categories($categories, $post_id = '') {
$cat_ids = array ();
foreach ($categories as $category) {
@ -39,6 +79,14 @@ function wp_create_categories($categories, $post_id = '') {
return $cat_ids;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $cat_ID
* @return unknown
*/
function wp_delete_category($cat_ID) {
$cat_ID = (int) $cat_ID;
$default = get_option('default_category');
@ -50,6 +98,15 @@ function wp_delete_category($cat_ID) {
return wp_delete_term($cat_ID, 'category', array('default' => $default));
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $catarr
* @param unknown_type $wp_error
* @return unknown
*/
function wp_insert_category($catarr, $wp_error = false) {
$cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
$cat_arr = wp_parse_args($cat_arr, $cat_defaults);
@ -99,6 +156,14 @@ function wp_insert_category($catarr, $wp_error = false) {
return $cat_ID['term_id'];
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $catarr
* @return unknown
*/
function wp_update_category($catarr) {
$cat_ID = (int) $catarr['cat_ID'];
@ -121,6 +186,14 @@ function wp_update_category($catarr) {
// Tags
//
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post_id
* @return unknown
*/
function get_tags_to_edit( $post_id ) {
$post_id = (int) $post_id;
if ( !$post_id )
@ -139,10 +212,26 @@ function get_tags_to_edit( $post_id ) {
return $tags_to_edit;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $tag_name
* @return unknown
*/
function tag_exists($tag_name) {
return is_term($tag_name, 'post_tag');
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $tag_name
* @return unknown
*/
function wp_create_tag($tag_name) {
if ( $id = tag_exists($tag_name) )
return $id;

View File

@ -1,15 +1,43 @@
<?php
//
// Big Mess
//
/**
* Template WordPress Administration API.
*
* A Big Mess. Also some neat functions that are nicely written.
*
* @package WordPress
* @subpackage Administration
*/
// Ugly recursive category stuff.
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $parent
* @param unknown_type $level
* @param unknown_type $categories
* @param unknown_type $page
* @param unknown_type $per_page
*/
function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
$count = 0;
_cat_rows($categories, $count, $parent, $level, $page, $per_page);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $categories
* @param unknown_type $count
* @param unknown_type $parent
* @param unknown_type $level
* @param unknown_type $page
* @param unknown_type $per_page
* @return unknown
*/
function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
if ( empty($categories) ) {
$args = array('hide_empty' => 0);
@ -72,6 +100,16 @@ function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $p
echo $output;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $category
* @param unknown_type $level
* @param unknown_type $name_override
* @return unknown
*/
function _cat_row( $category, $level, $name_override = false ) {
global $class;
@ -144,6 +182,15 @@ function _cat_row( $category, $level, $name_override = false ) {
return apply_filters('cat_row', $output);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $category
* @param unknown_type $name_override
* @return unknown
*/
function link_cat_row( $category, $name_override = false ) {
global $class;
@ -214,11 +261,27 @@ function link_cat_row( $category, $name_override = false ) {
return apply_filters( 'link_cat_row', $output );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $checked
* @param unknown_type $current
*/
function checked( $checked, $current) {
if ( $checked == $current)
echo ' checked="checked"';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $selected
* @param unknown_type $current
*/
function selected( $selected, $current) {
if ( $selected == $current)
echo ' selected="selected"';
@ -228,12 +291,27 @@ function selected( $selected, $current) {
// Category Checklists
//
// Deprecated. Use wp_link_category_checklist
/**
* {@internal Missing Short Description}}
*
* @since unknown
* @deprecated Use {@link wp_link_category_checklist()}
* @see wp_link_category_checklist()
*
* @param unknown_type $default
* @param unknown_type $parent
* @param unknown_type $popular_ids
*/
function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
global $post_ID;
wp_category_checklist($post_ID);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
class Walker_Category_Checklist extends Walker {
var $tree_type = 'category';
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
@ -260,6 +338,16 @@ class Walker_Category_Checklist extends Walker {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post_id
* @param unknown_type $descendants_and_self
* @param unknown_type $selected_cats
* @param unknown_type $popular_cats
*/
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
$walker = new Walker_Category_Checklist;
$descendants_and_self = (int) $descendants_and_self;
@ -301,6 +389,17 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $taxonomy
* @param unknown_type $default
* @param unknown_type $number
* @param unknown_type $echo
* @return unknown
*/
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
global $post_ID;
if ( $post_ID )
@ -329,13 +428,28 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
return $popular_ids;
}
// Deprecated. Use wp_link_category_checklist
/**
* {@internal Missing Short Description}}
*
* @since unknown
* @deprecated Use {@link wp_link_category_checklist()}
* @see wp_link_category_checklist()
*
* @param unknown_type $default
*/
function dropdown_link_categories( $default = 0 ) {
global $link_id;
wp_link_category_checklist($link_id);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $link_id
*/
function wp_link_category_checklist( $link_id = 0 ) {
$default = 1;
@ -367,6 +481,15 @@ function wp_link_category_checklist( $link_id = 0 ) {
// Returns a single tag row (see tag_rows below)
// Note: this is also used in admin-ajax.php!
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $tag
* @param unknown_type $class
* @return unknown
*/
function _tag_row( $tag, $class = '' ) {
$count = number_format_i18n( $tag->count );
$count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
@ -422,6 +545,16 @@ function _tag_row( $tag, $class = '' ) {
// Outputs appropriate rows for the Nth page of the Tag Management screen,
// assuming M tags displayed at a time on the page
// Returns the number of tags displayed
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
* @param unknown_type $pagesize
* @param unknown_type $searchterms
* @return unknown
*/
function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
// Get a page worth of tags
@ -449,6 +582,13 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
}
// define the columns to display, the syntax is 'internal name' => 'display name'
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function wp_manage_posts_columns() {
$posts_columns = array();
$posts_columns['cb'] = '<input type="checkbox" />';
@ -471,6 +611,13 @@ function wp_manage_posts_columns() {
}
// define the columns to display, the syntax is 'internal name' => 'display name'
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function wp_manage_media_columns() {
$posts_columns = array();
$posts_columns['cb'] = '<input type="checkbox" />';
@ -488,6 +635,13 @@ function wp_manage_media_columns() {
return $posts_columns;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function wp_manage_pages_columns() {
$posts_columns = array();
$posts_columns['cb'] = '<input type="checkbox" />';
@ -516,6 +670,14 @@ function wp_manage_pages_columns() {
return $posts_columns;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
* @return unknown
*/
function get_column_headers($page) {
switch ($page) {
case 'post':
@ -590,6 +752,14 @@ function get_column_headers($page) {
return $columns;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $type
* @param unknown_type $id
*/
function print_column_headers( $type, $id = true ) {
$columns = get_column_headers( $type );
$hidden = (array) get_user_option( "manage-$type-columns-hidden" );
@ -626,6 +796,13 @@ function print_column_headers( $type, $id = true ) {
<?php }
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $type
*/
function inline_edit_row( $type ) {
global $current_user, $mode;
@ -868,6 +1045,13 @@ function inline_edit_row( $type ) {
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $data
*/
function inline_save_row( $data ) {
// get the original post content
$post = get_post( $data['post_ID'], ARRAY_A );
@ -896,6 +1080,13 @@ function inline_save_row( $data ) {
}
// adds hidden fields with the data for use in the inline editor
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $post
*/
function get_inline_data($post) {
if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
@ -933,6 +1124,13 @@ function get_inline_data($post) {
echo '</div>';
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $posts
*/
function post_rows( $posts = array() ) {
global $wp_query, $post, $mode;
@ -959,6 +1157,15 @@ function post_rows( $posts = array() ) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $a_post
* @param unknown_type $pending_comments
* @param unknown_type $mode
*/
function _post_row($a_post, $pending_comments, $mode) {
global $post;
static $rowclass;
@ -1174,6 +1381,14 @@ function _post_row($a_post, $pending_comments, $mode) {
* display one row if the page doesn't have any children
* otherwise, display the row and its children in subsequent rows
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
* @param unknown_type $level
*/
function display_page_row( $page, $level = 0 ) {
global $post;
static $rowclass;
@ -1329,6 +1544,16 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
/*
* displays pages in hierarchical order with paging support
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $pages
* @param unknown_type $pagenum
* @param unknown_type $per_page
* @return unknown
*/
function page_rows($pages, $pagenum = 1, $per_page = 20) {
global $wpdb;
@ -1406,6 +1631,18 @@ function page_rows($pages, $pagenum = 1, $per_page = 20) {
* Given a top level page ID, display the nested hierarchy of sub-pages
* together with paging support
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $children_pages
* @param unknown_type $count
* @param unknown_type $parent
* @param unknown_type $level
* @param unknown_type $pagenum
* @param unknown_type $per_page
*/
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
if ( ! isset( $children_pages[$parent] ) )
@ -1448,6 +1685,16 @@ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_
unset( $children_pages[$parent] ); //required in order to keep track of orphans
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $user_object
* @param unknown_type $style
* @param unknown_type $role
* @return unknown
*/
function user_row( $user_object, $style = '', $role = '' ) {
global $wp_roles;
@ -1531,6 +1778,19 @@ function user_row( $user_object, $style = '', $role = '' ) {
return $r;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $status
* @param unknown_type $s
* @param unknown_type $start
* @param unknown_type $num
* @param unknown_type $post
* @param unknown_type $type
* @return unknown
*/
function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
global $wpdb;
@ -1583,6 +1843,16 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
return array($comments, $total);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $comment_id
* @param unknown_type $mode
* @param unknown_type $comment_status
* @param unknown_type $checkbox
*/
function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true ) {
global $comment, $post;
$comment = get_comment( $comment_id );
@ -1707,6 +1977,15 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
echo "</tr>\n";
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $position
* @param unknown_type $checkbox
* @param unknown_type $mode
*/
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single') {
global $current_user;
@ -1750,6 +2029,18 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $currentcat
* @param unknown_type $currentparent
* @param unknown_type $parent
* @param unknown_type $level
* @param unknown_type $categories
* @return unknown
*/
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
if (!$categories )
$categories = get_categories( array('hide_empty' => 0) );
@ -1771,6 +2062,13 @@ function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $le
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $meta
*/
function list_meta( $meta ) {
// Exit if no meta
if (!$meta ) {
@ -1793,6 +2091,15 @@ function list_meta( $meta ) {
echo "\n\t</tbody>";
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $entry
* @param unknown_type $count
* @return unknown
*/
function _list_meta_row( $entry, &$count ) {
static $update_nonce = false;
if ( !$update_nonce )
@ -1835,6 +2142,11 @@ function _list_meta_row( $entry, &$count ) {
return $r;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function meta_form() {
global $wpdb;
$limit = (int) apply_filters( 'postmeta_form_limit', 30 );
@ -1881,6 +2193,16 @@ function meta_form() {
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $edit
* @param unknown_type $for_post
* @param unknown_type $tab_index
* @param unknown_type $multi
*/
function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
global $wp_locale, $post, $comment;
@ -1931,6 +2253,13 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $default
*/
function page_template_dropdown( $default = '' ) {
$templates = get_page_templates();
ksort( $templates );
@ -1943,6 +2272,16 @@ function page_template_dropdown( $default = '' ) {
endforeach;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $default
* @param unknown_type $parent
* @param unknown_type $level
* @return unknown
*/
function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
global $wpdb, $post_ID;
$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
@ -1969,6 +2308,11 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function browse_happy() {
$getit = __( 'WordPress recommends a better browser' );
echo '
@ -1979,6 +2323,14 @@ function browse_happy() {
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
add_action( 'in_admin_footer', 'browse_happy' );
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $id
* @return unknown
*/
function the_attachment_links( $id = false ) {
$id = (int) $id;
$post = & get_post( $id );
@ -2022,6 +2374,13 @@ function the_attachment_links( $id = false ) {
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $default
*/
function wp_dropdown_roles( $default = false ) {
global $wp_roles;
$p = '';
@ -2036,6 +2395,14 @@ function wp_dropdown_roles( $default = false ) {
echo $p . $r;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $size
* @return unknown
*/
function wp_convert_hr_to_bytes( $size ) {
$size = strtolower($size);
$bytes = (int) $size;
@ -2048,6 +2415,14 @@ function wp_convert_hr_to_bytes( $size ) {
return $bytes;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $bytes
* @return unknown
*/
function wp_convert_bytes_to_hr( $bytes ) {
$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
$log = log( $bytes, 1024 );
@ -2056,6 +2431,13 @@ function wp_convert_bytes_to_hr( $bytes ) {
return $size . $units[$power];
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function wp_max_upload_size() {
$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
@ -2063,6 +2445,13 @@ function wp_max_upload_size() {
return $bytes;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $action
*/
function wp_import_upload_form( $action ) {
$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
$size = wp_convert_bytes_to_hr( $bytes );
@ -2082,6 +2471,11 @@ function wp_import_upload_form( $action ) {
<?php
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function wp_remember_old_slug() {
global $post;
$name = attribute_escape($post->post_name); // just in case
@ -2090,16 +2484,16 @@ function wp_remember_old_slug() {
}
/**
* add_meta_box() - Add a meta box to an edit form
* Add a meta box to an edit form.
*
* @since 2.5
* @since 2.5.0
*
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the meta box
* @param string $title Title of the meta box.
* @param string $callback Function that fills the box with the desired content. The function should echo its output.
* @param string $page The type of edit page on which to show the box (post, page, link)
* @param string $context The context within the page where the boxes should show ('normal', 'advanced')
* @param string $priority The priority within the context where the boxes should show ('high', 'low')
* @param string $page The type of edit page on which to show the box (post, page, link).
* @param string $context The context within the page where the boxes should show ('normal', 'advanced').
* @param string $priority The priority within the context where the boxes should show ('high', 'low').
*/
function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
global $wp_meta_boxes;
@ -2151,6 +2545,16 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
* @param unknown_type $context
* @param unknown_type $object
* @return unknown
*/
function do_meta_boxes($page, $context, $object) {
global $wp_meta_boxes;
static $already_sorted = false;
@ -2202,13 +2606,13 @@ function do_meta_boxes($page, $context, $object) {
}
/**
* remove_meta_box() - Remove a meta box from an edit form
* Remove a meta box from an edit form.
*
* @since 2.6
* @since 2.6.0
*
* @param string $id String for use in the 'id' attribute of tags.
* @param string $page The type of edit page on which to show the box (post, page, link)
* @param string $context The context within the page where the boxes should show ('normal', 'advanced')
* @param string $page The type of edit page on which to show the box (post, page, link).
* @param string $context The context within the page where the boxes should show ('normal', 'advanced').
*/
function remove_meta_box($id, $page, $context) {
global $wp_meta_boxes;
@ -2224,6 +2628,13 @@ function remove_meta_box($id, $page, $context) {
$wp_meta_boxes[$page][$context][$priority][$id] = false;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
*/
function meta_box_prefs($page) {
global $wp_meta_boxes;
@ -2250,14 +2661,14 @@ function meta_box_prefs($page) {
}
/**
* Add a new section to a settings page
* Add a new section to a settings page.
*
* @since 2.7
* @since 2.7.0
*
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the section
* @param string $title Title of the section.
* @param string $callback Function that fills the section with the desired content. The function should echo its output.
* @param string $page The type of settings page on which to show the section (general, reading, writing, ...)
* @param string $page The type of settings page on which to show the section (general, reading, writing, ...).
*/
function add_settings_section($id, $title, $callback, $page) {
global $wp_settings_sections;
@ -2273,15 +2684,15 @@ function add_settings_section($id, $title, $callback, $page) {
}
/**
* Add a new field to a settings page
* Add a new field to a settings page.
*
* @since 2.7
* @since 2.7.0
*
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the field
* @param string $title Title of the field.
* @param string $callback Function that fills the field with the desired content. The function should echo its output.
* @param string $page The type of settings page on which to show the field (general, reading, writing, ...)
* @param string $section The section of the settingss page in which to show the box (default, ...)
* @param string $page The type of settings page on which to show the field (general, reading, writing, ...).
* @param string $section The section of the settingss page in which to show the box (default, ...).
* @param array $args Additional arguments
*/
function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
@ -2297,6 +2708,13 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default',
$wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
*/
function do_settings_sections($page) {
global $wp_settings_sections, $wp_settings_fields;
@ -2314,6 +2732,14 @@ function do_settings_sections($page) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
* @param unknown_type $section
*/
function do_settings_fields($page, $section) {
global $wp_settings_fields;
@ -2333,6 +2759,13 @@ function do_settings_fields($page, $section) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
*/
function manage_columns_prefs($page) {
$columns = get_column_headers($page);
@ -2354,6 +2787,13 @@ function manage_columns_prefs($page) {
}
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $found_action
*/
function find_posts_div($found_action = '') {
?>
<div id="find-posts" class="find-box" style="display:none;">
@ -2484,8 +2924,8 @@ function find_posts_div($found_action = '') {
/**
* Display the post password.
*
* The password is passed through {@link attribute_escape()}
* to ensure that it is safe for placing in an html attribute.
* The password is passed through {@link attribute_escape()} to ensure that it
* is safe for placing in an html attribute.
*
* @uses attribute_escape
* @since 2.7.0
@ -2495,6 +2935,11 @@ function the_post_password() {
if ( isset( $post->post_password ) ) echo attribute_escape( $post->post_password );
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*/
function favorite_actions() {
$actions = array(
'page-new.php' => __('Add New Page'),
@ -2512,13 +2957,15 @@ function favorite_actions() {
}
echo "</div></div>\n";
}
/**
* Get the post title.
*
* The post title is fetched and if it is blank then a default string is returned.
* The post title is fetched and if it is blank then a default string is
* returned.
*
* @since 2.7.0
* @param int $id The post id. If not supplied the global $post is used..
* @param int $id The post id. If not supplied the global $post is used.
*
*/
function _draft_or_post_title($post_id = 0)
@ -2528,4 +2975,5 @@ function _draft_or_post_title($post_id = 0)
$title = __('(no title)');
return $title;
}
?>

View File

@ -1,5 +1,18 @@
<?php
/**
* WordPress Theme Administration API
*
* @package WordPress
* @subpackage Administration
*/
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function current_theme_info() {
$themes = get_themes();
$current_theme = get_current_theme();
@ -18,6 +31,13 @@ function current_theme_info() {
return $ct;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function get_broken_themes() {
global $wp_broken_themes;
@ -25,6 +45,13 @@ function get_broken_themes() {
return $wp_broken_themes;
}
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @return unknown
*/
function get_page_templates() {
$themes = get_themes();
$theme = get_current_theme();

View File

@ -4,13 +4,13 @@
*
* @package WordPress
* @subpackage Administration
* @since 2.7
* @since 2.7.0
*/
/**
* Stores files to be deleted.
*
* @since 2.7
* @since 2.7.0
* @global array $_old_files
* @var array
* @name $_old_files
@ -166,6 +166,8 @@ $_old_files = array(
* themes, then if you edit the default theme, you should rename it, so that
* your changes remain.
*
* @since 2.7.0
*
* @param string $from New release unzipped path.
* @param string $to Path to old WordPress installation.
* @return WP_Error|null WP_Error on failure, null on success.

View File

@ -1,11 +1,38 @@
<?php
/**
* WordPress Upgrade API
*
* Most of the functions are pluggable and can be overwritten
*
* @package WordPress
* @subpackage Administration
*/
/** Include user install customize script. */
if ( file_exists(WP_CONTENT_DIR . '/install.php') )
require (WP_CONTENT_DIR . '/install.php');
/** WordPress Administration API */
require_once(ABSPATH . 'wp-admin/includes/admin.php');
/** WordPress Schema API */
require_once(ABSPATH . 'wp-admin/includes/schema.php');
if ( !function_exists('wp_install') ) :
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param string $blog_title Blog title.
* @param string $user_name User's username.
* @param string $user_email User's email.
* @param bool $public Whether blog is public.
* @param null $deprecated Optional. Not used.
* @return array Array keys 'url', 'user_id', 'password'.
*/
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
global $wp_rewrite;
@ -53,6 +80,15 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
endif;
if ( !function_exists('wp_install_defaults') ) :
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param int $user_id User ID.
*/
function wp_install_defaults($user_id) {
global $wpdb;
@ -107,6 +143,18 @@ function wp_install_defaults($user_id) {
endif;
if ( !function_exists('wp_new_blog_notification') ) :
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param string $blog_title Blog title.
* @param string $blog_url Blog url.
* @param int $user_id User ID.
* @param string $password User's Password.
*/
function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
$user = new WP_User($user_id);
$email = $user->user_email;
@ -132,6 +180,15 @@ http://wordpress.org/
endif;
if ( !function_exists('wp_upgrade') ) :
/**
* Run WordPress Upgrade functions.
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @return null
*/
function wp_upgrade() {
global $wp_current_db_version, $wp_db_version;
@ -141,7 +198,7 @@ function wp_upgrade() {
if ( $wp_db_version == $wp_current_db_version )
return;
if(!is_blog_installed())
if( ! is_blog_installed() )
return;
wp_check_mysql_version();
@ -152,7 +209,13 @@ function wp_upgrade() {
}
endif;
// Functions to be called in install and upgrade scripts
/**
* Functions to be called in install and upgrade scripts.
*
* {@internal Missing Long Description}}
*
* @since unknown
*/
function upgrade_all() {
global $wp_current_db_version, $wp_db_version, $wp_rewrite;
$wp_current_db_version = __get_option('db_version');
@ -220,6 +283,11 @@ function upgrade_all() {
update_option('db_version', $wp_db_version);
}
/**
* Execute changes made in WordPress 1.0.
*
* @since 1.0.0
*/
function upgrade_100() {
global $wpdb;
@ -242,7 +310,6 @@ function upgrade_100() {
}
}
$wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
WHERE option_name LIKE 'links_rating_image%'
AND option_value LIKE 'wp-links/links-images/%'");
@ -272,6 +339,11 @@ function upgrade_100() {
endif;
}
/**
* Execute changes made in WordPress 1.0.1.
*
* @since 1.0.1
*/
function upgrade_101() {
global $wpdb;
@ -285,7 +357,11 @@ function upgrade_101() {
add_clean_index($wpdb->links , 'link_visible');
}
/**
* Execute changes made in WordPress 1.2.
*
* @since 1.2.0
*/
function upgrade_110() {
global $wpdb;
@ -305,7 +381,6 @@ function upgrade_110() {
}
}
// Get the GMT offset, we'll use that later on
$all_options = get_alloptions_110();
@ -342,6 +417,11 @@ function upgrade_110() {
}
/**
* Execute changes made in WordPress 1.5.
*
* @since 1.5.0
*/
function upgrade_130() {
global $wpdb;
@ -419,6 +499,11 @@ function upgrade_130() {
make_site_theme();
}
/**
* Execute changes made in WordPress 2.0.
*
* @since 2.0.0
*/
function upgrade_160() {
global $wpdb, $wp_current_db_version;
@ -497,6 +582,11 @@ function upgrade_160() {
}
}
/**
* Execute changes made in WordPress 2.1.
*
* @since 2.1.0
*/
function upgrade_210() {
global $wpdb, $wp_current_db_version;
@ -536,6 +626,11 @@ function upgrade_210() {
}
}
/**
* Execute changes made in WordPress 2.3.
*
* @since 2.3.0
*/
function upgrade_230() {
global $wp_current_db_version, $wpdb;
@ -706,6 +801,11 @@ function upgrade_230() {
}
}
/**
* Remove old options from the database.
*
* @since 2.3.0
*/
function upgrade_230_options_table() {
global $wpdb;
$old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
@ -715,6 +815,11 @@ function upgrade_230_options_table() {
$wpdb->show_errors();
}
/**
* Remove old categories, link2cat, and post2cat database tables.
*
* @since 2.3.0
*/
function upgrade_230_old_tables() {
global $wpdb;
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories');
@ -722,13 +827,22 @@ function upgrade_230_old_tables() {
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat');
}
/**
* Upgrade old slugs made in version 2.2.
*
* @since 2.2.0
*/
function upgrade_old_slugs() {
// upgrade people who were using the Redirect Old Slugs plugin
global $wpdb;
$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
}
/**
* Execute changes made in WordPress 2.5.0.
*
* @since 2.5.0
*/
function upgrade_250() {
global $wp_current_db_version;
@ -738,6 +852,11 @@ function upgrade_250() {
}
/**
* Execute changes made in WordPress 2.5.1.
*
* @since 2.5.1
*/
function upgrade_251() {
global $wp_current_db_version;
@ -745,12 +864,22 @@ function upgrade_251() {
update_option('secret', wp_generate_password(64));
}
/**
* Execute changes made in WordPress 2.5.2.
*
* @since 2.5.2
*/
function upgrade_252() {
global $wpdb;
$wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
}
/**
* Execute changes made in WordPress 2.6.
*
* @since 2.6.0
*/
function upgrade_260() {
global $wp_current_db_version;
@ -763,6 +892,11 @@ function upgrade_260() {
}
}
/**
* Execute changes made in WordPress 2.7.
*
* @since 2.7.0
*/
function upgrade_270() {
global $wpdb, $wp_current_db_version;
@ -778,6 +912,18 @@ function upgrade_270() {
// The functions we use to actually do stuff
// General
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param string $table_name Database table name to create.
* @param string $create_ddl SQL statement to create table.
* @return bool If table already exists or was created by function.
*/
function maybe_create_table($table_name, $create_ddl) {
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
@ -796,6 +942,17 @@ function maybe_create_table($table_name, $create_ddl) {
return false;
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param string $table Database table name.
* @param string $index Index name to drop.
* @return bool True, when finished.
*/
function drop_index($table, $index) {
global $wpdb;
$wpdb->hide_errors();
@ -808,6 +965,17 @@ function drop_index($table, $index) {
return true;
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param string $table Database table name.
* @param string $index Database table index column.
* @return bool True, when done with execution.
*/
function add_clean_index($table, $index) {
global $wpdb;
drop_index($table, $index);
@ -840,8 +1008,13 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
return false;
}
// get_alloptions as it was for 1.2.
/**
* Retrieve all options as it was for 1.2.
*
* @since 1.2.0
*
* @return array List of options.
*/
function get_alloptions_110() {
global $wpdb;
if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
@ -857,7 +1030,15 @@ function get_alloptions_110() {
return $all_options;
}
// Version of get_option that is private to install/upgrade.
/**
* Version of get_option that is private to install/upgrade.
*
* @since unknown
* @access private
*
* @param string $setting Option name.
* @return mixed
*/
function __get_option($setting) {
global $wpdb;
@ -884,6 +1065,16 @@ function __get_option($setting) {
return $option;
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param string $content
* @return string
*/
function deslash($content) {
// Note: \\\ inside a regex denotes a single backslash.
@ -901,6 +1092,17 @@ function deslash($content) {
return $content;
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param unknown_type $queries
* @param unknown_type $execute
* @return unknown
*/
function dbDelta($queries, $execute = true) {
global $wpdb;
@ -1102,6 +1304,13 @@ function dbDelta($queries, $execute = true) {
return $for_update;
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*/
function make_db_current() {
global $wp_queries;
@ -1111,12 +1320,30 @@ function make_db_current() {
echo "</ol>\n";
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*/
function make_db_current_silent() {
global $wp_queries;
$alterations = dbDelta($wp_queries);
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param unknown_type $theme_name
* @param unknown_type $template
* @return unknown
*/
function make_site_theme_from_oldschool($theme_name, $template) {
$home_path = get_home_path();
$site_dir = WP_CONTENT_DIR . "/themes/$template";
@ -1185,6 +1412,17 @@ function make_site_theme_from_oldschool($theme_name, $template) {
return true;
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param unknown_type $theme_name
* @param unknown_type $template
* @return unknown
*/
function make_site_theme_from_default($theme_name, $template) {
$site_dir = WP_CONTENT_DIR . "/themes/$template";
$default_dir = WP_CONTENT_DIR . '/themes/default';
@ -1240,6 +1478,15 @@ function make_site_theme_from_default($theme_name, $template) {
}
// Create a site theme from the default theme.
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @return unknown
*/
function make_site_theme() {
// Name the theme after the blog.
$theme_name = __get_option('blogname');
@ -1281,6 +1528,14 @@ function make_site_theme() {
return $template;
}
/**
* Translate user level to user role name.
*
* @since unknown
*
* @param int $level User level.
* @return string User role name.
*/
function translate_level_to_role($level) {
switch ($level) {
case 10:
@ -1302,6 +1557,13 @@ function translate_level_to_role($level) {
}
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*/
function wp_check_mysql_version() {
global $wpdb;
$result = $wpdb->check_database_version();
@ -1309,6 +1571,13 @@ function wp_check_mysql_version() {
die( $result->get_error_message() );
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*/
function maybe_disable_automattic_widgets() {
$plugins = __get_option( 'active_plugins' );

View File

@ -1,6 +1,21 @@
<?php
/**
* WordPress user administration API.
*
* @package WordPress
* @subpackage Administration
*/
// Creates a new user from the "Users" form using $_POST information.
/**
* Creates a new user from the "Users" form using $_POST information.
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param int $user_id Optional. User ID.
* @return null|WP_Error|int Null when adding user, WP_Error or User ID integer when no parameters.
*/
function add_user() {
if ( func_num_args() ) { // The hackiest hack that ever did hack
global $current_user, $wp_roles;
@ -18,6 +33,16 @@ function add_user() {
}
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param int $user_id Optional. User ID.
* @return unknown
*/
function edit_user( $user_id = 0 ) {
global $current_user, $wp_roles, $wpdb;
if ( $user_id != 0 ) {
@ -142,12 +167,31 @@ function edit_user( $user_id = 0 ) {
return $user_id;
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @return array List of user IDs.
*/
function get_author_user_ids() {
global $wpdb;
$level_key = $wpdb->prefix . 'user_level';
return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param int $user_id User ID.
* @return array|bool List of editable authors. False if no editable users.
*/
function get_editable_authors( $user_id ) {
global $wpdb;
@ -163,6 +207,17 @@ function get_editable_authors( $user_id ) {
return apply_filters('get_editable_authors', $authors);
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @param int $user_id User ID.
* @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
* @return unknown
*/
function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
global $wpdb;
@ -184,6 +239,15 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
return $wpdb->get_col( $query );
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
*
* @return unknown
*/
function get_nonauthor_user_ids() {
global $wpdb;
$level_key = $wpdb->prefix . 'user_level';
@ -191,6 +255,15 @@ function get_nonauthor_user_ids() {
return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
}
/**
* Retrieve editable posts from other users.
*
* @since unknown
*
* @param int $user_id User ID to not retrieve posts from.
* @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
* @return array List of posts from others.
*/
function get_others_unpublished_posts($user_id, $type='any') {
global $wpdb;
@ -213,14 +286,38 @@ function get_others_unpublished_posts($user_id, $type='any') {
return apply_filters('get_others_drafts', $other_unpubs);
}
/**
* Retrieve drafts from other users.
*
* @since unknown
*
* @param int $user_id User ID.
* @return array List of drafts from other users.
*/
function get_others_drafts($user_id) {
return get_others_unpublished_posts($user_id, 'draft');
}
/**
* Retrieve pending review posts from other users.
*
* @since unknown
*
* @param int $user_id User ID.
* @return array List of posts with pending review post type from other users.
*/
function get_others_pending($user_id) {
return get_others_unpublished_posts($user_id, 'pending');
}
/**
* Retrieve user data and filter it.
*
* @since unknown
*
* @param int $user_id User ID.
* @return object WP_User object with user data.
*/
function get_user_to_edit( $user_id ) {
$user = new WP_User( $user_id );
$user->user_login = attribute_escape($user->user_login);
@ -238,6 +335,14 @@ function get_user_to_edit( $user_id ) {
return $user;
}
/**
* Retrieve the user's drafts.
*
* @since unknown
*
* @param int $user_id User ID.
* @return array
*/
function get_users_drafts( $user_id ) {
global $wpdb;
$query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
@ -245,6 +350,20 @@ function get_users_drafts( $user_id ) {
return $wpdb->get_results( $query );
}
/**
* Remove user and optionally reassign posts and links to another user.
*
* If the $reassign parameter is not assigned to an User ID, then all posts will
* be deleted of that user. The action 'delete_user' that is passed the User ID
* being deleted will be run after the posts are either reassigned or deleted.
* The user meta will also be deleted that are for that User ID.
*
* @since unknown
*
* @param int $id User ID.
* @param int $reassign Optional. Reassign posts and links to new User ID.
* @return bool True when finished.
*/
function wp_delete_user($id, $reassign = 'novalue') {
global $wpdb;
@ -279,6 +398,13 @@ function wp_delete_user($id, $reassign = 'novalue') {
return true;
}
/**
* Remove all capabilities from user.
*
* @since unknown
*
* @param int $id User ID.
*/
function wp_revoke_user($id) {
$id = (int) $id;
@ -286,28 +412,161 @@ function wp_revoke_user($id) {
$user->remove_all_caps();
}
// WP_User_Search class
// by Mark Jaquith
if ( !class_exists('WP_User_Search') ) :
/**
* WordPress User Search class.
*
* @since unknown
* @author Mark Jaquith
*/
class WP_User_Search {
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $results;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $search_term;
/**
* Page number.
*
* @since unknown
* @access private
* @var int
*/
var $page;
/**
* Role name that users have.
*
* @since unknown
* @access private
* @var string
*/
var $role;
/**
* Raw page number.
*
* @since unknown
* @access private
* @var int|bool
*/
var $raw_page;
/**
* Amount of users to display per page.
*
* @since unknown
* @access public
* @var int
*/
var $users_per_page = 50;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $first_user;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var int
*/
var $last_user;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $query_limit;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $query_sort;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $query_from_where;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var int
*/
var $total_users_for_query = 0;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var bool
*/
var $too_many_total_users = false;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $search_errors;
/**
* {@internal Missing Description}}
*
* @since unknown
* @access private
* @var unknown_type
*/
var $paging_text;
function WP_User_Search ($search_term = '', $page = '', $role = '') { // constructor
/**
* PHP4 Constructor - Sets up the object properties.
*
* @since unknown
*
* @param string $search_term Search terms string.
* @param int $page Optional. Page ID.
* @param string $role Role name.
* @return WP_User_Search
*/
function WP_User_Search ($search_term = '', $page = '', $role = '') {
$this->search_term = $search_term;
$this->raw_page = ( '' == $page ) ? false : (int) $page;
$this->page = (int) ( '' == $page ) ? 1 : $page;
@ -319,6 +578,14 @@ class WP_User_Search {
$this->do_paging();
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
* @access public
*/
function prepare_query() {
global $wpdb;
$this->first_user = ($this->page - 1) * $this->users_per_page;
@ -343,6 +610,14 @@ class WP_User_Search {
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
* @access public
*/
function query() {
global $wpdb;
$this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_sort . $this->query_limit);
@ -353,10 +628,26 @@ class WP_User_Search {
$this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
* @access public
*/
function prepare_vars_for_template_usage() {
$this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
* @access public
*/
function do_paging() {
if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
$args = array();
@ -375,20 +666,56 @@ class WP_User_Search {
}
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
* @access public
*
* @return unknown
*/
function get_results() {
return (array) $this->results;
}
/**
* Displaying paging text.
*
* @see do_paging() Builds paging text.
*
* @since unknown
* @access public
*/
function page_links() {
echo $this->paging_text;
}
/**
* Whether paging is enabled.
*
* @see do_paging() Builds paging text.
*
* @since unknown
* @access public
*
* @return bool
*/
function results_are_paged() {
if ( $this->paging_text )
return true;
return false;
}
/**
* Whether there are search terms.
*
* @since unknown
* @access public
*
* @return bool
*/
function is_search() {
if ( $this->search_term )
return true;

View File

@ -9,10 +9,12 @@
/**
* Display list of widgets, either all or matching search.
*
* The search parameter are search terms separated by spaces.
*
* @since unknown
*
* @param unknown_type $show
* @param unknown_type $_search Optional. Search for widgets. Should be unsanitized.
* @param string $show Optional, default is all. What to display, can be 'all', 'unused', or 'used'.
* @param string $_search Optional. Search for widgets. Should be unsanitized.
*/
function wp_list_widgets( $show = 'all', $_search = false ) {
global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
@ -168,7 +170,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
*
* @since unknown
*
* @param unknown_type $sidebar
* @param string $sidebar
*/
function wp_list_widget_controls( $sidebar ) {
add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
@ -188,8 +190,8 @@ function wp_list_widget_controls( $sidebar ) {
*
* @since unknown
*
* @param unknown_type $params
* @return unknown
* @param array $params
* @return array
*/
function wp_list_widget_controls_dynamic_sidebar( $params ) {
global $wp_registered_widgets;
@ -216,8 +218,8 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
*
* @since unknown
*
* @param unknown_type $sidebar_args
* @return unknown
* @param array $sidebar_args
* @return array
*/
function wp_widget_control( $sidebar_args ) {
global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
@ -322,8 +324,8 @@ function wp_widget_control( $sidebar_args ) {
*
* @since unknown
*
* @param unknown_type $string
* @return unknown
* @param string $string
* @return string
*/
function wp_widget_control_ob_filter( $string ) {
if ( false === $beg = strpos( $string, '%BEG_OF_TITLE%' ) )