HEX
Server: Apache
System: Linux cpanelx.inxs.ro 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: crowdandsafety (1041)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/cwd/wp-content/plugins/shortpixel-image-optimiser/class/external/gravityforms.php
<?php
namespace ShortPixel;

if ( ! defined( 'ABSPATH' ) ) {
 exit; // Exit if accessed directly.
}

use ShortPixel\Controller\OtherMediaController as OtherMediaController;

// Gravity Forms integrations.
class gravityForms
{

  public function __construct()
  {
		// @todo All this off, because it can only fatal error.
   // add_filter( 'gform_save_field_value', array($this,'shortPixelGravityForms'), 10, 5 );
  }

  function shortPixelGravityForms( $value, $lead, $field, $form ) {
      if($field->type == 'post_image') {
          $this->handleGravityFormsImageField($value);
      }
      return $value;
  }

  public function handleGravityFormsImageField($value) {


			$fs = \wpSPIO()->filesystem();
			$otherMediaController = OtherMediaController::getInstance();
			$uploadBase = $fs->getWPUploadBase();


			$gravFolder = $otherMediaController->getFolderByPath($uploadBase->getPath() . 'gravity_forms');

			if (! $gravFolder->exists())
			 	return false;

/* no clue what this legacy is suppposed to be.
      if(strpos($value , '|:|')) {
          $cleanup = explode('|:|', $value);
          $value = $cleanup[0];
      }
*/
			if (! $gravFolder->get('in_db'))
			{
				 $otherMediaController->addDirectory($gravFolder->getPath());
			}

  }

} // class

$g = new gravityForms();