wp/wp-admin/includes/misc.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   119 		// Make sure the file is created with a minimum set of permissions.
   119 		// Make sure the file is created with a minimum set of permissions.
   120 		$perms = fileperms( $filename );
   120 		$perms = fileperms( $filename );
   121 		if ( $perms ) {
   121 		if ( $perms ) {
   122 			chmod( $filename, $perms | 0644 );
   122 			chmod( $filename, $perms | 0644 );
   123 		}
   123 		}
   124 	} elseif ( ! is_writeable( $filename ) ) {
   124 	} elseif ( ! is_writable( $filename ) ) {
   125 		return false;
   125 		return false;
   126 	}
   126 	}
   127 
   127 
   128 	if ( ! is_array( $insertion ) ) {
   128 	if ( ! is_array( $insertion ) ) {
   129 		$insertion = explode( "\n", $insertion );
   129 		$insertion = explode( "\n", $insertion );
  1002 	} elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) {
  1002 	} elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) {
  1003 		$icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
  1003 		$icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
  1004 	} else {
  1004 	} else {
  1005 		// Fall back to the default set of icon colors if the default scheme is missing.
  1005 		// Fall back to the default set of icon colors if the default scheme is missing.
  1006 		$icon_colors = array(
  1006 		$icon_colors = array(
  1007 			'base'    => '#a0a5aa',
  1007 			'base'    => '#a7aaad',
  1008 			'focus'   => '#00a0d2',
  1008 			'focus'   => '#72aee6',
  1009 			'current' => '#fff',
  1009 			'current' => '#fff',
  1010 		);
  1010 		);
  1011 	}
  1011 	}
  1012 
  1012 
  1013 	echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
  1013 	echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
  1244 			$response['wp_autosave'] = array(
  1244 			$response['wp_autosave'] = array(
  1245 				'success' => false,
  1245 				'success' => false,
  1246 				'message' => __( 'Error while saving.' ),
  1246 				'message' => __( 'Error while saving.' ),
  1247 			);
  1247 			);
  1248 		} else {
  1248 		} else {
  1249 			/* translators: Draft saved date format, see https://www.php.net/date */
  1249 			/* translators: Draft saved date format, see https://www.php.net/manual/datetime.format.php */
  1250 			$draft_saved_date_format = __( 'g:i:s a' );
  1250 			$draft_saved_date_format = __( 'g:i:s a' );
  1251 			$response['wp_autosave'] = array(
  1251 			$response['wp_autosave'] = array(
  1252 				'success' => true,
  1252 				'success' => true,
  1253 				/* translators: %s: Date and time. */
  1253 				/* translators: %s: Date and time. */
  1254 				'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ),
  1254 				'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ),