src/FeaturedImageProcessing/FeaturedImageProcessing.php
public function process($data) {

        $featuredImageProcessing = [];


        // FEATURED_IMAGE_URL

        // is the featured image from an external URL?
        $useFeaturedImageUrl = $this->isFieldValueBlank($data['featured_image_url']);

        // if using the featured_image_url field, then validate it now
        if (
            ($useFeaturedImageUrl) &&
            ($this->validateFeaturedImageUrl($data['featured_image_url']) != "passed")
        )
        {
            // validation failed
            $featuredImageProcessing['validationMessage'] = $this->validateFeaturedImageUrl($data['featured_image_url']);
            return $featuredImageProcessing;
        }

        // if using the featured_image_url field, and it passes the validation, then make it the Featured Image
        if ($useFeaturedImageUrl) {
            $featuredImageProcessing['validationMessage'] = "passed";
            $featuredImageProcessing['featured_image']    = $data['featured_image_url'];
            return $featuredImageProcessing;
        }


        // FEATURED_IMAGE_UPLOAD

        // is the featured image from a local file upload?
        $useFeaturedImageUpload = $this->isFieldValueBlank($data['featured_image_upload']);

        // if using the featured_image_upload field, then validate it now
        if (
            ($useFeaturedImageUpload) &&
            ($this->validateFeaturedImageUpload($data['featured_image_upload']) != "passed")
        )
        {
            // validation failed
            $featuredImageProcessing['validationMessage'] = $this->validateFeaturedImageUpload($data['featured_image_upload']);
            return $featuredImageProcessing;

        }

        // if using the featured_image_upload field, and it passes the validation, then make it the Featured Image
        if ($useFeaturedImageUpload) {

            // Move the file from the tmp folder to the image folder
            $this->moveFile($data['featured_image_upload']);

            $featuredImageProcessing['validationMessage'] = "passed";
            $featuredImageProcessing['featured_image']    = $data['featured_image_upload'];
            return $featuredImageProcessing;
        }


        // FEATURED_IMAGE_SERVER

        // if using the featured_image_upload field, then validate it now
        if ($this->validateFeaturedImageServer($data['featured_image_server']) != "passed") {
            // validation failed
            $featuredImageProcessing['validationMessage'] = $this->validateFeaturedImageServer($data['featured_image_server']);
            return $featuredImageProcessing;
        }

        // if using the featured_image_upload field, and it passes the validation, then make it the Featured Image
        $featuredImageProcessing['validationMessage'] = "passed";
        $featuredImageProcessing['featured_image']    = $data['featured_image_server'];
        return $featuredImageProcessing;
    }
public function process($data) {

        $featuredImageProcessing = [];


        // FEATURED_IMAGE_URL

        // is the featured image from an external URL?
        $useFeaturedImageUrl = $this->isFieldValueBlank($data['featured_image_url']);

        // if using the featured_image_url field, then validate it now
        if (
            ($useFeaturedImageUrl) &&
            ($this->validateFeaturedImageUrl($data['featured_image_url']) != "passed")
        )
        {
            // validation failed
            $featuredImageProcessing['validationMessage'] = $this->validateFeaturedImageUrl($data['featured_image_url']);
            return $featuredImageProcessing;
        }

        // if using the featured_image_url field, and it passes the validation, then make it the Featured Image
        if ($useFeaturedImageUrl) {
            $featuredImageProcessing['validationMessage'] = "passed";
            $featuredImageProcessing['featured_image']    = $data['featured_image_url'];
            return $featuredImageProcessing;
        }


        // FEATURED_IMAGE_UPLOAD

        // is the featured image from a local file upload?
        $useFeaturedImageUpload = $this->isFieldValueBlank($data['featured_image_upload']);

        // if using the featured_image_upload field, then validate it now
        if (
            ($useFeaturedImageUpload) &&
            ($this->validateFeaturedImageUpload($data['featured_image_upload']) != "passed")
        )
        {
            // validation failed
            $featuredImageProcessing['validationMessage'] = $this->validateFeaturedImageUpload($data['featured_image_upload']);
            return $featuredImageProcessing;

        }

        // if using the featured_image_upload field, and it passes the validation, then make it the Featured Image
        if ($useFeaturedImageUpload) {

            // Move the file from the tmp folder to the image folder
            $this->moveFile($data['featured_image_upload']);

            $featuredImageProcessing['validationMessage'] = "passed";
            $featuredImageProcessing['featured_image']    = $data['featured_image_upload'];
            return $featuredImageProcessing;
        }


        // FEATURED_IMAGE_SERVER

        // if using the featured_image_upload field, then validate it now
        if ($this->validateFeaturedImageServer($data['featured_image_server']) != "passed") {
            // validation failed
            $featuredImageProcessing['validationMessage'] = $this->validateFeaturedImageServer($data['featured_image_server']);
            return $featuredImageProcessing;
        }

        // if using the featured_image_upload field, and it passes the validation, then make it the Featured Image
        $featuredImageProcessing['validationMessage'] = "passed";
        $featuredImageProcessing['featured_image']    = $data['featured_image_server'];
        return $featuredImageProcessing;
    }
