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/Controller/Queue/QueueItems.php
<?php
namespace ShortPixel\Controller\Queue;

if ( ! defined( 'ABSPATH' ) ) {
 exit; // Exit if accessed directly.
}
// Attempt to standardize what goes around in the queue and keep some overview.

use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
use ShortPixel\Model\Image\ImageModel as ImageModel;
use ShortPixel\Model\Queue\QueueItem as QueueItem;

class QueueItems
{

    protected static $items = [
        'media' => [],
        'custom' => [],
    ];

    /**
     * GetImageItem
     *
     * @param ImageModel $imageModel
     * @return QueueItem QueueItem
     */

    public static function getImageItem(ImageModel $imageModel)
    {
        $type = $imageModel->get('type');
        $id = $imageModel->get('id');

        /*
        if (! isset(self::$items[$type][$id]))
        {
            $item = new QueueItem(['imageModel' => $imageModel]);
            self::$items[$type][$id] = $item;
        }

        return self::$items[$type][$id];
        */
        $item = new QueueItem(['imageModel' => $imageModel]);
        return $item;
    }

    public static function getEmptyItem($id, $type)
    {

      $item = new QueueItem(['item_id' => $id, 'type' => $type]);
      return $item;
      /*
      if (! isset(self::$items[$type][$id]))
      {
          $item = new QueueItem(['item_id' => $id, 'type' => $type]);
          self::$items[$type][$id] = $item;
      }

      return self::$items[$type][$id]; */
    }


    /*
      @param int $id of the item
      @param string $type Custom / Media
     */
    public static function getImageItemByID($id, $type)
    {
        $fs = \wpSPIO()->filesystem();
         $image = $fs->getMediaImage($id, $type);
         if (false !== $image)
         {
            return self::getImageItem($image);
         }
         else {
            return false;
         }

    }



} // class