';
$item_output .= '
';
} elseif ( empty( $depth ) && ( 'custom' === $item->object ) && ! empty ( $rb_settings[ $item->ID ]['mega_shortcode'] ) ) {
/** mega template */
if ( ! empty( $rb_settings[ $item->ID ]['mega_width'] ) ) {
$item_output .= '
';
} else {
$item_output .= '
';
}
$item_output .= '
';
} elseif ( empty( $depth ) && ( 'custom' === $item->object ) && ! empty ( $rb_settings[ $item->ID ]['columns'] ) ) {
/** mega columns */
$inner_classes = 'mega-dropdown-inner';
if ( empty( $rb_settings[ $item->ID ]['sub_scheme'] ) ) {
if ( ! empty( $args->sub_scheme ) ) {
$inner_classes .= ' ' . esc_attr( $args->sub_scheme );
}
} elseif ( '1' === $rb_settings[ $item->ID ]['sub_scheme'] ) {
$inner_classes .= ' light-scheme';
}
if ( ! empty( $rb_settings[ $item->ID ]['mega_width'] ) ) {
$item_output .= '
';
} else {
$item_output .= '
';
}
$item_output .= '
';
$item_output .= '
';
}
/** filter */
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
public function end_el( &$output, $item, $depth = 0, $args = null ) {
$rb_settings = get_option( 'rb_menu_settings_' . self::get_menu_id( $args ), array() );
if ( empty( $depth ) && 'category' === $item->object && ! empty( $rb_settings[ $item->ID ]['category'] ) ) {
$output .= $this->category_mega_menu( $item, $rb_settings );
$output .= '
';
} elseif ( empty( $depth ) && ( 'custom' === $item->object ) && ! empty ( $rb_settings[ $item->ID ]['mega_shortcode'] ) ) {
$output .= $this->column_mega_menu( $item, $rb_settings );
$output .= '
';
} elseif ( empty( $depth ) && ( 'custom' === $item->object ) && ( ! empty ( $rb_settings[ $item->ID ]['columns'] ) ) ) {
$output .= $this->column_mega_menu( $item, $rb_settings );
$output .= '
';
}
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$output .= "{$n}";
}
/**
* @param $item
* @param $rb_settings
*
* @return string
*/
public function category_mega_menu( $item, $rb_settings ) {
if ( ! empty ( $rb_settings[ $item->ID ]['layout'] ) ) {
return $this->blog_hierarchical( $item );
} else {
return $this->blog_default( $item );
}
}
/** mega category default */
public function blog_default( $item ) {
$output = '';
if ( ! empty( $item->object_id ) ) {
$output .= '';
$output .= foxiz_get_grid_small_1( array(
'uuid' => 'mega-listing-' . $item->ID,
'duplicate_allowed' => 1,
'columns' => 5,
'posts_per_page' => 5,
'title_tag' => 'span',
'crop_size' => 'foxiz_crop_g1',
'title_classes' => 'h4',
'review' => 'replace',
'entry_meta' => 'date',
'entry_category' => '-1',
'excerpt_length' => '-1',
'category' => $item->object_id
) );
}
return $output;
}
/**
* @param $item
*
* @return string
*/
public function blog_hierarchical( $item ) {
$output = '';
if ( ! empty( $item->object_id ) ) {
$data = get_option( 'foxiz_category_meta', array() );
$description = term_description( $item->object_id );
$featured = '';
if ( isset( $data[ $item->object_id ]['featured_image'] ) ) {
$featured = $data[ $item->object_id ]['featured_image'];
}
$output .= '
';
$output .= '
';
$output .= '';
$output .= foxiz_get_list_small_2( array(
'uuid' => 'mega-listing-trending-' . $item->ID,
'duplicate_allowed' => 1,
'posts_per_page' => 3,
'title_tag' => 'span',
'title_classes' => 'h4',
'category' => $item->object_id,
'order' => 'comment_count',
'review' => 'replace',
'entry_category' => '-1',
'excerpt_length' => '-1',
'entry_meta' => 'date',
'entry_format' => 'bottom',
'readmore' => '-1',
) );
$output .= '
';
$output .= '
';
$output .= '';
$output .= foxiz_get_list_small_1( array(
'uuid' => 'mega-listing-latest-' . $item->ID,
'duplicate_allowed' => 1,
'posts_per_page' => 4,
'title_tag' => 'span',
'title_classes' => 'h4',
'category' => $item->object_id,
'review' => 'replace',
'entry_format' => 'false',
'review_description' => '-1',
'entry_category' => '-1',
'entry_meta' => 'date',
'excerpt_length' => '-1',
'readmore' => '-1',
'bottom_border' => 'gray',
'last_bottom_border' => '-1'
) );
$output .= '
';
}
return $output;
}
/**
* @param $item
* @param $rb_settings
*
* @return false|string
*/
public function column_mega_menu( $item, $rb_settings ) {
ob_start();
if ( ! empty( $rb_settings[ $item->ID ]['mega_shortcode'] ) ) : ?>
ID ]['mega_shortcode'] ) ); ?>
ID ]['columns'] ) ) : ?>
ID ]['columns'] ); ?>
';
$output .= '
';
$output .= '
';
$output .= '';
return $output;
}
}
if ( ! function_exists( 'foxiz_get_wologin_bookmark' ) ) {
/**
* @param string $post_id
* @param string $redirect
*
* @return false|string
* without login bookmark
*/
function foxiz_get_wologin_bookmark( $post_id = '', $redirect = '' ) {
if ( function_exists( 'foxiz_is_amp' ) && foxiz_is_amp() ) {
return false;
}
if ( empty( $redirect ) ) {
$redirect = home_url( '/' );
}
$output = '
';
$output .= '';
$output .= '';
$output .= '';
$output .= '';
return $output;
}
}
if ( ! function_exists( 'foxiz_bookmark_trigger' ) ) {
/**
* @param string $post_id
*/
function foxiz_bookmark_trigger( $post_id = '' ) {
echo foxiz_get_bookmark_trigger( $post_id );
}
}
if ( ! function_exists( 'foxiz_get_bookmark_trigger' ) ) {
/**
* @param string $post_id
*
* @return false|string
*/
function foxiz_get_bookmark_trigger( $post_id = '' ) {
if ( foxiz_is_amp() || ! class_exists( 'Foxiz_Bookmark' ) ) {
return false;
}
$settings = Foxiz_Bookmark::get_instance()->settings;
if ( empty( $settings['bookmark'] ) ) {
return false;
}
if ( ! isset( $settings['logged_redirect'] ) ) {
$redirect = $settings['logged_redirect'];
} else {
$redirect = get_home_url();
}
if ( empty( $settings['enable_when'] ) || is_user_logged_in() ) {
return foxiz_get_bookmark( $post_id );
}
if ( 'ask_login' === $settings['enable_when'] && ! is_user_logged_in() ) {
return foxiz_get_wologin_bookmark( $post_id, esc_url( $redirect ) );
}
}
}
PK ! u% u% bookmark/bookmark.phpnu [ get_settings();
add_action( 'wp_ajax_nopriv_rb_bookmark', array( $this, 'add_bookmark' ) );
add_action( 'wp_ajax_rb_bookmark', array( $this, 'add_bookmark' ) );
add_action( 'wp_ajax_nopriv_rb_follow', array( $this, 'follow_toggle' ) );
add_action( 'wp_ajax_rb_follow', array( $this, 'follow_toggle' ) );
add_action( 'wp_ajax_nopriv_sync_bookmarks', array( $this, 'sync_bookmarks' ) );
add_action( 'wp_ajax_sync_bookmarks', array( $this, 'sync_bookmarks' ) );
add_filter( 'body_class', array( $this, 'add_classes' ), 99 );
add_action( 'wp_footer', array( $this, 'bookmark_info_template' ) );
add_action( 'wp_footer', array( $this, 'bookmark_remove_info' ) );
add_action( 'transition_post_status', array( $this, 'push_notification' ), 10, 3 );
}
function bookmark_remove_info() {
$settings = $this->settings;
if ( empty( $settings['bookmark'] ) ) {
return;
} ?>
settings;
if ( empty( $settings['bookmark'] ) || empty( $settings['notification'] ) ) {
return;
} ?>
settings['bookmark'] ) ) {
$classes[] = 'sync-bookmarks';
}
return $classes;
}
/**
* @param $name
*
* @return false|mixed
* get setting by name
*/
public function get_setting( $name ) {
if ( function_exists( 'foxiz_get_option' ) ) {
return foxiz_get_option( $name );
}
return false;
}
/**
* get settings
*/
public function get_settings() {
$settings = array(
'bookmark' => $this->get_setting( 'bookmark_system' ),
'enable_when' => $this->get_setting( 'bookmark_enable_when' ),
'logged_redirect' => $this->get_setting( 'bookmark_logged_redirect' ),
'expiration' => intval( $this->get_setting( 'bookmark_expiration' ) ) * 86400,
'notification' => $this->get_setting( 'bookmark_notification' )
);
$this->settings = wp_parse_args( $settings, array(
'bookmark' => '',
'enable_when' => '',
'logged_redirect' => '',
'expiration' => '5076000'
) );
}
/**
* @return string|string[]|null
* get user IP
*/
public function get_ip() {
if ( function_exists( 'foxiz_get_user_ip' ) ) {
$ip = foxiz_get_user_ip();
return foxiz_convert_to_id( $ip );
}
return '127_0_0_1';
}
/**
* @param $post_id
*
* @return bool
* check bookmark
*/
public function is_bookmarked( $post_id ) {
if ( is_user_logged_in() ) {
$data = get_user_meta( get_current_user_id(), $this->meta_ID, true );
} else {
$data = get_transient( 'rb_bookmark_' . $this->get_ip() );
}
if ( empty( $data ) || ! is_array( $data ) ) {
return false;
} else {
return in_array( $post_id, $data );
}
}
/**
* add bookmark
*/
public function add_bookmark() {
if ( empty( $_POST['pid'] ) ) {
wp_send_json( '', null );
}
$post_id = intval( $_POST['pid'] );
$response = array(
'action' => 'added',
'description' => foxiz_html__( 'This article has been added to reading list', 'foxiz' )
);
if ( is_user_logged_in() ) {
$user_id = get_current_user_id();
$bookmarked = get_user_meta( $user_id, $this->meta_ID, true );
if ( empty( $bookmarked ) || ! is_array( $bookmarked ) ) {
$bookmarked = array();
}
$key = array_search( $post_id, $bookmarked );
if ( false === $key ) {
array_push( $bookmarked, $post_id );
} else {
unset( $bookmarked[ $key ] );
$response['action'] = 'removed';
$response['description'] = foxiz_html__( 'This article was removed from reading list', 'foxiz' );
}
update_user_meta( $user_id, $this->meta_ID, array_unique( $bookmarked ) );
} else {
$transient_ID = 'rb_bookmark_' . $this->get_ip();
$bookmarked = get_transient( $transient_ID );
if ( empty( $bookmarked ) || ! is_array( $bookmarked ) ) {
$bookmarked = array();
}
$key = array_search( $post_id, $bookmarked );
if ( false === $key ) {
array_push( $bookmarked, $post_id );
} else {
unset( $bookmarked[ $key ] );
$response['action'] = 'removed';
$response['description'] = foxiz_html__( 'This article was removed from your bookmark', 'foxiz' );
}
set_transient( $transient_ID, array_unique( $bookmarked ), $this->settings['expiration'] );
}
if ( ! empty( $this->settings['notification'] ) ) {
$response['title'] = get_the_title( $post_id );
$response['image'] = '
';
}
wp_send_json( $response, null );
}
/**
* get bookmarks
*/
public function get_bookmarks() {
if ( is_user_logged_in() ) {
$bookmarked = get_user_meta( get_current_user_id(), $this->meta_ID, true );
} else {
$bookmarked = get_transient( 'rb_bookmark_' . $this->get_ip() );
}
return $bookmarked;
}
public function sync_bookmarks() {
wp_send_json( $this->get_bookmarks(), null );
}
/**
* @return false|WP_Query
*/
public function get_query() {
$data = $this->get_bookmarks();
if ( is_array( $data ) && count( $data ) ) {
return new WP_Query( array(
'post_type' => 'post',
'post__in' => $data,
'ignore_sticky_posts' => 1,
'duplicate_allowed' => 1
) );
} else {
return false;
}
}
/**
* @param $new_status
* @param $old_status
* @param $post
*/
public function push_notification( $new_status, $old_status, $post ) {
if ( ( 'publish' === $new_status && 'publish' !== $old_status ) && 'post' === $post->post_type ) {
update_option( 'rb_push_notification', $post->ID );
}
}
/**
* @return array|mixed
*/
public function get_user_categories() {
if ( is_user_logged_in() ) {
$ids = get_user_meta( get_current_user_id(), $this->meta_category_ID, true );
if ( ! empty( $ids ) && is_array( $ids ) && count( $ids ) ) {
return $ids;
}
}
$data = array();
$counter = 1;
$categories = get_categories( array(
'orderby' => 'count',
'order' => 'DESC'
) );
foreach ( $categories as $category ) {
array_push( $data, $category->term_id );
if ( $counter >= 4 ) {
break;
}
$counter ++;
}
return $data;
}
/** follow toggle */
public function follow_toggle() {
if ( empty( $_POST['cid'] ) && ! is_user_logged_in() ) {
wp_send_json( '', null );
}
$category_id = intval( $_POST['cid'] );
$response = array(
'action' => 'added',
);
if ( is_user_logged_in() ) {
$user_id = get_current_user_id();
$followed = get_user_meta( $user_id, $this->meta_category_ID, true );
if ( empty( $followed ) || ! is_array( $followed ) ) {
$followed = array();
}
$key = array_search( $category_id, $followed );
if ( false === $key ) {
array_push( $followed, $category_id );
} else {
unset( $followed[ $key ] );
$response['action'] = 'removed';
}
update_user_meta( $user_id, $this->meta_category_ID, array_unique( $followed ) );
}
wp_send_json( $response, null );
}
/**
* @param $category_id
*
* @return bool
*/
public function is_followed( $category_id ) {
if ( ! is_user_logged_in() ) {
return false;
}
$data = get_user_meta( get_current_user_id(), $this->meta_category_ID, true );
if ( empty( $data ) || ! is_array( $data ) ) {
return false;
} else {
return in_array( $category_id, $data );
}
}
}
}
PK ! /"! "! bookmark/templates.phpnu [ 'uid_saved',
'bookmark_action' => true,
'classes' => 'saved-content',
) );
unset( $settings['pagination'] );
$image_description = foxiz_get_option( 'saved_image' );
$image_description_dark = foxiz_get_option( 'saved_image_dark' );
$heading_classes = 'bookmark-section-header';
if ( ! empty( $settings['pattern'] ) && '-1' !== (string) $settings['pattern'] ) {
$heading_classes .= ' is-pattern pattern-' . esc_attr( $settings['pattern'] );
} else {
$heading_classes .= ' solid-bg';
}
$_query = Foxiz_Bookmark::get_instance()->get_query();
?>
have_posts() ) :
foxiz_the_blog( $settings, $_query );
else : ?>
foxiz_get_option( 'interest_layout' ),
'url' => foxiz_get_option( 'interest_url' ),
'follow' => true,
'title_tag' => 'h4',
'count_posts' => true,
); ?>
'uid_rec',
);
$settings = foxiz_get_archive_page_settings( 'recommended_', $settings );
if ( is_user_logged_in() ) {
$settings['categories'] = Foxiz_Bookmark::get_instance()->get_user_categories();
if ( ! is_array( $settings['categories'] ) || ! count( $settings['categories'] ) ) {
$settings['order'] = 'popular_m';
}
} elseif ( function_exists( 'pvc_get_post_views' ) ) {
$settings['order'] = 'popular';
} else {
$settings['order'] = 'comment_count';
}
$_query = foxiz_query( $settings );
if ( ! $_query->have_posts() ) {
return false;
} ?>
get_user_categories();
$settings['classes'] = 'block-follow';
if ( empty( $settings['columns'] ) ) {
$settings['columns'] = 5;
}
if ( empty( $settings['column_gap'] ) ) {
$settings['column_gap'] = 10;
}
foxiz_block_open_tag( $settings ); ?>
PK ! \4I I style.cssnu [ /*
Theme Name: Foxiz
Theme URI: https://tf01.themeruby.com
Author: Theme-Ruby
Author URI: https://themeforest.net/user/theme-ruby/
Description: Foxiz - WordPress Newspaper News and Magazine Theme
Requires at least: 5.3
Tested up to: 5.9
Requires PHP: 5.6
Text Domain: foxiz
Version: 1.4
Tags: custom-background, custom-menu, featured-images, theme-options, custom-colors, translation-ready, threaded-comments, translation-ready
License: Themeforest Licence
License URI: http://themeforest.net/licenses/standard
*/PK ! t
footer.phpnu [