Remove trailing whitespace

git-svn-id: http://svn.automattic.com/wordpress/trunk@11930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-09-14 14:03:32 +00:00
parent aa1e377ede
commit 8e3808bce2
44 changed files with 294 additions and 294 deletions

View File

@ -46,7 +46,7 @@ case 'editcomment' :
if ( 'trash' == $comment->comment_approved )
comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
$comment = get_comment_to_edit( $comment_id );
include('edit-form-comment.php');
@ -170,12 +170,12 @@ case 'trashcomment' :
case 'untrashcomment' :
$comment_id = absint( $_REQUEST['c'] );
$noredir = isset($_REQUEST['noredir']);
if (!$comment = get_comment($comment_id))
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );
if (!current_user_can('edit_post', $comment->comment_post_ID ))
comment_footer_die( __('You are not allowed to edit comments on this post.') );
if ($action == 'trashcomment') {
check_admin_referer( 'trash-comment_' . $comment_id );
wp_trash_comment($comment_id);
@ -184,7 +184,7 @@ case 'untrashcomment' :
check_admin_referer( 'untrash-comment_' . $comment_id );
wp_untrash_comment($comment_id);
}
if ('' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ))
wp_redirect( wp_get_referer() );
else if ('' != wp_get_original_referer() && false == $noredir)

View File

@ -19,7 +19,7 @@ $post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) ) {
check_admin_referer('bulk-comments');
if ((isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
$comment_status = $wpdb->escape($_REQUEST['comment_status']);
$delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
@ -29,9 +29,9 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R
$comment_ids = $_REQUEST['delete_comments'];
$doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
} else wp_redirect($_SERVER['HTTP_REFERER']);
$approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0;
foreach ($comment_ids as $comment_id) { // Check the permissions on each
$_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );

View File

@ -40,7 +40,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
if ( !wp_trash_post($post_id) )
wp_die( __('Error in moving to trash...') );
$trashed++;
}
$sendback = add_query_arg('trashed', $trashed, $sendback);
@ -53,7 +53,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
if ( !wp_untrash_post($post_id) )
wp_die( __('Error in restoring from trash...') );
$untrashed++;
}
$sendback = add_query_arg('untrashed', $untrashed, $sendback);

View File

@ -48,7 +48,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
if ( !wp_trash_post($post_id) )
wp_die( __('Error in moving to trash...') );
$trashed++;
}
$sendback = add_query_arg('trashed', $trashed, $sendback);
@ -61,7 +61,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
if ( !wp_untrash_post($post_id) )
wp_die( __('Error in restoring from trash...') );
$untrashed++;
}
$sendback = add_query_arg('untrashed', $untrashed, $sendback);

View File

