private static IEnumerable <string> AddDatePart(Item item, IEnumerable <string> folderNames)
            {
                var dateFolderAbbrev = string.Join(string.Empty, folderNames);
                var itemUrlPart      = string.Format("{0}-{1}", MainUtil.EncodeName(item.Name), dateFolderAbbrev);

                yield return(itemUrlPart);
            }
Exemple #2
0
        /// <summary>
        /// The get media path.
        /// </summary>
        /// <param name="mediaItem">
        /// The media item.
        /// </param>
        /// <param name="extension">
        /// The extension.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public string GetMediaPath(MediaItem mediaItem, string extension = "")
        {
            string newFileName = MainUtil.EncodeName(mediaItem.Name);

            return
                (mediaItem.MediaPath.TrimStart('/')
                 .Replace(mediaItem.DisplayName, newFileName + "." + extension)
                 .ToLower());
        }
Exemple #3
0
        private string EncodeUrlToken(string urlToken, bool removeInvalidPathCharacters)
        {
            if (string.IsNullOrEmpty(urlToken))
            {
                return(null);
            }
            if (removeInvalidPathCharacters)
            {
                urlToken = MainUtil.EncodeName(urlToken);
            }

            return(Uri.EscapeDataString(urlToken).Replace(_urlTokenDelimiter, _encodedDelimiter));
        }
Exemple #4
0
 public override string GetItemUrl(Sitecore.Data.Items.Item item, UrlOptions options)
 {
     try
     {
         if (BucketManager.IsItemContainedWithinBucket(item))
         {
             var bucketItem = item.GetParentBucketItemOrParent();
             if (bucketItem != null && bucketItem.IsABucket())
             {
                 var    bucketUrl = base.GetItemUrl(bucketItem, options);
                 string itemName  = MainUtil.EncodeName(item.Name);
                 return(FileUtil.MakePath(bucketUrl, itemName));
             }
         }
     }
     catch (Exception ex)
     {
         Sitecore.Diagnostics.Log.Error(ex.Message, ex, this);
     }
     return(base.GetItemUrl(item, options));
 }
        public UrlString GetUrl(Item wildcardItem)
        {
            string wildcardUrl = LinkManager.GetItemUrl(wildcardItem);

            return(new UrlString(wildcardUrl.Replace(MainUtil.EncodeName("*"), MainUtil.EncodeName(Name))));
        }