/** * The Securify Content Filter * * This is the primary function that picks up where wpmem() leaves off. * Determines whether content is shown or hidden for both post and * pages. * * @since 2.0 * * @uses apply_filters Calls 'wpmem_securify' * * @global var $wpmem_a the action variable received from wpmem() * @global string $wpmem_regchk contains messages returned from wpmem() action functions * @global string $wpmem_themsg contains messages to be output * @global string $wpmem_captcha_err contains error message for reCAPTCHA * @global array $post needed for protecting comments * @param string $content * @return $content */ function wpmem_securify($content = null) { $content = is_single() || is_page() ? $content : wpmem_do_excerpt($content); if (!wpmem_test_shortcode()) { global $wpmem_regchk, $wpmem_themsg, $wpmem_a; if ($wpmem_regchk == "captcha") { global $wpmem_captcha_err; $wpmem_themsg = __('There was an error with the CAPTCHA form.') . '<br /><br />' . $wpmem_captcha_err; } // Block/unblock Posts if (!is_user_logged_in() && wpmem_block() == true) { // protects comments if user is not logged in global $post; $post->post_password = apply_filters('wpmem_post_password', wp_generate_password()); include_once 'wp-members-dialogs.php'; // show the login and registration forms if ($wpmem_regchk) { // empty content in any of these scenarios $content = ''; switch ($wpmem_regchk) { case "loginfailed": $content = wpmem_inc_loginfailed(); break; case "success": $content = wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_login(); break; default: $content = wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration(); break; } } else { // toggle shows excerpt above login/reg on posts/pages if (WPMEM_SHOW_EXCERPT == 1) { if (!stristr($content, '<span id="more')) { $content = wpmem_do_excerpt($content); } else { $len = strpos($content, '<span id="more'); $content = substr($content, 0, $len); } } else { // empty all content $content = ''; } $content = $content . wpmem_inc_login(); $content = WPMEM_NO_REG != 1 ? $content . wpmem_inc_registration() : $content; } // Protects comments if expiration module is used and user is expired } elseif (is_user_logged_in() && wpmem_block() == true) { $content = WPMEM_USE_EXP == 1 ? wpmem_do_expmessage($content) : $content; } } $content = apply_filters('wpmem_securify', $content); return $content; }
/** * The Securify Content Filter * * This is the primary function that picks up where wpmem() leaves off. * Determines whether content is shown or hidden for both post and * pages. * * @since 2.0 * * @global var $wpmem_a the action variable received from wpmem() * @global string $wpmem_regchk contains messages returned from wpmem() action functions * @global string $wpmem_themsg contains messages to be output * @global string $wpmem_captcha_err contains error message for reCAPTCHA * @global array $post needed for protecting comments * @param string $content * @return string $content */ function wpmem_securify($content = null) { $content = is_single() || is_page() ? $content : wpmem_do_excerpt($content); if (!wpmem_test_shortcode($content, 'wp-members')) { global $wpmem_regchk, $wpmem_themsg, $wpmem_a; if ($wpmem_regchk == "captcha") { global $wpmem_captcha_err; $wpmem_themsg = __('There was an error with the CAPTCHA form.') . '<br /><br />' . $wpmem_captcha_err; } // Block/unblock Posts if (!is_user_logged_in() && wpmem_block() == true) { // protects comments if user is not logged in global $post; /** * Filter the post password. * * @since 2.8.0 * * @param string The autogenerated post password. */ $post->post_password = apply_filters('wpmem_post_password', wp_generate_password()); include_once WPMEM_PATH . 'wp-members-dialogs.php'; // show the login and registration forms if ($wpmem_regchk) { // empty content in any of these scenarios $content = ''; switch ($wpmem_regchk) { case "loginfailed": $content = wpmem_inc_loginfailed(); break; case "success": $content = wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_login(); break; default: $content = wpmem_inc_regmessage($wpmem_regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration(); break; } } else { // toggle shows excerpt above login/reg on posts/pages if (WPMEM_SHOW_EXCERPT == 1) { if (!stristr($content, '<span id="more')) { $content = wpmem_do_excerpt($content); } else { $len = strpos($content, '<span id="more'); $content = substr($content, 0, $len); } } else { // empty all content $content = ''; } $content = $content . wpmem_inc_login(); $content = WPMEM_NO_REG != 1 ? $content . wpmem_inc_registration() : $content; } // Protects comments if expiration module is used and user is expired } elseif (is_user_logged_in() && wpmem_block() == true) { $content = WPMEM_USE_EXP == 1 && function_exists('wpmem_do_expmessage') ? wpmem_do_expmessage($content) : $content; } } /** * Filter the value of $content after wpmem_securify has run. * * @since 2.7.7 * * @param string $content The content after securify has run. */ $content = apply_filters('wpmem_securify', $content); if (strstr($content, '[wpmem_txt]')) { // fix the wptexturize remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'wpmem_texturize', 99); } return $content; }
/** * The Securify Content Filter. * * This is the primary function that picks up where get_action() leaves off. * Determines whether content is shown or hidden for both post and pages. * * @since 3.0 * * @global string $wpmem_themsg Contains messages to be output. * @global string $wpmem_captcha_err Contains error message for reCAPTCHA. * @global object $post The post object. * @param string $content * @return string $content */ function do_securify($content = null) { global $wpmem_themsg, $post; $content = is_single() || is_page() ? $content : wpmem_do_excerpt($content); if (!wpmem_test_shortcode($content, 'wp-members')) { if ($this->regchk == "captcha") { global $wpmem_captcha_err; $wpmem_themsg = __('There was an error with the CAPTCHA form.') . '<br /><br />' . $wpmem_captcha_err; } // Block/unblock Posts. if (!is_user_logged_in() && $this->is_blocked() == true) { include_once WPMEM_PATH . 'inc/dialogs.php'; //Show the login and registration forms. if ($this->regchk) { // Empty content in any of these scenarios. $content = ''; switch ($this->regchk) { case "loginfailed": $content = wpmem_inc_loginfailed(); break; case "success": $content = wpmem_inc_regmessage($this->regchk, $wpmem_themsg); $content = $content . wpmem_inc_login(); break; default: $content = wpmem_inc_regmessage($this->regchk, $wpmem_themsg); $content = $content . wpmem_inc_registration(); break; } } else { // Toggle shows excerpt above login/reg on posts/pages. global $wp_query; if (isset($wp_query->query_vars['page']) && $wp_query->query_vars['page'] > 1) { // Shuts down excerpts on multipage posts if not on first page. $content = ''; } elseif ($this->show_excerpt[$post->post_type] == 1) { if (!stristr($content, '<span id="more')) { $content = wpmem_do_excerpt($content); } else { $len = strpos($content, '<span id="more'); $content = substr($content, 0, $len); } } else { // Empty all content. $content = ''; } $content = $this->show_login[$post->post_type] == 1 ? $content . wpmem_inc_login() : $content . wpmem_inc_login('page', '', 'hide'); $content = $this->show_reg[$post->post_type] == 1 ? $content . wpmem_inc_registration() : $content; } // Protects comments if expiration module is used and user is expired. } elseif (is_user_logged_in() && $this->is_blocked() == true) { $content = $this->use_exp == 1 && function_exists('wpmem_do_expmessage') ? wpmem_do_expmessage($content) : $content; } } /** * Filter the value of $content after wpmem_securify has run. * * @since 2.7.7 * * @param string $content The content after securify has run. */ $content = apply_filters('wpmem_securify', $content); if (strstr($content, '[wpmem_txt]')) { // Fix the wptexturize. remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'wpmem_texturize', 99); } return $content; }