@ -29,7 +29,7 @@
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
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 !).
@ -68,7 +68,7 @@
// ----- Optional threshold ratio for use of temporary files
// Pclzip sense the size of the file to add/extract and decide to
// use or not temporary file. The algorythm is looking for
// use or not temporary file. The algorythm is looking for
// memory_limit of PHP and apply a ratio.
// threshold = memory_limit * ratio.
// Recommended values are under 0.5. Default 0.47.
@ -152,7 +152,7 @@
define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
// ----- File description attributes
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
@ -198,7 +198,7 @@
// ----- Internal error handling
var $error_code = 1;
var $error_string = '';
// ----- Current status of the magic_quotes_runtime
// This value store the php configuration for magic_quotes
// The class can then disable the magic_quotes and reset it after
@ -341,7 +341,7 @@
}
}
}
// ----- Look for default option values
$this->privOptionDefaultThreshold($v_options);
@ -350,16 +350,16 @@
$v_att_list = array();
$v_filedescr_list = array();
$p_result_list = array();
// ----- Look if the $p_filelist is really an array
if (is_array($p_filelist)) {
// ----- Look if the first element is also an array
// This will mean that this is a file description entry
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
$v_att_list = $p_filelist;
}
// ----- The list is a list of string names
else {
$v_string_list = $p_filelist;
@ -378,7 +378,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
@ -390,7 +390,7 @@
}
}
}
// ----- For each file in the list check the attributes
$v_supported_attributes
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
@ -549,16 +549,16 @@
$v_att_list = array();
$v_filedescr_list = array();
$p_result_list = array();
// ----- Look if the $p_filelist is really an array
if (is_array($p_filelist)) {
// ----- Look if the first element is also an array
// This will mean that this is a file description entry
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
$v_att_list = $p_filelist;
}
// ----- The list is a list of string names
else {
$v_string_list = $p_filelist;
@ -577,14 +577,14 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
return 0;
}
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
}
}
// ----- For each file in the list check the attributes
$v_supported_attributes
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
@ -1049,7 +1049,7 @@
// Options :
// PCLZIP_OPT_BY_INDEX :
// PCLZIP_OPT_BY_NAME :
// PCLZIP_OPT_BY_EREG :
// PCLZIP_OPT_BY_EREG :
// PCLZIP_OPT_BY_PREG :
// Return Values :
// 0 on failure,
@ -1124,7 +1124,7 @@
function deleteByIndex($p_index)
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
// ----- Return
@ -1178,7 +1178,7 @@
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
{
$this->privSwapBackMagicQuotes();
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
@ -1507,7 +1507,7 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
$v_result=1;
// ----- Read the options
$i=0;
while ($i<$p_size) {
@ -1552,14 +1552,14 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Check for incompatible options
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Check the value
$v_value = $p_options_list[$i+1];
if ((!is_integer($v_value)) || ($v_value<0)) {
@ -1581,7 +1581,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$v_result_list[$p_options_list[$i]] = true;
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
break;
@ -1599,7 +1599,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
$v_result_list[$p_options_list[$i]] = true;
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
break;
@ -1763,7 +1763,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Reduce the index list
// each index item in the list must be a couple with a start and
// an end value : [0,3], [5-5], [8-10], ...
@ -1774,10 +1774,10 @@
// ----- Explode the item
$v_item_list = explode("-", $v_work_list[$j]);
$v_size_item_list = sizeof($v_item_list);
// ----- TBC : Here we might check that each item is a
// real integer ...
// ----- Look for single value
if ($v_size_item_list == 1) {
// ----- Set the option value
@ -1815,7 +1815,7 @@
}
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
}
// ----- Sort the items
if ($v_sort_flag) {
// TBC : To Be Completed
@ -1928,11 +1928,11 @@
}
}
}
// ----- Look for default values
if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Calculate auto threshold");
}
// ----- Return
@ -1951,19 +1951,19 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOptionDefaultThreshold", "");
$v_result=1;
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Create an auto-threshold for use of temporay files");
// ----- Get 'memory_limit' configuration value
$v_memory_limit = ini_get('memory_limit');
$v_memory_limit = trim($v_memory_limit);
$last = strtolower(substr($v_memory_limit, -1));
if($last == 'g')
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
$v_memory_limit = $v_memory_limit*1073741824;
@ -1972,9 +1972,9 @@
$v_memory_limit = $v_memory_limit*1048576;
if($last == 'k')
$v_memory_limit = $v_memory_limit*1024;
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Threshold value is : ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]." bytes");
@ -1983,7 +1983,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Unset the threshold (value ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD].") because under 1Mo sanity check)");
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
}
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
@ -2002,10 +2002,10 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
$v_result=1;
// ----- For each file in the list check the attributes
foreach ($p_file_list as $v_key => $v_value) {
// ----- Check if the option is supported
if (!isset($v_requested_options[$v_key])) {
// ----- Error log
@ -2027,7 +2027,7 @@
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
if ($p_filedescr['filename'] == '') {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
@ -2123,10 +2123,10 @@
}
}
}
// end foreach
}
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
@ -2140,7 +2140,7 @@
// or a string to be added as file. For any other type of files (link, other)
// just ignore the item.
// Then prepare the information that will be stored for that file.
// When its a folder, expand the folder with all the files that are in that
// When its a folder, expand the folder with all the files that are in that
// folder (recursively).
// Parameters :
// Return Values :
@ -2151,23 +2151,23 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
$v_result=1;
// ----- Create a result list
$v_result_list = array();
// ----- Look each entry
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for file ".$i.".");
// ----- Get filedescr
$v_descr = $p_filedescr_list[$i];
// ----- Reduce the filename
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
// ----- Look for real file or folder
if (file_exists($v_descr['filename'])) {
if (@is_file($v_descr['filename'])) {
@ -2189,13 +2189,13 @@
continue;
}
}
// ----- Look for string added as file
else if (isset($v_descr['content'])) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a string added as a file");
$v_descr['type'] = 'virtual_file';
}
// ----- Missing file
else {
// ----- Error log
@ -2206,13 +2206,13 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Calculate the stored filename
$this->privCalculateStoredFilename($v_descr, $p_options);
// ----- Add the descriptor in result list
$v_result_list[sizeof($v_result_list)] = $v_descr;
// ----- Look for folder
if ($v_descr['type'] == 'folder') {
// ----- List of items in folder
@ -2226,10 +2226,10 @@
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
continue;
}
// ----- Compose the full filename
$v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
// ----- Look for different stored filename
// Because the name of the folder was changed, the name of the
// files/sub-folders also change
@ -2241,17 +2241,17 @@
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
}
}
$v_dirlist_nb++;
}
@closedir($v_folder_handler);
}
else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
// TBC : unable to open folder in read mode
}
// ----- Expand each element of the list
if ($v_dirlist_nb != 0) {
// ----- Expand
@ -2259,7 +2259,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Concat the resulting list
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
@ -2268,12 +2268,12 @@
else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
}
// ----- Free local array
unset($v_dirlist_descr);
}
}
// ----- Get the result list
$p_filedescr_list = $v_result_list;
@ -2294,7 +2294,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
$v_result=1;
$v_list_detail = array();
// ----- Magic quotes trick
$this->privDisableMagicQuotes();
@ -2655,7 +2655,7 @@
// Function : privAddFileList()
// Description :
// Parameters :
// $p_filedescr_list : An array containing the file description
// $p_filedescr_list : An array containing the file description
// or directory names to add in the zip
// $p_result_list : list of added files with their properties (specially the status field)
// Return Values :
@ -2675,7 +2675,7 @@
// ----- Format the filename
$p_filedescr_list[$j]['filename']
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
// ----- Skip empty file names
@ -2735,7 +2735,7 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
$v_result=1;
// ----- Working variable
$p_filename = $p_filedescr['filename'];
@ -2748,8 +2748,8 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Look for a stored different filename
// ----- Look for a stored different filename
/* TBC : Removed
if (isset($p_filedescr['stored_filename'])) {
$v_stored_filename = $p_filedescr['stored_filename'];
@ -2786,20 +2786,20 @@
$p_header['external'] = 0x00000000;
$p_header['size'] = filesize($p_filename);
}
// ----- Look for regular folder
else if ($p_filedescr['type']=='folder') {
$p_header['external'] = 0x00000010;
$p_header['mtime'] = filemtime($p_filename);
$p_header['size'] = filesize($p_filename);
}
// ----- Look for virtual file
else if ($p_filedescr['type'] == 'virtual_file') {
$p_header['external'] = 0x00000000;
$p_header['size'] = strlen($p_filedescr['content']);
}
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
// ----- Look for filetime
@ -2855,7 +2855,7 @@
if ($p_header['stored_filename'] == "") {
$p_header['status'] = "filtered";
}
// ----- Check the path length
if (strlen($p_header['stored_filename']) > 0xFF) {
$p_header['status'] = 'filename_too_long';
@ -2867,7 +2867,7 @@
// ----- Look for a file
if ($p_filedescr['type'] == 'file') {
// ----- Look for using temporary file to zip
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
@ -2876,12 +2876,12 @@
return $v_result;
}
}
// ----- Use "in memory" zip algo
else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
// ----- Open the source file
@ -2893,15 +2893,15 @@
// ----- Read the file content
$v_content = @fread($v_file, $p_header['size']);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");
// ----- Close the file
@fclose($v_file);
// ----- Calculate the CRC
$p_header['crc'] = @crc32($v_content);
// ----- Look for no compression
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
@ -2909,20 +2909,20 @@
$p_header['compressed_size'] = $p_header['size'];
$p_header['compression'] = 0;
}
// ----- Look for normal compression
else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
// ----- Compress the content
$v_content = @gzdeflate($v_content);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");
// ----- Set header parameters
$p_header['compressed_size'] = strlen($v_content);
$p_header['compression'] = 8;
}
// ----- Call the header generation
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
@fclose($v_file);
@ -2939,13 +2939,13 @@
// ----- Look for a virtual file (a file from string)
else if ($p_filedescr['type'] == 'virtual_file') {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Add by string");
$v_content = $p_filedescr['content'];
// ----- Calculate the CRC
$p_header['crc'] = @crc32($v_content);
// ----- Look for no compression
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
@ -2953,7 +2953,7 @@
$p_header['compressed_size'] = $p_header['size'];
$p_header['compression'] = 0;
}
// ----- Look for normal compression
else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
@ -2964,7 +2964,7 @@
$p_header['compressed_size'] = strlen($v_content);
$p_header['compression'] = 8;
}
// ----- Call the header generation
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
@fclose($v_file);
@ -3035,7 +3035,7 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileUsingTempFile", "filename='".$p_filedescr['filename']."'");
$v_result=PCLZIP_ERR_NO_ERROR;
// ----- Working variable
$p_filename = $p_filedescr['filename'];
@ -3153,7 +3153,7 @@
// ----- Unlink the temporary file
@unlink($v_gzip_temp_name);
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
@ -3172,7 +3172,7 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
$v_result=1;
// ----- Working variables
$p_filename = $p_filedescr['filename'];
if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
@ -3201,7 +3201,7 @@
$v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
}
// ----- Look for path and/or short name change
else {
@ -3234,7 +3234,7 @@
if ( (substr($p_filename, 0, 2) == "./")
|| (substr($p_remove_dir, 0, 2) == "./")) {
if ( (substr($p_filename, 0, 2) == "./")
&& (substr($p_remove_dir, 0, 2) != "./")) {
$p_remove_dir = "./".$p_remove_dir;
@ -3260,10 +3260,10 @@
}
}
}
// ----- Remove drive letter if any
$v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
// ----- Look for path to add
if ($p_add_dir != "") {
if (substr($p_add_dir, -1) == "/")
@ -3278,7 +3278,7 @@
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
$p_filedescr['stored_filename'] = $v_stored_filename;
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
@ -3443,7 +3443,7 @@
{
// ----- Magic quotes trick
$this->privSwapBackMagicQuotes();
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
@ -3726,7 +3726,7 @@
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
// ----- Look if the index is in the list
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
@ -3766,7 +3766,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
$this->privSwapBackMagicQuotes();
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
"Filename '".$v_header['stored_filename']."' is "
."compressed by an unsupported compression "
@ -3776,7 +3776,7 @@
return PclZip::errorCode();
}
}
// ----- Check encrypted files
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
@ -3813,7 +3813,7 @@
$v_extract = false;
}
// ----- Look for real extraction
if ($v_extract)
{
@ -3867,7 +3867,7 @@
// ----- Next extracted file
$v_nb_extracted++;
// ----- Look for user callback abort
if ($v_result1 == 2) {
break;
@ -4019,13 +4019,13 @@
if ($p_path != '') {
$p_entry['filename'] = $p_path."/".$p_entry['filename'];
}
// ----- Check a base_dir_restriction
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
$v_inclusion
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
$p_entry['filename']);
$p_entry['filename']);
if ($v_inclusion == 0) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
@ -4055,7 +4055,7 @@
$p_entry['status'] = "skipped";
$v_result = 1;
}
// ----- Look for abort result
if ($v_result == 2) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
@ -4087,7 +4087,7 @@
// ----- Change the file status
$p_entry['status'] = "already_a_directory";
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
// For historical reason first PclZip implementation does not stop
// when this kind of error occurs.
@ -4172,10 +4172,10 @@
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
// ----- Change the file status
$p_entry['status'] = "path_creation_fail";
// ----- Return
////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
//return $v_result;
@ -4220,7 +4220,7 @@
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
@fwrite($v_dest_file, $v_binary_data, $v_read_size);
*/
@fwrite($v_dest_file, $v_buffer, $v_read_size);
@fwrite($v_dest_file, $v_buffer, $v_read_size);
$v_size -= $v_read_size;
}
@ -4229,7 +4229,7 @@
// ----- Change the file mtime
touch($p_entry['filename'], $p_entry['mtime']);
}
else {
@ -4245,7 +4245,7 @@
// ----- Look for using temporary file to unzip
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
@ -4254,47 +4254,47 @@
return $v_result;
}
}
// ----- Look for extract in memory
else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
// ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
// ----- Decompress the file
$v_file_content = @gzinflate($v_buffer);
unset($v_buffer);
if ($v_file_content === FALSE) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
// ----- Change the file status
// TBC
$p_entry['status'] = "error";
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
// ----- Change the file status
$p_entry['status'] = "write_error";
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Write the uncompressed data
@fwrite($v_dest_file, $v_file_content, $p_entry['size']);
unset($v_file_content);
// ----- Closing the destination file
@fclose($v_dest_file);
}
// ----- Change the file mtime
@ -4317,7 +4317,7 @@
if ($p_entry['status'] == "aborted") {
$p_entry['status'] = "skipped";
}
// ----- Look for post-extract callback
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
@ -4354,7 +4354,7 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileUsingTempFile', "filename='".$p_entry['filename']."'");
$v_result=1;
// ----- Creates a temporary file
$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
@ -4426,7 +4426,7 @@
// ----- Delete the temporary file
@unlink($v_gzip_temp_name);
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
@ -4515,7 +4515,7 @@
// ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
// ----- Decompress the file
$v_file_content = gzinflate($v_buffer);
unset($v_buffer);
@ -4604,7 +4604,7 @@
// ----- Reading the file
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
// ----- Decompress the file
if (($p_string = @gzinflate($v_data)) === FALSE) {
// TBC
@ -4921,7 +4921,7 @@
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
}
// ----- Look for flag bit 3
if (($p_local_header['flag'] & 8) == 8) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
@ -5026,9 +5026,9 @@
// ----- Add the byte
// $v_bytes = ($v_bytes << 8) | Ord($v_byte);
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
// ----- Compare the bytes
if ($v_bytes == 0x504b0506)
@ -5363,7 +5363,7 @@
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Check that local file header is same as central file header
if ($this->privCheckFileHeaders($v_local_header,
$v_header_list[$i]) != 1) {
@ -5456,11 +5456,11 @@
// TBC : I should test the result ...
//@rename($v_zip_temp_name, $this->zipname);
PclZipUtilRename($v_zip_temp_name, $this->zipname);
// ----- Destroy the temporary archive
unset($v_temp_zip);
}
// ----- Remove every files : reset the file
else if ($v_central_dir['entries'] != 0) {
$this->privCloseFd();
@ -6008,7 +6008,7 @@
}
}
}
// ----- Look for skip
if ($v_skip > 0) {
while ($v_skip > 0) {
@ -6043,7 +6043,7 @@
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
$v_result = 1;
// ----- Look for path beginning by ./
if ( ($p_dir == '.')
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
@ -6234,7 +6234,7 @@
function PclZipUtilOptionText($p_option)
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
$v_list = get_defined_constants();
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
$v_prefix = substr($v_key, 0, 10);
@ -6246,7 +6246,7 @@
return $v_key;
}
}
$v_result = 'Unknown';
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);

