CoreFiles by mySites.guru
compare.php82 lines, 3,656 bytes, from Joomla_5.4.11-Stable-Full_Package.zip
Raw History Compare with 5.4.10
md5
37c044f04191899953b4c444058b3036
sha1
22dcc5088f22018222b1f3dfa427bf4f8146d5ae
sha256
c7661a5da301e9f60d5d013f4955c7a6a70efe62dc8b3339203f3d9e0b860e0b
<?php

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

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/** @var \Joomla\Component\Contenthistory\Administrator\View\Compare\HtmlView $this */

Session::checkToken('get') or die(Text::_('JINVALID_TOKEN'));

$version2 = $this->items[0];
$version1 = $this->items[1];
$object1  = $version1->data;
$object2  = $version2->data;

/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->getDocument()->getWebAssetManager();
$wa->useScript('com_contenthistory.admin-compare-compare');

?>
<div role="main">
    <h1 class="mb-3"><?php echo Text::_('COM_CONTENTHISTORY_COMPARE_TITLE'); ?></h1>

    <table id="diff" class="table">
        <caption class="visually-hidden">
            <?php echo Text::_('COM_CONTENTHISTORY_COMPARE_CAPTION'); ?>
        </caption>
        <thead>
            <tr>
                <th scope="col" class="w-25"><?php echo Text::_('COM_CONTENTHISTORY_PREVIEW_FIELD'); ?></th>
                <th scope="col"><?php echo Text::_('COM_CONTENTHISTORY_COMPARE_OLD'); ?></th>
                <th scope="col"><?php echo Text::_('COM_CONTENTHISTORY_COMPARE_NEW'); ?></th>
                <th scope="col"><?php echo Text::_('COM_CONTENTHISTORY_COMPARE_DIFF'); ?></th>
            </tr>
        </thead>
        <tbody>
        <?php foreach ($object1 as $name => $value) : ?>
            <?php if (isset($value->value) && isset($object2->$name->value) && $value->value != $object2->$name->value) : ?>
                <?php if (is_object($value->value)) : ?>
                    <tr>
                        <td colspan="4">
                            <strong><?php echo $this->escape($value->label); ?></strong>
                        </td>
                    </tr>
                    <?php foreach ($value->value as $subName => $subValue) : ?>
                        <?php $newSubValue = $object2->$name->value->$subName->value ?? ''; ?>
                        <?php if ($subValue->value || $newSubValue) : ?>
                            <?php if ($subValue->value != $newSubValue) : ?>
                                <tr>
                                    <th scope="row"><em>&nbsp;&nbsp;<?php echo $this->escape($subValue->label); ?></em></th>
                                    <td class="original"><?php echo $this->escape($subValue->value); ?></td>
                                    <td class="changed" ><?php echo $this->escape($newSubValue); ?></td>
                                    <td class="diff">&nbsp;</td>
                                </tr>
                            <?php endif; ?>
                        <?php endif; ?>
                    <?php endforeach; ?>
                <?php else : ?>
                    <tr>
                        <th scope="row">
                            <?php echo $this->escape($value->label); ?>
                        </th>
                        <td class="original"><?php echo $this->escape($value->value); ?></td>
                        <?php $object2->$name->value = is_object($object2->$name->value) ? json_encode($object2->$name->value) : $object2->$name->value; ?>
                        <td class="changed"><?php echo $this->escape($object2->$name->value); ?></td>
                        <td class="diff">&nbsp;</td>
                    </tr>
                <?php endif; ?>
            <?php endif; ?>
        <?php endforeach; ?>
        </tbody>
    </table>
</div>

No other release has this exact content. See every version of this file.