CoreFiles by mySites.guru
ActiveSiteTemplate.php58 lines, 1,403 bytes, from Joomla_4.2.4-Stable-Full_Package.zip
Raw History Compare with 4.2.3
md5
f4322f9ddc210796b6af5e9d600af0c9
sha1
fef2dda01ef1347aef826eb1c91bdd761195ed00
sha256
39c4b592b2549c369541a6becd2aab934fb825bef1d7c9b751e5d77876a5142b
<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  Editors.tinymce
 *
 * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Plugin\Editors\TinyMCE\PluginTraits;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use RuntimeException;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Gets the active Site template style.
 *
 * @since  4.1.0
 */
trait ActiveSiteTemplate
{
    /**
     * Helper function to get the active Site template style.
     *
     * @return  object
     *
     * @since   4.1.0
     */
    protected function getActiveSiteTemplate()
    {
        $db    = Factory::getContainer()->get('db');
        $query = $db->getQuery(true)
            ->select('*')
            ->from($db->quoteName('#__template_styles'))
            ->where(
                [
                    $db->quoteName('client_id') . ' = 0',
                    $db->quoteName('home') . ' = ' . $db->quote('1'),
                ]
            );

        $db->setQuery($query);

        try {
            return $db->loadObject();
        } catch (RuntimeException $e) {
            $this->app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');

            return new \stdClass();
        }
    }
}

The same content is in 16 releases, Joomla 4.2.1 to 4.3.0-alpha2. See them all, or every version of this file.