!is_numeric( $file['error'] ) && $file['error'] ) return $upload_error_handler( $file, $file['error'] ); // You may define your own function and pass the name in $overrides['unique_filename_callback'] $unique_filename_callback = null; // $_POST['action'] must be set and its value must equal $overrides['action'] or this: $action = 'wp_handle_upload'; // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error']. $upload_error_strings = array( false, __( "The uploaded file exceeds the upload_max_filesize directive in php.ini." ), __( "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." ), __( "The uploaded file was only partially uploaded." ), __( "No file was uploaded." ), '', __( "Missing a temporary folder." ), __( "Failed to write file to disk." ), __( "File upload stopped by extension." )); // All tests are on by default. Most can be turned off by $overrides[{test_name}] = false; $test_form = true; $test_size = true; $test_upload = true; // If you override this, you must provide $ext and $type!!!! $test_type = true; $mimes = false; // Install user overrides. Did we mention that this voids your warranty? if ( is_array( $overrides ) ) extract( $overrides, EXTR_OVERWRITE ); // A correct form post will pass this test. if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) ) return call_user_func($upload_error_handler, $file, __( 'Invalid form submission.' )); // A successful upload will pass this test. It makes no sense to override this one. if ( $file['error'] > 0 ) return call_user_func($upload_error_handler, $file, $upload_error_strings[$file['error']] ); // A non-empty file will pass this test. if ( $test_size && !($file['size'] > 0 ) ) { if ( is_multisite() ) $error_msg = __( 'File is empty. Please upload something more substantial.' ); else $error_msg = __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' ); return call_user_func($upload_error_handler, $file, $error_msg); } // A properly uploaded file will pass this test. There should be no reason to override this one. if ( $test_upload && ! @ is_uploaded_file( $file['tmp_name'] ) ) return call_user_func($upload_error_handler, $file, __( 'Specified file failed upload test.' )); // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. if ( $test_type ) { $wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes ); extract( $wp_filetype ); // Check to see if wp_check_filetype_and_ext() determined the filename was incorrect if ( $proper_filename ) $file['name'] = $proper_filename; if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) return call_user_func($upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' )); if ( !$ext ) $ext = ltrim(strrchr($file['name'], '.'), '.'); if ( !$type ) $type = $file['type']; } else { $type = ''; } // A writable uploads dir will pass this test. Again, there's no point overriding this one. if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) ) return call_user_func($upload_error_handler, $file, $uploads['error'] ); $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); $tmp_file = wp_tempnam($filename); // Move the file to the uploads dir if ( false === @ move_uploaded_file( $file['tmp_name'], $tmp_file ) ) return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); // If a resize was requested, perform the resize. $image_resize = isset( $_POST['image_resize'] ) && 'true' == $_POST['image_resize']; $do_resize = apply_filters( 'wp_upload_resize', $image_resize ); $size = @getimagesize( $tmp_file ); ifo['filename']); } $z->close(); return true; } /** * This function should not be called directly, use unzip_file instead. Attempts to unzip an archive using the PclZip library. * Assumes that WP_Filesystem() has already been called and set up. * * @since 3.0.0 * @see unzip_file * @access private * * @param string $file Full path and filename of zip archive * @param string $to Full path on the filesystem to extract archive to * @param array $needed_dirs A partial list of required folders needed to be created. * @return mixed WP_Error on failure, True on success */ function _unzip_file_pclzip($file, $to, $needed_dirs = array()) { global $wp_filesystem; // See #15789 - PclZip uses string functions on binary data, If it's overloaded with Multibyte safe functions the results are incorrect. if ( ini_get('mbstring.func_overload') && function_exists('mb_internal_encoding') ) { $previous_encoding = mb_internal_encoding(); mb_internal_encoding('ISO-8859-1'); } require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php'); $archive = new PclZip($file); $archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING); if ( isset($previous_encoding) ) mb_internal_encoding($previous_encoding); // Is the archive valid? if ( !is_array($archive_files) ) return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true)); if ( 0 == count($archive_files) ) return new WP_Error('empty_archive', __('Empty archive.')); // Determine any children directories needed (From within the archive) foreach ( $archive_files as $file ) { if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Skip the OS X-created __MACOSX directory continue; $needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname($file['filename']) ); } $needed_dirs = array_unique($needed_dirs); foreach ( $needed_dirs as $dir ) { // Check the parent folders of the folders all exist within the creation array. if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist) continue; if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it continue; $parent_folder = dirname($dir); while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) { $needed_dirs[] = $parent_folder; $parent_folder = dirname($parent_folder); } } asort($needed_dirs); // Create those directories if need be: foreach ( $needed_dirs as $_dir ) { if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the dir exists upon creation failure. Less I/O this way. return new WP_Error('mkdir_failed', __('Could not create directory.'), $_dir); } unset($needed_dirs); // Extract the files from the zip foreach ( $archive_files as $file ) { if ( $file['folder'] ) continue; if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files continue; if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) return new WP_Error('copy_failed', __('Could not copy file.'), $to . $file['filename']); } return true; } /** * Copies a directory from one location to another via the WordPress Filesystem Abstraction. * Assumes that WP_Filesystem() has already been called and setup. * * @since 2.5.0 * * @param string $from source directory * @param string $to destination directory * @param array $skip_list a list of files/folders to skip copying * @return mixed WP_Error on failure, True on success. */ function copy_dir($from, $to, $skip_list = array() ) { global $wp_filesystem; $dirlist = $wp_filesystem->dirlist($from); $from = trailingslashit($from); $to = trailingslashit($to); $skip_regex = ''; foreach ( (array)$skip_list as $key => $skip_file ) $skip_regex .= preg_quote($skip_file, '!') . '|'; if ( !empty($skip_regex) ) $skip_regex = '!(' . rtrim($skip_rege still 50% of the population that got it and voted for Kerry. Bush should apply Tom Peters approach to management: Re-imagine ! And he is miles away from Kevin Roberts (Saatchi & Saatchi CEO) Lovemarks approach.

