From: jervfors Date: Sun, 4 Mar 2007 12:50:00 +0000 (+0000) Subject: Updating to the newer option page format. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=e9e4a22b6babc32f89a4690b9ff32dcb3fb5a515;hp=06e9ab5c2075bd6356634647887cad9c4147afd9 Updating to the newer option page format. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12308 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/plugins/abook_take/functions.php b/plugins/abook_take/functions.php index e9918a0c..ee3414e2 100644 --- a/plugins/abook_take/functions.php +++ b/plugins/abook_take/functions.php @@ -13,28 +13,26 @@ */ /** */ -function valid_email ($email, $verify) -{ +function valid_email ($email, $verify) { global $Email_RegExp_Match; - if (! eregi('^' . $Email_RegExp_Match . '$', $email)) + if (! eregi('^' . $Email_RegExp_Match . '$', $email)) { return false; + } - if (! $verify) + if (! $verify) { return true; + } return checkdnsrr(substr(strstr($email, '@'), 1), 'ANY') ; } -function abook_take_read_string($str) -{ +function abook_take_read_string($str) { global $abook_found_email, $Email_RegExp_Match; - while (eregi('(' . $Email_RegExp_Match . ')', $str, $hits)) - { + while (eregi('(' . $Email_RegExp_Match . ')', $str, $hits)) { $str = substr(strstr($str, $hits[0]), strlen($hits[0])); - if (! isset($abook_found_email[$hits[0]])) - { + if (! isset($abook_found_email[$hits[0]])) { echo addHidden('email[]', $hits[0]); $abook_found_email[$hits[0]] = 1; } @@ -43,14 +41,12 @@ function abook_take_read_string($str) return; } -function abook_take_read_array($array) -{ +function abook_take_read_array($array) { foreach ($array as $item) abook_take_read_string($item->getAddress()); } -function abook_take_read() -{ +function abook_take_read() { global $message; echo '
' . addForm(SM_PATH . 'plugins/abook_take/take.php') . @@ -69,28 +65,22 @@ function abook_take_read() ''; } -function abook_take_pref() -{ +function abook_take_pref() { global $username, $data_dir, $abook_take_verify; $abook_take_verify = getPref($data_dir, $username, 'abook_take_verify', false); } -function abook_take_options() -{ - global $abook_take_verify; - - echo '' . html_tag('td',_("Address Book Take:"),'right','','style="white-space: nowrap;"') . "\n" . '' . - addCheckbox('abook_take_abook_take_verify', $abook_take_verify) . - _("Try to verify addresses") . "\n"; -} - -function abook_take_save() -{ - global $username, $data_dir; - - if (sqgetGlobalVar('abook_take_abook_take_verify', $abook_take_abook_take_verify, SQ_POST)) - setPref($data_dir, $username, 'abook_take_verify', '1'); - else - setPref($data_dir, $username, 'abook_take_verify', ''); +function abook_take_options() { + global $optpage_data; + + $optpage_data['grps']['abook_take'] = _("Address Book Take"); + $optionValues = array(); + $optionValues[] = array( + 'name' => 'abook_take_verify', + 'caption' => _("Try to verify addresses"), + 'type' => SMOPT_TYPE_BOOLEAN, + 'refresh' => SMOPT_REFRESH_NONE + ); + $optpage_data['vals']['abook_take'] = $optionValues; } diff --git a/plugins/abook_take/setup.php b/plugins/abook_take/setup.php index f135f467..2751f76b 100755 --- a/plugins/abook_take/setup.php +++ b/plugins/abook_take/setup.php @@ -24,8 +24,7 @@ function squirrelmail_plugin_init_abook_take() $squirrelmail_plugin_hooks['read_body_bottom']['abook_take'] = 'abook_take_read_body_bottom'; $squirrelmail_plugin_hooks['loading_prefs']['abook_take'] = 'abook_take_loading_prefs'; - $squirrelmail_plugin_hooks['options_display_inside']['abook_take'] = 'abook_take_options_display_inside'; - $squirrelmail_plugin_hooks['options_display_save']['abook_take'] = 'abook_take_options_display_save'; + $squirrelmail_plugin_hooks['optpage_loadhook_display']['abook_take'] = 'abook_take_optpage_loadhook_display'; } function abook_take_read_body_bottom() { @@ -40,14 +39,8 @@ function abook_take_loading_prefs() { abook_take_pref(); } -function abook_take_options_display_inside() { +function abook_take_optpage_loadhook_display() { include_once(SM_PATH . 'plugins/abook_take/functions.php'); abook_take_options(); } - -function abook_take_options_display_save() { - include_once(SM_PATH . 'plugins/abook_take/functions.php'); - - abook_take_save(); -}