HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/expodubai/wp-content/plugins/modern-events-calendar-lite/app/features/profile.php
<?php
/** no direct access **/
defined('MECEXEC') or die();

/**
 * Webnus MEC profile class.
 * @author Webnus <[email protected]>
 */
class MEC_feature_profile extends MEC_base
{
    /**
     * @var MEC_factory
     */
    public $factory;

    /**
     * @var MEC_main
     */
    public $main;

    /**
     * @var MEC_book
     */
    public $book;

    /**
     * @var string
     */
    public $PT;

    /**
     * Constructor method
     * @author Webnus <[email protected]>
     */
    public function __construct()
    {
        // Import MEC Factory
        $this->factory = $this->getFactory();
        
        // Import MEC Main
        $this->main = $this->getMain();

        // Import MEC Book
        $this->book = $this->getBook();

        // Booking Post Type
        $this->PT = $this->main->get_book_post_type();
    }
    
    /**
     * Initialize profile feature
     * @author Webnus <[email protected]>
     */
    public function init()
    {
        // Profile Shortcode
        $this->factory->shortcode('MEC_profile', array($this, 'profile'));
    }

    /**
     * Show user profile
     * @param array $atts
     * @return string
     */
    public function profile($atts = array())
    {
        // Force to array
        if(!is_array($atts)) $atts = array();

        // Show login/register message if user is not logged in and guest submission is not enabled.
        if(!is_user_logged_in())
        {
            // Show message
            $message = sprintf(__('Please %s/%s in order to see your bookings / profile.', 'modern-events-calendar-lite'), '<a href="'.wp_login_url($this->main->get_full_url()).'">'.__('Login', 'modern-events-calendar-lite').'</a>', '<a href="'.wp_registration_url().'">'.__('Register', 'modern-events-calendar-lite').'</a>');

            ob_start();
            include MEC::import('app.features.profile.message', true, true);
            return ob_get_clean();
        }

        $path = MEC::import('app.features.profile.profile', true, true);

        ob_start();
        include $path;
        return ob_get_clean();
    }
}