Beispiel #1
0
} else {
    $siteAccessArray = array($ini->variable('SiteSettings', 'DefaultAccess'));
}
// adding the mobile sitemap site accesses
if ($xrowsitemapINI->hasVariable('MobileSitemapSettings', 'AvailableSiteAccessList')) {
    $siteAccessArray = array_merge($siteAccessArray, $xrowsitemapINI->variable('MobileSitemapSettings', 'AvailableSiteAccessList'));
}
$Module = $Params['Module'];
$access = $GLOBALS['eZCurrentAccess']['name'];
if (is_array($siteAccessArray) && count($siteAccessArray) > 0) {
    if (!in_array($access, $siteAccessArray)) {
        return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
    }
}
$index = new xrowSitemapIndex();
$dirArray = array(eZSys::storageDirectory() . '/sitemap/' . xrowSitemapTools::domain(), eZSys::storageDirectory() . '/sitemap/' . xrowSitemapTools::domain() . '/' . xrowSitemapTools::FILETYP_ARCHIVE, eZSys::storageDirectory() . '/sitemap/' . xrowSitemapTools::domain() . '/' . xrowSitemapTools::FILETYP_STANDARD);
foreach ($dirArray as $item) {
    addFiles($index, $item, $dirArray);
}
function addFiles(&$index, $dirname, $dirArray)
{
    try {
        $dir = new eZClusterDirectoryIterator($dirname);
    } catch (Exception $e) {
        if ($e instanceof UnexpectedValueException) {
            eZDebug::writeDebug("Cannot add {$dirname} to the sitemaps index because it does not exist");
            return;
        }
    }
    foreach ($dir as $file) {
        $f = eZClusterFileHandler::instance($file->name());
 private static function getSitemapImageItemFromDataMap(array $dataMap)
 {
     $images = array();
     foreach ($dataMap as $attributeIdentifier => $attribute) {
         switch ($attribute->DataTypeString) {
             case 'ezimage':
                 if ($attribute->hasContent()) {
                     $imagedata = $attribute->content();
                     $image = new xrowSitemapItemImage();
                     $aliasdata = $imagedata->attribute('large');
                     $image->url = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url'];
                     if ($imagedata->attribute('alternative_text')) {
                         $image->caption = $imagedata->attribute('alternative_text');
                     }
                     $images[] = $image;
                 }
                 break;
         }
     }
     return $images;
 }
 function addImage(eZContentObjectTreeNode $node)
 {
     $images = false;
     $ini = eZINI::instance('xrowsitemap.ini');
     $dm = $node->attribute('data_map');
     foreach ($dm as $attribute) {
         switch ($attribute->DataTypeString) {
             case 'ezimage':
                 if ($attribute->hasContent()) {
                     if ($images === false) {
                         $images = array();
                     }
                     $imagedata = $attribute->content();
                     $image = new xrowSitemapItemImage();
                     if ($ini->hasVariable('SitemapSettings', 'ImageAlias')) {
                         $aliasdata = $imagedata->attribute($ini->variable('SitemapSettings', 'ImageAlias'));
                         $image->url = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url'];
                     } else {
                         $aliasdata = $imagedata->attribute('original');
                         $image->url = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url'];
                     }
                     if ($imagedata->attribute('alternative_text')) {
                         $image->caption = $imagedata->attribute('alternative_text');
                     }
                     $image->title = $node->attribute('name');
                     $images[] = $image;
                 }
                 break;
         }
     }
     return $images;
 }