Ejemplo n.º 1
0
function wpbilbao_template_miembros_do_loop()
{
    $miembros = get_users('orderby=nicename&role=miembro');
    echo '<div class="lista-miembros row">';
    foreach ($miembros as $miembro) {
        $miembro_id = $miembro->ID;
        $miembro_imagen = get_cimyFieldValue($miembro_id, 'IMAGEN');
        ?>

    <div class="miembro-lista col-xs-6 col-sm-2">
      <a href="<?php 
        echo get_author_posts_url($miembro_id);
        ?>
" title="<?php 
        printf(__('Pefil de %s', 'wpbilbao'), esc_html($miembro->display_name));
        ?>
">
        <?php 
        if ($miembro_imagen) {
            ?>
          <img src="<?php 
            echo cimy_uef_sanitize_content($miembro_imagen);
            ?>
" alt="<?php 
            echo esc_html($miembro->display_name);
            ?>
"/>
        <?php 
        } else {
            ?>
          <img src="<?php 
            echo get_bloginfo('stylesheet_directory');
            ?>
/images/miembros/wpbilbao-sin-foto.jpg" alt="<?php 
            echo esc_html($miembro->display_name);
            ?>
"/>
        <?php 
        }
        ?>
        <h4><?php 
        echo esc_html($miembro->display_name);
        ?>
</h4>
      </a>
    </div><!-- .miembro-lista -->

  <?php 
    }
    echo '<div class="clearfix"></div>';
    echo '</div><!-- .lista-miembros -->';
}
function cimy_registration_form($errors = null, $show_type = 0)
{
    global $wpdb, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_maxlen_needed, $fields_name_prefix, $wp_fields_name_prefix, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types, $user_level, $cimy_uef_domain, $cimy_uef_file_images_types, $cimy_uef_text_types;
    if (cimy_is_at_least_wordpress35()) {
        cimy_switch_to_blog();
    }
    $my_user_level = $user_level;
    // -1 == anonymous
    if (!is_user_logged_in()) {
        $my_user_level = -1;
    }
    $extra_fields = get_cimyFields(false, true);
    $wp_fields = get_cimyFields(true);
    if (is_multisite()) {
        $input_class = "cimy_uef_input_mu";
    } else {
        $input_class = "cimy_uef_input_27";
    }
    $options = cimy_get_options();
    $tabindex = 21;
    echo $start_cimy_uef_comment;
    // needed to apply default values only first time and not in case of errors
    echo "\t<input type=\"hidden\" name=\"cimy_post\" value=\"1\" />\n";
    if ($options['confirm_form']) {
        if ($show_type == 0) {
            echo "\t<input type=\"hidden\" name=\"register_confirmation\" value=\"1\" />\n";
        } else {
            if ($show_type == 2) {
                echo "\t<input type=\"hidden\" name=\"register_confirmation\" value=\"2\" />\n";
            }
        }
    }
    $radio_checked = array();
    $i = 1;
    // confirmation page, all fields are plain text + hidden fields to carry over values
    if ($show_type == 2) {
        $user_email = $_POST["user_email"];
        if (in_array("username", $options["wp_hidden_fields"])) {
            $username = $_POST["user_login"];
            ?>
			<p id="user_login_p">
				<label for="user_login"><?php 
            _e("Username");
            ?>
 </label><?php 
            echo esc_html($username);
            ?>
			</p>
<?php 
        } else {
            $username = $user_email;
        }
        $upload_dir = cimy_uef_get_dir_or_filename("");
        $dirs = glob($upload_dir . ".cimytemp_*.tmp");
        if (is_array($dirs)) {
            foreach ($dirs as $dir) {
                $diff = current_time('timestamp', true) - filemtime($dir);
                // If older than two days delete!
                if ($diff > 172800) {
                    cimy_rfr($dir . "/", "*");
                    if (is_dir($dir)) {
                        rmdir($dir);
                    }
                }
            }
        }
        $temp_user_login = "******" . sanitize_user($username) . '_' . rand() . '.tmp';
        ?>
		<input type="hidden" name="temp_user_login" value="<?php 
        echo esc_attr($temp_user_login);
        ?>
" />
		<input type="hidden" name="user_login" id="user_login" value="<?php 
        echo esc_attr($username);
        ?>
" />
		<p id="user_email_p">
			<label for="user_email"><?php 
        _e("E-mail");
        ?>
 </label><input type="hidden" name="user_email" id="user_email" value="<?php 
        echo esc_attr($user_email);
        ?>
" /><?php 
        echo esc_html($user_email);
        ?>
		</p>
		<br />
<?php 
    }
    // do first the WP fields then the EXTRA fields
    while ($i <= 2) {
        if ($i == 1) {
            $fields = $wp_fields;
            $prefix = $wp_fields_name_prefix;
        } else {
            $fields = $extra_fields;
            $prefix = $fields_name_prefix;
            $current_fieldset = -1;
            if (!empty($options['fieldset_title'])) {
                $fieldset_titles = explode(',', $options['fieldset_title']);
            } else {
                $fieldset_titles = array();
            }
        }
        $tiny_mce_objects = "";
        foreach ($fields as $thisField) {
            $field_id = $thisField['ID'];
            $name = $thisField['NAME'];
            $rules = $thisField['RULES'];
            $type = $thisField['TYPE'];
            $old_type = $type;
            $label = cimy_wpml_translate_string($name . "_label", $thisField["LABEL"]);
            $description = cimy_uef_sanitize_content(cimy_wpml_translate_string($name . "_desc", $thisField["DESCRIPTION"]));
            $fieldset = empty($thisField['FIELDSET']) ? 0 : $thisField['FIELDSET'];
            $maxlen = 0;
            $unique_id = $prefix . $field_id;
            $input_name = $prefix . esc_attr($name);
            $field_id_data = $input_name . "_" . $field_id . "_data";
            $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
            // do not dupe username
            if ($i == 1 && $name == "USERNAME") {
                continue;
            }
            // showing the search then there is no need for upload buttons
            if ($show_type == 1) {
                if ($type == "password") {
                    continue;
                }
                if (in_array($type, $cimy_uef_file_types)) {
                    $type = "text";
                }
            } else {
                if ($show_type == 2) {
                    $type = "hidden";
                }
            }
            // if the current user LOGGED IN has not enough permissions to see the field, skip it
            if ($rules['show_level'] == 'view_cimy_extra_fields') {
                if (!current_user_can($rules['show_level'])) {
                    continue;
                }
            } else {
                if ($my_user_level < $rules['show_level']) {
                    continue;
                }
            }
            // if show_level == anonymous then do NOT ovverride other show_xyz rules
            if ($rules['show_level'] == -1) {
                if ($show_type == 0 || $show_type == 2) {
                    // if flag to show the field in the registration is NOT activated, skip it
                    if (!$rules['show_in_reg']) {
                        continue;
                    }
                } else {
                    if ($show_type == 1) {
                        // if flag to show the field in the blog is NOT activated, skip it
                        if (!$rules['show_in_search']) {
                            continue;
                        }
                    }
                }
            }
            // uploading a file is not supported when confirmation email is enabled (on MS is turned on by default yes)
            if ((is_multisite() || $options["confirm_email"]) && in_array($type, $cimy_uef_file_types)) {
                continue;
            }
            if (isset($_POST[$input_name])) {
                if ($type == "dropdown-multi" || $old_type == "dropdown-multi") {
                    $value = stripslashes(implode(",", $_POST[$input_name]));
                } else {
                    $value = stripslashes($_POST[$input_name]);
                }
            } else {
                if (isset($_GET[$name])) {
                    if ($type == "dropdown-multi" || $old_type == "dropdown-multi") {
                        $value = stripslashes(implode(",", $_GET[$name]));
                    } else {
                        $value = stripslashes($_GET[$name]);
                    }
                } else {
                    if (!isset($_POST["cimy_post"])) {
                        $value = $thisField['VALUE'];
                        switch ($type) {
                            case "radio":
                                if ($value == "YES") {
                                    $value = $field_id;
                                } else {
                                    $value = "";
                                }
                                break;
                            case "checkbox":
                                if ($value == "YES") {
                                    $value = "1";
                                } else {
                                    $value = "";
                                }
                                break;
                        }
                    } else {
                        $value = "";
                    }
                }
            }
            if ($i != 1 && $fieldset > $current_fieldset && isset($fieldset_titles[$fieldset])) {
                $current_fieldset = $fieldset;
                if (isset($fieldset_titles[$current_fieldset])) {
                    echo "\n\t<h2>" . esc_html(cimy_wpml_translate_string("a_opt_fieldset_title_" . $current_fieldset, $fieldset_titles[$current_fieldset])) . "</h2>\n";
                }
            }
            if (!empty($description) && $type != "registration-date") {
                echo "\t";
                echo '<p id="' . $prefix . 'p_desc_' . $field_id . '" class="description"><br />' . $description . '</p>';
                echo "\n";
            }
            echo "\t";
            echo '<p id="' . $prefix . 'p_field_' . $field_id . '">';
            echo "\n\t";
            $obj_class = "";
            switch ($type) {
                case "date":
                    $obj_class = " datepicker";
                case "picture-url":
                case "password":
                case "text":
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="' . $input_class . $obj_class . '"';
                    $obj_name = ' name="' . $input_name . '"';
                    if (in_array($type, $cimy_uef_text_types)) {
                        $obj_type = ' type="text"';
                    } else {
                        $obj_type = ' type="' . $type . '"';
                    }
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_value2 = "";
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "dropdown":
                case "dropdown-multi":
                    // cimy_dropDownOptions uses cimy_uef_sanitize_content and esc_attr by itself
                    $ret = cimy_dropDownOptions($label, $value);
                    $label = $ret['label'];
                    $html = $ret['html'];
                    if ($type == "dropdown-multi") {
                        $obj_name = ' name="' . $input_name . '[]" multiple="multiple" size="6"';
                    } else {
                        $obj_name = ' name="' . $input_name . '"';
                    }
                    $obj_label = '<label for="' . $unique_id . '">' . $label . '</label>';
                    $obj_class = ' class="' . $input_class . '"';
                    $obj_type = '';
                    $obj_value = '';
                    $obj_value2 = $html;
                    $obj_checked = "";
                    $obj_tag = "select";
                    $obj_closing_tag = true;
                    break;
                case "textarea":
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="' . $input_class . '"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = "";
                    $obj_value = "";
                    $obj_value2 = esc_html($value);
                    $obj_checked = "";
                    $obj_tag = "textarea";
                    $obj_closing_tag = true;
                    break;
                case "textarea-rich":
                    if (empty($tiny_mce_objects)) {
                        $tiny_mce_objects = $fields_name_prefix . $field_id;
                    } else {
                        $tiny_mce_objects .= "," . $fields_name_prefix . $field_id;
                    }
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="' . $input_class . '"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = "";
                    $obj_value = "";
                    $obj_value2 = esc_html($value);
                    $obj_checked = "";
                    $obj_tag = "textarea";
                    $obj_closing_tag = true;
                    break;
                case "checkbox":
                    $obj_label = '<label class="cimy_uef_label_checkbox" for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label><br />';
                    $obj_class = ' class="cimy_uef_checkbox"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="' . $type . '"';
                    $obj_value = ' value="1"';
                    $obj_value2 = "";
                    $value == "1" ? $obj_checked = ' checked="checked"' : ($obj_checked = '');
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "radio":
                    $obj_label = '<label class="cimy_uef_label_radio" for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="cimy_uef_radio"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="' . $type . '"';
                    $obj_value = ' value="' . $field_id . '"';
                    $obj_value2 = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    // do not check if another check was done
                    if (intval($value) == intval($field_id) && !in_array($name, $radio_checked)) {
                        $obj_checked = ' checked="checked"';
                        $radio_checked += array($name => true);
                    } else {
                        $obj_checked = '';
                    }
                    break;
                case "avatar":
                case "picture":
                case "file":
                    $allowed_exts = '';
                    if (isset($rules['equal_to'])) {
                        if ($rules['equal_to'] != "") {
                            $allowed_exts = "'" . implode("', '", explode(",", $rules['equal_to'])) . "'";
                        }
                    }
                    if ($type == "file") {
                        // if we do not escape then some translations can break
                        $warning_msg = esc_js(__("Please upload a file with one of the following extensions", $cimy_uef_domain));
                        $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"';
                    } else {
                        // if we do not escape then some translations can break
                        $warning_msg = esc_js(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
                        $allowed_exts = "'" . implode("','", cimy_uef_get_allowed_image_extensions()) . "'";
                        $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"';
                    }
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . ' </label>';
                    $obj_class = ' class="cimy_uef_picture"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="file"';
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_value2 = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "hidden":
                    $obj_label = "";
                    $obj_value2 = "";
                    switch ($old_type) {
                        case 'checkbox':
                            $value == 1 ? $obj_value2 = __("YES", $cimy_uef_domain) : ($obj_value2 = __("NO", $cimy_uef_domain));
                            break;
                        case 'radio':
                            intval($value) == intval($field_id) ? $obj_value2 = __("YES", $cimy_uef_domain) : ($obj_value2 = __("NO", $cimy_uef_domain));
                            break;
                        case 'dropdown':
                        case 'dropdown-multi':
                            $ret = cimy_dropDownOptions($label, $value);
                            $label = $ret['label'];
                            break;
                        case 'picture':
                        case 'avatar':
                        case 'file':
                            if ($old_type == "avatar") {
                                // since avatars are drawn max to 512px then we can save bandwith resizing, do it!
                                $rules['equal_to'] = 512;
                            }
                            $value = cimy_manage_upload($input_name, $temp_user_login, $rules, false, false, $old_type, !empty($advanced_options["filename"]) ? $advanced_options["filename"] : "");
                            $file_on_server = cimy_uef_get_dir_or_filename($temp_user_login, $value, false);
                            $file_thumb = cimy_uef_get_dir_or_filename($temp_user_login, $value, true);
                            if (!empty($advanced_options["no-thumb"]) && is_file($file_thumb)) {
                                rename($file_thumb, $file_on_server);
                            }
                            // yea little trick
                            empty($value) ? $obj_value2 = "&nbsp;" : ($obj_value2 = esc_html(basename($value)));
                            break;
                    }
                    if ($old_type != "password") {
                        $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . ' </label>';
                        if (empty($obj_value2)) {
                            $obj_value2 = cimy_uef_sanitize_content($value);
                        }
                    }
                    $obj_class = '';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="hidden"';
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "registration-date":
                    $obj_label = '';
                    $obj_class = '';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="hidden"';
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_value2 = "";
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
            }
            $obj_id = ' id="' . $unique_id . '"';
            // tabindex not used in MU, WordPress 3.5+ and Theme My Login dropping...
            if (is_multisite() || cimy_is_at_least_wordpress35() || cimy_uef_is_theme_my_login_register_page()) {
                $obj_tabindex = "";
            } else {
                $obj_tabindex = ' tabindex="' . strval($tabindex) . '"';
                $tabindex++;
            }
            $obj_maxlen = "";
            if (in_array($type, $rule_maxlen_needed) && !in_array($type, $cimy_uef_file_types)) {
                if (isset($rules['max_length'])) {
                    $obj_maxlen = ' maxlength="' . $rules['max_length'] . '"';
                } else {
                    if (isset($rules['exact_length'])) {
                        $obj_maxlen = ' maxlength="' . $rules['exact_length'] . '"';
                    }
                }
            }
            if (in_array($type, $cimy_uef_textarea_types)) {
                $obj_rowscols = ' rows="3" cols="25"';
            } else {
                $obj_rowscols = '';
            }
            echo "\t";
            $form_object = '<' . $obj_tag . $obj_type . $obj_name . $obj_id . $obj_class . $obj_value . $obj_checked . $obj_maxlen . $obj_rowscols . $obj_tabindex;
            if ($obj_closing_tag) {
                $form_object .= ">" . $obj_value2 . "</" . $obj_tag . ">";
            } else {
                if ($type == "hidden") {
                    $form_object .= " />" . $obj_value2;
                    if (in_array($old_type, $cimy_uef_file_types)) {
                        $f_size = empty($_FILES[$input_name]['size']) ? 0 : $_FILES[$input_name]['size'];
                        $f_type = empty($_FILES[$input_name]['type']) ? "" : $_FILES[$input_name]['type'];
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_size\" id=\"" . esc_attr($field_id_data) . "_size\" value=\"" . esc_attr(strval($f_size / 1024)) . "\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_type\" id=\"" . esc_attr($field_id_data) . "_type\" value=\"" . esc_attr(strval($f_type)) . "\" />";
                    }
                    if (in_array($old_type, $cimy_uef_file_images_types) && is_file($file_on_server)) {
                        echo '<img id="' . esc_attr($field_id_data) . '" src="' . esc_attr($value) . '" alt="picture" /><br />';
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_button\" id=\"" . esc_attr($field_id_data) . "_button\" value=\"1\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_x1\" id=\"" . esc_attr($field_id_data) . "_x1\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_y1\" id=\"" . esc_attr($field_id_data) . "_y1\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_x2\" id=\"" . esc_attr($field_id_data) . "_x2\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_y2\" id=\"" . esc_attr($field_id_data) . "_y2\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_w\" id=\"" . esc_attr($field_id_data) . "_w\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_h\" id=\"" . esc_attr($field_id_data) . "_h\" value=\"\" />";
                        $imgarea_options = "handles: true, fadeSpeed: 200, onSelectChange: preview";
                        if (isset($advanced_options["crop_x1"]) && isset($advanced_options["crop_y1"]) && isset($advanced_options["crop_x2"]) && isset($advanced_options["crop_y2"])) {
                            $imgarea_options .= ", x1: " . intval($advanced_options["crop_x1"]);
                            $imgarea_options .= ", y1: " . intval($advanced_options["crop_y1"]);
                            $imgarea_options .= ", x2: " . intval($advanced_options["crop_x2"]);
                            $imgarea_options .= ", y2: " . intval($advanced_options["crop_y2"]);
                        }
                        if (!empty($advanced_options["crop_ratio"])) {
                            $imgarea_options .= ", aspectRatio: '" . esc_js($advanced_options["crop_ratio"]) . "'";
                        } else {
                            if ($type == "avatar") {
                                $imgarea_options .= ", aspectRatio: '1:1'";
                            }
                        }
                        echo "<script type='text/javascript'>jQuery(document).ready(function () { jQuery('#" . esc_js($field_id_data) . "').imgAreaSelect({ " . $imgarea_options . " }); });</script>";
                    }
                } else {
                    $form_object .= " />";
                }
            }
            if ($type != "radio" && $type != "checkbox") {
                echo $obj_label;
            }
            if (is_multisite() && is_wp_error($errors)) {
                if ($errmsg = $errors->get_error_message($unique_id)) {
                    echo '<p class="error">' . $errmsg . '</p>';
                }
            }
            // TinceMCE needed and we have WordPress >= 3.3 yummy!
            if ($type == "textarea-rich" && function_exists("wp_editor")) {
                ?>
				<script type='text/javascript'>
					var login_div = document.getElementById("login");
					login_div.style.width = "535px";
				</script>
		<?php 
                $quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close');
                $editor_settings = array('textarea_name' => $input_name, 'teeny' => false, 'textarea_rows' => '10', 'dfw' => false, 'media_buttons' => true, 'tinymce' => true, 'quicktags' => $quicktags_settings);
                if (!empty($obj_tabindex)) {
                    $editor_settings['tabindex'] = $tabindex;
                }
                wp_editor($value, $unique_id, $editor_settings);
            } else {
                echo $form_object;
            }
            if ($type == "date") {
                echo cimy_uef_date_picker_options($unique_id, $rules);
            }
            if ($show_type == 0 && $i == 1 && $options['password_meter']) {
                if ($input_name == $prefix . "PASSWORD") {
                    $pass1_id = $unique_id;
                }
                if ($input_name == $prefix . "PASSWORD2") {
                    echo "\n\t\t<div id=\"pass-strength-result\" class=\"hide-if-no-js\" aria-live=\"polite\">" . __('Strength indicator') . "</div>";
                    echo "\n\t\t<p class=\"description indicator-hint\">" . __('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).') . "</p><br />";
                    $pass2_id = $unique_id;
                }
            }
            if (!($type != "radio" && $type != "checkbox")) {
                echo $obj_label;
            }
            echo "\n\t</p>\n";
            if ($type == "textarea-rich" || in_array($type, $cimy_uef_file_types)) {
                echo "\t<br />\n";
            }
        }
        $i++;
    }
    echo "\t<br />";
    if ($show_type != 2 && $options['captcha'] == "securimage") {
        global $cuef_securimage_webpath;
        if (is_multisite()) {
            if (is_wp_error($errors) && ($errmsg = $errors->get_error_message("securimage_code"))) {
                echo '<p class="error">' . $errmsg . '</p>';
            }
        }
        require_once $cuef_plugin_dir . '/securimage/securimage.php';
        $captcha_options = array();
        $captcha_options['image_id'] = 'captcha';
        $captcha_options['input_name'] = 'securimage_response_field';
        $captcha_options['input_text'] = __("Insert the code:", $cimy_uef_domain);
        $captcha_options['refresh_alt_text'] = __("Change image", $cimy_uef_domain);
        $captcha_options['refresh_title_text'] = __("Change image", $cimy_uef_domain);
        $captcha_options['show_audio_button'] = true;
        $captcha_options['show_refresh_button'] = true;
        echo Securimage::getCaptchaHtml($captcha_options);
    }
    if ($show_type != 2) {
        if (is_multisite() && is_wp_error($errors) && ($errmsg = $errors->get_error_message("recaptcha_code"))) {
            echo '<p class="error">' . $errmsg . '</p>';
        }
        if ($options['captcha'] == "recaptcha2" && !empty($options['recaptcha2_site_key']) && !empty($options['recaptcha2_secret_key'])) {
            ?>
			<div class="g-recaptcha" 
				data-sitekey="<?php 
            echo esc_attr($options['recaptcha2_site_key']);
            ?>
" 
				<?php 
            if (!empty($obj_tabindex)) {
                echo "data-tabindex=" . $tabindex;
            }
            $tabindex++;
            ?>
				data-size="compact"
				>
			</div>
<?php 
        }
        if ($options['captcha'] == "recaptcha" && !empty($options['recaptcha_public_key']) && !empty($options['recaptcha_private_key'])) {
            require_once $cuef_plugin_dir . '/recaptcha/recaptchalib.php';
            ?>
			<script type='text/javascript'>
				var RecaptchaOptions = {
					lang: '<?php 
            echo substr(get_locale(), 0, 2);
            ?>
'
					<?php 
            if (!empty($obj_tabindex)) {
                echo ", tabindex: " . $tabindex;
            }
            $tabindex++;
            ?>
				};
			</script>
<?php 
            // no need if Tiny MCE is present already
            if (empty($tiny_mce_objects)) {
                ?>
			<script type='text/javascript'>
				var login_div = document.getElementById("login");
				login_div.style.width = "375px";
			</script>
<?php 
            }
            echo recaptcha_get_html($options['recaptcha_public_key'], null, is_ssl());
        }
    }
    cimy_switch_current_blog(true);
    echo $end_cimy_uef_comment;
}
Ejemplo n.º 3
0
function wpbilbao_page_author_do_loop()
{
    // Check that the page is author page
    if (!is_author()) {
        return;
    }
    // Assign Query Object to $miembro var
    if (get_query_var('author')) {
        global $wp_query;
        $miembro = $wp_query->get_queried_object();
    }
    // Assign the $miembro ID to $miembro_id var to let us get the rest info of the $miembro
    $miembro_id = $miembro->ID;
    /*
     * We assign the $miembro fields to different variables
     * get_cimyFieldValue lets us get the field of the "Cimy User Extra Fields" Plugin
     *
     * We have to pass the $miembro_id to get the information
     * Then we pass the field name to get it
     */
    $miembro_imagen = get_cimyFieldValue($miembro_id, 'IMAGEN');
    $miembro_nombre = get_the_author();
    $miembro_email = get_cimyFieldValue($miembro_id, 'EMAIL');
    $miembro_telefono = get_cimyFieldValue($miembro_id, 'TELEFONO');
    $miembro_web = get_cimyFieldValue($miembro_id, 'PAGINA-WEB');
    $miembro_twitter = get_cimyFieldValue($miembro_id, 'TWITTER');
    $miembro_linkedin = get_cimyFieldValue($miembro_id, 'LINKEDIN');
    $miembro_facebook = get_cimyFieldValue($miembro_id, 'FACEBOOK');
    $miembro_google = get_cimyFieldValue($miembro_id, 'GOOGLEPLUS');
    $miembro_descripcion = get_cimyFieldValue($miembro_id, 'DESCRIPCION');
    $miembro_deskribapena = get_cimyFieldValue($miembro_id, 'DESKRIBAPENA');
    // Assign language locale, the 'locale' parameter is optional
    $polylangSlug = pll_current_language('locale');
    ?>

  <div class="entry">
    <div class="row">

      <?php 
    /*
     * Check that the $miembro_descripcion it's not empty - Line 83
     *
     * If has content, then we show it - Line 85
     * If hasn't got content, then we show the "else :" content - Line 216
     */
    if ($miembro_descripcion) {
        ?>

        <div class="perfil col-xs-12 col-sm-3">

          <?php 
        if ($miembro_imagen) {
            ?>
            <img src="<?php 
            echo $miembro_imagen;
            ?>
"
                 alt="<?php 
            echo esc_html(cimy_uef_sanitize_content($miembro_nombre));
            ?>
"/>
          <?php 
        }
        ?>

          <?php 
        if ($miembro_nombre) {
            ?>
            <h1><?php 
            echo esc_html(cimy_uef_sanitize_content($miembro_nombre));
            ?>
</h1>
          <?php 
        }
        ?>

          <?php 
        /*
         * Check if the viewer it's a logued in user - Line 103
         *
         * If logged in, we show him the 'real button' - Line 105
         * If not logged in, we show the 'false button'. This button shows the Modal - Line 112
         */
        if (is_user_logged_in()) {
            ?>

            <a class="btn btn-primario" role="button" data-toggle="collapse" href=".collapseDatos" aria-expanded="false" aria-controls="collapseDatos">
              <?php 
            _e('Ver datos de contacto', 'wpbilbao');
            ?>
            </a>

          <?php 
        } else {
            ?>
            <!-- Botón del Modal -->
            <div class="text-center">
              <a class="btn btn-primario" role="button" data-toggle="modal" data-target="#noUsuario">
                <?php 
            _e('Ver datos de contacto', 'wpbilbao');
            ?>
              </a>
            </div>

            <!-- Modal -->
            <div class="modal fade" id="noUsuario" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
              <div class="modal-dialog" role="document">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Cerrar"><span
                        aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel"><?php 
            _e('Hazte miembro', 'wpbilbao');
            ?>
</h4>
                  </div>
                  <div class="modal-body">
                    <p><?php 
            _e('Para poder ver los datos de contacto de los miembros tienes que ser miembro.', 'wpbilbao');
            ?>
</p>

                    <p><?php 
            _e('Ser miembro es <strong>totalmente gratuito</strong> y podrás contar con tu propio perfil.', 'wpbilbao');
            ?>
</p>

                    <p><?php 
            _e('Iremos añadiendo nuevas características para los miembros.', 'wpbilbao');
            ?>
</p>

                    <p class="text-center">
                      <strong><?php 
            _e('¡Crea tu perfil ahora en menos de 5 minutos!', 'wpbilbao');
            ?>
</strong></p>
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><?php 
            _e('Cerrar', 'wpbilbao');
            ?>
</button>
                    <a href="<?php 
            echo site_url();
            ?>
/wp-login.php" type="button" class="btn btn-primary" title="<?php 
            _e('Entrar', 'wpbilbao');
            ?>
"><?php 
            _e('Entrar', 'wpbilbao');
            ?>
</a>
                    <a href="<?php 
            echo site_url();
            ?>
/wp-login.php?action=register" type="button" class="btn btn-primario" title="<?php 
            _e('Hacerse miembro', 'wpbilbao');
            ?>
"><?php 
            _e('Hacerse miembro', 'wpbilbao');
            ?>
</a>
                  </div> <!-- .modal-footer -->
                </div> <!-- .modal-content -->
              </div> <!-- .modal-dialog -->
            </div><!-- #noUsuario -->
          <?php 
        }
        ?>
        </div><!-- .perfil -->

        <div class="descripcion col-xs-12 col-sm-8">
          <?php 
        if ($polylangSlug != 'eu') {
            ?>
              <?php 
            if ($miembro_descripcion) {
                ?>
                <?php 
                echo $miembro_descripcion;
                ?>
              <?php 
            }
            ?>
          <?php 
        } else {
            ?>
              <?php 
            if ($miembro_deskribapena) {
                ?>
                <?php 
                echo $miembro_deskribapena;
                ?>
              <?php 
            }
            ?>
          <?php 
        }
        ?>

          <div class="collapse collapseDatos">
            <ul>
              <?php 
        if ($miembro_email) {
            ?>
                <li class="text-right"><i class="fa fa-envelope"></i>
                  <a href="mailto:<?php 
            echo esc_html($miembro_email);
            ?>
" title="<?php 
            _e('Enviar correo electrónico', 'wpbilbao');
            ?>
" target="_blank"><?php 
            echo esc_html($miembro_email);
            ?>
</a>
                </li>
              <?php 
        }
        ?>

              <?php 
        if ($miembro_telefono) {
            ?>
                <?php 
            $caracteres = array("+", " ");
            ?>
                <?php 
            $miembro_telefono_formatted = str_replace($caracteres, "", $miembro_telefono);
            ?>
                <li class="text-right"><i class="fa fa-phone"></i>
                  <a href="tel:<?php 
            echo esc_html($miembro_telefono_formatted);
            ?>
" title="<?php 
            _e('Llamar por teléfono', 'wpbilbao');
            ?>
">
                    <?php 
            echo esc_html($miembro_telefono);
            ?>
                  </a>
                </li>
              <?php 
        }
        ?>
              <ul>
          </div><!-- #collapseDatos -->
        </div><!-- .descripcion -->

        <div class="redes-sociales col-xs-12 col-sm-1">
          <div class="collapse collapseDatos">
            <ul>
              <?php 
        if ($miembro_web) {
            ?>
                <li><a href="<?php 
            echo esc_html($miembro_web);
            ?>
" title="<?php 
            _e('Visitar página web', 'wpbilbao');
            ?>
"
                       target="_blank"><i class="fa fa-globe"></i></a>
                </li>
              <?php 
        }
        ?>

              <?php 
        if ($miembro_twitter) {
            ?>
                <li><a href="<?php 
            echo esc_html($miembro_twitter);
            ?>
" title="<?php 
            _e('Visitar Twitter', 'wpbilbao');
            ?>
"
                       target="_blank"><i class="fa fa-twitter"></i>
                  </a>
                </li>
              <?php 
        }
        ?>

              <?php 
        if ($miembro_linkedin) {
            ?>
                <li><a href="<?php 
            echo esc_html($miembro_linkedin);
            ?>
" title="<?php 
            _e('Visitar Linkedin', 'wpbilbao');
            ?>
"
                       target="_blank"><i class="fa fa-linkedin"></i></a>
                </li>
              <?php 
        }
        ?>

              <?php 
        if ($miembro_facebook) {
            ?>
                <li><a href="<?php 
            echo esc_html($miembro_facebook);
            ?>
" title="<?php 
            _e('Visitar Facebook', 'wpbilbao');
            ?>
"
                       target="_blank"><i class="fa fa-facebook"></i></a>
                </li>
              <?php 
        }
        ?>

              <?php 
        if ($miembro_google) {
            ?>
                <li><a href="<?php 
            echo esc_html($miembro_google);
            ?>
" title="<?php 
            _e('Visitar Google', 'wpbilbao');
            ?>
"
                       target="_blank"><i class="fa fa-google"></i></a>
                </li>
              <?php 
        }
        ?>
            </ul>
          </div><!-- .collapseDatos -->
        </div><!-- .redes-sociales -->

      <?php 
    } else {
        ?>
        <h2 class="text-center"><?php 
        _e('Aún no hay contenido de este miembro', 'wpbilbao');
        ?>
</h2>
      <?php 
    }
    ?>

      <?php 
    wp_reset_query();
    ?>

    </div><!-- .row -->

    <?php 
    do_action('genesis_entry_footer');
    ?>

  </div><!-- .entry -->

  <?php 
    do_action('genesis_after_entry');
    ?>

  <?php 
}
Ejemplo n.º 4
0
function cimy_extract_ExtraFields()
{
    global $wpdb, $user_ID, $wpdb_data_table, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_profile_value, $cimy_uef_options, $rule_maxlen_needed, $fields_name_prefix, $cuef_upload_path, $cimy_uef_domain, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types, $user_level;
    // if editing a different user (only admin)
    if (isset($_GET['user_id'])) {
        $get_user_id = $_GET['user_id'];
        if (!current_user_can('edit_user', $get_user_id)) {
            return;
        }
    } else {
        if (isset($_POST['user_id'])) {
            $get_user_id = $_POST['user_id'];
            if (!current_user_can('edit_user', $get_user_id)) {
                return;
            }
        } else {
            if (!isset($user_ID)) {
                return;
            }
            $get_user_id = $user_ID;
        }
    }
    $get_user_id = intval($get_user_id);
    $options = cimy_get_options();
    $extra_fields = get_cimyFields(false, true);
    if (cimy_uef_is_multisite_per_blog_installation()) {
        echo "<input type=\"hidden\" name=\"from_blog_id\" value=\"" . strval(get_current_blog_id()) . "\" />\n";
    }
    if (!empty($extra_fields)) {
        $upload_image_function = false;
        echo $start_cimy_uef_comment;
        if ($options['extra_fields_title'] != "") {
            echo "<br clear=\"all\" />\n";
            echo "<h2>" . esc_html(cimy_wpml_translate_string("a_opt_extra_fields_title", $options['extra_fields_title'])) . "</h2>\n";
        }
        foreach ($extra_fields as $thisField) {
            $field_id = $thisField['ID'];
            cimy_insert_ExtraFields_if_not_exist($get_user_id, $field_id);
        }
        // 		$ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$get_user_id, ARRAY_A);
        $radio_checked = array();
        $current_fieldset = -1;
        $tiny_mce_objects = "";
        if (!empty($options['fieldset_title'])) {
            $fieldset_titles = explode(',', $options['fieldset_title']);
        } else {
            $fieldset_titles = array();
        }
        $close_table = false;
        echo '<table class="form-table">';
        echo "\n";
        foreach ($extra_fields as $thisField) {
            $value = "";
            $old_value = "";
            $field_id = $thisField['ID'];
            $name = $thisField['NAME'];
            $rules = $thisField['RULES'];
            $type = $thisField['TYPE'];
            $label = cimy_wpml_translate_string($name . "_label", $thisField["LABEL"]);
            $description = cimy_uef_sanitize_content(cimy_wpml_translate_string($name . "_desc", $thisField["DESCRIPTION"]));
            $fieldset = $thisField['FIELDSET'];
            $unique_id = $fields_name_prefix . $field_id;
            $input_name = $fields_name_prefix . esc_attr($name);
            $field_id_data = $input_name . "_" . $field_id . "_data";
            $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
            // if the current user LOGGED IN has not enough permissions to see the field, skip it
            // apply only for EXTRA FIELDS
            if ($rules['show_level'] == 'view_cimy_extra_fields') {
                if (!current_user_can($rules['show_level'])) {
                    continue;
                }
            } else {
                if ($user_level < $rules['show_level']) {
                    continue;
                }
            }
            // if show_level == anonymous then do NOT ovverride other show_xyz rules
            if ($rules['show_level'] == -1) {
                // if flag to show the field in the profile is NOT activated, skip it
                if (!$rules['show_in_profile']) {
                    continue;
                }
            }
            // 			foreach ($ef_db as $d_field) {
            // 				if ($d_field['FIELD_ID'] == $field_id)
            // 					$value = $d_field['VALUE'];
            // 			}
            $value = $wpdb->get_var($wpdb->prepare("SELECT VALUE FROM " . $wpdb_data_table . " WHERE USER_ID=%d AND FIELD_ID=%d", $get_user_id, $field_id));
            $old_value = $value;
            if ($type == "radio" && empty($radio_checked[$name])) {
                $radio_checked[$name] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb_data_table . " WHERE USER_ID=%d AND FIELD_ID=%d AND VALUE=\"selected\"", $get_user_id, $field_id));
            }
            // if nothing is inserted and field admin default value then assign it
            if (in_array($type, $rule_profile_value)) {
                if (empty($value)) {
                    $value = $thisField['VALUE'];
                }
            }
            if ($fieldset > $current_fieldset && isset($fieldset_titles[$fieldset])) {
                $current_fieldset = $fieldset;
                // do not close the table if it is the first iteration
                if ($close_table) {
                    echo "</table>\n";
                } else {
                    $close_table = true;
                }
                if (isset($fieldset_titles[$current_fieldset])) {
                    echo "\n\t<h3>" . esc_html(cimy_wpml_translate_string("a_opt_fieldset_title_" . $current_fieldset, $fieldset_titles[$current_fieldset])) . "</h3>\n";
                }
                echo '<table class="form-table">';
                echo "\n";
            }
            echo "\t";
            echo "<tr>";
            echo "\n\t";
            // if you use it you need to escape it!
            $non_escaped_value = $value;
            $value = esc_attr($value);
            $old_value = esc_attr($old_value);
            $obj_class = '';
            if ($rules['can_be_empty']) {
                $required = '';
            } else {
                $required = ' <span class="description">' . __("(required)") . '</span>';
            }
            switch ($type) {
                case "picture-url":
                case "password":
                case "text":
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>';
                    $obj_name = ' name="' . $input_name . '"';
                    if ($type == "picture-url") {
                        $obj_type = ' type="text"';
                    } else {
                        $obj_type = ' type="' . $type . '"';
                    }
                    $obj_value = ' value="' . $value . '"';
                    $obj_value2 = "";
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    $obj_style = ' class="regular-text"';
                    if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) {
                        $obj_disabled = ' disabled="disabled"';
                    } else {
                        $obj_disabled = "";
                    }
                    break;
                case "textarea":
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = "";
                    $obj_value = "";
                    $obj_value2 = $value;
                    $obj_checked = "";
                    $obj_tag = "textarea";
                    $obj_closing_tag = true;
                    $obj_style = "";
                    $obj_class = ' class="cimy_uef_textarea"';
                    if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) {
                        $obj_disabled = ' disabled="disabled"';
                    } else {
                        $obj_disabled = "";
                    }
                    break;
                case "textarea-rich":
                    if ($tiny_mce_objects == "") {
                        $tiny_mce_objects = $unique_id;
                    } else {
                        $tiny_mce_objects .= "," . $unique_id;
                    }
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = "";
                    $obj_value = "";
                    $obj_value2 = $value;
                    $obj_checked = "";
                    $obj_tag = "textarea";
                    $obj_closing_tag = true;
                    $obj_style = "";
                    $obj_class = ' class="cimy_uef_textarea"';
                    if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) {
                        $obj_disabled = ' disabled="disabled"';
                    } else {
                        $obj_disabled = "";
                    }
                    break;
                case "dropdown-multi":
                case "dropdown":
                    // cimy_dropDownOptions uses cimy_uef_sanitize_content and esc_attr by itself
                    $ret = cimy_dropDownOptions($label, $non_escaped_value);
                    $label = $ret['label'];
                    $html = $ret['html'];
                    $obj_label = '<label for="' . $unique_id . '">' . $label . $required . '</label>';
                    if ($type == "dropdown-multi") {
                        $obj_name = ' name="' . $input_name . '[]" multiple="multiple" size="5"';
                        $obj_style = ' style="height: 11em;"';
                    } else {
                        $obj_name = ' name="' . $input_name . '"';
                        $obj_style = '';
                    }
                    $obj_type = '';
                    $obj_value = '';
                    $obj_value2 = $html;
                    $obj_checked = "";
                    $obj_tag = "select";
                    $obj_closing_tag = true;
                    if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) {
                        $obj_disabled = ' disabled="disabled"';
                    } else {
                        $obj_disabled = "";
                    }
                    break;
                case "checkbox":
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="' . $type . '"';
                    $obj_value = ' value="1"';
                    $obj_value2 = "";
                    $value == "YES" ? $obj_checked = ' checked="checked"' : ($obj_checked = '');
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    $obj_style = ' style="width:auto; border:0; background:white;"';
                    if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) {
                        $obj_disabled = ' disabled="disabled"';
                    } else {
                        $obj_disabled = "";
                    }
                    break;
                case "radio":
                    $obj_label = '<label for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="' . $type . '"';
                    $obj_value = ' value="' . $field_id . '"';
                    $obj_value2 = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    $obj_style = ' style="width:auto; border:0; background:white;"';
                    if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) {
                        $obj_disabled = ' disabled="disabled"';
                    } else {
                        $obj_disabled = "";
                    }
                    if ($value == "selected" || $value == "YES" && $radio_checked[$name] == 0) {
                        $radio_checked[$name] = 1;
                        $obj_checked = ' checked="checked"';
                    } else {
                        $obj_checked = '';
                    }
                    break;
                case "avatar":
                case "picture":
                case "file":
                    $allowed_exts = '';
                    if (isset($rules['equal_to'])) {
                        if (!empty($rules['equal_to'])) {
                            $allowed_exts = "'" . implode("', '", explode(",", $rules['equal_to'])) . "'";
                        }
                    }
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . $required . '</label>';
                    $obj_class = '';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="file"';
                    $obj_value = ' value=""';
                    $obj_value2 = '';
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    if ($type == "file") {
                        // if we do not escape then some translations can break
                        $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain));
                        $obj_style = ' onchange="uploadFile(\'your-profile\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"';
                    } else {
                        // if we do not escape then some translations can break
                        $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
                        $allowed_exts = "'" . implode("','", cimy_uef_get_allowed_image_extensions()) . "'";
                        $obj_style = ' onchange="uploadFile(\'your-profile\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"';
                    }
                    if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value)) {
                        $obj_disabled = ' disabled="disabled"';
                    } else {
                        $obj_disabled = "";
                    }
                    break;
                case "registration-date":
                    $value = cimy_get_registration_date($get_user_id, $value);
                    if (isset($rules['equal_to'])) {
                        $obj_value = cimy_get_formatted_date($value, $rules['equal_to']);
                    } else {
                        $obj_value = cimy_get_formatted_date($value);
                    }
                    $obj_label = '<label>' . cimy_uef_sanitize_content($label) . '</label>';
                    break;
            }
            $obj_id = ' id="' . $unique_id . '"';
            $obj_maxlen = "";
            if (in_array($type, $rule_maxlen_needed) && !in_array($type, $cimy_uef_file_types)) {
                if (isset($rules['max_length'])) {
                    $obj_maxlen = ' maxlength="' . $rules['max_length'] . '"';
                } else {
                    if (isset($rules['exact_length'])) {
                        $obj_maxlen = ' maxlength="' . $rules['exact_length'] . '"';
                    }
                }
            }
            if (in_array($type, $cimy_uef_textarea_types)) {
                $obj_rowscols = ' rows="3" cols="25"';
            } else {
                $obj_rowscols = '';
            }
            echo "\t";
            $form_object = '<' . $obj_tag . $obj_id . $obj_class . $obj_name . $obj_type . $obj_value . $obj_checked . $obj_maxlen . $obj_rowscols . $obj_style . $obj_disabled;
            if ($obj_closing_tag) {
                $form_object .= ">" . $obj_value2 . "</" . $obj_tag . ">";
            } else {
                $form_object .= " />";
            }
            echo "<th>";
            echo $obj_label;
            echo "</th>\n";
            echo "\t\t<td>";
            if (!empty($description) && ($type == "picture" || $type == "picture-url")) {
                echo "<span class='description'>" . $description . "</span><br />";
            }
            if (in_array($type, $cimy_uef_file_types)) {
                $profileuser = get_user_to_edit($get_user_id);
            }
            if ($type == "avatar") {
                $user_email = $profileuser->user_email;
                $img_avatar = get_avatar($user_email, $size = '128');
                $img_avatar = str_replace("<img", "<img id='{$field_id_data}'", $img_avatar);
                echo '<div id="profpic">' . $img_avatar . "</div>\n\t\t";
            }
            if (in_array($type, $cimy_uef_file_types) && !empty($value)) {
                $old_value = basename($old_value);
                $user_login = $profileuser->user_login;
                if ($type == "picture") {
                    $value_thumb = cimy_get_thumb_path($value);
                    $file_on_server = cimy_uef_get_dir_or_filename($user_login, $value, false);
                    $file_thumb = cimy_uef_get_dir_or_filename($user_login, $value, true);
                    if (!empty($advanced_options["no-thumb"]) && is_file($file_thumb)) {
                        rename($file_thumb, $file_on_server);
                    }
                    echo "\n\t\t";
                    if (is_file($file_thumb)) {
                        echo '<a target="_blank" href="' . $value . '"><img id="' . $field_id_data . '" src="' . $value_thumb . '" alt="picture" /></a><br />';
                        echo "\n\t\t";
                    } else {
                        if (is_file($file_on_server)) {
                            echo '<img id="' . $field_id_data . '" src="' . $value . '" alt="picture" /><br />';
                            echo "\n\t\t";
                        }
                    }
                }
                if ($type == "file") {
                    echo '<a target="_blank" href="' . $value . '">';
                    echo basename($value);
                    echo '</a><br />';
                    echo "\n\t\t";
                }
                // if there is no image or there is the default one then disable delete button
                if (empty($old_value)) {
                    $dis_delete_img = ' disabled="disabled"';
                } else {
                    // take the "can be modified" rule just set before
                    $dis_delete_img = $obj_disabled;
                    // 					echo '<input type="hidden" name="'.$input_name.'_oldfile" value="'.basename($value).'" />';
                    // 					echo "\n\t\t";
                }
                if (($type == "picture" || $type == "avatar") && (empty($rules["equal_to"]) || !empty($advanced_options["no-thumb"]))) {
                    echo "<input type=\"hidden\" name=\"" . $field_id_data . "_x1\" id=\"" . $field_id_data . "_x1\" value=\"\" />";
                    echo "<input type=\"hidden\" name=\"" . $field_id_data . "_y1\" id=\"" . $field_id_data . "_y1\" value=\"\" />";
                    echo "<input type=\"hidden\" name=\"" . $field_id_data . "_x2\" id=\"" . $field_id_data . "_x2\" value=\"\" />";
                    echo "<input type=\"hidden\" name=\"" . $field_id_data . "_y2\" id=\"" . $field_id_data . "_y2\" value=\"\" />";
                    echo "<input type=\"hidden\" name=\"" . $field_id_data . "_w\" id=\"" . $field_id_data . "_w\" value=\"\" />";
                    echo "<input type=\"hidden\" name=\"" . $field_id_data . "_h\" id=\"" . $field_id_data . "_h\" value=\"\" />";
                    // 					echo "<p class=\"submit\"><input type=\"submit\" name=\"".$field_id_data."_button\" class=\"button-primary\" value=\"".__("Edit Image")."\"  /></p>";
                    echo "<input type=\"hidden\" name=\"" . $field_id_data . "_button\" id=\"" . $field_id_data . "_button\" value=\"1\" />";
                    $imgarea_options = "handles: true, fadeSpeed: 200, onSelectChange: preview";
                    if (isset($advanced_options["crop_x1"]) && isset($advanced_options["crop_y1"]) && isset($advanced_options["crop_x2"]) && isset($advanced_options["crop_y2"])) {
                        $imgarea_options .= ", x1: " . intval($advanced_options["crop_x1"]);
                        $imgarea_options .= ", y1: " . intval($advanced_options["crop_y1"]);
                        $imgarea_options .= ", x2: " . intval($advanced_options["crop_x2"]);
                        $imgarea_options .= ", y2: " . intval($advanced_options["crop_y2"]);
                    }
                    if (!empty($advanced_options["crop_ratio"])) {
                        $imgarea_options .= ", aspectRatio: '" . esc_js($advanced_options["crop_ratio"]) . "'";
                    } else {
                        if ($type == "avatar") {
                            $imgarea_options .= ", aspectRatio: '1:1'";
                        }
                    }
                    echo "<script type='text/javascript'>jQuery(document).ready(function () { jQuery('#" . esc_js($field_id_data) . "').imgAreaSelect({ " . $imgarea_options . " }); });</script>";
                }
                echo '<input type="checkbox" name="' . $input_name . '_del" value="1" style="width:auto; border:0; background:white;"' . $dis_delete_img . ' />';
                if ($type == "file") {
                    echo " " . __("Delete the file", $cimy_uef_domain) . "<br /><br />";
                    echo "\n\t\t" . __("Update the file", $cimy_uef_domain) . "<br />";
                } else {
                    echo " " . __("Delete the picture", $cimy_uef_domain) . "<br /><br />";
                    echo "\n\t\t" . __("Update the picture", $cimy_uef_domain) . "<br />";
                }
                echo "\n\t\t";
            }
            if ($type == "picture-url") {
                if (!empty($value)) {
                    if (intval($rules['equal_to'])) {
                        echo '<a target="_blank" href="' . $value . '">';
                        echo '<img src="' . $value . '" alt="picture"' . $size . ' width="' . intval($rules['equal_to']) . '" height="*" />';
                        echo "</a>";
                    } else {
                        echo '<img src="' . $value . '" alt="picture" />';
                    }
                    echo "<br />";
                    echo "\n\t\t";
                }
                echo "<br />" . __("Picture URL:", $cimy_uef_domain) . "<br />\n\t\t";
            }
            // write previous value
            echo "<input type=\"hidden\" name=\"" . $input_name . "_" . $field_id . "_prev_value\" value=\"" . $old_value . "\" />\n\t\t";
            // TinceMCE needed and we have WordPress >= 3.3 yummy!
            if ($type == "textarea-rich" && function_exists("wp_editor")) {
                $quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close');
                $editor_settings = array('textarea_name' => $input_name, 'teeny' => false, 'textarea_rows' => '10', 'dfw' => false, 'media_buttons' => true, 'tinymce' => true, 'quicktags' => $quicktags_settings);
                wp_editor($non_escaped_value, $unique_id, $editor_settings);
            } else {
                if ($type != "registration-date") {
                    echo $form_object;
                } else {
                    echo $obj_value;
                }
            }
            if (!empty($description) && $type != "picture" && $type != "picture-url") {
                if ($type == "textarea" || $type == "textarea-rich") {
                    echo "<br />";
                } else {
                    echo " ";
                }
                echo "<span class='description'>" . $description . "</span>";
            }
            echo "</td>";
            echo "\n\t</tr>\n";
        }
        echo "</table>";
        // WP 3.2 or lower (N)
        if (!empty($tiny_mce_objects) && !function_exists("wp_editor")) {
            require_once $cuef_plugin_dir . '/cimy_uef_init_mce.php';
        }
        echo $end_cimy_uef_comment;
    }
}
Ejemplo n.º 5
0
function wpbilbao_page_author_related_members()
{
    $miembros = get_users();
    // Get random order of the members
    shuffle($miembros);
    echo '<div class="lista-miembros row">';
    echo '<h2>' . __('Otros Miembros', 'wpbilbao') . '</h2>';
    $i = 0;
    foreach ($miembros as $miembro) {
        $miembro_id = $miembro->ID;
        $miembro_imagen = get_cimyFieldValue($miembro_id, 'IMAGEN');
        $miembro_descripcion = get_cimyFieldValue($miembro_id, 'DESCRIPCION');
        // Show 6 members
        if ($i == 6) {
            break;
        }
        ?>

      <?php 
        if ($miembro_descripcion) {
            ?>

        <div class="miembro-lista col-xs-6 col-sm-2">
          <a href="<?php 
            echo get_author_posts_url($miembro_id);
            ?>
" title="<?php 
            printf(__('Pefil de %s', 'wpbilbao'), esc_html($miembro->display_name));
            ?>
">

            <?php 
            if ($miembro_imagen) {
                ?>
              <img src="<?php 
                echo cimy_uef_sanitize_content($miembro_imagen);
                ?>
" alt="<?php 
                echo esc_html($miembro->display_name);
                ?>
"/>
            <?php 
            } else {
                ?>
              <img src="<?php 
                echo get_bloginfo('stylesheet_directory');
                ?>
/images/miembros/wpbilbao-sin-foto.jpg" alt="<?php 
                echo esc_html($miembro->display_name);
                ?>
"/>
            <?php 
            }
            ?>

            <h3><?php 
            echo esc_html($miembro->display_name);
            ?>
</h3>
          </a>
        </div><!-- .miembro-lista -->

        <?php 
            $i++;
            ?>
      <?php 
        }
    }
    echo '<div class="clearfix"></div>';
    echo '<p>';
    echo '<a class="btn btn-primario" href="' . site_url() . '/miembros/" title="' . __('Ver todos los miembros', 'wpbilbao') . '">' . __('Ver todos los miembros', 'wpbilbao') . '</a>';
    echo '</p>';
    echo '</div><!-- .lista-miembros -->';
}
function cimy_dropDownOptions($values, $selected)
{
    $label_pos = strpos($values, "/");
    if ($label_pos) {
        $label = substr($values, 0, $label_pos);
        $values = substr($values, $label_pos + 1);
    } else {
        $label = "";
    }
    $items = explode(",", $values);
    $sel_items = explode(",", $selected);
    $html_options = "";
    $sel_i = 0;
    foreach ($items as $item) {
        $item_clean = trim($item, "\t\n\r");
        $html_options .= "\n\t\t\t";
        $html_options .= '<option value="' . esc_attr($item_clean) . '"';
        if (isset($sel_items[$sel_i])) {
            $is_selected = selected($item_clean, $sel_items[$sel_i], false);
            if (!empty($is_selected)) {
                $sel_i++;
                $html_options .= $is_selected;
            }
        }
        $html_options .= ">" . esc_html($item_clean) . "</option>";
    }
    $ret = array();
    $ret['html'] = $html_options;
    $ret['label'] = cimy_uef_sanitize_content($label);
    return $ret;
}
Ejemplo n.º 7
0
function shortcode_carnet()
{
    if (is_user_logged_in()) {
        // $current_user = wp_get_current_user();
        $current_user = wp_get_current_user();
        ob_start();
        ?>
<div class="carnet-titulo"><?php 
        echo 'Carnet Provisional';
        ?>
</div><?php 
        ?>
<div class="contenedor-carnet"><?php 
        ?>
<div class="carnet-codigo"><?php 
        echo 'Carnet No.: 040' . ($user_ID = get_current_user_id());
        ?>
</div><?php 
        ?>
<div class="carnet-nombre"><?php 
        echo 'Nombre: ' . $current_user->user_firstname . ' ' . $current_user->user_lastname;
        // echo '<br />';
        ?>
</div><?php 
        // ------------------------------------------
        if ($current_user->ID) {
            $cedula = cimy_uef_sanitize_content(get_cimyFieldValue($current_user->ID, 'CEDULA'));
            $ciudad = cimy_uef_sanitize_content(get_cimyFieldValue($current_user->ID, 'CIUDAD'));
            $telefono = cimy_uef_sanitize_content(get_cimyFieldValue($current_user->ID, 'TELEFONO'));
            ?>
<div class="carnet-nombre"><?php 
            echo 'Cédula:' . ' ' . $cedula;
            ?>
</div><?php 
            // echo '<hr>';
            ?>
<div class="carnet-nombre"><?php 
            echo 'Ciudad:' . ' ' . $ciudad;
            ?>
</div><?php 
            ?>
<div class="carnet-nombre"><?php 
            echo 'Teléfono:' . ' ' . $telefono;
            ?>
</div><?php 
        }
        // ------------------------------------------
        ?>
<div class="carnet-logo"><?php 
        // echo get_avatar();
        // echo get_avatar( $user_id, 45 );
        // echo get_avatar( $user_id );
        ?>
<img class="carnet-logo_img" src="http://cambiogeneracional.org/carnetizate/wp-content/uploads/logo.png"></img><?php 
        ?>
</div><?php 
        ?>
</div><?php 
        return ob_get_clean();
    }
}
Ejemplo n.º 8
0
     cimy_insert_ExtraFields_if_not_exist($user_object->ID, $field_id);
 }
 // retrieve extra fields data from DB
 $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM " . $wpdb_data_table . " WHERE USER_ID = " . $user_object->ID, ARRAY_A);
 foreach ($extra_fields as $thisField) {
     $rules = $thisField['RULES'];
     $type = $thisField['TYPE'];
     $value = $thisField['VALUE'];
     if ($type == "avatar") {
         continue;
     }
     if ($rules['show_in_aeu']) {
         $field_id = $thisField['ID'];
         foreach ($ef_db as $d_field) {
             if ($d_field['FIELD_ID'] == $field_id) {
                 $field = cimy_uef_sanitize_content($d_field['VALUE']);
                 //$field = esc_attr($d_field['VALUE']);
             }
         }
         echo "<td>";
         if ($type == "picture-url") {
             if ($field == "") {
                 $field = $value;
             }
             if ($field != "") {
                 if (intval($rules['equal_to'])) {
                     echo '<a target="_blank" href="' . $field . '">';
                     echo '<img src="' . $field . '" alt="picture"' . $size . ' width="' . intval($rules['equal_to']) . '" height="*" />';
                     echo "</a>";
                 } else {
                     echo '<img src="' . $field . '" alt="picture" />';
Ejemplo n.º 9
0
                ?>
 " >Flickr do <?php 
                echo get_the_author_meta('display_name', $autor);
                ?>
</a>
					</li>
					<?php 
            }
            ?>
					
					<?php 
            if (get_cimyFieldValue($autor, "YOUTUBE")) {
                ?>
					<li id="youtube-btn" class="social-icons-btn">
						<a href="<?php 
                echo cimy_uef_sanitize_content(get_cimyFieldValue($autor, "YOUTUBE"));
                ?>
" title="Youtube do <?php 
                echo get_the_author_meta('display_name', $autor);
                ?>
 " >Youtube do <?php 
                echo get_the_author_meta('display_name', $autor);
                ?>
</a>
					</li>
					<?php 
            }
            ?>
					
				</ul>
			</div><!-- .redes-sociais-wrapper -->
function cimy_registration_form($errors = null, $show_type = 0)
{
    global $wpdb, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_maxlen_needed, $fields_name_prefix, $wp_fields_name_prefix, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types, $user_level, $cimy_uef_domain;
    // 	cimy_switch_to_blog();
    $my_user_level = $user_level;
    // -1 == anonymous
    if (!is_user_logged_in()) {
        $my_user_level = -1;
    }
    // needed by cimy_uef_init_mce.php
    $cimy_uef_register_page = true;
    $extra_fields = get_cimyFields(false, true);
    $wp_fields = get_cimyFields(true);
    if (is_multisite()) {
        $input_class = "cimy_uef_input_mu";
    } else {
        $input_class = "cimy_uef_input_27";
    }
    $options = cimy_get_options();
    $tabindex = 21;
    echo $start_cimy_uef_comment;
    // needed to apply default values only first time and not in case of errors
    echo "\t<input type=\"hidden\" name=\"cimy_post\" value=\"1\" />\n";
    if ($options['confirm_form']) {
        if ($show_type == 0) {
            echo "\t<input type=\"hidden\" name=\"register_confirmation\" value=\"1\" />\n";
        } else {
            if ($show_type == 2) {
                echo "\t<input type=\"hidden\" name=\"register_confirmation\" value=\"2\" />\n";
            }
        }
    }
    $radio_checked = array();
    $i = 1;
    $upload_file_function = false;
    $is_jquery_added = false;
    $crop_image_function = false;
    // confirmation page, all fields are plain text + hidden fields to carry over values
    if ($show_type == 2) {
        $upload_dir = cimy_uef_get_dir_or_filename("");
        $dirs = glob($upload_dir . ".cimytemp_*.tmp");
        if (is_array($dirs)) {
            foreach ($dirs as $dir) {
                $diff = current_time('timestamp', true) - filemtime($dir);
                // If older than two days delete!
                if ($diff > 172800) {
                    cimy_rfr($dir . "/", "*");
                    if (is_dir($dir)) {
                        rmdir($dir);
                    }
                }
            }
        }
        $temp_user_login = "******" . sanitize_user($_POST['user_login']) . '_' . rand() . '.tmp';
        ?>
	<input type="hidden" name="temp_user_login" value="<?php 
        echo esc_attr($temp_user_login);
        ?>
" />
	<p id="user_login_p">
		<label for="user_login"><?php 
        _e("Username");
        ?>
 </label><input type="hidden" name="user_login" id="user_login" value="<?php 
        echo esc_attr($_POST["user_login"]);
        ?>
" /><?php 
        echo esc_html($_POST["user_login"]);
        ?>
	</p>
	<p id="user_email_p">
		<label for="user_email"><?php 
        _e("E-mail");
        ?>
 </label><input type="hidden" name="user_email" id="user_email" value="<?php 
        echo esc_attr($_POST["user_email"]);
        ?>
" /><?php 
        echo esc_html($_POST["user_email"]);
        ?>
	</p>
	<br />
<?php 
    }
    // do first the WP fields then the EXTRA fields
    while ($i <= 2) {
        if ($i == 1) {
            $fields = $wp_fields;
            $prefix = $wp_fields_name_prefix;
        } else {
            $fields = $extra_fields;
            $prefix = $fields_name_prefix;
            $current_fieldset = -1;
            if (!empty($options['fieldset_title'])) {
                $fieldset_titles = explode(',', $options['fieldset_title']);
            } else {
                $fieldset_titles = array();
            }
        }
        $tiny_mce_objects = "";
        foreach ($fields as $thisField) {
            $field_id = $thisField['ID'];
            $name = $thisField['NAME'];
            $rules = $thisField['RULES'];
            $type = $thisField['TYPE'];
            $old_type = $type;
            $label = $thisField['LABEL'];
            $description = cimy_uef_sanitize_content($thisField['DESCRIPTION']);
            $fieldset = empty($thisField['FIELDSET']) ? 0 : $thisField['FIELDSET'];
            $input_name = $prefix . esc_attr($name);
            $post_input_name = $prefix . $wpdb->escape($name);
            $maxlen = 0;
            $unique_id = $prefix . $field_id;
            $field_id_data = $input_name . "_" . $field_id . "_data";
            $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
            // showing the search then there is no need to upload buttons
            if ($show_type == 1) {
                if ($type == "password") {
                    continue;
                }
                if ($type == "avatar" || $type == "picture" || $type == "file") {
                    $type = "text";
                }
            } else {
                if ($show_type == 2) {
                    $type = "hidden";
                }
            }
            // if the current user LOGGED IN has not enough permissions to see the field, skip it
            if ($rules['show_level'] == 'view_cimy_extra_fields') {
                if (!current_user_can($rules['show_level'])) {
                    continue;
                }
            } else {
                if ($my_user_level < $rules['show_level']) {
                    continue;
                }
            }
            // if show_level == anonymous then do NOT ovverride other show_xyz rules
            if ($rules['show_level'] == -1) {
                if ($show_type == 0) {
                    // if flag to show the field in the registration is NOT activated, skip it
                    if (!$rules['show_in_reg']) {
                        continue;
                    }
                } else {
                    if ($show_type == 1) {
                        // if flag to show the field in the blog is NOT activated, skip it
                        if (!$rules['show_in_search']) {
                            continue;
                        }
                    }
                }
            }
            // uploading a file is not supported when confirmation email is enabled (on MS is turned on by default yes)
            if ((is_multisite() || $options["confirm_email"]) && in_array($type, $cimy_uef_file_types)) {
                continue;
            }
            if (isset($_POST[$post_input_name])) {
                if ($type == "dropdown-multi" || $old_type == "dropdown-multi") {
                    $value = stripslashes(implode(",", $_POST[$post_input_name]));
                } else {
                    $value = stripslashes($_POST[$post_input_name]);
                }
            } else {
                if (isset($_GET[$name])) {
                    if ($type == "dropdown-multi" || $old_type == "dropdown-multi") {
                        $value = stripslashes(implode(",", $_GET[$name]));
                    } else {
                        $value = stripslashes($_GET[$name]);
                    }
                } else {
                    if (!isset($_POST["cimy_post"])) {
                        $value = $thisField['VALUE'];
                        switch ($type) {
                            case "radio":
                                if ($value == "YES") {
                                    $value = $field_id;
                                } else {
                                    $value = "";
                                }
                                break;
                            case "checkbox":
                                if ($value == "YES") {
                                    $value = "1";
                                } else {
                                    $value = "";
                                }
                                break;
                        }
                    } else {
                        $value = "";
                    }
                }
            }
            if ($i != 1 && $fieldset > $current_fieldset && isset($fieldset_titles[$fieldset])) {
                $current_fieldset = $fieldset;
                if (isset($fieldset_titles[$current_fieldset])) {
                    echo "\n\t<h2>" . esc_html($fieldset_titles[$current_fieldset]) . "</h2>\n";
                }
            }
            if (!empty($description) && $type != "registration-date") {
                echo "\t";
                echo '<p id="' . $prefix . 'p_desc_' . $field_id . '" class="desc"><br />' . $description . '</p>';
                echo "\n";
            }
            echo "\t";
            echo '<p id="' . $prefix . 'p_field_' . $field_id . '">';
            echo "\n\t";
            switch ($type) {
                case "picture-url":
                case "password":
                case "text":
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="' . $input_class . '"';
                    $obj_name = ' name="' . $input_name . '"';
                    if ($type == "picture-url") {
                        $obj_type = ' type="text"';
                    } else {
                        $obj_type = ' type="' . $type . '"';
                    }
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_value2 = "";
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "dropdown":
                case "dropdown-multi":
                    // cimy_dropDownOptions uses cimy_uef_sanitize_content and esc_attr by itself
                    $ret = cimy_dropDownOptions($label, $value);
                    $label = $ret['label'];
                    $html = $ret['html'];
                    if ($type == "dropdown-multi") {
                        $obj_name = ' name="' . $input_name . '[]" multiple="multiple" size="6"';
                    } else {
                        $obj_name = ' name="' . $input_name . '"';
                    }
                    $obj_label = '<label for="' . $unique_id . '">' . $label . '</label>';
                    $obj_class = ' class="' . $input_class . '"';
                    $obj_type = '';
                    $obj_value = '';
                    $obj_value2 = $html;
                    $obj_checked = "";
                    $obj_tag = "select";
                    $obj_closing_tag = true;
                    break;
                case "textarea":
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="' . $input_class . '"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = "";
                    $obj_value = "";
                    $obj_value2 = esc_html($value);
                    $obj_checked = "";
                    $obj_tag = "textarea";
                    $obj_closing_tag = true;
                    break;
                case "textarea-rich":
                    if ($tiny_mce_objects == "") {
                        $tiny_mce_objects = $fields_name_prefix . $field_id;
                    } else {
                        $tiny_mce_objects .= "," . $fields_name_prefix . $field_id;
                    }
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="' . $input_class . '"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = "";
                    $obj_value = "";
                    $obj_value2 = esc_html($value);
                    $obj_checked = "";
                    $obj_tag = "textarea";
                    $obj_closing_tag = true;
                    break;
                case "checkbox":
                    $obj_label = '<label class="cimy_uef_label_checkbox" for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label><br />';
                    $obj_class = ' class="cimy_uef_checkbox"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="' . $type . '"';
                    $obj_value = ' value="1"';
                    $obj_value2 = "";
                    $value == "1" ? $obj_checked = ' checked="checked"' : ($obj_checked = '');
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "radio":
                    $obj_label = '<label class="cimy_uef_label_radio" for="' . $unique_id . '"> ' . cimy_uef_sanitize_content($label) . '</label>';
                    $obj_class = ' class="cimy_uef_radio"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="' . $type . '"';
                    $obj_value = ' value="' . $field_id . '"';
                    $obj_value2 = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    // do not check if another check was done
                    if (intval($value) == intval($field_id) && !in_array($name, $radio_checked)) {
                        $obj_checked = ' checked="checked"';
                        $radio_checked += array($name => true);
                    } else {
                        $obj_checked = '';
                    }
                    break;
                case "avatar":
                case "picture":
                case "file":
                    $allowed_exts = '';
                    if (isset($rules['equal_to'])) {
                        if ($rules['equal_to'] != "") {
                            $allowed_exts = "'" . implode("', '", explode(",", $rules['equal_to'])) . "'";
                        }
                    }
                    if ($type == "file") {
                        // if we do not escape then some translations can break
                        $warning_msg = $wpdb->escape(__("Please upload a file with one of the following extensions", $cimy_uef_domain));
                        $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(' . $allowed_exts . '));"';
                    } else {
                        // if we do not escape then some translations can break
                        $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain));
                        $obj_checked = ' onchange="uploadFile(\'registerform\', \'' . $unique_id . '\', \'' . $warning_msg . '\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"';
                    }
                    // javascript will be added later
                    $upload_file_function = true;
                    $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . ' </label>';
                    $obj_class = ' class="cimy_uef_picture"';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="file"';
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_value2 = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "hidden":
                    $obj_label = "";
                    $obj_value2 = "";
                    switch ($old_type) {
                        case 'checkbox':
                            $value == 1 ? $obj_value2 = __("YES", $cimy_uef_domain) : ($obj_value2 = __("NO", $cimy_uef_domain));
                            break;
                        case 'radio':
                            intval($value) == intval($field_id) ? $obj_value2 = __("YES", $cimy_uef_domain) : ($obj_value2 = __("NO", $cimy_uef_domain));
                            break;
                        case 'dropdown':
                        case 'dropdown-multi':
                            $ret = cimy_dropDownOptions($label, $value);
                            $label = $ret['label'];
                            break;
                        case 'picture':
                        case 'avatar':
                        case 'file':
                            $value = cimy_manage_upload($input_name, $temp_user_login, $rules, false, false, $type, !empty($advanced_options["filename"]) ? $advanced_options["filename"] : "");
                            $file_on_server = cimy_uef_get_dir_or_filename($temp_user_login, $value, false);
                            $file_thumb = cimy_uef_get_dir_or_filename($temp_user_login, $value, true);
                            if ($advanced_options["no-thumb"] && is_file($file_thumb)) {
                                rename($file_thumb, $file_on_server);
                            }
                            // yea little trick
                            $obj_value2 = "&nbsp;";
                            break;
                    }
                    if ($old_type != "password") {
                        $obj_label = '<label for="' . $unique_id . '">' . cimy_uef_sanitize_content($label) . ' </label>';
                        if (empty($obj_value2)) {
                            $obj_value2 = cimy_uef_sanitize_content($value);
                        }
                    }
                    $obj_class = '';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="hidden"';
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
                case "registration-date":
                    $obj_label = '';
                    $obj_class = '';
                    $obj_name = ' name="' . $input_name . '"';
                    $obj_type = ' type="hidden"';
                    $obj_value = ' value="' . esc_attr($value) . '"';
                    $obj_value2 = "";
                    $obj_checked = "";
                    $obj_tag = "input";
                    $obj_closing_tag = false;
                    break;
            }
            $obj_id = ' id="' . $unique_id . '"';
            // tabindex not used in MU, dropping...
            if (is_multisite()) {
                $obj_tabindex = "";
            } else {
                $obj_tabindex = ' tabindex="' . strval($tabindex) . '"';
                $tabindex++;
            }
            $obj_maxlen = "";
            if (in_array($type, $rule_maxlen_needed) && !in_array($type, $cimy_uef_file_types)) {
                if (isset($rules['max_length'])) {
                    $obj_maxlen = ' maxlength="' . $rules['max_length'] . '"';
                } else {
                    if (isset($rules['exact_length'])) {
                        $obj_maxlen = ' maxlength="' . $rules['exact_length'] . '"';
                    }
                }
            }
            if (in_array($type, $cimy_uef_textarea_types)) {
                $obj_rowscols = ' rows="3" cols="25"';
            } else {
                $obj_rowscols = '';
            }
            echo "\t";
            $form_object = '<' . $obj_tag . $obj_type . $obj_name . $obj_id . $obj_class . $obj_value . $obj_checked . $obj_maxlen . $obj_rowscols . $obj_tabindex;
            if ($obj_closing_tag) {
                $form_object .= ">" . $obj_value2 . "</" . $obj_tag . ">";
            } else {
                if ($type == "hidden") {
                    $form_object .= " />" . $obj_value2;
                    if (in_array($old_type, $cimy_uef_file_types)) {
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_size\" id=\"" . esc_attr($field_id_data) . "_size\" value=\"" . strval($_FILES[$input_name]['size'] / 1024) . "\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_type\" id=\"" . esc_attr($field_id_data) . "_type\" value=\"" . strval($_FILES[$input_name]['type']) . "\" />";
                    }
                    if (($old_type == "picture" || $old_type == "avatar") && is_file($file_on_server)) {
                        if (!$is_jquery_added) {
                            wp_print_scripts("jquery");
                            $is_jquery_added = true;
                        }
                        $crop_image_function = true;
                        echo '<img id="' . esc_attr($field_id_data) . '" src="' . esc_attr($value) . '" alt="picture" /><br />';
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_button\" id=\"" . esc_attr($field_id_data) . "_button\" value=\"1\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_x1\" id=\"" . esc_attr($field_id_data) . "_x1\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_y1\" id=\"" . esc_attr($field_id_data) . "_y1\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_x2\" id=\"" . esc_attr($field_id_data) . "_x2\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_y2\" id=\"" . esc_attr($field_id_data) . "_y2\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_w\" id=\"" . esc_attr($field_id_data) . "_w\" value=\"\" />";
                        echo "<input type=\"hidden\" name=\"" . esc_attr($field_id_data) . "_h\" id=\"" . esc_attr($field_id_data) . "_h\" value=\"\" />";
                        $imgarea_options = "handles: true, fadeSpeed: 200, onSelectChange: preview";
                        if (isset($advanced_options["crop_x1"]) && isset($advanced_options["crop_y1"]) && isset($advanced_options["crop_x2"]) && isset($advanced_options["crop_y2"])) {
                            $imgarea_options .= ", x1: " . intval($advanced_options["crop_x1"]);
                            $imgarea_options .= ", y1: " . intval($advanced_options["crop_y1"]);
                            $imgarea_options .= ", x2: " . intval($advanced_options["crop_x2"]);
                            $imgarea_options .= ", y2: " . intval($advanced_options["crop_y2"]);
                        }
                        if (!empty($advanced_options["crop_ratio"])) {
                            $imgarea_options .= ", aspectRatio: '" . esc_js($advanced_options["crop_ratio"]) . "'";
                        } else {
                            if ($type == "avatar") {
                                $imgarea_options .= ", aspectRatio: '1:1'";
                            }
                        }
                        echo "<script type='text/javascript'>jQuery(document).ready(function () { jQuery('#" . esc_js($field_id_data) . "').imgAreaSelect({ " . $imgarea_options . " }); });</script>";
                    }
                } else {
                    $form_object .= " />";
                }
            }
            if ($type != "radio" && $type != "checkbox") {
                echo $obj_label;
            }
            if (is_multisite()) {
                if ($errmsg = $errors->get_error_message($unique_id)) {
                    echo '<p class="error">' . $errmsg . '</p>';
                }
            }
            // write to the html the form object built
            echo $form_object;
            if ($show_type == 0 && $i == 1 && $options['password_meter']) {
                if ($input_name == $prefix . "PASSWORD") {
                    $pass1_id = $unique_id;
                }
                if ($input_name == $prefix . "PASSWORD2") {
                    echo "\n\t\t<div id=\"pass-strength-result\">" . __('Strength indicator') . "</div>";
                    echo "\n\t\t<p class=\"description indicator-hint\">" . __('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).') . "</p><br />";
                    $pass2_id = $unique_id;
                }
            }
            if (!($type != "radio" && $type != "checkbox")) {
                echo $obj_label;
            }
            echo "\n\t</p>\n";
            if ($type == "textarea-rich" || in_array($type, $cimy_uef_file_types)) {
                echo "\t<br />\n";
            }
        }
        $i++;
    }
    echo "\t<br />";
    if ($show_type == 0) {
        if (!empty($tiny_mce_objects)) {
            require_once $cuef_plugin_dir . '/cimy_uef_init_mce.php';
        }
        if ($options['password_meter']) {
            if (!$is_jquery_added) {
                wp_print_scripts("jquery");
                $is_jquery_added = true;
            }
            require_once $cuef_plugin_dir . '/cimy_uef_init_strength_meter.php';
        }
    }
    if ($crop_image_function) {
        wp_print_scripts('imgareaselect');
        wp_print_styles('imgareaselect');
        wp_print_scripts('cimy_uef_img_selection');
    }
    if ($show_type != 2 && $options['captcha'] == "securimage") {
        global $cuef_securimage_webpath;
        ?>
		<div style="width: 278px; float: left; height: 80px; vertical-align: text-top;">
			<img id="captcha" align="left" style="padding-right: 5px; border: 0" src="<?php 
        echo $cuef_securimage_webpath;
        ?>
/securimage_show_captcha.php" alt="CAPTCHA Image" />
			<object type="application/x-shockwave-flash" data="<?php 
        echo $cuef_securimage_webpath;
        ?>
/securimage_play.swf?audio=<?php 
        echo $cuef_securimage_webpath;
        ?>
/securimage_play.php&#038;bgColor1=#fff&#038;bgColor2=#fff&#038;iconColor=#777&#038;borderWidth=1&#038;borderColor=#000" height="19" width="19"><param name="movie" value="<?php 
        echo $cuef_securimage_webpath;
        ?>
/securimage_play.swf?audio=<?php 
        echo $cuef_securimage_webpath;
        ?>
/securimage_play.php&#038;bgColor1=#fff&#038;bgColor2=#fff&#038;iconColor=#777&#038;borderWidth=1&#038;borderColor=#000" /></object>
			<br /><br /><br /><br />
			<a align="right" tabindex="<?php 
        echo $tabindex;
        $tabindex++;
        ?>
" style="border-style: none" href="#" onclick="document.getElementById('captcha').src = '<?php 
        echo $cuef_securimage_webpath;
        ?>
/securimage_show_captcha.php?' + Math.random(); return false"><img src="<?php 
        echo $cuef_securimage_webpath;
        ?>
/images/refresh.gif" alt="<?php 
        _e("Change image", $cimy_uef_domain);
        ?>
" border="0" onclick="this.blur()" align="bottom" /></a>
		</div>
		<div style="width: 278px; float: left; height: 50px; vertical-align: bottom; padding: 5px;">
			<?php 
        _e("Insert the code:", $cimy_uef_domain);
        ?>
&nbsp;<input type="text" name="securimage_response_field" size="10" maxlength="6" tabindex="<?php 
        echo $tabindex;
        $tabindex++;
        ?>
" />
		</div>
<?php 
    }
    if ($show_type != 2 && $options['captcha'] == "recaptcha" && !empty($options['recaptcha_public_key']) && !empty($options['recaptcha_private_key'])) {
        require_once $cuef_plugin_dir . '/recaptcha/recaptchalib.php';
        ?>
			<script type='text/javascript'>
				var RecaptchaOptions = {
					lang: '<?php 
        echo substr(get_locale(), 0, 2);
        ?>
',
					tabindex : <?php 
        echo strval($tabindex);
        $tabindex++;
        ?>
				};
			</script>
	<?php 
        // no need if Tiny MCE is present already
        if ($tiny_mce_objects == "") {
            ?>
			<script type='text/javascript'>
				var login_div = document.getElementById("login");
				login_div.style.width = "375px";
			</script>
	<?php 
        }
        echo recaptcha_get_html($options['recaptcha_public_key']);
    }
    if ($upload_file_function) {
        wp_print_scripts("cimy_uef_upload_file");
    }
    cimy_switch_current_blog(true);
    echo $end_cimy_uef_comment;
}