/**
  * 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;
 }
Example #2
0
 /**
  * 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;
 }
Example #3
0
 function rt_get_content_output_function()
 {
     global $rt_templateID, $post;
     // Password Protected
     $password_protected = is_object($post) && post_password_required($post) ? true : false;
     //check if the currenct page blocked by the  WP-Members plugin
     if (function_exists('wpmem') && is_object($post)) {
         if (!is_user_logged_in() && wpmem_block() == true) {
             $password_protected = true;
         }
     }
     //do not display the template contents if the content is password protected
     if ($password_protected) {
         get_template_part('page');
         return;
     }
     // Get the header output
     $content_output = get_option(RT_THEMESLUG . "_" . $rt_templateID . "_content_output");
     echo do_shortcode($content_output);
 }
Example #4
0
/**
 * Securifies the comments.
 *
 * If the user is not logged in and the content is blocked
 * (i.e. wpmem_block() returns true), function loads a
 * dummy/empty comments template.
 *
 * @since 2.9.9
 *
 * @return bool $open Whether the current post is open for comments.
 */
function wpmem_securify_comments($open)
{
    $open = !is_user_logged_in() && wpmem_block() ? false : $open;
    /**
     * Filters whether comments are open or not.
     *
     * @since 3.0.0
     *
     * @param bool $open Whether the current post is open for comments.
     */
    $open = apply_filters('wpmem_securify_comments', $open);
    if (!$open) {
        add_filter('comments_array', 'wpmem_securify_comments_array', 10, 2);
    }
    return $open;
}
Example #5
0
/**
 * Securifies the comments.
 *
 * If the user is not logged in and the content is blocked
 * (i.e. wpmem->is_blocked() returns true), function loads a
 * dummy/empty comments template.
 *
 * @since 2.9.9
 *
 * @return bool $open true if current post is open for comments, otherwise false.
 */
function wpmem_securify_comments($open)
{
    $open = !is_user_logged_in() && wpmem_block() ? false : $open;
    /**
     * Filters whether comments are open or not.
     *
     * @since 3.0.0
     *
     * @param bool $open true if current post is open for comments, otherwise false.
     */
    $open = apply_filters('wpmem_securify_comments', $open);
    if (!$open) {
        /** This filter is documented in wp-includes/comment-template.php */
        add_filter('comments_array', 'wpmem_securify_comments_array', 10, 2);
    }
    return $open;
}
Example #6
0
/**
 * Securifies the comments.
 *
 * If the user is not logged in and the content is blocked
 * (i.e. wpmem_block() returns true), function loads a 
 * dummy/empty comments template.
 *
 * @since 2.9.9
 *
 * @return string $template The location of the comments template.
 */
function wpmem_securify_comments($template)
{
    if (!is_user_logged_in() && wpmem_block()) {
        return dirname(__FILE__) . '/lib/comments-template.php';
    }
    return $template;
}