wordpress/wp-content/themes/basic/themify/themify-metabox/includes/themify-metabox-core.php
/**
	 * Import color and gradient swatches
	 * @since 4.5
	 */
Import color and gradient swatches
@since 4.5
Import color and gradient swatches @since 4 . 5
function themify_import_colors() {
		check_ajax_referer( 'ajax-nonce', 'tb_load_nonce' );
		$response['status'] = 'ERROR';
		$response['msg'] = __( 'Oopsss ... .Something went wrong.', 'themify' );
		if ( isset( $_FILES['file'] ) ) {
			$fileContent = themify_get_file_contents( $_FILES['file']['tmp_name'] );
			$new_data = unserialize( $fileContent );
			if ( $new_data !== null ) {
				if ( 'colors' === $_POST['type'] ) {
					$type = 'colors';
				} elseif ( 'gradients' === $_POST['type'] ) {
					$type = 'gradients';
				}
				$end = end( $new_data );
				$end=!empty($end['uid']);
				if ( ($end===true && 'colors' === $type) || ( $end===false && 'gradients' === $type ) ) {
					$currentSwatches = unserialize( get_option( 'themify_saved_' . $type, serialize( array() ) ) );
					$new_data = $currentSwatches + $new_data;
					$new_data = !empty($new_data) && is_array($new_data) ? $new_data : array();
					$_key='themify_saved_' . $type;
					delete_option($_key);
					add_option($_key,serialize( $new_data ), '', 'no' );
					$response['status'] = 'SUCCESS';
					$response['colors'] = $new_data;
					$response['msg'] = __( 'New swatches successfully imported.', 'themify' );
				} else {
					$response['status'] = 'FAILED';
					$response['msg'] = __( 'The uploaded file is not valid.', 'themify' );
				}
			}
		}
		wp_send_json( $response );
		wp_die();
	}
function themify_import_colors ( ) { check_ajax_referer ( 'ajax-nonce' , 'tb_load_nonce' ) ; $ response [ 'status' ] = 'ERROR' ; $ response [ 'msg' ] = __ ( 'Oopsss ... .Something went wrong.' , 'themify' ) ; if ( isset ( $ _FILES [ 'file' ] ) ) { $ fileContent = themify_get_file_contents ( $ _FILES [ 'file' ] [ 'tmp_name' ] ) ; $ new_data = unserialize ( $ fileContent ) ; if ( $ new_data !== null ) { if ( 'colors' === $ _POST [ 'type' ] ) { $ type = 'colors' ; } elseif ( 'gradients' === $ _POST [ 'type' ] ) { $ type = 'gradients' ; } $ end = end ( $ new_data ) ; $ end = ! empty ( $ end [ 'uid' ] ) ; if ( ( $ end === true && 'colors' === $ type ) || ( $ end === false && 'gradients' === $ type ) ) { $ currentSwatches = unserialize ( get_option ( 'themify_saved_' . $ type , serialize ( array ( ) ) ) ) ; $ new_data = $ currentSwatches + $ new_data ; $ new_data = ! empty ( $ new_data ) && is_array ( $ new_data ) ? $ new_data : array ( ) ; $ _key = 'themify_saved_' . $ type ; delete_option ( $ _key ) ; add_option ( $ _key , serialize ( $ new_data ) , '' , 'no' ) ; $ response [ 'status' ] = 'SUCCESS' ; $ response [ 'colors' ] = $ new_data ; $ response [ 'msg' ] = __ ( 'New swatches successfully imported.' , 'themify' ) ; } else { $ response [ 'status' ] = 'FAILED' ; $ response [ 'msg' ] = __ ( 'The uploaded file is not valid.' , 'themify' ) ; } } } wp_send_json ( $ response ) ; wp_die ( ) ; }
Import color and gradient swatches
 @since 4.5
Import color and gradient swatches @since 4 . 5