Your IP : 216.73.216.11


Current Path : /home/digilove/public_html/41423/
Upload File :
Current File : //home/digilove/public_html/41423/Version.php.tar

home/digilove/public_html/libraries/src/Version.php000064400000017401152345540670016517 0ustar00<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Helper\LibraryHelper;

/**
 * Version information class for the Joomla CMS.
 *
 * @since  1.0
 */
final class Version
{
	/**
	 * Product name.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const PRODUCT = 'Joomla!';

	/**
	 * Major release version.
	 *
	 * @var    integer
	 * @since  3.8.0
	 */
	const MAJOR_VERSION = 3;

	/**
	 * Minor release version.
	 *
	 * @var    integer
	 * @since  3.8.0
	 */
	const MINOR_VERSION = 10;

	/**
	 * Patch release version.
	 *
	 * @var    integer
	 * @since  3.8.0
	 */
	const PATCH_VERSION = 12;

	/**
	 * Extra release version info.
	 *
	 * This constant when not empty adds an additional identifier to the version string to reflect the development state.
	 * For example, for 3.8.0 when this is set to 'dev' the version string will be `3.8.0-dev`.
	 *
	 * @var    string
	 * @since  3.8.0
	 */
	const EXTRA_VERSION = '';

	/**
	 * Release version.
	 *
	 * @var    string
	 * @since  3.5
	 * @deprecated  4.0  Use separated version constants instead
	 */
	const RELEASE = '3.10';

	/**
	 * Maintenance version.
	 *
	 * @var    string
	 * @since  3.5
	 * @deprecated  4.0  Use separated version constants instead
	 */
	const DEV_LEVEL = '12';

	/**
	 * Development status.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const DEV_STATUS = 'Stable';

	/**
	 * Build number.
	 *
	 * @var    string
	 * @since  3.5
	 * @deprecated  4.0
	 */
	const BUILD = '';

	/**
	 * Code name.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const CODENAME = 'Daraja';

	/**
	 * Release date.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const RELDATE = '8-July-2023';

	/**
	 * Release time.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const RELTIME = '15:18';

	/**
	 * Release timezone.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const RELTZ = 'GMT';

	/**
	 * Copyright Notice.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const COPYRIGHT = '(C) 2005 Open Source Matters, Inc. <https://www.joomla.org>';

	/**
	 * Link text.
	 *
	 * @var    string
	 * @since  3.5
	 */
	const URL = '<a href="https://www.joomla.org">Joomla!</a> is Free Software released under the GNU General Public License.';

