Changeset 1703145
- Timestamp:
- 07/26/2017 01:58:43 PM (9 years ago)
- Location:
- imagify
- Files:
-
- 6 edited
-
tags/1.6.8/inc/admin/ui/notices.php (modified) (2 diffs)
-
tags/1.6.8/inc/admin/ui/options.php (modified) (1 diff)
-
tags/1.6.8/inc/functions/attachments.php (modified) (3 diffs)
-
trunk/inc/admin/ui/notices.php (modified) (2 diffs)
-
trunk/inc/admin/ui/options.php (modified) (1 diff)
-
trunk/inc/functions/attachments.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
imagify/tags/1.6.8/inc/admin/ui/notices.php
r1702448 r1703145 354 354 } 355 355 356 $filesystem = imagify_get_filesystem(); 357 $has_backup_dir = wp_mkdir_p( get_imagify_backup_dir_path() ); 358 359 if ( $has_backup_dir && $filesystem->is_writable( get_imagify_backup_dir_path() ) ) { 360 return; 361 } 362 363 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path() ); 356 if ( imagify_backup_dir_is_writable() ) { 357 return; 358 } 359 360 $filesystem = imagify_get_filesystem(); 361 362 if ( $filesystem->exists( get_imagify_backup_dir_path() ) ) { 363 /* translators: %s is a file path. */ 364 $message = __( 'The backup folder %s is not writable by the server, original images cannot be saved!', 'imagify' ); 365 } else { 366 /* translators: %s is a file path. */ 367 $message = __( 'The backup folder %s cannot be created. Is its parent directory writable by the server? Original images cannot be saved!', 'imagify' ); 368 } 369 370 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path( true ) ); 364 371 ?> 365 372 <div class="clear"></div> … … 369 376 </div> 370 377 <div class="imagify-notice-content"> 371 <p><?php 372 /* translators: %s is a file path. */ 373 printf( __( 'The backup folder %s can\'t be created, original images can\'t be saved!', 'imagify' ), "<code>$backup_path</code>" ); 374 ?></p> 378 <p><?php printf( $message, "<code>$backup_path</code>" ); ?></p> 375 379 </div> 376 380 </div> -
imagify/tags/1.6.8/inc/admin/ui/options.php
r1702448 r1703145 213 213 <br/><strong id="backup-dir-is-writable" class="imagify-error<?php echo $backup_error_class; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'imagify_check_backup_dir_is_writable' ) ); ?>"> 214 214 <?php 215 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path( ) );215 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path( true ) ); 216 216 /* translators: %s is a file path. */ 217 printf( __( 'The backup folder %s can \'t be created, original images can\'t be saved!', 'imagify' ), "<code>$backup_path</code>" );217 printf( __( 'The backup folder %s cannot be created or is not writable by the server, original images cannot be saved!', 'imagify' ), "<code>$backup_path</code>" ); 218 218 ?> 219 219 </strong> -
imagify/tags/1.6.8/inc/functions/attachments.php
r1702448 r1703145 51 51 * @author Grégory Viguier 52 52 * 53 * @return string|bool Path to the backups directory. False on failure. 54 */ 55 function get_imagify_backup_dir_path() { 53 * @param bool $bypass_error True to return the path even if there is an error. This is used when we want to display this path in a message for example. 54 * @return string|bool Path to the backups directory. False on failure. 55 */ 56 function get_imagify_backup_dir_path( $bypass_error = false ) { 56 57 static $backup_dir; 57 58 … … 60 61 } 61 62 62 $upload_basedir = get_imagify_upload_basedir( );63 $upload_basedir = get_imagify_upload_basedir( $bypass_error ); 63 64 64 65 if ( ! $upload_basedir ) { … … 224 225 * 225 226 * @since 1.6.7 226 * @author Grégory Viguier 227 * 228 * @return string|bool The path. False on failure. 229 */ 230 function get_imagify_upload_basedir() { 227 * @since 1.6.8 Added the $bypass_error parameter. 228 * @author Grégory Viguier 229 * 230 * @param bool $bypass_error True to return the path even if there is an error. This is used when we want to display this path in a message for example. 231 * @return string|bool The path. False on failure. 232 */ 233 function get_imagify_upload_basedir( $bypass_error = false ) { 231 234 static $upload_basedir; 235 static $upload_basedir_or_error; 232 236 233 237 if ( isset( $upload_basedir ) ) { 234 return $upload_basedir; 235 } 236 237 $uploads = wp_upload_dir(); 238 return $bypass_error ? $upload_basedir : $upload_basedir_or_error; 239 } 240 241 $uploads = wp_upload_dir(); 242 $upload_basedir = trailingslashit( wp_normalize_path( $uploads['basedir'] ) ); 238 243 239 244 if ( false !== $uploads['error'] ) { 240 $upload_basedir = false; 241 return $upload_basedir; 242 } 243 244 $upload_basedir = trailingslashit( wp_normalize_path( $uploads['basedir'] ) ); 245 246 return $upload_basedir; 245 $upload_basedir_or_error = false; 246 } else { 247 $upload_basedir_or_error = $upload_basedir; 248 } 249 250 return $bypass_error ? $upload_basedir : $upload_basedir_or_error; 247 251 } 248 252 -
imagify/trunk/inc/admin/ui/notices.php
r1702451 r1703145 354 354 } 355 355 356 $filesystem = imagify_get_filesystem(); 357 $has_backup_dir = wp_mkdir_p( get_imagify_backup_dir_path() ); 358 359 if ( $has_backup_dir && $filesystem->is_writable( get_imagify_backup_dir_path() ) ) { 360 return; 361 } 362 363 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path() ); 356 if ( imagify_backup_dir_is_writable() ) { 357 return; 358 } 359 360 $filesystem = imagify_get_filesystem(); 361 362 if ( $filesystem->exists( get_imagify_backup_dir_path() ) ) { 363 /* translators: %s is a file path. */ 364 $message = __( 'The backup folder %s is not writable by the server, original images cannot be saved!', 'imagify' ); 365 } else { 366 /* translators: %s is a file path. */ 367 $message = __( 'The backup folder %s cannot be created. Is its parent directory writable by the server? Original images cannot be saved!', 'imagify' ); 368 } 369 370 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path( true ) ); 364 371 ?> 365 372 <div class="clear"></div> … … 369 376 </div> 370 377 <div class="imagify-notice-content"> 371 <p><?php 372 /* translators: %s is a file path. */ 373 printf( __( 'The backup folder %s can\'t be created, original images can\'t be saved!', 'imagify' ), "<code>$backup_path</code>" ); 374 ?></p> 378 <p><?php printf( $message, "<code>$backup_path</code>" ); ?></p> 375 379 </div> 376 380 </div> -
imagify/trunk/inc/admin/ui/options.php
r1702451 r1703145 213 213 <br/><strong id="backup-dir-is-writable" class="imagify-error<?php echo $backup_error_class; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'imagify_check_backup_dir_is_writable' ) ); ?>"> 214 214 <?php 215 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path( ) );215 $backup_path = imagify_make_file_path_replative( get_imagify_backup_dir_path( true ) ); 216 216 /* translators: %s is a file path. */ 217 printf( __( 'The backup folder %s can \'t be created, original images can\'t be saved!', 'imagify' ), "<code>$backup_path</code>" );217 printf( __( 'The backup folder %s cannot be created or is not writable by the server, original images cannot be saved!', 'imagify' ), "<code>$backup_path</code>" ); 218 218 ?> 219 219 </strong> -
imagify/trunk/inc/functions/attachments.php
r1702451 r1703145 51 51 * @author Grégory Viguier 52 52 * 53 * @return string|bool Path to the backups directory. False on failure. 54 */ 55 function get_imagify_backup_dir_path() { 53 * @param bool $bypass_error True to return the path even if there is an error. This is used when we want to display this path in a message for example. 54 * @return string|bool Path to the backups directory. False on failure. 55 */ 56 function get_imagify_backup_dir_path( $bypass_error = false ) { 56 57 static $backup_dir; 57 58 … … 60 61 } 61 62 62 $upload_basedir = get_imagify_upload_basedir( );63 $upload_basedir = get_imagify_upload_basedir( $bypass_error ); 63 64 64 65 if ( ! $upload_basedir ) { … … 224 225 * 225 226 * @since 1.6.7 226 * @author Grégory Viguier 227 * 228 * @return string|bool The path. False on failure. 229 */ 230 function get_imagify_upload_basedir() { 227 * @since 1.6.8 Added the $bypass_error parameter. 228 * @author Grégory Viguier 229 * 230 * @param bool $bypass_error True to return the path even if there is an error. This is used when we want to display this path in a message for example. 231 * @return string|bool The path. False on failure. 232 */ 233 function get_imagify_upload_basedir( $bypass_error = false ) { 231 234 static $upload_basedir; 235 static $upload_basedir_or_error; 232 236 233 237 if ( isset( $upload_basedir ) ) { 234 return $upload_basedir; 235 } 236 237 $uploads = wp_upload_dir(); 238 return $bypass_error ? $upload_basedir : $upload_basedir_or_error; 239 } 240 241 $uploads = wp_upload_dir(); 242 $upload_basedir = trailingslashit( wp_normalize_path( $uploads['basedir'] ) ); 238 243 239 244 if ( false !== $uploads['error'] ) { 240 $upload_basedir = false; 241 return $upload_basedir; 242 } 243 244 $upload_basedir = trailingslashit( wp_normalize_path( $uploads['basedir'] ) ); 245 246 return $upload_basedir; 245 $upload_basedir_or_error = false; 246 } else { 247 $upload_basedir_or_error = $upload_basedir; 248 } 249 250 return $bypass_error ? $upload_basedir : $upload_basedir_or_error; 247 251 } 248 252
Note: See TracChangeset
for help on using the changeset viewer.