File: /var/www/html/www.winghung.com/wp-content/themes/zeen/inc/core/rcp.php
<?php
/**
* RCP
*
* @package Zeen
* @since 4.2.0
*/
function zeen_rcp_restricted_content_message( $message ) {
global $post;
global $rcp_options;
if ( ! $post instanceof WP_Post || ! empty( $rcp_options['restriction_message'] ) ) {
return $message;
}
if ( rcp_is_paid_content( $post->ID ) ) {
$message = esc_html__( 'An active subscription is required to continue reading this page. Create your account or log in to continue reading.', 'zeen' );
} else {
$message = esc_html__( 'Create your free account or log in to continue reading.', 'zeen' );
}
$title = esc_html__( 'Get unlimited access to ', 'zeen' ) . get_bloginfo( 'name' );
$message = '<div class="rcp__message"><h2 class="rcp__message__title">' . $title . '</h2>' . $message . '</div>';
return '<div class="rcp__message__wrap rcp__container tipi-flex tipi-flex-wrap tipi-all-c block-skin-11 block-skin--light">' . $message . zeen_rcp_subscribe_buttons() . '</div>';
}
add_filter( 'rcp_restricted_content_message', 'zeen_rcp_restricted_content_message' );
function zeen_rcp_subscribe_buttons() {
global $rcp_options;
$output = '';
if ( ! empty( $rcp_options['registration_page'] ) ) {
$output .= '<a href="' . esc_url( get_permalink( $rcp_options['registration_page'] ) ) . '" class="tipi-button tipi-all-c button-arrow-r button-arrow"><span class="button-text button-title">Subscribe</span> <i class="tipi-i-arrow-right"></i></a>';
}
if ( ! empty( $rcp_options['account_page'] ) ) {
$output .= '<a href="' . esc_url( get_permalink( $rcp_options['account_page'] ) ) . '" class="tipi-button tipi-all-c button-arrow-r button-arrow"><span class="button-text button-title">Log In</span> <i class="tipi-i-arrow-right"></i></a>';
}
if ( ! empty( $output ) ) {
$output = '<div class="rcp__buttons__wrap tipi-flex tipi-flex-hc button-size-wrap-1">' . $output . '</div>';
}
return $output;
}
function zeen_rcp_post_excerpt( $the_excerpt = '', $post = '', $length = '', $tags = '', $extra = '' ) {
return str_replace( $extra, apply_filters( 'zeen_rcp_excerpt_extra', '...' ), $the_excerpt );
}
add_filter( 'rcp_post_excerpt', 'zeen_rcp_post_excerpt', 10, 5 );
function zeen_rcp_user_can_access() {
if ( ! function_exists( 'rcp_user_can_access' ) ) {
return true;
}
if ( rcp_user_can_access( get_current_user_id(), get_the_ID() ) ) {
return true;
}
}
function zeen_rcp_before_register_form( $id = '', $atts = '' ) {
echo '<div class="rcp__register__wrap rcp__container block-skin-11 block-skin--light">';
}
add_action( 'rcp_before_register_form', 'zeen_rcp_before_register_form', 10, 2 );
function zeen_rcp_after_register_form( $id = '', $atts = '' ) {
echo '</div>';
}
add_action( 'rcp_after_register_form', 'zeen_rcp_after_register_form', 10, 2 );
function zeen_rcp_filter_excerpt_length( $length ) {
return 20;
}
add_filter( 'rcp_filter_excerpt_length', 'zeen_rcp_filter_excerpt_length' );