mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed member directory notices;
This commit is contained in:
@@ -773,129 +773,6 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
|
||||
|
||||
return $array;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check image upload and handle errors
|
||||
*
|
||||
* @param $file
|
||||
* @param $field
|
||||
*
|
||||
* @return null|string|void
|
||||
*/
|
||||
function check_image_upload( $file, $field, $stream_photo = false ) {
|
||||
$error = null;
|
||||
|
||||
$fileinfo = $this->get_image_data( $file );
|
||||
$data = UM()->fields()->get_field( $field );
|
||||
|
||||
if ( $data == null ) {
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_custom_image_handle_{$field}
|
||||
* @description Custom image handle
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Image Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_custom_image_handle_{$field}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_custom_image_handle_{$field}', 'my_custom_image_handle', 10, 1 );
|
||||
* function my_custom_image_handle( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( "um_custom_image_handle_{$field}", array() );
|
||||
if ( ! $data ) {
|
||||
$error = __( 'This media type is not recognized.', 'ultimate-member' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_handle_global__option
|
||||
* @description Custom image global handle
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Image Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_image_handle_global__option', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_handle_global__option', 'my_image_handle_global', 10, 1 );
|
||||
* function my_image_handle_global( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters("um_image_handle_global__option", $data );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_image_handle_{$field}__option
|
||||
* @description Custom image handle for each $field
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Image Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_image_handle_{$field}__option', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_image_handle_{$field}__option', 'my_image_handle', 10, 1 );
|
||||
* function my_image_handle( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( "um_image_handle_{$field}__option", $data );
|
||||
|
||||
if ( $fileinfo['invalid_image'] == true ) {
|
||||
$error = sprintf(__('Your image is invalid or too large!','ultimate-member') );
|
||||
} elseif ( isset($data['min_size']) && ( $fileinfo['size'] < $data['min_size'] ) ) {
|
||||
$error = $data['min_size_error'];
|
||||
} elseif ( isset($data['min_width']) && ( $fileinfo['width'] < $data['min_width'] ) ) {
|
||||
$error = sprintf(__('Your photo is too small. It must be at least %spx wide.','ultimate-member'), $data['min_width']);
|
||||
} elseif ( isset($data['min_height']) && ( $fileinfo['height'] < $data['min_height'] ) ) {
|
||||
$error = sprintf(__('Your photo is too small. It must be at least %spx wide.','ultimate-member'), $data['min_height']);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check file upload and handle errors
|
||||
*
|
||||
* @param $file
|
||||
* @param $extension
|
||||
* @param $field
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
function check_file_upload( $file, $extension, $field ) {
|
||||
$error = null;
|
||||
|
||||
$fileinfo = $this->get_file_data( $file );
|
||||
$data = UM()->fields()->get_field( $field );
|
||||
|
||||
if ( isset($data['min_size']) && ( $fileinfo['size'] < $data['min_size'] ) ) {
|
||||
$error = $data['min_size_error'];
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
@@ -907,7 +784,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function in_array( $value, $array ){
|
||||
function in_array( $value, $array ) {
|
||||
|
||||
if ( in_array( $value, explode(',', $array ) ) ){
|
||||
return true;
|
||||
|
||||
@@ -262,7 +262,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
?>
|
||||
|
||||
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?> <?php selected( $_GET[$filter], $v ) ?>><?php echo __( $v, 'ultimate-member'); ?></option>
|
||||
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?> <?php selected( isset( $_GET[$filter] ) && $_GET[$filter] == $v ) ?>><?php echo __( $v, 'ultimate-member'); ?></option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -213,17 +213,17 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
public function validate_upload( $file ){
|
||||
|
||||
|
||||
if( 'image' == $this->upload_type ){
|
||||
if ( 'image' == $this->upload_type ) {
|
||||
|
||||
$error = $this->validate_image_data( $file['tmp_name'], $this->field_key );
|
||||
|
||||
}else if( 'file' == $this->upload_type ){
|
||||
} elseif( 'file' == $this->upload_type ) {
|
||||
|
||||
$error = $this->validate_file_data( $file['tmp_name'], $this->field_key );
|
||||
|
||||
}
|
||||
|
||||
if( $error ){
|
||||
if ( $error ) {
|
||||
$file['error'] = $error;
|
||||
}
|
||||
|
||||
@@ -610,18 +610,18 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
$response['handle_upload'] = $movefile;
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check image upload and handle errors
|
||||
*
|
||||
* @param $file
|
||||
* @param $field
|
||||
*
|
||||
* @return null|string|void
|
||||
* @return null|string
|
||||
*/
|
||||
public function validate_image_data( $file, $field_key ){
|
||||
public function validate_image_data( $file, $field_key ) {
|
||||
$error = null;
|
||||
|
||||
if ( ! function_exists( 'wp_get_image_editor' ) ) {
|
||||
@@ -729,9 +729,9 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
|
||||
return $error;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check file upload and handle errors
|
||||
*
|
||||
@@ -740,7 +740,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function validate_file_data( $file, $field_key ){
|
||||
public function validate_file_data( $file, $field_key ) {
|
||||
$error = null;
|
||||
|
||||
if ( ! function_exists( 'wp_get_image_editor' ) ) {
|
||||
|
||||
Reference in New Issue
Block a user