PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 3.1.1
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v3.1.1
4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 3.12.1 All 134 releases
optimole-wp / inc / cli.php

cli.php in Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization 3.1.1, at inc/cli.php

50 lines 844 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * CLI class.
5 *
6 * Author: Bogdan Preda <bogdan.preda@themeisle.com>
7 * Created on: 19/07/2018
8 *
9 * @package \Optimole\Inc
10 * @author Optimole <friends@optimole.com>
11 */
12
13 /**
14 * Class Optml_Cli
15 */
16 class Optml_Cli {
17
18 /**
19 * Api version.
20 *
21 * @var string Version string.
22 */
23 const CLI_NAMESPACE = 'optimole';
24
25 /**
26 * CLI controllers
27 *
28 * @var array List of CLI controllers.
29 */
30 private $commands = [
31 'setting',
32 'media',
33 ];
34
35 /**
36 * Optml_Cli constructor.
37 */
38 public function __construct() {
39 foreach ( $this->commands as $command ) {
40 $class_name = 'Optml_Cli_' . ucfirst( $command );
41 $controller = new $class_name();
42 try {
43 \WP_CLI::add_command( self::CLI_NAMESPACE . ' ' . $command, $controller );
44 } catch ( \Exception $e ) {
45 // TODO Log this exception.
46 }
47 }
48 }
49 }
50