public static function admin()
 {
     parent::admin();
     if (self::detect()) {
         $wpml_api = ICL_PLUGIN_PATH . DW_WPML_API;
         require_once $wpml_api;
         $list = array();
         $wpml_langs = wpml_get_active_languages();
         foreach ($wpml_langs as $lang) {
             $code = $lang['code'];
             $list[$code] = $lang['display_name'];
         }
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
     }
 }
/**
 * If WPML is used: Try to create automatically a Newsletter subscription page 
 * for each language, when language list is changed
 */
function alo_em_create_wpml_subscrpage_translations($settings)
{
    if (!function_exists('wpml_get_active_languages')) {
        return;
    }
    // if runs before WPML is completely loaded
    $langs = wpml_get_active_languages();
    if (is_array($langs)) {
        foreach ($langs as $lang) {
            // Original page ID
            $original_page_id = get_option('alo_em_subsc_page');
            // If the translated page doesn't exist, now create it
            if (icl_object_id($original_page_id, 'page', false, $lang['code']) == null) {
                // Found at: http://wordpress.stackexchange.com/questions/20143/plugin-wpml-how-to-create-a-translation-of-a-post-using-the-wpml-api
                $post_translated_title = get_post($original_page_id)->post_title . ' (' . $lang['code'] . ')';
                // All page stuff
                $my_page = array();
                $my_page['post_title'] = $post_translated_title;
                $my_page['post_content'] = '[ALO-EASYMAIL-PAGE]';
                $my_page['post_status'] = 'publish';
                $my_page['post_author'] = 1;
                $my_page['comment_status'] = 'closed';
                $my_page['post_type'] = 'page';
                // Insert translated post
                $post_translated_id = wp_insert_post($my_page);
                // Get trid of original post
                $trid = wpml_get_content_trid('post_' . 'page', $original_page_id);
                // Get default language
                $default_lang = wpml_get_default_language();
                // Associate original post and translated post
                global $wpdb;
                $wpdb->update($wpdb->prefix . 'icl_translations', array('trid' => $trid, 'language_code' => $lang['code'], 'source_language_code' => $default_lang), array('element_id' => $post_translated_id));
            }
        }
    }
}
    $opt_wpml = $DW->getOptions($_GET['id'], 'wpml');
    if (count($opt_wpml) > 0) {
        $wpml_act = array();
        foreach ($opt_wpml as $wpml_condition) {
            if ($wpml_condition['name'] == 'default' || empty($wpml_condition['name'])) {
                $wpml_default = $wpml_condition['value'];
            } else {
                $wpml_act[] = $wpml_condition['name'];
            }
        }
        if ($wpml_default == '0') {
            $wpml_no_selected = $wpml_yes_selected;
            unset($wpml_yes_selected);
        }
    }
    $wpml_langs = wpml_get_active_languages();
    if (count($wpml_langs) > DW_LIST_LIMIT) {
        $wpml_condition_select_style = DW_LIST_STYLE;
    }
    ?>

<h4><b><?php 
    _e('Language (WPML)', DW_L10N_DOMAIN);
    ?>
</b><?php 
    echo count($opt_wpml) > 0 ? ' <img src="' . $DW->plugin_url . 'img/checkmark.gif" alt="Checkmark" />' : '';
    ?>
</h4>
<div class="dynwid_conf">
<?php 
    _e('Show widget default on all languages?', DW_L10N_DOMAIN);