当前位置: 首页>>代码示例>>PHP>>正文


PHP eZDir::filenamePath方法代码示例

本文整理汇总了PHP中eZDir::filenamePath方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDir::filenamePath方法的具体用法?PHP eZDir::filenamePath怎么用?PHP eZDir::filenamePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZDir的用法示例。


在下文中一共展示了eZDir::filenamePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gmapStaticImage

 /**
  *
  * http://maps.googleapis.com/maps/api/staticmap?zoom=13&size=600x300&maptype=roadmap&markers=color:blue|{first_set( $attribute.content.latitude, '0.0')},{first_set( $attribute.content.longitude, '0.0')}
  * @param array $parameters
  * @param eZContentObjectAttribute $attribute
  * @return string
  */
 public static function gmapStaticImage(array $parameters, eZContentObjectAttribute $attribute, $extraCacheFileNameStrings = array())
 {
     $cacheParameters = array(serialize($parameters));
     $cacheFile = $attribute->attribute('id') . implode('-', $extraCacheFileNameStrings) . '-' . md5(implode('-', $cacheParameters)) . '.cache';
     $extraPath = eZDir::filenamePath($attribute->attribute('id'));
     $cacheDir = eZDir::path(array(eZSys::cacheDirectory(), 'gmap_static', $extraPath));
     // cacenllo altri file con il medesimo attributo
     $fileList = array();
     $deleteItems = eZDir::recursiveList($cacheDir, $cacheDir, $fileList);
     foreach ($fileList as $file) {
         if ($file['type'] == 'file' && $file['name'] !== $cacheFile) {
             unlink($file['path'] . '/' . $file['name']);
         }
     }
     $cachePath = eZDir::path(array($cacheDir, $cacheFile));
     $args = compact('parameters', 'attribute');
     $cacheFile = eZClusterFileHandler::instance($cachePath);
     $result = $cacheFile->processCache(array('OCOperatorsCollectionsTools', 'gmapStaticImageRetrieve'), array('OCOperatorsCollectionsTools', 'gmapStaticImageGenerate'), null, null, $args);
     return $result;
 }
开发者ID:OpencontentCoop,项目名称:ocoperatorscollection,代码行数:27,代码来源:ocoperatorscollectionstools.php