	/**
	 * Magic getter providing access to constants previously defined as class member vars.
	 *
	 * @param   string  $name  The name of the property.
	 *
	 * @return  mixed   A value if the property name is valid.
	 *
	 * @since   3.5
	 * @deprecated  4.0  Access the constants directly
	 */
	public function __get($name)
	{
		if (defined("JVersion::$name"))
		{
			\JLog::add(
				'Accessing Version data through class member variables is deprecated, use the corresponding constant instead.',
				\JLog::WARNING,
				'deprecated'
			);

			return constant("\\Joomla\\CMS\\Version::$name");
		}

		$trace = debug_backtrace();
		trigger_error(
			'Undefined constant via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'],
			E_USER_NOTICE
		);
	}

	/**
	 * Check if we are in development mode
	 *
	 * @return  boolean
	 *
	 * @since   3.4.3
	 */
	public function isInDevelopmentState()
	{
		return strtolower(self::DEV_STATUS) !== 'stable';
	}

	/**
	 * Compares two a "PHP standardized" version number against the current Joomla version.
	 *
	 * @param   string  $minimum  The minimum version of the Joomla which is compatible.
	 *
	 * @return  boolean True if the version is compatible.
	 *
	 * @link    https://www.php.net/version_compare
	 * @since   1.0
	 */
	public function isCompatible($minimum)
	{
		return version_compare(JVERSION, $minimum, 'ge');
	}

	/**
	 * Method to get the help file version.
	 *
	 * @return  string  Version suffix for help files.
	 *
	 * @since   1.0
	 */
	public function getHelpVersion()
	{
		return '.' . self::MAJOR_VERSION . self::MINOR_VERSION;
	}

	/**
	 * Gets a "PHP standardized" version string for the current Joomla.
	 *
	 * @return  string  Version string.
	 *
	 * @since   1.5
	 */
	public function getShortVersion()
	{
		$version = self::MAJOR_VERSION . '.' . self::MINOR_VERSION . '.' . self::PATCH_VERSION;

		// Has to be assigned to a variable to support PHP 5.3 and 5.4
		$extraVersion = self::EXTRA_VERSION;

		if (!empty($extraVersion))
		{
			$version .= '-' . $extraVersion;
		}

		return $version;
	}

	/**
	 * Gets a version string for the current Joomla with all release information.
	 *
	 * @return  string  Complete version string.
	 *
	 * @since   1.5
	 */
	public function getLongVersion()
	{
		return self::PRODUCT . ' ' . $this->getShortVersion() . ' '
			. self::DEV_STATUS . ' [ ' . self::CODENAME . ' ] ' . self::RELDATE . ' '
			. self::RELTIME . ' ' . self::RELTZ;
	}

	/**
	 * Returns the user agent.
	 *
	 * @param   string  $suffix      String to append to resulting user agent.
	 * @param   bool    $mask        Mask as Mozilla/5.0 or not.
	 * @param   bool    $addVersion  Add version afterwards to component.
	 *
	 * @return  string  User Agent.
	 *
	 * @since   1.0
	 */
	public function getUserAgent($suffix = null, $mask = false, $addVersion = true)
	{
		if ($suffix === null)
		{
			$suffix = 'Framework';
		}

		if ($addVersion)
		{
			$suffix .= '/' . self::RELEASE;
		}

		// If masked pretend to look like Mozilla 5.0 but still identify ourselves.
		if ($mask)
		{
			return 'Mozilla/5.0 ' . self::PRODUCT . '/' . self::RELEASE . '.' . self::DEV_LEVEL . ($suffix ? ' ' . $suffix : '');
		}
		else
		{
			return self::PRODUCT . '/' . self::RELEASE . '.' . self::DEV_LEVEL . ($suffix ? ' ' . $suffix : '');
		}
	}

	/**
	 * Generate a media version string for assets
	 * Public to allow third party developers to use it
	 *
	 * @return  string
	 *
	 * @since   3.2
	 */
	public function generateMediaVersion()
	{
		$date = new \JDate;

		return md5($this->getLongVersion() . \JFactory::getConfig()->get('secret') . $date->toSql());
	}

	/**
	 * Gets a media version which is used to append to Joomla core media files.
	 *
	 * This media version is used to append to Joomla core media in order to trick browsers into
	 * reloading the CSS and JavaScript, because they think the files are renewed.
	 * The media version is renewed after Joomla core update, install, discover_install and uninstallation.
	 *
	 * @return  string  The media version.
	 *
	 * @since   3.2
	 */
	public function getMediaVersion()
	{
		// Load the media version and cache it for future use
		static $mediaVersion = null;

		if ($mediaVersion === null)
		{
			// Get the joomla library params
			$params = LibraryHelper::getParams('joomla');

			// Get the media version
			$mediaVersion = $params->get('mediaversion', '');

			// Refresh assets in debug mode or when the media version is not set
			if (JDEBUG || empty($mediaVersion))
			{
				$mediaVersion = $this->generateMediaVersion();

				$this->setMediaVersion($mediaVersion);
			}
		}

		return $mediaVersion;
	}

	/**
	 * Function to refresh the media version
	 *
	 * @return  Version  Instance of $this to allow chaining.
	 *
	 * @since   3.2
	 */
	public function refreshMediaVersion()
	{
		$newMediaVersion = $this->generateMediaVersion();

		return $this->setMediaVersion($newMediaVersion);
	}

	/**
	 * Sets the media version which is used to append to Joomla core media files.
	 *
	 * @param   string  $mediaVersion  The media version.
	 *
	 * @return  Version  Instance of $this to allow chaining.
	 *
	 * @since   3.2
	 */
	public function setMediaVersion($mediaVersion)
	{
		// Do not allow empty media versions
		if (!empty($mediaVersion))
		{
			// Get library parameters
			$params = LibraryHelper::getParams('joomla');

			$params->set('mediaversion', $mediaVersion);

			// Save modified params
			LibraryHelper::saveParams('joomla', $params);
		}

		return $this;
	}
}
home/digilove/public_html/libraries/regularlabs/src/Version.php000064400000024635152346342400021021 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         23.7.24631
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            https://regularlabs.com
 * @copyright       Copyright © 2023 Regular Labs All Rights Reserved
 * @license         GNU General Public License version 2 or later
 */

namespace RegularLabs\Library;

defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper as JComponentHelper;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\CMS\Router\Route as JRoute;
use Joomla\CMS\Session\Session as JSession;
use Joomla\CMS\Uri\Uri as JUri;

jimport('joomla.filesystem.file');

/**
 * Class Version
 * @package RegularLabs\Library
 */
class Version
{
    /**
     * Get the version of the given extension
     *
     * @param        $alias
     * @param string $type
     * @param string $folder
     *
     * @return string
     */
    public static function get($alias, $type = 'component', $folder = 'system')
    {
        return trim(Extension::getXmlValue('version', $alias, $type, $folder));
    }

