user_id;
if ($commentauthor_ID ==0) {
$author = get_comment_author( $comment->comment_ID);
$url = get_comment_author_url( $comment->comment_ID);
if ( empty( $url ) || 'http://' == $url )
$return = $author;
else
$return = ''.$author.'';
}
else {
$author = get_userdata($commentauthor_ID);
/* Registered Commenter */
if ( !empty($author) ){
$authorid = $author->ID;
$authorName = $author->display_name;
if (class_exists( 'BuddyPress' )) {
return ''.$authorName.'';
}
elseif (count_user_posts($authorid) > 0 && !empty($author)) {
return ''.$authorName.'';
}
else {
$author = get_comment_author($comment->comment_ID);
$return = $author;
}
}
else {
$author = get_comment_author($comment->comment_ID);
$return = $author;
}
}
return $return;
}
}
if (rehub_option('enable_comment_link') == 1){
add_filter('get_comment_author_link', 'rh_comment_author_profile_link');
}
/**
* This file represents an example of the code that themes would use to register
* the required plugins.
*
* It is expected that theme authors would copy and paste this code into their
* functions.php file, and amend to suit.
*
* @package TGM-Plugin-Activation
* @subpackage Example
* @version 2.4.0
* @author Thomas Griffin
* @author Gary Jones
* @copyright Copyright (c) 2014, Thomas Griffin
* @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
* @link https://github.com/thomasgriffin/TGM-Plugin-Activation
*/
/**
* Include the TGM_Plugin_Activation class.
*/
require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'my_theme_register_required_plugins' );
/**
* Register the required plugins for this theme.
*
* In this example, we register two plugins - one included with the TGMPA library
* and one from the .org repo.
*
* The variable passed to tgmpa_register_plugins() should be an array of plugin
* arrays.
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
*/
if( !function_exists('my_theme_register_required_plugins') ) {
function my_theme_register_required_plugins() {
/**
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
array(
'name' => 'Greenshift - page builder',
'slug' => 'greenshift-animation-and-page-builder-blocks',
'required' => false,
'image_url' => get_template_directory_uri() . '/admin/screens/images/gs.jpg',
'description' => 'Page builder for Gutenberg',
),
array(
'name' => 'Greenshift Animation addon', // The plugin name
'slug' => 'greenshiftgsap', // The plugin slug (typically the folder name)
'source' => get_template_directory() . '/plugins/greenshiftgsap.zip',
'required' => false,
'version' => '3.7.4',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
'image_url' => get_template_directory_uri() . '/admin/screens/images/gs.jpg',
'description' => 'Animation addon',
),
array(
'name' => 'One Click Demo Import',
'slug' => 'one-click-demo-import',
'required' => false,
'image_url' => get_template_directory_uri() . '/admin/screens/images/ocdi.jpg',
'description' => 'Import demo content and settings',
),
array(
'name' => 'Envato Market', // The plugin name
'slug' => 'envato-market', // The plugin slug (typically the folder name)
'source' => get_template_directory() . '/plugins/envato-market.zip', // The plugin source
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '', // If set, overrides default API URL and points to an external URL
'image_url' => get_template_directory_uri() . '/admin/screens/images/envato.jpg',
'description' => 'Auto update of theme',
),
array(
'name' => 'Content EGG',
'slug' => 'content-egg',
'required' => false,
'image_url' => get_template_directory_uri() . '/admin/screens/images/contentegg.png',
'description' => 'All in one for moneymaking',
),
array(
'name' => 'Rehub Framework', // The plugin name
'slug' => 'rehub-framework', // The plugin slug (typically the folder name)
'source' => get_template_directory() . '/plugins/rehub-framework.zip',
'required' => true,
'version' => '19.8.3',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
'image_url' => get_template_directory_uri() . '/admin/screens/images/framework.png',
'description' => 'Rehub Theme framework',
),
);
$plugins[] = array(
'name' => 'Elementor',
'slug' => 'elementor',
'required' => false,
'image_url' => get_template_directory_uri() . '/admin/screens/images/elementor.jpg',
'description' => 'Elementor Page Builder',
);
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array(
'id' => 'rehub-theme', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to pre-packaged plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
'strings' => array(
'page_title' => esc_html__( 'Install Required Plugins', 'rehub-theme' ),
'menu_title' => esc_html__( 'Install Plugins', 'rehub-theme' ),
'installing' => esc_html__( 'Installing Plugin: %s', 'rehub-theme' ), // %s = plugin name.
'oops' => esc_html__( 'Something went wrong with the plugin API.', 'rehub-theme' ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'rehub-theme' ), // %1$s = plugin name(s).
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s. Please, activate only those plug-ins which are necessary to you', 'rehub-theme' ), // %1$s = plugin name(s).
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'rehub-theme' ), // %1$s = plugin name(s).
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'rehub-theme' ), // %1$s = plugin name(s).
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'rehub-theme' ), // %1$s = plugin name(s).
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'rehub-theme' ), // %1$s = plugin name(s).
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'rehub-theme' ), // %1$s = plugin name(s).
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'rehub-theme' ), // %1$s = plugin name(s).
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'rehub-theme' ),
'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'rehub-theme' ),
'return' => esc_html__( 'Return to Required Plugins Installer and Activate plugins', 'rehub-theme' ),
'plugin_activated' => esc_html__( 'Plugin activated successfully.', 'rehub-theme' ),
'complete' => esc_html__( 'All plugins installed and activated successfully. %s', 'rehub-theme' ), // %s = dashboard link.
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
)
);
tgmpa( $plugins, $config );
}
}
// Open Graph + JSON-LD
function re_add_openschema() {
$jsonload = $jsonloadsale = array();
if(rehub_option('type_schema_review') != 'none'){
if (is_single() && !is_singular('product')) {
global $post;
$overal_score = rehub_get_overall_score();
if($overal_score){
$author_data = get_userdata($post->post_author);
$jsonload["@context"] = "http://schema.org/";
$reviewtext = get_post_meta((int)$post->ID, '_review_post_summary_text', true);
if(!$reviewtext){
$review_post = rehub_get_review_data();
$reviewtext = (!empty($review_post['review_post_summary_text'])) ? $review_post['review_post_summary_text'] : '';
}
$review_body = ($reviewtext) ? $reviewtext : $post->post_excerpt;
$reviewhead = get_post_meta((int)$post->ID, '_review_heading', true);
if(!$reviewhead){
if(!isset($review_post)){
$review_post = rehub_get_review_data();
}
$reviewhead = (!empty($review_post['review_post_heading'])) ? $review_post['review_post_heading'] : '';
}
$review_name = ($reviewhead) ? $reviewhead : $post->post_title;
$usercount = '';
if(rehub_option('type_user_review') == 'full_review'){
$user_rates = get_post_meta($post->ID, 'post_user_raitings', true);
if (!empty($user_rates)) {
$usercount = (!empty($user_rates['criteria'][0]['count'])) ? $user_rates['criteria'][0]['count'] : '';
}
}
if (rehub_option('type_user_review') == 'simple'){
$usercount = get_post_meta((int)$post->ID, 'rehub_users_num', true );
}
if(!$usercount) $usercount = '1';
$jsonload["@type"] = "Review";
$jsonload["name"] = $review_name;
$jsonload["datePublished"] = $post->post_date;
$jsonload["dateModified"] = $post->post_modified;
$jsonload["reviewBody"] = $review_body;
$jsonload["reviewRating"] = array(
"@type" => "Rating",
"worstRating" => "1",
"bestRating" => "10",
"ratingValue" => round($overal_score, 1),
);
$jsonload["author"] = array(
"@type" => "Person",
"name" => $author_data->display_name,
);
$jsonload["itemReviewed"] = array(
"@type" => "Product",
"name" => $post->post_title,
"aggregateRating" => array(
"@type" => "AggregateRating",
"worstRating" => "1",
"bestRating" => "10",
"ratingValue" => round($overal_score, 1),
"reviewCount" => $usercount,
)
);
$organization = rehub_option('rehub_org_name_review');
$logo = rehub_option('rehub_logo');
$logo_width = rehub_option('rehub_logo_retina_width');
$logo_height = rehub_option('rehub_logo_retina_height');
if ($organization ){
$jsonload["publisher"] = array(
"@type" => "Organization",
"name" => esc_html($organization),
);
if ($logo_width && $logo_height && $logo){
$jsonload["publisher"]["logo"] = array(
"@type" => "ImageObject",
"url" => esc_url($logo),
"height" => esc_html($logo_height),
"width" => esc_html($logo_width),
);
}
}
}
}else if(is_tax('dealstore')){
$tagid = get_queried_object()->term_id;
$rate = get_term_meta( $tagid , 'rehub_user_rate', true );
$count = get_term_meta( $tagid , 'rehub_users_num', true );
$brandimage = get_term_meta( $tagid, 'brandimage', true );
if($brandimage && $count){
$tagobj = get_term_by('id', $tagid, 'dealstore');
$jsonload["@context"] = "http://schema.org/";
$jsonload["@type"] = "WebPage";
$jsonload["url"] = get_term_link($tagid);
$jsonload["aggregateRating"] = array(
"worstRating" => "1",
"bestRating" => "5",
"name"=> $tagobj->name,
"ratingValue" => round($rate/$count,2),
"reviewCount" => $count,
"itemReviewed" => array(
"name"=> $tagobj->name,
"@type" => "Store",
"image" => $brandimage
)
);
}
}
if(function_exists('bp_get_profile_field_data')){
if(bp_is_user()){
$bp=buddypress();
$bpuserid = $bp->displayed_user->id;
$seo_user_description = '';
$profile_description = rehub_option('rh_bp_seo_description');
$profile_phone = rehub_option('rh_bp_phone');
$bpuserrating = get_user_meta( $bpuserid, 'rh_bp_user_rating', true);
$bpuserratingcount = get_user_meta( $bpuserid, 'rh_total_bp_user_rating_num', true);
$image = bp_attachments_get_attachment('url', array('object_dir' => 'members','item_id' => $bpuserid) );
if ($profile_description){
$seo_user_description = bp_get_profile_field_data('field='.$profile_description.'&user_id='.$bpuserid);
}
if ($profile_phone){
$phone = bp_get_profile_field_data('field='.$profile_phone.'&user_id='.$bpuserid);
}
if(!$seo_user_description){
$seo_user_description = get_bloginfo('description');
}
$seo_user_description = apply_filters('rh_bp_user_seo_description', $seo_user_description);
echo '';
}
}
}
if(!empty($jsonload)){
echo '';
}
}
add_action( 'wp_head', 're_add_openschema', 5 );
//VC init
if (class_exists('WPBakeryVisualComposerAbstract')) {
if(!function_exists('add_rehub_to_vc')) {
function add_rehub_to_vc(){
require_once ( 'functions/vc_functions.php');
}
}
if(!function_exists('rehub_vc_styles')) {
function rehub_vc_styles() {
wp_enqueue_style('rehub_vc', get_template_directory_uri() .'/functions/vc/vc.css', array(), time(), 'all');
}
}
function rhVCSetAsTheme() {
vc_set_as_theme();
}
add_action( 'vc_before_init', 'rhVCSetAsTheme' );
add_action('init','add_rehub_to_vc', 5);
add_action('admin_enqueue_scripts', 'rehub_vc_styles');
}
//Elementor Init
if ( did_action( 'elementor/loaded' ) ) {
require_once ('functions/el_functions.php');
//require_once ('rehub-elementor/templates/remote.php');
}
/*
function rehub_admin_error_notice() {
$page = (isset($_GET['page'])) ? $_GET['page'] : '';
global $current_user ;
$user_id = $current_user->ID;
if ( ! get_user_meta($user_id, 'ignore_notices_rehub149') ) {
//if ($page=='rehub' || $page=='rehub-support' || $page=='rehub-plugins' || $page=='rehub-demos' || $page=='vpt_option' ) {
$class = "error";
$message = 'This is major update of theme affected post formats. Check our documentation in Rehub 15.0 notice' ;
echo"