function sms_valid_create_example_ruleset in SMS Framework 6
Same name and namespace in other branches
- 6.2 modules/sms_valid/sms_valid.install \sms_valid_create_example_ruleset()
- 7 modules/sms_valid/sms_valid.install \sms_valid_create_example_ruleset()
Create an example number validation ruleset
Parameters
$ret: Array of query results.
1 call to sms_valid_create_example_ruleset()
- sms_valid_install in modules/
sms_valid/ sms_valid.install - Implementation of hook_install().
File
- modules/
sms_valid/ sms_valid.install, line 85 - SMS Framework Number Validation feature module: Install file
Code
function sms_valid_create_example_ruleset(&$ret = array()) {
$prefix = 64;
$name = 'New Zealand';
$dirs_enabled = 4;
$iso2 = 'NZ';
$rules = array(
'21' => array(
'allow' => TRUE,
'comment' => 'Vodafone',
),
'22' => array(
'allow' => TRUE,
'comment' => 'Two Degrees Mobile',
),
'25' => array(
'allow' => FALSE,
'comment' => 'Telecom AMPS+TDMA (old)',
),
'26' => array(
'allow' => FALSE,
'comment' => 'Telecom pager network',
),
'27' => array(
'allow' => TRUE,
'comment' => 'Telecom CDMA',
),
'28' => array(
'allow' => TRUE,
'comment' => 'Slingshot',
),
'29' => array(
'allow' => TRUE,
'comment' => 'TelstraClear',
),
);
$rules_z = serialize($rules);
$sql = "INSERT INTO {sms_valid_rules} (prefix,name,rules,dirs_enabled,iso2)" . "VALUES (%d, '%s', '%s', %d, '%s')";
$result = db_query($sql, $prefix, $name, $rules_z, $dirs_enabled, $iso2);
$ret[] = array(
'success' => $result !== FALSE,
'query' => check_plain($sql),
);
}