PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.4 3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 All 262 releases
wpfunnels / vendor / spatie / image-optimizer / src / Optimizers / BaseOptimizer.php

BaseOptimizer.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at vendor/spatie/image-optimizer/src/Optimizers/BaseOptimizer.php

64 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Spatie\ImageOptimizer\Optimizers;
4
5 use Spatie\ImageOptimizer\Optimizer;
6
7 abstract class BaseOptimizer implements Optimizer
8 {
9 public $options = [];
10
11 public $imagePath = '';
12
13 public $binaryPath = '';
14
15 public $tmpPath = null;
16
17 public function __construct($options = [])
18 {
19 $this->setOptions($options);
20 }
21
22 public function binaryName(): string
23 {
24 return $this->binaryName;
25 }
26
27 public function setBinaryPath(string $binaryPath)
28 {
29 if (strlen($binaryPath) > 0 && substr($binaryPath, -1) !== DIRECTORY_SEPARATOR) {
30 $binaryPath = $binaryPath.DIRECTORY_SEPARATOR;
31 }
32
33 $this->binaryPath = $binaryPath;
34
35 return $this;
36 }
37
38 public function setImagePath(string $imagePath)
39 {
40 $this->imagePath = $imagePath;
41
42 return $this;
43 }
44
45 public function setOptions(array $options = [])
46 {
47 $this->options = $options;
48
49 return $this;
50 }
51
52 public function getCommand(): string
53 {
54 $optionString = implode(' ', $this->options);
55
56 return "\"{$this->binaryPath}{$this->binaryName}\" {$optionString} ".escapeshellarg($this->imagePath);
57 }
58
59 public function getTmpPath(): ?string
60 {
61 return $this->tmpPath;
62 }
63 }
64