public function request_quote_list($atts, $content = null) { $raq_content = YITH_Request_Quote()->get_raq_return(); $args = array('raq_content' => $raq_content, 'template_part' => 'view'); $args['args'] = $args; ob_start(); yit_plugin_get_template(YITH_YWRAQ_DIR, 'request-quote.php', $args); return ob_get_clean(); }
public function get_box() { $recent_posts = $this->_get_content(); $tabs = array(); if (!empty($recent_posts)) { $tabs['view-all'] = array('title' => __('View all', 'yit'), 'content' => $recent_posts); } $data = array('model' => 'static', 'type' => 'static', 'tabs' => $tabs, 'label' => $this->name, 'label_all' => sprintf(__('All %s', 'yit'), $this->name)); yit_plugin_get_template(YIT_Layout()->plugin_path, 'admin/accordion-item.php', $data); }
/** * Print social buttons * * @return void * @since 1.0.0 * @author Emanuela Castorina */ public function social_buttons($template_part = '', $is_shortcode = false) { $enabled_social = YITH_WC_Social_Login()->enabled_social; $template_part = empty($template_part) ? 'social-buttons' : $template_part; if ($is_shortcode) { ob_start(); } if (!is_user_logged_in() && !empty($enabled_social)) { yit_plugin_get_template(YITH_YWSL_DIR, $template_part . '.php', array('label' => get_option('ywsl_social_label'), 'socials' => $enabled_social, 'label_checkout' => get_option('ywsl_social_label_checkout'))); } if ($is_shortcode) { return ob_get_clean(); } }
public static function print_product_slider($atts, $content = null) { global $yith_wc_product_slider; $default_attrs = array('id' => ''); $atts = shortcode_atts($default_attrs, $atts); extract($atts); $id = intval(yith_wpml_get_translated_id($id, 'yith_wcps_type')); if (isset($id) && !empty($id)) { $extra_params = array('en_responsive' => get_option('ywcps_check_responsive') == 'yes' ? "true" : "false", 'n_item_desk_small' => get_option('ywcps_n_item_small_desk'), 'n_item_tablet' => get_option('ywcps_n_item_tablet'), 'n_item_mobile' => get_option('ywcps_n_item_mobile'), 'is_rtl' => get_option('ywcps_check_rtl') == 'yes' ? "true" : "false", 'posts_per_page' => get_option('ywcps_n_posts_per_page'), 'title' => get_the_title($id), 'categories' => get_post_meta($id, '_ywcps_categories', true), 'product_type' => get_post_meta($id, '_ywcps_product_type', true), 'show_title' => get_post_meta($id, '_ywcp_show_title', true) == 1, 'hide_add_to_cart' => get_post_meta($id, '_ywcps_hide_add_to_cart', true) == 1, 'hide_price' => get_post_meta($id, '_ywcps_hide_price', true) == 1, 'n_items' => get_post_meta($id, '_ywcps_image_per_row', true), 'order_by' => get_post_meta($id, '_ywcps_order_by', true), 'order' => get_post_meta($id, '_ywcps_order_type', true), 'is_loop' => get_post_meta($id, '_ywcps_check_loop', true) == 1 ? "true" : "false", 'page_speed' => get_post_meta($id, '_ywcps_pagination_speed', true), 'auto_play' => get_post_meta($id, '_ywcps_auto_play', true), 'stop_hov' => get_post_meta($id, '_ywcps_stop_hover', true) == 1 ? "true" : "false", 'show_nav' => get_post_meta($id, '_ywcps_show_navigation', true) == 1 ? "true" : "false", 'anim_in' => get_post_meta($id, '_ywcps_animate_in', true), 'anim_out' => get_post_meta($id, '_ywcps_animate_out', true), 'anim_speed' => get_post_meta($id, '_ywcps_animation_speed', true), 'show_dot_nav' => get_post_meta($id, '_ywcps_show_dot_navigation', true) == 1 ? "true" : "false", 'template_slider' => get_post_meta($id, '_ywcps_layout_type', true)); $atts['id'] = $id; $atts = array_merge($extra_params, $atts); $atts['atts'] = $atts; $yith_wc_product_slider = true; $template = yit_plugin_get_template(YWCPS_DIR, 'product_slider_view.php', $atts, true); $yith_wc_product_slider = false; return apply_filters('yith_wcpsl_productslider_html', $template, array(), true); } }
/** * put_content_tabs * Put the content at the tabs * @param $key * @param $tab */ public function put_content_tabs($key, $tab) { $args['content'] = get_post_meta($key, '_ywtm_text_tab', true); yit_plugin_get_template(YWTM_DIR, $this->_default_layout . '.php', $args); }
/** * Yit Sidebar Panel * * print HTML code to sidebar panel * * @return void * @since 1.0 * @author Emanuela Castorina <*****@*****.**> */ public function yit_sidebar_panel() { yit_plugin_get_template($this->plugin_path, '/admin/sidebar-panel.php', array('plugin_path' => $this->plugin_path)); ?> <?php }
/** * Show the upgrade to pro version page * * @return void * @since 2.9.13 * @author Andrea Grillo <*****@*****.**> */ public function show_premium_version_upgrade() { yit_plugin_get_template(YIT_CORE_PLUGIN_PATH, 'upgrade/upgrade-to-pro-version.php', array('core_plugin_url' => YIT_CORE_PLUGIN_URL)); }
/** * Shortcode Callback * * Callback for contact forms shortcode; load the correct template whit variables inserted and return the html markup * * @param $atts array() Attributes array for shortcode * @param $content string Shortcode content * @param $shortcode string Shortcode Tag * * @return string * @since 1.0.0 * @author Francesco Licandro <*****@*****.**> */ public function shortcode_callback($atts, $content = null, $shortcode) { //$shortcode_contact = $this->contactform_shortcode(); //foreach( $shortcode_contact as $short ){} global $wpdb; $all_atts = $atts; $all_atts['content'] = $content; $all_atts['button_style'] = isset($all_atts['button_style']) ? $all_atts['button_style'] : 'btn btn-flat'; // get post id of contact form $this->current_form_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_name = %s AND post_type = %s", $all_atts['name'], 'contact-form')); //wpml control $this->current_form_id = yit_wpml_get_translated_id($this->current_form_id, 'contact-form'); $fields = $this->get('_items'); if (!is_array($fields) or empty($fields)) { return null; } ob_start(); yit_plugin_get_template(untrailingslashit($this->plugin_path), 'contact-form/contactform-template.php', array('fields' => $fields, 'post_id' => $this->current_form_id, 'button_style' => $all_atts['button_style'], 'title_position' => $this->get('_title_position'))); $shortcode_html = ob_get_clean(); return apply_filters('yit_shortcode_' . $shortcode, $shortcode_html, $shortcode); }
/** * Return an array with all testimonial categories * * All testimonial categories in an array, the first element of array is a general item * that is useful to show all categories * * @param $atts * @param string $content * @param $shortcode * * @return array * @since 1.0 * @author Emanuela Castorina <*****@*****.**> * @author Francesco Licandro <*****@*****.**> */ public function add_shortcode($atts, $content = "", $shortcode) { $all_atts = $atts; $all_atts['content'] = $content; if (defined('YIT_SHORTCODE')) { $shortcodes = YIT_Shortcodes()->shortcodes; } else { $shortcodes = $this->shortcodes_hook(); } if (isset($shortcodes[$shortcode]['unlimited']) && $shortcodes[$shortcode]['unlimited']) { $atts['content'] = $content; } else { //retrieves default atts $default_atts = array(); if (!empty($shortcodes[$shortcode]['attributes'])) { foreach ($shortcodes[$shortcode]['attributes'] as $name => $type) { $default_atts[$name] = isset($type['std']) ? $type['std'] : ''; if (isset($atts[$name]) && $type['type'] == "checkbox") { if ($atts[$name] == 1 || $atts[$name] == 'yes') { $atts[$name] = 'yes'; } else { $atts[$name] = 'no'; } } } } // // if ( ! empty( $shortcodes[$shortcode]['attributes'] ) ) { // foreach ( $shortcodes[$shortcode]['attributes'] as $name => $type ) { // $default_atts[$name] = isset( $type['std'] ) ? $type['std'] : ''; // } // } //combines with user attributes $atts = shortcode_atts($default_atts, $atts); } // remove validate attrs foreach ($atts as $att => $v) { unset($all_atts[$att]); } $atts['content'] = $content; ob_start(); yit_plugin_get_template($this->plugin_path, 'shortcodes/' . $shortcode . '.php', $atts); $shortcode_html = ob_get_clean(); return apply_filters('yit_shortcode_' . $shortcode, $shortcode_html); }
/** * Shortcode Callback * * Callback for logos shortcode; load the correct template whit variables inserted and return the html markup * * @param $atts array() Attributes array for shortcode * @param $content string Shortcode content * @param $shortcode string Shortcode Tag * * @return string * @since 1.0.0 * @author Antonio La Rocca <*****@*****.**> */ public function shortcode_callback($atts, $content = null, $shortcode) { $shortcode_logo = $this->newsletter_shortcode_list(); $all_atts = $atts; $all_atts['content'] = $content; if (isset($shortcode_logo[$shortcode]['unlimited']) && $shortcode_logo[$shortcode]['unlimited']) { $atts['content'] = $content; } else { //retrieves default atts $default_atts = array(); if (!empty($shortcode_logo[$shortcode]['attributes'])) { foreach ($shortcode_logo[$shortcode]['attributes'] as $name => $type) { $default_atts[$name] = isset($type['std']) ? $type['std'] : ''; if (isset($atts[$name]) && $type['type'] == "checkbox") { if ($atts[$name] == 1 || $atts[$name] == 'yes') { $atts[$name] = 'yes'; } else { $atts[$name] = 'no'; } } } } //combines with user attributes $atts = shortcode_atts($default_atts, $atts); $atts['content'] = $content; } // remove validate attrs foreach ($atts as $att => $v) { unset($all_atts[$att]); } ob_start(); yit_plugin_get_template($this->plugin_path, 'shortcodes/' . $shortcode . '.php', $atts); $shortcode_html = ob_get_clean(); return apply_filters('yit_shortcode_' . $shortcode, $shortcode_html, $shortcode); }
/** * Widget * * Show output of the widget * * @param $args * @param $instance * * @return void * @since Version 1.0 * @author Antonio La Rocca <*****@*****.**> * @author Francesco Licandro <*****@*****.**> */ public function widget($args, $instance) { extract($args); $args['title'] = apply_filters('widget_title', $instance['title']); $args['subtitle'] = apply_filters('widget_subtitle', $instance['subtitle']); $args['icon_form'] = $instance['icon_form']; $args['post_name'] = $instance['post_name']; $args['with_border'] = isset($instance['with_border']) ? $instance['with_border'] : ''; $args['widget'] = true; $args['text'] = empty($instance['text']) ? '' : $instance['text']; $args['button_class'] = isset($instance['button_class']) ? $instance['button_class'] : ''; $class = isset($instance['with_border']) && $instance['with_border'] == 'yes' ? 'newsletter-form with-border' : 'newsletter-form'; echo str_replace('newsletter-form', $class, $before_widget); echo $before_title . $args['title'] . $after_title; if ($args['subtitle'] != '') { echo '<p class="newsletter-subtitle">' . $args['subtitle'] . '</p>'; } yit_plugin_get_template(untrailingslashit(plugin_dir_path(__FILE__)), 'shortcodes/newsletter_form.php', $args); echo $after_widget; }
/** * Show metabox * * show the html of metabox * * * @return void * @since 1.0 * @author Emanuela Castorina <*****@*****.**> */ public function show() { $this->reorder_tabs(); yit_plugin_get_template(YIT_CORE_PLUGIN_PATH, 'metaboxes/tab.php', array('tabs' => $this->tabs)); }
$tab['fields'] = apply_filters('yit_metabox_' . sanitize_title($tab['label']) . '_tab_fields', $tab['fields']); foreach ($tab['fields'] as $id_tab => $field) { $value = yit_get_post_meta($post->ID, $field['id']); $field['value'] = $value != '' ? $value : (isset($field['std']) ? $field['std'] : ''); ?> <div class="the-metabox <?php echo $field['type']; ?> clearfix<?php if (empty($field['label'])) { ?> no-label<?php } ?> "> <?php $args = apply_filters('yit_fw_metaboxes_type_args', array('basename' => YIT_CORE_PLUGIN_PATH, 'path' => '/metaboxes/types/', 'type' => $field['type'], 'args' => array('args' => $field))); extract($args); ?> <?php yit_plugin_get_template($basename, $path . $type . '.php', $args); ?> </div> <?php } ?> </div> <?php } ?> </div>
<h2 class="ypop-title"><?php echo $header; ?> </h2> </div> <div class="ypop-content-wrapper"> <div class="ypop-content"> <?php echo do_shortcode($content); ?> <div class="ypop-content-type"> <?php if ($template_part != '') { yit_plugin_get_template(YITH_YPOP_DIR, $template_part, $args); } elseif ($shortcode != '') { echo do_shortcode($shortcode); } ?> </div> </div> </div> <!-- ypop-border --> <div class="ypop-footer"> <?php echo do_shortcode($footer_content); ?> </div> <div class="ypop-checkzone">
case 'date': if (!isset($query_args['orderby'])) { $query_args['orderby'] = 'post_date'; $query_args['order'] = $order; } break; case 'price': $query_args['meta_key'] = '_price'; $query_args['orderby'] = 'meta_value_num'; $query_args['order'] = $order; break; case 'name': if (!isset($query_args['orderby'])) { $query_args['orderby'] = 'post_title'; $query_args['order'] = $order; } break; } } $atts['query_args'] = $query_args; switch ($template_slider) { case 'default': yit_plugin_get_template(YWCPS_DIR, 'product_slider_view_default.php', $atts, false); break; case 'tmp1': case 'tmp2': case 'tmp3': $atts['layouts'] = $template_slider; yit_plugin_get_template(YWCPS_DIR, 'product_slider_view_custom_template.php', $atts, false); break; }
public function add_shortcode( $atts, $content = "" ) { $shortcode = $this->shortcode_hook(); $default_atts = array(); if ( ! empty( $shortcode['faq']['attributes'] ) ) { foreach ( $shortcode['faq']['attributes'] as $name => $type ) { $default_atts[$name] = isset( $type['std'] ) ? $type['std'] : ''; if( isset( $atts[$name] ) && $type['type'] == "checkbox" ){ if ( $atts[$name] == 1 || $atts[$name] == 'yes' ){ $atts[$name] = 'yes'; }else{ $atts[$name] = 'no'; } } } } //combines with user attributes $atts = shortcode_atts( $default_atts, $atts ); ob_start(); yit_plugin_get_template( $this->plugin_path, 'shortcodes/faq.php', $atts ); $shortcode_html = ob_get_clean(); return apply_filters( 'yit_shortcode_faq', $shortcode_html ); }
<div class="yit-panel-sidebar-widget-title <?php echo $title_class; ?> "> <?php echo $title; ?> </div> <?php } ?> <div class="yit-panel-sidebar-widget-content"><?php echo $content; ?> </div> <?php if (!empty($image)) { $path = YIT_CORE_PLUGIN_URL . '/assets/images/widgets/' . $image; echo "<img class='yit-panel-sidebar-widget-image {$image_class}' src='{$path}' alt='' width='100%'/>"; } ?> </div> <?php if (!empty($badge)) { $basename = YIT_CORE_PLUGIN_PATH; $path = '/panel/sidebar/widgets/badges/badge.php'; yit_plugin_get_template($basename, $path, array('text' => $badge_text, 'type' => $badge)); } ?> </div>
/** * Load single template * * Add the print of single template part for the YIThemes's themes. For all others templates, it's valid the * standard single-services.php template of wordpress. * * @return void * @since 1.0 * @author Antonino Scarfì <*****@*****.**> */ public function load_single_template() { if (!is_singular($this->service_post_type)) { return; } yit_plugin_get_template($this->plugin_path, 'services/single.php'); }
/** * Print Messages * * Print all message in cart and checkout * * @return void * @since 1.0 * @author Emanuela Castorina <*****@*****.**> */ public function print_messages() { foreach ($this->messages as $message) { if (apply_filters('yith_ywcm_is_valid_message', $this->is_valid($message->ID), $message->ID)) { $message_type = get_post_meta($message->ID, '_ywcm_message_type', true); $layout = get_post_meta($message->ID, '_ywcm_message_layout', true) !== '' ? get_post_meta($message->ID, '_ywcm_message_layout', true) : 'layout'; $args = method_exists($this, 'get_' . $message_type . '_args') ? $this->{'get_' . $message_type . '_args'}($message) : false; if ($args) { yit_plugin_get_template(YITH_YWCM_DIR, '/layouts/' . $layout . '.php', $args); } } } }
?> " alt="" title=""/></span> <?php } else { ?> <span class="add-on"><i class="icon-<?php echo $field['icon']; ?> "></i></span> <?php } } } yit_plugin_get_template(untrailingslashit(YIT_Contact_Form()->plugin_path), 'contact-form/fields/' . $field['type'] . '.php', array('field' => $field, 'form_name' => $form_name, 'value' => $value, 'input_class' => $input_class, 'title_position' => $title_position)); ?> <div class="msg-error"><?php echo $error_msg; ?> </div> </div> <div class="clear"></div> </li> <?php } ?> <?php
/** * Print the panel sidebar widgets * * @return void * * @since 1.0 * @author Leanza Francesco <*****@*****.**> */ public function print_panel_sidebar_widgets() { $basename = YIT_CORE_PLUGIN_PATH; $path = '/panel/sidebar/widget.php'; $default_args = array('id' => '', 'title' => '', 'icon' => '', 'content' => '', 'class' => '', 'title_class' => '', 'template' => '', 'badge' => '', 'badge_text' => '', 'image' => '', 'image_class' => '', 'args' => array(), 'hide_if_empty_args' => '', 'priority' => 10, 'starting' => '', 'expiration' => ''); $this->_filter_and_sort_widgets(); foreach ($this->widgets as $widget_id => $widget) { $args = array_merge($widget, array('id' => $widget_id)); $args = wp_parse_args($args, $default_args); $is_started = empty($args['starting']) || strtotime($args['starting'] . ' midnight') <= strtotime('midnight'); $is_expired = !empty($args['expiration']) && strtotime($args['expiration'] . ' midnight') < strtotime('midnight'); if ($is_expired || !$is_started) { continue; } if (!empty($args['hide_if_empty_args'])) { $hide_if_empty_args = $args['hide_if_empty_args']; $continue = false; foreach ($hide_if_empty_args as $hide_if_empty_arg) { if (empty($args['args'][$hide_if_empty_arg])) { $continue = true; break; } } if ($continue) { continue; } } do_action('yit_panel_sidebar_before_widget', $widget_id, $widget); yit_plugin_get_template($basename, $path, $args); do_action('yit_panel_sidebar_after_widget', $widget_id, $widget); } }
<?php if (!isset($tab['fields'])) { continue; } $tab['fields'] = apply_filters('yit_metabox_' . sanitize_title($tab['label']) . '_tab_fields', $tab['fields']); foreach ($tab['fields'] as $id_tab => $field) { $value = yit_get_post_meta($post->ID, $field['id']); $field['value'] = $value != '' ? $value : (isset($field['std']) ? $field['std'] : ''); ?> <div class="the-metabox <?php echo $field['type']; ?> clearfix<?php if (empty($field['label'])) { ?> no-label<?php } ?> "> <?php yit_plugin_get_template(YIT_CORE_PLUGIN_PATH, '/metaboxes/types/' . $field['type'] . '.php', array('args' => $field)); ?> </div> <?php } ?> </div> <?php } ?> </div>
/** * Callback that prints the shortcode * * @param mixed[] $atts Shortcode attributes * @param string $content Shortcode content * * @return string Html markup of the shortcode * @since 1.0 * @author Antonio La Rocca <*****@*****.**> */ public function add_shortcode( $atts, $content = "" ) { $shortcode = $this->shortcode_hook(); $default_atts = array(); if ( ! empty( $shortcode['team_section']['attributes'] ) ) { foreach ( $shortcode['team_section']['attributes'] as $name => $type ) { $default_atts[$name] = isset( $type['std'] ) ? $type['std'] : ''; if( isset( $atts[$name] ) && $type['type'] == "checkbox" ){ if ( $atts[$name] == 1 || $atts[$name] == 'yes' ){ $atts[$name] = 'yes'; }else{ $atts[$name] = 'no'; } } } } //combines with user attributes $atts = shortcode_atts( $default_atts, $atts ); global $wpdb; $atts['post_type'] = get_post_meta( $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type = %s", $atts['team'], $this->teams_post_type ) ), '_post_type', true ); ob_start(); yit_plugin_get_template( $this->plugin_path, 'shortcodes/team_section.php', $atts ); $shortcode_html = ob_get_clean(); return apply_filters( 'yit_shortcode_team', $shortcode_html ); }
public function widget($args, $instance) { $extra_params = array('en_responsive' => get_option('ywcps_check_responsive') == 'yes' ? "true" : "false", 'n_item_desk_small' => 1, 'n_item_tablet' => 1, 'n_item_mobile' => 1, 'is_rtl' => get_option('ywcps_check_rtl') == 'yes' ? "true" : "false", 'id' => $instance['slider_id'], 'posts_per_page' => get_option('ywcps_n_posts_per_page'), 'title' => get_the_title($instance['slider_id']), 'categories' => get_post_meta($instance['slider_id'], '_ywcps_categories', true), 'product_type' => get_post_meta($instance['slider_id'], '_ywcps_product_type', true), 'show_title' => get_post_meta($instance['slider_id'], '_ywcp_show_title', true), 'hide_add_to_cart' => isset($instance['hide_add_to_cart']) && $instance['hide_add_to_cart'] == 'on', 'hide_price' => isset($instance['hide_price']) && $instance['hide_price'] == 'on', 'n_items' => 1, 'order_by' => get_post_meta($instance['slider_id'], '_ywcps_order_by', true), 'order' => get_post_meta($instance['slider_id'], '_ywcps_order_type', true), 'is_loop' => get_post_meta($instance['slider_id'], '_ywcps_check_loop', true) == 1 ? "true" : "false", 'page_speed' => get_post_meta($instance['slider_id'], '_ywcps_pagination_speed', true), 'auto_play' => get_post_meta($instance['slider_id'], '_ywcps_auto_play', true), 'stop_hov' => get_post_meta($instance['slider_id'], '_ywcps_stop_hover', true) == 1 ? "true" : "false", 'show_nav' => get_post_meta($instance['slider_id'], '_ywcps_show_navigation', true) == 1 ? "true" : "false", 'anim_in' => $instance['anim_in'], 'anim_out' => $instance['anim_out'], 'anim_speed' => get_post_meta($instance['slider_id'], '_ywcps_animation_speed', true), 'show_dot_nav' => get_post_meta($instance['slider_id'], '_ywcps_show_dot_navigation', true) == 1 ? "true" : "false", 'template_slider' => get_post_meta($instance['slider_id'], '_ywcps_layout_type', true)); $extra_params['atts'] = $extra_params; extract($args); echo $before_widget; yit_plugin_get_template(YWCPS_DIR, 'product_slider_view.php', $extra_params, false); echo $after_widget; }
/** * Main function to login with social providers * * @since 1.0.0 * @return void * @author Emanuela Castorina <*****@*****.**> */ public function get_login_request() { if (isset($_REQUEST['ywsl_social']) && isset($this->_data['social_list'][$_REQUEST['ywsl_social']])) { $social = $_REQUEST['ywsl_social']; $social_name = $this->_data['social_list'][$_REQUEST['ywsl_social']]['label']; if (!isset($this->config['providers'][$social_name]) || get_option('ywsl_' . $social . '_enable') != 'yes') { return; } try { $this->hybridauth = new Hybrid_Auth($this->config); } catch (Exception $e) { wp_safe_redirect($this->get_redirect_to()); } try { $adapter = $this->hybridauth->authenticate($social_name); $user_profile = $adapter->getUserProfile(); } catch (Exception $e) { //echo $this->get_error( $e->getCode() ); $this->hybridauth->logoutAllProviders(); exit; } $registration_check = $this->verify_user($social, $user_profile->identifier); if ($registration_check) { //registration with this provider exists wp_set_auth_cookie($registration_check, true); wp_safe_redirect($this->get_redirect_to()); exit; } else { $hyb_email = sanitize_email($user_profile->email); $hyb_user_login = sanitize_user($user_profile->displayName, true); $hyb_user_avatar = $user_profile->photoURL; $yith_user_login = $this->get_username($hyb_user_login, $hyb_email); $yith_user_email = $this->get_email($hyb_email); $yith_user_login_validate = validate_username($yith_user_login); $yith_user_email_validate = filter_var($yith_user_email, FILTER_VALIDATE_EMAIL); if (empty($yith_user_login)) { $yith_user_login_validate = false; } if (empty($yith_user_email)) { $yith_user_email_validate = false; } $show_form = false; $show_email = false; $show_username = false; $show_form_errors = array(); if (!$yith_user_email && !is_user_logged_in()) { $show_form = true; $show_email = true; $show_form_errors[] = __('Add your email address', 'yith-woocommerce-social-login'); } if ($yith_user_email && !$yith_user_email_validate) { $show_form = true; $show_email = true; $show_form_errors[] = __('Your email address is not valid!', 'yith-woocommerce-social-login'); } if ($yith_user_email_validate && $this->verify_email_exists($yith_user_email)) { $show_form = true; $show_email = true; $show_form_errors[] = __('This email already exists', 'yith-woocommerce-social-login'); } if (!$yith_user_login || !$yith_user_login_validate) { $show_form = true; $show_username = true; $show_form_errors[] = __('Username is not valid!', 'yith-woocommerce-social-login'); } if ($show_form) { $args = array('errors' => $show_form_errors, 'avatar' => $hyb_user_avatar, 'show_user' => $show_username, 'show_email' => $show_email, 'provider' => $social, 'redirect' => $this->get_redirect_to()); yit_plugin_get_template(YITH_YWSL_DIR, 'request-info.php', $args); exit; } else { //verify if exist an user with that email // $current_customer_id = $this->verify_email_exists( $yith_user_email ); if (is_user_logged_in()) { $current_user = wp_get_current_user(); $current_customer_id = $current_user->ID; } else { $current_customer_id = $this->add_user($yith_user_login, $yith_user_email, $user_profile); } //link account add_user_meta($current_customer_id, $social . '_login_id', $user_profile->identifier, true); add_user_meta($current_customer_id, $social . '_login_data', (array) $user_profile, true); wp_set_auth_cookie($current_customer_id, true); wp_safe_redirect($this->get_redirect_to()); exit; } } } }
echo $incipit; ?> </span><?php } ?> </div> <?php } else { $center = 'newsletter-call3-center'; } ?> <div class="newsletter-call3 <?php echo $center; ?> clearfix"> <?php if (yit_plugin_locate_template(YIT_Newsletter()->plugin_path, 'newsletter-services/' . $integration . '.php')) { yit_plugin_get_template(YIT_Newsletter()->plugin_path, 'newsletter-services/' . $integration . '.php', $args); } ?> </div> <div class="clear"></div> </div> </div> <?php } }