You are here

public static function CleantalkFuncs::print_form in Anti Spam by CleanTalk 9.1.x

Same name and namespace in other branches
  1. 8.4 src/CleantalkFuncs.php \Drupal\cleantalk\CleantalkFuncs::print_form()
1 call to CleantalkFuncs::print_form()
BootSubscriber::handle in src/EventSubscriber/BootSubscriber.php

File

src/CleantalkFuncs.php, line 742

Class

CleantalkFuncs
Cleantalk class create request

Namespace

Drupal\cleantalk

Code

public static function print_form($arr, $k) {

  // Fix for pages04.net forms
  if (isset($arr['formSourceName'])) {
    $tmp = array();
    foreach ($arr as $key => $val) {
      $tmp_key = str_replace('_', '+', $key);
      $tmp[$tmp_key] = $val;
    }
    $arr = $tmp;
    unset($tmp, $key, $tmp_key, $val);
  }
  foreach ($arr as $key => $value) {
    if (!is_array($value)) {
      print '<textarea
				name="' . ($k == '' ? $key : $k . '[' . $key . ']') . '"
				style="display:none;">' . htmlspecialchars($value) . '</textarea>';
    }
    else {
      self::print_form($value, $k == '' ? $key : $k . '[' . $key . ']');
    }
  }
}