    /**
     * Get the version of the given component
     *
     * @param $alias
     *
     * @return string
     */
    public static function getComponentVersion($alias)
    {
        return self::get($alias, 'component');
    }

    /**
     * Get the full footer
     *
     * @param     $name
     * @param int $copyright
     *
     * @return string
     */
    public static function getFooter($name, $copyright = true)
    {
        Document::loadMainDependencies();

        $html = [];

        $html[] = '<div class="rl_footer_extension">' . self::getFooterName($name) . '</div>';
        $html[] = '<div class="rl_footer_documentation">' . self::getFooterDocumentationLink($name) . '</div>';

        if ($copyright)
        {
            $html[] = '<div class="rl_footer_review">' . self::getFooterReview($name) . '</div>';
            $html[] = '<div class="rl_footer_logo">' . self::getFooterLogo() . '</div>';
            $html[] = '<div class="rl_footer_copyright">' . self::getFooterCopyright() . '</div>';
        }

        return '<div class="rl_footer">' . implode('', $html) . '</div>';
    }

    /**
     * Get the version message
     *
     * @param $alias
     *
     * @return string
     */
    public static function getMessage($alias)
    {
        if ( ! $alias)
        {
            return '';
        }

        $name    = Extension::getNameByAlias($alias);
        $alias   = Extension::getAliasByName($alias);
        $version = self::get($alias);

        if ( ! $version)
        {
            return '';
        }

        Document::loadMainDependencies();

        $url    = 'download.regularlabs.com/extensions.xml?j=3&e=' . $alias;
        $script = "
            jQuery(document).ready(function() {
                RegularLabsScripts.loadajax(
                    '" . $url . "',
                    'RegularLabsScripts.displayVersion( data, \"" . $alias . "\", \"" . str_replace(['FREE', 'PRO'], '', $version) . "\" )',
                    'RegularLabsScripts.displayVersion( \"\" )',
                    null, null, null, (60 * 60)
                );
            });
        ";
        JFactory::getDocument()->addScriptDeclaration($script);

        return '<div class="alert alert-success" style="display:none;" id="regularlabs_version_' . $alias . '">' . self::getMessageText($alias, $name, $version) . '</div>';
    }

    /**
     * Get the version of the given module
     *
     * @param $alias
     *
     * @return string
     */
    public static function getModuleVersion($alias)
    {
        return self::get($alias, 'module');
    }

    /**
     * Get the version of the given plugin
     *
     * @param        $alias
     * @param string $folder
     *
     * @return string
     */
    public static function getPluginVersion($alias, $folder = 'system')
    {
        return self::get($alias, 'plugin', $folder);
    }

    /**
     * Get the copyright text for the footer
     *
     * @return string
     */
    private static function getFooterCopyright()
    {
        return JText::_('RL_COPYRIGHT') . ' &copy; ' . date('Y') . ' Regular Labs - ' . JText::_('RL_ALL_RIGHTS_RESERVED');
    }

    /**
     * Get the Regular Labs logo for the footer
     *
     * @return string
     */
    private static function getFooterLogo()
    {
        return JText::sprintf(
            'RL_POWERED_BY',
            '<a href="https://regularlabs.com" target="_blank">'
            . '<img src="' . JUri::root() . 'media/regularlabs/images/logo.svg" width="112" height="24" alt="Regular Labs">'
            . '</a>'
        );
    }

    /**
     * Get the extension name and version for the footer
     *
     * @param $name
     *
     * @return string
     */
    private static function getFooterName($name)
    {
        $name   = JText::_($name);
        $alias  = Extension::getAliasByName($name);
        $suffix = self::getVersionSuffix($alias);

        return '<a href="https://regularlabs.com/' . $alias . '" target="_blank">' . $name . '</a>' . $suffix;
    }

    /**
     * Get the link to the documentation for the footer
     *
     * @param $name
     *
     * @return string
     */
    private static function getFooterDocumentationLink($name)
    {
        $alias = Extension::getAliasByName($name);

        return JText::sprintf('RL_GO_TO_DOCUMENTATION', '<span class="icon-book" aria-hidden="true"></span>', '<a href="https://docs3.regularlabs.com/' . $alias . '" target="_blank">', '</a>');
    }

    /**
     * Get the version for the footer name
     *
     * @param $alias
     *
     * @return string
     */
    private static function getVersionSuffix($alias)
    {
        $version = self::get($alias);

        if ( ! $version)
        {
            return '';
        }

        if (strpos($version, 'PRO') !== false)
        {
            return ' v' . str_replace('PRO', '', $version) . ' <small>[PRO]</small>';
        }

        if (strpos($version, 'FREE') !== false)
        {
            return ' v' . str_replace('FREE', '', $version) . ' <small>[FREE]</small>';
        }

        return ' v' . $version;
    }