public function process ( $ data ) { $ featuredImageProcessing = [ ] ; // FEATURED_IMAGE_URL // is the featured image from an external URL? $ useFeaturedImageUrl = $ this -> isFieldValueBlank ( $ data [ 'featured_image_url' ] ) ; // if using the featured_image_url field, then validate it now if ( ( $ useFeaturedImageUrl ) && ( $ this -> validateFeaturedImageUrl ( $ data [ 'featured_image_url' ] ) != "passed" ) ) { // validation failed $ featuredImageProcessing [ 'validationMessage' ] = $ this -> validateFeaturedImageUrl ( $ data [ 'featured_image_url' ] ) ; return $ featuredImageProcessing ; } // if using the featured_image_url field, and it passes the validation, then make it the Featured Image if ( $ useFeaturedImageUrl ) { $ featuredImageProcessing [ 'validationMessage' ] = "passed" ; $ featuredImageProcessing [ 'featured_image' ] = $ data [ 'featured_image_url' ] ; return $ featuredImageProcessing ; } // FEATURED_IMAGE_UPLOAD // is the featured image from a local file upload? $ useFeaturedImageUpload = $ this -> isFieldValueBlank ( $ data [ 'featured_image_upload' ] ) ; // if using the featured_image_upload field, then validate it now if ( ( $ useFeaturedImageUpload ) && ( $ this -> validateFeaturedImageUpload ( $ data [ 'featured_image_upload' ] ) != "passed" ) ) { // validation failed $ featuredImageProcessing [ 'validationMessage' ] = $ this -> validateFeaturedImageUpload ( $ data [ 'featured_image_upload' ] ) ; return $ featuredImageProcessing ; } // if using the featured_image_upload field, and it passes the validation, then make it the Featured Image if ( $ useFeaturedImageUpload ) { // Move the file from the tmp folder to the image folder $ this -> moveFile ( $ data [ 'featured_image_upload' ] ) ; $ featuredImageProcessing [ 'validationMessage' ] = "passed" ; $ featuredImageProcessing [ 'featured_image' ] = $ data [ 'featured_image_upload' ] ; return $ featuredImageProcessing ; } // FEATURED_IMAGE_SERVER // if using the featured_image_upload field, then validate it now if ( $ this -> validateFeaturedImageServer ( $ data [ 'featured_image_server' ] ) != "passed" ) { // validation failed $ featuredImageProcessing [ 'validationMessage' ] = $ this -> validateFeaturedImageServer ( $ data [ 'featured_image_server' ] ) ; return $ featuredImageProcessing ; } // if using the featured_image_upload field, and it passes the validation, then make it the Featured Image $ featuredImageProcessing [ 'validationMessage' ] = "passed" ; $ featuredImageProcessing [ 'featured_image' ] = $ data [ 'featured_image_server' ] ; return $ featuredImageProcessing ; }
Main featured image processing

@param  array  $data   Form field data
Main featured image processing