コード例 #1
0
ファイル: options.php プロジェクト: jin255ff/company_website
function create_option_groups($optgrps, $optvals)
{
    /* Build a simple array with which to start. */
    $result = array();
    /* Create option group for each option group name. */
    foreach ($optgrps as $grpkey => $grpname) {
        $result[$grpkey] = array();
        $result[$grpkey]['name'] = $grpname;
        $result[$grpkey]['options'] = array();
    }
    /* Create a new SquirrelOption for each set of option values. */
    foreach ($optvals as $grpkey => $grpopts) {
        foreach ($grpopts as $optset) {
            /* Create a new option with all values given. */
            $next_option = new SquirrelOption($optset['name'], $optset['caption'], $optset['type'], isset($optset['refresh']) ? $optset['refresh'] : SMOPT_REFRESH_NONE, isset($optset['initial_value']) ? $optset['initial_value'] : '', isset($optset['posvals']) ? $optset['posvals'] : '', isset($optset['htmlencoded']) ? $optset['htmlencoded'] : false);
            /* If provided, set the size for this option. */
            if (isset($optset['size'])) {
                $next_option->setSize($optset['size']);
            }
            /* If provided, set the comment for this option. */
            if (isset($optset['comment'])) {
                $next_option->setComment($optset['comment']);
            }
            /* If provided, set the save function for this option. */
            if (isset($optset['save'])) {
                $next_option->setSaveFunction($optset['save']);
            }
            /* If provided, set the script for this option. */
            if (isset($optset['script'])) {
                $next_option->setScript($optset['script']);
            }
            /* If provided, set the "post script" for this option. */
            if (isset($optset['post_script'])) {
                $next_option->setPostScript($optset['post_script']);
            }
            /* Add this option to the option array. */
            $result[$grpkey]['options'][] = $next_option;
        }
    }
    /* Return our resulting array. */
    return $result;
}
コード例 #2
0
ファイル: options.php プロジェクト: teammember8/roundcube
/**
 * @param array $optgrps
 * @param array $optvals
 * @return array
 */
function create_option_groups($optgrps, $optvals)
{
    /* Build a simple array with which to start. */
    $result = array();
    /* Create option group for each option group name. */
    foreach ($optgrps as $grpkey => $grpname) {
        $result[$grpkey] = array();
        $result[$grpkey]['name'] = $grpname;
        $result[$grpkey]['options'] = array();
    }
    /* Create a new SquirrelOption for each set of option values. */
    foreach ($optvals as $grpkey => $grpopts) {
        foreach ($grpopts as $optset) {
            /* Create a new option with all values given. */
            $next_option = new SquirrelOption($optset, $optset['name'], $optset['caption'], $optset['type'], isset($optset['refresh']) ? $optset['refresh'] : SMOPT_REFRESH_NONE, isset($optset['initial_value']) ? $optset['initial_value'] : '', isset($optset['posvals']) ? $optset['posvals'] : '', isset($optset['htmlencoded']) ? $optset['htmlencoded'] : false);
            /* If provided, set if the caption is allowed to wrap for this option. */
            if (isset($optset['caption_wrap'])) {
                $next_option->setCaptionWrap($optset['caption_wrap']);
            }
            /* If provided, set the size for this option. */
            if (isset($optset['size'])) {
                $next_option->setSize($optset['size']);
            }
            /* If provided, set the trailing_text for this option. */
            if (isset($optset['trailing_text'])) {
                $next_option->setTrailingText($optset['trailing_text']);
            }
            /* If provided, set the yes_text for this option. */
            if (isset($optset['yes_text'])) {
                $next_option->setYesText($optset['yes_text']);
            }
            /* If provided, set the no_text for this option. */
            if (isset($optset['no_text'])) {
                $next_option->setNoText($optset['no_text']);
            }
            /* If provided, set the poss_value_folders value for this option. */
            if (isset($optset['poss_value_folders'])) {
                $next_option->setPossValueFolders($optset['poss_value_folders']);
            }
            /* If provided, set the layout type for this option. */
            if (isset($optset['layout_type'])) {
                $next_option->setLayoutType($optset['layout_type']);
            }
            /* If provided, set the use_add_widget value for this option. */
            if (isset($optset['use_add_widget'])) {
                $next_option->setUseAddWidget($optset['use_add_widget']);
            }
            /* If provided, set the use_delete_widget value for this option. */
            if (isset($optset['use_delete_widget'])) {
                $next_option->setUseDeleteWidget($optset['use_delete_widget']);
            }
            /* If provided, set the comment for this option. */
            if (isset($optset['comment'])) {
                $next_option->setComment($optset['comment']);
            }
            /* If provided, set the save function for this option. */
            if (isset($optset['save'])) {
                $next_option->setSaveFunction($optset['save']);
            }
            /* If provided, set the extra attributes for this option. */
            if (isset($optset['extra_attributes'])) {
                $next_option->setExtraAttributes($optset['extra_attributes']);
            }
            /* If provided, set the "post script" for this option. */
            if (isset($optset['post_script'])) {
                $next_option->setPostScript($optset['post_script']);
            }
            /* If provided, set the folder_filter for this option. */
            if (isset($optset['folder_filter'])) {
                $next_option->setFolderFilter($optset['folder_filter']);
            }
            /* Add this option to the option array. */
            $result[$grpkey]['options'][] = $next_option;
        }
    }
    /* Return our resulting array. */
    return $result;
}