    /**
     * Get the review text for the footer
     *
     * @param $name
     *
     * @return string
     */
    private static function getFooterReview($name)
    {
        $alias = Extension::getAliasByName($name);

        $jed_url = 'http://regl.io/jed-' . $alias . '#reviews';

        return StringHelper::html_entity_decoder(
            JText::sprintf(
                'RL_JED_REVIEW',
                '<a href="' . $jed_url . '" target="_blank">',
                '</a>'
                . ' <a href="' . $jed_url . '" target="_blank" class="stars">'
                . str_repeat('<span class="icon-star"></span>', 5)
                . '</a>'
            )
        );
    }

    /**
     * Get the version message text
     *
     * @param $alias
     * @param $name
     * @param $version
     *
     * @return array|string
     */
    private static function getMessageText($alias, $name, $version)
    {
        [$url, $onclick] = self::getUpdateLink($alias, $version);

        $href    = $onclick ? '' : 'href="' . $url . '" target="_blank" ';
        $onclick = $onclick ? 'onclick="' . $onclick . '" ' : '';

        $is_pro  = strpos($version, 'PRO') !== false;
        $version = str_replace(['FREE', 'PRO'], ['', ' <small>[PRO]</small>'], $version);

        $msg = '<div class="text-center">'
            . '<span class="ghosted">'
            . JText::sprintf('RL_NEW_VERSION_OF_AVAILABLE', JText::_($name))
            . '</span>'
            . '<br>'
            . '<a ' . $href . $onclick . ' class="btn btn-large btn-success">'
            . '<span class="icon-upload"></span> '
            . StringHelper::html_entity_decoder(JText::sprintf('RL_UPDATE_TO', '<span id="regularlabs_newversionnumber_' . $alias . '"></span>'))
            . '</a>';

        if ( ! $is_pro)
        {
            $msg .= ' <a href="https://regularlabs.com/purchase/cart/add/' . $alias . '" target="_blank" class="btn btn-large btn-primary">'
                . '<span class="icon-basket"></span> '
                . JText::_('RL_GO_PRO')
                . '</a>';
        }

        $msg .= '<br>'
            . '<span class="ghosted">'
            . '[ <a href="https://regularlabs.com/' . $alias . '/changelog" target="_blank">'
            . JText::_('RL_CHANGELOG')
            . '</a> ]'
            . '<br>'
            . JText::sprintf('RL_CURRENT_VERSION', $version)
            . '</span>'
            . '</div>';

        return StringHelper::html_entity_decoder($msg);
    }

    /**
     * Get the url and onclick function for the update link
     *
     * @param $alias
     * @param $version
     *
     * @return array
     */
    private static function getUpdateLink($alias, $version)
    {
        if ((int) JVERSION != 3)
        {
            return ['https://regularlabs.com/' . $alias . '/features', ''];
        }

        $is_pro = strpos($version, 'PRO') !== false;

        if (
            ! file_exists(JPATH_ADMINISTRATOR . '/components/com_regularlabsmanager/regularlabsmanager.xml')
            || ! JComponentHelper::isInstalled('com_regularlabsmanager')
            || ! JComponentHelper::isEnabled('com_regularlabsmanager')
        )
        {
            $url = $is_pro
                ? 'https://regularlabs.com/' . $alias . '/features'
                : JRoute::_('index.php?option=com_installer&view=update');

            return [$url, ''];
        }

        $config = JComponentHelper::getParams('com_regularlabsmanager');

        $key = trim($config->get('key'));

        if ($is_pro && ! $key)
        {
            return ['index.php?option=com_regularlabsmanager', ''];
        }

        jimport('joomla.filesystem.file');

        Document::loadMainDependencies();
        JHtml::_('behavior.modal');

        JFactory::getDocument()->addScriptDeclaration(
            "
            var RLEM_TIMEOUT = " . (int) $config->get('timeout', 5) . ";
            var RLEM_TOKEN = '" . JSession::getFormToken() . "';
        "
        );
        Document::script('regularlabsmanager/script.min.js', '23.7.24631');

        $url = 'https://download.regularlabs.com?ext=' . $alias . '&j=3';

        if ($is_pro)
        {
            $url .= '&k=' . strtolower(substr($key, 0, 8) . md5(substr($key, 8)));
        }

        return ['', 'RegularLabsManager.openModal(\'update\', [\'' . $alias . '\'], [\'' . $url . '\'], true);'];
    }
}