Posted by John Turner at January 4, 2005 4:29 PM


How can the Irag war "continue" to be a success when it's continuing to be a catastrophic failure?

Posted by john Davincinato at January 5, 2005 1:28 PM



ARCHIVES

- May 2013

- April 2013

- March 2013

- February 2013

- January 2013

- December 2012

- November 2012

- October 2012

- September 2012

- August 2012

- July 2012

- June 2012

- May 2012

- April 2012

- March 2012

- February 2012

- January 2012

- December 2011

- November 2011

- October 2011

- September 2011

- August 2011

- July 2011

- June 2011

- May 2011

- April 2011

- March 2011

- February 2011

- January 2011

- December 2010

- November 2010

- October 2010

- September 2010

- August 2010

- July 2010

- June 2010

- May 2010

- April 2010

- March 2010

- February 2010

- January 2010

- December 2009

- November 2009

- October 2009

- September 2009

- August 2009

- July 2009

- June 2009

- May 2009

- April 2009

- March 2009

- February 2009

- January 2009

- December 2008

- November 2008

- October 2008

- September 2008

- August 2008

- July 2008

- June 2008

- May 2008

- April 2008

- March 2008

- February 2008

- January 2008

- December 2007

- November 2007

- October 2007

- September 2007

- August 2007

- July 2007

- June 2007

- May 2007

- April 2007

- March 2007

- February 2007

- January 2007

- December 2006

- November 2006

- October 2006

- September 2006

- August 2006

- July 2006

- June 2006

- May 2006

- April 2006

- March 2006

- February 2006

- January 2006

- December 2005

- November 2005

- October 2005

- September 2005

- August 2005

- July 2005

- June 2005

- May 2005

- April 2005

- March 2005

- February 2005

- January 2005

- December 2004

- November 2004

- October 2004

- September 2004

- August 2004

- July 2004

- June 2004

- May 2004

- April 2004

Before blogging became all the rage, Tom was posting book reviews and Observations (essentially early blog posts) to this site. You can find the archives below.

What Tom's Reading Archives

- February 2004

- August 2003

- March 2003

- September 2002

- March 2002

- September 2001

- April 2001

- March 2001

- June 2000

- September 1999

OBSERVATIONS ARCHIVES

- July 2004

- April 2004

- February 2004

- May 2003

- March 2003

- June 2002

- April 2002

- March 2002

- February 2002

- January 2002

- December 2001

- November 2001

- October 2001

- September 2001

- August 2001

- February 2001

- January 2001

- December 2000

- November 2000

- October 2000

- September 2000

- August 2000

- July 2000

- June 2000

- May 2000

- April 2000

- March 2000

- February 2000

- January 2000

- December 1999

- November 1999

- October 1999

- September 1999

right now

What we're talking about
on the front page.