| Server IP : 52.25.153.185 / Your IP : 216.73.217.131 Web Server : Apache System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64 User : daemon ( 1) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /bitnami/wordpress/wp-content/plugins/fluentformpro/src/classes/ |
Upload File : |
<?php
namespace FluentFormPro\classes;
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
class ProSmartCodes
{
public function register()
{
add_filter('fluentform/smartcode_group_render_images', array($this, 'parseImageLists'), 10, 2);
}
public function parseImageLists($property, $instance)
{
$propertyArray = explode('|', $property);
$inputName = array_shift($propertyArray);
$column = false;
if(isset($propertyArray[0])) {
$column = intval($propertyArray[0]);
}
if(!$column) {
$column = 1;
}
$inputs = $instance::getInputs();
$images = \FluentForm\Framework\Helpers\ArrayHelper::get($inputs, $inputName);
if(!is_array($images)) {
return '';
}
if(!$images) {
return '';
}
$rows = array_chunk($images, $column);
$html = '<table class="fs_rendered_images" border="0" style="border:0px solid transparent; border-collapse: collapse;">';
foreach ($rows as $rowImages) {
$html .= '<tr>';
foreach ($rowImages as $image) {
$parts = explode('.', $image);
$extension = array_pop($parts);
if(in_array($extension, ['png', 'jpg', 'jpeg', 'gif'])) {
$html .= '<td><img src="'.$image.'" /></td>';
} else {
$parts = explode('/', $image);
$extension = array_pop($parts);
$html .= '<td><a href="'.$image.'">'.$extension.'</a></td>';
}
}
$html .= '</tr>';
}
$html .= '</table>';
return $html;
}
}