faybobo

Untitled

May 27th, 2021
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.52 KB | None | 0 0
  1. <?php
  2. if(isset($args['before_widget'])) {
  3.     echo $args['before_widget'];
  4. }
  5.  
  6. $PeepSoProfile=PeepSoProfile::get_instance();
  7. $PeepSoUser = $PeepSoProfile->user;
  8.  
  9. $login_with_email = 2 === (int) PeepSo::get_option('login_with_email', 0);
  10.  
  11. ?>
  12.  
  13.     <div class="psw-profile <?php if(isset($instance['show_cover']) && 1 == intval($instance['show_cover'])) { ?>psw-profile--cover<?php } ?> ps-js-widget-me">
  14.         <!-- Title of Profile Widget -->
  15.         <?php
  16.         if ( ! empty( $instance['title'] ) ) {
  17.             echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
  18.         }
  19.         ?>
  20.  
  21.         <?php
  22.         if($instance['user_id'] >0)
  23.         {
  24.             $user  = $instance['user'];
  25.  
  26.             if($instance['user_id'] > 0 && $instance['user_id'] == get_current_user_id()) {
  27.                 $user->profile_fields->load_fields();
  28.                 $stats = $user->profile_fields->profile_fields_stats;
  29.             }
  30.  
  31.             ?>
  32.             <div class="psw-profile__header">
  33.                 <div class="psw-profile__avatar">
  34.                     <?php if(isset($instance['show_cover']) && 1 == intval($instance['show_cover'])) { ?>
  35.                     <div class="psw-profile__cover ps-js-widget-me-cover" style="background-image:url(<?php echo $user->get_cover(750); ?>);"></div>
  36.                     <?php } ?>
  37.                     <a class="ps-avatar psw-avatar--profile" href="<?php echo $user->get_profileurl();?>">
  38.                         <img class="ps-js-widget-me-avatar" src="<?php echo $user->get_avatar();?>"
  39.                             title="<?php echo $user->get_profileurl();?>"
  40.                             alt="<?php printf( __('%s avatar', 'peepso-core'), $user->get_fullname() ); ?>" />
  41.                     </a>
  42.                 </div>
  43.  
  44.                 <div class="psw-profile__meta">
  45.                     <div class="psw-profile__title" data-hover-card="<?php echo $user->get_id() ?>">
  46.                       <a href="<?php echo $user->get_profileurl();?>">
  47.                         <?php
  48.                         //[peepso]_[action]_[WHICH_PLUGIN]_[WHERE]_[WHAT]_[BEFORE/AFTER]
  49.                         do_action('peepso_action_render_user_name_before', $user->get_id());
  50.  
  51.                         echo $user->get_fullname();
  52.  
  53.                         //[peepso]_[action]_[WHICH_PLUGIN]_[WHERE]_[WHAT]_[BEFORE/AFTER]
  54.                         do_action('peepso_action_render_user_name_after', $user->get_id());
  55.                         ?>
  56.                       </a>
  57.                     </div>
  58.                     <div class="ps-notifs psw-notifs--profile ps-js-widget-me-notifications">
  59.                         <?php echo $instance['toolbar']; ?>
  60.                     </div>
  61.                 </div>
  62.  
  63.                 <!-- Profile Completeness -->
  64.                 <?php
  65.  
  66.                 $hide_progress = TRUE;
  67.                 if (isset($stats) && $stats['fields_all'] > 0) {
  68.                     if ($stats['completeness'] < 100) {
  69.                         $hide_progress = FALSE;
  70.                     }
  71.                 }
  72.  
  73.                 ?>
  74.                 <div class="psw-profile__progress ps-js-widget-me-completeness" <?php if ($hide_progress) echo 'style="display:none"'; ?>>
  75.                     <div class="psw-profile__progress-message ps-js-status">
  76.                         <?php
  77.                         echo $stats['completeness_message'];
  78.                         do_action('peepso_action_render_profile_completeness_message_after', $stats);
  79.                         ?>
  80.                     </div>
  81.  
  82.                     <div class="psw-profile__progress-bar ps-js-progressbar"><span style="width:<?php echo $stats['completeness'];?>%"></span></div>
  83.                 </div>
  84.             </div>
  85.             <?php
  86.             //[peepso]_[action]_[WHICH_PLUGIN]_[WHERE]_[WHAT]_[BEFORE/AFTER]
  87.             do_action('peepso_action_widget_profile_name_after', $instance['user_id']);
  88.             ?>
  89.  
  90.             <div class="psw-profile__menu-title">
  91.                 <?php echo __('My Profile', 'peepso-core'); ?>
  92.             </div>
  93.  
  94.             <div class="psw-profile__menu">
  95.                 <?php
  96.                 // Profile Submenu extra links
  97.                 $instance['links']['peepso-core-preferences'] = array(
  98.                     'href' => $user->get_profileurl() . 'about/preferences/',
  99.                     'icon' => 'gcis gci-cog',
  100.                     'label' => __('Preferences', 'peepso-core'),
  101.                 );
  102.  
  103.                 // @todo #2274 this has to be peepso_navigation_profile
  104.                 //                if(class_exists('PeepSoPMP')) {
  105.                 //                    $instance['links']['peepso-pmp'] = array(
  106.                 //                        'href' => pmpro_url("account"),
  107.                 //                        'label' => __('Membership', 'peepso-pmp'),
  108.                 //                        'icon' => 'ps-icon-vcard',
  109.                 //                    );
  110.                 //                }
  111.  
  112.                 $instance['links']['peepso-core-logout'] = array(
  113.                     'href' => PeepSo::get_page('logout'),
  114.                     'icon' => 'gcis gci-power-off',
  115.                     'label' => __('Log Out', 'peepso-core'),
  116.                     'widget'=>TRUE,
  117.                 );
  118.  
  119.                 if (isset($instance['show_community_links']) && $instance['show_community_links'] === 1) {
  120.                     $instance['community_links']['peepso-core-logout'] = $instance['links']['peepso-core-logout'];
  121.                     unset($instance['links']['peepso-core-logout']);
  122.                 }
  123.  
  124.                 foreach($instance['links'] as $id => $link)
  125.                 {
  126.                     if(!isset($link['label']) || !isset($link['href']) || !isset($link['icon'])) {
  127.                         var_dump($link);
  128.                     }
  129.  
  130.                     $class = isset($link['class']) ? $link['class'] : '' ;
  131.  
  132.                     $href = $user->get_profileurl(). $link['href'];
  133.                     if('http' == substr(strtolower($link['href']), 0,4)) {
  134.                         $href = $link['href'];
  135.                     }
  136.  
  137.                     echo '<a href="' . $href . '" class="psw-profile__menu-item ' . $class . '"><i class="' . $link['icon'] . '"></i> ' . $link['label'] . '</a>';
  138.                 }
  139.                 ?>
  140.             </div>
  141.  
  142.             <?php if (isset($instance['show_community_links']) && $instance['show_community_links'] === 1) { ?>
  143.             <div class="psw-profile__menu-title">
  144.                 <?php echo __('Community', 'peepso-core'); ?>
  145.             </div>
  146.  
  147.             <div class="psw-profile__menu">
  148.                 <?php
  149.                 foreach($instance['community_links'] as $link)
  150.                 {
  151.                     if(FALSE == $link['widget'] ) {
  152.                         continue;
  153.                     }
  154.  
  155.                     $class = isset($link['class']) ? $link['class'] : '' ;
  156.                     echo '<a href="' . $link['href'] . '" class="psw-profile__menu-item ' . $class . ' ps-js-widget-community-link"><i class="' . $link['icon'] . '"></i> ' . $link['label'] . '</a>';
  157.  
  158.                 }
  159.                 ?>
  160.             </div>
  161.         <?php } ?>
  162.         <?php } else { ?>
  163.  
  164.             <div class="psf-login">
  165.                 <form class="ps-form ps-form--login ps-js-form-me-widget" action="" onsubmit="return false;" method="post" name="login" id="ps-form-login-me">
  166.                     <!-- Login -->
  167.                     <div class="ps-form__row ps-js-username-field">
  168.                         <div class="ps-form__field ps-form__field--icon">
  169.                           <div class="ps-input__wrapper--icon">
  170.                               <input class="ps-input ps-input--sm ps-input--icon" type="text" name="username" placeholder="<?php echo PeepSoGeneral::get_login_input_label(); ?>" mouseev="true"
  171.                                    autocomplete="off" keyev="true" clickev="true" />
  172.                               <?php if ($login_with_email) { ?>
  173.                               <i class="gcis gci-envelope"></i>
  174.                               <?php } else { ?>
  175.                               <i class="gcis gci-user"></i>
  176.                               <?php } ?>
  177.                           </div>
  178.                           <?php if ($login_with_email) { ?>
  179.                           <div class="ps-form__field-notice ps-form__field-notice--important ps-js-email-notice" style="display:none"><?php echo __('Please use a valid email address.', 'peepso-core'); ?></div>
  180.                           <?php } ?>
  181.                         </div>
  182.                     </div>
  183.  
  184.                     <!-- Password -->
  185.                     <div class="ps-form__row ps-js-password-field">
  186.                         <div class="ps-form__field ps-form__field--icon">
  187.                             <input class="ps-input ps-input--sm ps-input--icon <?php echo PeepSo::get_option_new('password_preview_enable') ? 'ps-js-password-preview' : '' ?>"
  188.                                     type="password" name="password" placeholder="<?php echo __('Password', 'peepso-core'); ?>" mouseev="true"
  189.                                     autocomplete="off" keyev="true" clickev="true" />
  190.                             <i class="gcis gci-key"></i>
  191.                         </div>
  192.                     </div>
  193.                     <?php echo apply_filters( 'gglcptch_display_recaptcha', '', 'my_custom_form' ); ?>
  194.  
  195.                     <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); ?>
  196.                     <?php if( PeepSo::two_factor_plugin_enabled() /* is_plugin_active('two-factor-authentication/two-factor-login.php') */ ) { ?>
  197.                         <!-- Two Factor authentication -->
  198.                         <div class="ps-form__row ps-js-password-field">
  199.                             <div class="ps-form__field ps-form__field--icon">
  200.                                 <input class="ps-input ps-input--sm ps-input--icon" type="password" name="password" placeholder="<?php echo __('Password', 'peepso-core'); ?>" mouseev="true"
  201.                                        autocomplete="off" keyev="true" clickev="true" />
  202.                                 <i class="gcis gci-fingerprint"></i>
  203.                             </div>
  204.                         </div>
  205.                     <?php } ?>
  206.  
  207.                     <!-- Remember password -->
  208.                     <div class="ps-form__row ps-js-password-field">
  209.                         <div class="ps-form__field ps-form__field--checkbox">
  210.                             <div class="ps-checkbox ps-checkbox--login">
  211.                                 <input class="ps-checkbox__input" type="checkbox" alt="<?php echo __('Remember Me', 'peepso-core'); ?>" value="yes" name="remember" id="ps-form-login-me-remember" <?php echo PeepSo::get_option('site_frontpage_rememberme_default', 0) ? ' checked':'';?>>
  212.                                 <label class="ps-checkbox__label" for="ps-form-login-me-remember"><?php echo __('Remember Me', 'peepso-core'); ?></label>
  213.                             </div>
  214.                         </div>
  215.                     </div>
  216.  
  217.                     <!-- Submit form -->
  218.                     <div class="ps-form__row ps-js-password-field">
  219.                         <div class="ps-form__field ps-form__field--submit">
  220.                             <?php $recaptchaEnabled = PeepSo::get_option('recaptcha_login_enable', 0); ?>
  221.                             <button type="submit"
  222.                                 class="ps-btn ps-btn--sm ps-btn--action ps-btn--login ps-btn--loading <?php echo $recaptchaEnabled ? 'ps-js-recaptcha' : ''; ?>"
  223.                                 <?php echo $recaptchaEnabled ? 'disabled="disabled"' : '' ?>>
  224.                                 <span><?php echo __('Login', 'peepso-core'); ?></span>
  225.                                 <img src="<?php echo PeepSo::get_asset('images/ajax-loader.gif'); ?>">
  226.                             </button>
  227.                         </div>
  228.                     </div>
  229.  
  230.                     <input type="hidden" name="option" value="ps_users">
  231.                     <input type="hidden" name="task" value="-user-login">
  232.                     <input type="hidden" name="redirect_to" value="<?php echo PeepSo::get_page('redirectlogin'); ?>" />
  233.                     <?php
  234.                     // Remove ID attribute from nonce field.
  235.                     $nonce = wp_nonce_field('ajax-login-nonce', 'security', true, false);
  236.                     $nonce = preg_replace( '/\sid="[^"]+"/', '', $nonce );
  237.                     echo $nonce;
  238.                     ?>
  239.  
  240.                     <?php do_action('peepso_action_render_login_form_after'); ?>
  241.                 </form>
  242.  
  243.                 <?php do_action('peepso_after_login_form'); ?>
  244.  
  245.                 <div class="psf-login__links">
  246.                     <?php
  247.                     $disable_registration = intval(PeepSo::get_option('site_registration_disabled', 0));
  248.  
  249.                     // PeepSo/peepso#2906 hide "resend activation" until really necessary
  250.                     $hide_resend_activation = TRUE;
  251.                     ?>
  252.  
  253.                     <?php if(0 === $disable_registration) { ?>
  254.                         <a class="psf-login__link psf-login__link--register" href="<?php echo PeepSo::get_page('register'); ?>"><?php echo __('Register', 'peepso-core'); ?></a>
  255.                     <?php } ?>
  256.  
  257.                     <a class="psf-login__link psf-login__link--recover" href="<?php echo PeepSo::get_page('recover'); ?>"><?php echo __('Forgot Password', 'peepso-core'); ?></a>
  258.  
  259.                     <?php if(0 === $disable_registration) { ?>
  260.                         <a class="psf-login__link psf-login__link--activation ps-js-register-activation" href="<?php echo PeepSo::get_page('register'); ?>?resend"><?php echo __('Resend activation code', 'peepso-core'); ?></a>
  261.                     <?php } ?>
  262.                 </div>
  263.             </div>
  264.  
  265.             <script>
  266.                 (function() {
  267.                     // naively check if jQuery exist to prevent error
  268.                     var timer = setInterval(function() {
  269.                         if ( window.jQuery && window.peepso ) {
  270.                             clearInterval( timer );
  271.                             peepso.login.initForm( jQuery('.ps-js-form-me-widget') );
  272.                         }
  273.                     }, 1000 );
  274.                 })();
  275.             </script>
  276.  
  277.             <?php
  278.         }
  279.         ?>
  280.     </div>
  281.  
  282. <?php
  283. if (isset($args['after_widget'])) {
  284.     echo $args['after_widget'];
  285. }
  286.  
  287. if(PeepSo::is_dev_mode()) { include('developer.php'); }
  288. // EOF
  289.  
Advertisement
Add Comment
Please, Sign In to add comment