Beispiel #1
0
<?php

/**
 * @package nxcContentClassDiff
 * @author  Serhey Dolgushev <*****@*****.**>
 * @date    16 Aug 2012
 **/
$dom = nxcContentClassDiffHelper::getAllClassesXML();
header('Content-Type: text/xml');
echo $dom->saveXML();
eZExecution::cleanExit();
Beispiel #2
0
        $isSourceUpdated = true;
    } else {
        $error = ezpI18n::tr('extension/nxc_content_class_diff', 'Compare source is not available or does not contain any class definitions');
    }
    @unlink($cookie);
} elseif ($module->isCurrentAction('Copmare')) {
    $compare = true;
    $compareOptions = (array) $http->postVariable('compare_options');
    $file = eZClusterFileHandler::instance('var/class_diff_source.xml');
    $sourceClassesDefinition = $file->fetchContents();
    if (nxcContentClassDiffHelper::isValidClassesDefinition($sourceClassesDefinition)) {
        $currentDom = nxcContentClassDiffHelper::getAllClassesXML();
        $sourceDom = new DOMDocument('1.0', 'utf-8');
        $sourceDom->loadXML($sourceClassesDefinition);
        $currentClassesInfo = nxcContentClassDiffHelper::parseClassesDefinition($currentDom, $compareOptions);
        $sourceClassesInfo = nxcContentClassDiffHelper::parseClassesDefinition($sourceDom, $compareOptions);
        foreach ($currentClassesInfo as $identifier => $classInfo) {
            if (isset($compareOptions['class_ids']) && in_array(-1, $compareOptions['class_ids']) === false) {
                $class = eZContentClass::fetchByIdentifier($identifier, false);
                if (in_array($class['id'], $compareOptions['class_ids'], false) === false) {
                    continue;
                }
            }
            if (isset($sourceClassesInfo[$identifier]) === false) {
                $diff[$identifier] = $classInfo;
            } elseif (serialize($classInfo['attributes']) != serialize($sourceClassesInfo[$identifier]['attributes'])) {
                $diff[$identifier] = $classInfo;
            }
        }
        foreach ($sourceClassesInfo as $identifier => $classInfo) {
            if (isset($compareOptions['class_ids']) && in_array(-1, $compareOptions['class_ids']) === false) {