raw
mp-wp_genesis           1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * File contains all the administration image manipulation functions.
mp-wp_genesis 4 *
mp-wp_genesis 5 * @package WordPress
mp-wp_genesis 6 * @subpackage Administration
mp-wp_genesis 7 */
mp-wp_genesis 8
mp-wp_genesis 9 /** The descriptions for theme files. */
mp-wp_genesis 10 $wp_file_descriptions = array (
mp-wp_genesis 11 'index.php' => __( 'Main Index Template' ),
mp-wp_genesis 12 'style.css' => __( 'Stylesheet' ),
mp-wp_genesis 13 'rtl.css' => __( 'RTL Stylesheet' ),
mp-wp_genesis 14 'comments.php' => __( 'Comments' ),
mp-wp_genesis 15 'comments-popup.php' => __( 'Popup Comments' ),
mp-wp_genesis 16 'footer.php' => __( 'Footer' ),
mp-wp_genesis 17 'header.php' => __( 'Header' ),
mp-wp_genesis 18 'sidebar.php' => __( 'Sidebar' ),
mp-wp_genesis 19 'archive.php' => __( 'Archives' ),
mp-wp_genesis 20 'category.php' => __( 'Category Template' ),
mp-wp_genesis 21 'page.php' => __( 'Page Template' ),
mp-wp_genesis 22 'search.php' => __( 'Search Results' ),
mp-wp_genesis 23 'searchform.php' => __( 'Search Form' ),
mp-wp_genesis 24 'single.php' => __( 'Single Post' ),
mp-wp_genesis 25 '404.php' => __( '404 Template' ),
mp-wp_genesis 26 'link.php' => __( 'Links Template' ),
mp-wp_genesis 27 'functions.php' => __( 'Theme Functions' ),
mp-wp_genesis 28 'attachment.php' => __( 'Attachment Template' ),
mp-wp_genesis 29 'image.php' => __('Image Attachment Template'),
mp-wp_genesis 30 'video.php' => __('Video Attachment Template'),
mp-wp_genesis 31 'audio.php' => __('Audio Attachment Template'),
mp-wp_genesis 32 'application.php' => __('Application Attachment Template'),
mp-wp_genesis 33 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ),
mp-wp_genesis 34 '.htaccess' => __( '.htaccess (for rewrite rules )' ),
mp-wp_genesis 35 // Deprecated files
mp-wp_genesis 36 'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
mp-wp_genesis 37
mp-wp_genesis 38 /**
mp-wp_genesis 39 * {@internal Missing Short Description}}
mp-wp_genesis 40 *
mp-wp_genesis 41 * @since unknown
mp-wp_genesis 42 *
mp-wp_genesis 43 * @param unknown_type $file
mp-wp_genesis 44 * @return unknown
mp-wp_genesis 45 */
mp-wp_genesis 46 function get_file_description( $file ) {
mp-wp_genesis 47 global $wp_file_descriptions;
mp-wp_genesis 48
mp-wp_genesis 49 if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
mp-wp_genesis 50 return $wp_file_descriptions[basename( $file )];
mp-wp_genesis 51 }
mp-wp_genesis 52 elseif ( file_exists( WP_CONTENT_DIR . $file ) && is_file( WP_CONTENT_DIR . $file ) ) {
mp-wp_genesis 53 $template_data = implode( '', file( WP_CONTENT_DIR . $file ) );
mp-wp_genesis 54 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
mp-wp_genesis 55 return $name[1] . ' Page Template';
mp-wp_genesis 56 }
mp-wp_genesis 57
mp-wp_genesis 58 return basename( $file );
mp-wp_genesis 59 }
mp-wp_genesis 60
mp-wp_genesis 61 /**
mp-wp_genesis 62 * {@internal Missing Short Description}}
mp-wp_genesis 63 *
mp-wp_genesis 64 * @since unknown
mp-wp_genesis 65 *
mp-wp_genesis 66 * @return unknown
mp-wp_genesis 67 */
mp-wp_genesis 68 function get_home_path() {
mp-wp_genesis 69 $home = get_option( 'home' );
mp-wp_genesis 70 if ( $home != '' && $home != get_option( 'siteurl' ) ) {
mp-wp_genesis 71 $home_path = parse_url( $home );
mp-wp_genesis 72 $home_path = $home_path['path'];
mp-wp_genesis 73 $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
mp-wp_genesis 74 $home_path = trailingslashit( $root.$home_path );
mp-wp_genesis 75 } else {
mp-wp_genesis 76 $home_path = ABSPATH;
mp-wp_genesis 77 }
mp-wp_genesis 78
mp-wp_genesis 79 return $home_path;
mp-wp_genesis 80 }
mp-wp_genesis 81
mp-wp_genesis 82 /**
mp-wp_genesis 83 * {@internal Missing Short Description}}
mp-wp_genesis 84 *
mp-wp_genesis 85 * @since unknown
mp-wp_genesis 86 *
mp-wp_genesis 87 * @param unknown_type $file
mp-wp_genesis 88 * @return unknown
mp-wp_genesis 89 */
mp-wp_genesis 90 function get_real_file_to_edit( $file ) {
mp-wp_genesis 91 if ('index.php' == $file || '.htaccess' == $file ) {
mp-wp_genesis 92 $real_file = get_home_path() . $file;
mp-wp_genesis 93 } else {
mp-wp_genesis 94 $real_file = WP_CONTENT_DIR . $file;
mp-wp_genesis 95 }
mp-wp_genesis 96
mp-wp_genesis 97 return $real_file;
mp-wp_genesis 98 }
mp-wp_genesis 99
mp-wp_genesis 100 /**
mp-wp_genesis 101 * {@internal Missing Short Description}}
mp-wp_genesis 102 *
mp-wp_genesis 103 * @since unknown
mp-wp_genesis 104 *
mp-wp_genesis 105 * @param string $folder Optional. Full path to folder
mp-wp_genesis 106 * @param int $levels Optional. Levels of folders to follow, Default: 100 (PHP Loop limit).
mp-wp_genesis 107 * @return bool|array
mp-wp_genesis 108 */
mp-wp_genesis 109 function list_files( $folder = '', $levels = 100 ) {
mp-wp_genesis 110 if( empty($folder) )
mp-wp_genesis 111 return false;
mp-wp_genesis 112
mp-wp_genesis 113 if( ! $levels )
mp-wp_genesis 114 return false;
mp-wp_genesis 115
mp-wp_genesis 116 $files = array();
mp-wp_genesis 117 if ( $dir = @opendir( $folder ) ) {
mp-wp_genesis 118 while (($file = readdir( $dir ) ) !== false ) {
mp-wp_genesis 119 if ( in_array($file, array('.', '..') ) )
mp-wp_genesis 120 continue;
mp-wp_genesis 121 if ( is_dir( $folder . '/' . $file ) ) {
mp-wp_genesis 122 $files2 = list_files( $folder . '/' . $file, $levels - 1);
mp-wp_genesis 123 if( $files2 )
mp-wp_genesis 124 $files = array_merge($files, $files2 );
mp-wp_genesis 125 else
mp-wp_genesis 126 $files[] = $folder . '/' . $file . '/';
mp-wp_genesis 127 } else {
mp-wp_genesis 128 $files[] = $folder . '/' . $file;
mp-wp_genesis 129 }
mp-wp_genesis 130 }
mp-wp_genesis 131 }
mp-wp_genesis 132 @closedir( $dir );
mp-wp_genesis 133 return $files;
mp-wp_genesis 134 }
mp-wp_genesis 135
mp-wp_genesis 136 /**
mp-wp_genesis 137 * {@internal Missing Short Description}}
mp-wp_genesis 138 *
mp-wp_genesis 139 * @since unknown
mp-wp_genesis 140 *
mp-wp_genesis 141 * @return unknown
mp-wp_genesis 142 */
mp-wp_genesis 143 function get_temp_dir() {
mp-wp_genesis 144 if ( defined('WP_TEMP_DIR') )
mp-wp_genesis 145 return trailingslashit(WP_TEMP_DIR);
mp-wp_genesis 146
mp-wp_genesis 147 $temp = WP_CONTENT_DIR . '/';
mp-wp_genesis 148 if ( is_dir($temp) && is_writable($temp) )
mp-wp_genesis 149 return $temp;
mp-wp_genesis 150
mp-wp_genesis 151 if ( function_exists('sys_get_temp_dir') )
mp-wp_genesis 152 return trailingslashit(sys_get_temp_dir());
mp-wp_genesis 153
mp-wp_genesis 154 return '/tmp/';
mp-wp_genesis 155 }
mp-wp_genesis 156
mp-wp_genesis 157 /**
mp-wp_genesis 158 * {@internal Missing Short Description}}
mp-wp_genesis 159 *
mp-wp_genesis 160 * @since unknown
mp-wp_genesis 161 *
mp-wp_genesis 162 * @param unknown_type $filename
mp-wp_genesis 163 * @param unknown_type $dir
mp-wp_genesis 164 * @return unknown
mp-wp_genesis 165 */
mp-wp_genesis 166 function wp_tempnam($filename = '', $dir = ''){
mp-wp_genesis 167 if ( empty($dir) )
mp-wp_genesis 168 $dir = get_temp_dir();
mp-wp_genesis 169 $filename = basename($filename);
mp-wp_genesis 170 if ( empty($filename) )
mp-wp_genesis 171 $filename = time();
mp-wp_genesis 172
mp-wp_genesis 173 $filename = $dir . wp_unique_filename($dir, $filename);
mp-wp_genesis 174 touch($filename);
mp-wp_genesis 175 return $filename;
mp-wp_genesis 176 }
mp-wp_genesis 177
mp-wp_genesis 178 /**
mp-wp_genesis 179 * {@internal Missing Short Description}}
mp-wp_genesis 180 *
mp-wp_genesis 181 * @since unknown
mp-wp_genesis 182 *
mp-wp_genesis 183 * @param unknown_type $file
mp-wp_genesis 184 * @param unknown_type $allowed_files
mp-wp_genesis 185 * @return unknown
mp-wp_genesis 186 */
mp-wp_genesis 187 function validate_file_to_edit( $file, $allowed_files = '' ) {
mp-wp_genesis 188 $file = stripslashes( $file );
mp-wp_genesis 189
mp-wp_genesis 190 $code = validate_file( $file, $allowed_files );
mp-wp_genesis 191
mp-wp_genesis 192 if (!$code )
mp-wp_genesis 193 return $file;
mp-wp_genesis 194
mp-wp_genesis 195 switch ( $code ) {
mp-wp_genesis 196 case 1 :
mp-wp_genesis 197 wp_die( __('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));
mp-wp_genesis 198
mp-wp_genesis 199 case 2 :
mp-wp_genesis 200 wp_die( __('Sorry, can&#8217;t call files with their real path.' ));
mp-wp_genesis 201
mp-wp_genesis 202 case 3 :
mp-wp_genesis 203 wp_die( __('Sorry, that file cannot be edited.' ));
mp-wp_genesis 204 }
mp-wp_genesis 205 }
mp-wp_genesis 206
mp-wp_genesis 207 /**
mp-wp_genesis 208 * {@internal Missing Short Description}}
mp-wp_genesis 209 *
mp-wp_genesis 210 * @since unknown
mp-wp_genesis 211 *
mp-wp_genesis 212 * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
mp-wp_genesis 213 * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
mp-wp_genesis 214 * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
mp-wp_genesis 215 */
mp-wp_genesis 216 function wp_handle_upload( &$file, $overrides = false, $time = null ) {
mp-wp_genesis 217 // The default error handler.
mp-wp_genesis 218 if (! function_exists( 'wp_handle_upload_error' ) ) {
mp-wp_genesis 219 function wp_handle_upload_error( &$file, $message ) {
mp-wp_genesis 220 return array( 'error'=>$message );
mp-wp_genesis 221 }
mp-wp_genesis 222 }
mp-wp_genesis 223
mp-wp_genesis 224 // You may define your own function and pass the name in $overrides['upload_error_handler']
mp-wp_genesis 225 $upload_error_handler = 'wp_handle_upload_error';
mp-wp_genesis 226
mp-wp_genesis 227 // You may define your own function and pass the name in $overrides['unique_filename_callback']
mp-wp_genesis 228 $unique_filename_callback = null;
mp-wp_genesis 229
mp-wp_genesis 230 // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
mp-wp_genesis 231 $action = 'wp_handle_upload';
mp-wp_genesis 232
mp-wp_genesis 233 // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
mp-wp_genesis 234 $upload_error_strings = array( false,
mp-wp_genesis 235 __( "The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
mp-wp_genesis 236 __( "The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
mp-wp_genesis 237 __( "The uploaded file was only partially uploaded." ),
mp-wp_genesis 238 __( "No file was uploaded." ),
mp-wp_genesis 239 '',
mp-wp_genesis 240 __( "Missing a temporary folder." ),
mp-wp_genesis 241 __( "Failed to write file to disk." ));
mp-wp_genesis 242
mp-wp_genesis 243 // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
mp-wp_genesis 244 $test_form = true;
mp-wp_genesis 245 $test_size = true;
mp-wp_genesis 246
mp-wp_genesis 247 // If you override this, you must provide $ext and $type!!!!
mp-wp_genesis 248 $test_type = true;
mp-wp_genesis 249 $mimes = false;
mp-wp_genesis 250
mp-wp_genesis 251 // Install user overrides. Did we mention that this voids your warranty?
mp-wp_genesis 252 if ( is_array( $overrides ) )
mp-wp_genesis 253 extract( $overrides, EXTR_OVERWRITE );
mp-wp_genesis 254
mp-wp_genesis 255 // A correct form post will pass this test.
mp-wp_genesis 256 if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
mp-wp_genesis 257 return $upload_error_handler( $file, __( 'Invalid form submission.' ));
mp-wp_genesis 258
mp-wp_genesis 259 // A successful upload will pass this test. It makes no sense to override this one.
mp-wp_genesis 260 if ( $file['error'] > 0 )
mp-wp_genesis 261 return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
mp-wp_genesis 262
mp-wp_genesis 263 // A non-empty file will pass this test.
mp-wp_genesis 264 if ( $test_size && !($file['size'] > 0 ) )
mp-wp_genesis 265 return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));
mp-wp_genesis 266
mp-wp_genesis 267 // A properly uploaded file will pass this test. There should be no reason to override this one.
mp-wp_genesis 268 if (! @ is_uploaded_file( $file['tmp_name'] ) )
mp-wp_genesis 269 return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
mp-wp_genesis 270
mp-wp_genesis 271 // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
mp-wp_genesis 272 if ( $test_type ) {
mp-wp_genesis 273 $wp_filetype = wp_check_filetype( $file['name'], $mimes );
mp-wp_genesis 274
mp-wp_genesis 275 extract( $wp_filetype );
mp-wp_genesis 276
mp-wp_genesis 277 if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
mp-wp_genesis 278 return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
mp-wp_genesis 279
mp-wp_genesis 280 if ( !$ext )
mp-wp_genesis 281 $ext = ltrim(strrchr($file['name'], '.'), '.');
mp-wp_genesis 282
mp-wp_genesis 283 if ( !$type )
mp-wp_genesis 284 $type = $file['type'];
mp-wp_genesis 285 }
mp-wp_genesis 286
mp-wp_genesis 287 // A writable uploads dir will pass this test. Again, there's no point overriding this one.
mp-wp_genesis 288 if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
mp-wp_genesis 289 return $upload_error_handler( $file, $uploads['error'] );
mp-wp_genesis 290
mp-wp_genesis 291 $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
mp-wp_genesis 292
mp-wp_genesis 293 // Move the file to the uploads dir
mp-wp_genesis 294 $new_file = $uploads['path'] . "/$filename";
mp-wp_genesis 295 if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
mp-wp_genesis 296 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
mp-wp_genesis 297 }
mp-wp_genesis 298
mp-wp_genesis 299 // Set correct file permissions
mp-wp_genesis 300 $stat = stat( dirname( $new_file ));
mp-wp_genesis 301 $perms = $stat['mode'] & 0000666;
mp-wp_genesis 302 @ chmod( $new_file, $perms );
mp-wp_genesis 303
mp-wp_genesis 304 // Compute the URL
mp-wp_genesis 305 $url = $uploads['url'] . "/$filename";
mp-wp_genesis 306
mp-wp_genesis 307 $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
mp-wp_genesis 308
mp-wp_genesis 309 return $return;
mp-wp_genesis 310 }
mp-wp_genesis 311
mp-wp_genesis 312 /**
mp-wp_genesis 313 * {@internal Missing Short Description}}
mp-wp_genesis 314 *
mp-wp_genesis 315 * Pass this function an array similar to that of a $_FILES POST array.
mp-wp_genesis 316 *
mp-wp_genesis 317 * @since unknown
mp-wp_genesis 318 *
mp-wp_genesis 319 * @param unknown_type $file
mp-wp_genesis 320 * @param unknown_type $overrides
mp-wp_genesis 321 * @return unknown
mp-wp_genesis 322 */
mp-wp_genesis 323 function wp_handle_sideload( &$file, $overrides = false ) {
mp-wp_genesis 324 // The default error handler.
mp-wp_genesis 325 if (! function_exists( 'wp_handle_upload_error' ) ) {
mp-wp_genesis 326 function wp_handle_upload_error( &$file, $message ) {
mp-wp_genesis 327 return array( 'error'=>$message );
mp-wp_genesis 328 }
mp-wp_genesis 329 }
mp-wp_genesis 330
mp-wp_genesis 331 // You may define your own function and pass the name in $overrides['upload_error_handler']
mp-wp_genesis 332 $upload_error_handler = 'wp_handle_upload_error';
mp-wp_genesis 333
mp-wp_genesis 334 // You may define your own function and pass the name in $overrides['unique_filename_callback']
mp-wp_genesis 335 $unique_filename_callback = null;
mp-wp_genesis 336
mp-wp_genesis 337 // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
mp-wp_genesis 338 $action = 'wp_handle_sideload';
mp-wp_genesis 339
mp-wp_genesis 340 // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
mp-wp_genesis 341 $upload_error_strings = array( false,
mp-wp_genesis 342 __( "The file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
mp-wp_genesis 343 __( "The file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
mp-wp_genesis 344 __( "The file was only partially uploaded." ),
mp-wp_genesis 345 __( "No file was sent." ),
mp-wp_genesis 346 __( "Missing a temporary folder." ),
mp-wp_genesis 347 __( "Failed to write file to disk." ));
mp-wp_genesis 348
mp-wp_genesis 349 // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
mp-wp_genesis 350 $test_form = true;
mp-wp_genesis 351 $test_size = true;
mp-wp_genesis 352
mp-wp_genesis 353 // If you override this, you must provide $ext and $type!!!!
mp-wp_genesis 354 $test_type = true;
mp-wp_genesis 355 $mimes = false;
mp-wp_genesis 356
mp-wp_genesis 357 // Install user overrides. Did we mention that this voids your warranty?
mp-wp_genesis 358 if ( is_array( $overrides ) )
mp-wp_genesis 359 extract( $overrides, EXTR_OVERWRITE );
mp-wp_genesis 360
mp-wp_genesis 361 // A correct form post will pass this test.
mp-wp_genesis 362 if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
mp-wp_genesis 363 return $upload_error_handler( $file, __( 'Invalid form submission.' ));
mp-wp_genesis 364
mp-wp_genesis 365 // A successful upload will pass this test. It makes no sense to override this one.
mp-wp_genesis 366 if ( $file['error'] > 0 )
mp-wp_genesis 367 return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
mp-wp_genesis 368
mp-wp_genesis 369 // A non-empty file will pass this test.
mp-wp_genesis 370 if ( $test_size && !(filesize($file['tmp_name']) > 0 ) )
mp-wp_genesis 371 return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));
mp-wp_genesis 372
mp-wp_genesis 373 // A properly uploaded file will pass this test. There should be no reason to override this one.
mp-wp_genesis 374 if (! @ is_file( $file['tmp_name'] ) )
mp-wp_genesis 375 return $upload_error_handler( $file, __( 'Specified file does not exist.' ));
mp-wp_genesis 376
mp-wp_genesis 377 // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
mp-wp_genesis 378 if ( $test_type ) {
mp-wp_genesis 379 $wp_filetype = wp_check_filetype( $file['name'], $mimes );
mp-wp_genesis 380
mp-wp_genesis 381 extract( $wp_filetype );
mp-wp_genesis 382
mp-wp_genesis 383 if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
mp-wp_genesis 384 return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
mp-wp_genesis 385
mp-wp_genesis 386 if ( !$ext )
mp-wp_genesis 387 $ext = ltrim(strrchr($file['name'], '.'), '.');
mp-wp_genesis 388
mp-wp_genesis 389 if ( !$type )
mp-wp_genesis 390 $type = $file['type'];
mp-wp_genesis 391 }
mp-wp_genesis 392
mp-wp_genesis 393 // A writable uploads dir will pass this test. Again, there's no point overriding this one.
mp-wp_genesis 394 if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
mp-wp_genesis 395 return $upload_error_handler( $file, $uploads['error'] );
mp-wp_genesis 396
mp-wp_genesis 397 $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
mp-wp_genesis 398
mp-wp_genesis 399 // Strip the query strings.
mp-wp_genesis 400 $filename = str_replace('?','-', $filename);
mp-wp_genesis 401 $filename = str_replace('&','-', $filename);
mp-wp_genesis 402
mp-wp_genesis 403 // Move the file to the uploads dir
mp-wp_genesis 404 $new_file = $uploads['path'] . "/$filename";
mp-wp_genesis 405 if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
mp-wp_genesis 406 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
mp-wp_genesis 407 }
mp-wp_genesis 408
mp-wp_genesis 409 // Set correct file permissions
mp-wp_genesis 410 $stat = stat( dirname( $new_file ));
mp-wp_genesis 411 $perms = $stat['mode'] & 0000666;
mp-wp_genesis 412 @ chmod( $new_file, $perms );
mp-wp_genesis 413
mp-wp_genesis 414 // Compute the URL
mp-wp_genesis 415 $url = $uploads['url'] . "/$filename";
mp-wp_genesis 416
mp-wp_genesis 417 $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
mp-wp_genesis 418
mp-wp_genesis 419 return $return;
mp-wp_genesis 420 }
mp-wp_genesis 421
mp-wp_genesis 422 /**
mp-wp_genesis 423 * Downloads a url to a local file using the Snoopy HTTP Class.
mp-wp_genesis 424 *
mp-wp_genesis 425 * @since unknown
mp-wp_genesis 426 * @todo Transition over to using the new HTTP Request API (jacob).
mp-wp_genesis 427 *
mp-wp_genesis 428 * @param string $url the URL of the file to download
mp-wp_genesis 429 * @return mixed WP_Error on failure, string Filename on success.
mp-wp_genesis 430 */
mp-wp_genesis 431 function download_url( $url ) {
mp-wp_genesis 432 //WARNING: The file is not automatically deleted, The script must unlink() the file.
mp-wp_genesis 433 if ( ! $url )
mp-wp_genesis 434 return new WP_Error('http_no_url', __('Invalid URL Provided'));
mp-wp_genesis 435
mp-wp_genesis 436 $tmpfname = wp_tempnam($url);
mp-wp_genesis 437 if ( ! $tmpfname )
mp-wp_genesis 438 return new WP_Error('http_no_file', __('Could not create Temporary file'));
mp-wp_genesis 439
mp-wp_genesis 440 $handle = @fopen($tmpfname, 'wb');
mp-wp_genesis 441 if ( ! $handle )
mp-wp_genesis 442 return new WP_Error('http_no_file', __('Could not create Temporary file'));
mp-wp_genesis 443
mp-wp_genesis 444 $response = wp_remote_get($url, array('timeout' => 30));
mp-wp_genesis 445
mp-wp_genesis 446 if ( is_wp_error($response) ) {
mp-wp_genesis 447 fclose($handle);
mp-wp_genesis 448 unlink($tmpfname);
mp-wp_genesis 449 return $response;
mp-wp_genesis 450 }
mp-wp_genesis 451
mp-wp_genesis 452 if ( $response['response']['code'] != '200' ){
mp-wp_genesis 453 fclose($handle);
mp-wp_genesis 454 unlink($tmpfname);
mp-wp_genesis 455 return new WP_Error('http_404', trim($response['response']['message']));
mp-wp_genesis 456 }
mp-wp_genesis 457
mp-wp_genesis 458 fwrite($handle, $response['body']);
mp-wp_genesis 459 fclose($handle);
mp-wp_genesis 460
mp-wp_genesis 461 return $tmpfname;
mp-wp_genesis 462 }
mp-wp_genesis 463
mp-wp_genesis 464 /**
mp-wp_genesis 465 * {@internal Missing Short Description}}
mp-wp_genesis 466 *
mp-wp_genesis 467 * @since unknown
mp-wp_genesis 468 *
mp-wp_genesis 469 * @param unknown_type $file
mp-wp_genesis 470 * @param unknown_type $to
mp-wp_genesis 471 * @return unknown
mp-wp_genesis 472 */
mp-wp_genesis 473 function unzip_file($file, $to) {
mp-wp_genesis 474 global $wp_filesystem;
mp-wp_genesis 475
mp-wp_genesis 476 if ( ! $wp_filesystem || !is_object($wp_filesystem) )
mp-wp_genesis 477 return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
mp-wp_genesis 478
mp-wp_genesis 479 // Unzip uses a lot of memory
mp-wp_genesis 480 @ini_set('memory_limit', '256M');
mp-wp_genesis 481
mp-wp_genesis 482 $fs =& $wp_filesystem;
mp-wp_genesis 483
mp-wp_genesis 484 require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
mp-wp_genesis 485
mp-wp_genesis 486 $archive = new PclZip($file);
mp-wp_genesis 487
mp-wp_genesis 488 // Is the archive valid?
mp-wp_genesis 489 if ( false == ($archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING)) )
mp-wp_genesis 490 return new WP_Error('incompatible_archive', __('Incompatible archive'), $archive->errorInfo(true));
mp-wp_genesis 491
mp-wp_genesis 492 if ( 0 == count($archive_files) )
mp-wp_genesis 493 return new WP_Error('empty_archive', __('Empty archive'));
mp-wp_genesis 494
mp-wp_genesis 495 $path = explode('/', untrailingslashit($to));
mp-wp_genesis 496 for ( $i = count($path); $i > 0; $i-- ) { //>0 = first element is empty allways for paths starting with '/'
mp-wp_genesis 497 $tmppath = implode('/', array_slice($path, 0, $i) );
mp-wp_genesis 498 if ( $fs->is_dir($tmppath) ) { //Found the highest folder that exists, Create from here(ie +1)
mp-wp_genesis 499 for ( $i = $i + 1; $i <= count($path); $i++ ) {
mp-wp_genesis 500 $tmppath = implode('/', array_slice($path, 0, $i) );
mp-wp_genesis 501 if ( ! $fs->mkdir($tmppath, FS_CHMOD_DIR) )
mp-wp_genesis 502 return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath);
mp-wp_genesis 503 }
mp-wp_genesis 504 break; //Exit main for loop
mp-wp_genesis 505 }
mp-wp_genesis 506 }
mp-wp_genesis 507
mp-wp_genesis 508 $to = trailingslashit($to);
mp-wp_genesis 509 foreach ($archive_files as $file) {
mp-wp_genesis 510 $path = $file['folder'] ? $file['filename'] : dirname($file['filename']);
mp-wp_genesis 511 $path = explode('/', $path);
mp-wp_genesis 512 for ( $i = count($path); $i >= 0; $i-- ) { //>=0 as the first element contains data
mp-wp_genesis 513 if ( empty($path[$i]) )
mp-wp_genesis 514 continue;
mp-wp_genesis 515 $tmppath = $to . implode('/', array_slice($path, 0, $i) );
mp-wp_genesis 516 if ( $fs->is_dir($tmppath) ) {//Found the highest folder that exists, Create from here
mp-wp_genesis 517 for ( $i = $i + 1; $i <= count($path); $i++ ) { //< count() no file component please.
mp-wp_genesis 518 $tmppath = $to . implode('/', array_slice($path, 0, $i) );
mp-wp_genesis 519 if ( ! $fs->is_dir($tmppath) && ! $fs->mkdir($tmppath, FS_CHMOD_DIR) )
mp-wp_genesis 520 return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath);
mp-wp_genesis 521 }
mp-wp_genesis 522 break; //Exit main for loop
mp-wp_genesis 523 }
mp-wp_genesis 524 }
mp-wp_genesis 525
mp-wp_genesis 526 // We've made sure the folders are there, so let's extract the file now:
mp-wp_genesis 527 if ( ! $file['folder'] ) {
mp-wp_genesis 528 if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
mp-wp_genesis 529 return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
mp-wp_genesis 530 $fs->chmod($to . $file['filename'], FS_CHMOD_FILE);
mp-wp_genesis 531 }
mp-wp_genesis 532 }
mp-wp_genesis 533 return true;
mp-wp_genesis 534 }
mp-wp_genesis 535
mp-wp_genesis 536 /**
mp-wp_genesis 537 * {@internal Missing Short Description}}
mp-wp_genesis 538 *
mp-wp_genesis 539 * @since unknown
mp-wp_genesis 540 *
mp-wp_genesis 541 * @param unknown_type $from
mp-wp_genesis 542 * @param unknown_type $to
mp-wp_genesis 543 * @return unknown
mp-wp_genesis 544 */
mp-wp_genesis 545 function copy_dir($from, $to) {
mp-wp_genesis 546 global $wp_filesystem;
mp-wp_genesis 547
mp-wp_genesis 548 $dirlist = $wp_filesystem->dirlist($from);
mp-wp_genesis 549
mp-wp_genesis 550 $from = trailingslashit($from);
mp-wp_genesis 551 $to = trailingslashit($to);
mp-wp_genesis 552
mp-wp_genesis 553 foreach ( (array) $dirlist as $filename => $fileinfo ) {
mp-wp_genesis 554 if ( 'f' == $fileinfo['type'] ) {
mp-wp_genesis 555 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) {
mp-wp_genesis 556 // If copy failed, chmod file to 0644 and try again.
mp-wp_genesis 557 $wp_filesystem->chmod($to . $filename, 0644);
mp-wp_genesis 558 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
mp-wp_genesis 559 return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
mp-wp_genesis 560 }
mp-wp_genesis 561 $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE);
mp-wp_genesis 562 } elseif ( 'd' == $fileinfo['type'] ) {
mp-wp_genesis 563 if ( !$wp_filesystem->is_dir($to . $filename) ) {
mp-wp_genesis 564 if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
mp-wp_genesis 565 return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
mp-wp_genesis 566 }
mp-wp_genesis 567 $result = copy_dir($from . $filename, $to . $filename);
mp-wp_genesis 568 if ( is_wp_error($result) )
mp-wp_genesis 569 return $result;
mp-wp_genesis 570 }
mp-wp_genesis 571 }
mp-wp_genesis 572 }
mp-wp_genesis 573
mp-wp_genesis 574 /**
mp-wp_genesis 575 * {@internal Missing Short Description}}
mp-wp_genesis 576 *
mp-wp_genesis 577 * @since unknown
mp-wp_genesis 578 *
mp-wp_genesis 579 * @param unknown_type $args
mp-wp_genesis 580 * @return unknown
mp-wp_genesis 581 */
mp-wp_genesis 582 function WP_Filesystem( $args = false ) {
mp-wp_genesis 583 global $wp_filesystem;
mp-wp_genesis 584
mp-wp_genesis 585 require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
mp-wp_genesis 586
mp-wp_genesis 587 $method = get_filesystem_method($args);
mp-wp_genesis 588
mp-wp_genesis 589 if ( ! $method )
mp-wp_genesis 590 return false;
mp-wp_genesis 591
mp-wp_genesis 592 $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
mp-wp_genesis 593 if( ! file_exists($abstraction_file) )
mp-wp_genesis 594 return;
mp-wp_genesis 595
mp-wp_genesis 596 require_once($abstraction_file);
mp-wp_genesis 597 $method = "WP_Filesystem_$method";
mp-wp_genesis 598
mp-wp_genesis 599 $wp_filesystem = new $method($args);
mp-wp_genesis 600
mp-wp_genesis 601 if ( $wp_filesystem->errors->get_error_code() )
mp-wp_genesis 602 return false;
mp-wp_genesis 603
mp-wp_genesis 604 if ( !$wp_filesystem->connect() )
mp-wp_genesis 605 return false; //There was an erorr connecting to the server.
mp-wp_genesis 606
mp-wp_genesis 607 // Set the permission constants if not already set.
mp-wp_genesis 608 if ( ! defined('FS_CHMOD_DIR') )
mp-wp_genesis 609 define('FS_CHMOD_DIR', 0755 );
mp-wp_genesis 610 if ( ! defined('FS_CHMOD_FILE') )
mp-wp_genesis 611 define('FS_CHMOD_FILE', 0644 );
mp-wp_genesis 612
mp-wp_genesis 613 return true;
mp-wp_genesis 614 }
mp-wp_genesis 615
mp-wp_genesis 616 /**
mp-wp_genesis 617 * {@internal Missing Short Description}}
mp-wp_genesis 618 *
mp-wp_genesis 619 * @since unknown
mp-wp_genesis 620 *
mp-wp_genesis 621 * @param unknown_type $args
mp-wp_genesis 622 * @return unknown
mp-wp_genesis 623 */
mp-wp_genesis 624 function get_filesystem_method($args = array()) {
mp-wp_genesis 625 $method = false;
mp-wp_genesis 626 if( function_exists('getmyuid') && function_exists('fileowner') ){
mp-wp_genesis 627 $temp_file = wp_tempnam();
mp-wp_genesis 628 if ( getmyuid() == fileowner($temp_file) )
mp-wp_genesis 629 $method = 'direct';
mp-wp_genesis 630 unlink($temp_file);
mp-wp_genesis 631 }
mp-wp_genesis 632
mp-wp_genesis 633 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') ) $method = 'ssh2';
mp-wp_genesis 634 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
mp-wp_genesis 635 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
mp-wp_genesis 636 return apply_filters('filesystem_method', $method);
mp-wp_genesis 637 }
mp-wp_genesis 638
mp-wp_genesis 639 /**
mp-wp_genesis 640 * {@internal Missing Short Description}}
mp-wp_genesis 641 *
mp-wp_genesis 642 * @since unknown
mp-wp_genesis 643 *
mp-wp_genesis 644 * @param unknown_type $form_post
mp-wp_genesis 645 * @param unknown_type $type
mp-wp_genesis 646 * @param unknown_type $error
mp-wp_genesis 647 * @return unknown
mp-wp_genesis 648 */
mp-wp_genesis 649 function request_filesystem_credentials($form_post, $type = '', $error = false) {
mp-wp_genesis 650 $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
mp-wp_genesis 651 if ( '' !== $req_cred )
mp-wp_genesis 652 return $req_cred;
mp-wp_genesis 653
mp-wp_genesis 654 if ( empty($type) )
mp-wp_genesis 655 $type = get_filesystem_method();
mp-wp_genesis 656
mp-wp_genesis 657 if ( 'direct' == $type )
mp-wp_genesis 658 return true;
mp-wp_genesis 659
mp-wp_genesis 660 $credentials = get_option('ftp_credentials', array());
mp-wp_genesis 661 // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
mp-wp_genesis 662 $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
mp-wp_genesis 663 $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
mp-wp_genesis 664 $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']);
mp-wp_genesis 665
mp-wp_genesis 666 // Check to see if we are setting the public/private keys for ssh
mp-wp_genesis 667 $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : $credentials['public_key']);
mp-wp_genesis 668 $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : $credentials['private_key']);
mp-wp_genesis 669
mp-wp_genesis 670 if ( strpos($credentials['hostname'], ':') )
mp-wp_genesis 671 list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2);
mp-wp_genesis 672
mp-wp_genesis 673 if ( defined('FTP_SSH') || (isset($_POST['connection_type']) && 'ssh' == $_POST['connection_type']) )
mp-wp_genesis 674 $credentials['connection_type'] = 'ssh';
mp-wp_genesis 675 else if ( defined('FTP_SSL') || (isset($_POST['connection_type']) && 'ftps' == $_POST['connection_type']) )
mp-wp_genesis 676 $credentials['connection_type'] = 'ftps';
mp-wp_genesis 677 else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) )
mp-wp_genesis 678 $credentials['connection_type'] = 'ftp';
mp-wp_genesis 679
mp-wp_genesis 680 if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {
mp-wp_genesis 681 $stored_credentials = $credentials;
mp-wp_genesis 682 unset($stored_credentials['password'], $stored_credentials['private_key'], $stored_credentials['public_key']);
mp-wp_genesis 683 update_option('ftp_credentials', $stored_credentials);
mp-wp_genesis 684 return $credentials;
mp-wp_genesis 685 }
mp-wp_genesis 686 $hostname = '';
mp-wp_genesis 687 $username = '';
mp-wp_genesis 688 $password = '';
mp-wp_genesis 689 $connection_type = '';
mp-wp_genesis 690 if ( !empty($credentials) )
mp-wp_genesis 691 extract($credentials, EXTR_OVERWRITE);
mp-wp_genesis 692 if ( $error ) {
mp-wp_genesis 693 $error_string = __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.');
mp-wp_genesis 694 if ( is_wp_error($error) )
mp-wp_genesis 695 $error_string = $error->get_error_message();
mp-wp_genesis 696 echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
mp-wp_genesis 697 }
mp-wp_genesis 698 ?>
mp-wp_genesis 699 <script type="text/javascript">
mp-wp_genesis 700 <!--
mp-wp_genesis 701 jQuery(function($){
mp-wp_genesis 702 jQuery("#ssh").click(function () {
mp-wp_genesis 703 jQuery("#ssh_keys").show();
mp-wp_genesis 704 });
mp-wp_genesis 705 jQuery("#ftp, #ftps").click(function () {
mp-wp_genesis 706 jQuery("#ssh_keys").hide();
mp-wp_genesis 707 });
mp-wp_genesis 708 });
mp-wp_genesis 709 -->
mp-wp_genesis 710 </script>
mp-wp_genesis 711 <form action="<?php echo $form_post ?>" method="post">
mp-wp_genesis 712 <div class="wrap">
mp-wp_genesis 713 <h2><?php _e('Connection Information') ?></h2>
mp-wp_genesis 714 <p><?php _e('To perform the requested action, connection information is required.') ?></p>
mp-wp_genesis 715
mp-wp_genesis 716 <table class="form-table">
mp-wp_genesis 717 <tr valign="top">
mp-wp_genesis 718 <th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
mp-wp_genesis 719 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
mp-wp_genesis 720 </tr>
mp-wp_genesis 721
mp-wp_genesis 722 <tr valign="top">
mp-wp_genesis 723 <th scope="row"><label for="username"><?php _e('Username') ?></label></th>
mp-wp_genesis 724 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
mp-wp_genesis 725 </tr>
mp-wp_genesis 726
mp-wp_genesis 727 <tr valign="top">
mp-wp_genesis 728 <th scope="row"><label for="password"><?php _e('Password') ?></label></th>
mp-wp_genesis 729 <td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td>
mp-wp_genesis 730 </tr>
mp-wp_genesis 731
mp-wp_genesis 732 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
mp-wp_genesis 733 <th scope="row"><?php _e('Authentication Keys') ?>
mp-wp_genesis 734 <div class="key-labels textright">
mp-wp_genesis 735 <label for="public_key"><?php _e('Public Key:') ?></label ><br />
mp-wp_genesis 736 <label for="private_key"><?php _e('Private Key:') ?></label>
mp-wp_genesis 737 </div></th>
mp-wp_genesis 738 <td><br /><input name="public_key" type="text" id="public_key" value=""<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value=""<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
mp-wp_genesis 739 <div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
mp-wp_genesis 740 </tr>
mp-wp_genesis 741
mp-wp_genesis 742 <tr valign="top">
mp-wp_genesis 743 <th scope="row"><?php _e('Connection Type') ?></th>
mp-wp_genesis 744 <td>
mp-wp_genesis 745 <fieldset><legend class="hidden"><?php _e('Connection Type') ?></legend>
mp-wp_genesis 746 <label><input id="ftp" name="connection_type" type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label><br />
mp-wp_genesis 747 <label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSH') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTPS (SSL)') ?></label><br />
mp-wp_genesis 748 <?php if ( extension_loaded('ssh2') ) { ?><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label><?php } ?>
mp-wp_genesis 749 </fieldset>
mp-wp_genesis 750 </td>
mp-wp_genesis 751 </tr>
mp-wp_genesis 752 </table>
mp-wp_genesis 753
mp-wp_genesis 754 <?php if ( isset( $_POST['version'] ) ) : ?>
mp-wp_genesis 755 <input type="hidden" name="version" value="<?php echo attribute_escape($_POST['version']) ?>" />
mp-wp_genesis 756 <?php endif; ?>
mp-wp_genesis 757 <?php if ( isset( $_POST['locale'] ) ) : ?>
mp-wp_genesis 758 <input type="hidden" name="locale" value="<?php echo attribute_escape($_POST['locale']) ?>" />
mp-wp_genesis 759 <?php endif; ?>
mp-wp_genesis 760 <p class="submit">
mp-wp_genesis 761 <input id="upgrade" name="upgrade" type="submit" class="button" value="<?php _e('Proceed'); ?>" />
mp-wp_genesis 762 </p>
mp-wp_genesis 763 </div>
mp-wp_genesis 764 </form>
mp-wp_genesis 765 <?php
mp-wp_genesis 766 return false;
mp-wp_genesis 767 }
mp-wp_genesis 768
mp-wp_genesis 769 ?>