var feedArray = ArrayNew(1); var feedData = StructNew(); var feedStream = ArrayNew(1); var appConfigStruct = getAppConfig(); var postQty = arguments.maxPosts; var d = 1; var dt = ""; var contentDate = ""; var maxWords = ""; var postID = ""; var postMsg = ""; var postMsgClean = ""; var fdImageData = StructNew(); if ( LEN(TRIM(arguments.maxPostWords)) AND IsNumeric(arguments.maxPostWords) ) maxWords = arguments.maxPostWords; // Get the the Twitter feed form the designated Account feedStream = application.ptSocialMedia.wordpressFeedsDAO.getWordPressBlogRSS(arguments.feedCriteria); if ( arguments.showFeedDump ) // TODO: Add contributor rights check around this DUMP application.ptSocialMedia.utils.doDUMP(feedStream,"WordPress-feedStream (#arguments.FeedID#)",0); // Make sure the feedStream.items exist and contains an Array if ( StructKeyExists(feedStream,"items") AND IsArray(feedStream.items) ) { // If XML feed returns items only loop over the maxPost qty if ( ArrayLen(feedStream.items) LTE arguments.maxPosts ) postQty = ArrayLen(feedStream.items); for ( d=1; d LTE postQty; d=d+1 ) { PostID = ""; // Post ID (Use HASH function to create a unique Blog ID) // http://blogs.potsdam.edu/admissions/?p=733 // http://blogs.potsdam.edu/network/2011/03/17/announce-cms-maintenance-2/ if ( StructKeyExists(feedStream.items[d],"ID") AND LEN(TRIM(feedStream.items[d].ID)) ) { // Convert Blog PostID to a oneway hash to create a uniqueID // Note: use same function to match values PostID = buildUniquePostID(feedStream.items[d].ID); } // Do not Build a Feed Data Struct for Posts that are part of the Excluded Posts List if ( ListFindNoCase(arguments.excludedPostIDs,PostID) EQ 0 ) { // Build the empty feed data structure feedData = application.ptSocialMedia.feedController.buildFeedDataFormat(); // Fill in the feedData structure with the post info // General Post Metadata feedService = Application.ptSocialMedia.wordpressFeedsDAO.getWordPressMetadata(); StructAppend(feedData,feedService,true); // Feed ID feedData.FeedID = arguments.FeedID; // Feed Type feedData.FeedType = "blog"; // Feed Name if ( StructKeyExists(feedStream,"feed") AND StructKeyExists(feedStream.feed,"title") ) feedData.FeedName = feedStream.feed.title; // On WordPress a FeedImage is not being used ... So need use the one from the Config Element if ( LEN(TRIM(arguments.feedImageURL)) ) feedData.FeedImage = arguments.feedImageURL; // if no other Thumbnail URL was provided use the Service Logo if ( LEN(TRIM(feedData.FeedImage)) EQ 0 ) feedData.FeedImage = feedData.ServiceLogo; // Feed Link feedData.FeedLink = TRIM(arguments.feedCriteria); //if ( StructKeyExists(feedStream,"feed") ) { // Feed Published Dates /* if ( StructKeyExists(feedStream.feed,"DateUpdated") ) { dt = feedStream.feed.DateUpdated; if ( IsDate(dt) ) { feedData.PublishedDate = Application.ptSocialMedia.Date.formatDateTimeISO8601(dt,dt,0); feedData.csFormattedPublishedDate = Application.ptSocialMedia.Date.csDateFormat(dt,dt); //DateFormat(dt),TimeFormat(dt) } } */ //} // Post Content - Published Dates if ( StructKeyExists(feedStream.items[d],"date") ) { // This DT is set at UTC-0000 ... // Since it comes through the CF server as a CF datetime stamp // CF thinks it is a datetime in the Servers TimeZone // Viewed the raw XML feed not processed by CF to confirm dt = feedStream.items[d].date; if ( application.ptSocialMedia.date.IsRealDate(dt) ) { // Force the DateTime to be converted to ISO8601 GNT (UTC-0000) gmtDT = Application.ptSocialMedia.Date.formatDateTimeISO8601(dt,dt,0); // set the the PublishedDate and Content Date for the FeedData gmtDTdata = Application.ptSocialMedia.date.ISOToDateTimeStruct(gmtDT); feedData.PublishedDate = gmtDTdata.ISO8601DateTime; feedData.csFormattedPublishedDate = gmtDTdata.csDateTime; feedData.Content.Date = gmtDTdata.ISO8601DateTime; feedData.Content.CSFormattedDate = gmtDTdata.csDateTime; } } // Post Content - Post Title if ( StructKeyExists(feedStream.items[d],"title") ) feedData.Content.Title = feedStream.items[d].Title; // Post Content - Published Dates /* if ( StructKeyExists(feedStream.items[d],"date") ) { contentDate = feedStream.items[d].date; if ( IsDate(contentDate) ) { feedData.Content.Date = Application.ptSocialMedia.Date.formatDateTimeISO8601(DateFormat(contentDate),TimeFormat(contentDate)); feedData.Content.CSFormattedDate = Application.ptSocialMedia.Date.csDateFormat(DateFormat(contentDate),TimeFormat(contentDate)); } } */ // Post Content - Content Block if ( StructKeyExists(feedStream.items[d],"content") ) { postMsg = feedStream.items[d].content; // Strip The HTML postMsgClean = ReReplace(postMsg, "<[^>]*>", "", "all"); //feedData.Content.text = postCleanMsg; //feedData.Content.textformatted = postMsg; if ( LEN(TRIM(maxWords)) ) { // Use Word Limiter (maxWords) feedData.Content.message = Application.ptSocialMedia.data.trimStringByWordCount(postMsgClean,maxWords,1); } else { feedData.Content.message = postMsgClean; } } // Post Content - Post ID (Use HASH function to create a unique Blog ID) // http://blogs.potsdam.edu/admissions/?p=733 // http://blogs.potsdam.edu/network/2011/03/17/announce-cms-maintenance-2/ /* if ( StructKeyExists(feedStream.items[d],"ID") AND LEN(TRIM(feedStream.items[d].ID)) ) { // Convert Blog PostID to a oneway hash to create a uniqueID // Note: use same function to match values feedData.Content.postid = buildUniquePostID(feedStream.items[d].ID); //feedData.Content.postid = feedStream.items[d].ID; } */ // Post Content - PostID (Used a HASH function to create a unique PostID ) if ( LEN(TRIM(PostID)) ) feedData.Content.postid = PostID; // Post Content - Post Link if ( StructKeyExists(feedStream.items[d],"link") ) feedData.Content.link = feedStream.items[d].link; // Post Source Info // Post Source - Name (Author) if ( StructKeyExists(feedStream.items[d],"author") ) { feedData.Source.Name = feedStream.items[d].author; feedData.Source.UserName = feedStream.items[d].author; } // Post Source - Link (AuthorURL) if ( StructKeyExists(feedStream.items[d],"authorurl") ) feedData.Source.Link = feedStream.items[d].authorurl; // FB Like and Twitter Tweet Buttons if ( LEN(TRIM(feedData.Content.Link)) ) { feedData.FBLikeBtn.link = feedData.Content.Link; feedData.TweetBtn.link = feedData.Content.Link; } else if ( LEN(TRIM(feedData.Source.Link)) ) { feedData.FBLikeBtn.link = feedData.Source.Link; feedData.TweetBtn.link = feedData.Source.Link; } else { feedData.FBLikeBtn.link = feedData.FEEDLINK; feedData.TweetBtn.link = feedData.FEEDLINK; } // Twitter Tweet Text if ( LEN(TRIM(feedData.Content.Title)) ) feedData.TweetBtn.message = Left(feedData.Content.Title,120); else if ( LEN(TRIM(feedData.Content.message)) ) feedData.TweetBtn.message = Left(feedData.Content.message,120); else if ( LEN(TRIM(feedData.Content.description)) ) feedData.TweetBtn.message = Left(feedData.Content.description,120); ArrayAppend(feedArray,feedData); } } } return feedArray; return hash(arguments.str, arguments.algorithm); // encrypt: CFMX_COMPAT (default), AES (standard edition CF), BLOWFISH, DES, and DESEDE // hash: CFMX_COMPAT (default), MD5, SHA, SHA-256 //var algorithm = "" //var encoding = ""; //Base64, hex, or uu //var key = ""; // Don't use a key of unique IDs //var encString = ""; //if ( arguments.oneway ) encString = hash(arguments.str, arguments.algorithm); //, arguments.encoding //else //encString = encrypt(arguments.str, arguments.key, arguments.algorithm, arguments.encoding); return encString; --->