HEX
Server: LiteSpeed
System: Linux server.tenvelop.com 5.14.0-611.16.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Dec 22 03:40:39 EST 2025 x86_64
User: livspacetenvelop (1024)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/livspacetenvelop/public_html/wp-content/plugins/metform/core/entries/metform-shortcode.php
<?php
namespace MetForm\Core\Entries;
defined( 'ABSPATH' ) || exit;

Class Metform_Shortcode{
    use \MetForm\Traits\Singleton;

    private $all_keys;
    private $all_values;
    private $main_data;

    public function get_process_shortcode($string){
        $replace = str_replace($this->all_keys, $this->all_values, $string);
        return $replace;
    }

    public function set_values($main_data){
        $this->main_data = $main_data;
        $this->formate_keys();
        $this->formate_values();
        return $this;
    }

    public function get_all_keys(){
        return $this->all_keys;
    }

    public function get_all_values(){
        return $this->all_values;
    }

    public function set_all_keys($main_data){
        $this->main_data = $main_data;
        $this->formate_keys();
        return $this;
    }

    public function set_all_values($main_data){
        $this->main_data = $main_data;
        $this->formate_values();
        return $this;
    }

    public function formate_keys(){

        $this->all_keys = array_map(function($v){
            return "[".$v."]";
        }, array_keys($this->main_data) );
    }

    public function formate_values(){

        $this->all_values = array_map(function($value){
            return (is_array($value) ? implode(', ', $value) : $value);
        }, $this->main_data);
    }

}