示例2: generateViewCacheFile

 static function generateViewCacheFile($user, $nodeID, $offset, $layout, $language, $viewMode, $viewParameters = false, $cachedViewPreferences = false, $viewCacheTweak = '')
 {
     $cacheNameExtra = '';
     $ini = eZINI::instance();
     if (!$language) {
         $language = false;
     }
     if (!$viewCacheTweak && $ini->hasVariable('ContentSettings', 'ViewCacheTweaks')) {
         $viewCacheTweaks = $ini->variable('ContentSettings', 'ViewCacheTweaks');
         if (isset($viewCacheTweaks[$nodeID])) {
             $viewCacheTweak = $viewCacheTweaks[$nodeID];
         } else {
             if (isset($viewCacheTweaks['global'])) {
                 $viewCacheTweak = $viewCacheTweaks['global'];
             }
         }
     }
     // should we use current siteaccess or let several siteaccesse share cache?
     if (strpos($viewCacheTweak, 'ignore_siteaccess_name') === false) {
         $currentSiteAccess = $GLOBALS['eZCurrentAccess']['name'];
     } else {
         $currentSiteAccess = $ini->variable('SiteSettings', 'DefaultAccess');
     }
     $cacheHashArray = array($nodeID, $viewMode, $language, $offset, $layout);
     // several user related cache tweaks
     if (strpos($viewCacheTweak, 'ignore_userroles') === false) {
         $cacheHashArray[] = implode('.', $user->roleIDList());
     }
     if (strpos($viewCacheTweak, 'ignore_userlimitedlist') === false) {
         $cacheHashArray[] = implode('.', $user->limitValueList());
     }
     if (strpos($viewCacheTweak, 'ignore_discountlist') === false) {
         $cacheHashArray[] = implode('.', eZUserDiscountRule::fetchIDListByUserID($user->attribute('contentobject_id')));
     }
     $cacheHashArray[] = eZSys::indexFile();
     // Add access type to cache hash if current access is uri type (so uri and host doesn't share cache)
     if (strpos($viewCacheTweak, 'ignore_siteaccess_type') === false && $GLOBALS['eZCurrentAccess']['type'] === eZSiteAccess::TYPE_URI) {
         $cacheHashArray[] = eZSiteAccess::TYPE_URI;
     }
     // Make the cache unique for every logged in user
     if (strpos($viewCacheTweak, 'pr_user') !== false and !$user->isAnonymous()) {
         $cacheNameExtra = $user->attribute('contentobject_id') . '-';
     }
     // Make the cache unique for every case of view parameters
     if (strpos($viewCacheTweak, 'ignore_viewparameters') === false && $viewParameters) {
         $vpString = '';
         ksort($viewParameters);
         foreach ($viewParameters as $key => $value) {
             if (!$key || $key === '_custom') {
                 continue;
             }
             $vpString .= 'vp:' . $key . '=' . $value;
         }
         $cacheHashArray[] = $vpString;
     }
     // Make the cache unique for every case of the preferences
     if ($cachedViewPreferences === false) {
         $depPreferences = $ini->variable('ContentSettings', 'CachedViewPreferences');
     } else {
         $depPreferences = $cachedViewPreferences;
     }
     if (strpos($viewCacheTweak, 'ignore_userpreferences') === false && isset($depPreferences[$viewMode])) {
         $depPreferences = explode(';', $depPreferences[$viewMode]);
         $pString = '';
         // Fetch preferences for the specified user
         $preferences = eZPreferences::values($user);
         foreach ($depPreferences as $pref) {
             $pref = explode('=', $pref);
             if (isset($pref[0])) {
                 if (isset($preferences[$pref[0]])) {
                     $pString .= 'p:' . $pref[0] . '=' . $preferences[$pref[0]] . ';';
                 } else {
                     if (isset($pref[1])) {
                         $pString .= 'p:' . $pref[0] . '=' . $pref[1] . ';';
                     }
                 }
             }
         }
         $cacheHashArray[] = $pString;
     }
     $cacheFile = $nodeID . '-' . $cacheNameExtra . md5(implode('-', $cacheHashArray)) . '.cache';
     $extraPath = eZDir::filenamePath($nodeID);
     $cacheDir = eZDir::path(array(eZSys::cacheDirectory(), $ini->variable('ContentSettings', 'CacheDir'), $currentSiteAccess, $extraPath));
     $cachePath = eZDir::path(array($cacheDir, $cacheFile));
     return array('cache_path' => $cachePath, 'cache_dir' => $cacheDir, 'cache_file' => $cacheFile);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:86,代码来源:eznodeviewfunctions.php

示例3: cleanup

    static function cleanup( $nodeList, $userId = false )
    {
        // The view-cache has a different storage structure than before:
        // var/cache/content/<siteaccess>/<extra-path>/<nodeID>-<hash>.cache
        // Also it uses the cluster file handler to delete files using a wildcard (glob style).
        $ini = eZINI::instance();
        $extraCacheName = '';
        $cacheBaseDir = eZDir::path( array( eZSys::cacheDirectory(), $ini->variable( 'ContentSettings', 'CacheDir' ) ) );
        $fileHandler = eZClusterFileHandler::instance();

        if ( $userId !== false && is_numeric( $userId ) )
        {
            $extraCacheName = $userId . '-';
        }

        // Figure out the siteaccess which are related, first using the new
        // INI setting RelatedSiteAccessList then the old existing one
        // AvailableSiteAccessList
        if ( $ini->hasVariable( 'SiteAccessSettings', 'RelatedSiteAccessList' ) &&
             $relatedSiteAccessList = $ini->variable( 'SiteAccessSettings', 'RelatedSiteAccessList' ) )
        {
            if ( !is_array( $relatedSiteAccessList ) )
            {
                $relatedSiteAccessList = array( $relatedSiteAccessList );
            }
            $relatedSiteAccessList[] = $GLOBALS['eZCurrentAccess']['name'];
            $siteAccesses = array_unique( $relatedSiteAccessList );
        }
        else
        {
            $siteAccesses = $ini->variable( 'SiteAccessSettings', 'AvailableSiteAccessList' );
        }
        if ( !$siteAccesses )
        {
            return;
        }

        foreach ( $nodeList as $nodeID )
        {
            $extraPath = eZDir::filenamePath( $nodeID );
            $fileHandler->fileDeleteByDirList( $siteAccesses, $cacheBaseDir, "$extraPath$nodeID-$extraCacheName" );
        }
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:43,代码来源:ezcontentcache.php


注:本文中的eZDir::filenamePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。