CoreFiles by mySites.guru
ActiveSiteTemplate.php56 lines, 1,353 bytes, from Joomla_6.2.0-Stable-Full_Package.zip
Raw History Compare with 6.1.4
md5
728eac8d4c12d2900f9fa9e6f9b2b345
sha1
6559541a3f6f1116978a5da9d73515ef18d0993c
sha256
d537f2a2d2cfab34f590b878e646b75dfa89e0a81c4606c53a0cfe2d12e183ad
<?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\Language\Text;

// 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    = $this->getDatabase();
        $query = $db->createQuery()
            ->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) {
            $this->getApplication()->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');

            return new \stdClass();
        }
    }
}

The same content is in 44 releases, Joomla 6.0.0-rc1 to 6.2.1-rc1. See them all, or every version of this file.