| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/AIWEBSTATION/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;
}
}