View File

@ -18,7 +18,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
var $errors = null;
/**
* constructor
*
*
* @param $arg mixed ingored argument
*/
function WP_Filesystem_Direct($arg) {
@ -27,7 +27,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* connect filesystem.
*
*
* @return bool Returns true on success or false on failure (always true for WP_Filesystem_Direct).
*/
function connect() {
@ -35,26 +35,26 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* Reads entire file into a string
*
*
* @param $file string Name of the file to read.
* @return string|bool The function returns the read data or false on failure.
* @return string|bool The function returns the read data or false on failure.
*/
function get_contents($file) {
return @file_get_contents($file);
}
/**
* Reads entire file into an array
*
* @param $file string Path to the file.
* @return array|bool the file contents in an array or false on failure.
*
* @param $file string Path to the file.
* @return array|bool the file contents in an array or false on failure.
*/
function get_contents_array($file) {
return @file($file);
}
/**
* Write a string to a file
*
* @param $file string Path to the file where to write the data.
*
* @param $file string Path to the file where to write the data.
* @param $contents string The data to write.
* @param $mode int (optional) The file permissions as octal number, usually 0644.
* @param $type string (optional) Specifies additional type of access you require to the file.
@ -70,8 +70,8 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* Gets the current working directory
*
* @return string|bool the current working directory on success, or false on failure.
*
* @return string|bool the current working directory on success, or false on failure.
*/
function cwd() {
return @getcwd();
@ -79,7 +79,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Change directory
*
* @param $dir string The new current directory.
* @param $dir string The new current directory.
* @return bool Returns true on success or false on failure.
*/
function chdir($dir) {
@ -87,10 +87,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* Changes file group
*
* @param $file string Path to the file.
*
* @param $file string Path to the file.
* @param $group mixed A group name or number.
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
* @return bool Returns true on success or false on failure.
*/
function chgrp($file, $group, $recursive = false) {
@ -110,10 +110,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* Changes filesystem permissions
*
*
* @param $file string Path to the file.
* @param $mode int (optional) The permissions as octal number, usually 0644 for files, 0755 for dirs.
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
* @return bool Returns true on success or false on failure.
*/
function chmod($file, $mode = false, $recursive = false) {
@ -126,7 +126,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
elseif ( $this->is_dir($file) )
$mode = FS_CHMOD_DIR;
else
return false;
return false;
}
if ( ! $recursive )
@ -143,10 +143,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* Changes file owner
*
* @param $file string Path to the file.
*
* @param $file string Path to the file.
* @param $owner mixed A user name or number.
* @param $recursive bool (optional) If set True changes file owner recursivly. Defaults to False.
* @param $recursive bool (optional) If set True changes file owner recursivly. Defaults to False.
* @return bool Returns true on success or false on failure.
*/
function chown($file, $owner, $recursive = false) {
@ -165,8 +165,8 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* Gets file owner
*
* @param $file string Path to the file.
*
* @param $file string Path to the file.
* @return string Username of the user.
*/
function owner($file) {
@ -180,10 +180,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
}
/**
* Gets file permissions
*
*
* FIXME does not handle errors in fileperms()
*
* @param $file string Path to the file.
*
* @param $file string Path to the file.
* @return string Mode of the file (last 4 digits).
*/
function getchmod($file) {

View File

@ -149,7 +149,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
elseif ( $this->is_dir($file) )
$mode = FS_CHMOD_DIR;
else
return false;
return false;
}
if ( ! $recursive || ! $this->is_dir($file) ) {

View File

@ -160,7 +160,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
elseif ( $this->is_dir($file) )
$mode = FS_CHMOD_DIR;
else
return false;
return false;
}
if ( ! $recursive || ! $this->is_dir($file) ) {

View File

@ -194,7 +194,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
elseif ( $this->is_dir($file) )
$mode = FS_CHMOD_DIR;
else
return false;
return false;
}
if ( ! $recursive || ! $this->is_dir($file) )

View File

@ -570,7 +570,7 @@ class Theme_Upgrader extends WP_Upgrader {
$this->skin->after();
return false;
}
$r = $current->response[ $theme ];
add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
@ -1006,10 +1006,10 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
$name = $theme_info['Name'];
$stylesheet = $this->upgrader->result['destination_name'];
$template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
$update_actions = array(
'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>',
'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>',

View File

@ -268,7 +268,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
// Don't export revisions. They bloat the export.
if ( 'revision' == $post->post_type )
continue;
setup_postdata($post);
setup_postdata($post);
$is_sticky = 0;
if ( is_sticky( $post->ID ) )

View File

@ -598,7 +598,7 @@ function WP_Filesystem( $args = false, $context = false ) {
$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
if( ! file_exists($abstraction_file) )
return;
require_once($abstraction_file);
}
$method = "WP_Filesystem_$method";

View File

@ -42,7 +42,7 @@ function wp_image_editor($post_id) {
<div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-fliph" title="<?php echo esc_attr__( 'Flip horizontally' ); ?>"></div>
<div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-flipv" title="<?php echo esc_attr__( 'Flip vertically' ); ?>"></div>
<div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-undo disabled" title="<?php echo esc_attr__( 'Undo' ); ?>"></div>
<div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-redo disabled" title="<?php echo esc_attr__( 'Redo' ); ?>"></div>
<br class="clear" />

View File

@ -615,7 +615,7 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
} else {
$menu[$position] = $new_menu;
}
$_registered_pages[$hookname] = true;
return $hookname;
@ -623,17 +623,17 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
global $_wp_last_object_menu;
$_wp_last_object_menu++;
return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_object_menu);
}
function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
global $_wp_last_utility_menu;
$_wp_last_utility_menu++;
return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_utility_menu);
}
@ -674,7 +674,7 @@ function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $fi
$_registered_pages[$hookname] = true;
// backwards-compatibility for plugins using add_management page. See wp-admin/admin.php for redirect from edit.php to tools.php
if ( 'tools.php' == $parent )
if ( 'tools.php' == $parent )
$_registered_pages[get_plugin_page_hookname( $file, 'edit.php')] = true;
return $hookname;

View File

@ -1078,7 +1078,7 @@ function wp_set_post_lock( $post_id ) {
/**
* Outputs the notice message to say that someone else is editing this post at the moment.
*
*
* @since 2.9.0
* @return none
*/
@ -1086,7 +1086,7 @@ function _admin_notice_post_locked() {
global $post;
$last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
switch ($post->post_type) {
case 'post':
$message = __( 'Warning: %s is currently editing this post' );
@ -1097,9 +1097,9 @@ function _admin_notice_post_locked() {
default:
$message = __( 'Warning: %s is currently editing this.' );
}
$message = sprintf( $message, esc_html( $last_user_name ) );
echo "<div class='error'><p>$message</p></div>";
echo "<div class='error'><p>$message</p></div>";
}
/**

View File

@ -2065,7 +2065,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
} else {
$query .= "AND $approved $post $typesql";
}
$comments = $wpdb->get_results("SELECT * $query $orderby");
if ( '' === $total )
$total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query");

View File

@ -54,7 +54,7 @@ function display_setup_form( $error = null ) {
if ( isset($_POST) && !empty($_POST) ) {
$blog_public = isset($_POST['blog_public']);
}
if ( ! is_null( $error ) ) {
?>
<p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>

View File

@ -60,7 +60,7 @@ case 'edit' :
if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
if ( $att->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
wp_enqueue_script( 'wp-ajax-response' );

View File

@ -131,7 +131,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
$parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
if ( $parent_exists )
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";

View File

@ -61,7 +61,7 @@ if ( !empty($action) ) {
case 'activate-selected':
if ( ! current_user_can('activate_plugins') )
wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
check_admin_referer('bulk-manage-plugins');
$plugins = (array) $_POST['checked'];

View File

@ -68,7 +68,7 @@ switch ( $step ) :
break;
case 1:
wp_upgrade();
$backto = empty($_GET['backto']) ? '' : $_GET['backto'] ;
$backto = stripslashes( urldecode( $backto ) );
$backto = esc_url_raw( $backto );

View File

@ -69,7 +69,7 @@ if ( isset($_GET['find_detached']) ) {
} elseif ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
check_admin_referer('bulk-media');
if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
$doaction = 'delete';
@ -78,7 +78,7 @@ if ( isset($_GET['find_detached']) ) {
$doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
} else
wp_redirect($_SERVER['HTTP_REFERER']);
$location = 'upload.php';
if ( $referer = wp_get_referer() ) {
if ( false !== strpos($referer, 'upload.php') )
@ -90,7 +90,7 @@ if ( isset($_GET['find_detached']) ) {
foreach( (array) $post_ids as $post_id ) {
if ( !current_user_can('delete_post', $post_id) )
wp_die( __('You are not allowed to move this post to the trash.') );
if ( !wp_trash_post($post_id) )
wp_die( __('Error in moving to trash...') );
}
@ -100,7 +100,7 @@ if ( isset($_GET['find_detached']) ) {
foreach( (array) $post_ids as $post_id ) {
if ( !current_user_can('delete_post', $post_id) )
wp_die( __('You are not allowed to move this post out of the trash.') );
if ( !wp_untrash_post($post_id) )
wp_die( __('Error in restoring from trash...') );
}
@ -110,7 +110,7 @@ if ( isset($_GET['find_detached']) ) {
foreach( (array) $post_ids as $post_id_del ) {
if ( !current_user_can('delete_post', $post_id_del) )
wp_die( __('You are not allowed to delete this post.') );
if ( !wp_delete_attachment($post_id_del) )
wp_die( __('Error in deleting...') );
}

View File

@ -273,7 +273,7 @@ else
<tr>
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
</tr>
</tr>
<?php
}
?>

View File

@ -781,7 +781,7 @@ EOD;
}
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
$location = get_option ('upload_path') . '/' . $location;
$location = get_option ('upload_path') . '/' . $location;
$filetype = wp_check_filetype($location);
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
@ -791,9 +791,9 @@ EOD;
header('Content-Type: ' . $entry['post_mime_type']);
header('Connection: close');
if ($fp = fopen($location, "rb")) {
status_header('200');
header('Content-Type: ' . $entry['post_mime_type']);
if ($fp = fopen($location, "rb")) {
status_header('200');
header('Content-Type: ' . $entry['post_mime_type']);
header('Connection: close');
while(!feof($fp)) {

View File

@ -95,8 +95,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
}
} elseif ( is_single() && !empty($_GET['name']) && ! $redirect_url ) {
if ( $redirect_url = get_permalink( $wp_query->get_queried_object_id() ) )
$redirect['query'] = remove_query_arg('name', $redirect['query']);
if ( $redirect_url = get_permalink( $wp_query->get_queried_object_id() ) )
$redirect['query'] = remove_query_arg('name', $redirect['query']);
} elseif ( is_page() && !empty($_GET['page_id']) && ! $redirect_url ) {
if ( $redirect_url = get_permalink(get_query_var('page_id')) )
$redirect['query'] = remove_query_arg('page_id', $redirect['query']);

View File

@ -266,7 +266,7 @@ class Services_JSON
*/
function _encode($var)
{
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false';

View File

@ -214,7 +214,7 @@ class WP {
// Trim the query of everything up to the '?'.
$query = preg_replace("!^.+\?!", '', $query);
// Substitute the substring matches into the query.
$query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
@ -1594,59 +1594,59 @@ class WP_Ajax_Response {
/**
* Helper class to remove the need to use eval to replace $matches[] in query strings.
*
*
* @since 2.9.0
*/
class WP_MatchesMapRegex {
/**
* store for matches
*
*
* @access private
* @var array
*/
var $_matches;
/**
* store for mapping result
*
*
* @access public
* @var string
*/
var $output;
/**
* subject to perform mapping on (query string containing $matches[] references
*
*
* @access private
* @var string
*/
var $_subject;
/**
* regexp pattern to match $matches[] references
*
* regexp pattern to match $matches[] references
*
* @var string
*/
var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
/**
* constructor
*
*
* @param string $subject subject if regex
* @param array $matches data to use in map
* @return self
*/
*/
function WP_MatchesMapRegex($subject, $matches) {
$this->_subject = $subject;
$this->_matches = $matches;
$this->output = $this->_map();
$this->output = $this->_map();
}
/**
* Substitute substring matches in subject.
*
*
* static helper function to ease use
*
*
* @access public
* @param string $subject subject
* @param array $matches data used for subsitution
@ -1654,12 +1654,12 @@ class WP_MatchesMapRegex {
*/
function apply($subject, $matches) {
$oSelf =& new WP_MatchesMapRegex($subject, $matches);
return $oSelf->output;
return $oSelf->output;
}
/**
* do the actual mapping
*
* do the actual mapping
*
* @access private
* @return string
*/
@ -1667,10 +1667,10 @@ class WP_MatchesMapRegex {
$callback = array(&$this, 'callback');
return preg_replace_callback($this->_pattern, $callback, $this->_subject);
}
/**
* preg_replace_callback hook
*
*
* @access public
* @param array $matches preg_replace regexp matches
* @return string
@ -1679,7 +1679,7 @@ class WP_MatchesMapRegex {
$index = intval(substr($matches[0], 9, -1));
return ( isset( $this->_matches[$index] ) ? $this->_matches[$index] : '' );
}
}
?>

View File

@ -835,12 +835,12 @@ function comments_template( $file = '/comments.php', $separate_comments = false
/**
* The email address of the current comment author escaped for use in attributes.
*/
*/
$comment_author_email = $commenter['comment_author_email']; // Escaped by sanitize_comment_cookies()
/**
* The url of the current comment author escaped for use in attributes.
*/
*/
$comment_author_url = esc_url($commenter['comment_author_url']);
/** @todo Use API instead of SELECTs. */

View File

@ -734,9 +734,9 @@ function wp_delete_comment($comment_id) {
if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
return wp_trash_comment($comment_id);
do_action('delete_comment', $comment_id);
$trash_meta = get_option('wp_trash_meta');
if (is_array($trash_meta) && isset($trash_meta['comments'][$comment_id])) {
unset($trash_meta['comments'][$comment_id]);
@ -1093,7 +1093,7 @@ function wp_new_comment( $commentdata ) {
*/
function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
global $wpdb;
$status = '0';
switch ( $comment_status ) {
case 'hold':

View File

@ -32,12 +32,12 @@ function wptexturize($text) {
$curl = '';
$textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$stop = count($textarr);
/* translators: opening curly quote */
$opening_quote = _x('&#8220;', 'opening curly quote');
/* translators: closing curly quote */
$closing_quote = _x('&#8221;', 'closing curly quote');
$no_texturize_tags = apply_filters('no_texturize_tags', array('pre', 'code', 'kbd', 'style', 'script', 'tt'));
$no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', array('code'));
$no_texturize_tags_stack = array();
@ -1326,7 +1326,7 @@ function translate_smiley($smiley) {
$smiley = trim(reset($smiley));
$img = $wpsmiliestrans[$smiley];
$smiley_masked = esc_attr($smiley);
$srcurl = apply_filters('smilies_src', "$siteurl/wp-includes/images/smilies/$img", $img, $siteurl);
return " <img src='$srcurl' alt='$smiley_masked' class='wp-smiley' /> ";
@ -2087,14 +2087,14 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
/**
* Perform a deep string replace operation to ensure the values in $search are no longer present
*
*
* Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values
* e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that
* str_replace would return
*
*
* @since 2.8.1
* @access private
*
*
* @param string|array $search
* @param string $subject
* @return string The processed string
@ -2110,7 +2110,7 @@ function _deep_replace($search, $subject){
}
}
}
return $subject;
}

View File

@ -3308,13 +3308,13 @@ function wp_timezone_choice( $selected_zone ) {
$display = $zone['t_continent'];
} else {
// It's inside a continent group
// Continent optgroup
if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
$label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
}
// Add the city to the value
$value[] = $zone['city'];
if ( 'Etc' === $zone['continent'] ) {
@ -3342,7 +3342,7 @@ function wp_timezone_choice( $selected_zone ) {
$selected = 'selected="selected" ';
}
$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
// Close continent optgroup
if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
$structure[] = '</optgroup>';
@ -3364,7 +3364,7 @@ function _cleanup_header_comment($str) {
/**
* Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
*
*
* @since 2.9.0
*
* @return void
@ -3373,15 +3373,15 @@ function wp_scheduled_delete() {
global $wpdb;
$delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
foreach ( (array) $posts_to_delete as $post ) {
wp_delete_post($post['post_id']);
}
//Trashed Comments
//TODO Come up with a better store for the comment trash meta.
//TODO Come up with a better store for the comment trash meta.
$trash_meta = get_option('wp_trash_meta');
if ( !is_array($trash_meta) )
return;

View File

@ -1813,10 +1813,10 @@ class WP_Http_Encoding {
/**
* Decompression of deflated string while staying compatible with the majority of servers.
*
* Certain Servers will return deflated data with headers which PHP's gziniflate()
* Certain Servers will return deflated data with headers which PHP's gziniflate()
* function cannot handle out of the box. The following function lifted from
* http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate
* the various return forms used.
* http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate
* the various return forms used.
*
* @since 2.8.1
* @link http://au2.php.net/manual/en/function.gzinflate.php#77336

View File

@ -1176,16 +1176,16 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
return '';
$css_array = split( ';', trim( $css ) );
$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color',
'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top',
'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side',
'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style',
'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom',
'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom',
'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align',
'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color',
'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top',
'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side',
'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style',
'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom',
'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom',
'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align',
'width' ) );
if ( empty($allowed_attr) )

View File

@ -1648,10 +1648,10 @@ function paginate_comments_links($args = array()) {
*/
function get_shortcut_link() {
$link = "javascript:
var d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
var d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
x=d.selection,
s=(e?e():(k)?k():(x?x.createRange().text:0)),
f='" . admin_url('press-this.php') . "',

View File

@ -349,7 +349,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
$newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
// convert from full colors to index colors, like original PNG.
if ( IMAGETYPE_PNG == $orig_type && !imageistruecolor( $image ) )
imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
@ -378,7 +378,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
} else {
// all other formats are converted to jpg
$destfilename = "{$dir}/{$name}-{$suffix}.jpg";
if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
}
@ -837,7 +837,7 @@ function gd_edit_image_support($mime_type) {
return function_exists('imagecreatefrompng');
case 'image/gif':
return function_exists('imagecreatefromgif');
}
}
}
return false;
}

View File

@ -998,7 +998,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
$notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
$notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
/* translators: 1: blog name, 2: post title */
/* translators: 1: blog name, 2: post title */
$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
} elseif ('pingback' == $comment_type) {
/* translators: 1: post id, 2: post title */

View File

@ -135,7 +135,7 @@ function &get_children($args = '', $output = OBJECT) {
$r = wp_parse_args( $args, $defaults );
$children = get_posts( $r );
if ( !$children )
return $kids;
@ -583,7 +583,7 @@ function delete_post_meta($post_id, $meta_key, $meta_value = '') {
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $meta_key, $meta_value ) );
wp_cache_delete($post_id, 'post_meta');
do_action( 'deleted_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
return true;
@ -672,12 +672,12 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
}
do_action( 'update_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
$wpdb->update( $wpdb->postmeta, $data, $where );
wp_cache_delete($post_id, 'post_meta');
do_action( 'updated_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
return true;
}
@ -1154,12 +1154,12 @@ function wp_delete_post($postid = 0) {
if ( ($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'trash' && EMPTY_TRASH_DAYS > 0 )
return wp_trash_post($postid);
if ( $post->post_type == 'attachment' )
return wp_delete_attachment($postid);
do_action('delete_post', $postid);
delete_post_meta($postid,'_wp_trash_meta_status');
delete_post_meta($postid,'_wp_trash_meta_time');
@ -1819,14 +1819,14 @@ function check_and_publish_future_post($post_id) {
function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
return $slug;
global $wpdb, $wp_rewrite;
$hierarchical_post_types = apply_filters('hierarchical_post_types', array('page'));
if ( 'attachment' == $post_type ) {
// Attachment slugs must be unique across all types.
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
$suffix = 2;
do {
@ -1841,7 +1841,7 @@ function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_pa
// separate namespace than posts so page slugs are allowed to overlap post slugs.
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", $wpdb->escape($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent));
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
$suffix = 2;
do {
@ -1855,7 +1855,7 @@ function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_pa
// Post slugs must be unique across all posts.
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID));
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
$suffix = 2;
do {

View File

@ -2697,7 +2697,7 @@ function setup_postdata($post) {
}
do_action_ref_array('the_post', array(&$post));
return true;
}

View File

@ -306,7 +306,7 @@ function wp_create_user($username, $password, $email = '') {
* Setup the default contact methods
*
* @access private
* @since
* @since
*
* @return array $user_contactmethods Array of contact methods and their labels.
*/

View File

@ -452,7 +452,7 @@ function wp_default_styles( &$styles ) {
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
$styles->add( 'colors', true, array(), $colors_version );
// do not refer to these directly, the right one is queued by the above "meta" colors handle
$styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array(), $colors_version);
$styles->add_data( 'colors-fresh', 'rtl', true );

View File

@ -604,13 +604,13 @@ function get_category_template() {
$category = get_category( $cat_ID );
$templates = array();
if ( !is_wp_error($category) )
$templates[] = "category-{$category->slug}.php";
$templates[] = "category-$cat_ID.php";
$templates[] = "category.php";
$templates[] = "category.php";
$template = locate_template($templates);
return apply_filters('category_template', $template);
}

View File

@ -420,7 +420,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
wp_cache_delete($user_id, 'users');
if ( !$cur )
if ( !$cur )
do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
else
do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );

View File

@ -263,7 +263,7 @@ class wpdb {
*/
var $old_tables = array('categories', 'post2cat', 'link2cat');
/**
* Format specifiers for DB columns. Columns not listed here default to %s. Initialized in wp-settings.php.
*

View File

@ -59,8 +59,8 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
if ( $is_iphone ) {
?>
<meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
<style type="text/css" media="screen">
<meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
<style type="text/css" media="screen">
form { margin-left: 0px; }
#login { margin-top: 20px; }
</style>