PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.1
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.1
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
ablocks / includes / frontend / dynamic-content / argument-parser.php

argument-parser.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.9.1, at includes/frontend/dynamic-content/argument-parser.php

32 lines 863 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ABlocks\Frontend\DynamicContent;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7 class ArgumentParser {
8
9 protected array $args;
10 protected array $interpreters;
11 protected string $arg_str;
12 protected bool $is_richtext;
13 public function __construct( string $arg_str, bool $is_richtext, array $interpreters ) {
14 $this->arg_str = $arg_str;
15 $this->is_richtext = $is_richtext;
16 $this->interpreters = $interpreters;
17 }
18 public function interpret() : ?Interpreters\Abstracts\Interpreter {
19 $setting = explode( '|', $this->arg_str );
20 $action_name = $setting[0];
21 array_shift( $setting );
22
23 if ( ! empty( $class = $this->interpreters[ $action_name ] ?? '' ) &&
24 class_exists( $class ) &&
25 ( $ins = new $class( $action_name, $setting, $this->is_richtext ) ) instanceof Interpreters\Abstracts\Interpreter
26 ) {
27 return $ins;
28 }
29 return null;
30 }
31 }
32