You are here

function sms_valid_rules_to_text in SMS Framework 6

Same name and namespace in other branches
  1. 6.2 modules/sms_valid/sms_valid.module \sms_valid_rules_to_text()
  2. 7 modules/sms_valid/sms_valid.module \sms_valid_rules_to_text()

Implode a rules array into rules text

Parameters

$rules: A rules array.

Return value

A text string containing rules for a ruleset.

1 call to sms_valid_rules_to_text()
sms_valid_admin_ruleset_form in modules/sms_valid/sms_valid.admin.inc
Validation ruleset editing form

File

modules/sms_valid/sms_valid.module, line 383
Number validation feature module for Drupal SMS Framework.

Code

function sms_valid_rules_to_text($rules) {
  $lines = array();
  if ($rules && is_array($rules)) {
    foreach ($rules as $rule_prefix => $rule) {
      $allow = $rule['allow'] ? '+' : '-';
      $comment = $rule['comment'] ? '    # ' . $rule['comment'] : '';
      $lines[] = $rule_prefix . $allow . $comment;
    }
  }
  return implode("\n", $lines);
}