Server IP : 192.64.118.117 / Your IP : 3.147.83.1 Web Server : LiteSpeed System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : thecgapy ( 1160) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/thecgapy/www/wp-content/plugins/leads/shared/classes/ |
Upload File : |
<?php if ( !class_exists('Inbound_Templating_Engine') ) { function Inbound_Templating_Engine() { return Inbound_Templating_Engine::instance(); } class Inbound_Templating_Engine { public static $instance; private $defaults; /* Load Singleton Instance */ public static function instance() { if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Inbound_Automation_Load_Extensions ) ) { self::$instance = new Inbound_Templating_Engine; self::define_default_tokens(); } return self::$instance; } /* Set Default Token Values */ public static function define_default_tokens() { self::$instance->defaults = array ( 'admin-email-address' => get_option( 'admin_email', '' ), 'admin-url' => admin_url(), 'site-name' => get_option( 'blogname', '' ), 'site-tagline' => get_option( 'blogdescription', '' ), 'site-url' => get_option( 'siteurl', '' ) , 'date-time' => date( 'Y-m-d H:i:s A', current_time( 'timestamp' ) ) ); /* Plugin specific constants */ if ( defined( 'LANDINGPAGES_URLPATH' ) ) { self::$instance->defaults['landingpages-urlpath'] = LANDINGPAGES_URLPATH; } if ( defined( 'WPL_URLPATH' ) ) { self::$instance->defaults['leads-urlpath'] = WPL_URLPATH; } if ( defined( 'WP_CTA_URLPATH' ) ) { self::$instance->defaults['callstoaction-urlpath'] = WP_CTA_URLPATH; } } /* Replace Tokens */ public static function replace_tokens( $template, $args ) { /* Add default key/value pairs to front of $args array */ array_unshift( $args, self::$instance->defaults ); /* Loop through arguments in $args and replacec template tokens with values found in arguments */ foreach ($args as $arg) { /* Lets look for certain nested arrays and pull their content into the main $arg array */ if ( isset($arg['Mapped_Data']) ) { $arg_json = json_decode( stripslashes($arg['Mapped_Data']), true); foreach ($arg_json as $k=>$v) { $arg[$k] = $v; } } foreach ($arg as $key => $value ) { /* ignore child elements that are arrays */ if ( is_array($value) ) { continue; } /* prepare/re-map keys */ $key = str_replace( 'inbound_current_page_url', 'source', $key ); $key = str_replace( 'inbound_form_n', 'form_name', $key ); $key = str_replace( 'inbound_', '', $key ); $key = str_replace( 'wpleads_', 'lead_', $key ); $key = str_replace( '_', '-', $key ); /* replace tokens in template */ $template = str_replace( '{{'.$key.'}}', $value, $template ); } } /* Replace All Leftover Tokens */ $template = preg_replace( '/{{(.*?)}}/si', '', $template, -1 ); return do_shortcode($template); } } }