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_filter_content($content) { //GETTING POST META global $post; if ($post == FALSE || !isset($post->ID)) { return do_shortcode($content); } $meta_arr = ihc_post_metas($post->ID); if ($meta_arr['ihc_mb_block_type'] == 'redirect') { return do_shortcode($content); } ///this extra check it's for ihc_list_posts_filter(), ///GETTING USER TYPE $current_user = ihc_get_user_type(); if ($current_user == 'admin') { return do_shortcode($content); } //show always for admin // who can access the content if (isset($meta_arr['ihc_mb_who'])) { if ($meta_arr['ihc_mb_who'] == -1) { $meta_arr['ihc_mb_who'] = ''; } //-1 means no value selected $target_users = explode(',', $meta_arr['ihc_mb_who']); } else { return do_shortcode($content); } ////TESTING USER $block = ihc_test_if_must_block($meta_arr['ihc_mb_type'], $current_user, $target_users); //IF NOT BLOCKING, RETURN THE CONTENT if (!$block) { return do_shortcode($content); } // REPLACE CONTENT if (isset($meta_arr['ihc_replace_content'])) { $meta_arr['ihc_replace_content'] = stripslashes($meta_arr['ihc_replace_content']); $meta_arr['ihc_replace_content'] = htmlspecialchars_decode($meta_arr['ihc_replace_content']); $meta_arr['ihc_replace_content'] = ihc_format_str_like_wp($meta_arr['ihc_replace_content']); return do_shortcode($meta_arr['ihc_replace_content']); } //IF SOMEHOW IT CAME UP HERE, RETURN CONTENT return do_shortcode($content); }
function ihc_correct_text($str, $wp_editor_content = false) { $str = stripcslashes(htmlspecialchars_decode($str)); if ($wp_editor_content) { return ihc_format_str_like_wp($str); } return $str; }