From 7a7c3015b0dea4c78fb4496a21558cc262a01c13 Mon Sep 17 00:00:00 2001 From: Henry Schorradt Date: Fri, 21 Apr 2017 09:45:23 +0200 Subject: [PATCH] Some fixes for PHP7 environment --- MF_thumb.php | 2 +- admin/mf_ajax_call.php | 2 +- mf_front_end.php | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/MF_thumb.php b/MF_thumb.php index 705e476..8b233cc 100644 --- a/MF_thumb.php +++ b/MF_thumb.php @@ -11,7 +11,7 @@ */ class mfthumb{ - function mfthumb(){ + function __construct(){ require_once(ABSPATH."/wp-admin/includes/image.php"); require_once(ABSPATH."/wp-includes/media.php"); } diff --git a/admin/mf_ajax_call.php b/admin/mf_ajax_call.php index a507bd7..e0e181d 100644 --- a/admin/mf_ajax_call.php +++ b/admin/mf_ajax_call.php @@ -28,7 +28,7 @@ public function resolve($data){ public function mf_sort_field($data){ if ( !empty( $data['order'] ) && !empty( $data['group_id'] ) ) { $order = $data['order']; - $order = split(',',$order); + $order = explode(',',$order); array_walk( $order, create_function( '&$v,$k', '$v = str_replace("order_","",$v);' )); if( $thing = mf_custom_fields::save_order_field( $data['group_id'], $order ) ) { diff --git a/mf_front_end.php b/mf_front_end.php index 0be5de0..4a12a64 100644 --- a/mf_front_end.php +++ b/mf_front_end.php @@ -254,7 +254,18 @@ function get_label($field_name,$post_id=NULL){ */ function create_image($options){ global $post,$mf_domain; - + + //correct init + $field_name = ''; + $group_index = 1; + $field_index = 1; + $param = NULL; + $attr = NULL; + $post_id = NULL; + $tag_img = true; + $wp_size = 'original'; + + // establish the default values, then override them with // whatever the user has passed in $options = array_merge( @@ -456,7 +467,7 @@ function _processed_value($value, $type, $options = array(), $image_array = 0 ){ $options= unserialize( $options ); } - $result = ''; + $result = array(); switch($type){ case 'audio': case 'file':