| Server IP : 87.98.154.146 / Your IP : 216.73.216.165 Web Server : Apache System : Linux webm004.cluster126.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : ohklomafyi ( 52085) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/ohklomafyi/www/wp-content/plugins/shortpixel-image-optimiser/class/external/ |
Upload File : |
<?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());
}
//ShortPixel is monitoring the gravity forms folder, add the image to queue
// $uploadDir = wp_upload_dir();
//$localPath = str_replace($uploadDir['baseurl'], SHORTPIXEL_UPLOADS_BASE, $value);
//return $shortPixelObj->addPathToCustomFolder($localPath, $folder->getId(), 0);
}
} // class
$g = new gravityForms();