phpdoc for wp-admin. See #7496 props santosj.

git-svn-id: http://svn.automattic.com/wordpress/trunk@8645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2008-08-14 06:30:38 +00:00
parent 1ef0029be8
commit 7f894ae416
46 changed files with 1027 additions and 167 deletions

View File

@ -18,6 +18,12 @@ $min_width_pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php'
$the_current_page = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
$ie6_no_scrollbar = true;
/**
* Append 'minwidth' to value.
*
* @param mixed $c
* @return string
*/
function add_minwidth($c) {
return $c . 'minwidth ';
}

View File

@ -1,9 +1,46 @@
<?php
/**
* Blogger Importer
*
* @package WordPress
* @subpackage Importer
*/
define( 'MAX_RESULTS', 50 ); // How many records per GData query
define( 'MAX_EXECUTION_TIME', 20 ); // How many seconds to let the script run
define( 'STATUS_INTERVAL', 3 ); // How many seconds between status bar updates
/**
* How many records per GData query
*
* @package WordPress
* @subpackage Blogger_Import
* @var int
* @since unknown
*/
define( 'MAX_RESULTS', 50 );
/**
* How many seconds to let the script run
*
* @package WordPress
* @subpackage Blogger_Import
* @var int
* @since unknown
*/
define( 'MAX_EXECUTION_TIME', 20 );
/**
* How many seconds between status bar updates
*
* @package WordPress
* @subpackage Blogger_Import
* @var int
* @since unknown
*/
define( 'STATUS_INTERVAL', 3 );
/**
* Blogger Importer class
*
* @since unknown
*/
class Blogger_Import {
// Shows the welcome screen and the magic auth link.

View File

@ -1,7 +1,20 @@
<?php
/**
* Blogware XML Importer
*
* @package WordPress
* @subpackage Importer
* @author Shayne Sweeney
* @link http://www.theshayne.com/
*/
/* By Shayne Sweeney - http://www.theshayne.com/ */
/**
* Blogware XML Importer class
*
* Extract posts from Blogware XML export file into your blog.
*
* @since unknown
*/
class BW_Import {
var $file;

View File

@ -1,5 +1,19 @@
<?php
/**
* BunnyTags Plugin Tag Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* BunnyTags Plugin tag converter
*
* This will process the BunnyTags plugin tags and convert them to the WordPress
* 2.3 taxonomy.
*
* @since unknown
*/
class BunnyTags_Import {
function header() {

View File

@ -1,7 +1,11 @@
<?php
/*
* DotClear import plugin
* by Thomas Quinot - http://thomas.quinot.org/
/**
* DotClear Importer
*
* @package WordPress
* @subpackage Importer
* @author Thomas Quinot
* @link http://thomas.quinot.org/
*/
/**
@ -10,6 +14,15 @@
if(!function_exists('get_comment_count'))
{
/**
* Get the comment count for posts.
*
* @package WordPress
* @subpackage Dotclear_Import
*
* @param int $post_ID Post ID
* @return int
*/
function get_comment_count($post_ID)
{
global $wpdb;
@ -19,6 +32,15 @@ if(!function_exists('get_comment_count'))
if(!function_exists('link_exists'))
{
/**
* Check whether link already exists.
*
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $linkname
* @return int
*/
function link_exists($linkname)
{
global $wpdb;
@ -40,31 +62,73 @@ if(!function_exists('link_exists'))
// This cries out for a C-implementation to be included in PHP core
//
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $char
* @return string
*/
function valid_1byte($char) {
if(!is_int($char)) return false;
return ($char & 0x80) == 0x00;
}
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $char
* @return string
*/
function valid_2byte($char) {
if(!is_int($char)) return false;
return ($char & 0xE0) == 0xC0;
}
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $char
* @return string
*/
function valid_3byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF0) == 0xE0;
}
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $char
* @return string
*/
function valid_4byte($char) {
if(!is_int($char)) return false;
return ($char & 0xF8) == 0xF0;
}
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $char
* @return string
*/
function valid_nextbyte($char) {
if(!is_int($char)) return false;
return ($char & 0xC0) == 0x80;
}
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $string
* @return string
*/
function valid_utf8($string) {
$len = strlen($string);
$i = 0;
@ -92,6 +156,13 @@ function valid_utf8($string) {
return true; // done
}
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $s
* @return string
*/
function csc ($s) {
if (valid_utf8 ($s)) {
return $s;
@ -100,13 +171,28 @@ function csc ($s) {
}
}
/**
* @package WordPress
* @subpackage Dotclear_Import
*
* @param string $s
* @return string
*/
function textconv ($s) {
return csc (preg_replace ('|(?<!<br />)\s*\n|', ' ', $s));
}
/**
The Main Importer Class
**/
* Dotclear Importer class
*
* Will process the WordPress eXtended RSS files that you upload from the export
* file.
*
* @package WordPress
* @subpackage Importer
*
* @since unknown
*/
class Dotclear_Import {
function header()
@ -742,5 +828,7 @@ class Dotclear_Import {
}
$dc_import = new Dotclear_Import();
register_importer('dotclear', __('DotClear'), __('Import categories, users, posts, comments, and links from a DotClear blog.'), array ($dc_import, 'dispatch'));
?>

View File

@ -1,5 +1,19 @@
<?php
/**
* GreyMatter Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* GreyMatter Importer class
*
* Basic GreyMatter to WordPress importer, will import posts, comments, and
* posts karma.
*
* @since unknown
*/
class GM_Import {
var $gmnames = array ();

View File

@ -1,5 +1,18 @@
<?php
/**
* Jeromes Keyword Plugin Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* Jeromes Keyword Plugin Importer class
*
* Will convert Jeromes Keyword Plugin tags to WordPress taxonomy tags.
*
* @since 2.3
*/
class JeromesKeyword_Import {
function header() {

View File

@ -1,5 +1,18 @@
<?php
/**
* LiveJournal Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* LiveJournal Importer class
*
* Imports your LiveJournal XML exported file into WordPress.
*
* @since unknown
*/
class LJ_Import {
var $file;

View File

@ -1,5 +1,18 @@
<?php
/**
* Movable Type and Typepad Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* Moveable Type and Typepad Importer class
*
* Upload your exported Movable Type or Typepad entries into WordPress.
*
* @since unknown
*/
class MT_Import {
var $posts = array ();

View File

@ -1,5 +1,20 @@
<?php
/**
* RSS Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* RSS Importer
*
* Will process a RSS feed for importing posts into WordPress. This is a very
* limited importer and should only be used as the last resort, when no other
* importer is available.
*
* @since unknown
*/
class RSS_Import {
var $posts = array ();

View File

@ -1,4 +1,18 @@
<?php
/**
* Simple Tags Plugin Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* Simple Tags Plugin Tags converter class.
*
* Will convert Simple Tags Plugin tags over to the WordPress 2.3 taxonomy.
*
* @since unknown
*/
class STP_Import {
function header() {
echo '<div class="wrap">';

View File

@ -1,10 +1,22 @@
<?php
/**
Add These Functions to make our lives easier
**/
* TextPattern Importer
*
* @package WordPress
* @subpackage Importer
*/
if(!function_exists('get_comment_count'))
{
/**
* Get the comment count for posts.
*
* @package WordPress
* @subpackage Textpattern_Import
*
* @param int $post_ID Post ID
* @return int
*/
function get_comment_count($post_ID)
{
global $wpdb;
@ -14,6 +26,15 @@ if(!function_exists('get_comment_count'))
if(!function_exists('link_exists'))
{
/**
* Check whether link already exists.
*
* @package WordPress
* @subpackage Textpattern_Import
*
* @param string $linkname
* @return int
*/
function link_exists($linkname)
{
global $wpdb;
@ -22,8 +43,10 @@ if(!function_exists('link_exists'))
}
/**
The Main Importer Class
**/
* TextPattern Importer Class
*
* @since unknown
*/
class Textpattern_Import {
function header()
@ -670,5 +693,7 @@ class Textpattern_Import {
}
$txp_import = new Textpattern_Import();
register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog.'), array ($txp_import, 'dispatch'));
?>

View File

@ -1,5 +1,18 @@
<?php
/**
* The Ultimate Tag Warrior Importer.
*
* @package WordPress
* @subpackage Importer
*/
/**
* Ultimate Tag Warrior Converter to 2.3 taxonomy.
*
* This converts the Ultimate Tag Warrior tags to the 2.3 WordPress taxonomy.
*
* @since 2.3.0
*/
class UTW_Import {
function header() {

View File

@ -1,5 +1,19 @@
<?php
/**
* WordPress Importer
*
* @package WordPress
* @subpackage Importer
*/
/**
* WordPress Importer
*
* Will process the WordPress eXtended RSS files that you upload from the export
* file.
*
* @since unknown
*/
class WP_Import {
var $post_ids_processed = array ();
@ -746,6 +760,13 @@ class WP_Import {
}
}
/**
* Register WordPress Importer
*
* @since unknown
* @var WP_Import
* @name $wp_import
*/
$wp_import = new WP_Import();
register_importer('wordpress', 'WordPress', __('Import <strong>posts, comments, custom fields, pages, and categories</strong> from a WordPress export file.'), array ($wp_import, 'dispatch'));

View File

@ -1,5 +1,19 @@
<?php
/**
* WordPress Categories to Tags Converter.
*
* @package WordPress
* @subpackage Importer
*/
/**
* WordPress categories to tags converter class.
*
* Will convert WordPress categories to tags, removing the category after the
* process is complete and updating all posts to switch to the tag.
*
* @since unknown
*/
class WP_Categories_to_Tags {
var $categories_to_convert = array();
var $all_categories = array();

View File

@ -11,6 +11,20 @@
* @link http://www.phpclasses.org/browse/package/1743.html Site
* @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
*/
/**
* FTP implementation using fsockopen to connect.
*
* @package PemFTP
* @subpackage Pure
* @since 2.5
*
* @version 1.0
* @copyright Alexey Dotsenko
* @author Alexey Dotsenko
* @link http://www.phpclasses.org/browse/package/1743.html Site
* @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
*/
class ftp extends ftp_base {
function ftp($verb=FALSE, $le=FALSE) {
@ -172,4 +186,5 @@ class ftp extends ftp_base {
}
}
}
?>

View File

@ -11,6 +11,20 @@
* @link http://www.phpclasses.org/browse/package/1743.html Site
* @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
*/
/**
* Socket Based FTP implementation
*
* @package PemFTP
* @subpackage Socket
* @since 2.5
*
* @version 1.0
* @copyright Alexey Dotsenko
* @author Alexey Dotsenko
* @link http://www.phpclasses.org/browse/package/1743.html Site
* @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
*/
class ftp extends ftp_base {
function ftp($verb=FALSE, $le=FALSE) {

View File

@ -11,15 +11,75 @@
* @link http://www.phpclasses.org/browse/package/1743.html Site
* @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
*/
/**
* Defines the newline characters, if not defined already.
*
* This can be redefined.
*
* @since 2.5
* @var string
*/
if(!defined('CRLF')) define('CRLF',"\r\n");
/**
* Sets whatever to autodetect ASCII mode.
*
* This can be redefined.
*
* @since 2.5
* @var int
*/
if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);
/**
*
* This can be redefined.
* @since 2.5
* @var int
*/
if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);
/**
*
* This can be redefined.
* @since 2.5
* @var int
*/
if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);
if(!defined('FTP_FORCE')) define('FTP_FORCE', TRUE);
/**
* Whether to force FTP.
*
* This can be redefined.
*
* @since 2.5
* @var bool
*/
if(!defined('FTP_FORCE')) define('FTP_FORCE', true);
/**
* @since 2.5
* @var string
*/
define('FTP_OS_Unix','u');
/**
* @since 2.5
* @var string
*/
define('FTP_OS_Windows','w');
/**
* @since 2.5
* @var string
*/
define('FTP_OS_Mac','m');
/**
* PemFTP base class
*
*/
class ftp_base {
/* Public variables */
var $LocalEcho;
@ -838,5 +898,6 @@ if (!extension_loaded('sockets')) {
$prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
}
require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php";
?>

View File

@ -1,51 +1,60 @@
<?php
// --------------------------------------------------------------------------------
// PhpConcept Library - Zip Module 2.5
// --------------------------------------------------------------------------------
// License GNU/LGPL - Vincent Blavet - March 2006
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
//
// Presentation :
// PclZip is a PHP library that manage ZIP archives.
// So far tests show that archives generated by PclZip are readable by
// WinZip application and other tools.
//
// Description :
// See readme.txt and http://www.phpconcept.net
//
// Warning :
// This library and the associated files are non commercial, non professional
// work.
// It should not have unexpected results. However if any damage is caused by
// this software the author can not be responsible.
// The use of this software is at the risk of the user.
//
// --------------------------------------------------------------------------------
// $Id: pclzip.lib.php,v 1.44 2006/03/08 21:23:59 vblavet Exp $
// --------------------------------------------------------------------------------
/**
* PhpConcept Library - Zip Module 2.5
*
* Presentation :
* PclZip is a PHP library that manage ZIP archives.
* So far tests show that archives generated by PclZip are readable by
* WinZip application and other tools.
*
* Warning :
* This library and the associated files are non commercial, non professional
* work.
* It should not have unexpected results. However if any damage is caused by
* this software the author can not be responsible.
* The use of this software is at the risk of the user.
*
* @package External
* @subpackage PclZip
*
* @license License GNU/LGPL
* @copyright March 2006 Vincent Blavet
* @author Vincent Blavet
* @link http://www.phpconcept.net
* @version $Id: pclzip.lib.php,v 1.44 2006/03/08 21:23:59 vblavet Exp $
*/
// ----- Constants
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
/**
* The read block size for reading zip files.
*
* @since 2.5
*/
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
// ----- File list separator
// In version 1.x of PclZip, the separator for file list is a space
// (which is not a very smart choice, specifically for windows paths !).
// A better separator should be a comma (,). This constant gives you the
// abilty to change that.
// However notice that changing this value, may have impact on existing
// scripts, using space separated filenames.
// Recommanded values for compatibility with older versions :
//define( 'PCLZIP_SEPARATOR', ' ' );
// Recommanded values for smart separation of filenames.
define( 'PCLZIP_SEPARATOR', ',' );
/**
* File list separator
*
* In version 1.x of PclZip, the separator for file list is a space(which is not
* a very smart choice, specifically for windows paths !). A better separator
* should be a comma (,). This constant gives you the abilty to change that.
*
* However notice that changing this value, may have impact on existing scripts,
* using space separated filenames. Recommanded values for compatibility with
* older versions :
* <code>define( 'PCLZIP_SEPARATOR', ' ' );</code>
* Recommanded values for smart separation of filenames.
*/
define( 'PCLZIP_SEPARATOR', ',' );
// ----- Error configuration
// 0 : PclZip Class integrated error handling
// 1 : PclError external library error handling. By enabling this
// you must ensure that you have included PclError library.
// [2,...] : reserved for futur use
define( 'PCLZIP_ERROR_EXTERNAL', 0 );
/**
* Error configuration
*
* 0 : PclZip Class integrated error handling
* 1 : PclError external library error handling. By enabling this you must
* ensure that you have included PclError library.
* [2,...] : reserved for future use
*/
define( 'PCLZIP_ERROR_EXTERNAL', 0 );
// ----- Optional static temporary directory
// By default temporary files are generated in the script current
@ -137,7 +146,7 @@
define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
define( 'PCLZIP_CB_PRE_ADD', 78003 );
define( 'PCLZIP_CB_POST_ADD', 78004 );
/* For futur use
/* For future use
define( 'PCLZIP_CB_PRE_LIST', 78005 );
define( 'PCLZIP_CB_POST_LIST', 78006 );
define( 'PCLZIP_CB_PRE_DELETE', 78007 );

View File

@ -1,5 +1,17 @@
<?php
class WP_Filesystem_Base{
/**
* Base WordPress Filesystem.
*
* @package WordPress
* @subpackage Filesystem
*/
/**
* Base WordPress Filesystem class for which Filesystem implementations extend
*
* @since 2.5
*/
class WP_Filesystem_Base {
var $verbose = false;
var $cache = array();
@ -155,4 +167,5 @@ class WP_Filesystem_Base{
return $newmode;
}
}
?>

View File

@ -1,5 +1,19 @@
<?php
/**
* WordPress Direct Filesystem.
*
* @package WordPress
* @subpackage Filesystem
*/
/**
* WordPress Filesystem Class for direct PHP file and folder manipulation.
*
* @since 2.5
* @package WordPress
* @subpackage Filesystem
* @uses WP_Filesystem_Base Extends class
*/
class WP_Filesystem_Direct extends WP_Filesystem_Base {
var $permission = null;
var $errors = array();

View File

@ -1,5 +1,20 @@
<?php
class WP_Filesystem_FTPext extends WP_Filesystem_Base{
/**
* WordPress FTP Filesystem.
*
* @package WordPress
* @subpackage Filesystem
*/
/**
* WordPress Filesystem Class for implementing FTP.
*
* @since 2.5
* @package WordPress
* @subpackage Filesystem
* @uses WP_Filesystem_Base Extends class
*/
class WP_Filesystem_FTPext extends WP_Filesystem_Base {
var $link;
var $timeout = 5;
var $errors = array();

View File

@ -1,4 +1,19 @@
<?php
/**
* WordPress FTP Sockets Filesystem.
*
* @package WordPress
* @subpackage Filesystem
*/
/**
* WordPress Filesystem Class for implementing FTP Sockets.
*
* @since 2.5
* @package WordPress
* @subpackage Filesystem
* @uses WP_Filesystem_Base Extends class
*/
class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
var $ftp = false;
var $timeout = 5;
@ -22,7 +37,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
'bmp' => FTP_BINARY
);
function WP_Filesystem_ftpsockets($opt='') {
function WP_Filesystem_ftpsockets($opt = '') {
$this->method = 'ftpsockets';
$this->errors = new WP_Error();
@ -86,7 +101,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
$this->permission = $perm;
}
function get_contents($file, $type = '', $resumepos = 0){
function get_contents($file, $type = '', $resumepos = 0) {
if( ! $this->exists($file) )
return false;
@ -112,7 +127,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
return $contents;
}
function get_contents_array($file){
function get_contents_array($file) {
return explode("\n", $this->get_contents($file) );
}
@ -151,7 +166,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
return false;
}
function chmod($file, $mode = false, $recursive = false ){
function chmod($file, $mode = false, $recursive = false ) {
if( ! $mode )
$mode = $this->permission;
if( ! $mode )
@ -251,7 +266,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
return $this->ftp->filesize($file);
}
function touch($file, $time = 0, $atime = 0 ){
function touch($file, $time = 0, $atime = 0 ) {
return false;
}
@ -311,8 +326,9 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
return $ret;
}
function __destruct(){
function __destruct() {
$this->ftp->quit();
}
}
?>

View File

@ -1,5 +1,15 @@
<?php
/**
* {@internal Missing Short Description}}
*
* @since unknown
* @uses $wpdb
*
* @param string $comment_author
* @param string $comment_date
* @return mixed Comment ID on success.
*/
function comment_exists($comment_author, $comment_date) {
global $wpdb;
@ -7,6 +17,10 @@ function comment_exists($comment_author, $comment_date) {
WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
}
/**
*
*
*/
function edit_comment() {
$comment_post_ID = (int) $_POST['comment_post_ID'];

View File

@ -1,5 +1,20 @@
<?php
/**
* WordPress core upgrade functionality.
*
* @package WordPress
* @subpackage Administration
* @since 2.7
*/
/**
* Stores files to be deleted.
*
* @since 2.7
* @global array $_old_files
* @var array
* @name $_old_files
*/
global $_old_files;
$_old_files = array(
@ -117,6 +132,44 @@ $_old_files = array(
'wp-content/plugins/textile1.php',
);
/**
* Upgrade the core of WordPress.
*
* This will create a .maintenance file at the base of the WordPress directory
* to ensure that people can not access the web site, when the files are being
* copied to their locations.
*
* The files in the {@link $_old_files} list will be removed and the new files
* copied from the zip file after the database is upgraded.
*
* The steps for the upgrader for after the new release is downloaded and
* unzipped is:
* 1. Test unzipped location for select files to ensure that unzipped worked.
* 2. Create the .maintenance file in current WordPress base.
* 3. Copy new WordPress directory over old WordPress files.
* 4. Upgrade WordPress to new version.
* 5. Delete new WordPress directory path.
* 6. Delete .maintenance file.
* 7. Remove old files.
* 8. Delete 'update_core' option.
*
* There are several areas of failure. For instance if PHP times out before step
* 6, then you will not be able to access any portion of your site. Also, since
* the upgrade will not continue where it left off, you will not be able to
* automatically remove old files and remove the 'update_core' option. This
* isn't that bad.
*
* If the copy of the new WordPress over the old fails, then the worse is that
* the new WordPress directory will remain.
*
* If it is assumed that every file will be copied over, including plugins and
* themes, then if you edit the default theme, you should rename it, so that
* your changes remain.
*
* @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.
*/
function update_core($from, $to) {
global $wp_filesystem, $_old_files;

View File

@ -1,15 +1,76 @@
<?php
$wp_only_load_config = true;
require_once(dirname(dirname(__FILE__)).'/wp-load.php');
$debug = 0;
/**
* Plugins may load this file to gain access to special helper functions for
* plugin installation. This file is not included by WordPress and it is
* recommended, to prevent fatal errors, that this file is included using
* require_once().
*
* These functions are not optimized for speed, but they should only be used
* once in a while, so speed shouldn't be a concern. If it is and you are
* needing to use these functions a lot, you might experience time outs. If you
* do, then it is advised to just write the SQL code yourself.
*
* You can turn debugging on, by setting $debug to 1 after you include this
* file.
*
* <code>
* check_column('wp_links', 'link_description', 'mediumtext');
* if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
* echo "ok\n";
*
* $error_count = 0;
* $tablename = $wpdb->links;
* // check the column
* if (!check_column($wpdb->links, 'link_description', 'varchar(255)')) {
* $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
* $q = $wpdb->query($ddl);
* }
*
* if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
* $res .= $tablename . ' - ok <br />';
* } else {
* $res .= 'There was a problem with ' . $tablename . '<br />';
* ++$error_count;
* }
* </code>
*
* @package WordPress
* @subpackage Plugins
*/
/**
** maybe_create_table()
** Create db table if it doesn't exist.
** Returns: true if already exists or on successful completion
** false on error
* @global bool $wp_only_load_config
* @name $wp_only_load_config
* @var bool
* @since unknown
*/
$wp_only_load_config = true;
/** Load WordPress Bootstrap */
require_once(dirname(dirname(__FILE__)).'/wp-load.php');
/**
* Turn debugging on or off.
* @global bool|int $debug
* @name $debug
* @var bool|int
* @since unknown
*/
$debug = 0;
if ( ! function_exists('maybe_create_table') ) :
/**
* Create database table, if it doesn't already exist.
*
* @since unknown
* @package WordPress
* @subpackage Plugins
* @uses $wpdb
*
* @param string $table_name Database table name.
* @param string $create_ddl Create database table SQL.
* @return bool False on error, true if already exists or success.
*/
function maybe_create_table($table_name, $create_ddl) {
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
@ -29,20 +90,29 @@ function maybe_create_table($table_name, $create_ddl) {
}
endif;
/**
** maybe_add_column()
** Add column to db table if it doesn't exist.
** Returns: true if already exists or on successful completion
** false on error
*/
if ( ! function_exists('maybe_add_column') ) :
/**
* Add column to database table, if column doesn't already exist in table.
*
* @since unknown
* @package WordPress
* @subpackage Plugins
* @uses $wpdb
* @uses $debug
*
* @param string $table_name Database table name
* @param string $column_name Table column name
* @param string $create_ddl SQL to add column to table.
* @return bool False on failure. True, if already exists or was successful.
*/
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$wpdb->query($create_ddl);
@ -57,10 +127,17 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
endif;
/**
** maybe_drop_column()
** Drop column from db table if it exists.
** Returns: true if it doesn't already exist or on successful drop
** false on error
* Drop column from database table, if it exists.
*
* @since unknown
* @package WordPress
* @subpackage Plugins
* @uses $wpdb
*
* @param string $table_name Table name
* @param string $column_name Column name
* @param string $drop_ddl SQL statement to drop column.
* @return bool False on failure, true on success or doesn't exist.
*/
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
global $wpdb;
@ -80,20 +157,30 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
return true;
}
/**
** check_column()
** Check column matches passed in criteria.
** Pass in null to skip checking that criteria
** Returns: true if it matches
** false otherwise
** (case sensitive) Column names returned from DESC table are:
** Field
** Type
** Null
** Key
** Default
** Extra
* Check column matches criteria.
*
* Uses the SQL DESC for retrieving the table info for the column. It will help
* understand the parameters, if you do more research on what column information
* is returned by the SQL statement. Pass in null to skip checking that
* criteria.
*
* Column names returned from DESC table are case sensitive and are listed:
* Field
* Type
* Null
* Key
* Default
* Extra
*
* @param string $table_name Table name
* @param string $col_name Column name
* @param string $col_type Column type
* @param bool $is_null Optional. Check is null.
* @param mixed $key Optional. Key info.
* @param mixed $default Optional. Default value.
* @param mixed $extra Optional. Extra value.
* @return bool True, if matches. False, if not matching.
*/
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
global $wpdb, $debug;
@ -102,55 +189,33 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
foreach ($results as $row ) {
if ($debug > 1) print_r($row);
if ($row->Field == $col_name) {
// got our column, check the params
if ($debug) echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs;
}
if (($is_null != null) && ($row->Null != $is_null)) {
++$diffs;
}
if (($key != null) && ($row->Key != $key)) {
++$diffs;
}
if (($default != null) && ($row->Default != $default)) {
++$diffs;
}
if (($extra != null) && ($row->Extra != $extra)) {
++$diffs;
}
if ($diffs > 0) {
if ($debug) echo ("diffs = $diffs returning false\n");
return false;
}
return true;
} // end if found our column
if ($row->Field == $col_name) {
// got our column, check the params
if ($debug) echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs;
}
if (($is_null != null) && ($row->Null != $is_null)) {
++$diffs;
}
if (($key != null) && ($row->Key != $key)) {
++$diffs;
}
if (($default != null) && ($row->Default != $default)) {
++$diffs;
}
if (($extra != null) && ($row->Extra != $extra)) {
++$diffs;
}
if ($diffs > 0) {
if ($debug) echo ("diffs = $diffs returning false\n");
return false;
}
return true;
} // end if found our column
}
return false;
}
/*
echo "<p>testing</p>";
echo "<pre>";
//check_column('wp_links', 'link_description', 'mediumtext');
//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
// echo "ok\n";
$error_count = 0;
$tablename = $wpdb->links;
// check the column
if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
{
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
$q = $wpdb->query($ddl);
}
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';
++$error_count;
}
echo "</pre>";
*/
?>

View File

@ -1,14 +1,38 @@
<?php
/**
* WordPress Installer
*
* @package WordPress
* @subpackage Administration
*/
/**
* We are installing WordPress.
*
* @since unknown
* @var bool
*/
define('WP_INSTALLING', true);
/** Load WordPress Bootstrap */
require_once('../wp-load.php');
/** Load WordPress Administration Upgrade API */
require_once('./includes/upgrade.php');
if (isset($_GET['step']))
$step = $_GET['step'];
else
$step = 0;
function display_header(){
/**
* Display install header.
*
* @since unknown
* @package WordPress
* @subpackage Installer
*/
function display_header() {
header( 'Content-Type: text/html; charset=utf-8' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

View File

@ -1,4 +1,12 @@
<?php
/**
* Add Link Administration Panel.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once('admin.php');
$title = __('Add Link');

View File

@ -1,4 +1,15 @@
<?php
/**
* Manage link category administration actions.
*
* This page is accessed by the link management pages and handles the forms and
* AJAX processes for category actions.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once('admin.php');
wp_reset_vars(array('action', 'cat'));
@ -31,7 +42,7 @@ case 'delete':
$default_cat_id = get_option('default_link_category');
// Don't delete the default cats.
if ( $cat_ID == $default_cat_id )
if ( $cat_ID == $default_cat_id )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));

View File

@ -1,7 +1,14 @@
<?php
// Links
// Copyright (C) 2002 Mike Little -- mike@zed1.com
/**
* Links Import Administration Panel.
*
* @copyright 2002 Mike Little <mike@zed1.com>
* @author Mike Little <mike@zed1.com>
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once('admin.php');
$parent_file = 'edit.php';
$title = __('Import Blogroll');
@ -98,6 +105,7 @@ foreach ($categories as $category) {
$opml = file_get_contents($opml_url);
}
/** Load OPML Parser */
include_once('link-parse-opml.php');
$link_count = count($names);

View File

@ -1,5 +1,12 @@
<?php
/**
* Link Management Administration Panel.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once ('admin.php');
// Handle bulk deletes

View File

@ -1,4 +1,12 @@
<?php
/**
* Parse OPML XML files and store in globals.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Bootstrap */
require_once('../wp-load.php');
// columns we wish to find are: link_url, link_name, link_target, link_description
@ -15,9 +23,24 @@ $opml_map = array('URL' => 'link_url',
$map = $opml_map;
/**
** startElement()
** Callback function. Called at the start of a new xml tag.
**/
* XML callback function for the start of a new XML tag.
*
* @since unknown
* @access private
*
* @uses $updated_timestamp Not used inside function.
* @uses $all_links Not used inside function.
* @uses $map Stores names of attributes to use.
* @global array $names
* @global array $urls
* @global array $targets
* @global array $descriptions
* @global array $feeds
*
* @param mixed $parser XML Parser resource.
* @param string $tagName XML element name.
* @param array $attrs XML element attributes.
*/
function startElement($parser, $tagName, $attrs) {
global $updated_timestamp, $all_links, $map;
global $names, $urls, $targets, $descriptions, $feeds;
@ -41,9 +64,16 @@ function startElement($parser, $tagName, $attrs) {
}
/**
** endElement()
** Callback function. Called at the end of an xml tag.
**/
* XML callback function that is called at the end of a XML tag.
*
* @since unknown
* @access private
* @package WordPress
* @subpackage Dummy
*
* @param mixed $parser XML Parser resource.
* @param string $tagName XML tag name.
*/
function endElement($parser, $tagName) {
// nothing to do.
}

View File

@ -1,4 +1,15 @@
<?php
/**
* Manage link administration actions.
*
* This page is accessed by the link management pages and handles the forms and
* AJAX processes for link actions.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once ('admin.php');
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));

View File

@ -1,4 +1,15 @@
<?php
/**
* Manage media uploaded file.
*
* There are many filters in here for media. Plugins can extend functionality
* by hooking into the filters.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once('admin.php');
wp_enqueue_script('swfupload');
wp_enqueue_script('swfupload-degrade');
@ -11,7 +22,7 @@ if (!current_user_can('upload_files'))
wp_die(__('You do not have permission to upload files.'));
// IDs should be integers
$ID = isset($ID)? (int) $ID : 0;
$ID = isset($ID) ? (int) $ID : 0;
$post_id = isset($post_id)? (int) $post_id : 0;
// Require an ID for the edit screen

View File

@ -1,5 +1,12 @@
<?php
/**
* Media management action handler.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once('admin.php');
$parent_file = 'edit.php';

View File

@ -1,4 +1,18 @@
<?php
/**
* Displays Administration Menu.
*
* @package WordPress
* @subpackage Administration
*/
/**
* The current page.
*
* @global string $self
* @name $self
* @var string
*/
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
$self = preg_replace('|^.*/plugins/|i', '', $self);

View File

@ -1,9 +1,23 @@
<?php
// This array constructs the admin menu bar.
//
// Menu item name
// The minimum level the user needs to access the item: between 0 and 10
// The URL of the item's file
/**
* Build Administration Menu.
*
* @package WordPress
* @subpackage Administration
*/
/**
* Constructs the admin menu bar.
*
* The elements in the array are :
* 0: Menu item name
* 1: Minimum level or capability required.
* 2: The URL of the item's file
*
* @global array $menu
* @name $menu
* @var array
*/
$menu[0] = array(__('Dashboard'), 'read', 'index.php');
if (strpos($_SERVER['REQUEST_URI'], 'edit-pages.php') !== false)

View File

@ -1,4 +1,12 @@
<?php
/**
* Comment Moderation Administration Panel.
*
* Redirects to edit-comments.php?comment_status=moderated.
*
* @package WordPress
* @subpackage Administration
*/
require_once('../wp-load.php');
wp_redirect('edit-comments.php?comment_status=moderated');
?>

View File

@ -1,4 +1,16 @@
<?php wp_reset_vars(array('action', 'standalone', 'option_group_id')); ?>
<?php
/**
* WordPress Options Header.
*
* Resets variables: 'action', 'standalone', and 'option_group_id'. Displays
* updated message, if updated variable is part of the URL query.
*
* @package WordPress
* @subpackage Administration
*/
wp_reset_vars(array('action', 'standalone', 'option_group_id'));
?>
<?php if (isset($_GET['updated'])) : ?>
<div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div>

View File

@ -1,4 +1,12 @@
<?php
/**
* Privacy Options Settings Administration Panel.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once('./admin.php');
$title = __('Privacy Settings');

View File

@ -1,4 +1,12 @@
<?php
/**
* New Post Administration Panel.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap */
require_once('admin.php');
$title = __('Create New Post');
$parent_file = 'post-new.php';

View File

@ -1,4 +1,19 @@
<?php
/**
* User Profile Administration Panel.
*
* @package WordPress
* @subpackage Administration
*/
/**
* This is a profile page.
*
* @since unknown
* @var bool
*/
define('IS_PROFILE_PAGE', true);
/** Load User Editing Page */
require_once('user-edit.php');
?>

View File

@ -1,4 +1,20 @@
<?php
/**
* Retrieves and creates the wp-config.php file.
*
* The permissions for the base directory must allow for writing files in order
* for the wp-config.php to be created using this page.
*
* @package WordPress
* @subpackage Administration
*/
/**
* We are installing.
*
* @since unknown
* @package WordPress
*/
define('WP_INSTALLING', true);
//These three defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware
define('ABSPATH', dirname(dirname(__FILE__)).'/');
@ -30,7 +46,14 @@ if (isset($_GET['step']))
else
$step = 0;
function display_header(){
/**
* Display setup wp-config.php file header.
*
* @since unknown
* @package WordPress
* @subpackage Installer_WP_Config
*/
function display_header() {
header( 'Content-Type: text/html; charset=utf-8' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

View File

@ -1,5 +1,21 @@
<?php
/**
* Send blog links to pingomatic.com to update.
*
* You can disable this feature by deleting the option 'use_linksupdate' or
* setting the option to false. If no links exist, then no links are sent.
*
* Snoopy is included, but is not used. Fsockopen() is used instead to send link
* URLs.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Bootstrap */
require_once('../wp-load.php');
/** Load Snoopy HTTP Client class */
require_once( ABSPATH . 'wp-includes/class-snoopy.php');
if ( !get_option('use_linksupdate') )

View File

@ -1,5 +1,13 @@
<?php
// Deprecated. Use includes/upgrade.php.
/**
* WordPress Upgrade Functions. Old file, must not be used. Include
* wp-admin/includes/upgrade.php instead.
*
* @deprecated 2.5
* @package WordPress
* @subpackage Administration
*/
_deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php' );
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
?>

View File

@ -1,7 +1,22 @@
<?php
/**
* Upgrade WordPress Page.
*
* @package WordPress
* @subpackage Administration
*/
/**
* We are upgrading WordPress.
*
* @since unknown
* @var bool
*/
define('WP_INSTALLING', true);
/** Load WordPress Bootstrap */
require('../wp-load.php');
timer_start();
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');