function ihc_print_locker_template($id = false, $meta_arr = false, $preview = false) { //function that return html template for an id $str = ''; if ($id && $id != -1) { $meta_arr = ihc_return_meta('ihc_lockers', $id); } //gettings metas for id if ($meta_arr) { $login = ''; if ($meta_arr['ihc_locker_login_form']) { $meta_arr_login = ihc_return_meta_arr('login'); if ($meta_arr['ihc_locker_additional_links']) { $meta_arr_login['ihc_login_remember_me'] = 0; $meta_arr_login['ihc_login_register'] = 1; $meta_arr_login['ihc_login_pass_lost'] = 1; } else { $meta_arr_login['ihc_login_remember_me'] = 0; $meta_arr_login['ihc_login_register'] = 0; $meta_arr_login['ihc_login_pass_lost'] = 0; } $meta_arr_login['ihc_login_template'] = 'ihc-login-template-7'; //no template for login if (isset($meta_arr['ihc_locker_login_template']) && $meta_arr['ihc_locker_login_template']) { $meta_arr_login['ihc_login_template'] = $meta_arr['ihc_locker_login_template']; } if ($preview) { $meta_arr_login['preview'] = true; } $login = ihc_print_form_login($meta_arr_login); } elseif ($meta_arr['ihc_locker_additional_links']) { $login = ihc_print_links_login(); } $meta_arr['ihc_locker_custom_content'] = ihc_format_str_like_wp($meta_arr['ihc_locker_custom_content']); $meta_arr['ihc_locker_custom_content'] = stripslashes($meta_arr['ihc_locker_custom_content']); $meta_arr['ihc_locker_custom_content'] = htmlspecialchars_decode($meta_arr['ihc_locker_custom_content']); $str = ihc_locker_layout($meta_arr['ihc_locker_template'], $login, $meta_arr['ihc_locker_custom_content']); $str = '<div class="ihc-locker-wrap">' . $str . '</div>'; if ($meta_arr['ihc_locker_custom_css']) { $str = '<style>' . $meta_arr['ihc_locker_custom_css'] . '</style>' . $str; } } return $str; //if something goes wrong return blank string }
function ihc_login_form($attr = false) { ///////////// LOGIN FORM $str = ''; $msg = ''; $user_type = ihc_get_user_type(); if ($user_type != 'unreg') { ////////////REGISTERED USER if ($user_type == 'pending') { //pending user $msg = ihc_correct_text(get_option('ihc_register_pending_user_msg', true)); if ($msg) { $str .= '<div class="ihc-login-pending">' . $msg . '</div>'; } } else { //already logged in } } else { /////////////UNREGISTERED $meta_arr = ihc_return_meta_arr('login'); $str .= ihc_print_form_login($meta_arr); } //print the message if (isset($_REQUEST['ihc_success_login']) && $_REQUEST['ihc_success_login']) { //success $msg .= get_option('ihc_login_succes'); if (!empty($msg)) { $str .= '<div class="ihc-login-success">' . ihc_correct_text($msg) . '</div>'; } } else { global $ihc_login_msg; if (!empty($ihc_login_msg)) { //error $str .= '<div class="ihc-login-error">' . $ihc_login_msg . '</div>'; } } return $str; }
function ihc_login_form_preview() { $meta_arr['ihc_login_remember_me'] = $_REQUEST['remember']; $meta_arr['ihc_login_register'] = $_REQUEST['register']; $meta_arr['ihc_login_pass_lost'] = $_REQUEST['pass_lost']; $meta_arr['ihc_login_template'] = $_REQUEST['template']; $meta_arr['ihc_login_custom_css'] = $_REQUEST['css']; echo ihc_print_form_login($meta_arr); die; }