File manager - Edit - /home/opticamezl/www/newok/Version.php.tar
Back
home/opticamezl/www/newok/libraries/regularlabs/src/Version.php 0000604 00000017607 15172777213 0021041 0 ustar 00 <?php /** * @package Regular Labs Library * @version 25.7.12430 * * @author Peter van Westen <info@regularlabs.com> * @link https://regularlabs.com * @copyright Copyright © 2025 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\Language\Text as JText; use Joomla\CMS\Router\Route as JRoute; use Joomla\CMS\Uri\Uri as JUri; class Version { /** * Get the version of the given extension */ public static function get(string $alias, string $type = 'component', string $folder = 'system'): string { return trim(\RegularLabs\Library\Extension::getXmlValue('version', $alias, $type, $folder)); } /** * Get the version of the given component */ public static function getComponentVersion(string $alias): string { return self::get($alias, 'component'); } /** * Get the full footer */ public static function getFooter(string $name, bool|int $copyright = \true, bool|int $review = \true): string { $html = []; $html[] = '<div class="rl-footer-extension">' . self::getFooterName($name) . '</div>'; $html[] = '<div class="rl-footer-documentation">' . self::getFooterDocumentationLink($name) . '</div>'; if ($copyright && $review) { $html[] = '<div class="rl-footer-review">' . self::getFooterReview($name) . '</div>'; } if ($copyright) { $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 major Joomla version */ public static function getMajorJoomlaVersion(): int { return match ((int) JVERSION) { 4, 5, 6 => 4, default => (int) JVERSION, }; } /** * Get the version message */ public static function getMessage(string $alias): string { if (!$alias) { return ''; } $name = \RegularLabs\Library\Extension::getNameByAlias($alias); $alias = \RegularLabs\Library\Extension::getAliasByName($alias); $version = self::get($alias); if (!$version) { return ''; } 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 */ public static function getModuleVersion(string $alias): string { return self::get($alias, 'module'); } /** * Get the version of the given plugin */ public static function getPluginVersion(string $alias, string $folder = 'system'): string { return self::get($alias, 'plugin', $folder); } /** * Get the copyright text for the footer */ private static function getFooterCopyright(): string { return JText::_('RL_COPYRIGHT') . ' © ' . date('Y') . ' Regular Labs - ' . JText::_('RL_ALL_RIGHTS_RESERVED'); } /** * Get the link to the documentation for the footer */ private static function getFooterDocumentationLink(string $name): string { $alias = \RegularLabs\Library\Extension::getAliasByName($name); return JText::sprintf('RL_GO_TO_DOCUMENTATION', '<span class="icon-book" aria-hidden="true"></span>', '<a href="https://docs4.regularlabs.com/' . $alias . '" target="_blank">', '</a>'); } /** * Get the Regular Labs logo for the footer */ private static function getFooterLogo(): string { return JText::sprintf('RL_POWERED_BY', '<a href="https://regularlabs.com" target="_blank">' . '<img src="' . JUri::root() . 'media/regularlabs/images/logo.svg" width="149" height="32" alt="Regular Labs">' . '</a>'); } /** * Get the extension name and version for the footer */ private static function getFooterName(string $name): string { $name = JText::_($name); $alias = \RegularLabs\Library\Extension::getAliasByName($name); $suffix = self::getVersionSuffix($alias); return '<a href="https://regularlabs.com/' . $alias . '" target="_blank">' . $name . '</a>' . $suffix; } /** * Get the review text for the footer */ private static function getFooterReview(string $name): string { $alias = \RegularLabs\Library\Extension::getAliasByName($name); $jed_url = 'http://regl.io/jed-' . $alias . '#reviews'; return \RegularLabs\Library\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 */ private static function getMessageText(string $alias, string $name, string $version): string { [$url, $onclick] = self::getUpdateLink($alias, $version); $href = $onclick ? '' : 'href="' . $url . '" target="_blank" '; $onclick = $onclick ? 'onclick="' . $onclick . '" ' : ''; $is_pro = str_contains($version, 'PRO'); $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 text-bg-success">' . '<span class="icon-upload"></span> ' . \RegularLabs\Library\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 text-bg-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 \RegularLabs\Library\StringHelper::html_entity_decoder($msg); } /** * Get the url and onclick function for the update link */ private static function getUpdateLink(string $alias, string $version): array { $jversion = self::getMajorJoomlaVersion(); if ($jversion != 4) { return ['https://regularlabs.com/' . $alias . '/features', '']; } $is_pro = str_contains($version, 'PRO'); 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, '']; } return ['index.php?option=com_regularlabsmanager', '']; } /** * Get the version for the footer name */ private static function getVersionSuffix(string $alias): string { $version = self::get($alias); if (!$version) { return ''; } if (str_contains($version, 'PRO')) { return ' v' . str_replace('PRO', '', $version) . ' <small>[PRO]</small>'; } if (str_contains($version, 'FREE')) { return ' v' . str_replace('FREE', '', $version) . ' <small>[FREE]</small>'; } return ' v' . $version; } } home/opticamezl/www/newok/libraries/src/Version.php 0000644 00000020017 15173221714 0016516 0 ustar 00 <?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; use Joomla\CMS\Cache\CacheController; use Joomla\CMS\Cache\CacheControllerFactoryInterface; use Joomla\CMS\Cache\Controller\CallbackController; use Joomla\CMS\Date\Date; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Version information class for the Joomla CMS. * * @since 1.0 */ final class Version { /** * Product name. * * @var string * @since 3.5 */ public const PRODUCT = 'Joomla!'; /** * Major release version. * * @var integer * @since 3.8.0 */ public const MAJOR_VERSION = 4; /** * Minor release version. * * @var integer * @since 3.8.0 */ public const MINOR_VERSION = 4; /** * Patch release version. * * @var integer * @since 3.8.0 */ public const PATCH_VERSION = 14; /** * 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 */ public const EXTRA_VERSION = ''; /** * Development status. * * @var string * @since 3.5 */ public const DEV_STATUS = 'Stable'; /** * Code name. * * @var string * @since 3.5 */ public const CODENAME = 'Pamoja'; /** * Release date. * * @var string * @since 3.5 */ public const RELDATE = '30-September-2025'; /** * Release time. * * @var string * @since 3.5 */ public const RELTIME = '16:00'; /** * Release timezone. * * @var string * @since 3.5 */ public const RELTZ = 'GMT'; /** * Copyright Notice. * * @var string * @since 3.5 */ public const COPYRIGHT = '(C) 2005 Open Source Matters, Inc. <https://www.joomla.org>'; /** * Link text. * * @var string * @since 3.5 */ public const URL = '<a href="https://www.joomla.org">Joomla!</a> is Free Software released under the GNU General Public License.'; /** * Media version string * * @var string * @since 4.2.0 */ private static $mediaVersion = null; /** * Check if we are in development mode * * @return boolean * * @since 3.4.3 */ public function isInDevelopmentState(): bool { 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(string $minimum): bool { 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(): string { 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(): string { $version = self::MAJOR_VERSION . '.' . self::MINOR_VERSION . '.' . self::PATCH_VERSION; if (!empty(self::EXTRA_VERSION)) { $version .= '-' . self::EXTRA_VERSION; } 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(): string { 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(string $suffix = '', bool $mask = false, bool $addVersion = true): string { if ($suffix === '') { $suffix = 'Framework'; } if ($addVersion) { $suffix .= '/' . self::MAJOR_VERSION . '.' . self::MINOR_VERSION; } // If masked pretend to look like Mozilla 5.0 but still identify ourselves. return ($mask ? 'Mozilla/5.0 ' : '') . self::PRODUCT . '/' . $this->getShortVersion() . ($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(): string { return md5($this->getLongVersion() . Factory::getApplication()->get('secret') . (new 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(): string { // Load the media version and cache it for future use if (self::$mediaVersion === null) { self::$mediaVersion = $this->getMediaVersionCache() ->get([$this, 'generateMediaVersion'], [], md5('_media_version' . $this->getLongVersion())); } return self::$mediaVersion; } /** * Function to refresh the media version * * @return Version Instance of $this to allow chaining. * * @since 3.2 */ public function refreshMediaVersion(): Version { return $this->setMediaVersion($this->generateMediaVersion()); } /** * 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(string $mediaVersion): Version { // Do not allow empty media versions if (!empty($mediaVersion)) { self::$mediaVersion = $mediaVersion; $this->getMediaVersionCache() ->store(['result' => $mediaVersion, 'output' => ''], md5('_media_version' . $this->getLongVersion())); } return $this; } /** * Get cache instance for MediaVersion caching. * * @return CacheController * * @since 4.2.0 */ private function getMediaVersionCache(): CacheController { /** @var CallbackController $cache */ $cache = Factory::getContainer()->get(CacheControllerFactoryInterface::class) ->createCacheController('callback', ['defaultgroup' => '_media_version', 'caching' => true]); $cache->setLifeTime(5259600); // Disable cache when Debug is enabled if (JDEBUG) { $cache->setCaching(false); } return $cache; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings